From git at git.haskell.org Sun Apr 1 21:25:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 Apr 2018 21:25:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Bump haddock submodule again (6d7eecf) Message-ID: <20180401212554.EC61A3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/6d7eecff7948ad77854f834f55b4d4f942276ad3/ghc >--------------------------------------------------------------- commit 6d7eecff7948ad77854f834f55b4d4f942276ad3 Author: Ben Gamari Date: Thu Mar 29 13:59:00 2018 -0400 Bump haddock submodule again >--------------------------------------------------------------- 6d7eecff7948ad77854f834f55b4d4f942276ad3 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 7064cd5..37e9341 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 7064cd54e016b2f8e0a8c2ba8d3dd5edea9071ca +Subproject commit 37e93411ef8ee673eebd6c56b8db3f2e851572c9 From git at git.haskell.org Sun Apr 1 21:45:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 Apr 2018 21:45:00 +0000 (UTC) Subject: [commit: ghc] branch 'wip/restore-ttg' created Message-ID: <20180401214500.34A7C3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/restore-ttg Referencing: 2f9766b1a757d66bec6a849a4e4079b81fec3908 From git at git.haskell.org Sun Apr 1 21:45:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 Apr 2018 21:45:03 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg: Refresh D4199 for current master (43fca9b) Message-ID: <20180401214503.1CF7D3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/restore-ttg Link : http://ghc.haskell.org/trac/ghc/changeset/43fca9b2c259ae1b61791a5da30a3fb2a8fe3a7c/ghc >--------------------------------------------------------------- commit 43fca9b2c259ae1b61791a5da30a3fb2a8fe3a7c Author: Alan Zimmerman Date: Wed Mar 28 23:35:43 2018 +0200 Refresh D4199 for current master >--------------------------------------------------------------- 43fca9b2c259ae1b61791a5da30a3fb2a8fe3a7c compiler/deSugar/Coverage.hs | 4 +- compiler/deSugar/DsMeta.hs | 6 +- compiler/hsSyn/HsBinds.hs | 38 ++++--- compiler/hsSyn/HsDecls.hs | 127 +++++++++++------------ compiler/hsSyn/HsExpr.hs | 195 +++++++++++++++++++----------------- compiler/hsSyn/HsExpr.hs-boot | 28 +++--- compiler/hsSyn/HsExtension.hs | 97 +++--------------- compiler/hsSyn/HsLit.hs | 35 +++---- compiler/hsSyn/HsPat.hs | 22 ++-- compiler/hsSyn/HsPat.hs-boot | 5 +- compiler/hsSyn/HsSyn.hs | 4 +- compiler/hsSyn/HsTypes.hs | 73 +++++++------- compiler/hsSyn/HsUtils.hs | 63 ++++++------ compiler/parser/Parser.y | 29 +++--- compiler/rename/RnExpr.hs | 2 +- compiler/typecheck/Inst.hs | 6 +- compiler/typecheck/TcAnnotations.hs | 2 +- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcEnv.hs | 6 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcMatches.hs | 10 +- compiler/typecheck/TcTypeable.hs | 8 +- utils/haddock | 2 +- 23 files changed, 344 insertions(+), 424 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 43fca9b2c259ae1b61791a5da30a3fb2a8fe3a7c From git at git.haskell.org Sun Apr 1 21:45:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 Apr 2018 21:45:06 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg: Restore TTG 1 (2f9766b) Message-ID: <20180401214506.18B213A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/restore-ttg Link : http://ghc.haskell.org/trac/ghc/changeset/2f9766b1a757d66bec6a849a4e4079b81fec3908/ghc >--------------------------------------------------------------- commit 2f9766b1a757d66bec6a849a4e4079b81fec3908 Author: Alan Zimmerman Date: Sun Apr 1 21:33:53 2018 +0200 Restore TTG 1 First commit restored >--------------------------------------------------------------- 2f9766b1a757d66bec6a849a4e4079b81fec3908 compiler/deSugar/Check.hs | 53 +-- compiler/deSugar/Coverage.hs | 8 +- compiler/deSugar/DsArrows.hs | 30 +- compiler/deSugar/DsExpr.hs | 7 +- compiler/deSugar/DsMeta.hs | 112 +++--- compiler/deSugar/DsUtils.hs | 63 ++-- compiler/deSugar/Match.hs | 71 ++-- compiler/deSugar/MatchLit.hs | 27 +- compiler/hsSyn/Convert.hs | 163 +++++---- compiler/hsSyn/HsBinds.hs | 105 ++++-- compiler/hsSyn/HsDecls.hs | 59 +-- compiler/hsSyn/HsExpr.hs | 34 +- compiler/hsSyn/HsExpr.hs-boot | 14 +- compiler/hsSyn/HsExtension.hs | 273 +++++++++++--- compiler/hsSyn/HsLit.hs | 64 +++- compiler/hsSyn/HsPat.hs | 294 +++++++++------ compiler/hsSyn/HsPat.hs-boot | 4 +- compiler/hsSyn/HsSyn.hs | 2 +- compiler/hsSyn/HsTypes.hs | 402 ++++++++++++++------- compiler/hsSyn/HsUtils.hs | 223 ++++++------ compiler/hsSyn/PlaceHolder.hs | 9 +- compiler/main/HscStats.hs | 2 +- compiler/main/InteractiveEval.hs | 3 +- compiler/parser/Parser.y | 100 ++--- compiler/parser/RdrHsSyn.hs | 130 +++---- compiler/rename/RnBinds.hs | 14 +- compiler/rename/RnExpr.hs | 46 ++- compiler/rename/RnFixity.hs | 5 +- compiler/rename/RnNames.hs | 8 +- compiler/rename/RnPat.hs | 93 ++--- compiler/rename/RnSource.hs | 14 +- compiler/rename/RnSplice.hs | 16 +- compiler/rename/RnSplice.hs-boot | 4 +- compiler/rename/RnTypes.hs | 283 ++++++++------- compiler/typecheck/Inst.hs | 16 +- compiler/typecheck/TcBinds.hs | 10 +- compiler/typecheck/TcDeriv.hs | 3 +- compiler/typecheck/TcExpr.hs | 43 ++- compiler/typecheck/TcGenDeriv.hs | 15 +- compiler/typecheck/TcGenFunctor.hs | 1 + compiler/typecheck/TcHsSyn.hs | 130 +++---- compiler/typecheck/TcHsType.hs | 81 +++-- compiler/typecheck/TcInstDcls.hs | 3 +- compiler/typecheck/TcPat.hs | 81 +++-- compiler/typecheck/TcPatSyn.hs | 86 ++--- compiler/typecheck/TcRnDriver.hs | 30 +- compiler/typecheck/TcTyClsDecls.hs | 12 +- compiler/typecheck/TcTyDecls.hs | 7 +- ghc/GHCi/UI/Info.hs | 4 +- .../parser/should_compile/DumpParsedAst.stderr | 25 +- .../parser/should_compile/DumpRenamedAst.stderr | 138 ++++--- .../tests/parser/should_compile/T14189.stderr | 13 +- testsuite/tests/perf/haddock/all.T | 1 + testsuite/tests/quasiquotation/T7918.hs | 4 +- utils/ghctags/Main.hs | 25 +- utils/haddock | 2 +- 56 files changed, 2075 insertions(+), 1390 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 2f9766b1a757d66bec6a849a4e4079b81fec3908 From git at git.haskell.org Mon Apr 2 02:44:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 02:44:14 +0000 (UTC) Subject: [commit: ghc] master: Track type variable scope more carefully. (faec8d3) Message-ID: <20180402024414.B23E83A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/faec8d358985e5d0bf363bd96f23fe76c9e281f7/ghc >--------------------------------------------------------------- commit faec8d358985e5d0bf363bd96f23fe76c9e281f7 Author: Richard Eisenberg Date: Mon Sep 4 22:27:17 2017 +0100 Track type variable scope more carefully. The main job of this commit is to track more accurately the scope of tyvars introduced by user-written foralls. For example, it would be to have something like this: forall a. Int -> (forall k (b :: k). Proxy '[a, b]) -> Bool In that type, a's kind must be k, but k isn't in scope. We had a terrible way of doing this before (not worth repeating or describing here, but see the old tcImplicitTKBndrs and friends), but now we have a principled approach: make an Implication when kind-checking a forall. Doing so then hooks into the existing machinery for preventing skolem-escape, performing floating, etc. This also means that we bump the TcLevel whenever going into a forall. The new behavior is done in TcHsType.scopeTyVars, but see also TcHsType.tc{Im,Ex}plicitTKBndrs, which have undergone significant rewriting. There are several Notes near there to guide you. Of particular interest there is that Implication constraints can now have skolems that are out of order; this situation is reported in TcErrors. A major consequence of this is a slightly tweaked process for type- checking type declarations. The new Note [Use SigTvs in kind-checking pass] in TcTyClsDecls lays it out. The error message for dependent/should_fail/TypeSkolEscape has become noticeably worse. However, this is because the code in TcErrors goes to some length to preserve pre-8.0 error messages for kind errors. It's time to rip off that plaster and get rid of much of the kind-error-specific error messages. I tried this, and doing so led to a lovely error message for TypeSkolEscape. So: I'm accepting the error message quality regression for now, but will open up a new ticket to fix it, along with a larger error-message improvement I've been pondering. This applies also to dependent/should_fail/{BadTelescope2,T14066,T14066e}, polykinds/T11142. Other minor changes: - isUnliftedTypeKind didn't look for tuples and sums. It does now. - check_type used check_arg_type on both sides of an AppTy. But the left side of an AppTy isn't an arg, and this was causing a bad error message. I've changed it to use check_type on the left-hand side. - Some refactoring around when we print (TYPE blah) in error messages. The changes decrease the times when we do so, to good effect. Of course, this is still all controlled by -fprint-explicit-runtime-reps Fixes #14066 #14749 Test cases: dependent/should_compile/{T14066a,T14749}, dependent/should_fail/T14066{,c,d,e,f,g,h} >--------------------------------------------------------------- faec8d358985e5d0bf363bd96f23fe76c9e281f7 compiler/basicTypes/DataCon.hs | 6 +- compiler/basicTypes/Var.hs | 10 +- compiler/deSugar/DsExpr.hs | 4 +- compiler/hsSyn/HsDecls.hs | 11 +- compiler/hsSyn/HsTypes.hs | 4 +- compiler/iface/IfaceType.hs | 38 +- compiler/iface/ToIface.hs | 17 +- compiler/nativeGen/RegAlloc/Liveness.hs | 2 - compiler/prelude/PrelNames.hs | 10 +- compiler/typecheck/TcBinds.hs | 39 +- compiler/typecheck/TcClassDcl.hs | 13 +- compiler/typecheck/TcDeriv.hs | 3 + compiler/typecheck/TcEnv.hs | 8 + compiler/typecheck/TcErrors.hs | 118 ++- compiler/typecheck/TcEvidence.hs | 12 +- compiler/typecheck/TcHsSyn.hs | 1 + compiler/typecheck/TcHsType.hs | 816 ++++++++++++++------- compiler/typecheck/TcInstDcls.hs | 6 +- compiler/typecheck/TcInteract.hs | 22 +- compiler/typecheck/TcMType.hs | 53 +- compiler/typecheck/TcPat.hs | 4 + compiler/typecheck/TcPatSyn.hs | 2 +- compiler/typecheck/TcRnDriver.hs | 3 +- compiler/typecheck/TcRnMonad.hs | 38 +- compiler/typecheck/TcRnTypes.hs | 49 +- compiler/typecheck/TcSMonad.hs | 21 +- compiler/typecheck/TcSigs.hs | 95 ++- compiler/typecheck/TcSimplify.hs | 201 +++-- compiler/typecheck/TcSplice.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 518 +++++++------ compiler/typecheck/TcType.hs | 74 +- compiler/typecheck/TcUnify.hs | 27 +- compiler/typecheck/TcValidity.hs | 127 ++-- compiler/types/Coercion.hs | 3 +- compiler/types/TyCoRep.hs | 8 +- compiler/types/TyCoRep.hs-boot | 5 +- compiler/types/TyCon.hs | 52 +- compiler/types/Type.hs | 19 + compiler/utils/Bag.hs | 15 +- compiler/utils/Outputable.hs | 5 + docs/users_guide/glasgow_exts.rst | 27 +- testsuite/tests/codeGen/should_fail/T13233.stderr | 4 +- .../InferDependency.hs | 0 testsuite/tests/dependent/should_compile/T11635.hs | 2 +- .../tests/dependent/should_compile/T14066a.hs | 82 +++ .../tests/dependent/should_compile/T14066a.stderr | 5 + .../should_compile/T14749.hs | 0 testsuite/tests/dependent/should_compile/all.T | 2 + .../dependent/should_fail/BadTelescope.stderr | 5 +- .../dependent/should_fail/BadTelescope2.stderr | 13 +- .../dependent/should_fail/BadTelescope3.stderr | 2 +- .../dependent/should_fail/BadTelescope4.stderr | 4 +- .../dependent/should_fail/InferDependency.stderr | 10 +- .../tests/dependent/should_fail/T13601.stderr | 3 +- .../tests/dependent/should_fail/T13780c.stderr | 2 +- testsuite/tests/dependent/should_fail/T14066.hs | 17 + .../tests/dependent/should_fail/T14066.stderr | 11 + testsuite/tests/dependent/should_fail/T14066c.hs | 9 + .../tests/dependent/should_fail/T14066c.stderr | 6 + testsuite/tests/dependent/should_fail/T14066d.hs | 17 + .../tests/dependent/should_fail/T14066d.stderr | 21 + testsuite/tests/dependent/should_fail/T14066e.hs | 13 + .../tests/dependent/should_fail/T14066e.stderr | 11 + testsuite/tests/dependent/should_fail/T14066f.hs | 8 + .../tests/dependent/should_fail/T14066f.stderr | 6 + testsuite/tests/dependent/should_fail/T14066g.hs | 9 + .../tests/dependent/should_fail/T14066g.stderr | 7 + testsuite/tests/dependent/should_fail/T14066h.hs | 11 + .../tests/dependent/should_fail/T14066h.stderr | 16 + .../tests/dependent/should_fail/TypeSkolEscape.hs | 1 + .../dependent/should_fail/TypeSkolEscape.stderr | 10 +- testsuite/tests/dependent/should_fail/all.T | 11 +- testsuite/tests/deriving/should_compile/T11732c.hs | 7 +- testsuite/tests/gadt/T12468.stderr | 4 +- testsuite/tests/ghci/scripts/T10248.stderr | 4 +- testsuite/tests/ghci/scripts/T10249.stderr | 4 +- testsuite/tests/ghci/scripts/T8353.stderr | 20 +- .../tests/indexed-types/should_fail/T7938.stderr | 2 +- .../tests/indexed-types/should_fail/T8129.stdout | 1 - testsuite/tests/module/mod71.stderr | 4 +- .../partial-sigs/should_compile/T12531.stderr | 4 +- .../tests/partial-sigs/should_fail/T10615.stderr | 6 +- .../tests/partial-sigs/should_fail/T11976.stderr | 18 +- .../tests/partial-sigs/should_fail/T14040a.stderr | 37 +- testsuite/tests/perf/haddock/all.T | 5 +- testsuite/tests/polykinds/SigTvKinds3.hs | 9 + testsuite/tests/polykinds/SigTvKinds3.stderr | 6 + testsuite/tests/polykinds/T11142.stderr | 9 +- testsuite/tests/polykinds/T12593.stderr | 59 +- testsuite/tests/polykinds/T13985.stderr | 6 +- testsuite/tests/polykinds/T14563.hs | 2 +- testsuite/tests/polykinds/T14846.stderr | 25 + testsuite/tests/polykinds/T7230.stderr | 4 +- testsuite/tests/polykinds/T8566.stderr | 2 +- testsuite/tests/polykinds/T9222.stderr | 2 +- testsuite/tests/polykinds/all.T | 6 +- testsuite/tests/th/T10267.stderr | 16 +- .../tests/typecheck/should_compile/T13050.stderr | 30 +- testsuite/tests/typecheck/should_compile/T13343.hs | 2 + .../tests/typecheck/should_compile/T14590.stderr | 40 +- .../tests/typecheck/should_compile/T2494.stderr | 6 +- .../tests/typecheck/should_compile/T9497a.stderr | 4 +- .../abstract_refinement_substitutions.stderr | 244 ++++-- testsuite/tests/typecheck/should_compile/all.T | 1 - .../should_compile/hole_constraints.stderr | 20 +- .../should_compile/hole_constraints_nested.stderr | 4 +- .../tests/typecheck/should_compile/holes.stderr | 26 +- .../tests/typecheck/should_compile/holes3.stderr | 26 +- .../should_compile/refinement_substitutions.stderr | 190 ++++- .../should_compile/valid_substitutions.stderr | 30 +- .../valid_substitutions_interactions.stderr | 4 +- .../tests/typecheck/should_fail/T11355.stderr | 2 +- .../tests/typecheck/should_fail/T12177.stderr | 11 +- .../tests/typecheck/should_fail/T14350.stderr | 27 +- testsuite/tests/typecheck/should_fail/T14607.hs | 4 + .../tests/typecheck/should_fail/T14607.stderr | 13 +- .../tests/typecheck/should_fail/T9497d.stderr | 4 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- .../tests/typecheck/should_run/T9497a-run.stderr | 4 +- .../tests/typecheck/should_run/T9497b-run.stderr | 4 +- .../tests/typecheck/should_run/T9497c-run.stderr | 4 +- 121 files changed, 2509 insertions(+), 1261 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 faec8d358985e5d0bf363bd96f23fe76c9e281f7 From git at git.haskell.org Mon Apr 2 02:44:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 02:44:17 +0000 (UTC) Subject: [commit: ghc] master: Clarify comments around dropping Derived constraints (1845d1b) Message-ID: <20180402024417.7C1313A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1845d1bce2e4edea4f5cc9de0d46631369268212/ghc >--------------------------------------------------------------- commit 1845d1bce2e4edea4f5cc9de0d46631369268212 Author: Richard Eisenberg Date: Sat Mar 17 01:57:28 2018 -0400 Clarify comments around dropping Derived constraints [skip ci] >--------------------------------------------------------------- 1845d1bce2e4edea4f5cc9de0d46631369268212 compiler/typecheck/TcRnTypes.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index f0439a6..6c221b7 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1981,7 +1981,7 @@ isDroppableCt ct = definitely_insoluble -- Keep only definitely insoluble | otherwise = case orig of - KindEqOrigin {} -> True -- Why? + KindEqOrigin {} -> True -- See Note [Dropping derived constraints] -- See Note [Dropping derived constraints] -- For fundeps, drop wanted/wanted interactions @@ -2031,6 +2031,9 @@ But (tiresomely) we do keep *some* Derived constraints: * Insoluble kind equalities (e.g. [D] * ~ (* -> *)), with KindEqOrigin, may arise from a type equality a ~ Int#, say. See Note [Equalities with incompatible kinds] in TcCanonical. + These need to be kept because the kind equalities might have different + source locations and hence different error messages. + E.g., test case dependent/should_fail/T11471 * We keep most derived equalities arising from functional dependencies - Given/Given interactions (subset of FunDepOrigin1): From git at git.haskell.org Mon Apr 2 02:44:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 02:44:20 +0000 (UTC) Subject: [commit: ghc] master: Apply the interim fix for #14119 to liftCoMatch (ef44382) Message-ID: <20180402024420.46BD53A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ef443820b71f5c9c2dca362217f1a9fbab6dd736/ghc >--------------------------------------------------------------- commit ef443820b71f5c9c2dca362217f1a9fbab6dd736 Author: Richard Eisenberg Date: Sat Feb 24 11:49:15 2018 -0500 Apply the interim fix for #14119 to liftCoMatch Matching in the presence of casts can happen in liftCoMatch, too. >--------------------------------------------------------------- ef443820b71f5c9c2dca362217f1a9fbab6dd736 compiler/types/Unify.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 34f2fac..cb651ee 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -1328,7 +1328,13 @@ ty_co_match menv subst ty co lkco rkco ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty - = ty_co_match menv subst ty' co (co' `mkTransCo` lkco) (co' `mkTransCo` rkco) + -- See Note [Matching in the presence of casts] + = let empty_subst = mkEmptyTCvSubst (rnInScopeSet (me_env menv)) + substed_co_l = substCo (liftEnvSubstLeft empty_subst subst) co' + substed_co_r = substCo (liftEnvSubstRight empty_subst subst) co' + in + ty_co_match menv subst ty' co (substed_co_l `mkTransCo` lkco) + (substed_co_r `mkTransCo` rkco) | CoherenceCo co1 co2 <- co = ty_co_match menv subst ty co1 (lkco `mkTransCo` mkSymCo co2) rkco From git at git.haskell.org Mon Apr 2 02:44:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 02:44:23 +0000 (UTC) Subject: [commit: ghc] master: Apply Note [EtaAppCo] in OptCoercion to another case (3eaa55d) Message-ID: <20180402024423.198743A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3eaa55dcbcd860a035dfe2cae96866e96b008f67/ghc >--------------------------------------------------------------- commit 3eaa55dcbcd860a035dfe2cae96866e96b008f67 Author: Richard Eisenberg Date: Sun Mar 11 09:45:31 2018 -0400 Apply Note [EtaAppCo] in OptCoercion to another case >--------------------------------------------------------------- 3eaa55dcbcd860a035dfe2cae96866e96b008f67 compiler/types/OptCoercion.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/types/OptCoercion.hs b/compiler/types/OptCoercion.hs index 11aeb93..3de51c3 100644 --- a/compiler/types/OptCoercion.hs +++ b/compiler/types/OptCoercion.hs @@ -577,9 +577,8 @@ opt_trans_rule is in_co1@(FunCo r1 co1a co1b) in_co2@(FunCo r2 co2a co2b) mkFunCo r1 (opt_trans is co1a co2a) (opt_trans is co1b co2b) opt_trans_rule is in_co1@(AppCo co1a co1b) in_co2@(AppCo co2a co2b) - = fireTransRule "TrPushApp" in_co1 in_co2 $ - mkAppCo (opt_trans is co1a co2a) - (opt_trans is co1b co2b) + -- Must call opt_trans_rule_app; see Note [EtaAppCo] + = opt_trans_rule_app is in_co1 in_co2 co1a [co1b] co2a [co2b] -- Eta rules opt_trans_rule is co1@(TyConAppCo r tc cos1) co2 From git at git.haskell.org Mon Apr 2 06:36:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 06:36:57 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg: Restore TTG patch #2 (2bbc7f3) Message-ID: <20180402063657.91DC83A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/restore-ttg Link : http://ghc.haskell.org/trac/ghc/changeset/2bbc7f3003d08fb75a4c56dd9e595aed36e4c5be/ghc >--------------------------------------------------------------- commit 2bbc7f3003d08fb75a4c56dd9e595aed36e4c5be Author: Alan Zimmerman Date: Mon Apr 2 08:34:24 2018 +0200 Restore TTG patch #2 This was originally e3ec2e7ae94524ebd111963faf34b84d942265b4 >--------------------------------------------------------------- 2bbc7f3003d08fb75a4c56dd9e595aed36e4c5be compiler/deSugar/Check.hs | 8 +- compiler/deSugar/Coverage.hs | 147 ++++--- compiler/deSugar/DsArrows.hs | 17 +- compiler/deSugar/DsExpr.hs | 114 ++--- compiler/deSugar/DsGRHSs.hs | 15 +- compiler/deSugar/DsMeta.hs | 51 ++- compiler/deSugar/Match.hs | 32 +- compiler/deSugar/MatchLit.hs | 8 +- compiler/deSugar/PmExpr.hs | 37 +- compiler/hsSyn/Convert.hs | 76 ++-- compiler/hsSyn/HsExpr.hs | 471 +++++++++++++-------- compiler/hsSyn/HsExtension.hs | 119 ++++++ compiler/hsSyn/HsPat.hs | 10 - compiler/hsSyn/HsUtils.hs | 115 ++--- compiler/hsSyn/PlaceHolder.hs | 6 - compiler/main/InteractiveEval.hs | 2 +- compiler/parser/Parser.y | 145 ++++--- compiler/parser/RdrHsSyn.hs | 131 +++--- compiler/rename/RnEnv.hs | 4 +- compiler/rename/RnExpr.hs | 196 ++++----- compiler/rename/RnPat.hs | 6 +- compiler/rename/RnSource.hs | 15 +- compiler/rename/RnSplice.hs | 18 +- compiler/rename/RnTypes.hs | 41 +- compiler/typecheck/Inst.hs | 6 +- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcExpr.hs | 205 ++++----- compiler/typecheck/TcGenDeriv.hs | 10 +- compiler/typecheck/TcHsSyn.hs | 146 +++---- compiler/typecheck/TcInstDcls.hs | 18 +- compiler/typecheck/TcMatches.hs | 10 +- compiler/typecheck/TcPatSyn.hs | 32 +- compiler/typecheck/TcRnDriver.hs | 9 +- compiler/typecheck/TcRnTypes.hs | 91 ++-- compiler/typecheck/TcSplice.hs | 9 +- compiler/typecheck/TcTyDecls.hs | 6 +- ghc/GHCi/UI.hs | 4 +- ghc/GHCi/UI/Info.hs | 8 +- testsuite/tests/ghc-api/annotations/parseTree.hs | 6 +- .../tests/ghc-api/annotations/stringSource.hs | 6 +- testsuite/tests/ghc-api/annotations/t11430.hs | 2 +- .../parser/should_compile/DumpParsedAst.stderr | 3 + .../parser/should_compile/DumpRenamedAst.stderr | 3 + .../should_compile/DumpTypecheckedAst.stderr | 73 ++++ testsuite/tests/perf/haddock/all.T | 1 + testsuite/tests/quasiquotation/T7918.hs | 2 +- utils/haddock | 2 +- 47 files changed, 1396 insertions(+), 1044 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 2bbc7f3003d08fb75a4c56dd9e595aed36e4c5be From git at git.haskell.org Mon Apr 2 13:43:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 13:43:17 +0000 (UTC) Subject: [commit: ghc] master: Test #14884, #14969 (07abff7) Message-ID: <20180402134317.154B23A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb/ghc >--------------------------------------------------------------- commit 07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb Author: Richard Eisenberg Date: Mon Apr 2 09:39:19 2018 -0400 Test #14884, #14969 These were fixed by faec8d358985e5d0bf363bd96f23fe76c9e281f7 test cases: typecheck/should_fail/T14884 ghci/scripts/T14969 >--------------------------------------------------------------- 07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb testsuite/tests/ghci/scripts/T14969.script | 1 + testsuite/tests/ghci/scripts/T14969.stderr | 7 ++++ testsuite/tests/ghci/scripts/all.T | 1 + testsuite/tests/typecheck/should_fail/T14884.hs | 4 ++ .../tests/typecheck/should_fail/T14884.stderr | 44 ++++++++++++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 6 files changed, 58 insertions(+) diff --git a/testsuite/tests/ghci/scripts/T14969.script b/testsuite/tests/ghci/scripts/T14969.script new file mode 100644 index 0000000..ab6af53 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T14969.script @@ -0,0 +1 @@ +3 _ 4 diff --git a/testsuite/tests/ghci/scripts/T14969.stderr b/testsuite/tests/ghci/scripts/T14969.stderr new file mode 100644 index 0000000..b581657 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T14969.stderr @@ -0,0 +1,7 @@ + +:1:1: error: + • Non type-variable argument + in the constraint: Num (t2 -> t1 -> t3) + (Use FlexibleContexts to permit this) + • When checking the inferred type + it :: forall t1 t2 t3. (Num t1, Num (t2 -> t1 -> t3)) => t3 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index f0d90b6..06f1ec4 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -264,3 +264,4 @@ test('T14342', [extra_hc_opts("-XOverloadedStrings -XRebindableSyntax")], ghci_script, ['T14342.script']) test('T14676', extra_files(['../prog002']), ghci_script, ['T14676.script']) test('T14796', normal, ghci_script, ['T14796.script']) +test('T14969', normal, ghci_script, ['T14969.script']) diff --git a/testsuite/tests/typecheck/should_fail/T14884.hs b/testsuite/tests/typecheck/should_fail/T14884.hs new file mode 100644 index 0000000..d5d1545 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14884.hs @@ -0,0 +1,4 @@ +module T14884 where + +x :: IO () +x = _ print "abc" diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr new file mode 100644 index 0000000..5134d85 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14884.stderr @@ -0,0 +1,44 @@ + +T14884.hs:4:5: error: + • Found hole: _ :: (a0 -> IO ()) -> [Char] -> IO () + Where: ‘a0’ is an ambiguous type variable + • In the expression: _ + In the expression: _ print "abc" + In an equation for ‘x’: x = _ print "abc" + • Relevant bindings include x :: IO () (bound at T14884.hs:4:1) + Valid substitutions include + foldMap :: forall (t :: * -> *). + Foldable t => + forall m a. Monoid m => (a -> m) -> t a -> m + (imported from ‘Prelude’ at T14884.hs:1:8-13 + (and originally defined in ‘Data.Foldable’)) + mapM_ :: forall (t :: * -> *) (m :: * -> *) a b. + (Foldable t, Monad m) => + (a -> m b) -> t a -> m () + (imported from ‘Prelude’ at T14884.hs:1:8-13 + (and originally defined in ‘Data.Foldable’)) + ($) :: forall a b. (a -> b) -> a -> b + (imported from ‘Prelude’ at T14884.hs:1:8-13 + (and originally defined in ‘GHC.Base’)) + ($!) :: forall a b. (a -> b) -> a -> b + (imported from ‘Prelude’ at T14884.hs:1:8-13 + (and originally defined in ‘GHC.Base’)) + id :: forall a. a -> a + (imported from ‘Prelude’ at T14884.hs:1:8-13 + (and originally defined in ‘GHC.Base’)) + +T14884.hs:4:7: error: + • Ambiguous type variable ‘a0’ arising from a use of ‘print’ + prevents the constraint ‘(Show a0)’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: + instance (Show a, Show b) => Show (Either a b) + -- Defined in ‘Data.Either’ + instance Show Ordering -- Defined in ‘GHC.Show’ + instance Show Integer -- Defined in ‘GHC.Show’ + ...plus 23 others + ...plus 64 instances involving out-of-scope types + (use -fprint-potential-instances to see them all) + • In the first argument of ‘_’, namely ‘print’ + In the expression: _ print "abc" + In an equation for ‘x’: x = _ print "abc" diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 3f791a7..16fd5de 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -470,3 +470,4 @@ test('T14607', normal, compile_fail, ['']) test('T14605', normal, compile_fail, ['']) test('T14761a', normal, compile_fail, ['']) test('T14761b', normal, compile_fail, ['']) +test('T14884', normal, compile_fail, ['']) From git at git.haskell.org Mon Apr 2 15:28:39 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 15:28:39 +0000 (UTC) Subject: [commit: ghc] branch 'wip/ttg-next' created Message-ID: <20180402152839.695E43A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/ttg-next Referencing: 83a628592ad8071ff62ce8cdaee5a45d99c32805 From git at git.haskell.org Mon Apr 2 15:28:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 15:28:42 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: Restore TTG Path 3 (4365f6d) Message-ID: <20180402152842.5C18E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/4365f6dfbafcb0e1b6f824f77c418027b7f3b1b7/ghc >--------------------------------------------------------------- commit 4365f6dfbafcb0e1b6f824f77c418027b7f3b1b7 Author: Alan Zimmerman Date: Mon Apr 2 10:33:49 2018 +0200 Restore TTG Path 3 Originally 47ad6578ea460999b53eb4293c3a3b3017a56d65 >--------------------------------------------------------------- 4365f6dfbafcb0e1b6f824f77c418027b7f3b1b7 compiler/deSugar/Coverage.hs | 59 +++--- compiler/deSugar/DsArrows.hs | 33 ++-- compiler/deSugar/DsExpr.hs | 3 +- compiler/deSugar/DsListComp.hs | 20 +- compiler/deSugar/DsMeta.hs | 33 ++-- compiler/deSugar/Match.hs | 4 +- compiler/deSugar/PmExpr.hs | 2 +- compiler/hsSyn/Convert.hs | 17 +- compiler/hsSyn/HsBinds.hs | 36 +--- compiler/hsSyn/HsDecls.hs | 6 +- compiler/hsSyn/HsExpr.hs | 231 ++++++++++++++++------- compiler/hsSyn/HsExtension.hs | 129 ++++++++++++- compiler/hsSyn/HsPat.hs | 1 - compiler/hsSyn/HsTypes.hs | 14 +- compiler/hsSyn/HsUtils.hs | 46 ++--- compiler/hsSyn/PlaceHolder.hs | 10 +- compiler/parser/Parser.y | 34 ++-- compiler/parser/RdrHsSyn.hs | 30 +-- compiler/rename/RnExpr.hs | 85 +++++---- compiler/rename/RnPat.hs | 6 +- compiler/rename/RnSplice.hs | 67 ++++--- compiler/rename/RnTypes.hs | 15 +- compiler/typecheck/TcArrows.hs | 53 +++--- compiler/typecheck/TcExpr.hs | 7 +- compiler/typecheck/TcHsSyn.hs | 61 +++--- compiler/typecheck/TcHsType.hs | 4 +- compiler/typecheck/TcMatches.hs | 11 +- compiler/typecheck/TcPat.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 6 +- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcSplice.hs | 20 +- compiler/typecheck/TcTyDecls.hs | 2 +- testsuite/tests/ghc-api/annotations/parseTree.hs | 4 +- testsuite/tests/perf/haddock/all.T | 3 +- 34 files changed, 635 insertions(+), 421 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 4365f6dfbafcb0e1b6f824f77c418027b7f3b1b7 From git at git.haskell.org Mon Apr 2 15:28:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 15:28:45 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: WIP (16dc5e1) Message-ID: <20180402152845.2CE6E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/16dc5e1921fd6f9fde1fcd6b487cbffc52270de3/ghc >--------------------------------------------------------------- commit 16dc5e1921fd6f9fde1fcd6b487cbffc52270de3 Author: Alan Zimmerman Date: Mon Apr 2 14:15:04 2018 +0200 WIP >--------------------------------------------------------------- 16dc5e1921fd6f9fde1fcd6b487cbffc52270de3 compiler/hsSyn/HsBinds.hs | 51 ++++-- compiler/hsSyn/HsDecls.hs | 6 + compiler/hsSyn/HsExtension.hs | 400 +++++++++++++++++++++++------------------- 3 files changed, 263 insertions(+), 194 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 16dc5e1921fd6f9fde1fcd6b487cbffc52270de3 From git at git.haskell.org Mon Apr 2 15:28:49 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 15:28:49 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: Move TTG data instances to a single file. (9623654) Message-ID: <20180402152849.290B63A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/962365479652db9a73c2c119f24602f10fe4e410/ghc >--------------------------------------------------------------- commit 962365479652db9a73c2c119f24602f10fe4e410 Author: Alan Zimmerman Date: Mon Apr 2 16:09:52 2018 +0200 Move TTG data instances to a single file. And introduce TTG for HsLocalBindsLR Re-applies 0cd0c39fc7884a8e26d1e3d43c7d9243359d51da >--------------------------------------------------------------- 962365479652db9a73c2c119f24602f10fe4e410 compiler/deSugar/Coverage.hs | 11 ++-- compiler/deSugar/DsExpr.hs | 9 +-- compiler/deSugar/DsMeta.hs | 10 +-- compiler/ghc.cabal.in | 2 + compiler/hsSyn/Convert.hs | 4 +- compiler/hsSyn/HsBinds.hs | 24 ++++--- compiler/hsSyn/HsDecls.hs | 58 ++++++++--------- compiler/hsSyn/HsExpr.hs | 43 ++++++------ compiler/hsSyn/HsExpr.hs-boot | 10 +-- compiler/hsSyn/HsExtension.hs | 3 + compiler/hsSyn/HsInstances.hs | 126 ++++++++++++++++++++++++++++++++++++ compiler/hsSyn/HsInstances.hs-boot | 18 ++++++ compiler/hsSyn/HsInstances2.hs | 119 ++++++++++++++++++++++++++++++++++ compiler/hsSyn/HsInstances2.hs-boot | 28 ++++++++ compiler/hsSyn/HsLit.hs | 4 +- compiler/hsSyn/HsPat.hs | 4 +- compiler/hsSyn/HsPat.hs-boot | 6 +- compiler/hsSyn/HsSyn.hs | 4 +- compiler/hsSyn/HsTypes.hs | 20 +++--- compiler/hsSyn/HsUtils.hs | 26 ++++---- compiler/main/InteractiveEval.hs | 2 +- compiler/parser/Parser.y | 6 +- compiler/rename/RnBinds.hs | 14 ++-- compiler/rename/RnExpr.hs | 23 ++++--- compiler/rename/RnSource.hs | 2 +- compiler/typecheck/TcBinds.hs | 16 +++-- compiler/typecheck/TcHsSyn.hs | 17 +++-- compiler/typecheck/TcPatSyn.hs | 4 +- compiler/typecheck/TcRnDriver.hs | 3 +- 29 files changed, 463 insertions(+), 153 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 962365479652db9a73c2c119f24602f10fe4e410 From git at git.haskell.org Mon Apr 2 15:28:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 15:28:51 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: Put all the data instances in one file. (83a6285) Message-ID: <20180402152851.EC8E93A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/83a628592ad8071ff62ce8cdaee5a45d99c32805/ghc >--------------------------------------------------------------- commit 83a628592ad8071ff62ce8cdaee5a45d99c32805 Author: Alan Zimmerman Date: Mon Apr 2 17:27:09 2018 +0200 Put all the data instances in one file. Reverses e764d986d2050d84407e6989f0bd38fc1c677134 >--------------------------------------------------------------- 83a628592ad8071ff62ce8cdaee5a45d99c32805 compiler/ghc.cabal.in | 1 - compiler/hsSyn/HsInstances.hs | 36 +++---- compiler/hsSyn/HsInstances.hs-boot | 18 ---- compiler/hsSyn/HsInstances2.hs | 119 --------------------- compiler/hsSyn/HsInstances2.hs-boot | 28 ----- compiler/hsSyn/HsSyn.hs | 1 - .../parser/should_compile/DumpParsedAst.stderr | 3 +- .../parser/should_compile/DumpRenamedAst.stderr | 3 +- .../should_compile/DumpTypecheckedAst.stderr | 3 +- 9 files changed, 20 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 83a628592ad8071ff62ce8cdaee5a45d99c32805 From git at git.haskell.org Mon Apr 2 16:04:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 16:04:51 +0000 (UTC) Subject: [commit: ghc] master: Allow unpacking of single-data-con GADTs (9187d5f) Message-ID: <20180402160451.4EC773A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9187d5fb1d3d38a4e607b0d61784c21447c8195b/ghc >--------------------------------------------------------------- commit 9187d5fb1d3d38a4e607b0d61784c21447c8195b Author: Simon Peyton Jones Date: Mon Apr 2 14:55:43 2018 +0100 Allow unpacking of single-data-con GADTs Trac #14978 pointed out that single-constructor GADTs should be unpackable without trouble. Acutally I realise that even existentials should be unpackable too, but that's a bit more work, so it's not part of this patch. See Note [Unpacking GADTs and existentials] in MkId. >--------------------------------------------------------------- 9187d5fb1d3d38a4e607b0d61784c21447c8195b compiler/basicTypes/MkId.hs | 59 ++++++++++++++-------- testsuite/tests/simplCore/should_compile/Makefile | 5 ++ testsuite/tests/simplCore/should_compile/T14978.hs | 12 +++++ .../tests/simplCore/should_compile/T14978.stdout | 2 + testsuite/tests/simplCore/should_compile/all.T | 4 ++ 5 files changed, 62 insertions(+), 20 deletions(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 38c772c..27e9f2b 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -855,7 +855,7 @@ dataConArgUnpack arg_ty -- A recursive newtype might mean that -- 'arg_ty' is a newtype , let rep_tys = dataConInstArgTys con tc_args - = ASSERT( isVanillaDataCon con ) + = ASSERT( null (dataConExTyVars con) ) -- Note [Unpacking GADTs and existentials] ( rep_tys `zip` dataConRepStrictness con ,( \ arg_id -> do { rep_ids <- mapM newLocal rep_tys @@ -879,31 +879,27 @@ isUnpackableType :: DynFlags -> FamInstEnvs -> Type -> Bool -- we encounter on the way, because otherwise we might well -- end up relying on ourselves! isUnpackableType dflags fam_envs ty - | Just (tc, _) <- splitTyConApp_maybe ty - , Just con <- tyConSingleAlgDataCon_maybe tc - , isVanillaDataCon con - = ok_con_args (unitNameSet (getName tc)) con + | Just data_con <- unpackable_type ty + = ok_con_args (unitNameSet (getName data_con)) data_con | otherwise = False where - ok_arg tcs (ty, bang) = not (attempt_unpack bang) || ok_ty tcs norm_ty + ok_con_args dcs con + = all (ok_arg dcs) (dataConOrigArgTys con `zip` dataConSrcBangs con) + -- NB: dataConSrcBangs gives the *user* request; + -- We'd get a black hole if we used dataConImplBangs + + ok_arg dcs (ty, bang) = not (attempt_unpack bang) || ok_ty dcs norm_ty where norm_ty = topNormaliseType fam_envs ty - ok_ty tcs ty - | Just (tc, _) <- splitTyConApp_maybe ty - , let tc_name = getName tc - = not (tc_name `elemNameSet` tcs) - && case tyConSingleAlgDataCon_maybe tc of - Just con | isVanillaDataCon con - -> ok_con_args (tcs `extendNameSet` getName tc) con - _ -> True - | otherwise - = True - ok_con_args tcs con - = all (ok_arg tcs) (dataConOrigArgTys con `zip` dataConSrcBangs con) - -- NB: dataConSrcBangs gives the *user* request; - -- We'd get a black hole if we used dataConImplBangs + ok_ty dcs ty + | Just data_con <- unpackable_type ty + , let dc_name = getName data_con + , not (dc_name `elemNameSet` dcs) + = ok_con_args (dcs `extendNameSet` dc_name) data_con + | otherwise + = True -- NB True here, in constrast to False at top level attempt_unpack (HsSrcBang _ SrcUnpack NoSrcStrict) = xopt LangExt.StrictData dflags @@ -915,7 +911,30 @@ isUnpackableType dflags fam_envs ty = xopt LangExt.StrictData dflags -- Be conservative attempt_unpack _ = False + unpackable_type :: Type -> Maybe DataCon + -- Works just on a single level + unpackable_type ty + | Just (tc, _) <- splitTyConApp_maybe ty + , Just data_con <- tyConSingleAlgDataCon_maybe tc + , null (dataConExTyVars data_con) -- See Note [Unpacking GADTs and existentials] + = Just data_con + | otherwise + = Nothing + {- +Note [Unpacking GADTs and existentials] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +There is nothing stopping us unpacking a data type with equality +components, like + data Equal a b where + Equal :: Equal a a + +And it'd be fine to unpack a product type with existential components +too, but that would require a bit more plumbing, so currently we don't. + +So for now we require: null (dataConExTyVars data_con) +See Trac #14978 + Note [Unpack one-wide fields] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The flag UnboxSmallStrictFields ensures that any field that can diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 33322f3..1f1bf25 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -2,6 +2,11 @@ TOP=../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +T14978: + $(RM) -f T14978.o T14978.hi + -'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T14978.hs -dsuppress-coercions | grep 'foo' + # Expecting the defn of 'foo' to apply Goof to an unboxed coercion + T13468: $(RM) -f T13468.o T13468.hi -'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T13468.hs | grep 'Error' diff --git a/testsuite/tests/simplCore/should_compile/T14978.hs b/testsuite/tests/simplCore/should_compile/T14978.hs new file mode 100644 index 0000000..3fedb96 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14978.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE GADTs #-} +module T14978 where + +data Equal a b where + Refl :: Equal a a + +data Goof a where + Goof :: {-# UNPACK #-} !(Equal a Int) -> Goof a + + +foo :: Goof Int +foo = Goof Refl diff --git a/testsuite/tests/simplCore/should_compile/T14978.stdout b/testsuite/tests/simplCore/should_compile/T14978.stdout new file mode 100644 index 0000000..1b12ead --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14978.stdout @@ -0,0 +1,2 @@ +foo :: Goof Int +foo = T14978.Goof @ Int @~ diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 13511ee..a521a10 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -297,3 +297,7 @@ test('T14152a', [extra_files(['T14152.hs']), pre_cmd('cp T14152.hs T14152a.hs'), test('T13990', normal, compile, ['-dcore-lint -O']) test('T14650', normal, compile, ['-O2']) test('T14959', normal, compile, ['-O']) +test('T14978', + normal, + run_command, + ['$MAKE -s --no-print-directory T14978']) From git at git.haskell.org Mon Apr 2 16:04:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 16:04:54 +0000 (UTC) Subject: [commit: ghc] master: SpecConstr: accommodate casts in value arguments (5ab8094) Message-ID: <20180402160454.7FADD3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5ab8094e4579c08973260c2d18599be0738526ec/ghc >--------------------------------------------------------------- commit 5ab8094e4579c08973260c2d18599be0738526ec Author: Simon Peyton Jones Date: Mon Apr 2 14:57:37 2018 +0100 SpecConstr: accommodate casts in value arguments This commit: commit fb050a330ad202c1eb43038dc18cca2a5be26f4a Author: Simon Peyton Jones Date: Thu Oct 12 11:00:19 2017 +0100 Do not bind coercion variables in SpecConstr rules arranged to reject any SpecConstr call pattern that mentioned a coercion in the pattern. There was a good reason for that -- see Note [SpecConstr and casts] -- but I didn't realise how important it was to accept patterns that mention casts in /terms/. Trac #14936 showed this up. This patch just narrows the restriction to discard only the cases where the coercion is mentioned only in types. Fortunately that was pretty easy to do. >--------------------------------------------------------------- 5ab8094e4579c08973260c2d18599be0738526ec compiler/specialise/SpecConstr.hs | 56 ++++++++++++++++++---- testsuite/tests/perf/should_run/T14936.hs | 29 +++++++++++ .../should_run/T14936.stdout} | 0 testsuite/tests/perf/should_run/all.T | 6 +++ 4 files changed, 82 insertions(+), 9 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index d54c1ea..f32e0e3 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1921,11 +1921,39 @@ But alas, when we match the call we won't bind 'co', because type-matching I don't know how to solve this, so for now I'm just discarding any call patterns that - * Mentions a coercion variable + * Mentions a coercion variable in a type argument * That is not in scope at the binding of the function I think this is very rare. +It is important (e.g. Trac #14936) that this /only/ applies to +coercions mentioned in casts. We don't want to be discombobulated +by casts in terms! For example, consider + f ((e1,e2) |> sym co) +where, say, + f :: Foo -> blah + co :: Foo ~R (Int,Int) + +Here we definitely do want to specialise for that pair! We do not +match on the structre of the coercion; instead we just match on a +coercion variable, so the RULE looks like + + forall (x::Int, y::Int, co :: (Int,Int) ~R Foo) + f ((x,y) |> co) = $sf x y co + +Often the body of f looks like + f arg = ...(case arg |> co' of + (x,y) -> blah)... + +so that the specialised f will turn into + $sf x y co = let arg = (x,y) |> co + in ...(case arg>| co' of + (x,y) -> blah).... + +which will simplify to not use 'co' at all. But we can't guarantee +that co will end up unused, so we still pass it. Absence analysis +may remove it later. + Note that this /also/ discards the call pattern if we have a cast in a /term/, although in fact Rules.match does make a very flaky and fragile attempt to match coercions. e.g. a call like @@ -2045,17 +2073,19 @@ callToPats env bndr_occs call@(Call _ args con_env) | args `ltLength` bndr_occs -- Check saturated = return Nothing | otherwise - = do { let in_scope = substInScope (sc_subst env) + = do { let in_scope = substInScope (sc_subst env) ; (interesting, pats) <- argsToPats env in_scope con_env args bndr_occs - ; let pat_fvs = exprsFreeVarsList pats + ; let pat_fvs = exprsFreeVarsList pats -- To get determinism we need the list of free variables in -- deterministic order. Otherwise we end up creating -- lambdas with different argument orders. See -- determinism/simplCore/should_compile/spec-inline-determ.hs -- for an example. For explanation of determinism -- considerations See Note [Unique Determinism] in Unique. + in_scope_vars = getInScopeVars in_scope - qvars = filterOut (`elemVarSet` in_scope_vars) pat_fvs + is_in_scope v = v `elemVarSet` in_scope_vars + qvars = filterOut is_in_scope pat_fvs -- Quantify over variables that are not in scope -- at the call site -- See Note [Free type variables of the qvar types] @@ -2070,13 +2100,21 @@ callToPats env bndr_occs call@(Call _ args con_env) sanitise id = id `setIdType` expandTypeSynonyms (idType id) -- See Note [Free type variables of the qvar types] - bad_covars = filter isCoVar ids - -- See Note [SpecConstr and casts] + -- Bad coercion variables: see Note [SpecConstr and casts] + bad_covars :: CoVarSet + bad_covars = mapUnionVarSet get_bad_covars pats + get_bad_covars :: CoreArg -> CoVarSet + get_bad_covars (Type ty) + = filterVarSet (\v -> isId v && not (is_in_scope v)) $ + tyCoVarsOfType ty + get_bad_covars _ + = emptyVarSet ; -- pprTrace "callToPats" (ppr args $$ ppr bndr_occs) $ - WARN( not (null bad_covars), text "SpecConstr: bad covars:" <+> ppr bad_covars - $$ ppr call ) - if interesting && null bad_covars + WARN( not (isEmptyVarSet bad_covars) + , text "SpecConstr: bad covars:" <+> ppr bad_covars + $$ ppr call ) + if interesting && isEmptyVarSet bad_covars then return (Just (qvars', pats)) else return Nothing } diff --git a/testsuite/tests/perf/should_run/T14936.hs b/testsuite/tests/perf/should_run/T14936.hs new file mode 100644 index 0000000..187404c --- /dev/null +++ b/testsuite/tests/perf/should_run/T14936.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE FlexibleContexts #-} + +module Main where + +import Prelude +import qualified Foreign.Storable as Storable +import qualified Control.Monad.State.Strict as S +import Control.Monad.IO.Class +import Foreign.Marshal.Alloc (mallocBytes) + +newtype Foo a = Foo a + +intSize :: Int +intSize = Storable.sizeOf (undefined :: Int) + +-- This 'go' loop should allocate nothing, because it specialises +-- for the shape of the state. But in 8.4 it did (Trac #14936) + +slow :: Int -> IO () +slow i = do let go 0 = pure () + go j = do Foo (!a, !off) <- S.get + S.put (Foo (a+1, off)) + go (j - 1) + S.evalStateT (go i) (Foo ((0::Int),(intSize::Int))) + +main = do { slow (10 ^ 7); print "Done" } + diff --git a/testsuite/tests/ado/T14163.stdout b/testsuite/tests/perf/should_run/T14936.stdout similarity index 100% copy from testsuite/tests/ado/T14163.stdout copy to testsuite/tests/perf/should_run/T14936.stdout diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index d5261b8..20555a4 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -556,3 +556,9 @@ test('T14052', [ (wordsize(64), 2346183840, 10) ])], ghci_script, ['T14052.script']) + +test('T14936', + [stats_num_field('bytes allocated', + [ (wordsize(64), 51792, 5) ])], + compile_and_run, + ['-O2']) From git at git.haskell.org Mon Apr 2 18:44:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 18:44:13 +0000 (UTC) Subject: [commit: ghc] master: Mark test as expected to pass. (ddf8955) Message-ID: <20180402184413.EA7E73A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ddf895577173106646cfc6f6d21be3d5651067bc/ghc >--------------------------------------------------------------- commit ddf895577173106646cfc6f6d21be3d5651067bc Author: Richard Eisenberg Date: Mon Apr 2 14:43:09 2018 -0400 Mark test as expected to pass. This fixes the SplitWD "unexpected pass". This test was fixed by ef443820b71f5c9c2dca362217f1a9fbab6dd736 and somehow fell through my validation cracks. >--------------------------------------------------------------- ddf895577173106646cfc6f6d21be3d5651067bc testsuite/tests/typecheck/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 55ca693..6be32f6 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -600,5 +600,5 @@ test('T14811', normal, compile, ['']) test('T14934', [extra_files(['T14934.hs', 'T14934a.hs'])], run_command, ['$MAKE -s --no-print-directory T14934']) test('T13643', normal, compile, ['']) -test('SplitWD', expect_broken(14119), compile, ['']) +test('SplitWD', normal, compile, ['']) test('T14441', normal, compile, ['']) From git at git.haskell.org Mon Apr 2 21:25:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 21:25:15 +0000 (UTC) Subject: [commit: ghc] master: Fix #14991. (d8d4266) Message-ID: <20180402212515.0B14C3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d8d4266bf73790f65b223ec16f645763eaed8be3/ghc >--------------------------------------------------------------- commit d8d4266bf73790f65b223ec16f645763eaed8be3 Author: Richard Eisenberg Date: Mon Apr 2 15:32:04 2018 -0400 Fix #14991. It turns out that solveEqualities really does need to use simpl_top. I thought that solveWanteds would be enough, and no existing test case showed up the different. #14991 shows that we need simpl_top. Easy enough to fix. test case: dependent/should_compile/T14991 >--------------------------------------------------------------- d8d4266bf73790f65b223ec16f645763eaed8be3 compiler/typecheck/TcSimplify.hs | 4 ++- compiler/typecheck/TcTyClsDecls.hs | 2 +- testsuite/tests/dependent/should_compile/T14991.hs | 34 ++++++++++++++++++++++ testsuite/tests/dependent/should_compile/all.T | 1 + 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 7307f74..ccb7ef5 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -165,7 +165,9 @@ solveEqualities thing_inside = checkNoErrs $ -- See Note [Fail fast on kind errors] do { (result, wanted) <- captureConstraints thing_inside ; traceTc "solveEqualities {" $ text "wanted = " <+> ppr wanted - ; final_wc <- runTcSEqualities $ solveWanteds wanted + ; final_wc <- runTcSEqualities $ simpl_top wanted + -- NB: Use simpl_top here so that we potentially default RuntimeRep + -- vars to LiftedRep. This is needed to avoid #14991. ; traceTc "End solveEqualities }" empty ; traceTc "reportAllUnsolved {" empty diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 6598942..cdcc3bd 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -1485,7 +1485,7 @@ So, the kind-checker must return both the new args (that is, Type Because we don't need this information in the kind-checking phase of checking closed type families, we don't require these extra pieces of -information in tc_fam_ty_pats. See also Note [tc_fam_ty_pats vs tcFamTyPats]. +information in tc_fam_ty_pats. Note [Failing early in kcDataDefn] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testsuite/tests/dependent/should_compile/T14991.hs b/testsuite/tests/dependent/should_compile/T14991.hs new file mode 100644 index 0000000..f435c37 --- /dev/null +++ b/testsuite/tests/dependent/should_compile/T14991.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module T14991 where + +import Data.Kind + +type family Promote (k :: Type) :: Type +type family PromoteX (a :: k) :: Promote k + +type family Demote (k :: Type) :: Type +type family DemoteX (a :: k) :: Demote k + +----- +-- Type +----- + +type instance Demote Type = Type +type instance Promote Type = Type + +type instance DemoteX (a :: Type) = Demote a +type instance PromoteX (a :: Type) = Promote a + +----- +-- Arrows +----- + +data TyFun :: Type -> Type -> Type +type a ~> b = TyFun a b -> Type +infixr 0 ~> + +type instance Demote (a ~> b) = DemoteX a -> DemoteX b +type instance Promote (a -> b) = PromoteX a ~> PromoteX b diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index 070e120..701e187 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -34,3 +34,4 @@ test('T14556', normal, compile, ['']) test('T14720', normal, compile, ['']) test('T14066a', normal, compile, ['']) test('T14749', normal, compile, ['']) +test('T14991', normal, compile, ['']) From git at git.haskell.org Mon Apr 2 21:42:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 21:42:37 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: Add TTG to HsBinds (5593b36) Message-ID: <20180402214237.65B8B3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/5593b3692eee0dbcaaf277938d485531836efa11/ghc >--------------------------------------------------------------- commit 5593b3692eee0dbcaaf277938d485531836efa11 Author: Alan Zimmerman Date: Mon Apr 2 21:32:33 2018 +0200 Add TTG to HsBinds >--------------------------------------------------------------- 5593b3692eee0dbcaaf277938d485531836efa11 compiler/deSugar/Coverage.hs | 1 + compiler/deSugar/DsBinds.hs | 1 + compiler/deSugar/DsMeta.hs | 12 +++--- compiler/hsSyn/Convert.hs | 4 +- compiler/hsSyn/HsBinds.hs | 43 ++++++++++++++++++---- compiler/hsSyn/HsExtension.hs | 24 +++++++++++- compiler/hsSyn/HsInstances.hs | 18 ++++----- compiler/hsSyn/HsUtils.hs | 20 +++++----- compiler/parser/Parser.y | 8 ++-- compiler/parser/RdrHsSyn.hs | 11 ++++-- compiler/rename/RnBinds.hs | 26 ++++++------- compiler/rename/RnSource.hs | 6 +-- compiler/typecheck/TcBinds.hs | 34 ++++++++++------- compiler/typecheck/TcClassDcl.hs | 3 +- compiler/typecheck/TcHsSyn.hs | 22 +++++++---- compiler/typecheck/TcInstDcls.hs | 11 ++++-- compiler/typecheck/TcPatSyn.hs | 8 ++-- compiler/typecheck/TcRnDriver.hs | 2 +- .../parser/should_compile/DumpParsedAst.stderr | 2 +- .../parser/should_compile/DumpRenamedAst.stderr | 4 +- .../should_compile/DumpTypecheckedAst.stderr | 11 +++++- utils/ghctags/Main.hs | 3 +- utils/haddock | 2 +- 23 files changed, 178 insertions(+), 98 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 5593b3692eee0dbcaaf277938d485531836efa11 From git at git.haskell.org Mon Apr 2 21:42:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 Apr 2018 21:42:40 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: Use Plan B for deriving Data Instances (0d06dad) Message-ID: <20180402214240.423AE3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/0d06dad00a0b3de9ad5257b9a98c2e66f01eb3ec/ghc >--------------------------------------------------------------- commit 0d06dad00a0b3de9ad5257b9a98c2e66f01eb3ec Author: Alan Zimmerman Date: Mon Apr 2 23:38:59 2018 +0200 Use Plan B for deriving Data Instances https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances#PLANB Illustrative numbers Compiling HsInstances before using Plan B. Max residency ~ 5G <> Using Plan B Max residency 1.1G <> >--------------------------------------------------------------- 0d06dad00a0b3de9ad5257b9a98c2e66f01eb3ec compiler/hsSyn/HsInstances.hs | 430 +++++++++++++++++++++++++++++++++++------- compiler/hsSyn/HsSyn.hs | 6 +- 2 files changed, 366 insertions(+), 70 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 0d06dad00a0b3de9ad5257b9a98c2e66f01eb3ec From git at git.haskell.org Tue Apr 3 08:08:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 Apr 2018 08:08:43 +0000 (UTC) Subject: [commit: ghc] master: Fix accidental breakage in T7050 (72b5f64) Message-ID: <20180403080843.E081E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72b5f649ede82ab3bb429aa72ee1c572f415b0eb/ghc >--------------------------------------------------------------- commit 72b5f649ede82ab3bb429aa72ee1c572f415b0eb Author: Simon Peyton Jones Date: Tue Apr 3 09:06:49 2018 +0100 Fix accidental breakage in T7050 I introduced a silly bug in commit 9187d5fb1d3d38a4e607b0d61784c21447c8195b Date: Mon Apr 2 14:55:43 2018 +0100 Allow unpacking of single-data-con GADTs that made test T7050 diverge. This patch fixes it. >--------------------------------------------------------------- 72b5f649ede82ab3bb429aa72ee1c572f415b0eb compiler/basicTypes/MkId.hs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 27e9f2b..7e55520 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -880,26 +880,32 @@ isUnpackableType :: DynFlags -> FamInstEnvs -> Type -> Bool -- end up relying on ourselves! isUnpackableType dflags fam_envs ty | Just data_con <- unpackable_type ty - = ok_con_args (unitNameSet (getName data_con)) data_con + = ok_con_args emptyNameSet data_con | otherwise = False where ok_con_args dcs con - = all (ok_arg dcs) (dataConOrigArgTys con `zip` dataConSrcBangs con) - -- NB: dataConSrcBangs gives the *user* request; - -- We'd get a black hole if we used dataConImplBangs - - ok_arg dcs (ty, bang) = not (attempt_unpack bang) || ok_ty dcs norm_ty - where - norm_ty = topNormaliseType fam_envs ty + | dc_name `elemNameSet` dcs + = False + | otherwise + = all (ok_arg dcs') + (dataConOrigArgTys con `zip` dataConSrcBangs con) + -- NB: dataConSrcBangs gives the *user* request; + -- We'd get a black hole if we used dataConImplBangs + where + dc_name = getName con + dcs' = dcs `extendNameSet` dc_name + + ok_arg dcs (ty, bang) + = not (attempt_unpack bang) || ok_ty dcs norm_ty + where + norm_ty = topNormaliseType fam_envs ty ok_ty dcs ty | Just data_con <- unpackable_type ty - , let dc_name = getName data_con - , not (dc_name `elemNameSet` dcs) - = ok_con_args (dcs `extendNameSet` dc_name) data_con + = ok_con_args dcs data_con | otherwise - = True -- NB True here, in constrast to False at top level + = True -- NB True here, in contrast to False at top level attempt_unpack (HsSrcBang _ SrcUnpack NoSrcStrict) = xopt LangExt.StrictData dflags From git at git.haskell.org Tue Apr 3 10:43:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 Apr 2018 10:43:27 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4395-new: Discard reflexive casts during Simplify (6531dd3) Message-ID: <20180403104327.49AA73A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4395-new Link : http://ghc.haskell.org/trac/ghc/changeset/6531dd38db014ac9b9325f4ae854bbd923cf8cf5/ghc >--------------------------------------------------------------- commit 6531dd38db014ac9b9325f4ae854bbd923cf8cf5 Author: Richard Eisenberg Date: Fri Jan 26 22:42:46 2018 -0500 Discard reflexive casts during Simplify Previously, we went to great lengths to build just the right reflexive casts, only to discard them shortly later. Now, just skip creating reflexive casts altogether. Details discussed in https://ghc.haskell.org/trac/ghc/ticket/11735 This should theoretically improve performance, or at least set the stage for more efficient handling of coercions. Profiling shows that performance does not actually improve, because we are now spending a lot of time in simplCast; however, the improved code structure is still good to have, and the change does not make performance worse either. As a starting point for profiling, the Grammar.hs example from #11735 can be used: https://ghc.haskell.org/trac/ghc/attachment/ticket/14683/Grammar.hs On the test system, compilation times for both GHC HEAD and GHC HEAD with this patch applied are around 20 seconds for this input file. Further performance improvements to be handled in future patches and tickets. >--------------------------------------------------------------- 6531dd38db014ac9b9325f4ae854bbd923cf8cf5 compiler/coreSyn/CoreOpt.hs | 48 +++++++++++++---------- compiler/simplCore/Simplify.hs | 89 +++++++++++++++++++++++------------------- 2 files changed, 76 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 6531dd38db014ac9b9325f4ae854bbd923cf8cf5 From git at git.haskell.org Wed Apr 4 12:15:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 Apr 2018 12:15:31 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394: Fix bug in invocation of decomposeFunCo (0674a60) Message-ID: <20180404121531.43D293A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394 Link : http://ghc.haskell.org/trac/ghc/changeset/0674a60e420e02e9043cf6e250e92a978d71885a/ghc >--------------------------------------------------------------- commit 0674a60e420e02e9043cf6e250e92a978d71885a Author: Simon Peyton Jones Date: Wed Apr 4 13:13:11 2018 +0100 Fix bug in invocation of decomposeFunCo We were invoking decomposeFunCo with the wrong role argument; i.e. one that did not match the pre-condition of decomposeFunCo, that that the role argument is the role of the coercion argument. >--------------------------------------------------------------- 0674a60e420e02e9043cf6e250e92a978d71885a compiler/types/Coercion.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 2807512..556dd8e 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -290,7 +290,7 @@ decomposePiCos orig_kind orig_args orig_co = go [] orig_subst orig_kind orig_arg -- ty :: s2 -- need arg_co :: s2 ~ s1 -- res_co :: t1 ~ t2 - = let (sym_arg_co, res_co) = decomposeFunCo Representational co + = let (sym_arg_co, res_co) = decomposeFunCo Nominal co arg_co = mkSymCo sym_arg_co in go (arg_co : acc_arg_cos) subst res_ki tys res_co From git at git.haskell.org Wed Apr 4 12:15:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 Apr 2018 12:15:34 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394: Debug only (7694c43) Message-ID: <20180404121534.15A3F3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394 Link : http://ghc.haskell.org/trac/ghc/changeset/7694c4331bdb43ff86b973b4e4acc509e6c57cda/ghc >--------------------------------------------------------------- commit 7694c4331bdb43ff86b973b4e4acc509e6c57cda Author: Simon Peyton Jones Date: Wed Apr 4 13:14:43 2018 +0100 Debug only * Improve assertion-failure message * Add HasDebugCallStack to decomposeFunCo >--------------------------------------------------------------- 7694c4331bdb43ff86b973b4e4acc509e6c57cda compiler/types/Coercion.hs | 82 ++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 556dd8e..8d1b7b8 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -238,8 +238,10 @@ decomposeCo arity co rs = [mkNthCo r n co | (n,r) <- [0..(arity-1)] `zip` rs ] -- Remember, Nth is zero-indexed -decomposeFunCo :: Role -- of the input coercion - -> Coercion -> (Coercion, Coercion) +decomposeFunCo :: HasDebugCallStack + => Role -- Role of the input coercion + -> Coercion -- Input coercion + -> (Coercion, Coercion) -- Expects co :: (s1 -> t1) ~ (s2 -> t2) -- Returns (co1 :: s1~s2, co2 :: t1~t2) -- See Note [Function coercions] for the "2" and "3" @@ -842,44 +844,11 @@ mkNthCo :: HasDebugCallStack -> Coercion -> Coercion mkNthCo r n co - = ASSERT(good_call) + = ASSERT2( good_call, bad_call_msg ) go r n co where Pair ty1 ty2 = coercionKind co - good_call - -- If the Coercion passed in is between forall-types, then the Int must - -- be 0 and the role must be Nominal. - | Just (_tv1, _) <- splitForAllTy_maybe ty1 - , Just (_tv2, _) <- splitForAllTy_maybe ty2 - = n == 0 && r == Nominal - - -- If the Coercion passed in is between T tys and T tys', then the Int - -- must be less than the length of tys/tys' (which must be the same - -- lengths). - -- - -- If the role of the Coercion is nominal, then the role passed in must - -- be nominal. If the role of the Coercion is representational, then the - -- role passed in must be tyConRolesRepresentational T !! n. If the role - -- of the Coercion is Phantom, then the role passed in must be Phantom. - -- - -- See also Note [NthCo Cached Roles] if you're wondering why it's - -- blaringly obvious that we should be *computing* this role instead of - -- passing it in. - | Just (tc1, tys1) <- splitTyConApp_maybe ty1 - , Just (tc2, tys2) <- splitTyConApp_maybe ty2 - , tc1 == tc2 - = let len1 = length tys1 - len2 = length tys2 - good_role = case coercionRole co of - Nominal -> r == Nominal - Representational -> r == (tyConRolesRepresentational tc1 !! n) - Phantom -> r == Phantom - in len1 == len2 && n < len1 && good_role - - | otherwise - = True - go r 0 (Refl _ ty) | Just (tv, _) <- splitForAllTy_maybe ty = ASSERT( r == Nominal ) @@ -933,6 +902,47 @@ mkNthCo r n co go r n co = NthCo r n co + -- Assertion checking + bad_call_msg = vcat [ text "Coercion =" <+> ppr co + , text "LHS ty =" <+> ppr ty1 + , text "RHS ty =" <+> ppr ty2 + , text "n =" <+> ppr n, text "r =" <+> ppr r + , text "coercion role =" <+> ppr (coercionRole co) ] + good_call + -- If the Coercion passed in is between forall-types, then the Int must + -- be 0 and the role must be Nominal. + | Just (_tv1, _) <- splitForAllTy_maybe ty1 + , Just (_tv2, _) <- splitForAllTy_maybe ty2 + = n == 0 && r == Nominal + + -- If the Coercion passed in is between T tys and T tys', then the Int + -- must be less than the length of tys/tys' (which must be the same + -- lengths). + -- + -- If the role of the Coercion is nominal, then the role passed in must + -- be nominal. If the role of the Coercion is representational, then the + -- role passed in must be tyConRolesRepresentational T !! n. If the role + -- of the Coercion is Phantom, then the role passed in must be Phantom. + -- + -- See also Note [NthCo Cached Roles] if you're wondering why it's + -- blaringly obvious that we should be *computing* this role instead of + -- passing it in. + | Just (tc1, tys1) <- splitTyConApp_maybe ty1 + , Just (tc2, tys2) <- splitTyConApp_maybe ty2 + , tc1 == tc2 + = let len1 = length tys1 + len2 = length tys2 + good_role = case coercionRole co of + Nominal -> r == Nominal + Representational -> r == (tyConRolesRepresentational tc1 !! n) + Phantom -> r == Phantom + in len1 == len2 && n < len1 && good_role + + | otherwise + = True + + + -- | If you're about to call @mkNthCo r n co@, then @r@ should be -- whatever @nthCoRole n co@ returns. nthCoRole :: Int -> Coercion -> Role From git at git.haskell.org Thu Apr 5 09:36:55 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 09:36:55 +0000 (UTC) Subject: [commit: ghc] branch 'wip/tdammers/T14737-patch' created Message-ID: <20180405093655.651D23A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/tdammers/T14737-patch Referencing: 8044db837a6678ab59b5a96a935678876d76cb6a From git at git.haskell.org Thu Apr 5 09:37:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 09:37:00 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Fix huge performance regression (5d1a707) Message-ID: <20180405093700.E85693A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/5d1a707c6c78dedc915604aec702d07c4bc741c5/ghc >--------------------------------------------------------------- commit 5d1a707c6c78dedc915604aec702d07c4bc741c5 Author: Tobias Dammers Date: Mon Mar 26 13:44:56 2018 +0200 Fix huge performance regression Previous version caused a 10x increase in execution time for the infamous Grammar.hs test case from #14683; this patch gets us back on par. >--------------------------------------------------------------- 5d1a707c6c78dedc915604aec702d07c4bc741c5 compiler/simplCore/Simplify.hs | 102 +++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 56 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index b2444e5..5e5d836 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1215,62 +1215,52 @@ simplCast env body co0 cont0 where -- If the first parameter is Nothing, then simplifying revealed a -- reflexive coercion. Omit. - addCoerce0 :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont - addCoerce0 Nothing cont = return cont - addCoerce0 (Just co) cont = addCoerce co cont - - addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont - addCoerce co cont -- just skip reflexive casts - | isReflexiveCo co = {-#SCC "addCoerce-reflexive" #-} - return cont - -- It's worth checking isReflexiveCo. - -- For example, in the initial form of a worker - -- we may find (coerce T (coerce S (\x.e))) y - -- and we'd like it to simplify to e[y/x] in one round - -- of simplification - - addCoerce co1 (CastIt co2 cont) - = addCoerce (mkTransCo co1 co2) cont - - addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) - | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty - = case m_co' of - Just co' -> do { tail' <- addCoerce co' tail - ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } - Nothing -> return cont - - addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se - , sc_dup = dup, sc_cont = tail }) - | Just (co1, m_co2) <- pushCoValArg co - , Pair _ new_ty <- coercionKind co1 - , not (isTypeLevPoly new_ty) -- without this check, we get a lev-poly arg - -- See Note [Levity polymorphism invariants] in CoreSyn - -- test: typecheck/should_run/EtaExpandLevPoly - = do { tail' <- addCoerce0 m_co2 tail - ; if isReflCo co1 - then return (cont { sc_cont = tail' }) - -- Avoid simplifying if possible; - -- See Note [Avoiding exponential behaviour] - else do - { (dup', arg_se', arg') <- simplArg env dup arg_se arg - -- When we build the ApplyTo we can't mix the OutCoercion - -- 'co' with the InExpr 'arg', so we simplify - -- to make it all consistent. It's a bit messy. - -- But it isn't a common case. - -- Example of use: Trac #995 - ; return (ApplyToVal { sc_arg = mkCast arg' co1 - , sc_env = arg_se' - , sc_dup = dup' - , sc_cont = tail' }) } } - - addCoerce co cont - | isReflexiveCo co = return cont - | otherwise = return (CastIt co cont) - -- It's worth checking isReflexiveCo. - -- For example, in the initial form of a worker - -- we may find (coerce T (coerce S (\x.e))) y - -- and we'd like it to simplify to e[y/x] in one round - -- of simplification + addCoerce0 :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce0 Nothing cont = return cont + addCoerce0 (Just co) cont = addCoerce co cont + + addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont + + addCoerce co1 (CastIt co2 cont) + = addCoerce (mkTransCo co1 co2) cont + + addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) + | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty + = do { tail' <- addCoerce0 m_co' tail + ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + + addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se + , sc_dup = dup, sc_cont = tail }) + | Just (co1, m_co2) <- pushCoValArg co + , Pair _ new_ty <- coercionKind co1 + , not (isTypeLevPoly new_ty) -- without this check, we get a lev-poly arg + -- See Note [Levity polymorphism invariants] in CoreSyn + -- test: typecheck/should_run/EtaExpandLevPoly + = do { tail' <- addCoerce0 m_co2 tail + ; if isReflCo co1 + then return (cont { sc_cont = tail' }) + -- Avoid simplifying if possible; + -- See Note [Avoiding exponential behaviour] + else do + { (dup', arg_se', arg') <- simplArg env dup arg_se arg + -- When we build the ApplyTo we can't mix the OutCoercion + -- 'co' with the InExpr 'arg', so we simplify + -- to make it all consistent. It's a bit messy. + -- But it isn't a common case. + -- Example of use: Trac #995 + ; return (ApplyToVal { sc_arg = mkCast arg' co1 + , sc_env = arg_se' + , sc_dup = dup' + , sc_cont = tail' }) } } + + addCoerce co cont + | isReflexiveCo co = return cont + | otherwise = return (CastIt co cont) + -- It's worth checking isReflexiveCo. + -- For example, in the initial form of a worker + -- we may find (coerce T (coerce S (\x.e))) y + -- and we'd like it to simplify to e[y/x] in one round + -- of simplification simplArg :: SimplEnv -> DupFlag -> StaticEnv -> CoreExpr -> SimplM (DupFlag, StaticEnv, OutExpr) From git at git.haskell.org Thu Apr 5 09:36:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 09:36:58 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Discard reflexive casts during Simplify (325fa91) Message-ID: <20180405093658.2ADA53A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/325fa912c6f8fbc767dd45a9a333ee50563761cf/ghc >--------------------------------------------------------------- commit 325fa912c6f8fbc767dd45a9a333ee50563761cf Author: Richard Eisenberg Date: Fri Jan 26 22:42:46 2018 -0500 Discard reflexive casts during Simplify Previously, we went to great lengths to build just the right reflexive casts, only to discard them shortly later. Now, just skip creating reflexive casts altogether. >--------------------------------------------------------------- 325fa912c6f8fbc767dd45a9a333ee50563761cf compiler/coreSyn/CoreOpt.hs | 48 ++++++++++++++++++++++++------------------ compiler/simplCore/Simplify.hs | 27 +++++++++++++++++++----- 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 04e604e..e1eae8b 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -732,9 +732,11 @@ exprIsConApp_maybe (in_scope, id_unf) expr go subst (Tick t expr) cont | not (tickishIsCode t) = go subst expr cont go subst (Cast expr co1) (CC args co2) - | Just (args', co1') <- pushCoArgs (subst_co subst co1) args + | Just (args', m_co1') <- pushCoArgs (subst_co subst co1) args -- See Note [Push coercions in exprIsConApp_maybe] - = go subst expr (CC args' (co1' `mkTransCo` co2)) + = case m_co1' of + Just co1' -> go subst expr (CC args' (co1' `mkTransCo` co2)) + Nothing -> go subst expr (CC args' co2) go subst (App fun arg) (CC args co) = go subst fun (CC (subst_arg subst arg : args) co) go subst (Lam var body) (CC (arg:args) co) @@ -928,36 +930,40 @@ Here we implement the "push rules" from FC papers: by pushing the coercion into the arguments -} -pushCoArgs :: Coercion -> [CoreArg] -> Maybe ([CoreArg], Coercion) -pushCoArgs co [] = return ([], co) -pushCoArgs co (arg:args) = do { (arg', co1) <- pushCoArg co arg - ; (args', co2) <- pushCoArgs co1 args - ; return (arg':args', co2) } +pushCoArgs :: Coercion -> [CoreArg] -> Maybe ([CoreArg], Maybe Coercion) +pushCoArgs co [] = return ([], Just co) +pushCoArgs co (arg:args) = do { (arg', m_co1) <- pushCoArg co arg + ; case m_co1 of + Just co1 -> do { (args', m_co2) <- pushCoArgs co1 args + ; return (arg':args', m_co2) } + Nothing -> return (arg':args, Nothing) } -pushCoArg :: Coercion -> CoreArg -> Maybe (CoreArg, Coercion) +pushCoArg :: Coercion -> CoreArg -> Maybe (CoreArg, Maybe Coercion) -- We have (fun |> co) arg, and we want to transform it to -- (fun arg) |> co -- This may fail, e.g. if (fun :: N) where N is a newtype -- C.f. simplCast in Simplify.hs -- 'co' is always Representational +-- If the returned coercion is Nothing, then it would have been reflexive +pushCoArg co (Type ty) = do { (ty', m_co') <- pushCoTyArg co ty + ; return (Type ty', m_co') } +pushCoArg co val_arg = do { (arg_co, m_co') <- pushCoValArg co + ; return (val_arg `mkCast` arg_co, m_co') } -pushCoArg co (Type ty) = do { (ty', co') <- pushCoTyArg co ty - ; return (Type ty', co') } -pushCoArg co val_arg = do { (arg_co, co') <- pushCoValArg co - ; return (mkCast val_arg arg_co, co') } - -pushCoTyArg :: Coercion -> Type -> Maybe (Type, Coercion) +pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) -- We have (fun |> co) @ty -- Push the coercion through to return -- (fun @ty') |> co' -- 'co' is always Representational +-- If the returned coercion is Nothing, then it would have been reflexive; +-- it's faster not to compute it, though. pushCoTyArg co ty | tyL `eqType` tyR - = Just (ty, mkRepReflCo (piResultTy tyR ty)) + = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) - Just (ty `mkCastTy` mkSymCo co1, co2) + Just (ty `mkCastTy` mkSymCo co1, Just co2) | otherwise = Nothing @@ -977,14 +983,16 @@ pushCoTyArg co ty -- co2 :: ty1[ (ty|>co1)/a1 ] ~ ty2[ ty/a2 ] -- Arg of mkInstCo is always nominal, hence mkNomReflCo -pushCoValArg :: Coercion -> Maybe (Coercion, Coercion) +pushCoValArg :: Coercion -> Maybe (Coercion, Maybe Coercion) -- We have (fun |> co) arg -- Push the coercion through to return -- (fun (arg |> co_arg)) |> co_res -- 'co' is always Representational +-- If the second returned Coercion is actually Nothing, then no cast is necessary; +-- the returned coercion would have been reflexive. pushCoValArg co | tyL `eqType` tyR - = Just (mkRepReflCo arg, mkRepReflCo res) + = Just (mkRepReflCo arg, Nothing) | isFunTy tyL , (co1, co2) <- decomposeFunCo co @@ -992,12 +1000,12 @@ pushCoValArg co -- then co1 :: tyL1 ~ tyR1 -- co2 :: tyL2 ~ tyR2 = ASSERT2( isFunTy tyR, ppr co $$ ppr arg ) - Just (mkSymCo co1, co2) + Just (mkSymCo co1, Just co2) | otherwise = Nothing where - (arg, res) = splitFunTy tyR + (arg, _) = splitFunTy tyR Pair tyL tyR = coercionKind co pushCoercionIntoLambda diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index b123055..b2444e5 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1213,23 +1213,40 @@ simplCast env body co0 cont0 ; cont1 <- addCoerce co1 cont0 ; simplExprF env body cont1 } where + -- If the first parameter is Nothing, then simplifying revealed a + -- reflexive coercion. Omit. + addCoerce0 :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce0 Nothing cont = return cont + addCoerce0 (Just co) cont = addCoerce co cont + addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce co cont -- just skip reflexive casts + | isReflexiveCo co = {-#SCC "addCoerce-reflexive" #-} + return cont + -- It's worth checking isReflexiveCo. + -- For example, in the initial form of a worker + -- we may find (coerce T (coerce S (\x.e))) y + -- and we'd like it to simplify to e[y/x] in one round + -- of simplification + addCoerce co1 (CastIt co2 cont) = addCoerce (mkTransCo co1 co2) cont addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) - | Just (arg_ty', co') <- pushCoTyArg co arg_ty - = do { tail' <- addCoerce co' tail - ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty + = case m_co' of + Just co' -> do { tail' <- addCoerce co' tail + ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + Nothing -> return cont addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se , sc_dup = dup, sc_cont = tail }) - | Just (co1, co2) <- pushCoValArg co + | Just (co1, m_co2) <- pushCoValArg co , Pair _ new_ty <- coercionKind co1 , not (isTypeLevPoly new_ty) -- without this check, we get a lev-poly arg -- See Note [Levity polymorphism invariants] in CoreSyn -- test: typecheck/should_run/EtaExpandLevPoly - = do { tail' <- addCoerce co2 tail + = do { tail' <- addCoerce0 m_co2 tail ; if isReflCo co1 then return (cont { sc_cont = tail' }) -- Avoid simplifying if possible; From git at git.haskell.org Thu Apr 5 09:37:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 09:37:03 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Improve isReflexiveCo performance (87c547d) Message-ID: <20180405093703.C61C83A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/87c547dea0620d92f552275eaa39135bdd4e0423/ghc >--------------------------------------------------------------- commit 87c547dea0620d92f552275eaa39135bdd4e0423 Author: Tobias Dammers Date: Thu Mar 29 10:45:54 2018 +0200 Improve isReflexiveCo performance >--------------------------------------------------------------- 87c547dea0620d92f552275eaa39135bdd4e0423 compiler/types/Coercion.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 7a7918c..c053233 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -376,7 +376,9 @@ isReflCo_maybe _ = Nothing -- | Slowly checks if the coercion is reflexive. Don't call this in a loop, -- as it walks over the entire coercion. isReflexiveCo :: Coercion -> Bool -isReflexiveCo = isJust . isReflexiveCo_maybe +isReflexiveCo (Refl {}) = True +isReflexiveCo co = eqType ty1 ty2 + where Pair ty1 ty2 = coercionKind co -- | Extracts the coerced type from a reflexive coercion. This potentially -- walks over the entire coercion, so avoid doing this in a loop. From git at git.haskell.org Thu Apr 5 09:37:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 09:37:06 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Remove unnecessary check in simplCast (8044db8) Message-ID: <20180405093706.8D6053A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/8044db837a6678ab59b5a96a935678876d76cb6a/ghc >--------------------------------------------------------------- commit 8044db837a6678ab59b5a96a935678876d76cb6a Author: Tobias Dammers Date: Tue Apr 3 13:49:40 2018 +0200 Remove unnecessary check in simplCast The coercion optimizer will take care of it anyway, and the check is prohibitively expensive. See Trac #14737. >--------------------------------------------------------------- 8044db837a6678ab59b5a96a935678876d76cb6a compiler/coreSyn/CoreOpt.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index e1eae8b..4b305fa 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -958,8 +958,10 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) -- If the returned coercion is Nothing, then it would have been reflexive; -- it's faster not to compute it, though. pushCoTyArg co ty - | tyL `eqType` tyR - = Just (ty, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion + -- optimizer will take care of it. See Trac #14737. + -- | tyL `eqType` tyR + -- = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) From git at git.haskell.org Thu Apr 5 09:37:09 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 09:37:09 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Clean up & document isReflexiveCo. (f1e5fef) Message-ID: <20180405093709.52F2E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/f1e5fef1a75b79ef4189bdf7027e8a7bd456e0ef/ghc >--------------------------------------------------------------- commit f1e5fef1a75b79ef4189bdf7027e8a7bd456e0ef Author: Tobias Dammers Date: Sat Mar 31 18:25:15 2018 +0200 Clean up & document isReflexiveCo. >--------------------------------------------------------------- f1e5fef1a75b79ef4189bdf7027e8a7bd456e0ef compiler/types/Coercion.hs | 54 ++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index c053233..0176460 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -58,7 +58,7 @@ module Coercion ( pickLR, - isReflCo, isReflCo_maybe, isReflexiveCo, isReflexiveCo_maybe, + isReflCo, isReflCo_maybe, isReflexiveCo, isReflCoVar_maybe, -- ** Coercion variables @@ -359,37 +359,53 @@ isReflCoVar_maybe cv | otherwise = Nothing --- | Tests if this coercion is obviously reflexive. Guaranteed to work --- very quickly. Sometimes a coercion can be reflexive, but not obviously --- so. c.f. 'isReflexiveCo' +-- | Tests if this coercion is obviously reflexive. +-- See Note [Checking whether coercions are reflexive]. isReflCo :: Coercion -> Bool isReflCo (Refl {}) = True isReflCo _ = False --- | Returns the type coerced if this coercion is reflexive. Guaranteed --- to work very quickly. Sometimes a coercion can be reflexive, but not --- obviously so. c.f. 'isReflexiveCo_maybe' +-- | Returns the type coerced if this coercion is obviously reflexive. +-- See Note [Checking whether coercions are reflexive]. isReflCo_maybe :: Coercion -> Maybe (Type, Role) isReflCo_maybe (Refl r ty) = Just (ty, r) isReflCo_maybe _ = Nothing --- | Slowly checks if the coercion is reflexive. Don't call this in a loop, --- as it walks over the entire coercion. +-- | Slowly checks if the coercion is reflexive. +-- See Note [Checking whether coercions are reflexive]. isReflexiveCo :: Coercion -> Bool isReflexiveCo (Refl {}) = True isReflexiveCo co = eqType ty1 ty2 where Pair ty1 ty2 = coercionKind co --- | Extracts the coerced type from a reflexive coercion. This potentially --- walks over the entire coercion, so avoid doing this in a loop. -isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role) -isReflexiveCo_maybe (Refl r ty) = Just (ty, r) -isReflexiveCo_maybe co - | ty1 `eqType` ty2 - = Just (ty1, r) - | otherwise - = Nothing - where (Pair ty1 ty2, r) = coercionKindRole co +{- + +Note [Checking whether coercions are reflexive] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes a coercion can be reflexive, but not obviously so; in such cases, a +conclusive will be very expensive, because it requires walking over the entire +coercion. + +Also, when we determine whether a coercion is reflexive, it is sometimes useful +to also determine the type coerced and return it from the check, but when we +don't need it, we can write a more efficient implementation using booleans +instead of `Maybe`. + +Because of this, several flavors of the is-reflexive test exist: + +- `isReflCo` performs a very quick test, only checking whether the coercion is + obviously reflexive. This test may miss non-obviously reflexive coercions, + but it is guaranteed to run very quickly. +- `isReflCo_maybe` performs the same quick test as `isReflCo`, but also returns + the type coerced if it has been found to be obviously reflexive. +- `isReflexiveCo` performs a full, conclusive test; this will correctly detect + non-obviously reflexive coercions, but may run slowly. + +Previously, `isReflexiveCo_maybe` also existed, but we don't need a full test +that also returns the type coerced anywhere. + +-} {- %************************************************************************ From git at git.haskell.org Thu Apr 5 10:08:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 10:08:12 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4395-new: Simplify simplCast (aa8ea83) Message-ID: <20180405100812.BFD473A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4395-new Link : http://ghc.haskell.org/trac/ghc/changeset/aa8ea83e445ad105a593f7d8004631404dea21c9/ghc >--------------------------------------------------------------- commit aa8ea83e445ad105a593f7d8004631404dea21c9 Author: Richard Eisenberg Date: Fri Jan 26 22:42:46 2018 -0500 Simplify simplCast Trac Trac #14735 (derived from Trac #11735) found that 75% of compile time was being spent in simplCast. This patch is the first in a series to deal with that problem. This particular patch actually has very little effect on performance; it just refactors simplCast so that it builds Refl coercions less often. Refl coercions require us to compute the type to put inside them, and even if that's done lazily it is still work and code. Instead we use Maybe Coercion with Nothing for Refl. This change also percolates to pushCoTyArg and pushValArg. >--------------------------------------------------------------- aa8ea83e445ad105a593f7d8004631404dea21c9 compiler/coreSyn/CoreOpt.hs | 48 +++++++++++++---------- compiler/simplCore/Simplify.hs | 89 +++++++++++++++++++++++------------------- 2 files changed, 76 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 aa8ea83e445ad105a593f7d8004631404dea21c9 From git at git.haskell.org Thu Apr 5 12:25:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 12:25:50 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Fix unintended Haddock (abcecfe) Message-ID: <20180405122550.BFC043A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/abcecfe3ffb384a4730adaa1247c9ab4305448d1/ghc >--------------------------------------------------------------- commit abcecfe3ffb384a4730adaa1247c9ab4305448d1 Author: Tobias Dammers Date: Thu Apr 5 14:25:03 2018 +0200 Fix unintended Haddock >--------------------------------------------------------------- abcecfe3ffb384a4730adaa1247c9ab4305448d1 compiler/coreSyn/CoreOpt.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 4b305fa..6c63361 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -960,8 +960,8 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) pushCoTyArg co ty -- The following is inefficient - don't do `eqType` here, the coercion -- optimizer will take care of it. See Trac #14737. - -- | tyL `eqType` tyR - -- = Just (ty, Nothing) + -- -- | tyL `eqType` tyR + -- -- = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) @@ -993,8 +993,10 @@ pushCoValArg :: Coercion -> Maybe (Coercion, Maybe Coercion) -- If the second returned Coercion is actually Nothing, then no cast is necessary; -- the returned coercion would have been reflexive. pushCoValArg co - | tyL `eqType` tyR - = Just (mkRepReflCo arg, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion + -- optimizer will take care of it. See Trac #14737. + -- -- | tyL `eqType` tyR + -- -- = Just (mkRepReflCo arg, Nothing) | isFunTy tyL , (co1, co2) <- decomposeFunCo co From git at git.haskell.org Thu Apr 5 14:04:24 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 14:04:24 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T15002' created Message-ID: <20180405140424.DD1163A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T15002 Referencing: 8b833ab90321c66f583a1d8268e16d181ef3ff6c From git at git.haskell.org Thu Apr 5 14:04:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 14:04:28 +0000 (UTC) Subject: [commit: ghc] wip/T15002: CSE: in bind_cse, adhere to noCSE (fixes #15002) (8b833ab) Message-ID: <20180405140428.370803A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/8b833ab90321c66f583a1d8268e16d181ef3ff6c/ghc >--------------------------------------------------------------- commit 8b833ab90321c66f583a1d8268e16d181ef3ff6c Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: in bind_cse, adhere to noCSE (fixes #15002) Differential Revision: https://phabricator.haskell.org/D4572 >--------------------------------------------------------------- 8b833ab90321c66f583a1d8268e16d181ef3ff6c compiler/simplCore/CSE.hs | 3 +++ testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 16 insertions(+) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 8f61128..09e23f5 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -353,6 +353,9 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | noCSE in_id + = (env', (out_id, in_rhs)) + | otherwise = (env', (out_id', out_rhs)) where diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a521a10..016b439 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -301,3 +301,4 @@ test('T14978', normal, run_command, ['$MAKE -s --no-print-directory T14978']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Thu Apr 5 15:41:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 15:41:35 +0000 (UTC) Subject: [commit: ghc] master: Remove unused bdescr flag BF_FREE (c2f90c8) Message-ID: <20180405154135.EEEAB3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2f90c84e6dcf4331e934a76de313b168c77b6dc/ghc >--------------------------------------------------------------- commit c2f90c84e6dcf4331e934a76de313b168c77b6dc Author: Ömer Sinan Ağacan Date: Thu Apr 5 18:41:02 2018 +0300 Remove unused bdescr flag BF_FREE Reviewers: bgamari, simonmar, erikd Reviewed By: bgamari, simonmar Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4539 >--------------------------------------------------------------- c2f90c84e6dcf4331e934a76de313b168c77b6dc includes/rts/storage/Block.h | 2 -- rts/RetainerProfile.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h index c1d2518..9ba0b15 100644 --- a/includes/rts/storage/Block.h +++ b/includes/rts/storage/Block.h @@ -143,8 +143,6 @@ typedef struct bdescr_ { #define BF_PINNED 4 /* Block is to be marked, not copied */ #define BF_MARKED 8 -/* Block is free, and on the free list (TODO: is this used?) */ -#define BF_FREE 16 /* Block is executable */ #define BF_EXEC 32 /* Block contains only a small amount of live data */ diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 42ddae3..79bb7e3 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -2068,7 +2068,7 @@ retainerProfile(void) #if defined(DEBUG_RETAINER) #define LOOKS_LIKE_PTR(r) ((LOOKS_LIKE_STATIC_CLOSURE(r) || \ - ((HEAP_ALLOCED(r) && ((Bdescr((P_)r)->flags & BF_FREE) == 0)))) && \ + (HEAP_ALLOCED(r))) && \ ((StgWord)(*(StgPtr)r)!=(StgWord)0xaaaaaaaaaaaaaaaaULL)) static uint32_t From git at git.haskell.org Thu Apr 5 17:42:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 Apr 2018 17:42:15 +0000 (UTC) Subject: [commit: ghc] wip/T15002: CSE: in bind_cse, adhere to noCSE (fixes #15002) (d015504) Message-ID: <20180405174215.AB6233A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/d0155044e4f06d5ec87bf924a4ace374b2a984d3/ghc >--------------------------------------------------------------- commit d0155044e4f06d5ec87bf924a4ace374b2a984d3 Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: in bind_cse, adhere to noCSE (fixes #15002) Previously, noCSE was only checked for self-recursive bindings, and non-recursive join points were happily CSE’ed, breaking the join point invariant. By checking noCSE in all cases of cseBind/cse_bind, this can be prevented. Eventually CSE for join points would be desirable (#13219). Differential Revision: https://phabricator.haskell.org/D4572 >--------------------------------------------------------------- d0155044e4f06d5ec87bf924a4ace374b2a984d3 compiler/simplCore/CSE.hs | 21 ++++++++++++++++++++- testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 8f61128..6bdf4f0 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -276,6 +276,23 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. +Another way how CSE for joint points is tricky is + + let join foo x = (x, 42) + join bar x = (x, 42) + in … jump foo 1 … jump bar 2 … + +naively, CSE would turn this into + + let join foo x = (x, 42) + join bar = foo + in … jump foo 1 … jump bar 2 … + +but now bar is a join point with join-arity one, but a right-hand side that is +not a lambda (came up in #15002) + +Eventually we might want to teach CSE to handle join points (#13219) + Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -353,6 +370,9 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | noCSE in_id + = (env', (out_id, in_rhs)) + | otherwise = (env', (out_id', out_rhs)) where @@ -370,7 +390,6 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Note [Type-let] in CoreSyn), in which case we can just substitute. addBinding env in_id out_id rhs' | not (isId in_id) = (extendCSSubst env in_id rhs', out_id) - | noCSE in_id = (env, out_id) | use_subst = (extendCSSubst env in_id rhs', out_id) | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a521a10..016b439 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -301,3 +301,4 @@ test('T14978', normal, run_command, ['$MAKE -s --no-print-directory T14978']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Fri Apr 6 09:11:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 Apr 2018 09:11:11 +0000 (UTC) Subject: [commit: ghc] master: Comments only, about exitifcation (891ffd5) Message-ID: <20180406091111.A06113A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/891ffd58c323a44a10959ce5a78529a3db75c7ff/ghc >--------------------------------------------------------------- commit 891ffd58c323a44a10959ce5a78529a3db75c7ff Author: Simon Peyton Jones Date: Fri Apr 6 09:46:29 2018 +0100 Comments only, about exitifcation >--------------------------------------------------------------- 891ffd58c323a44a10959ce5a78529a3db75c7ff compiler/basicTypes/Id.hs | 2 +- compiler/simplCore/Exitify.hs | 39 ++++++++++++++++++++++++++------------- compiler/simplCore/SimplUtils.hs | 2 +- compiler/simplCore/Simplify.hs | 2 +- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index fbece0e..709bea4 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -498,7 +498,7 @@ isJoinId_maybe id _ -> Nothing | otherwise = Nothing --- see Note [Exitification] and see Note [Do not inline exit join points] +-- See Note [Exitification] and Note [Do not inline exit join points] in Exitify.hs isExitJoinId :: Var -> Bool isExitJoinId id = isJoinId id && isOneOcc (idOccInfo id) && occ_in_lam (idOccInfo id) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 2d3b5af..cf6a930 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -250,7 +250,6 @@ type ExitifyM = State [(JoinId, CoreExpr)] {- Note [Interesting expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - We do not want this to happen: joinrec go 0 x y = x @@ -291,7 +290,6 @@ non-imported variable. Note [Jumps can be interesting] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - A jump to a join point can be interesting, if its arguments contain free non-exported variables (z in the following example): @@ -304,16 +302,34 @@ non-exported variables (z in the following example): go (n-1) x y = jump go (n-1) (x+y) -The join point itself can be interesting, even if none if -its arguments are (assume `g` to be an imported function that, on its own, does -not make this interesting): +The join point itself can be interesting, even if none if its +arguments have free variables free in the joinrec. For example + + join j p = case p of (x,y) -> x+y + joinrec go 0 x y = jump j (x,y) + go (n-1) x y = jump go (n-1) (x+y) y + in … + +Here, `j` would not be inlined because we do not inline something that looks +like an exit join point (see Note [Do not inline exit join points]). But +if we exitify the 'jump j (x,y)' we get + + join j p = case p of (x,y) -> x+y + join exit x y = jump j (x,y) + joinrec go 0 x y = jump exit x y + go (n-1) x y = jump go (n-1) (x+y) y + in … + +and now 'j' can inline, and we get rid of the pair. Here's another +example (assume `g` to be an imported function that, on its own, +does not make this interesting): join j y = map f y joinrec go 0 x y = jump j (map g x) go (n-1) x y = jump go (n-1) (x+y) in … -Here, `j` would not be inlined because we do not inline something that looks +Again, `j` would not be inlined because we do not inline something that looks like an exit join point (see Note [Do not inline exit join points]). But after exitification we have @@ -353,7 +369,6 @@ interesting expressions. Note [Calculating free variables] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - We have two options where to annotate the tree with free variables: A) The whole tree. @@ -369,7 +384,6 @@ it would have to ensure that the annotations are correct. Note [Do not inline exit join points] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - When we have let t = foo bar @@ -396,14 +410,13 @@ occ_in_lam, because `j2` is called only once. We create exit join point ids with such an `OccInfo`, see `exit_occ_info`. -To prevent inlining, we check for that in `preInlineUnconditionally` directly. -For `postInlineUnconditionally` and unfolding-based inlining, the function -`simplLetUnfolding` simply gives exit join points no unfolding, which prevents -this kind of inlining. +To prevent inlining, we check for isExitJoinId +* In `preInlineUnconditionally` directly. +* In `simplLetUnfolding` we simply give exit join points no unfolding, which + prevents inlining in `postInlineUnconditionally` and call sites. Note [Placement of the exitification pass] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - I (Joachim) experimented with multiple positions for the Exitification pass in the Core2Core pipeline: diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index cc72f7a..db26af4 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1113,7 +1113,7 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env | not active = Nothing | isTopLevel top_lvl && isBottomingId bndr = Nothing -- Note [Top-level bottoming Ids] | isCoVar bndr = Nothing -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = Nothing + | isExitJoinId bndr = Nothing -- Note [Do not inline exit join points] in Exitify | not (one_occ (idOccInfo bndr)) = Nothing | not (isStableUnfolding unf) = Just (extend_subst_with rhs) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index a60df1c..78b62d3 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3271,7 +3271,7 @@ simplLetUnfolding env top_lvl cont_mb id new_rhs rhs_ty unf | isStableUnfolding unf = simplStableUnfolding env top_lvl cont_mb id unf rhs_ty | isExitJoinId id - = return noUnfolding -- see Note [Do not inline exit join points] + = return noUnfolding -- see Note [Do not inline exit join points] in Exitify | otherwise = mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs From git at git.haskell.org Fri Apr 6 18:49:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 Apr 2018 18:49:05 +0000 (UTC) Subject: [commit: ghc] master: base: Add dependency on GHC.Integer in a few boot files (54acfbb) Message-ID: <20180406184905.907FB3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54acfbbf64f5fcb108836412e9be0cfabf0d7801/ghc >--------------------------------------------------------------- commit 54acfbbf64f5fcb108836412e9be0cfabf0d7801 Author: Ben Gamari Date: Fri Apr 6 11:10:07 2018 -0400 base: Add dependency on GHC.Integer in a few boot files Summary: The typechecker started trying to pull in GHC.Integer.Type's interface file due to the change made in d8d4266bf73790f65b223ec16f645763eaed8be3. It's unclear why the patch in question changed this behavior, but these typechecker-induced dependencies are known to be a bit fragile and adding these imports ensures that the build order is correct. Test Plan: Validate Reviewers: goldfire, hvr Subscribers: thomie, carter GHC Trac Issues: #15004 Differential Revision: https://phabricator.haskell.org/D4560 >--------------------------------------------------------------- 54acfbbf64f5fcb108836412e9be0cfabf0d7801 libraries/base/Data/Semigroup/Internal.hs-boot | 1 + libraries/base/GHC/IO.hs-boot | 1 + 2 files changed, 2 insertions(+) diff --git a/libraries/base/Data/Semigroup/Internal.hs-boot b/libraries/base/Data/Semigroup/Internal.hs-boot index 645a088..8075024 100644 --- a/libraries/base/Data/Semigroup/Internal.hs-boot +++ b/libraries/base/Data/Semigroup/Internal.hs-boot @@ -4,6 +4,7 @@ module Data.Semigroup.Internal where import {-# SOURCE #-} GHC.Real (Integral) import {-# SOURCE #-} GHC.Base (Semigroup,Monoid,Maybe) +import GHC.Integer () -- Note [Depend on GHC.Integer] stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a diff --git a/libraries/base/GHC/IO.hs-boot b/libraries/base/GHC/IO.hs-boot index 88b09aa..f1e50fe 100644 --- a/libraries/base/GHC/IO.hs-boot +++ b/libraries/base/GHC/IO.hs-boot @@ -4,6 +4,7 @@ module GHC.IO where import GHC.Types +import GHC.Integer () -- see Note [Depend upon GHC.Integer] in libraries/base/GHC/Base.hs failIO :: [Char] -> IO a mplusIO :: IO a -> IO a -> IO a From git at git.haskell.org Fri Apr 6 18:49:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 Apr 2018 18:49:08 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Accept output for T12593 (875e59d) Message-ID: <20180406184908.6426C3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/875e59d37186a997df2cc7d0fdb49ef41d0e31ce/ghc >--------------------------------------------------------------- commit 875e59d37186a997df2cc7d0fdb49ef41d0e31ce Author: Ben Gamari Date: Fri Apr 6 11:10:25 2018 -0400 testsuite: Accept output for T12593 Summary: This seems to have changed recently but the new output looks plausible. Reviewers: RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, thomie, carter Differential Revision: https://phabricator.haskell.org/D4561 >--------------------------------------------------------------- 875e59d37186a997df2cc7d0fdb49ef41d0e31ce testsuite/tests/polykinds/T12593.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/polykinds/T12593.stderr b/testsuite/tests/polykinds/T12593.stderr index e30599d..3e63159 100644 --- a/testsuite/tests/polykinds/T12593.stderr +++ b/testsuite/tests/polykinds/T12593.stderr @@ -10,7 +10,7 @@ T12593.hs:12:31: error: • Expecting one more argument to ‘k’ Expected a type, but ‘k’ has kind - ‘(((k0 -> k1 -> TYPE t1) -> Constraint) -> k2 -> *) -> Constraint’ + ‘(((k0 -> k1 -> *) -> Constraint) -> k2 -> *) -> Constraint’ • In the kind ‘k’ In the type signature: run :: k2 q => @@ -21,7 +21,7 @@ T12593.hs:12:40: error: • Expecting two more arguments to ‘k1’ Expected a type, but ‘k1’ has kind - ‘((k0 -> k1 -> TYPE t1) -> Constraint) -> k2 -> *’ + ‘((k0 -> k1 -> *) -> Constraint) -> k2 -> *’ • In the kind ‘k1’ In the type signature: run :: k2 q => From git at git.haskell.org Fri Apr 6 20:34:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 Apr 2018 20:34:19 +0000 (UTC) Subject: [commit: ghc] wip/T15002: CSE: in bind_cse, adhere to noCSE (fixes #15002) (374a3f2) Message-ID: <20180406203419.1C65D3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/374a3f2343f06743c8ace1bbdf4be512f695e46c/ghc >--------------------------------------------------------------- commit 374a3f2343f06743c8ace1bbdf4be512f695e46c Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: in bind_cse, adhere to noCSE (fixes #15002) Previously, noCSE was only checked for self-recursive bindings, and non-recursive join points were happily CSE’ed, breaking the join point invariant. By checking noCSE in all cases of cseBind/cse_bind, this can be prevented. Eventually CSE for join points would be desirable (#13219). Differential Revision: https://phabricator.haskell.org/D4572 >--------------------------------------------------------------- 374a3f2343f06743c8ace1bbdf4be512f695e46c compiler/simplCore/CSE.hs | 21 ++++++++++++++++++++- testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 8f61128..6bdf4f0 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -276,6 +276,23 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. +Another way how CSE for joint points is tricky is + + let join foo x = (x, 42) + join bar x = (x, 42) + in … jump foo 1 … jump bar 2 … + +naively, CSE would turn this into + + let join foo x = (x, 42) + join bar = foo + in … jump foo 1 … jump bar 2 … + +but now bar is a join point with join-arity one, but a right-hand side that is +not a lambda (came up in #15002) + +Eventually we might want to teach CSE to handle join points (#13219) + Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -353,6 +370,9 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | noCSE in_id + = (env', (out_id, in_rhs)) + | otherwise = (env', (out_id', out_rhs)) where @@ -370,7 +390,6 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Note [Type-let] in CoreSyn), in which case we can just substitute. addBinding env in_id out_id rhs' | not (isId in_id) = (extendCSSubst env in_id rhs', out_id) - | noCSE in_id = (env, out_id) | use_subst = (extendCSSubst env in_id rhs', out_id) | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a521a10..016b439 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -301,3 +301,4 @@ test('T14978', normal, run_command, ['$MAKE -s --no-print-directory T14978']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Fri Apr 6 20:34:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 Apr 2018 20:34:21 +0000 (UTC) Subject: [commit: ghc] wip/T15002's head updated: CSE: in bind_cse, adhere to noCSE (fixes #15002) (374a3f2) Message-ID: <20180406203421.A0EF83A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T15002' now includes: c2f90c8 Remove unused bdescr flag BF_FREE 891ffd5 Comments only, about exitifcation 54acfbb base: Add dependency on GHC.Integer in a few boot files 875e59d testsuite: Accept output for T12593 374a3f2 CSE: in bind_cse, adhere to noCSE (fixes #15002) From git at git.haskell.org Sat Apr 7 09:11:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 09:11:19 +0000 (UTC) Subject: [commit: ghc] wip/ttg-next: WIP on TTG for HsBinds (151b14d) Message-ID: <20180407091119.20D523A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttg-next Link : http://ghc.haskell.org/trac/ghc/changeset/151b14d4b152daa70f11b3d09ec2307f4c375f01/ghc >--------------------------------------------------------------- commit 151b14d4b152daa70f11b3d09ec2307f4c375f01 Author: Alan Zimmerman Date: Wed Apr 4 21:43:25 2018 +0200 WIP on TTG for HsBinds >--------------------------------------------------------------- 151b14d4b152daa70f11b3d09ec2307f4c375f01 compiler/deSugar/Coverage.hs | 10 ++- compiler/deSugar/DsBinds.hs | 7 +- compiler/deSugar/DsExpr.hs | 9 +- compiler/deSugar/DsMeta.hs | 24 +++--- compiler/hsSyn/Convert.hs | 21 ++--- compiler/hsSyn/HsBinds.hs | 171 ++++++++++++++++++++++++++----------- compiler/hsSyn/HsExtension.hs | 112 ++++++++++++++++++++++-- compiler/hsSyn/HsUtils.hs | 16 ++-- compiler/parser/Parser.y | 38 ++++----- compiler/parser/RdrHsSyn.hs | 4 +- compiler/rename/RnBinds.hs | 104 ++++++++++++---------- compiler/rename/RnExpr.hs | 6 +- compiler/rename/RnNames.hs | 2 +- compiler/rename/RnSource.hs | 6 +- compiler/typecheck/TcBinds.hs | 33 +++---- compiler/typecheck/TcClassDcl.hs | 15 ++-- compiler/typecheck/TcEnv.hs | 4 +- compiler/typecheck/TcGenDeriv.hs | 10 +-- compiler/typecheck/TcHsSyn.hs | 31 ++++--- compiler/typecheck/TcInstDcls.hs | 16 ++-- compiler/typecheck/TcPatSyn.hs | 3 + compiler/typecheck/TcSigs.hs | 25 +++--- compiler/typecheck/TcTyClsDecls.hs | 4 +- compiler/typecheck/TcTyDecls.hs | 2 +- 24 files changed, 443 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 151b14d4b152daa70f11b3d09ec2307f4c375f01 From git at git.haskell.org Sat Apr 7 11:56:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 11:56:35 +0000 (UTC) Subject: [commit: ghc] master: Fix #14238 by always pretty-printing visible tyvars (718a018) Message-ID: <20180407115635.DD0883A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/718a018128a0ba2ae20001c10bc8ca4d929a1d33/ghc >--------------------------------------------------------------- commit 718a018128a0ba2ae20001c10bc8ca4d929a1d33 Author: Ryan Scott Date: Sat Apr 7 07:30:42 2018 -0400 Fix #14238 by always pretty-printing visible tyvars Summary: Before, GHC would never print visible tyvars in the absence of `-fprint-explicit-foralls`, which led to `:kind` displaying incorrect kinds in GHCi. The fix is simple—simply check beforehand if any of the type variable binders are required when deciding when to pretty-print them. Test Plan: make test TEST=T14238 Reviewers: simonpj, goldfire, bgamari Subscribers: thomie, carter GHC Trac Issues: #14238 Differential Revision: https://phabricator.haskell.org/D4564 >--------------------------------------------------------------- 718a018128a0ba2ae20001c10bc8ca4d929a1d33 compiler/iface/IfaceType.hs | 37 +++++++++++++++++++++++++++- testsuite/tests/dependent/ghci/T14238.script | 4 +++ testsuite/tests/dependent/ghci/T14238.stdout | 1 + testsuite/tests/dependent/ghci/all.T | 1 + testsuite/tests/ghci/scripts/T11252.stdout | 2 +- 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/compiler/iface/IfaceType.hs b/compiler/iface/IfaceType.hs index 4523093..f6493f0 100644 --- a/compiler/iface/IfaceType.hs +++ b/compiler/iface/IfaceType.hs @@ -860,11 +860,46 @@ pprIfaceSigmaType show_forall ty pprUserIfaceForAll :: [IfaceForAllBndr] -> SDoc pprUserIfaceForAll tvs = sdocWithDynFlags $ \dflags -> - ppWhen (any tv_has_kind_var tvs || gopt Opt_PrintExplicitForalls dflags) $ + -- See Note [When to print foralls] + ppWhen (any tv_has_kind_var tvs + || any tv_is_required tvs + || gopt Opt_PrintExplicitForalls dflags) $ pprIfaceForAll tvs where tv_has_kind_var (TvBndr (_,kind) _) = not (ifTypeIsVarFree kind) + tv_is_required = isVisibleArgFlag . binderArgFlag +{- +Note [When to print foralls] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We opt to explicitly pretty-print `forall`s if any of the following +criteria are met: + +1. -fprint-explicit-foralls is on. + +2. A bound type variable has a polymorphic kind. E.g., + + forall k (a::k). Proxy a -> Proxy a + + Since a's kind mentions a variable k, we print the foralls. + +3. A bound type variable is a visible argument (#14238). + Suppose we are printing the kind of: + + T :: forall k -> k -> Type + + The "forall k ->" notation means that this kind argument is required. + That is, it must be supplied at uses of T. E.g., + + f :: T (Type->Type) Monad -> Int + + So we print an explicit "T :: forall k -> k -> Type", + because omitting it and printing "T :: k -> Type" would be + utterly misleading. + + See Note [TyVarBndrs, TyVarBinders, TyConBinders, and visibility] + in TyCoRep. +-} ------------------- diff --git a/testsuite/tests/dependent/ghci/T14238.script b/testsuite/tests/dependent/ghci/T14238.script new file mode 100644 index 0000000..7c27123 --- /dev/null +++ b/testsuite/tests/dependent/ghci/T14238.script @@ -0,0 +1,4 @@ +:set -XTypeInType +:m + Data.Kind +data Foo (k :: Type) :: k -> Type +:kind Foo diff --git a/testsuite/tests/dependent/ghci/T14238.stdout b/testsuite/tests/dependent/ghci/T14238.stdout new file mode 100644 index 0000000..fddbc0d --- /dev/null +++ b/testsuite/tests/dependent/ghci/T14238.stdout @@ -0,0 +1 @@ +Foo :: forall k -> k -> * diff --git a/testsuite/tests/dependent/ghci/all.T b/testsuite/tests/dependent/ghci/all.T index 956272f..bd819c2 100644 --- a/testsuite/tests/dependent/ghci/all.T +++ b/testsuite/tests/dependent/ghci/all.T @@ -2,3 +2,4 @@ test('T11549', [ expect_broken( 11787 ), expect_broken( 11786 ) ], ghci_script, ['T11549.script']) +test('T14238', normal, ghci_script, ['T14238.script']) diff --git a/testsuite/tests/ghci/scripts/T11252.stdout b/testsuite/tests/ghci/scripts/T11252.stdout index f6d45dd..eddba45 100644 --- a/testsuite/tests/ghci/scripts/T11252.stdout +++ b/testsuite/tests/ghci/scripts/T11252.stdout @@ -1 +1 @@ -Proxy1 :: k -> * +Proxy1 :: forall k -> k -> * From git at git.haskell.org Sat Apr 7 13:01:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 13:01:47 +0000 (UTC) Subject: [commit: ghc] master: Remove HasSourceText and SourceTextX classes (5819ae2) Message-ID: <20180407130147.D8A2D3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5819ae2173d4b16f1fde067d39c3c215a6adfe97/ghc >--------------------------------------------------------------- commit 5819ae2173d4b16f1fde067d39c3c215a6adfe97 Author: Alan Zimmerman Date: Wed Mar 28 23:35:43 2018 +0200 Remove HasSourceText and SourceTextX classes Updates haddock submodule to match. Test Plan : Validate Differential Revision: https://phabricator.haskell.org/D4199 >--------------------------------------------------------------- 5819ae2173d4b16f1fde067d39c3c215a6adfe97 compiler/deSugar/Coverage.hs | 4 +- compiler/deSugar/DsMeta.hs | 6 +- compiler/hsSyn/HsBinds.hs | 38 ++++--- compiler/hsSyn/HsDecls.hs | 127 +++++++++++------------ compiler/hsSyn/HsExpr.hs | 195 +++++++++++++++++++----------------- compiler/hsSyn/HsExpr.hs-boot | 28 +++--- compiler/hsSyn/HsExtension.hs | 97 +++--------------- compiler/hsSyn/HsLit.hs | 35 +++---- compiler/hsSyn/HsPat.hs | 22 ++-- compiler/hsSyn/HsPat.hs-boot | 5 +- compiler/hsSyn/HsSyn.hs | 4 +- compiler/hsSyn/HsTypes.hs | 73 +++++++------- compiler/hsSyn/HsUtils.hs | 63 ++++++------ compiler/parser/Parser.y | 29 +++--- compiler/rename/RnExpr.hs | 2 +- compiler/typecheck/Inst.hs | 6 +- compiler/typecheck/TcAnnotations.hs | 2 +- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcEnv.hs | 6 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcMatches.hs | 10 +- compiler/typecheck/TcTypeable.hs | 8 +- utils/haddock | 2 +- 23 files changed, 344 insertions(+), 424 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 5819ae2173d4b16f1fde067d39c3c215a6adfe97 From git at git.haskell.org Sat Apr 7 19:44:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 19:44:29 +0000 (UTC) Subject: [commit: ghc] master: Collect build artifacts with S3 (d386cd6) Message-ID: <20180407194429.F29F63A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d386cd67662a9ece05fb094252668e3f5f8ce5e2/ghc >--------------------------------------------------------------- commit d386cd67662a9ece05fb094252668e3f5f8ce5e2 Author: mrkkrp Date: Fri Mar 30 17:18:16 2018 +0700 Collect build artifacts with S3 >--------------------------------------------------------------- d386cd67662a9ece05fb094252668e3f5f8ce5e2 .appveyor.sh | 3 ++- .circleci/config.yml | 42 ++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.appveyor.sh b/.appveyor.sh index 97d0fdb..22cc520 100644 --- a/.appveyor.sh +++ b/.appveyor.sh @@ -33,7 +33,8 @@ EOF "test") make test THREADS=$THREADS make binary-dist - 7z a ghc-windows.zip *.tar.xz + curl https://ghc-artifacts.s3.amazonaws.com/tools/ghc-artifact-collector-x86_64-windows --output ghc-artifact-collector + ./ghc-artifact-collector *.tar.xz ;; *) diff --git a/.circleci/config.yml b/.circleci/config.yml index e42d849..2d0e645 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,19 +69,17 @@ aliases: # Building bindist takes ~15 minutes without output, account for # that. no_output_timeout: "30m" - - &collectartifacts + - &storeartifacts run: - name: Collect artifacts - # We need this because CircleCI expects a path without - # wildcards but bindist archive name is not static + name: Store artifacts command: | - mkdir -p /tmp/artifacts - pwd - find . - cp ghc*.tar.xz /tmp/artifacts - - &storeartifacts - store-artifacts: - path: /tmp/artifacts + curl https://ghc-artifacts.s3.amazonaws.com/tools/ghc-artifact-collector-$GHC_COLLECTOR_FLAVOR --output ghc-artifact-collector + chmod +x ghc-artifact-collector + ./ghc-artifact-collector ghc*.tar.xz + - &trigger_on_tags + filters: + tags: + only: /^ghc-.*/ jobs: "validate-x86_64-linux": @@ -90,6 +88,7 @@ jobs: - image: ghcci/x86_64-linux:0.0.1 environment: <<: *buildenv + GHC_COLLECTOR_FLAVOR: x86_64-linux steps: - checkout - *prepare @@ -99,7 +98,6 @@ jobs: - *make - *test - *bindist - - *collectartifacts - *storeartifacts "validate-x86_64-freebsd": @@ -109,6 +107,7 @@ jobs: environment: TARGET: FreeBSD <<: *buildenv + GHC_COLLECTOR_FLAVOR: x86_64-freebsd steps: - checkout - *prepare @@ -118,7 +117,6 @@ jobs: - *make - *test - *bindist - - *collectartifacts - *storeartifacts "validate-x86_64-darwin": @@ -130,6 +128,7 @@ jobs: ac_cv_func_clock_gettime: "no" environment: <<: *buildenv + GHC_COLLECTOR_FLAVOR: x86_64-darwin steps: - checkout - *prepare @@ -139,7 +138,6 @@ jobs: - *make - *test - *bindist - - *collectartifacts - *storeartifacts "validate-hadrian-x86_64-linux": @@ -218,6 +216,7 @@ jobs: - image: ghcci/i386-linux:0.0.1 environment: <<: *buildenv + GHC_COLLECTOR_FLAVOR: i386-linux steps: - checkout - *prepare @@ -227,7 +226,6 @@ jobs: - *make - *test - *bindist - - *collectartifacts - *storeartifacts "validate-x86_64-fedora": @@ -236,6 +234,7 @@ jobs: - image: ghcci/x86_64-linux-fedora:0.0.2 environment: <<: *buildenv + GHC_COLLECTOR_FLAVOR: x86_64-linux steps: - checkout - *prepare @@ -245,21 +244,24 @@ jobs: - *make - *test - *bindist - - *collectartifacts - *storeartifacts workflows: version: 2 validate: jobs: - - validate-x86_64-linux + - validate-x86_64-linux: + *trigger_on_tags # FreeBSD disabled: https://github.com/haskell/unix/issues/102 # - validate-x86_64-freebsd - - validate-x86_64-darwin + - validate-x86_64-darwin: + *trigger_on_tags - validate-x86_64-linux-llvm - - validate-i386-linux + - validate-i386-linux: + *trigger_on_tags - validate-hadrian-x86_64-linux - - validate-x86_64-fedora + - validate-x86_64-fedora: + *trigger_on_tags nightly: triggers: From git at git.haskell.org Sat Apr 7 19:44:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 19:44:43 +0000 (UTC) Subject: [commit: ghc] master: Document SumTyCon (26cfe29) Message-ID: <20180407194443.E1F083A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/26cfe291c5d581299a40ae5177979ddf1b465ec0/ghc >--------------------------------------------------------------- commit 26cfe291c5d581299a40ae5177979ddf1b465ec0 Author: Simon Jakobi Date: Mon Apr 2 21:29:02 2018 +0200 Document SumTyCon >--------------------------------------------------------------- 26cfe291c5d581299a40ae5177979ddf1b465ec0 compiler/types/TyCon.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 072e397..67c7b1b 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -863,6 +863,7 @@ data AlgTyConRhs -- tuple? } + -- | An unboxed sum type. | SumTyCon { data_cons :: [DataCon], data_cons_size :: Int -- ^ Cached value: length data_cons From git at git.haskell.org Sat Apr 7 19:44:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 19:44:58 +0000 (UTC) Subject: [commit: ghc] master: Improve documentation for refineDefaultAlt (7bd7fec) Message-ID: <20180407194458.0AA093A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd/ghc >--------------------------------------------------------------- commit 7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd Author: Simon Jakobi Date: Mon Apr 2 22:27:44 2018 +0200 Improve documentation for refineDefaultAlt >--------------------------------------------------------------- 7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd compiler/coreSyn/CoreUtils.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 5608afc..792da99 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -645,12 +645,13 @@ filterAlts _tycon inst_tys imposs_cons alts impossible_alt inst_tys (DataAlt con, _, _) = dataConCannotMatch inst_tys con impossible_alt _ _ = False -refineDefaultAlt :: [Unique] -> TyCon -> [Type] - -> [AltCon] -- Constructors that cannot match the DEFAULT (if any) +-- | Refine the default alternative to a 'DataAlt', if there is a unique way to do so. +refineDefaultAlt :: [Unique] -- ^ Uniques for constructing new binders + -> TyCon -- ^ Type constructor of scrutinee's type + -> [Type] -- ^ Type arguments of scrutinee's type + -> [AltCon] -- ^ Constructors that cannot match the DEFAULT (if any) -> [CoreAlt] - -> (Bool, [CoreAlt]) --- Refine the default alternative to a DataAlt, --- if there is a unique way to do so + -> (Bool, [CoreAlt]) -- ^ 'True', if a default alt was replaced with a 'DataAlt' refineDefaultAlt us tycon tys imposs_deflt_cons all_alts | (DEFAULT,_,rhs) : rest_alts <- all_alts , isAlgTyCon tycon -- It's a data type, tuple, or unboxed tuples. From git at git.haskell.org Sat Apr 7 19:45:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 19:45:14 +0000 (UTC) Subject: [commit: ghc] master: Run tests after artifact collection (605ae8d) Message-ID: <20180407194514.360B73A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/605ae8dd28ef71f13d0e5346b8798a6c41c459d0/ghc >--------------------------------------------------------------- commit 605ae8dd28ef71f13d0e5346b8798a6c41c459d0 Author: mrkkrp Date: Wed Apr 4 20:38:54 2018 +0700 Run tests after artifact collection Since for every job there are failing tests, if we try to upload artifacts after tests, we won't get any. As a temporary measure I suggest uploading artifacts before running tests. Once tests are fixed, we should peform artifact uploading after tests again. >--------------------------------------------------------------- 605ae8dd28ef71f13d0e5346b8798a6c41c459d0 .appveyor.sh | 2 +- .circleci/config.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.appveyor.sh b/.appveyor.sh index 22cc520..1a3e597 100644 --- a/.appveyor.sh +++ b/.appveyor.sh @@ -31,10 +31,10 @@ EOF ;; "test") - make test THREADS=$THREADS make binary-dist curl https://ghc-artifacts.s3.amazonaws.com/tools/ghc-artifact-collector-x86_64-windows --output ghc-artifact-collector ./ghc-artifact-collector *.tar.xz + make test THREADS=$THREADS ;; *) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d0e645..bb071bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,9 +96,9 @@ jobs: - *boot - *configure_unix - *make - - *test - *bindist - *storeartifacts + - *test "validate-x86_64-freebsd": resource_class: xlarge @@ -115,9 +115,9 @@ jobs: - *boot - *configure_bsd - *make - - *test - *bindist - *storeartifacts + - *test "validate-x86_64-darwin": macos: @@ -136,9 +136,9 @@ jobs: - *boot - *configure_unix - *make - - *test - *bindist - *storeartifacts + - *test "validate-hadrian-x86_64-linux": resource_class: xlarge @@ -224,9 +224,9 @@ jobs: - *boot - *configure_unix_32 - *make - - *test - *bindist - *storeartifacts + - *test "validate-x86_64-fedora": resource_class: xlarge @@ -242,9 +242,9 @@ jobs: - *boot - *configure_unix - *make - - *test - *bindist - *storeartifacts + - *test workflows: version: 2 From git at git.haskell.org Sat Apr 7 19:45:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 19:45:28 +0000 (UTC) Subject: [commit: ghc] master: CoreUtils.filterAlts: Correct docs (a5bfb7e) Message-ID: <20180407194528.354A33A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a5bfb7e143d826db310f5c632a90d39de62c7aa3/ghc >--------------------------------------------------------------- commit a5bfb7e143d826db310f5c632a90d39de62c7aa3 Author: Simon Jakobi Date: Thu Apr 5 00:00:25 2018 +0200 CoreUtils.filterAlts: Correct docs `refineDefaultAlt` takes care of refining the default alt these days. >--------------------------------------------------------------- a5bfb7e143d826db310f5c632a90d39de62c7aa3 compiler/coreSyn/CoreUtils.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 792da99..3c5cb34 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -614,8 +614,6 @@ filterAlts :: TyCon -- ^ Type constructor of scrutinee's type (us -- 2. The new alternatives, trimmed by -- a) remove imposs_cons -- b) remove constructors which can't match because of GADTs - -- and with the DEFAULT expanded to a DataAlt if there is exactly - -- remaining constructor that can match -- -- NB: the final list of alternatives may be empty: -- This is a tricky corner case. If the data type has no constructors, From git at git.haskell.org Sat Apr 7 19:45:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 Apr 2018 19:45:42 +0000 (UTC) Subject: [commit: ghc] master: docs(Data.Function): fix and augment `on` annotation (8b823f2) Message-ID: <20180407194542.D3A933A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8b823f270e53627ddca1a993c05f1ab556742d96/ghc >--------------------------------------------------------------- commit 8b823f270e53627ddca1a993c05f1ab556742d96 Author: Gabriel Lebec Date: Sat Apr 7 12:57:36 2018 -0400 docs(Data.Function): fix and augment `on` annotation >--------------------------------------------------------------- 8b823f270e53627ddca1a993c05f1ab556742d96 libraries/base/Data/Function.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/base/Data/Function.hs b/libraries/base/Data/Function.hs index ccc58c7..c54e81f 100644 --- a/libraries/base/Data/Function.hs +++ b/libraries/base/Data/Function.hs @@ -50,18 +50,21 @@ infixl 1 & fix :: (a -> a) -> a fix f = let x = f x in x --- | @((==) \`on\` f) x y = f x == f y@ +-- | @'on' b u x y@ runs the binary function `b` /on/ the results of applying unary function `u` to two arguments `x` and `y`. From the opposite perspective, it transforms two inputs and combines the outputs. +-- +-- @((+) \``on`\` f) x y = f x + f y@ -- -- Typical usage: @'Data.List.sortBy' ('compare' \`on\` 'fst')@. - +-- -- Algebraic properties: -- --- * @(*) \`on\` 'id' = (*)@ (if @(*) ∉ {⊥, 'const' ⊥}@) +-- * @(*) \`on\` 'id' = (*) -- (if (*) ∉ {⊥, 'const' ⊥})@ -- -- * @((*) \`on\` f) \`on\` g = (*) \`on\` (f . g)@ -- -- * @'flip' on f . 'flip' on g = 'flip' on (g . f)@ - +on :: (b -> b -> c) -> (a -> b) -> a -> a -> c +(.*.) `on` f = \x y -> f x .*. f y -- Proofs (so that I don't have to edit the test-suite): -- (*) `on` id @@ -102,9 +105,6 @@ fix f = let x = f x in x -- = -- flip on (g . f) -on :: (b -> b -> c) -> (a -> b) -> a -> a -> c -(.*.) `on` f = \x y -> f x .*. f y - -- | '&' is a reverse application operator. This provides notational -- convenience. Its precedence is one higher than that of the forward From git at git.haskell.org Sun Apr 8 15:09:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 8 Apr 2018 15:09:15 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg: Restore TTG 1 (b92ed28) Message-ID: <20180408150915.34D2E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/restore-ttg Link : http://ghc.haskell.org/trac/ghc/changeset/b92ed2812cb9ea121b952902eae2475c00772791/ghc >--------------------------------------------------------------- commit b92ed2812cb9ea121b952902eae2475c00772791 Author: Alan Zimmerman Date: Sun Apr 1 21:33:53 2018 +0200 Restore TTG 1 First commit restored Was D4186 >--------------------------------------------------------------- b92ed2812cb9ea121b952902eae2475c00772791 compiler/deSugar/Check.hs | 53 +-- compiler/deSugar/Coverage.hs | 8 +- compiler/deSugar/DsArrows.hs | 30 +- compiler/deSugar/DsExpr.hs | 7 +- compiler/deSugar/DsMeta.hs | 112 +++--- compiler/deSugar/DsUtils.hs | 63 ++-- compiler/deSugar/Match.hs | 71 ++-- compiler/deSugar/MatchLit.hs | 27 +- compiler/hsSyn/Convert.hs | 163 +++++---- compiler/hsSyn/HsBinds.hs | 105 ++++-- compiler/hsSyn/HsDecls.hs | 59 +-- compiler/hsSyn/HsExpr.hs | 34 +- compiler/hsSyn/HsExpr.hs-boot | 14 +- compiler/hsSyn/HsExtension.hs | 273 +++++++++++--- compiler/hsSyn/HsLit.hs | 64 +++- compiler/hsSyn/HsPat.hs | 294 +++++++++------ compiler/hsSyn/HsPat.hs-boot | 4 +- compiler/hsSyn/HsSyn.hs | 2 +- compiler/hsSyn/HsTypes.hs | 402 ++++++++++++++------- compiler/hsSyn/HsUtils.hs | 223 ++++++------ compiler/hsSyn/PlaceHolder.hs | 9 +- compiler/main/HscStats.hs | 2 +- compiler/main/InteractiveEval.hs | 3 +- compiler/parser/Parser.y | 100 ++--- compiler/parser/RdrHsSyn.hs | 130 +++---- compiler/rename/RnBinds.hs | 14 +- compiler/rename/RnExpr.hs | 46 ++- compiler/rename/RnFixity.hs | 5 +- compiler/rename/RnNames.hs | 8 +- compiler/rename/RnPat.hs | 93 ++--- compiler/rename/RnSource.hs | 14 +- compiler/rename/RnSplice.hs | 16 +- compiler/rename/RnSplice.hs-boot | 4 +- compiler/rename/RnTypes.hs | 283 ++++++++------- compiler/typecheck/Inst.hs | 16 +- compiler/typecheck/TcBinds.hs | 10 +- compiler/typecheck/TcDeriv.hs | 3 +- compiler/typecheck/TcExpr.hs | 43 ++- compiler/typecheck/TcGenDeriv.hs | 15 +- compiler/typecheck/TcGenFunctor.hs | 1 + compiler/typecheck/TcHsSyn.hs | 130 +++---- compiler/typecheck/TcHsType.hs | 82 +++-- compiler/typecheck/TcInstDcls.hs | 3 +- compiler/typecheck/TcPat.hs | 81 +++-- compiler/typecheck/TcPatSyn.hs | 86 ++--- compiler/typecheck/TcRnDriver.hs | 30 +- compiler/typecheck/TcTyClsDecls.hs | 15 +- compiler/typecheck/TcTyDecls.hs | 7 +- ghc/GHCi/UI/Info.hs | 4 +- .../parser/should_compile/DumpParsedAst.stderr | 25 +- .../parser/should_compile/DumpRenamedAst.stderr | 138 ++++--- .../tests/parser/should_compile/T14189.stderr | 13 +- testsuite/tests/perf/haddock/all.T | 1 + testsuite/tests/quasiquotation/T7918.hs | 4 +- utils/ghctags/Main.hs | 25 +- utils/haddock | 2 +- 56 files changed, 2078 insertions(+), 1391 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 b92ed2812cb9ea121b952902eae2475c00772791 From git at git.haskell.org Sun Apr 8 15:09:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 8 Apr 2018 15:09:23 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg's head updated: Restore TTG Path 3 (5b13283) Message-ID: <20180408150923.374423A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/restore-ttg' now includes: faec8d3 Track type variable scope more carefully. ef44382 Apply the interim fix for #14119 to liftCoMatch 3eaa55d Apply Note [EtaAppCo] in OptCoercion to another case 1845d1b Clarify comments around dropping Derived constraints 07abff7 Test #14884, #14969 9187d5f Allow unpacking of single-data-con GADTs 5ab8094 SpecConstr: accommodate casts in value arguments ddf8955 Mark test as expected to pass. d8d4266 Fix #14991. 72b5f64 Fix accidental breakage in T7050 c2f90c8 Remove unused bdescr flag BF_FREE 891ffd5 Comments only, about exitifcation 54acfbb base: Add dependency on GHC.Integer in a few boot files 875e59d testsuite: Accept output for T12593 718a018 Fix #14238 by always pretty-printing visible tyvars 5819ae2 Remove HasSourceText and SourceTextX classes d386cd6 Collect build artifacts with S3 26cfe29 Document SumTyCon 7bd7fec Improve documentation for refineDefaultAlt 605ae8d Run tests after artifact collection a5bfb7e CoreUtils.filterAlts: Correct docs 8b823f2 docs(Data.Function): fix and augment `on` annotation b92ed28 Restore TTG 1 4e038c9 Restore TTG patch #2 5b13283 Restore TTG Path 3 From git at git.haskell.org Sun Apr 8 15:09:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 8 Apr 2018 15:09:21 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg: Restore TTG Path 3 (5b13283) Message-ID: <20180408150921.0CB763A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/restore-ttg Link : http://ghc.haskell.org/trac/ghc/changeset/5b132838e86d0fc4ad647a80c7b889fbcf3cafa7/ghc >--------------------------------------------------------------- commit 5b132838e86d0fc4ad647a80c7b889fbcf3cafa7 Author: Alan Zimmerman Date: Mon Apr 2 10:33:49 2018 +0200 Restore TTG Path 3 Originally 47ad6578ea460999b53eb4293c3a3b3017a56d65 >--------------------------------------------------------------- 5b132838e86d0fc4ad647a80c7b889fbcf3cafa7 compiler/deSugar/Coverage.hs | 59 +++--- compiler/deSugar/DsArrows.hs | 33 ++-- compiler/deSugar/DsExpr.hs | 3 +- compiler/deSugar/DsListComp.hs | 20 +- compiler/deSugar/DsMeta.hs | 33 ++-- compiler/deSugar/Match.hs | 4 +- compiler/deSugar/PmExpr.hs | 2 +- compiler/hsSyn/Convert.hs | 17 +- compiler/hsSyn/HsBinds.hs | 36 +--- compiler/hsSyn/HsDecls.hs | 6 +- compiler/hsSyn/HsExpr.hs | 231 ++++++++++++++++------- compiler/hsSyn/HsExtension.hs | 129 ++++++++++++- compiler/hsSyn/HsPat.hs | 1 - compiler/hsSyn/HsTypes.hs | 14 +- compiler/hsSyn/HsUtils.hs | 46 ++--- compiler/hsSyn/PlaceHolder.hs | 10 +- compiler/parser/Parser.y | 34 ++-- compiler/parser/RdrHsSyn.hs | 30 +-- compiler/rename/RnExpr.hs | 85 +++++---- compiler/rename/RnPat.hs | 6 +- compiler/rename/RnSplice.hs | 67 ++++--- compiler/rename/RnTypes.hs | 15 +- compiler/typecheck/TcArrows.hs | 53 +++--- compiler/typecheck/TcExpr.hs | 7 +- compiler/typecheck/TcHsSyn.hs | 61 +++--- compiler/typecheck/TcHsType.hs | 7 +- compiler/typecheck/TcMatches.hs | 11 +- compiler/typecheck/TcPat.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 6 +- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcSplice.hs | 20 +- compiler/typecheck/TcTyClsDecls.hs | 2 +- compiler/typecheck/TcTyDecls.hs | 2 +- testsuite/tests/ghc-api/annotations/parseTree.hs | 4 +- testsuite/tests/perf/haddock/all.T | 5 +- utils/haddock | 2 +- 36 files changed, 638 insertions(+), 427 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 5b132838e86d0fc4ad647a80c7b889fbcf3cafa7 From git at git.haskell.org Sun Apr 8 15:09:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 8 Apr 2018 15:09:18 +0000 (UTC) Subject: [commit: ghc] wip/restore-ttg: Restore TTG patch #2 (4e038c9) Message-ID: <20180408150918.24A733A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/restore-ttg Link : http://ghc.haskell.org/trac/ghc/changeset/4e038c9aac531ffb2c17b9178137612c0a846af6/ghc >--------------------------------------------------------------- commit 4e038c9aac531ffb2c17b9178137612c0a846af6 Author: Alan Zimmerman Date: Mon Apr 2 08:34:24 2018 +0200 Restore TTG patch #2 This was originally e3ec2e7ae94524ebd111963faf34b84d942265b4 >--------------------------------------------------------------- 4e038c9aac531ffb2c17b9178137612c0a846af6 compiler/deSugar/Check.hs | 8 +- compiler/deSugar/Coverage.hs | 147 ++++--- compiler/deSugar/DsArrows.hs | 17 +- compiler/deSugar/DsExpr.hs | 114 ++--- compiler/deSugar/DsGRHSs.hs | 15 +- compiler/deSugar/DsMeta.hs | 51 ++- compiler/deSugar/Match.hs | 32 +- compiler/deSugar/MatchLit.hs | 8 +- compiler/deSugar/PmExpr.hs | 37 +- compiler/hsSyn/Convert.hs | 76 ++-- compiler/hsSyn/HsExpr.hs | 471 +++++++++++++-------- compiler/hsSyn/HsExtension.hs | 119 ++++++ compiler/hsSyn/HsPat.hs | 10 - compiler/hsSyn/HsUtils.hs | 115 ++--- compiler/hsSyn/PlaceHolder.hs | 6 - compiler/main/InteractiveEval.hs | 2 +- compiler/parser/Parser.y | 145 ++++--- compiler/parser/RdrHsSyn.hs | 131 +++--- compiler/rename/RnEnv.hs | 4 +- compiler/rename/RnExpr.hs | 196 ++++----- compiler/rename/RnPat.hs | 6 +- compiler/rename/RnSource.hs | 15 +- compiler/rename/RnSplice.hs | 18 +- compiler/rename/RnTypes.hs | 41 +- compiler/typecheck/Inst.hs | 6 +- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcExpr.hs | 205 ++++----- compiler/typecheck/TcGenDeriv.hs | 10 +- compiler/typecheck/TcHsSyn.hs | 146 +++---- compiler/typecheck/TcInstDcls.hs | 18 +- compiler/typecheck/TcMatches.hs | 10 +- compiler/typecheck/TcPatSyn.hs | 32 +- compiler/typecheck/TcRnDriver.hs | 9 +- compiler/typecheck/TcRnTypes.hs | 91 ++-- compiler/typecheck/TcSplice.hs | 9 +- compiler/typecheck/TcTyDecls.hs | 6 +- ghc/GHCi/UI.hs | 4 +- ghc/GHCi/UI/Info.hs | 8 +- testsuite/tests/ghc-api/annotations/parseTree.hs | 6 +- .../tests/ghc-api/annotations/stringSource.hs | 6 +- testsuite/tests/ghc-api/annotations/t11430.hs | 2 +- .../parser/should_compile/DumpParsedAst.stderr | 3 + .../parser/should_compile/DumpRenamedAst.stderr | 3 + .../should_compile/DumpTypecheckedAst.stderr | 73 ++++ testsuite/tests/perf/haddock/all.T | 1 + testsuite/tests/quasiquotation/T7918.hs | 2 +- 46 files changed, 1395 insertions(+), 1043 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 4e038c9aac531ffb2c17b9178137612c0a846af6 From git at git.haskell.org Mon Apr 9 15:25:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 15:25:23 +0000 (UTC) Subject: [commit: ghc] master: Some cleanup of the Exitification code (b14c037) Message-ID: <20180409152523.BD8243A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b14c03737574895718eed786a60dfdfd42ab49ce/ghc >--------------------------------------------------------------- commit b14c03737574895718eed786a60dfdfd42ab49ce Author: Joachim Breitner Date: Fri Apr 6 17:26:45 2018 -0400 Some cleanup of the Exitification code based on a thorough review by Simon in comments https://ghc.haskell.org/trac/ghc/ticket/14152#comment:33 through 37. The changes are: * `isExitJoinId` is moved to `SimplUtils`, because it is only valid when occurrence information is up-to-date. * Abstracted variables are properly sorted using `sortQuantVars` * Exitification does not set occ info. And then minor quibles to notes and avoiding some unhelpful shadowing of local names. Differential Revision: https://phabricator.haskell.org/D4576 >--------------------------------------------------------------- b14c03737574895718eed786a60dfdfd42ab49ce compiler/basicTypes/Id.hs | 6 +----- compiler/simplCore/Exitify.hs | 45 ++++++++++++++++++++++------------------ compiler/simplCore/SimplUtils.hs | 12 ++++++++++- 3 files changed, 37 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 b14c03737574895718eed786a60dfdfd42ab49ce From git at git.haskell.org Mon Apr 9 16:09:22 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 16:09:22 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T14737-patch: Bump perf test targets (0579534) Message-ID: <20180409160922.70ED53A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T14737-patch Link : http://ghc.haskell.org/trac/ghc/changeset/05795345a2356c037d97493bdb0ed9487cf22cb4/ghc >--------------------------------------------------------------- commit 05795345a2356c037d97493bdb0ed9487cf22cb4 Author: Tobias Dammers Date: Mon Apr 9 18:08:15 2018 +0200 Bump perf test targets Collateral to #14737: a handful of tests perform somewhat worse with this patch. >--------------------------------------------------------------- 05795345a2356c037d97493bdb0ed9487cf22cb4 testsuite/tests/perf/compiler/all.T | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 4c2462c..537c9b5 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -476,12 +476,13 @@ test('parsing001', [(wordsize(32), 232777056, 10), # Initial: 274000576 # 2017-03-24: 232777056 - (wordsize(64), 490228304, 5)]), + (wordsize(64), 519401296, 5)]), # expected value: 587079016 (amd64/Linux) # 2016-09-01: 581551384 (amd64/Linux) Restore w/w limit (#11565) # 2016-12-19: 493730288 (amd64/Linux) Join points (#12988) # 2017-02-14: 463931280 Early inlining patch; acutal improvement 7% # 2017-12-11: 490228304 BlockArguments + # 2018-04-09: 519401296 Inexplicable, collateral of #14737 only_ways(['normal']), ], compile_fail, ['']) @@ -744,7 +745,7 @@ test('T9020', # 2014-07-31: 343005716 (Windows) (general round of updates) # 2017-03-24: 249904136 (x86/Linux, 64-bit machine) - (wordsize(64), 423163832, 10)]) + (wordsize(64), 562206104, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -758,6 +759,7 @@ test('T9020', # Program size collapses in first simplification # 2017-03-31: 493596312 Fix memory leak in simplifier # 2017-04-28: 423163832 Remove exponential behaviour in simplifier + # 2018-04-09: 562206104 Inexplicable, collateral of #14737 ], compile,['']) @@ -1109,7 +1111,7 @@ test('T13056', test('T12707', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1163821528, 5), + [(wordsize(64), 1237898376, 5), # initial: 1271577192 # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) @@ -1117,6 +1119,7 @@ test('T12707', # 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin) # 2017-03-02: 1231809592 Drift from recent simplifier improvements # 2017-05-14: 1163821528 (amd64/Linux) Two-pass CmmLayoutStack + # 2018-04-09: 1237898376 Inexplicable, collateral of #14737 ]), ], compile, From git at git.haskell.org Mon Apr 9 17:14:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 17:14:15 +0000 (UTC) Subject: [commit: ghc] master: Bump template-haskell to 2.14.0.0 (48f55e7) Message-ID: <20180409171415.E09AC3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48f55e764bb41848cff759fbea3211d8a0bbfd5b/ghc >--------------------------------------------------------------- commit 48f55e764bb41848cff759fbea3211d8a0bbfd5b Author: Ryan Scott Date: Mon Apr 9 12:56:51 2018 -0400 Bump template-haskell to 2.14.0.0 Summary: There has been at least one breaking change to `template-haskell` (the removal of `qAddForeignFile`) which is causing packages like `th-orphans` and `singletons` to fail to build with GHC HEAD. Let's bump `template-haskell`'s major version number so that these packages can properly guard against these changes. While I was in town, I also started a `changelog` section for the next major version of `template-haskell`, and copied over finishing touches for `template-haskell-2.13.0.0`. Test Plan: ./validate Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4558 >--------------------------------------------------------------- 48f55e764bb41848cff759fbea3211d8a0bbfd5b compiler/ghc.cabal.in | 2 +- libraries/ghci/ghci.cabal.in | 2 +- libraries/template-haskell/changelog.md | 20 ++++++++++++++++++-- libraries/template-haskell/template-haskell.cabal | 2 +- testsuite/tests/th/TH_Roles2.stderr | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 5ffc3ce..a349904 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -59,7 +59,7 @@ Library containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, - template-haskell == 2.13.*, + template-haskell == 2.14.*, hpc == 0.6.*, transformers == 0.5.*, ghc-boot == @ProjectVersionMunged@, diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in index c22f605..595f8de 100644 --- a/libraries/ghci/ghci.cabal.in +++ b/libraries/ghci/ghci.cabal.in @@ -77,7 +77,7 @@ library filepath == 1.4.*, ghc-boot == @ProjectVersionMunged@, ghc-boot-th == @ProjectVersionMunged@, - template-haskell == 2.13.*, + template-haskell == 2.14.*, transformers == 0.5.* if !os(windows) diff --git a/libraries/template-haskell/changelog.md b/libraries/template-haskell/changelog.md index b472832..41b7eea 100644 --- a/libraries/template-haskell/changelog.md +++ b/libraries/template-haskell/changelog.md @@ -1,8 +1,24 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) -## 2.13.0.0 *TBA* +## 2.14.0.0 *TBA* - * Bundled with GHC *TBA* + * Introduce an `addForeignFilePath` function, as well as a corresponding + `qAddForeignFile` class method to `Quasi`. Unlike `addForeingFile`, which + takes the contents of the file as an argument, `addForeignFilePath` takes + as an argument a path pointing to a foreign file. A new `addForeignSource` + function has also been added which takes a file's contents as an argument. + + The old `addForeignFile` function is now deprecated in favor of + `addForeignSource`, and the `qAddForeignFile` method of `Quasi` has been + removed entirely. + + * Introduce an `addTempFile` function, as well as a corresponding + `qAddTempFile` method to `Quasi`, which requests a temporary file of + a given suffix. + +## 2.13.0.0 *March 2018* + + * Bundled with GHC 8.4.1 * `Language.Haskell.TH.FamFlavour`, which was deprecated in 2.11, has been removed. diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index 7770a38..b0bc10e 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -1,5 +1,5 @@ name: template-haskell -version: 2.13.0.0 +version: 2.14.0.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index b8e0d72..09b4bea 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -6,7 +6,7 @@ COERCION AXIOMS Dependent modules: [] Dependent packages: [array-0.5.2.0, base-4.11.0.0, deepseq-1.4.3.0, ghc-boot-th-8.3, ghc-prim-0.5.2.0, integer-gmp-1.0.1.0, - pretty-1.1.3.5, template-haskell-2.13.0.0] + pretty-1.1.3.5, template-haskell-2.14.0.0] ==================== Typechecker ==================== TH_Roles2.$tcT From git at git.haskell.org Mon Apr 9 18:58:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 18:58:26 +0000 (UTC) Subject: [commit: ghc] wip/T15002: CSE: in bind_cse, adhere to noCSE (fixes #15002) (40b0fe5) Message-ID: <20180409185826.D68D13A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/40b0fe5e82d8213a03abdd2f9fb7c8edacf02f47/ghc >--------------------------------------------------------------- commit 40b0fe5e82d8213a03abdd2f9fb7c8edacf02f47 Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: in bind_cse, adhere to noCSE (fixes #15002) Previously, noCSE was only checked for self-recursive bindings, and non-recursive join points were happily CSE’ed, breaking the join point invariant. By checking noCSE in all cases of cseBind/cse_bind, this can be prevented. Eventually CSE for join points would be desirable (#13219). Differential Revision: https://phabricator.haskell.org/D4572 >--------------------------------------------------------------- 40b0fe5e82d8213a03abdd2f9fb7c8edacf02f47 compiler/simplCore/CSE.hs | 21 ++++++++++++++++++++- testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 8f61128..6bdf4f0 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -276,6 +276,23 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. +Another way how CSE for joint points is tricky is + + let join foo x = (x, 42) + join bar x = (x, 42) + in … jump foo 1 … jump bar 2 … + +naively, CSE would turn this into + + let join foo x = (x, 42) + join bar = foo + in … jump foo 1 … jump bar 2 … + +but now bar is a join point with join-arity one, but a right-hand side that is +not a lambda (came up in #15002) + +Eventually we might want to teach CSE to handle join points (#13219) + Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -353,6 +370,9 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | noCSE in_id + = (env', (out_id, in_rhs)) + | otherwise = (env', (out_id', out_rhs)) where @@ -370,7 +390,6 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Note [Type-let] in CoreSyn), in which case we can just substitute. addBinding env in_id out_id rhs' | not (isId in_id) = (extendCSSubst env in_id rhs', out_id) - | noCSE in_id = (env, out_id) | use_subst = (extendCSSubst env in_id rhs', out_id) | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a521a10..016b439 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -301,3 +301,4 @@ test('T14978', normal, run_command, ['$MAKE -s --no-print-directory T14978']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Mon Apr 9 18:58:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 18:58:32 +0000 (UTC) Subject: [commit: ghc] wip/T15002's head updated: Fix #15002 more carefully (e0d22dd) Message-ID: <20180409185832.2E1673A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T15002' now includes: 718a018 Fix #14238 by always pretty-printing visible tyvars 5819ae2 Remove HasSourceText and SourceTextX classes d386cd6 Collect build artifacts with S3 26cfe29 Document SumTyCon 7bd7fec Improve documentation for refineDefaultAlt 605ae8d Run tests after artifact collection a5bfb7e CoreUtils.filterAlts: Correct docs 8b823f2 docs(Data.Function): fix and augment `on` annotation b14c037 Some cleanup of the Exitification code 40b0fe5 CSE: in bind_cse, adhere to noCSE (fixes #15002) e0d22dd Fix #15002 more carefully From git at git.haskell.org Mon Apr 9 18:58:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 18:58:29 +0000 (UTC) Subject: [commit: ghc] wip/T15002: Fix #15002 more carefully (e0d22dd) Message-ID: <20180409185829.9F1CC3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/e0d22dded6953cd1d55736f2f40895c492970873/ghc >--------------------------------------------------------------- commit e0d22dded6953cd1d55736f2f40895c492970873 Author: Joachim Breitner Date: Mon Apr 9 14:54:06 2018 -0400 Fix #15002 more carefully `noCSE` checks a bunch of conditions, and adding that check to all branches of `cseBind` causes regressions. So, to understand the situation better, let’s just check `isJoinId` and see if that fixes the bug without causing regressions. Maybe `noCSE` is only about what should be added to the the CSEnv, and the question of “which RHSs” should be CSEd needs to be answered differently. >--------------------------------------------------------------- e0d22dded6953cd1d55736f2f40895c492970873 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 6bdf4f0..865ab6a 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -370,7 +370,7 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) - | noCSE in_id + | isJoinId in_id = (env', (out_id, in_rhs)) | otherwise From git at git.haskell.org Mon Apr 9 19:06:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 19:06:59 +0000 (UTC) Subject: [commit: ghc] wip/T15002: CSE: in bind_cse, adhere to noCSE (fixes #15002) (ca0f443) Message-ID: <20180409190659.C14523A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/ca0f44357fc5172ea61fd55e49f03e691b891a15/ghc >--------------------------------------------------------------- commit ca0f44357fc5172ea61fd55e49f03e691b891a15 Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: in bind_cse, adhere to noCSE (fixes #15002) Previously, noCSE was only checked for self-recursive bindings, and non-recursive join points were happily CSE’ed, breaking the join point invariant. By checking noCSE in all cases of cseBind/cse_bind, this can be prevented. Eventually CSE for join points would be desirable (#13219). Differential Revision: https://phabricator.haskell.org/D4572 >--------------------------------------------------------------- ca0f44357fc5172ea61fd55e49f03e691b891a15 compiler/simplCore/CSE.hs | 21 ++++++++++++++++++++- testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 8f61128..6bdf4f0 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -276,6 +276,23 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. +Another way how CSE for joint points is tricky is + + let join foo x = (x, 42) + join bar x = (x, 42) + in … jump foo 1 … jump bar 2 … + +naively, CSE would turn this into + + let join foo x = (x, 42) + join bar = foo + in … jump foo 1 … jump bar 2 … + +but now bar is a join point with join-arity one, but a right-hand side that is +not a lambda (came up in #15002) + +Eventually we might want to teach CSE to handle join points (#13219) + Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -353,6 +370,9 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | noCSE in_id + = (env', (out_id, in_rhs)) + | otherwise = (env', (out_id', out_rhs)) where @@ -370,7 +390,6 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Note [Type-let] in CoreSyn), in which case we can just substitute. addBinding env in_id out_id rhs' | not (isId in_id) = (extendCSSubst env in_id rhs', out_id) - | noCSE in_id = (env, out_id) | use_subst = (extendCSSubst env in_id rhs', out_id) | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a521a10..016b439 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -301,3 +301,4 @@ test('T14978', normal, run_command, ['$MAKE -s --no-print-directory T14978']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Mon Apr 9 19:07:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 19:07:02 +0000 (UTC) Subject: [commit: ghc] wip/T15002: In CSE: Look past join point lambdas (7c4e7fb) Message-ID: <20180409190702.BC0FD3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/7c4e7fbf1a3b5dc2dfd856d257f69a99f0f2c548/ghc >--------------------------------------------------------------- commit 7c4e7fbf1a3b5dc2dfd856d257f69a99f0f2c548 Author: Joachim Breitner Date: Mon Apr 9 15:05:00 2018 -0400 In CSE: Look past join point lambdas This is a more promising apporach to fix #15002. If Harbormaster and perf.haskell.org are happy with it, I’ll add the note explaining why this is needed. >--------------------------------------------------------------- 7c4e7fbf1a3b5dc2dfd856d257f69a99f0f2c548 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 865ab6a..17d8f4c 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -17,7 +17,7 @@ import Var ( Var ) import VarEnv ( elemInScopeSet, mkInScopeSet ) import Id ( Id, idType, idInlineActivation, isDeadBinder , zapIdOccInfo, zapIdUsageInfo, idInlinePragma - , isJoinId ) + , isJoinId, isJoinId_maybe ) import CoreUtils ( mkAltExpr, eqExpr , exprIsTickedString , stripTicksE, stripTicksT, mkTicks ) @@ -370,8 +370,11 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) - | isJoinId in_id - = (env', (out_id, in_rhs)) + | Just arity <- isJoinId_maybe in_id + = let (params, in_body) = collectNBinders arity in_rhs + (env', params') = addBinders env params + out_body = tryForCSE env' in_body + in (env, (out_id, mkLams params' out_body)) | otherwise = (env', (out_id', out_rhs)) @@ -390,6 +393,7 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Note [Type-let] in CoreSyn), in which case we can just substitute. addBinding env in_id out_id rhs' | not (isId in_id) = (extendCSSubst env in_id rhs', out_id) + | noCSE in_id = (env, out_id) | use_subst = (extendCSSubst env in_id rhs', out_id) | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where @@ -411,6 +415,8 @@ addBinding env in_id out_id rhs' Var {} -> True _ -> False +-- | Given a binder `let x = e`, this function +-- determines whether we should add `e -> x` to the cseExpr noCSE :: InId -> Bool noCSE id = not (isAlwaysActive (idInlineActivation id)) && not (noUserInlineSpec (inlinePragmaSpec (idInlinePragma id))) From git at git.haskell.org Mon Apr 9 19:07:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 19:07:05 +0000 (UTC) Subject: [commit: ghc] wip/T15002: Fix #15002 more carefully (dbbda65) Message-ID: <20180409190705.B638C3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15002 Link : http://ghc.haskell.org/trac/ghc/changeset/dbbda65ba43670eb9d17c28b635c646c9ee4def7/ghc >--------------------------------------------------------------- commit dbbda65ba43670eb9d17c28b635c646c9ee4def7 Author: Joachim Breitner Date: Mon Apr 9 14:54:06 2018 -0400 Fix #15002 more carefully `noCSE` checks a bunch of conditions, and adding that check to all branches of `cseBind` causes regressions. So, to understand the situation better, let’s just check `isJoinId` and see if that fixes the bug without causing regressions. Maybe `noCSE` is only about what should be added to the the CSEnv, and the question of “which RHSs” should be CSEd needs to be answered differently. >--------------------------------------------------------------- dbbda65ba43670eb9d17c28b635c646c9ee4def7 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 6bdf4f0..865ab6a 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -370,7 +370,7 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) - | noCSE in_id + | isJoinId in_id = (env', (out_id, in_rhs)) | otherwise From git at git.haskell.org Mon Apr 9 19:07:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 19:07:08 +0000 (UTC) Subject: [commit: ghc] wip/T15002's head updated: In CSE: Look past join point lambdas (7c4e7fb) Message-ID: <20180409190708.450DB3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T15002' now includes: 48f55e7 Bump template-haskell to 2.14.0.0 ca0f443 CSE: in bind_cse, adhere to noCSE (fixes #15002) dbbda65 Fix #15002 more carefully 7c4e7fb In CSE: Look past join point lambdas From git at git.haskell.org Mon Apr 9 19:29:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 9 Apr 2018 19:29:48 +0000 (UTC) Subject: [commit: ghc] master: Restore Trees That Grow reverted commits (1aa1d40) Message-ID: <20180409192948.CF4DE3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1aa1d405d8212a99ac24dcfd48024a17c3ffd296/ghc >--------------------------------------------------------------- commit 1aa1d405d8212a99ac24dcfd48024a17c3ffd296 Author: Alan Zimmerman Date: Sun Apr 1 21:33:53 2018 +0200 Restore Trees That Grow reverted commits The following commits were reverted prior to the release of GHC 8.4.1, because the time to derive Data instances was too long [1]. 438dd1cbba13d35f3452b4dcef3f94ce9a216905 Phab:D4147 e3ec2e7ae94524ebd111963faf34b84d942265b4 Phab:D4177 47ad6578ea460999b53eb4293c3a3b3017a56d65 Phab:D4186 The work is continuing, as the minimum bootstrap compiler is now GHC 8.2.1, and this allows Plan B[2] for instances to be used. This will land in a following commit. Updates Haddock submodule [1] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances [2] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances#PLANB >--------------------------------------------------------------- 1aa1d405d8212a99ac24dcfd48024a17c3ffd296 compiler/deSugar/Check.hs | 61 +- compiler/deSugar/Coverage.hs | 214 +++--- compiler/deSugar/DsArrows.hs | 80 ++- compiler/deSugar/DsExpr.hs | 124 ++-- compiler/deSugar/DsGRHSs.hs | 15 +- compiler/deSugar/DsListComp.hs | 20 +- compiler/deSugar/DsMeta.hs | 194 +++--- compiler/deSugar/DsUtils.hs | 63 +- compiler/deSugar/Match.hs | 107 +-- compiler/deSugar/MatchLit.hs | 35 +- compiler/deSugar/PmExpr.hs | 39 +- compiler/hsSyn/Convert.hs | 257 ++++---- compiler/hsSyn/HsBinds.hs | 71 +- compiler/hsSyn/HsDecls.hs | 65 +- compiler/hsSyn/HsExpr.hs | 724 ++++++++++++++------- compiler/hsSyn/HsExpr.hs-boot | 14 +- compiler/hsSyn/HsExtension.hs | 499 ++++++++++++-- compiler/hsSyn/HsLit.hs | 64 +- compiler/hsSyn/HsPat.hs | 283 +++++--- compiler/hsSyn/HsPat.hs-boot | 4 +- compiler/hsSyn/HsSyn.hs | 2 +- compiler/hsSyn/HsTypes.hs | 414 ++++++++---- compiler/hsSyn/HsUtils.hs | 372 ++++++----- compiler/hsSyn/PlaceHolder.hs | 21 +- compiler/main/HscStats.hs | 2 +- compiler/main/InteractiveEval.hs | 5 +- compiler/parser/Parser.y | 255 ++++---- compiler/parser/RdrHsSyn.hs | 275 ++++---- compiler/rename/RnBinds.hs | 14 +- compiler/rename/RnEnv.hs | 4 +- compiler/rename/RnExpr.hs | 321 ++++----- compiler/rename/RnFixity.hs | 5 +- compiler/rename/RnNames.hs | 8 +- compiler/rename/RnPat.hs | 101 +-- compiler/rename/RnSource.hs | 29 +- compiler/rename/RnSplice.hs | 101 +-- compiler/rename/RnSplice.hs-boot | 4 +- compiler/rename/RnTypes.hs | 337 +++++----- compiler/typecheck/Inst.hs | 22 +- compiler/typecheck/TcArrows.hs | 53 +- compiler/typecheck/TcBinds.hs | 14 +- compiler/typecheck/TcDeriv.hs | 3 +- compiler/typecheck/TcExpr.hs | 245 +++---- compiler/typecheck/TcGenDeriv.hs | 25 +- compiler/typecheck/TcGenFunctor.hs | 1 + compiler/typecheck/TcHsSyn.hs | 335 +++++----- compiler/typecheck/TcHsType.hs | 82 +-- compiler/typecheck/TcInstDcls.hs | 17 +- compiler/typecheck/TcMatches.hs | 21 +- compiler/typecheck/TcPat.hs | 81 +-- compiler/typecheck/TcPatSyn.hs | 114 ++-- compiler/typecheck/TcRnDriver.hs | 39 +- compiler/typecheck/TcRnTypes.hs | 91 ++- compiler/typecheck/TcSplice.hs | 29 +- compiler/typecheck/TcTyClsDecls.hs | 17 +- compiler/typecheck/TcTyDecls.hs | 15 +- ghc/GHCi/UI.hs | 4 +- ghc/GHCi/UI/Info.hs | 12 +- testsuite/tests/ghc-api/annotations/parseTree.hs | 6 +- .../tests/ghc-api/annotations/stringSource.hs | 6 +- testsuite/tests/ghc-api/annotations/t11430.hs | 2 +- .../parser/should_compile/DumpParsedAst.stderr | 28 +- .../parser/should_compile/DumpRenamedAst.stderr | 141 ++-- .../should_compile/DumpTypecheckedAst.stderr | 73 +++ .../tests/parser/should_compile/T14189.stderr | 13 +- testsuite/tests/perf/haddock/all.T | 3 +- testsuite/tests/quasiquotation/T7918.hs | 6 +- utils/ghctags/Main.hs | 25 +- utils/haddock | 2 +- 69 files changed, 3991 insertions(+), 2737 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 1aa1d405d8212a99ac24dcfd48024a17c3ffd296 From git at git.haskell.org Tue Apr 10 02:15:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 02:15:21 +0000 (UTC) Subject: [commit: ghc] master: CSE: Walk past join point lambdas (#15002) (ae0cff0) Message-ID: <20180410021521.1AFD13A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8/ghc >--------------------------------------------------------------- commit ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8 Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: Walk past join point lambdas (#15002) As the CSE transformation traverses the syntax tree, it needs to go past the lambdas of a join point, and only look for CSE opportunities inside, as a join point’s lambdas must be preserved. Simple fix; comes with a Note and a test case. Thanks to Ryan Scott for an excellently minimized test case, and for bisecting GHC. Differential Revision: https://phabricator.haskell.org/D4572 >--------------------------------------------------------------- ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8 compiler/simplCore/CSE.hs | 34 ++++++++++++++++++++-- testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 8f61128..ee3a1eb 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -17,7 +17,7 @@ import Var ( Var ) import VarEnv ( elemInScopeSet, mkInScopeSet ) import Id ( Id, idType, idInlineActivation, isDeadBinder , zapIdOccInfo, zapIdUsageInfo, idInlinePragma - , isJoinId ) + , isJoinId, isJoinId_maybe ) import CoreUtils ( mkAltExpr, eqExpr , exprIsTickedString , stripTicksE, stripTicksT, mkTicks ) @@ -274,7 +274,28 @@ compiling ppHtml in Haddock.Backends.Xhtml). We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's -less to gain by trying to CSE them. +less to gain by trying to CSE them. (#13219) + +Note [Don’t tryForCSE the RHS of a Join Point] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Another way how CSE for joint points is tricky is + + let join foo x = (x, 42) + join bar x = (x, 42) + in … jump foo 1 … jump bar 2 … + +naively, CSE would turn this into + + let join foo x = (x, 42) + join bar = foo + in … jump foo 1 … jump bar 2 … + +but now bar is a join point that claims arity one, but its right-hand side +is not a lambda, breaking the join-point invariant (this was #15002). + +Therefore, `cse_bind` will zoom past the lambdas of a join point (using +`collectNBinders`) and resume searching for CSE opportunities only in the body +of the join point. Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -353,6 +374,13 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | Just arity <- isJoinId_maybe in_id + -- See Note [Don’t tryForCSE the RHS of a Join Point] + = let (params, in_body) = collectNBinders arity in_rhs + (env', params') = addBinders env params + out_body = tryForCSE env' in_body + in (env, (out_id, mkLams params' out_body)) + | otherwise = (env', (out_id', out_rhs)) where @@ -392,6 +420,8 @@ addBinding env in_id out_id rhs' Var {} -> True _ -> False +-- | Given a binder `let x = e`, this function +-- determines whether we should add `e -> x` to the cs_map noCSE :: InId -> Bool noCSE id = not (isAlwaysActive (idInlineActivation id)) && not (noUserInlineSpec (inlinePragmaSpec (idInlinePragma id))) diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a521a10..016b439 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -301,3 +301,4 @@ test('T14978', normal, run_command, ['$MAKE -s --no-print-directory T14978']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Tue Apr 10 02:20:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 02:20:01 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T15002' deleted Message-ID: <20180410022001.1E0EA3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T15002 From git at git.haskell.org Tue Apr 10 08:41:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 08:41:19 +0000 (UTC) Subject: [commit: ghc] master: Add a forgotten newline in a debug print (a1fcdf3) Message-ID: <20180410084119.4D9D63A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1fcdf381c4c1fa5856a3519228c3bde9de04ae8/ghc >--------------------------------------------------------------- commit a1fcdf381c4c1fa5856a3519228c3bde9de04ae8 Author: Ömer Sinan Ağacan Date: Tue Apr 10 11:40:59 2018 +0300 Add a forgotten newline in a debug print [skip ci] >--------------------------------------------------------------- a1fcdf381c4c1fa5856a3519228c3bde9de04ae8 rts/Printer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/Printer.c b/rts/Printer.c index 1c9634d..702e490 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -395,7 +395,7 @@ printClosure( const StgClosure *obj ) break; case STACK: - debugBelch("STACK"); + debugBelch("STACK\n"); break; #if 0 From git at git.haskell.org Tue Apr 10 10:51:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 10:51:32 +0000 (UTC) Subject: [commit: ghc] master: Fix GHC collector flavor for Fedora job (Circle CI) (b2eb9ad) Message-ID: <20180410105132.2DEE33A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b2eb9addcc42f6b9149015436150cd01297346b5/ghc >--------------------------------------------------------------- commit b2eb9addcc42f6b9149015436150cd01297346b5 Author: mrkkrp Date: Tue Apr 10 17:50:39 2018 +0700 Fix GHC collector flavor for Fedora job (Circle CI) >--------------------------------------------------------------- b2eb9addcc42f6b9149015436150cd01297346b5 .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb071bb..bdbbff0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -234,7 +234,7 @@ jobs: - image: ghcci/x86_64-linux-fedora:0.0.2 environment: <<: *buildenv - GHC_COLLECTOR_FLAVOR: x86_64-linux + GHC_COLLECTOR_FLAVOR: x86_64-fedora steps: - checkout - *prepare From git at git.haskell.org Tue Apr 10 12:28:30 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 12:28:30 +0000 (UTC) Subject: [commit: packages/array] master: Bump upper bound on base to < 4.13 (234d0a1) Message-ID: <20180410122830.4FB0D3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/234d0a11820c263c873e41810d7a4b9d6152dcec >--------------------------------------------------------------- commit 234d0a11820c263c873e41810d7a4b9d6152dcec Author: Ryan Scott Date: Tue Apr 10 08:27:39 2018 -0400 Bump upper bound on base to < 4.13 See https://ghc.haskell.org/trac/ghc/ticket/15018. >--------------------------------------------------------------- 234d0a11820c263c873e41810d7a4b9d6152dcec array.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/array.cabal b/array.cabal index 6491ade..f19de50 100644 --- a/array.cabal +++ b/array.cabal @@ -36,7 +36,7 @@ library Trustworthy, UnboxedTuples, UnliftedFFITypes - build-depends: base >= 4.9 && < 4.12 + build-depends: base >= 4.9 && < 4.13 ghc-options: -Wall exposed-modules: Data.Array From git at git.haskell.org Tue Apr 10 12:30:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 12:30:25 +0000 (UTC) Subject: [commit: packages/hpc] master: Bump upper bound on base to < 4.13 (91f520c) Message-ID: <20180410123025.E03513A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/91f520cb9725d812fa93b57bca1d8dbd72c88dd5 >--------------------------------------------------------------- commit 91f520cb9725d812fa93b57bca1d8dbd72c88dd5 Author: Ryan Scott Date: Tue Apr 10 08:29:05 2018 -0400 Bump upper bound on base to < 4.13 See https://ghc.haskell.org/trac/ghc/ticket/15018. >--------------------------------------------------------------- 91f520cb9725d812fa93b57bca1d8dbd72c88dd5 hpc.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hpc.cabal b/hpc.cabal index 017a609..baebc38 100644 --- a/hpc.cabal +++ b/hpc.cabal @@ -35,7 +35,7 @@ Library Trace.Hpc.Reflect Build-Depends: - base >= 4.4.1 && < 4.12, + base >= 4.4.1 && < 4.13, containers >= 0.4.1 && < 0.6, directory >= 1.1 && < 1.4, filepath >= 1 && < 1.5, From git at git.haskell.org Tue Apr 10 13:28:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 13:28:00 +0000 (UTC) Subject: [commit: ghc] master: Add test case for #15005 (3f59d38) Message-ID: <20180410132800.885D53A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f59d3802170f495702674b4f8e4e80247803654/ghc >--------------------------------------------------------------- commit 3f59d3802170f495702674b4f8e4e80247803654 Author: Joachim Breitner Date: Tue Apr 10 09:26:09 2018 -0400 Add test case for #15005 this succeeds on `master` right now, but I confirmed that it fails on ghc-8.4.1-release. >--------------------------------------------------------------- 3f59d3802170f495702674b4f8e4e80247803654 testsuite/tests/simplCore/should_compile/T15005.hs | 189 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 190 insertions(+) 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 3f59d3802170f495702674b4f8e4e80247803654 From git at git.haskell.org Tue Apr 10 14:06:55 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 14:06:55 +0000 (UTC) Subject: [commit: ghc] master: Remove PARALLEL_HASKELL comments (635a784) Message-ID: <20180410140655.21E033A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/635a784a519f73b19f1e86bda94d4b3c5587d85c/ghc >--------------------------------------------------------------- commit 635a784a519f73b19f1e86bda94d4b3c5587d85c Author: Ömer Sinan Ağacan Date: Tue Apr 10 17:06:27 2018 +0300 Remove PARALLEL_HASKELL comments PARALLEL_HASKELL was long gone, remove references [skip ci] >--------------------------------------------------------------- 635a784a519f73b19f1e86bda94d4b3c5587d85c rts/Schedule.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 2dc850c..33b7815 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -705,8 +705,6 @@ static void schedulePushWork(Capability *cap USED_IF_THREADS, Task *task USED_IF_THREADS) { - /* following code not for PARALLEL_HASKELL. I kept the call general, - future GUM versions might use pushing in a distributed setup */ #if defined(THREADED_RTS) Capability *free_caps[n_capabilities], *cap0; From git at git.haskell.org Tue Apr 10 15:36:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 15:36:15 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for negative sqrts (#10010) (5161609) Message-ID: <20180410153615.E47523A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5161609117c16cb7b29b2b8b1cd41e74341d4137/ghc >--------------------------------------------------------------- commit 5161609117c16cb7b29b2b8b1cd41e74341d4137 Author: Ben Gamari Date: Sat Apr 7 13:31:42 2018 -0400 testsuite: Add test for negative sqrts (#10010) Reviewers: hvr, alpmestan Reviewed By: alpmestan Subscribers: thomie, carter GHC Trac Issues: #10010 Differential Revision: https://phabricator.haskell.org/D4543 >--------------------------------------------------------------- 5161609117c16cb7b29b2b8b1cd41e74341d4137 libraries/base/tests/Numeric/all.T | 1 + libraries/base/tests/Numeric/sqrt.hs | 3 +++ libraries/base/tests/Numeric/sqrt.stdout | 2 ++ 3 files changed, 6 insertions(+) diff --git a/libraries/base/tests/Numeric/all.T b/libraries/base/tests/Numeric/all.T index a0a9d68..0d7467e 100644 --- a/libraries/base/tests/Numeric/all.T +++ b/libraries/base/tests/Numeric/all.T @@ -25,3 +25,4 @@ test('num010', when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')), compile_and_run, ['']) +test('sqrt', normal, compile_and_run, ['']) diff --git a/libraries/base/tests/Numeric/sqrt.hs b/libraries/base/tests/Numeric/sqrt.hs new file mode 100644 index 0000000..a58875a --- /dev/null +++ b/libraries/base/tests/Numeric/sqrt.hs @@ -0,0 +1,3 @@ +main = do + print (sqrt (-7 :: Double)) + print (sqrt (-7 :: Float)) diff --git a/libraries/base/tests/Numeric/sqrt.stdout b/libraries/base/tests/Numeric/sqrt.stdout new file mode 100644 index 0000000..913b330 --- /dev/null +++ b/libraries/base/tests/Numeric/sqrt.stdout @@ -0,0 +1,2 @@ +NaN +NaN From git at git.haskell.org Tue Apr 10 15:36:30 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 15:36:30 +0000 (UTC) Subject: [commit: ghc] master: rts/RetainerProfile: Handle BLOCKING_QUEUES (d5f6d7a) Message-ID: <20180410153630.519483A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d5f6d7a03d66a93ec05a90948126feffc9279dc6/ghc >--------------------------------------------------------------- commit d5f6d7a03d66a93ec05a90948126feffc9279dc6 Author: Ben Gamari Date: Sat Apr 7 13:32:04 2018 -0400 rts/RetainerProfile: Handle BLOCKING_QUEUES push() considers BLOCKING_QUEUES to be an invalid closure type which should never be present on the stack. However, retainClosure made no accomodation for this and ended up pushing such a closure. This lead to #14947. Test Plan: Validate Reviewers: simonmar, erikd Reviewed By: simonmar Subscribers: thomie, carter, RyanGlScott GHC Trac Issues: #14947 Differential Revision: https://phabricator.haskell.org/D4538 >--------------------------------------------------------------- d5f6d7a03d66a93ec05a90948126feffc9279dc6 rts/RetainerProfile.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 79bb7e3..67a6da9 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -424,7 +424,7 @@ find_srt( stackPos *info ) * push() pushes a stackElement representing the next child of *c * onto the traverse stack. If *c has no child, *first_child is set * to NULL and nothing is pushed onto the stack. If *c has only one - * child, *c_chlid is set to that child and nothing is pushed onto + * child, *c_child is set to that child and nothing is pushed onto * the stack. If *c has more than two children, *first_child is set * to the first child and a stackElement representing the second * child is pushed onto the stack. @@ -1695,6 +1695,15 @@ inner_loop: goto loop; } + case BLOCKING_QUEUE: + { + StgBlockingQueue *bq = (StgBlockingQueue *)c; + retainClosure((StgClosure*) bq->link, c, c_child_r); + retainClosure((StgClosure*) bq->bh, c, c_child_r); + retainClosure((StgClosure*) bq->owner, c, c_child_r); + goto loop; + } + case PAP: { StgPAP *pap = (StgPAP *)c; From git at git.haskell.org Tue Apr 10 15:36:44 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 15:36:44 +0000 (UTC) Subject: [commit: ghc] master: Minor typofix in LoadArchive.c (81e7980) Message-ID: <20180410153644.6B6413A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81e7980a015795209f8edbf298761df9c749a4b3/ghc >--------------------------------------------------------------- commit 81e7980a015795209f8edbf298761df9c749a4b3 Author: Edward Z. Yang Date: Sat Apr 7 13:32:31 2018 -0400 Minor typofix in LoadArchive.c Test Plan: none Reviewers: bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4551 >--------------------------------------------------------------- 81e7980a015795209f8edbf298761df9c749a4b3 rts/linker/LoadArchive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 7f00edb..85eedb9 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -261,7 +261,7 @@ static HsInt loadArchive_ (pathchar *path) int misalignment = 0; DEBUG_LOG("start\n"); - DEBUG_LOG("Loading archive `%" PATH_FMT" '\n", path); + DEBUG_LOG("Loading archive `%" PATH_FMT "'\n", path); /* Check that we haven't already loaded this archive. Ignore requests to load multiple times */ From git at git.haskell.org Tue Apr 10 15:36:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 15:36:59 +0000 (UTC) Subject: [commit: ghc] master: Move gmp/config.mk.in to config.mk.in, fix #14972 (2534164) Message-ID: <20180410153659.5C9983A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2534164aefd346c7c51b70e8e8c49aa881dd9f85/ghc >--------------------------------------------------------------- commit 2534164aefd346c7c51b70e8e8c49aa881dd9f85 Author: Edward Z. Yang Date: Sat Apr 7 13:32:47 2018 -0400 Move gmp/config.mk.in to config.mk.in, fix #14972 Here's how the rube goldberg machine triggered the old bug: 1. If you have a file gmp/config.mk.in, then Cabal will create a generated file in $DIST/build/gmp/config.mk 2. When you attempt to load inplace integer-gmp via GHCi, it will ask gcc (aka clang on OS X) for the file name of 'gmp', with base directory set to $DIST/build 3. There is a folder named 'gmp', and so this folder is returned as the 'library' for gmp 4. GHCi loadArchive chokes to death trying to open a library that is actually a folder This patch solves the problem by breaking the chain at (1): if we don't put config.mk in a folder named gmp, NO PROBLEM. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: angerman, hvr, bgamari Reviewed By: angerman Subscribers: erikd, thomie, carter GHC Trac Issues: #14972 Differential Revision: https://phabricator.haskell.org/D4552 >--------------------------------------------------------------- 2534164aefd346c7c51b70e8e8c49aa881dd9f85 libraries/integer-gmp/{gmp => }/config.mk.in | 4 ++++ libraries/integer-gmp/configure.ac | 2 +- libraries/integer-gmp/gmp/ghc.mk | 5 ++--- libraries/integer-gmp/integer-gmp.cabal | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libraries/integer-gmp/gmp/config.mk.in b/libraries/integer-gmp/config.mk.in similarity index 53% rename from libraries/integer-gmp/gmp/config.mk.in rename to libraries/integer-gmp/config.mk.in index 93a4f53..b66f94c 100644 --- a/libraries/integer-gmp/gmp/config.mk.in +++ b/libraries/integer-gmp/config.mk.in @@ -1,3 +1,7 @@ +# NB: This file lives in the top-level integer-gmp folder, and not in +# the gmp subfolder, because of #14972, where we MUST NOT create a +# folder named 'gmp' in dist/build/ + ifeq "$(HaveLibGmp)" "" HaveLibGmp = @HaveLibGmp@ endif diff --git a/libraries/integer-gmp/configure.ac b/libraries/integer-gmp/configure.ac index 3aebeba..1ccd48e 100644 --- a/libraries/integer-gmp/configure.ac +++ b/libraries/integer-gmp/configure.ac @@ -106,7 +106,7 @@ AC_SUBST(GhcGmpVerMj) AC_SUBST(GhcGmpVerMi) AC_SUBST(GhcGmpVerPl) -AC_CONFIG_FILES([integer-gmp.buildinfo gmp/config.mk include/HsIntegerGmp.h]) +AC_CONFIG_FILES([integer-gmp.buildinfo config.mk include/HsIntegerGmp.h]) dnl-------------------------------------------------------------------- dnl * Generate output files diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk index f18e27d..2a9f3eb 100644 --- a/libraries/integer-gmp/gmp/ghc.mk +++ b/libraries/integer-gmp/gmp/ghc.mk @@ -27,7 +27,6 @@ endif ifneq "$(NO_CLEAN_GMP)" "YES" $(eval $(call clean-target,gmp,,\ libraries/integer-gmp/include/ghc-gmp.h \ - libraries/integer-gmp/gmp/config.mk \ libraries/integer-gmp/gmp/libgmp.a \ libraries/integer-gmp/gmp/gmp.h \ libraries/integer-gmp/gmp/gmpbuild \ @@ -53,10 +52,10 @@ endif ifeq "$(phase)" "final" ifneq "$(CLEANING)" "YES" -# Hack. The file gmp/config.mk doesn't exist yet after running ./configure in +# Hack. The file config.mk doesn't exist yet after running ./configure in # the toplevel (ghc) directory. To let some toplevel make commands such as # sdist go through, right after ./configure, don't consider this an error. --include libraries/integer-gmp/dist-install/build/gmp/config.mk +-include libraries/integer-gmp/dist-install/build/config.mk endif gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS)) diff --git a/libraries/integer-gmp/integer-gmp.cabal b/libraries/integer-gmp/integer-gmp.cabal index 6edacea..d2f6e3c 100644 --- a/libraries/integer-gmp/integer-gmp.cabal +++ b/libraries/integer-gmp/integer-gmp.cabal @@ -26,16 +26,19 @@ extra-source-files: config.sub configure configure.ac - gmp/config.mk.in + config.mk.in include/HsIntegerGmp.h.in install-sh integer-gmp.buildinfo.in +-- NB: Many of these tmp files no longer ever actually get plopped in +-- the root directory post Cabal 2.4, thanks to a change that causes +-- autoconf/configure to get run inside the dist directory. extra-tmp-files: autom4te.cache config.log config.status - gmp/config.mk + config.mk integer-gmp.buildinfo include/HsIntegerGmp.h From git at git.haskell.org Tue Apr 10 15:37:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 15:37:14 +0000 (UTC) Subject: [commit: ghc] master: Revert "Fix #14838 by marking TH-spliced code as FromSource" (c054162) Message-ID: <20180410153714.0DF9A3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c054162ae151ff82d43e504836784a7bc7827d9f/ghc >--------------------------------------------------------------- commit c054162ae151ff82d43e504836784a7bc7827d9f Author: Ben Gamari Date: Sat Apr 7 13:32:58 2018 -0400 Revert "Fix #14838 by marking TH-spliced code as FromSource" This reverts commit ffb2738f86c4e4c3f0eaacf0a95d7326fdd2e383. Due to #14987. Reviewers: goldfire, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, thomie, carter GHC Trac Issues: #14987, #14838 Differential Revision: https://phabricator.haskell.org/D4545 >--------------------------------------------------------------- c054162ae151ff82d43e504836784a7bc7827d9f compiler/hsSyn/Convert.hs | 4 ++-- compiler/hsSyn/HsUtils.hs | 14 +++++++------- compiler/parser/RdrHsSyn.hs | 10 +++++----- compiler/typecheck/TcGenDeriv.hs | 8 +++----- testsuite/tests/th/T14838.hs | 14 -------------- testsuite/tests/th/T14838.stderr | 18 ------------------ testsuite/tests/th/T14838Lib.hs | 14 -------------- testsuite/tests/th/all.T | 2 -- 8 files changed, 17 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 c054162ae151ff82d43e504836784a7bc7827d9f From git at git.haskell.org Tue Apr 10 15:37:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 15:37:28 +0000 (UTC) Subject: [commit: ghc] master: Discard reflexive casts during Simplify (7bb7f99) Message-ID: <20180410153728.60DA33A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7bb7f991e2b04b7daed079bab9e63884404802a0/ghc >--------------------------------------------------------------- commit 7bb7f991e2b04b7daed079bab9e63884404802a0 Author: Richard Eisenberg Date: Tue Apr 10 10:23:42 2018 -0400 Discard reflexive casts during Simplify Trac #14735 (derived from Trac #11735) found that 75% of compile time was being spent in simplCast. This patch is the first in a series to deal with that problem. This particular patch actually has very little effect on performance; it just refactors simplCast so that it builds Refl coercions less often. Refl coercions require us to compute the type to put inside them, and even if that's done lazily it is still work and code. Instead we use Maybe Coercion with Nothing for Refl. This change also percolates to pushCoTyArg and pushValArg. Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14737 Differential Revision: https://phabricator.haskell.org/D4395 >--------------------------------------------------------------- 7bb7f991e2b04b7daed079bab9e63884404802a0 compiler/coreSyn/CoreOpt.hs | 48 +++++++++++++---------- compiler/simplCore/Simplify.hs | 89 +++++++++++++++++++++++------------------- 2 files changed, 76 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 7bb7f991e2b04b7daed079bab9e63884404802a0 From git at git.haskell.org Tue Apr 10 18:20:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 Apr 2018 18:20:14 +0000 (UTC) Subject: [commit: ghc] master: In Exitify, zap idInfo of abstracted variables (fixes #15005) (3cfb12d) Message-ID: <20180410182014.0AF1E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3cfb12d8adac37e5565d66fd173e4648cc041e65/ghc >--------------------------------------------------------------- commit 3cfb12d8adac37e5565d66fd173e4648cc041e65 Author: Joachim Breitner Date: Tue Apr 10 09:36:08 2018 -0400 In Exitify, zap idInfo of abstracted variables (fixes #15005) as helpfully outlined by SPJ. This commit copies a small bit code from `SetLevels` which could reasonably be put in `Id` as `zapAllIdinfo`; I did not do this to make merging this commmit into `ghc-8.4` easier. If this commit gets merged, then presumably after commit 3f59d3802170f495702674b4f8e4e80247803654 (test case) and ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8 (other fixes to Exitify.hs). Differential Revision: https://phabricator.haskell.org/D4582 >--------------------------------------------------------------- 3cfb12d8adac37e5565d66fd173e4648cc041e65 compiler/simplCore/Exitify.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 570186e..6e7d063 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -175,7 +175,14 @@ exitify in_scope pairs = is_interesting = anyVarSet isLocalId (fvs `minusVarSet` mkVarSet captured) -- The possible arguments of this exit join point - abs_vars = sortQuantVars $ filter (`elemVarSet` fvs) captured + abs_vars = + map zap $ + sortQuantVars $ + filter (`elemVarSet` fvs) captured + + -- cf. SetLevels.abstractVars + zap v | isId v = setIdInfo v vanillaIdInfo + | otherwise = v -- We cannot abstract over join points captures_join_points = any isJoinId abs_vars From git at git.haskell.org Wed Apr 11 07:33:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 07:33:14 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394: Bump perf test targets (ac5bf4c) Message-ID: <20180411073314.839163A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394 Link : http://ghc.haskell.org/trac/ghc/changeset/ac5bf4cbbd69acc8b37aac149ef46e45c26bfb5a/ghc >--------------------------------------------------------------- commit ac5bf4cbbd69acc8b37aac149ef46e45c26bfb5a Author: Tobias Dammers Date: Mon Apr 9 18:08:15 2018 +0200 Bump perf test targets Collateral to #14737: a handful of tests perform somewhat worse with this patch, and one perfoms better. For now, just doctor the numbers to make it pass. >--------------------------------------------------------------- ac5bf4cbbd69acc8b37aac149ef46e45c26bfb5a testsuite/tests/perf/compiler/all.T | 6 ++++-- testsuite/tests/perf/haddock/all.T | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 5a45859..29787f5 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -476,12 +476,13 @@ test('parsing001', [(wordsize(32), 232777056, 10), # Initial: 274000576 # 2017-03-24: 232777056 - (wordsize(64), 490228304, 5)]), + (wordsize(64), 519401296, 5)]), # expected value: 587079016 (amd64/Linux) # 2016-09-01: 581551384 (amd64/Linux) Restore w/w limit (#11565) # 2016-12-19: 493730288 (amd64/Linux) Join points (#12988) # 2017-02-14: 463931280 Early inlining patch; acutal improvement 7% # 2017-12-11: 490228304 BlockArguments + # 2018-04-09: 519401296 Inexplicable, collateral of #14737 only_ways(['normal']), ], compile_fail, ['']) @@ -885,7 +886,7 @@ test('T9872c', test('T9872d', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 526485920, 5), + [(wordsize(64), 572537984, 5), # 2014-12-18 796071864 Initally created # 2014-12-18 739189056 Reduce type families even more eagerly # 2015-01-07 687562440 TrieMap leaf compression @@ -899,6 +900,7 @@ test('T9872d', # 2017-02-25 498855104 Early inlining # 2017-03-03 462817352 Share Typeable KindReps # 2018-03-25 526485920 Flattener patch does more work (#12919) + # 2018-04-11 572537984 simplCast improvement collateral (#11735) (wordsize(32), 232954000, 5) # some date 328810212 diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index db378fe..09ed19a 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -10,7 +10,7 @@ test('haddock.base', # 2017-02-19 24286343184 (x64/Windows) - Generalize kind of (->) # 2017-12-24 18733710728 (x64/Windows) - Unknown - ,(wordsize(64), 19694554424, 5) + ,(wordsize(64), 20727464616, 5) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) @@ -44,6 +44,7 @@ test('haddock.base', # 2017-06-06: 25173968808 (x86_64/Linux) - Don't pass on -dcore-lint in Haddock.mk # 2017-07-12: 23677299848 (x86_64/Linux) - Use getNameToInstancesIndex # 2017-08-22: 19694554424 (x86_64/Linux) - Various Haddock optimizations + # 2018-04-11: 20727464616 (x86_64/Linux) - Collateral of simplCast improvement (#14737) ,(platform('i386-unknown-mingw32'), 2885173512, 5) # 2013-02-10: 3358693084 (x86/Windows) From git at git.haskell.org Wed Apr 11 07:45:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 07:45:48 +0000 (UTC) Subject: [commit: ghc] master: Move T14925.stdout to its correct location, remove expect_broken (a323f21) Message-ID: <20180411074548.E60723A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a323f2127bdcfa3893e40cbc1849cf62eccdd801/ghc >--------------------------------------------------------------- commit a323f2127bdcfa3893e40cbc1849cf62eccdd801 Author: Ömer Sinan Ağacan Date: Wed Apr 11 10:44:00 2018 +0300 Move T14925.stdout to its correct location, remove expect_broken >--------------------------------------------------------------- a323f2127bdcfa3893e40cbc1849cf62eccdd801 T14925.stdout => testsuite/tests/typecheck/should_run/T14925.stdout | 0 testsuite/tests/typecheck/should_run/all.T | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/T14925.stdout b/testsuite/tests/typecheck/should_run/T14925.stdout similarity index 100% rename from T14925.stdout rename to testsuite/tests/typecheck/should_run/T14925.stdout diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index f7643ba..c38e7ac 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -125,4 +125,4 @@ test('T11715', exit_code(1), compile_and_run, ['']) test('T13594a', normal, ghci_script, ['T13594a.script']) test('T14218', normal, compile_and_run, ['']) test('T14236', normal, compile_and_run, ['']) -test('T14925', expect_broken(14925), compile_and_run, ['']) +test('T14925', normal, compile_and_run, ['']) From git at git.haskell.org Wed Apr 11 07:50:33 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 07:50:33 +0000 (UTC) Subject: [commit: ghc] master: Schedule.c: remove unused code (ed57a34) Message-ID: <20180411075033.C32B43A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ed57a347e428570f639094c705e2b5dcf4c55b03/ghc >--------------------------------------------------------------- commit ed57a347e428570f639094c705e2b5dcf4c55b03 Author: Ömer Sinan Ağacan Date: Wed Apr 11 10:50:11 2018 +0300 Schedule.c: remove unused code >--------------------------------------------------------------- ed57a347e428570f639094c705e2b5dcf4c55b03 rts/Schedule.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 33b7815..27ef6a6 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -180,9 +180,6 @@ schedule (Capability *initialCapability, Task *task) StgThreadReturnCode ret; uint32_t prev_what_next; bool ready_to_gc; -#if defined(THREADED_RTS) - bool first = true; -#endif cap = initialCapability; @@ -292,16 +289,6 @@ schedule (Capability *initialCapability, Task *task) // as a result of a console event having been delivered. #if defined(THREADED_RTS) - if (first) - { - // XXX: ToDo - // // don't yield the first time, we want a chance to run this - // // thread for a bit, even if there are others banging at the - // // door. - // first = false; - // ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task); - } - scheduleYield(&cap,task); if (emptyRunQueue(cap)) continue; // look for work again From git at git.haskell.org Wed Apr 11 10:15:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 10:15:04 +0000 (UTC) Subject: [commit: ghc] master: Schedule.c: remove some unused parameters (74e768e) Message-ID: <20180411101504.67B3E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/74e768ea39c9b9b42ced7848f4d499f06d9fca29/ghc >--------------------------------------------------------------- commit 74e768ea39c9b9b42ced7848f4d499f06d9fca29 Author: Ömer Sinan Ağacan Date: Wed Apr 11 11:35:43 2018 +0300 Schedule.c: remove some unused parameters >--------------------------------------------------------------- 74e768ea39c9b9b42ced7848f4d499f06d9fca29 rts/Schedule.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 27ef6a6..0ef1047 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -151,11 +151,11 @@ static bool scheduleHandleThreadFinished( Capability *cap, Task *task, static bool scheduleNeedHeapProfile(bool ready_to_gc); static void scheduleDoGC(Capability **pcap, Task *task, bool force_major); -static void deleteThread (Capability *cap, StgTSO *tso); -static void deleteAllThreads (Capability *cap); +static void deleteThread (StgTSO *tso); +static void deleteAllThreads (void); #if defined(FORKPROCESS_PRIMOP_SUPPORTED) -static void deleteThread_(Capability *cap, StgTSO *tso); +static void deleteThread_(StgTSO *tso); #endif /* --------------------------------------------------------------------------- @@ -347,7 +347,7 @@ schedule (Capability *initialCapability, Task *task) // in a foreign call returns. if (sched_state >= SCHED_INTERRUPTING && !(t->what_next == ThreadComplete || t->what_next == ThreadKilled)) { - deleteThread(cap,t); + deleteThread(t); } // If this capability is disabled, migrate the thread away rather @@ -1252,7 +1252,7 @@ scheduleHandleThreadBlocked( StgTSO *t * -------------------------------------------------------------------------- */ static bool -scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t) +scheduleHandleThreadFinished (Capability *cap, Task *task, StgTSO *t) { /* Need to check whether this was a main thread, and if so, * return with the return value. @@ -1341,7 +1341,7 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t) * -------------------------------------------------------------------------- */ static bool -scheduleNeedHeapProfile( bool ready_to_gc STG_UNUSED ) +scheduleNeedHeapProfile( bool ready_to_gc ) { // When we have +RTS -i0 and we're heap profiling, do a census at // every GC. This lets us get repeatable runs for debugging. @@ -1743,7 +1743,7 @@ delete_threads_and_gc: * Checking for major_gc ensures that the last GC is major. */ if (sched_state == SCHED_INTERRUPTING && major_gc) { - deleteAllThreads(cap); + deleteAllThreads(); #if defined(THREADED_RTS) // Discard all the sparks from every Capability. Why? // They'll probably be GC'd anyway since we've killed all the @@ -2038,7 +2038,7 @@ forkProcess(HsStablePtr *entry // don't allow threads to catch the ThreadKilled // exception, but we do want to raiseAsync() because these // threads may be evaluating thunks that we need later. - deleteThread_(t->cap,t); + deleteThread_(t); // stop the GC from updating the InCall to point to // the TSO. This is only necessary because the @@ -2262,7 +2262,7 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS) * ------------------------------------------------------------------------- */ static void -deleteAllThreads ( Capability *cap ) +deleteAllThreads () { // NOTE: only safe to call if we own all capabilities. @@ -2273,7 +2273,7 @@ deleteAllThreads ( Capability *cap ) for (g = 0; g < RtsFlags.GcFlags.generations; g++) { for (t = generations[g].threads; t != END_TSO_QUEUE; t = next) { next = t->global_link; - deleteThread(cap,t); + deleteThread(t); } } @@ -2784,7 +2784,7 @@ void wakeUpRts(void) -------------------------------------------------------------------------- */ static void -deleteThread (Capability *cap STG_UNUSED, StgTSO *tso) +deleteThread (StgTSO *tso) { // NOTE: must only be called on a TSO that we have exclusive // access to, because we will call throwToSingleThreaded() below. @@ -2799,7 +2799,7 @@ deleteThread (Capability *cap STG_UNUSED, StgTSO *tso) #if defined(FORKPROCESS_PRIMOP_SUPPORTED) static void -deleteThread_(Capability *cap, StgTSO *tso) +deleteThread_(StgTSO *tso) { // for forkProcess only: // like deleteThread(), but we delete threads in foreign calls, too. @@ -2808,7 +2808,7 @@ deleteThread_(Capability *cap, StgTSO *tso) tso->what_next = ThreadKilled; appendToRunQueue(tso->cap, tso); } else { - deleteThread(cap,tso); + deleteThread(tso); } } #endif From git at git.haskell.org Wed Apr 11 11:25:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 11:25:32 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394: Bump perf test targets (55a78ea) Message-ID: <20180411112532.96F4A3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394 Link : http://ghc.haskell.org/trac/ghc/changeset/55a78ea829d6ad079783194f759198826292e42b/ghc >--------------------------------------------------------------- commit 55a78ea829d6ad079783194f759198826292e42b Author: Tobias Dammers Date: Mon Apr 9 18:08:15 2018 +0200 Bump perf test targets Collateral to #14737: a handful of tests perform somewhat worse with this patch, and one perfoms better. For now, just doctor the numbers to make it pass. >--------------------------------------------------------------- 55a78ea829d6ad079783194f759198826292e42b testsuite/tests/perf/compiler/all.T | 6 ++++-- testsuite/tests/perf/haddock/all.T | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 5a45859..29787f5 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -476,12 +476,13 @@ test('parsing001', [(wordsize(32), 232777056, 10), # Initial: 274000576 # 2017-03-24: 232777056 - (wordsize(64), 490228304, 5)]), + (wordsize(64), 519401296, 5)]), # expected value: 587079016 (amd64/Linux) # 2016-09-01: 581551384 (amd64/Linux) Restore w/w limit (#11565) # 2016-12-19: 493730288 (amd64/Linux) Join points (#12988) # 2017-02-14: 463931280 Early inlining patch; acutal improvement 7% # 2017-12-11: 490228304 BlockArguments + # 2018-04-09: 519401296 Inexplicable, collateral of #14737 only_ways(['normal']), ], compile_fail, ['']) @@ -885,7 +886,7 @@ test('T9872c', test('T9872d', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 526485920, 5), + [(wordsize(64), 572537984, 5), # 2014-12-18 796071864 Initally created # 2014-12-18 739189056 Reduce type families even more eagerly # 2015-01-07 687562440 TrieMap leaf compression @@ -899,6 +900,7 @@ test('T9872d', # 2017-02-25 498855104 Early inlining # 2017-03-03 462817352 Share Typeable KindReps # 2018-03-25 526485920 Flattener patch does more work (#12919) + # 2018-04-11 572537984 simplCast improvement collateral (#11735) (wordsize(32), 232954000, 5) # some date 328810212 diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index db378fe..09ed19a 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -10,7 +10,7 @@ test('haddock.base', # 2017-02-19 24286343184 (x64/Windows) - Generalize kind of (->) # 2017-12-24 18733710728 (x64/Windows) - Unknown - ,(wordsize(64), 19694554424, 5) + ,(wordsize(64), 20727464616, 5) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) @@ -44,6 +44,7 @@ test('haddock.base', # 2017-06-06: 25173968808 (x86_64/Linux) - Don't pass on -dcore-lint in Haddock.mk # 2017-07-12: 23677299848 (x86_64/Linux) - Use getNameToInstancesIndex # 2017-08-22: 19694554424 (x86_64/Linux) - Various Haddock optimizations + # 2018-04-11: 20727464616 (x86_64/Linux) - Collateral of simplCast improvement (#14737) ,(platform('i386-unknown-mingw32'), 2885173512, 5) # 2013-02-10: 3358693084 (x86/Windows) From git at git.haskell.org Wed Apr 11 12:57:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 12:57:20 +0000 (UTC) Subject: [commit: ghc] branch 'wip/tdammers/D4570' created Message-ID: <20180411125720.33C963A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/tdammers/D4570 Referencing: 93e30351fbeed56ab9dae6e3f1149e960184fe85 From git at git.haskell.org Wed Apr 11 12:57:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 12:57:23 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4570: Debug only (93e3035) Message-ID: <20180411125723.092B23A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4570 Link : http://ghc.haskell.org/trac/ghc/changeset/93e30351fbeed56ab9dae6e3f1149e960184fe85/ghc >--------------------------------------------------------------- commit 93e30351fbeed56ab9dae6e3f1149e960184fe85 Author: Simon Peyton Jones Date: Wed Apr 4 13:14:43 2018 +0100 Debug only * Improve assertion-failure message * Add HasDebugCallStack to decomposeFunCo >--------------------------------------------------------------- 93e30351fbeed56ab9dae6e3f1149e960184fe85 compiler/types/Coercion.hs | 82 ++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 556dd8e..8d1b7b8 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -238,8 +238,10 @@ decomposeCo arity co rs = [mkNthCo r n co | (n,r) <- [0..(arity-1)] `zip` rs ] -- Remember, Nth is zero-indexed -decomposeFunCo :: Role -- of the input coercion - -> Coercion -> (Coercion, Coercion) +decomposeFunCo :: HasDebugCallStack + => Role -- Role of the input coercion + -> Coercion -- Input coercion + -> (Coercion, Coercion) -- Expects co :: (s1 -> t1) ~ (s2 -> t2) -- Returns (co1 :: s1~s2, co2 :: t1~t2) -- See Note [Function coercions] for the "2" and "3" @@ -842,44 +844,11 @@ mkNthCo :: HasDebugCallStack -> Coercion -> Coercion mkNthCo r n co - = ASSERT(good_call) + = ASSERT2( good_call, bad_call_msg ) go r n co where Pair ty1 ty2 = coercionKind co - good_call - -- If the Coercion passed in is between forall-types, then the Int must - -- be 0 and the role must be Nominal. - | Just (_tv1, _) <- splitForAllTy_maybe ty1 - , Just (_tv2, _) <- splitForAllTy_maybe ty2 - = n == 0 && r == Nominal - - -- If the Coercion passed in is between T tys and T tys', then the Int - -- must be less than the length of tys/tys' (which must be the same - -- lengths). - -- - -- If the role of the Coercion is nominal, then the role passed in must - -- be nominal. If the role of the Coercion is representational, then the - -- role passed in must be tyConRolesRepresentational T !! n. If the role - -- of the Coercion is Phantom, then the role passed in must be Phantom. - -- - -- See also Note [NthCo Cached Roles] if you're wondering why it's - -- blaringly obvious that we should be *computing* this role instead of - -- passing it in. - | Just (tc1, tys1) <- splitTyConApp_maybe ty1 - , Just (tc2, tys2) <- splitTyConApp_maybe ty2 - , tc1 == tc2 - = let len1 = length tys1 - len2 = length tys2 - good_role = case coercionRole co of - Nominal -> r == Nominal - Representational -> r == (tyConRolesRepresentational tc1 !! n) - Phantom -> r == Phantom - in len1 == len2 && n < len1 && good_role - - | otherwise - = True - go r 0 (Refl _ ty) | Just (tv, _) <- splitForAllTy_maybe ty = ASSERT( r == Nominal ) @@ -933,6 +902,47 @@ mkNthCo r n co go r n co = NthCo r n co + -- Assertion checking + bad_call_msg = vcat [ text "Coercion =" <+> ppr co + , text "LHS ty =" <+> ppr ty1 + , text "RHS ty =" <+> ppr ty2 + , text "n =" <+> ppr n, text "r =" <+> ppr r + , text "coercion role =" <+> ppr (coercionRole co) ] + good_call + -- If the Coercion passed in is between forall-types, then the Int must + -- be 0 and the role must be Nominal. + | Just (_tv1, _) <- splitForAllTy_maybe ty1 + , Just (_tv2, _) <- splitForAllTy_maybe ty2 + = n == 0 && r == Nominal + + -- If the Coercion passed in is between T tys and T tys', then the Int + -- must be less than the length of tys/tys' (which must be the same + -- lengths). + -- + -- If the role of the Coercion is nominal, then the role passed in must + -- be nominal. If the role of the Coercion is representational, then the + -- role passed in must be tyConRolesRepresentational T !! n. If the role + -- of the Coercion is Phantom, then the role passed in must be Phantom. + -- + -- See also Note [NthCo Cached Roles] if you're wondering why it's + -- blaringly obvious that we should be *computing* this role instead of + -- passing it in. + | Just (tc1, tys1) <- splitTyConApp_maybe ty1 + , Just (tc2, tys2) <- splitTyConApp_maybe ty2 + , tc1 == tc2 + = let len1 = length tys1 + len2 = length tys2 + good_role = case coercionRole co of + Nominal -> r == Nominal + Representational -> r == (tyConRolesRepresentational tc1 !! n) + Phantom -> r == Phantom + in len1 == len2 && n < len1 && good_role + + | otherwise + = True + + + -- | If you're about to call @mkNthCo r n co@, then @r@ should be -- whatever @nthCoRole n co@ returns. nthCoRole :: Int -> Coercion -> Role From git at git.haskell.org Wed Apr 11 15:25:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 Apr 2018 15:25:17 +0000 (UTC) Subject: [commit: ghc] master: No need for sortQuantVars in Exitify after all (270e3e9) Message-ID: <20180411152517.22CCB3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/270e3e9bbaabad3d9a1348cea9e46a9ecf1e5ec2/ghc >--------------------------------------------------------------- commit 270e3e9bbaabad3d9a1348cea9e46a9ecf1e5ec2 Author: Joachim Breitner Date: Wed Apr 11 11:24:01 2018 -0400 No need for sortQuantVars in Exitify after all because `captured :: [Var]` is always in dependency order. I added a comment in the crucial point so that this does not trip us up again. >--------------------------------------------------------------- 270e3e9bbaabad3d9a1348cea9e46a9ecf1e5ec2 compiler/simplCore/Exitify.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 6e7d063..22edc20 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -48,7 +48,6 @@ import VarEnv import CoreFVs import FastString import Type -import MkCore ( sortQuantVars ) import Data.Bifunctor import Control.Monad @@ -128,7 +127,7 @@ exitify in_scope pairs = -- variables bound on the way and lifts it out as a join point. -- -- ExitifyM is a state monad to keep track of floated binds - go :: [Var] -- ^ variables to abstract over + go :: [Var] -- ^ variables to abstract over (in dependency order) -> CoreExprWithFVs -- ^ current expression in tail position -> ExitifyM CoreExpr @@ -175,10 +174,8 @@ exitify in_scope pairs = is_interesting = anyVarSet isLocalId (fvs `minusVarSet` mkVarSet captured) -- The possible arguments of this exit join point - abs_vars = - map zap $ - sortQuantVars $ - filter (`elemVarSet` fvs) captured + -- No need for `sortQuantVars`, `captured` is already in dependency order + abs_vars = map zap $ filter (`elemVarSet` fvs) captured -- cf. SetLevels.abstractVars zap v | isId v = setIdInfo v vanillaIdInfo From git at git.haskell.org Thu Apr 12 03:08:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 03:08:13 +0000 (UTC) Subject: [commit: ghc] master: Remove fs files from rts install-includes. (111556f) Message-ID: <20180412030813.D49293A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/111556f9e809962a91666c99d96cf80db361ee32/ghc >--------------------------------------------------------------- commit 111556f9e809962a91666c99d96cf80db361ee32 Author: Tamar Christina Date: Thu Apr 12 04:06:11 2018 +0100 Remove fs files from rts install-includes. They don't really need to be installed and will fix Hadrian installs. Skipping review because change is trivial. >--------------------------------------------------------------- 111556f9e809962a91666c99d96cf80db361ee32 rts/rts.cabal.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index 0b9a8c4..b3cd2b2 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -129,8 +129,6 @@ library rts/Timer.h rts/Types.h rts/Utils.h - rts/fs.h - rts/fs_rts.h rts/prof/CCS.h rts/prof/LDV.h rts/storage/Block.h From git at git.haskell.org Thu Apr 12 06:51:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 06:51:50 +0000 (UTC) Subject: [commit: ghc] master: Revert "Remove fs files from rts install-includes." (4e6da0f) Message-ID: <20180412065150.292593A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4e6da0f2feeb22f54361d774eb05251019b25e09/ghc >--------------------------------------------------------------- commit 4e6da0f2feeb22f54361d774eb05251019b25e09 Author: Tamar Christina Date: Thu Apr 12 07:50:28 2018 +0100 Revert "Remove fs files from rts install-includes." This reverts commit 111556f9e809962a91666c99d96cf80db361ee32. There is a mismatch between Hadrian and Make on these install-includes. but the reachability analysis forces these headers to be exported even through they can't vven be used. >--------------------------------------------------------------- 4e6da0f2feeb22f54361d774eb05251019b25e09 rts/rts.cabal.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index b3cd2b2..0b9a8c4 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -129,6 +129,8 @@ library rts/Timer.h rts/Types.h rts/Utils.h + rts/fs.h + rts/fs_rts.h rts/prof/CCS.h rts/prof/LDV.h rts/storage/Block.h From git at git.haskell.org Thu Apr 12 15:27:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 15:27:51 +0000 (UTC) Subject: [commit: ghc] branch 'wip/tdammers/D4394-squash' created Message-ID: <20180412152751.C5F323A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/tdammers/D4394-squash Referencing: 772fb62e2a9c0fbab7cd090e82750fd261f2f6a1 From git at git.haskell.org Thu Apr 12 15:27:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 15:27:57 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Improve coercionKind(Role) perfomance (12b6941) Message-ID: <20180412152757.701813A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/12b6941111b1a23eac4bf5b5cb0bd3d4c6fbc45a/ghc >--------------------------------------------------------------- commit 12b6941111b1a23eac4bf5b5cb0bd3d4c6fbc45a Author: Tobias Dammers Date: Wed Jan 24 16:05:55 2018 +0100 Improve coercionKind(Role) perfomance By separating / refactoring the coercionKind and coercionRole functions, we can avoid unnecessary calculations and avoid some costly recursions. See #11735. >--------------------------------------------------------------- 12b6941111b1a23eac4bf5b5cb0bd3d4c6fbc45a compiler/types/Coercion.hs | 82 ++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 53 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index c8105d0..4cc8cef 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -1755,6 +1755,8 @@ substitute for them all at once. Remarkably, for Trac #11735 this single change reduces /total/ compile time by a factor of more than ten. -} +======= +>>>>>>> Applying patch suggested in #11735 to improve coercionKind perf -- | Apply 'coercionKind' to multiple 'Coercion's coercionKinds :: [Coercion] -> Pair [Type] @@ -1763,77 +1765,51 @@ coercionKinds tys = sequenceA $ map coercionKind tys -- | Get a coercion's kind and role. -- Why both at once? See Note [Computing a coercion kind and role] coercionKindRole :: Coercion -> (Pair Type, Role) -coercionKindRole = go +coercionKindRole co = (coercionKind co, coercionRole co) + +-- | Retrieve the role from a coercion. +coercionRole :: Coercion -> Role +coercionRole = go where - go (Refl r ty) = (Pair ty ty, r) - go (TyConAppCo r tc cos) - = (mkTyConApp tc <$> (sequenceA $ map coercionKind cos), r) - go (AppCo co1 co2) - = let (tys1, r1) = go co1 in - (mkAppTy <$> tys1 <*> coercionKind co2, r1) - go (ForAllCo tv1 k_co co) - = let Pair _ k2 = coercionKind k_co - tv2 = setTyVarKind tv1 k2 - (Pair ty1 ty2, r) = go co - subst = zipTvSubst [tv1] [TyVarTy tv2 `mkCastTy` mkSymCo k_co] - ty2' = substTyAddInScope subst ty2 in - -- We need free vars of ty2 in scope to satisfy the invariant - -- from Note [The substitution invariant] - -- This is doing repeated substitutions and probably doesn't - -- need to, see #11735 - (mkInvForAllTy <$> Pair tv1 tv2 <*> Pair ty1 ty2', r) - go (FunCo r co1 co2) - = (mkFunTy <$> coercionKind co1 <*> coercionKind co2, r) + go (Refl r _) = r + go (TyConAppCo r _ _) = r + go (AppCo co1 _) = go co1 + go (ForAllCo _ _ co) = go co + go (FunCo r _ _) = r go (CoVarCo cv) = go_var cv go (HoleCo h) = go_var (coHoleCoVar h) - go co@(AxiomInstCo ax _ _) = (coercionKind co, coAxiomRole ax) - go (UnivCo _ r ty1 ty2) = (Pair ty1 ty2, r) - go (SymCo co) = first swap $ go co - go (TransCo co1 co2) - = let (tys1, r) = go co1 in - (Pair (pFst tys1) (pSnd $ coercionKind co2), r) + go (AxiomInstCo ax _ _) = coAxiomRole ax + go (UnivCo _ r _ _) = r + go (SymCo co) = go co + go (TransCo co1 co2) = go co1 go (NthCo d co) | Just (tv1, _) <- splitForAllTy_maybe ty1 = ASSERT( d == 0 ) - let (tv2, _) = splitForAllTy ty2 in - (tyVarKind <$> Pair tv1 tv2, Nominal) + Nominal | otherwise = let (tc1, args1) = splitTyConApp ty1 (_tc2, args2) = splitTyConApp ty2 in ASSERT2( tc1 == _tc2, ppr d $$ ppr tc1 $$ ppr _tc2 ) - ((`getNth` d) <$> Pair args1 args2, nthRole r tc1 d) + (nthRole r tc1 d) where - (Pair ty1 ty2, r) = go co - go co@(LRCo {}) = (coercionKind co, Nominal) - go (InstCo co arg) = go_app co [arg] - go (CoherenceCo co1 co2) - = let (Pair t1 t2, r) = go co1 in - (Pair (t1 `mkCastTy` co2) t2, r) - go co@(KindCo {}) = (coercionKind co, Nominal) - go (SubCo co) = (coercionKind co, Representational) - go co@(AxiomRuleCo ax _) = (coercionKind co, coaxrRole ax) + (Pair ty1 ty2, r) = coercionKindRole co + go (LRCo {}) = Nominal + go (InstCo co arg) = go_app co + go (CoherenceCo co1 _) = go co1 + go (KindCo {}) = Nominal + go (SubCo _) = Representational + go (AxiomRuleCo ax _) = coaxrRole ax ------------- - go_var cv = (coVarTypes cv, coVarRole cv) + go_var = coVarRole ------------- - go_app :: Coercion -> [Coercion] -> (Pair Type, Role) - -- Collect up all the arguments and apply all at once - -- See Note [Nested InstCos] - go_app (InstCo co arg) args = go_app co (arg:args) - go_app co args - = let (pair, r) = go co in - (piResultTys <$> pair <*> (sequenceA $ map coercionKind args), r) - --- | Retrieve the role from a coercion. -coercionRole :: Coercion -> Role -coercionRole = snd . coercionKindRole - -- There's not a better way to do this, because NthCo needs the *kind* - -- and role of its argument. Luckily, laziness should generally avoid - -- the need for computing kinds in other cases. + go_app :: Coercion -> Role + go_app (InstCo co arg) = go_app co + go_app co = go co {- Note [Nested InstCos] From git at git.haskell.org Thu Apr 12 15:27:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 15:27:54 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Added SCCs to hunt down #14683 (9a4182b) Message-ID: <20180412152754.A1EEE3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/9a4182bb66137ce6b8bab97cec2a9d04045c8eef/ghc >--------------------------------------------------------------- commit 9a4182bb66137ce6b8bab97cec2a9d04045c8eef Author: Tobias Dammers Date: Wed Jan 24 16:07:00 2018 +0100 Added SCCs to hunt down #14683 >--------------------------------------------------------------- 9a4182bb66137ce6b8bab97cec2a9d04045c8eef compiler/simplCore/Simplify.hs | 72 +++++++++++++++++++++++++----------------- compiler/types/TyCoRep.hs | 9 +++--- 2 files changed, 48 insertions(+), 33 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 9a4182bb66137ce6b8bab97cec2a9d04045c8eef From git at git.haskell.org Thu Apr 12 15:28:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 15:28:00 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Cache coercion roles in NthCo (772fb62) Message-ID: <20180412152800.6A3313A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/772fb62e2a9c0fbab7cd090e82750fd261f2f6a1/ghc >--------------------------------------------------------------- commit 772fb62e2a9c0fbab7cd090e82750fd261f2f6a1 Author: Tobias Dammers Date: Thu Jan 25 20:33:58 2018 +0100 Cache coercion roles in NthCo Most callers of mkNthCo know the role of the coercion they are trying to make. So instead of calculating this role, we pass it in, forcing the caller to calculate it when needed. >--------------------------------------------------------------- 772fb62e2a9c0fbab7cd090e82750fd261f2f6a1 compiler/coreSyn/CoreFVs.hs | 2 +- compiler/coreSyn/CoreLint.hs | 8 +- compiler/coreSyn/CoreOpt.hs | 24 +- compiler/coreSyn/CoreUtils.hs | 2 +- compiler/iface/TcIface.hs | 3 +- compiler/iface/ToIface.hs | 2 +- compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcEvidence.hs | 12 +- compiler/typecheck/TcTyDecls.hs | 2 +- compiler/typecheck/TcType.hs | 4 +- compiler/typecheck/TcUnify.hs | 4 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Coercion.hs | 415 +++++++++++++++-------- compiler/types/Coercion.hs-boot | 2 +- compiler/types/FamInstEnv.hs | 2 +- compiler/types/OptCoercion.hs | 103 +++--- compiler/types/TyCoRep.hs | 39 ++- compiler/types/Type.hs | 20 +- compiler/types/Unify.hs | 4 +- docs/core-spec/CoreLint.ott | 4 +- docs/core-spec/CoreSyn.ott | 6 +- docs/core-spec/core-spec.mng | 2 +- docs/core-spec/core-spec.pdf | Bin 354307 -> 355707 bytes libraries/array | 2 +- testsuite/tests/perf/compiler/all.T | 9 +- testsuite/tests/perf/haddock/all.T | 3 +- testsuite/tests/pmcheck/should_compile/T11195.hs | 2 +- 27 files changed, 412 insertions(+), 268 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 772fb62e2a9c0fbab7cd090e82750fd261f2f6a1 From git at git.haskell.org Thu Apr 12 20:43:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 Apr 2018 20:43:00 +0000 (UTC) Subject: [commit: ghc] master: Remove fs files from rts install-includes. (5417c68) Message-ID: <20180412204300.5E1143A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5417c68977db2f2c2c1ce3b8b19ac1f540df471c/ghc >--------------------------------------------------------------- commit 5417c68977db2f2c2c1ce3b8b19ac1f540df471c Author: Tamar Christina Date: Thu Apr 12 21:40:43 2018 +0100 Remove fs files from rts install-includes. Summary: They don't really need to be installed and will fix Hadrian installs. Skipping review because change is trivial. THis should be safe, but running it through CI to be sure. Test Plan: ./validate Reviewers: bgamari, erikd, simonmar Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4591 >--------------------------------------------------------------- 5417c68977db2f2c2c1ce3b8b19ac1f540df471c rts/rts.cabal.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index 0b9a8c4..b3cd2b2 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -129,8 +129,6 @@ library rts/Timer.h rts/Types.h rts/Utils.h - rts/fs.h - rts/fs_rts.h rts/prof/CCS.h rts/prof/LDV.h rts/storage/Block.h From git at git.haskell.org Fri Apr 13 11:41:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 11:41:20 +0000 (UTC) Subject: [commit: ghc] master: TTG for HsBinds and Data instances Plan B (b138694) Message-ID: <20180413114120.CA5763A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b1386942e63ba5fe4b2da27f5025afdf80356392/ghc >--------------------------------------------------------------- commit b1386942e63ba5fe4b2da27f5025afdf80356392 Author: Alan Zimmerman Date: Sun Apr 1 21:33:53 2018 +0200 TTG for HsBinds and Data instances Plan B Summary: - Add the balance of the TTG extensions for hsSyn/HsBinds - Move all the (now orphan) data instances into hsSyn/HsInstances and use TTG Data instances Plan B https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances#PLANB Updates haddock submodule. Illustrative numbers Compiling HsInstances before using Plan B. Max residency ~ 5G <> Using Plan B Max residency 1.1G <> Test Plan: ./validate Reviewers: shayan-najd, goldfire, bgamari Subscribers: goldfire, thomie, mpickering, carter Differential Revision: https://phabricator.haskell.org/D4581 >--------------------------------------------------------------- b1386942e63ba5fe4b2da27f5025afdf80356392 compiler/deSugar/Coverage.hs | 22 +- compiler/deSugar/DsBinds.hs | 8 +- compiler/deSugar/DsExpr.hs | 18 +- compiler/deSugar/DsMeta.hs | 47 +- compiler/ghc.cabal.in | 1 + compiler/hsSyn/Convert.hs | 27 +- compiler/hsSyn/HsBinds.hs | 246 +++++++--- compiler/hsSyn/HsDecls.hs | 39 +- compiler/hsSyn/HsExpr.hs | 23 +- compiler/hsSyn/HsExpr.hs-boot | 10 +- compiler/hsSyn/HsExtension.hs | 503 ++++++++++++++------- compiler/hsSyn/HsInstances.hs | 405 +++++++++++++++++ compiler/hsSyn/HsLit.hs | 3 - compiler/hsSyn/HsPat.hs | 2 - compiler/hsSyn/HsPat.hs-boot | 4 +- compiler/hsSyn/HsSyn.hs | 9 +- compiler/hsSyn/HsTypes.hs | 11 - compiler/hsSyn/HsUtils.hs | 62 +-- compiler/main/InteractiveEval.hs | 2 +- compiler/parser/Parser.y | 44 +- compiler/parser/RdrHsSyn.hs | 11 +- compiler/rename/RnBinds.hs | 138 +++--- compiler/rename/RnExpr.hs | 29 +- compiler/rename/RnNames.hs | 2 +- compiler/rename/RnSource.hs | 14 +- compiler/typecheck/TcBinds.hs | 75 +-- compiler/typecheck/TcClassDcl.hs | 18 +- compiler/typecheck/TcEnv.hs | 4 +- compiler/typecheck/TcGenDeriv.hs | 10 +- compiler/typecheck/TcHsSyn.hs | 64 ++- compiler/typecheck/TcInstDcls.hs | 27 +- compiler/typecheck/TcPatSyn.hs | 15 +- compiler/typecheck/TcRnDriver.hs | 6 +- compiler/typecheck/TcSigs.hs | 25 +- compiler/typecheck/TcTyClsDecls.hs | 5 +- compiler/typecheck/TcTyDecls.hs | 2 +- .../parser/should_compile/DumpParsedAst.stderr | 5 +- .../parser/should_compile/DumpRenamedAst.stderr | 7 +- .../should_compile/DumpTypecheckedAst.stderr | 15 +- testsuite/tests/perf/haddock/all.T | 9 +- utils/ghctags/Main.hs | 4 +- utils/haddock | 2 +- 42 files changed, 1337 insertions(+), 636 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 b1386942e63ba5fe4b2da27f5025afdf80356392 From git at git.haskell.org Fri Apr 13 16:06:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:06:25 +0000 (UTC) Subject: [commit: ghc] master: Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0 (c4814ab) Message-ID: <20180413160625.77A303A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4814ab6b8d756ae0e32c9a9f44e4888c4e24763/ghc >--------------------------------------------------------------- commit c4814ab6b8d756ae0e32c9a9f44e4888c4e24763 Author: Ryan Scott Date: Fri Apr 13 11:31:09 2018 -0400 Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0 This takes care of bumping the `base` and `integer-gmp` minor version numbers in anticipation of a GHC 8.4.2 release. While I was in town, I also filled in a `@since TODO` Haddock annotation for `powModSecInteger` in `integer-gmp` with `1.0.2.0`, and updated the changelog accordingly. Test Plan: ./validate Reviewers: hvr, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15025 Differential Revision: https://phabricator.haskell.org/D4586 >--------------------------------------------------------------- c4814ab6b8d756ae0e32c9a9f44e4888c4e24763 docs/users_guide/8.4.2-notes.rst | 14 ++++++++++---- libraries/base/base.cabal | 2 +- libraries/base/changelog.md | 4 ++++ libraries/integer-gmp/changelog.md | 7 +++++++ libraries/integer-gmp/integer-gmp.cabal | 2 +- libraries/integer-gmp/src/GHC/Integer/Type.hs | 2 +- testsuite/tests/ado/ado004.stderr | 4 ++-- testsuite/tests/backpack/should_compile/bkp16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail17.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail19.stderr | 4 ++-- testsuite/tests/determinism/determ021/determ021.stdout | 8 ++++---- testsuite/tests/driver/json2.stderr | 6 +++--- testsuite/tests/ghci/scripts/ghci008.stdout | 4 ++-- testsuite/tests/indexed-types/should_compile/T3017.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr3.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr4.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr5.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr6.stderr | 4 ++-- .../tests/partial-sigs/should_compile/BoolToBool.stderr | 4 ++-- .../should_compile/DataFamilyInstanceLHS.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting1MROn.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting2MROff.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting2MROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Either.stderr | 4 ++-- .../partial-sigs/should_compile/EqualityConstraint.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Every.stderr | 4 ++-- .../tests/partial-sigs/should_compile/EveryNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExpressionSig.stderr | 4 ++-- .../partial-sigs/should_compile/ExpressionSigNamed.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints1.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints2.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints3.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraNumAMROff.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExtraNumAMROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Forall1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/GenNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/HigherRank1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/HigherRank2.stderr | 4 ++-- .../partial-sigs/should_compile/LocalDefinitionBug.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Meltdown.stderr | 4 ++-- .../partial-sigs/should_compile/MonoLocalBinds.stderr | 4 ++-- .../tests/partial-sigs/should_compile/NamedTyVar.stderr | 4 ++-- .../NamedWildcardInDataFamilyInstanceLHS.stderr | 4 ++-- .../NamedWildcardInTypeFamilyInstanceLHS.stderr | 4 ++-- .../partial-sigs/should_compile/ParensAroundContext.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/PatBind.stderr | 4 ++-- .../tests/partial-sigs/should_compile/PatBind2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/PatternSig.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Recursive.stderr | 4 ++-- .../should_compile/ScopedNamedWildcards.stderr | 4 ++-- .../should_compile/ScopedNamedWildcardsGood.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ShowNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/SimpleGen.stderr | 4 ++-- .../tests/partial-sigs/should_compile/SkipMany.stderr | 4 ++-- .../partial-sigs/should_compile/SomethingShowable.stderr | 4 ++-- .../should_compile/TypeFamilyInstanceLHS.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Uncurry.stderr | 4 ++-- .../tests/partial-sigs/should_compile/UncurryNamed.stderr | 4 ++-- .../should_compile/WarningWildcardInstantiations.stderr | 4 ++-- testsuite/tests/rename/should_fail/rnfail040.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles14.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles2.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles3.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles4.stderr | 4 ++-- testsuite/tests/roles/should_compile/T8958.stderr | 4 ++-- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 2 +- testsuite/tests/safeHaskell/check/Check08.stderr | 2 +- testsuite/tests/safeHaskell/check/Check09.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 2 +- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 2 +- testsuite/tests/typecheck/should_compile/T12763.stderr | 4 ++-- testsuite/tests/typecheck/should_compile/holes.stderr | 8 ++++---- testsuite/tests/typecheck/should_compile/holes3.stderr | 8 ++++---- testsuite/tests/typecheck/should_compile/tc231.stderr | 4 ++-- .../typecheck/should_fail/TcStaticPointersFail02.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 2 +- 83 files changed, 176 insertions(+), 159 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 c4814ab6b8d756ae0e32c9a9f44e4888c4e24763 From git at git.haskell.org Fri Apr 13 16:06:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:06:40 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Update release notes and language extensions (f02309f) Message-ID: <20180413160640.A737E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f02309fe66606ffbd2d52d9347438e11890f7cfa/ghc >--------------------------------------------------------------- commit f02309fe66606ffbd2d52d9347438e11890f7cfa Author: Takenobu Tani Date: Fri Apr 13 11:31:23 2018 -0400 users-guide: Update release notes and language extensions Update release notes and language extensions for GHC 8.6.1. * Add `BlockArguments` and `NumericUndescores` in release note * Fix directive for `HexFloatLiterals` and `NumericUndescores` Test Plan: build Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4579 >--------------------------------------------------------------- f02309fe66606ffbd2d52d9347438e11890f7cfa docs/users_guide/8.6.1-notes.rst | 10 ++++++++++ docs/users_guide/glasgow_exts.rst | 16 +++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst index 6300a3f..74bf929 100644 --- a/docs/users_guide/8.6.1-notes.rst +++ b/docs/users_guide/8.6.1-notes.rst @@ -60,6 +60,16 @@ Language - Scoped type variables now work in default methods of class declarations and in pattern synonyms in Template Haskell. See :ghc-ticket:`14885`. +- ``do`` expressions, lambda expressions, etc. to be directly used as + a function argument, enabled with :extension:`BlockArguments`. + See :ref:`More liberal syntax for function arguments ` + for the full details. + +- Underscores in numeric literals (e.g. ``1_000_000``), enabled with + :extension:`NumericUnderscores`. + See :ref:`Numeric underscores ` + for the full details. + Compiler ~~~~~~~~ diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 6442818..e2d2033 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -525,11 +525,8 @@ instance, the binary integer literal ``0b11001001`` will be desugared into Hexadecimal floating point literals ----------------------------------- -.. ghc-flag:: -XHexFloatLiterals +.. extension:: HexFloatLiterals :shortdesc: Enable support for :ref:`hexadecimal floating point literals `. - :type: dynamic - :reverse: -XNoHexFloatLIterals - :category: :since: 8.4.1 @@ -569,11 +566,8 @@ by one bit left (negative) or right (positive). Here are some examples: Numeric underscores ------------------- -.. ghc-flag:: -XNumericUnderscores +.. extension:: NumericUnderscores :shortdesc: Enable support for :ref:`numeric underscores `. - :type: dynamic - :reverse: -XNoNumericUnderscores - :category: :since: 8.6.1 @@ -582,12 +576,12 @@ Numeric underscores GHC allows for numeric literals to be given in decimal, octal, hexadecimal, binary, or float notation. -The language extension :ghc-flag:`-XNumericUnderscores` adds support for expressing +The language extension :extension:`NumericUnderscores` adds support for expressing underscores in numeric literals. For instance, the numeric literal ``1_000_000`` will be parsed into -``1000000`` when :ghc-flag:`-XNumericUnderscores` is enabled. +``1000000`` when :extension:`NumericUnderscores` is enabled. That is, underscores in numeric literals are ignored when -:ghc-flag:`-XNumericUnderscores` is enabled. +:extension:`NumericUnderscores` is enabled. See also :ghc-ticket:`14473`. For example: :: From git at git.haskell.org Fri Apr 13 16:06:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:06:54 +0000 (UTC) Subject: [commit: ghc] master: Revert "CmmPipeline: add a second pass of CmmCommonBlockElim" (78ff6e5) Message-ID: <20180413160654.EE66A3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/78ff6e541d33d2d2caf52d2cb4578cd7b745d282/ghc >--------------------------------------------------------------- commit 78ff6e541d33d2d2caf52d2cb4578cd7b745d282 Author: Michal Terepeta Date: Fri Apr 13 11:31:38 2018 -0400 Revert "CmmPipeline: add a second pass of CmmCommonBlockElim" This reverts commit d5c4d46a62ce6a0cfa6440344f707136eff18119. Please see #14989 for details. Test Plan: ./validate Reviewers: bgamari, simonmar Subscribers: thomie, carter GHC Trac Issues: #14989 Differential Revision: https://phabricator.haskell.org/D4577 >--------------------------------------------------------------- 78ff6e541d33d2d2caf52d2cb4578cd7b745d282 compiler/cmm/CmmCommonBlockElim.hs | 8 ++++---- compiler/cmm/CmmPipeline.hs | 42 +++----------------------------------- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs index ad10511..c91d553 100644 --- a/compiler/cmm/CmmCommonBlockElim.hs +++ b/compiler/cmm/CmmCommonBlockElim.hs @@ -59,10 +59,9 @@ import Data.List (foldl') -- hashes, and at most once otherwise. Previously, we were slower, and people -- rightfully complained: #10397 -type Subst = LabelMap BlockId - -elimCommonBlocks :: CmmGraph -> (CmmGraph, Subst) -elimCommonBlocks g = (replaceLabels env $ copyTicks env g, env) +-- TODO: Use optimization fuel +elimCommonBlocks :: CmmGraph -> CmmGraph +elimCommonBlocks g = replaceLabels env $ copyTicks env g where env = iterate mapEmpty blocks_with_key -- The order of blocks doesn't matter here, but revPostorder also drops any @@ -74,6 +73,7 @@ elimCommonBlocks g = (replaceLabels env $ copyTicks env g, env) -- (so avoid comparing them again) type DistinctBlocks = [CmmBlock] type Key = [Label] +type Subst = LabelMap BlockId -- The outer list groups by hash. We retain this grouping throughout. iterate :: Subst -> [[(Key, DistinctBlocks)]] -> Subst diff --git a/compiler/cmm/CmmPipeline.hs b/compiler/cmm/CmmPipeline.hs index babdb0b..4d109a4 100644 --- a/compiler/cmm/CmmPipeline.hs +++ b/compiler/cmm/CmmPipeline.hs @@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE TypeFamilies #-} module CmmPipeline ( -- | Converts C-- with an implicit stack and native C-- calls into @@ -29,8 +28,6 @@ import Control.Monad import Outputable import Platform -import Data.Maybe - ----------------------------------------------------------------------------- -- | Top level driver for C-- pipeline ----------------------------------------------------------------------------- @@ -70,9 +67,9 @@ cpsTop hsc_env proc = , do_layout = do_layout }} = h ----------- Eliminate common blocks ------------------------------------- - (g, _) <- {-# SCC "elimCommonBlocks" #-} - condPass2 Opt_CmmElimCommonBlocks elimCommonBlocks g mapEmpty - Opt_D_dump_cmm_cbe "Post common block elimination" + g <- {-# SCC "elimCommonBlocks" #-} + condPass Opt_CmmElimCommonBlocks elimCommonBlocks g + Opt_D_dump_cmm_cbe "Post common block elimination" -- Any work storing block Labels must be performed _after_ -- elimCommonBlocks @@ -107,32 +104,6 @@ cpsTop hsc_env proc = condPass Opt_CmmSink (cmmSink dflags) g Opt_D_dump_cmm_sink "Sink assignments" - (g, call_pps, proc_points) <- do - -- Only do the second CBE if we did the sinking pass. Otherwise, - -- it's unlikely we'll have any new opportunities to find redundant - -- blocks. - if not (gopt Opt_CmmSink dflags) - then pure (g, call_pps, proc_points) - else do - (g, cbe_subst) <- {-# SCC "elimCommonBlocks2" #-} - condPass2 - Opt_CmmElimCommonBlocks elimCommonBlocks g mapEmpty - Opt_D_dump_cmm_cbe "Post common block elimination 2" - - -- CBE might invalidate the results of proc-point analysis (by - -- removing labels). So we need to fix it. Instead of re-doing - -- the whole analysis, we use the final substitution env from - -- CBE to update existing results. - let cbe_fix set bid = - setInsert (fromMaybe bid (mapLookup bid cbe_subst)) set - let !new_call_pps = setFoldl cbe_fix setEmpty call_pps - let !new_proc_points - | splitting_proc_points = - setFoldl cbe_fix setEmpty proc_points - | otherwise = new_call_pps - - return (g, new_call_pps, new_proc_points) - ------------- CAF analysis ---------------------------------------------- let cafEnv = {-# SCC "cafAnal" #-} cafAnal g dumpWith dflags Opt_D_dump_cmm_caf "CAFEnv" (ppr cafEnv) @@ -184,13 +155,6 @@ cpsTop hsc_env proc = return g else return g - condPass2 flag pass g a dumpflag dumpname = - if gopt flag dflags - then do - (g, a) <- return $ pass g - dump dumpflag dumpname g - return (g, a) - else return (g, a) -- we don't need to split proc points for the NCG, unless -- tablesNextToCode is off. The latter is because we have no From git at git.haskell.org Fri Apr 13 16:07:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:07:11 +0000 (UTC) Subject: [commit: ghc] master: Fix processHeapClosureForDead CONSTR_NOCAF case: (a303584) Message-ID: <20180413160711.B12853A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a303584e58b3f4791bc5881cb722e7f498e14554/ghc >--------------------------------------------------------------- commit a303584e58b3f4791bc5881cb722e7f498e14554 Author: Ömer Sinan Ağacan Date: Fri Apr 13 11:31:56 2018 -0400 Fix processHeapClosureForDead CONSTR_NOCAF case: CONSTR_NOCAF was introduced with 55d535da10d as a replacement for CONSTR_STATIC and CONSTR_NOCAF_STATIC, however, as explained in Note [static constructors], we copy CONSTR_NOCAFs (which can also be seen in evacuate) during GC, and they can become dead, like other CONSTR_X_Ys. processHeapClosureForDead is updated to reflect this. Reviewers: bgamari, simonmar, erikd Subscribers: thomie, carter GHC Trac Issues: #7836 Differential Revision: https://phabricator.haskell.org/D4567 >--------------------------------------------------------------- a303584e58b3f4791bc5881cb722e7f498e14554 rts/LdvProfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 7899416..7cf9ceb 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -101,6 +101,7 @@ processHeapClosureForDead( const StgClosure *c ) case CONSTR_2_0: case CONSTR_1_1: case CONSTR_0_2: + case CONSTR_NOCAF: case FUN: case FUN_1_0: case FUN_0_1: @@ -130,7 +131,6 @@ processHeapClosureForDead( const StgClosure *c ) case IND_STATIC: case FUN_STATIC: case THUNK_STATIC: - case CONSTR_NOCAF: // stack objects case UPDATE_FRAME: case CATCH_FRAME: @@ -139,6 +139,9 @@ processHeapClosureForDead( const StgClosure *c ) case RET_BCO: case RET_SMALL: case RET_BIG: + case CATCH_STM_FRAME: + case CATCH_RETRY_FRAME: + case ATOMICALLY_FRAME: // others case INVALID_OBJECT: case COMPACT_NFDATA: From git at git.haskell.org Fri Apr 13 16:07:41 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:07:41 +0000 (UTC) Subject: [commit: ghc] master: Fix rts.cabal.in (f78df87) Message-ID: <20180413160741.79D293A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f78df87c3857c128c9126f1979fbacf84ac5cd1a/ghc >--------------------------------------------------------------- commit f78df87c3857c128c9126f1979fbacf84ac5cd1a Author: Andrey Mokhov Date: Fri Apr 13 11:33:30 2018 -0400 Fix rts.cabal.in On Windows the FFI library is called `libCffi-6` instead of `libCffi`. This needs to be reflected in `rts.cabal.in` as otherwise we cannot properly `copy` and `register` the RTS package on Windows. See https://github.com/snowleopard/hadrian/issues/567 Test Plan: Build GHC using Hadrian. Make build system does not use `rts.cabal.in`. Reviewers: bgamari, erikd, simonmar, Phyx Reviewed By: Phyx Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4590 >--------------------------------------------------------------- f78df87c3857c128c9126f1979fbacf84ac5cd1a rts/rts.cabal.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index b3cd2b2..c1efd4e 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -34,7 +34,10 @@ library -- expects the unit-id to be -- set without version ghc-options: -this-unit-id rts - extra-bundled-libraries: Cffi + if os(windows) + extra-bundled-libraries: Cffi-6 + else + extra-bundled-libraries: Cffi -- the rts comes in a variety of flavours that ar built outside -- of cabal. The combination of extra-bundled-libraries and -- extra-library-flavours results in the following libraries to From git at git.haskell.org Fri Apr 13 16:07:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:07:27 +0000 (UTC) Subject: [commit: ghc] master: Update JMP_TBL targets during shortcutting in X86 NCG. (120a261) Message-ID: <20180413160727.4206F3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/120a261773d3da7ef81d1ba9e41733afbadefe1d/ghc >--------------------------------------------------------------- commit 120a261773d3da7ef81d1ba9e41733afbadefe1d Author: Andreas Klebinger Date: Fri Apr 13 11:32:23 2018 -0400 Update JMP_TBL targets during shortcutting in X86 NCG. Without updating the JMP_TBL information the block list in JMP_TBL contained blocks which were eliminated in some circumstances. The actual assembly generation doesn't look at these fields so this didn't cause any bugs yet. However as long as we carry this information around we should make an effort to keep it correct. Especially since it's useful for debugging purposes and can be used for passes near the end of the codegen pipeline. In particular it's used by jumpDestsOfInstr which without these changes returns the wrong destinations. Test Plan: ci Reviewers: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4566 >--------------------------------------------------------------- 120a261773d3da7ef81d1ba9e41733afbadefe1d compiler/nativeGen/X86/Instr.hs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs index f4f625b..49beafa 100644 --- a/compiler/nativeGen/X86/Instr.hs +++ b/compiler/nativeGen/X86/Instr.hs @@ -1026,14 +1026,26 @@ canShortcut _ = Nothing -- The blockset helps avoid following cycles. shortcutJump :: (BlockId -> Maybe JumpDest) -> Instr -> Instr shortcutJump fn insn = shortcutJump' fn (setEmpty :: LabelSet) insn - where shortcutJump' fn seen insn@(JXX cc id) = - if setMember id seen then insn - else case fn id of - Nothing -> insn - Just (DestBlockId id') -> shortcutJump' fn seen' (JXX cc id') - Just (DestImm imm) -> shortcutJump' fn seen' (JXX_GBL cc imm) - where seen' = setInsert id seen - shortcutJump' _ _ other = other + where + shortcutJump' :: (BlockId -> Maybe JumpDest) -> LabelSet -> Instr -> Instr + shortcutJump' fn seen insn@(JXX cc id) = + if setMember id seen then insn + else case fn id of + Nothing -> insn + Just (DestBlockId id') -> shortcutJump' fn seen' (JXX cc id') + Just (DestImm imm) -> shortcutJump' fn seen' (JXX_GBL cc imm) + where seen' = setInsert id seen + shortcutJump' fn _ (JMP_TBL addr blocks section tblId) = + let updateBlock Nothing = Nothing + updateBlock (Just bid) = + case fn bid of + Nothing -> Just bid + Just (DestBlockId bid') -> Just bid' + Just (DestImm _) -> + panic "Can't shortcut jump table to immediate" + blocks' = map updateBlock blocks + in JMP_TBL addr blocks' section tblId + shortcutJump' _ _ other = other -- Here because it knows about JumpDest shortcutStatics :: (BlockId -> Maybe JumpDest) -> (Alignment, CmmStatics) -> (Alignment, CmmStatics) From git at git.haskell.org Fri Apr 13 16:07:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:07:56 +0000 (UTC) Subject: [commit: ghc] master: Remove unused function: mkFunCos (6f62303) Message-ID: <20180413160756.868D03A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6f6230308fda376c55cb7cbcd4b6b51b680d4cef/ghc >--------------------------------------------------------------- commit 6f6230308fda376c55cb7cbcd4b6b51b680d4cef Author: Matthew Pickering Date: Fri Apr 13 11:33:40 2018 -0400 Remove unused function: mkFunCos Reviewers: goldfire, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4587 >--------------------------------------------------------------- 6f6230308fda376c55cb7cbcd4b6b51b680d4cef compiler/types/Coercion.hs | 6 +----- compiler/types/Coercion.hs-boot | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 3e69b71..a169966 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -31,7 +31,7 @@ module Coercion ( mkPiCo, mkPiCos, mkCoCast, mkSymCo, mkTransCo, mkNthCo, mkLRCo, - mkInstCo, mkAppCo, mkAppCos, mkTyConAppCo, mkFunCo, mkFunCos, + mkInstCo, mkAppCo, mkAppCos, mkTyConAppCo, mkFunCo, mkForAllCo, mkForAllCos, mkHomoForAllCos, mkHomoForAllCos_NoRefl, mkPhantomCo, mkUnsafeCo, mkHoleCo, mkUnivCo, mkSubCo, @@ -553,10 +553,6 @@ mkFunCo r co1 co2 = Refl r (mkFunTy ty1 ty2) | otherwise = FunCo r co1 co2 --- | Make nested function 'Coercion's -mkFunCos :: Role -> [Coercion] -> Coercion -> Coercion -mkFunCos r cos res_co = foldr (mkFunCo r) res_co cos - -- | Apply a 'Coercion' to another 'Coercion'. -- The second coercion must be Nominal, unless the first is Phantom. -- If the first is Phantom, then the second can be either Phantom or Nominal. diff --git a/compiler/types/Coercion.hs-boot b/compiler/types/Coercion.hs-boot index 1508e6f..1e85476 100644 --- a/compiler/types/Coercion.hs-boot +++ b/compiler/types/Coercion.hs-boot @@ -33,8 +33,6 @@ mkKindCo :: Coercion -> Coercion mkSubCo :: Coercion -> Coercion mkProofIrrelCo :: Role -> Coercion -> Coercion -> Coercion -> Coercion -mkFunCos :: Role -> [Coercion] -> Coercion -> Coercion - isReflCo :: Coercion -> Bool isReflexiveCo :: Coercion -> Bool decomposePiCos :: Kind -> [Type] -> Coercion -> ([Coercion], Coercion) From git at git.haskell.org Fri Apr 13 16:08:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:08:13 +0000 (UTC) Subject: [commit: ghc] master: Fix #9438 by converting a panic to an error message (7613a81) Message-ID: <20180413160813.16CF53A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7613a812888424b49cb334a4e63bd7280adf2774/ghc >--------------------------------------------------------------- commit 7613a812888424b49cb334a4e63bd7280adf2774 Author: Ryan Scott Date: Fri Apr 13 11:33:54 2018 -0400 Fix #9438 by converting a panic to an error message Previously, GHC was quite eager to panic whenever it was fed an archive file when `DYNAMIC_GHC_PROGRAMS=YES`. This ought to be an explicit error message instead, so this patch accomplishes just that. Test Plan: make test TEST=T14708 Reviewers: Phyx, hvr, bgamari Reviewed By: Phyx Subscribers: thomie, carter GHC Trac Issues: #9438, #14708, #15032 Differential Revision: https://phabricator.haskell.org/D4589 >--------------------------------------------------------------- 7613a812888424b49cb334a4e63bd7280adf2774 compiler/ghci/Linker.hs | 15 +++++++++++++-- testsuite/.gitignore | 1 + testsuite/tests/ghci/linking/Makefile | 8 ++++++++ .../{driver/withRtsOpts.hs => ghci/linking/T14708.hs} | 1 - testsuite/tests/ghci/linking/T14708.stderr | 4 ++++ testsuite/tests/ghci/linking/add.c | 1 + testsuite/tests/ghci/linking/all.T | 8 ++++++++ 7 files changed, 35 insertions(+), 3 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index a91df32..8d0338a 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -71,7 +71,10 @@ import System.Win32.Info (getSystemDirectory) import Exception -import Foreign (Ptr) -- needed for 2nd stage +-- needed for 2nd stage +#if STAGE >= 2 +import Foreign (Ptr) +#endif {- ********************************************************************** @@ -504,9 +507,17 @@ preloadLib hsc_env lib_paths framework_paths pls lib_spec = do = do b <- doesFileExist name if not b then return False else do if dynamicGhc - then panic "Loading archives not supported" + then throwGhcExceptionIO $ + CmdLineError dynamic_msg else loadArchive hsc_env name return True + where + dynamic_msg = unlines + [ "User-specified static library could not be loaded (" + ++ name ++ ")" + , "Loading static libraries is not supported in this configuration." + , "Try using a dynamic library instead." + ] {- ********************************************************************** diff --git a/testsuite/.gitignore b/testsuite/.gitignore index e6934f9..7c4453e 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -776,6 +776,7 @@ mk/ghcconfig*_test___spaces_ghc*.exe.mk /tests/ghci/linking/dir004/ /tests/ghci/linking/dir005/ /tests/ghci/linking/dir006/ +/tests/ghci/linking/T14708scratch/ /tests/ghci/prog001/C.hs /tests/ghci/prog001/D.hs /tests/ghci/prog002/A.hs diff --git a/testsuite/tests/ghci/linking/Makefile b/testsuite/tests/ghci/linking/Makefile index 793152d..793998e 100644 --- a/testsuite/tests/ghci/linking/Makefile +++ b/testsuite/tests/ghci/linking/Makefile @@ -126,3 +126,11 @@ endif T3333: "$(TEST_HC)" -c T3333.c -o T3333.o echo "weak_test 10" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) T3333.hs T3333.o + +.PHONY: T14708 +T14708: + $(RM) -rf T14708scratch + mkdir T14708scratch + "$(TEST_HC)" -c add.c -o T14708scratch/add.o + "$(AR)" cqs T14708scratch/libadd.a T14708scratch/add.o + -"$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -LT14708scratch -ladd T14708.hs diff --git a/testsuite/tests/driver/withRtsOpts.hs b/testsuite/tests/ghci/linking/T14708.hs similarity index 96% copy from testsuite/tests/driver/withRtsOpts.hs copy to testsuite/tests/ghci/linking/T14708.hs index 0634af0..377b6b5 100644 --- a/testsuite/tests/driver/withRtsOpts.hs +++ b/testsuite/tests/ghci/linking/T14708.hs @@ -1,3 +1,2 @@ - main :: IO () main = return () diff --git a/testsuite/tests/ghci/linking/T14708.stderr b/testsuite/tests/ghci/linking/T14708.stderr new file mode 100644 index 0000000..fabbdb4 --- /dev/null +++ b/testsuite/tests/ghci/linking/T14708.stderr @@ -0,0 +1,4 @@ +: User-specified static library could not be loaded (T14708scratch/libadd.a) +Loading static libraries is not supported in this configuration. +Try using a dynamic library instead. + diff --git a/testsuite/tests/ghci/linking/add.c b/testsuite/tests/ghci/linking/add.c new file mode 100644 index 0000000..538880c --- /dev/null +++ b/testsuite/tests/ghci/linking/add.c @@ -0,0 +1 @@ +int add2(int x, int y) { return x + y; } diff --git a/testsuite/tests/ghci/linking/all.T b/testsuite/tests/ghci/linking/all.T index 124b3a4..f9617c5 100644 --- a/testsuite/tests/ghci/linking/all.T +++ b/testsuite/tests/ghci/linking/all.T @@ -31,3 +31,11 @@ test('T3333', unless(opsys('linux') or opsys('darwin') or ghc_dynamic(), expect_broken(3333))], run_command, ['$MAKE -s --no-print-directory T3333']) + +test('T14708', + [extra_files(['T14708.hs', 'add.c']), + unless(doing_ghci, skip), + unless(ghc_dynamic(), skip), + extra_clean(['T14708scratch/*', 'T14708'])], + run_command, + ['$MAKE -s --no-print-directory T14708']) From git at git.haskell.org Fri Apr 13 16:08:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:08:27 +0000 (UTC) Subject: [commit: ghc] master: Use newtype deriving for Hoopl code (6a78a40) Message-ID: <20180413160827.612EC3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6a78a40b616369b280630fe6259be35be9806caa/ghc >--------------------------------------------------------------- commit 6a78a40b616369b280630fe6259be35be9806caa Author: U-Maokai\andi Date: Fri Apr 13 11:34:03 2018 -0400 Use newtype deriving for Hoopl code Hoopl.Collections/.Label has newtype containers which derive Functor/Traversable. Enabling GeneralizedNewtypeDeriving improves allocation count and compile time when building these files for GHC. ``` Vanilla, O1 <> GeneralizedNewtypeDeriving , O1 <> ``` Test Plan: ci Reviewers: bgamari, simonmar, RyanGlScott Reviewed By: RyanGlScott Subscribers: mpickering, RyanGlScott, thomie, carter Differential Revision: https://phabricator.haskell.org/D4583 >--------------------------------------------------------------- 6a78a40b616369b280630fe6259be35be9806caa compiler/cmm/Hoopl/Collections.hs | 2 ++ compiler/cmm/Hoopl/Label.hs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/compiler/cmm/Hoopl/Collections.hs b/compiler/cmm/Hoopl/Collections.hs index ef7de4a..f8bdfda 100644 --- a/compiler/cmm/Hoopl/Collections.hs +++ b/compiler/cmm/Hoopl/Collections.hs @@ -2,6 +2,8 @@ {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} + module Hoopl.Collections ( IsSet(..) , setInsertList, setDeleteList, setUnions diff --git a/compiler/cmm/Hoopl/Label.hs b/compiler/cmm/Hoopl/Label.hs index 6eae115..caed683 100644 --- a/compiler/cmm/Hoopl/Label.hs +++ b/compiler/cmm/Hoopl/Label.hs @@ -2,6 +2,8 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} + module Hoopl.Label ( Label , LabelMap From git at git.haskell.org Fri Apr 13 16:11:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 16:11:01 +0000 (UTC) Subject: [commit: ghc] master: Revert "Fix processHeapClosureForDead CONSTR_NOCAF case:" (9430901) Message-ID: <20180413161101.BC3453A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9430901df1428e9ea512d136648e1eba3c9b9a1c/ghc >--------------------------------------------------------------- commit 9430901df1428e9ea512d136648e1eba3c9b9a1c Author: Ben Gamari Date: Fri Apr 13 12:10:45 2018 -0400 Revert "Fix processHeapClosureForDead CONSTR_NOCAF case:" This reverts commit a303584e58b3f4791bc5881cb722e7f498e14554. >--------------------------------------------------------------- 9430901df1428e9ea512d136648e1eba3c9b9a1c rts/LdvProfile.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 7cf9ceb..7899416 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -101,7 +101,6 @@ processHeapClosureForDead( const StgClosure *c ) case CONSTR_2_0: case CONSTR_1_1: case CONSTR_0_2: - case CONSTR_NOCAF: case FUN: case FUN_1_0: case FUN_0_1: @@ -131,6 +130,7 @@ processHeapClosureForDead( const StgClosure *c ) case IND_STATIC: case FUN_STATIC: case THUNK_STATIC: + case CONSTR_NOCAF: // stack objects case UPDATE_FRAME: case CATCH_FRAME: @@ -139,9 +139,6 @@ processHeapClosureForDead( const StgClosure *c ) case RET_BCO: case RET_SMALL: case RET_BIG: - case CATCH_STM_FRAME: - case CATCH_RETRY_FRAME: - case ATOMICALLY_FRAME: // others case INVALID_OBJECT: case COMPACT_NFDATA: From git at git.haskell.org Fri Apr 13 17:11:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 17:11:28 +0000 (UTC) Subject: [commit: ghc] master: Correct FixIOException's @since annotation retroactively (ce27c7d) Message-ID: <20180413171128.B41E83A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ce27c7d5fe3c335dcc354b70fdfc17831a6848f6/ghc >--------------------------------------------------------------- commit ce27c7d5fe3c335dcc354b70fdfc17831a6848f6 Author: Ryan Scott Date: Fri Apr 13 12:54:31 2018 -0400 Correct FixIOException's @since annotation retroactively Summary: In D4113, a `FixIOException` data type was added with a `@since TODO` annotation, but it seems that `TODO` made it out into `base-4.11` itself. I've (retroactively) fixed this and added an entry to the `base-4.11` entry in the `changelog`. Test Plan: Read it Reviewers: dfeuer, hvr, bgamari Reviewed By: dfeuer Subscribers: thomie, carter GHC Trac Issues: #14356, #15025 Differential Revision: https://phabricator.haskell.org/D4578 >--------------------------------------------------------------- ce27c7d5fe3c335dcc354b70fdfc17831a6848f6 libraries/base/GHC/IO/Exception.hs | 7 +++++-- libraries/base/changelog.md | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs index f6b60a4..7479a42 100644 --- a/libraries/base/GHC/IO/Exception.hs +++ b/libraries/base/GHC/IO/Exception.hs @@ -273,12 +273,15 @@ instance Show ArrayException where . (if not (null s) then showString ": " . showString s else id) --- | @since TODO +-- | The exception thrown when an infinite cycle is detected in 'fixIO'. +-- +-- @since 4.11.0.0 data FixIOException = FixIOException --- | @since TODO +-- | @since 4.11.0.0 instance Exception FixIOException +-- | @since 4.11.0.0 instance Show FixIOException where showsPrec _ FixIOException = showString "cyclic evaluation in fixIO" diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 56d8ffc..157c7df 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -95,6 +95,10 @@ * Deprecated STM invariant checking primitives (`checkInv`, `always`, and `alwaysSucceeds`) in `GHC.Conc.Sync` (#14324). + * Add a `FixIOException` data type to `Control.Exception.Base`, and change + `fixIO` to throw that instead of a `BlockedIndefinitelyOnMVar` exception + (#14356). + ## 4.10.1.0 *November 2017* * Bundled with GHC 8.2.2 From git at git.haskell.org Fri Apr 13 18:17:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 18:17:29 +0000 (UTC) Subject: [commit: ghc] master: Declare `catchRetry#` lazy in its first argument (00b8ecb) Message-ID: <20180413181729.542A33A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/00b8ecb78624511a045120673b01fafe5794ecdc/ghc >--------------------------------------------------------------- commit 00b8ecb78624511a045120673b01fafe5794ecdc Author: Ben Gamari Date: Fri Apr 13 13:22:55 2018 -0400 Declare `catchRetry#` lazy in its first argument As per the results on item 1 in T14998, declaring `catchRetry#` lazy in its first argument opens the possibility to remove `ExnStr` complexity from strictness demands at virtually no regressions in NoFib. This brings `catchRetry#` in line with other primops from the `catch*` family. Reviewers: bgamari, simonpj, nomeata Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14998, #11222 Differential Revision: https://phabricator.haskell.org/D4573 >--------------------------------------------------------------- 00b8ecb78624511a045120673b01fafe5794ecdc compiler/prelude/primops.txt.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 1362704..4098e80 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2377,7 +2377,7 @@ primop CatchRetryOp "catchRetry#" GenPrimOp -> (State# RealWorld -> (# State# RealWorld, a #) ) -> (State# RealWorld -> (# State# RealWorld, a #) ) with - strictness = { \ _arity -> mkClosedStrictSig [ catchArgDmd + strictness = { \ _arity -> mkClosedStrictSig [ lazyApply1Dmd , lazyApply1Dmd , topDmd ] topRes } -- See Note [Strictness for mask/unmask/catch] From git at git.haskell.org Fri Apr 13 18:17:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 18:17:43 +0000 (UTC) Subject: [commit: ghc] master: Make shortcutting at the asm stage toggleable and default for O2. (3c7f9e7) Message-ID: <20180413181743.B909D3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3c7f9e74ca858de17bc63b862c77cbb3f8b0ee51/ghc >--------------------------------------------------------------- commit 3c7f9e74ca858de17bc63b862c77cbb3f8b0ee51 Author: Andreas Klebinger Date: Fri Apr 13 13:23:13 2018 -0400 Make shortcutting at the asm stage toggleable and default for O2. Shortcutting during the asm stage of codegen is often redundant as most cases get caught during the Cmm passes. For example during compilation of all of nofib only 508 jumps are eleminated. For this reason I moved the pass from -O1 to -O2. I also made it toggleable with -fasm-shortcutting. Test Plan: ci Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4555 >--------------------------------------------------------------- 3c7f9e74ca858de17bc63b862c77cbb3f8b0ee51 compiler/main/DynFlags.hs | 4 ++++ compiler/nativeGen/AsmCodeGen.hs | 6 ++++-- docs/users_guide/using-optimisation.rst | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 7c27e52..6bfa8f2 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -480,6 +480,7 @@ data GeneralFlag | Opt_IrrefutableTuples | Opt_CmmSink | Opt_CmmElimCommonBlocks + | Opt_AsmShortcutting | Opt_OmitYields | Opt_FunToThunk -- allow WwLib.mkWorkerArgs to remove all value lambdas | Opt_DictsStrict -- be strict in argument dictionaries @@ -664,6 +665,7 @@ optimisationFlags = EnumSet.fromList , Opt_IrrefutableTuples , Opt_CmmSink , Opt_CmmElimCommonBlocks + , Opt_AsmShortcutting , Opt_OmitYields , Opt_FunToThunk , Opt_DictsStrict @@ -3893,6 +3895,7 @@ fFlagsDeps = [ -- See Note [Updating flag description in the User's Guide] -- See Note [Supporting CLI completion] -- Please keep the list of flags below sorted alphabetically + flagSpec "asm-shortcutting" Opt_AsmShortcutting, flagGhciSpec "break-on-error" Opt_BreakOnError, flagGhciSpec "break-on-exception" Opt_BreakOnException, flagSpec "building-cabal-package" Opt_BuildingCabalPackage, @@ -4370,6 +4373,7 @@ optLevelFlags -- see Note [Documenting optimisation flags] , ([1,2], Opt_CaseMerge) , ([1,2], Opt_CaseFolding) , ([1,2], Opt_CmmElimCommonBlocks) + , ([2], Opt_AsmShortcutting) , ([1,2], Opt_CmmSink) , ([1,2], Opt_CSE) , ([1,2], Opt_StgCSE) diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index 6b20a12..5d29085 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -934,8 +934,10 @@ shortcutBranches -> [NatCmmDecl statics instr] shortcutBranches dflags ncgImpl tops - | optLevel dflags < 1 = tops -- only with -O or higher - | otherwise = map (apply_mapping ncgImpl mapping) tops' + | gopt Opt_AsmShortcutting dflags + = map (apply_mapping ncgImpl mapping) tops' + | otherwise + = tops where (tops', mappings) = mapAndUnzip (build_mapping ncgImpl) tops mapping = plusUFMList mappings diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 8466406..59edcdc 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -217,6 +217,23 @@ by saying ``-fno-wombat``. to their usage sites. It also inlines simple expressions like literals or registers. +.. ghc-flag:: -fasm-shortcutting + :shortdesc: Enable shortcutting on assembly. Implied by :ghc-flag:`-O2`. + :type: dynamic + :reverse: -fno-asm-shortcutting + :category: + + :default: off + + This enables shortcutting at the assembly stage of the code generator. + In simpler terms shortcutting means if a block of instructions A only consists + of a unconditionally jump, we replace all jumps to A by jumps to the successor + of A. + + This is mostly done during Cmm passes. However this can miss corner cases. So at -O2 + we run the pass again at the asm stage to catch these. + + .. ghc-flag:: -fcpr-anal :shortdesc: Turn on CPR analysis in the demand analyser. Implied by :ghc-flag:`-O`. :type: dynamic From git at git.haskell.org Fri Apr 13 18:17:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 18:17:58 +0000 (UTC) Subject: [commit: ghc] master: Omit ways depending on rts flags for #12870 related tests. (9e89092) Message-ID: <20180413181758.15D053A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9e89092d4ee1effd558757361fb62b83697f8f42/ghc >--------------------------------------------------------------- commit 9e89092d4ee1effd558757361fb62b83697f8f42 Author: Andreas Klebinger Date: Fri Apr 13 13:27:36 2018 -0400 Omit ways depending on rts flags for #12870 related tests. Some of these tests instruct the RTS to ignore all RTS flags being passed. While this is intended it causes test failures for some ways like profiling which depend on passing RTS flags. So we skip these ways. Test Plan: testsuite/tests/rts/flags$ make slow Reviewers: bgamari, simonmar, alpmestan Reviewed By: alpmestan Subscribers: alpmestan, thomie, carter GHC Trac Issues: #12870 Differential Revision: https://phabricator.haskell.org/D4585 >--------------------------------------------------------------- 9e89092d4ee1effd558757361fb62b83697f8f42 testsuite/tests/rts/flags/all.T | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/testsuite/tests/rts/flags/all.T b/testsuite/tests/rts/flags/all.T index 548fcd8..6bfa14f 100644 --- a/testsuite/tests/rts/flags/all.T +++ b/testsuite/tests/rts/flags/all.T @@ -1,51 +1,53 @@ +#We ignore ways which depend on passing RTS arguments for simplicity. + #Standard handling of RTS arguments test('T12870a', [extra_run_opts('+RTS -G2 -RTS arg1 --RTS +RTS arg2'), extra_files(['T12870.hs']), - omit_ways(['ghci'])], + omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870', '-rtsopts']) test('T12870b', [extra_run_opts('+RTS -G2 -RTS arg1 --RTS +RTS arg2'), extra_files(['T12870.hs']), - exit_code(1), ignore_stderr, omit_ways(['ghci'])], + exit_code(1), ignore_stderr, omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870', '-rtsopts=none']) test('T12870c', [extra_run_opts('+RTS -G2 -RTS arg1 --RTS +RTS arg2'), extra_files(['T12870.hs']), - exit_code(1), omit_ways(['ghci'])], + exit_code(1), omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870', '-rtsopts=some']) test('T12870d', [extra_run_opts('+RTS -G2 -RTS arg1 --RTS +RTS arg2'), extra_files(['T12870.hs']), - omit_ways(['ghci'])], + omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870', '']) #RTS options should be passed along to the program test('T12870e', [extra_run_opts('+RTS -G2 -RTS arg1 --RTS +RTS arg2'), extra_files(['T12870.hs']), - omit_ways(['ghci', 'threaded2'])], + omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870', '-rtsopts=ignore']) test('T12870f', [extra_run_opts('+RTS -G2 -RTS arg1 --RTS +RTS arg2'), extra_files(['T12870.hs']), - omit_ways(['ghci', 'threaded2'])], + omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870', '-rtsopts=ignoreAll']) #Check handling of env variables test('T12870g', [extra_files(['T12870g.hs']), cmd_prefix('GHCRTS=-G7 '), extra_files(['T12870g.hs']), - omit_ways(['ghci'])], + omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870g', '-rtsopts -with-rtsopts="-G3"']) test('T12870h', [extra_files(['T12870g.hs']), cmd_prefix('GHCRTS=-G7 '), extra_files(['T12870g.hs']), - omit_ways(['ghci'])], + omit_ways(['ghci','threaded2','profasm','profthreaded'])], multimod_compile_and_run, ['T12870g', '-rtsopts=ignoreAll -with-rtsopts="-G3"']) From git at git.haskell.org Fri Apr 13 18:48:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 18:48:42 +0000 (UTC) Subject: [commit: ghc] master: Configure option to disable dtrace (4b831c2) Message-ID: <20180413184842.4734C3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4b831c27926d643b0b6fad82c1e946d05cde8645/ghc >--------------------------------------------------------------- commit 4b831c27926d643b0b6fad82c1e946d05cde8645 Author: Ben Gamari Date: Fri Apr 13 14:18:03 2018 -0400 Configure option to disable dtrace Reviewers: hvr, bgamari Subscribers: lelf, thomie, carter Differential Revision: https://phabricator.haskell.org/D4575 >--------------------------------------------------------------- 4b831c27926d643b0b6fad82c1e946d05cde8645 configure.ac | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 062004d..a8b8681 100644 --- a/configure.ac +++ b/configure.ac @@ -806,13 +806,23 @@ dnl if GNU patch is named gpatch, look for it first AC_PATH_PROGS(PatchCmd,gpatch patch, patch) dnl ** check for dtrace (currently only implemented for Mac OS X) +AC_ARG_ENABLE(dtrace, + [AC_HELP_STRING([--enable-dtrace], + [Enable DTrace])], + EnableDtrace=$enableval, + EnableDtrace=yes +) + HaveDtrace=NO + AC_PATH_PROG(DtraceCmd,dtrace) -if test -n "$DtraceCmd"; then - if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" \ - -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xfreebsd-portbld" \ - -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then - HaveDtrace=YES +if test "x$EnableDtrace" = "xyes"; then + if test -n "$DtraceCmd"; then + if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" \ + -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xfreebsd-portbld" \ + -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then + HaveDtrace=YES + fi fi fi AC_SUBST(HaveDtrace) From git at git.haskell.org Fri Apr 13 22:07:36 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 Apr 2018 22:07:36 +0000 (UTC) Subject: [commit: ghc] master: Enhanced constant folding (fea04de) Message-ID: <20180413220736.99E243A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fea04defa64871caab6339ff3fc5511a272f37c7/ghc >--------------------------------------------------------------- commit fea04defa64871caab6339ff3fc5511a272f37c7 Author: Sylvain Henry Date: Fri Apr 13 13:29:07 2018 -0400 Enhanced constant folding Until now GHC only supported basic constant folding (lit op lit, expr op 0, etc.). This patch uses laws of +/-/* (associativity, commutativity, distributivity) to support some constant folding into nested expressions. Examples of new transformations: - simple nesting: (10 + x) + 10 becomes 20 + x - deep nesting: 5 + x + (y + (z + (t + 5))) becomes 10 + (x + (y + (z + t))) - distribution: (5 + x) * 6 becomes 30 + 6*x - simple factorization: 5 + x + (x + (x + (x + 5))) becomes 10 + (4 *x) - siblings: (5 + 4*x) - (3*x + 2) becomes 3 + x Test Plan: validate Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie GHC Trac Issues: #9136 Differential Revision: https://phabricator.haskell.org/D2858 >--------------------------------------------------------------- fea04defa64871caab6339ff3fc5511a272f37c7 compiler/main/DynFlags.hs | 3 + compiler/prelude/PrelRules.hs | 305 ++++++++++++++++++++- .../simplCore/should_compile/spec-inline.stderr | 38 +-- 3 files changed, 309 insertions(+), 37 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 fea04defa64871caab6339ff3fc5511a272f37c7 From git at git.haskell.org Sat Apr 14 18:49:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 18:49:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: rts/RetainerProfile: Handle BLOCKING_QUEUES (0ec1bd6) Message-ID: <20180414184920.7C4C43A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/0ec1bd64b3317febe8c018041f538f1c83135e6c/ghc >--------------------------------------------------------------- commit 0ec1bd64b3317febe8c018041f538f1c83135e6c Author: Ben Gamari Date: Sat Apr 7 13:32:04 2018 -0400 rts/RetainerProfile: Handle BLOCKING_QUEUES push() considers BLOCKING_QUEUES to be an invalid closure type which should never be present on the stack. However, retainClosure made no accomodation for this and ended up pushing such a closure. This lead to #14947. Test Plan: Validate Reviewers: simonmar, erikd Reviewed By: simonmar Subscribers: thomie, carter, RyanGlScott GHC Trac Issues: #14947 Differential Revision: https://phabricator.haskell.org/D4538 (cherry picked from commit d5f6d7a03d66a93ec05a90948126feffc9279dc6) >--------------------------------------------------------------- 0ec1bd64b3317febe8c018041f538f1c83135e6c rts/RetainerProfile.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 7a9b9cc..67cba83 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -426,7 +426,7 @@ find_srt( stackPos *info ) * push() pushes a stackElement representing the next child of *c * onto the traverse stack. If *c has no child, *first_child is set * to NULL and nothing is pushed onto the stack. If *c has only one - * child, *c_chlid is set to that child and nothing is pushed onto + * child, *c_child is set to that child and nothing is pushed onto * the stack. If *c has more than two children, *first_child is set * to the first child and a stackElement representing the second * child is pushed onto the stack. @@ -1706,6 +1706,15 @@ inner_loop: goto loop; } + case BLOCKING_QUEUE: + { + StgBlockingQueue *bq = (StgBlockingQueue *)c; + retainClosure((StgClosure*) bq->link, c, c_child_r); + retainClosure((StgClosure*) bq->bh, c, c_child_r); + retainClosure((StgClosure*) bq->owner, c, c_child_r); + goto loop; + } + case PAP: { StgPAP *pap = (StgPAP *)c; From git at git.haskell.org Sat Apr 14 18:49:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 18:49:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Fix #9438 by converting a panic to an error message (20f6dae) Message-ID: <20180414184931.6F0823A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/20f6dae073082789208f4d84a700316567e128aa/ghc >--------------------------------------------------------------- commit 20f6dae073082789208f4d84a700316567e128aa Author: Ryan Scott Date: Fri Apr 13 11:33:54 2018 -0400 Fix #9438 by converting a panic to an error message Previously, GHC was quite eager to panic whenever it was fed an archive file when `DYNAMIC_GHC_PROGRAMS=YES`. This ought to be an explicit error message instead, so this patch accomplishes just that. Test Plan: make test TEST=T14708 Reviewers: Phyx, hvr, bgamari Reviewed By: Phyx Subscribers: thomie, carter GHC Trac Issues: #9438, #14708, #15032 Differential Revision: https://phabricator.haskell.org/D4589 (cherry picked from commit 7613a812888424b49cb334a4e63bd7280adf2774) >--------------------------------------------------------------- 20f6dae073082789208f4d84a700316567e128aa compiler/ghci/Linker.hs | 15 +++++++++++++-- testsuite/.gitignore | 1 + testsuite/tests/ghci/linking/Makefile | 8 ++++++++ .../{driver/withRtsOpts.hs => ghci/linking/T14708.hs} | 1 - testsuite/tests/ghci/linking/T14708.stderr | 4 ++++ testsuite/tests/ghci/linking/add.c | 1 + testsuite/tests/ghci/linking/all.T | 8 ++++++++ 7 files changed, 35 insertions(+), 3 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index ecd9cbd..150f2af 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -70,7 +70,10 @@ import System.Win32.Info (getSystemDirectory) import Exception -import Foreign (Ptr) -- needed for 2nd stage +-- needed for 2nd stage +#if STAGE >= 2 +import Foreign (Ptr) +#endif {- ********************************************************************** @@ -495,9 +498,17 @@ preloadLib hsc_env lib_paths framework_paths pls lib_spec = do = do b <- doesFileExist name if not b then return False else do if dynamicGhc - then panic "Loading archives not supported" + then throwGhcExceptionIO $ + CmdLineError dynamic_msg else loadArchive hsc_env name return True + where + dynamic_msg = unlines + [ "User-specified static library could not be loaded (" + ++ name ++ ")" + , "Loading static libraries is not supported in this configuration." + , "Try using a dynamic library instead." + ] {- ********************************************************************** diff --git a/testsuite/.gitignore b/testsuite/.gitignore index e6934f9..7c4453e 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -776,6 +776,7 @@ mk/ghcconfig*_test___spaces_ghc*.exe.mk /tests/ghci/linking/dir004/ /tests/ghci/linking/dir005/ /tests/ghci/linking/dir006/ +/tests/ghci/linking/T14708scratch/ /tests/ghci/prog001/C.hs /tests/ghci/prog001/D.hs /tests/ghci/prog002/A.hs diff --git a/testsuite/tests/ghci/linking/Makefile b/testsuite/tests/ghci/linking/Makefile index 793152d..793998e 100644 --- a/testsuite/tests/ghci/linking/Makefile +++ b/testsuite/tests/ghci/linking/Makefile @@ -126,3 +126,11 @@ endif T3333: "$(TEST_HC)" -c T3333.c -o T3333.o echo "weak_test 10" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) T3333.hs T3333.o + +.PHONY: T14708 +T14708: + $(RM) -rf T14708scratch + mkdir T14708scratch + "$(TEST_HC)" -c add.c -o T14708scratch/add.o + "$(AR)" cqs T14708scratch/libadd.a T14708scratch/add.o + -"$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -LT14708scratch -ladd T14708.hs diff --git a/testsuite/tests/driver/withRtsOpts.hs b/testsuite/tests/ghci/linking/T14708.hs similarity index 96% copy from testsuite/tests/driver/withRtsOpts.hs copy to testsuite/tests/ghci/linking/T14708.hs index 0634af0..377b6b5 100644 --- a/testsuite/tests/driver/withRtsOpts.hs +++ b/testsuite/tests/ghci/linking/T14708.hs @@ -1,3 +1,2 @@ - main :: IO () main = return () diff --git a/testsuite/tests/ghci/linking/T14708.stderr b/testsuite/tests/ghci/linking/T14708.stderr new file mode 100644 index 0000000..fabbdb4 --- /dev/null +++ b/testsuite/tests/ghci/linking/T14708.stderr @@ -0,0 +1,4 @@ +: User-specified static library could not be loaded (T14708scratch/libadd.a) +Loading static libraries is not supported in this configuration. +Try using a dynamic library instead. + diff --git a/testsuite/tests/ghci/linking/add.c b/testsuite/tests/ghci/linking/add.c new file mode 100644 index 0000000..538880c --- /dev/null +++ b/testsuite/tests/ghci/linking/add.c @@ -0,0 +1 @@ +int add2(int x, int y) { return x + y; } diff --git a/testsuite/tests/ghci/linking/all.T b/testsuite/tests/ghci/linking/all.T index 124b3a4..f9617c5 100644 --- a/testsuite/tests/ghci/linking/all.T +++ b/testsuite/tests/ghci/linking/all.T @@ -31,3 +31,11 @@ test('T3333', unless(opsys('linux') or opsys('darwin') or ghc_dynamic(), expect_broken(3333))], run_command, ['$MAKE -s --no-print-directory T3333']) + +test('T14708', + [extra_files(['T14708.hs', 'add.c']), + unless(doing_ghci, skip), + unless(ghc_dynamic(), skip), + extra_clean(['T14708scratch/*', 'T14708'])], + run_command, + ['$MAKE -s --no-print-directory T14708']) From git at git.haskell.org Sat Apr 14 18:49:41 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 18:49:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0 (b4012b6) Message-ID: <20180414184941.7B99D3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/b4012b61b75c976a00d09bd0eda8876e4d687b61/ghc >--------------------------------------------------------------- commit b4012b61b75c976a00d09bd0eda8876e4d687b61 Author: Ryan Scott Date: Fri Apr 13 11:31:09 2018 -0400 Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0 This takes care of bumping the `base` and `integer-gmp` minor version numbers in anticipation of a GHC 8.4.2 release. While I was in town, I also filled in a `@since TODO` Haddock annotation for `powModSecInteger` in `integer-gmp` with `1.0.2.0`, and updated the changelog accordingly. Test Plan: ./validate Reviewers: hvr, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15025 Differential Revision: https://phabricator.haskell.org/D4586 (cherry picked from commit c4814ab6b8d756ae0e32c9a9f44e4888c4e24763) >--------------------------------------------------------------- b4012b61b75c976a00d09bd0eda8876e4d687b61 docs/users_guide/8.4.2-notes.rst | 14 ++++++++++---- libraries/base/base.cabal | 2 +- libraries/base/changelog.md | 2 ++ libraries/integer-gmp/changelog.md | 7 +++++++ libraries/integer-gmp/integer-gmp.cabal | 2 +- libraries/integer-gmp/src/GHC/Integer/Type.hs | 2 +- testsuite/tests/ado/ado004.stderr | 4 ++-- testsuite/tests/backpack/should_compile/bkp16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail17.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail19.stderr | 4 ++-- testsuite/tests/determinism/determ021/determ021.stdout | 8 ++++---- testsuite/tests/driver/json2.stderr | 6 +++--- testsuite/tests/ghci/scripts/ghci008.stdout | 4 ++-- testsuite/tests/indexed-types/should_compile/T3017.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr3.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr4.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr5.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr6.stderr | 4 ++-- .../tests/partial-sigs/should_compile/BoolToBool.stderr | 4 ++-- .../should_compile/DataFamilyInstanceLHS.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting1MROn.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting2MROff.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting2MROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Either.stderr | 4 ++-- .../partial-sigs/should_compile/EqualityConstraint.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Every.stderr | 4 ++-- .../tests/partial-sigs/should_compile/EveryNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExpressionSig.stderr | 4 ++-- .../partial-sigs/should_compile/ExpressionSigNamed.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints1.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints2.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints3.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraNumAMROff.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExtraNumAMROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Forall1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/GenNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/HigherRank1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/HigherRank2.stderr | 4 ++-- .../partial-sigs/should_compile/LocalDefinitionBug.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Meltdown.stderr | 4 ++-- .../partial-sigs/should_compile/MonoLocalBinds.stderr | 4 ++-- .../tests/partial-sigs/should_compile/NamedTyVar.stderr | 4 ++-- .../NamedWildcardInDataFamilyInstanceLHS.stderr | 4 ++-- .../NamedWildcardInTypeFamilyInstanceLHS.stderr | 4 ++-- .../partial-sigs/should_compile/ParensAroundContext.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/PatBind.stderr | 4 ++-- .../tests/partial-sigs/should_compile/PatBind2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/PatternSig.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Recursive.stderr | 4 ++-- .../should_compile/ScopedNamedWildcards.stderr | 4 ++-- .../should_compile/ScopedNamedWildcardsGood.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ShowNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/SimpleGen.stderr | 4 ++-- .../tests/partial-sigs/should_compile/SkipMany.stderr | 4 ++-- .../partial-sigs/should_compile/SomethingShowable.stderr | 4 ++-- .../should_compile/TypeFamilyInstanceLHS.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Uncurry.stderr | 4 ++-- .../tests/partial-sigs/should_compile/UncurryNamed.stderr | 4 ++-- .../should_compile/WarningWildcardInstantiations.stderr | 4 ++-- testsuite/tests/rename/should_fail/rnfail040.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles14.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles2.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles3.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles4.stderr | 4 ++-- testsuite/tests/roles/should_compile/T8958.stderr | 4 ++-- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 2 +- testsuite/tests/safeHaskell/check/Check08.stderr | 2 +- testsuite/tests/safeHaskell/check/Check09.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 2 +- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 2 +- testsuite/tests/typecheck/should_compile/T12763.stderr | 4 ++-- testsuite/tests/typecheck/should_compile/holes.stderr | 8 ++++---- testsuite/tests/typecheck/should_compile/holes3.stderr | 8 ++++---- testsuite/tests/typecheck/should_compile/tc231.stderr | 4 ++-- .../typecheck/should_fail/TcStaticPointersFail02.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 2 +- 83 files changed, 174 insertions(+), 159 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 b4012b61b75c976a00d09bd0eda8876e4d687b61 From git at git.haskell.org Sat Apr 14 18:49:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 18:49:51 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Configure option to disable dtrace (ab458df) Message-ID: <20180414184951.CC20A3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/ab458df61bd792654322fd6b20b1ac42e17f3f81/ghc >--------------------------------------------------------------- commit ab458df61bd792654322fd6b20b1ac42e17f3f81 Author: Ben Gamari Date: Fri Apr 13 14:18:03 2018 -0400 Configure option to disable dtrace Reviewers: hvr, bgamari Subscribers: lelf, thomie, carter Differential Revision: https://phabricator.haskell.org/D4575 (cherry picked from commit 4b831c27926d643b0b6fad82c1e946d05cde8645) >--------------------------------------------------------------- ab458df61bd792654322fd6b20b1ac42e17f3f81 configure.ac | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 77a22b7..2ce32a6 100644 --- a/configure.ac +++ b/configure.ac @@ -797,13 +797,23 @@ dnl if GNU patch is named gpatch, look for it first AC_PATH_PROGS(PatchCmd,gpatch patch, patch) dnl ** check for dtrace (currently only implemented for Mac OS X) +AC_ARG_ENABLE(dtrace, + [AC_HELP_STRING([--enable-dtrace], + [Enable DTrace])], + EnableDtrace=$enableval, + EnableDtrace=yes +) + HaveDtrace=NO + AC_PATH_PROG(DtraceCmd,dtrace) -if test -n "$DtraceCmd"; then - if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" \ - -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xfreebsd-portbld" \ - -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then - HaveDtrace=YES +if test "x$EnableDtrace" = "xyes"; then + if test -n "$DtraceCmd"; then + if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" \ + -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xfreebsd-portbld" \ + -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then + HaveDtrace=YES + fi fi fi AC_SUBST(HaveDtrace) From git at git.haskell.org Sat Apr 14 18:57:55 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 18:57:55 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Correct FixIOException's @since annotation retroactively (8147fa3) Message-ID: <20180414185755.304C13A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/8147fa3278d4a51d82d794d23c039289f6dd9446/ghc >--------------------------------------------------------------- commit 8147fa3278d4a51d82d794d23c039289f6dd9446 Author: Ryan Scott Date: Fri Apr 13 12:54:31 2018 -0400 Correct FixIOException's @since annotation retroactively Summary: In D4113, a `FixIOException` data type was added with a `@since TODO` annotation, but it seems that `TODO` made it out into `base-4.11` itself. I've (retroactively) fixed this and added an entry to the `base-4.11` entry in the `changelog`. Test Plan: Read it Reviewers: dfeuer, hvr, bgamari Reviewed By: dfeuer Subscribers: thomie, carter GHC Trac Issues: #14356, #15025 Differential Revision: https://phabricator.haskell.org/D4578 (cherry picked from commit ce27c7d5fe3c335dcc354b70fdfc17831a6848f6) >--------------------------------------------------------------- 8147fa3278d4a51d82d794d23c039289f6dd9446 libraries/base/GHC/IO/Exception.hs | 7 +++++-- libraries/base/changelog.md | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs index 020bc06..cb53432 100644 --- a/libraries/base/GHC/IO/Exception.hs +++ b/libraries/base/GHC/IO/Exception.hs @@ -269,12 +269,15 @@ instance Show ArrayException where . (if not (null s) then showString ": " . showString s else id) --- | @since TODO +-- | The exception thrown when an infinite cycle is detected in 'fixIO'. +-- +-- @since 4.11.0.0 data FixIOException = FixIOException --- | @since TODO +-- | @since 4.11.0.0 instance Exception FixIOException +-- | @since 4.11.0.0 instance Show FixIOException where showsPrec _ FixIOException = showString "cyclic evaluation in fixIO" diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 3977117..cb9519c 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -85,6 +85,10 @@ * Deprecated STM invariant checking primitives (`checkInv`, `always`, and `alwaysSucceeds`) in `GHC.Conc.Sync` (#14324). + * Add a `FixIOException` data type to `Control.Exception.Base`, and change + `fixIO` to throw that instead of a `BlockedIndefinitelyOnMVar` exception + (#14356). + ## 4.10.1.0 *November 2017* * Bundled with GHC 8.2.2 From git at git.haskell.org Sat Apr 14 21:00:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 21:00:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: CSE: Walk past join point lambdas (#15002) (4edcef7) Message-ID: <20180414210052.9A62E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/4edcef7814704c594e8152ce01abad61159c5d39/ghc >--------------------------------------------------------------- commit 4edcef7814704c594e8152ce01abad61159c5d39 Author: Joachim Breitner Date: Thu Apr 5 10:02:25 2018 -0400 CSE: Walk past join point lambdas (#15002) As the CSE transformation traverses the syntax tree, it needs to go past the lambdas of a join point, and only look for CSE opportunities inside, as a join point’s lambdas must be preserved. Simple fix; comes with a Note and a test case. Thanks to Ryan Scott for an excellently minimized test case, and for bisecting GHC. Differential Revision: https://phabricator.haskell.org/D4572 (cherry picked from commit ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8) >--------------------------------------------------------------- 4edcef7814704c594e8152ce01abad61159c5d39 compiler/simplCore/CSE.hs | 34 ++++++++++++++++++++-- testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index c5958a4..055c68d 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -17,7 +17,7 @@ import Var ( Var ) import VarEnv ( elemInScopeSet, mkInScopeSet ) import Id ( Id, idType, idInlineActivation, isDeadBinder , zapIdOccInfo, zapIdUsageInfo, idInlinePragma - , isJoinId ) + , isJoinId, isJoinId_maybe ) import CoreUtils ( mkAltExpr, eqExpr , exprIsTickedString , stripTicksE, stripTicksT, mkTicks ) @@ -274,7 +274,28 @@ compiling ppHtml in Haddock.Backends.Xhtml). We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's -less to gain by trying to CSE them. +less to gain by trying to CSE them. (#13219) + +Note [Don’t tryForCSE the RHS of a Join Point] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Another way how CSE for joint points is tricky is + + let join foo x = (x, 42) + join bar x = (x, 42) + in … jump foo 1 … jump bar 2 … + +naively, CSE would turn this into + + let join foo x = (x, 42) + join bar = foo + in … jump foo 1 … jump bar 2 … + +but now bar is a join point that claims arity one, but its right-hand side +is not a lambda, breaking the join-point invariant (this was #15002). + +Therefore, `cse_bind` will zoom past the lambdas of a join point (using +`collectNBinders`) and resume searching for CSE opportunities only in the body +of the join point. Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -353,6 +374,13 @@ cse_bind toplevel env (in_id, in_rhs) out_id -- See Note [Take care with literal strings] = (env', (out_id, in_rhs)) + | Just arity <- isJoinId_maybe in_id + -- See Note [Don’t tryForCSE the RHS of a Join Point] + = let (params, in_body) = collectNBinders arity in_rhs + (env', params') = addBinders env params + out_body = tryForCSE env' in_body + in (env, (out_id, mkLams params' out_body)) + | otherwise = (env', (out_id', out_rhs)) where @@ -392,6 +420,8 @@ addBinding env in_id out_id rhs' Var {} -> True _ -> False +-- | Given a binder `let x = e`, this function +-- determines whether we should add `e -> x` to the cs_map noCSE :: InId -> Bool noCSE id = not (isAlwaysActive (idInlineActivation id)) && not (noUserInlineSpec (inlinePragmaSpec (idInlinePragma id))) diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs new file mode 100644 index 0000000..a5918c5 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T15002.hs @@ -0,0 +1,12 @@ +module T15002 where + +import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) +import Data.Foldable (for_) + +broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () +broadcastThen finalState mv x = + modifyMVar_ mv $ \mx -> do + case mx of + Left ls -> do for_ ls (`putMVar` x) + return finalState + Right _ -> return finalState diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index e68f49c..c4b2f30 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -295,3 +295,4 @@ test('T14152a', [ only_ways(['optasm']), check_errmsg(r'dead code') ], compile, test('T13990', normal, compile, ['-dcore-lint -O']) test('T14650', normal, compile, ['-O2']) test('T14959', normal, compile, ['-O']) +test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof']) From git at git.haskell.org Sat Apr 14 21:01:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 21:01:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Add test case for #15005 (e1071f6) Message-ID: <20180414210103.1EF623A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/e1071f6ee200ec4bf8a36b402873d9f3e78fe3c0/ghc >--------------------------------------------------------------- commit e1071f6ee200ec4bf8a36b402873d9f3e78fe3c0 Author: Joachim Breitner Date: Tue Apr 10 09:26:09 2018 -0400 Add test case for #15005 this succeeds on `master` right now, but I confirmed that it fails on ghc-8.4.1-release. (cherry picked from commit 3f59d3802170f495702674b4f8e4e80247803654) >--------------------------------------------------------------- e1071f6ee200ec4bf8a36b402873d9f3e78fe3c0 testsuite/tests/simplCore/should_compile/T15005.hs | 189 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 190 insertions(+) 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 e1071f6ee200ec4bf8a36b402873d9f3e78fe3c0 From git at git.haskell.org Sat Apr 14 21:01:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 21:01:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: In Exitify, zap idInfo of abstracted variables (fixes #15005) (2f5b97c) Message-ID: <20180414210113.0707E3A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/2f5b97c37dbc9708e7a33b4e36f66a12b32ee09f/ghc >--------------------------------------------------------------- commit 2f5b97c37dbc9708e7a33b4e36f66a12b32ee09f Author: Joachim Breitner Date: Tue Apr 10 09:36:08 2018 -0400 In Exitify, zap idInfo of abstracted variables (fixes #15005) as helpfully outlined by SPJ. This commit copies a small bit code from `SetLevels` which could reasonably be put in `Id` as `zapAllIdinfo`; I did not do this to make merging this commmit into `ghc-8.4` easier. If this commit gets merged, then presumably after commit 3f59d3802170f495702674b4f8e4e80247803654 (test case) and ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8 (other fixes to Exitify.hs). Differential Revision: https://phabricator.haskell.org/D4582 (cherry picked from commit 3cfb12d8adac37e5565d66fd173e4648cc041e65) >--------------------------------------------------------------- 2f5b97c37dbc9708e7a33b4e36f66a12b32ee09f compiler/simplCore/Exitify.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 2d3b5af..9295922 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -48,6 +48,7 @@ import VarEnv import CoreFVs import FastString import Type +import MkCore ( sortQuantVars ) import Data.Bifunctor import Control.Monad @@ -166,7 +167,14 @@ exitify in_scope pairs = is_interesting = anyVarSet isLocalId (fvs `minusVarSet` mkVarSet captured) -- The possible arguments of this exit join point - args = filter (`elemVarSet` fvs) captured + args = + map zap $ + sortQuantVars $ + filter (`elemVarSet` fvs) captured + + -- cf. SetLevels.abstractVars + zap v | isId v = setIdInfo v vanillaIdInfo + | otherwise = v -- We cannot abstract over join points captures_join_points = any isJoinId args From git at git.haskell.org Sat Apr 14 21:49:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 Apr 2018 21:49:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: SpecConstr: accommodate casts in value arguments (6ed694d) Message-ID: <20180414214940.93EB03A5F8@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/6ed694d7bc7823321349bcfc60c21aad59d78669/ghc >--------------------------------------------------------------- commit 6ed694d7bc7823321349bcfc60c21aad59d78669 Author: Simon Peyton Jones Date: Mon Apr 2 14:57:37 2018 +0100 SpecConstr: accommodate casts in value arguments This commit: commit fb050a330ad202c1eb43038dc18cca2a5be26f4a Author: Simon Peyton Jones Date: Thu Oct 12 11:00:19 2017 +0100 Do not bind coercion variables in SpecConstr rules arranged to reject any SpecConstr call pattern that mentioned a coercion in the pattern. There was a good reason for that -- see Note [SpecConstr and casts] -- but I didn't realise how important it was to accept patterns that mention casts in /terms/. Trac #14936 showed this up. This patch just narrows the restriction to discard only the cases where the coercion is mentioned only in types. Fortunately that was pretty easy to do. (cherry picked from commit 5ab8094e4579c08973260c2d18599be0738526ec) >--------------------------------------------------------------- 6ed694d7bc7823321349bcfc60c21aad59d78669 compiler/specialise/SpecConstr.hs | 56 ++++++++++++++++++---- testsuite/tests/perf/should_run/T14936.hs | 29 +++++++++++ .../should_run/T14936.stdout} | 0 testsuite/tests/perf/should_run/all.T | 6 +++ 4 files changed, 82 insertions(+), 9 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index d54c1ea..f32e0e3 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1921,11 +1921,39 @@ But alas, when we match the call we won't bind 'co', because type-matching I don't know how to solve this, so for now I'm just discarding any call patterns that - * Mentions a coercion variable + * Mentions a coercion variable in a type argument * That is not in scope at the binding of the function I think this is very rare. +It is important (e.g. Trac #14936) that this /only/ applies to +coercions mentioned in casts. We don't want to be discombobulated +by casts in terms! For example, consider + f ((e1,e2) |> sym co) +where, say, + f :: Foo -> blah + co :: Foo ~R (Int,Int) + +Here we definitely do want to specialise for that pair! We do not +match on the structre of the coercion; instead we just match on a +coercion variable, so the RULE looks like + + forall (x::Int, y::Int, co :: (Int,Int) ~R Foo) + f ((x,y) |> co) = $sf x y co + +Often the body of f looks like + f arg = ...(case arg |> co' of + (x,y) -> blah)... + +so that the specialised f will turn into + $sf x y co = let arg = (x,y) |> co + in ...(case arg>| co' of + (x,y) -> blah).... + +which will simplify to not use 'co' at all. But we can't guarantee +that co will end up unused, so we still pass it. Absence analysis +may remove it later. + Note that this /also/ discards the call pattern if we have a cast in a /term/, although in fact Rules.match does make a very flaky and fragile attempt to match coercions. e.g. a call like @@ -2045,17 +2073,19 @@ callToPats env bndr_occs call@(Call _ args con_env) | args `ltLength` bndr_occs -- Check saturated = return Nothing | otherwise - = do { let in_scope = substInScope (sc_subst env) + = do { let in_scope = substInScope (sc_subst env) ; (interesting, pats) <- argsToPats env in_scope con_env args bndr_occs - ; let pat_fvs = exprsFreeVarsList pats + ; let pat_fvs = exprsFreeVarsList pats -- To get determinism we need the list of free variables in -- deterministic order. Otherwise we end up creating -- lambdas with different argument orders. See -- determinism/simplCore/should_compile/spec-inline-determ.hs -- for an example. For explanation of determinism -- considerations See Note [Unique Determinism] in Unique. + in_scope_vars = getInScopeVars in_scope - qvars = filterOut (`elemVarSet` in_scope_vars) pat_fvs + is_in_scope v = v `elemVarSet` in_scope_vars + qvars = filterOut is_in_scope pat_fvs -- Quantify over variables that are not in scope -- at the call site -- See Note [Free type variables of the qvar types] @@ -2070,13 +2100,21 @@ callToPats env bndr_occs call@(Call _ args con_env) sanitise id = id `setIdType` expandTypeSynonyms (idType id) -- See Note [Free type variables of the qvar types] - bad_covars = filter isCoVar ids - -- See Note [SpecConstr and casts] + -- Bad coercion variables: see Note [SpecConstr and casts] + bad_covars :: CoVarSet + bad_covars = mapUnionVarSet get_bad_covars pats + get_bad_covars :: CoreArg -> CoVarSet + get_bad_covars (Type ty) + = filterVarSet (\v -> isId v && not (is_in_scope v)) $ + tyCoVarsOfType ty + get_bad_covars _ + = emptyVarSet ; -- pprTrace "callToPats" (ppr args $$ ppr bndr_occs) $ - WARN( not (null bad_covars), text "SpecConstr: bad covars:" <+> ppr bad_covars - $$ ppr call ) - if interesting && null bad_covars + WARN( not (isEmptyVarSet bad_covars) + , text "SpecConstr: bad covars:" <+> ppr bad_covars + $$ ppr call ) + if interesting && isEmptyVarSet bad_covars then return (Just (qvars', pats)) else return Nothing } diff --git a/testsuite/tests/perf/should_run/T14936.hs b/testsuite/tests/perf/should_run/T14936.hs new file mode 100644 index 0000000..187404c --- /dev/null +++ b/testsuite/tests/perf/should_run/T14936.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE FlexibleContexts #-} + +module Main where + +import Prelude +import qualified Foreign.Storable as Storable +import qualified Control.Monad.State.Strict as S +import Control.Monad.IO.Class +import Foreign.Marshal.Alloc (mallocBytes) + +newtype Foo a = Foo a + +intSize :: Int +intSize = Storable.sizeOf (undefined :: Int) + +-- This 'go' loop should allocate nothing, because it specialises +-- for the shape of the state. But in 8.4 it did (Trac #14936) + +slow :: Int -> IO () +slow i = do let go 0 = pure () + go j = do Foo (!a, !off) <- S.get + S.put (Foo (a+1, off)) + go (j - 1) + S.evalStateT (go i) (Foo ((0::Int),(intSize::Int))) + +main = do { slow (10 ^ 7); print "Done" } + diff --git a/testsuite/tests/ado/T14163.stdout b/testsuite/tests/perf/should_run/T14936.stdout similarity index 100% copy from testsuite/tests/ado/T14163.stdout copy to testsuite/tests/perf/should_run/T14936.stdout diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 9c92cd6..f1284c0 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -547,3 +547,9 @@ test('T13623', only_ways(['normal'])], compile_and_run, ['-O2']) + +test('T14936', + [stats_num_field('bytes allocated', + [ (wordsize(64), 51792, 5) ])], + compile_and_run, + ['-O2']) From git at git.haskell.org Mon Apr 16 05:46:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:46:59 +0000 (UTC) Subject: [commit: ghc] branch 'wip/tdammers/D4568' created Message-ID: <20180416054659.ACB2A3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/tdammers/D4568 Referencing: 4c390f8781cf3b79d1b82363186d9e8ca88579f1 From git at git.haskell.org Mon Apr 16 05:47:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:08 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Remove unnecessary check in simplCast (d959087) Message-ID: <20180416054708.0D06B3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/d9590878863762a85a85c011247e4a3b2ffbddda/ghc >--------------------------------------------------------------- commit d9590878863762a85a85c011247e4a3b2ffbddda Author: Tobias Dammers Date: Tue Apr 3 13:49:40 2018 +0200 Remove unnecessary check in simplCast The coercion optimizer will take care of it anyway, and the check is prohibitively expensive. See Trac #14737. >--------------------------------------------------------------- d9590878863762a85a85c011247e4a3b2ffbddda compiler/coreSyn/CoreOpt.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index e1eae8b..4b305fa 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -958,8 +958,10 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) -- If the returned coercion is Nothing, then it would have been reflexive; -- it's faster not to compute it, though. pushCoTyArg co ty - | tyL `eqType` tyR - = Just (ty, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion + -- optimizer will take care of it. See Trac #14737. + -- | tyL `eqType` tyR + -- = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) From git at git.haskell.org Mon Apr 16 05:47:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:05 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Clean up & document isReflexiveCo. (fdf6ad3) Message-ID: <20180416054705.45A913AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/fdf6ad32b8a1ed8af43a968caa82e155e0b0565b/ghc >--------------------------------------------------------------- commit fdf6ad32b8a1ed8af43a968caa82e155e0b0565b Author: Tobias Dammers Date: Sat Mar 31 18:25:15 2018 +0200 Clean up & document isReflexiveCo. >--------------------------------------------------------------- fdf6ad32b8a1ed8af43a968caa82e155e0b0565b compiler/types/Coercion.hs | 54 ++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index b6de283..046ac43 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -58,7 +58,7 @@ module Coercion ( pickLR, - isReflCo, isReflCo_maybe, isReflexiveCo, isReflexiveCo_maybe, + isReflCo, isReflCo_maybe, isReflexiveCo, isReflCoVar_maybe, -- ** Coercion variables @@ -418,37 +418,53 @@ isReflCoVar_maybe cv | otherwise = Nothing --- | Tests if this coercion is obviously reflexive. Guaranteed to work --- very quickly. Sometimes a coercion can be reflexive, but not obviously --- so. c.f. 'isReflexiveCo' +-- | Tests if this coercion is obviously reflexive. +-- See Note [Checking whether coercions are reflexive]. isReflCo :: Coercion -> Bool isReflCo (Refl {}) = True isReflCo _ = False --- | Returns the type coerced if this coercion is reflexive. Guaranteed --- to work very quickly. Sometimes a coercion can be reflexive, but not --- obviously so. c.f. 'isReflexiveCo_maybe' +-- | Returns the type coerced if this coercion is obviously reflexive. +-- See Note [Checking whether coercions are reflexive]. isReflCo_maybe :: Coercion -> Maybe (Type, Role) isReflCo_maybe (Refl r ty) = Just (ty, r) isReflCo_maybe _ = Nothing --- | Slowly checks if the coercion is reflexive. Don't call this in a loop, --- as it walks over the entire coercion. +-- | Slowly checks if the coercion is reflexive. +-- See Note [Checking whether coercions are reflexive]. isReflexiveCo :: Coercion -> Bool isReflexiveCo (Refl {}) = True isReflexiveCo co = eqType ty1 ty2 where Pair ty1 ty2 = coercionKind co --- | Extracts the coerced type from a reflexive coercion. This potentially --- walks over the entire coercion, so avoid doing this in a loop. -isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role) -isReflexiveCo_maybe (Refl r ty) = Just (ty, r) -isReflexiveCo_maybe co - | ty1 `eqType` ty2 - = Just (ty1, r) - | otherwise - = Nothing - where (Pair ty1 ty2, r) = coercionKindRole co +{- + +Note [Checking whether coercions are reflexive] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes a coercion can be reflexive, but not obviously so; in such cases, a +conclusive will be very expensive, because it requires walking over the entire +coercion. + +Also, when we determine whether a coercion is reflexive, it is sometimes useful +to also determine the type coerced and return it from the check, but when we +don't need it, we can write a more efficient implementation using booleans +instead of `Maybe`. + +Because of this, several flavors of the is-reflexive test exist: + +- `isReflCo` performs a very quick test, only checking whether the coercion is + obviously reflexive. This test may miss non-obviously reflexive coercions, + but it is guaranteed to run very quickly. +- `isReflCo_maybe` performs the same quick test as `isReflCo`, but also returns + the type coerced if it has been found to be obviously reflexive. +- `isReflexiveCo` performs a full, conclusive test; this will correctly detect + non-obviously reflexive coercions, but may run slowly. + +Previously, `isReflexiveCo_maybe` also existed, but we don't need a full test +that also returns the type coerced anywhere. + +-} {- %************************************************************************ From git at git.haskell.org Mon Apr 16 05:47:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:02 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Discard reflexive casts during Simplify (469ce3b) Message-ID: <20180416054702.7EDC43AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/469ce3b752db7943a60dc273483c1ed15d685d44/ghc >--------------------------------------------------------------- commit 469ce3b752db7943a60dc273483c1ed15d685d44 Author: Richard Eisenberg Date: Fri Jan 26 22:42:46 2018 -0500 Discard reflexive casts during Simplify Previously, we went to great lengths to build just the right reflexive casts, only to discard them shortly later. Now, just skip creating reflexive casts altogether. >--------------------------------------------------------------- 469ce3b752db7943a60dc273483c1ed15d685d44 compiler/coreSyn/CoreOpt.hs | 48 ++++++++++++++++++++++++------------------ compiler/simplCore/Simplify.hs | 27 +++++++++++++++++++----- 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 04e604e..e1eae8b 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -732,9 +732,11 @@ exprIsConApp_maybe (in_scope, id_unf) expr go subst (Tick t expr) cont | not (tickishIsCode t) = go subst expr cont go subst (Cast expr co1) (CC args co2) - | Just (args', co1') <- pushCoArgs (subst_co subst co1) args + | Just (args', m_co1') <- pushCoArgs (subst_co subst co1) args -- See Note [Push coercions in exprIsConApp_maybe] - = go subst expr (CC args' (co1' `mkTransCo` co2)) + = case m_co1' of + Just co1' -> go subst expr (CC args' (co1' `mkTransCo` co2)) + Nothing -> go subst expr (CC args' co2) go subst (App fun arg) (CC args co) = go subst fun (CC (subst_arg subst arg : args) co) go subst (Lam var body) (CC (arg:args) co) @@ -928,36 +930,40 @@ Here we implement the "push rules" from FC papers: by pushing the coercion into the arguments -} -pushCoArgs :: Coercion -> [CoreArg] -> Maybe ([CoreArg], Coercion) -pushCoArgs co [] = return ([], co) -pushCoArgs co (arg:args) = do { (arg', co1) <- pushCoArg co arg - ; (args', co2) <- pushCoArgs co1 args - ; return (arg':args', co2) } +pushCoArgs :: Coercion -> [CoreArg] -> Maybe ([CoreArg], Maybe Coercion) +pushCoArgs co [] = return ([], Just co) +pushCoArgs co (arg:args) = do { (arg', m_co1) <- pushCoArg co arg + ; case m_co1 of + Just co1 -> do { (args', m_co2) <- pushCoArgs co1 args + ; return (arg':args', m_co2) } + Nothing -> return (arg':args, Nothing) } -pushCoArg :: Coercion -> CoreArg -> Maybe (CoreArg, Coercion) +pushCoArg :: Coercion -> CoreArg -> Maybe (CoreArg, Maybe Coercion) -- We have (fun |> co) arg, and we want to transform it to -- (fun arg) |> co -- This may fail, e.g. if (fun :: N) where N is a newtype -- C.f. simplCast in Simplify.hs -- 'co' is always Representational +-- If the returned coercion is Nothing, then it would have been reflexive +pushCoArg co (Type ty) = do { (ty', m_co') <- pushCoTyArg co ty + ; return (Type ty', m_co') } +pushCoArg co val_arg = do { (arg_co, m_co') <- pushCoValArg co + ; return (val_arg `mkCast` arg_co, m_co') } -pushCoArg co (Type ty) = do { (ty', co') <- pushCoTyArg co ty - ; return (Type ty', co') } -pushCoArg co val_arg = do { (arg_co, co') <- pushCoValArg co - ; return (mkCast val_arg arg_co, co') } - -pushCoTyArg :: Coercion -> Type -> Maybe (Type, Coercion) +pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) -- We have (fun |> co) @ty -- Push the coercion through to return -- (fun @ty') |> co' -- 'co' is always Representational +-- If the returned coercion is Nothing, then it would have been reflexive; +-- it's faster not to compute it, though. pushCoTyArg co ty | tyL `eqType` tyR - = Just (ty, mkRepReflCo (piResultTy tyR ty)) + = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) - Just (ty `mkCastTy` mkSymCo co1, co2) + Just (ty `mkCastTy` mkSymCo co1, Just co2) | otherwise = Nothing @@ -977,14 +983,16 @@ pushCoTyArg co ty -- co2 :: ty1[ (ty|>co1)/a1 ] ~ ty2[ ty/a2 ] -- Arg of mkInstCo is always nominal, hence mkNomReflCo -pushCoValArg :: Coercion -> Maybe (Coercion, Coercion) +pushCoValArg :: Coercion -> Maybe (Coercion, Maybe Coercion) -- We have (fun |> co) arg -- Push the coercion through to return -- (fun (arg |> co_arg)) |> co_res -- 'co' is always Representational +-- If the second returned Coercion is actually Nothing, then no cast is necessary; +-- the returned coercion would have been reflexive. pushCoValArg co | tyL `eqType` tyR - = Just (mkRepReflCo arg, mkRepReflCo res) + = Just (mkRepReflCo arg, Nothing) | isFunTy tyL , (co1, co2) <- decomposeFunCo co @@ -992,12 +1000,12 @@ pushCoValArg co -- then co1 :: tyL1 ~ tyR1 -- co2 :: tyL2 ~ tyR2 = ASSERT2( isFunTy tyR, ppr co $$ ppr arg ) - Just (mkSymCo co1, co2) + Just (mkSymCo co1, Just co2) | otherwise = Nothing where - (arg, res) = splitFunTy tyR + (arg, _) = splitFunTy tyR Pair tyL tyR = coercionKind co pushCoercionIntoLambda diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index a60df1c..d440bbb 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1207,23 +1207,40 @@ simplCast env body co0 cont0 ; cont1 <- addCoerce co1 cont0 ; simplExprF env body cont1 } where + -- If the first parameter is Nothing, then simplifying revealed a + -- reflexive coercion. Omit. + addCoerce0 :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce0 Nothing cont = return cont + addCoerce0 (Just co) cont = addCoerce co cont + addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce co cont -- just skip reflexive casts + | isReflexiveCo co = {-#SCC "addCoerce-reflexive" #-} + return cont + -- It's worth checking isReflexiveCo. + -- For example, in the initial form of a worker + -- we may find (coerce T (coerce S (\x.e))) y + -- and we'd like it to simplify to e[y/x] in one round + -- of simplification + addCoerce co1 (CastIt co2 cont) = addCoerce (mkTransCo co1 co2) cont addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) - | Just (arg_ty', co') <- pushCoTyArg co arg_ty - = do { tail' <- addCoerce co' tail - ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty + = case m_co' of + Just co' -> do { tail' <- addCoerce co' tail + ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + Nothing -> return cont addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se , sc_dup = dup, sc_cont = tail }) - | Just (co1, co2) <- pushCoValArg co + | Just (co1, m_co2) <- pushCoValArg co , Pair _ new_ty <- coercionKind co1 , not (isTypeLevPoly new_ty) -- without this check, we get a lev-poly arg -- See Note [Levity polymorphism invariants] in CoreSyn -- test: typecheck/should_run/EtaExpandLevPoly - = do { tail' <- addCoerce co2 tail + = do { tail' <- addCoerce0 m_co2 tail ; if isReflCo co1 then return (cont { sc_cont = tail' }) -- Avoid simplifying if possible; From git at git.haskell.org Mon Apr 16 05:47:10 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:10 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Fix unintended Haddock (c349615) Message-ID: <20180416054710.D7BE73AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/c349615ac28a5ef8b13c6b037d177049d5f2063d/ghc >--------------------------------------------------------------- commit c349615ac28a5ef8b13c6b037d177049d5f2063d Author: Tobias Dammers Date: Thu Apr 5 14:25:03 2018 +0200 Fix unintended Haddock >--------------------------------------------------------------- c349615ac28a5ef8b13c6b037d177049d5f2063d compiler/coreSyn/CoreOpt.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 4b305fa..6c63361 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -960,8 +960,8 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) pushCoTyArg co ty -- The following is inefficient - don't do `eqType` here, the coercion -- optimizer will take care of it. See Trac #14737. - -- | tyL `eqType` tyR - -- = Just (ty, Nothing) + -- -- | tyL `eqType` tyR + -- -- = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) @@ -993,8 +993,10 @@ pushCoValArg :: Coercion -> Maybe (Coercion, Maybe Coercion) -- If the second returned Coercion is actually Nothing, then no cast is necessary; -- the returned coercion would have been reflexive. pushCoValArg co - | tyL `eqType` tyR - = Just (mkRepReflCo arg, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion + -- optimizer will take care of it. See Trac #14737. + -- -- | tyL `eqType` tyR + -- -- = Just (mkRepReflCo arg, Nothing) | isFunTy tyL , (co1, co2) <- decomposeFunCo co From git at git.haskell.org Mon Apr 16 05:47:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:13 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Fix huge performance regression (17c5f40) Message-ID: <20180416054713.A04E23AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/17c5f404fd68e861b2dd66ea4a494100e4541bb3/ghc >--------------------------------------------------------------- commit 17c5f404fd68e861b2dd66ea4a494100e4541bb3 Author: Tobias Dammers Date: Mon Mar 26 13:44:56 2018 +0200 Fix huge performance regression Previous version caused a 10x increase in execution time for the infamous Grammar.hs test case from #14683; this patch gets us back on par. >--------------------------------------------------------------- 17c5f404fd68e861b2dd66ea4a494100e4541bb3 compiler/simplCore/Simplify.hs | 102 +++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 56 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d440bbb..9fbcac8 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1209,62 +1209,52 @@ simplCast env body co0 cont0 where -- If the first parameter is Nothing, then simplifying revealed a -- reflexive coercion. Omit. - addCoerce0 :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont - addCoerce0 Nothing cont = return cont - addCoerce0 (Just co) cont = addCoerce co cont - - addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont - addCoerce co cont -- just skip reflexive casts - | isReflexiveCo co = {-#SCC "addCoerce-reflexive" #-} - return cont - -- It's worth checking isReflexiveCo. - -- For example, in the initial form of a worker - -- we may find (coerce T (coerce S (\x.e))) y - -- and we'd like it to simplify to e[y/x] in one round - -- of simplification - - addCoerce co1 (CastIt co2 cont) - = addCoerce (mkTransCo co1 co2) cont - - addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) - | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty - = case m_co' of - Just co' -> do { tail' <- addCoerce co' tail - ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } - Nothing -> return cont - - addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se - , sc_dup = dup, sc_cont = tail }) - | Just (co1, m_co2) <- pushCoValArg co - , Pair _ new_ty <- coercionKind co1 - , not (isTypeLevPoly new_ty) -- without this check, we get a lev-poly arg - -- See Note [Levity polymorphism invariants] in CoreSyn - -- test: typecheck/should_run/EtaExpandLevPoly - = do { tail' <- addCoerce0 m_co2 tail - ; if isReflCo co1 - then return (cont { sc_cont = tail' }) - -- Avoid simplifying if possible; - -- See Note [Avoiding exponential behaviour] - else do - { (dup', arg_se', arg') <- simplArg env dup arg_se arg - -- When we build the ApplyTo we can't mix the OutCoercion - -- 'co' with the InExpr 'arg', so we simplify - -- to make it all consistent. It's a bit messy. - -- But it isn't a common case. - -- Example of use: Trac #995 - ; return (ApplyToVal { sc_arg = mkCast arg' co1 - , sc_env = arg_se' - , sc_dup = dup' - , sc_cont = tail' }) } } - - addCoerce co cont - | isReflexiveCo co = return cont - | otherwise = return (CastIt co cont) - -- It's worth checking isReflexiveCo. - -- For example, in the initial form of a worker - -- we may find (coerce T (coerce S (\x.e))) y - -- and we'd like it to simplify to e[y/x] in one round - -- of simplification + addCoerce0 :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce0 Nothing cont = return cont + addCoerce0 (Just co) cont = addCoerce co cont + + addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont + + addCoerce co1 (CastIt co2 cont) + = addCoerce (mkTransCo co1 co2) cont + + addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) + | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty + = do { tail' <- addCoerce0 m_co' tail + ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + + addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se + , sc_dup = dup, sc_cont = tail }) + | Just (co1, m_co2) <- pushCoValArg co + , Pair _ new_ty <- coercionKind co1 + , not (isTypeLevPoly new_ty) -- without this check, we get a lev-poly arg + -- See Note [Levity polymorphism invariants] in CoreSyn + -- test: typecheck/should_run/EtaExpandLevPoly + = do { tail' <- addCoerce0 m_co2 tail + ; if isReflCo co1 + then return (cont { sc_cont = tail' }) + -- Avoid simplifying if possible; + -- See Note [Avoiding exponential behaviour] + else do + { (dup', arg_se', arg') <- simplArg env dup arg_se arg + -- When we build the ApplyTo we can't mix the OutCoercion + -- 'co' with the InExpr 'arg', so we simplify + -- to make it all consistent. It's a bit messy. + -- But it isn't a common case. + -- Example of use: Trac #995 + ; return (ApplyToVal { sc_arg = mkCast arg' co1 + , sc_env = arg_se' + , sc_dup = dup' + , sc_cont = tail' }) } } + + addCoerce co cont + | isReflexiveCo co = return cont + | otherwise = return (CastIt co cont) + -- It's worth checking isReflexiveCo. + -- For example, in the initial form of a worker + -- we may find (coerce T (coerce S (\x.e))) y + -- and we'd like it to simplify to e[y/x] in one round + -- of simplification simplArg :: SimplEnv -> DupFlag -> StaticEnv -> CoreExpr -> SimplM (DupFlag, StaticEnv, OutExpr) From git at git.haskell.org Mon Apr 16 05:47:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:16 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Improve isReflexiveCo performance (5a83981) Message-ID: <20180416054716.697503AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/5a83981a7ae1dfbfcda3f460867440ea945dcbeb/ghc >--------------------------------------------------------------- commit 5a83981a7ae1dfbfcda3f460867440ea945dcbeb Author: Tobias Dammers Date: Thu Mar 29 10:45:54 2018 +0200 Improve isReflexiveCo performance >--------------------------------------------------------------- 5a83981a7ae1dfbfcda3f460867440ea945dcbeb compiler/types/Coercion.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index c8105d0..b6de283 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -435,7 +435,9 @@ isReflCo_maybe _ = Nothing -- | Slowly checks if the coercion is reflexive. Don't call this in a loop, -- as it walks over the entire coercion. isReflexiveCo :: Coercion -> Bool -isReflexiveCo = isJust . isReflexiveCo_maybe +isReflexiveCo (Refl {}) = True +isReflexiveCo co = eqType ty1 ty2 + where Pair ty1 ty2 = coercionKind co -- | Extracts the coerced type from a reflexive coercion. This potentially -- walks over the entire coercion, so avoid doing this in a loop. From git at git.haskell.org Mon Apr 16 05:47:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 05:47:19 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4568: Bump perf test targets (4c390f8) Message-ID: <20180416054719.341283AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4568 Link : http://ghc.haskell.org/trac/ghc/changeset/4c390f8781cf3b79d1b82363186d9e8ca88579f1/ghc >--------------------------------------------------------------- commit 4c390f8781cf3b79d1b82363186d9e8ca88579f1 Author: Tobias Dammers Date: Mon Apr 9 18:08:15 2018 +0200 Bump perf test targets Collateral to #14737: a handful of tests perform somewhat worse with this patch. >--------------------------------------------------------------- 4c390f8781cf3b79d1b82363186d9e8ca88579f1 testsuite/tests/perf/compiler/all.T | 12 ++++++++---- testsuite/tests/perf/haddock/all.T | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index f9cf692..1f3c17d 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -476,12 +476,13 @@ test('parsing001', [(wordsize(32), 232777056, 10), # Initial: 274000576 # 2017-03-24: 232777056 - (wordsize(64), 490228304, 5)]), + (wordsize(64), 519401296, 5)]), # expected value: 587079016 (amd64/Linux) # 2016-09-01: 581551384 (amd64/Linux) Restore w/w limit (#11565) # 2016-12-19: 493730288 (amd64/Linux) Join points (#12988) # 2017-02-14: 463931280 Early inlining patch; acutal improvement 7% # 2017-12-11: 490228304 BlockArguments + # 2018-04-09: 519401296 Inexplicable, collateral of #14737 only_ways(['normal']), ], compile_fail, ['']) @@ -743,7 +744,7 @@ test('T9020', # 2014-07-31: 343005716 (Windows) (general round of updates) # 2017-03-24: 249904136 (x86/Linux, 64-bit machine) - (wordsize(64), 423163832, 10)]) + (wordsize(64), 562206104, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -757,6 +758,7 @@ test('T9020', # Program size collapses in first simplification # 2017-03-31: 493596312 Fix memory leak in simplifier # 2017-04-28: 423163832 Remove exponential behaviour in simplifier + # 2018-04-09: 562206104 Inexplicable, collateral of #14737 ], compile,['']) @@ -1034,7 +1036,7 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 134780272, 5), + [(wordsize(64), 141952368, 5), # initial: 125831400 # 2017-01-18: 133380960 Allow top-level string literals in Core # 2017-02-17: 153611448 Type-indexed Typeable @@ -1042,6 +1044,7 @@ test('T12425', # 2017-03-21: 134334800 Unclear # 2017-04-28: 127500136 Remove exponential behaviour in simplifier # 2017-05-23: 134780272 Addition of llvm-targets in dynflags (D3352) + # 2018-04-15: 141952368 Collateral of #14737 ]), ], compile, @@ -1111,7 +1114,7 @@ test('T13056', test('T12707', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1163821528, 5), + [(wordsize(64), 1237898376, 5), # initial: 1271577192 # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) @@ -1119,6 +1122,7 @@ test('T12707', # 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin) # 2017-03-02: 1231809592 Drift from recent simplifier improvements # 2017-05-14: 1163821528 (amd64/Linux) Two-pass CmmLayoutStack + # 2018-04-09: 1237898376 Inexplicable, collateral of #14737 ]), ], compile, diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index db378fe..7ca8bf2 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -10,7 +10,7 @@ test('haddock.base', # 2017-02-19 24286343184 (x64/Windows) - Generalize kind of (->) # 2017-12-24 18733710728 (x64/Windows) - Unknown - ,(wordsize(64), 19694554424, 5) + ,(wordsize(64), 20713759000, 5) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) @@ -44,6 +44,7 @@ test('haddock.base', # 2017-06-06: 25173968808 (x86_64/Linux) - Don't pass on -dcore-lint in Haddock.mk # 2017-07-12: 23677299848 (x86_64/Linux) - Use getNameToInstancesIndex # 2017-08-22: 19694554424 (x86_64/Linux) - Various Haddock optimizations + # 2018-04-15: 20713759000 (x86_64/Linux) - Collateral of #14737 ,(platform('i386-unknown-mingw32'), 2885173512, 5) # 2013-02-10: 3358693084 (x86/Windows) From git at git.haskell.org Mon Apr 16 16:54:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 16:54:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/no-exnstr' created Message-ID: <20180416165413.7B9793AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/no-exnstr Referencing: e6f1a7979eef882aba97ca1778a9468fcfb29820 From git at git.haskell.org Mon Apr 16 16:54:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 16:54:16 +0000 (UTC) Subject: [commit: ghc] wip/no-exnstr: Rip out ExnStr business (e6f1a79) Message-ID: <20180416165416.535973AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-exnstr Link : http://ghc.haskell.org/trac/ghc/changeset/e6f1a7979eef882aba97ca1778a9468fcfb29820/ghc >--------------------------------------------------------------- commit e6f1a7979eef882aba97ca1778a9468fcfb29820 Author: David Feuer Date: Mon Apr 16 12:52:17 2018 -0400 Rip out ExnStr business Summary: This is just the first pass. The postprocessing business still needs ripping, but let's get a look at what fails. Reviewers: goldfire, bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4601 >--------------------------------------------------------------- e6f1a7979eef882aba97ca1778a9468fcfb29820 compiler/basicTypes/Demand.hs | 150 +++++++++++++--------------------------- compiler/coreSyn/CoreArity.hs | 3 +- compiler/coreSyn/MkCore.hs | 3 +- compiler/prelude/primops.txt.pp | 6 +- compiler/simplCore/Simplify.hs | 6 +- compiler/stranal/WwLib.hs | 2 +- 6 files changed, 56 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 e6f1a7979eef882aba97ca1778a9468fcfb29820 From git at git.haskell.org Mon Apr 16 18:37:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 18:37:04 +0000 (UTC) Subject: [commit: ghc] master: users guide: Note improved constant folding in 8.6 release notes (09128f3) Message-ID: <20180416183704.5A9853AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/09128f3a3d754abcef63480bc7e2e901d30b155a/ghc >--------------------------------------------------------------- commit 09128f3a3d754abcef63480bc7e2e901d30b155a Author: Ben Gamari Date: Fri Apr 13 18:10:39 2018 -0400 users guide: Note improved constant folding in 8.6 release notes >--------------------------------------------------------------- 09128f3a3d754abcef63480bc7e2e901d30b155a docs/users_guide/8.6.1-notes.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst index 74bf929..996fb17 100644 --- a/docs/users_guide/8.6.1-notes.rst +++ b/docs/users_guide/8.6.1-notes.rst @@ -79,6 +79,10 @@ Compiler - GHC now supports British spelling of :extension:`GeneralizedNewtypeDeriving`. +- GHC now does significantly more constant folding in its core-to-core optimiser. + This will result in significantly better code being generated for some + programs. See :ghc-ticket:`9136`. + - The code-generation effects of :ghc-flag:`-dynamic` can now be enabled independently by the flag :ghc-flag:`-fexternal-dynamic-refs`. If you don't know why you might From git at git.haskell.org Mon Apr 16 18:37:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 18:37:18 +0000 (UTC) Subject: [commit: ghc] master: Revert "Enhanced constant folding" (0e37361) Message-ID: <20180416183718.C5AD53AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0e37361392a910ccbbb2719168f4e8d8272b2ae2/ghc >--------------------------------------------------------------- commit 0e37361392a910ccbbb2719168f4e8d8272b2ae2 Author: Ben Gamari Date: Mon Apr 16 14:36:11 2018 -0400 Revert "Enhanced constant folding" I need to upgrade GHC on the CI builders before landing this due to a bug in 8.2.1 triggered by this patch. This reverts commit fea04defa64871caab6339ff3fc5511a272f37c7. >--------------------------------------------------------------- 0e37361392a910ccbbb2719168f4e8d8272b2ae2 compiler/main/DynFlags.hs | 3 - compiler/prelude/PrelRules.hs | 305 +-------------------- .../simplCore/should_compile/spec-inline.stderr | 38 ++- 3 files changed, 37 insertions(+), 309 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 0e37361392a910ccbbb2719168f4e8d8272b2ae2 From git at git.haskell.org Mon Apr 16 18:37:33 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 18:37:33 +0000 (UTC) Subject: [commit: ghc] master: rts: Comment wibbles (90283b5) Message-ID: <20180416183733.287A43AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90283b5f54427f2f04dce7901f2722dc75e7d098/ghc >--------------------------------------------------------------- commit 90283b5f54427f2f04dce7901f2722dc75e7d098 Author: Ben Gamari Date: Mon Apr 16 14:35:41 2018 -0400 rts: Comment wibbles >--------------------------------------------------------------- 90283b5f54427f2f04dce7901f2722dc75e7d098 includes/rts/storage/Closures.h | 2 +- rts/sm/GC.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h index e5b274d..e52043c 100644 --- a/includes/rts/storage/Closures.h +++ b/includes/rts/storage/Closures.h @@ -125,7 +125,7 @@ typedef struct { StgClosure *static_link; // See Note [CAF lists] const StgInfoTable *saved_info; // `saved_info` also used for the link field for `debug_caf_list`, - // see `newCAF` and Note [CAF lists] + // see `newCAF` and Note [CAF lists] in rts/sm/Storage.h. } StgIndStatic; typedef struct StgBlockingQueue_ { diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 9e6bd55..e52400e 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -95,6 +95,8 @@ * * We build up a static object list while collecting generations 0..N, * which is then appended to the static object list of generation N+1. + * + * See also: Note [STATIC_LINK fields] in Storage.h. */ /* N is the oldest generation being collected, where the generations From git at git.haskell.org Mon Apr 16 18:59:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 Apr 2018 18:59:12 +0000 (UTC) Subject: [commit: ghc] master: Remove markSignalHandlers (4d30bc8) Message-ID: <20180416185912.0DABC3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4d30bc869dba8480fad2487911e828aab6ffd53c/ghc >--------------------------------------------------------------- commit 4d30bc869dba8480fad2487911e828aab6ffd53c Author: Ömer Sinan Ağacan Date: Mon Apr 16 21:58:21 2018 +0300 Remove markSignalHandlers It's no-op on all platforms Reviewers: bgamari, simonmar, erikd, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4588 >--------------------------------------------------------------- 4d30bc869dba8480fad2487911e828aab6ffd53c rts/RtsSignals.h | 8 -------- rts/posix/Signals.c | 10 ---------- rts/sm/GC.c | 5 ----- rts/win32/ConsoleHandler.c | 12 ------------ 4 files changed, 35 deletions(-) diff --git a/rts/RtsSignals.h b/rts/RtsSignals.h index d417603..b0add67 100644 --- a/rts/RtsSignals.h +++ b/rts/RtsSignals.h @@ -51,14 +51,6 @@ void freeSignalHandlers(void); */ void awaitUserSignals(void); -/* - * Function: markSignalHandlers() - * - * Evacuate the handler queue. _Assumes_ that console event delivery - * has already been blocked. - */ -void markSignalHandlers (evac_fn evac, void *user); - #include "EndPrivate.h" #endif /* RTS_USER_SIGNALS */ diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index cf45019..4cd1e38 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -488,16 +488,6 @@ startSignalHandlers(Capability *cap) } #endif -/* ---------------------------------------------------------------------------- - * Mark signal handlers during GC. - * -------------------------------------------------------------------------- */ - -void -markSignalHandlers (evac_fn evac STG_UNUSED, void *user STG_UNUSED) -{ - // nothing to do -} - #else /* !RTS_USER_SIGNALS */ StgInt stg_sig_install(StgInt sig STG_UNUSED, diff --git a/rts/sm/GC.c b/rts/sm/GC.c index e52400e..cadf557 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -402,11 +402,6 @@ GarbageCollect (uint32_t collect_gen, markScheduler(mark_root, gct); -#if defined(RTS_USER_SIGNALS) - // mark the signal handlers (signals should be already blocked) - markSignalHandlers(mark_root, gct); -#endif - // Mark the weak pointer list, and prepare to detect dead weak pointers. markWeakPtrList(); initWeakForGC(); diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c index 88c4a61..545a76a 100644 --- a/rts/win32/ConsoleHandler.c +++ b/rts/win32/ConsoleHandler.c @@ -199,18 +199,6 @@ void startSignalHandlers(Capability *cap) } #endif /* !THREADED_RTS */ -/* - * Function: markSignalHandlers() - * - * Evacuate the handler stack. _Assumes_ that console event delivery - * has already been blocked. - */ -void markSignalHandlers (evac_fn evac STG_UNUSED, void *user STG_UNUSED) -{ - // nothing to mark; the console handler is a StablePtr which is - // already treated as a root by the GC. -} - /* * Function: generic_handler() From git at git.haskell.org Tue Apr 17 02:17:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 02:17:54 +0000 (UTC) Subject: [commit: ghc] wip/no-exnstr: Merge branch 'master' into wip/no-exnstr (a1cc538) Message-ID: <20180417021754.2E8743AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-exnstr Link : http://ghc.haskell.org/trac/ghc/changeset/a1cc538a145993c0df5b4d482a54a46457ba15ed/ghc >--------------------------------------------------------------- commit a1cc538a145993c0df5b4d482a54a46457ba15ed Merge: e6f1a79 4d30bc8 Author: David Feuer Date: Mon Apr 16 22:16:57 2018 -0400 Merge branch 'master' into wip/no-exnstr >--------------------------------------------------------------- a1cc538a145993c0df5b4d482a54a46457ba15ed compiler/main/DynFlags.hs | 3 - compiler/prelude/PrelRules.hs | 305 +-------------------- docs/users_guide/8.6.1-notes.rst | 4 + includes/rts/storage/Closures.h | 2 +- rts/RtsSignals.h | 8 - rts/posix/Signals.c | 10 - rts/sm/GC.c | 7 +- rts/win32/ConsoleHandler.c | 12 - .../simplCore/should_compile/spec-inline.stderr | 38 ++- 9 files changed, 44 insertions(+), 345 deletions(-) From git at git.haskell.org Tue Apr 17 02:17:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 02:17:56 +0000 (UTC) Subject: [commit: ghc] wip/no-exnstr's head updated: Merge branch 'master' into wip/no-exnstr (a1cc538) Message-ID: <20180417021756.57ACB3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/no-exnstr' now includes: 09128f3 users guide: Note improved constant folding in 8.6 release notes 0e37361 Revert "Enhanced constant folding" 90283b5 rts: Comment wibbles 4d30bc8 Remove markSignalHandlers a1cc538 Merge branch 'master' into wip/no-exnstr From git at git.haskell.org Tue Apr 17 14:22:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:22:01 +0000 (UTC) Subject: [commit: ghc] master: Minor comments in CSE (7889659) Message-ID: <20180417142201.399673AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/788965922facefb6cf666a9fcf71a12f847072d7/ghc >--------------------------------------------------------------- commit 788965922facefb6cf666a9fcf71a12f847072d7 Author: Simon Peyton Jones Date: Mon Apr 16 13:56:08 2018 +0100 Minor comments in CSE >--------------------------------------------------------------- 788965922facefb6cf666a9fcf71a12f847072d7 compiler/simplCore/CSE.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index ee3a1eb..af447e6 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -276,8 +276,8 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. (#13219) -Note [Don’t tryForCSE the RHS of a Join Point] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [Look inside join-point binders] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Another way how CSE for joint points is tricky is let join foo x = (x, 42) @@ -293,9 +293,9 @@ naively, CSE would turn this into but now bar is a join point that claims arity one, but its right-hand side is not a lambda, breaking the join-point invariant (this was #15002). -Therefore, `cse_bind` will zoom past the lambdas of a join point (using -`collectNBinders`) and resume searching for CSE opportunities only in the body -of the join point. +So `cse_bind` must zoom past the lambdas of a join point (using +`collectNBinders`) and resume searching for CSE opportunities only in +the body of the join point. Note [CSE for recursive bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -372,10 +372,10 @@ cse_bind :: TopLevelFlag -> CSEnv -> (InId, InExpr) -> OutId -> (CSEnv, (OutId, cse_bind toplevel env (in_id, in_rhs) out_id | isTopLevel toplevel, exprIsTickedString in_rhs -- See Note [Take care with literal strings] - = (env', (out_id, in_rhs)) + = (env', (out_id', in_rhs)) | Just arity <- isJoinId_maybe in_id - -- See Note [Don’t tryForCSE the RHS of a Join Point] + -- See Note [Look inside join-point binders] = let (params, in_body) = collectNBinders arity in_rhs (env', params') = addBinders env params out_body = tryForCSE env' in_body @@ -384,8 +384,8 @@ cse_bind toplevel env (in_id, in_rhs) out_id | otherwise = (env', (out_id', out_rhs)) where - out_rhs = tryForCSE env in_rhs (env', out_id') = addBinding env in_id out_id out_rhs + out_rhs = tryForCSE env in_rhs addBinding :: CSEnv -- Includes InId->OutId cloning -> InVar -- Could be a let-bound type From git at git.haskell.org Tue Apr 17 14:22:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:22:04 +0000 (UTC) Subject: [commit: ghc] master: Comments only (fe325d3) Message-ID: <20180417142204.087B73AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe325d3dc3750274c742b9814bf7915f17546e7c/ghc >--------------------------------------------------------------- commit fe325d3dc3750274c742b9814bf7915f17546e7c Author: Simon Peyton Jones Date: Tue Apr 17 13:19:40 2018 +0100 Comments only Deleting misleading comments, to fix Trac #15047 >--------------------------------------------------------------- fe325d3dc3750274c742b9814bf7915f17546e7c compiler/rename/RnSource.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 07dcff2..8bea770 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -113,7 +113,6 @@ rnSrcDecls group@(HsGroup { hs_valds = val_decls, -- -- * Class ops, data constructors, and record fields, -- because they do not have value declarations. - -- Aso step (C) depends on datacons and record fields -- -- * For hs-boot files, include the value signatures -- Again, they have no value declarations @@ -132,8 +131,7 @@ rnSrcDecls group@(HsGroup { hs_valds = val_decls, extendPatSynEnv val_decls local_fix_env $ \pat_syn_bndrs -> do { -- (D2) Rename the left-hand sides of the value bindings. - -- This depends on everything from (B) being in scope, - -- and on (C) for resolving record wild cards. + -- This depends on everything from (B) being in scope. -- It uses the fixity env from (A) to bind fixities for view patterns. new_lhs <- rnTopBindsLHS local_fix_env val_decls ; From git at git.haskell.org Tue Apr 17 14:32:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:32:50 +0000 (UTC) Subject: [commit: packages/terminfo] master: Removed Repeated feild Category (#29) (863d77c) Message-ID: <20180417143250.38C3A3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/863d77cd6c2a0ae5411b383dc93d01e345486305 >--------------------------------------------------------------- commit 863d77cd6c2a0ae5411b383dc93d01e345486305 Author: Chitrak Raj Gupta Date: Mon Mar 5 10:22:39 2018 +0530 Removed Repeated feild Category (#29) >--------------------------------------------------------------- 863d77cd6c2a0ae5411b383dc93d01e345486305 terminfo.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/terminfo.cabal b/terminfo.cabal index 3284525..4f37a4d 100644 --- a/terminfo.cabal +++ b/terminfo.cabal @@ -7,7 +7,6 @@ License-File: LICENSE Copyright: (c) Judah Jacobson Author: Judah Jacobson Maintainer: Judah Jacobson -Category: User Interfaces Synopsis: Haskell bindings to the terminfo library. Description: This library provides an interface to the terminfo database (via bindings to the curses library). allows POSIX From git at git.haskell.org Tue Apr 17 14:32:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:32:52 +0000 (UTC) Subject: [commit: packages/terminfo] master: Bump upper bound on base to < 4.13 (16ac4a4) Message-ID: <20180417143252.3D8483AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/16ac4a4035d5341d1c2ab378e70803ece045bed4 >--------------------------------------------------------------- commit 16ac4a4035d5341d1c2ab378e70803ece045bed4 Author: Ryan Scott Date: Tue Apr 10 07:44:03 2018 -0400 Bump upper bound on base to < 4.13 See https://ghc.haskell.org/trac/ghc/ticket/15018. >--------------------------------------------------------------- 16ac4a4035d5341d1c2ab378e70803ece045bed4 terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminfo.cabal b/terminfo.cabal index 4f37a4d..ae819c4 100644 --- a/terminfo.cabal +++ b/terminfo.cabal @@ -28,7 +28,7 @@ Library other-extensions: CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables if impl(ghc>=7.3) other-extensions: Safe, Trustworthy - build-depends: base >= 4.3 && < 4.12 + build-depends: base >= 4.3 && < 4.13 ghc-options: -Wall exposed-modules: System.Console.Terminfo From git at git.haskell.org Tue Apr 17 14:32:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:32:54 +0000 (UTC) Subject: [commit: packages/terminfo] master: Merge pull request #30 from RyanGlScott/patch-1 (72a08c5) Message-ID: <20180417143254.428033AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/72a08c5435c332bdfd0444dd3ab3fad96e401da1 >--------------------------------------------------------------- commit 72a08c5435c332bdfd0444dd3ab3fad96e401da1 Merge: 863d77c 16ac4a4 Author: Judah Jacobson Date: Sun Apr 15 18:25:57 2018 -0700 Merge pull request #30 from RyanGlScott/patch-1 Bump upper bound on base to < 4.13 >--------------------------------------------------------------- 72a08c5435c332bdfd0444dd3ab3fad96e401da1 terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Tue Apr 17 14:33:09 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:33:09 +0000 (UTC) Subject: [commit: packages/haskeline] master: Bump upper bound on base to < 4.13 (1acbc27) Message-ID: <20180417143309.C4A3C3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/1acbc2721ca4b5833a6e88b3704ee23dc5734a16 >--------------------------------------------------------------- commit 1acbc2721ca4b5833a6e88b3704ee23dc5734a16 Author: Ryan Scott Date: Tue Apr 10 07:42:56 2018 -0400 Bump upper bound on base to < 4.13 See https://ghc.haskell.org/trac/ghc/ticket/15018. >--------------------------------------------------------------- 1acbc2721ca4b5833a6e88b3704ee23dc5734a16 haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskeline.cabal b/haskeline.cabal index 991a402..8df52a6 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -43,7 +43,7 @@ Library -- We require ghc>=7.4.1 (base>=4.5) to use the base library encodings, even -- though it was implemented in earlier releases, due to GHC bug #5436 which -- wasn't fixed until 7.4.1 - Build-depends: base >=4.5 && < 4.12, containers>=0.4 && < 0.6, + Build-depends: base >=4.5 && < 4.13, 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.7, stm >= 2.4 && < 2.5 From git at git.haskell.org Tue Apr 17 14:33:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:33:11 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #81 from RyanGlScott/patch-1 (ba6ae80) Message-ID: <20180417143311.CB42F3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/ba6ae8011f052b18c683f99b4a3db6cca1aa1678 >--------------------------------------------------------------- commit ba6ae8011f052b18c683f99b4a3db6cca1aa1678 Merge: 019e08f 1acbc27 Author: Judah Jacobson Date: Sun Apr 15 18:25:42 2018 -0700 Merge pull request #81 from RyanGlScott/patch-1 Bump upper bound on base to < 4.13 >--------------------------------------------------------------- ba6ae8011f052b18c683f99b4a3db6cca1aa1678 haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Tue Apr 17 14:33:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:33:13 +0000 (UTC) Subject: [commit: packages/haskeline] master: Bump upper bound on unix to < 2.9 (1732a6d) Message-ID: <20180417143313.D05243AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/1732a6d02ed834f810c2a88bee3d2a176ed5773f >--------------------------------------------------------------- commit 1732a6d02ed834f810c2a88bee3d2a176ed5773f Author: Ryan Scott Date: Mon Apr 16 08:30:27 2018 -0400 Bump upper bound on unix to < 2.9 See https://ghc.haskell.org/trac/ghc/ticket/15042. >--------------------------------------------------------------- 1732a6d02ed834f810c2a88bee3d2a176ed5773f haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskeline.cabal b/haskeline.cabal index 8df52a6..84cd0e0 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -95,7 +95,7 @@ Library install-includes: win_console.h cpp-options: -DMINGW } else { - Build-depends: unix>=2.0 && < 2.8 + Build-depends: unix>=2.0 && < 2.9 Other-modules: System.Console.Haskeline.Backend.Posix System.Console.Haskeline.Backend.Posix.Encoder From git at git.haskell.org Tue Apr 17 14:33:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 14:33:15 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #82 from RyanGlScott/master (481b890) Message-ID: <20180417143315.D627E3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/481b890e8616d9e85da69173d5079ad49f9fb83d >--------------------------------------------------------------- commit 481b890e8616d9e85da69173d5079ad49f9fb83d Merge: ba6ae80 1732a6d Author: Judah Jacobson Date: Mon Apr 16 07:20:01 2018 -0700 Merge pull request #82 from RyanGlScott/master Bump upper bound on unix to < 2.9 >--------------------------------------------------------------- 481b890e8616d9e85da69173d5079ad49f9fb83d haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Tue Apr 17 15:15:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 15:15:00 +0000 (UTC) Subject: [commit: ghc] master: Fix markup in the UNPACK pragma section of the user's guide. (4a16804) Message-ID: <20180417151500.F3FA73AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4a168043f1b584dc201b5af48870ab6498b8a830/ghc >--------------------------------------------------------------- commit 4a168043f1b584dc201b5af48870ab6498b8a830 Author: theindigamer Date: Sat Apr 14 19:17:04 2018 -0400 Fix markup in the UNPACK pragma section of the user's guide. The ticket 5252 wasn't linked earlier. >--------------------------------------------------------------- 4a168043f1b584dc201b5af48870ab6498b8a830 docs/users_guide/glasgow_exts.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index e2d2033..26b7957 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -14406,11 +14406,8 @@ See also the :ghc-flag:`-funbox-strict-fields` flag, which essentially has the effect of adding ``{-# UNPACK #-}`` to every strict constructor field. .. [1] - in fact, UNPACK has no effect without - -O - , for technical reasons (see - tick 5252 - ) + In fact, ``UNPACK`` has no effect without :ghc-flag:`-O`, for technical + reasons (see :ghc-ticket:`5252`). .. _nounpack-pragma: From git at git.haskell.org Tue Apr 17 15:15:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 15:15:16 +0000 (UTC) Subject: [commit: ghc] master: Proper safe coercions paper link (cab3e6b) Message-ID: <20180417151516.5FC493AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cab3e6bfa8486c6c8eecac269c54d662f1371a0c/ghc >--------------------------------------------------------------- commit cab3e6bfa8486c6c8eecac269c54d662f1371a0c Author: Kirill Zaborsky Date: Tue Apr 17 10:29:19 2018 +0300 Proper safe coercions paper link >--------------------------------------------------------------- cab3e6bfa8486c6c8eecac269c54d662f1371a0c libraries/ghc-prim/GHC/Types.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index 215f96c..ce526b4 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -260,7 +260,7 @@ class a ~~ b -- @type role Set nominal@ -- -- For more details about this feature, please refer to --- +-- -- by Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones and Stephanie Weirich. -- -- @since 4.7.0.0 From git at git.haskell.org Tue Apr 17 22:18:41 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 Apr 2018 22:18:41 +0000 (UTC) Subject: [commit: ghc] master: Introduce a $tooldir variable for nicer toolchain detection on Windows (5d76846) Message-ID: <20180417221841.3AD4A3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5d76846405240c051b00cddcda9d8d02c880968e/ghc >--------------------------------------------------------------- commit 5d76846405240c051b00cddcda9d8d02c880968e Author: Alp Mestanogullari Date: Tue Apr 17 23:04:11 2018 +0100 Introduce a $tooldir variable for nicer toolchain detection on Windows Summary: This patch affects several files that affect how we detect mingw and perl on Windows. The initial motivation is: https://github.com/snowleopard/hadrian/issues/564 where, with Hadrian building relocatable (non-inplace) GHCs, the current detection mechanism falls short by e.g only trying $topdir/../mingw. But in Hadrian, for reasons given in that issue, we would need to store e.g mingw under $topdir/../../mingw except for binary distributions, where we want to follow the existing structure, in which case $topdir/../mingw is correct. So we need to support both, which is what this patch hopefully implements. Test Plan: ./validate Reviewers: Phyx, hvr, bgamari, erikd Reviewed By: Phyx Subscribers: snowleopard, thomie, carter Differential Revision: https://phabricator.haskell.org/D4598 >--------------------------------------------------------------- 5d76846405240c051b00cddcda9d8d02c880968e aclocal.m4 | 16 +++++----- compiler/main/SysTools.hs | 24 +++++++++------ compiler/main/SysTools/BaseDir.hs | 64 +++++++++++++++++++++++++++++++++++---- 3 files changed, 80 insertions(+), 24 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 5d76846405240c051b00cddcda9d8d02c880968e From git at git.haskell.org Thu Apr 19 12:52:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 12:52:54 +0000 (UTC) Subject: [commit: ghc] master: Fix #14710 with more validity checks during renaming (447d126) Message-ID: <20180419125254.708573AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/447d1264abcd52bdd98267d109bfc1ff1c96ad27/ghc >--------------------------------------------------------------- commit 447d1264abcd52bdd98267d109bfc1ff1c96ad27 Author: Ryan Scott Date: Thu Apr 19 08:30:53 2018 -0400 Fix #14710 with more validity checks during renaming Summary: #14710 revealed two unfortunate regressions related to kind polymorphism that had crept in in recent GHC releases: 1. While GHC was able to catch illegal uses of kind polymorphism (i.e., if `PolyKinds` wasn't enabled) in limited situations, it wasn't able to catch kind polymorphism of the following form: ```lang=haskell f :: forall a. a -> a f x = const x g where g :: Proxy (x :: a) g = Proxy ``` Note that the variable `a` is being used as a kind variable in the type signature of `g`, but GHC happily accepts it, even without the use of `PolyKinds`. 2. If you have `PolyKinds` (but not `TypeInType`) enabled, then GHC incorrectly accepts the following definition: ```lang=haskell f :: forall k (a :: k). Proxy a f = Proxy ``` Even though `k` is explicitly bound and then later used as a kind variable within the same telescope. This patch fixes these two bugs as follows: 1. Whenever we rename any `HsTyVar`, we check if the following three criteria are met: (a) It's a type variable (b) It's used at the kind level (c) `PolyKinds` is not enabled If so, then we have found an illegal use of kind polymorphism, so throw an error. This check replaces the `checkBadKindBndrs` function, which could only catch illegal uses of kind polymorphism in very limited situations (when the bad kind variable happened to be implicitly quantified in the same type signature). 2. In `extract_hs_tv_bndrs`, we must error if `TypeInType` is not enabled and either of the following criteria are met: (a) An explicitly bound type variable is used in kind position in the body of a `forall` type. (b) An explicitly bound type variable is used in kind position in the kind of a bound type variable in a `forall` type. `extract_hs_tv_bndrs` was checking (a), but not (b). Easily fixed. Test Plan: ./validate Reviewers: goldfire, simonpj, bgamari, hvr Reviewed By: simonpj Subscribers: thomie, carter GHC Trac Issues: #14710 Differential Revision: https://phabricator.haskell.org/D4554 >--------------------------------------------------------------- 447d1264abcd52bdd98267d109bfc1ff1c96ad27 compiler/rename/RnSource.hs | 2 +- compiler/rename/RnTypes.hs | 84 +++++++++++++++++------------ docs/users_guide/8.6.1-notes.rst | 19 +++++++ libraries/base/GHC/Base.hs | 1 + testsuite/tests/polykinds/BadKindVar.stderr | 5 +- testsuite/tests/polykinds/T14710.hs | 25 +++++++++ testsuite/tests/polykinds/T14710.stderr | 38 +++++++++++++ testsuite/tests/polykinds/all.T | 1 + 8 files changed, 139 insertions(+), 36 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 447d1264abcd52bdd98267d109bfc1ff1c96ad27 From git at git.haskell.org Thu Apr 19 12:52:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 12:52:57 +0000 (UTC) Subject: [commit: ghc] master: Bump unix submodule to version 2.8.0.0 (2fdfe05) Message-ID: <20180419125257.3F28F3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fdfe056812ec469a05f46f228ef076942297b5f/ghc >--------------------------------------------------------------- commit 2fdfe056812ec469a05f46f228ef076942297b5f Author: Ryan Scott Date: Thu Apr 19 08:31:08 2018 -0400 Bump unix submodule to version 2.8.0.0 Summary: Requires bumping several submodules. Test Plan: ./validate Reviewers: hvr, bgamari Subscribers: thomie, carter GHC Trac Issues: #15042 Differential Revision: https://phabricator.haskell.org/D4604 >--------------------------------------------------------------- 2fdfe056812ec469a05f46f228ef076942297b5f compiler/ghc.cabal.in | 2 +- ghc/ghc-bin.cabal.in | 2 +- iserv/iserv-bin.cabal | 4 ++-- libraries/Cabal | 2 +- libraries/base/tests/IO/T2122.hs | 4 ++-- libraries/base/tests/T7773.hs | 2 +- libraries/directory | 2 +- libraries/ghci/ghci.cabal.in | 2 +- libraries/haskeline | 2 +- libraries/process | 2 +- libraries/unix | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 36dc437..2a4d975 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -71,7 +71,7 @@ Library else if flag(terminfo) Build-Depends: terminfo == 0.4.* - Build-Depends: unix == 2.7.* + Build-Depends: unix >= 2.7 && < 2.9 GHC-Options: -Wall -Wno-name-shadowing diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index c94c6f8..12812ef 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -40,7 +40,7 @@ Executable ghc if os(windows) Build-Depends: Win32 >= 2.3 && < 2.7 else - Build-Depends: unix == 2.7.* + Build-Depends: unix >= 2.7 && < 2.9 C-Sources: hschooks.c diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index a713e6f..b269509 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -92,7 +92,7 @@ Library if os(windows) Cpp-Options: -DWINDOWS else - Build-Depends: unix >= 2.7 && < 2.8 + Build-Depends: unix >= 2.7 && < 2.9 Executable iserv Default-Language: Haskell2010 @@ -117,7 +117,7 @@ Executable iserv if os(windows) Cpp-Options: -DWINDOWS else - Build-Depends: unix >= 2.7 && < 2.8 + Build-Depends: unix >= 2.7 && < 2.9 Executable iserv-proxy If flag(proxy) diff --git a/libraries/Cabal b/libraries/Cabal index c219cd3..335fa8d 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit c219cd3f31c8e4e4bc71f93bbcd4de87830a986d +Subproject commit 335fa8d82520bad1a6980fd55230e65889c99860 diff --git a/libraries/base/tests/IO/T2122.hs b/libraries/base/tests/IO/T2122.hs index 9a8badc..488d243 100644 --- a/libraries/base/tests/IO/T2122.hs +++ b/libraries/base/tests/IO/T2122.hs @@ -51,9 +51,9 @@ test causeFailure = -- probably because openFd does not try to lock the file test2 :: Bool -> IO () test2 causeFailure = - do fd1 <- openFd fp ReadOnly Nothing defaultFileFlags `catchIOError` (\e -> error ("openFile 1: " ++ show e)) + do fd1 <- openFd fp ReadOnly defaultFileFlags `catchIOError` (\e -> error ("openFile 1: " ++ show e)) when causeFailure $ do - fd2 <- openFd fp ReadOnly Nothing defaultFileFlags `catchIOError` (\e -> error ("openFile 2: " ++ show e)) + fd2 <- openFd fp ReadOnly defaultFileFlags `catchIOError` (\e -> error ("openFile 2: " ++ show e)) closeFd fd2 closeFd fd1 removeFile fp diff --git a/libraries/base/tests/T7773.hs b/libraries/base/tests/T7773.hs index 495cd7a..7f73b12 100644 --- a/libraries/base/tests/T7773.hs +++ b/libraries/base/tests/T7773.hs @@ -3,7 +3,7 @@ import System.Posix.IO main = do putStrLn "hello" - fd <- openFd "/dev/random" ReadOnly Nothing defaultFileFlags + fd <- openFd "/dev/random" ReadOnly defaultFileFlags threadWaitRead fd putStrLn "goodbye" diff --git a/libraries/directory b/libraries/directory index 6f3a182..9c474f0 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 6f3a1823b56f47cc17a9d39897965d47d6b2cbb4 +Subproject commit 9c474f0d287b143c43dff275db0640d358e323cc diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in index 595f8de..05655d0 100644 --- a/libraries/ghci/ghci.cabal.in +++ b/libraries/ghci/ghci.cabal.in @@ -81,4 +81,4 @@ library transformers == 0.5.* if !os(windows) - Build-Depends: unix == 2.7.* + Build-Depends: unix >= 2.7 && < 2.9 diff --git a/libraries/haskeline b/libraries/haskeline index 019e08f..481b890 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 019e08f2c91b7cc45e5fb98189193a9f5c2d2d57 +Subproject commit 481b890e8616d9e85da69173d5079ad49f9fb83d diff --git a/libraries/process b/libraries/process index 7c0b581..78c338b 160000 --- a/libraries/process +++ b/libraries/process @@ -1 +1 @@ -Subproject commit 7c0b58141290b50a338bf391adc0a8c43513165b +Subproject commit 78c338b2ad06f0a3ed4ace7d95cc68ddb87ab207 diff --git a/libraries/unix b/libraries/unix index 41c5776..c9ec0b0 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 41c5776162b60e0739a7559ceab03b9c3a444516 +Subproject commit c9ec0b00012e5eb447ff021091f86efe31be8abf From git at git.haskell.org Thu Apr 19 16:23:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 16:23:47 +0000 (UTC) Subject: [commit: ghc] master: Add a test case from the nested CPR work (19ddd04) Message-ID: <20180419162347.A39CC3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/19ddd04474a7bf7cff9c5a971cb908c7c06f100a/ghc >--------------------------------------------------------------- commit 19ddd04474a7bf7cff9c5a971cb908c7c06f100a Author: Ben Gamari Date: Tue Apr 17 12:46:13 2018 -0400 Add a test case from the nested CPR work Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4565 >--------------------------------------------------------------- 19ddd04474a7bf7cff9c5a971cb908c7c06f100a testsuite/tests/stranal/sigs/CaseBinderCPR.hs | 15 +++++++++++++++ testsuite/tests/stranal/sigs/CaseBinderCPR.stderr | 12 ++++++++++++ testsuite/tests/stranal/sigs/all.T | 1 + 3 files changed, 28 insertions(+) diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.hs b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs new file mode 100644 index 0000000..13f2163 --- /dev/null +++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs @@ -0,0 +1,15 @@ +module CaseBinderCPR where + +-- This example, taken from nofib's transform (and heavily reduced) ensures that +-- CPR information is added to a case binder + +f_list_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> Int; +f_list_cmp a_cmp [] []= 0 +f_list_cmp a_cmp [] a_ys= -1 +f_list_cmp a_cmp a_xs []= 1 +f_list_cmp a_cmp (a_x:a_xs) (a_y:a_ys)= + if r_order == 0 + then f_list_cmp a_cmp a_xs a_ys + else r_order + where + r_order = a_cmp a_x a_y diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr new file mode 100644 index 0000000..f708813 --- /dev/null +++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr @@ -0,0 +1,12 @@ + +==================== Strictness signatures ==================== +CaseBinderCPR.$trModule: m +CaseBinderCPR.f_list_cmp: m + + + +==================== Strictness signatures ==================== +CaseBinderCPR.$trModule: m +CaseBinderCPR.f_list_cmp: m + + diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T index f28cda7..091a4f4 100644 --- a/testsuite/tests/stranal/sigs/all.T +++ b/testsuite/tests/stranal/sigs/all.T @@ -16,3 +16,4 @@ test('UnsatFun', normal, compile, ['']) test('BottomFromInnerLambda', normal, compile, ['']) test('DmdAnalGADTs', normal, compile, ['']) test('T12370', normal, compile, ['']) +test('CaseBinderCPR', normal, compile, ['']) From git at git.haskell.org Thu Apr 19 16:24:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 16:24:01 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Override mathjax_path (803178a) Message-ID: <20180419162401.C66583AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/803178a5383cdb5383e5b9fedd8feb3d65f9183b/ghc >--------------------------------------------------------------- commit 803178a5383cdb5383e5b9fedd8feb3d65f9183b Author: Ben Gamari Date: Thu Apr 19 11:28:19 2018 -0400 users-guide: Override mathjax_path The Mathjax CDN no longer exists. Use CDNJS instead. See #15006. Test Plan: Build HTML users guide, see whether math is rendered. Reviewers: alpmestan Reviewed By: alpmestan Subscribers: thomie, carter GHC Trac Issues: #15006 Differential Revision: https://phabricator.haskell.org/D4603 >--------------------------------------------------------------- 803178a5383cdb5383e5b9fedd8feb3d65f9183b docs/users_guide/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/users_guide/conf.py b/docs/users_guide/conf.py index ef7b9d5..0732c5c 100644 --- a/docs/users_guide/conf.py +++ b/docs/users_guide/conf.py @@ -57,6 +57,9 @@ html_use_smartypants = True html_use_opensearch = 'https://downloads.haskell.org/~ghc/master/users-guide' html_show_copyright = True +# See GHC #15006 +mathjax_path = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js' + # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. From git at git.haskell.org Thu Apr 19 16:24:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 16:24:16 +0000 (UTC) Subject: [commit: ghc] master: rts: fix format arguments for debugBelch calls on 32-bit systems (48b8842) Message-ID: <20180419162416.4FD053AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48b88421995b121b62d5b6a1890e61252d49ce90/ghc >--------------------------------------------------------------- commit 48b88421995b121b62d5b6a1890e61252d49ce90 Author: Sergei Trofimovich Date: Thu Apr 19 11:28:46 2018 -0400 rts: fix format arguments for debugBelch calls on 32-bit systems This change fixes build failure like this: ``` rts/Stats.c:1467:14: error: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format=] debugBelch("%51s%9" FMT_Word " %9" FMT_Word "\n", ^~~~~~~~ "",tot_live*sizeof(W_),tot_slop*sizeof(W_)); ~~~~~~~~~~~~~~~~~~~ ``` The fix is to cast sizeof() result to Word (W_). Signed-off-by: Sergei Trofimovich Test Plan: build for 32-bit target Reviewers: bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4608 >--------------------------------------------------------------- 48b88421995b121b62d5b6a1890e61252d49ce90 rts/Printer.c | 2 +- rts/Stats.c | 2 +- rts/sm/Sanity.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/Printer.c b/rts/Printer.c index 702e490..87a2cb1 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -409,7 +409,7 @@ printClosure( const StgClosure *obj ) case COMPACT_NFDATA: debugBelch("COMPACT_NFDATA(size=%" FMT_Word ")\n", - (W_)((StgCompactNFData *)obj)->totalW * sizeof(W_)); + (W_)((StgCompactNFData *)obj)->totalW * (W_)sizeof(W_)); break; diff --git a/rts/Stats.c b/rts/Stats.c index 44b6e2d..3d03d49 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -1465,7 +1465,7 @@ statDescribeGens(void) } debugBelch("----------------------------------------------------------------------\n"); debugBelch("%51s%9" FMT_Word " %9" FMT_Word "\n", - "",tot_live*sizeof(W_),tot_slop*sizeof(W_)); + "",tot_live*(W_)sizeof(W_),tot_slop*(W_)sizeof(W_)); debugBelch("----------------------------------------------------------------------\n"); debugBelch("\n"); } diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 53b1010..7a0ad16 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -859,7 +859,7 @@ void findSlop(bdescr *bd) slop = (bd->blocks * BLOCK_SIZE_W) - (bd->free - bd->start); if (slop > (1024/sizeof(W_))) { debugBelch("block at %p (bdescr %p) has %" FMT_Word "KB slop\n", - bd->start, bd, slop / (1024/sizeof(W_))); + bd->start, bd, slop / (1024/(W_)sizeof(W_))); } } } From git at git.haskell.org Thu Apr 19 16:24:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 16:24:31 +0000 (UTC) Subject: [commit: ghc] master: Add a test for #14815: (f7f567d) Message-ID: <20180419162431.501093AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f7f567d5003d15308bf5404301e29300b664e770/ghc >--------------------------------------------------------------- commit f7f567d5003d15308bf5404301e29300b664e770 Author: Ömer Sinan Ağacan Date: Thu Apr 19 11:32:26 2018 -0400 Add a test for #14815: Because the program doesn't have any binders that -XStrict can make strict, the desugarer output should be identical when it's compiled with and without -XStrict. This wasn't the case with GHC 8.2.2, but apparently it was fixed some time between 8.2.2 and 8.4.1. We now add a test case to make sure it stays fixed. Reviewers: bgamari Reviewed By: bgamari Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #14815 Differential Revision: https://phabricator.haskell.org/D4531 >--------------------------------------------------------------- f7f567d5003d15308bf5404301e29300b664e770 testsuite/tests/deSugar/should_compile/Makefile | 9 +++++ testsuite/tests/deSugar/should_compile/T14815.hs | 43 ++++++++++++++++++++++ .../tests/deSugar/should_compile/T14815.stdout | 2 + testsuite/tests/deSugar/should_compile/all.T | 1 + 4 files changed, 55 insertions(+) diff --git a/testsuite/tests/deSugar/should_compile/Makefile b/testsuite/tests/deSugar/should_compile/Makefile index 792d4e7..4600070 100644 --- a/testsuite/tests/deSugar/should_compile/Makefile +++ b/testsuite/tests/deSugar/should_compile/Makefile @@ -14,3 +14,12 @@ T5252Take2: $(RM) -f T5252Take2a.hi T5252Take2a.o '$(TEST_HC)' $(TEST_HC_OPTS) -c T5252Take2a.hs '$(TEST_HC)' $(TEST_HC_OPTS) -c T5252Take2.hs + +T14815: + '$(TEST_HC)' $(TEST_HC_OPTS) T14815.hs -ddump-ds -dsuppress-uniques -ddump-to-file -dumpdir lazy -fforce-recomp + '$(TEST_HC)' $(TEST_HC_OPTS) T14815.hs -XStrict -ddump-ds -dsuppress-uniques -ddump-to-file -dumpdir strict -fforce-recomp + # Drop time stamps from both files + tail -n +5 lazy/T14815.dump-ds >lazy_out + tail -n +5 strict/T14815.dump-ds >strict_out + # Finally compare outputs + diff lazy_out strict_out -q diff --git a/testsuite/tests/deSugar/should_compile/T14815.hs b/testsuite/tests/deSugar/should_compile/T14815.hs new file mode 100644 index 0000000..fc5a6ee --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T14815.hs @@ -0,0 +1,43 @@ +-- Desugarer outputs of this program when compiled with and without -XStrict +-- should be the same because this program has only one binder (`a` in function +-- `primitive`), but the binder is annotated with a laziness annotation, so +-- -XStrict should have no effect on that binder. +-- +-- Derived methods are also effected by -XStrict, but in our case we derive via +-- GND which just generates coercions like +-- +-- instance Functor m => Functor (StateT s m) where +-- fmap +-- = coerce +-- @(forall (a_aJ2 :: TYPE LiftedRep) (b_aJ3 :: TYPE LiftedRep). +-- a_aJ2 -> b_aJ3 +-- -> StateT s_aDW m_aDX a_aJ2 -> StateT s_aDW m_aDX b_aJ3) +-- @(forall (a_aJ2 :: TYPE LiftedRep) (b_aJ3 :: TYPE LiftedRep). +-- a_aJ2 -> b_aJ3 +-- -> StateT s_aDW m_aDX a_aJ2 -> StateT s_aDW m_aDX b_aJ3) +-- fmap +-- +-- So really -XStrict shouldn't have any effect on this program. + +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UnboxedTuples #-} + +module K where + +import qualified Control.Monad.State.Strict as S +import Control.Monad.Trans +import GHC.Exts + +class Monad m => PrimMonad m where + type PrimState m + primitive :: (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a + +newtype StateT s m a = StateT (S.StateT s m a) + deriving (Functor, Applicative, Monad, MonadTrans) + +instance PrimMonad m => PrimMonad (StateT s m) where + type PrimState (StateT s m) = PrimState m + primitive ~a = lift (primitive a) ; {-# INLINE primitive #-} diff --git a/testsuite/tests/deSugar/should_compile/T14815.stdout b/testsuite/tests/deSugar/should_compile/T14815.stdout new file mode 100644 index 0000000..f51afc4 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T14815.stdout @@ -0,0 +1,2 @@ +[1 of 1] Compiling K ( T14815.hs, T14815.o ) +[1 of 1] Compiling K ( T14815.hs, T14815.o ) diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 2608b7d..2d36146 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -102,3 +102,4 @@ test('T13870', normal, compile, ['']) test('T14135', normal, compile, ['']) test('T14773a', normal, compile, ['-Wincomplete-patterns']) test('T14773b', normal, compile, ['-Wincomplete-patterns']) +test('T14815', [], run_command, ['$MAKE -s --no-print-directory T14815']) From git at git.haskell.org Thu Apr 19 19:25:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 19:25:50 +0000 (UTC) Subject: [commit: ghc] master: Better error message for empty character literal, for Trac #13450. (cac8be6) Message-ID: <20180419192550.E8FCE3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cac8be611e7e80ed80e24b15faac9e1ac0a07247/ghc >--------------------------------------------------------------- commit cac8be611e7e80ed80e24b15faac9e1ac0a07247 Author: HE, Tao Date: Thu Apr 19 12:31:09 2018 -0400 Better error message for empty character literal, for Trac #13450. For empty character literal, the `''`, report error message properly rather than just throw a "parser error" with wrong error location. Test Plan: make test TEST="T13450 T13450TH" Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering, carter GHC Trac Issues: #13450 Differential Revision: https://phabricator.haskell.org/D4594 >--------------------------------------------------------------- cac8be611e7e80ed80e24b15faac9e1ac0a07247 compiler/parser/Parser.y | 58 ++++++++++++++++++---- testsuite/tests/parser/should_fail/T13450.hs | 4 ++ testsuite/tests/parser/should_fail/T13450.stderr | 4 ++ testsuite/tests/parser/should_fail/T13450TH.hs | 6 +++ testsuite/tests/parser/should_fail/T13450TH.stderr | 6 +++ testsuite/tests/parser/should_fail/all.T | 2 + 6 files changed, 70 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 cac8be611e7e80ed80e24b15faac9e1ac0a07247 From git at git.haskell.org Thu Apr 19 19:26:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 19:26:00 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix `./validate --slow` (d9d8015) Message-ID: <20180419192600.4A5BC3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d9d801516dccab88b8083d34b465ee9ca8deb92f/ghc >--------------------------------------------------------------- commit d9d801516dccab88b8083d34b465ee9ca8deb92f Author: Alp Mestanogullari Date: Thu Apr 19 12:40:21 2018 -0400 testsuite: Fix `./validate --slow` This fixes all unexpected passes and unexpected failures from a `./validate --slow` run I did last week. I commented on many tickets and created a few more as I was going through the failing tests. A summary of the entire process is available at: https://gist.github.com/alpmestan/c371840968f086c8dc5b56af8325f0a9 This is part of an attempt to have `./validate --slow` pass, tracked in #14890. Another patch will be necessary for the unexpected stats failures. Test Plan: ./validate --slow (not green yet) Reviewers: bgamari, simonmar Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4546 >--------------------------------------------------------------- d9d801516dccab88b8083d34b465ee9ca8deb92f testsuite/tests/codeGen/should_run/all.T | 2 -- testsuite/tests/deSugar/should_run/all.T | 4 +++- testsuite/tests/dependent/should_compile/all.T | 5 +---- testsuite/tests/driver/all.T | 4 ++-- testsuite/tests/numeric/should_compile/all.T | 2 +- testsuite/tests/parser/should_compile/all.T | 2 +- testsuite/tests/patsyn/should_run/all.T | 3 ++- testsuite/tests/rename/should_compile/all.T | 2 +- testsuite/tests/rts/all.T | 8 ++++++-- testsuite/tests/simplCore/should_compile/T13543.stderr | 10 ++++++++++ testsuite/tests/simplCore/should_compile/all.T | 2 +- testsuite/tests/simplCore/should_fail/all.T | 2 +- testsuite/tests/th/all.T | 2 +- testsuite/tests/typecheck/should_compile/all.T | 4 ++-- testsuite/tests/typecheck/should_run/all.T | 6 +++--- 15 files changed, 35 insertions(+), 23 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 d9d801516dccab88b8083d34b465ee9ca8deb92f From git at git.haskell.org Thu Apr 19 19:25:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 19:25:54 +0000 (UTC) Subject: [commit: ghc] master: Fix #15012 with a well-placed use of Any (b08a6d7) Message-ID: <20180419192554.8D4C53AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b08a6d75e0440f33260bea5319b8c3f871b42f6e/ghc >--------------------------------------------------------------- commit b08a6d75e0440f33260bea5319b8c3f871b42f6e Author: Ryan Scott Date: Thu Apr 19 12:36:42 2018 -0400 Fix #15012 with a well-placed use of Any Previously, derived `Generic1` instances could have associated `Rep1` type family instances with unbound variables, such as in the following example: ```lang=haskell data T a = MkT (FakeOut a) deriving Generic1 type FakeOut a = Int ==> instance Generic1 T where type Rep1 T = ... (Rec0 (FakeOut a)) ``` Yikes! To avoid this, we simply map the last type variable in a derived `Generic1` instance to `Any`. Test Plan: make test TEST=T15012 Reviewers: bgamari Reviewed By: bgamari Subscribers: simonpj, thomie, carter GHC Trac Issues: #15012 Differential Revision: https://phabricator.haskell.org/D4602 >--------------------------------------------------------------- b08a6d75e0440f33260bea5319b8c3f871b42f6e compiler/typecheck/TcGenGenerics.hs | 36 +++++++++++++++++++++++++++++++++++- testsuite/tests/generics/Makefile | 5 +++++ testsuite/tests/generics/T15012.hs | 7 +++++++ testsuite/tests/generics/T15012a.hs | 11 +++++++++++ testsuite/tests/generics/all.T | 2 ++ 5 files changed, 60 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcGenGenerics.hs b/compiler/typecheck/TcGenGenerics.hs index 61a432e9..9da9428 100644 --- a/compiler/typecheck/TcGenGenerics.hs +++ b/compiler/typecheck/TcGenGenerics.hs @@ -420,7 +420,15 @@ tc_mkRepFamInsts gk tycon inst_tys = -- type arguments before generating the Rep/Rep1 instance, since some -- of the tyvars might have been instantiated when deriving. -- See Note [Generating a correctly typed Rep instance]. - ; let env = zipTyEnv tyvars inst_args + ; let (env_tyvars, env_inst_args) + = case gk_ of + Gen0_ -> (tyvars, inst_args) + Gen1_ last_tv + -- See the "wrinkle" in + -- Note [Generating a correctly typed Rep instance] + -> ( last_tv : tyvars + , anyTypeOfKind (tyVarKind last_tv) : inst_args ) + env = zipTyEnv env_tyvars env_inst_args in_scope = mkInScopeSet (tyCoVarsOfTypes inst_tys) subst = mkTvSubst in_scope env repTy' = substTy subst repTy @@ -923,6 +931,32 @@ the tyConTyVars of the TyCon to their counterparts in the fully instantiated type. (For example, using T above as example, you'd map a :-> Int.) We then apply the substitution to the RHS before generating the instance. +A wrinkle in all of this: when forming the type variable substitution for +Generic1 instances, we map the last type variable of the tycon to Any. Why? +It's because of wily data types like this one (#15012): + + data T a = MkT (FakeOut a) + type FakeOut a = Int + +If we ignore a, then we'll produce the following Rep1 instance: + + instance Generic1 T where + type Rep1 T = ... (Rec0 (FakeOut a)) + ... + +Oh no! Now we have `a` on the RHS, but it's completely unbound. Instead, we +ensure that `a` is mapped to Any: + + instance Generic1 T where + type Rep1 T = ... (Rec0 (FakeOut Any)) + ... + +And now all is good. + +Alternatively, we could have avoided this problem by expanding all type +synonyms on the RHSes of Rep1 instances. But we might blow up the size of +these types even further by doing this, so we choose not to do so. + Note [Handling kinds in a Rep instance] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Because Generic1 is poly-kinded, the representation types were generalized to diff --git a/testsuite/tests/generics/Makefile b/testsuite/tests/generics/Makefile index 9a36a1c..69a5802 100644 --- a/testsuite/tests/generics/Makefile +++ b/testsuite/tests/generics/Makefile @@ -1,3 +1,8 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk + +T15012: + $(RM) T15012.hi T15012.o T15012a.hi T15012a.o + '$(TEST_HC)' $(TEST_HC_OPTS) -c T15012a.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -c T15012.hs diff --git a/testsuite/tests/generics/T15012.hs b/testsuite/tests/generics/T15012.hs new file mode 100644 index 0000000..388eddc --- /dev/null +++ b/testsuite/tests/generics/T15012.hs @@ -0,0 +1,7 @@ +module T15012 where + +import GHC.Generics +import T15012a + +blah :: IO () +blah = print $ from1 $ TyFamily 1 2 diff --git a/testsuite/tests/generics/T15012a.hs b/testsuite/tests/generics/T15012a.hs new file mode 100644 index 0000000..5109ea0 --- /dev/null +++ b/testsuite/tests/generics/T15012a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE TypeFamilies #-} +module T15012a where + +import GHC.Generics + +type FakeOut a = Int + +data family TyFamily y z +data instance TyFamily a b = TyFamily Int (FakeOut b) + deriving Generic1 diff --git a/testsuite/tests/generics/all.T b/testsuite/tests/generics/all.T index 1d4aeae..f127f78 100644 --- a/testsuite/tests/generics/all.T +++ b/testsuite/tests/generics/all.T @@ -43,3 +43,5 @@ test('T10361a', normal, compile, ['']) test('T10361b', normal, compile, ['']) test('T11358', normal, compile_and_run, ['']) test('T12220', normal, compile, ['']) +test('T15012', [extra_files(['T15012.hs', 'T15012a.hs'])], run_command, + ['$MAKE -s --no-print-directory T15012']) From git at git.haskell.org Thu Apr 19 19:25:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 19:25:57 +0000 (UTC) Subject: [commit: ghc] master: Bump base to version 4.12.0.0 (8f19ecc) Message-ID: <20180419192557.705FE3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f19ecc95fbaf2cc977531d721085d8441dc09b7/ghc >--------------------------------------------------------------- commit 8f19ecc95fbaf2cc977531d721085d8441dc09b7 Author: Ryan Scott Date: Thu Apr 19 12:38:17 2018 -0400 Bump base to version 4.12.0.0 Summary: Bumps several submodules. Test Plan: ./validate Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15018 Differential Revision: https://phabricator.haskell.org/D4609 >--------------------------------------------------------------- 8f19ecc95fbaf2cc977531d721085d8441dc09b7 libraries/array | 2 +- libraries/base/base.cabal | 2 +- libraries/deepseq | 2 +- libraries/filepath | 2 +- libraries/ghc-boot-th/ghc-boot-th.cabal.in | 2 +- libraries/ghc-boot/ghc-boot.cabal.in | 2 +- libraries/ghc-compact/ghc-compact.cabal | 2 +- libraries/ghci/ghci.cabal.in | 2 +- libraries/hpc | 2 +- libraries/parallel | 2 +- libraries/parsec | 2 +- libraries/stm | 2 +- libraries/template-haskell/template-haskell.cabal | 2 +- libraries/terminfo | 2 +- testsuite/tests/ado/ado004.stderr | 2 +- testsuite/tests/backpack/should_compile/bkp16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail17.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail19.stderr | 4 ++-- testsuite/tests/determinism/determ021/determ021.stdout | 4 ++-- testsuite/tests/driver/json2.stderr | 4 ++-- testsuite/tests/ghci/scripts/ghci008.stdout | 4 ++-- testsuite/tests/indexed-types/should_compile/T3017.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/AddAndOr1.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/AddAndOr2.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/AddAndOr3.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/AddAndOr4.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/AddAndOr5.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/AddAndOr6.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/BoolToBool.stderr | 2 +- .../partial-sigs/should_compile/DataFamilyInstanceLHS.stderr | 2 +- .../tests/partial-sigs/should_compile/Defaulting1MROn.stderr | 2 +- .../tests/partial-sigs/should_compile/Defaulting2MROff.stderr | 2 +- .../tests/partial-sigs/should_compile/Defaulting2MROn.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Either.stderr | 2 +- .../tests/partial-sigs/should_compile/EqualityConstraint.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Every.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ExpressionSig.stderr | 2 +- .../tests/partial-sigs/should_compile/ExpressionSigNamed.stderr | 2 +- .../tests/partial-sigs/should_compile/ExtraConstraints1.stderr | 2 +- .../tests/partial-sigs/should_compile/ExtraConstraints2.stderr | 2 +- .../tests/partial-sigs/should_compile/ExtraConstraints3.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ExtraNumAMROff.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ExtraNumAMROn.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Forall1.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/GenNamed.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/HigherRank1.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/HigherRank2.stderr | 2 +- .../tests/partial-sigs/should_compile/LocalDefinitionBug.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Meltdown.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/MonoLocalBinds.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr | 2 +- .../should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr | 2 +- .../tests/partial-sigs/should_compile/ParensAroundContext.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/PatBind.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/PatBind2.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/PatternSig.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Recursive.stderr | 2 +- .../tests/partial-sigs/should_compile/ScopedNamedWildcards.stderr | 2 +- .../partial-sigs/should_compile/ScopedNamedWildcardsGood.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/SkipMany.stderr | 2 +- .../tests/partial-sigs/should_compile/SomethingShowable.stderr | 2 +- .../partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Uncurry.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr | 2 +- .../should_compile/WarningWildcardInstantiations.stderr | 2 +- testsuite/tests/rename/should_fail/rnfail040.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 2 +- testsuite/tests/roles/should_compile/Roles14.stderr | 2 +- testsuite/tests/roles/should_compile/Roles2.stderr | 2 +- testsuite/tests/roles/should_compile/Roles3.stderr | 2 +- testsuite/tests/roles/should_compile/Roles4.stderr | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 2 +- testsuite/tests/safeHaskell/check/Check08.stderr | 2 +- testsuite/tests/safeHaskell/check/Check09.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 2 +- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 2 +- testsuite/tests/typecheck/should_compile/T12763.stderr | 2 +- testsuite/tests/typecheck/should_compile/holes.stderr | 8 ++++---- testsuite/tests/typecheck/should_compile/holes3.stderr | 8 ++++---- testsuite/tests/typecheck/should_compile/tc231.stderr | 2 +- .../tests/typecheck/should_fail/TcStaticPointersFail02.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 2 +- utils/haddock | 2 +- 92 files changed, 106 insertions(+), 106 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 8f19ecc95fbaf2cc977531d721085d8441dc09b7 From git at git.haskell.org Thu Apr 19 19:44:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 19:44:26 +0000 (UTC) Subject: [commit: ghc] master: parsec: Make version hack compatible with Windows (3c3e731) Message-ID: <20180419194426.26C7E3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3c3e73103a45c9acee1682300727bad7b6a62d30/ghc >--------------------------------------------------------------- commit 3c3e73103a45c9acee1682300727bad7b6a62d30 Author: Ben Gamari Date: Thu Apr 19 15:42:26 2018 -0400 parsec: Make version hack compatible with Windows Fixes D4609 on Windows by bumping parsec submodule. >--------------------------------------------------------------- 3c3e73103a45c9acee1682300727bad7b6a62d30 libraries/parsec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/parsec b/libraries/parsec index cd7a8e7..610d7aa 160000 --- a/libraries/parsec +++ b/libraries/parsec @@ -1 +1 @@ -Subproject commit cd7a8e7abf30728f66365edb8fbbfb05fe3234ae +Subproject commit 610d7aa58bb5d436aac47b7c03fa6a0f8cb82ba7 From git at git.haskell.org Thu Apr 19 22:57:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 22:57:23 +0000 (UTC) Subject: [commit: ghc] master: configure: Use -Werror to check for existence of -no-pie (cbd73bb) Message-ID: <20180419225723.C2C753AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cbd73bbbb7df080d5204098aa02e5f5d0d48823c/ghc >--------------------------------------------------------------- commit cbd73bbbb7df080d5204098aa02e5f5d0d48823c Author: Ben Gamari Date: Thu Apr 19 15:05:50 2018 -0400 configure: Use -Werror to check for existence of -no-pie Clang throws a warning instead of an error when it is passed -no-pie, clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument] Consequently configure concludes that it supports -no-pie. However, this will fail when used with -Werror. The solution is to simply use -Werror in the configure check. Thanks to @goldfire for reporting this. Reviewers: hvr Subscribers: thomie, carter, goldfire Differential Revision: https://phabricator.haskell.org/D4557 >--------------------------------------------------------------- cbd73bbbb7df080d5204098aa02e5f5d0d48823c aclocal.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index a48a5af..1cef842 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1294,7 +1294,7 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], AC_MSG_CHECKING([whether GCC supports -no-pie]) echo 'int main() { return 0; }' > conftest.c # Some GCC versions only warn when passed an unrecognized flag. - if $CC -no-pie -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then + if $CC -no-pie -Werror -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then CONF_GCC_SUPPORTS_NO_PIE=YES AC_MSG_RESULT([yes]) else From git at git.haskell.org Thu Apr 19 22:57:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 Apr 2018 22:57:37 +0000 (UTC) Subject: [commit: ghc] master: boot: Fix computation of TOP (8fa688a) Message-ID: <20180419225737.F3AA23AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8fa688a84f4e4d86096710edd1f0d19bac3eea90/ghc >--------------------------------------------------------------- commit 8fa688a84f4e4d86096710edd1f0d19bac3eea90 Author: Ben Gamari Date: Thu Apr 19 15:07:57 2018 -0400 boot: Fix computation of TOP Test Plan: Run `./boot`, check to make sure that `libraries/ghc-prim/GNUmakefile` is sane Subscribers: thomie, carter, sjakobi Differential Revision: https://phabricator.haskell.org/D4580 >--------------------------------------------------------------- 8fa688a84f4e4d86096710edd1f0d19bac3eea90 boot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot b/boot index f913724..d57dcc8 100755 --- a/boot +++ b/boot @@ -116,7 +116,7 @@ def boot_pkgs(): if os.path.isfile(cabal): # strip both .cabal and .in pkg = os.path.splitext(os.path.splitext(os.path.basename(cabal))[0])[0] - top = package + top = os.path.join(*['..'] * len(os.path.normpath(package).split(os.path.sep))) ghc_mk = os.path.join(package, 'ghc.mk') print('Creating %s' % ghc_mk) From git at git.haskell.org Fri Apr 20 00:19:46 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:19:46 +0000 (UTC) Subject: [commit: ghc] tag 'ghc-8.4.2-release' created Message-ID: <20180420001946.A23AC3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New tag : ghc-8.4.2-release Referencing: 4ac65911a066b5cbe893d9e6d664622635fbeea9 From git at git.haskell.org Fri Apr 20 00:19:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:19:54 +0000 (UTC) Subject: [commit: ghc] : libraries: Update changelogs (8c2cfc6) Message-ID: <20180420001954.EEED43AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/8c2cfc66efb17a0d899fc798fd67800a6f2a0889/ghc >--------------------------------------------------------------- commit 8c2cfc66efb17a0d899fc798fd67800a6f2a0889 Author: Ben Gamari Date: Tue Apr 17 13:30:00 2018 -0400 libraries: Update changelogs >--------------------------------------------------------------- 8c2cfc66efb17a0d899fc798fd67800a6f2a0889 libraries/base/changelog.md | 4 ++-- libraries/integer-gmp/changelog.md | 2 +- libraries/template-haskell/changelog.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index cb9519c..ec07002 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,13 +1,13 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) -## 4.11.1.0 *TBA* +## 4.11.1.0 *April 2018* * Bundled with GHC 8.4.2 * Add the `readFieldHash` function to `GHC.Read` which behaves like `readField`, but for a field that ends with a `#` symbol (#14918). -## 4.11.0.0 *TBA* +## 4.11.0.0 *March 2018* * Bundled with GHC 8.4.1 * `System.IO.openTempFile` is now thread-safe on Windows. diff --git a/libraries/integer-gmp/changelog.md b/libraries/integer-gmp/changelog.md index 51c84bc..a70f214 100644 --- a/libraries/integer-gmp/changelog.md +++ b/libraries/integer-gmp/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`integer-gmp` package](http://hackage.haskell.org/package/integer-gmp) -## 1.0.2.0 *TBA* +## 1.0.2.0 *April 2018* * Bundled with GHC 8.4.2 diff --git a/libraries/template-haskell/changelog.md b/libraries/template-haskell/changelog.md index b472832..1479a9e 100644 --- a/libraries/template-haskell/changelog.md +++ b/libraries/template-haskell/changelog.md @@ -1,8 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) -## 2.13.0.0 *TBA* +## 2.13.0.0 *March 2018* - * Bundled with GHC *TBA* + * Bundled with GHC 8.4.1 * `Language.Haskell.TH.FamFlavour`, which was deprecated in 2.11, has been removed. From git at git.haskell.org Fri Apr 20 00:19:49 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:19:49 +0000 (UTC) Subject: [commit: ghc] : Bump mtl submodule to 2.2.2 (b183d44) Message-ID: <20180420001949.6AC4E3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/b183d44a1ff5a6caf22db1bf5f7de23a3e58a6f0/ghc >--------------------------------------------------------------- commit b183d44a1ff5a6caf22db1bf5f7de23a3e58a6f0 Author: Ben Gamari Date: Mon Apr 16 09:49:58 2018 -0400 Bump mtl submodule to 2.2.2 >--------------------------------------------------------------- b183d44a1ff5a6caf22db1bf5f7de23a3e58a6f0 libraries/mtl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/mtl b/libraries/mtl index bf4af11..c7d3967 160000 --- a/libraries/mtl +++ b/libraries/mtl @@ -1 +1 @@ -Subproject commit bf4af114ba3d35b2937fc74926aa49e128dd6c1f +Subproject commit c7d396732bd45e409478bd4df1d0ca95d6f39356 From git at git.haskell.org Fri Apr 20 00:19:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:19:52 +0000 (UTC) Subject: [commit: ghc] : Release 8.4.2 (28595b7) Message-ID: <20180420001952.33E433AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/28595b7ab619d9a812cce23a546d7deabb486372/ghc >--------------------------------------------------------------- commit 28595b7ab619d9a812cce23a546d7deabb486372 Author: Ben Gamari Date: Mon Apr 16 09:50:06 2018 -0400 Release 8.4.2 >--------------------------------------------------------------- 28595b7ab619d9a812cce23a546d7deabb486372 configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2ce32a6..b74938f 100644 --- a/configure.ac +++ b/configure.ac @@ -13,10 +13,10 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.4.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.4.2], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO -: ${RELEASE=NO} +: ${RELEASE=YES} # The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line # above. If this is not a released version, then we will append the From git at git.haskell.org Fri Apr 20 00:19:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:19:57 +0000 (UTC) Subject: [commit: ghc] : users-guide: Write release notes for 8.4.2 (f3c5115) Message-ID: <20180420001957.B74C43AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/f3c5115b16b658c1729b7d1555ce9e390dd3cff4/ghc >--------------------------------------------------------------- commit f3c5115b16b658c1729b7d1555ce9e390dd3cff4 Author: Ben Gamari Date: Tue Apr 17 13:29:40 2018 -0400 users-guide: Write release notes for 8.4.2 >--------------------------------------------------------------- f3c5115b16b658c1729b7d1555ce9e390dd3cff4 docs/users_guide/8.4.2-notes.rst | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/8.4.2-notes.rst b/docs/users_guide/8.4.2-notes.rst index e579e83..dfbf355 100644 --- a/docs/users_guide/8.4.2-notes.rst +++ b/docs/users_guide/8.4.2-notes.rst @@ -3,14 +3,18 @@ Release notes for version 8.4.2 =============================== -TODO - Highlights ---------- +This is a bug-fix release resolving several regressions introduced in 8.4.1. + The highlights, since the 8.4.1 release, are: -- TODO +- Fixed a regression causing uses of ``Control.Exception.evaluate`` to be + incorrectly optimised, resulting in space leaks (:ghc-ticket:`13930`) + +- Fix a regression causing the interpreter to segmentation fault when built with + profiling (:ghc-ticket:`14705`) Full details @@ -27,34 +31,51 @@ Language Compiler ~~~~~~~~ +In addition to the regressions listed above, this release fixes a bug affecting +GHC's debug output support (:ghc-flag:`-g`) which resulted in invalid code to be +generated for string literals (:ghc-ticket:`13868`) + +- :ghc-ticket:`14918`, where ``Read`` instances for types with field names + containing ``#`` would fail to parse, has been fixed. Runtime system ~~~~~~~~~~~~~~ +- A bug causing panics while running programs with :rts-flag:`-hr` was fixed + (:ghc-ticket:`14947`) Template Haskell ~~~~~~~~~~~~~~~~ +No changes. ``ghc`` library ~~~~~~~~~~~~~~~ +No changes. ``base`` library ~~~~~~~~~~~~~~~~ +- Version bumped to 4.11.1.0 to account for the addition of + ``GHC.IO.FixIOException`` + - Add the ``readFieldHash`` function to ``GHC.Read`` which behaves like ``readField``, but for a field that ends with a ``#`` symbol. ``integer-gmp`` library ~~~~~~~~~~~~~~~~~~~~~~~ +- Version bumped to 1.0.2.0 to account for the addition of ``powModSecInteger``. + - Define ``powModSecInteger``, a "secure" version of ``powModInteger`` using the ``mpz_powm_sec`` function. Build system ~~~~~~~~~~~~ +- ``configure`` now takes a ``--disable-dtrace`` flag, allowing workaround of + :ghc-ticket:`15040`. Included libraries ------------------ From git at git.haskell.org Fri Apr 20 00:20:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:20:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.4's head updated: Bump mtl submodule to 2.2.2 (b183d44) Message-ID: <20180420002043.9DD6B3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'ghc-8.4' now includes: b183d44 Bump mtl submodule to 2.2.2 From git at git.haskell.org Fri Apr 20 00:20:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:20:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.4's head updated: users-guide: Write release notes for 8.4.2 (f3c5115) Message-ID: <20180420002052.C650A3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'ghc-8.4' now includes: f3c5115 users-guide: Write release notes for 8.4.2 From git at git.haskell.org Fri Apr 20 00:21:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:21:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.4's head updated: libraries: Update changelogs (8c2cfc6) Message-ID: <20180420002102.3CB593AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'ghc-8.4' now includes: 8c2cfc6 libraries: Update changelogs From git at git.haskell.org Fri Apr 20 00:21:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:21:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.4's head updated: Release 8.4.2 (28595b7) Message-ID: <20180420002115.57BB43AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'ghc-8.4' now includes: 28595b7 Release 8.4.2 From git at git.haskell.org Fri Apr 20 00:21:24 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:21:24 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: A few more release notes (615fba2) Message-ID: <20180420002124.DDB753AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/615fba2a137e88dbc9880413825d65f626eaecf8/ghc >--------------------------------------------------------------- commit 615fba2a137e88dbc9880413825d65f626eaecf8 Author: Ben Gamari Date: Thu Apr 19 19:28:40 2018 -0400 A few more release notes >--------------------------------------------------------------- 615fba2a137e88dbc9880413825d65f626eaecf8 docs/users_guide/8.4.2-notes.rst | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/docs/users_guide/8.4.2-notes.rst b/docs/users_guide/8.4.2-notes.rst index dfbf355..7e182f3 100644 --- a/docs/users_guide/8.4.2-notes.rst +++ b/docs/users_guide/8.4.2-notes.rst @@ -16,33 +16,40 @@ The highlights, since the 8.4.1 release, are: - Fix a regression causing the interpreter to segmentation fault when built with profiling (:ghc-ticket:`14705`) +- DWARF debug information support has been significantly improved + (:ghc-ticket:`14894`, :ghc-ticket:`14779`) + +- A regression in runtime performance of code involving ``newtype``\s has been + fixed (:ghc-ticket:`14936`) Full details ------------ - -Language -~~~~~~~~ - -- Fix a regression in which derived ``Read`` instances for record data types - with field names ending with ``#`` (by way of :ghc-flag:`-XMagicHash`) would - no longer parse valid output. +In addition to the highlights listed above, this release resolves a number of +other issues, described below. Compiler ~~~~~~~~ -In addition to the regressions listed above, this release fixes a bug affecting -GHC's debug output support (:ghc-flag:`-g`) which resulted in invalid code to be -generated for string literals (:ghc-ticket:`13868`) +- A bug affecting GHC's debug output support (:ghc-flag:`-g`) which resulted in + invalid code being generated for string literals (:ghc-ticket:`13868`) - :ghc-ticket:`14918`, where ``Read`` instances for types with field names containing ``#`` would fail to parse, has been fixed. +- Several compiler panics have been resolved (:ghc-ticket:`12158`, + :ghc-ticket:`15002`, :ghc-ticket:`14933`, :ghc-ticket:`14959`) + +- Fix a regression in which derived ``Read`` instances for record data types + with field names ending with ``#`` (by way of :ghc-flag:`-XMagicHash`) would + no longer parse valid output. + + Runtime system ~~~~~~~~~~~~~~ -- A bug causing panics while running programs with :rts-flag:`-hr` was fixed - (:ghc-ticket:`14947`) +- A bug causing panics while running programs with retainer profiling + (:rts-flag:`-hr`) was fixed (:ghc-ticket:`14947`) Template Haskell ~~~~~~~~~~~~~~~~ @@ -77,6 +84,8 @@ Build system - ``configure`` now takes a ``--disable-dtrace`` flag, allowing workaround of :ghc-ticket:`15040`. +- A bug breaking GHC builds bootstrapped on Darwin has been fixed (:ghc-ticket:`14972`) + Included libraries ------------------ From git at git.haskell.org Fri Apr 20 00:21:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 00:21:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: configure: Set RELEASE=NO (4df0106) Message-ID: <20180420002135.33AD63AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/4df0106890df687d32ad1941dd5ccb31a11438d8/ghc >--------------------------------------------------------------- commit 4df0106890df687d32ad1941dd5ccb31a11438d8 Author: Ben Gamari Date: Thu Apr 19 20:20:23 2018 -0400 configure: Set RELEASE=NO >--------------------------------------------------------------- 4df0106890df687d32ad1941dd5ccb31a11438d8 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b74938f..8bed181 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ dnl AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.4.2], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO -: ${RELEASE=YES} +: ${RELEASE=NO} # The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line # above. If this is not a released version, then we will append the From git at git.haskell.org Fri Apr 20 03:00:39 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 03:00:39 +0000 (UTC) Subject: [commit: ghc] master: Lint types in newFamInst (257c13d) Message-ID: <20180420030039.8CA823AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/257c13d86db0a9ed540287127fd1c79abacf857e/ghc >--------------------------------------------------------------- commit 257c13d86db0a9ed540287127fd1c79abacf857e Author: Ryan Scott Date: Thu Apr 19 20:47:48 2018 -0400 Lint types in newFamInst We weren't linting the types used in `newFamInst`, which might have been why #15012 went undiscovered for so long. Let's fix that. One has to be surprisingly careful with expanding type synonyms in `lintType`, since in the offending program (simplified): ```lang=haskell type FakeOut a = Int type family TF a type instance TF Int = FakeOut a ``` If one expands type synonyms, then `FakeOut a` will expand to `Int`, which masks the issue (that `a` is unbound). I added an extra Lint flag to configure whether type synonyms should be expanded or not in Lint, and disabled this when calling `lintTypes` from `newFamInst`. As evidence that this works, I ran it on the offending program from #15012, and voilà: ``` $ ghc3/inplace/bin/ghc-stage2 Bug.hs -dcore-lint [1 of 1] Compiling Foo ( Bug.hs, Bug.o ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.5.20180417 for x86_64-unknown-linux): Core Lint error : warning: In the type ‘... (Rec0 (FakeOut b_a1Qt))))’ @ b_a1Qt is out of scope ``` Test Plan: make test TEST=T15057 Reviewers: simonpj, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15057 Differential Revision: https://phabricator.haskell.org/D4611 >--------------------------------------------------------------- 257c13d86db0a9ed540287127fd1c79abacf857e compiler/coreSyn/CoreLint.hs | 112 +++++++++++++++------ compiler/typecheck/FamInst.hs | 16 ++- .../tests/indexed-types/should_compile/T15057.hs | 11 ++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 4 files changed, 109 insertions(+), 31 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 257c13d86db0a9ed540287127fd1c79abacf857e From git at git.haskell.org Fri Apr 20 03:00:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 03:00:53 +0000 (UTC) Subject: [commit: ghc] master: Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412) (a26983a) Message-ID: <20180420030053.CC9023AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a26983a3aef25b3fa5f66b4d68ea7240a6dd1543/ghc >--------------------------------------------------------------- commit a26983a3aef25b3fa5f66b4d68ea7240a6dd1543 Author: ARJANEN Loïc Jean David Date: Thu Apr 19 20:48:28 2018 -0400 Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412) Corrects the inconsistency between Data.Char.isAlphaNum, Data.Char.isAlpha and Data.Char.isNumber. Indeed, isAlphaNum was returning True not only when isAlpha or isNumber returned True but also when isMark did. The selectors for the Mn, Mc and Me general categories where removed from the macro generating u_iswalnum in ubconfc. Also, Data.Char.isAlphaNum's documentation was changed to state that isAlphaNum returns true not only for Unicode number digits but for Unicode numbers in general in Unicode.hs. Signed-off-by: ARJANEN Loïc Jean David Reviewers: hvr, ekmett, lelf, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #10412 Differential Revision: https://phabricator.haskell.org/D4593 >--------------------------------------------------------------- a26983a3aef25b3fa5f66b4d68ea7240a6dd1543 libraries/base/GHC/Unicode.hs | 9 +++++---- libraries/base/cbits/ubconfc | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libraries/base/GHC/Unicode.hs b/libraries/base/GHC/Unicode.hs index 1b8cd05..df7c978 100644 --- a/libraries/base/GHC/Unicode.hs +++ b/libraries/base/GHC/Unicode.hs @@ -220,11 +220,12 @@ isLower :: Char -> Bool -- This function is equivalent to 'Data.Char.isLetter'. isAlpha :: Char -> Bool --- | Selects alphabetic or numeric digit Unicode characters. +-- | Selects alphabetic or numeric Unicode characters. -- --- Note that numeric digits outside the ASCII range are selected by this --- function but not by 'isDigit'. Such digits may be part of identifiers --- but are not used by the printer and reader to represent numbers. +-- Note that numeric digits outside the ASCII range, as well as numeric +-- characters which aren't digits, are selected by this function but not by +-- 'isDigit'. Such characters may be part of identifiers but are not used by +-- the printer and reader to represent numbers. isAlphaNum :: Char -> Bool -- | Selects ASCII digits, i.e. @\'0\'@..@\'9\'@. diff --git a/libraries/base/cbits/ubconfc b/libraries/base/cbits/ubconfc index 509049d..4d32586 100644 --- a/libraries/base/cbits/ubconfc +++ b/libraries/base/cbits/ubconfc @@ -322,7 +322,6 @@ unipred(u_iswalpha,(GENCAT_LL|GENCAT_LU|GENCAT_LT|GENCAT_LM|GENCAT_LO)) unipred(u_iswdigit,GENCAT_ND) unipred(u_iswalnum,(GENCAT_LT|GENCAT_LU|GENCAT_LL|GENCAT_LM|GENCAT_LO| - GENCAT_MC|GENCAT_ME|GENCAT_MN| GENCAT_NO|GENCAT_ND|GENCAT_NL)) #define caseconv(p,to) \\ @@ -341,5 +340,4 @@ HsInt u_gencat(HsInt c) { return getrule(allchars,NUM_BLOCKS,c)->catnumber; } - EOF From git at git.haskell.org Fri Apr 20 07:08:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 07:08:12 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Add SCCs to hunt down #14683 (bd9c4df) Message-ID: <20180420070812.B23D63AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/bd9c4df27e3cd33b340bf39facae7f9e7e67e844/ghc >--------------------------------------------------------------- commit bd9c4df27e3cd33b340bf39facae7f9e7e67e844 Author: Tobias Dammers Date: Wed Jan 24 16:07:00 2018 +0100 Add SCCs to hunt down #14683 >--------------------------------------------------------------- bd9c4df27e3cd33b340bf39facae7f9e7e67e844 compiler/simplCore/Simplify.hs | 72 +++++++++++++++++++++++++----------------- compiler/types/TyCoRep.hs | 9 +++--- 2 files changed, 48 insertions(+), 33 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 bd9c4df27e3cd33b340bf39facae7f9e7e67e844 From git at git.haskell.org Fri Apr 20 07:08:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 07:08:16 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Add regression test (Grammar.hs from #14683) (792c0d9) Message-ID: <20180420070816.07CC53AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/792c0d9d88a46d5ead4adca1fff7264a3c0d79ec/ghc >--------------------------------------------------------------- commit 792c0d9d88a46d5ead4adca1fff7264a3c0d79ec Author: Tobias Dammers Date: Tue Apr 17 12:02:38 2018 +0200 Add regression test (Grammar.hs from #14683) >--------------------------------------------------------------- 792c0d9d88a46d5ead4adca1fff7264a3c0d79ec testsuite/tests/perf/compiler/T14683.hs | 3869 +++++++++++++++++++++++++++++++ testsuite/tests/perf/compiler/all.T | 8 + 2 files changed, 3877 insertions(+) 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 792c0d9d88a46d5ead4adca1fff7264a3c0d79ec From git at git.haskell.org Fri Apr 20 07:08:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 07:08:18 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Cache coercion roles in NthCo (99ff72b) Message-ID: <20180420070818.F17FF3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/99ff72b2de1765afe5f2719d47908e87728c354b/ghc >--------------------------------------------------------------- commit 99ff72b2de1765afe5f2719d47908e87728c354b Author: Tobias Dammers Date: Thu Jan 25 20:33:58 2018 +0100 Cache coercion roles in NthCo Most callers of mkNthCo know the role of the coercion they are trying to make. So instead of calculating this role, we pass it in, forcing the caller to calculate it when needed. >--------------------------------------------------------------- 99ff72b2de1765afe5f2719d47908e87728c354b compiler/coreSyn/CoreFVs.hs | 2 +- compiler/coreSyn/CoreLint.hs | 8 +- compiler/coreSyn/CoreOpt.hs | 24 +- compiler/coreSyn/CoreUtils.hs | 2 +- compiler/iface/TcIface.hs | 3 +- compiler/iface/ToIface.hs | 2 +- compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcEvidence.hs | 12 +- compiler/typecheck/TcTyDecls.hs | 2 +- compiler/typecheck/TcType.hs | 4 +- compiler/typecheck/TcUnify.hs | 4 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Coercion.hs | 415 +++++++++++++++-------- compiler/types/Coercion.hs-boot | 2 +- compiler/types/FamInstEnv.hs | 2 +- compiler/types/OptCoercion.hs | 103 +++--- compiler/types/TyCoRep.hs | 39 ++- compiler/types/Type.hs | 20 +- compiler/types/Unify.hs | 4 +- docs/core-spec/CoreLint.ott | 4 +- docs/core-spec/CoreSyn.ott | 6 +- docs/core-spec/core-spec.mng | 2 +- docs/core-spec/core-spec.pdf | Bin 354307 -> 355707 bytes libraries/array | 2 +- testsuite/tests/perf/compiler/all.T | 13 +- testsuite/tests/perf/haddock/all.T | 3 +- testsuite/tests/pmcheck/should_compile/T11195.hs | 2 +- 27 files changed, 415 insertions(+), 269 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 99ff72b2de1765afe5f2719d47908e87728c354b From git at git.haskell.org Fri Apr 20 07:08:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 07:08:21 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Improve coercionKind(Role) perfomance (bf52700) Message-ID: <20180420070821.B90BF3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/bf52700b7b53ea6daca448074af2055077148ab0/ghc >--------------------------------------------------------------- commit bf52700b7b53ea6daca448074af2055077148ab0 Author: Tobias Dammers Date: Wed Jan 24 16:05:55 2018 +0100 Improve coercionKind(Role) perfomance By separating / refactoring the coercionKind and coercionRole functions, we can avoid unnecessary calculations and avoid some costly recursions. See #11735. >--------------------------------------------------------------- bf52700b7b53ea6daca448074af2055077148ab0 compiler/types/Coercion.hs | 82 ++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 53 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index c8105d0..4cc8cef 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -1755,6 +1755,8 @@ substitute for them all at once. Remarkably, for Trac #11735 this single change reduces /total/ compile time by a factor of more than ten. -} +======= +>>>>>>> Applying patch suggested in #11735 to improve coercionKind perf -- | Apply 'coercionKind' to multiple 'Coercion's coercionKinds :: [Coercion] -> Pair [Type] @@ -1763,77 +1765,51 @@ coercionKinds tys = sequenceA $ map coercionKind tys -- | Get a coercion's kind and role. -- Why both at once? See Note [Computing a coercion kind and role] coercionKindRole :: Coercion -> (Pair Type, Role) -coercionKindRole = go +coercionKindRole co = (coercionKind co, coercionRole co) + +-- | Retrieve the role from a coercion. +coercionRole :: Coercion -> Role +coercionRole = go where - go (Refl r ty) = (Pair ty ty, r) - go (TyConAppCo r tc cos) - = (mkTyConApp tc <$> (sequenceA $ map coercionKind cos), r) - go (AppCo co1 co2) - = let (tys1, r1) = go co1 in - (mkAppTy <$> tys1 <*> coercionKind co2, r1) - go (ForAllCo tv1 k_co co) - = let Pair _ k2 = coercionKind k_co - tv2 = setTyVarKind tv1 k2 - (Pair ty1 ty2, r) = go co - subst = zipTvSubst [tv1] [TyVarTy tv2 `mkCastTy` mkSymCo k_co] - ty2' = substTyAddInScope subst ty2 in - -- We need free vars of ty2 in scope to satisfy the invariant - -- from Note [The substitution invariant] - -- This is doing repeated substitutions and probably doesn't - -- need to, see #11735 - (mkInvForAllTy <$> Pair tv1 tv2 <*> Pair ty1 ty2', r) - go (FunCo r co1 co2) - = (mkFunTy <$> coercionKind co1 <*> coercionKind co2, r) + go (Refl r _) = r + go (TyConAppCo r _ _) = r + go (AppCo co1 _) = go co1 + go (ForAllCo _ _ co) = go co + go (FunCo r _ _) = r go (CoVarCo cv) = go_var cv go (HoleCo h) = go_var (coHoleCoVar h) - go co@(AxiomInstCo ax _ _) = (coercionKind co, coAxiomRole ax) - go (UnivCo _ r ty1 ty2) = (Pair ty1 ty2, r) - go (SymCo co) = first swap $ go co - go (TransCo co1 co2) - = let (tys1, r) = go co1 in - (Pair (pFst tys1) (pSnd $ coercionKind co2), r) + go (AxiomInstCo ax _ _) = coAxiomRole ax + go (UnivCo _ r _ _) = r + go (SymCo co) = go co + go (TransCo co1 co2) = go co1 go (NthCo d co) | Just (tv1, _) <- splitForAllTy_maybe ty1 = ASSERT( d == 0 ) - let (tv2, _) = splitForAllTy ty2 in - (tyVarKind <$> Pair tv1 tv2, Nominal) + Nominal | otherwise = let (tc1, args1) = splitTyConApp ty1 (_tc2, args2) = splitTyConApp ty2 in ASSERT2( tc1 == _tc2, ppr d $$ ppr tc1 $$ ppr _tc2 ) - ((`getNth` d) <$> Pair args1 args2, nthRole r tc1 d) + (nthRole r tc1 d) where - (Pair ty1 ty2, r) = go co - go co@(LRCo {}) = (coercionKind co, Nominal) - go (InstCo co arg) = go_app co [arg] - go (CoherenceCo co1 co2) - = let (Pair t1 t2, r) = go co1 in - (Pair (t1 `mkCastTy` co2) t2, r) - go co@(KindCo {}) = (coercionKind co, Nominal) - go (SubCo co) = (coercionKind co, Representational) - go co@(AxiomRuleCo ax _) = (coercionKind co, coaxrRole ax) + (Pair ty1 ty2, r) = coercionKindRole co + go (LRCo {}) = Nominal + go (InstCo co arg) = go_app co + go (CoherenceCo co1 _) = go co1 + go (KindCo {}) = Nominal + go (SubCo _) = Representational + go (AxiomRuleCo ax _) = coaxrRole ax ------------- - go_var cv = (coVarTypes cv, coVarRole cv) + go_var = coVarRole ------------- - go_app :: Coercion -> [Coercion] -> (Pair Type, Role) - -- Collect up all the arguments and apply all at once - -- See Note [Nested InstCos] - go_app (InstCo co arg) args = go_app co (arg:args) - go_app co args - = let (pair, r) = go co in - (piResultTys <$> pair <*> (sequenceA $ map coercionKind args), r) - --- | Retrieve the role from a coercion. -coercionRole :: Coercion -> Role -coercionRole = snd . coercionKindRole - -- There's not a better way to do this, because NthCo needs the *kind* - -- and role of its argument. Luckily, laziness should generally avoid - -- the need for computing kinds in other cases. + go_app :: Coercion -> Role + go_app (InstCo co arg) = go_app co + go_app co = go co {- Note [Nested InstCos] From git at git.haskell.org Fri Apr 20 08:39:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 08:39:21 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Improve coercionKind(Role) perfomance (8f4ee8d) Message-ID: <20180420083921.B24EF3AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/8f4ee8d5a349bc2395eafb4f45fd26e7f547f1d8/ghc >--------------------------------------------------------------- commit 8f4ee8d5a349bc2395eafb4f45fd26e7f547f1d8 Author: Tobias Dammers Date: Wed Jan 24 16:05:55 2018 +0100 Improve coercionKind(Role) perfomance By separating / refactoring the coercionKind and coercionRole functions, we can avoid unnecessary calculations and avoid some costly recursions. See #11735. >--------------------------------------------------------------- 8f4ee8d5a349bc2395eafb4f45fd26e7f547f1d8 compiler/types/Coercion.hs | 82 ++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 53 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index c8105d0..4cc8cef 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -1755,6 +1755,8 @@ substitute for them all at once. Remarkably, for Trac #11735 this single change reduces /total/ compile time by a factor of more than ten. -} +======= +>>>>>>> Applying patch suggested in #11735 to improve coercionKind perf -- | Apply 'coercionKind' to multiple 'Coercion's coercionKinds :: [Coercion] -> Pair [Type] @@ -1763,77 +1765,51 @@ coercionKinds tys = sequenceA $ map coercionKind tys -- | Get a coercion's kind and role. -- Why both at once? See Note [Computing a coercion kind and role] coercionKindRole :: Coercion -> (Pair Type, Role) -coercionKindRole = go +coercionKindRole co = (coercionKind co, coercionRole co) + +-- | Retrieve the role from a coercion. +coercionRole :: Coercion -> Role +coercionRole = go where - go (Refl r ty) = (Pair ty ty, r) - go (TyConAppCo r tc cos) - = (mkTyConApp tc <$> (sequenceA $ map coercionKind cos), r) - go (AppCo co1 co2) - = let (tys1, r1) = go co1 in - (mkAppTy <$> tys1 <*> coercionKind co2, r1) - go (ForAllCo tv1 k_co co) - = let Pair _ k2 = coercionKind k_co - tv2 = setTyVarKind tv1 k2 - (Pair ty1 ty2, r) = go co - subst = zipTvSubst [tv1] [TyVarTy tv2 `mkCastTy` mkSymCo k_co] - ty2' = substTyAddInScope subst ty2 in - -- We need free vars of ty2 in scope to satisfy the invariant - -- from Note [The substitution invariant] - -- This is doing repeated substitutions and probably doesn't - -- need to, see #11735 - (mkInvForAllTy <$> Pair tv1 tv2 <*> Pair ty1 ty2', r) - go (FunCo r co1 co2) - = (mkFunTy <$> coercionKind co1 <*> coercionKind co2, r) + go (Refl r _) = r + go (TyConAppCo r _ _) = r + go (AppCo co1 _) = go co1 + go (ForAllCo _ _ co) = go co + go (FunCo r _ _) = r go (CoVarCo cv) = go_var cv go (HoleCo h) = go_var (coHoleCoVar h) - go co@(AxiomInstCo ax _ _) = (coercionKind co, coAxiomRole ax) - go (UnivCo _ r ty1 ty2) = (Pair ty1 ty2, r) - go (SymCo co) = first swap $ go co - go (TransCo co1 co2) - = let (tys1, r) = go co1 in - (Pair (pFst tys1) (pSnd $ coercionKind co2), r) + go (AxiomInstCo ax _ _) = coAxiomRole ax + go (UnivCo _ r _ _) = r + go (SymCo co) = go co + go (TransCo co1 co2) = go co1 go (NthCo d co) | Just (tv1, _) <- splitForAllTy_maybe ty1 = ASSERT( d == 0 ) - let (tv2, _) = splitForAllTy ty2 in - (tyVarKind <$> Pair tv1 tv2, Nominal) + Nominal | otherwise = let (tc1, args1) = splitTyConApp ty1 (_tc2, args2) = splitTyConApp ty2 in ASSERT2( tc1 == _tc2, ppr d $$ ppr tc1 $$ ppr _tc2 ) - ((`getNth` d) <$> Pair args1 args2, nthRole r tc1 d) + (nthRole r tc1 d) where - (Pair ty1 ty2, r) = go co - go co@(LRCo {}) = (coercionKind co, Nominal) - go (InstCo co arg) = go_app co [arg] - go (CoherenceCo co1 co2) - = let (Pair t1 t2, r) = go co1 in - (Pair (t1 `mkCastTy` co2) t2, r) - go co@(KindCo {}) = (coercionKind co, Nominal) - go (SubCo co) = (coercionKind co, Representational) - go co@(AxiomRuleCo ax _) = (coercionKind co, coaxrRole ax) + (Pair ty1 ty2, r) = coercionKindRole co + go (LRCo {}) = Nominal + go (InstCo co arg) = go_app co + go (CoherenceCo co1 _) = go co1 + go (KindCo {}) = Nominal + go (SubCo _) = Representational + go (AxiomRuleCo ax _) = coaxrRole ax ------------- - go_var cv = (coVarTypes cv, coVarRole cv) + go_var = coVarRole ------------- - go_app :: Coercion -> [Coercion] -> (Pair Type, Role) - -- Collect up all the arguments and apply all at once - -- See Note [Nested InstCos] - go_app (InstCo co arg) args = go_app co (arg:args) - go_app co args - = let (pair, r) = go co in - (piResultTys <$> pair <*> (sequenceA $ map coercionKind args), r) - --- | Retrieve the role from a coercion. -coercionRole :: Coercion -> Role -coercionRole = snd . coercionKindRole - -- There's not a better way to do this, because NthCo needs the *kind* - -- and role of its argument. Luckily, laziness should generally avoid - -- the need for computing kinds in other cases. + go_app :: Coercion -> Role + go_app (InstCo co arg) = go_app co + go_app co = go co {- Note [Nested InstCos] From git at git.haskell.org Fri Apr 20 08:39:24 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 08:39:24 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/D4394-squash: Cache coercion roles in NthCo (03ed25a) Message-ID: <20180420083924.9B3133AB9B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/D4394-squash Link : http://ghc.haskell.org/trac/ghc/changeset/03ed25a8f228c2f6d56793bc45f5709b9afb02c7/ghc >--------------------------------------------------------------- commit 03ed25a8f228c2f6d56793bc45f5709b9afb02c7 Author: Tobias Dammers Date: Thu Jan 25 20:33:58 2018 +0100 Cache coercion roles in NthCo Most callers of mkNthCo know the role of the coercion they are trying to make. So instead of calculating this role, we pass it in, forcing the caller to calculate it when needed. This introduces a performance regression in perf/compiler/T9872d. >--------------------------------------------------------------- 03ed25a8f228c2f6d56793bc45f5709b9afb02c7 compiler/coreSyn/CoreFVs.hs | 2 +- compiler/coreSyn/CoreLint.hs | 8 +- compiler/coreSyn/CoreOpt.hs | 24 +- compiler/coreSyn/CoreUtils.hs | 2 +- compiler/iface/TcIface.hs | 3 +- compiler/iface/ToIface.hs | 2 +- compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcEvidence.hs | 12 +- compiler/typecheck/TcTyDecls.hs | 2 +- compiler/typecheck/TcType.hs | 4 +- compiler/typecheck/TcUnify.hs | 4 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Coercion.hs | 415 +++++++++++++++-------- compiler/types/Coercion.hs-boot | 2 +- compiler/types/FamInstEnv.hs | 2 +- compiler/types/OptCoercion.hs | 103 +++--- compiler/types/TyCoRep.hs | 39 ++- compiler/types/Type.hs | 20 +- compiler/types/Unify.hs | 4 +- docs/core-spec/CoreLint.ott | 4 +- docs/core-spec/CoreSyn.ott | 6 +- docs/core-spec/core-spec.mng | 2 +- docs/core-spec/core-spec.pdf | Bin 354307 -> 355707 bytes libraries/array | 2 +- testsuite/tests/perf/compiler/all.T | 13 +- testsuite/tests/perf/haddock/all.T | 3 +- testsuite/tests/pmcheck/should_compile/T11195.hs | 2 +- 27 files changed, 415 insertions(+), 269 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 03ed25a8f228c2f6d56793bc45f5709b9afb02c7 From git at git.haskell.org Fri Apr 20 14:16:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 14:16:34 +0000 (UTC) Subject: [commit: ghc] master: Bump transformers submodule (b41a42e) Message-ID: <20180420141634.1F2AA3AB9F@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b41a42e3dc0c428344c553e195b7dc91272de21e/ghc >--------------------------------------------------------------- commit b41a42e3dc0c428344c553e195b7dc91272de21e Author: Ryan Scott Date: Fri Apr 20 10:14:31 2018 -0400 Bump transformers submodule This brings in a commit which migrates Contravariant instances from base to transformers. >--------------------------------------------------------------- b41a42e3dc0c428344c553e195b7dc91272de21e libraries/transformers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/transformers b/libraries/transformers index 33b3c8a..8055784 160000 --- a/libraries/transformers +++ b/libraries/transformers @@ -1 +1 @@ -Subproject commit 33b3c8a71778ae37040088dfe022c648373777a8 +Subproject commit 80557845cdc0e72bc05cec19cf7a1bf5495e9e69 From git at git.haskell.org Fri Apr 20 14:29:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 14:29:32 +0000 (UTC) Subject: [commit: ghc] master: Caching coercion roles in NthCo and coercionKindsRole refactoring (2fbe0b5) Message-ID: <20180420142932.7E6343AB9F@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fbe0b5171fd5639845b630faccb9a0c3b564df7/ghc >--------------------------------------------------------------- commit 2fbe0b5171fd5639845b630faccb9a0c3b564df7 Author: Tobias Dammers Date: Fri Apr 20 09:11:14 2018 -0400 Caching coercion roles in NthCo and coercionKindsRole refactoring While addressing nonlinear behavior related to coercion roles, particularly `NthCo`, we noticed that coercion roles are recalculated often even though they should be readily at hand already in most cases. This patch adds a `Role` to the `NthCo` constructor so that we can cache them rather than having to recalculate them on the fly. https://ghc.haskell.org/trac/ghc/ticket/11735#comment:23 explains the approach. Performance improvement over GHC HEAD, when compiling Grammar.hs (see below): GHC 8.2.1: ``` ghc Grammar.hs 176.27s user 0.23s system 99% cpu 2:56.81 total ``` before patch (but with other optimizations applied): ``` ghc Grammar.hs -fforce-recomp 175.77s user 0.19s system 100% cpu 2:55.78 total ``` after: ``` ../../ghc/inplace/bin/ghc-stage2 Grammar.hs 10.32s user 0.17s system 98% cpu 10.678 total ``` Introduces the following regressions: - perf/compiler/parsing001 (possibly false positive) - perf/compiler/T9872 - perf/compiler/haddock.base Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11735 Differential Revision: https://phabricator.haskell.org/D4394 >--------------------------------------------------------------- 2fbe0b5171fd5639845b630faccb9a0c3b564df7 compiler/coreSyn/CoreFVs.hs | 2 +- compiler/coreSyn/CoreLint.hs | 8 +- compiler/coreSyn/CoreOpt.hs | 24 +- compiler/coreSyn/CoreUtils.hs | 2 +- compiler/iface/TcIface.hs | 3 +- compiler/iface/ToIface.hs | 2 +- compiler/simplCore/Simplify.hs | 74 +- compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcEvidence.hs | 12 +- compiler/typecheck/TcTyDecls.hs | 2 +- compiler/typecheck/TcType.hs | 4 +- compiler/typecheck/TcUnify.hs | 4 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Coercion.hs | 471 +-- compiler/types/Coercion.hs-boot | 2 +- compiler/types/FamInstEnv.hs | 2 +- compiler/types/OptCoercion.hs | 103 +- compiler/types/TyCoRep.hs | 46 +- compiler/types/Type.hs | 20 +- compiler/types/Unify.hs | 4 +- docs/core-spec/CoreLint.ott | 4 +- docs/core-spec/CoreSyn.ott | 6 +- docs/core-spec/core-spec.mng | 2 +- docs/core-spec/core-spec.pdf | Bin 354307 -> 355707 bytes testsuite/tests/perf/compiler/T14683.hs | 3869 ++++++++++++++++++++++ testsuite/tests/perf/compiler/all.T | 19 +- testsuite/tests/perf/haddock/all.T | 10 +- testsuite/tests/pmcheck/should_compile/T11195.hs | 2 +- 28 files changed, 4358 insertions(+), 343 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 2fbe0b5171fd5639845b630faccb9a0c3b564df7 From git at git.haskell.org Fri Apr 20 16:08:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 16:08:19 +0000 (UTC) Subject: [commit: ghc] master: comments only (f6db0b2) Message-ID: <20180420160819.816903AB9F@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f6db0b202be1ba780544cb34b527ee2955c56f9b/ghc >--------------------------------------------------------------- commit f6db0b202be1ba780544cb34b527ee2955c56f9b Author: Simon Peyton Jones Date: Fri Apr 20 13:58:38 2018 +0100 comments only >--------------------------------------------------------------- f6db0b202be1ba780544cb34b527ee2955c56f9b compiler/basicTypes/BasicTypes.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index 9b8208e..dfb7ab4 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -1220,10 +1220,10 @@ data InlinePragma -- Note [InlinePragma] -- | Inline Specification data InlineSpec -- What the user's INLINE pragma looked like - = Inline - | Inlinable - | NoInline - | NoUserInline -- Used when the pragma did not come from the user, + = Inline -- User wrote INLINE + | Inlinable -- User wrote INLINABLE + | NoInline -- User wrote NOINLINE + | NoUserInline -- User did not write any of INLINE/INLINABLE/NOINLINE -- e.g. in `defaultInlinePragma` or when created by CSE deriving( Eq, Data, Show ) -- Show needed for Lexer.x From git at git.haskell.org Fri Apr 20 16:08:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 16:08:23 +0000 (UTC) Subject: [commit: ghc] master: Inline wrappers earlier (8b10b89) Message-ID: <20180420160823.76A143AB9F@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8b10b8968f25589b1857f12788fc79b3b142c467/ghc >--------------------------------------------------------------- commit 8b10b8968f25589b1857f12788fc79b3b142c467 Author: Simon Peyton Jones Date: Fri Apr 20 13:57:16 2018 +0100 Inline wrappers earlier This patch has a single significant change: strictness wrapper functions are inlined earlier, in phase 2 rather than phase 0. As shown by Trac #15056, this gives a better chance for RULEs to fire. Before this change, a function that would have inlined early without strictness analyss was instead inlining late. Result: applying "optimisation" made the program worse. This does not make too much difference in nofib, but I've stumbled over the problem more than once, so even a "no-change" result would be quite acceptable. Here are the headlines: -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- cacheprof -0.5% -0.5% +2.5% +2.5% 0.0% fulsom -1.0% +2.6% -0.1% -0.1% 0.0% mate -0.6% +2.4% -0.9% -0.9% 0.0% veritas -0.7% -23.2% 0.002 0.002 0.0% -------------------------------------------------------------------------------- Min -1.4% -23.2% -12.5% -15.3% 0.0% Max +0.6% +2.6% +4.4% +4.3% +19.0% Geometric Mean -0.7% -0.2% -1.4% -1.7% +0.2% * A worthwhile reduction in binary size. * Runtimes are not to be trusted much but look as if they are moving the right way. * A really big win in veritas, described in comment:1 of Trac #15056; more fusion rules fired. * I investigated the losses in 'mate' and 'fulsom'; see #15056. >--------------------------------------------------------------- 8b10b8968f25589b1857f12788fc79b3b142c467 compiler/stranal/WorkWrap.hs | 137 +++++++----- .../tests/simplCore/should_compile/T13143.stderr | 4 +- testsuite/tests/simplCore/should_compile/T15056.hs | 6 + .../tests/simplCore/should_compile/T15056.stderr | 9 + .../tests/simplCore/should_compile/T15056a.hs | 11 + .../tests/simplCore/should_compile/T3717.stderr | 4 +- .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../tests/simplCore/should_compile/T4930.stderr | 4 +- .../tests/simplCore/should_compile/T6056.stderr | 2 +- testsuite/tests/simplCore/should_compile/all.T | 1 + .../simplCore/should_compile/spec-inline.stderr | 6 +- .../tests/stranal/should_compile/T10482.stderr | 150 ++++++------- .../tests/stranal/should_compile/T10482a.stderr | 248 ++++++++++----------- 13 files changed, 323 insertions(+), 265 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 8b10b8968f25589b1857f12788fc79b3b142c467 From git at git.haskell.org Fri Apr 20 22:04:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 22:04:40 +0000 (UTC) Subject: [commit: ghc] master: Remove broken top-level shell.nix (430e6fe) Message-ID: <20180420220440.2A3AC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/430e6fedfda3e705c6e4c962954c32211a90f9f7/ghc >--------------------------------------------------------------- commit 430e6fedfda3e705c6e4c962954c32211a90f9f7 Author: Matthew Pickering Date: Fri Apr 20 13:31:49 2018 -0400 Remove broken top-level shell.nix There is a maintained shell.nix file in the hadrian submodule. This has long since been broken anyway. Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15045 Differential Revision: https://phabricator.haskell.org/D4599 >--------------------------------------------------------------- 430e6fedfda3e705c6e4c962954c32211a90f9f7 shell.nix | 61 ------------------------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/shell.nix b/shell.nix deleted file mode 100644 index e9a5ecc..0000000 --- a/shell.nix +++ /dev/null @@ -1,61 +0,0 @@ -# Invoking nix-shell sets up an environment where we can build ghc -# by only invoking hadrian. - - -{ nixpkgs ? import {} }: - -let - haskellPackages = nixpkgs.haskell.packages.ghc821; - - removeBuild = path: type: - let baseName = baseNameOf (toString path); - in - ! (baseName == "_build" - || baseName == "dist" - || baseName == "dist-newstyle" - || baseName == ".stack-work" - || baseName == "config.log" - || baseName == "config.status" - || nixpkgs.lib.hasSuffix ".sh" baseName - || !(nixpkgs.lib.cleanSourceFilter path type)) ; - - filterSrc = path: builtins.filterSource removeBuild path; - - - hadrianPackages = nixpkgs.haskell.packages.ghc821.override { - overrides = self: super: let - localPackage = name: path: self.callCabal2nix name (filterSrc path) {}; - in { - hadrian = localPackage "hadrian" ./. ; - shake = self.callHackage "shake" "0.16" {}; - Cabal = localPackage "Cabal" ./../libraries/Cabal/Cabal ; - filepath = localPackage "filepath" ./../libraries/filepath ; - text = localPackage "text" ./../libraries/text ; - hpc = localPackage"hpc" ./../libraries/hpc ; - parsec = localPackage "parsec" ./../libraries/parsec ; - HUnit = nixpkgs.haskell.lib.dontCheck (self.callHackage "HUnit" "1.3.1.2" {}); - process = localPackage "process" ./../libraries/process ; - directory = localPackage "directory" ./../libraries/directory ; - }; }; - -in - - nixpkgs.stdenv.mkDerivation { - name = "ghc-dev"; - buildInputs = [ - hadrianPackages.hadrian - nixpkgs.haskell.compiler.ghc821 - haskellPackages.alex - haskellPackages.happy - nixpkgs.python3 - nixpkgs.git - nixpkgs.autoconf - nixpkgs.automake - nixpkgs.perl - nixpkgs.gcc - nixpkgs.python3Packages.sphinx - nixpkgs.ncurses - nixpkgs.m4 - nixpkgs.gmp - nixpkgs.file ]; - } From git at git.haskell.org Fri Apr 20 22:04:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 22:04:56 +0000 (UTC) Subject: [commit: ghc] master: Fix implementation of rnIfaceBndr (698db813) Message-ID: <20180420220456.256353ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/698db813dbc49f6c1e011299e8044b3bafb26847/ghc >--------------------------------------------------------------- commit 698db813dbc49f6c1e011299e8044b3bafb26847 Author: Matthew Pickering Date: Fri Apr 20 13:32:30 2018 -0400 Fix implementation of rnIfaceBndr Reviewers: ezyang, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15041 Differential Revision: https://phabricator.haskell.org/D4600 >--------------------------------------------------------------- 698db813dbc49f6c1e011299e8044b3bafb26847 compiler/backpack/RnModIface.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/backpack/RnModIface.hs b/compiler/backpack/RnModIface.hs index c52fce7..afdd89e 100644 --- a/compiler/backpack/RnModIface.hs +++ b/compiler/backpack/RnModIface.hs @@ -619,7 +619,7 @@ rnIfaceBndrs = mapM rnIfaceBndr rnIfaceBndr :: Rename IfaceBndr rnIfaceBndr (IfaceIdBndr (fs, ty)) = IfaceIdBndr <$> ((,) fs <$> rnIfaceType ty) -rnIfaceBndr (IfaceTvBndr tv_bndr) = IfaceIdBndr <$> rnIfaceTvBndr tv_bndr +rnIfaceBndr (IfaceTvBndr tv_bndr) = IfaceTvBndr <$> rnIfaceTvBndr tv_bndr rnIfaceTvBndr :: Rename IfaceTvBndr rnIfaceTvBndr (fs, kind) = (,) fs <$> rnIfaceType kind From git at git.haskell.org Fri Apr 20 22:05:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 22:05:15 +0000 (UTC) Subject: [commit: ghc] master: base: Add a test for T10412 (da74385) Message-ID: <20180420220515.45C933ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da7438526e4bfb1821aa77a22ff66a4a80baf8c6/ghc >--------------------------------------------------------------- commit da7438526e4bfb1821aa77a22ff66a4a80baf8c6 Author: Ben Gamari Date: Fri Apr 20 13:54:04 2018 -0400 base: Add a test for T10412 Expects the current behavior, will be updated by D4593 to reflect desired behavior. Reviewers: hvr Subscribers: thomie, carter GHC Trac Issues: #10412 Differential Revision: https://phabricator.haskell.org/D4610 >--------------------------------------------------------------- da7438526e4bfb1821aa77a22ff66a4a80baf8c6 libraries/base/tests/T10412.hs | 7 +++++++ .../should_run/T9858c.stdout => libraries/base/tests/T10412.stdout | 2 ++ libraries/base/tests/all.T | 1 + 3 files changed, 10 insertions(+) diff --git a/libraries/base/tests/T10412.hs b/libraries/base/tests/T10412.hs new file mode 100644 index 0000000..9657ef7 --- /dev/null +++ b/libraries/base/tests/T10412.hs @@ -0,0 +1,7 @@ +import Data.Char + +main :: IO () +main = do + print $ isMark '\768' + print $ isAlphaNum '\768' + print $ (isAlpha '\768', isNumber '\768') diff --git a/testsuite/tests/typecheck/should_run/T9858c.stdout b/libraries/base/tests/T10412.stdout similarity index 58% copy from testsuite/tests/typecheck/should_run/T9858c.stdout copy to libraries/base/tests/T10412.stdout index 78a8f06..b243ae6 100644 --- a/testsuite/tests/typecheck/should_run/T9858c.stdout +++ b/libraries/base/tests/T10412.stdout @@ -1 +1,3 @@ +True +True (False,False) diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 06c7350..0db147e 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -222,3 +222,4 @@ test('T3474', only_ways(['normal'])], compile_and_run, ['-O']) test('T14425', normal, compile_and_run, ['']) +test('T10412', normal, compile_and_run, ['']) From git at git.haskell.org Fri Apr 20 22:05:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 Apr 2018 22:05:31 +0000 (UTC) Subject: [commit: ghc] master: Remove unnecessary check in simplCast (2a5bdd9) Message-ID: <20180420220531.5EC993ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2a5bdd9adb1cb4afecd3303f0cfcc224be5ce745/ghc >--------------------------------------------------------------- commit 2a5bdd9adb1cb4afecd3303f0cfcc224be5ce745 Author: Tobias Dammers Date: Fri Apr 20 16:38:34 2018 -0400 Remove unnecessary check in simplCast The coercion optimizer will take care of it anyway, and the check is prohibitively expensive. See Trac #14737. Reviewers: bgamari Subscribers: simonpj, thomie, carter Differential Revision: https://phabricator.haskell.org/D4568 >--------------------------------------------------------------- 2a5bdd9adb1cb4afecd3303f0cfcc224be5ce745 compiler/coreSyn/CoreOpt.hs | 12 ++++++++---- testsuite/tests/perf/compiler/all.T | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 372c2ea..f1ff68d 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -958,8 +958,10 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) -- If the returned coercion is Nothing, then it would have been reflexive; -- it's faster not to compute it, though. pushCoTyArg co ty - | tyL `eqType` tyR - = Just (ty, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion + -- optimizer will take care of it. See Trac #14737. + -- -- | tyL `eqType` tyR + -- -- = Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) @@ -991,8 +993,10 @@ pushCoValArg :: CoercionR -> Maybe (Coercion, Maybe Coercion) -- If the second returned Coercion is actually Nothing, then no cast is necessary; -- the returned coercion would have been reflexive. pushCoValArg co - | tyL `eqType` tyR - = Just (mkRepReflCo arg, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion + -- optimizer will take care of it. See Trac #14737. + -- -- | tyL `eqType` tyR + -- -- = Just (mkRepReflCo arg, Nothing) | isFunTy tyL , (co1, co2) <- decomposeFunCo Representational co diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index ba36b41..2001cda 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -747,7 +747,7 @@ test('T9020', # 2014-07-31: 343005716 (Windows) (general round of updates) # 2017-03-24: 249904136 (x86/Linux, 64-bit machine) - (wordsize(64), 423163832, 10)]) + (wordsize(64), 562206104, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -761,6 +761,7 @@ test('T9020', # Program size collapses in first simplification # 2017-03-31: 493596312 Fix memory leak in simplifier # 2017-04-28: 423163832 Remove exponential behaviour in simplifier + # 2018-04-09: 562206104 Inexplicable, collateral of #14737 ], compile,['']) @@ -1039,7 +1040,7 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 134780272, 5), + [(wordsize(64), 141952368, 5), # initial: 125831400 # 2017-01-18: 133380960 Allow top-level string literals in Core # 2017-02-17: 153611448 Type-indexed Typeable @@ -1047,6 +1048,7 @@ test('T12425', # 2017-03-21: 134334800 Unclear # 2017-04-28: 127500136 Remove exponential behaviour in simplifier # 2017-05-23: 134780272 Addition of llvm-targets in dynflags (D3352) + # 2018-04-15: 141952368 Collateral of #14737 ]), ], compile, @@ -1116,7 +1118,7 @@ test('T13056', test('T12707', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1163821528, 5), + [(wordsize(64), 1237898376, 5), # initial: 1271577192 # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) @@ -1124,6 +1126,7 @@ test('T12707', # 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin) # 2017-03-02: 1231809592 Drift from recent simplifier improvements # 2017-05-14: 1163821528 (amd64/Linux) Two-pass CmmLayoutStack + # 2018-04-09: 1237898376 Inexplicable, collateral of #14737 ]), ], compile, @@ -1235,9 +1238,10 @@ test('T14697', test('T14683', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 14675353056, 10), + [(wordsize(64), 10521594688, 10), # initial: 25189145632 # 2018-04-19: 14675353056 Cache NthCo role (#14683) + # 2018-04-20: 10521594688 Remove unnecessary check in simplCast ]), ], multimod_compile, From git at git.haskell.org Sat Apr 21 11:26:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 Apr 2018 11:26:58 +0000 (UTC) Subject: [commit: ghc] master: s/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci] (98b0c3f) Message-ID: <20180421112658.93DD93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/98b0c3fd63fd052239259f985df45a4a01192914/ghc >--------------------------------------------------------------- commit 98b0c3fd63fd052239259f985df45a4a01192914 Author: Ömer Sinan Ağacan Date: Sat Apr 21 14:26:34 2018 +0300 s/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci] >--------------------------------------------------------------- 98b0c3fd63fd052239259f985df45a4a01192914 rts/sm/MarkWeak.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index 9a077b3d14..248bf63 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -32,11 +32,11 @@ /* ----------------------------------------------------------------------------- Weak Pointers - traverse_weak_ptr_list is called possibly many times during garbage + traverseWeakPtrList is called possibly many times during garbage collection. It returns a flag indicating whether it did any work (i.e. called evacuate on any live pointers). - Invariant: traverse_weak_ptr_list is called when the heap is in an + Invariant: traverseWeakPtrList is called when the heap is in an idempotent state. That means that there are no pending evacuate/scavenge operations. This invariant helps the weak pointer code decide which weak pointers are dead - if there are no @@ -60,7 +60,7 @@ Now, we discover which *threads* are still alive. Pointers to threads from the all_threads and main thread lists are the - weakest of all: a pointers from the finalizer of a dead weak + weakest of all: a pointer from the finalizer of a dead weak pointer can keep a thread alive. Any threads found to be unreachable are evacuated and placed on the resurrected_threads list so we can send them a signal later. @@ -72,7 +72,7 @@ -------------------------------------------------------------------------- */ /* Which stage of processing various kinds of weak pointer are we at? - * (see traverse_weak_ptr_list() below for discussion). + * (see traverseWeakPtrList() below for discussion). */ typedef enum { WeakPtrs, WeakThreads, WeakDone } WeakStage; static WeakStage weak_stage; @@ -185,7 +185,7 @@ traverseWeakPtrList(void) } default: - barf("traverse_weak_ptr_list"); + barf("traverseWeakPtrList"); return true; } } From git at git.haskell.org Sat Apr 21 16:10:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 Apr 2018 16:10:16 +0000 (UTC) Subject: [commit: ghc] master: rts: Use g0 for &generations[0] (ea01daf) Message-ID: <20180421161016.494413ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea01dafe89c150f073814f0f3a54a36215112ac4/ghc >--------------------------------------------------------------- commit ea01dafe89c150f073814f0f3a54a36215112ac4 Author: Ömer Sinan Ağacan Date: Sat Apr 21 19:09:15 2018 +0300 rts: Use g0 for &generations[0] [skip ci] >--------------------------------------------------------------- ea01dafe89c150f073814f0f3a54a36215112ac4 rts/sm/MarkWeak.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index 248bf63..0153539 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -378,14 +378,13 @@ static void checkWeakPtrSanity(StgWeak *hd, StgWeak *tl) void collectFreshWeakPtrs() { uint32_t i; - generation *gen = &generations[0]; // move recently allocated weak_ptr_list to the old list as well for (i = 0; i < n_capabilities; i++) { Capability *cap = capabilities[i]; if (cap->weak_ptr_list_tl != NULL) { IF_DEBUG(sanity, checkWeakPtrSanity(cap->weak_ptr_list_hd, cap->weak_ptr_list_tl)); - cap->weak_ptr_list_tl->link = gen->weak_ptr_list; - gen->weak_ptr_list = cap->weak_ptr_list_hd; + cap->weak_ptr_list_tl->link = g0->weak_ptr_list; + g0->weak_ptr_list = cap->weak_ptr_list_hd; cap->weak_ptr_list_tl = NULL; cap->weak_ptr_list_hd = NULL; } else { From git at git.haskell.org Sat Apr 21 19:21:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 Apr 2018 19:21:54 +0000 (UTC) Subject: [commit: ghc] master: Remove a outdated comment [skip ci] (c7c53c6) Message-ID: <20180421192154.D7B0E3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c7c53c69bfa26543a0a6d42bc00a6c0b30baab1d/ghc >--------------------------------------------------------------- commit c7c53c69bfa26543a0a6d42bc00a6c0b30baab1d Author: Ömer Sinan Ağacan Date: Sat Apr 21 22:21:29 2018 +0300 Remove a outdated comment [skip ci] >--------------------------------------------------------------- c7c53c69bfa26543a0a6d42bc00a6c0b30baab1d rts/sm/GC.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/rts/sm/GC.c b/rts/sm/GC.c index cadf557..1e07948 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -1530,9 +1530,6 @@ collect_gct_blocks (void) take a global lock. Here we collect those blocks from the cap->pinned_object_blocks lists and put them on the main g0->large_object list. - - Returns: the number of words allocated this way, for stats - purposes. -------------------------------------------------------------------------- */ static void From git at git.haskell.org Sun Apr 22 07:28:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 Apr 2018 07:28:05 +0000 (UTC) Subject: [commit: ghc] master: Typo fix in scavenge_one comment [skip ci] (bfc1fc2) Message-ID: <20180422072805.541283ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bfc1fc2566944a455572303cbb2cbbf0c539c871/ghc >--------------------------------------------------------------- commit bfc1fc2566944a455572303cbb2cbbf0c539c871 Author: Ömer Sinan Ağacan Date: Sun Apr 22 10:27:17 2018 +0300 Typo fix in scavenge_one comment [skip ci] >--------------------------------------------------------------- bfc1fc2566944a455572303cbb2cbbf0c539c871 rts/sm/Scav.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 1ae8a4c..8b4c80e 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -1365,7 +1365,7 @@ scavenge_one(StgPtr p) case WEAK: // This WEAK object will not be considered by tidyWeakList during this - // collection because it is in a generation >= N, but it is on the + // collection because it is in a generation > N, but it is on the // mutable list so we must evacuate all of its pointers because some // of them may point into a younger generation. scavengeLiveWeak((StgWeak *)p); From git at git.haskell.org Mon Apr 23 14:34:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 14:34:35 +0000 (UTC) Subject: [commit: ghc] master: coercion: Improve debugging output (2eafd76) Message-ID: <20180423143435.BEBDA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2eafd7670e83cb8684585829d5b4bbcc69d34c70/ghc >--------------------------------------------------------------- commit 2eafd7670e83cb8684585829d5b4bbcc69d34c70 Author: Simon Peyton Jones Date: Mon Apr 23 09:38:35 2018 -0400 coercion: Improve debugging output * Improve assertion-failure message * Add HasDebugCallStack to decomposeFunCo Reviewers: goldfire, bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4570 >--------------------------------------------------------------- 2eafd7670e83cb8684585829d5b4bbcc69d34c70 compiler/types/Coercion.hs | 82 ++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index ff41529..4255e4a 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -239,8 +239,10 @@ decomposeCo arity co rs = [mkNthCo r n co | (n,r) <- [0..(arity-1)] `zip` rs ] -- Remember, Nth is zero-indexed -decomposeFunCo :: Role -- of the input coercion - -> Coercion -> (Coercion, Coercion) +decomposeFunCo :: HasDebugCallStack + => Role -- Role of the input coercion + -> Coercion -- Input coercion + -> (Coercion, Coercion) -- Expects co :: (s1 -> t1) ~ (s2 -> t2) -- Returns (co1 :: s1~s2, co2 :: t1~t2) -- See Note [Function coercions] for the "2" and "3" @@ -839,44 +841,11 @@ mkNthCo :: HasDebugCallStack -> Coercion -> Coercion mkNthCo r n co - = ASSERT(good_call) + = ASSERT2( good_call, bad_call_msg ) go r n co where Pair ty1 ty2 = coercionKind co - good_call - -- If the Coercion passed in is between forall-types, then the Int must - -- be 0 and the role must be Nominal. - | Just (_tv1, _) <- splitForAllTy_maybe ty1 - , Just (_tv2, _) <- splitForAllTy_maybe ty2 - = n == 0 && r == Nominal - - -- If the Coercion passed in is between T tys and T tys', then the Int - -- must be less than the length of tys/tys' (which must be the same - -- lengths). - -- - -- If the role of the Coercion is nominal, then the role passed in must - -- be nominal. If the role of the Coercion is representational, then the - -- role passed in must be tyConRolesRepresentational T !! n. If the role - -- of the Coercion is Phantom, then the role passed in must be Phantom. - -- - -- See also Note [NthCo Cached Roles] if you're wondering why it's - -- blaringly obvious that we should be *computing* this role instead of - -- passing it in. - | Just (tc1, tys1) <- splitTyConApp_maybe ty1 - , Just (tc2, tys2) <- splitTyConApp_maybe ty2 - , tc1 == tc2 - = let len1 = length tys1 - len2 = length tys2 - good_role = case coercionRole co of - Nominal -> r == Nominal - Representational -> r == (tyConRolesRepresentational tc1 !! n) - Phantom -> r == Phantom - in len1 == len2 && n < len1 && good_role - - | otherwise - = True - go r 0 (Refl _ ty) | Just (tv, _) <- splitForAllTy_maybe ty = ASSERT( r == Nominal ) @@ -930,6 +899,47 @@ mkNthCo r n co go r n co = NthCo r n co + -- Assertion checking + bad_call_msg = vcat [ text "Coercion =" <+> ppr co + , text "LHS ty =" <+> ppr ty1 + , text "RHS ty =" <+> ppr ty2 + , text "n =" <+> ppr n, text "r =" <+> ppr r + , text "coercion role =" <+> ppr (coercionRole co) ] + good_call + -- If the Coercion passed in is between forall-types, then the Int must + -- be 0 and the role must be Nominal. + | Just (_tv1, _) <- splitForAllTy_maybe ty1 + , Just (_tv2, _) <- splitForAllTy_maybe ty2 + = n == 0 && r == Nominal + + -- If the Coercion passed in is between T tys and T tys', then the Int + -- must be less than the length of tys/tys' (which must be the same + -- lengths). + -- + -- If the role of the Coercion is nominal, then the role passed in must + -- be nominal. If the role of the Coercion is representational, then the + -- role passed in must be tyConRolesRepresentational T !! n. If the role + -- of the Coercion is Phantom, then the role passed in must be Phantom. + -- + -- See also Note [NthCo Cached Roles] if you're wondering why it's + -- blaringly obvious that we should be *computing* this role instead of + -- passing it in. + | Just (tc1, tys1) <- splitTyConApp_maybe ty1 + , Just (tc2, tys2) <- splitTyConApp_maybe ty2 + , tc1 == tc2 + = let len1 = length tys1 + len2 = length tys2 + good_role = case coercionRole co of + Nominal -> r == Nominal + Representational -> r == (tyConRolesRepresentational tc1 !! n) + Phantom -> r == Phantom + in len1 == len2 && n < len1 && good_role + + | otherwise + = True + + + -- | If you're about to call @mkNthCo r n co@, then @r@ should be -- whatever @nthCoRole n co@ returns. nthCoRole :: Int -> Coercion -> Role From git at git.haskell.org Mon Apr 23 14:34:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 14:34:38 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Fix up formatting in 8.6 release notes (f19b07a) Message-ID: <20180423143438.85CEF3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f19b07af673ab96b3d373790bb3fdd6b4de96a01/ghc >--------------------------------------------------------------- commit f19b07af673ab96b3d373790bb3fdd6b4de96a01 Author: Ben Gamari Date: Sun Apr 22 18:32:53 2018 -0400 users-guide: Fix up formatting in 8.6 release notes >--------------------------------------------------------------- f19b07af673ab96b3d373790bb3fdd6b4de96a01 docs/users_guide/8.6.1-notes.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst index 25a4ac3..fea86ae 100644 --- a/docs/users_guide/8.6.1-notes.rst +++ b/docs/users_guide/8.6.1-notes.rst @@ -118,7 +118,7 @@ Runtime system - The GHC runtime linker now uses ``LIBRARY_PATH`` and the runtime loader now also searches ``LD_LIBRARY_PATH``. -- The GHC runtime on Windows is no longer constrained by MAX_PATH. +- The GHC runtime on Windows is no longer constrained by ``MAX_PATH``. Template Haskell ~~~~~~~~~~~~~~~~ @@ -134,7 +134,7 @@ Template Haskell - ``($!)`` is now representation-polymorphic like ``($)``. - The module ``Data.Functor.Contravariant`` has been moved from the - ``contravariant`` package into base. All the other modules in + ``contravariant`` package into ``base``. All the other modules in ``contravariant`` (``Data.Functor.Contravariant.Divisible``, etc.) have not been moved to ``base``, and they still reside in ``contravariant``. @@ -146,7 +146,7 @@ Windows Paths ~~~~~~~~~~~~~ Windows paths are not all the same. The different kinds of paths each have -different meanings. The MAX_PATH limitation is not a limitation of the Operating +different meanings. The ``MAX_PATH`` limitation is not a limitation of the Operating System nor the File System. It is a limitation of the default namespace enforced by the Win32 API for backwards compatibility. @@ -156,9 +156,9 @@ PATH. The namespaces are: - - file namespace: \\?\ - - device namespace: \\.\ - - nt namespace: \ + - file namespace: ``\\?\`` + - device namespace: ``\\.\`` + - nt namespace: ``\`` Each of these turn off Path processing completely by the Win32 API and the paths are passed untouched to the filesystem. @@ -172,7 +172,7 @@ The Haskell I/O manager will now automatically promote paths in the legacy format to Win32 file namespace. By default the I/O manager will do two things to your paths: - - replace / with \\ + - replace ``/`` with ``\\`` - expand relative paths to absolute paths If you want to opt out of all preprocessing just expliticly use namespaces in From git at git.haskell.org Mon Apr 23 17:03:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 17:03:51 +0000 (UTC) Subject: [commit: ghc] master: Add testcase for #15050 (f04ac4d) Message-ID: <20180423170351.7DC103ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f04ac4d4d0811f48c68fecacefb262039ee33239/ghc >--------------------------------------------------------------- commit f04ac4d4d0811f48c68fecacefb262039ee33239 Author: Joachim Breitner Date: Mon Apr 23 13:02:50 2018 -0400 Add testcase for #15050 so that we notice if someone accidentially implements this... >--------------------------------------------------------------- f04ac4d4d0811f48c68fecacefb262039ee33239 testsuite/tests/typecheck/should_compile/T15050.hs | 21 +++++++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 22 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T15050.hs b/testsuite/tests/typecheck/should_compile/T15050.hs new file mode 100644 index 0000000..ed5f095 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T15050.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE GADTs #-} +module T15050 where +data P a = P +data T1 a where + MkT1a :: forall a. P a -> T1 a + MkT1b :: forall a. P a -> T1 a + MkT1c :: forall a. P a -> T1 a + MkT2 :: forall a. P a -> T1 (a,a) + MkT3 :: forall a b. b ~ Int => P a -> P b -> T1 a + MkT4 :: forall a b. P a -> P b -> T1 a + MkT5 :: forall a b c. b ~ c => P a -> P b -> P c -> T1 a + +foo :: T1 (Int, Int) -> () +foo (MkT1a (P::P (Int,Int))) = () +foo (MkT1b (P::P (Int,x))) = (() :: x ~ Int => ()) +foo (MkT1c (P::P x)) = (() :: x ~ (Int,Int) => ()) +foo (MkT2 (P::P x)) = (() :: x ~ Int => ()) +foo (MkT3 P (P::P Int)) = () +foo (MkT4 P (P::P b)) = () +foo (MkT5 P (P::P b) (P::P b)) = () diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 70e52cf..80a8b0e 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -602,3 +602,4 @@ test('T14934', [extra_files(['T14934.hs', 'T14934a.hs'])], run_command, test('T13643', normal, compile, ['']) test('SplitWD', normal, compile, ['']) test('T14441', normal, compile, ['']) +test('T15050', [expect_broken(15050)], compile, ['']) From git at git.haskell.org Mon Apr 23 17:34:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 17:34:42 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T15050' created Message-ID: <20180423173442.786E43ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T15050 Referencing: 1c8605c64e7e101a53e8ec948d4c15e920850027 From git at git.haskell.org Mon Apr 23 17:34:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 17:34:45 +0000 (UTC) Subject: [commit: ghc] wip/T15050: Use TauTv for pattern signature variables #15050 (2be9001) Message-ID: <20180423173445.4A8DA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15050 Link : http://ghc.haskell.org/trac/ghc/changeset/2be900108ed862d090bb7475aeb48a9a273e81fb/ghc >--------------------------------------------------------------- commit 2be900108ed862d090bb7475aeb48a9a273e81fb Author: Joachim Breitner Date: Mon Apr 23 13:13:37 2018 -0400 Use TauTv for pattern signature variables #15050 just to see what happens. This commit does not yet * update all the notes * rename `SigTv` to `TauTv`, as it should: Originally, `SigTv` was only used in pattern signatures (and a note still claims that). But then it seems that the same behaviour is also needed for kind variables. So this patch tries to not touch the effect on kind variables, but it would be odd to continue to call them `PatTv`. These things will be done once we decide we actually want this feature. >--------------------------------------------------------------- 2be900108ed862d090bb7475aeb48a9a273e81fb compiler/typecheck/TcHsType.hs | 14 +++----------- compiler/typecheck/TcMType.hs | 10 +++++++++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 6874a74..6974d54 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -18,8 +18,8 @@ module TcHsType ( tcHsDeriv, tcHsVectInst, tcHsTypeApp, UserTypeCtxt(..), - tcImplicitTKBndrs, tcImplicitTKBndrsX, tcImplicitTKBndrsSig, - tcExplicitTKBndrs, tcExplicitTKBndrsX, tcExplicitTKBndrsSig, + tcImplicitTKBndrs, tcImplicitTKBndrsX, + tcExplicitTKBndrs, tcExplicitTKBndrsX, kcExplicitTKBndrs, kcImplicitTKBndrs, -- Type checking type and class decls @@ -1806,14 +1806,6 @@ tcExplicitTKBndrs :: SkolemInfo -- No cloning: returned TyVars have the same Name as the incoming LHsTyVarBndrs tcExplicitTKBndrs = tcExplicitTKBndrsX newSkolemTyVar --- | This brings a bunch of tyvars into scope as SigTvs, where they can unify --- with other type *variables* only. -tcExplicitTKBndrsSig :: SkolemInfo - -> [LHsTyVarBndr GhcRn] - -> TcM a - -> TcM ([TcTyVar], a) -tcExplicitTKBndrsSig = tcExplicitTKBndrsX newSigTyVar - tcExplicitTKBndrsX :: (Name -> Kind -> TcM TyVar) -> SkolemInfo -> [LHsTyVarBndr GhcRn] @@ -2470,7 +2462,7 @@ tcHsPatSigType ctxt sig_ty new_tv = case ctxt of RuleSigCtxt {} -> newSkolemTyVar - _ -> newSigTyVar + _ -> newTauTyVar -- See Note [Pattern signature binders] -- See Note [Unifying SigTvs] diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index b1bc1d0..e493715 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -55,7 +55,7 @@ module TcMType ( -- Instantiation newMetaTyVars, newMetaTyVarX, newMetaTyVarsX, newMetaSigTyVars, newMetaSigTyVarX, - newSigTyVar, newSkolemTyVar, newWildCardX, + newSigTyVar, newTauTyVar, newSkolemTyVar, newWildCardX, tcInstType, tcInstSkolTyVars,tcInstSkolTyVarsX, tcInstSuperSkolTyVarsX, @@ -613,6 +613,14 @@ newSigTyVar name kind ; traceTc "newSigTyVar" (ppr tyvar) ; return tyvar } +newTauTyVar :: Name -> Kind -> TcM TcTyVar +newTauTyVar name kind + = do { details <- newMetaDetails TauTv + ; let tyvar = mkTcTyVar name kind details + ; traceTc "newTauTyVar" (ppr tyvar) + ; return tyvar } + + -- makes a new skolem tv newSkolemTyVar :: Name -> Kind -> TcM TcTyVar newSkolemTyVar name kind = do { lvl <- getTcLevel From git at git.haskell.org Mon Apr 23 17:34:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 17:34:48 +0000 (UTC) Subject: [commit: ghc] wip/T15050: Update test suite output (1c8605c) Message-ID: <20180423173448.253583ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15050 Link : http://ghc.haskell.org/trac/ghc/changeset/1c8605c64e7e101a53e8ec948d4c15e920850027/ghc >--------------------------------------------------------------- commit 1c8605c64e7e101a53e8ec948d4c15e920850027 Author: Joachim Breitner Date: Mon Apr 23 13:17:17 2018 -0400 Update test suite output test #15050 passes now (duh). Other outputs now no longer trip over type variables in pattern signatures being bound to full types, and thus give different error messages, but nothing worrying, as far as I can tell. >--------------------------------------------------------------- 1c8605c64e7e101a53e8ec948d4c15e920850027 testsuite/tests/typecheck/should_compile/all.T | 2 +- testsuite/tests/typecheck/should_compile/tc141.stderr | 12 ++++++------ testsuite/tests/typecheck/should_fail/T5689.stderr | 14 +++++--------- testsuite/tests/typecheck/should_fail/T5691.stderr | 9 --------- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 80a8b0e..690ead6 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -602,4 +602,4 @@ test('T14934', [extra_files(['T14934.hs', 'T14934a.hs'])], run_command, test('T13643', normal, compile, ['']) test('SplitWD', normal, compile, ['']) test('T14441', normal, compile, ['']) -test('T15050', [expect_broken(15050)], compile, ['']) +test('T15050', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index 9c13f17..5fa0854 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -35,11 +35,11 @@ tc141.hs:13:13: error: in v tc141.hs:15:18: error: - • Couldn't match expected type ‘a2’ with actual type ‘p’ - because type variable ‘a2’ would escape its scope + • Couldn't match expected type ‘a1’ with actual type ‘p1’ + because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - v :: forall a2. a2 + v :: forall a1. a1 at tc141.hs:14:14-19 • In the expression: b In an equation for ‘v’: v = b @@ -49,6 +49,6 @@ tc141.hs:15:18: error: v = b in v • Relevant bindings include - v :: a2 (bound at tc141.hs:15:14) - b :: p (bound at tc141.hs:13:5) - g :: a -> p -> a1 (bound at tc141.hs:13:1) + v :: a1 (bound at tc141.hs:15:14) + b :: p1 (bound at tc141.hs:13:5) + g :: p -> p1 -> a (bound at tc141.hs:13:1) diff --git a/testsuite/tests/typecheck/should_fail/T5689.stderr b/testsuite/tests/typecheck/should_fail/T5689.stderr index 2c7eaa8..5385f57 100644 --- a/testsuite/tests/typecheck/should_fail/T5689.stderr +++ b/testsuite/tests/typecheck/should_fail/T5689.stderr @@ -1,10 +1,6 @@ -T5689.hs:10:36: error: - • Couldn't match expected type ‘Bool’ with actual type ‘t’ - • In the expression: v - In the expression: if v then False else True - In the second argument of ‘writeIORef’, namely - ‘(\ v -> if v then False else True)’ - • Relevant bindings include - v :: t (bound at T5689.hs:10:28) - r :: IORef (t -> t) (bound at T5689.hs:7:14) +T5689.hs:15:23: error: + • No instance for (Num Bool) arising from the literal ‘1234’ + • In the first argument of ‘c’, namely ‘1234’ + In the second argument of ‘($)’, namely ‘c 1234’ + In a stmt of a 'do' block: print $ c 1234 diff --git a/testsuite/tests/typecheck/should_fail/T5691.stderr b/testsuite/tests/typecheck/should_fail/T5691.stderr index ad5c7e4..d06a4f4 100644 --- a/testsuite/tests/typecheck/should_fail/T5691.stderr +++ b/testsuite/tests/typecheck/should_fail/T5691.stderr @@ -1,13 +1,4 @@ -T5691.hs:14:9: error: - • Couldn't match type ‘p’ with ‘PrintRuleInterp’ - Expected type: PrintRuleInterp a - Actual type: p a - • When checking that the pattern signature: p a - fits the type of its context: PrintRuleInterp a - In the pattern: f :: p a - In an equation for ‘test’: test (f :: p a) = MkPRI $ printRule_ f - T5691.hs:24:10: error: • No instance for (Alternative RecDecParser) arising from the superclasses of an instance declaration From git at git.haskell.org Mon Apr 23 20:54:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 Apr 2018 20:54:18 +0000 (UTC) Subject: [commit: ghc] wip/T15050: Mark test case for #7786 as succeeding (2b8eb54) Message-ID: <20180423205419.007563ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15050 Link : http://ghc.haskell.org/trac/ghc/changeset/2b8eb5450c60ec5b3705af263b4e40cdc8df838a/ghc >--------------------------------------------------------------- commit 2b8eb5450c60ec5b3705af263b4e40cdc8df838a Author: Joachim Breitner Date: Mon Apr 23 16:52:24 2018 -0400 Mark test case for #7786 as succeeding previously, the code was not allowed due to ScopedTypeVariables being restricted to refer to variables, and this led to a bad error message. Now the program is accepted and the test case compiles. >--------------------------------------------------------------- 2b8eb5450c60ec5b3705af263b4e40cdc8df838a .../{should_fail => should_compile}/T7786.hs | 0 testsuite/tests/indexed-types/should_compile/all.T | 1 + .../tests/indexed-types/should_fail/T7786.stderr | 49 ---------------------- testsuite/tests/indexed-types/should_fail/all.T | 1 - 4 files changed, 1 insertion(+), 50 deletions(-) diff --git a/testsuite/tests/indexed-types/should_fail/T7786.hs b/testsuite/tests/indexed-types/should_compile/T7786.hs similarity index 100% rename from testsuite/tests/indexed-types/should_fail/T7786.hs rename to testsuite/tests/indexed-types/should_compile/T7786.hs diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T index 1a5e5d4..943a45e 100644 --- a/testsuite/tests/indexed-types/should_compile/all.T +++ b/testsuite/tests/indexed-types/should_compile/all.T @@ -274,3 +274,4 @@ test('T14237', normal, compile, ['']) test('T14554', normal, compile, ['']) test('T14680', normal, compile, ['']) test('T15057', normal, compile, ['']) +test('T7786', normal, compile, ['']) diff --git a/testsuite/tests/indexed-types/should_fail/T7786.stderr b/testsuite/tests/indexed-types/should_fail/T7786.stderr deleted file mode 100644 index 89984ca..0000000 --- a/testsuite/tests/indexed-types/should_fail/T7786.stderr +++ /dev/null @@ -1,49 +0,0 @@ - -T7786.hs:94:41: error: - • Couldn't match type ‘xxx’ - with ‘Intersect (BuriedUnder sub k 'Empty) inv’ - Expected type: Maybe (Sing xxx) - Actual type: Maybe - (Sing (Intersect (BuriedUnder sub k 'Empty) inv)) - • In a stmt of a 'do' block: Nil :: Sing xxx <- foogle db k sub - In the expression: - do Nil :: Sing xxx <- foogle db k sub - return $ Sub db k sub - In an equation for ‘addSub’: - addSub db k sub - = do Nil :: Sing xxx <- foogle db k sub - return $ Sub db k sub - • Relevant bindings include - sub :: Database sub (bound at T7786.hs:94:13) - k :: Sing k (bound at T7786.hs:94:11) - db :: Database inv (bound at T7786.hs:94:8) - addSub :: Database inv - -> Sing k - -> Database sub - -> Maybe (Database (BuriedUnder sub k inv)) - (bound at T7786.hs:94:1) - -T7786.hs:95:31: error: - • Could not deduce: Intersect (BuriedUnder sub k 'Empty) inv - ~ - 'Empty - arising from a use of ‘Sub’ - from the context: xxx ~ 'Empty - bound by a pattern with constructor: Nil :: forall a. Sing 'Empty, - in a pattern binding in - 'do' block - at T7786.hs:94:22-24 - • In the second argument of ‘($)’, namely ‘Sub db k sub’ - In a stmt of a 'do' block: return $ Sub db k sub - In the expression: - do Nil :: Sing xxx <- foogle db k sub - return $ Sub db k sub - • Relevant bindings include - sub :: Database sub (bound at T7786.hs:94:13) - k :: Sing k (bound at T7786.hs:94:11) - db :: Database inv (bound at T7786.hs:94:8) - addSub :: Database inv - -> Sing k - -> Database sub - -> Maybe (Database (BuriedUnder sub k inv)) - (bound at T7786.hs:94:1) diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 4d25d97..a4fb6e7 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -87,7 +87,6 @@ test('T7536', normal, compile_fail, ['']) test('T7729', normal, compile_fail, ['']) test('T7729a', normal, compile_fail, ['']) -test('T7786', normal, compile_fail, ['']) test('NoGood', normal, compile_fail, ['']) test('T7967', normal, compile_fail, ['']) From git at git.haskell.org Tue Apr 24 16:08:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 Apr 2018 16:08:59 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix overflow in T13623 on 32-bit machines (1126e69) Message-ID: <20180424160859.311573ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1126e6942624f4e6578e59b2a28b9848ad9fcea2/ghc >--------------------------------------------------------------- commit 1126e6942624f4e6578e59b2a28b9848ad9fcea2 Author: Ben Gamari Date: Mon Apr 23 10:41:38 2018 -0400 testsuite: Fix overflow in T13623 on 32-bit machines We simply truncate the result to 32-bits to ensure that the test passed under both environments. Test Plan: Validate on 32-bit Subscribers: thomie, carter GHC Trac Issues: #13623 Differential Revision: https://phabricator.haskell.org/D4615 >--------------------------------------------------------------- 1126e6942624f4e6578e59b2a28b9848ad9fcea2 testsuite/tests/perf/should_run/T13623.hs | 5 ++++- testsuite/tests/perf/should_run/T13623.stdout | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/should_run/T13623.hs b/testsuite/tests/perf/should_run/T13623.hs index 7a048b2..83004f3 100644 --- a/testsuite/tests/perf/should_run/T13623.hs +++ b/testsuite/tests/perf/should_run/T13623.hs @@ -4,6 +4,7 @@ module Main where +import Data.Int import GHC.Types @@ -16,7 +17,9 @@ foo = \i j -> sfoldl' (+) 0 $ xs i j +++ ys i j {-# Inline foo #-} -main = do { n <- foo 1 1; print n } +-- We narrow the result to 32-bits to account for the fact that this overflows +-- on 32-bit machines. +main = do { n <- foo 1 1; print (fromIntegral n :: Int32) } diff --git a/testsuite/tests/perf/should_run/T13623.stdout b/testsuite/tests/perf/should_run/T13623.stdout index ac3eff3..c94819c 100644 --- a/testsuite/tests/perf/should_run/T13623.stdout +++ b/testsuite/tests/perf/should_run/T13623.stdout @@ -1 +1 @@ -65000250000 +575740560 From git at git.haskell.org Tue Apr 24 16:09:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 Apr 2018 16:09:01 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix T4442 on 32-bit architectures (ec9638b) Message-ID: <20180424160901.F26393ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ec9638b222433b33943b3c4319d1d5cf91313b0c/ghc >--------------------------------------------------------------- commit ec9638b222433b33943b3c4319d1d5cf91313b0c Author: Ben Gamari Date: Mon Apr 23 10:42:17 2018 -0400 testsuite: Fix T4442 on 32-bit architectures This relied on Int# being 64-bits. This is nothing a bit of CPP can't fix, but I think the right solution would be to make out treatment of word-size dependent types more consistent, as suggested by #11953. Test Plan: Validate on i386 Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4614 >--------------------------------------------------------------- ec9638b222433b33943b3c4319d1d5cf91313b0c testsuite/tests/primops/should_run/T4442.hs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/primops/should_run/T4442.hs b/testsuite/tests/primops/should_run/T4442.hs index 76320e4..0d09f62 100644 --- a/testsuite/tests/primops/should_run/T4442.hs +++ b/testsuite/tests/primops/should_run/T4442.hs @@ -111,6 +111,33 @@ testIntArray name0 index read write val0 len = do (intToBytes val len) len +#if WORD_SIZE_IN_BITS == 64 +testInt64Array = testIntArray +#else +testInt64Array :: + String + -> (ByteArray# -> Int# -> Int64#) + -> (MutableByteArray# RealWorld -> Int# -> State# RealWorld + -> (# State# RealWorld, Int64# #)) + -> (MutableByteArray# RealWorld -> Int# -> Int64# -> State# RealWorld + -> State# RealWorld) + -> Int + -> Int + -> IO () +testInt64Array name0 index read write val0 len = do + doOne (name0 ++ " positive") val0 + doOne (name0 ++ " negative") (negate val0) + where + doOne name val = test + name + (\arr i -> I64# (index arr i)) + (\arr i s -> case read arr i s of (# s', a #) -> (# s', I# a #)) + (\arr i (I64# a) s -> write arr i a s) + val + (intToBytes val len) + len +#endif + testWordArray :: String -> (ByteArray# -> Int# -> Word#) @@ -172,7 +199,7 @@ main = do testIntArray "Int32#" indexWord8ArrayAsInt32# readWord8ArrayAsInt32# writeWord8ArrayAsInt32# 12345678 4 - testIntArray "Int64#" + testInt64Array "Int64#" indexWord8ArrayAsInt64# readWord8ArrayAsInt64# writeWord8ArrayAsInt64# 1234567890123 8 testIntArray "Int#" From git at git.haskell.org Tue Apr 24 16:09:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 Apr 2018 16:09:04 +0000 (UTC) Subject: [commit: ghc] master: ghc-prim: Refactor and document __sync_fetch_and_nand workaround (e732210) Message-ID: <20180424160904.BDC693ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e7322107d3647e5d3097eeca878e036b1c98557b/ghc >--------------------------------------------------------------- commit e7322107d3647e5d3097eeca878e036b1c98557b Author: Ben Gamari Date: Mon Apr 23 10:40:34 2018 -0400 ghc-prim: Refactor and document __sync_fetch_and_nand workaround ed6f9fb9d5a684d2159c29633159c3254cf04deb reduced the scope of this hack to only include Clangs which actually lack __sync_fetch_and_nand. However, this causes GHC to fail to build with -Werror on Clang due to the lack of the -Wsync-nand warning flag. As it turns out a flag controlling the warning is available under a different name, however. Test Plan: Validate with Clang, GCC Subscribers: thomie, carter GHC Trac Issues: #9678 Differential Revision: https://phabricator.haskell.org/D4613 >--------------------------------------------------------------- e7322107d3647e5d3097eeca878e036b1c98557b libraries/ghc-prim/cbits/atomic.c | 75 +++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/libraries/ghc-prim/cbits/atomic.c b/libraries/ghc-prim/cbits/atomic.c index b238041..0a471b3 100644 --- a/libraries/ghc-prim/cbits/atomic.c +++ b/libraries/ghc-prim/cbits/atomic.c @@ -107,7 +107,44 @@ hs_atomic_and64(StgWord x, StgWord64 val) // FetchNandByteArrayOp_Int -// Workaround for http://llvm.org/bugs/show_bug.cgi?id=8842 +// Note [__sync_fetch_and_nand usage] +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// The __sync_fetch_and_nand builtin is a bit of a disaster. It was introduced +// in GCC long ago with silly semantics. Specifically: +// +// *ptr = ~(tmp & value) +// +// Clang introduced the builtin with the same semantics. +// +// In GCC 4.4 the operation's semantics were rightly changed to, +// +// *ptr = ~tmp & value +// +// and the -Wsync-nand warning was added warning users of the operation about +// the change. +// +// Clang took this change as a reason to remove support for the +// builtin in 2010. Then, in 2014 Clang re-added support with the new +// semantics. However, the warning flag was given a different name +// (-Wsync-fetch-and-nand-semantics-changed) for added fun. +// +// Consequently, we are left with a bit of a mess: GHC requires GCC >4.4 +// (enforced by the FP_GCC_VERSION autoconf check), so we thankfully don't need +// to support the operation's older broken semantics. However, we need to take +// care to explicitly disable -Wsync-nand wherever possible, lest the build +// fails with -Werror. Furthermore, we need to emulate the operation when +// building with some Clang versions (shipped by some Mac OS X releases) which +// lack support for the builtin. +// +// In the words of Bob Dylan: everything is broken. +// +// See also: +// +// * https://bugs.llvm.org/show_bug.cgi?id=8842 +// * https://ghc.haskell.org/trac/ghc/ticket/9678 +// + #define CAS_NAND(x, val) \ { \ __typeof__ (*(x)) tmp = *(x); \ @@ -117,14 +154,22 @@ hs_atomic_and64(StgWord x, StgWord64 val) return tmp; \ } -// This is only provided by clang +// N.B. __has_builtin is only provided by clang #if !defined(__has_builtin) #define __has_builtin(x) 0 #endif +#if defined(__clang__) && !__has_builtin(__sync_fetch_and_nand) +#define USE_SYNC_FETCH_AND_NAND 0 +#else +#define USE_SYNC_FETCH_AND_NAND 1 +#endif + // Otherwise this fails with -Werror -#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push +#if defined(__clang__) +#pragma GCC diagnostic ignored "-Wsync-fetch-and-nand-semantics-changed" +#elif defined(__GNUC__) #pragma GCC diagnostic ignored "-Wsync-nand" #endif @@ -132,10 +177,10 @@ extern StgWord hs_atomic_nand8(StgWord x, StgWord val); StgWord hs_atomic_nand8(StgWord x, StgWord val) { -#if defined(__clang__) && __has_builtin(__sync_fetch_and_nand) - CAS_NAND((volatile StgWord8 *) x, (StgWord8) val) -#else +#if USE_SYNC_FETCH_AND_NAND return __sync_fetch_and_nand((volatile StgWord8 *) x, (StgWord8) val); +#else + CAS_NAND((volatile StgWord8 *) x, (StgWord8) val) #endif } @@ -143,10 +188,10 @@ extern StgWord hs_atomic_nand16(StgWord x, StgWord val); StgWord hs_atomic_nand16(StgWord x, StgWord val) { -#if defined(__clang__) && __has_builtin(__sync_fetch_and_nand) - CAS_NAND((volatile StgWord16 *) x, (StgWord16) val); -#else +#if USE_SYNC_FETCH_AND_NAND return __sync_fetch_and_nand((volatile StgWord16 *) x, (StgWord16) val); +#else + CAS_NAND((volatile StgWord16 *) x, (StgWord16) val); #endif } @@ -154,10 +199,10 @@ extern StgWord hs_atomic_nand32(StgWord x, StgWord val); StgWord hs_atomic_nand32(StgWord x, StgWord val) { -#if defined(__clang__) && __has_builtin(__sync_fetch_and_nand) - CAS_NAND((volatile StgWord32 *) x, (StgWord32) val); -#else +#if USE_SYNC_FETCH_AND_NAND return __sync_fetch_and_nand((volatile StgWord32 *) x, (StgWord32) val); +#else + CAS_NAND((volatile StgWord32 *) x, (StgWord32) val); #endif } @@ -166,10 +211,10 @@ extern StgWord64 hs_atomic_nand64(StgWord x, StgWord64 val); StgWord64 hs_atomic_nand64(StgWord x, StgWord64 val) { -#if defined(__clang__) && __has_builtin(__sync_fetch_and_nand) - CAS_NAND((volatile StgWord64 *) x, val); -#else +#if USE_SYNC_FETCH_AND_NAND return __sync_fetch_and_nand((volatile StgWord64 *) x, val); +#else + CAS_NAND((volatile StgWord64 *) x, val); #endif } #endif From git at git.haskell.org Wed Apr 25 17:43:36 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 17:43:36 +0000 (UTC) Subject: [commit: ghc] master: Stable.c: minor refactoring, add/update some comments (acb7361) Message-ID: <20180425174336.A2AA53ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/acb73617abb23a16c2195459d8cefbf3febe26f3/ghc >--------------------------------------------------------------- commit acb73617abb23a16c2195459d8cefbf3febe26f3 Author: Ömer Sinan Ağacan Date: Wed Apr 25 20:42:26 2018 +0300 Stable.c: minor refactoring, add/update some comments Test Plan: Passes validate Reviewers: simonmar, bgamari, erikd Subscribers: thomie, carter GHC Trac Issues: #10296 Differential Revision: https://phabricator.haskell.org/D4627 >--------------------------------------------------------------- acb73617abb23a16c2195459d8cefbf3febe26f3 includes/rts/Stable.h | 16 ++++++++++++---- rts/Stable.c | 49 ++++++++++++++++++++----------------------------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/includes/rts/Stable.h b/includes/rts/Stable.h index 75fcf4f..4550ad6 100644 --- a/includes/rts/Stable.h +++ b/includes/rts/Stable.h @@ -21,13 +21,21 @@ StgStablePtr getStablePtr (StgPtr p); -------------------------------------------------------------------------- */ typedef struct { - StgPtr addr; /* Haskell object, free list, or NULL */ - StgPtr old; /* old Haskell object, used during GC */ - StgClosure *sn_obj; /* the StableName object (or NULL) */ + StgPtr addr; // Haskell object when entry is in use, next free + // entry (NULL when this is the last free entry) + // otherwise. May be NULL temporarily during GC (when + // pointee dies). + + StgPtr old; // Old Haskell object, used during GC + + StgClosure *sn_obj; // The StableName object, or NULL when the entry is + // free } snEntry; typedef struct { - StgPtr addr; + StgPtr addr; // Haskell object when entry is in use, next free + // entry (NULL when this is the last free entry) + // otherwise. } spEntry; extern DLL_IMPORT_RTS snEntry *stable_name_table; diff --git a/rts/Stable.c b/rts/Stable.c index ecf216a..71eaf1a 100644 --- a/rts/Stable.c +++ b/rts/Stable.c @@ -181,7 +181,7 @@ initStableTables(void) { if (SNT_size > 0) return; SNT_size = INIT_SNT_SIZE; - stable_name_table = stgMallocBytes(SNT_size * sizeof *stable_name_table, + stable_name_table = stgMallocBytes(SNT_size * sizeof(snEntry), "initStableNameTable"); /* we don't use index 0 in the stable name table, because that * would conflict with the hash table lookup operations which @@ -192,7 +192,7 @@ initStableTables(void) if (SPT_size > 0) return; SPT_size = INIT_SPT_SIZE; - stable_ptr_table = stgMallocBytes(SPT_size * sizeof *stable_ptr_table, + stable_ptr_table = stgMallocBytes(SPT_size * sizeof(spEntry), "initStablePtrTable"); initSpEntryFreeList(stable_ptr_table,INIT_SPT_SIZE,NULL); @@ -214,12 +214,13 @@ enlargeStableNameTable(void) SNT_size *= 2; stable_name_table = stgReallocBytes(stable_name_table, - SNT_size * sizeof *stable_name_table, + SNT_size * sizeof(snEntry), "enlargeStableNameTable"); initSnEntryFreeList(stable_name_table + old_SNT_size, old_SNT_size, NULL); } +// Must be holding stable_mutex static void enlargeStablePtrTable(void) { @@ -233,11 +234,11 @@ enlargeStablePtrTable(void) * [Enlarging the stable pointer table]. */ new_stable_ptr_table = - stgMallocBytes(SPT_size * sizeof *stable_ptr_table, + stgMallocBytes(SPT_size * sizeof(spEntry), "enlargeStablePtrTable"); memcpy(new_stable_ptr_table, stable_ptr_table, - old_SPT_size * sizeof *stable_ptr_table); + old_SPT_size * sizeof(spEntry)); ASSERT(n_old_SPTs < MAX_N_OLD_SPTS); old_SPTs[n_old_SPTs++] = stable_ptr_table; @@ -376,9 +377,6 @@ removeIndirections (StgClosure* p) StgWord lookupStableName (StgPtr p) { - StgWord sn; - const void* sn_tmp; - stableLock(); if (stable_name_free == NULL) { @@ -393,8 +391,7 @@ lookupStableName (StgPtr p) // register the untagged pointer. This just makes things simpler. p = (StgPtr)UNTAG_CLOSURE((StgClosure*)p); - sn_tmp = lookupHashTable(addrToStableHash,(W_)p); - sn = (StgWord)sn_tmp; + StgWord sn = (StgWord)lookupHashTable(addrToStableHash,(W_)p); if (sn != 0) { ASSERT(stable_name_table[sn].addr == p); @@ -531,7 +528,7 @@ threadStableTables( evac_fn evac, void *user ) } /* ----------------------------------------------------------------------------- - * Garbage collect any dead entries in the stable pointer table. + * Garbage collect any dead entries in the stable name table. * * A dead entry has: * @@ -549,32 +546,26 @@ gcStableTables( void ) { FOR_EACH_STABLE_NAME( p, { - // Update the pointer to the StableName object, if there is one + // FOR_EACH_STABLE_NAME traverses free entries too, so + // check sn_obj if (p->sn_obj != NULL) { + // Update the pointer to the StableName object, if there is one p->sn_obj = isAlive(p->sn_obj); - if(p->sn_obj == NULL) { + if (p->sn_obj == NULL) { // StableName object died debugTrace(DEBUG_stable, "GC'd StableName %ld (addr=%p)", (long)(p - stable_name_table), p->addr); freeSnEntry(p); - /* Can't "continue", so use goto */ - goto next_stable_name; - } - } - /* If sn_obj became NULL, the object died, and addr is now - * invalid. But if sn_obj was null, then the StableName - * object may not have been created yet, while the pointee - * already exists and must be updated to new location. */ - if (p->addr != NULL) { - p->addr = (StgPtr)isAlive((StgClosure *)p->addr); - if(p->addr == NULL) { - // StableName pointee died - debugTrace(DEBUG_stable, "GC'd pointee %ld", - (long)(p - stable_name_table)); + } else if (p->addr != NULL) { + // sn_obj is alive, update pointee + p->addr = (StgPtr)isAlive((StgClosure *)p->addr); + if (p->addr == NULL) { + // Pointee died + debugTrace(DEBUG_stable, "GC'd pointee %ld", + (long)(p - stable_name_table)); + } } } - next_stable_name: - if (0) {} }); } From git at git.haskell.org Wed Apr 25 23:19:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:19:59 +0000 (UTC) Subject: [commit: hadrian] master: Add troubleshooting section (c1706f6) Message-ID: <20180425231959.E67813ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/c1706f68bc18b7465ee1bf30ba9ae30d633ca36b >--------------------------------------------------------------- commit c1706f68bc18b7465ee1bf30ba9ae30d633ca36b Author: Andrey Mokhov Date: Tue Feb 27 12:44:21 2018 +0000 Add troubleshooting section See #308 >--------------------------------------------------------------- c1706f68bc18b7465ee1bf30ba9ae30d633ca36b README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 23e8586..bdd8ed8 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,28 @@ replace the `validate` script (see [#187][validation-issue]). * `build selftest` runs tests of the build system. Current test coverage is close to zero (see [#197][test-issue]). +Troubleshooting +--------------- + +Here are a few simple suggestions that might help you fix the build: + +* The Hadrian submodule in GHC is occasionally behind the master branch of this repository, + which contains most recent bug fixes. To switch to the most recent version of Hadrian, + run `git pull https://github.com/snowleopard/hadrian.git`. Beware: the most recent version + contains the most recent bugs too! If this works, please raise an issue and we will try to + push the changes to the GHC submodule as soon as possible. + +* Hadrian is occasionally broken by changes in GHC. If this happens, you might want to switch + to an earlier GHC commit. + +* If Hadrian fails with the message `Configuration file hadrian/cfg/system.config is missing`, + you have probably forgotten to pass the `--configure` flag during the first build. + +* If you need help in debugging Hadrian, read the [wiki](https://github.com/snowleopard/hadrian/wiki) + and Shake's [debugging tutorial](https://shakebuild.com/debugging). + +If everything fails, don't hesitate to [raise an issue](https://github.com/snowleopard/hadrian/issues/new). + Current limitations ------------------- The new build system still lacks many important features: From git at git.haskell.org Wed Apr 25 23:20:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:01 +0000 (UTC) Subject: [commit: hadrian] master: Pin nixpkgs and all-cabal-hashes in shell.nix (#511) (37bd95f) Message-ID: <20180425232001.EA90F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/37bd95fee83b50c2567914a6e6c2a4cc73803f30 >--------------------------------------------------------------- commit 37bd95fee83b50c2567914a6e6c2a4cc73803f30 Author: Matthew Pickering Date: Wed Feb 28 18:09:34 2018 +0000 Pin nixpkgs and all-cabal-hashes in shell.nix (#511) * Pin shell.nix Also adds a new option to build `cabal-install` HEAD which is sometimes useful. * Bump QuickCheck bound * Remove cabal-install which snuck in >--------------------------------------------------------------- 37bd95fee83b50c2567914a6e6c2a4cc73803f30 hadrian.cabal | 2 +- shell.nix | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/hadrian.cabal b/hadrian.cabal index fef9bd9..84aecef 100644 --- a/hadrian.cabal +++ b/hadrian.cabal @@ -128,7 +128,7 @@ executable hadrian , directory >= 1.2 && < 1.4 , extra >= 1.4.7 , mtl == 2.2.* - , QuickCheck >= 2.6 && < 2.10 + , QuickCheck >= 2.6 && < 2.11 , shake == 0.16.* , transformers >= 0.4 && < 0.6 , unordered-containers >= 0.2.1 && < 0.3 diff --git a/shell.nix b/shell.nix index d8767cd..1b17905 100644 --- a/shell.nix +++ b/shell.nix @@ -2,9 +2,26 @@ # by only invoking hadrian. -{ nixpkgs ? import {} }: +{ _nixpkgs ? import {} }: let + + nixpkgs = import (_nixpkgs.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + rev = "e7a327da5cffdf5e77e1924906a4f0983591bd3e"; + sha256 = "1xzil4mayhggg2miwspbk12nihlszg0y4n6i4qacrxql5n75f0hr"; + }){ overlays = [cabalHashes]; }; + + + + cabalHashes = sel: super: { + all-cabal-hashes = super.fetchurl { + url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/b2b93ae610f5f1b51d22b191f972dc3dec8f94c6.tar.gz"; + sha256 = "0bffclpqbw62xff36qlzxghr042mhv0m06k5ml4298w6fv7ly1xw"; + }; + }; + haskellPackages = nixpkgs.haskell.packages.ghc822; removeBuild = path: type: @@ -28,7 +45,10 @@ let localPackage = name: path: self.callCabal2nix name (filterSrc path) {}; in { hadrian = localPackage "hadrian" ./. ; - shake = self.callHackage "shake" "0.16" {}; + happy = nixpkgs.haskell.lib.dontCheck (super.happy); + shake = self.callHackage "shake" "0.16.2" {}; + extra = self.callHackage "extra" "1.6.4" {}; + QuickCheck = self.callHackage "QuickCheck" "2.10" {}; Cabal = localPackage "Cabal" ./../libraries/Cabal/Cabal ; filepath = localPackage "filepath" ./../libraries/filepath ; text = localPackage "text" ./../libraries/text ; @@ -39,6 +59,15 @@ let directory = localPackage "directory" ./../libraries/directory ; }; }; + cabalPackages = nixpkgs.haskell.packages.ghc822.override { + overrides = self: super: let + localPackage = name: path: self.callCabal2nix name (filterSrc path) {}; + in { + Cabal = localPackage "Cabal" ./../../cabal/Cabal ; + cabal-install = self.callPackage ./../../cabal/cabal-install.nix {}; + }; }; + + in nixpkgs.lib.overrideDerivation nixpkgs.haskell.packages.ghcHEAD.ghc (drv: { @@ -47,6 +76,11 @@ in [ hadrianPackages.hadrian nixpkgs.arcanist nixpkgs.python3Packages.sphinx + nixpkgs.texlive.combined.scheme-basic + (nixpkgs.haskell.packages.ghc822.ghcWithPackages + (ps: [ps.html ps.regex-compat ps.dump-core])) + + #cabalPackages.cabal-install ]; }) From git at git.haskell.org Wed Apr 25 23:20:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:03 +0000 (UTC) Subject: [commit: hadrian] master: Change permission bits for build.cabal.sh, fixes #517 (#520) (7894c96) Message-ID: <20180425232003.EEEA43ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/7894c96e4776e4bfb84d499a7d32999cf4e27e65 >--------------------------------------------------------------- commit 7894c96e4776e4bfb84d499a7d32999cf4e27e65 Author: Zhen Zhang Date: Mon Mar 5 09:59:05 2018 +0800 Change permission bits for build.cabal.sh, fixes #517 (#520) >--------------------------------------------------------------- 7894c96e4776e4bfb84d499a7d32999cf4e27e65 build.cabal.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/build.cabal.sh b/build.cabal.sh old mode 100644 new mode 100755 From git at git.haskell.org Wed Apr 25 23:20:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:05 +0000 (UTC) Subject: [commit: hadrian] master: Drop the no longer necessary chmod (764be7e) Message-ID: <20180425232005.F3F9F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/764be7eb9fbc387673d322c066996884b9933e08 >--------------------------------------------------------------- commit 764be7eb9fbc387673d322c066996884b9933e08 Author: Andrey Mokhov Date: Mon Mar 5 02:08:14 2018 +0000 Drop the no longer necessary chmod See #517 >--------------------------------------------------------------- 764be7eb9fbc387673d322c066996884b9933e08 build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sh b/build.sh index ad502b3..13daebe 100755 --- a/build.sh +++ b/build.sh @@ -31,5 +31,4 @@ function rl { root="$(dirname "$(rl "$0")")" # By default on Linux/MacOS we build Hadrian using Cabal -chmod a+x "$root/build.cabal.sh" (. "$root/build.cabal.sh" "$@") From git at git.haskell.org Wed Apr 25 23:20:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:08 +0000 (UTC) Subject: [commit: hadrian] master: Fix Hadrian after Cabal changes (eda173b) Message-ID: <20180425232008.051A93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/eda173b7c0be97a4bd5f81fcf83788ddc874e900 >--------------------------------------------------------------- commit eda173b7c0be97a4bd5f81fcf83788ddc874e900 Author: Andrey Mokhov Date: Mon Mar 5 02:43:47 2018 +0000 Fix Hadrian after Cabal changes >--------------------------------------------------------------- eda173b7c0be97a4bd5f81fcf83788ddc874e900 hadrian.cabal | 2 +- stack.yaml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hadrian.cabal b/hadrian.cabal index 84aecef..c81340f 100644 --- a/hadrian.cabal +++ b/hadrian.cabal @@ -123,7 +123,7 @@ executable hadrian other-extensions: MultiParamTypeClasses , TypeFamilies build-depends: base >= 4.8 && < 5 - , Cabal >= 2.1.0.0 && < 2.3 + , Cabal >= 2.2.0.0 && < 2.3 , containers == 0.5.* , directory >= 1.2 && < 1.4 , extra >= 1.4.7 diff --git a/stack.yaml b/stack.yaml index da03763..663389f 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,12 +1,13 @@ # For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration.html # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) -resolver: lts-9.0 +resolver: lts-10.8 # Local packages, usually specified by relative directory name packages: - '.' - '../libraries/Cabal/Cabal' +- '../libraries/text' extra-deps: - shake-0.16 From git at git.haskell.org Wed Apr 25 23:20:10 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:10 +0000 (UTC) Subject: [commit: hadrian] master: Merge pull request #521 from snowleopard/drop-chmod (9eef6a7) Message-ID: <20180425232010.0A3F63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/9eef6a7c7cce150f39740beb8570f4cbc38b947e >--------------------------------------------------------------- commit 9eef6a7c7cce150f39740beb8570f4cbc38b947e Merge: 7894c96 eda173b Author: Andrey Mokhov Date: Mon Mar 5 03:17:48 2018 +0000 Merge pull request #521 from snowleopard/drop-chmod Drop the no longer necessary chmod >--------------------------------------------------------------- 9eef6a7c7cce150f39740beb8570f4cbc38b947e build.sh | 1 - hadrian.cabal | 2 +- stack.yaml | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) From git at git.haskell.org Wed Apr 25 23:20:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:12 +0000 (UTC) Subject: [commit: hadrian] master: Bump Cabal version (f4d12c0) Message-ID: <20180425232012.0F8113ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/f4d12c0f8943818d41b97c295eb26ed7eaf8edfc >--------------------------------------------------------------- commit f4d12c0f8943818d41b97c295eb26ed7eaf8edfc Author: Andrey Mokhov Date: Tue Mar 13 21:21:03 2018 +0000 Bump Cabal version See #527 >--------------------------------------------------------------- f4d12c0f8943818d41b97c295eb26ed7eaf8edfc hadrian.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadrian.cabal b/hadrian.cabal index c81340f..6248df3 100644 --- a/hadrian.cabal +++ b/hadrian.cabal @@ -123,7 +123,7 @@ executable hadrian other-extensions: MultiParamTypeClasses , TypeFamilies build-depends: base >= 4.8 && < 5 - , Cabal >= 2.2.0.0 && < 2.3 + , Cabal >= 2.3 && < 2.4 , containers == 0.5.* , directory >= 1.2 && < 1.4 , extra >= 1.4.7 From git at git.haskell.org Wed Apr 25 23:20:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:14 +0000 (UTC) Subject: [commit: hadrian] master: Merge pull request #528 from snowleopard/bump-cabal (3fa914a) Message-ID: <20180425232014.152813ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/3fa914a648b5e9e5efff380854625284276fd867 >--------------------------------------------------------------- commit 3fa914a648b5e9e5efff380854625284276fd867 Merge: 9eef6a7 f4d12c0 Author: Andrey Mokhov Date: Tue Mar 13 21:36:42 2018 +0000 Merge pull request #528 from snowleopard/bump-cabal Bump Cabal version >--------------------------------------------------------------- 3fa914a648b5e9e5efff380854625284276fd867 hadrian.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Wed Apr 25 23:20:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:16 +0000 (UTC) Subject: [commit: hadrian] master: Add extra include paths when invoking ghc-cabal (#526) (7a5ee60) Message-ID: <20180425232016.1A4863ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/7a5ee60910cc3571d5f4b6f90f9818367ad71f97 >--------------------------------------------------------------- commit 7a5ee60910cc3571d5f4b6f90f9818367ad71f97 Author: Andrey Mokhov Date: Wed Mar 14 19:34:29 2018 +0000 Add extra include paths when invoking ghc-cabal (#526) See #523 >--------------------------------------------------------------- 7a5ee60910cc3571d5f4b6f90f9818367ad71f97 src/Settings/Builders/GhcCabal.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Settings/Builders/GhcCabal.hs b/src/Settings/Builders/GhcCabal.hs index bfb84a7..78b4587 100644 --- a/src/Settings/Builders/GhcCabal.hs +++ b/src/Settings/Builders/GhcCabal.hs @@ -56,13 +56,17 @@ configureArgs :: Args configureArgs = do top <- expr topDirectory root <- getBuildRoot + pkg <- getPackage let conf key expr = do values <- unwords <$> expr not (null values) ? arg ("--configure-option=" ++ key ++ "=" ++ values) cFlags = mconcat [ remove ["-Werror"] cArgs , getStagedSettingList ConfCcArgs - , arg $ "-I" ++ top -/- root -/- generatedDir ] + , arg $ "-I" ++ top -/- root -/- generatedDir + -- See https://github.com/snowleopard/hadrian/issues/523 + , arg $ "-I" ++ top -/- pkgPath pkg + , arg $ "-I" ++ top -/- "includes" ] ldFlags = ldArgs <> (getStagedSettingList ConfGccLinkerArgs) cppFlags = cppArgs <> (getStagedSettingList ConfCppArgs) cldFlags <- unwords <$> (cFlags <> ldFlags) From git at git.haskell.org Wed Apr 25 23:20:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:18 +0000 (UTC) Subject: [commit: hadrian] master: Add 'git' to nativeBuildInputs in shell.nix (#530) (57d0fca) Message-ID: <20180425232018.1F0443ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/57d0fca0ebbc2907004d7a7ee5c263f536ad64cb >--------------------------------------------------------------- commit 57d0fca0ebbc2907004d7a7ee5c263f536ad64cb Author: Vladislav Zavialov Date: Mon Mar 19 16:41:26 2018 +0300 Add 'git' to nativeBuildInputs in shell.nix (#530) >--------------------------------------------------------------- 57d0fca0ebbc2907004d7a7ee5c263f536ad64cb shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/shell.nix b/shell.nix index 1b17905..f193000 100644 --- a/shell.nix +++ b/shell.nix @@ -75,6 +75,7 @@ in nativeBuildInputs = drv.nativeBuildInputs ++ [ hadrianPackages.hadrian nixpkgs.arcanist + nixpkgs.git nixpkgs.python3Packages.sphinx nixpkgs.texlive.combined.scheme-basic (nixpkgs.haskell.packages.ghc822.ghcWithPackages From git at git.haskell.org Wed Apr 25 23:20:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:20 +0000 (UTC) Subject: [commit: hadrian] master: Add clean routines for fs (#533) (47678ea) Message-ID: <20180425232020.245B23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/47678ea67682ce49b37d5b3109a5b42030c09fc3 >--------------------------------------------------------------- commit 47678ea67682ce49b37d5b3109a5b42030c09fc3 Author: Tamar Christina Date: Tue Mar 20 08:51:53 2018 +0000 Add clean routines for fs (#533) >--------------------------------------------------------------- 47678ea67682ce49b37d5b3109a5b42030c09fc3 src/Rules/Clean.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Rules/Clean.hs b/src/Rules/Clean.hs index d11cbf5..7592c60 100644 --- a/src/Rules/Clean.hs +++ b/src/Rules/Clean.hs @@ -18,6 +18,19 @@ cleanSourceTree = do removeDirectory inplaceBinPath removeDirectory inplaceLibPath removeDirectory "sdistprep" + cleanFsUtils + +-- Clean all temporary fs files copied by configure into the source folder +cleanFsUtils :: Action () +cleanFsUtils = do + let dirs = [ "utils/lndir/" + , "utils/unlit/" + , "rts/" + , "libraries/base/include/" + , "libraries/base/cbits/" + ] + liftIO $ forM_ dirs (flip removeFiles ["fs.*"]) + cleanRules :: Rules () cleanRules = "clean" ~> clean From git at git.haskell.org Wed Apr 25 23:20:22 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:22 +0000 (UTC) Subject: [commit: hadrian] master: Add user-defined flavour example for turning off dynamic linking (#535) (2fcfde2) Message-ID: <20180425232022.297A23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/2fcfde2a455b2d0c5f6a0f6003dcc8af669aea80 >--------------------------------------------------------------- commit 2fcfde2a455b2d0c5f6a0f6003dcc8af669aea80 Author: Alp Mestanogullari Date: Thu Mar 22 01:38:11 2018 +0100 Add user-defined flavour example for turning off dynamic linking (#535) See #534 and https://ghc.haskell.org/trac/ghc/ticket/10536 >--------------------------------------------------------------- 2fcfde2a455b2d0c5f6a0f6003dcc8af669aea80 doc/user-settings.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/user-settings.md b/doc/user-settings.md index 1a89dd4..05e4efc 100644 --- a/doc/user-settings.md +++ b/doc/user-settings.md @@ -149,6 +149,16 @@ Note that `rtsWays` is computed from `libraryWays` by default, therefore the abo change will lead to the removal of `threadedProfiling` way from `rtsWays`. To change this behaviour, you can override the default `rtsWays` setting. +Similarly, if we want to completely turn off dynamic linking, +we can define a custom `Flavour` to this effect: +``` haskell +noDynamicFlavour :: Flavour +noDynamicFlavour = defaultFlavour + { name = "no-dynamic" + , libraryWays = remove [dynamic] defaultLibraryWays + } +``` + ## Verbose command lines By default Hadrian does not print full command lines during the build process From git at git.haskell.org Wed Apr 25 23:20:24 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:24 +0000 (UTC) Subject: [commit: hadrian] master: fix end (fe5759b) Message-ID: <20180425232024.2EDCC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/fe5759b46cb9f04ba78a975c99a6d99b866d448e >--------------------------------------------------------------- commit fe5759b46cb9f04ba78a975c99a6d99b866d448e Author: Tamar Christina Date: Wed Mar 28 00:53:12 2018 +0100 fix end >--------------------------------------------------------------- fe5759b46cb9f04ba78a975c99a6d99b866d448e src/Settings/Packages/Rts.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Settings/Packages/Rts.hs b/src/Settings/Packages/Rts.hs index fcbd795..212bd72 100644 --- a/src/Settings/Packages/Rts.hs +++ b/src/Settings/Packages/Rts.hs @@ -112,6 +112,8 @@ rtsPackageArgs = package rts ? do , arg $ "-I" ++ path , flag UseSystemFfi ? arg ("-I" ++ ffiIncludeDir) , arg $ "-DRtsWay=\"rts_" ++ show way ++ "\"" + -- Set the namespace for the rts fs functions + , arg $ "-DFS_NAMESPACE=rts" -- RTS *must* be compiled with optimisations. The INLINE_HEADER macro -- requires that functions are inlined to work as expected. Inlining -- only happens for optimised builds. Otherwise we can assume that @@ -145,6 +147,14 @@ rtsPackageArgs = package rts ? do , "-DGhcUnregisterised=" ++ show ghcUnreg , "-DGhcEnableTablesNextToCode=" ++ show ghcEnableTNC ] + -- We're after pur performance here. So make sure fast math and + -- vectorization is enabled. + , input "//xxhash.c" ? pure + [ "-O3" + , "-ffast-math" + , "-ftree-vectorize" + ] + , inputs ["//Evac.c", "//Evac_thr.c"] ? arg "-funroll-loops" , speedHack ? From git at git.haskell.org Wed Apr 25 23:20:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:26 +0000 (UTC) Subject: [commit: hadrian] master: Use Cabal directly in place of ghc-cabal + make build root configurable (#531) (3a68f11) Message-ID: <20180425232026.42A253ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/3a68f11c9d6ceebdb09f85804143dd2f1d49a502 >--------------------------------------------------------------- commit 3a68f11c9d6ceebdb09f85804143dd2f1d49a502 Author: Alp Mestanogullari Date: Fri Mar 30 20:31:03 2018 +0200 Use Cabal directly in place of ghc-cabal + make build root configurable (#531) * Use Cabal directly in place of ghc-cabal; make build root configurable. This commit implements two significant changes (that were not easy to separate): - Don't use ghc-cabal anymore for getting information about Haskell packages. We now instead directly use Cabal-the-library. - Make the build root configurable. This effectively gets rid of the inplace logic and allows us to place _all_ build artefacts in some directory of our choice, by passing '--build-root ' to hadrian. The code for this was mostly taken from #445. * fix documentation rules * remove some leftover unrelated, commented-out code * more documentation fixes, address some feedback * cleanup * more cleanup * boot and configure explicitly in travis CI scripts * update cabal/ghc versions in .travis.yml (8.0.x not supported anymore) * temporarily disable dynamic ways in Settings.Default * update appveyor script * travis: when booting with 8.2.2, build a complete stage2 compiler * Fix CI? Try to fix the CI by adding the `debug` rts way back in. * Update Quickest.hs Replicate the make build systems build flavours. * Update .travis.yml - Run selftest, and build in separate instances. - try with python2 - and unify mac to stage2 * Update .travis.yml upgrade python on mac * [travis] os x: test the freshly built ghc * Get rid of two unused GhcCabalMode constructors * fix ghc-split rule, get rid of Install/Wrappers rules * address more feedback * ConfiguredCabal -> PackageData, more comments, more feedback addressed * make the complete stage 2 build the default * use a dummy package instead of base in Rules.hs * update CI scripts * attempt at fixing hadrian's -c option * .travis.yml: use -c everywhere again * travis: back to explicit './boot && ./configure' * update README.md and doc/user-settings.md to reflect configurable build root * some more feedback >--------------------------------------------------------------- 3a68f11c9d6ceebdb09f85804143dd2f1d49a502 .travis.yml | 71 +++++-- README.md | 19 +- appveyor.yml | 11 +- doc/user-settings.md | 10 - hadrian.cabal | 19 +- src/Base.hs | 91 ++++---- src/Builder.hs | 93 ++++++-- src/Builder.hs-boot | 46 ++++ src/CommandLine.hs | 22 +- src/Context.hs | 60 +++--- src/Context/Paths.hs | 39 ++++ src/Expression.hs | 26 ++- src/Expression/Type.hs | 5 +- src/GHC.hs | 199 +++++------------- src/GHC/Packages.hs | 105 ++++++++++ src/Hadrian/Builder.hs | 40 +++- src/Hadrian/Haskell/Cabal.hs | 29 +-- src/Hadrian/Haskell/Cabal/PackageData.hs | 46 ++++ src/Hadrian/Haskell/Cabal/Parse.hs | 314 +++++++++++++++++++++++++-- src/Hadrian/Haskell/Cabal/Parse.hs-boot | 9 + src/Hadrian/Haskell/Cabal/Type.hs | 22 +- src/Hadrian/Oracles/TextFile.hs | 46 +++- src/Hadrian/Package.hs | 14 +- src/Hadrian/Utilities.hs | 16 +- src/Main.hs | 5 +- src/Oracles/ModuleFiles.hs | 40 ++-- src/Oracles/PackageData.hs | 66 ------ src/Rules.hs | 61 ++++-- src/Rules/Clean.hs | 10 +- src/Rules/Compile.hs | 6 +- src/Rules/Configure.hs | 2 +- src/Rules/Dependencies.hs | 12 +- src/Rules/Documentation.hs | 108 ++++++---- src/Rules/Generate.hs | 140 +++++++------ src/Rules/Gmp.hs | 30 +-- src/Rules/Install.hs | 349 ------------------------------- src/Rules/Libffi.hs | 13 +- src/Rules/Library.hs | 72 +++++-- src/Rules/PackageData.hs | 122 ++--------- src/Rules/Program.hs | 116 ++++------ src/Rules/Register.hs | 103 ++++++--- src/Rules/SourceDist.hs | 2 +- src/Rules/Test.hs | 18 +- src/Rules/Wrappers.hs | 162 -------------- src/Settings.hs | 6 +- src/Settings/Builders/Cc.hs | 6 +- src/Settings/Builders/Common.hs | 38 +++- src/Settings/Builders/DeriveConstants.hs | 1 + src/Settings/Builders/Ghc.hs | 55 +++-- src/Settings/Builders/GhcCabal.hs | 66 +++++- src/Settings/Builders/GhcPkg.hs | 16 +- src/Settings/Builders/Haddock.hs | 32 +-- src/Settings/Builders/HsCpp.hs | 1 + src/Settings/Builders/Hsc2Hs.hs | 25 ++- src/Settings/Builders/RunTest.hs | 5 +- src/Settings/Default.hs | 49 ++--- src/Settings/Flavours/Quickest.hs | 7 +- src/Settings/Packages.hs | 125 +++++++++++ src/Settings/Packages/Haskeline.hs | 8 - src/Settings/Packages/Rts.hs | 1 + src/Settings/Warnings.hs | 1 + src/UserSettings.hs | 8 +- src/Utilities.hs | 46 ++-- 63 files changed, 1752 insertions(+), 1533 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 3a68f11c9d6ceebdb09f85804143dd2f1d49a502 From git at git.haskell.org Wed Apr 25 23:20:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:28 +0000 (UTC) Subject: [commit: hadrian] master: Merge pull request #542 from Mistuke/fix-specific-file (9a46249) Message-ID: <20180425232028.4E3B03ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/9a46249e974c99a2015d7bba514b252c31ff8575 >--------------------------------------------------------------- commit 9a46249e974c99a2015d7bba514b252c31ff8575 Merge: 3a68f11 fe5759b Author: Moritz Angermann Date: Sat Mar 31 12:58:55 2018 +0800 Merge pull request #542 from Mistuke/fix-specific-file Move rts I/O Functions in different namespace. >--------------------------------------------------------------- 9a46249e974c99a2015d7bba514b252c31ff8575 src/Settings/Packages/Rts.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) From git at git.haskell.org Wed Apr 25 23:20:30 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:30 +0000 (UTC) Subject: [commit: hadrian] master: Fix warnings (#547) (659b18d) Message-ID: <20180425232030.5491C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/659b18d59ea034419f94c2a038d08ea69bc15803 >--------------------------------------------------------------- commit 659b18d59ea034419f94c2a038d08ea69bc15803 Author: Andrey Mokhov Date: Tue Apr 3 09:45:05 2018 +0100 Fix warnings (#547) * Fix warnings * Link to GitHub issues See #544 >--------------------------------------------------------------- 659b18d59ea034419f94c2a038d08ea69bc15803 src/CommandLine.hs | 1 - src/GHC.hs | 13 ----------- src/Hadrian/Haskell/Cabal/Parse.hs | 48 ++++++++++++++++++++------------------ src/Rules/Clean.hs | 2 +- src/Rules/SourceDist.hs | 3 ++- src/Settings/Builders/Common.hs | 1 - src/Settings/Builders/GhcCabal.hs | 13 ++--------- src/Settings/Default.hs | 1 - 8 files changed, 30 insertions(+), 52 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 659b18d59ea034419f94c2a038d08ea69bc15803 From git at git.haskell.org Wed Apr 25 23:20:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:32 +0000 (UTC) Subject: [commit: hadrian] master: Fix Circle CI (#553) (591c425) Message-ID: <20180425232032.584A93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/591c4252ec2175c99fce431548c68ae3cd63cbf5 >--------------------------------------------------------------- commit 591c4252ec2175c99fce431548c68ae3cd63cbf5 Author: Zhen Zhang Date: Tue Apr 3 16:52:20 2018 +0800 Fix Circle CI (#553) >--------------------------------------------------------------- 591c4252ec2175c99fce431548c68ae3cd63cbf5 circle.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index 8ca33cf..66d5193 100644 --- a/circle.yml +++ b/circle.yml @@ -8,11 +8,13 @@ dependencies: override: - brew update - brew install ghc cabal-install python3 + - brew link ghc cabal-install python3 - cabal update - - cabal install alex happy mtl shake quickcheck + - cabal install alex 'happy >= 1.19.4' mtl shake QuickCheck cache_directories: - - $HOME/.cabal - - $HOME/.ghc + - ~/.cabal + - ~/.ghc + - /usr/local/Cellar compile: override: @@ -29,12 +31,14 @@ compile: # in CircleCI is a separate process, thus you can't "cd" for the other lines - cd ghc/hadrian; git reset --hard HEAD + - cd ghc; ./boot && PATH=~/.cabal/bin:$PATH ./configure + # XXX: export PATH doesn't work well either, so we use inline env # Self test - - PATH=$HOME/.cabal/bin:$PATH ghc/hadrian/build.sh -c selftest + - PATH=~/.cabal/bin:$PATH ghc/hadrian/build.sh selftest # Build GHC - - PATH=$HOME/.cabal/bin:$PATH ghc/hadrian/build.sh -j -c $MODE --no-progress --progress-colour=never --profile=- + - PATH=~/.cabal/bin:$PATH ghc/hadrian/build.sh -j $MODE --no-progress --progress-colour=never --profile=- test: override: From git at git.haskell.org Wed Apr 25 23:20:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:34 +0000 (UTC) Subject: [commit: hadrian] master: Unregister stage0 package first if it needs to be cloned (#552) (a8ad5af) Message-ID: <20180425232034.5D0423ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/a8ad5af8537606b0dd8e53051fbcf56d6a30c605 >--------------------------------------------------------------- commit a8ad5af8537606b0dd8e53051fbcf56d6a30c605 Author: Zhen Zhang Date: Tue Apr 3 21:33:03 2018 +0800 Unregister stage0 package first if it needs to be cloned (#552) Fixes #543 >--------------------------------------------------------------- a8ad5af8537606b0dd8e53051fbcf56d6a30c605 src/Builder.hs | 5 +++++ src/Builder.hs-boot | 2 +- src/Rules/Register.hs | 11 +++++++++-- src/Settings/Builders/GhcPkg.hs | 10 ++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Builder.hs b/src/Builder.hs index 8ce2aea..5ca6c20 100644 --- a/src/Builder.hs +++ b/src/Builder.hs @@ -65,6 +65,7 @@ instance NFData GhcCabalMode data GhcPkgMode = Init -- initialize a new database. | Update -- update a package. | Clone -- clone a package from one pkg database into another. @Copy@ is already taken by GhcCabalMode. + | Unregister -- unregister a package | Dependencies -- compute package dependencies. deriving (Eq, Generic, Show) @@ -265,6 +266,10 @@ instance H.Builder Builder where ] cmd (Stdin pkgDesc) [path] (buildArgs ++ ["-"]) + GhcPkg Unregister _ -> do + Exit _ <- cmd echo [path] (buildArgs ++ [input]) + return () + _ -> cmd echo [path] buildArgs -- TODO: Some builders are required only on certain platforms. For example, diff --git a/src/Builder.hs-boot b/src/Builder.hs-boot index e8eed47..bd38891 100644 --- a/src/Builder.hs-boot +++ b/src/Builder.hs-boot @@ -8,7 +8,7 @@ import Hadrian.Builder.Tar data CcMode = CompileC | FindCDependencies data GhcMode = CompileHs | CompileCWithGhc | FindHsDependencies | LinkHs data GhcCabalMode = Conf | HsColour | Check | Sdist -data GhcPkgMode = Init | Update | Clone | Dependencies +data GhcPkgMode = Init | Update | Clone | Unregister | Dependencies data HaddockMode = BuildPackage | BuildIndex data Builder = Alex diff --git a/src/Rules/Register.hs b/src/Rules/Register.hs index 14b085d..12d3c5b 100644 --- a/src/Rules/Register.hs +++ b/src/Rules/Register.hs @@ -83,8 +83,15 @@ copyConf rs context at Context {..} conf = do depPkgIds <- fmap stdOutToPkgIds . askWithResources rs $ target context (GhcPkg Dependencies stage) [pkgName package] [] need =<< mapM (\pkgId -> packageDbPath stage <&> (-/- pkgId <.> "conf")) depPkgIds - buildWithResources rs $ - target context (GhcPkg Clone stage) [pkgName package] [conf] + -- we should unregister if the file exists since ghc-pkg will complain + -- about existing pkg id (See https://github.com/snowleopard/hadrian/issues/543) + -- also, we don't always do the unregistration + registration to avoid + -- repeated work after a full build + unlessM (doesFileExist conf) $ do + buildWithResources rs $ + target context (GhcPkg Unregister stage) [pkgName package] [] + buildWithResources rs $ + target context (GhcPkg Clone stage) [pkgName package] [conf] where stdOutToPkgIds :: String -> [String] diff --git a/src/Settings/Builders/GhcPkg.hs b/src/Settings/Builders/GhcPkg.hs index 4056d84..535b00d 100644 --- a/src/Settings/Builders/GhcPkg.hs +++ b/src/Settings/Builders/GhcPkg.hs @@ -14,6 +14,16 @@ ghcPkgBuilderArgs = mconcat , arg "register" , verbosity < Chatty ? arg "-v0" ] + , builder (GhcPkg Unregister) ? do + verbosity <- expr getVerbosity + stage <- getStage + pkgDb <- expr $ packageDbPath stage + mconcat [ arg "--global-package-db" + , arg pkgDb + , arg "unregister" + , arg "--force" + , verbosity < Chatty ? arg "-v0" + ] , builder (GhcPkg Update) ? do verbosity <- expr getVerbosity context <- getContext From git at git.haskell.org Wed Apr 25 23:20:36 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:36 +0000 (UTC) Subject: [commit: hadrian] master: Preliminary bindist rule (#555) (1579730) Message-ID: <20180425232036.61BF63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/15797302751614fba8da15f59de588be7841dd27 >--------------------------------------------------------------- commit 15797302751614fba8da15f59de588be7841dd27 Author: Alp Mestanogullari Date: Tue Apr 3 18:22:55 2018 +0200 Preliminary bindist rule (#555) * Preliminary bindist rule For now, we only ship `/{bin, lib}` and the few make build system related files that are needed to support a simple ``` ./configure [--prefix=PATH] && make install ``` workflow. The current binary distributions of GHC support a wider range of parameters, but I figured it would be a good thing to start with this and enhance it as we all see fit and perhaps using feedback from GHC HQ (@bgamari in particular) and bindist users. * document binary distribution rule in README * sdist-ghc -> source-dist, Rules.Bindist -> Rules.BinaryDist >--------------------------------------------------------------- 15797302751614fba8da15f59de588be7841dd27 README.md | 13 ++++++++++++- cfg/system.config.in | 1 + hadrian.cabal | 1 + src/Builder.hs | 4 ++++ src/Builder.hs-boot | 1 + src/Rules.hs | 6 ++++-- src/Rules/SourceDist.hs | 2 +- 7 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 620d405..2509dae 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,18 @@ are currently not supported. #### Source distribution -To build a GHC source distribution tarball, run `build sdist-ghc`. +To build a GHC source distribution tarball, run `build source-dist`. + +#### Binary distribution + +To build a GHC binary distribution, run `build binary-dist`. The resulting +tarball contains just enough to support the + +``` sh +$ ./configure [--prefix=PATH] && make install +``` + +workflow, for now. #### Testing diff --git a/cfg/system.config.in b/cfg/system.config.in index c983ae4..72bef12 100644 --- a/cfg/system.config.in +++ b/cfg/system.config.in @@ -7,6 +7,7 @@ alex = @AlexCmd@ ar = @ArCmd@ +autoreconf = autoreconf cc = @CC@ happy = @HappyCmd@ hs-cpp = @HaskellCPPCmd@ diff --git a/hadrian.cabal b/hadrian.cabal index 486148f..ca339fb 100644 --- a/hadrian.cabal +++ b/hadrian.cabal @@ -51,6 +51,7 @@ executable hadrian , Oracles.Setting , Oracles.ModuleFiles , Rules + , Rules.BinaryDist , Rules.Clean , Rules.Compile , Rules.Configure diff --git a/src/Builder.hs b/src/Builder.hs index 5ca6c20..0fb8be5 100644 --- a/src/Builder.hs +++ b/src/Builder.hs @@ -89,6 +89,7 @@ instance NFData HaddockMode -- @GhcPkg Stage1@ is the one built in Stage0. data Builder = Alex | Ar ArMode Stage + | Autoreconf FilePath | DeriveConstants | Cc CcMode Stage | Configure FilePath @@ -174,6 +175,7 @@ instance H.Builder Builder where runtimeDependencies :: Builder -> Action [FilePath] runtimeDependencies = \case + Autoreconf dir -> return [dir -/- "configure.ac"] Configure dir -> return [dir -/- "configure"] Ghc _ Stage0 -> return [] @@ -232,6 +234,7 @@ instance H.Builder Builder where Ar Unpack _ -> cmd echo [Cwd output] [path] buildArgs + Autoreconf dir -> cmd echo [Cwd dir] [path] buildArgs Configure dir -> do -- Inject /bin/bash into `libtool`, instead of /bin/sh, -- otherwise Windows breaks. TODO: Figure out why. @@ -287,6 +290,7 @@ systemBuilderPath builder = case builder of Alex -> fromKey "alex" Ar _ Stage0 -> fromKey "system-ar" Ar _ _ -> fromKey "ar" + Autoreconf _ -> fromKey "autoreconf" Cc _ Stage0 -> fromKey "system-cc" Cc _ _ -> fromKey "cc" -- We can't ask configure for the path to configure! diff --git a/src/Builder.hs-boot b/src/Builder.hs-boot index bd38891..1d10434 100644 --- a/src/Builder.hs-boot +++ b/src/Builder.hs-boot @@ -13,6 +13,7 @@ data HaddockMode = BuildPackage | BuildIndex data Builder = Alex | Ar ArMode Stage + | Autoreconf FilePath | DeriveConstants | Cc CcMode Stage | Configure FilePath diff --git a/src/Rules.hs b/src/Rules.hs index 982d249..100720f 100644 --- a/src/Rules.hs +++ b/src/Rules.hs @@ -8,15 +8,16 @@ import qualified Hadrian.Oracles.TextFile import Expression import GHC import qualified Oracles.ModuleFiles +import qualified Rules.BinaryDist import qualified Rules.Compile -import qualified Rules.PackageData +import qualified Rules.Configure import qualified Rules.Dependencies import qualified Rules.Documentation import qualified Rules.Generate -import qualified Rules.Configure import qualified Rules.Gmp import qualified Rules.Libffi import qualified Rules.Library +import qualified Rules.PackageData import qualified Rules.Program import qualified Rules.Register import Settings @@ -122,6 +123,7 @@ packageRules = do buildRules :: Rules () buildRules = do + Rules.BinaryDist.bindistRules Rules.Configure.configureRules Rules.Generate.copyRules Rules.Generate.generateRules diff --git a/src/Rules/SourceDist.hs b/src/Rules/SourceDist.hs index 6ef7929..8bec3f3 100644 --- a/src/Rules/SourceDist.hs +++ b/src/Rules/SourceDist.hs @@ -9,7 +9,7 @@ import Rules.Clean sourceDistRules :: Rules () sourceDistRules = do - "sdist-ghc" ~> do + "source-dist" ~> do -- We clean the source tree first. -- See https://github.com/snowleopard/hadrian/issues/384. -- TODO: Do we still need to clean the tree? From git at git.haskell.org Wed Apr 25 23:20:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:38 +0000 (UTC) Subject: [commit: hadrian] master: Revert "Preliminary bindist rule (#555)" (#557) (8c2817a) Message-ID: <20180425232038.6720F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/8c2817a37ec2fdc347a6ee90957f0119a8faa105 >--------------------------------------------------------------- commit 8c2817a37ec2fdc347a6ee90957f0119a8faa105 Author: Andrey Mokhov Date: Tue Apr 3 17:53:28 2018 +0100 Revert "Preliminary bindist rule (#555)" (#557) This reverts commit 15797302751614fba8da15f59de588be7841dd27. >--------------------------------------------------------------- 8c2817a37ec2fdc347a6ee90957f0119a8faa105 README.md | 13 +------------ cfg/system.config.in | 1 - hadrian.cabal | 1 - src/Builder.hs | 4 ---- src/Builder.hs-boot | 1 - src/Rules.hs | 6 ++---- src/Rules/SourceDist.hs | 2 +- 7 files changed, 4 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 2509dae..620d405 100644 --- a/README.md +++ b/README.md @@ -125,18 +125,7 @@ are currently not supported. #### Source distribution -To build a GHC source distribution tarball, run `build source-dist`. - -#### Binary distribution - -To build a GHC binary distribution, run `build binary-dist`. The resulting -tarball contains just enough to support the - -``` sh -$ ./configure [--prefix=PATH] && make install -``` - -workflow, for now. +To build a GHC source distribution tarball, run `build sdist-ghc`. #### Testing diff --git a/cfg/system.config.in b/cfg/system.config.in index 72bef12..c983ae4 100644 --- a/cfg/system.config.in +++ b/cfg/system.config.in @@ -7,7 +7,6 @@ alex = @AlexCmd@ ar = @ArCmd@ -autoreconf = autoreconf cc = @CC@ happy = @HappyCmd@ hs-cpp = @HaskellCPPCmd@ diff --git a/hadrian.cabal b/hadrian.cabal index ca339fb..486148f 100644 --- a/hadrian.cabal +++ b/hadrian.cabal @@ -51,7 +51,6 @@ executable hadrian , Oracles.Setting , Oracles.ModuleFiles , Rules - , Rules.BinaryDist , Rules.Clean , Rules.Compile , Rules.Configure diff --git a/src/Builder.hs b/src/Builder.hs index 0fb8be5..5ca6c20 100644 --- a/src/Builder.hs +++ b/src/Builder.hs @@ -89,7 +89,6 @@ instance NFData HaddockMode -- @GhcPkg Stage1@ is the one built in Stage0. data Builder = Alex | Ar ArMode Stage - | Autoreconf FilePath | DeriveConstants | Cc CcMode Stage | Configure FilePath @@ -175,7 +174,6 @@ instance H.Builder Builder where runtimeDependencies :: Builder -> Action [FilePath] runtimeDependencies = \case - Autoreconf dir -> return [dir -/- "configure.ac"] Configure dir -> return [dir -/- "configure"] Ghc _ Stage0 -> return [] @@ -234,7 +232,6 @@ instance H.Builder Builder where Ar Unpack _ -> cmd echo [Cwd output] [path] buildArgs - Autoreconf dir -> cmd echo [Cwd dir] [path] buildArgs Configure dir -> do -- Inject /bin/bash into `libtool`, instead of /bin/sh, -- otherwise Windows breaks. TODO: Figure out why. @@ -290,7 +287,6 @@ systemBuilderPath builder = case builder of Alex -> fromKey "alex" Ar _ Stage0 -> fromKey "system-ar" Ar _ _ -> fromKey "ar" - Autoreconf _ -> fromKey "autoreconf" Cc _ Stage0 -> fromKey "system-cc" Cc _ _ -> fromKey "cc" -- We can't ask configure for the path to configure! diff --git a/src/Builder.hs-boot b/src/Builder.hs-boot index 1d10434..bd38891 100644 --- a/src/Builder.hs-boot +++ b/src/Builder.hs-boot @@ -13,7 +13,6 @@ data HaddockMode = BuildPackage | BuildIndex data Builder = Alex | Ar ArMode Stage - | Autoreconf FilePath | DeriveConstants | Cc CcMode Stage | Configure FilePath diff --git a/src/Rules.hs b/src/Rules.hs index 100720f..982d249 100644 --- a/src/Rules.hs +++ b/src/Rules.hs @@ -8,16 +8,15 @@ import qualified Hadrian.Oracles.TextFile import Expression import GHC import qualified Oracles.ModuleFiles -import qualified Rules.BinaryDist import qualified Rules.Compile -import qualified Rules.Configure +import qualified Rules.PackageData import qualified Rules.Dependencies import qualified Rules.Documentation import qualified Rules.Generate +import qualified Rules.Configure import qualified Rules.Gmp import qualified Rules.Libffi import qualified Rules.Library -import qualified Rules.PackageData import qualified Rules.Program import qualified Rules.Register import Settings @@ -123,7 +122,6 @@ packageRules = do buildRules :: Rules () buildRules = do - Rules.BinaryDist.bindistRules Rules.Configure.configureRules Rules.Generate.copyRules Rules.Generate.generateRules diff --git a/src/Rules/SourceDist.hs b/src/Rules/SourceDist.hs index 8bec3f3..6ef7929 100644 --- a/src/Rules/SourceDist.hs +++ b/src/Rules/SourceDist.hs @@ -9,7 +9,7 @@ import Rules.Clean sourceDistRules :: Rules () sourceDistRules = do - "source-dist" ~> do + "sdist-ghc" ~> do -- We clean the source tree first. -- See https://github.com/snowleopard/hadrian/issues/384. -- TODO: Do we still need to clean the tree? From git at git.haskell.org Wed Apr 25 23:20:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:40 +0000 (UTC) Subject: [commit: hadrian] master: Preliminary bindist (#558) (8219f6a) Message-ID: <20180425232040.71F7D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/8219f6a48280b962b2de28b757b45b70b38d0523 >--------------------------------------------------------------- commit 8219f6a48280b962b2de28b757b45b70b38d0523 Author: Alp Mestanogullari Date: Tue Apr 3 21:42:39 2018 +0200 Preliminary bindist (#558) * Preliminary bindist rule For now, we only ship `/{bin, lib}` and the few make build system related files that are needed to support a simple ``` ./configure [--prefix=PATH] && make install ``` workflow. The current binary distributions of GHC support a wider range of parameters, but I figured it would be a good thing to start with this and enhance it as we all see fit and perhaps using feedback from GHC HQ (@bgamari in particular) and bindist users. * document binary distribution rule in README * sdist-ghc -> source-dist, Rules.Bindist -> Rules.BinaryDist * add missing src/Rules/BinaryDist.hs >--------------------------------------------------------------- 8219f6a48280b962b2de28b757b45b70b38d0523 README.md | 13 +++++- cfg/system.config.in | 1 + hadrian.cabal | 1 + src/Builder.hs | 4 ++ src/Builder.hs-boot | 1 + src/Rules.hs | 6 ++- src/Rules/BinaryDist.hs | 121 ++++++++++++++++++++++++++++++++++++++++++++++++ src/Rules/SourceDist.hs | 2 +- 8 files changed, 145 insertions(+), 4 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 8219f6a48280b962b2de28b757b45b70b38d0523 From git at git.haskell.org Wed Apr 25 23:20:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:42 +0000 (UTC) Subject: [commit: hadrian] master: Fix boot and configure on AppVeyor (#561) (3465caf) Message-ID: <20180425232042.76F873ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/3465caf80a5d852ce43ec7ecde73c887bc3d3562 >--------------------------------------------------------------- commit 3465caf80a5d852ce43ec7ecde73c887bc3d3562 Author: Andrey Mokhov Date: Sun Apr 8 20:53:49 2018 +0100 Fix boot and configure on AppVeyor (#561) * Call the boot script using the right Python interpreter * Install Python3 * Call boot and configure from Stack environment * Stay in Hadrian directory * Fix path to Stack * Fix slashes * Use bash to run configure >--------------------------------------------------------------- 3465caf80a5d852ce43ec7ecde73c887bc3d3562 appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9c163f8..3e67707 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,12 +27,13 @@ install: # Install all Hadrian and GHC build dependencies - cd ghc\hadrian - stack setup > nul - - appveyor-retry stack exec -- pacman -S autoconf automake-wrapper make patch python tar --noconfirm + - appveyor-retry stack exec -- pacman -S autoconf automake-wrapper make patch python3 tar --noconfirm build_script: # Boot and configure ghc source tree - cd .. - - python boot && configure --enable-tarballs-autodownload + - hadrian\stack exec -- python3 boot + - hadrian\stack exec -- bash configure --enable-tarballs-autodownload - cd hadrian # Build Hadrian and run internal Hadrian tests From git at git.haskell.org Wed Apr 25 23:20:44 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:44 +0000 (UTC) Subject: [commit: hadrian] master: Fix Windows build (#563) (2683445) Message-ID: <20180425232044.815C73ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/2683445c64be4d4079b00af87fa23cd9a9b2c152 >--------------------------------------------------------------- commit 2683445c64be4d4079b00af87fa23cd9a9b2c152 Author: Andrey Mokhov Date: Tue Apr 10 03:22:31 2018 +0100 Fix Windows build (#563) Fix copyFile failure on Windows plus minor revision >--------------------------------------------------------------- 2683445c64be4d4079b00af87fa23cd9a9b2c152 src/Builder.hs-boot | 2 +- src/Hadrian/Haskell/Cabal/Parse.hs | 376 +++++++++++++++++-------------------- src/Rules/Register.hs | 3 +- 3 files changed, 178 insertions(+), 203 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 2683445c64be4d4079b00af87fa23cd9a9b2c152 From git at git.haskell.org Wed Apr 25 23:20:46 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:46 +0000 (UTC) Subject: [commit: hadrian] master: Fix Windows build, improve error reporting (#565) (b6c77f3) Message-ID: <20180425232046.82D673ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/b6c77f39778d739ba5fc4a920e0f8231e693d1e4 >--------------------------------------------------------------- commit b6c77f39778d739ba5fc4a920e0f8231e693d1e4 Author: Andrey Mokhov Date: Wed Apr 11 23:23:50 2018 +0100 Fix Windows build, improve error reporting (#565) * Print diagnostic info in verbose mode * Try enable-distro-toolchain * Improve error handling >--------------------------------------------------------------- b6c77f39778d739ba5fc4a920e0f8231e693d1e4 appveyor.yml | 2 +- src/Hadrian/Haskell/Cabal/Parse.hs | 65 +++++++++++++++++++------------------- src/Hadrian/Oracles/TextFile.hs | 9 +++++- src/Hadrian/Package.hs | 5 +-- 4 files changed, 44 insertions(+), 37 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 b6c77f39778d739ba5fc4a920e0f8231e693d1e4 From git at git.haskell.org Wed Apr 25 23:20:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:48 +0000 (UTC) Subject: [commit: hadrian] master: Fix copying of fs*.h files during RTS registration (#566) (66117c5) Message-ID: <20180425232048.89A363ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/66117c5e751dd5dc742a305e131c48a768984166 >--------------------------------------------------------------- commit 66117c5e751dd5dc742a305e131c48a768984166 Author: Andrey Mokhov Date: Thu Apr 12 02:32:31 2018 +0100 Fix copying of fs*.h files during RTS registration (#566) * Fix indentation * Pass the verbosity setting to Cabal * Add a workaround for missing fs.h files >--------------------------------------------------------------- 66117c5e751dd5dc742a305e131c48a768984166 src/Hadrian/Haskell/Cabal/Parse.hs | 12 ++++++-- src/Rules/Generate.hs | 57 +++++++++++++++++++++----------------- src/Rules/Register.hs | 57 +++++++++++++++++++------------------- 3 files changed, 68 insertions(+), 58 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 66117c5e751dd5dc742a305e131c48a768984166 From git at git.haskell.org Wed Apr 25 23:20:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:50 +0000 (UTC) Subject: [commit: hadrian] master: Undo fs*.h workaround (4e4a023) Message-ID: <20180425232050.8F06C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/4e4a023f5f0595f54df8a0872a34506114df2423 >--------------------------------------------------------------- commit 4e4a023f5f0595f54df8a0872a34506114df2423 Author: Andrey Mokhov Date: Fri Apr 13 01:00:54 2018 +0100 Undo fs*.h workaround See #554 >--------------------------------------------------------------- 4e4a023f5f0595f54df8a0872a34506114df2423 src/Rules/Generate.hs | 5 ----- src/Rules/Register.hs | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs index b57f547..cc2bf4b 100644 --- a/src/Rules/Generate.hs +++ b/src/Rules/Generate.hs @@ -167,11 +167,6 @@ copyRules = do prefix -/- "platformConstants" <~ (buildRoot <&> (-/- generatedDir)) prefix -/- "settings" <~ return "." prefix -/- "template-hsc.h" <~ return (pkgPath hsc2hs) - - -- TODO: Get rid of this workaround. - -- See https://github.com/snowleopard/hadrian/issues/554 - root -/- buildDir rtsContext -/- "rts/fs.h" <~ return "rts" - root -/- buildDir rtsContext -/- "rts/fs_rts.h" <~ return "rts" where infixl 1 <~ pattern <~ mdir = pattern %> \file -> do diff --git a/src/Rules/Register.hs b/src/Rules/Register.hs index 8c726b5..ed0cb2b 100644 --- a/src/Rules/Register.hs +++ b/src/Rules/Register.hs @@ -65,11 +65,7 @@ buildConf _ context at Context {..} _conf = do , path -/- "ghcautoconf.h" , path -/- "ghcplatform.h" , path -/- "ghcversion.h" - , path -/- "ffi.h" - -- TODO: Get rid of this workaround. - -- See https://github.com/snowleopard/hadrian/issues/554 - , path -/- "rts/fs.h" - , path -/- "rts/fs_rts.h" ] + , path -/- "ffi.h" ] when (package == integerGmp) $ need [path -/- "ghc-gmp.h"] From git at git.haskell.org Wed Apr 25 23:20:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:52 +0000 (UTC) Subject: [commit: hadrian] master: Fix integer-gmp build (#568) (c190ab6) Message-ID: <20180425232052.933D13ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/c190ab6eeda6cfa0782269d4f2d38c64aa65fd17 >--------------------------------------------------------------- commit c190ab6eeda6cfa0782269d4f2d38c64aa65fd17 Author: Andrey Mokhov Date: Mon Apr 16 02:10:17 2018 +0100 Fix integer-gmp build (#568) * Fix path to GMP's config.mk * Minor revision * Relocate GMP's build artefacts >--------------------------------------------------------------- c190ab6eeda6cfa0782269d4f2d38c64aa65fd17 src/Rules/Gmp.hs | 15 +++++++++------ src/Rules/Library.hs | 34 +++++++++++++++------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs index 89a88e4..8852311 100644 --- a/src/Rules/Gmp.hs +++ b/src/Rules/Gmp.hs @@ -22,9 +22,13 @@ gmpLibrary = ".libs/libgmp.a" gmpContext :: Context gmpContext = vanillaContext Stage1 integerGmp +-- TODO: Location of 'gmpBuildPath' is important: it should be outside any +-- package build directory, as otherwise GMP's object files will match build +-- patterns of 'compilePackage' rules. We could make 'compilePackage' rules +-- more precise to avoid such spurious matching. -- | Build directory for in-tree GMP library. gmpBuildPath :: Action FilePath -gmpBuildPath = buildRoot <&> (-/- buildDir gmpContext -/- "gmp") +gmpBuildPath = buildRoot <&> (-/- stageString (stage gmpContext) -/- "gmp") -- | GMP library header, relative to 'gmpBuildPath'. gmpLibraryH :: FilePath @@ -45,7 +49,7 @@ gmpRules = do root <- buildRootRules root gmpLibraryH %> \header -> do windows <- windowsHost - configMk <- readFile' =<< (gmpBuildPath <&> (-/- "config.mk")) + configMk <- readFile' =<< (buildPath gmpContext <&> (-/- "config.mk")) if not windows && -- TODO: We don't use system GMP on Windows. Fix? any (`isInfixOf` configMk) [ "HaveFrameworkGMP = YES", "HaveLibGmp = YES" ] then do @@ -75,14 +79,13 @@ gmpRules = do -- This causes integerGmp package to be configured, hence creating the files root "gmp/config.mk" %> \_ -> do - -- setup-config, triggers `ghc-cabal configure` - -- everything of a package should depend on that - -- in the first place. + -- Calling 'need' on @setup-config@, triggers @ghc-cabal configure@ + -- Building anything in a package transitively depends on its configuration. setupConfig <- contextPath gmpContext <&> (-/- "setup-config") need [setupConfig] - -- Run GMP's configure script -- TODO: Get rid of hard-coded @gmp at . + -- Run GMP's configure script root "gmp/Makefile" %> \mk -> do env <- configureEnvironment gmpPath <- gmpBuildPath diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs index e9f8ff6..000d032 100644 --- a/src/Rules/Library.hs +++ b/src/Rules/Library.hs @@ -23,34 +23,30 @@ import qualified System.Directory as IO archive :: Way -> String -> String archive way pkgId = "libHS" ++ pkgId ++ (waySuffix way <.> "a") --- | Building a library consist of building --- the artifacts, and copying it somewhere --- with cabal, and finally registering it --- with the compiler via cabal in the --- package database. --- --- So we'll assume rules to build all the --- package artifacts, and provide rules for --- the any of the library artifacts. +-- TODO: This comment is rather vague, make it more precise by listing what +-- exactly gets built and moved where, referencing the corresponding rules. +-- | Building a library consist of building the artefacts, copying it somewhere +-- with Cabal, and finally registering it with the compiler via Cabal in the +-- package database. We assume rules to build all the package artefacts, and +-- provide rules for the library artefacts. library :: Context -> Rules () library context at Context{..} = do root <- buildRootRules pkgId <- case pkgCabalFile package of - Just file -> liftIO $ parseCabalPkgId file - Nothing -> return (pkgName package) + Just file -> liftIO $ parseCabalPkgId file + Nothing -> return $ pkgName package - root -/- libDir context -/- pkgId -/- archive way pkgId %> \_ -> do + root -/- libDir context -/- pkgId -/- archive way pkgId %> \_ -> need =<< mapM (\pkgId -> packageDbPath stage <&> (-/- pkgId <.> "conf")) [pkgId] - return () libraryObjects :: Context -> Action [FilePath] libraryObjects context at Context{..} = do - hsObjs <- hsObjects context - noHsObjs <- nonHsObjects context + hsObjs <- hsObjects context + nonHsObjs <- nonHsObjects context -- This will create split objects if required (we don't track them -- explicitly as this would needlessly bloat the Shake database). - need $ noHsObjs ++ hsObjs + need $ nonHsObjs ++ hsObjs split <- interpretInContext context =<< splitObjects <$> flavour let getSplitObjs = concatForM hsObjs $ \obj -> do @@ -58,7 +54,7 @@ libraryObjects context at Context{..} = do contents <- liftIO $ IO.getDirectoryContents dir return . map (dir -/-) $ filter (not . all (== '.')) contents - (noHsObjs ++) <$> if split then getSplitObjs else return hsObjs + (nonHsObjs ++) <$> if split then getSplitObjs else return hsObjs buildDynamicLib :: Context -> Rules () buildDynamicLib context at Context{..} = do @@ -106,8 +102,8 @@ buildPackageGhciLibrary :: Context -> Rules () buildPackageGhciLibrary context at Context {..} = priority 2 $ do root <- buildRootRules pkgId <- case pkgCabalFile package of - Just file -> liftIO $ parseCabalPkgId file - Nothing -> return (pkgName package) + Just file -> liftIO $ parseCabalPkgId file + Nothing -> return $ pkgName package let libPrefix = root -/- buildDir context -/- "HS" ++ pkgId o = libPrefix ++ "*" ++ (waySuffix way <.> "o") From git at git.haskell.org Wed Apr 25 23:20:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:54 +0000 (UTC) Subject: [commit: hadrian] master: Fix the path to touchy (#572) (32e26b0) Message-ID: <20180425232054.97F913ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/32e26b0fa5adec71fa513a8e6e1d4d655fc562b7 >--------------------------------------------------------------- commit 32e26b0fa5adec71fa513a8e6e1d4d655fc562b7 Author: Andrey Mokhov Date: Mon Apr 16 20:01:00 2018 +0100 Fix the path to touchy (#572) * Fix the path to touchy * Allow binaries to live in lib/bin >--------------------------------------------------------------- 32e26b0fa5adec71fa513a8e6e1d4d655fc562b7 src/GHC.hs | 8 ++++++-- src/Rules/Program.hs | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/GHC.hs b/src/GHC.hs index 5a7dc31..0262823 100644 --- a/src/GHC.hs +++ b/src/GHC.hs @@ -128,8 +128,12 @@ installStage pkg -- | The 'FilePath' to a program executable in a given 'Context'. programPath :: Context -> Action FilePath programPath context at Context {..} = do - path <- stageBinPath stage - pgm <- programName context + -- The @touchy@ utility lives in the @lib/bin@ directory instead of @bin@, + -- which is likely just a historical accident that will hopefully be fixed. + -- See: https://github.com/snowleopard/hadrian/issues/570 + path <- if package /= touchy then stageBinPath stage + else stageLibPath stage <&> (-/- "bin") + pgm <- programName context return $ path -/- pgm <.> exe -- | Some contexts are special: their packages do not have @.cabal@ metadata or diff --git a/src/Rules/Program.hs b/src/Rules/Program.hs index 32a8eb8..67a310f 100644 --- a/src/Rules/Program.hs +++ b/src/Rules/Program.hs @@ -19,7 +19,8 @@ buildProgram :: [(Resource, Int)] -> Rules () buildProgram rs = do root <- buildRootRules forM_ [Stage0 ..] $ \stage -> - root -/- stageString stage -/- "bin" -/- "*" %> \bin -> do + [ root -/- stageString stage -/- "bin" -/- "*" + , root -/- stageString stage -/- "lib/bin" -/- "*" ] |%> \bin -> do -- quite inefficient. But we can't access the programName from -- Rules, as it's an Action, due to being backed by an Oracle. From git at git.haskell.org Wed Apr 25 23:20:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:56 +0000 (UTC) Subject: [commit: hadrian] master: Fix missing libHSghc-8.5-0.a (#574) (05fbe8b) Message-ID: <20180425232056.9D4B83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/05fbe8b36da146aae24c53455131b5b5618ee849 >--------------------------------------------------------------- commit 05fbe8b36da146aae24c53455131b5b5618ee849 Author: Andrey Mokhov Date: Mon Apr 16 23:29:25 2018 +0100 Fix missing libHSghc-8.5-0.a (#574) * Drop support for lib0 libraries See #573 * Minor refactoring >--------------------------------------------------------------- 05fbe8b36da146aae24c53455131b5b5618ee849 src/Context.hs | 15 +++------------ src/Hadrian/Oracles/TextFile.hs | 11 ++++++----- src/Rules/Library.hs | 20 ++++++++------------ src/Utilities.hs | 11 +---------- 4 files changed, 18 insertions(+), 39 deletions(-) diff --git a/src/Context.hs b/src/Context.hs index 225752d..0694eb1 100644 --- a/src/Context.hs +++ b/src/Context.hs @@ -7,11 +7,9 @@ module Context ( withHsPackage, -- * Paths - contextDir, buildPath, buildDir, - pkgInplaceConfig, pkgSetupConfigFile, - pkgHaddockFile, pkgLibraryFile, pkgLibraryFile0, pkgGhciLibraryFile, - pkgConfFile, objectPath, contextPath, getContextPath, - libDir, libPath + contextDir, buildPath, buildDir, pkgInplaceConfig, pkgSetupConfigFile, + pkgHaddockFile, pkgLibraryFile, pkgGhciLibraryFile, pkgConfFile, objectPath, + contextPath, getContextPath, libDir, libPath ) where import Base @@ -101,13 +99,6 @@ pkgLibraryFile context at Context {..} = do extension <- libsuf way pkgFile context "libHS" extension --- | Path to the auxiliary library file of a given 'Context', e.g.: --- @_build/stage1/compiler/build/libHSghc-8.1-0.a at . -pkgLibraryFile0 :: Context -> Action FilePath -pkgLibraryFile0 context at Context {..} = do - extension <- libsuf way - pkgFile context "libHS" ("-0" ++ extension) - -- | Path to the GHCi library file of a given 'Context', e.g.: -- @_build/stage1/libraries/array/build/HSarray-0.5.1.0.o at . pkgGhciLibraryFile :: Context -> Action FilePath diff --git a/src/Hadrian/Oracles/TextFile.hs b/src/Hadrian/Oracles/TextFile.hs index 98c098a..2f58fab 100644 --- a/src/Hadrian/Oracles/TextFile.hs +++ b/src/Hadrian/Oracles/TextFile.hs @@ -147,10 +147,11 @@ textFileOracle = do confCabal <- newCache $ \(ctx at Context {..}) -> do case pkgCabalFile package of - Just file -> do - need [file] - putLoud $ "| PackageDataFile oracle: reading " ++ quote file ++ " (Stage: " ++ stageString stage ++ ")..." - Just <$> parsePackageData ctx - Nothing -> return Nothing + Just file -> do + need [file] + putLoud $ "| PackageDataFile oracle: reading " ++ quote file + ++ " (Stage: " ++ stageString stage ++ ")..." + Just <$> parsePackageData ctx + Nothing -> return Nothing void $ addOracle $ \(PackageDataFile ctx) -> confCabal ctx diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs index 000d032..6ce0a71 100644 --- a/src/Rules/Library.hs +++ b/src/Rules/Library.hs @@ -12,7 +12,6 @@ import Expression hiding (way, package) import Flavour import GHC.Packages import Oracles.ModuleFiles -import Oracles.Setting import Rules.Gmp import Settings import Target @@ -60,8 +59,8 @@ buildDynamicLib :: Context -> Rules () buildDynamicLib context at Context{..} = do root <- buildRootRules pkgId <- case pkgCabalFile package of - Just file -> liftIO $ parseCabalPkgId file - Nothing -> return (pkgName package) + Just file -> liftIO $ parseCabalPkgId file + Nothing -> return $ pkgName package let libPrefix = root -/- buildDir context -/- "libHS" ++ pkgId -- OS X libPrefix ++ "*.dylib" %> buildDynamicLibUnix @@ -79,20 +78,17 @@ buildPackageLibrary :: Context -> Rules () buildPackageLibrary context at Context {..} = do root <- buildRootRules pkgId <- case pkgCabalFile package of - Just file -> liftIO (parseCabalPkgId file) - Nothing -> return (pkgName package) + Just file -> liftIO $ parseCabalPkgId file + Nothing -> return $ pkgName package let libPrefix = root -/- buildDir context -/- "libHS" ++ pkgId archive = libPrefix ++ (waySuffix way <.> "a") archive %%> \a -> do objs <- libraryObjects context - asuf <- libsuf way - let isLib0 = ("//*-0" ++ asuf) ?== a removeFile a - if isLib0 then build $ target context (Ar Pack stage) [] [a] -- TODO: Scan for dlls - else build $ target context (Ar Pack stage) objs [a] + build $ target context (Ar Pack stage) objs [a] synopsis <- pkgSynopsis context - unless isLib0 . putSuccess $ renderLibrary + putSuccess $ renderLibrary (quote (pkgName package) ++ " (" ++ show stage ++ ", way " ++ show way ++ ").") a synopsis @@ -101,13 +97,13 @@ buildPackageLibrary context at Context {..} = do buildPackageGhciLibrary :: Context -> Rules () buildPackageGhciLibrary context at Context {..} = priority 2 $ do root <- buildRootRules + -- TODO: Get rid of code duplication for 'pkgId'. pkgId <- case pkgCabalFile package of Just file -> liftIO $ parseCabalPkgId file Nothing -> return $ pkgName package let libPrefix = root -/- buildDir context -/- "HS" ++ pkgId - o = libPrefix ++ "*" ++ (waySuffix way <.> "o") - o %> \obj -> do + libPrefix ++ "*" ++ (waySuffix way <.> "o") %> \obj -> do objs <- allObjects context need objs build $ target context (Ld stage) objs [obj] diff --git a/src/Utilities.hs b/src/Utilities.hs index 57faf41..2c73d94 100644 --- a/src/Utilities.hs +++ b/src/Utilities.hs @@ -13,8 +13,6 @@ import Hadrian.Utilities import Context import Expression hiding (stage) -import GHC.Packages -import Oracles.Setting (windowsHost) import Settings import Target @@ -67,18 +65,11 @@ stage1Dependencies = libraryTargets :: Bool -> Context -> Action [FilePath] libraryTargets includeGhciLib context = do libFile <- pkgLibraryFile context - lib0File <- pkgLibraryFile0 context - lib0 <- buildDll0 context ghciLib <- pkgGhciLibraryFile context ghci <- if includeGhciLib then interpretInContext context $ getPackageData PD.buildGhciLib else return False - return $ [ libFile ] ++ [ lib0File | lib0 ] ++ [ ghciLib | ghci ] - - where buildDll0 :: Context -> Action Bool - buildDll0 Context {..} = do - windows <- windowsHost - return $ windows && stage == Stage1 && package == compiler + return $ [ libFile ] ++ [ ghciLib | ghci ] -- | Coarse-grain 'need': make sure all given libraries are fully built. needLibrary :: [Context] -> Action () From git at git.haskell.org Wed Apr 25 23:20:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:20:58 +0000 (UTC) Subject: [commit: hadrian] master: Fix lint error (#575) (5b8f442) Message-ID: <20180425232058.A1CA93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/5b8f442f1ac886496ac1b7f8c0234171f8f5f199 >--------------------------------------------------------------- commit 5b8f442f1ac886496ac1b7f8c0234171f8f5f199 Author: Andrey Mokhov Date: Tue Apr 17 01:31:33 2018 +0100 Fix lint error (#575) * Minor revision * Use untracked doesFileExist >--------------------------------------------------------------- 5b8f442f1ac886496ac1b7f8c0234171f8f5f199 src/Rules/Register.hs | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/Rules/Register.hs b/src/Rules/Register.hs index ed0cb2b..b66f085 100644 --- a/src/Rules/Register.hs +++ b/src/Rules/Register.hs @@ -10,6 +10,7 @@ import Utilities import Distribution.ParseUtils import qualified Distribution.Compat.ReadP as Parse import Distribution.Version (Version) +import qualified System.Directory as IO import Hadrian.Expression import Hadrian.Haskell.Cabal.Parse as Cabal @@ -22,24 +23,24 @@ parseCabalName = readPToMaybe parse -- by running the @ghc-pkg@ utility. registerPackages :: [(Resource, Int)] -> Context -> Rules () registerPackages rs context at Context {..} = do - root <- buildRootRules - root -/- relativePackageDbPath stage %> - buildStamp rs context - - root -/- relativePackageDbPath stage -/- packageDbStamp %> \stamp -> - writeFileLines stamp [] - - root -/- relativePackageDbPath stage -/- "*.conf" %> \conf -> do - settings <- libPath context <&> (-/- "settings") - platformConstants <- libPath context <&> (-/- "platformConstants") - need [settings, platformConstants] - let Just pkgName | takeBaseName conf == "rts" = Just "rts" - | otherwise = fst <$> parseCabalName (takeBaseName conf) - let Just pkg = findPackageByName pkgName - bootLibs <- filter isLibrary <$> stagePackages Stage0 - case stage of - Stage0 | pkg `notElem` bootLibs -> copyConf rs (context { package = pkg }) conf - _ -> buildConf rs (context { package = pkg }) conf + root <- buildRootRules + root -/- relativePackageDbPath stage %> buildStamp rs context + + root -/- relativePackageDbPath stage -/- packageDbStamp %> \stamp -> + writeFileLines stamp [] + + -- TODO: Add proper error handling for partial functions. + root -/- relativePackageDbPath stage -/- "*.conf" %> \conf -> do + settings <- libPath context <&> (-/- "settings") + platformConstants <- libPath context <&> (-/- "platformConstants") + need [settings, platformConstants] + let Just pkgName | takeBaseName conf == "rts" = Just "rts" + | otherwise = fst <$> parseCabalName (takeBaseName conf) + let Just pkg = findPackageByName pkgName + isBoot <- (pkg `notElem`) <$> stagePackages Stage0 + case stage of + Stage0 | isBoot -> copyConf rs (context { package = pkg }) conf + _ -> buildConf rs (context { package = pkg }) conf buildConf :: [(Resource, Int)] -> Context -> FilePath -> Action () buildConf _ context at Context {..} _conf = do @@ -76,13 +77,16 @@ buildConf _ context at Context {..} _conf = do copyConf :: [(Resource, Int)] -> Context -> FilePath -> Action () copyConf rs context at Context {..} conf = do depPkgIds <- fmap stdOutToPkgIds . askWithResources rs $ - target context (GhcPkg Dependencies stage) [pkgName package] [] + target context (GhcPkg Dependencies stage) [pkgName package] [] need =<< mapM (\pkgId -> packageDbPath stage <&> (-/- pkgId <.> "conf")) depPkgIds -- We should unregister if the file exists since @ghc-pkg@ will complain -- about existing package: https://github.com/snowleopard/hadrian/issues/543. -- Also, we don't always do the unregistration + registration to avoid -- repeated work after a full build. - unlessM (doesFileExist conf) $ do + -- We do not track 'doesFileExist' since we are going to create the file if + -- it is currently missing. TODO: Is this the right thing to do? + -- See https://github.com/snowleopard/hadrian/issues/569. + unlessM (liftIO $ IO.doesFileExist conf) $ do buildWithResources rs $ target context (GhcPkg Unregister stage) [pkgName package] [] buildWithResources rs $ From git at git.haskell.org Wed Apr 25 23:21:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:00 +0000 (UTC) Subject: [commit: hadrian] master: Speed up AppVeyor build (5276bf5) Message-ID: <20180425232100.A67E33ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/5276bf540756133a8b6506a293131929db801569 >--------------------------------------------------------------- commit 5276bf540756133a8b6506a293131929db801569 Author: Andrey Mokhov Date: Tue Apr 17 01:44:03 2018 +0100 Speed up AppVeyor build >--------------------------------------------------------------- 5276bf540756133a8b6506a293131929db801569 appveyor.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 69e3b90..f8fe198 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,11 +36,8 @@ build_script: - hadrian\stack exec -- bash configure --enable-distro-toolchain - cd hadrian - # Build Hadrian and run internal Hadrian tests - - build selftest - # Build GHC - - build -j --flavour=quickest --no-progress --progress-colour=never --profile=- + - build -j --flavour=quickest --integer-simple --no-progress --progress-colour=never --profile=- # Test GHC binary - cd .. From git at git.haskell.org Wed Apr 25 23:21:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:02 +0000 (UTC) Subject: [commit: hadrian] master: Generic library rules (#571) (d021ffc) Message-ID: <20180425232102.AD4823ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/d021ffc30b7cb0cd616ec44059f122b49e0b3f58 >--------------------------------------------------------------- commit d021ffc30b7cb0cd616ec44059f122b49e0b3f58 Author: Alp Mestanogullari Date: Tue Apr 17 19:03:36 2018 +0200 Generic library rules (#571) * wip * debugging output * Compute ProjectVersion on demand ONLY! * remove debugging output, boot with --hadrian * go back to using -c everywhere in .travis.yml * prioritise libgmp.a rule over catch-all *.a rule, to avoid conflict * add missing import * tentative fix for the appveyor script * use backslashes in appveyor.yml * less 'cd'ing around in appveyor.yml * address most of @snowleopard's feedback * address last bit of feedback >--------------------------------------------------------------- d021ffc30b7cb0cd616ec44059f122b49e0b3f58 .travis.yml | 21 +-- appveyor.yml | 6 +- hadrian.cabal | 1 + src/Rules.hs | 15 +- src/Rules/Configure.hs | 3 +- src/Rules/Gmp.hs | 5 +- src/Rules/Libffi.hs | 4 +- src/Rules/Library.hs | 364 +++++++++++++++++++++++++++++++++++------------ src/Settings/Packages.hs | 6 +- src/Way.hs | 2 +- src/Way/Type.hs | 4 + 11 files changed, 309 insertions(+), 122 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 d021ffc30b7cb0cd616ec44059f122b49e0b3f58 From git at git.haskell.org Wed Apr 25 23:21:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:04 +0000 (UTC) Subject: [commit: hadrian] master: Fix warning (99c262b) Message-ID: <20180425232104.B1D393ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/99c262bfe240215c993304dacca611cb5d880557 >--------------------------------------------------------------- commit 99c262bfe240215c993304dacca611cb5d880557 Author: Andrey Mokhov Date: Tue Apr 17 19:47:29 2018 +0100 Fix warning >--------------------------------------------------------------- 99c262bfe240215c993304dacca611cb5d880557 src/Rules/Library.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs index 314d124..0f74d9d 100644 --- a/src/Rules/Library.hs +++ b/src/Rules/Library.hs @@ -10,7 +10,6 @@ import Expression hiding (way, package) import Flavour import GHC.Packages import Oracles.ModuleFiles -import Oracles.Setting (libsuf) import Rules.Gmp import Settings import Target From git at git.haskell.org Wed Apr 25 23:21:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:06 +0000 (UTC) Subject: [commit: hadrian] master: Fix CircleCI (66bc48c) Message-ID: <20180425232106.B657E3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/66bc48cada640cd53ee09c9b9832859f153e231d >--------------------------------------------------------------- commit 66bc48cada640cd53ee09c9b9832859f153e231d Author: Andrey Mokhov Date: Tue Apr 17 19:48:16 2018 +0100 Fix CircleCI >--------------------------------------------------------------- 66bc48cada640cd53ee09c9b9832859f153e231d circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 66d5193..67b287d 100644 --- a/circle.yml +++ b/circle.yml @@ -43,4 +43,4 @@ compile: test: override: # Test GHC binary - - ghc/inplace/bin/ghc-stage2 -e 1+2 + - _build/stage1/bin/ghc -e 1+2 From git at git.haskell.org Wed Apr 25 23:21:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:08 +0000 (UTC) Subject: [commit: hadrian] master: Fix path to GHC (1174b31) Message-ID: <20180425232108.BADAA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/1174b31551fb954cb5568a34170a5ebcc5b9d292 >--------------------------------------------------------------- commit 1174b31551fb954cb5568a34170a5ebcc5b9d292 Author: Andrey Mokhov Date: Tue Apr 17 20:32:56 2018 +0100 Fix path to GHC See #541 >--------------------------------------------------------------- 1174b31551fb954cb5568a34170a5ebcc5b9d292 circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 67b287d..10b9094 100644 --- a/circle.yml +++ b/circle.yml @@ -43,4 +43,4 @@ compile: test: override: # Test GHC binary - - _build/stage1/bin/ghc -e 1+2 + - ghc/_build/stage1/bin/ghc -e 1+2 From git at git.haskell.org Wed Apr 25 23:21:10 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:10 +0000 (UTC) Subject: [commit: hadrian] master: Fix AppVeyor (#577) (9110813) Message-ID: <20180425232110.BF81D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/911081374f58514e76520ae755614c5a0000073c >--------------------------------------------------------------- commit 911081374f58514e76520ae755614c5a0000073c Author: Andrey Mokhov Date: Wed Apr 18 01:34:10 2018 +0100 Fix AppVeyor (#577) * Copy inplace/mingw to the build root * Run Hadrian with -c on AppVeyor >--------------------------------------------------------------- 911081374f58514e76520ae755614c5a0000073c appveyor.yml | 8 ++------ src/Rules/Configure.hs | 8 +++++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 85bfee8..1a18abe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,13 +30,9 @@ install: - appveyor-retry stack exec -- pacman -S autoconf automake-wrapper make patch python3 tar --noconfirm build_script: - # Boot and configure ghc source tree - - cd .. - - hadrian\stack exec -- python3 boot - - hadrian\stack exec -- bash configure --enable-distro-toolchain - # Build GHC - - hadrian\build -j --flavour=quickest --integer-simple --no-progress --progress-colour=never --profile=- + - cd .. + - hadrian\build -c -j --flavour=quickest --integer-simple --no-progress --progress-colour=never --profile=- # Test GHC binary - _build\stage1\bin\ghc -e 1+2 diff --git a/src/Rules/Configure.hs b/src/Rules/Configure.hs index 1fd07de..050d7f3 100644 --- a/src/Rules/Configure.hs +++ b/src/Rules/Configure.hs @@ -12,7 +12,7 @@ import Utilities configureRules :: Rules () configureRules = do - -- TODO: consider other files we should track here (rts/rts.cabal etc) + -- TODO: consider other files we should track here, e.g. @rts/rts.cabal at . [configFile, "settings", configH, "compiler/ghc.cabal"] &%> \outs -> do skip <- not <$> cmdConfigure if skip @@ -29,6 +29,12 @@ configureRules = do context = vanillaContext Stage0 compiler need srcs build $ target context (Configure ".") srcs outs + -- We need to copy the directory with unpacked Windows tarball to + -- the build directory, so that the built GHC has access to it. + -- See https://github.com/snowleopard/hadrian/issues/564. + when System.isWindows $ do + root <- buildRoot + copyDirectory "inplace/mingw" (root -/- "mingw") ["configure", configH <.> "in"] &%> \_ -> do skip <- not <$> cmdConfigure From git at git.haskell.org Wed Apr 25 23:21:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:12 +0000 (UTC) Subject: [commit: hadrian] master: Update README.md (#578) (64da39c) Message-ID: <20180425232112.C456B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/64da39cc9f955d7c1492ab39927a8e0849b23f00 >--------------------------------------------------------------- commit 64da39cc9f955d7c1492ab39927a8e0849b23f00 Author: Alp Mestanogullari Date: Mon Apr 23 14:21:55 2018 +0200 Update README.md (#578) I noticed that one sentence from the README is out of date, so here's a tentative wording that reflects the current state of things. >--------------------------------------------------------------- 64da39cc9f955d7c1492ab39927a8e0849b23f00 README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2509dae..5da7990 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,10 @@ project and the architecture of the build system you can find more details in this [Haskell Symposium 2016 paper](https://dl.acm.org/authorize?N41275) and this [Haskell eXchange 2016 talk][talk]. -The new build system can work side-by-side with the existing build system. Note, there is -some interaction between them: they put (some) build results in the same directories, -e.g. the resulting GHC is `inplace/bin/ghc-stage2`. +The new build system can work side-by-side with the existing build system, since it +places all build artefacts under a dedicated directory. The only thing they both share +is the need to run the `./boot` and `./configure` scripts, even though Hadrian can do it +for you (see the documentation for the `-c` flag below). Your first build ---------------- From git at git.haskell.org Wed Apr 25 23:21:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:21:14 +0000 (UTC) Subject: [commit: hadrian] master: Link to Quick Start guide (7c3c45f) Message-ID: <20180425232114.C91D83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/7c3c45f4539af8e75764a1c100dfbb35a86f4be3 >--------------------------------------------------------------- commit 7c3c45f4539af8e75764a1c100dfbb35a86f4be3 Author: Andrey Mokhov Date: Tue Apr 24 11:27:09 2018 +0100 Link to Quick Start guide >--------------------------------------------------------------- 7c3c45f4539af8e75764a1c100dfbb35a86f4be3 README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5da7990..6221353 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ this [Haskell Symposium 2016 paper](https://dl.acm.org/authorize?N41275) and thi [Haskell eXchange 2016 talk][talk]. The new build system can work side-by-side with the existing build system, since it -places all build artefacts under a dedicated directory. The only thing they both share -is the need to run the `./boot` and `./configure` scripts, even though Hadrian can do it -for you (see the documentation for the `-c` flag below). +places all build artefacts in a dedicated directory (called `_build` by default). +See [this guide](https://ghc.haskell.org/trac/ghc/wiki/Building/Hadrian/QuickStart) +if you'd like to start using Hadrian for building GHC. Your first build ---------------- From git at git.haskell.org Wed Apr 25 23:22:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 Apr 2018 23:22:16 +0000 (UTC) Subject: [commit: ghc] master: Update Hadrian submodule (625eea9) Message-ID: <20180425232216.B71043ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/625eea9332532666a35b4cc680ef4f7e51d4b2d1/ghc >--------------------------------------------------------------- commit 625eea9332532666a35b4cc680ef4f7e51d4b2d1 Author: Andrey Mokhov Date: Wed Apr 25 23:57:28 2018 +0100 Update Hadrian submodule * Link to Quick Start guide * Update README.md (hadrian/578) * Fix AppVeyor (hadrian/577) * Fix CircleCI * Generic library rules (hadrian/571) * Fix lint error (hadrian/575) * Fix missing libHSghc-8.5-0.a (hadrian/574) * Fix the path to touchy (hadrian/572) * Fix integer-gmp build (hadrian/568) * Undo fs*.h workaround * Fix copying of fs*.h files during RTS registration (hadrian/566) * Fix Windows build, improve error reporting (hadrian/565) * Fix Windows build (hadrian/563) * Fix boot and configure on AppVeyor (hadrian/561) * Preliminary bindist (hadrian/558, hadrian/555) * Unregister stage0 package first if it needs to be cloned (hadrian/552) * Fix Circle CI (hadrian/553) * Fix warnings (hadrian/547) * Merge pull request hadrian/542 from Mistuke/fix-specific-file * Use Cabal directly in place of ghc-cabal + make build root configurable (hadrian/531) * Add user-defined flavour example for turning off dynamic linking (hadrian/535) * Add clean routines for fs (hadrian/533) * Add 'git' to nativeBuildInputs in shell.nix (hadrian/530) * Add extra include paths when invoking ghc-cabal (hadrian/526) * Merge pull request hadrian/528 from snowleopard/bump-cabal * Merge pull request hadrian/521 from snowleopard/drop-chmod * Change permission bits for build.cabal.sh, fixes hadrian/517 (hadrian/520) * Pin nixpkgs and all-cabal-hashes in shell.nix (hadrian/511) * Add troubleshooting section >--------------------------------------------------------------- 625eea9332532666a35b4cc680ef4f7e51d4b2d1 hadrian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadrian b/hadrian index da39729..7c3c45f 160000 --- a/hadrian +++ b/hadrian @@ -1 +1 @@ -Subproject commit da397291a9052387862c27c87ec29b6fce2c7d77 +Subproject commit 7c3c45f4539af8e75764a1c100dfbb35a86f4be3 From git at git.haskell.org Thu Apr 26 11:37:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 Apr 2018 11:37:59 +0000 (UTC) Subject: [commit: ghc] branch 'wip/tdammers/T15019' created Message-ID: <20180426113759.9D4C93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/tdammers/T15019 Referencing: b2ff1ed477fe57c5aa69fbe6a93d7e88b52d536a From git at git.haskell.org Thu Apr 26 11:38:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 Apr 2018 11:38:02 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T15019: Fix performance regressions from #14737 (b2ff1ed) Message-ID: <20180426113802.6CE863ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T15019 Link : http://ghc.haskell.org/trac/ghc/changeset/b2ff1ed477fe57c5aa69fbe6a93d7e88b52d536a/ghc >--------------------------------------------------------------- commit b2ff1ed477fe57c5aa69fbe6a93d7e88b52d536a Author: Tobias Dammers Date: Thu Apr 26 13:34:07 2018 +0200 Fix performance regressions from #14737 See #15019. When removing an unnecessary type equality check in #14737, several regression tests failed. The cause was that some coercions that are actually Refl coercions weren't passed in as such, which made the equality check needlessly complex (Refl coercions can be discarded in this particular check immediately, without inspecting the types at all). We fix that, and get additional performance improvements for free. >--------------------------------------------------------------- b2ff1ed477fe57c5aa69fbe6a93d7e88b52d536a compiler/coreSyn/CoreOpt.hs | 13 +++++++++++-- compiler/simplCore/Simplify.hs | 10 ++++++++-- compiler/types/Coercion.hs | 9 +++++++++ testsuite/tests/perf/compiler/all.T | 12 ++++++++---- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index f1ff68d..99b7a38 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -958,10 +958,14 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) -- If the returned coercion is Nothing, then it would have been reflexive; -- it's faster not to compute it, though. pushCoTyArg co ty + | isReflCo co + = Just (ty, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion -- optimizer will take care of it. See Trac #14737. -- -- | tyL `eqType` tyR - -- -- = Just (ty, Nothing) + -- -- = pprTrace "eqType fired: " (ppr (co, tyL, tyR)) $ + -- -- Just (ty, Nothing) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) @@ -993,10 +997,15 @@ pushCoValArg :: CoercionR -> Maybe (Coercion, Maybe Coercion) -- If the second returned Coercion is actually Nothing, then no cast is necessary; -- the returned coercion would have been reflexive. pushCoValArg co + -- The "easy" case; this doesn't interest us. + | isReflCo co + = Just (mkRepReflCo arg, Nothing) + -- The following is inefficient - don't do `eqType` here, the coercion -- optimizer will take care of it. See Trac #14737. -- -- | tyL `eqType` tyR - -- -- = Just (mkRepReflCo arg, Nothing) + -- -- = pprTrace "eqType fired: " (ppr (co, tyL, tyR)) $ + -- -- Just (mkRepReflCo arg, Nothing) | isFunTy tyL , (co1, co2) <- decomposeFunCo Representational co diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d92f6d7..6f5d65a 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1224,9 +1224,15 @@ simplCast env body co0 cont0 addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont + addCoerce co cont + | isReflCo co = return cont + addCoerce co1 (CastIt co2 cont) - = {-#SCC "addCoerce-simple-recursion" #-} - addCoerce (mkTransCo co1 co2) cont + | isReflexiveCo co' = return cont + | otherwise = {-#SCC "addCoerce-simple-recursion" #-} + addCoerce co' cont + where + co' = mkTransCo co1 co2 addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index ff41529..af10e91 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -61,6 +61,7 @@ module Coercion ( isReflCo, isReflCo_maybe, isReflexiveCo, isReflexiveCo_maybe, isReflCoVar_maybe, + isEqTypeCo, -- ** Coercion variables mkCoVar, isCoVar, coVarName, setCoVarName, setCoVarUnique, @@ -434,6 +435,14 @@ isReflCo :: Coercion -> Bool isReflCo (Refl {}) = True isReflCo _ = False +-- | Test if this coercion amounts to a trivial type equality. This covers more +-- cases than 'isReflCo', but is still a lot faster than the full kind and role +-- extraction that 'isReflexiveCo' or 'eqType' perform. +isEqTypeCo :: Coercion -> Bool +isEqTypeCo (SymCo co) = isEqTypeCo co +isEqTypeCo (NthCo _ _ _) = True -- isEqTypeCo co +isEqTypeCo co = isReflCo co + -- | Returns the type coerced if this coercion is reflexive. Guaranteed -- to work very quickly. Sometimes a coercion can be reflexive, but not -- obviously so. c.f. 'isReflexiveCo_maybe' diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 2001cda..11bb920 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -595,7 +595,7 @@ test('T5321FD', # (due to better optCoercion, 5e7406d9, #9233) # 2016-04-06: 250757460 (x86/Linux) - (wordsize(64), 415136648, 10)]) + (wordsize(64), 367569448, 10)]) # prev: 418306336 # 29/08/2012: 492905640 # (increase due to new codegen) @@ -617,6 +617,8 @@ test('T5321FD', # 2016-07-16: 477840432 # Optimize handling of built-in OccNames # 2017-05-14: 415136648 (amd64/Linux) Two-pass CmmLayoutStack + # 2018-04-26: 367569448 + # improve simplCast (#15019, #14737) ], compile,['']) @@ -747,7 +749,7 @@ test('T9020', # 2014-07-31: 343005716 (Windows) (general round of updates) # 2017-03-24: 249904136 (x86/Linux, 64-bit machine) - (wordsize(64), 562206104, 10)]) + (wordsize(64), 429226072, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -1040,7 +1042,7 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 141952368, 5), + [(wordsize(64), 130647536, 5), # initial: 125831400 # 2017-01-18: 133380960 Allow top-level string literals in Core # 2017-02-17: 153611448 Type-indexed Typeable @@ -1049,6 +1051,7 @@ test('T12425', # 2017-04-28: 127500136 Remove exponential behaviour in simplifier # 2017-05-23: 134780272 Addition of llvm-targets in dynflags (D3352) # 2018-04-15: 141952368 Collateral of #14737 + # 2018-04-26: 130647536 Fixed #14737 (via #15019) ]), ], compile, @@ -1118,7 +1121,7 @@ test('T13056', test('T12707', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1237898376, 5), + [(wordsize(64), 1141557680, 5), # initial: 1271577192 # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) @@ -1127,6 +1130,7 @@ test('T12707', # 2017-03-02: 1231809592 Drift from recent simplifier improvements # 2017-05-14: 1163821528 (amd64/Linux) Two-pass CmmLayoutStack # 2018-04-09: 1237898376 Inexplicable, collateral of #14737 + # 2018-04-26: 1141557680 Fixed #14737 regression (via #15019) ]), ], compile, From git at git.haskell.org Thu Apr 26 16:44:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 Apr 2018 16:44:29 +0000 (UTC) Subject: [commit: ghc] master: Do not unpack class dictionaries with INLINABLE (3d38e82) Message-ID: <20180426164429.954A73ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3d38e8284b7382844f9862e8d8afbae9c7248b09/ghc >--------------------------------------------------------------- commit 3d38e8284b7382844f9862e8d8afbae9c7248b09 Author: Simon Peyton Jones Date: Thu Apr 26 15:59:13 2018 +0100 Do not unpack class dictionaries with INLINABLE Matthew Pickering uncovered a bad performance hole in the way that single-method dictionaries work, described in Trac #14955. See Note [Do not unpack class dictionaries] in WwLib. I tried to fix this 6 years ago, but got it slightly wrong. This patch fixes it, which makes a dramatic improvement in the test case. Nofib highlights: not much happening: Program Size Allocs Runtime Elapsed TotalMem ----------------------------------------------------------------- VSM -0.3% +2.7% -7.4% -7.4% 0.0% cacheprof -0.0% +0.1% +0.3% +0.7% 0.0% integer -0.0% +1.1% +7.5% +7.5% 0.0% tak -0.1% -0.2% 0.024 0.024 0.0% ----------------------------------------------------------------- Min -4.4% -0.2% -7.4% -7.4% -8.0% Max +0.6% +2.7% +7.5% +7.5% 0.0% Geom Mean -0.1% +0.0% +0.1% +0.1% -0.2% I investigated VSM. The patch unpacks class dictionaries a bit more than before (i.e. does so if there is no INLINABLE pragma). And that gives better code in VSM (less dictionary selection etc), but one closure gets one word bigger. I'll accept these changes in exchange for more robust performance. Some ghci.debugger output wobbled around (order of bindings being displayed). I have no idea why; but I accepted the changes. >--------------------------------------------------------------- 3d38e8284b7382844f9862e8d8afbae9c7248b09 compiler/stranal/WorkWrap.hs | 10 ++- compiler/stranal/WwLib.hs | 64 ++++++++++++------- .../tests/ghci.debugger/scripts/break006.stdout | 4 +- .../tests/ghci.debugger/scripts/hist001.stdout | 2 +- .../tests/ghci.debugger/scripts/hist002.stdout | 2 +- .../indexed-types/should_compile/T7837.stderr | 4 ++ testsuite/tests/perf/should_run/T14955.hs | 20 ++++++ .../T5472.stdout => perf/should_run/T14955.stdout} | 0 testsuite/tests/perf/should_run/T14955a.hs | 72 ++++++++++++++++++++++ testsuite/tests/perf/should_run/all.T | 9 +++ 10 files changed, 155 insertions(+), 32 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 3d38e8284b7382844f9862e8d8afbae9c7248b09 From git at git.haskell.org Fri Apr 27 07:26:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 07:26:47 +0000 (UTC) Subject: [commit: ghc] master: Rename a local variable (313720a) Message-ID: <20180427072647.A2F333ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/313720a453889ddd05da02f4f2c31eb3bc3734d2/ghc >--------------------------------------------------------------- commit 313720a453889ddd05da02f4f2c31eb3bc3734d2 Author: Simon Peyton Jones Date: Fri Apr 20 17:13:31 2018 +0100 Rename a local variable >--------------------------------------------------------------- 313720a453889ddd05da02f4f2c31eb3bc3734d2 compiler/simplCore/Simplify.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 249d19f..2580720 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1696,7 +1696,7 @@ simplIdF env var cont completeCall :: SimplEnv -> OutId -> SimplCont -> SimplM (SimplFloats, OutExpr) completeCall env var cont - | Just expr <- callSiteInline dflags var unfolding + | Just expr <- callSiteInline dflags var active_unf lone_variable arg_infos interesting_cont -- Inline the variable's RHS = do { checkedTick (UnfoldingDone var) @@ -1715,7 +1715,7 @@ completeCall env var cont (lone_variable, arg_infos, call_cont) = contArgs cont n_val_args = length arg_infos interesting_cont = interestingCallContext env call_cont - unfolding = activeUnfolding (getMode env) var + active_unf = activeUnfolding (getMode env) var dump_inline unfolding cont | not (dopt Opt_D_dump_inlinings dflags) = return () From git at git.haskell.org Fri Apr 27 07:26:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 07:26:50 +0000 (UTC) Subject: [commit: ghc] master: Comments only (693857f) Message-ID: <20180427072650.71AD83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/693857f3a890dd061e19c70d4863b2258d97ff09/ghc >--------------------------------------------------------------- commit 693857f3a890dd061e19c70d4863b2258d97ff09 Author: Simon Peyton Jones Date: Fri Jan 12 17:31:06 2018 +0000 Comments only >--------------------------------------------------------------- 693857f3a890dd061e19c70d4863b2258d97ff09 compiler/simplCore/SimplUtils.hs | 3 ++- compiler/simplCore/Simplify.hs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 7c0689d..fbf9b3e 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1116,7 +1116,8 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env | not active = Nothing | isTopLevel top_lvl && isBottomingId bndr = Nothing -- Note [Top-level bottoming Ids] | isCoVar bndr = Nothing -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = Nothing -- Note [Do not inline exit join points] in Exitify + | isExitJoinId bndr = Nothing -- Note [Do not inline exit join points] + -- in module Exitify | not (one_occ (idOccInfo bndr)) = Nothing | not (isStableUnfolding unf) = Just (extend_subst_with rhs) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d92f6d7..249d19f 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3292,7 +3292,7 @@ simplLetUnfolding env top_lvl cont_mb id new_rhs rhs_ty unf | isStableUnfolding unf = simplStableUnfolding env top_lvl cont_mb id unf rhs_ty | isExitJoinId id - = return noUnfolding -- see Note [Do not inline exit join points] + = return noUnfolding -- See Note [Do not inline exit join points] in Exitify | otherwise = mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs From git at git.haskell.org Fri Apr 27 07:26:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 07:26:53 +0000 (UTC) Subject: [commit: ghc] master: Refactor in OccurAnal (705dcb0) Message-ID: <20180427072653.4033F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/705dcb0d47462739f575456223b8259b48d36183/ghc >--------------------------------------------------------------- commit 705dcb0d47462739f575456223b8259b48d36183 Author: Simon Peyton Jones Date: Fri Jan 12 17:34:49 2018 +0000 Refactor in OccurAnal * (+++) --> andUDs * combineAltsUsageDetails --> orUDs * combineUsageDetailsList --> andUDsList * Change some andUDsList to a fold for efficiency No change in behaviour >--------------------------------------------------------------- 705dcb0d47462739f575456223b8259b48d36183 compiler/simplCore/OccurAnal.hs | 57 +++++++++++++++++++++-------------------- 1 file changed, 29 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 705dcb0d47462739f575456223b8259b48d36183 From git at git.haskell.org Fri Apr 27 13:39:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 13:39:11 +0000 (UTC) Subject: [commit: ghc] master: TTG : complete for balance of hsSyn AST (c3823cb) Message-ID: <20180427133911.3974C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c3823cba2147c74b2c727b5458b9e95350496988/ghc >--------------------------------------------------------------- commit c3823cba2147c74b2c727b5458b9e95350496988 Author: Alan Zimmerman Date: Wed Apr 18 23:55:14 2018 +0200 TTG : complete for balance of hsSyn AST Summary: - remove PostRn/PostTc fields - remove the HsVect In/Out distinction for Type, Class and Instance - remove PlaceHolder in favour of NoExt - Simplify OutputableX constraint Updates haddock submodule Test Plan: ./validate Reviewers: goldfire, bgamari Subscribers: goldfire, thomie, mpickering, carter Differential Revision: https://phabricator.haskell.org/D4625 >--------------------------------------------------------------- c3823cba2147c74b2c727b5458b9e95350496988 compiler/deSugar/Check.hs | 24 +- compiler/deSugar/Coverage.hs | 87 +-- compiler/deSugar/Desugar.hs | 23 +- compiler/deSugar/DsArrows.hs | 44 +- compiler/deSugar/DsExpr.hs | 43 +- compiler/deSugar/DsForeign.hs | 5 +- compiler/deSugar/DsGRHSs.hs | 16 +- compiler/deSugar/DsListComp.hs | 52 +- compiler/deSugar/DsMeta.hs | 154 +++-- compiler/deSugar/Match.hs | 15 +- compiler/hsSyn/Convert.hs | 214 +++---- compiler/hsSyn/HsBinds.hs | 81 +-- compiler/hsSyn/HsDecls.hs | 623 ++++++++++++++------- compiler/hsSyn/HsExpr.hs | 389 +++++++------ compiler/hsSyn/HsExpr.hs-boot | 4 +- compiler/hsSyn/HsExtension.hs | 613 +++++++++++++++----- compiler/hsSyn/HsImpExp.hs | 99 ++-- compiler/hsSyn/HsInstances.hs | 31 +- compiler/hsSyn/HsLit.hs | 15 +- compiler/hsSyn/HsPat.hs | 71 +-- compiler/hsSyn/HsTypes.hs | 225 +++++--- compiler/hsSyn/HsUtils.hs | 167 +++--- compiler/hsSyn/PlaceHolder.hs | 21 +- compiler/main/HeaderInfo.hs | 3 +- compiler/main/HscMain.hs | 5 +- compiler/main/HscStats.hs | 11 +- compiler/main/InteractiveEval.hs | 4 +- compiler/parser/Parser.y | 163 +++--- compiler/parser/RdrHsSyn.hs | 174 +++--- compiler/rename/RnBinds.hs | 27 +- compiler/rename/RnExpr.hs | 152 ++--- compiler/rename/RnNames.hs | 71 ++- compiler/rename/RnPat.hs | 10 +- compiler/rename/RnSource.hs | 259 +++++---- compiler/rename/RnSplice.hs | 6 +- compiler/rename/RnTypes.hs | 39 +- compiler/typecheck/TcAnnotations.hs | 3 +- compiler/typecheck/TcArrows.hs | 34 +- compiler/typecheck/TcBinds.hs | 28 +- compiler/typecheck/TcDefaults.hs | 14 +- compiler/typecheck/TcDeriv.hs | 18 +- compiler/typecheck/TcEnv.hs | 7 + compiler/typecheck/TcExpr.hs | 1 + compiler/typecheck/TcForeign.hs | 4 +- compiler/typecheck/TcHsSyn.hs | 150 ++--- compiler/typecheck/TcHsType.hs | 41 +- compiler/typecheck/TcInstDcls.hs | 19 +- compiler/typecheck/TcMatches.hs | 103 ++-- compiler/typecheck/TcPat.hs | 9 +- compiler/typecheck/TcPatSyn.hs | 13 +- compiler/typecheck/TcRnDriver.hs | 47 +- compiler/typecheck/TcRnExports.hs | 58 +- compiler/typecheck/TcRnTypes.hs | 5 +- compiler/typecheck/TcRules.hs | 21 +- compiler/typecheck/TcSigs.hs | 6 +- compiler/typecheck/TcSplice.hs | 8 +- compiler/typecheck/TcTyClsDecls.hs | 71 ++- compiler/typecheck/TcTyDecls.hs | 2 +- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghc-api/T6145.hs | 2 +- .../tests/ghc-api/annotations/stringSource.hs | 6 +- testsuite/tests/ghc-api/annotations/t11430.hs | 6 +- .../parser/should_compile/DumpParsedAst.stderr | 100 ++-- .../parser/should_compile/DumpRenamedAst.stderr | 170 +++--- .../should_compile/DumpTypecheckedAst.stderr | 180 +++--- .../tests/parser/should_compile/T14189.stderr | 25 +- utils/ghctags/Main.hs | 5 +- utils/haddock | 2 +- 68 files changed, 3139 insertions(+), 1961 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 c3823cba2147c74b2c727b5458b9e95350496988 From git at git.haskell.org Fri Apr 27 15:56:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 15:56:25 +0000 (UTC) Subject: [commit: ghc] master: Add missing stdout file for T14955 (56bbe1e) Message-ID: <20180427155625.D77343ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/56bbe1e4aac9eb3e722db64f628474070d4b80d4/ghc >--------------------------------------------------------------- commit 56bbe1e4aac9eb3e722db64f628474070d4b80d4 Author: Simon Peyton Jones Date: Fri Apr 27 16:54:22 2018 +0100 Add missing stdout file for T14955 Accidentally omitted from Trac #14955 commit. >--------------------------------------------------------------- 56bbe1e4aac9eb3e722db64f628474070d4b80d4 testsuite/tests/perf/should_run/T14955.stdout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/perf/should_run/T14955.stdout b/testsuite/tests/perf/should_run/T14955.stdout index 0519ecb..0ca9514 100644 --- a/testsuite/tests/perf/should_run/T14955.stdout +++ b/testsuite/tests/perf/should_run/T14955.stdout @@ -1 +1 @@ - \ No newline at end of file +True From git at git.haskell.org Fri Apr 27 16:21:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 16:21:34 +0000 (UTC) Subject: [commit: ghc] master: Better linting for types (6da5b87) Message-ID: <20180427162134.EC6EE3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6da5b8772d512e2fb61730367f5258303e008ab4/ghc >--------------------------------------------------------------- commit 6da5b8772d512e2fb61730367f5258303e008ab4 Author: Simon Peyton Jones Date: Fri Apr 27 16:32:02 2018 +0100 Better linting for types Trac #15057 described deficiencies in the linting for types involving type synonyms. This patch fixes an earlier attempt. The moving parts are desrcribed in Note [Linting type synonym applications] Not a big deal. >--------------------------------------------------------------- 6da5b8772d512e2fb61730367f5258303e008ab4 compiler/coreSyn/CoreLint.hs | 169 ++++++++++++++++++++++++------------------ compiler/typecheck/FamInst.hs | 4 +- 2 files changed, 99 insertions(+), 74 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 6da5b8772d512e2fb61730367f5258303e008ab4 From git at git.haskell.org Fri Apr 27 16:21:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 16:21:37 +0000 (UTC) Subject: [commit: ghc] master: Refactor tcExtendLocalFamInst a bit (0c01224) Message-ID: <20180427162137.B4AC13ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0c01224bb95b3c0d6730ededaf04c9ab0892e297/ghc >--------------------------------------------------------------- commit 0c01224bb95b3c0d6730ededaf04c9ab0892e297 Author: Simon Peyton Jones Date: Thu Apr 26 14:04:29 2018 +0100 Refactor tcExtendLocalFamInst a bit This patch just pulls out FamInst.loadDependentFamInstModules as a separate function, and adds better comments. Provoked by Trac #14759, comment:10. >--------------------------------------------------------------- 0c01224bb95b3c0d6730ededaf04c9ab0892e297 compiler/rename/RnNames.hs | 4 +-- compiler/typecheck/FamInst.hs | 73 ++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 60f87fc..f06fc00 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -200,8 +200,8 @@ rnImports imports = do new_finsts = imp_finsts imp_avails1 {- -Note [Combine ImportAvails] -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [Combining ImportAvails] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ imp_finsts in ImportAvails is a list of family instance modules transitively depended on by an import. imp_finsts for a currently compiled module is a union of all the imp_finsts of imports. diff --git a/compiler/typecheck/FamInst.hs b/compiler/typecheck/FamInst.hs index 4fe1430..cda6404 100644 --- a/compiler/typecheck/FamInst.hs +++ b/compiler/typecheck/FamInst.hs @@ -46,10 +46,8 @@ import Control.Monad #include "HsVersions.h" -{- - -Note [The type family instance consistency story] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +{- Note [The type family instance consistency story] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To preserve type safety we must ensure that for any given module, all the type family instances used either in that module or in any module @@ -588,38 +586,57 @@ tcExtendLocalFamInstEnv [] thing_inside = thing_inside -- Otherwise proceed... tcExtendLocalFamInstEnv fam_insts thing_inside - = do { env <- getGblEnv - ; let this_mod = tcg_mod env - imports = tcg_imports env - - -- Optimization: If we're only defining type family instances - -- for type families *defined in the home package*, then we - -- only have to load interface files that belong to the home - -- package. The reason is that there's no recursion between - -- packages, so modules in other packages can't possibly define - -- instances for our type families. - -- - -- (Within the home package, we could import a module M that - -- imports us via an hs-boot file, and thereby defines an - -- instance of a type family defined in this module. So we can't - -- apply the same logic to avoid reading any interface files at - -- all, when we define an instances for type family defined in - -- the current module.) - home_fams_only = all (nameIsHomePackage this_mod . fi_fam) fam_insts - want_module mod - | mod == this_mod = False - | home_fams_only = moduleUnitId mod == moduleUnitId this_mod - | otherwise = True - ; loadModuleInterfaces (text "Loading family-instance modules") - (filter want_module (imp_finsts imports)) + = do { -- Load family-instance modules "below" this module, so that + -- allLocalFamInst can check for consistency with them + -- See Note [The type family instance consistency story] + loadDependentFamInstModules fam_insts + + -- Now add the instances one by one + ; env <- getGblEnv ; (inst_env', fam_insts') <- foldlM addLocalFamInst (tcg_fam_inst_env env, tcg_fam_insts env) fam_insts + ; let env' = env { tcg_fam_insts = fam_insts' , tcg_fam_inst_env = inst_env' } ; setGblEnv env' thing_inside } +loadDependentFamInstModules :: [FamInst] -> TcM () +-- Load family-instance modules "below" this module, so that +-- allLocalFamInst can check for consistency with them +-- See Note [The type family instance consistency story] +loadDependentFamInstModules fam_insts + = do { env <- getGblEnv + ; let this_mod = tcg_mod env + imports = tcg_imports env + + want_module mod -- See Note [Home package family instances] + | mod == this_mod = False + | home_fams_only = moduleUnitId mod == moduleUnitId this_mod + | otherwise = True + home_fams_only = all (nameIsHomePackage this_mod . fi_fam) fam_insts + + ; loadModuleInterfaces (text "Loading family-instance modules") $ + filter want_module (imp_finsts imports) } + +{- Note [Home package family instances] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Optimization: If we're only defining type family instances +for type families *defined in the home package*, then we +only have to load interface files that belong to the home +package. The reason is that there's no recursion between +packages, so modules in other packages can't possibly define +instances for our type families. + +(Within the home package, we could import a module M that +imports us via an hs-boot file, and thereby defines an +instance of a type family defined in this module. So we can't +apply the same logic to avoid reading any interface files at +all, when we define an instances for type family defined in +the current module. +-} + -- Check that the proposed new instance is OK, -- and then add it to the home inst env -- This must be lazy in the fam_inst arguments, see Note [Lazy axiom match] From git at git.haskell.org Fri Apr 27 16:21:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 16:21:40 +0000 (UTC) Subject: [commit: ghc] master: Comments only: the FVAnn invariant (69119b2) Message-ID: <20180427162140.7EC093ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/69119b2087ff6a016c2490981f01dfd72b971661/ghc >--------------------------------------------------------------- commit 69119b2087ff6a016c2490981f01dfd72b971661 Author: Simon Peyton Jones Date: Fri Apr 20 17:51:58 2018 +0100 Comments only: the FVAnn invariant >--------------------------------------------------------------- 69119b2087ff6a016c2490981f01dfd72b971661 compiler/coreSyn/CoreFVs.hs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/compiler/coreSyn/CoreFVs.hs b/compiler/coreSyn/CoreFVs.hs index 7e77271..4a72516 100644 --- a/compiler/coreSyn/CoreFVs.hs +++ b/compiler/coreSyn/CoreFVs.hs @@ -537,14 +537,23 @@ The free variable pass annotates every node in the expression with its NON-GLOBAL free variables and type variables. -} -type FVAnn = DVarSet +type FVAnn = DVarSet -- See Note [The FVAnn invariant] + +{- Note [The FVAnn invariant] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Invariant: a FVAnn, say S, is closed: + That is: if v is in S, + then freevars( v's type/kind ) is also in S +-} -- | Every node in a binding group annotated with its -- (non-global) free variables, both Ids and TyVars, and type. type CoreBindWithFVs = AnnBind Id FVAnn + -- | Every node in an expression annotated with its -- (non-global) free variables, both Ids and TyVars, and type. -type CoreExprWithFVs = AnnExpr Id FVAnn +-- NB: see Note [The FVAnn invariant] +type CoreExprWithFVs = AnnExpr Id FVAnn type CoreExprWithFVs' = AnnExpr' Id FVAnn -- | Every node in an expression annotated with its @@ -698,12 +707,14 @@ freeVarsBind (Rec binds) body_fvs rhss2 = map freeVars rhss rhs_body_fvs = foldr (unionFVs . freeVarsOf) body_fvs rhss2 binders_fvs = fvDVarSet $ mapUnionFV bndrRuleAndUnfoldingFVs binders + -- See Note [The FVAnn invariant] all_fvs = rhs_body_fvs `unionFVs` binders_fvs -- The "delBinderFV" happens after adding the idSpecVars, -- since the latter may add some of the binders as fvs freeVars :: CoreExpr -> CoreExprWithFVs --- ^ Annotate a 'CoreExpr' with its (non-global) free type and value variables at every tree node +-- ^ Annotate a 'CoreExpr' with its (non-global) free type +-- and value variables at every tree node. freeVars = go where go :: CoreExpr -> CoreExprWithFVs @@ -711,7 +722,8 @@ freeVars = go | isLocalVar v = (aFreeVar v `unionFVs` ty_fvs, AnnVar v) | otherwise = (emptyDVarSet, AnnVar v) where - ty_fvs = dVarTypeTyCoVars v -- Do we need this? + ty_fvs = dVarTypeTyCoVars v + -- See Note [The FVAnn invariant] go (Lit lit) = (emptyDVarSet, AnnLit lit) go (Lam b body) @@ -721,6 +733,7 @@ freeVars = go body'@(body_fvs, _) = go body b_ty = idType b b_fvs = tyCoVarsOfTypeDSet b_ty + -- See Note [The FVAnn invariant] go (App fun arg) = ( freeVarsOf fun' `unionFVs` freeVarsOf arg' @@ -733,8 +746,8 @@ freeVars = go = ( (bndr `delBinderFV` alts_fvs) `unionFVs` freeVarsOf scrut2 `unionFVs` tyCoVarsOfTypeDSet ty - -- don't need to look at (idType bndr) - -- b/c that's redundant with scrut + -- Don't need to look at (idType bndr) + -- because that's redundant with scrut , AnnCase scrut2 bndr ty alts2 ) where scrut2 = go scrut From git at git.haskell.org Fri Apr 27 16:21:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 16:21:43 +0000 (UTC) Subject: [commit: ghc] master: Minor refactoring in Exitify (512f503) Message-ID: <20180427162143.4824D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/512f5038b597d01dec4c1bfaaf0517940fd01e94/ghc >--------------------------------------------------------------- commit 512f5038b597d01dec4c1bfaaf0517940fd01e94 Author: Simon Peyton Jones Date: Fri Apr 20 17:50:56 2018 +0100 Minor refactoring in Exitify No change in behaviour here, just some modest refactoring as I tried to understand the code better. >--------------------------------------------------------------- 512f5038b597d01dec4c1bfaaf0517940fd01e94 compiler/simplCore/Exitify.hs | 71 ++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 22edc20..a8f02ae 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -48,12 +48,13 @@ import VarEnv import CoreFVs import FastString import Type +import Util( mapSnd ) import Data.Bifunctor import Control.Monad -- | Traverses the AST, simply to find all joinrecs and call 'exitify' on them. --- The really interesting function is exitify +-- The really interesting function is exitifyRec exitifyProgram :: CoreProgram -> CoreProgram exitifyProgram binds = map goTopLvl binds where @@ -64,34 +65,38 @@ exitifyProgram binds = map goTopLvl binds in_scope_toplvl = emptyInScopeSet `extendInScopeSetList` bindersOfBinds binds go :: InScopeSet -> CoreExpr -> CoreExpr - go _ e@(Var{}) = e - go _ e@(Lit {}) = e - go _ e@(Type {}) = e - go _ e@(Coercion {}) = e + go _ e@(Var{}) = e + go _ e@(Lit {}) = e + go _ e@(Type {}) = e + go _ e@(Coercion {}) = e + go in_scope (Cast e' c) = Cast (go in_scope e') c + go in_scope (Tick t e') = Tick t (go in_scope e') + go in_scope (App e1 e2) = App (go in_scope e1) (go in_scope e2) - go in_scope (Lam v e') = Lam v (go in_scope' e') + go in_scope (Lam v e') + = Lam v (go in_scope' e') where in_scope' = in_scope `extendInScopeSet` v - go in_scope (App e1 e2) = App (go in_scope e1) (go in_scope e2) + go in_scope (Case scrut bndr ty alts) - = Case (go in_scope scrut) bndr ty (map (goAlt in_scope') alts) - where in_scope' = in_scope `extendInScopeSet` bndr - go in_scope (Cast e' c) = Cast (go in_scope e') c - go in_scope (Tick t e') = Tick t (go in_scope e') - go in_scope (Let bind body) = goBind in_scope bind (go in_scope' body) - where in_scope' = in_scope `extendInScopeSetList` bindersOf bind + = Case (go in_scope scrut) bndr ty (map go_alt alts) + where + in_scope1 = in_scope `extendInScopeSet` bndr + go_alt (dc, pats, rhs) = (dc, pats, go in_scope' rhs) + where in_scope' = in_scope1 `extendInScopeSetList` pats - goAlt :: InScopeSet -> CoreAlt -> CoreAlt - goAlt in_scope (dc, pats, rhs) = (dc, pats, go in_scope' rhs) - where in_scope' = in_scope `extendInScopeSetList` pats + go in_scope (Let (NonRec bndr rhs) body) + = Let (NonRec bndr (go in_scope rhs)) (go in_scope' body) + where + in_scope' = in_scope `extendInScopeSet` bndr - goBind :: InScopeSet -> CoreBind -> (CoreExpr -> CoreExpr) - goBind in_scope (NonRec v rhs) = Let (NonRec v (go in_scope rhs)) - goBind in_scope (Rec pairs) - | is_join_rec = exitify in_scope' pairs' - | otherwise = Let (Rec pairs') - where pairs' = map (second (go in_scope')) pairs - is_join_rec = any (isJoinId . fst) pairs - in_scope' = in_scope `extendInScopeSetList` bindersOf (Rec pairs) + go in_scope (Let (Rec pairs) body) + | is_join_rec = mkLets (exitifyRec in_scope' pairs') body' + | otherwise = Let (Rec pairs') body' + where + is_join_rec = any (isJoinId . fst) pairs + in_scope' = in_scope `extendInScopeSetList` bindersOf (Rec pairs) + pairs' = mapSnd (go in_scope') pairs + body' = go in_scope' body -- | State Monad used inside `exitify` @@ -99,13 +104,10 @@ type ExitifyM = State [(JoinId, CoreExpr)] -- | Given a recursive group of a joinrec, identifies “exit paths” and binds them as -- join-points outside the joinrec. -exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) -exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) +exitifyRec :: InScopeSet -> [(Var,CoreExpr)] -> [CoreBind] +exitifyRec in_scope pairs + = [ NonRec xid rhs | (xid,rhs) <- exits ] ++ [Rec pairs'] where - mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' - mkExitLets [] = id - -- We need the set of free variables of many subexpressions here, so -- annotate the AST with them -- see Note [Calculating free variables] @@ -127,8 +129,11 @@ exitify in_scope pairs = -- variables bound on the way and lifts it out as a join point. -- -- ExitifyM is a state monad to keep track of floated binds - go :: [Var] -- ^ variables to abstract over (in dependency order) - -> CoreExprWithFVs -- ^ current expression in tail position + go :: [Var] -- ^ Variables that are in-scope here, but + -- not in scope at the joinrec; that is, + -- we must potentially abstract over them. + -- Invariant: they are kept in dependency order + -> CoreExprWithFVs -- ^ Current expression in tail position -> ExitifyM CoreExpr -- We first look at the expression (no matter what it shape is) @@ -177,6 +182,8 @@ exitify in_scope pairs = -- No need for `sortQuantVars`, `captured` is already in dependency order abs_vars = map zap $ filter (`elemVarSet` fvs) captured + -- We are going to abstract over these variables, so we must + -- zap any IdInfo they have; see Trac #15005 -- cf. SetLevels.abstractVars zap v | isId v = setIdInfo v vanillaIdInfo | otherwise = v From git at git.haskell.org Fri Apr 27 16:21:46 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 Apr 2018 16:21:46 +0000 (UTC) Subject: [commit: ghc] master: Make out-of-scope errors more prominent (08003e7) Message-ID: <20180427162146.163AB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/08003e7f4abafb0c9fe084e4670122ce67cf45dd/ghc >--------------------------------------------------------------- commit 08003e7f4abafb0c9fe084e4670122ce67cf45dd Author: Simon Peyton Jones Date: Fri Apr 27 16:15:25 2018 +0100 Make out-of-scope errors more prominent Generally, when the type checker reports an error, more serious ones suppress less serious ones. A "variable out of scope" error is arguably the most serious of all, so this patch moves it to the front of the list instead of the end. This patch also fixes Trac #14149, which had -fdefer-out-of-scope-variables, but also had a solid type error. As things stood, the type error was not reported at all, and compilation "succeeded" with error code 0. Yikes. Note that - "Hole errors" (including out of scope) are never suppressed. (maybeReportHoleError vs maybeReportError in TcErorrs) They can just get drowned by the noise. - But with the new orientation, out of scope errors will suppress type errors. That would be easy to change. >--------------------------------------------------------------- 08003e7f4abafb0c9fe084e4670122ce67cf45dd compiler/typecheck/TcErrors.hs | 18 +++++++++++++++--- testsuite/tests/typecheck/should_compile/T14149.stderr | 7 +++++-- testsuite/tests/typecheck/should_compile/all.T | 2 +- testsuite/tests/typecheck/should_fail/T12406.stderr | 9 --------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 27148af..dde7c3c 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -529,14 +529,15 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics }) -- (see TcRnTypes.insolubleWantedCt) is caught here, otherwise -- we might suppress its error message, and proceed on past -- type checking to get a Lint error later - report1 = [ ("custom_error", is_user_type_error,True, mkUserTypeErrorReporter) + report1 = [ ("Out of scope", is_out_of_scope, out_of_scope_killer, mkHoleReporter tidy_cts) + , ("Holes", is_hole, False, mkHoleReporter tidy_cts) + , ("custom_error", is_user_type_error, True, mkUserTypeErrorReporter) + , given_eq_spec , ("insoluble2", utterly_wrong, True, mkGroupReporter mkEqErr) , ("skolem eq1", very_wrong, True, mkSkolReporter) , ("skolem eq2", skolem_eq, True, mkSkolReporter) , ("non-tv eq", non_tv_eq, True, mkSkolReporter) - , ("Out of scope", is_out_of_scope,True, mkHoleReporter tidy_cts) - , ("Holes", is_hole, False, mkHoleReporter tidy_cts) -- The only remaining equalities are alpha ~ ty, -- where alpha is untouchable; and representational equalities @@ -551,6 +552,15 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics }) , ("Irreds", is_irred, False, mkGroupReporter mkIrredErr) , ("Dicts", is_dict, False, mkGroupReporter mkDictErr) ] + out_of_scope_killer :: Bool + out_of_scope_killer + = case cec_out_of_scope_holes ctxt of + HoleError -> True -- Makes scope errors suppress type errors + _ -> False -- But if the scope-errors are warnings or deferred, + -- do not suppress type errors; else you get an exit + -- code of "success" even though there is + -- a type error! + -- rigid_nom_eq, rigid_nom_tv_eq, is_hole, is_dict, is_equality, is_ip, is_irred :: Ct -> PredTree -> Bool @@ -789,6 +799,8 @@ reportGroup mk_err ctxt cts = _otherwise -> False maybeReportHoleError :: ReportErrCtxt -> Ct -> ErrMsg -> TcM () +-- Unlike maybeReportError, these "hole" errors are +-- /not/ suppressed by cec_suppress. We want to see them! maybeReportHoleError ctxt ct err -- When -XPartialTypeSignatures is on, warnings (instead of errors) are -- generated for holes in partial type signatures. diff --git a/testsuite/tests/typecheck/should_compile/T14149.stderr b/testsuite/tests/typecheck/should_compile/T14149.stderr index 5e5306e..b1a8d37 100644 --- a/testsuite/tests/typecheck/should_compile/T14149.stderr +++ b/testsuite/tests/typecheck/should_compile/T14149.stderr @@ -1,3 +1,6 @@ -T14149.hs:8:13: warning: [-Wdeferred-out-of-scope-variables (in -Wdefault)] - Variable not in scope: k :: Int +T14149.hs:8:5: error: + • Couldn't match representation of type ‘Int’ with that of ‘Bool’ + arising from a use of ‘coerce’ + • In the expression: coerce (k :: Int) + In an equation for ‘f’: f = coerce (k :: Int) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 80a8b0e..6a680f6 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -577,7 +577,7 @@ test('T13915a', normal, multimod_compile, ['T13915a', '-v0']) test('T13915b', normal, compile, ['']) test('T13984', normal, compile, ['']) test('T14128', normal, multimod_compile, ['T14128Main', '-v0']) -test('T14149', normal, compile, ['']) +test('T14149', normal, compile_fail, ['']) test('T14154', normal, compile, ['']) test('T14158', normal, compile, ['']) test('T13943', normal, compile, ['-fsolve-constant-dicts']) diff --git a/testsuite/tests/typecheck/should_fail/T12406.stderr b/testsuite/tests/typecheck/should_fail/T12406.stderr index 85096e6..5219a5f 100644 --- a/testsuite/tests/typecheck/should_fail/T12406.stderr +++ b/testsuite/tests/typecheck/should_fail/T12406.stderr @@ -1,12 +1,3 @@ -T12406.hs:20:7: error: - • Couldn't match type ‘Ref m0’ with ‘IORef’ - Expected type: IO (Ref m0 (f0 ())) - Actual type: IO (Ref IO (f0 ())) - The type variable ‘m0’ is ambiguous - • In the first argument of ‘(>>=)’, namely ‘newRef (pure ())’ - In the expression: newRef (pure ()) >>= join . readRef - In an equation for ‘foo’: foo = newRef (pure ()) >>= join . readRef - T12406.hs:20:28: error: Variable not in scope: join :: m0 (f0 ()) -> IO () From git at git.haskell.org Mon Apr 30 09:28:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 Apr 2018 09:28:37 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T15019: Fix simplCast perf issues from #14737 (5a157f8) Message-ID: <20180430092837.244853ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T15019 Link : http://ghc.haskell.org/trac/ghc/changeset/5a157f8032633804d9c2f7ba7d558e9d99ad1e78/ghc >--------------------------------------------------------------- commit 5a157f8032633804d9c2f7ba7d558e9d99ad1e78 Author: Tobias Dammers Date: Mon Apr 30 09:33:59 2018 +0200 Fix simplCast perf issues from #14737 See Trac #15019. Reflexive coercion performance is a surprisingly delicate matter. On the one hand, we want to eliminate reflexive coercions as early as possible, to avoid performance bottlenecks later on; on the other hand, conclusively doing so involves calling `eqType`, which is expensive. In #14737, we addressed the `eqType` part by simply removing the `eqType` check. This, however, causes regressions, because the check no longer catches some of the reflexive coercions that we want to catch. So we need to find a balance between getting rid of reflexivity as soon as it appears (see Trac #11735, #14737, #15019), and avoiding calls to `isReflexiveCo` (which is expensive on big types, since it involves `eqType`). In particular, we want to behave well on * e |> co1 |> co2 where the two happent to cancel out entirely. That is quite common; e.g. a newtype wrapping and unwrapping cancel * (f |> co) @t1 @t2 ... @tn x1 .. xm Here we wil use pushCoTyArg and pushCoValArg successively, which build up NthCo stacks. Silly to do that if co is reflexive. A good compromise (determined experimentally) seems to be to call isReflexiveCo * when composing casts, and * at the end >--------------------------------------------------------------- 5a157f8032633804d9c2f7ba7d558e9d99ad1e78 compiler/coreSyn/CoreOpt.hs | 6 ++++ compiler/simplCore/Simplify.hs | 70 ++++++++++++++++++++++++++----------- testsuite/tests/perf/compiler/all.T | 12 ++++--- 3 files changed, 63 insertions(+), 25 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 5a157f8032633804d9c2f7ba7d558e9d99ad1e78