From git at git.haskell.org Tue May 1 02:16:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 02:16:20 +0000 (UTC) Subject: [commit: ghc] master: Add test case for #15108 (4e45ebe) Message-ID: <20180501021620.269403ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4e45ebeea097b662076936f5a50c0873d8737923/ghc >--------------------------------------------------------------- commit 4e45ebeea097b662076936f5a50c0873d8737923 Author: Joachim Breitner Date: Mon Apr 30 22:13:38 2018 -0400 Add test case for #15108 thanks to cdisselkoen for the nicely minimized test case. >--------------------------------------------------------------- 4e45ebeea097b662076936f5a50c0873d8737923 testsuite/tests/profiling/should_compile/T15108.hs | 22 ++++++++++++++++++++++ testsuite/tests/profiling/should_compile/all.T | 1 + 2 files changed, 23 insertions(+) diff --git a/testsuite/tests/profiling/should_compile/T15108.hs b/testsuite/tests/profiling/should_compile/T15108.hs new file mode 100644 index 0000000..d0143bf --- /dev/null +++ b/testsuite/tests/profiling/should_compile/T15108.hs @@ -0,0 +1,22 @@ +module Main where + +main :: IO () +main = do + _ <- return $ getInt Circle + return () + +newtype MyInt = MyInt Int + +data Shape = Circle | Square + +getInt :: Shape -> MyInt +getInt sh = + case sh of + Circle -> + let (MyInt i) = MyInt 3 + in myInt i + Square -> + let (MyInt i) = MyInt 2 + in myInt i + where + myInt = MyInt diff --git a/testsuite/tests/profiling/should_compile/all.T b/testsuite/tests/profiling/should_compile/all.T index 4664658..7d51a9c 100644 --- a/testsuite/tests/profiling/should_compile/all.T +++ b/testsuite/tests/profiling/should_compile/all.T @@ -7,3 +7,4 @@ test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -fpro test('T5889', [only_ways(['normal']), req_profiling, extra_files(['T5889/A.hs', 'T5889/B.hs'])], multimod_compile, ['A B', '-O -prof -fno-prof-count-entries -v0']) test('T12790', [only_ways(['normal']), req_profiling], compile, ['-O -prof']) test('T14931', [only_ways(['normal']), req_profiling], run_command, ['$MAKE -s --no-print-directory T14931']) +test('T15108', [only_ways(['normal']), req_profiling, expect_broken(15108)], compile, ['-O -prof -fprof-auto']) From git at git.haskell.org Tue May 1 07:39:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 07:39:18 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T14975' created Message-ID: <20180501073918.D26B63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T14975 Referencing: e70ae1fe4b2b4dfeccf359a9e36eafa801a4ac54 From git at git.haskell.org Tue May 1 07:39:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 07:39:21 +0000 (UTC) Subject: [commit: ghc] wip/T14975: Define MCoercion type (e70ae1f) Message-ID: <20180501073921.9CCEF3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14975 Link : http://ghc.haskell.org/trac/ghc/changeset/e70ae1fe4b2b4dfeccf359a9e36eafa801a4ac54/ghc >--------------------------------------------------------------- commit e70ae1fe4b2b4dfeccf359a9e36eafa801a4ac54 Author: Tobias Dammers Date: Tue Mar 27 12:19:49 2018 +0200 Define MCoercion type >--------------------------------------------------------------- e70ae1fe4b2b4dfeccf359a9e36eafa801a4ac54 compiler/types/Coercion.hs | 2 +- compiler/types/TyCoRep.hs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 7a7918c..f55cab1 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -10,7 +10,7 @@ -- module Coercion ( -- * Main data type - Coercion, CoercionN, CoercionR, CoercionP, + Coercion, CoercionN, CoercionR, CoercionP, MCoercion, UnivCoProvenance, CoercionHole, LeftOrRight(..), Var, CoVar, TyCoVar, Role(..), ltRole, diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 588963d..9323e23 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -34,6 +34,7 @@ module TyCoRep ( UnivCoProvenance(..), CoercionHole(..), coHoleCoVar, CoercionN, CoercionR, CoercionP, KindCoercion, + MCoercion, -- * Functions over types mkTyConTy, mkTyVarTy, mkTyVarTys, @@ -857,6 +858,10 @@ type CoercionR = Coercion -- always representational type CoercionP = Coercion -- always phantom type KindCoercion = CoercionN -- always nominal +-- | A semantically more meaningful type to represent what may or may not be a +-- useful 'Coercion'. +data MCoercion = MRefl | MCo Coercion + {- Note [Refl invariant] ~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Tue May 1 12:19:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 12:19:05 +0000 (UTC) Subject: [commit: ghc] master: Don't crash when pretty-printing bad joins (07cc603) Message-ID: <20180501121905.273683ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/07cc6039dccff82790bf1d84a81e26df234ad899/ghc >--------------------------------------------------------------- commit 07cc6039dccff82790bf1d84a81e26df234ad899 Author: Simon Peyton Jones Date: Tue May 1 11:11:46 2018 +0100 Don't crash when pretty-printing bad joins Trac #15108 showed that the Core pretty-printer would crash if it found a join-point binding with too few lambda on the RHS. That is super-unhelpful! Lint will find it, but pretty-printing should not crash. This patch just makes the pretty printer behave more robustly; it leaves the job of error reporting to Lint. >--------------------------------------------------------------- 07cc6039dccff82790bf1d84a81e26df234ad899 compiler/coreSyn/PprCore.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 96f7aa5..ca2b8af 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -128,10 +128,18 @@ ppr_binding ann (val_bdr, expr) -- lambda (the first rendering looks like a nullary join point returning -- an n-argument function). pp_join_bind join_arity + | bndrs `lengthAtLeast` join_arity = hang (ppr val_bdr <+> sep (map (pprBndr LambdaBind) lhs_bndrs)) 2 (equals <+> pprCoreExpr rhs) + | otherwise -- Yikes! A join-binding with too few lambda + -- Lint will complain, but we don't want to crash + -- the pretty-printer else we can't see what's wrong + -- So refer to printing j = e + = pp_normal_bind where - (lhs_bndrs, rhs) = collectNBinders join_arity expr + (bndrs, body) = collectBinders expr + lhs_bndrs = take join_arity bndrs + rhs = mkLams (drop join_arity bndrs) body pprParendExpr expr = ppr_expr parens expr pprCoreExpr expr = ppr_expr noParens expr From git at git.haskell.org Tue May 1 12:19:07 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 12:19:07 +0000 (UTC) Subject: [commit: ghc] master: Preserve join-point arity in CoreOpt (d4cc74f) Message-ID: <20180501121907.E79523ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4cc74f1a5d1aafc8a2fde3c80019e2ef88d146b/ghc >--------------------------------------------------------------- commit d4cc74f1a5d1aafc8a2fde3c80019e2ef88d146b Author: Simon Peyton Jones Date: Tue May 1 12:16:28 2018 +0100 Preserve join-point arity in CoreOpt Trac #15108 showed that the simple optimiser in CoreOpt was accidentally eta-reducing a join point, so it didn't meet its arity invariant. This patch fixes it. See Note [Preserve join-binding arity]. >--------------------------------------------------------------- d4cc74f1a5d1aafc8a2fde3c80019e2ef88d146b compiler/coreSyn/CoreOpt.hs | 23 +++++++++++++++++++++-- testsuite/tests/profiling/should_compile/all.T | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index f1ff68d..03bc6cd 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -359,14 +359,25 @@ simple_bind_pair env@(SOE { soe_inl = inl_env, soe_subst = subst }) = (env { soe_inl = extendVarEnv inl_env in_bndr clo }, Nothing) | otherwise - = simple_out_bind_pair env in_bndr mb_out_bndr - (simple_opt_clo env clo) + = simple_out_bind_pair env in_bndr mb_out_bndr out_rhs occ active stable_unf where stable_unf = isStableUnfolding (idUnfolding in_bndr) active = isAlwaysActive (idInlineActivation in_bndr) occ = idOccInfo in_bndr + out_rhs | Just join_arity <- isJoinId_maybe in_bndr + = simple_join_rhs join_arity + | otherwise + = simple_opt_clo env clo + + simple_join_rhs join_arity -- See Note [Preserve join-binding arity] + = mkLams join_bndrs' (simple_opt_expr env_body join_body) + where + env0 = soeSetInScope env rhs_env + (join_bndrs, join_body) = collectNBinders join_arity in_rhs + (env_body, join_bndrs') = subst_opt_bndrs env0 join_bndrs + pre_inline_unconditionally :: Bool pre_inline_unconditionally | isCoVar in_bndr = False -- See Note [Do not inline CoVars unconditionally] @@ -451,6 +462,14 @@ trivial ones. But we do here! Why? In the simple optimiser Those differences obviate the reasons for not inlining a trivial rhs, and increase the benefit for doing so. So we unconditionally inline trivial rhss here. + +Note [Preserve join-binding arity] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Be careful /not/ to eta-reduce the RHS of a join point, lest we lose +the join-point arity invariant. Trac #15108 was caused by simplifying +the RHS with simple_opt_expr, which does eta-reduction. Solution: +simplify the RHS of a join point by simplifying under the lambdas +(which of course should be there). -} ---------------------- diff --git a/testsuite/tests/profiling/should_compile/all.T b/testsuite/tests/profiling/should_compile/all.T index 7d51a9c..999fa53 100644 --- a/testsuite/tests/profiling/should_compile/all.T +++ b/testsuite/tests/profiling/should_compile/all.T @@ -7,4 +7,4 @@ test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -fpro test('T5889', [only_ways(['normal']), req_profiling, extra_files(['T5889/A.hs', 'T5889/B.hs'])], multimod_compile, ['A B', '-O -prof -fno-prof-count-entries -v0']) test('T12790', [only_ways(['normal']), req_profiling], compile, ['-O -prof']) test('T14931', [only_ways(['normal']), req_profiling], run_command, ['$MAKE -s --no-print-directory T14931']) -test('T15108', [only_ways(['normal']), req_profiling, expect_broken(15108)], compile, ['-O -prof -fprof-auto']) +test('T15108', [only_ways(['normal']), req_profiling], compile, ['-O -prof -fprof-auto']) From git at git.haskell.org Tue May 1 15:34:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 15:34:06 +0000 (UTC) Subject: [commit: ghc] master: rts: Don't disable formatting warning in RetainerSet.c (b5739bd) Message-ID: <20180501153406.22F2C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b5739bde5dd9113c34ebacc7f85f10ba347c5850/ghc >--------------------------------------------------------------- commit b5739bde5dd9113c34ebacc7f85f10ba347c5850 Author: Ben Gamari Date: Wed Apr 25 10:46:48 2018 -0400 rts: Don't disable formatting warning in RetainerSet.c This really shouldn't be necessary. >--------------------------------------------------------------- b5739bde5dd9113c34ebacc7f85f10ba347c5850 rts/ghc.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index 9d1c2a5..e96e147 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -483,7 +483,6 @@ rts/sm/Compact_CC_OPTS += -Wno-inline rts/StgCRun_CC_OPTS += -w rts/RetainerProfile_CC_OPTS += -w -rts/RetainerSet_CC_OPTS += -Wno-format # On Windows: rts/win32/ConsoleHandler_CC_OPTS += -w rts/win32/ThrIOManager_CC_OPTS += -w From git at git.haskell.org Tue May 1 15:34:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 15:34:20 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump performance meterics due to 3d38e8284b73 (6212d01) Message-ID: <20180501153420.E37C53ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6212d01542e77b4f8855437280c641854fcd962b/ghc >--------------------------------------------------------------- commit 6212d01542e77b4f8855437280c641854fcd962b Author: Ben Gamari Date: Mon Apr 30 18:01:12 2018 -0400 testsuite: Bump performance meterics due to 3d38e8284b73 This commit bumped T12425, T12234 and T12150 over their expected metrics on OS X. >--------------------------------------------------------------- 6212d01542e77b4f8855437280c641854fcd962b 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 2001cda..237b74a 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1040,7 +1040,7 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 141952368, 5), + [(wordsize(64), 150743648, 5), # initial: 125831400 # 2017-01-18: 133380960 Allow top-level string literals in Core # 2017-02-17: 153611448 Type-indexed Typeable @@ -1049,6 +1049,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: 150743648 Do not unpack class dictionaries with INLINABLE ]), ], compile, @@ -1061,7 +1062,7 @@ test('T12234', # initial: 83032768 # 2017-02-19 89180624 (x64/Windows) - Unknown # 2017-02-25 79889200 (x64/Windows) - Early inline patch - (wordsize(64), 81696664, 5), + (wordsize(64), 85961968, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) # 2017-02-01: 80882208 (Use superclass instances when solving) @@ -1069,6 +1070,7 @@ test('T12234', # 2017-02-17: 86525344 (Type-indexed Typeable) # 2017-02-25: 83032768 (Early inline patch) # 2017-09-07: 81696664 (Semigroup=>Monoid patch, D3927) + # 2018-04-26: 85961968 (Do not unpack class dictionaries with INLINABLE) ]), ], compile, @@ -1135,11 +1137,12 @@ test('T12707', test('T12150', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 73769936, 5) + [(wordsize(64), 77557800, 5) # initial: 70773000 # 2017-08-25: 74358208 Refactor the Mighty Simplifier # 2017-08-25: 78300680 Drift # 2017-10-25: 73769936 amd64/linux Fix space leak in BinIface.getSymbolTable + # 2018-04-26: 77557800 Do not unpack class dictionaries with INLINABLE ]), ], compile, From git at git.haskell.org Tue May 1 20:04:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 20:04:26 +0000 (UTC) Subject: [commit: ghc] master: rts: Add -hT to the rts usage message (260e23b) Message-ID: <20180501200426.AB4EB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/260e23b4033f92c1d7326a60320067922ef06da2/ghc >--------------------------------------------------------------- commit 260e23b4033f92c1d7326a60320067922ef06da2 Author: Ben Gamari Date: Tue May 1 14:57:31 2018 -0400 rts: Add -hT to the rts usage message Reviewers: erikd, simonmar Subscribers: thomie, carter GHC Trac Issues: #15086 Differential Revision: https://phabricator.haskell.org/D4643 >--------------------------------------------------------------- 260e23b4033f92c1d7326a60320067922ef06da2 rts/RtsFlags.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index abb9800..eb226ed 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -343,6 +343,9 @@ usage_text[] = { " -xt Include threads (TSOs) in a heap profile", "", " -xc Show current cost centre stack on raising an exception", +#else +"", +" -hT Produce a heap profile grouped by closure type" #endif /* PROFILING */ #if defined(TRACING) From git at git.haskell.org Tue May 1 20:04:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 May 2018 20:04:43 +0000 (UTC) Subject: [commit: ghc] master: rts: Allow profiling by closure type in prof way (b7b6617) Message-ID: <20180501200443.3CE503ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b7b6617a90824303daf555c817f538cd9c792671/ghc >--------------------------------------------------------------- commit b7b6617a90824303daf555c817f538cd9c792671 Author: Ben Gamari Date: Tue May 1 13:10:13 2018 -0400 rts: Allow profiling by closure type in prof way Previously we inexplicably disabled support for `-hT` profiling in the profiled way. Admittedly, there are relatively few cases where one would prefer -hT to `-hd`, but the option should nevertheless be available for the sake of consistency. Note that this does mean that there is a bit of an inconsistency in the behavior of `-h`: in the profiled way `-h` behaves like `-hc` whereas in the non-profiled way it defaults to `-hT`. >--------------------------------------------------------------- b7b6617a90824303daf555c817f538cd9c792671 rts/ProfHeap.c | 5 +---- rts/RtsFlags.c | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 4a7b6d3..55d22ff 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -127,8 +127,8 @@ closureIdentity( const StgClosure *p ) return retainerSetOf(p); else return NULL; +#endif -#else case HEAP_BY_CLOSURE_TYPE: { const StgInfoTable *info; @@ -147,7 +147,6 @@ closureIdentity( const StgClosure *p ) } } -#endif default: barf("closureIdentity"); } @@ -815,7 +814,6 @@ dumpCensus( Census *census ) if (count == 0) continue; -#if !defined(PROFILING) switch (RtsFlags.ProfFlags.doHeapProfile) { case HEAP_BY_CLOSURE_TYPE: fprintf(hp_file, "%s", (char *)ctr->identity); @@ -823,7 +821,6 @@ dumpCensus( Census *census ) count * sizeof(W_)); break; } -#endif #if defined(PROFILING) switch (RtsFlags.ProfFlags.doHeapProfile) { diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index eb226ed..461c416 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -343,10 +343,9 @@ usage_text[] = { " -xt Include threads (TSOs) in a heap profile", "", " -xc Show current cost centre stack on raising an exception", -#else +#endif /* PROFILING */ "", " -hT Produce a heap profile grouped by closure type" -#endif /* PROFILING */ #if defined(TRACING) "", @@ -1956,6 +1955,9 @@ static bool read_heap_profiling_flag(const char *arg) case 'b': RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_LDV; break; + case 'T': + RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_CLOSURE_TYPE; + break; } break; From git at git.haskell.org Wed May 2 02:38:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 May 2018 02:38:05 +0000 (UTC) Subject: [commit: ghc] master: Exitify: Do not trip over shadowing (fixes #15110) (60f9e46) Message-ID: <20180502023805.2ABA33ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60f9e46a5a2867127ca04ce4b87b370ec8170e55/ghc >--------------------------------------------------------------- commit 60f9e46a5a2867127ca04ce4b87b370ec8170e55 Author: Joachim Breitner Date: Tue May 1 22:33:01 2018 -0400 Exitify: Do not trip over shadowing (fixes #15110) >--------------------------------------------------------------- 60f9e46a5a2867127ca04ce4b87b370ec8170e55 compiler/simplCore/Exitify.hs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index a8f02ae..f67d4bd 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -178,9 +178,12 @@ exitifyRec in_scope pairs -- See Note [Interesting expression] is_interesting = anyVarSet isLocalId (fvs `minusVarSet` mkVarSet captured) - -- The possible arguments of this exit join point - -- No need for `sortQuantVars`, `captured` is already in dependency order - abs_vars = map zap $ filter (`elemVarSet` fvs) captured + -- The arguments of this exit join point + -- See Note [Picking arguments to abstract over] + abs_vars = snd $ foldr pick (fvs, []) captured + where + pick v (fvs', acc) | v `elemVarSet` fvs' = (fvs' `delVarSet` v, zap v : acc) + | otherwise = (fvs', acc) -- We are going to abstract over these variables, so we must -- zap any IdInfo they have; see Trac #15005 @@ -261,7 +264,6 @@ addExit in_scope ty join_arity rhs = do put ((v,rhs):fs) return v - {- Note [Interesting expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -468,4 +470,17 @@ Positions C and D have their advantages: C decreases allocations in simpl, but D Assuming we have a budget of _one_ run of Exitification, then C wins (but we could get more from running it multiple times, as seen in fish). +Note [Picking arguments to abstract over] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When we create an exit join point, so we need to abstract over those of its +free variables that are be out-of-scope at the destination of the exit join +point. So we go through the list `captured` and pick those that are actually +free variables of the join point. + +We do not just `filter (`elemVarSet` fvs) captured`, as there might be +shadowing, and `captured` may contain multiple variables with the same Unique. I +these cases we want to abstract only over the last occurence, hence the `foldr` +(with emphasis on the `r`). This is #15110. + -} From git at git.haskell.org Wed May 2 11:48:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 May 2018 11:48:58 +0000 (UTC) Subject: [commit: ghc] master: errorWithoutStackTrace: omit profiling stack trace (#14970) (dc655bf) Message-ID: <20180502114858.EB06E3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dc655bf0310012b193cf49cce9f5b0bfbc53764c/ghc >--------------------------------------------------------------- commit dc655bf0310012b193cf49cce9f5b0bfbc53764c Author: Simon Marlow Date: Sat Apr 21 12:22:18 2018 +0100 errorWithoutStackTrace: omit profiling stack trace (#14970) Test Plan: validate Reviewers: hvr, bgamari, erikd Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4648 >--------------------------------------------------------------- dc655bf0310012b193cf49cce9f5b0bfbc53764c libraries/base/GHC/Err.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libraries/base/GHC/Err.hs b/libraries/base/GHC/Err.hs index 4231fce..3d64c95 100644 --- a/libraries/base/GHC/Err.hs +++ b/libraries/base/GHC/Err.hs @@ -30,7 +30,9 @@ import GHC.Prim import GHC.Integer () -- Make sure Integer is compiled first -- because GHC depends on it in a wired-in way -- so the build system doesn't see the dependency -import {-# SOURCE #-} GHC.Exception( errorCallWithCallStackException ) +import {-# SOURCE #-} GHC.Exception + ( errorCallWithCallStackException + , errorCallException ) -- | 'error' stops execution and displays an error message. error :: forall (r :: RuntimeRep). forall (a :: TYPE r). @@ -46,10 +48,7 @@ error s = raise# (errorCallWithCallStackException s ?callStack) -- @since 4.9.0.0 errorWithoutStackTrace :: forall (r :: RuntimeRep). forall (a :: TYPE r). [Char] -> a -errorWithoutStackTrace s = - -- we don't have withFrozenCallStack yet, so we just inline the definition - let ?callStack = freezeCallStack emptyCallStack - in error s +errorWithoutStackTrace s = raise# (errorCallException s) -- Note [Errors in base] From git at git.haskell.org Wed May 2 11:49:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 May 2018 11:49:02 +0000 (UTC) Subject: [commit: ghc] master: storageAddCapabilities: fix bug in updating nursery pointers (4cb5595) Message-ID: <20180502114902.6C6113ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4cb5595e5e800818721a623a5419cad29a528000/ghc >--------------------------------------------------------------- commit 4cb5595e5e800818721a623a5419cad29a528000 Author: Simon Marlow Date: Fri Apr 27 11:31:19 2018 -0700 storageAddCapabilities: fix bug in updating nursery pointers Summary: We were unconditionally updating the nursery pointers to be `nurseries[cap->no]`, but when using nursery chunks this might be wrong. This manifested as a later assertion failure in allocate(). Test Plan: new test case Reviewers: bgamari, niteria, erikd Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4649 >--------------------------------------------------------------- 4cb5595e5e800818721a623a5419cad29a528000 rts/sm/Storage.c | 7 +++++-- testsuite/tests/rts/all.T | 7 +++++++ testsuite/tests/rts/nursery-chunks1.hs | 12 ++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 9174646..52dab73 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -220,6 +220,7 @@ initStorage (void) void storageAddCapabilities (uint32_t from, uint32_t to) { uint32_t n, g, i, new_n_nurseries; + nursery *old_nurseries; if (RtsFlags.GcFlags.nurseryChunkSize == 0) { new_n_nurseries = to; @@ -229,6 +230,7 @@ void storageAddCapabilities (uint32_t from, uint32_t to) stg_max(to, total_alloc / RtsFlags.GcFlags.nurseryChunkSize); } + old_nurseries = nurseries; if (from > 0) { nurseries = stgReallocBytes(nurseries, new_n_nurseries * sizeof(struct nursery_), @@ -240,8 +242,9 @@ void storageAddCapabilities (uint32_t from, uint32_t to) // we've moved the nurseries, so we have to update the rNursery // pointers from the Capabilities. - for (i = 0; i < to; i++) { - capabilities[i]->r.rNursery = &nurseries[i]; + for (i = 0; i < from; i++) { + uint32_t index = capabilities[i]->r.rNursery - old_nurseries; + capabilities[i]->r.rNursery = &nurseries[index]; } /* The allocation area. Policy: keep the allocation area diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index a278388..8fa2257 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -402,3 +402,10 @@ test('alloccounter1', normal, compile_and_run, # allocation and messes up the results: '-with-rtsopts=-k1m' ]) + +test('nursery-chunks1', + [ extra_run_opts('4 100 +RTS -n32k -A1m -RTS') + , only_ways(['threaded1','threaded2']) + ], + compile_and_run, + ['']) diff --git a/testsuite/tests/rts/nursery-chunks1.hs b/testsuite/tests/rts/nursery-chunks1.hs new file mode 100644 index 0000000..f8f9f6a --- /dev/null +++ b/testsuite/tests/rts/nursery-chunks1.hs @@ -0,0 +1,12 @@ +-- Test for a bug that provoked the following assertion failure: +-- nursery-chunks1: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 903 +module Main (main) where + +import Control.Monad +import System.Environment +import GHC.Conc + +main = do + [n,m] <- fmap read <$> getArgs + forM_ [1..n] $ \n' -> + when (sum [1.. m::Integer] > 0) $ setNumCapabilities (fromIntegral n') From git at git.haskell.org Thu May 3 03:53:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 03:53:06 +0000 (UTC) Subject: [commit: ghc] master: Set arity for absentError (198db04) Message-ID: <20180503035306.7C9003ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/198db048f60f48b420ac4ad9264af57185b4b41a/ghc >--------------------------------------------------------------- commit 198db048f60f48b420ac4ad9264af57185b4b41a Author: David Feuer Date: Wed May 2 23:43:13 2018 -0400 Set arity for absentError * The note on how to prevent stable unfoldings from leading to `case` on `absentError` was wrong. Make it reflect reality. * Reviewing the above change, Simon noticed that we didn't set an arity for `absentError`, which definitely has arity 1. It may not matter much, since `absentError` usually vanishes quickly, but we might as well set it properly, so now we do. Reviewers: simonpj, bgamari Reviewed By: simonpj Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4655 >--------------------------------------------------------------- 198db048f60f48b420ac4ad9264af57185b4b41a compiler/coreSyn/MkCore.hs | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/compiler/coreSyn/MkCore.hs b/compiler/coreSyn/MkCore.hs index f2b940b..8291c01 100644 --- a/compiler/coreSyn/MkCore.hs +++ b/compiler/coreSyn/MkCore.hs @@ -824,40 +824,43 @@ Yikes! That bogusly appears to evaluate the absentError! This is extremely tiresome. Another way to think of this is that, in Core, it is an invariant that a strict data contructor, like MkT, must -be be applied only to an argument in HNF. so (absentError "blah") had +be applied only to an argument in HNF. So (absentError "blah") had better be non-bottom. -So the "solution" is to make absentError behave like a data constructor, -to respect this invariant. Rather than have a special case in exprIsHNF, -I eneded up doing this: +So the "solution" is to add a special case for absentError to exprIsHNFlike. +This allows Simplify.rebuildCase, in the Note [Case to let transformation] +branch, to convert the case on absentError into a let. We also make +absentError *not* be diverging, unlike the other error-ids, so that we +can be sure not to remove the case branches before converting the case to +a let. - * Make absentError claim to be ConLike - - * Make exprOkForSpeculation/exprOkForSideEffects - return True for ConLike things - - * In Simplify.rebuildCase, make the - Note [Case to let transformation] - branch use exprOkForSpeculation rather than exprIsHNF, so that - it converts the absentError case to a let. - -On the other hand if, by some bug or bizarre happenstance, we ever call -absentError, we should thow an exception. This should never happen, of -course, but we definitely can't return anything. e.g. if somehow we had +If, by some bug or bizarre happenstance, we ever call absentError, we should +throw an exception. This should never happen, of course, but we definitely +can't return anything. e.g. if somehow we had case absentError "foo" of Nothing -> ... Just x -> ... then if we return, the case expression will select a field and continue. -Seg fault city. Better to throw an exception. (Even though we've said -it is ConLike :-) +Seg fault city. Better to throw an exception. (Even though we've said +it is in HNF :-) + +It might seem a bit surprising that seq on absentError is simply erased + + absentError "foo" `seq` x ==> x + +but that should be okay; since there's no pattern match we can't really +be relying on anything from it. -} aBSENT_ERROR_ID - = mkVanillaGlobal absentErrorName absent_ty + = mkVanillaGlobalWithInfo absentErrorName absent_ty arity_info where absent_ty = mkSpecForAllTys [alphaTyVar] (mkFunTy addrPrimTy alphaTy) -- Not runtime-rep polymorphic. aBSENT_ERROR_ID is only used for -- lifted-type things; see Note [Absent errors] in WwLib + arity_info = vanillaIdInfo `setArityInfo` 1 + -- NB: no bottoming strictness info, unlike other error-ids. + -- See Note [aBSENT_ERROR_ID] mkAbsentErrorApp :: Type -- The type to instantiate 'a' -> String -- The string to print From git at git.haskell.org Thu May 3 07:51:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 07:51:51 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #15114 (6742ce2) Message-ID: <20180503075151.5561D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6742ce2d8e0919dd75b5ecb0e2b5f891c442bdd3/ghc >--------------------------------------------------------------- commit 6742ce2d8e0919dd75b5ecb0e2b5f891c442bdd3 Author: Simon Peyton Jones Date: Thu May 3 08:51:29 2018 +0100 Test Trac #15114 >--------------------------------------------------------------- 6742ce2d8e0919dd75b5ecb0e2b5f891c442bdd3 testsuite/tests/simplCore/should_run/T15114.hs | 23 ++++++++++++++++++++++ testsuite/tests/simplCore/should_run/T15114.stdout | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 3 files changed, 25 insertions(+) diff --git a/testsuite/tests/simplCore/should_run/T15114.hs b/testsuite/tests/simplCore/should_run/T15114.hs new file mode 100644 index 0000000..ef0e77c --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T15114.hs @@ -0,0 +1,23 @@ +{-# OPTIONS_GHC -O #-} +-- Bug only showed up with optimisation on + +module Main where + +import qualified Control.Exception as Exception + +main :: IO () +main = do + unserialize + putStrLn "all is well" + +unserialize :: IO Char +unserialize = + if definitelyTrue + then do + return 'a' + else do + Exception.evaluate (error "wrong place") + +{-# NOINLINE definitelyTrue #-} +definitelyTrue :: Bool +definitelyTrue = True diff --git a/testsuite/tests/simplCore/should_run/T15114.stdout b/testsuite/tests/simplCore/should_run/T15114.stdout new file mode 100644 index 0000000..0b9e820 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T15114.stdout @@ -0,0 +1 @@ +all is well diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index ca69565..3d8f540 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -84,3 +84,4 @@ test('T14868', compile_and_run, ['']) test('T14894', normal, compile_and_run, ['']) test('T14965', normal, compile_and_run, ['']) +test('T15114', only_ways('optasm'), compile_and_run, ['']) From git at git.haskell.org Thu May 3 14:17:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 14:17:37 +0000 (UTC) Subject: [commit: ghc] master: Add regression tests for #14904 (5de0be8) Message-ID: <20180503141737.77CF03ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5de0be8d7ee48eac0af42387eb40b5a5a9b08a35/ghc >--------------------------------------------------------------- commit 5de0be8d7ee48eac0af42387eb40b5a5a9b08a35 Author: Ryan Scott Date: Thu May 3 10:15:45 2018 -0400 Add regression tests for #14904 Trac #14904 was fixed in commit faec8d358985e5d0bf363bd96f23fe76c9e281f7. Let's add some tests to ensure that it stays fixed. >--------------------------------------------------------------- 5de0be8d7ee48eac0af42387eb40b5a5a9b08a35 testsuite/tests/typecheck/should_fail/T14904a.hs | 9 +++++++++ .../T11648b.stderr => typecheck/should_fail/T14904a.stderr} | 6 +++--- testsuite/tests/typecheck/should_fail/T14904b.hs | 9 +++++++++ testsuite/tests/typecheck/should_fail/T14904b.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/all.T | 2 ++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/T14904a.hs b/testsuite/tests/typecheck/should_fail/T14904a.hs new file mode 100644 index 0000000..654f5a6 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14904a.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeInType #-} +module T14904a where + +import Data.Kind + +type family F (f :: forall a. g a) :: Type where + F (f :: forall a. g a) = Int diff --git a/testsuite/tests/polykinds/T11648b.stderr b/testsuite/tests/typecheck/should_fail/T14904a.stderr similarity index 72% copy from testsuite/tests/polykinds/T11648b.stderr copy to testsuite/tests/typecheck/should_fail/T14904a.stderr index e709e00..94cad4a 100644 --- a/testsuite/tests/polykinds/T11648b.stderr +++ b/testsuite/tests/typecheck/should_fail/T14904a.stderr @@ -1,8 +1,8 @@ -T11648b.hs:7:1: error: +T14904a.hs:8:1: error: You have written a *complete user-suppled kind signature*, but the following variable is undetermined: k0 :: * Perhaps add a kind signature. Inferred kinds of user-written variables: - k :: k0 - a :: Proxy k + g :: k0 -> * + f :: forall (a :: k0). g a diff --git a/testsuite/tests/typecheck/should_fail/T14904b.hs b/testsuite/tests/typecheck/should_fail/T14904b.hs new file mode 100644 index 0000000..d8cfa1e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14904b.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeInType #-} +module T14904b where + +import Data.Kind + +type family F f :: Type where + F ((f :: forall a. g a) :: forall a. g a) = Int diff --git a/testsuite/tests/typecheck/should_fail/T14904b.stderr b/testsuite/tests/typecheck/should_fail/T14904b.stderr new file mode 100644 index 0000000..fff6942 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14904b.stderr @@ -0,0 +1,6 @@ + +T14904b.hs:9:7: error: + • Expected kind ‘forall (a :: k1). g a’, but ‘f’ has kind ‘k0’ + • In the first argument of ‘F’, namely + ‘((f :: forall a. g a) :: forall a. g a)’ + In the type family declaration for ‘F’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 16fd5de..a4150ea 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -471,3 +471,5 @@ test('T14605', normal, compile_fail, ['']) test('T14761a', normal, compile_fail, ['']) test('T14761b', normal, compile_fail, ['']) test('T14884', normal, compile_fail, ['']) +test('T14904a', normal, compile_fail, ['']) +test('T14904b', normal, compile_fail, ['']) From git at git.haskell.org Thu May 3 15:04:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 15:04:32 +0000 (UTC) Subject: [commit: ghc] master: Compute DW_FORM_block length correctly; also fixes #15068 (358b508) Message-ID: <20180503150432.22F173ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/358b508051333882d4099acca8f269e6fb2b7d65/ghc >--------------------------------------------------------------- commit 358b508051333882d4099acca8f269e6fb2b7d65 Author: Bertram Felgenhauer Date: Thu May 3 18:03:53 2018 +0300 Compute DW_FORM_block length correctly; also fixes #15068 Before this patch, the pprUnwindwExpr function computed the length of by the following assembly fragment: .uleb128 1f-.-1 1: That is, to compute the length, it takes the difference of the label 1 and the address of the .uleb128 directive, and subtracts 1. In #15068 it was reported that `as` from binutils 4.30 has trouble with evaluating the `.` part of the expression. However, there is actually a problem with the expression, if the length of the data ever becomes larger than 128: In that case, the .uleb128 directive will emit more than 1 byte, and the computed length will be wrong. The present patch changes the assembly fragment to use two labels, which fixes both these problems. .uleb128 2f-1f 1: 2: Test Plan: validate Reviewers: bgamari, osa1 Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15068 Differential Revision: https://phabricator.haskell.org/D4654 >--------------------------------------------------------------- 358b508051333882d4099acca8f269e6fb2b7d65 compiler/nativeGen/Dwarf/Types.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs index 23a2c92..579ed0d 100644 --- a/compiler/nativeGen/Dwarf/Types.hs +++ b/compiler/nativeGen/Dwarf/Types.hs @@ -492,9 +492,11 @@ pprUnwindExpr spIsCFA expr pprE (UwPlus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_plus pprE (UwMinus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_minus pprE (UwTimes u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_mul - in text "\t.uleb128 1f-.-1" $$ -- DW_FORM_block length + in text "\t.uleb128 2f-1f" $$ -- DW_FORM_block length + -- computed as the difference of the following local labels 2: and 1: + text "1:" $$ pprE expr $$ - text "1:" + text "2:" -- | Generate code for re-setting the unwind information for a -- register to @undefined@ From git at git.haskell.org Thu May 3 16:01:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 16:01:11 +0000 (UTC) Subject: [commit: ghc] master: Warn against using Data.Monoid.First (e34e30e) Message-ID: <20180503160111.B13183ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e34e30e492a7bc40e3da5a05b8e297acb0aeeadc/ghc >--------------------------------------------------------------- commit e34e30e492a7bc40e3da5a05b8e297acb0aeeadc Author: Andrew Martin Date: Wed Apr 25 19:35:36 2018 -0400 Warn against using Data.Monoid.First Noting that it will be removed in the future. >--------------------------------------------------------------- e34e30e492a7bc40e3da5a05b8e297acb0aeeadc libraries/base/Data/Monoid.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs index b6d09c1..d11eda8 100644 --- a/libraries/base/Data/Monoid.hs +++ b/libraries/base/Data/Monoid.hs @@ -88,6 +88,16 @@ import Data.Semigroup.Internal -- -- >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world")) -- Just "hello" +-- +-- Use of this type is discouraged. Note the following equivalence: +-- +-- > Data.Monoid.First x === Maybe (Data.Semigroup.First x) +-- +-- In additional to being equivalent in the structural sense, the two +-- also have 'Monoid' instances that behave the same. This type will +-- be marked deprecated in GHC 8.8. It will be removed in GHC 8.10. +-- Users are advised to use the variant from "Data.Semigroup" and wrap +-- it in 'Maybe'. newtype First a = First { getFirst :: Maybe a } deriving ( Eq -- ^ @since 2.01 , Ord -- ^ @since 2.01 From git at git.haskell.org Thu May 3 16:01:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 16:01:26 +0000 (UTC) Subject: [commit: ghc] master: document the plan for removing Data.Semigroup.Option (90589a9) Message-ID: <20180503160126.3BFB83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90589a942b770b9c373a73b6c1d17487fdcf4d9b/ghc >--------------------------------------------------------------- commit 90589a942b770b9c373a73b6c1d17487fdcf4d9b Author: Andrew Martin Date: Wed Apr 25 19:44:29 2018 -0400 document the plan for removing Data.Semigroup.Option >--------------------------------------------------------------- 90589a942b770b9c373a73b6c1d17487fdcf4d9b libraries/base/Data/Semigroup.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs index 4438e2f..58a0b92 100644 --- a/libraries/base/Data/Semigroup.hs +++ b/libraries/base/Data/Semigroup.hs @@ -455,7 +455,12 @@ mtimesDefault n x -- underlying 'Monoid'. -- -- Ideally, this type would not exist at all and we would just fix the --- 'Monoid' instance of 'Maybe' +-- 'Monoid' instance of 'Maybe'. +-- +-- In GHC 8.4 and higher, the 'Monoid' instance for 'Maybe' has been +-- corrected to lift a 'Semigroup' instance instead of a 'Monoid' +-- instance. Consequently, this type is no longer useful. It will be +-- marked deprecated in GHC 8.8 and removed in GHC 8.10. newtype Option a = Option { getOption :: Maybe a } deriving ( Eq -- ^ @since 4.9.0.0 , Ord -- ^ @since 4.9.0.0 From git at git.haskell.org Thu May 3 16:01:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 16:01:40 +0000 (UTC) Subject: [commit: ghc] master: minor improvement to wording of warning against First. Add warning against Last (cf35ab9) Message-ID: <20180503160140.DDDF63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf35ab9ac7e0f33e39af6af16ecf850e24c2cb79/ghc >--------------------------------------------------------------- commit cf35ab9ac7e0f33e39af6af16ecf850e24c2cb79 Author: Andrew Martin Date: Wed Apr 25 21:01:25 2018 -0400 minor improvement to wording of warning against First. Add warning against Last >--------------------------------------------------------------- cf35ab9ac7e0f33e39af6af16ecf850e24c2cb79 libraries/base/Data/Monoid.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs index d11eda8..aa3000a 100644 --- a/libraries/base/Data/Monoid.hs +++ b/libraries/base/Data/Monoid.hs @@ -95,7 +95,7 @@ import Data.Semigroup.Internal -- -- In additional to being equivalent in the structural sense, the two -- also have 'Monoid' instances that behave the same. This type will --- be marked deprecated in GHC 8.8. It will be removed in GHC 8.10. +-- be marked deprecated in GHC 8.8, and removed in GHC 8.10. -- Users are advised to use the variant from "Data.Semigroup" and wrap -- it in 'Maybe'. newtype First a = First { getFirst :: Maybe a } @@ -127,6 +127,16 @@ instance Monoid (First a) where -- -- >>> getLast (Last (Just "hello") <> Last Nothing <> Last (Just "world")) -- Just "world" +-- +-- Use of this type is discouraged. Note the following equivalence: +-- +-- > Data.Monoid.Last x === Maybe (Data.Semigroup.Last x) +-- +-- In additional to being equivalent in the structural sense, the two +-- also have 'Monoid' instances that behave the same. This type will +-- be marked deprecated in GHC 8.8, and removed in GHC 8.10. +-- Users are advised to use the variant from "Data.Semigroup" and wrap +-- it in 'Maybe'. newtype Last a = Last { getLast :: Maybe a } deriving ( Eq -- ^ @since 2.01 , Ord -- ^ @since 2.01 From git at git.haskell.org Thu May 3 19:01:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:01:53 +0000 (UTC) Subject: [commit: ghc] master: Don't shadow "result" in JUnit driver (107d2cb) Message-ID: <20180503190153.A0FAE3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/107d2cb7cc1e9c6d2226c3965e83a1b59d89ed04/ghc >--------------------------------------------------------------- commit 107d2cb7cc1e9c6d2226c3965e83a1b59d89ed04 Author: Matthew Pickering Date: Thu May 3 12:35:07 2018 -0400 Don't shadow "result" in JUnit driver Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15093 Differential Revision: https://phabricator.haskell.org/D4645 >--------------------------------------------------------------- 107d2cb7cc1e9c6d2226c3965e83a1b59d89ed04 testsuite/driver/junit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/junit.py b/testsuite/driver/junit.py index 01a5f47..f2dbebb 100644 --- a/testsuite/driver/junit.py +++ b/testsuite/driver/junit.py @@ -11,14 +11,14 @@ def junit(t): errors = str(len(t.framework_failures)), timestamp = datetime.now().isoformat()) - for result, group in [('stat failure', t.unexpected_stat_failures), + for res_type, group in [('stat failure', t.unexpected_stat_failures), ('unexpected failure', t.unexpected_failures)]: for (directory, testname, reason, way) in group: testcase = ET.SubElement(testsuite, 'testcase', classname = testname, name = way) result = ET.SubElement(testcase, 'failure', - type = result, + type = res_type, message = reason) for (directory, testname, reason, way) in t.framework_failures: From git at git.haskell.org Thu May 3 19:02:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:02:12 +0000 (UTC) Subject: [commit: ghc] master: CircleCI: Save test results as JUnit XML (1ad0277) Message-ID: <20180503190212.1F0F33ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1ad0277e4e7fb0e742cbf9b78e1ed41174864b22/ghc >--------------------------------------------------------------- commit 1ad0277e4e7fb0e742cbf9b78e1ed41174864b22 Author: Matthew Pickering Date: Thu May 3 12:35:22 2018 -0400 CircleCI: Save test results as JUnit XML Reviewers: mrkkrp, bgamari Reviewed By: mrkkrp, bgamari Subscribers: thomie, carter GHC Trac Issues: #15093 Differential Revision: https://phabricator.haskell.org/D4646 >--------------------------------------------------------------- 1ad0277e4e7fb0e742cbf9b78e1ed41174864b22 .circleci/config.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bdbbff0..74b88b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -57,7 +57,12 @@ aliases: - &test run: name: Test - command: make test SKIP_PERF_TESTS=YES + command: | + mkdir -p test-results + make test SKIP_PERF_TESTS=YES JUNIT_FILE=../../test-results/junit.xml + - &store_test_results + store_test_results: + path: test-results - &slowtest run: name: Full Test @@ -99,6 +104,7 @@ jobs: - *bindist - *storeartifacts - *test + - *store_test_results "validate-x86_64-freebsd": resource_class: xlarge @@ -118,6 +124,7 @@ jobs: - *bindist - *storeartifacts - *test + - *store_test_results "validate-x86_64-darwin": macos: @@ -139,6 +146,7 @@ jobs: - *bindist - *storeartifacts - *test + - *store_test_results "validate-hadrian-x86_64-linux": resource_class: xlarge @@ -168,6 +176,7 @@ jobs: - *configure_unreg - *make - *test + - *store_test_results "validate-x86_64-linux-llvm": resource_class: xlarge @@ -209,6 +218,7 @@ jobs: - *configure_unreg - *make - *test + - *store_test_results "validate-i386-linux": resource_class: xlarge @@ -227,6 +237,7 @@ jobs: - *bindist - *storeartifacts - *test + - *store_test_results "validate-x86_64-fedora": resource_class: xlarge @@ -245,6 +256,7 @@ jobs: - *bindist - *storeartifacts - *test + - *store_test_results workflows: version: 2 From git at git.haskell.org Thu May 3 19:02:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:02:27 +0000 (UTC) Subject: [commit: ghc] master: Fix NUMA support on Windows (#15049) (75361b1) Message-ID: <20180503190227.43BF03ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/75361b119c609f0ab98f3d12a15690aae4ce42a1/ghc >--------------------------------------------------------------- commit 75361b119c609f0ab98f3d12a15690aae4ce42a1 Author: David Kraeutmann Date: Thu May 3 12:36:34 2018 -0400 Fix NUMA support on Windows (#15049) * osNumaNodes now returns the right number of nodes * thread affinity is now correctly set TODO: no noticeable performance improvement. does windows already distribute threads in a NUMA-aware fashion? Test Plan: * validate * local tests on a NUMA machine Reviewers: bgamari, erikd, simonmar Reviewed By: bgamari, simonmar Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4607 >--------------------------------------------------------------- 75361b119c609f0ab98f3d12a15690aae4ce42a1 rts/win32/OSMem.c | 23 ++++++++++++++++------- rts/win32/OSThreads.c | 3 +-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c index 534cd15..d05151c 100644 --- a/rts/win32/OSMem.c +++ b/rts/win32/OSMem.c @@ -510,9 +510,18 @@ uint32_t osNumaNodes(void) static ULONG numNumaNodes = 0; /* Cache the amount of NUMA nodes. */ - if (!numNumaNodes && !GetNumaHighestNodeNumber(&numNumaNodes)) + if (!numNumaNodes) { - numNumaNodes = 1; + if (GetNumaHighestNodeNumber(&numNumaNodes)) + { + // GetNumaHighestNodeNumber returns the highest node number + // i.e: 0 for a non-NUMA system, and >0 for a NUMA system, so add a 1. + numNumaNodes += 1; + } + else + { + numNumaNodes = 1; + } } return numNumaNodes; @@ -520,12 +529,12 @@ uint32_t osNumaNodes(void) uint64_t osNumaMask(void) { - uint64_t numaMask; - if (!GetNumaNodeProcessorMask(0, &numaMask)) - { - return 1; + // the concept of a numa node mask (c.f. numa_get_mems_allowed on POSIX) + // doesn't exist on Windows. Thus, all nodes are allowed. + if (osNumaNodes() > sizeof(StgWord)*8) { + barf("osNumaMask: too many NUMA nodes (%d)", osNumaNodes()); } - return numaMask; + return (1 << osNumaNodes()) - 1; } void osBindMBlocksToNode( diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c index b1a98ce..cc67353 100644 --- a/rts/win32/OSThreads.c +++ b/rts/win32/OSThreads.c @@ -579,8 +579,7 @@ void setThreadNode (uint32_t node) if (osNumaAvailable()) { StgWord mask = 0; - mask |= 1 << node; - if (!SetThreadAffinityMask(GetCurrentThread(), mask)) + if (!GetNumaNodeProcessorMask(node, &mask) && !SetThreadAffinityMask(GetCurrentThread(), mask)) { sysErrorBelch( "setThreadNode: Error setting affinity of thread to NUMA node `%u': %lu.", From git at git.haskell.org Thu May 3 19:02:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:02:45 +0000 (UTC) Subject: [commit: ghc] master: Correctly add unwinding info in manifestSp and makeFixupBlocks (6132d7c) Message-ID: <20180503190245.3AFCD3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6132d7c5e6404936ef281a6f3be333fea780906e/ghc >--------------------------------------------------------------- commit 6132d7c5e6404936ef281a6f3be333fea780906e Author: Bartosz Nitka Date: Thu May 3 12:37:00 2018 -0400 Correctly add unwinding info in manifestSp and makeFixupBlocks In `manifestSp` the unwind info was before the relevant instruction, not after. I added some notes to establish semantics. Also removes redundant annotation in stg_catch_frame. For `makeFixupBlocks` it looks like we were off by `wORD_SIZE dflags`. I'm not sure why, but it lines up with `manifestSp`. In fact it lines up so well so that I can consolidate the Sp unwind logic in `maybeAddUnwind`. I detected the problems with `makeFixupBlocks` by running T14779b after patching D4559. Test Plan: added a new test Reviewers: bgamari, scpmw, simonmar, erikd Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14999 Differential Revision: https://phabricator.haskell.org/D4606 >--------------------------------------------------------------- 6132d7c5e6404936ef281a6f3be333fea780906e compiler/cmm/CmmLayoutStack.hs | 62 +++++++-------- compiler/cmm/Debug.hs | 91 +++++++++++++++++++++- compiler/nativeGen/Dwarf/Types.hs | 6 ++ rts/Exception.cmm | 1 - testsuite/driver/testglobals.py | 6 ++ testsuite/driver/testlib.py | 6 ++ testsuite/mk/test.mk | 14 ++++ testsuite/tests/codeGen/should_compile/Makefile | 5 ++ testsuite/tests/codeGen/should_compile/T14999.cmm | 11 +++ .../tests/codeGen/should_compile/T14999.stdout | 16 ++++ testsuite/tests/codeGen/should_compile/all.T | 5 ++ 11 files changed, 185 insertions(+), 38 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6132d7c5e6404936ef281a6f3be333fea780906e From git at git.haskell.org Thu May 3 19:21:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:21:38 +0000 (UTC) Subject: [commit: ghc] master: Move the ResponseFile module from haddock into base (866525a) Message-ID: <20180503192138.1F2FB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/866525a1765715b8b9902e1bd53b9af1c7a93a30/ghc >--------------------------------------------------------------- commit 866525a1765715b8b9902e1bd53b9af1c7a93a30 Author: Chaitanya Koparkar Date: Thu May 3 12:38:36 2018 -0400 Move the ResponseFile module from haddock into base GHC and the build tools use "response files" to work around the limit on the length of command line arguments on Windows. Haddock's implementation of parsing response files (i.e escaping/unescaping the appropriate characters) seems complete, is well tested, and also closely matches the GCC version. This patch moves the relevant bits into `base` so that it's easier for other libraries to reuse it. Test Plan: make test TEST=T13896 Reviewers: bgamari, RyanGlScott, 23Skidoo, hvr Reviewed By: RyanGlScott Subscribers: thomie, carter GHC Trac Issues: #13896 Differential Revision: https://phabricator.haskell.org/D4612 >--------------------------------------------------------------- 866525a1765715b8b9902e1bd53b9af1c7a93a30 libraries/base/GHC/ResponseFile.hs | 159 +++++++++++++++++++++++++++++++++++++ libraries/base/base.cabal | 1 + libraries/base/changelog.md | 3 + libraries/base/tests/T13896.hs | 75 +++++++++++++++++ libraries/base/tests/all.T | 1 + 5 files changed, 239 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 866525a1765715b8b9902e1bd53b9af1c7a93a30 From git at git.haskell.org Thu May 3 19:21:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:21:54 +0000 (UTC) Subject: [commit: ghc] master: GHCi: Improve the error message for hidden packages (721e826) Message-ID: <20180503192154.074F93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/721e82644b49da59e84c409562a63e7df75068bb/ghc >--------------------------------------------------------------- commit 721e82644b49da59e84c409562a63e7df75068bb Author: Chaitanya Koparkar Date: Thu May 3 12:39:45 2018 -0400 GHCi: Improve the error message for hidden packages Test Plan: make test TEST=T15055 Reviewers: bgamari, RyanGlScott, osa1, Iceland_jack Reviewed By: osa1 Subscribers: ulysses4ever, thomie, carter GHC Trac Issues: #15055 Differential Revision: https://phabricator.haskell.org/D4621 >--------------------------------------------------------------- 721e82644b49da59e84c409562a63e7df75068bb compiler/main/Finder.hs | 10 +++++++--- testsuite/tests/ghci/should_fail/T15055.script | 1 + testsuite/tests/ghci/should_fail/T15055.stderr | 5 +++++ testsuite/tests/ghci/should_fail/all.T | 1 + testsuite/tests/package/package01e.stderr | 2 ++ testsuite/tests/package/package06e.stderr | 2 ++ testsuite/tests/package/package07e.stderr | 3 +++ testsuite/tests/package/package08e.stderr | 3 +++ testsuite/tests/plugins/T11244.stderr | 1 + 9 files changed, 25 insertions(+), 3 deletions(-) diff --git a/compiler/main/Finder.hs b/compiler/main/Finder.hs index 2bfea5d..9568ac1 100644 --- a/compiler/main/Finder.hs +++ b/compiler/main/Finder.hs @@ -667,14 +667,18 @@ cantFindErr cannot_find _ dflags mod_name find_result <+> quotes (ppr pkgid) --FIXME: we don't really want to show the unit id here we should -- show the source package id or installed package id if it's ambiguous - <> dot $$ cabal_pkg_hidden_hint pkgid - cabal_pkg_hidden_hint pkgid + <> dot $$ pkg_hidden_hint pkgid + pkg_hidden_hint pkgid | gopt Opt_BuildingCabalPackage dflags = let pkg = expectJust "pkg_hidden" (lookupPackage dflags pkgid) in text "Perhaps you need to add" <+> quotes (ppr (packageName pkg)) <+> text "to the build-depends in your .cabal file." - | otherwise = Outputable.empty + | otherwise + = let pkg = expectJust "pkg_hidden" (lookupPackage dflags pkgid) + in text "You can run" <+> + quotes (text ":set -package " <> ppr (packageName pkg)) <+> + text "to expose it." mod_hidden pkg = text "it is a hidden module in the package" <+> quotes (ppr pkg) diff --git a/testsuite/tests/ghci/should_fail/T15055.script b/testsuite/tests/ghci/should_fail/T15055.script new file mode 100644 index 0000000..800944a --- /dev/null +++ b/testsuite/tests/ghci/should_fail/T15055.script @@ -0,0 +1 @@ +import GHC diff --git a/testsuite/tests/ghci/should_fail/T15055.stderr b/testsuite/tests/ghci/should_fail/T15055.stderr new file mode 100644 index 0000000..dcc297c --- /dev/null +++ b/testsuite/tests/ghci/should_fail/T15055.stderr @@ -0,0 +1,5 @@ + +: + Could not find module ‘GHC’ + It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. diff --git a/testsuite/tests/ghci/should_fail/all.T b/testsuite/tests/ghci/should_fail/all.T index 2851373..d62c3ba 100644 --- a/testsuite/tests/ghci/should_fail/all.T +++ b/testsuite/tests/ghci/should_fail/all.T @@ -1,3 +1,4 @@ test('T10549', [], ghci_script, ['T10549.script']) test('T10549a', [], ghci_script, ['T10549a.script']) test('T14608', [], ghci_script, ['T14608.script']) +test('T15055', [], ghci_script, ['T15055.script']) diff --git a/testsuite/tests/package/package01e.stderr b/testsuite/tests/package/package01e.stderr index 7dd9f69..a755991 100644 --- a/testsuite/tests/package/package01e.stderr +++ b/testsuite/tests/package/package01e.stderr @@ -2,9 +2,11 @@ package01e.hs:2:1: error: Could not find module ‘Data.Map’ It is a member of the hidden package ‘containers-0.5.11.0’. + You can run ‘:set -package containers’ to expose it. Use -v to see a list of the files searched for. package01e.hs:3:1: error: Could not find module ‘Data.IntMap’ It is a member of the hidden package ‘containers-0.5.11.0’. + You can run ‘:set -package containers’ to expose it. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/package/package06e.stderr b/testsuite/tests/package/package06e.stderr index c634d2d..59aeb37 100644 --- a/testsuite/tests/package/package06e.stderr +++ b/testsuite/tests/package/package06e.stderr @@ -2,9 +2,11 @@ package06e.hs:2:1: error: Could not find module ‘HsTypes’ It is a member of the hidden package ‘ghc-8.1’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. package06e.hs:3:1: error: Could not find module ‘UniqFM’ It is a member of the hidden package ‘ghc-8.1’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/package/package07e.stderr b/testsuite/tests/package/package07e.stderr index 9ca835f..d167508 100644 --- a/testsuite/tests/package/package07e.stderr +++ b/testsuite/tests/package/package07e.stderr @@ -7,14 +7,17 @@ package07e.hs:2:1: error: package07e.hs:3:1: error: Could not find module ‘HsTypes’ It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. package07e.hs:4:1: error: Could not find module ‘HsUtils’ It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. package07e.hs:5:1: error: Could not find module ‘UniqFM’ It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/package/package08e.stderr b/testsuite/tests/package/package08e.stderr index 5992a4c..922c643 100644 --- a/testsuite/tests/package/package08e.stderr +++ b/testsuite/tests/package/package08e.stderr @@ -7,14 +7,17 @@ package08e.hs:2:1: error: package08e.hs:3:1: error: Could not find module ‘HsTypes’ It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. package08e.hs:4:1: error: Could not find module ‘HsUtils’ It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. package08e.hs:5:1: error: Could not find module ‘UniqFM’ It is a member of the hidden package ‘ghc-8.5’. + You can run ‘:set -package ghc’ to expose it. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/plugins/T11244.stderr b/testsuite/tests/plugins/T11244.stderr index 30c8c5b..472ef44 100644 --- a/testsuite/tests/plugins/T11244.stderr +++ b/testsuite/tests/plugins/T11244.stderr @@ -1,3 +1,4 @@ : Could not find module ‘RuleDefiningPlugin’ It is a member of the hidden package ‘rule-defining-plugin-0.1’. +You can run ‘:set -package rule-defining-plugin’ to expose it. Use -v to see a list of the files searched for. From git at git.haskell.org Thu May 3 19:22:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:22:11 +0000 (UTC) Subject: [commit: ghc] master: rts: Throw better error if --numa is used without libnuma support (6462d90) Message-ID: <20180503192211.B1AA63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6462d90d01bcb07b8bff63689e8f2c8c20044952/ghc >--------------------------------------------------------------- commit 6462d90d01bcb07b8bff63689e8f2c8c20044952 Author: Ben Gamari Date: Thu May 3 12:42:24 2018 -0400 rts: Throw better error if --numa is used without libnuma support Test Plan: Validate, run program with `+RTS --numa` without libnuma support compiled in Reviewers: erikd, simonmar Subscribers: thomie, carter GHC Trac Issues: #14956 Differential Revision: https://phabricator.haskell.org/D4556 >--------------------------------------------------------------- 6462d90d01bcb07b8bff63689e8f2c8c20044952 rts/RtsFlags.c | 6 ++++++ rts/posix/OSMem.c | 9 +++++++++ rts/sm/OSMem.h | 1 + rts/win32/OSMem.c | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 461c416..7c292d2 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -906,6 +906,12 @@ error = true; } #if defined(THREADED_RTS) else if (!strncmp("numa", &rts_argv[arg][2], 4)) { + if (!osBuiltWithNumaSupport()) { + errorBelch("%s: This GHC build was compiled without NUMA support.", + rts_argv[arg]); + error = true; + break; + } OPTION_SAFE; StgWord mask; if (rts_argv[arg][6] == '=') { diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index f603644..9ecd53e 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -591,6 +591,15 @@ void osReleaseHeapMemory(void) #endif +bool osBuiltWithNumaSupport(void) +{ +#if HAVE_LIBNUMA + return true; +#else + return false; +#endif +} + bool osNumaAvailable(void) { #if HAVE_LIBNUMA diff --git a/rts/sm/OSMem.h b/rts/sm/OSMem.h index 3b0cee9..7dd0efd 100644 --- a/rts/sm/OSMem.h +++ b/rts/sm/OSMem.h @@ -18,6 +18,7 @@ void osFreeAllMBlocks(void); size_t getPageSize (void); StgWord64 getPhysicalMemorySize (void); void setExecutable (void *p, W_ len, bool exec); +bool osBuiltWithNumaSupport(void); // See #14956 bool osNumaAvailable(void); uint32_t osNumaNodes(void); uint64_t osNumaMask(void); diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c index d05151c..c62ee3b 100644 --- a/rts/win32/OSMem.c +++ b/rts/win32/OSMem.c @@ -499,6 +499,11 @@ void osReleaseHeapMemory (void) #endif +bool osBuiltWithNumaSupport(void) +{ + return true; +} + bool osNumaAvailable(void) { return osNumaNodes() > 1; From git at git.haskell.org Thu May 3 19:22:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 May 2018 19:22:27 +0000 (UTC) Subject: [commit: ghc] master: Enable warning flags to safe-guard against regressions in `base` (79c4f10) Message-ID: <20180503192227.18A163ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/79c4f10e4928c37bf4bbad974be0bd693df2d2b9/ghc >--------------------------------------------------------------- commit 79c4f10e4928c37bf4bbad974be0bd693df2d2b9 Author: Herbert Valerio Riedel Date: Thu May 3 12:50:25 2018 -0400 Enable warning flags to safe-guard against regressions in `base` Test Plan: via CI Reviewers: bgamari Subscribers: dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4640 >--------------------------------------------------------------- 79c4f10e4928c37bf4bbad974be0bd693df2d2b9 libraries/base/base.cabal | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index 6da95b0..905bc49 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -398,3 +398,6 @@ Library -- We need to set the unit id to base (without a version number) -- as it's magic. ghc-options: -this-unit-id base + + -- Make sure we don't accidentally regress into anti-patterns + ghc-options: -Wcompat -Wnoncanonical-monad-instances From git at git.haskell.org Fri May 4 09:41:39 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 May 2018 09:41:39 +0000 (UTC) Subject: [commit: nofib] master: Update Simon-nofib-notes (36fb02b) Message-ID: <20180504094139.48BEA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36fb02b02cdbd8945312b4a6267c5cacd0d9a2a1/nofib >--------------------------------------------------------------- commit 36fb02b02cdbd8945312b4a6267c5cacd0d9a2a1 Author: Simon Peyton Jones Date: Fri May 4 10:41:31 2018 +0100 Update Simon-nofib-notes >--------------------------------------------------------------- 36fb02b02cdbd8945312b4a6267c5cacd0d9a2a1 Simon-nofib-notes | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Simon-nofib-notes b/Simon-nofib-notes index 33e9597..9527859 100644 --- a/Simon-nofib-notes +++ b/Simon-nofib-notes @@ -13,6 +13,15 @@ whereas it didn't before. So allocations go up a bit. Imaginary suite --------------------------------------- +queens +~~~~~~ +The comprehension + gen n = [ (q:b) | b <- gen (n-1), q <- [1..nq], safe q 1 b] + +has, for each iteration of 'b', a new list [1..nq]. This can floated +and hence and shared, or fused. It's quite delicate which of the two +happens. + integrate ~~~~~~~~~ integrate1D is strict in its second argument 'u', but it also passes 'u' to @@ -229,9 +238,9 @@ it was inlined regardless by the instance-decl stuff. So perf drops slightly. integer ~~~~~~~ -A good benchmark for beating on big-integer arithmetic. -In this function: +A good benchmark for beating on big-integer arithmetic +There is a delicate interaction of fusion and full laziness in the comprehension integerbench :: (Integer -> Integer -> a) -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer @@ -242,12 +251,15 @@ In this function: , b <- [ bstart,astart+bstep..blim ]]) return () -if you do a bit of inlining and rule firing before floating, we'll fuse -the comprehension with the [bstart, astart+bstep..blim], whereas if you -float first you'll share the [bstart...] list. The latter does 11% less -allocation, but more case analysis etc. +and the analogous one for Int. + +Since the inner loop (for b) doesn't depend on a, we could float the +b-list out; but it may fuse first. In GHC 8 (and most previous +version) this fusion did happen at type Integer, but (accidentally) not for +Int because an interving eval got in the way. So the b-enumeration was floated +out, which led to less allocation of Int values. -knights +Knights ~~~~~~~ * In knights/KnightHeuristic, we don't find that possibleMoves is strict (with important knock-on effects) unless we apply rules before floating From git at git.haskell.org Fri May 4 09:53:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 May 2018 09:53:51 +0000 (UTC) Subject: [commit: ghc] master: Normalize T14999 test output some more (5697432) Message-ID: <20180504095351.565FA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/56974323ed427988059b5153bb43c694358cbb9b/ghc >--------------------------------------------------------------- commit 56974323ed427988059b5153bb43c694358cbb9b Author: Bartosz Nitka Date: Fri May 4 02:44:46 2018 -0700 Normalize T14999 test output some more @osa1 reported that the output on his machine has extra newlines: https://phabricator.haskell.org/D4606#129092. This collapses consecutive newlines. >--------------------------------------------------------------- 56974323ed427988059b5153bb43c694358cbb9b testsuite/tests/codeGen/should_compile/Makefile | 4 ++-- testsuite/tests/codeGen/should_compile/T14999.stdout | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile index e024788..82896ad 100644 --- a/testsuite/tests/codeGen/should_compile/Makefile +++ b/testsuite/tests/codeGen/should_compile/Makefile @@ -36,5 +36,5 @@ debug: T14999: '$(TEST_HC)' $(TEST_HC_OPTS) -O2 -g -c T14999.cmm -o T14999.o - gdb --batch -ex 'file T14999.o' -ex 'disassemble stg_catch_frame_info' --nx | tr -s '[:blank:]' - readelf --debug-dump=frames-interp T14999.o | tr -s '[:blank:]' + gdb --batch -ex 'file T14999.o' -ex 'disassemble stg_catch_frame_info' --nx | tr -s '[[:blank:]\n]' + readelf --debug-dump=frames-interp T14999.o | tr -s '[[:blank:]\n]' diff --git a/testsuite/tests/codeGen/should_compile/T14999.stdout b/testsuite/tests/codeGen/should_compile/T14999.stdout index 4bca980..546be1b 100644 --- a/testsuite/tests/codeGen/should_compile/T14999.stdout +++ b/testsuite/tests/codeGen/should_compile/T14999.stdout @@ -3,14 +3,11 @@ Dump of assembler code for function stg_catch_frame_info: 0x0000000000000014 <+4>: jmpq *0x0(%rbp) End of assembler dump. Contents of the .debug_frame section: - 00000000 0000000000000014 ffffffff CIE "" cf=1 df=-8 ra=16 LOC CFA rbp rsp ra 0000000000000000 rbp+0 v+0 s c+0 - 00000018 000000000000002c 00000000 FDE cie=00000000 pc=000000000000000f..0000000000000017 LOC CFA rbp rsp ra 000000000000000f rbp+0 v+0 s c+0 000000000000000f rbp+24 v+0 s c+0 0000000000000014 rbp+0 v+0 s c+0 - From git at git.haskell.org Fri May 4 14:51:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 May 2018 14:51:15 +0000 (UTC) Subject: [commit: ghc] master: Simplify callSiteInline a little (33de71f) Message-ID: <20180504145115.8746F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/33de71fa06d03e6da396a7c0a314fea3b492ab91/ghc >--------------------------------------------------------------- commit 33de71fa06d03e6da396a7c0a314fea3b492ab91 Author: Simon Peyton Jones Date: Fri May 4 15:47:31 2018 +0100 Simplify callSiteInline a little This patch has virtually no effect on anything (according to a nofib run). But it simplifies the definition of interesting_call by being a bit less gung-ho about inlining nested function bindings. See Note [Nested functions] ----------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem ----------------------------------------------------------------------- anna +0.2% -0.0% 0.163 0.163 0.0% binary-trees +0.1% +0.0% -4.5% -4.5% 0.0% cacheprof -0.1% +0.1% -4.7% -4.8% +2.7% fasta +0.2% 0.0% +2.6% +3.0% 0.0% fluid -0.0% -0.6% 0.011 0.011 0.0% gamteb -0.1% -0.0% 0.069 0.070 0.0% hpg +0.1% +0.0% +0.7% +0.7% 0.0% infer +0.3% +0.2% 0.097 0.098 0.0% lambda -0.1% -0.0% +2.0% +2.0% 0.0% n-body +0.1% -0.1% -0.1% -0.1% 0.0% simple -0.2% -0.2% +0.6% +0.6% 0.0% spectral-norm +0.1% -0.0% -0.1% -0.1% 0.0% tak -0.0% -0.1% 0.024 0.024 0.0% -------------------------------------------------------------------------------- Min -0.4% -0.6% -5.3% -5.3% 0.0% Max +0.3% +0.2% +3.3% +3.3% +15.0% Geometric Mean -0.0% -0.0% -0.3% -0.3% +0.2% >--------------------------------------------------------------- 33de71fa06d03e6da396a7c0a314fea3b492ab91 compiler/coreSyn/CoreUnfold.hs | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index c1f7892..b4f080b 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -1151,11 +1151,11 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info -- idUnfolding checks for loop-breakers, returning NoUnfolding -- Things with an INLINE pragma may have an unfolding *and* -- be a loop breaker (maybe the knot is not yet untied) - CoreUnfolding { uf_tmpl = unf_template, uf_is_top = is_top + CoreUnfolding { uf_tmpl = unf_template , uf_is_work_free = is_wf , uf_guidance = guidance, uf_expandable = is_exp } | active_unfolding -> tryUnfolding dflags id lone_variable - arg_infos cont_info unf_template is_top + arg_infos cont_info unf_template is_wf is_exp guidance | otherwise -> traceInline dflags id "Inactive unfolding:" (ppr id) Nothing NoUnfolding -> Nothing @@ -1175,10 +1175,10 @@ traceInline dflags inline_id str doc result = result tryUnfolding :: DynFlags -> Id -> Bool -> [ArgSummary] -> CallCtxt - -> CoreExpr -> Bool -> Bool -> Bool -> UnfoldingGuidance + -> CoreExpr -> Bool -> Bool -> UnfoldingGuidance -> Maybe CoreExpr tryUnfolding dflags id lone_variable - arg_infos cont_info unf_template is_top + arg_infos cont_info unf_template is_wf is_exp guidance = case guidance of UnfNever -> traceInline dflags id str (text "UnfNever") Nothing @@ -1250,10 +1250,10 @@ tryUnfolding dflags id lone_variable CaseCtxt -> not (lone_variable && is_exp) -- Note [Lone variables] ValAppCtxt -> True -- Note [Cast then apply] RuleArgCtxt -> uf_arity > 0 -- See Note [Unfold info lazy contexts] - DiscArgCtxt -> uf_arity > 0 -- + DiscArgCtxt -> uf_arity > 0 -- Note [Inlining in ArgCtxt] RhsCtxt -> uf_arity > 0 -- - _ -> not is_top && uf_arity > 0 -- Note [Nested functions] - -- Note [Inlining in ArgCtxt] + _other -> False -- See Note [Nested functions] + {- Note [Unfold into lazy contexts], Note [RHS of lets] @@ -1323,18 +1323,17 @@ However for worker/wrapper it may be worth inlining even if the arity is not satisfied (as we do in the CoreUnfolding case) so we don't require saturation. - Note [Nested functions] ~~~~~~~~~~~~~~~~~~~~~~~ -If a function has a nested defn we also record some-benefit, on the -grounds that we are often able to eliminate the binding, and hence the -allocation, for the function altogether; this is good for join points. -But this only makes sense for *functions*; inlining a constructor -doesn't help allocation unless the result is scrutinised. UNLESS the -constructor occurs just once, albeit possibly in multiple case -branches. Then inlining it doesn't increase allocation, but it does -increase the chance that the constructor won't be allocated at all in -the branches that don't use it. +At one time we treated a call of a non-top-level function as +"interesting" (regardless of how boring the context) in the hope +that inlining it would eliminate the binding, and its allocation. +Specifically, in the default case of interesting_call we had + _other -> not is_top && uf_arity > 0 + +But actually postInlineUnconditionally does some of this and overall +it makes virtually no difference to nofib. So I simplified away this +special case Note [Cast then apply] ~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Sat May 5 17:25:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:25:56 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump T9630 allocations as a result of 33de71fa06d0 (b750dcc) Message-ID: <20180505172556.94B0F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b750dcc5d9e1df8505788a41d0cf0d92acd17f0d/ghc >--------------------------------------------------------------- commit b750dcc5d9e1df8505788a41d0cf0d92acd17f0d Author: Ben Gamari Date: Sat May 5 13:08:04 2018 -0400 testsuite: Bump T9630 allocations as a result of 33de71fa06d0 This patch made the simplifier inline nested function bindings less aggressively and, while it didn't seem to affect nofib, appears to have regressed T9630 rather considerably. >--------------------------------------------------------------- b750dcc5d9e1df8505788a41d0cf0d92acd17f0d testsuite/tests/perf/compiler/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 237b74a..903c05f 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1266,10 +1266,11 @@ test ('T9630', [ compiler_stats_num_field('max_bytes_used', # Note [residency] [(platform('x86_64-unknown-mingw32'), 39867088, 15), # 2017-12-24: 34171816 (x64/Windows) - (wordsize(64), 35324712, 15) + (wordsize(64), 42664296, 15) # initial: 56955240 # 2017-06-07: 41568168 Stop the specialiser generating loopy code # 2018-02-25: 35324712 It's not entirely clear + # 2018-05-05: 42664296 Don't inline nested function bindings as aggressively ]), extra_clean(['T9630a.hi', 'T9630a.o']) ], From git at git.haskell.org Sat May 5 17:26:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:26:12 +0000 (UTC) Subject: [commit: ghc] master: Update docker images to use GHC 8.4.2 and cabal-install-2.2 (56e8c6f) Message-ID: <20180505172612.497703ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/56e8c6fc9d65fec11485bd02d437a753bc1a4ebe/ghc >--------------------------------------------------------------- commit 56e8c6fc9d65fec11485bd02d437a753bc1a4ebe Author: mrkkrp Date: Thu Apr 26 15:12:15 2018 +0700 Update docker images to use GHC 8.4.2 and cabal-install-2.2 The ‘haskell’ images are not being updated and there is no image with GHC 8.4.2, so we probably should not use them anymore. I adapted Dockerfiles used by those images so the end result is almost the same except we get newer GHC and cabal-install. >--------------------------------------------------------------- 56e8c6fc9d65fec11485bd02d437a753bc1a4ebe .circleci/config.yml | 16 ++++++++-------- .circleci/images/i386-linux/Dockerfile | 19 +++++++------------ .circleci/images/x86_64-linux-fedora/Dockerfile | 10 +++++----- .circleci/images/x86_64-linux/Dockerfile | 23 ++++++++++++++++++----- 4 files changed, 38 insertions(+), 30 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 56e8c6fc9d65fec11485bd02d437a753bc1a4ebe From git at git.haskell.org Sat May 5 17:26:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:26:27 +0000 (UTC) Subject: [commit: ghc] master: Fix typo in user guide about promoted list (13e8bc0) Message-ID: <20180505172627.28B953ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/13e8bc0d7afa74d502a630c817840d390c328f6e/ghc >--------------------------------------------------------------- commit 13e8bc0d7afa74d502a630c817840d390c328f6e Author: Masahiro Sakai Date: Thu Apr 26 23:42:43 2018 +0900 Fix typo in user guide about promoted list `:'` in explanation text should be `':` to match code example. >--------------------------------------------------------------- 13e8bc0d7afa74d502a630c817840d390c328f6e docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 26b7957..90ccb44 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -8478,7 +8478,7 @@ Haskell. .. note:: The declaration for ``HCons`` also requires :extension:`TypeOperators` - because of infix type operator ``(:')`` + because of infix type operator ``(':)`` .. _promotion-existentials: From git at git.haskell.org Sat May 5 17:26:41 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:26:41 +0000 (UTC) Subject: [commit: ghc] master: rel-notes: Note that -hT is now allowed (49f5943) Message-ID: <20180505172641.BCE363ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49f594307d0615e6b32d054d39364d85d2d6317e/ghc >--------------------------------------------------------------- commit 49f594307d0615e6b32d054d39364d85d2d6317e Author: Ben Gamari Date: Thu May 3 16:19:22 2018 -0400 rel-notes: Note that -hT is now allowed See #15086. [skip-ci] >--------------------------------------------------------------- 49f594307d0615e6b32d054d39364d85d2d6317e docs/users_guide/8.6.1-notes.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst index fea86ae..8920ea8 100644 --- a/docs/users_guide/8.6.1-notes.rst +++ b/docs/users_guide/8.6.1-notes.rst @@ -120,6 +120,9 @@ Runtime system - The GHC runtime on Windows is no longer constrained by ``MAX_PATH``. +- The runtime now allows use of the :rts-flag:`-hT` profiling variety on + programs built with :ghc-flag:`-prof`. + Template Haskell ~~~~~~~~~~~~~~~~ From git at git.haskell.org Sat May 5 17:26:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:26:57 +0000 (UTC) Subject: [commit: ghc] master: Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module. (426ae98) Message-ID: <20180505172657.8D2C83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/426ae98852be498fa87d10e4c88ba8d726d6b320/ghc >--------------------------------------------------------------- commit 426ae98852be498fa87d10e4c88ba8d726d6b320 Author: klebinger.andreas at gmx.at Date: Thu May 3 16:20:03 2018 -0400 Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module. Splitting TrieMap into a general and core specific part allows us to define instances for TrieMap without creating a transitive dependency on CoreSyn. Test Plan: ci Reviewers: goldfire, bgamari, simonmar, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, nomeata, thomie, carter GHC Trac Issues: #15082 Differential Revision: https://phabricator.haskell.org/D4618 >--------------------------------------------------------------- 426ae98852be498fa87d10e4c88ba8d726d6b320 compiler/coreSyn/{TrieMap.hs => CoreMap.hs} | 392 ++------------------------- compiler/ghc.cabal.in | 1 + compiler/simplCore/CSE.hs | 2 +- compiler/simplStg/StgCse.hs | 2 +- compiler/typecheck/TcSMonad.hs | 2 +- compiler/typecheck/TcTypeable.hs | 2 +- compiler/types/FamInstEnv.hs | 2 +- compiler/utils/TrieMap.hs | 405 ++++++++++++++++++++++++++++ 8 files changed, 438 insertions(+), 370 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 426ae98852be498fa87d10e4c88ba8d726d6b320 From git at git.haskell.org Sat May 5 17:27:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:27:12 +0000 (UTC) Subject: [commit: ghc] master: Normalize the element type of ListPat, fix #14547 (361d23a) Message-ID: <20180505172712.EF6DD3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/361d23a8ebb44f5df5167306d7b98d8bd1724e06/ghc >--------------------------------------------------------------- commit 361d23a8ebb44f5df5167306d7b98d8bd1724e06 Author: HE, Tao Date: Thu May 3 17:16:09 2018 -0400 Normalize the element type of ListPat, fix #14547 The element type of `List` maybe a type family instacen, rather than a trivial type. For example in Trac #14547, ``` {-# LANGUAGE TypeFamilies, OverloadedLists #-} class Foo f where type It f foo :: [It f] -> f data List a = Empty | a :! List a deriving Show instance Foo (List a) where type It (List a) = a foo [] = Empty foo (x : xs) = x :! foo xs ``` Here the element type of `[]` is `It (List a)`, we should also normalize it as `a`. Test Plan: make test TEST="T14547" Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14547 Differential Revision: https://phabricator.haskell.org/D4624 >--------------------------------------------------------------- 361d23a8ebb44f5df5167306d7b98d8bd1724e06 compiler/deSugar/Check.hs | 5 ++++- testsuite/tests/deSugar/should_compile/T14547.hs | 15 +++++++++++++++ testsuite/tests/deSugar/should_compile/all.T | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 545aace..7a5f889 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -790,10 +790,13 @@ translatePat fam_insts pat = case pat of -- overloaded list ListPat (ListPatTc elem_ty (Just (pat_ty, _to_list))) lpats | Just e_ty <- splitListTyConApp_maybe pat_ty + , (_, norm_e_ty) <- normaliseType fam_insts Nominal e_ty + -- e_ty can be a type family instance, like + -- `It (List a)`, but we prefer `a`, see Trac #14547 , (_, norm_elem_ty) <- normaliseType fam_insts Nominal elem_ty -- elem_ty is frequently something like -- `Item [Int]`, but we prefer `Int` - , norm_elem_ty `eqType` e_ty -> + , norm_elem_ty `eqType` norm_e_ty -> -- We have to ensure that the element types are exactly the same. -- Otherwise, one may give an instance IsList [Int] (more specific than -- the default IsList [a]) with a different implementation for `toList' diff --git a/testsuite/tests/deSugar/should_compile/T14547.hs b/testsuite/tests/deSugar/should_compile/T14547.hs new file mode 100644 index 0000000..02ff2e6 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T14547.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE TypeFamilies #-} + +module T14547 where + +class Foo f where + type It f + foo :: [It f] -> f + +data List a = Empty | a :! List a deriving Show + +instance Foo (List a) where + type It (List a) = a + foo [] = Empty + foo (x : xs) = x :! foo xs diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 2d36146..1414073 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -100,6 +100,7 @@ test('T13290', normal, compile, ['']) test('T13257', normal, compile, ['']) test('T13870', normal, compile, ['']) test('T14135', normal, compile, ['']) +test('T14547', normal, compile, ['-Wincomplete-patterns']) 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 Sat May 5 17:27:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:27:28 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #15067 (0f046aa) Message-ID: <20180505172728.D898B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0f046aae5c9552771e489dac8531744034f37cde/ghc >--------------------------------------------------------------- commit 0f046aae5c9552771e489dac8531744034f37cde Author: Ben Gamari Date: Fri May 4 14:26:30 2018 -0400 testsuite: Add test for #15067 Subscribers: thomie, carter, RyanGlScott GHC Trac Issues: #15067 Differential Revision: https://phabricator.haskell.org/D4622 >--------------------------------------------------------------- 0f046aae5c9552771e489dac8531744034f37cde testsuite/tests/typecheck/should_fail/T15067.hs | 10 ++++++++++ testsuite/tests/typecheck/should_fail/T15067.stderr | 13 +++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 24 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T15067.hs b/testsuite/tests/typecheck/should_fail/T15067.hs new file mode 100644 index 0000000..ff093db --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T15067.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE UnboxedSums #-} +module T15067 where + +import Type.Reflection + +floopadoop :: TypeRep (# Bool | Int #) +floopadoop = typeRep + +rubadub :: (# True | 4 #) +rubadub = typeRep diff --git a/testsuite/tests/typecheck/should_fail/T15067.stderr b/testsuite/tests/typecheck/should_fail/T15067.stderr new file mode 100644 index 0000000..a16d799 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T15067.stderr @@ -0,0 +1,13 @@ + +T15067.hs:7:14: + No instance for (Typeable (# 'GHC.Types.LiftedRep #)) + arising from a use of ‘typeRep’ + GHC can't yet do polykinded + Typeable ((# 'GHC.Types.LiftedRep #) :: * + -> * + -> TYPE + ('GHC.Types.SumRep + '['GHC.Types.LiftedRep, + 'GHC.Types.LiftedRep])) + In the expression: typeRep + In an equation for ‘floopadoop’: floopadoop = typeRep diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index a4150ea..9dd00f8 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -473,3 +473,4 @@ test('T14761b', normal, compile_fail, ['']) test('T14884', normal, compile_fail, ['']) test('T14904a', normal, compile_fail, ['']) test('T14904b', normal, compile_fail, ['']) +test('T15067', expect_broken(15067), compile_fail, ['']) From git at git.haskell.org Sat May 5 17:27:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 17:27:43 +0000 (UTC) Subject: [commit: ghc] master: Do not supply `-mcpu` if `-optlc` provides `-mcpu` already. (cb1ee7e) Message-ID: <20180505172743.EC52B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb1ee7e10e50b11b4a24e56b425e8f3485d298d5/ghc >--------------------------------------------------------------- commit cb1ee7e10e50b11b4a24e56b425e8f3485d298d5 Author: Moritz Angermann Date: Fri May 4 14:39:16 2018 -0400 Do not supply `-mcpu` if `-optlc` provides `-mcpu` already. Reviewers: bgamari Subscribers: thomie, carter GHC Trac Issues: #14982 Differential Revision: https://phabricator.haskell.org/D4548 >--------------------------------------------------------------- cb1ee7e10e50b11b4a24e56b425e8f3485d298d5 compiler/main/DriverPipeline.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 2789ee4..1d78bee 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -70,7 +70,7 @@ import System.Directory import System.FilePath import System.IO import Control.Monad -import Data.List ( isSuffixOf, intercalate ) +import Data.List ( isInfixOf, isSuffixOf, intercalate ) import Data.Maybe import Data.Version import Data.Either ( partitionEithers ) @@ -823,7 +823,8 @@ llvmOptions dflags = ++ [("", "-filetype=obj") | fastLlvmPipeline dflags ] -- Additional llc flags - ++ [("", "-mcpu=" ++ mcpu) | not (null mcpu) ] + ++ [("", "-mcpu=" ++ mcpu) | not (null mcpu) + , not (any (isInfixOf "-mcpu") (getOpts dflags opt_lc)) ] ++ [("", "-mattr=" ++ attrs) | not (null attrs) ] where target = LLVM_TARGET From git at git.haskell.org Sat May 5 21:07:10 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 21:07:10 +0000 (UTC) Subject: [commit: ghc] master: Use unsafeInsertNew to create timers in TimerManager (418881f) Message-ID: <20180505210710.86BEA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/418881f7181cbfa31c44f0794db65bf00916bde2/ghc >--------------------------------------------------------------- commit 418881f7181cbfa31c44f0794db65bf00916bde2 Author: Mitchell Rosen Date: Mon Apr 30 18:05:07 2018 -0400 Use unsafeInsertNew to create timers in TimerManager >--------------------------------------------------------------- 418881f7181cbfa31c44f0794db65bf00916bde2 libraries/base/GHC/Event/PSQ.hs | 19 ++----------------- libraries/base/GHC/Event/TimerManager.hs | 4 +++- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/libraries/base/GHC/Event/PSQ.hs b/libraries/base/GHC/Event/PSQ.hs index 07b8de6..6e13839 100644 --- a/libraries/base/GHC/Event/PSQ.hs +++ b/libraries/base/GHC/Event/PSQ.hs @@ -28,7 +28,7 @@ module GHC.Event.PSQ , singleton -- * Insertion - , insert + , unsafeInsertNew -- * Delete/Update , delete @@ -36,7 +36,6 @@ module GHC.Event.PSQ -- * Conversion , toList - , fromList -- * Min , findMin @@ -213,14 +212,7 @@ singleton = Tip -- Insertion ------------------------------------------------------------------------------ --- | /O(min(n,W))/ Insert a new key, priority and value into the queue. If the key --- is already present in the queue, the associated priority and value are --- replaced with the supplied priority and value. -insert :: Key -> Prio -> v -> IntPSQ v -> IntPSQ v -insert k p x t0 = unsafeInsertNew k p x (delete k t0) - --- | Internal function to insert a key that is *not* present in the priority --- queue. +-- | /O(min(n,W))/ Insert a new key that is *not* present in the priority queue. {-# INLINABLE unsafeInsertNew #-} unsafeInsertNew :: Key -> Prio -> v -> IntPSQ v -> IntPSQ v unsafeInsertNew k p x = go @@ -340,13 +332,6 @@ binShrinkR k p x m l r = Bin k p x m l r -- Lists ------------------------------------------------------------------------------ --- | /O(n*min(n,W))/ Build a queue from a list of (key, priority, value) tuples. --- If the list contains more than one priority and value for the same key, the --- last priority and value for the key is retained. -{-# INLINABLE fromList #-} -fromList :: [Elem v] -> IntPSQ v -fromList = foldr (\(E k p x) im -> insert k p x im) empty - -- | /O(n)/ Convert a queue to a list of (key, priority, value) tuples. The -- order of the list is not specified. toList :: IntPSQ v -> [Elem v] diff --git a/libraries/base/GHC/Event/TimerManager.hs b/libraries/base/GHC/Event/TimerManager.hs index 046f49e..a28d361 100644 --- a/libraries/base/GHC/Event/TimerManager.hs +++ b/libraries/base/GHC/Event/TimerManager.hs @@ -220,7 +220,9 @@ registerTimeout mgr us cb = do now <- getMonotonicTimeNSec let expTime = fromIntegral us * 1000 + now - editTimeouts mgr (Q.insert key expTime cb) + -- "unsafeInsertNew" is safe - the key must not exist in the PSQ. It + -- doesn't because we just generated it from a unique supply. + editTimeouts mgr (Q.unsafeInsertNew key expTime cb) return $ TK key -- | Unregister an active timeout. From git at git.haskell.org Sat May 5 21:07:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 May 2018 21:07:27 +0000 (UTC) Subject: [commit: ghc] master: Add 'addWordC#' PrimOp (6243bba) Message-ID: <20180505210727.67A813ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6243bba73d14cbee4219a16d45f57d1b254a6456/ghc >--------------------------------------------------------------- commit 6243bba73d14cbee4219a16d45f57d1b254a6456 Author: Sebastian Graf Date: Sat May 5 13:30:32 2018 -0400 Add 'addWordC#' PrimOp This is mostly for congruence with 'subWordC#' and '{add,sub}IntC#'. I found 'plusWord2#' while implementing this, which both lacks documentation and has a slightly different specification than 'addWordC#', which means the generic implementation is unnecessarily complex. While I was at it, I also added lacking meta-information on PrimOps and refactored 'subWordC#'s generic implementation to be branchless. Reviewers: bgamari, simonmar, jrtc27, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4592 >--------------------------------------------------------------- 6243bba73d14cbee4219a16d45f57d1b254a6456 compiler/cmm/CmmMachOp.hs | 1 + compiler/cmm/PprC.hs | 1 + compiler/codeGen/StgCmmPrim.hs | 72 +++++++++++++++++++--- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 6 ++ compiler/nativeGen/PPC/CodeGen.hs | 7 +++ compiler/nativeGen/SPARC/CodeGen.hs | 1 + compiler/nativeGen/X86/CodeGen.hs | 3 + compiler/prelude/primops.txt.pp | 19 ++++-- docs/users_guide/8.6.1-notes.rst | 7 ++- libraries/ghc-compact/ghc-compact.cabal | 2 +- libraries/ghc-prim/changelog.md | 7 +++ libraries/ghc-prim/ghc-prim.cabal | 2 +- testsuite/tests/ado/ado004.stderr | 2 +- .../tests/backpack/should_compile/bkp16.stderr | 2 +- .../tests/determinism/determ021/determ021.stdout | 4 +- testsuite/tests/driver/json2.stderr | 4 +- .../indexed-types/should_compile/T3017.stderr | 2 +- .../tests/partial-sigs/should_compile/ADT.stderr | 2 +- .../partial-sigs/should_compile/AddAndOr1.stderr | 2 +- .../partial-sigs/should_compile/AddAndOr2.stderr | 2 +- .../partial-sigs/should_compile/AddAndOr3.stderr | 2 +- .../partial-sigs/should_compile/AddAndOr4.stderr | 2 +- .../partial-sigs/should_compile/AddAndOr5.stderr | 2 +- .../partial-sigs/should_compile/AddAndOr6.stderr | 2 +- .../partial-sigs/should_compile/BoolToBool.stderr | 2 +- .../should_compile/DataFamilyInstanceLHS.stderr | 2 +- .../should_compile/Defaulting1MROn.stderr | 2 +- .../should_compile/Defaulting2MROff.stderr | 2 +- .../should_compile/Defaulting2MROn.stderr | 2 +- .../partial-sigs/should_compile/Either.stderr | 2 +- .../should_compile/EqualityConstraint.stderr | 2 +- .../tests/partial-sigs/should_compile/Every.stderr | 2 +- .../partial-sigs/should_compile/EveryNamed.stderr | 2 +- .../should_compile/ExpressionSig.stderr | 2 +- .../should_compile/ExpressionSigNamed.stderr | 2 +- .../should_compile/ExtraConstraints1.stderr | 2 +- .../should_compile/ExtraConstraints2.stderr | 2 +- .../should_compile/ExtraConstraints3.stderr | 2 +- .../should_compile/ExtraNumAMROff.stderr | 2 +- .../should_compile/ExtraNumAMROn.stderr | 2 +- .../partial-sigs/should_compile/Forall1.stderr | 2 +- .../partial-sigs/should_compile/GenNamed.stderr | 2 +- .../partial-sigs/should_compile/HigherRank1.stderr | 2 +- .../partial-sigs/should_compile/HigherRank2.stderr | 2 +- .../should_compile/LocalDefinitionBug.stderr | 2 +- .../partial-sigs/should_compile/Meltdown.stderr | 2 +- .../should_compile/MonoLocalBinds.stderr | 2 +- .../partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../NamedWildcardInDataFamilyInstanceLHS.stderr | 2 +- .../NamedWildcardInTypeFamilyInstanceLHS.stderr | 2 +- .../should_compile/ParensAroundContext.stderr | 2 +- .../partial-sigs/should_compile/PatBind.stderr | 2 +- .../partial-sigs/should_compile/PatBind2.stderr | 2 +- .../partial-sigs/should_compile/PatternSig.stderr | 2 +- .../partial-sigs/should_compile/Recursive.stderr | 2 +- .../should_compile/ScopedNamedWildcards.stderr | 2 +- .../should_compile/ScopedNamedWildcardsGood.stderr | 2 +- .../partial-sigs/should_compile/ShowNamed.stderr | 2 +- .../partial-sigs/should_compile/SimpleGen.stderr | 2 +- .../partial-sigs/should_compile/SkipMany.stderr | 2 +- .../should_compile/SomethingShowable.stderr | 2 +- .../should_compile/TypeFamilyInstanceLHS.stderr | 2 +- .../partial-sigs/should_compile/Uncurry.stderr | 2 +- .../should_compile/UncurryNamed.stderr | 2 +- .../WarningWildcardInstantiations.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 2 +- .../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/th/TH_Roles2.stderr | 2 +- .../tests/typecheck/should_compile/T12763.stderr | 2 +- .../tests/typecheck/should_compile/tc231.stderr | 2 +- 74 files changed, 175 insertions(+), 81 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 6243bba73d14cbee4219a16d45f57d1b254a6456 From git at git.haskell.org Sun May 6 01:44:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 May 2018 01:44:52 +0000 (UTC) Subject: [commit: ghc] master: Add test for invertability of `Floating` methods. (be580b4) Message-ID: <20180506014452.E1C5D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/be580b424ffd1d8ffead78b38eae6262ef2930b4/ghc >--------------------------------------------------------------- commit be580b424ffd1d8ffead78b38eae6262ef2930b4 Author: Justus Sagemüller Date: Wed Mar 28 12:52:30 2018 +0200 Add test for invertability of `Floating` methods. These functions have inverses only on part of the real line, but there they should be reliably inverted – that's basically the whole point of the functions like `asin`, `atan` etc.. >--------------------------------------------------------------- be580b424ffd1d8ffead78b38eae6262ef2930b4 .../tests/numeric/should_run/FloatFnInverses.hs | 47 ++++++++++++++++++++++ .../numeric/should_run/FloatFnInverses.stdout | 10 +++++ testsuite/tests/numeric/should_run/all.T | 2 + 3 files changed, 59 insertions(+) diff --git a/testsuite/tests/numeric/should_run/FloatFnInverses.hs b/testsuite/tests/numeric/should_run/FloatFnInverses.hs new file mode 100644 index 0000000..773790e --- /dev/null +++ b/testsuite/tests/numeric/should_run/FloatFnInverses.hs @@ -0,0 +1,47 @@ +{-# LANGUAGE TypeApplications #-} + +-- Check that the standard analytic functions are correctly +-- inverted by the corresponding inverse functions. + +main :: IO () +main = mapM_ print + [ -- @recip@ is self-inverse on @ℝ\\{0}@. + invDeviation @Double recip recip <$> [-1e20, -1e3, -1, -1e-40, 1e-40, 1e90] + , invDeviation @Float recip recip <$> [-1e10, -10, -1, -1e-20, 1e-20, 1e30] + , -- @exp@ is invertible on @ℝ <-> [0…∞[@, but grows very fast. + invDeviation @Double exp log <$> [-10, -5 .. 300] + , invDeviation @Float exp log <$> [-10 .. 60] + -- @sin@ is only invertible on @[-π/2…π/2] <-> [-1…1]@. + , invDeviation @Double sin asin <$> [-1.5, -1.4 .. 1.5] + , invDeviation @Float sin asin <$> [-1.5, -1.4 .. 1.5] + -- @cos@ is invertible on @[0…π] <-> [-1…1]@. + , invDeviation @Double cos acos <$> [0, 0.1 .. 3] + , invDeviation @Float cos acos <$> [0, 0.1 .. 3] + -- @tan@ is invertible on @]-π/4…π/4[ <-> ]-∞…∞[@. + , invDeviation @Double tan atan <$> [-0.7, -0.6 .. 0.7] + , invDeviation @Float tan atan <$> [-0.7, -0.6 .. 0.7] + ] + +invDeviation :: KnownNumDeviation a + => (a -> a) -- ^ Some numerical function @f at . + -> (a -> a) -- ^ Inverse @g = f⁻¹@ of that function. + -> a -- ^ Value @x@ which to compare with @g (f x)@. + -> Double -- ^ Relative discrepancy between original/expected + -- value and actual function result. +invDeviation f g 0 = rmNumericDeviation (g (f 0) + 1) - 1 +invDeviation f g x = rmNumericDeviation (g (f x) / x) - 1 + +-- | We need to round results to some sensible precision, +-- because floating-point arithmetic generally makes +-- it impossible to /exactly/ invert functions. +-- What precision this is depends on the type. The bounds +-- here are rather generous; the functions should usually +-- perform substantially better than that. +class (Floating a, Eq a) => KnownNumDeviation a where + rmNumericDeviation :: a -> Double + +instance KnownNumDeviation Double where + rmNumericDeviation x = fromIntegral (round $ x * 2^36) / 2^36 + +instance KnownNumDeviation Float where + rmNumericDeviation x = fromIntegral (round $ x * 2^16) / 2^16 diff --git a/testsuite/tests/numeric/should_run/FloatFnInverses.stdout b/testsuite/tests/numeric/should_run/FloatFnInverses.stdout new file mode 100644 index 0000000..7fa3691 --- /dev/null +++ b/testsuite/tests/numeric/should_run/FloatFnInverses.stdout @@ -0,0 +1,10 @@ +[0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index fd9c05f..37fff44 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -41,6 +41,8 @@ test('arith018', normal, compile_and_run, ['']) test('arith019', normal, compile_and_run, ['']) test('expfloat', normal, compile_and_run, ['']) +test('FloatFnInverses', normal, compile_and_run, ['']) + test('T1603', skip, compile_and_run, ['']) test('T3676', expect_broken(3676), compile_and_run, ['']) test('T4381', normal, compile_and_run, ['']) From git at git.haskell.org Sun May 6 01:45:09 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 May 2018 01:45:09 +0000 (UTC) Subject: [commit: ghc] master: Add hyperbolic functions to test of Float-inverses (d814dd3) Message-ID: <20180506014509.E75BF3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d814dd3862413bdfa5f44d3c67615cac3a0d4a41/ghc >--------------------------------------------------------------- commit d814dd3862413bdfa5f44d3c67615cac3a0d4a41 Author: Justus Sagemüller Date: Wed Mar 28 14:44:51 2018 +0200 Add hyperbolic functions to test of Float-inverses The area hyperbolic sine is currently broken, see https://ghc.haskell.org/trac/ghc/ticket/14927. >--------------------------------------------------------------- d814dd3862413bdfa5f44d3c67615cac3a0d4a41 testsuite/tests/numeric/should_run/FloatFnInverses.hs | 9 +++++++++ testsuite/tests/numeric/should_run/FloatFnInverses.stdout | 6 ++++++ testsuite/tests/numeric/should_run/all.T | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/numeric/should_run/FloatFnInverses.hs b/testsuite/tests/numeric/should_run/FloatFnInverses.hs index 773790e..13bf873 100644 --- a/testsuite/tests/numeric/should_run/FloatFnInverses.hs +++ b/testsuite/tests/numeric/should_run/FloatFnInverses.hs @@ -20,6 +20,15 @@ main = mapM_ print -- @tan@ is invertible on @]-π/4…π/4[ <-> ]-∞…∞[@. , invDeviation @Double tan atan <$> [-0.7, -0.6 .. 0.7] , invDeviation @Float tan atan <$> [-0.7, -0.6 .. 0.7] + -- @sinh@ is invertible on @ℝ <-> ℝ@, but grows very fast. + , invDeviation @Double sinh asinh <$> [-700, -672 .. 700] + , invDeviation @Float sinh asinh <$> [-80, -71 .. 80] + -- @cosh@ is invertible on @[0…∞[ <-> [1…∞[@, but grows fast + , invDeviation @Double cosh acosh <$> [0, 15 .. 700] + , invDeviation @Float cosh acosh <$> [0, 15 .. 80] + -- @tanh@ is invertible on @ℝ <-> ]-1…1[@. + , invDeviation @Double atanh tanh <$> [-0.99, -0.87 .. 0.9] + , invDeviation @Float atanh tanh <$> [-0.99, -0.87 .. 0.9] ] invDeviation :: KnownNumDeviation a diff --git a/testsuite/tests/numeric/should_run/FloatFnInverses.stdout b/testsuite/tests/numeric/should_run/FloatFnInverses.stdout index 7fa3691..2d019b8 100644 --- a/testsuite/tests/numeric/should_run/FloatFnInverses.stdout +++ b/testsuite/tests/numeric/should_run/FloatFnInverses.stdout @@ -8,3 +8,9 @@ [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index 37fff44..9f2f52a 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -41,7 +41,7 @@ test('arith018', normal, compile_and_run, ['']) test('arith019', normal, compile_and_run, ['']) test('expfloat', normal, compile_and_run, ['']) -test('FloatFnInverses', normal, compile_and_run, ['']) +test('FloatFnInverses', expect_broken(14927), compile_and_run, ['']) test('T1603', skip, compile_and_run, ['']) test('T3676', expect_broken(3676), compile_and_run, ['']) From git at git.haskell.org Sun May 6 01:45:24 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 May 2018 01:45:24 +0000 (UTC) Subject: [commit: ghc] master: Stable area hyperbolic sine for `Double` and `Float`. (3ea3341) Message-ID: <20180506014524.6BD813ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3ea33411d7cbf32c20940cc72ca07df6830eeed7/ghc >--------------------------------------------------------------- commit 3ea33411d7cbf32c20940cc72ca07df6830eeed7 Author: Justus Sagemüller Date: Wed Mar 28 15:51:16 2018 +0200 Stable area hyperbolic sine for `Double` and `Float`. This function was unstable, in particular for negative arguments. https://ghc.haskell.org/trac/ghc/ticket/14927 The reason is that the formula `log (x + sqrt (1 + x*x))` is dominated by the numerical error of the `sqrt` function when x is strongly negative (and thus the summands in the `log` mostly cancel). However, the area hyperbolic sine is an odd function, thus the negative side can as well be calculated by flipping over the positive side, which avoids this instability. Furthermore, for _very_ big arguments, the `x*x` subexpression overflows. However, long before that happens, the square root is anyways completely dominated by that term, so we can neglect the `1 +` and get sqrt (1 + x*x) ≈ sqrt (x*x) = x and therefore asinh x ≈ log (x + x) = log (2*x) = log 2 + log x which does not overflow for any normal-finite positive argument, but perfectly matches the exact formula within the floating-point accuracy. >--------------------------------------------------------------- 3ea33411d7cbf32c20940cc72ca07df6830eeed7 libraries/base/GHC/Float.hs | 12 ++++++++++-- testsuite/tests/numeric/should_run/all.T | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/Float.hs b/libraries/base/GHC/Float.hs index c534baf..d60c660 100644 --- a/libraries/base/GHC/Float.hs +++ b/libraries/base/GHC/Float.hs @@ -367,7 +367,11 @@ instance Floating Float where (**) x y = powerFloat x y logBase x y = log y / log x - asinh x = log (x + sqrt (1.0+x*x)) + asinh x + | x > huge = log 2 + log x + | x < 0 = -asinh (-x) + | otherwise = log (x + sqrt (1 + x*x)) + where huge = 1e10 acosh x = log (x + (x+1.0) * sqrt ((x-1.0)/(x+1.0))) atanh x = 0.5 * log ((1.0+x) / (1.0-x)) @@ -492,7 +496,11 @@ instance Floating Double where (**) x y = powerDouble x y logBase x y = log y / log x - asinh x = log (x + sqrt (1.0+x*x)) + asinh x + | x > huge = log 2 + log x + | x < 0 = -asinh (-x) + | otherwise = log (x + sqrt (1 + x*x)) + where huge = 1e20 acosh x = log (x + (x+1.0) * sqrt ((x-1.0)/(x+1.0))) atanh x = 0.5 * log ((1.0+x) / (1.0-x)) diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index 9f2f52a..37fff44 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -41,7 +41,7 @@ test('arith018', normal, compile_and_run, ['']) test('arith019', normal, compile_and_run, ['']) test('expfloat', normal, compile_and_run, ['']) -test('FloatFnInverses', expect_broken(14927), compile_and_run, ['']) +test('FloatFnInverses', normal, compile_and_run, ['']) test('T1603', skip, compile_and_run, ['']) test('T3676', expect_broken(3676), compile_and_run, ['']) From git at git.haskell.org Sun May 6 01:48:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 May 2018 01:48:58 +0000 (UTC) Subject: [commit: ghc] master: base/changelog: Note stabilization of asinh (#14927) (46548ed) Message-ID: <20180506014858.34A753ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/46548ed1ee3ddac665c188b65d573fbf104407ea/ghc >--------------------------------------------------------------- commit 46548ed1ee3ddac665c188b65d573fbf104407ea Author: Ben Gamari Date: Sat May 5 21:48:17 2018 -0400 base/changelog: Note stabilization of asinh (#14927) >--------------------------------------------------------------- 46548ed1ee3ddac665c188b65d573fbf104407ea libraries/base/changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 0bca264..d4b9efa 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -14,6 +14,9 @@ * Add `Applicative` (for `K1`), `Semigroup` and `Monoid` instances in `GHC.Generics`. (#14849) + * `asinh` for `Float` and `Double` is now numerical stable in the face of + large negative arguments (#14927) + ## 4.11.1.0 *TBA* * Bundled with GHC 8.4.2 From git at git.haskell.org Sun May 6 01:51:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 May 2018 01:51:32 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump T5631 expected allocations (7271db4) Message-ID: <20180506015132.0B9663ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7271db46c332f15c302b9a55f4ed005cdd0fb898/ghc >--------------------------------------------------------------- commit 7271db46c332f15c302b9a55f4ed005cdd0fb898 Author: Ben Gamari Date: Sat May 5 21:50:37 2018 -0400 testsuite: Bump T5631 expected allocations This was failing on Darwin; I believe this is due to 33de71fa06d0. >--------------------------------------------------------------- 7271db46c332f15c302b9a55f4ed005cdd0fb898 testsuite/tests/perf/compiler/all.T | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 903c05f..6b0bd43 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -449,7 +449,7 @@ test('T5631', # 2014-04-04: 346389856 (x86 Windows, 64 bit machine) # 2014-12-01: 390199244 (Windows laptop) # 2016-04-06: 570137436 (amd64/Linux) many reasons - (wordsize(64), 1106015512, 5)]), + (wordsize(64), 1164944688, 5)]), # expected value: 774595008 (amd64/Linux): # expected value: 735486328 (amd64/Linux) 2012/12/12: # expected value: 690742040 (amd64/Linux) Call Arity improvements @@ -464,8 +464,9 @@ test('T5631', # 2017-02-17: 1517484488 (amd64/Linux) Type-indexed Typeable # 2017-03-03: 1065147968 (amd64/Linux) Share Typeable KindReps # 2017-03-31: 1037482512 (amd64/Linux) Fix memory leak in simplifier - # 2017-07-27: 1106015512 (Mac) Regresssion from tracking visibility in TypeEqOrigin - # should be fixed by #14037 + # 2017-07-27: 1106015512 (Mac) Regresssion from tracking visibility in + # TypeEqOrigin should be fixed by #14037 + # 2018-05-05: 1164944688 (amd64/Linux) Simplify callSiteInline a little only_ways(['normal']) ], compile, From git at git.haskell.org Sun May 6 07:33:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 May 2018 07:33:13 +0000 (UTC) Subject: [commit: ghc] master: printStackChunk: recognise a few more ret frames (875b61e) Message-ID: <20180506073313.A68593ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/875b61ea38aa912d153a30027b51a4f12508bb9a/ghc >--------------------------------------------------------------- commit 875b61ea38aa912d153a30027b51a4f12508bb9a Author: Ömer Sinan Ağacan Date: Sun May 6 10:31:22 2018 +0300 printStackChunk: recognise a few more ret frames >--------------------------------------------------------------- 875b61ea38aa912d153a30027b51a4f12508bb9a rts/Printer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rts/Printer.c b/rts/Printer.c index 87a2cb1..d184423 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -542,6 +542,18 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) debugBelch("stg_ap_ppppp_info\n" ); } else if (c == (StgWord)&stg_ap_pppppp_info) { debugBelch("stg_ap_pppppp_info\n" ); + } else if (c == (StgWord)&stg_ret_v_info) { + debugBelch("stg_ret_v_info\n" ); + } else if (c == (StgWord)&stg_ret_p_info) { + debugBelch("stg_ret_p_info\n" ); + } else if (c == (StgWord)&stg_ret_n_info) { + debugBelch("stg_ret_n_info\n" ); + } else if (c == (StgWord)&stg_ret_f_info) { + debugBelch("stg_ret_f_info\n" ); + } else if (c == (StgWord)&stg_ret_d_info) { + debugBelch("stg_ret_d_info\n" ); + } else if (c == (StgWord)&stg_ret_l_info) { + debugBelch("stg_ret_l_info\n" ); #if defined(PROFILING) } else if (c == (StgWord)&stg_restore_cccs_info) { debugBelch("stg_restore_cccs_info\n" ); From git at git.haskell.org Tue May 8 12:11:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 12:11:00 +0000 (UTC) Subject: [commit: ghc] branch 'wip/tdammers/T11066' created Message-ID: <20180508121100.067983ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/tdammers/T11066 Referencing: f4f9c0fc9564f17339718378e9fea3bd186fff96 From git at git.haskell.org Tue May 8 12:11:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 12:11:02 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: [WIP] turn "inaccessible code" error into a warning (f4f9c0f) Message-ID: <20180508121102.C691A3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/f4f9c0fc9564f17339718378e9fea3bd186fff96/ghc >--------------------------------------------------------------- commit f4f9c0fc9564f17339718378e9fea3bd186fff96 Author: Tobias Dammers Date: Tue May 8 13:54:28 2018 +0200 [WIP] turn "inaccessible code" error into a warning (#11066) >--------------------------------------------------------------- f4f9c0fc9564f17339718378e9fea3bd186fff96 compiler/typecheck/TcErrors.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index dde7c3c..2d3af68 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -708,7 +708,7 @@ mkGivenErrorReporter implic ctxt cts Nothing ty1 ty2 ; traceTc "mkGivenErrorReporter" (ppr ct) - ; maybeReportError ctxt err } + ; reportWarning NoReason err } where (ct : _ ) = cts -- Never empty (ty1, ty2) = getEqPredTys (ctPred ct) From git at git.haskell.org Tue May 8 14:45:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 14:45:47 +0000 (UTC) Subject: [commit: ghc] master: Simplify the kind checking for type/class decls (aa03ad8) Message-ID: <20180508144547.781293ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aa03ad885373f82c008ae7d75206f5305c395b61/ghc >--------------------------------------------------------------- commit aa03ad885373f82c008ae7d75206f5305c395b61 Author: Simon Peyton Jones Date: Fri May 4 16:31:55 2018 +0100 Simplify the kind checking for type/class decls This patch deletes quite a bit of code, AND fixes Trac #15116. >--------------------------------------------------------------- aa03ad885373f82c008ae7d75206f5305c395b61 compiler/typecheck/TcTyClsDecls.hs | 232 ++++++++++++--------- testsuite/tests/polykinds/T15116.hs | 9 + testsuite/tests/polykinds/T15116.stderr | 7 + testsuite/tests/polykinds/T15116a.hs | 6 + testsuite/tests/polykinds/T15116a.stderr | 7 + testsuite/tests/polykinds/all.T | 2 + .../tests/typecheck/should_fail/T14904a.stderr | 5 + 7 files changed, 165 insertions(+), 103 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 aa03ad885373f82c008ae7d75206f5305c395b61 From git at git.haskell.org Tue May 8 14:45:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 14:45:50 +0000 (UTC) Subject: [commit: ghc] master: Small refactoring in Exitify (61b245a) Message-ID: <20180508144550.4C2603ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/61b245a0c8abd365dcaa69b3190cf950603a1960/ghc >--------------------------------------------------------------- commit 61b245a0c8abd365dcaa69b3190cf950603a1960 Author: Simon Peyton Jones Date: Fri May 4 16:24:26 2018 +0100 Small refactoring in Exitify This refactoring was provoked by our conversation on Trac #14152. No change in behaviour. >--------------------------------------------------------------- 61b245a0c8abd365dcaa69b3190cf950603a1960 compiler/simplCore/Exitify.hs | 133 +++++++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 60 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index f67d4bd..3e7d503 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -124,7 +124,9 @@ exitifyRec in_scope pairs let rhs' = mkLams args body' return (x, rhs') - -- main working function. Goes through the RHS (tail-call positions only), + --------------------- + -- 'go' is the main working function. + -- It goes through the RHS (tail-call positions only), -- checks if there are no more recursive calls, if so, abstracts over -- variables bound on the way and lifts it out as a join point. -- @@ -139,63 +141,10 @@ exitifyRec in_scope pairs -- We first look at the expression (no matter what it shape is) -- and determine if we can turn it into a exit join point go captured ann_e - -- Do not touch an expression that is already a join jump where all arguments - -- are captured variables. See Note [Idempotency] - -- But _do_ float join jumps with interesting arguments. - -- See Note [Jumps can be interesting] - | (Var f, args) <- collectArgs e - , isJoinId f - , all isCapturedVarArg args - = return e - - -- Do not touch a boring expression (see Note [Interesting expression]) - | is_exit, not is_interesting = return e - - -- Cannot float out if local join points are used, as - -- we cannot abstract over them - | is_exit, captures_join_points = return e - - -- We have something to float out! - | is_exit = do - -- Assemble the RHS of the exit join point - let rhs = mkLams abs_vars e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured - -- Remember this binding under a suitable name - v <- addExit avoid ty (length abs_vars) rhs - -- And jump to it from here - return $ mkVarApps (Var v) abs_vars - where - -- An exit expression has no recursive calls - is_exit = disjointVarSet fvs recursive_calls - - -- Used to detect exit expressoins that are already proper exit jumps - isCapturedVarArg (Var v) = v `elem` captured - isCapturedVarArg _ = False - - -- An interesting exit expression has free, non-imported - -- variables from outside the recursive group - -- See Note [Interesting expression] - is_interesting = anyVarSet isLocalId (fvs `minusVarSet` mkVarSet captured) - - -- The arguments of this exit join point - -- See Note [Picking arguments to abstract over] - abs_vars = snd $ foldr pick (fvs, []) captured - where - pick v (fvs', acc) | v `elemVarSet` fvs' = (fvs' `delVarSet` v, zap v : acc) - | otherwise = (fvs', acc) - - -- 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 - - -- We cannot abstract over join points - captures_join_points = any isJoinId abs_vars - - e = deAnnotate ann_e - fvs = dVarSetToVarSet (freeVarsOf ann_e) + | -- An exit expression has no recursive calls + let fvs = dVarSetToVarSet (freeVarsOf ann_e) + , disjointVarSet fvs recursive_calls + = go_exit captured (deAnnotate ann_e) fvs -- We could not turn it into a exit joint point. So now recurse -- into all expression where eligible exit join points might sit, @@ -241,6 +190,69 @@ exitifyRec in_scope pairs -- tail-call subexpression. Nothing to do here. go _ ann_e = return (deAnnotate ann_e) + --------------------- + go_exit :: [Var] -- Variables captured locally + -> CoreExpr -- An exit expression + -> VarSet -- Free vars of the expression + -> ExitifyM CoreExpr + -- go_exit deals with a tail expression that is floatable + -- out as an exit point; that is, it mentions no recursive calls + go_exit captured e fvs + -- Do not touch an expression that is already a join jump where all arguments + -- are captured variables. See Note [Idempotency] + -- But _do_ float join jumps with interesting arguments. + -- See Note [Jumps can be interesting] + | (Var f, args) <- collectArgs e + , isJoinId f + , all isCapturedVarArg args + = return e + + -- Do not touch a boring expression (see Note [Interesting expression]) + | not is_interesting + = return e + + -- Cannot float out if local join points are used, as + -- we cannot abstract over them + | captures_join_points + = return e + + -- We have something to float out! + | otherwise + = do { -- Assemble the RHS of the exit join point + let rhs = mkLams abs_vars e + avoid = in_scope `extendInScopeSetList` captured + -- Remember this binding under a suitable name + ; v <- addExit avoid (length abs_vars) rhs + -- And jump to it from here + ; return $ mkVarApps (Var v) abs_vars } + + where + -- Used to detect exit expressoins that are already proper exit jumps + isCapturedVarArg (Var v) = v `elem` captured + isCapturedVarArg _ = False + + -- An interesting exit expression has free, non-imported + -- variables from outside the recursive group + -- See Note [Interesting expression] + is_interesting = anyVarSet isLocalId $ + fvs `minusVarSet` mkVarSet captured + + -- The arguments of this exit join point + -- See Note [Picking arguments to abstract over] + abs_vars = snd $ foldr pick (fvs, []) captured + where + pick v (fvs', acc) | v `elemVarSet` fvs' = (fvs' `delVarSet` v, zap v : acc) + | otherwise = (fvs', acc) + + -- 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 + + -- We cannot abstract over join points + captures_join_points = any isJoinId abs_vars + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec @@ -256,9 +268,10 @@ mkExitJoinId in_scope ty join_arity = do exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do +addExit :: InScopeSet -> JoinArity -> CoreExpr -> ExitifyM JoinId +addExit in_scope join_arity rhs = do -- Pick a suitable name + let ty = exprType rhs v <- mkExitJoinId in_scope ty join_arity fs <- get put ((v,rhs):fs) From git at git.haskell.org Tue May 8 14:45:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 14:45:53 +0000 (UTC) Subject: [commit: ghc] master: Used named fields for DataDeclRn (5b3104a) Message-ID: <20180508144553.207473ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b3104ab290e12f0c24c097c1fe4c4a6bdcdab70/ghc >--------------------------------------------------------------- commit 5b3104ab290e12f0c24c097c1fe4c4a6bdcdab70 Author: Simon Peyton Jones Date: Fri May 4 16:25:46 2018 +0100 Used named fields for DataDeclRn >--------------------------------------------------------------- 5b3104ab290e12f0c24c097c1fe4c4a6bdcdab70 compiler/rename/RnSource.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 065e72f..502be23 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -1561,11 +1561,14 @@ rnTyClDecl (DataDecl { tcdLName = tycon, tcdTyVars = tyvars, ; typeintype <- xoptM LangExt.TypeInType ; let cusk = hsTvbAllKinded tyvars' && (not typeintype || no_rhs_kvs) + rn_info = DataDeclRn { tcdDataCusk = cusk + , tcdFVs = fvs } ; traceRn "rndata" (ppr tycon <+> ppr cusk <+> ppr no_rhs_kvs) - ; return (DataDecl { tcdLName = tycon', tcdTyVars = tyvars' - , tcdFixity = fixity + ; return (DataDecl { tcdLName = tycon' + , tcdTyVars = tyvars' + , tcdFixity = fixity , tcdDataDefn = defn' - , tcdDExt = DataDeclRn cusk fvs }, fvs) } } + , tcdDExt = rn_info }, fvs) } } rnTyClDecl (ClassDecl { tcdCtxt = context, tcdLName = lcls, tcdTyVars = tyvars, tcdFixity = fixity, From git at git.haskell.org Tue May 8 14:51:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 14:51:01 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Move discussion MAX_PATH out of release notes (37acca7) Message-ID: <20180508145101.577713ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/37acca7ecea6a7365a52ec92f864f25fa179095a/ghc >--------------------------------------------------------------- commit 37acca7ecea6a7365a52ec92f864f25fa179095a Author: Ben Gamari Date: Mon May 7 14:43:45 2018 -0400 users-guide: Move discussion MAX_PATH out of release notes This discussion will be useful for users; move it into the users-guide proper. Also fixes a few typos noted by @Phyx. Test Plan: Read it Reviewers: Phyx Reviewed By: Phyx Subscribers: dfeuer, Phyx, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4420 >--------------------------------------------------------------- 37acca7ecea6a7365a52ec92f864f25fa179095a docs/users_guide/8.6.1-notes.rst | 52 +++++++--------------------------------- docs/users_guide/win32-dlls.rst | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 43 deletions(-) diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst index bda1ddc..25b93b8 100644 --- a/docs/users_guide/8.6.1-notes.rst +++ b/docs/users_guide/8.6.1-notes.rst @@ -13,6 +13,13 @@ Highlights The highlights, since the 8.4.1 release, are: +- Programs are no longer constrained by the Windows ``MAX_PATH`` file path + length limit. The file path limit is now approximately 32,767 characters. Note + that GHC itself is still somewhat limited due to GCC not supporting file + namespaced paths. Paths that are passed directly to the compiler, linker or + other GNU tools are currently still constrained. See :ref:`windows-file-paths` + for details. + - Many, many bug fixes. @@ -118,7 +125,8 @@ 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 the ``MAX_PATH`` file path + length limitation. See :ref:`windows-file-paths`. - The runtime now allows use of the :rts-flag:`-hT` profiling variety on programs built with :ghc-flag:`-prof`. @@ -150,48 +158,6 @@ Template Haskell Build system ~~~~~~~~~~~~ -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 -System nor the File System. It is a limitation of the default namespace enforced -by the Win32 API for backwards compatibility. - -The NT Kernel however allows you ways to opt out of this path preprocessing by -the Win32 APIs. This is done by explicitly using the desired namespace in the -PATH. - -The namespaces are: - - - 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. - -Paths with a drive letter are `legacy` paths. The drive letters are actually -meaningless to the kernel. Just like Unix operating systems, drive letters are -just a mount point. You can view your mount points by using the `mountvol` -command. - -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 ``\\`` - - expand relative paths to absolute paths - -If you want to opt out of all preprocessing just expliticly use namespaces in -your paths. Due to this change, if you need to open raw devices (e.g. COM ports) -you need to use the device namespace explicitly. (e.g. `\\.\COM1`). GHC and -Haskell programs in general no longer support opening devices in the `legacy` -format. - -See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx for -more details. - Included libraries ------------------ diff --git a/docs/users_guide/win32-dlls.rst b/docs/users_guide/win32-dlls.rst index 26c3ffe..4ecdd10 100644 --- a/docs/users_guide/win32-dlls.rst +++ b/docs/users_guide/win32-dlls.rst @@ -97,6 +97,52 @@ Windows. ``IOExts.hSetBinaryMode``. The ``IOExts`` module is part of the ``lang`` package. +.. _windows-file-paths: + +File paths under Windows +------------------------ + +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 +system nor the file system. It is a limitation of the default namespace enforced +by the Win32 API for backwards compatibility. + +The NT kernel however allows you ways to opt out of this path preprocessing by +the Win32 APIs. This is done by explicitly using the desired namespace in the +path. + +The namespaces are: + + - 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. + +Paths with a drive letter are *legacy* paths. The drive letters are actually +meaningless to the kernel. Just like Unix operating systems, drive letters are +just a mount point. You can view your mount points by using the :command:`mountvol` +command. + +Since GHC 8.6.1, the Haskell I/O manager automatically promotes paths in the legacy +format to Win32 file namespace. By default the I/O manager will do two things to +your paths: + + - replace ``\`` with ``\\`` + - expand relative paths to absolute paths + +If you want to opt out of all preprocessing just expliticly use namespaces in +your paths. Due to this change, if you need to open raw devices (e.g. COM ports) +you need to use the device namespace explicitly. (e.g. ``\\.\COM1``). GHC and +Haskell programs in general no longer support opening devices in the legacy +format. + +See the +`Windows documentation `_ +for more details. + + .. _ghci-cygwin: Using GHC (and other GHC-compiled executables) with Cygwin From git at git.haskell.org Tue May 8 14:51:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 14:51:16 +0000 (UTC) Subject: [commit: ghc] master: Revert "Normalize the element type of ListPat, fix #14547" (280de0c) Message-ID: <20180508145116.116323ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/280de0c19682fb1b0941cad94f9219b513a6d3e2/ghc >--------------------------------------------------------------- commit 280de0c19682fb1b0941cad94f9219b513a6d3e2 Author: Ben Gamari Date: Tue May 8 10:07:53 2018 -0400 Revert "Normalize the element type of ListPat, fix #14547" This reverts commit 361d23a8ebb44f5df5167306d7b98d8bd1724e06. >--------------------------------------------------------------- 280de0c19682fb1b0941cad94f9219b513a6d3e2 compiler/deSugar/Check.hs | 5 +---- testsuite/tests/deSugar/should_compile/T14547.hs | 15 --------------- testsuite/tests/deSugar/should_compile/all.T | 1 - 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 7a5f889..545aace 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -790,13 +790,10 @@ translatePat fam_insts pat = case pat of -- overloaded list ListPat (ListPatTc elem_ty (Just (pat_ty, _to_list))) lpats | Just e_ty <- splitListTyConApp_maybe pat_ty - , (_, norm_e_ty) <- normaliseType fam_insts Nominal e_ty - -- e_ty can be a type family instance, like - -- `It (List a)`, but we prefer `a`, see Trac #14547 , (_, norm_elem_ty) <- normaliseType fam_insts Nominal elem_ty -- elem_ty is frequently something like -- `Item [Int]`, but we prefer `Int` - , norm_elem_ty `eqType` norm_e_ty -> + , norm_elem_ty `eqType` e_ty -> -- We have to ensure that the element types are exactly the same. -- Otherwise, one may give an instance IsList [Int] (more specific than -- the default IsList [a]) with a different implementation for `toList' diff --git a/testsuite/tests/deSugar/should_compile/T14547.hs b/testsuite/tests/deSugar/should_compile/T14547.hs deleted file mode 100644 index 02ff2e6..0000000 --- a/testsuite/tests/deSugar/should_compile/T14547.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-# LANGUAGE OverloadedLists #-} -{-# LANGUAGE TypeFamilies #-} - -module T14547 where - -class Foo f where - type It f - foo :: [It f] -> f - -data List a = Empty | a :! List a deriving Show - -instance Foo (List a) where - type It (List a) = a - foo [] = Empty - foo (x : xs) = x :! foo xs diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 1414073..2d36146 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -100,7 +100,6 @@ test('T13290', normal, compile, ['']) test('T13257', normal, compile, ['']) test('T13870', normal, compile, ['']) test('T14135', normal, compile, ['']) -test('T14547', normal, compile, ['-Wincomplete-patterns']) 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 Tue May 8 14:51:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 14:51:31 +0000 (UTC) Subject: [commit: ghc] master: Normalize the element type of ListPat, fix #14547 (981bf47) Message-ID: <20180508145131.1CDBA3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/981bf4718de7daef7817a363ccc14030c2688632/ghc >--------------------------------------------------------------- commit 981bf4718de7daef7817a363ccc14030c2688632 Author: Ben Gamari Date: Tue May 8 10:08:04 2018 -0400 Normalize the element type of ListPat, fix #14547 The element type of `List` maybe a type family instacen, rather than a trivial type. For example in Trac #14547, ``` {-# LANGUAGE TypeFamilies, OverloadedLists #-} class Foo f where type It f foo :: [It f] -> f data List a = Empty | a :! List a deriving Show instance Foo (List a) where type It (List a) = a foo [] = Empty foo (x : xs) = x :! foo xs ``` Here the element type of `[]` is `It (List a)`, we should also normalize it as `a`. Test Plan: make test TEST="T14547" Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14547 Differential Revision: https://phabricator.haskell.org/D4624 >--------------------------------------------------------------- 981bf4718de7daef7817a363ccc14030c2688632 compiler/deSugar/Check.hs | 5 ++++- testsuite/tests/deSugar/should_compile/T14547.hs | 15 +++++++++++++++ testsuite/tests/deSugar/should_compile/all.T | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 545aace..7a5f889 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -790,10 +790,13 @@ translatePat fam_insts pat = case pat of -- overloaded list ListPat (ListPatTc elem_ty (Just (pat_ty, _to_list))) lpats | Just e_ty <- splitListTyConApp_maybe pat_ty + , (_, norm_e_ty) <- normaliseType fam_insts Nominal e_ty + -- e_ty can be a type family instance, like + -- `It (List a)`, but we prefer `a`, see Trac #14547 , (_, norm_elem_ty) <- normaliseType fam_insts Nominal elem_ty -- elem_ty is frequently something like -- `Item [Int]`, but we prefer `Int` - , norm_elem_ty `eqType` e_ty -> + , norm_elem_ty `eqType` norm_e_ty -> -- We have to ensure that the element types are exactly the same. -- Otherwise, one may give an instance IsList [Int] (more specific than -- the default IsList [a]) with a different implementation for `toList' diff --git a/testsuite/tests/deSugar/should_compile/T14547.hs b/testsuite/tests/deSugar/should_compile/T14547.hs new file mode 100644 index 0000000..02ff2e6 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T14547.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE TypeFamilies #-} + +module T14547 where + +class Foo f where + type It f + foo :: [It f] -> f + +data List a = Empty | a :! List a deriving Show + +instance Foo (List a) where + type It (List a) = a + foo [] = Empty + foo (x : xs) = x :! foo xs diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 2d36146..1414073 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -100,6 +100,7 @@ test('T13290', normal, compile, ['']) test('T13257', normal, compile, ['']) test('T13870', normal, compile, ['']) test('T14135', normal, compile, ['']) +test('T14547', normal, compile, ['-Wincomplete-patterns']) 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 Tue May 8 21:13:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 21:13:58 +0000 (UTC) Subject: [commit: ghc] master: Revert "Normalize the element type of ListPat, fix #14547" (849547b) Message-ID: <20180508211358.71CCC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/849547bd3a5bc6876268c94f97bf3e79c31340ec/ghc >--------------------------------------------------------------- commit 849547bd3a5bc6876268c94f97bf3e79c31340ec Author: Ben Gamari Date: Tue May 8 10:52:28 2018 -0400 Revert "Normalize the element type of ListPat, fix #14547" This reverts commit 981bf4718de7daef7817a363ccc14030c2688632. >--------------------------------------------------------------- 849547bd3a5bc6876268c94f97bf3e79c31340ec compiler/deSugar/Check.hs | 5 +---- testsuite/tests/deSugar/should_compile/T14547.hs | 15 --------------- testsuite/tests/deSugar/should_compile/all.T | 1 - 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 7a5f889..545aace 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -790,13 +790,10 @@ translatePat fam_insts pat = case pat of -- overloaded list ListPat (ListPatTc elem_ty (Just (pat_ty, _to_list))) lpats | Just e_ty <- splitListTyConApp_maybe pat_ty - , (_, norm_e_ty) <- normaliseType fam_insts Nominal e_ty - -- e_ty can be a type family instance, like - -- `It (List a)`, but we prefer `a`, see Trac #14547 , (_, norm_elem_ty) <- normaliseType fam_insts Nominal elem_ty -- elem_ty is frequently something like -- `Item [Int]`, but we prefer `Int` - , norm_elem_ty `eqType` norm_e_ty -> + , norm_elem_ty `eqType` e_ty -> -- We have to ensure that the element types are exactly the same. -- Otherwise, one may give an instance IsList [Int] (more specific than -- the default IsList [a]) with a different implementation for `toList' diff --git a/testsuite/tests/deSugar/should_compile/T14547.hs b/testsuite/tests/deSugar/should_compile/T14547.hs deleted file mode 100644 index 02ff2e6..0000000 --- a/testsuite/tests/deSugar/should_compile/T14547.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-# LANGUAGE OverloadedLists #-} -{-# LANGUAGE TypeFamilies #-} - -module T14547 where - -class Foo f where - type It f - foo :: [It f] -> f - -data List a = Empty | a :! List a deriving Show - -instance Foo (List a) where - type It (List a) = a - foo [] = Empty - foo (x : xs) = x :! foo xs diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 1414073..2d36146 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -100,7 +100,6 @@ test('T13290', normal, compile, ['']) test('T13257', normal, compile, ['']) test('T13870', normal, compile, ['']) test('T14135', normal, compile, ['']) -test('T14547', normal, compile, ['-Wincomplete-patterns']) 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 Tue May 8 21:14:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 8 May 2018 21:14:13 +0000 (UTC) Subject: [commit: ghc] master: Normalize the element type of ListPat, fix #14547 (ba6e445) Message-ID: <20180508211413.C57463ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ba6e445e1cf31957f2a327a73f9f66cfa7f24e26/ghc >--------------------------------------------------------------- commit ba6e445e1cf31957f2a327a73f9f66cfa7f24e26 Author: HE, Tao Date: Tue May 8 10:53:41 2018 -0400 Normalize the element type of ListPat, fix #14547 Summary: The element type of `List` maybe a type family instacen, rather than a trivial type. For example in Trac #14547, ``` {-# LANGUAGE TypeFamilies, OverloadedLists #-} class Foo f where type It f foo :: [It f] -> f data List a = Empty | a :! List a deriving Show instance Foo (List a) where type It (List a) = a foo [] = Empty foo (x : xs) = x :! foo xs ``` Here the element type of `[]` is `It (List a)`, we should also normalize it as `a`. Test Plan: make test TEST="T14547" Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14547 Differential Revision: https://phabricator.haskell.org/D4624 >--------------------------------------------------------------- ba6e445e1cf31957f2a327a73f9f66cfa7f24e26 compiler/deSugar/Check.hs | 40 ++++++++++++++++-------- testsuite/tests/deSugar/should_compile/T14547.hs | 15 +++++++++ testsuite/tests/deSugar/should_compile/all.T | 1 + 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 545aace..b383fb2 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -53,6 +53,7 @@ import Type import UniqSupply import DsGRHSs (isTrueLHsExpr) import Maybes (expectJust) +import qualified GHC.LanguageExtensions as LangExt import Data.List (find) import Data.Maybe (catMaybes, isJust, fromMaybe) @@ -788,18 +789,31 @@ translatePat fam_insts pat = case pat of <$> translatePatVec fam_insts (map unLoc ps) -- overloaded list - ListPat (ListPatTc elem_ty (Just (pat_ty, _to_list))) lpats - | Just e_ty <- splitListTyConApp_maybe pat_ty - , (_, norm_elem_ty) <- normaliseType fam_insts Nominal elem_ty - -- elem_ty is frequently something like - -- `Item [Int]`, but we prefer `Int` - , norm_elem_ty `eqType` e_ty -> - -- We have to ensure that the element types are exactly the same. - -- Otherwise, one may give an instance IsList [Int] (more specific than - -- the default IsList [a]) with a different implementation for `toList' - translatePat fam_insts (ListPat (ListPatTc e_ty Nothing) lpats) - -- See Note [Guards and Approximation] - | otherwise -> mkCanFailPmPat pat_ty + ListPat (ListPatTc _elem_ty (Just (pat_ty, _to_list))) lpats -> do + dflags <- getDynFlags + if xopt LangExt.RebindableSyntax dflags + then mkCanFailPmPat pat_ty + else case splitListTyConApp_maybe pat_ty of + Just e_ty -> translatePat fam_insts + (ListPat (ListPatTc e_ty Nothing) lpats) + Nothing -> mkCanFailPmPat pat_ty + -- (a) In the presence of RebindableSyntax, we don't know anything about + -- `toList`, we should treat `ListPat` as any other view pattern. + -- + -- (b) In the absence of RebindableSyntax, + -- - If the pat_ty is `[a]`, then we treat the overloaded list pattern + -- as ordinary list pattern. Although we can give an instance + -- `IsList [Int]` (more specific than the default `IsList [a]`), in + -- practice, we almost never do that. We assume the `_to_list` is + -- the `toList` from `instance IsList [a]`. + -- + -- - Otherwise, we treat the `ListPat` as ordinary view pattern. + -- + -- See Trac #14547, especially comment#9 and comment#10. + -- + -- Here we construct CanFailPmPat directly, rather can construct a view + -- pattern and do further translation as an optimization, for the reason, + -- see Note [Guards and Approximation]. ConPatOut { pat_con = L _ con , pat_arg_tys = arg_tys @@ -1073,7 +1087,7 @@ An overloaded list @[...]@ should be translated to @x ([...] <- toList x)@. The problem is exactly like above, as its solution. For future reference, the code below is the *right thing to do*: - ListPat lpats elem_ty (Just (pat_ty, to_list)) + ListPat (ListPatTc elem_ty (Just (pat_ty, _to_list))) lpats otherwise -> do (xp, xe) <- mkPmId2Forms pat_ty ps <- translatePatVec (map unLoc lpats) diff --git a/testsuite/tests/deSugar/should_compile/T14547.hs b/testsuite/tests/deSugar/should_compile/T14547.hs new file mode 100644 index 0000000..02ff2e6 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T14547.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE TypeFamilies #-} + +module T14547 where + +class Foo f where + type It f + foo :: [It f] -> f + +data List a = Empty | a :! List a deriving Show + +instance Foo (List a) where + type It (List a) = a + foo [] = Empty + foo (x : xs) = x :! foo xs diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 2d36146..1414073 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -100,6 +100,7 @@ test('T13290', normal, compile, ['']) test('T13257', normal, compile, ['']) test('T13870', normal, compile, ['']) test('T14135', normal, compile, ['']) +test('T14547', normal, compile, ['-Wincomplete-patterns']) 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 Wed May 9 12:45:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 9 May 2018 12:45:18 +0000 (UTC) Subject: [commit: ghc] master: Add -fghci-leak-check to check for space leaks (5fe6aaa) Message-ID: <20180509124518.4DA033ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5fe6aaa3756cda654374ebfd883fa8f064ff64a4/ghc >--------------------------------------------------------------- commit 5fe6aaa3756cda654374ebfd883fa8f064ff64a4 Author: Simon Marlow Date: Wed May 2 11:01:13 2018 +0100 Add -fghci-leak-check to check for space leaks Summary: Space leaks in GHCi emerge from time to time and tend to come back again after they get fixed. This is an attempt to limit regressions by * adding a reliable detection for some classes of space leaks in GHCi * turning on leak checking for all GHCi tests in the test suite, so that we'll notice if the leak appears again. The idea for detecting space leaks is quite simple: * find some data that we expect to be GC'd later, make a weak pointer to it * when we expect the data to be dead, do a `performGC` and then check the status of the weak pointer. It would be nice to apply this trick to lots of things in GHC, e.g. ensuring that HsSyn is not retained after the desugarer, or ensuring that CoreSyn from the previous simplifier pass is not retained. Test Plan: validate Reviewers: bgamari, simonpj, erikd, niteria Subscribers: thomie, carter GHC Trac Issues: #15111 Differential Revision: https://phabricator.haskell.org/D4658 >--------------------------------------------------------------- 5fe6aaa3756cda654374ebfd883fa8f064ff64a4 compiler/main/DynFlags.hs | 2 + docs/users_guide/ghci.rst | 11 ++++++ ghc/GHCi/Leak.hs | 59 +++++++++++++++++++++++++++++ ghc/GHCi/UI.hs | 15 +++++++- ghc/ghc-bin.cabal.in | 1 + testsuite/config/ghc | 2 +- testsuite/tests/ghci/scripts/T9293.stdout | 4 ++ testsuite/tests/ghci/scripts/ghci057.stdout | 4 ++ 8 files changed, 96 insertions(+), 2 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5fe6aaa3756cda654374ebfd883fa8f064ff64a4 From git at git.haskell.org Thu May 10 08:54:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 May 2018 08:54:03 +0000 (UTC) Subject: [commit: ghc] master: Fix #15038 (b2ff5dd) Message-ID: <20180510085403.A1BCE3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b2ff5dde399cd012218578945ada1d9ff68daa35/ghc >--------------------------------------------------------------- commit b2ff5dde399cd012218578945ada1d9ff68daa35 Author: Ömer Sinan Ağacan Date: Thu May 10 11:13:37 2018 +0300 Fix #15038 We introduce a new Id for unused pointer values in unboxed sums that is not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY definitions CAFFY, fixing #15038. To make sure anything referenced by the new id will be retained we get a stable pointer to in on RTS startup. Test Plan: Passes validate Reviewers: simonmar, simonpj, hvr, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15038 Differential Revision: https://phabricator.haskell.org/D4680 >--------------------------------------------------------------- b2ff5dde399cd012218578945ada1d9ff68daa35 compiler/coreSyn/MkCore.hs | 36 ++++- compiler/prelude/PrelNames.hs | 7 +- compiler/simplStg/UnariseStg.hs | 5 +- libraries/base/Control/Exception/Base.hs | 6 +- rts/Prelude.h | 2 + rts/RtsStartup.c | 7 + testsuite/tests/codeGen/should_run/T15038/Makefile | 9 ++ testsuite/tests/codeGen/should_run/T15038/all.T | 4 + .../should_run/T15038/common/Data/Trie/Naive.hs | 80 ++++++++++ .../codeGen/should_run/T15038/src/Packed/Bytes.hs | 80 ++++++++++ .../should_run/T15038/src/Packed/Bytes/Parser.hs | 165 +++++++++++++++++++++ .../T15038/src/Packed/Bytes/Stream/ST.hs | 61 ++++++++ .../tests/codeGen/should_run/T15038/test/Main.hs | 4 + .../tests/codeGen/should_run/T15038/test/Parser.hs | 61 ++++++++ 14 files changed, 518 insertions(+), 9 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 b2ff5dde399cd012218578945ada1d9ff68daa35 From git at git.haskell.org Thu May 10 15:06:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 May 2018 15:06:13 +0000 (UTC) Subject: [commit: ghc] master: rts: remove unused round_up_to_mblocks function (e5bb515) Message-ID: <20180510150613.7A6013ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5bb515e651e33fadc90c016c28553f2e9d8a956/ghc >--------------------------------------------------------------- commit e5bb515e651e33fadc90c016c28553f2e9d8a956 Author: Ömer Sinan Ağacan Date: Thu May 10 18:05:51 2018 +0300 rts: remove unused round_up_to_mblocks function >--------------------------------------------------------------- e5bb515e651e33fadc90c016c28553f2e9d8a956 includes/rts/storage/Block.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h index 9ba0b15..ecd6bf5 100644 --- a/includes/rts/storage/Block.h +++ b/includes/rts/storage/Block.h @@ -338,13 +338,4 @@ round_to_mblocks(StgWord words) return words; } -INLINE_HEADER StgWord -round_up_to_mblocks(StgWord words) -{ - words += FIRST_BLOCK_OFF/sizeof(W_); - words = ((words / MBLOCK_SIZE_W) + 1) * MBLOCK_SIZE_W; - words -= FIRST_BLOCK_OFF/sizeof(W_); - return words; -} - #endif /* !CMINUSMINUS */ From git at git.haskell.org Thu May 10 16:40:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 May 2018 16:40:25 +0000 (UTC) Subject: [commit: ghc] master: Revert "Add -fghci-leak-check to check for space leaks" (87e169a) Message-ID: <20180510164025.5C5C83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/87e169a30dae11444a90b4d37c3d30e57b9c275b/ghc >--------------------------------------------------------------- commit 87e169a30dae11444a90b4d37c3d30e57b9c275b Author: Simon Marlow Date: Thu May 10 17:39:53 2018 +0100 Revert "Add -fghci-leak-check to check for space leaks" This reverts commit 5fe6aaa3756cda654374ebfd883fa8f064ff64a4. >--------------------------------------------------------------- 87e169a30dae11444a90b4d37c3d30e57b9c275b compiler/main/DynFlags.hs | 2 - docs/users_guide/ghci.rst | 11 ------ ghc/GHCi/Leak.hs | 59 ----------------------------- ghc/GHCi/UI.hs | 15 +------- ghc/ghc-bin.cabal.in | 1 - testsuite/config/ghc | 2 +- testsuite/tests/ghci/scripts/T9293.stdout | 4 -- testsuite/tests/ghci/scripts/ghci057.stdout | 4 -- 8 files changed, 2 insertions(+), 96 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 87e169a30dae11444a90b4d37c3d30e57b9c275b From git at git.haskell.org Fri May 11 07:24:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 May 2018 07:24:31 +0000 (UTC) Subject: [commit: ghc] master: BlockAlloc.c: reuse tail_of function (40a76c9) Message-ID: <20180511072431.EBA593ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/40a76c99624ae82e960bad0f1c832ddec4aece16/ghc >--------------------------------------------------------------- commit 40a76c99624ae82e960bad0f1c832ddec4aece16 Author: Ömer Sinan Ağacan Date: Fri May 11 10:24:00 2018 +0300 BlockAlloc.c: reuse tail_of function >--------------------------------------------------------------- 40a76c99624ae82e960bad0f1c832ddec4aece16 rts/sm/BlockAlloc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index 2a02ecc..bbb4f8a 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -210,6 +210,12 @@ void recordFreedBlocks(uint32_t node, uint32_t n) Allocation -------------------------------------------------------------------------- */ +STATIC_INLINE bdescr * +tail_of (bdescr *bd) +{ + return bd + bd->blocks - 1; +} + STATIC_INLINE void initGroup(bdescr *head) { @@ -223,7 +229,7 @@ initGroup(bdescr *head) // mblocks don't have bdescrs; freeing these is handled in a // different way by free_mblock_group(). if (head->blocks > 1 && head->blocks <= BLOCKS_PER_MBLOCK) { - bdescr *last = head + head->blocks-1; + bdescr *last = tail_of(head); last->blocks = 0; last->link = head; } @@ -285,13 +291,6 @@ free_list_insert (uint32_t node, bdescr *bd) dbl_link_onto(bd, &free_list[node][ln]); } - -STATIC_INLINE bdescr * -tail_of (bdescr *bd) -{ - return bd + bd->blocks - 1; -} - // After splitting a group, the last block of each group must have a // tail that points to the head block, to keep our invariants for // coalescing. From git at git.haskell.org Fri May 11 11:02:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 May 2018 11:02:31 +0000 (UTC) Subject: [commit: ghc] master: Fix unwinding of C -> Haskell FFI calls with -threaded (cb5c2fe) Message-ID: <20180511110231.1B07A3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb5c2fe875965b7aedbc189012803fc62e48fb3f/ghc >--------------------------------------------------------------- commit cb5c2fe875965b7aedbc189012803fc62e48fb3f Author: Bartosz Nitka Date: Thu May 3 10:43:38 2018 -0700 Fix unwinding of C -> Haskell FFI calls with -threaded See the new note. Test Plan: manual testing with patched gdb Reviewers: bgamari, simonmar, erikd Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4666 >--------------------------------------------------------------- cb5c2fe875965b7aedbc189012803fc62e48fb3f includes/rts/Constants.h | 13 ++++ rts/RtsMessages.c | 4 +- rts/RtsUtils.h | 3 + rts/StgCRun.c | 175 ++++++++++++++++++++++++++++++++++++++++++++--- rts/StgStartup.cmm | 18 +---- 5 files changed, 185 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 cb5c2fe875965b7aedbc189012803fc62e48fb3f From git at git.haskell.org Fri May 11 21:21:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 May 2018 21:21:16 +0000 (UTC) Subject: [commit: ghc] branch 'arcpatch-D4679' created Message-ID: <20180511212116.85EEC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : arcpatch-D4679 Referencing: a98f8a7dd2bae870c45570525182690122666e90 From git at git.haskell.org Fri May 11 21:21:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 May 2018 21:21:19 +0000 (UTC) Subject: [commit: ghc] arcpatch-D4679: RTS: Auto-size the allocation area depending on CPU cache size (a98f8a7) Message-ID: <20180511212119.5464B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : arcpatch-D4679 Link : http://ghc.haskell.org/trac/ghc/changeset/a98f8a7dd2bae870c45570525182690122666e90/ghc >--------------------------------------------------------------- commit a98f8a7dd2bae870c45570525182690122666e90 Author: Simon Jakobi Date: Fri May 11 17:20:58 2018 -0400 RTS: Auto-size the allocation area depending on CPU cache size Summary: Looks for L3 and L2 caches and sets the size of the allocation area to the size of the largest cache found. If we can't find anything, use the existing default of 1MB. Implemented for Linux, Windows, and Darwin. Tested on Linux and 64bit Windows only so far. Reviewers: bgamari, erikd, simonmar Subscribers: dfeuer, Phyx, AndreasK, rwbarton, thomie, carter GHC Trac Issues: #13362 Differential Revision: https://phabricator.haskell.org/D4679 >--------------------------------------------------------------- a98f8a7dd2bae870c45570525182690122666e90 rts/RtsFlags.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- rts/ghc.mk | 10 ++++---- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 7c292d2..d000c49 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -33,6 +33,14 @@ #include +#if defined(mingw32_HOST_OS) +#include +#endif + +#if defined(darwin_HOST_OS) +#include +#endif + // Flag Structure RTS_FLAGS RtsFlags; @@ -124,6 +132,8 @@ static void setProgName (char *argv[]); static void errorRtsOptsDisabled (const char *s); +static StgWord32 largestCpuCacheSize(void); + /* ----------------------------------------------------------------------------- * Command-line option parsing routines. * ---------------------------------------------------------------------------*/ @@ -135,6 +145,10 @@ void initRtsFlagsDefaults(void) if (maxStkSize == 0) maxStkSize = 8 * 1024 * 1024; + StgWord32 minAllocAreaSize = largestCpuCacheSize(); + if (minAllocAreaSize == 0) + minAllocAreaSize = 1024 * 1024; + RtsFlags.GcFlags.statsFile = NULL; RtsFlags.GcFlags.giveStats = NO_GC_STATS; @@ -143,7 +157,7 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.stkChunkSize = (32 * 1024) / sizeof(W_); RtsFlags.GcFlags.stkChunkBufferSize = (1 * 1024) / sizeof(W_); - RtsFlags.GcFlags.minAllocAreaSize = (1024 * 1024) / BLOCK_SIZE; + RtsFlags.GcFlags.minAllocAreaSize = minAllocAreaSize / BLOCK_SIZE; RtsFlags.GcFlags.largeAllocLim = 0; /* defaults to minAllocAreasize */ RtsFlags.GcFlags.nurseryChunkSize = 0; RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE; @@ -2235,6 +2249,67 @@ void freeRtsArgs(void) freeRtsArgv(); } +// Return the size in bytes of the largest L3 or L2 CPU cache on the system. +// Returns 0 if the cache size can't be determined. +static StgWord32 largestCpuCacheSize(void) +{ +#if defined(linux_HOST_OS) + int args[2] = { + _SC_LEVEL3_CACHE_SIZE, + _SC_LEVEL2_CACHE_SIZE, + }; + for (int i = 0; i < 2; i++) { + long size = sysconf(args[i]); + if (size > 0L) + return (StgWord32)size; + } +#elif defined(mingw32_HOST_OS) + DWORD max_cache_size = 0; + + DWORD buffer_size = 0; + // Determine the necessary buffer size + GetLogicalProcessorInformationEx(RelationCache, NULL, &buffer_size); + + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* buffer = + (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc(buffer_size); + + BOOL ok = + GetLogicalProcessorInformationEx(RelationCache, buffer, &buffer_size); + if (!ok) + sysErrorBelch("GetLogicalProcessorInformationEx failed"); + + // SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX is a variable-size structure, so + // we progress by adding the size of the current SLPIE to the pointer. + for (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* p = buffer; + (char*)p < (char*)buffer + buffer_size; + p = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*) + ((char*)p + p->Size)) { + + if (p->Relationship == RelationCache) { + CACHE_RELATIONSHIP cache = p->Cache; + if ((cache.Type == CacheUnified || cache.Type == CacheData) && + (cache.Level == 2 || cache.Level == 3) && + cache.CacheSize > max_cache_size) + max_cache_size = cache.CacheSize; + } else + debugBelch("Unexpected Relationship %u", p->Relationship); + } + free(buffer); + return (StgWord32)max_cache_size; +#elif defined(darwin_HOST_OS) + // TODO: The following code might also work on FreeBSD. + // Enable it if you can test it. + char* args[2] = { "hw.l3cachesize", "hw.l2cachesize" }; + StgWord32 cache_size = 0; + size_t data_size = sizeof(cache_size); + for (int i = 0; i < 2; i++) { + int ret = sysctlbyname(args[i], &cache_size, &data_size, NULL, 0); + if (ret == 0 && cache_size > 0) + return cache_size; + } +#endif + return 0; +} /* Note [OPTION_SAFE vs OPTION_UNSAFE] diff --git a/rts/ghc.mk b/rts/ghc.mk index e96e147..95e602f 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -22,10 +22,10 @@ rts_VERSION = 1.0 # Minimum supported Windows version. # These numbers can be found at: # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx -# If we're compiling on windows, enforce that we only support Vista SP1+ +# If we're compiling on windows, enforce that we only support Windows 7 and newer. # Adding this here means it doesn't have to be done in individual .c files # and also centralizes the versioning. -rts_WINVER = 0x06000100 +rts_WINVER = 0x0601 # merge GhcLibWays and GhcRTSWays but strip out duplicates rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays)) @@ -192,11 +192,10 @@ endif rts_dist_$1_CC_OPTS += -DRtsWay=\"rts_$1\" -# If we're compiling on windows, enforce that we only support XP+ -# Adding this here means it doesn't have to be done in individual .c files -# and also centralizes the versioning. +# Windows version requirement ifeq "$$(TargetOS_CPP)" "mingw32" rts_dist_$1_CC_OPTS += -DWINVER=$(rts_WINVER) +rts_dist_$1_CC_OPTS += -D_WIN32_WINNT=$(rts_WINVER) endif ifneq "$$(UseSystemLibFFI)" "YES" @@ -372,6 +371,7 @@ endif # Set Windows version ifeq "$$(TargetOS_CPP)" "mingw32" rts_CC_OPTS += -DWINVER=$(rts_WINVER) +rts_CC_OPTS += -D_WIN32_WINNT=$(rts_WINVER) endif #----------------------------------------------------------------------------- From git at git.haskell.org Sat May 12 08:11:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 May 2018 08:11:27 +0000 (UTC) Subject: [commit: ghc] master: Expand $tooldir in ghc --info output (3781034) Message-ID: <20180512081127.BD5D23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/37810347dfeda977e7036cf8bc87ba079f094baa/ghc >--------------------------------------------------------------- commit 37810347dfeda977e7036cf8bc87ba079f094baa Author: Alp Mestanogullari Date: Sat May 12 08:36:19 2018 +0100 Expand $tooldir in ghc --info output Summary: This requires adding an `sToolDir :: Maybe FilePath` field to Settings, since compilerInfo is pure and therefore needs to have all the information available in the DynFlags. This should fix #15101 and #15107. Test Plan: ./validate --fast Reviewers: Phyx, bgamari Reviewed By: Phyx Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15101, #15107 Differential Revision: https://phabricator.haskell.org/D4686 >--------------------------------------------------------------- 37810347dfeda977e7036cf8bc87ba079f094baa compiler/main/DynFlags.hs | 18 ++++++++++++------ compiler/main/SysTools.hs | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 6bfa8f2..bd3e2a0 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -206,7 +206,7 @@ import {-# SOURCE #-} ErrUtils ( Severity(..), MsgDoc, mkLocMessageAnn , getCaretDiagnostic, dumpSDoc ) import Json import SysTools.Terminal ( stderrSupportsAnsiColors ) -import SysTools.BaseDir ( expandTopDir ) +import SysTools.BaseDir ( expandToolDir, expandTopDir ) import System.IO.Unsafe ( unsafePerformIO ) import Data.IORef @@ -1148,10 +1148,11 @@ data LlvmTarget = LlvmTarget type LlvmTargets = [(String, LlvmTarget)] data Settings = Settings { - sTargetPlatform :: Platform, -- Filled in by SysTools - sGhcUsagePath :: FilePath, -- Filled in by SysTools - sGhciUsagePath :: FilePath, -- ditto - sTopDir :: FilePath, + sTargetPlatform :: Platform, -- Filled in by SysTools + sGhcUsagePath :: FilePath, -- ditto + sGhciUsagePath :: FilePath, -- ditto + sToolDir :: Maybe FilePath, -- ditto + sTopDir :: FilePath, -- ditto sTmpDir :: String, -- no trailing '/' sProgramName :: String, sProjectVersion :: String, @@ -1211,6 +1212,8 @@ ghcUsagePath :: DynFlags -> FilePath ghcUsagePath dflags = sGhcUsagePath (settings dflags) ghciUsagePath :: DynFlags -> FilePath ghciUsagePath dflags = sGhciUsagePath (settings dflags) +toolDir :: DynFlags -> Maybe FilePath +toolDir dflags = sToolDir (settings dflags) topDir :: DynFlags -> FilePath topDir dflags = sTopDir (settings dflags) tmpDir :: DynFlags -> String @@ -5301,7 +5304,8 @@ compilerInfo dflags -- Next come the settings, so anything else can be overridden -- in the settings file (as "lookup" uses the first match for the -- key) - : map (fmap $ expandTopDir $ topDir dflags) (rawSettings dflags) + : map (fmap $ expandDirectories (topDir dflags) (toolDir dflags)) + (rawSettings dflags) ++ [("Project version", projectVersion dflags), ("Project Git commit id", cProjectGitCommitId), ("Booter version", cBooterVersion), @@ -5352,6 +5356,8 @@ compilerInfo dflags showBool True = "YES" showBool False = "NO" isWindows = platformOS (targetPlatform dflags) == OSMinGW32 + expandDirectories :: FilePath -> Maybe FilePath -> String -> String + expandDirectories topd mtoold = expandToolDir mtoold . expandTopDir topd -- Produced by deriveConstants #include "GHCConstantsHaskellWrappers.hs" diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index baf70df..619e0b6 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -277,6 +277,7 @@ initSysTools mbMinusB sTmpDir = normalise tmpdir, sGhcUsagePath = ghc_usage_msg_path, sGhciUsagePath = ghci_usage_msg_path, + sToolDir = mtool_dir, sTopDir = top_dir, sRawSettings = mySettings, sExtraGccViaCFlags = words myExtraGccViaCFlags, From git at git.haskell.org Sat May 12 08:11:30 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 May 2018 08:11:30 +0000 (UTC) Subject: [commit: ghc] master: Adds CTRL-C handler in Windows's timeout (trac issue #12721) (2323ffd) Message-ID: <20180512081130.8DD3A3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2323ffdd552327a8954de8ac37908029ec7cad38/ghc >--------------------------------------------------------------- commit 2323ffdd552327a8954de8ac37908029ec7cad38 Author: ARJANEN Loïc Jean David Date: Sat May 12 08:35:27 2018 +0100 Adds CTRL-C handler in Windows's timeout (trac issue #12721) Summary: Uses Win32's System.Win32.Console.CtrlHandler.withConsoleCtrlHandler to add to Windows's version of the timeout executable a CTRL-C/CTRL-BREAK handler which does the close IO port/kill job cleanup, just in case. Signed-off-by: ARJANEN Loïc Jean David Reviewers: Phyx, bgamari Reviewed By: Phyx Subscribers: dfeuer, thomie, carter GHC Trac Issues: #12721 Differential Revision: https://phabricator.haskell.org/D4631 >--------------------------------------------------------------- 2323ffdd552327a8954de8ac37908029ec7cad38 testsuite/timeout/timeout.hs | 55 ++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/testsuite/timeout/timeout.hs b/testsuite/timeout/timeout.hs index f72efe3..9f3044f 100644 --- a/testsuite/timeout/timeout.hs +++ b/testsuite/timeout/timeout.hs @@ -1,4 +1,5 @@ {-# OPTIONS -cpp #-} +{-# LANGUAGE LambdaCase #-} module Main where import Control.Concurrent (forkIO, threadDelay) @@ -21,6 +22,7 @@ import WinCBindings import Foreign import System.Win32.DebugApi import System.Win32.Types +import System.Win32.Console.CtrlHandler #endif main :: IO () @@ -129,28 +131,35 @@ run secs cmd = let handleInterrupt action = action `onException` terminateJobObject job 99 - - handleInterrupt $ do - resumeThread (piThread pi) - -- The program is now running - let handle = piProcess pi - let millisecs = secs * 1000 - rc <- waitForJobCompletion job ioPort (fromIntegral millisecs) - closeHandle ioPort - - if not rc - then do terminateJobObject job 99 - closeHandle job - exitWith (ExitFailure 99) - else alloca $ \p_exitCode -> - do terminateJobObject job 0 -- Ensure it's all really dead. - closeHandle job - r <- getExitCodeProcess handle p_exitCode - if r then do ec <- peek p_exitCode - let ec' = if ec == 0 - then ExitSuccess - else ExitFailure $ fromIntegral ec - exitWith ec' - else errorWin "getExitCodeProcess" + handleCtrl _ = do + terminateJobObject job 99 + closeHandle ioPort + closeHandle job + exitWith (ExitFailure 99) + return True + + withConsoleCtrlHandler handleCtrl $ + handleInterrupt $ do + resumeThread (piThread pi) + -- The program is now running + let handle = piProcess pi + let millisecs = secs * 1000 + rc <- waitForJobCompletion job ioPort (fromIntegral millisecs) + closeHandle ioPort + + if not rc + then do terminateJobObject job 99 + closeHandle job + exitWith (ExitFailure 99) + else alloca $ \p_exitCode -> + do terminateJobObject job 0 + -- Ensured it's all really dead. + closeHandle job + r <- getExitCodeProcess handle p_exitCode + if r + then peek p_exitCode >>= \case + 0 -> exitWith ExitSuccess + e -> exitWith $ ExitFailure (fromIntegral e) + else errorWin "getExitCodeProcess" #endif From git at git.haskell.org Sat May 12 14:31:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 May 2018 14:31:54 +0000 (UTC) Subject: [commit: ghc] master: Revert "Fix unwinding of C -> Haskell FFI calls with -threaded" (bec2e71) Message-ID: <20180512143154.25E643ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bec2e71e9869815c058dda9ebb6eb483352aa480/ghc >--------------------------------------------------------------- commit bec2e71e9869815c058dda9ebb6eb483352aa480 Author: Bartosz Nitka Date: Sat May 12 07:31:20 2018 -0700 Revert "Fix unwinding of C -> Haskell FFI calls with -threaded" This reverts commit cb5c2fe875965b7aedbc189012803fc62e48fb3f. It appears to have broken OSX and Windows builds. >--------------------------------------------------------------- bec2e71e9869815c058dda9ebb6eb483352aa480 includes/rts/Constants.h | 13 ---- rts/RtsMessages.c | 4 +- rts/RtsUtils.h | 3 - rts/StgCRun.c | 175 +++-------------------------------------------- rts/StgStartup.cmm | 18 ++++- 5 files changed, 28 insertions(+), 185 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 bec2e71e9869815c058dda9ebb6eb483352aa480 From git at git.haskell.org Sat May 12 17:40:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 May 2018 17:40:13 +0000 (UTC) Subject: [commit: ghc] master: Use correct source spans for EmptyCase (78db41e) Message-ID: <20180512174013.2AF123ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/78db41eaa806206001b80b3d225cd254435a2f83/ghc >--------------------------------------------------------------- commit 78db41eaa806206001b80b3d225cd254435a2f83 Author: Ryan Scott Date: Sat May 12 12:56:30 2018 -0400 Use correct source spans for EmptyCase Summary: The parser's calculation of source spans for `EmptyCase` expressions was a bit off, leading to some wonky-looking error messages. Easily fixed with some uses of `comb3` and `sLL`. Test Plan: make test TEST=T15139 Reviewers: bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, mpickering, carter GHC Trac Issues: #15139 Differential Revision: https://phabricator.haskell.org/D4685 >--------------------------------------------------------------- 78db41eaa806206001b80b3d225cd254435a2f83 compiler/parser/Parser.y | 5 +++-- testsuite/tests/parser/should_compile/T15139.hs | 13 +++++++++++++ testsuite/tests/parser/should_compile/T15139.stderr | 21 +++++++++++++++++++++ testsuite/tests/parser/should_compile/all.T | 1 + 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index a7c875e..4c66fd7 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -2573,7 +2573,8 @@ aexp :: { LHsExpr GhcPs } ams (sLL $1 $> $ HsMultiIf noExt (reverse $ snd $ unLoc $2)) (mj AnnIf $1:(fst $ unLoc $2)) } - | 'case' exp 'of' altslist {% ams (sLL $1 $> $ HsCase noExt $2 (mkMatchGroup + | 'case' exp 'of' altslist {% ams (L (comb3 $1 $3 $4) $ + HsCase noExt $2 (mkMatchGroup FromSource (snd $ unLoc $4))) (mj AnnCase $1:mj AnnOf $3 :(fst $ unLoc $4)) } @@ -2874,7 +2875,7 @@ altslist :: { Located ([AddAnn],[LMatch GhcPs (LHsExpr GhcPs)]) } ,(reverse (snd $ unLoc $2))) } | vocurly alts close { L (getLoc $2) (fst $ unLoc $2 ,(reverse (snd $ unLoc $2))) } - | '{' '}' { noLoc ([moc $1,mcc $2],[]) } + | '{' '}' { sLL $1 $> ([moc $1,mcc $2],[]) } | vocurly close { noLoc ([],[]) } alts :: { Located ([AddAnn],[LMatch GhcPs (LHsExpr GhcPs)]) } diff --git a/testsuite/tests/parser/should_compile/T15139.hs b/testsuite/tests/parser/should_compile/T15139.hs new file mode 100644 index 0000000..9f98bb1 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T15139.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE EmptyCase #-} +{-# LANGUAGE TypeOperators #-} +module T15139 where + +import Data.Type.Equality + +can'tHappen :: Int :~: Bool +can'tHappen = undefined + +f1, f2, g :: Bool -> Bool +f1 True = case can'tHappen of {} +f2 True = case can'tHappen of +g True = case () of () -> True diff --git a/testsuite/tests/parser/should_compile/T15139.stderr b/testsuite/tests/parser/should_compile/T15139.stderr new file mode 100644 index 0000000..010bd74 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T15139.stderr @@ -0,0 +1,21 @@ + +T15139.hs:11:1: warning: [-Wincomplete-patterns (in -Wextra)] + Pattern match(es) are non-exhaustive + In an equation for ‘f1’: Patterns not matched: False + | +11 | f1 True = case can'tHappen of {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +T15139.hs:12:1: warning: [-Wincomplete-patterns (in -Wextra)] + Pattern match(es) are non-exhaustive + In an equation for ‘f2’: Patterns not matched: False + | +12 | f2 True = case can'tHappen of + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +T15139.hs:13:1: warning: [-Wincomplete-patterns (in -Wextra)] + Pattern match(es) are non-exhaustive + In an equation for ‘g’: Patterns not matched: False + | +13 | g True = case () of () -> True + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index f323976..ab0a393 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -115,3 +115,4 @@ test('T13747', normal, compile, ['']) test('T14189', normal, compile, ['-dsuppress-uniques -ddump-rn-ast']) test('T13986', normal, compile, ['']) test('T10855', normal, compile, ['']) +test('T15139', normal, compile, ['-Wincomplete-patterns -fdiagnostics-show-caret']) From git at git.haskell.org Sun May 13 17:34:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 17:34:51 +0000 (UTC) Subject: [commit: ghc] master: Emit info-level log message when package envs are loaded (00049e2) Message-ID: <20180513173451.C40E93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/00049e2dce93b1e468c3fde3287371eb988aafdc/ghc >--------------------------------------------------------------- commit 00049e2dce93b1e468c3fde3287371eb988aafdc Author: Herbert Valerio Riedel Date: Sun May 13 19:32:29 2018 +0200 Emit info-level log message when package envs are loaded A common complaint with the new package environment files feature is that it's not obvious when package environments have been picked up. This patch applies the same strategy that was already used for `.ghci` files (which exhibit similar potential for confusion, c.f. #11389) to package environment files. For instance, this new notification looks like below for a GHCi invocation which loads both, a GHCi configuration as well as a package environment: GHCi, version 8.5.20180512: http://www.haskell.org/ghc/ :? for help Loaded package environment from /tmp/parsec-3.1.13.0/.ghc.environment.x86_64-linux-8.5.20180512 Loaded GHCi configuration from /home/hvr/.ghci Prelude> Addresses #15145 Reviewed By: bgamari, angerman GHC Trac Issues: #15145 Differential Revision: https://phabricator.haskell.org/D4689 >--------------------------------------------------------------- 00049e2dce93b1e468c3fde3287371eb988aafdc compiler/main/DynFlags.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index bd3e2a0..6e839cc 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -4959,6 +4959,9 @@ interpretPackageEnv dflags = do return dflags Just envfile -> do content <- readFile envfile + putLogMsg dflags NoReason SevInfo noSrcSpan + (defaultUserStyle dflags) + (text ("Loaded package environment from " ++ envfile)) let setFlags :: DynP () setFlags = do setGeneralFlag Opt_HideAllPackages From git at git.haskell.org Sun May 13 21:07:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 21:07:43 +0000 (UTC) Subject: [commit: packages/array] master: Generate a fresh Travis config file using the haskell-ci script (82a29b1) Message-ID: <20180513210743.5F93F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/82a29b198a67f54de2f72d96ca077800afbfbe4f >--------------------------------------------------------------- commit 82a29b198a67f54de2f72d96ca077800afbfbe4f Author: Chaitanya Koparkar Date: Sun May 13 11:45:39 2018 -0400 Generate a fresh Travis config file using the haskell-ci script Summary: The old Travis script still had targets to test against GHC < 8.0, and wasn't using Cabal `new-build` among other things. Reviewers: bgamari, RyanGlScott Reviewed By: RyanGlScott Differential Revision: https://phabricator.haskell.org/D4681 >--------------------------------------------------------------- 82a29b198a67f54de2f72d96ca077800afbfbe4f .gitignore | 5 +++ .travis.yml | 122 +++++++++++++++++++++++++++++++++++++++++++++++------------- array.cabal | 2 +- 3 files changed, 103 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 8fe129e..3b317ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ +cabal.project.local +cabal.project.local~ + # Specific generated files GNUmakefile dist-install/ dist/ +dist-newstyle/ +.ghc.environment.* ghc.mk diff --git a/.travis.yml b/.travis.yml index cfffef3..327a7b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,106 @@ -env: - - GHCVER=7.8.4 - - GHCVER=7.10.3 - - GHCVER=8.0.2 - - GHCVER=8.2.1 - - GHCVER=head +# This Travis job script has been generated by a script via +# +# runghc make_travis_yml_2.hs 'array.cabal' +# +# For more information, see https://github.com/hvr/multi-ghc-travis +# +language: c +sudo: false + +git: + submodules: false # whether to recursively clone submodules + +cache: + directories: + - $HOME/.cabal/packages + - $HOME/.cabal/store + +before_cache: + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + # remove files that are regenerated by 'cabal update' + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx + + - rm -rfv $HOME/.cabal/packages/head.hackage matrix: + include: + - compiler: "ghc-8.0.2" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}} + - compiler: "ghc-8.2.1" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}} + - compiler: "ghc-8.4.2" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.2], sources: [hvr-ghc]}} + - compiler: "ghc-head" + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}} + allow_failures: - - env: GHCVER=head + - compiler: "ghc-head" before_install: - - sudo add-apt-repository -y ppa:hvr/ghc - - sudo apt-get update - - sudo apt-get install cabal-install-head ghc-$GHCVER - - export PATH=/opt/ghc/bin:$PATH + - HC=${CC} + - HCPKG=${HC/ghc/ghc-pkg} + - unset CC + - ROOTDIR=$(pwd) + - mkdir -p $HOME/.local/bin + - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH" + - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') )) + - echo $HCNUMVER install: - - cabal update - - ghc --version + - cabal --version + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" + - BENCH=${BENCH---enable-benchmarks} + - TEST=${TEST---enable-tests} + - HADDOCK=${HADDOCK-true} + - INSTALLED=${INSTALLED-true} + - GHCHEAD=${GHCHEAD-false} + - travis_retry cabal update -v + - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config" + - rm -fv cabal.project cabal.project.local + - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' + - "printf 'packages: \".\"\\n' > cabal.project" + - cat cabal.project + - if [ -f "./configure.ac" ]; then + (cd "." && autoreconf -i); + fi + - rm -f cabal.project.freeze + - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all + - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all + - rm -rf .ghc.environment.* "."/dist + - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) +# Here starts the actual work to be performed for the package under test; +# any command which exits with a non-zero exit code causes the build to fail. script: - - cabal configure -v2 - - cabal build - - cabal check - - cabal sdist - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; - cd dist/; - if [ -f "$SRC_TGZ" ]; then - cabal install "$SRC_TGZ"; - else - echo "expected '$SRC_TGZ' not found"; - exit 1; - fi + # test that source-distributions can be generated + - (cd "." && cabal sdist) + - mv "."/dist/array-*.tar.gz ${DISTDIR}/ + - cd ${DISTDIR} || false + - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; + - "printf 'packages: array-*/*.cabal\\n' > cabal.project" + - cat cabal.project + # this builds all libraries and executables (without tests/benchmarks) + - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all + + # # Build with installed constraints for packages in global-db + # - if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi + + # build & run tests, build benchmarks + - cabal new-build -w ${HC} ${TEST} ${BENCH} all + + # cabal check + - (cd array-* && cabal check) + + # haddock + - rm -rf ./dist-newstyle + - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi + +# REGENDATA ["array.cabal"] +# EOF diff --git a/array.cabal b/array.cabal index f19de50..928a7f6 100644 --- a/array.cabal +++ b/array.cabal @@ -9,7 +9,7 @@ synopsis: Mutable and immutable arrays category: Data Structures build-type: Simple cabal-version: >=1.10 -tested-with: GHC==8.4.1, GHC==8.2.1, GHC==8.0.2 +tested-with: GHC==8.4.2, GHC==8.2.1, GHC==8.0.2 description: In addition to providing the "Data.Array" module , From git at git.haskell.org Sun May 13 22:31:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 22:31:00 +0000 (UTC) Subject: [commit: ghc] master: Simplify -ddump-json implementation (6ab7cf9) Message-ID: <20180513223100.85FD53ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ab7cf995dafcc9196e87bbde76b4f6937507592/ghc >--------------------------------------------------------------- commit 6ab7cf995dafcc9196e87bbde76b4f6937507592 Author: Matthew Pickering Date: Sun May 13 11:39:34 2018 -0400 Simplify -ddump-json implementation This patch takes the much simpler route of whenever the compiler tries to output something. We just dump a JSON document there and then. I think this should be sufficient to work with and anything more refined quickly got complicated as it was necessary to demarcate message scopes and so on. Reviewers: bgamari, dfeuer Reviewed By: bgamari Subscribers: Phyx, dfeuer, rwbarton, thomie, carter GHC Trac Issues: #14078 Differential Revision: https://phabricator.haskell.org/D4532 >--------------------------------------------------------------- 6ab7cf995dafcc9196e87bbde76b4f6937507592 compiler/main/DriverPipeline.hs | 3 +- compiler/main/DynFlags.hs | 87 +++++++++---------------------------- compiler/main/GHC.hs | 8 ++-- testsuite/tests/driver/json.stderr | 9 +--- testsuite/tests/driver/json2.stderr | 10 +---- 5 files changed, 27 insertions(+), 90 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 6ab7cf995dafcc9196e87bbde76b4f6937507592 From git at git.haskell.org Sun May 13 22:31:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 22:31:15 +0000 (UTC) Subject: [commit: ghc] master: base: Fix handling of showEFloat (Just 0) (9039f84) Message-ID: <20180513223115.DF1823ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9039f847a568ac69436d449b9fe090ecd03b9e06/ghc >--------------------------------------------------------------- commit 9039f847a568ac69436d449b9fe090ecd03b9e06 Author: Ben Gamari Date: Sun May 13 11:40:18 2018 -0400 base: Fix handling of showEFloat (Just 0) Previously `showEFloat (Just 0) pi ""` would produce `3.0e0`. Of course, this blatantly disrespects the user's request to print with zero digits of precision. Fix this. This is tested by base's `num008` testcase. Test Plan: Validate Reviewers: hvr Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15115 Differential Revision: https://phabricator.haskell.org/D4665 >--------------------------------------------------------------- 9039f847a568ac69436d449b9fe090ecd03b9e06 libraries/base/GHC/Float.hs | 10 +++++++ libraries/base/changelog.md | 3 +++ libraries/base/tests/Numeric/num008.stdout | 42 +++++++++++++++--------------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/libraries/base/GHC/Float.hs b/libraries/base/GHC/Float.hs index d60c660..db4200d 100644 --- a/libraries/base/GHC/Float.hs +++ b/libraries/base/GHC/Float.hs @@ -690,6 +690,16 @@ formatRealFloatAlt fmt decs alt x [d] -> d : ".0e" ++ show_e' (d:ds') -> d : '.' : ds' ++ "e" ++ show_e' [] -> errorWithoutStackTrace "formatRealFloat/doFmt/FFExponent: []" + Just 0 -> + -- handle this case specifically since we need to omit the + -- decimal point as well (#15115) + case is of + [0] -> "0e0" + _ -> + let + (ei,is') = roundTo base 1 is + d:_ = map intToDigit (if ei > 0 then init is' else is') + in d : 'e' : show (e-1+ei) Just dec -> let dec' = max dec 1 in case is of diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index d4b9efa..f239073 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -17,6 +17,9 @@ * `asinh` for `Float` and `Double` is now numerical stable in the face of large negative arguments (#14927) + * `Numeric.showEFloat (Just 0)` now respects the user's requested precision. + (#15115) + ## 4.11.1.0 *TBA* * Bundled with GHC 8.4.2 diff --git a/libraries/base/tests/Numeric/num008.stdout b/libraries/base/tests/Numeric/num008.stdout index 5086442..116998c 100644 --- a/libraries/base/tests/Numeric/num008.stdout +++ b/libraries/base/tests/Numeric/num008.stdout @@ -6,14 +6,14 @@ 4.2000000e-2 1.8217369e0 1.8217369e-300 -0.0e0 -4.2e2 -4.2e1 -4.2e0 -4.2e-1 -4.2e-2 -1.8e0 -1.8e-300 +0e0 +4e2 +4e1 +4e0 +4e-1 +4e-2 +2e0 +2e-300 0.0e0 4.2e2 4.2e1 @@ -59,9 +59,9 @@ 42 4 0 -4.2e-2 +4e-2 2 -1.8e-300 +2e-300 0.0 420.0 42.0 @@ -79,14 +79,14 @@ 4.2000000e-2 1.8217369e0 0.0000000e0 -0.0e0 -4.2e2 -4.2e1 -4.2e0 -4.2e-1 -4.2e-2 -1.8e0 -0.0e0 +0e0 +4e2 +4e1 +4e0 +4e-1 +4e-2 +2e0 +0e0 0.0e0 4.2e2 4.2e1 @@ -132,7 +132,7 @@ 42 4 0 -4.2e-2 +4e-2 2 0 0.0 @@ -144,5 +144,5 @@ 1.8217369 0.0 -[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300] -[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0] +[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,400.0,40.0,4.0,0.4,4.0e-2,2.0,2.0e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.0,0.0,4.0e-2,2.0,2.0e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300] +[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,400.0,40.0,4.0,0.4,4.0e-2,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,4.0e-2,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0] From git at git.haskell.org Sun May 13 22:31:30 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 22:31:30 +0000 (UTC) Subject: [commit: ghc] master: TcInteract: Ensure that tycons have representations before solving for Typeable (f0212a9) Message-ID: <20180513223130.DC48F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0212a93a2f3d4fb564c1025cca0dfd3050487e4/ghc >--------------------------------------------------------------- commit f0212a93a2f3d4fb564c1025cca0dfd3050487e4 Author: Ben Gamari Date: Sun May 13 11:41:16 2018 -0400 TcInteract: Ensure that tycons have representations before solving for Typeable Summary: This fixes #15067. Test Plan: Validate Subscribers: thomie, carter, RyanGlScott GHC Trac Issues: #15067 Differential Revision: https://phabricator.haskell.org/D4623 >--------------------------------------------------------------- f0212a93a2f3d4fb564c1025cca0dfd3050487e4 compiler/basicTypes/DataCon.hs-boot | 1 + compiler/typecheck/TcInteract.hs | 3 +++ compiler/types/TyCon.hs | 6 +++++- testsuite/tests/typecheck/should_fail/T15067.hs | 5 ++--- testsuite/tests/typecheck/should_fail/T15067.stderr | 2 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs-boot b/compiler/basicTypes/DataCon.hs-boot index 841f8c9..61fb3ce 100644 --- a/compiler/basicTypes/DataCon.hs-boot +++ b/compiler/basicTypes/DataCon.hs-boot @@ -25,6 +25,7 @@ dataConInstOrigArgTys :: DataCon -> [Type] -> [Type] dataConStupidTheta :: DataCon -> ThetaType dataConFullSig :: DataCon -> ([TyVar], [TyVar], [EqSpec], ThetaType, [Type], Type) +isUnboxedSumCon :: DataCon -> Bool instance Eq DataCon instance Uniquable DataCon diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 377b2d6..41afe3f 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2698,9 +2698,12 @@ doFunTy clas ty arg_ty ret_ty -- of monomorphic kind (e.g. all kind variables have been instantiated). doTyConApp :: Class -> Type -> TyCon -> [Kind] -> TcS LookupInstResult doTyConApp clas ty tc kind_args + | Just _ <- tyConRepName_maybe tc = return $ GenInst (map (mk_typeable_pred clas) kind_args) (\kinds -> evTypeable ty $ EvTypeableTyCon tc (map EvExpr kinds)) True + | otherwise + = return NoInstance -- | Representation for TyCon applications of a concrete kind. We just use the -- kind itself, but first we must make sure that we've instantiated all kind- diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 67c7b1b..5717aef 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -155,6 +155,7 @@ import Util import Unique( tyConRepNameUnique, dataConRepNameUnique ) import UniqSet import Module +import {-# SOURCE #-} DataCon import qualified Data.Data as Data @@ -1190,7 +1191,10 @@ tyConRepName_maybe (AlgTyCon { algTcParent = parent }) | UnboxedAlgTyCon rep_nm <- parent = rep_nm tyConRepName_maybe (FamilyTyCon { famTcFlav = DataFamilyTyCon rep_nm }) = Just rep_nm -tyConRepName_maybe (PromotedDataCon { tcRepName = rep_nm }) +tyConRepName_maybe (PromotedDataCon { dataCon = dc, tcRepName = rep_nm }) + | isUnboxedSumCon dc -- see #13276 + = Nothing + | otherwise = Just rep_nm tyConRepName_maybe _ = Nothing diff --git a/testsuite/tests/typecheck/should_fail/T15067.hs b/testsuite/tests/typecheck/should_fail/T15067.hs index ff093db..397655f 100644 --- a/testsuite/tests/typecheck/should_fail/T15067.hs +++ b/testsuite/tests/typecheck/should_fail/T15067.hs @@ -1,10 +1,9 @@ {-# LANGUAGE UnboxedSums #-} +{-# LANGUAGE DataKinds #-} + module T15067 where import Type.Reflection floopadoop :: TypeRep (# Bool | Int #) floopadoop = typeRep - -rubadub :: (# True | 4 #) -rubadub = typeRep diff --git a/testsuite/tests/typecheck/should_fail/T15067.stderr b/testsuite/tests/typecheck/should_fail/T15067.stderr index a16d799..7305611 100644 --- a/testsuite/tests/typecheck/should_fail/T15067.stderr +++ b/testsuite/tests/typecheck/should_fail/T15067.stderr @@ -1,5 +1,5 @@ -T15067.hs:7:14: +T15067.hs:9:14: No instance for (Typeable (# 'GHC.Types.LiftedRep #)) arising from a use of ‘typeRep’ GHC can't yet do polykinded diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 9dd00f8..e4aa682 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -473,4 +473,4 @@ test('T14761b', normal, compile_fail, ['']) test('T14884', normal, compile_fail, ['']) test('T14904a', normal, compile_fail, ['']) test('T14904b', normal, compile_fail, ['']) -test('T15067', expect_broken(15067), compile_fail, ['']) +test('T15067', normal, compile_fail, ['']) From git at git.haskell.org Sun May 13 22:31:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 22:31:45 +0000 (UTC) Subject: [commit: ghc] master: Bump array submodule (2188427) Message-ID: <20180513223145.1E8623ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2188427015e384410fcb7ec9114f5e7f0e2ad6f0/ghc >--------------------------------------------------------------- commit 2188427015e384410fcb7ec9114f5e7f0e2ad6f0 Author: Ben Gamari Date: Sun May 13 11:52:56 2018 -0400 Bump array submodule >--------------------------------------------------------------- 2188427015e384410fcb7ec9114f5e7f0e2ad6f0 libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 234d0a1..82a29b1 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 234d0a11820c263c873e41810d7a4b9d6152dcec +Subproject commit 82a29b198a67f54de2f72d96ca077800afbfbe4f From git at git.haskell.org Sun May 13 22:33:36 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 May 2018 22:33:36 +0000 (UTC) Subject: [commit: ghc] master: Refactor LitString (7c665f9) Message-ID: <20180513223336.D6C183ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c665f9ce0980ee7c81a44c8f861686395637453/ghc >--------------------------------------------------------------- commit 7c665f9ce0980ee7c81a44c8f861686395637453 Author: Sylvain Henry Date: Sun May 13 11:36:28 2018 -0400 Refactor LitString Refactor LitString so that the string length is computed at most once and then stored. Also remove strlen and memcmp wrappers (it seems like they were a workaround for a very old GCC when using -fvia-C). Bumps haddock submodule. Reviewers: bgamari, dfeuer, nickkuk Reviewed By: bgamari, nickkuk Subscribers: nickkuk, dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4630 >--------------------------------------------------------------- 7c665f9ce0980ee7c81a44c8f861686395637453 compiler/parser/cutils.c | 17 --------- compiler/parser/cutils.h | 5 --- compiler/utils/BufWrite.hs | 33 +++++++++++++++-- compiler/utils/FastString.hs | 35 +++++++++--------- compiler/utils/Pretty.hs | 74 ++++++++++++++++++------------------- testsuite/tests/perf/compiler/all.T | 3 +- utils/haddock | 2 +- 7 files changed, 86 insertions(+), 83 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7c665f9ce0980ee7c81a44c8f861686395637453 From git at git.haskell.org Mon May 14 02:50:44 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:50:44 +0000 (UTC) Subject: [commit: ghc] master: Fix a few GCC warnings (eb39f98) Message-ID: <20180514025044.EDA3F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eb39f98891482366cf1130fe58d728b93f0dd49f/ghc >--------------------------------------------------------------- commit eb39f98891482366cf1130fe58d728b93f0dd49f Author: Michal Terepeta Date: Sun May 13 18:34:03 2018 -0400 Fix a few GCC warnings GCC 8 now generates warnings for incompatible function pointer casts [-Werror=cast-function-type]. Apparently there are a few of those in rts code, which makes `./validate` unhappy (since we compile with `-Werror`) This commit tries to fix these issues by changing the functions to have the correct type (and, if necessary, moving the casts into those functions). For instance, hash/comparison function are declared (`Hash.h`) to take `StgWord` but we want to use `StgWord64[2]` in `StaticPtrTable.c`. Instead of casting the function pointers, we can cast the `StgWord` parameter to `StgWord*`. I think this should be ok since `StgWord` should be the same size as a pointer. Signed-off-by: Michal Terepeta Test Plan: ./validate Reviewers: bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4673 >--------------------------------------------------------------- eb39f98891482366cf1130fe58d728b93f0dd49f includes/rts/OSThreads.h | 2 +- rts/Hash.c | 6 +++--- rts/Hash.h | 2 +- rts/StaticPtrTable.c | 15 ++++++++------- rts/Task.c | 4 +++- rts/posix/OSThreads.c | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h index abb3120..d2c4a6a 100644 --- a/includes/rts/OSThreads.h +++ b/includes/rts/OSThreads.h @@ -166,7 +166,7 @@ extern OSThreadId osThreadId ( void ); extern void shutdownThread ( void ) GNUC3_ATTRIBUTE(__noreturn__); extern void yieldThread ( void ); -typedef void OSThreadProcAttr OSThreadProc(void *); +typedef void* OSThreadProcAttr OSThreadProc(void *); extern int createOSThread ( OSThreadId* tid, char *name, OSThreadProc *startProc, void *param); diff --git a/rts/Hash.c b/rts/Hash.c index b9a3cf6..658187b 100644 --- a/rts/Hash.c +++ b/rts/Hash.c @@ -77,8 +77,9 @@ hashWord(const HashTable *table, StgWord key) } int -hashStr(const HashTable *table, char *key) +hashStr(const HashTable *table, StgWord w) { + const char *key = (char*) w; #ifdef x86_64_HOST_ARCH StgWord h = XXH64 (key, strlen(key), 1048583); #else @@ -440,8 +441,7 @@ allocHashTable(void) HashTable * allocStrHashTable(void) { - return allocHashTable_((HashFunction *)hashStr, - (CompareFunction *)compareStr); + return allocHashTable_(hashStr, compareStr); } void diff --git a/rts/Hash.h b/rts/Hash.h index 1dde314..be388fb 100644 --- a/rts/Hash.h +++ b/rts/Hash.h @@ -56,7 +56,7 @@ typedef int HashFunction(const HashTable *table, StgWord key); typedef int CompareFunction(StgWord key1, StgWord key2); HashTable * allocHashTable_(HashFunction *hash, CompareFunction *compare); int hashWord(const HashTable *table, StgWord key); -int hashStr(const HashTable *table, char *key); +int hashStr(const HashTable *table, StgWord key); /* Freeing hash tables */ diff --git a/rts/StaticPtrTable.c b/rts/StaticPtrTable.c index 5d2737a..7711377 100644 --- a/rts/StaticPtrTable.c +++ b/rts/StaticPtrTable.c @@ -21,23 +21,24 @@ static Mutex spt_lock; #endif /// Hash function for the SPT. -static int hashFingerprint(HashTable *table, StgWord64 key[2]) { +static int hashFingerprint(const HashTable *table, StgWord key) { + const StgWord64* ptr = (StgWord64*) key; // Take half of the key to compute the hash. - return hashWord(table, (StgWord)key[1]); + return hashWord(table, *(ptr + 1)); } /// Comparison function for the SPT. -static int compareFingerprint(StgWord64 ptra[2], StgWord64 ptrb[2]) { - return ptra[0] == ptrb[0] && ptra[1] == ptrb[1]; +static int compareFingerprint(StgWord a, StgWord b) { + const StgWord64* ptra = (StgWord64*) a; + const StgWord64* ptrb = (StgWord64*) b; + return *ptra == *ptrb && *(ptra + 1) == *(ptrb + 1); } void hs_spt_insert_stableptr(StgWord64 key[2], StgStablePtr *entry) { // hs_spt_insert is called from constructor functions, so // the SPT needs to be initialized here. if (spt == NULL) { - spt = allocHashTable_( (HashFunction *)hashFingerprint - , (CompareFunction *)compareFingerprint - ); + spt = allocHashTable_(hashFingerprint, compareFingerprint); #if defined(THREADED_RTS) initMutex(&spt_lock); #endif diff --git a/rts/Task.c b/rts/Task.c index 758ae10..ac86311 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -416,7 +416,7 @@ workerTaskStop (Task *task) #if defined(THREADED_RTS) -static void OSThreadProcAttr +static void* OSThreadProcAttr workerStart(Task *task) { Capability *cap; @@ -442,6 +442,8 @@ workerStart(Task *task) traceTaskCreate(task, cap); scheduleWorker(cap,task); + + return NULL; } /* N.B. must take all_tasks_mutex */ diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 9cf42aa..7dcf0ee 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -134,7 +134,7 @@ int createOSThread (OSThreadId* pId, char *name STG_UNUSED, OSThreadProc *startProc, void *param) { - int result = pthread_create(pId, NULL, (void *(*)(void *))startProc, param); + int result = pthread_create(pId, NULL, startProc, param); if (!result) { pthread_detach(*pId); #if defined(HAVE_PTHREAD_SETNAME_NP) From git at git.haskell.org Mon May 14 02:50:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:50:59 +0000 (UTC) Subject: [commit: ghc] master: Fix changelog message for asinh (2828dbf) Message-ID: <20180514025059.904893ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2828dbf487c54d57b82578cc0872a348cfb173f3/ghc >--------------------------------------------------------------- commit 2828dbf487c54d57b82578cc0872a348cfb173f3 Author: David Feuer Date: Sun May 13 18:34:26 2018 -0400 Fix changelog message for asinh Reviewers: bgamari, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4678 >--------------------------------------------------------------- 2828dbf487c54d57b82578cc0872a348cfb173f3 libraries/base/changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f239073..d4b6261 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -14,8 +14,8 @@ * Add `Applicative` (for `K1`), `Semigroup` and `Monoid` instances in `GHC.Generics`. (#14849) - * `asinh` for `Float` and `Double` is now numerical stable in the face of - large negative arguments (#14927) + * `asinh` for `Float` and `Double` is now numerically stable in the face of + non-small negative arguments and enormous arguments of either sign. (#14927) * `Numeric.showEFloat (Just 0)` now respects the user's requested precision. (#15115) From git at git.haskell.org Mon May 14 02:51:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:51:14 +0000 (UTC) Subject: [commit: ghc] master: Remove unused things from utils/Digraph (cdbe00f) Message-ID: <20180514025114.5F2B73ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdbe00fe24e25f7ba06d15990a37ba4f3f6098ab/ghc >--------------------------------------------------------------- commit cdbe00fe24e25f7ba06d15990a37ba4f3f6098ab Author: David Feuer Date: Sun May 13 18:34:38 2018 -0400 Remove unused things from utils/Digraph `utils/Digraph` had a bunch of code that wasn't actually being used, much of which wasn't documented at all, some of which was clearly ill-considered, and some of which was documented as being inefficient. Remove all unused code from that module except for the obvious and innocuous `emptyG`. Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4676 >--------------------------------------------------------------- cdbe00fe24e25f7ba06d15990a37ba4f3f6098ab compiler/utils/Digraph.hs | 91 ++--------------------------------------------- 1 file changed, 2 insertions(+), 89 deletions(-) diff --git a/compiler/utils/Digraph.hs b/compiler/utils/Digraph.hs index c6f2706..c420486 100644 --- a/compiler/utils/Digraph.hs +++ b/compiler/utils/Digraph.hs @@ -7,12 +7,10 @@ module Digraph( SCC(..), Node(..), flattenSCC, flattenSCCs, stronglyConnCompG, - topologicalSortG, dfsTopSortG, + topologicalSortG, verticesG, edgesG, hasVertexG, reachableG, reachablesG, transposeG, - outdegreeG, indegreeG, - vertexGroupsG, emptyG, - componentsG, + emptyG, findCycle, @@ -45,17 +43,11 @@ import GhcPrelude import Util ( minWith, count ) import Outputable import Maybes ( expectJust ) -import MonadUtils ( allM ) - --- Extensions -import Control.Monad ( filterM, liftM, liftM2 ) -import Control.Monad.ST -- std interfaces import Data.Maybe import Data.Array import Data.List hiding (transpose) -import Data.Array.ST import qualified Data.Map as Map import qualified Data.Set as Set @@ -349,12 +341,6 @@ topologicalSortG :: Graph node -> [node] topologicalSortG graph = map (gr_vertex_to_node graph) result where result = {-# SCC "Digraph.topSort" #-} topSort (gr_int_graph graph) -dfsTopSortG :: Graph node -> [[node]] -dfsTopSortG graph = - map (map (gr_vertex_to_node graph) . flatten) $ dfs g (topSort g) - where - g = gr_int_graph graph - reachableG :: Graph node -> node -> [node] reachableG graph from = map (gr_vertex_to_node graph) result where from_vertex = expectJust "reachableG" (gr_node_to_vertex graph from) @@ -381,27 +367,9 @@ transposeG graph = Graph (G.transposeG (gr_int_graph graph)) (gr_vertex_to_node graph) (gr_node_to_vertex graph) -outdegreeG :: Graph node -> node -> Maybe Int -outdegreeG = degreeG outdegree - -indegreeG :: Graph node -> node -> Maybe Int -indegreeG = degreeG indegree - -degreeG :: (G.Graph -> Table Int) -> Graph node -> node -> Maybe Int -degreeG degree graph node = let table = degree (gr_int_graph graph) - in fmap ((!) table) $ gr_node_to_vertex graph node - -vertexGroupsG :: Graph node -> [[node]] -vertexGroupsG graph = map (map (gr_vertex_to_node graph)) result - where result = vertexGroups (gr_int_graph graph) - emptyG :: Graph node -> Bool emptyG g = graphEmpty (gr_int_graph g) -componentsG :: Graph node -> [[node]] -componentsG graph = map (map (gr_vertex_to_node graph) . flatten) - $ components (gr_int_graph graph) - {- ************************************************************************ * * @@ -452,58 +420,3 @@ preorderF ts = concat (map flatten ts) -- This generalizes reachable which was found in Data.Graph reachable :: IntGraph -> [Vertex] -> [Vertex] reachable g vs = preorderF (dfs g vs) - -{- ------------------------------------------------------------- --- Total ordering on groups of vertices ------------------------------------------------------------- - -The plan here is to extract a list of groups of elements of the graph -such that each group has no dependence except on nodes in previous -groups (i.e. in particular they may not depend on nodes in their own -group) and is maximal such group. - -Clearly we cannot provide a solution for cyclic graphs. - -We proceed by iteratively removing elements with no outgoing edges -and their associated edges from the graph. - -This probably isn't very efficient and certainly isn't very clever. --} - -type Set s = STArray s Vertex Bool - -mkEmpty :: Bounds -> ST s (Set s) -mkEmpty bnds = newArray bnds False - -contains :: Set s -> Vertex -> ST s Bool -contains m v = readArray m v - -include :: Set s -> Vertex -> ST s () -include m v = writeArray m v True - -vertexGroups :: IntGraph -> [[Vertex]] -vertexGroups g = runST (mkEmpty (bounds g) >>= \provided -> vertexGroupsS provided g next_vertices) - where next_vertices = noOutEdges g - -noOutEdges :: IntGraph -> [Vertex] -noOutEdges g = [ v | v <- vertices g, null (g!v)] - -vertexGroupsS :: Set s -> IntGraph -> [Vertex] -> ST s [[Vertex]] -vertexGroupsS provided g to_provide - = if null to_provide - then do { - all_provided <- allM (provided `contains`) (vertices g) - ; if all_provided - then return [] - else error "vertexGroup: cyclic graph" - } - else do { - mapM_ (include provided) to_provide - ; to_provide' <- filterM (vertexReady provided g) (vertices g) - ; rest <- vertexGroupsS provided g to_provide' - ; return $ to_provide : rest - } - -vertexReady :: Set s -> IntGraph -> Vertex -> ST s Bool -vertexReady provided g v = liftM2 (&&) (liftM not $ provided `contains` v) (allM (provided `contains`) (g!v)) From git at git.haskell.org Mon May 14 02:51:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:51:28 +0000 (UTC) Subject: [commit: ghc] master: rts: Compile with gcc -Og (d4abd03) Message-ID: <20180514025128.B24013ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4abd031f6e8c2fa01f8949f60d8a02cca513804/ghc >--------------------------------------------------------------- commit d4abd031f6e8c2fa01f8949f60d8a02cca513804 Author: Ben Gamari Date: Sun May 13 18:34:48 2018 -0400 rts: Compile with gcc -Og This optimisation level is specifically designed to provide the benefits of optimisation without the obfuscation that sometimes results. Test Plan: Validate Reviewers: simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4675 >--------------------------------------------------------------- d4abd031f6e8c2fa01f8949f60d8a02cca513804 rts/ghc.mk | 2 +- rts/sm/Sanity.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index e96e147..2976b0a 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -153,7 +153,7 @@ rts_dist_$1_CC_OPTS := $$(GhcRtsCcOpts) # The per-way CC_OPTS ifneq "$$(findstring debug, $1)" "" rts_dist_$1_HC_OPTS += -O0 -rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -O0 +rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -Og endif ifneq "$$(findstring dyn, $1)" "" diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 7a0ad16..23a20b2 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -481,7 +481,7 @@ checkCompactObjects(bdescr *bd) // before the actual closure for ( ; bd != NULL; bd = bd->link) { - StgCompactNFDataBlock *block, *last; + StgCompactNFDataBlock *block, *last = NULL; StgCompactNFData *str; StgWord totalW; From git at git.haskell.org Mon May 14 02:51:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:51:43 +0000 (UTC) Subject: [commit: ghc] master: GHCi: Include a note in the hint to expose a hidden package (30c887d) Message-ID: <20180514025143.5BFB73ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/30c887d3b176a36b7affc27b118e0450d115df0c/ghc >--------------------------------------------------------------- commit 30c887d3b176a36b7affc27b118e0450d115df0c Author: Chaitanya Koparkar Date: Sun May 13 18:35:18 2018 -0400 GHCi: Include a note in the hint to expose a hidden package Test Plan: validate Reviewers: bgamari, RyanGlScott, osa1 Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15055 Differential Revision: https://phabricator.haskell.org/D4669 >--------------------------------------------------------------- 30c887d3b176a36b7affc27b118e0450d115df0c compiler/main/Finder.hs | 3 ++- testsuite/tests/ghci/should_fail/T15055.stderr | 1 + testsuite/tests/package/package01e.stderr | 2 ++ testsuite/tests/package/package06e.stderr | 2 ++ testsuite/tests/package/package07e.stderr | 3 +++ testsuite/tests/package/package08e.stderr | 3 +++ testsuite/tests/plugins/T11244.stderr | 1 + 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/compiler/main/Finder.hs b/compiler/main/Finder.hs index 9568ac1..613c0a4 100644 --- a/compiler/main/Finder.hs +++ b/compiler/main/Finder.hs @@ -678,7 +678,8 @@ cantFindErr cannot_find _ dflags mod_name find_result = let pkg = expectJust "pkg_hidden" (lookupPackage dflags pkgid) in text "You can run" <+> quotes (text ":set -package " <> ppr (packageName pkg)) <+> - text "to expose it." + text "to expose it." $$ + text "(Note: this unloads all the modules in the current scope.)" mod_hidden pkg = text "it is a hidden module in the package" <+> quotes (ppr pkg) diff --git a/testsuite/tests/ghci/should_fail/T15055.stderr b/testsuite/tests/ghci/should_fail/T15055.stderr index dcc297c..daba7c7 100644 --- a/testsuite/tests/ghci/should_fail/T15055.stderr +++ b/testsuite/tests/ghci/should_fail/T15055.stderr @@ -3,3 +3,4 @@ Could not find module ‘GHC’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) diff --git a/testsuite/tests/package/package01e.stderr b/testsuite/tests/package/package01e.stderr index a755991..e4af6b1 100644 --- a/testsuite/tests/package/package01e.stderr +++ b/testsuite/tests/package/package01e.stderr @@ -3,10 +3,12 @@ package01e.hs:2:1: error: Could not find module ‘Data.Map’ It is a member of the hidden package ‘containers-0.5.11.0’. You can run ‘:set -package containers’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. package01e.hs:3:1: error: Could not find module ‘Data.IntMap’ It is a member of the hidden package ‘containers-0.5.11.0’. You can run ‘:set -package containers’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. diff --git a/testsuite/tests/package/package06e.stderr b/testsuite/tests/package/package06e.stderr index 59aeb37..1bdbb16 100644 --- a/testsuite/tests/package/package06e.stderr +++ b/testsuite/tests/package/package06e.stderr @@ -3,10 +3,12 @@ package06e.hs:2:1: error: Could not find module ‘HsTypes’ It is a member of the hidden package ‘ghc-8.1’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. package06e.hs:3:1: error: Could not find module ‘UniqFM’ It is a member of the hidden package ‘ghc-8.1’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. diff --git a/testsuite/tests/package/package07e.stderr b/testsuite/tests/package/package07e.stderr index d167508..9bd53da 100644 --- a/testsuite/tests/package/package07e.stderr +++ b/testsuite/tests/package/package07e.stderr @@ -8,16 +8,19 @@ package07e.hs:3:1: error: Could not find module ‘HsTypes’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. package07e.hs:4:1: error: Could not find module ‘HsUtils’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. package07e.hs:5:1: error: Could not find module ‘UniqFM’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. diff --git a/testsuite/tests/package/package08e.stderr b/testsuite/tests/package/package08e.stderr index 922c643..0e075dd 100644 --- a/testsuite/tests/package/package08e.stderr +++ b/testsuite/tests/package/package08e.stderr @@ -8,16 +8,19 @@ package08e.hs:3:1: error: Could not find module ‘HsTypes’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. package08e.hs:4:1: error: Could not find module ‘HsUtils’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. package08e.hs:5:1: error: Could not find module ‘UniqFM’ It is a member of the hidden package ‘ghc-8.5’. You can run ‘:set -package ghc’ to expose it. + (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. diff --git a/testsuite/tests/plugins/T11244.stderr b/testsuite/tests/plugins/T11244.stderr index 472ef44..b571144 100644 --- a/testsuite/tests/plugins/T11244.stderr +++ b/testsuite/tests/plugins/T11244.stderr @@ -1,4 +1,5 @@ : Could not find module ‘RuleDefiningPlugin’ It is a member of the hidden package ‘rule-defining-plugin-0.1’. You can run ‘:set -package rule-defining-plugin’ to expose it. +(Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. From git at git.haskell.org Mon May 14 02:51:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:51:57 +0000 (UTC) Subject: [commit: ghc] master: Clarify what the FFI spec says (48dee7c) Message-ID: <20180514025157.8B94C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48dee7c934cbb3cc908feb165fab0ec2facda4f8/ghc >--------------------------------------------------------------- commit 48dee7c934cbb3cc908feb165fab0ec2facda4f8 Author: David Feuer Date: Sun May 13 18:35:34 2018 -0400 Clarify what the FFI spec says Section 10.1.1 claimed that > The FFI addendum stipulates that an implementation is free to implement an unsafe call by performing a safe call ... Reading through the FFI addendum (and the Haskell 2010 Report, which integrates it), I see no such stipulation. I think this explains the situation a bit better. [ci skip] Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4656 >--------------------------------------------------------------- 48dee7c934cbb3cc908feb165fab0ec2facda4f8 docs/users_guide/ffi-chap.rst | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/users_guide/ffi-chap.rst b/docs/users_guide/ffi-chap.rst index e844fac..0b107de 100644 --- a/docs/users_guide/ffi-chap.rst +++ b/docs/users_guide/ffi-chap.rst @@ -35,17 +35,22 @@ GHC differences to the FFI Chapter Guaranteed call safety ~~~~~~~~~~~~~~~~~~~~~~ -The FFI addendum stipulates that an implementation is free to implement an -``unsafe`` call by performing a ``safe`` call (and therefore may run in an -arbitrary thread and may be subject to concurrent garbage collection). This -greatly constrains library authors since it implies that it is never safe to -pass any heap object reference to a foreign function, even if invoked with an -``unsafe`` call. For instance, it is often desirable to pass an unpinned -``ByteArray#``\s directly to native code to avoid making an -otherwise-unnecessary copy. However, this can only be done safely under -``unsafe`` call semantics as otherwise the array may be moved by the garbage +The Haskell 2010 Report specifies that ``safe`` FFI calls must allow foreign +calls to safely call into Haskell code. In practice, this means that the +garbage collector must be able to run while these calls are in progress, +moving heap-allocated Haskell values around arbitrarily. + +This greatly constrains library authors since it implies that it is not safe to +pass any heap object reference to a ``safe`` foreign function call. For +instance, it is often desirable to pass an unpinned ``ByteArray#``\s directly +to native code to avoid making an otherwise-unnecessary copy. However, this can +only be done safely if the array is guaranteed not to be moved by the garbage collector in the middle of the call. +The Chapter does *not* require implementations to refrain from doing the +same for ``unsafe`` calls, so strictly Haskell 2010-conforming programs +cannot pass heap-allocated references to ``unsafe`` FFI calls either. + In previous releases, GHC would take advantage of the freedom afforded by the Chapter by performing ``safe`` foreign calls in place of ``unsafe`` calls in the bytecode interpreter. This meant that some packages which worked when @@ -53,7 +58,8 @@ compiled would fail under GHCi (e.g. :ghc-ticket:`13730`). However, since version 8.4 this is no longer the case: GHC **guarantees** that garbage collection will never occur during an ``unsafe`` call, even in the -bytecode interpreter. +bytecode interpreter, and further guarantees that ``unsafe`` calls will be +performed in the calling thread. .. _ffi-ghcexts: From git at git.haskell.org Mon May 14 02:52:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:52:12 +0000 (UTC) Subject: [commit: ghc] master: Add note documenting refineDefaultAlt (bf6cad8) Message-ID: <20180514025212.656283ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf6cad8b86ee34ed5aa5fa0e295304b51f2a2324/ghc >--------------------------------------------------------------- commit bf6cad8b86ee34ed5aa5fa0e295304b51f2a2324 Author: Matthew Pickering Date: Sun May 13 18:36:10 2018 -0400 Add note documenting refineDefaultAlt Reviewers: sjakobi, bgamari Reviewed By: sjakobi Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4687 >--------------------------------------------------------------- bf6cad8b86ee34ed5aa5fa0e295304b51f2a2324 compiler/coreSyn/CoreUtils.hs | 88 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 4137c1c..7fc9fb3 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -644,6 +644,7 @@ filterAlts _tycon inst_tys imposs_cons alts impossible_alt _ _ = False -- | Refine the default alternative to a 'DataAlt', if there is a unique way to do so. +-- See Note [Refine Default Alts] refineDefaultAlt :: [Unique] -- ^ Uniques for constructing new binders -> TyCon -- ^ Type constructor of scrutinee's type -> [Type] -- ^ Type arguments of scrutinee's type @@ -686,6 +687,93 @@ refineDefaultAlt us tycon tys imposs_deflt_cons all_alts | otherwise -- The common case = (False, all_alts) +{- Note [Refine Default Alts] + +refineDefaultAlt replaces the DEFAULT alt with a constructor if there is one +possible value it could be. + +The simplest example being + +foo :: () -> () +foo x = case x of !_ -> () + +rewrites to + +foo :: () -> () +foo x = case x of () -> () + +There are two reasons in general why this is desirable. + +1. We can simplify inner expressions + +In this example we can eliminate the inner case by refining the outer case. +If we don't refine it, we are left with both case expressions. + +``` +{-# LANGUAGE BangPatterns #-} +module Test where + +mid x = x +{-# NOINLINE mid #-} + +data Foo = Foo1 () + +test :: Foo -> () +test x = + case x of + !_ -> mid (case x of + Foo1 x1 -> x1) + +``` + +refineDefaultAlt fills in the DEFAULT here with `Foo ip1` and then x +becomes bound to `Foo ip1` so is inlined into the other case which +causes the KnownBranch optimisation to kick in. + + +2. combineIdenticalAlts does a better job + +Simon Jakobi also points out that that combineIdenticalAlts will do a better job +if we refine the DEFAULT first. + +``` +data D = C0 | C1 | C2 + +case e of + DEFAULT -> e0 + C0 -> e1 + C1 -> e1 +``` + +When we apply combineIdenticalAlts to this expression, it can't +combine the alts for C0 and C1, as we already have a default case. + +If we apply refineDefaultAlt first, we get + +``` +case e of + C0 -> e1 + C1 -> e1 + C2 -> e0 +``` + +and combineIdenticalAlts can turn that into + +``` +case e of + DEFAULT -> e1 + C2 -> e0 +``` + +It isn't obvious that refineDefaultAlt does this but if you look at its one +call site in SimplUtils then the `imposs_deflt_cons` argument is populated with +constructors which are matched elsewhere. + +-} + + + + {- Note [Combine identical alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If several alternatives are identical, merge them into a single From git at git.haskell.org Mon May 14 02:52:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:52:28 +0000 (UTC) Subject: [commit: ghc] master: Fix #14875 by introducing PprPrec, and using it (21e1a00) Message-ID: <20180514025228.B2A6E3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/21e1a00c0ccf3072ccc04cd1acfc541c141189d2/ghc >--------------------------------------------------------------- commit 21e1a00c0ccf3072ccc04cd1acfc541c141189d2 Author: Ryan Scott Date: Sun May 13 18:36:23 2018 -0400 Fix #14875 by introducing PprPrec, and using it Trying to determine when to insert parentheses during TH conversion is a bit of a mess. There is an assortment of functions that try to detect this, such as: * `hsExprNeedsParens` * `isCompoundHsType` * `hsPatNeedsParens` * `isCompoundPat` * etc. To make things worse, each of them have slightly different semantics. Plus, they don't work well in the presence of explicit type signatures, as #14875 demonstrates. All of these problems can be alleviated with the use of an explicit precedence argument (much like what `showsPrec` currently does). To accomplish this, I introduce a new `PprPrec` data type, and define standard predences for things like function application, infix operators, function arrows, and explicit type signatures (that last one is new). I then added `PprPrec` arguments to the various `-NeedsParens` functions, and use them to make smarter decisions about when things need to be parenthesized. A nice side effect is that functions like `isCompoundHsType` are now completely unneeded, since they're simply aliases for `hsTypeNeedsParens appPrec`. As a result, I did a bit of refactoring to remove these sorts of functions. I also did a pass over various utility functions in GHC for constructing AST forms and used more appropriate precedences where convenient. Along the way, I also ripped out the existing `TyPrec` data type (which was tailor-made for pretty-printing `Type`s) and replaced it with `PprPrec` for consistency. Test Plan: make test TEST=T14875 Reviewers: alanz, goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14875 Differential Revision: https://phabricator.haskell.org/D4688 >--------------------------------------------------------------- 21e1a00c0ccf3072ccc04cd1acfc541c141189d2 compiler/basicTypes/BasicTypes.hs | 57 +++---- compiler/hsSyn/Convert.hs | 42 +++--- compiler/hsSyn/HsDecls.hs | 7 +- compiler/hsSyn/HsExpr.hs | 128 ++++++++++------ compiler/hsSyn/HsLit.hs | 57 +++---- compiler/hsSyn/HsPat.hs | 165 ++++++++------------- compiler/hsSyn/HsTypes.hs | 54 ++++--- compiler/hsSyn/HsUtils.hs | 28 ++-- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 126 ++++++++-------- compiler/typecheck/TcGenDeriv.hs | 7 +- compiler/types/TyCoRep.hs | 37 ++--- compiler/types/Type.hs | 2 +- .../template-haskell/Language/Haskell/TH/Ppr.hs | 19 ++- .../tests/deriving/should_compile/T14682.stderr | 4 +- testsuite/tests/th/T14875.hs | 14 ++ testsuite/tests/th/T14875.stderr | 24 +++ testsuite/tests/th/all.T | 1 + 18 files changed, 417 insertions(+), 357 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 21e1a00c0ccf3072ccc04cd1acfc541c141189d2 From git at git.haskell.org Mon May 14 02:52:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:52:43 +0000 (UTC) Subject: [commit: ghc] master: ghc-pkg: Configure handle encodings (cf88c2b) Message-ID: <20180514025243.A834D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf88c2b109a9f36d151af7fa0e542c48c98115fa/ghc >--------------------------------------------------------------- commit cf88c2b109a9f36d151af7fa0e542c48c98115fa Author: Ben Gamari Date: Sun May 13 18:36:59 2018 -0400 ghc-pkg: Configure handle encodings This fixes #15021 using a the same approach as was used to fix the issue in ghc (#10762). Test Plan: Validate on Windows as user whose username contains non-ASCII characters Reviewers: simonmar Reviewed By: simonmar Subscribers: lehins, thomie, carter GHC Trac Issues: #15021 Differential Revision: https://phabricator.haskell.org/D4642 >--------------------------------------------------------------- cf88c2b109a9f36d151af7fa0e542c48c98115fa compiler/utils/Util.hs | 15 --------------- ghc/Main.hs | 14 ++------------ libraries/ghc-boot/GHC/HandleEncoding.hs | 31 +++++++++++++++++++++++++++++++ libraries/ghc-boot/ghc-boot.cabal.in | 1 + utils/ghc-pkg/Main.hs | 2 ++ 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index d0a38ec..9523c08 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -98,7 +98,6 @@ module Util ( doesDirNameExist, getModificationUTCTime, modificationTimeIfExists, - hSetTranslit, global, consIORef, globalM, sharedGlobal, sharedGlobalM, @@ -145,9 +144,7 @@ import GHC.Stack (HasCallStack) import Control.Applicative ( liftA2 ) import Control.Monad ( liftM, guard ) -import GHC.IO.Encoding (mkTextEncoding, textEncodingName) import GHC.Conc.Sync ( sharedCAF ) -import System.IO (Handle, hGetEncoding, hSetEncoding) import System.IO.Error as IO ( isDoesNotExistError ) import System.Directory ( doesDirectoryExist, getModificationTime ) import System.FilePath @@ -1256,18 +1253,6 @@ modificationTimeIfExists f = do else ioError e -- -------------------------------------------------------------- --- Change the character encoding of the given Handle to transliterate --- on unsupported characters instead of throwing an exception - -hSetTranslit :: Handle -> IO () -hSetTranslit h = do - menc <- hGetEncoding h - case fmap textEncodingName menc of - Just name | '/' `notElem` name -> do - enc' <- mkTextEncoding $ name ++ "//TRANSLIT" - hSetEncoding h enc' - _ -> return () - -- split a string at the last character where 'pred' is True, -- returning a pair of strings. The first component holds the string -- up (but not including) the last character for which 'pred' returned diff --git a/ghc/Main.hs b/ghc/Main.hs index b720dea..276546b 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -40,6 +40,7 @@ import Module ( ModuleName ) -- Various other random stuff that we need +import GHC.HandleEncoding import Config import Constants import HscTypes @@ -92,18 +93,7 @@ main = do hSetBuffering stdout LineBuffering hSetBuffering stderr LineBuffering - -- Handle GHC-specific character encoding flags, allowing us to control how - -- GHC produces output regardless of OS. - env <- getEnvironment - case lookup "GHC_CHARENC" env of - Just "UTF-8" -> do - hSetEncoding stdout utf8 - hSetEncoding stderr utf8 - _ -> do - -- Avoid GHC erroring out when trying to display unhandled characters - hSetTranslit stdout - hSetTranslit stderr - + configureHandleEncoding GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $ do -- 1. extract the -B flag from the args argv0 <- getArgs diff --git a/libraries/ghc-boot/GHC/HandleEncoding.hs b/libraries/ghc-boot/GHC/HandleEncoding.hs new file mode 100644 index 0000000..aaa1689 --- /dev/null +++ b/libraries/ghc-boot/GHC/HandleEncoding.hs @@ -0,0 +1,31 @@ +-- | See GHC #10762 and #15021. +module GHC.HandleEncoding (configureHandleEncoding) where + +import GHC.IO.Encoding (textEncodingName) +import System.Environment +import System.IO + +-- | Handle GHC-specific character encoding flags, allowing us to control how +-- GHC produces output regardless of OS. +configureHandleEncoding :: IO () +configureHandleEncoding = do + env <- getEnvironment + case lookup "GHC_CHARENC" env of + Just "UTF-8" -> do + hSetEncoding stdout utf8 + hSetEncoding stderr utf8 + _ -> do + -- Avoid GHC erroring out when trying to display unhandled characters + hSetTranslit stdout + hSetTranslit stderr + +-- | Change the character encoding of the given Handle to transliterate +-- on unsupported characters instead of throwing an exception +hSetTranslit :: Handle -> IO () +hSetTranslit h = do + menc <- hGetEncoding h + case fmap textEncodingName menc of + Just name | '/' `notElem` name -> do + enc' <- mkTextEncoding $ name ++ "//TRANSLIT" + hSetEncoding h enc' + _ -> return () diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in index 5c03a77..0ca9c1e 100644 --- a/libraries/ghc-boot/ghc-boot.cabal.in +++ b/libraries/ghc-boot/ghc-boot.cabal.in @@ -40,6 +40,7 @@ Library GHC.PackageDb GHC.Serialized GHC.ForeignSrcLang + GHC.HandleEncoding build-depends: base >= 4.7 && < 4.13, binary == 0.8.*, diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 0e793b4..a322521 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -30,6 +30,7 @@ module Main (main) where import Version ( version, targetOS, targetARCH ) import qualified GHC.PackageDb as GhcPkg import GHC.PackageDb (BinaryStringRep(..)) +import GHC.HandleEncoding import qualified Distribution.Simple.PackageIndex as PackageIndex import qualified Data.Graph as Graph import qualified Distribution.ModuleName as ModuleName @@ -120,6 +121,7 @@ anyM p (x:xs) = do main :: IO () main = do + configureHandleEncoding args <- getArgs case getOpt Permute (flags ++ deprecFlags) args of From git at git.haskell.org Mon May 14 02:52:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:52:58 +0000 (UTC) Subject: [commit: ghc] master: Add support for opting out of package environments (8f3c149) Message-ID: <20180514025258.656D83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f3c149d94814e4f278b08c562f06fc257eb3c43/ghc >--------------------------------------------------------------- commit 8f3c149d94814e4f278b08c562f06fc257eb3c43 Author: Herbert Valerio Riedel Date: Sun May 13 18:37:18 2018 -0400 Add support for opting out of package environments This implements the first part proposed in #13753: Define a special magic "null" environment, which instructs GHC to ignore any package environment files. To this end, I propose to use the name `-` (i.e. a single dash), as that is more portable than using the empty string for environment variables. In other words, a - `-package-env -` CLI flag, or a - `GHC_ENVIRONMENT=-` env var (unless a `-package-env` flag is present) would inhibit GHC from looking up and interpreting any package environment files from the filesystem; this is the equivalent of `-ignore-dot-ghci` for package environment files. Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13753 Differential Revision: https://phabricator.haskell.org/D4690 >--------------------------------------------------------------- 8f3c149d94814e4f278b08c562f06fc257eb3c43 compiler/main/DynFlags.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index c80f552..25e99ee 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -4894,12 +4894,14 @@ interpretPackageEnv :: DynFlags -> IO DynFlags interpretPackageEnv dflags = do mPkgEnv <- runMaybeT $ msum $ [ getCmdLineArg >>= \env -> msum [ - probeEnvFile env + probeNullEnv env + , probeEnvFile env , probeEnvName env , cmdLineError env ] , getEnvVar >>= \env -> msum [ - probeEnvFile env + probeNullEnv env + , probeEnvFile env , probeEnvName env , envError env ] @@ -4912,6 +4914,9 @@ interpretPackageEnv dflags = do Nothing -> -- No environment found. Leave DynFlags unchanged. return dflags + Just "-" -> do + -- Explicitly disabled environment file. Leave DynFlags unchanged. + return dflags Just envfile -> do content <- readFile envfile putLogMsg dflags NoReason SevInfo noSrcSpan @@ -4941,6 +4946,10 @@ interpretPackageEnv dflags = do guard =<< liftMaybeT (doesFileExist path) return path + probeNullEnv :: FilePath -> MaybeT IO FilePath + probeNullEnv "-" = return "-" + probeNullEnv _ = mzero + parseEnvFile :: FilePath -> String -> DynP () parseEnvFile envfile = mapM_ parseEntry . lines where From git at git.haskell.org Mon May 14 02:53:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 02:53:13 +0000 (UTC) Subject: [commit: ghc] master: Fix another batch of `./validate --slow` failures (ca3d303) Message-ID: <20180514025313.932F23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ca3d3039386b145ae2835ca563b4c5a3497c25c9/ghc >--------------------------------------------------------------- commit ca3d3039386b145ae2835ca563b4c5a3497c25c9 Author: Alp Mestanogullari Date: Sun May 13 18:38:18 2018 -0400 Fix another batch of `./validate --slow` failures A rather detailed summary can be found at: https://gist.github.com/alpmestan/be82b47bb88b7dc9ff84105af9b1bb82 This doesn't fix all expectation mismatches yet, but we're down to about 20 mismatches with my previous patch and this one, as opposed to ~150 when I got started. Test Plan: ./validate --slow Reviewers: bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: thomie, carter GHC Trac Issues: #14890 Differential Revision: https://phabricator.haskell.org/D4636 >--------------------------------------------------------------- ca3d3039386b145ae2835ca563b4c5a3497c25c9 testsuite/tests/cabal/cabal01/all.T | 0 testsuite/tests/dependent/should_compile/all.T | 9 ++++++- testsuite/tests/driver/T3007/all.T | 5 +++- testsuite/tests/driver/all.T | 6 ++++- testsuite/tests/ffi/should_fail/all.T | 10 ++++++- testsuite/tests/indexed-types/should_compile/all.T | 8 +++++- testsuite/tests/numeric/should_compile/all.T | 3 +++ testsuite/tests/patsyn/should_compile/T13350/all.T | 4 ++- testsuite/tests/rts/Makefile | 12 +++++---- testsuite/tests/rts/T5435_asm.c | 4 ++- testsuite/tests/rts/T5435_dyn_asm.stdout | 2 -- .../{T5435_dyn_asm.stdout => T5435_v_asm_a.stdout} | 2 -- ...m.stdout-darwin => T5435_v_asm_a.stdout-darwin} | 0 ...stdout-mingw32 => T5435_v_asm_a.stdout-mingw32} | 0 ...dyn_asm.stdout-mingw32 => T5435_v_asm_b.stdout} | 0 testsuite/tests/rts/all.T | 31 +++++++++++++--------- testsuite/tests/typecheck/should_compile/all.T | 6 ++++- testsuite/tests/typecheck/should_run/all.T | 9 ++++++- 18 files changed, 81 insertions(+), 30 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 ca3d3039386b145ae2835ca563b4c5a3497c25c9 From git at git.haskell.org Mon May 14 04:08:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 04:08:02 +0000 (UTC) Subject: [commit: ghc] master: Improve some Foldable methods for NonEmpty (b713986) Message-ID: <20180514040802.942883ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b7139869c3c42c778fa9eb90058439323f548ec2/ghc >--------------------------------------------------------------- commit b7139869c3c42c778fa9eb90058439323f548ec2 Author: David Feuer Date: Sun May 13 23:26:08 2018 -0400 Improve some Foldable methods for NonEmpty * `length` is improved by using the default definition, while `foldr1` is improved by using a custom one. * Several methods had useless lazy pattern matches (i.e., the functions were actually strict in those arguments). Remove `~`s to clarify. Reviewers: hvr, bgamari, mpickering, nomeata Reviewed By: bgamari Subscribers: ygale, rwbarton, thomie, carter GHC Trac Issues: #15131 Differential Revision: https://phabricator.haskell.org/D4677 >--------------------------------------------------------------- b7139869c3c42c778fa9eb90058439323f548ec2 libraries/base/Data/Foldable.hs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs index 3fa5748..573d4c8 100644 --- a/libraries/base/Data/Foldable.hs +++ b/libraries/base/Data/Foldable.hs @@ -299,11 +299,27 @@ instance Foldable [] where -- | @since 4.9.0.0 instance Foldable NonEmpty where foldr f z ~(a :| as) = f a (List.foldr f z as) - foldl f z ~(a :| as) = List.foldl f (f z a) as - foldl1 f ~(a :| as) = List.foldl f a as + foldl f z (a :| as) = List.foldl f (f z a) as + foldl1 f (a :| as) = List.foldl f a as + + -- GHC isn't clever enough to transform the default definition + -- into anything like this, so we'd end up shuffling a bunch of + -- Maybes around. + foldr1 f (p :| ps) = foldr go id ps p + where + go x r prev = f prev (r x) + + -- We used to say + -- + -- length (_ :| as) = 1 + length as + -- + -- but the default definition is better, counting from 1. + -- + -- The default definition also works great for null and foldl'. + -- As usual for cons lists, foldr' is basically hopeless. + foldMap f ~(a :| as) = f a `mappend` foldMap f as fold ~(m :| ms) = m `mappend` fold ms - length (_ :| as) = 1 + List.length as toList ~(a :| as) = a : as -- | @since 4.7.0.0 From git at git.haskell.org Mon May 14 08:16:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 08:16:45 +0000 (UTC) Subject: [commit: ghc] master: utils/fs: use , not (6d57a92) Message-ID: <20180514081645.430713ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6d57a92f60761f38c7f5cdefd5c35423a7fe1d10/ghc >--------------------------------------------------------------- commit 6d57a92f60761f38c7f5cdefd5c35423a7fe1d10 Author: Sergei Trofimovich Date: Mon May 14 09:09:58 2018 +0100 utils/fs: use , not Fix cross-compilation failure from linux to windows: ``` CC utils/unlit/dist-install/build/fs.o utils/unlit/fs.c:24:10: fatal error: sys\stat.h: No such file or directory #include ^~~~~~~~~~~~ ``` Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 6d57a92f60761f38c7f5cdefd5c35423a7fe1d10 utils/fs/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/fs/fs.c b/utils/fs/fs.c index 24bf3a3..0f8fbe7 100644 --- a/utils/fs/fs.c +++ b/utils/fs/fs.c @@ -21,8 +21,8 @@ #include #include #include -#include -#include +#include +#include #include /* This function converts Windows paths between namespaces. More specifically From git at git.haskell.org Mon May 14 12:50:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 12:50:15 +0000 (UTC) Subject: [commit: ghc] master: Fix #14973 (e408d03) Message-ID: <20180514125015.172C03ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e408d03b512f353067879ecdb5be4b6e48cf0431/ghc >--------------------------------------------------------------- commit e408d03b512f353067879ecdb5be4b6e48cf0431 Author: Denis M Date: Mon May 14 00:08:36 2018 -0400 Fix #14973 Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4661 >--------------------------------------------------------------- e408d03b512f353067879ecdb5be4b6e48cf0431 ghc/GHCi/UI.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 349368b..3ed1c7f 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -791,16 +791,14 @@ checkPromptStringForErrors (_:xs) = checkPromptStringForErrors xs checkPromptStringForErrors "" = Nothing generatePromptFunctionFromString :: String -> PromptFunction -generatePromptFunctionFromString promptS = \_ _ -> do - (context, modules_names, line) <- getInfoForPrompt - - let +generatePromptFunctionFromString promptS modules_names line = + processString promptS + where processString :: String -> GHCi SDoc processString ('%':'s':xs) = liftM2 (<>) (return modules_list) (processString xs) where - modules_list = context <> modules_bit - modules_bit = hsep $ map text modules_names + modules_list = hsep $ map text modules_names processString ('%':'l':xs) = liftM2 (<>) (return $ ppr line) (processString xs) processString ('%':'d':xs) = @@ -861,8 +859,6 @@ generatePromptFunctionFromString promptS = \_ _ -> do processString "" = return empty - processString promptS - mkPrompt :: GHCi String mkPrompt = do st <- getGHCiState From git at git.haskell.org Mon May 14 12:50:30 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 12:50:30 +0000 (UTC) Subject: [commit: ghc] master: Revert "rts: Compile with gcc -Og" (1e27209) Message-ID: <20180514125030.DCB623ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e2720949a406f45b807fad69e7409777607f275/ghc >--------------------------------------------------------------- commit 1e2720949a406f45b807fad69e7409777607f275 Author: Ben Gamari Date: Mon May 14 08:48:42 2018 -0400 Revert "rts: Compile with gcc -Og" This reverts commit d4abd031f6e8c2fa01f8949f60d8a02cca513804. >--------------------------------------------------------------- 1e2720949a406f45b807fad69e7409777607f275 rts/ghc.mk | 2 +- rts/sm/Sanity.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index 2976b0a..e96e147 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -153,7 +153,7 @@ rts_dist_$1_CC_OPTS := $$(GhcRtsCcOpts) # The per-way CC_OPTS ifneq "$$(findstring debug, $1)" "" rts_dist_$1_HC_OPTS += -O0 -rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -Og +rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -O0 endif ifneq "$$(findstring dyn, $1)" "" diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 23a20b2..7a0ad16 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -481,7 +481,7 @@ checkCompactObjects(bdescr *bd) // before the actual closure for ( ; bd != NULL; bd = bd->link) { - StgCompactNFDataBlock *block, *last = NULL; + StgCompactNFDataBlock *block, *last; StgCompactNFData *str; StgWord totalW; From git at git.haskell.org Mon May 14 13:27:33 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 13:27:33 +0000 (UTC) Subject: [commit: ghc] master: Fix performance regressions from #14737 (d92c755) Message-ID: <20180514132733.0AD723ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d92c7556501a4cdeb7d269c4624992c94d9b3b8b/ghc >--------------------------------------------------------------- commit d92c7556501a4cdeb7d269c4624992c94d9b3b8b Author: Tobias Dammers Date: Mon May 14 08:50:29 2018 -0400 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. Reviewers: goldfire, bgamari, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, thomie, carter Differential Revision: https://phabricator.haskell.org/D4635 >--------------------------------------------------------------- d92c7556501a4cdeb7d269c4624992c94d9b3b8b compiler/coreSyn/CoreOpt.hs | 6 ++++ compiler/simplCore/Simplify.hs | 70 ++++++++++++++++++++++++++----------- testsuite/tests/perf/compiler/all.T | 4 ++- 3 files changed, 58 insertions(+), 22 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 03bc6cd..2027928 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -982,6 +982,9 @@ pushCoTyArg co ty -- -- | tyL `eqType` tyR -- -- = Just (ty, Nothing) + | isReflCo co + = Just (ty, Nothing) + | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) Just (ty `mkCastTy` mkSymCo co1, Just co2) @@ -1017,6 +1020,9 @@ pushCoValArg co -- -- | tyL `eqType` tyR -- -- = Just (mkRepReflCo arg, Nothing) + | isReflCo co + = Just (mkRepReflCo arg, Nothing) + | isFunTy tyL , (co1, co2) <- decomposeFunCo Representational co -- If co :: (tyL1 -> tyL2) ~ (tyR1 -> tyR2) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 2580720..b50771a 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1209,40 +1209,73 @@ rebuild env expr cont ************************************************************************ -} +{- Note [Optimising reflexivity] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +It's important (for compiler performance) to get rid of reflexivity as soon +as it appears. See Trac #11735, #14737, and #15019. + +In particular, we want to behave well on + + * e |> co1 |> co2 + where the two happen 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. + +However, we don't want to call isReflexiveCo too much, because it uses +type equality which is expensive on big types (Trac #14737 comment:7). + +A good compromise (determined experimentally) seems to be to call +isReflexiveCo + * when composing casts, and + * at the end + +In investigating this I saw missed opportunities for on-the-fly +coercion shrinkage. See Trac #15090. +-} + + simplCast :: SimplEnv -> InExpr -> Coercion -> SimplCont -> SimplM (SimplFloats, OutExpr) simplCast env body co0 cont0 = do { co1 <- {-#SCC "simplCast-simplCoercion" #-} simplCoercion env co0 - ; cont1 <- {-#SCC "simplCast-addCoerce" #-} addCoerce co1 cont0 + ; cont1 <- {-#SCC "simplCast-addCoerce" #-} + if isReflCo co1 + then return cont0 -- See Note [Optimising reflexivity] + else addCoerce co1 cont0 ; {-#SCC "simplCast-simplExprF" #-} 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 + addCoerceM :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont + addCoerceM Nothing cont = return cont + addCoerceM (Just co) cont = addCoerce co cont addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont - - addCoerce co1 (CastIt co2 cont) - = {-#SCC "addCoerce-simple-recursion" #-} - addCoerce (mkTransCo co1 co2) cont + addCoerce co1 (CastIt co2 cont) -- See Note [Optimising reflexivity] + | isReflexiveCo co' = return cont + | otherwise = 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 = {-#SCC "addCoerce-pushCoTyArg" #-} - do { tail' <- addCoerce0 m_co' tail + do { tail' <- addCoerceM 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 }) + , 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 + , 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 = {-#SCC "addCoerce-pushCoValArg" #-} - do { tail' <- addCoerce0 m_co2 tail + do { tail' <- addCoerceM m_co2 tail ; if isReflCo co1 then return (cont { sc_cont = tail' }) -- Avoid simplifying if possible; @@ -1260,15 +1293,10 @@ simplCast env body co0 cont0 , sc_cont = tail' }) } } addCoerce co cont - | isReflexiveCo co = {-#SCC "addCoerce-reflexive" #-} - return cont - | otherwise = {-#SCC "addCoerce-other" #-} - 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 + | isReflexiveCo co = return cont -- Having this at the end makes a huge + -- difference in T12227, for some reason + -- See Note [Optimising reflexivity] + | otherwise = return (CastIt co cont) simplArg :: SimplEnv -> DupFlag -> StaticEnv -> CoreExpr -> SimplM (DupFlag, StaticEnv, OutExpr) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 02668cf..3647b8a 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1051,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-30: 130646336 improved simplCast performance #15019 # 2018-04-26: 150743648 Do not unpack class dictionaries with INLINABLE ]), ], @@ -1122,7 +1123,7 @@ test('T13056', test('T12707', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1237898376, 5), + [(wordsize(64), 1141555816, 5), # initial: 1271577192 # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) @@ -1131,6 +1132,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-30: 1141555816 improved simplCast performance #15019 ]), ], compile, From git at git.haskell.org Mon May 14 21:00:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 May 2018 21:00:38 +0000 (UTC) Subject: [commit: ghc] master: rts: export new absentSumFieldError from base (79bbb23) Message-ID: <20180514210038.B159C3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/79bbb23fd3085c3dc52497175e9e74f73f7f6b68/ghc >--------------------------------------------------------------- commit 79bbb23fd3085c3dc52497175e9e74f73f7f6b68 Author: Sergei Trofimovich Date: Mon May 14 21:51:48 2018 +0100 rts: export new absentSumFieldError from base commit b2ff5dde399cd012218578945ada1d9ff68daa35 "Fix #15038" added new stable closure 'absentSumFieldError_closure' to base package. This closure is used in rts package. Unfortunately the symbol was not explicitly exported and build failed on windows as: ``` "inplace/bin/ghc-stage1" -o ...hsc2hs.exe ... rts/dist/build/libHSrts.a(RtsStartup.o): In function `hs_init_ghc': rts/RtsStartup.c:272:0: error: undefined reference to `base_ControlziExceptionziBase_absentSumFieldError_closure' | 272 | getStablePtr((StgPtr)absentSumFieldError_closure); | ^ ``` This change adds 'absentSumFieldError_closure' to explicit export into libHSbase.def. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 79bbb23fd3085c3dc52497175e9e74f73f7f6b68 rts/package.conf.in | 2 ++ rts/rts.cabal.in | 2 ++ rts/win32/libHSbase.def | 1 + 3 files changed, 5 insertions(+) diff --git a/rts/package.conf.in b/rts/package.conf.in index 15b8ac2..af5c282 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -93,6 +93,7 @@ ld-options: , "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure" , "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure" , "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure" + , "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure" , "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure" , "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure" , "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure" @@ -190,6 +191,7 @@ ld-options: , "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure" , "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure" , "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure" + , "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure" , "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure" , "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure" , "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure" diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index c1efd4e..7c1df5a 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -193,6 +193,7 @@ library "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure" "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure" "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure" + "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure" "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure" "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure" "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure" @@ -262,6 +263,7 @@ library "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure" "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure" "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure" + "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure" "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure" "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure" "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure" diff --git a/rts/win32/libHSbase.def b/rts/win32/libHSbase.def index 496893a..d4ec1fa 100644 --- a/rts/win32/libHSbase.def +++ b/rts/win32/libHSbase.def @@ -42,6 +42,7 @@ EXPORTS base_GHCziIOziException_cannotCompactPinned_closure base_GHCziIOziException_cannotCompactMutable_closure + base_ControlziExceptionziBase_absentSumFieldError_closure base_ControlziExceptionziBase_nonTermination_closure base_ControlziExceptionziBase_nestedAtomically_closure base_GHCziEventziThread_blockedOnBadFD_closure From git at git.haskell.org Tue May 15 02:39:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 02:39:28 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T11295-part1' created Message-ID: <20180515023928.ECC443ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T11295-part1 Referencing: d7cb5bb351e7cc2e75de518705ec73afc54263d0 From git at git.haskell.org Tue May 15 02:39:31 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 02:39:31 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: need to actually make the llvm-passes file now (d7cb5bb) Message-ID: <20180515023931.CF6363ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/d7cb5bb351e7cc2e75de518705ec73afc54263d0/ghc >--------------------------------------------------------------- commit d7cb5bb351e7cc2e75de518705ec73afc54263d0 Author: Kavon Farvardin Date: Mon May 14 21:36:07 2018 -0500 need to actually make the llvm-passes file now >--------------------------------------------------------------- d7cb5bb351e7cc2e75de518705ec73afc54263d0 compiler/main/DynFlags.hs | 13 +++++++++---- compiler/main/GHC.hs | 4 ++-- compiler/main/SysTools.hs | 26 ++++++++++++++++---------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 25e99ee..7fb9703 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -79,7 +79,7 @@ module DynFlags ( unsafeFlags, unsafeFlagsForInfer, -- ** LLVM Targets - LlvmTarget(..), LlvmTargets, + LlvmTarget(..), LlvmTargets, LlvmPasses, LlvmConfig, -- ** System tool settings and locations Settings(..), @@ -828,6 +828,7 @@ data DynFlags = DynFlags { hscTarget :: HscTarget, settings :: Settings, llvmTargets :: LlvmTargets, + llvmPasses :: LlvmPasses, verbosity :: Int, -- ^ Verbosity level: see Note [Verbosity levels] optLevel :: Int, -- ^ Optimisation level debugLevel :: Int, -- ^ How much debug information to produce @@ -1144,6 +1145,8 @@ data LlvmTarget = LlvmTarget } type LlvmTargets = [(String, LlvmTarget)] +type LlvmPasses = [(Int, String)] +type LlvmConfig = (LlvmTargets, LlvmPasses) data Settings = Settings { sTargetPlatform :: Platform, -- Filled in by SysTools @@ -1720,8 +1723,8 @@ initDynFlags dflags = do -- | The normal 'DynFlags'. Note that they are not suitable for use in this form -- and must be fully initialized by 'GHC.runGhc' first. -defaultDynFlags :: Settings -> LlvmTargets -> DynFlags -defaultDynFlags mySettings myLlvmTargets = +defaultDynFlags :: Settings -> LlvmConfig -> DynFlags +defaultDynFlags mySettings (myLlvmTargets, myLlvmPasses) = -- See Note [Updating flag description in the User's Guide] DynFlags { ghcMode = CompManager, @@ -1816,6 +1819,7 @@ defaultDynFlags mySettings myLlvmTargets = splitInfo = Nothing, settings = mySettings, llvmTargets = myLlvmTargets, + llvmPasses = myLlvmPasses, -- ghc -M values depMakefile = "Makefile", @@ -5464,10 +5468,11 @@ makeDynFlagsConsistent dflags -- initialized. defaultGlobalDynFlags :: DynFlags defaultGlobalDynFlags = - (defaultDynFlags settings llvmTargets) { verbosity = 2 } + (defaultDynFlags settings (llvmTargets, llvmPasses)) { verbosity = 2 } where settings = panic "v_unsafeGlobalDynFlags: settings not initialised" llvmTargets = panic "v_unsafeGlobalDynFlags: llvmTargets not initialised" + llvmPasses = panic "v_unsafeGlobalDynFlags: llvmPasses not initialised" #if STAGE < 2 GLOBAL_VAR(v_unsafeGlobalDynFlags, defaultGlobalDynFlags, DynFlags) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 5f1eba5..49e6c21 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -492,8 +492,8 @@ initGhcMonad :: GhcMonad m => Maybe FilePath -> m () initGhcMonad mb_top_dir = do { env <- liftIO $ do { mySettings <- initSysTools mb_top_dir - ; myLlvmTargets <- initLlvmTargets mb_top_dir - ; dflags <- initDynFlags (defaultDynFlags mySettings myLlvmTargets) + ; myLlvmConfig <- initLlvmConfig mb_top_dir + ; dflags <- initDynFlags (defaultDynFlags mySettings myLlvmConfig) ; checkBrokenTablesNextToCode dflags ; setUnsafeGlobalDynFlags dflags -- c.f. DynFlags.parseDynamicFlagsFull, which diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 619e0b6..8d7d1ea 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -13,7 +13,7 @@ module SysTools ( -- * Initialisation initSysTools, - initLlvmTargets, + initLlvmConfig, -- * Interface to system tools module SysTools.Tasks, @@ -110,16 +110,22 @@ stuff. ************************************************************************ -} -initLlvmTargets :: Maybe String - -> IO LlvmTargets -initLlvmTargets mbMinusB - = do top_dir <- findTopDir mbMinusB - let llvmTargetsFile = top_dir "llvm-targets" - llvmTargetsStr <- readFile llvmTargetsFile - case maybeReadFuzzy llvmTargetsStr of - Just s -> return (fmap mkLlvmTarget <$> s) - Nothing -> pgmError ("Can't parse " ++ show llvmTargetsFile) +initLlvmConfig :: Maybe String + -> IO LlvmConfig +initLlvmConfig mbMinusB + = do + tgts <- readAndParse "llvm-targets" mkLlvmTarget + passes <- readAndParse "llvm-passes" id + return (tgts, passes) where + readAndParse name bldr = + do top_dir <- findTopDir mbMinusB + let llvmConfigFile = top_dir name + llvmConfigStr <- readFile llvmConfigFile + case maybeReadFuzzy llvmConfigStr of + Just s -> return (fmap bldr <$> s) + Nothing -> pgmError ("Can't parse " ++ show llvmConfigFile) + mkLlvmTarget :: (String, String, String) -> LlvmTarget mkLlvmTarget (dl, cpu, attrs) = LlvmTarget dl cpu (words attrs) From git at git.haskell.org Tue May 15 14:29:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 14:29:59 +0000 (UTC) Subject: [commit: ghc] master: Tidy up error suppression (f49f90b) Message-ID: <20180515142959.828F63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f49f90bb84b12515366de9b8184644b5c3798901/ghc >--------------------------------------------------------------- commit f49f90bb84b12515366de9b8184644b5c3798901 Author: Simon Peyton Jones Date: Tue May 15 11:36:28 2018 +0100 Tidy up error suppression Trac #15152 showed that when a flag turned an error into a warning, we were still (alas) suppressing subequent errors; includign their essential addTcEvBind. That led (rightly) to a Lint error. This patch fixes it, and incidentally tidies up an ad-hoc special case of out-of-scope variables (see the old binding for 'out_of_scope_killer' in 'tryReporters'). No test, because the problem was only shown up when turning inaccessible code into a warning. >--------------------------------------------------------------- f49f90bb84b12515366de9b8184644b5c3798901 compiler/typecheck/TcErrors.hs | 56 +++++++++++++--------- .../tests/partial-sigs/should_fail/T14584.stderr | 11 +++++ .../tests/partial-sigs/should_fail/T14584a.stderr | 13 +++++ 3 files changed, 57 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 f49f90bb84b12515366de9b8184644b5c3798901 From git at git.haskell.org Tue May 15 17:04:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 17:04:47 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix expected allocations of T9020 and T12425 (df6670e) Message-ID: <20180515170447.285FF3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/df6670e7fec07f6ea1423e9e899209a3e66855ec/ghc >--------------------------------------------------------------- commit df6670e7fec07f6ea1423e9e899209a3e66855ec Author: Ben Gamari Date: Mon May 14 17:19:07 2018 -0400 testsuite: Fix expected allocations of T9020 and T12425 These were both improved by d92c7556501a4cdeb7d269c4624992c94d9b3b8b but the changes were lost due to merge silliness. >--------------------------------------------------------------- df6670e7fec07f6ea1423e9e899209a3e66855ec testsuite/tests/perf/compiler/all.T | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 3647b8a..fbca75d 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -749,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), 391876936, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -764,6 +764,7 @@ test('T9020', # 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 + # 2018-05-14: 391876936 Improved simplCast performance #15019 ], compile,['']) @@ -1042,7 +1043,7 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 150743648, 5), + [(wordsize(64), 139100464, 5), # initial: 125831400 # 2017-01-18: 133380960 Allow top-level string literals in Core # 2017-02-17: 153611448 Type-indexed Typeable @@ -1051,8 +1052,8 @@ 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-30: 130646336 improved simplCast performance #15019 # 2018-04-26: 150743648 Do not unpack class dictionaries with INLINABLE + # 2018-05-14: 139100464 improved simplCast performance #15019 ]), ], compile, From git at git.haskell.org Tue May 15 17:05:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 17:05:02 +0000 (UTC) Subject: [commit: ghc] master: Revert "Simplify callSiteInline a little" (9dbf66d) Message-ID: <20180515170502.5607C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9dbf66d74e65309d02c9d700094e363f59c94096/ghc >--------------------------------------------------------------- commit 9dbf66d74e65309d02c9d700094e363f59c94096 Author: Ben Gamari Date: Mon May 14 09:25:32 2018 -0400 Revert "Simplify callSiteInline a little" This lead to some rather significant performance regressions. Specifically, bytes allocated value is too high: Expected T5631(normal) bytes allocated: 1106015512 +/-5% Lower bound T5631(normal) bytes allocated: 1050714736 Upper bound T5631(normal) bytes allocated: 1161316288 Actual T5631(normal) bytes allocated: 1164953208 Deviation T5631(normal) bytes allocated: 5.3 % *** unexpected stat test failure for T5631(normal) max_bytes_used value is too high: Expected T9630(normal) max_bytes_used: 35324712 +/-15% Lower bound T9630(normal) max_bytes_used: 30026005 Upper bound T9630(normal) max_bytes_used: 40623419 Actual T9630(normal) max_bytes_used: 43490984 Deviation T9630(normal) max_bytes_used: 23.1 % *** unexpected stat test failure for T9630(normal) This reverts commit 7271db46c332f15c302b9a55f4ed005cdd0fb898. This reverts commit b750dcc5d9e1df8505788a41d0cf0d92acd17f0d. This reverts commit 33de71fa06d03e6da396a7c0a314fea3b492ab91. >--------------------------------------------------------------- 9dbf66d74e65309d02c9d700094e363f59c94096 compiler/coreSyn/CoreUnfold.hs | 33 +++++++++++++++++---------------- testsuite/tests/perf/compiler/all.T | 10 ++++------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index b4f080b..c1f7892 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -1151,11 +1151,11 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info -- idUnfolding checks for loop-breakers, returning NoUnfolding -- Things with an INLINE pragma may have an unfolding *and* -- be a loop breaker (maybe the knot is not yet untied) - CoreUnfolding { uf_tmpl = unf_template + CoreUnfolding { uf_tmpl = unf_template, uf_is_top = is_top , uf_is_work_free = is_wf , uf_guidance = guidance, uf_expandable = is_exp } | active_unfolding -> tryUnfolding dflags id lone_variable - arg_infos cont_info unf_template + arg_infos cont_info unf_template is_top is_wf is_exp guidance | otherwise -> traceInline dflags id "Inactive unfolding:" (ppr id) Nothing NoUnfolding -> Nothing @@ -1175,10 +1175,10 @@ traceInline dflags inline_id str doc result = result tryUnfolding :: DynFlags -> Id -> Bool -> [ArgSummary] -> CallCtxt - -> CoreExpr -> Bool -> Bool -> UnfoldingGuidance + -> CoreExpr -> Bool -> Bool -> Bool -> UnfoldingGuidance -> Maybe CoreExpr tryUnfolding dflags id lone_variable - arg_infos cont_info unf_template + arg_infos cont_info unf_template is_top is_wf is_exp guidance = case guidance of UnfNever -> traceInline dflags id str (text "UnfNever") Nothing @@ -1250,10 +1250,10 @@ tryUnfolding dflags id lone_variable CaseCtxt -> not (lone_variable && is_exp) -- Note [Lone variables] ValAppCtxt -> True -- Note [Cast then apply] RuleArgCtxt -> uf_arity > 0 -- See Note [Unfold info lazy contexts] - DiscArgCtxt -> uf_arity > 0 -- Note [Inlining in ArgCtxt] + DiscArgCtxt -> uf_arity > 0 -- RhsCtxt -> uf_arity > 0 -- - _other -> False -- See Note [Nested functions] - + _ -> not is_top && uf_arity > 0 -- Note [Nested functions] + -- Note [Inlining in ArgCtxt] {- Note [Unfold into lazy contexts], Note [RHS of lets] @@ -1323,17 +1323,18 @@ However for worker/wrapper it may be worth inlining even if the arity is not satisfied (as we do in the CoreUnfolding case) so we don't require saturation. + Note [Nested functions] ~~~~~~~~~~~~~~~~~~~~~~~ -At one time we treated a call of a non-top-level function as -"interesting" (regardless of how boring the context) in the hope -that inlining it would eliminate the binding, and its allocation. -Specifically, in the default case of interesting_call we had - _other -> not is_top && uf_arity > 0 - -But actually postInlineUnconditionally does some of this and overall -it makes virtually no difference to nofib. So I simplified away this -special case +If a function has a nested defn we also record some-benefit, on the +grounds that we are often able to eliminate the binding, and hence the +allocation, for the function altogether; this is good for join points. +But this only makes sense for *functions*; inlining a constructor +doesn't help allocation unless the result is scrutinised. UNLESS the +constructor occurs just once, albeit possibly in multiple case +branches. Then inlining it doesn't increase allocation, but it does +increase the chance that the constructor won't be allocated at all in +the branches that don't use it. Note [Cast then apply] ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index fbca75d..7718551 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -449,7 +449,7 @@ test('T5631', # 2014-04-04: 346389856 (x86 Windows, 64 bit machine) # 2014-12-01: 390199244 (Windows laptop) # 2016-04-06: 570137436 (amd64/Linux) many reasons - (wordsize(64), 1164944688, 5)]), + (wordsize(64), 1106015512, 5)]), # expected value: 774595008 (amd64/Linux): # expected value: 735486328 (amd64/Linux) 2012/12/12: # expected value: 690742040 (amd64/Linux) Call Arity improvements @@ -464,9 +464,8 @@ test('T5631', # 2017-02-17: 1517484488 (amd64/Linux) Type-indexed Typeable # 2017-03-03: 1065147968 (amd64/Linux) Share Typeable KindReps # 2017-03-31: 1037482512 (amd64/Linux) Fix memory leak in simplifier - # 2017-07-27: 1106015512 (Mac) Regresssion from tracking visibility in - # TypeEqOrigin should be fixed by #14037 - # 2018-05-05: 1164944688 (amd64/Linux) Simplify callSiteInline a little + # 2017-07-27: 1106015512 (Mac) Regresssion from tracking visibility in TypeEqOrigin + # should be fixed by #14037 only_ways(['normal']) ], compile, @@ -1271,11 +1270,10 @@ test ('T9630', [ compiler_stats_num_field('max_bytes_used', # Note [residency] [(platform('x86_64-unknown-mingw32'), 39867088, 15), # 2017-12-24: 34171816 (x64/Windows) - (wordsize(64), 42664296, 15) + (wordsize(64), 35324712, 15) # initial: 56955240 # 2017-06-07: 41568168 Stop the specialiser generating loopy code # 2018-02-25: 35324712 It's not entirely clear - # 2018-05-05: 42664296 Don't inline nested function bindings as aggressively ]), extra_clean(['T9630a.hi', 'T9630a.o']) ], From git at git.haskell.org Tue May 15 17:05:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 17:05:17 +0000 (UTC) Subject: [commit: ghc] master: Ensure that RTS cabal file reflects dependency on libnuma (45ad0c3) Message-ID: <20180515170517.4ECE33ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/45ad0c3946623bc8635d6e3964d9ebb1555a3df6/ghc >--------------------------------------------------------------- commit 45ad0c3946623bc8635d6e3964d9ebb1555a3df6 Author: Ben Gamari Date: Mon May 14 10:17:51 2018 -0400 Ensure that RTS cabal file reflects dependency on libnuma Test Plan: Validate with Hadrian and `libnuma` support Reviewers: snowleopard, hvr, erikd, simonmar Subscribers: izgzhen, alpmestan, thomie, carter Differential Revision: https://phabricator.haskell.org/D4616 >--------------------------------------------------------------- 45ad0c3946623bc8635d6e3964d9ebb1555a3df6 configure.ac | 6 ++++++ rts/rts.cabal.in | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac index a8b8681..1f49128 100644 --- a/configure.ac +++ b/configure.ac @@ -1258,6 +1258,12 @@ if test "$ac_cv_header_numa_h$ac_cv_header_numaif_h" = "yesyes" ; then AC_CHECK_LIB(numa, numa_available,HaveLibNuma=1) fi AC_DEFINE_UNQUOTED([HAVE_LIBNUMA], [$HaveLibNuma], [Define to 1 if you have libnuma]) +if test $HaveLibNuma = "YES" ; then + AC_SUBST([CabalHaveLibNuma],[True]) +else + AC_SUBST([CabalHaveLibNuma],[False]) +fi + dnl ** Documentation dnl -------------------------------------------------------------- diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index 7c1df5a..a82deb0 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -20,6 +20,8 @@ flag mingwex default: @CabalMingwex@ flag libdw default: @CabalHaveLibdw@ +flag libnuma + default: @CabalHaveLibNuma@ flag 64bit default: @Cabal64bit@ flag leading-underscore @@ -88,6 +90,8 @@ library if flag(libdw) -- for backtraces extra-libraries: elf dw + if flag(libnuma) + extra-libraries: numa if !flag(smp) cpp-options: -DNOSMP From git at git.haskell.org Tue May 15 17:05:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 17:05:32 +0000 (UTC) Subject: [commit: ghc] master: More explicit comment on switch in registerDelay (1154c9b) Message-ID: <20180515170532.7A6CC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1154c9b6332342e0447ab64c082b016862bc97da/ghc >--------------------------------------------------------------- commit 1154c9b6332342e0447ab64c082b016862bc97da Author: Kirill Zaborsky Date: Thu May 10 17:57:59 2018 +0300 More explicit comment on switch in registerDelay >--------------------------------------------------------------- 1154c9b6332342e0447ab64c082b016862bc97da libraries/base/GHC/Conc/IO.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Conc/IO.hs b/libraries/base/GHC/Conc/IO.hs index eb0bffe..3c37cbd 100644 --- a/libraries/base/GHC/Conc/IO.hs +++ b/libraries/base/GHC/Conc/IO.hs @@ -188,8 +188,9 @@ threadDelay time case delay# time# s of { s' -> (# s', () #) }} --- | Set the value of returned TVar to True after a given number of --- microseconds. The caveats associated with threadDelay also apply. +-- | Switch the value of returned 'TVar' from intial value 'False' to 'True' +-- after a given number of microseconds. The caveats associated with +-- 'threadDelay' also apply. -- registerDelay :: Int -> IO (TVar Bool) registerDelay usecs From git at git.haskell.org Tue May 15 17:05:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 17:05:47 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Disable T14697 on Windows (af986f9) Message-ID: <20180515170547.66BFC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af986f9dfb49db5544e4d670cde9a9a70a9a1223/ghc >--------------------------------------------------------------- commit af986f9dfb49db5544e4d670cde9a9a70a9a1223 Author: Ben Gamari Date: Mon May 14 16:36:52 2018 -0400 testsuite: Disable T14697 on Windows Test Plan: Validate on Windows Subscribers: thomie, carter GHC Trac Issues: #14697, #15072 Differential Revision: https://phabricator.haskell.org/D4619 >--------------------------------------------------------------- af986f9dfb49db5544e4d670cde9a9a70a9a1223 testsuite/tests/perf/compiler/all.T | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 7718551..5ef5a3d 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1236,6 +1236,8 @@ test('T14697', # initial: 635573784 # 2018-02-23: 337290376 Cache the fingerprint of sOpt_P ]), + # This generates too large of a command-line for poor Windows + when(opsys('mingw32'), expect_broken(15072)), pre_cmd('./genT14697'), extra_files(['genT14697']), extra_hc_opts('$(cat T14697-flags)'), # 10k -optP arguments From git at git.haskell.org Tue May 15 17:06:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 17:06:02 +0000 (UTC) Subject: [commit: ghc] master: Calling GetLastError() on Windows for socket IO (trac issue #12012) (01b15b8) Message-ID: <20180515170602.320033ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/01b15b88639443bec12415b6b0d906261bd6c047/ghc >--------------------------------------------------------------- commit 01b15b88639443bec12415b6b0d906261bd6c047 Author: ARJANEN Loïc Jean David Date: Mon May 14 16:38:21 2018 -0400 Calling GetLastError() on Windows for socket IO (trac issue #12012) For the threaded RTS, putting a private copy of the throwErrno series in GHC.IO.FD which gets if the operation was on a socket, so that we can call c_maperrno if need be. For the non-threaded RTS, if memory serves we call GetLastError() in case of an error on socket IO. However, we don't do the translation ErrCode ↔ Errno currently (and besides, it's a primop) so we do it if needed through c_maperrno_func in the asynchronous read/write functions. Signed-off-by: ARJANEN Loïc Jean David Reviewers: ekmett, hvr, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #12012 Differential Revision: https://phabricator.haskell.org/D4639 >--------------------------------------------------------------- 01b15b88639443bec12415b6b0d906261bd6c047 libraries/base/GHC/IO/FD.hs | 51 +++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/libraries/base/GHC/IO/FD.hs b/libraries/base/GHC/IO/FD.hs index bb188a9..d5567f0 100644 --- a/libraries/base/GHC/IO/FD.hs +++ b/libraries/base/GHC/IO/FD.hs @@ -45,6 +45,7 @@ import GHC.Conc.IO import GHC.IO.Exception #if defined(mingw32_HOST_OS) import GHC.Windows +import Data.Bool #endif import Foreign @@ -589,8 +590,10 @@ asyncReadRawBufferPtr loc !fd !buf !off !len = do (l, rc) <- asyncRead (fromIntegral (fdFD fd)) (fdIsSocket_ fd) (fromIntegral len) (buf `plusPtr` off) if l == (-1) - then - ioError (errnoToIOError loc (Errno (fromIntegral rc)) Nothing Nothing) + then let sock_errno = c_maperrno_func (fromIntegral rc) + non_sock_errno = Errno (fromIntegral rc) + errno = bool non_sock_errno sock_errno (fdIsSocket fd) + in ioError (errnoToIOError loc errno Nothing Nothing) else return (fromIntegral l) asyncWriteRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt @@ -598,34 +601,46 @@ asyncWriteRawBufferPtr loc !fd !buf !off !len = do (l, rc) <- asyncWrite (fromIntegral (fdFD fd)) (fdIsSocket_ fd) (fromIntegral len) (buf `plusPtr` off) if l == (-1) - then - ioError (errnoToIOError loc (Errno (fromIntegral rc)) Nothing Nothing) + then let sock_errno = c_maperrno_func (fromIntegral rc) + non_sock_errno = Errno (fromIntegral rc) + errno = bool non_sock_errno sock_errno (fdIsSocket fd) + in ioError (errnoToIOError loc errno Nothing Nothing) else return (fromIntegral l) -- Blocking versions of the read/write primitives, for the threaded RTS blockingReadRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt blockingReadRawBufferPtr loc !fd !buf !off !len - = throwErrnoIfMinus1Retry loc $ - if fdIsSocket fd - then c_safe_recv (fdFD fd) (buf `plusPtr` off) (fromIntegral len) 0 - else c_safe_read (fdFD fd) (buf `plusPtr` off) (fromIntegral len) + = throwErrnoIfMinus1Retry loc $ do + let start_ptr = buf `plusPtr` off + recv_ret = c_safe_recv (fdFD fd) start_ptr (fromIntegral len) 0 + read_ret = c_safe_read (fdFD fd) start_ptr (fromIntegral len) + r <- bool read_ret recv_ret (fdIsSocket fd) + when ((fdIsSocket fd) && (r == -1)) c_maperrno + return r + -- We trust read() to give us the correct errno but recv(), as a + -- Winsock function, doesn't do the errno conversion so if the fd + -- is for a socket, we do it from GetLastError() ourselves. blockingWriteRawBufferPtr :: String -> FD -> Ptr Word8-> Int -> CSize -> IO CInt blockingWriteRawBufferPtr loc !fd !buf !off !len - = throwErrnoIfMinus1Retry loc $ - if fdIsSocket fd - then c_safe_send (fdFD fd) (buf `plusPtr` off) (fromIntegral len) 0 - else do - r <- c_safe_write (fdFD fd) (buf `plusPtr` off) (fromIntegral len) - when (r == -1) c_maperrno - return r - -- we don't trust write() to give us the correct errno, and + = throwErrnoIfMinus1Retry loc $ do + let start_ptr = buf `plusPtr` off + send_ret = c_safe_send (fdFD fd) start_ptr (fromIntegral len) 0 + write_ret = c_safe_write (fdFD fd) start_ptr (fromIntegral len) + r <- bool write_ret send_ret (fdIsSocket fd) + when (r == -1) c_maperrno + return r + -- We don't trust write() to give us the correct errno, and -- instead do the errno conversion from GetLastError() - -- ourselves. The main reason is that we treat ERROR_NO_DATA + -- ourselves. The main reason is that we treat ERROR_NO_DATA -- (pipe is closing) as EPIPE, whereas write() returns EINVAL - -- for this case. We need to detect EPIPE correctly, because it + -- for this case. We need to detect EPIPE correctly, because it -- shouldn't be reported as an error when it happens on stdout. + -- As for send()'s case, Winsock functions don't do errno + -- conversion in any case so we have to do it ourselves. + -- That means we're doing the errno conversion no matter if the + -- fd is from a socket or not. -- NOTE: "safe" versions of the read/write calls for use by the threaded RTS. -- These calls may block, but that's ok. From git at git.haskell.org Tue May 15 18:28:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 18:28:43 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: updated the makefile-based build system for llvm-passes (f433a24) Message-ID: <20180515182843.85DB63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/f433a2490f50e6ff39290c46ce1eacc20dcbb4cc/ghc >--------------------------------------------------------------- commit f433a2490f50e6ff39290c46ce1eacc20dcbb4cc Author: Kavon Farvardin Date: Tue May 15 13:24:59 2018 -0500 updated the makefile-based build system for llvm-passes >--------------------------------------------------------------- f433a2490f50e6ff39290c46ce1eacc20dcbb4cc ghc.mk | 7 ++++--- ghc/GHCi/UI.hs | 8 ++++++-- ghc/ghc.mk | 6 +++++- testsuite/tests/codeGen/should_run/cgrun058.stdout => llvm-passes | 0 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ghc.mk b/ghc.mk index 3573b75..f90863f 100644 --- a/ghc.mk +++ b/ghc.mk @@ -1046,6 +1046,7 @@ $(eval $(call bindist-list,.,\ configure config.sub config.guess install-sh \ settings.in \ llvm-targets \ + llvm-passes \ packages \ Makefile \ mk/config.mk.in \ @@ -1072,7 +1073,7 @@ $(eval $(call bindist-list,.,\ $(wildcard compiler/stage2/doc) \ $(wildcard libraries/*/dist-install/doc/) \ $(wildcard libraries/*/*/dist-install/doc/) \ - $(filter-out settings llvm-targets,$(INSTALL_LIBS)) \ + $(filter-out settings llvm-targets llvm-passes,$(INSTALL_LIBS)) \ $(RTS_INSTALL_LIBS) \ $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \ mk/project.mk \ @@ -1105,7 +1106,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk unix-binary-dist-prep: $(call removeTrees,bindistprep/) "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) - set -e; for i in packages LICENSE compiler ghc iserv rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in llvm-targets ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done + set -e; for i in packages LICENSE compiler ghc iserv rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK) echo "BUILD_SPHINX_HTML = $(BUILD_SPHINX_HTML)" >> $(BIN_DIST_MK) echo "BUILD_SPHINX_PDF = $(BUILD_SPHINX_PDF)" >> $(BIN_DIST_MK) @@ -1203,7 +1204,7 @@ SRC_DIST_GHC_DIRS = mk rules docs distrib bindisttest libffi includes \ SRC_DIST_GHC_FILES += \ configure.ac config.guess config.sub configure \ aclocal.m4 README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \ - install-sh settings.in llvm-targets VERSION GIT_COMMIT_ID \ + install-sh settings.in llvm-targets llvm-passes VERSION GIT_COMMIT_ID \ boot packages ghc.mk MAKEHELP.md .PHONY: VERSION diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 3ed1c7f..8ac4cfa 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -2555,7 +2555,9 @@ showDynFlags show_all dflags = do is_on = test f dflags quiet = not show_all && test f default_dflags == is_on - default_dflags = defaultDynFlags (settings dflags) (llvmTargets dflags) + llvmConfig = (llvmTargets dflags, llvmPasses dflags) + + default_dflags = defaultDynFlags (settings dflags) llvmConfig (ghciFlags,others) = partition (\f -> flagSpecFlag f `elem` flgs) DynFlags.fFlags @@ -2966,8 +2968,10 @@ showLanguages' show_all dflags = is_on = test f dflags quiet = not show_all && test f default_dflags == is_on + llvmConfig = (llvmTargets dflags, llvmPasses dflags) + default_dflags = - defaultDynFlags (settings dflags) (llvmTargets dflags) `lang_set` + defaultDynFlags (settings dflags) llvmConfig `lang_set` case language dflags of Nothing -> Just Haskell2010 other -> other diff --git a/ghc/ghc.mk b/ghc/ghc.mk index 20fa142..6e32935 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -135,6 +135,9 @@ $(INPLACE_LIB)/settings : settings $(INPLACE_LIB)/llvm-targets : llvm-targets "$(CP)" $< $@ +$(INPLACE_LIB)/llvm-passes : llvm-passes + "$(CP)" $< $@ + $(INPLACE_LIB)/platformConstants: $(includes_GHCCONSTANTS_HASKELL_VALUE) "$(CP)" $< $@ @@ -144,6 +147,7 @@ $(INPLACE_LIB)/platformConstants: $(includes_GHCCONSTANTS_HASKELL_VALUE) GHC_DEPENDENCIES += $$(unlit_INPLACE) GHC_DEPENDENCIES += $(INPLACE_LIB)/settings GHC_DEPENDENCIES += $(INPLACE_LIB)/llvm-targets +GHC_DEPENDENCIES += $(INPLACE_LIB)/llvm-passes GHC_DEPENDENCIES += $(INPLACE_LIB)/platformConstants $(GHC_STAGE1) : | $(GHC_DEPENDENCIES) @@ -172,6 +176,7 @@ endif INSTALL_LIBS += settings INSTALL_LIBS += llvm-targets +INSTALL_LIBS += llvm-passes ifeq "$(Windows_Host)" "NO" install: install_ghc_link @@ -188,4 +193,3 @@ install_ghc_post: install_bins $(call removeFiles,"$(DESTDIR)$(bindir)/ghc.exe") "$(MV)" -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc.exe endif - diff --git a/testsuite/tests/codeGen/should_run/cgrun058.stdout b/llvm-passes similarity index 100% copy from testsuite/tests/codeGen/should_run/cgrun058.stdout copy to llvm-passes From git at git.haskell.org Tue May 15 19:04:13 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 19:04:13 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: use passes found in the file instead (58221e4) Message-ID: <20180515190413.9245A3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/58221e4bae7c4c563a8f55c7e1e9252e54ccdae9/ghc >--------------------------------------------------------------- commit 58221e4bae7c4c563a8f55c7e1e9252e54ccdae9 Author: Kavon Farvardin Date: Tue May 15 14:03:53 2018 -0500 use passes found in the file instead >--------------------------------------------------------------- 58221e4bae7c4c563a8f55c7e1e9252e54ccdae9 compiler/main/DriverPipeline.hs | 10 ++++++---- llvm-passes | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 0ed65d3..74aef51 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1474,10 +1474,12 @@ runPhase (RealPhase LlvmOpt) input_fn dflags where -- we always (unless -optlo specified) run Opt since we rely on it to -- fix up some pretty big deficiencies in the code we generate - llvmOpts = case optLevel dflags of - 0 -> "-mem2reg -globalopt" - 1 -> "-O1 -globalopt" - _ -> "-O2" + optIdx = min 2 $ max 0 $ optLevel dflags -- ensure we're in [0,2] + llvmOpts = case lookup optIdx $ llvmPasses dflags of + Just passes -> passes + Nothing -> panic ("runPhase LlvmOpt: llvm-passes file " + ++ "is missing passes for level " + ++ show optIdx) -- don't specify anything if user has specified commands. We do this -- for opt but not llc since opt is very specifically for optimisation diff --git a/llvm-passes b/llvm-passes index fe51488..5183c9f 100644 --- a/llvm-passes +++ b/llvm-passes @@ -1 +1,5 @@ -[] +[ +(0, "-mem2reg -globalopt"), +(1, "-O1 -globalopt"), +(2, "-O2") +] From git at git.haskell.org Tue May 15 19:24:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 19:24:32 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: Merge branch 'master' into wip/T11295-part1 (1193924) Message-ID: <20180515192432.B926B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/119392480a10ed19cd09871494b70966371d018b/ghc >--------------------------------------------------------------- commit 119392480a10ed19cd09871494b70966371d018b Merge: 58221e4 01b15b8 Author: Kavon Farvardin Date: Tue May 15 14:09:28 2018 -0500 Merge branch 'master' into wip/T11295-part1 >--------------------------------------------------------------- 119392480a10ed19cd09871494b70966371d018b compiler/coreSyn/CoreUnfold.hs | 33 ++++++------- compiler/typecheck/TcErrors.hs | 56 +++++++++++++--------- configure.ac | 6 +++ libraries/base/GHC/Conc/IO.hs | 5 +- libraries/base/GHC/IO/FD.hs | 51 +++++++++++++------- rts/rts.cabal.in | 4 ++ .../tests/partial-sigs/should_fail/T14584.stderr | 11 +++++ .../tests/partial-sigs/should_fail/T14584a.stderr | 13 +++++ testsuite/tests/perf/compiler/all.T | 19 ++++---- 9 files changed, 130 insertions(+), 68 deletions(-) From git at git.haskell.org Tue May 15 19:24:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 19:24:35 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1's head updated: Merge branch 'master' into wip/T11295-part1 (1193924) Message-ID: <20180515192435.75B1E3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T11295-part1' now includes: f49f90b Tidy up error suppression df6670e testsuite: Fix expected allocations of T9020 and T12425 9dbf66d Revert "Simplify callSiteInline a little" 45ad0c3 Ensure that RTS cabal file reflects dependency on libnuma 1154c9b More explicit comment on switch in registerDelay af986f9 testsuite: Disable T14697 on Windows 01b15b8 Calling GetLastError() on Windows for socket IO (trac issue #12012) 1193924 Merge branch 'master' into wip/T11295-part1 From git at git.haskell.org Tue May 15 21:47:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 21:47:50 +0000 (UTC) Subject: [commit: ghc] master: Algebraically simplify add/sub with carry/overflow (bb338f2) Message-ID: <20180515214750.170523ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa/ghc >--------------------------------------------------------------- commit bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa Author: Sebastian Graf Date: Tue May 15 13:12:56 2018 -0400 Algebraically simplify add/sub with carry/overflow Previously, the `{add,sub}{Int,Word}C#` PrimOps weren't handled in PrelRules (constant folding and algebraic simplification) at all. This implements the necessary logic, so that using these primitives isn't too punishing compared to their well-optimised, overflow-unaware counterparts. This is so that using these primitives in `enumFromThenTo @Int` can be optimized by constant folding, reducing closure sizes. Reviewers: bgamari, simonpj, hsyl20 Reviewed By: bgamari, simonpj Subscribers: AndreasK, thomie, carter GHC Trac Issues: #8763 Differential Revision: https://phabricator.haskell.org/D4605 >--------------------------------------------------------------- bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa compiler/basicTypes/Literal.hs | 48 +++++++++---- compiler/prelude/PrelRules.hs | 79 +++++++++++++++++++++- testsuite/tests/numeric/should_run/T10962.hs | 26 +++++-- .../tests/numeric/should_run/T10962.stdout-ws-32 | 8 ++- .../tests/numeric/should_run/T10962.stdout-ws-64 | 8 ++- testsuite/tests/numeric/should_run/all.T | 2 +- 6 files changed, 150 insertions(+), 21 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa From git at git.haskell.org Tue May 15 23:37:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 May 2018 23:37:50 +0000 (UTC) Subject: [commit: ghc] master: Less Tc inside simplCore (Phase 1 for #14391) (bb3fa2d) Message-ID: <20180515233750.B4FB53ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee/ghc >--------------------------------------------------------------- commit bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee Author: Artem Pelenitsyn Date: Tue May 15 18:07:23 2018 -0400 Less Tc inside simplCore (Phase 1 for #14391) Simplifier depends on typechecker in two points: `thNameToGhcName` (`lookupThName_maybe`, in particular) and `lookupGlobal`. We want to cut the ties in two steps. 1. (Presented in this commit), reimplement both functions in a way that doesn't use typechecker. 2. (Should follow), do code moving: a) `lookupGlobal` should go in some typechecker-free place; b) `thNameToGhcName` should leave simplifier, because it is not used there at all (probably, it should be placed somewhere where `GhcPlugins` can see it -- this is suggested by Joachim on Trac). Details ======= We redesigned lookup interface a bit so that it exposes some `IO`-equivalents of `Tc`-features in use. First, `CoreMonad.hs` still calls `lookupGlobal` which is no longer bound to the typechecker monad, but still resides in `TcEnv.hs` — it should be moved out of Tc-land at some point (“Phase 2”) in the future in order to achieve its part of the #14391's goal. Second, `lookupThName_maybe` is eliminated from `CoreMonad.hs` completely; this already achieves its part of the goal of #14391. Its client, though, `thNameToGhcName`, is better to be moved in the future also, for it is not used in the `CoreMonad.hs` (or anywhere else) anyway. Joachim suggested “any module reexported by GhcPlugins (or maybe even that module itself)”. As a side goal, we removed `initTcForLookup` which was instrumental for the past version of `lookupGlobal`. This, in turn, called for pushing some more parts of the lookup interface from the `Tc`-monad to `IO`, most notably, adding `IO`-version of `lookupOrig` and pushing `dataConInfoPtrToName` to `IO`. The `lookupOrig` part, in turn, triggered a slight redesign of name cache updating interface: we now have both, `updNameCacheIO` and `updNameCacheTc`, both accepting `mod` and `occ` to force them inside, instead of more error-prone outside before. But all these hardly have to do anything with #14391, mere refactoring. Reviewers: simonpj, nomeata, bgamari, hvr Reviewed By: simonpj, bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14391 Differential Revision: https://phabricator.haskell.org/D4503 >--------------------------------------------------------------- bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee compiler/ghci/DebuggerUtils.hs | 20 ++++---- compiler/ghci/RtClosureInspect.hs | 8 ++-- compiler/iface/IfaceEnv.hs | 83 ++++++++++++++++++++++------------ compiler/iface/LoadIface.hs | 1 + compiler/main/DynFlags.hs | 7 +++ compiler/main/HscTypes.hs | 10 ++-- compiler/simplCore/CoreMonad.hs | 24 +++++++--- compiler/typecheck/TcEnv.hs | 74 ++++++++++++++++++++++++++---- compiler/typecheck/TcRnMonad.hs | 16 +------ testsuite/tests/ghc-api/T4891/T4891.hs | 15 +++--- 10 files changed, 170 insertions(+), 88 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 bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee From git at git.haskell.org Wed May 16 08:25:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 08:25:19 +0000 (UTC) Subject: [commit: ghc] master: Force findPtr to be included in the binary (a18e7df) Message-ID: <20180516082519.76C453ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a18e7dfabd234af8b55d3280f9375e5e83facca1/ghc >--------------------------------------------------------------- commit a18e7dfabd234af8b55d3280f9375e5e83facca1 Author: Simon Marlow Date: Wed May 9 13:37:30 2018 +0100 Force findPtr to be included in the binary Summary: A better alternative to D4657. Test Plan: ``` cd testsuite/tests/codeGen/should_run ../../../../inplace/bin/ghc-stage2 -debug cgrun001 nm cgrun001 | grep findPtr ``` Reviewers: bgamari, Phyx, erikd Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4683 >--------------------------------------------------------------- a18e7dfabd234af8b55d3280f9375e5e83facca1 rts/package.conf.in | 10 ++++++++++ rts/rts.cabal.in | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/rts/package.conf.in b/rts/package.conf.in index af5c282..b5ed26d 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -174,6 +174,11 @@ ld-options: #if WORD_SIZE_IN_BITS == 64 , "-Wl,-u,_hs_atomicwrite64" #endif +#if defined(DEBUG) + /* This symbol is useful in gdb, but not referred to anywhere, + * so we need to force it to be included in the binary. */ + , "-Wl,-u,_findPtr" +#endif #else "-Wl,-u,base_GHCziTopHandler_runIO_closure" , "-Wl,-u,base_GHCziTopHandler_runNonIO_closure" @@ -272,6 +277,11 @@ ld-options: #if WORD_SIZE_IN_BITS == 64 , "-Wl,-u,hs_atomicwrite64" #endif +#if defined(DEBUG) + /* This symbol is useful in gdb, but not referred to anywhere, + * so we need to force it to be included in the binary. */ + , "-Wl,-u,findPtr" +#endif #endif /* Pick up static libraries in preference over dynamic if in earlier search diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index a82deb0..aae1dd4 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -250,6 +250,9 @@ library "-Wl,-u,_hs_atomicwrite8" "-Wl,-u,_hs_atomicwrite16" "-Wl,-u,_hs_atomicwrite32" + -- This symbol is useful in gdb, but not referred to anywhere, + -- so we need to force it to be included in the binary. + "-Wl,-u,_findPtr" else ld-options: "-Wl,-u,base_GHCziTopHandler_runIO_closure" @@ -320,6 +323,9 @@ library "-Wl,-u,hs_atomicwrite8" "-Wl,-u,hs_atomicwrite16" "-Wl,-u,hs_atomicwrite32" + -- This symbol is useful in gdb, but not referred to anywhere, + -- so we need to force it to be included in the binary. + "-Wl,-u,findPtr" if os(osx) ld-options: "-Wl,-search_paths_first" From git at git.haskell.org Wed May 16 12:36:33 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 12:36:33 +0000 (UTC) Subject: [commit: ghc] master: An overhaul of the SRT representation (eb8e692) Message-ID: <20180516123633.A2C6F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eb8e692cab7970c495681e14721d05ecadd21581/ghc >--------------------------------------------------------------- commit eb8e692cab7970c495681e14721d05ecadd21581 Author: Simon Marlow Date: Mon Sep 26 12:07:05 2016 +0100 An overhaul of the SRT representation Summary: - Previously we would hvae a single big table of pointers per module, with a set of bitmaps to reference entries within it. The new representation is identical to a static constructor, which is much simpler for the GC to traverse, and we get to remove the complicated bitmap-traversal code from the GC. - Rewrite all the code to generate SRTs in CmmBuildInfoTables, and document it much better (see Note [SRTs]). This has been something I've wanted to do since we moved to the new code generator, I finally had the opportunity to finish it while on a transatlantic flight recently :) There are a series of 4 diffs: 1. D4632 (this one), which does the bulk of the changes 2. D4633 which adds support for smaller `CmmLabelDiffOff` constants 3. D4634 which takes advantage of D4632 and D4633 to save a word in info tables that have an SRT on x86_64. This is where most of the binary size improvement comes from. 4. D4637 which makes a further optimisation to merge some SRTs with static FUN closures. This adds some complexity and the benefits are fairly modest, so it's not clear yet whether we should do this. Results (after (3), on x86_64) - GHC itself (staticaly linked) is 5.2% smaller - -1.7% binary sizes in nofib, -2.9% module sizes. Full nofib results: P176 - I measured the overhead of traversing all the static objects in a major GC in GHC itself by doing `replicateM_ 1000 performGC` as the first thing in `Main.main`. The new version was 5-10% faster, but the results did vary quite a bit. - I'm not sure if there's a compile-time difference, the results are too unreliable. Test Plan: validate Reviewers: bgamari, michalt, niteria, simonpj, erikd, osa1 Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4632 >--------------------------------------------------------------- eb8e692cab7970c495681e14721d05ecadd21581 compiler/cmm/CLabel.hs | 55 +- compiler/cmm/Cmm.hs | 14 +- compiler/cmm/CmmBuildInfoTables.hs | 913 ++++++++++++++++-------- compiler/cmm/CmmInfo.hs | 9 +- compiler/cmm/CmmParse.y | 12 +- compiler/cmm/CmmPipeline.hs | 21 +- compiler/cmm/Hoopl/Dataflow.hs | 6 + compiler/cmm/PprCmm.hs | 2 +- compiler/cmm/PprCmmDecl.hs | 17 +- compiler/codeGen/StgCmmClosure.hs | 10 +- compiler/main/HscMain.hs | 20 +- compiler/stgSyn/CoreToStg.hs | 9 - includes/rts/storage/ClosureMacros.h | 2 +- includes/rts/storage/InfoTables.h | 53 +- includes/stg/MiscClosures.h | 16 + libraries/ghci/GHCi/InfoTable.hsc | 8 + rts/RtsAPI.c | 2 +- rts/RtsSymbols.c | 16 + rts/StgMiscClosures.cmm | 55 +- rts/sm/Evac.c | 4 +- rts/sm/Scav.c | 109 +-- testsuite/tests/regalloc/regalloc_unit_tests.hs | 2 +- 22 files changed, 817 insertions(+), 538 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 eb8e692cab7970c495681e14721d05ecadd21581 From git at git.haskell.org Wed May 16 12:36:36 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 12:36:36 +0000 (UTC) Subject: [commit: ghc] master: Save a word in the info table on x86_64 (2b0918c) Message-ID: <20180516123636.76E743ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2b0918c9834be1873728176e4944bec26271234a/ghc >--------------------------------------------------------------- commit 2b0918c9834be1873728176e4944bec26271234a Author: Simon Marlow Date: Sun Apr 22 14:28:47 2018 +0100 Save a word in the info table on x86_64 Summary: An info table with an SRT normally looks like this: StgWord64 srt_offset StgClosureInfo layout StgWord32 layout StgWord32 has_srt But we only need 32 bits for srt_offset on x86_64, because the small memory model requires that code segments are at most 2GB. So we can optimise this to StgClosureInfo layout StgWord32 layout StgWord32 srt_offset saving a word. We can tell whether the info table has an SRT or not, because zero is not a valid srt_offset, so zero still indicates that there's no SRT. Test Plan: * validate * For results, see D4632. Reviewers: bgamari, niteria, osa1, erikd Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4634 >--------------------------------------------------------------- 2b0918c9834be1873728176e4944bec26271234a compiler/cmm/CmmBuildInfoTables.hs | 23 ++++++++++++----- compiler/cmm/CmmExpr.hs | 12 ++++++--- compiler/cmm/CmmInfo.hs | 44 ++++++++++++++++++++++----------- includes/rts/storage/ClosureMacros.h | 2 +- includes/rts/storage/InfoTables.h | 48 +++++++++++++++++++++++++++++------- libraries/ghci/GHCi/InfoTable.hsc | 4 +-- rts/RtsAPI.c | 2 +- rts/sm/Evac.c | 4 +-- rts/sm/Scav.c | 6 ++--- 9 files changed, 102 insertions(+), 43 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 2b0918c9834be1873728176e4944bec26271234a From git at git.haskell.org Wed May 16 12:36:39 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 12:36:39 +0000 (UTC) Subject: [commit: ghc] master: Allow CmmLabelDiffOff with different widths (fbd28e2) Message-ID: <20180516123639.557AB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fbd28e2c6b5f1302cd2d36d79149e3b0a9f01d84/ghc >--------------------------------------------------------------- commit fbd28e2c6b5f1302cd2d36d79149e3b0a9f01d84 Author: Simon Marlow Date: Sun Apr 22 12:48:11 2018 +0100 Allow CmmLabelDiffOff with different widths Summary: This change makes it possible to generate a static 32-bit relative label offset on x86_64. Currently we can only generate word-sized label offsets. This will be used in D4634 to shrink info tables. See D4632 for more details. Test Plan: See D4632 Reviewers: bgamari, niteria, michalt, erikd, jrtc27, osa1 Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4633 >--------------------------------------------------------------- fbd28e2c6b5f1302cd2d36d79149e3b0a9f01d84 compiler/cmm/CmmBuildInfoTables.hs | 2 +- compiler/cmm/CmmCommonBlockElim.hs | 2 +- compiler/cmm/CmmExpr.hs | 7 +++++-- compiler/cmm/CmmInfo.hs | 4 ++-- compiler/cmm/CmmUtils.hs | 4 ++-- compiler/cmm/PprC.hs | 6 +++--- compiler/cmm/PprCmmExpr.hs | 2 +- compiler/llvmGen/Llvm/Types.hs | 4 ++++ compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 14 +++++++++----- compiler/llvmGen/LlvmCodeGen/Data.hs | 8 +++++--- compiler/nativeGen/PIC.hs | 24 ++++++++++++------------ compiler/nativeGen/PPC/CodeGen.hs | 3 ++- compiler/nativeGen/PPC/RegInfo.hs | 4 ++-- compiler/nativeGen/PPC/Regs.hs | 2 +- compiler/nativeGen/SPARC/Imm.hs | 2 +- compiler/nativeGen/SPARC/ShortcutJump.hs | 4 ++-- compiler/nativeGen/X86/CodeGen.hs | 7 ++++--- compiler/nativeGen/X86/Instr.hs | 4 ++-- compiler/nativeGen/X86/Ppr.hs | 2 +- compiler/nativeGen/X86/Regs.hs | 2 +- 20 files changed, 61 insertions(+), 46 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fbd28e2c6b5f1302cd2d36d79149e3b0a9f01d84 From git at git.haskell.org Wed May 16 12:36:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 12:36:42 +0000 (UTC) Subject: [commit: ghc] master: Merge FUN_STATIC closure with its SRT (838b690) Message-ID: <20180516123642.2D9E43ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/838b69032566ce6ab3918d70e8d5e098d0bcee02/ghc >--------------------------------------------------------------- commit 838b69032566ce6ab3918d70e8d5e098d0bcee02 Author: Simon Marlow Date: Sun Apr 22 19:34:32 2018 +0100 Merge FUN_STATIC closure with its SRT Summary: The idea here is to save a little code size and some work in the GC, by collapsing FUN_STATIC closures and their SRTs. This is (4) in a series; see D4632 for more details. There's a tradeoff here: more complexity in the compiler in exchange for a modest code size reduction (probably around 0.5%). Results: * GHC binary itself (statically linked) is 1% smaller * -0.2% binary sizes in nofib (-0.5% module sizes) Full nofib results comparing D4634 with this: P177 (ignore runtimes, these aren't stable on my laptop) Test Plan: validate, nofib Reviewers: bgamari, niteria, simonpj, erikd Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4637 >--------------------------------------------------------------- 838b69032566ce6ab3918d70e8d5e098d0bcee02 compiler/cmm/Cmm.hs | 7 +- compiler/cmm/CmmBuildInfoTables.hs | 224 +++++++++++++++++++++-------------- compiler/cmm/CmmInfo.hs | 3 +- compiler/cmm/CmmParse.y | 12 +- compiler/codeGen/StgCmmBind.hs | 22 ++-- compiler/codeGen/StgCmmClosure.hs | 19 ++- includes/rts/storage/ClosureMacros.h | 3 - rts/RetainerProfile.c | 2 +- rts/sm/Compact.c | 2 +- rts/sm/Evac.c | 4 +- rts/sm/Sanity.c | 2 +- rts/sm/Scav.c | 4 +- 12 files changed, 182 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 838b69032566ce6ab3918d70e8d5e098d0bcee02 From git at git.haskell.org Wed May 16 12:42:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 12:42:02 +0000 (UTC) Subject: [commit: ghc] master: Make finalizers more reliable. (01bb17f) Message-ID: <20180516124202.A22213ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/01bb17fd4dc6d92cf08632bbb62656428db6e7fa/ghc >--------------------------------------------------------------- commit 01bb17fd4dc6d92cf08632bbb62656428db6e7fa Author: Tamar Christina Date: Tue May 15 21:20:45 2018 -0400 Make finalizers more reliable. Ignore any errors thrown by finalizers when running them. This prevents a faulty finalizer from stopping the rest being called. Test Plan: ./validate, new test T13167 Reviewers: hvr, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13167 Differential Revision: https://phabricator.haskell.org/D4693 >--------------------------------------------------------------- 01bb17fd4dc6d92cf08632bbb62656428db6e7fa libraries/base/GHC/Weak.hs | 5 +++-- libraries/base/tests/T13167.hs | 29 +++++++++++++++++++++++++++++ libraries/base/tests/T13167.stdout | 1 + libraries/base/tests/all.T | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Weak.hs b/libraries/base/GHC/Weak.hs index 8f886a6..6a53096 100644 --- a/libraries/base/GHC/Weak.hs +++ b/libraries/base/GHC/Weak.hs @@ -149,8 +149,9 @@ runFinalizerBatch (I# n) arr = 0# -> (# s, () #) _ -> let !m' = m -# 1# in case indexArray# arr m' of { (# io #) -> - case io s of { s' -> - unIO (go m') s' + case catch# (\p -> (# io p, () #)) + (\_ s'' -> (# s'', () #)) s of { + (# s', _ #) -> unIO (go m') s' }} in go n diff --git a/libraries/base/tests/T13167.hs b/libraries/base/tests/T13167.hs new file mode 100644 index 0000000..e41104c --- /dev/null +++ b/libraries/base/tests/T13167.hs @@ -0,0 +1,29 @@ +import Data.IORef +import Control.Monad +import Control.Exception +import Control.Concurrent.MVar +import System.Mem + +main :: IO () +main = do + run + run + run + run + m <- newEmptyMVar + quit m + performMajorGC + takeMVar m + +run :: IO () +run = do + ref <- newIORef () + void $ mkWeakIORef ref $ do + putStr "." + throwIO $ ErrorCall "failed" + +quit :: MVar () -> IO () +quit m = do + ref <- newIORef () + void $ mkWeakIORef ref $ do + putMVar m () diff --git a/libraries/base/tests/T13167.stdout b/libraries/base/tests/T13167.stdout new file mode 100644 index 0000000..4918d25 --- /dev/null +++ b/libraries/base/tests/T13167.stdout @@ -0,0 +1 @@ +.... diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 491df2f..d530e10 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -224,3 +224,4 @@ test('T3474', test('T14425', normal, compile_and_run, ['']) test('T10412', normal, compile_and_run, ['']) test('T13896', normal, compile_and_run, ['']) +test('T13167', normal, compile_and_run, ['']) From git at git.haskell.org Wed May 16 19:40:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 19:40:54 +0000 (UTC) Subject: [commit: ghc] master: InfoTables: Fix #if uses introduced by D4634 (3310f7f) Message-ID: <20180516194054.E68B53ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3310f7f14c0ba34a57fe5a77f47d2a66fe838a43/ghc >--------------------------------------------------------------- commit 3310f7f14c0ba34a57fe5a77f47d2a66fe838a43 Author: Ben Gamari Date: Wed May 16 12:15:32 2018 -0400 InfoTables: Fix #if uses introduced by D4634 >--------------------------------------------------------------- 3310f7f14c0ba34a57fe5a77f47d2a66fe838a43 includes/rts/storage/InfoTables.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h index 8107510..137cfe2 100644 --- a/includes/rts/storage/InfoTables.h +++ b/includes/rts/storage/InfoTables.h @@ -335,7 +335,7 @@ typedef struct StgConInfoTable_ { * info must be a Stg[Ret|Thunk]InfoTable* (an info table that has a SRT) */ #if defined(TABLES_NEXT_TO_CODE) -#if x86_64_TARGET_ARCH +#if defined(x86_64_TARGET_ARCH) #define GET_SRT(info) \ ((StgClosure*) (((StgWord) ((info)+1)) + (info)->i.srt)) #else @@ -362,7 +362,7 @@ typedef struct StgConInfoTable_ { * info must be a StgFunInfoTable* */ #if defined(TABLES_NEXT_TO_CODE) -#if x86_64_TARGET_ARCH +#if defined(x86_64_TARGET_ARCH) #define GET_FUN_SRT(info) \ ((StgClosure*) (((StgWord) ((info)+1)) + (info)->i.srt)) #else From git at git.haskell.org Wed May 16 19:40:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 19:40:57 +0000 (UTC) Subject: [commit: ghc] master: Add pprTraceM to Outputable as analog to traceM. (126b412) Message-ID: <20180516194057.ABCD93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/126b4125d95f7e4d272a9307cb8b634b11bd337f/ghc >--------------------------------------------------------------- commit 126b4125d95f7e4d272a9307cb8b634b11bd337f Author: klebinger.andreas at gmx.at Date: Wed May 16 12:11:27 2018 -0400 Add pprTraceM to Outputable as analog to traceM. Test Plan: ci, using it in monadic code. Reviewers: bgamari, mpickering Reviewed By: mpickering Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4697 >--------------------------------------------------------------- 126b4125d95f7e4d272a9307cb8b634b11bd337f compiler/utils/Outputable.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index e435734..2b89162 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -82,7 +82,7 @@ module Outputable ( -- * Error handling and debugging utilities pprPanic, pprSorry, assertPprPanic, pprPgmError, pprTrace, pprTraceDebug, pprTraceIt, warnPprTrace, pprSTrace, - pprTraceException, + pprTraceException, pprTraceM, trace, pgmError, panic, sorry, assertPanic, pprDebugAndThen, callStackDoc, ) where @@ -1182,6 +1182,9 @@ pprTrace str doc x | otherwise = pprDebugAndThen unsafeGlobalDynFlags trace (text str) doc x +pprTraceM :: Applicative f => String -> SDoc -> f () +pprTraceM str doc = pprTrace str doc (pure ()) + -- | @pprTraceIt desc x@ is equivalent to @pprTrace desc (ppr x) x@ pprTraceIt :: Outputable a => String -> a -> a pprTraceIt desc x = pprTrace desc (ppr x) x From git at git.haskell.org Wed May 16 19:41:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 19:41:01 +0000 (UTC) Subject: [commit: ghc] master: Improve numeric stability of numericEnumFrom for floating numbers (4ffaf4b) Message-ID: <20180516194101.33D683ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4ffaf4b67773af4c72d92bb8b6c87b1a7d34ac0f/ghc >--------------------------------------------------------------- commit 4ffaf4b67773af4c72d92bb8b6c87b1a7d34ac0f Author: HE, Tao Date: Wed May 16 12:13:16 2018 -0400 Improve numeric stability of numericEnumFrom for floating numbers Fixes #15081. Test Plan: cd libraries/base && make test TEST="enumNumeric" Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: dfeuer, simonpj, thomie, carter GHC Trac Issues: #15081 Differential Revision: https://phabricator.haskell.org/D4650 >--------------------------------------------------------------- 4ffaf4b67773af4c72d92bb8b6c87b1a7d34ac0f libraries/base/GHC/Real.hs | 56 +++++++++++++++++++++++++++++++-- libraries/base/tests/all.T | 1 + libraries/base/tests/enumNumeric.hs | 7 +++++ libraries/base/tests/enumNumeric.stdout | 5 +++ testsuite/tests/perf/should_run/all.T | 3 +- 5 files changed, 69 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/Real.hs b/libraries/base/GHC/Real.hs index 938dff6..7f2ecd0 100644 --- a/libraries/base/GHC/Real.hs +++ b/libraries/base/GHC/Real.hs @@ -216,10 +216,19 @@ class (Real a, Fractional a) => RealFrac a where -- These 'numeric' enumerations come straight from the Report numericEnumFrom :: (Fractional a) => a -> [a] -numericEnumFrom n = n `seq` (n : numericEnumFrom (n + 1)) +numericEnumFrom n = go 0 + where + -- See Note [Numeric Stability of Enumerating Floating Numbers] + go !k = let !n' = n + k + in n' : go (k + 1) numericEnumFromThen :: (Fractional a) => a -> a -> [a] -numericEnumFromThen n m = n `seq` m `seq` (n : numericEnumFromThen m (m+m-n)) +numericEnumFromThen n m = go 0 + where + step = m - n + -- See Note [Numeric Stability of Enumerating Floating Numbers] + go !k = let !n' = n + k * step + in n' : go (k + 1) numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a] numericEnumFromTo n m = takeWhile (<= m + 1/2) (numericEnumFrom n) @@ -232,6 +241,49 @@ numericEnumFromThenTo e1 e2 e3 predicate | e2 >= e1 = (<= e3 + mid) | otherwise = (>= e3 + mid) +{- Note [Numeric Stability of Enumerating Floating Numbers] +----------------------------------------------------------- +When enumerate floating numbers, we could add the increment to the last number +at every run (as what we did previously): + + numericEnumFrom n = n `seq` (n : numericEnumFrom (n + 1)) + +This approach is concise and really fast, only needs an addition operation. +However when a floating number is large enough, for `n`, `n` and `n+1` will +have the same binary representation. For example (all number has type +`Double`): + + 9007199254740990 is: 0x433ffffffffffffe + 9007199254740990 + 1 is: 0x433fffffffffffff + (9007199254740990 + 1) + 1 is: 0x4340000000000000 + ((9007199254740990 + 1) + 1) + 1 is: 0x4340000000000000 + +When we evaluate ([9007199254740990..9007199254740991] :: Double), we would +never reach the condition in `numericEnumFromTo` + + 9007199254740990 + 1 + 1 + ... > 9007199254740991 + 1/2 + +We would fall into infinite loop (as reported in Trac #15081). + +To remedy the situation, we record the number of `1` that needed to be added +to the start number, rather than increasing `1` at every time. This approach +can improvement the numeric stability greatly at the cost of a multiplication. + +Furthermore, we use the type of the enumerated number, `Fractional a => a`, +as the type of multiplier. In rare situations, the multiplier could be very +large and will lead to the enumeration to infinite loop, too, which should +be very rare. Consider the following example: + + [1..9007199254740994] + +We could fix that by using an Integer as multiplier but we don't do that. +The benchmark on T7954.hs shows that this approach leads to significant +degeneration on performance (33% increase allocation and 300% increase on +elapsed time). + +See Trac #15081 and Phab:D4650 for the related discussion about this problem. +-} + -------------------------------------------------------------- -- Instances for Int -------------------------------------------------------------- diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index d530e10..eb00fc3 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -2,6 +2,7 @@ test('readFloat', exit_code(1), compile_and_run, ['']) test('enumDouble', normal, compile_and_run, ['']) test('enumRatio', normal, compile_and_run, ['']) +test('enumNumeric', normal, compile_and_run, ['']) test('tempfiles', normal, compile_and_run, ['']) test('fixed', normal, compile_and_run, ['']) test('quotOverflow', normal, compile_and_run, ['']) diff --git a/libraries/base/tests/enumNumeric.hs b/libraries/base/tests/enumNumeric.hs new file mode 100644 index 0000000..36c4846 --- /dev/null +++ b/libraries/base/tests/enumNumeric.hs @@ -0,0 +1,7 @@ +main :: IO () +main = do + print $ map (/2) ([5..6] :: [Double]) + print $ ([9007199254740990..9007199254740991] :: [Double]) + print $ map (/2) ([9007199254740990..9007199254740991] :: [Double]) + print $ ([9007199254740989..9007199254740990] :: [Double]) + print $ map (/2) ([9007199254740989..9007199254740990] :: [Double]) diff --git a/libraries/base/tests/enumNumeric.stdout b/libraries/base/tests/enumNumeric.stdout new file mode 100644 index 0000000..3d7eb74 --- /dev/null +++ b/libraries/base/tests/enumNumeric.stdout @@ -0,0 +1,5 @@ +[2.5,3.0] +[9.00719925474099e15,9.007199254740991e15,9.007199254740992e15,9.007199254740992e15] +[4.503599627370495e15,4.5035996273704955e15,4.503599627370496e15,4.503599627370496e15] +[9.007199254740989e15,9.00719925474099e15] +[4.5035996273704945e15,4.503599627370495e15] diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 27405b0..f47d8e0 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -384,8 +384,9 @@ test('T7954', [(wordsize(32), 920045264, 10), # some date: 1380051408 (64-bit Windows machine) # 2014-04-04: 920045264 (64-bit Windows machine) - (wordsize(64), 1680051336, 10)]), + (wordsize(64), 1280051632, 10)]), # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis + # 2018-05-03: 1280051632 (x86_64/Linux), refactor numericEnumFrom only_ways(['normal']) ], compile_and_run, From git at git.haskell.org Wed May 16 19:41:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 19:41:04 +0000 (UTC) Subject: [commit: ghc] master: Fix #15039 by pretty-printing equalities more systematically (99f8cc8) Message-ID: <20180516194104.F308F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/99f8cc84a5b23878b3b0732955cb651bc973e9f2/ghc >--------------------------------------------------------------- commit 99f8cc84a5b23878b3b0732955cb651bc973e9f2 Author: Ryan Scott Date: Wed May 16 12:11:37 2018 -0400 Fix #15039 by pretty-printing equalities more systematically GHC previously had a handful of special cases for pretty-printing equalities in a more user-friendly manner, but they were far from comprehensive (see #15039 for an example of where this fell apart). This patch makes the pretty-printing of equalities much more systematic. I've adopted the approach laid out in https://ghc.haskell.org/trac/ghc/ticket/15039#comment:4, and updated `Note [Equality predicates in IfaceType]` accordingly. We are now more careful to respect the properties of the `-fprint-explicit-kinds` and `-fprint-equality-relations` flags, which led to some improvements in error message outputs. Along the way, I also tweaked the error-reporting machinery not to print out the type of a typed hole when the type is an unlifted equality, since it's kind (`TYPE ('TupleRep '[])`) was more confusing than anything. Test Plan: make test TEST="T15039a T15039b T15039c T15039d" Reviewers: simonpj, goldfire, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15039 Differential Revision: https://phabricator.haskell.org/D4696 >--------------------------------------------------------------- 99f8cc84a5b23878b3b0732955cb651bc973e9f2 compiler/iface/IfaceType.hs | 127 +++++++++++++++------ compiler/prelude/TysWiredIn.hs-boot | 2 + compiler/typecheck/TcErrors.hs | 8 +- .../tests/deSugar/should_compile/T2431.stderr | 6 +- .../tests/partial-sigs/should_compile/T15039a.hs | 41 +++++++ .../partial-sigs/should_compile/T15039a.stderr | 55 +++++++++ .../tests/partial-sigs/should_compile/T15039b.hs | 41 +++++++ .../partial-sigs/should_compile/T15039b.stderr | 56 +++++++++ .../tests/partial-sigs/should_compile/T15039c.hs | 41 +++++++ .../partial-sigs/should_compile/T15039c.stderr | 55 +++++++++ .../tests/partial-sigs/should_compile/T15039d.hs | 41 +++++++ .../partial-sigs/should_compile/T15039d.stderr | 58 ++++++++++ testsuite/tests/partial-sigs/should_compile/all.T | 6 +- .../tests/patsyn/should_compile/T14394.stdout | 2 +- .../tests/roles/should_compile/Roles13.stderr | 2 +- .../tests/typecheck/should_compile/T13032.stderr | 2 +- .../tests/typecheck/should_fail/T14390.stderr | 2 +- 17 files changed, 496 insertions(+), 49 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 99f8cc84a5b23878b3b0732955cb651bc973e9f2 From git at git.haskell.org Wed May 16 19:41:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 19:41:08 +0000 (UTC) Subject: [commit: ghc] master: Fix #15073 by suggesting UnboxedTuples in an error message (0c7db22) Message-ID: <20180516194108.A98A63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0c7db226012b5cfafc9a38bfe372661672ec8900/ghc >--------------------------------------------------------------- commit 0c7db226012b5cfafc9a38bfe372661672ec8900 Author: Ryan Scott Date: Wed May 16 12:59:45 2018 -0400 Fix #15073 by suggesting UnboxedTuples in an error message Under certain circumstances, `GeneralizedNewtypeDeriving` can emit code which uses unboxed tuple types, but if `UnboxedTuples` wasn't enabled, the error message that GHC gave didn't make it very clear that it could be worked around by explicitly enabling the extension. Easily fixed. Test Plan: make test TEST=T15073 Reviewers: bgamari Reviewed By: bgamari Subscribers: simonpj, thomie, carter GHC Trac Issues: #15073 Differential Revision: https://phabricator.haskell.org/D4620 >--------------------------------------------------------------- 0c7db226012b5cfafc9a38bfe372661672ec8900 compiler/typecheck/TcValidity.hs | 5 ++++- testsuite/tests/deriving/should_fail/T15073.hs | 8 ++++++++ testsuite/tests/deriving/should_fail/T15073.stderr | 22 ++++++++++++++++++++++ testsuite/tests/deriving/should_fail/T15073a.hs | 5 +++++ testsuite/tests/deriving/should_fail/all.T | 2 ++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 617975e..bdda6cd 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -621,7 +621,10 @@ forAllEscapeErr env ty tau_kind , text "of kind:" <+> ppr_tidy env tau_kind ]) ) ubxArgTyErr :: TidyEnv -> Type -> (TidyEnv, SDoc) -ubxArgTyErr env ty = (env, sep [text "Illegal unboxed tuple type as function argument:", ppr_tidy env ty]) +ubxArgTyErr env ty + = ( env, vcat [ sep [ text "Illegal unboxed tuple type as function argument:" + , ppr_tidy env ty ] + , text "Perhaps you intended to use UnboxedTuples" ] ) {- Note [Liberal type synonyms] diff --git a/testsuite/tests/deriving/should_fail/T15073.hs b/testsuite/tests/deriving/should_fail/T15073.hs new file mode 100644 index 0000000..ecceeed --- /dev/null +++ b/testsuite/tests/deriving/should_fail/T15073.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeInType #-} +module T15073 where + +import T15073a + +newtype Foo a = MkFoo a + deriving P diff --git a/testsuite/tests/deriving/should_fail/T15073.stderr b/testsuite/tests/deriving/should_fail/T15073.stderr new file mode 100644 index 0000000..7658b8e --- /dev/null +++ b/testsuite/tests/deriving/should_fail/T15073.stderr @@ -0,0 +1,22 @@ + +T15073.hs:8:12: error: + • Illegal unboxed tuple type as function argument: (# a #) + Perhaps you intended to use UnboxedTuples + • In the expression: + GHC.Prim.coerce + @(a + -> (Unit# a :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) + @(Foo a + -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) + p + In an equation for ‘p’: + p = GHC.Prim.coerce + @(a + -> (Unit# a :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) + @(Foo a + -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) + p + When typechecking the code for ‘p’ + in a derived instance for ‘P (Foo a)’: + To see the code I am typechecking, use -ddump-deriv + In the instance declaration for ‘P (Foo a)’ diff --git a/testsuite/tests/deriving/should_fail/T15073a.hs b/testsuite/tests/deriving/should_fail/T15073a.hs new file mode 100644 index 0000000..87e7571 --- /dev/null +++ b/testsuite/tests/deriving/should_fail/T15073a.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE UnboxedTuples #-} +module T15073a where + +class P a where + p :: a -> (# a #) diff --git a/testsuite/tests/deriving/should_fail/all.T b/testsuite/tests/deriving/should_fail/all.T index 8dc5b78..f1d8261 100644 --- a/testsuite/tests/deriving/should_fail/all.T +++ b/testsuite/tests/deriving/should_fail/all.T @@ -72,3 +72,5 @@ test('T14365', [extra_files(['T14365B.hs','T14365B.hs-boot'])], test('T14728a', normal, compile_fail, ['']) test('T14728b', normal, compile_fail, ['']) test('T14916', normal, compile_fail, ['']) +test('T15073', [extra_files(['T15073a.hs'])], multimod_compile_fail, + ['T15073', '-v0']) From git at git.haskell.org Wed May 16 20:53:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 20:53:43 +0000 (UTC) Subject: [commit: hadrian] master: add dependency on llvm-passes (112588a) Message-ID: <20180516205343.4DDFD3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hadrian On branch : master Link : http://git.haskell.org/hadrian.git/commitdiff/112588a45989a8bc108b747ae47128b5776b102a >--------------------------------------------------------------- commit 112588a45989a8bc108b747ae47128b5776b102a Author: Kavon Farvardin Date: Wed May 16 15:52:15 2018 -0500 add dependency on llvm-passes see https://phabricator.haskell.org/D4695 >--------------------------------------------------------------- 112588a45989a8bc108b747ae47128b5776b102a src/Base.hs | 1 + src/Rules/Generate.hs | 1 + src/Rules/Program.hs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Base.hs b/src/Base.hs index fea33a9..430078d 100644 --- a/src/Base.hs +++ b/src/Base.hs @@ -111,6 +111,7 @@ ghcDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f)) [ "ghc-usage.txt" , "ghci-usage.txt" , "llvm-targets" + , "llvm-passes" , "platformConstants" , "settings" ] diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs index cc2bf4b..8355ccc 100644 --- a/src/Rules/Generate.hs +++ b/src/Rules/Generate.hs @@ -164,6 +164,7 @@ copyRules = do prefix -/- "ghc-usage.txt" <~ return "driver" prefix -/- "ghci-usage.txt" <~ return "driver" prefix -/- "llvm-targets" <~ return "." + prefix -/- "llvm-passes" <~ return "." prefix -/- "platformConstants" <~ (buildRoot <&> (-/- generatedDir)) prefix -/- "settings" <~ return "." prefix -/- "template-hsc.h" <~ return (pkgPath hsc2hs) diff --git a/src/Rules/Program.hs b/src/Rules/Program.hs index 67a310f..228c345 100644 --- a/src/Rules/Program.hs +++ b/src/Rules/Program.hs @@ -43,7 +43,7 @@ buildProgram rs = do need [tmpl] when (package == ghc) $ do -- ghc depends on settings, platformConstants, llvm-targets - -- ghc-usage.txt, ghci-usage.txt + -- llvm-passes, ghc-usage.txt, ghci-usage.txt need =<< ghcDeps stage cross <- crossCompiling From git at git.haskell.org Wed May 16 20:58:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 20:58:12 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: Extract hard-coded LLVM opt flags into a file (0b8b867) Message-ID: <20180516205812.D4DD83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/0b8b86708f48e036795412d420b073b3b61c5e4a/ghc >--------------------------------------------------------------- commit 0b8b86708f48e036795412d420b073b3b61c5e4a Merge: 58221e4 01b15b8 Author: Kavon Farvardin Date: Tue May 15 14:09:28 2018 -0500 Extract hard-coded LLVM opt flags into a file Summary: To resolve ticket #11295, I think it makes sense to stop hard-coding the pass sequences used by GHC when compiling with LLVM into the compiler itself. This patchset introduces a companion to the existing `llvm-targets` file called `llvm-passes`. The passes file is a simple association list that holds the default LLVM `opt` pass sequence used by GHC. This allows end users to easily save their favorite optimization flags when compiling with LLVM. The main benefit for ticket #11295 is that when adding a custom pass sequence, it tends to be an extremely long string that would be unsightly in the code. This is essentially part 1 of 2 for ticket #11295. Test Plan: ./validate Reviewers: bgamari, angerman Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4695 >--------------------------------------------------------------- 0b8b86708f48e036795412d420b073b3b61c5e4a compiler/coreSyn/CoreUnfold.hs | 33 ++++++------- compiler/typecheck/TcErrors.hs | 56 +++++++++++++--------- configure.ac | 6 +++ libraries/base/GHC/Conc/IO.hs | 5 +- libraries/base/GHC/IO/FD.hs | 51 +++++++++++++------- rts/rts.cabal.in | 4 ++ .../tests/partial-sigs/should_fail/T14584.stderr | 11 +++++ .../tests/partial-sigs/should_fail/T14584a.stderr | 13 +++++ testsuite/tests/perf/compiler/all.T | 19 ++++---- 9 files changed, 130 insertions(+), 68 deletions(-) From git at git.haskell.org Wed May 16 20:58:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 20:58:15 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: Merge branch 'wip/T11295-part1' of ssh://git.haskell.org/ghc into wip/T11295-part1 (2c5616a) Message-ID: <20180516205815.B4ABC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/2c5616a75b3f7e1971968e292c75b9410b465a2c/ghc >--------------------------------------------------------------- commit 2c5616a75b3f7e1971968e292c75b9410b465a2c Merge: 0b8b867 1193924 Author: Kavon Farvardin Date: Tue May 15 15:31:38 2018 -0500 Merge branch 'wip/T11295-part1' of ssh://git.haskell.org/ghc into wip/T11295-part1 >--------------------------------------------------------------- 2c5616a75b3f7e1971968e292c75b9410b465a2c From git at git.haskell.org Wed May 16 20:58:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 20:58:18 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: readability tweaks (297b68e) Message-ID: <20180516205818.8BAA93ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/297b68ec8994589e1e49c4b83e2ca50b1692bdf4/ghc >--------------------------------------------------------------- commit 297b68ec8994589e1e49c4b83e2ca50b1692bdf4 Author: Kavon Farvardin Date: Wed May 16 15:44:23 2018 -0500 readability tweaks >--------------------------------------------------------------- 297b68ec8994589e1e49c4b83e2ca50b1692bdf4 compiler/main/DriverPipeline.hs | 2 +- compiler/main/SysTools.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 74aef51..5ea83ce 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1474,7 +1474,7 @@ runPhase (RealPhase LlvmOpt) input_fn dflags where -- we always (unless -optlo specified) run Opt since we rely on it to -- fix up some pretty big deficiencies in the code we generate - optIdx = min 2 $ max 0 $ optLevel dflags -- ensure we're in [0,2] + optIdx = max 0 $ min 2 $ optLevel dflags -- ensure we're in [0,2] llvmOpts = case lookup optIdx $ llvmPasses dflags of Just passes -> passes Nothing -> panic ("runPhase LlvmOpt: llvm-passes file " diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 8d7d1ea..2e52ef9 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -114,16 +114,16 @@ initLlvmConfig :: Maybe String -> IO LlvmConfig initLlvmConfig mbMinusB = do - tgts <- readAndParse "llvm-targets" mkLlvmTarget + targets <- readAndParse "llvm-targets" mkLlvmTarget passes <- readAndParse "llvm-passes" id - return (tgts, passes) + return (targets, passes) where - readAndParse name bldr = + readAndParse name builder = do top_dir <- findTopDir mbMinusB let llvmConfigFile = top_dir name llvmConfigStr <- readFile llvmConfigFile case maybeReadFuzzy llvmConfigStr of - Just s -> return (fmap bldr <$> s) + Just s -> return (fmap builder <$> s) Nothing -> pgmError ("Can't parse " ++ show llvmConfigFile) mkLlvmTarget :: (String, String, String) -> LlvmTarget From git at git.haskell.org Wed May 16 20:58:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 20:58:21 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: update hadrian with support for llvm-passes (6bc2425) Message-ID: <20180516205821.62FB13ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/6bc2425a0281b07a01bbf9949911913ef3b0a49a/ghc >--------------------------------------------------------------- commit 6bc2425a0281b07a01bbf9949911913ef3b0a49a Author: Kavon Farvardin Date: Wed May 16 15:54:27 2018 -0500 update hadrian with support for llvm-passes >--------------------------------------------------------------- 6bc2425a0281b07a01bbf9949911913ef3b0a49a hadrian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadrian b/hadrian index 7c3c45f..112588a 160000 --- a/hadrian +++ b/hadrian @@ -1 +1 @@ -Subproject commit 7c3c45f4539af8e75764a1c100dfbb35a86f4be3 +Subproject commit 112588a45989a8bc108b747ae47128b5776b102a From git at git.haskell.org Wed May 16 21:26:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 21:26:52 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: Merge branch 'master' into wip/T11295-part1 (a279e29) Message-ID: <20180516212652.5FB993ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/a279e298f0797e86959476f29f82373dfb384437/ghc >--------------------------------------------------------------- commit a279e298f0797e86959476f29f82373dfb384437 Merge: 6bc2425 0c7db22 Author: Kavon Farvardin Date: Wed May 16 16:04:04 2018 -0500 Merge branch 'master' into wip/T11295-part1 >--------------------------------------------------------------- a279e298f0797e86959476f29f82373dfb384437 compiler/basicTypes/Literal.hs | 48 +- compiler/cmm/CLabel.hs | 55 +- compiler/cmm/Cmm.hs | 19 +- compiler/cmm/CmmBuildInfoTables.hs | 994 ++++++++++++++------- compiler/cmm/CmmCommonBlockElim.hs | 2 +- compiler/cmm/CmmExpr.hs | 11 +- compiler/cmm/CmmInfo.hs | 52 +- compiler/cmm/CmmParse.y | 12 +- compiler/cmm/CmmPipeline.hs | 21 +- compiler/cmm/CmmUtils.hs | 4 +- compiler/cmm/Hoopl/Dataflow.hs | 6 + compiler/cmm/PprC.hs | 6 +- compiler/cmm/PprCmm.hs | 2 +- compiler/cmm/PprCmmDecl.hs | 17 +- compiler/cmm/PprCmmExpr.hs | 2 +- compiler/codeGen/StgCmmBind.hs | 22 +- compiler/codeGen/StgCmmClosure.hs | 21 +- compiler/ghci/DebuggerUtils.hs | 20 +- compiler/ghci/RtClosureInspect.hs | 8 +- compiler/iface/IfaceEnv.hs | 83 +- compiler/iface/IfaceType.hs | 127 ++- compiler/iface/LoadIface.hs | 1 + compiler/llvmGen/Llvm/Types.hs | 4 + compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 14 +- compiler/llvmGen/LlvmCodeGen/Data.hs | 8 +- compiler/main/DynFlags.hs | 7 + compiler/main/HscMain.hs | 20 +- compiler/main/HscTypes.hs | 10 +- compiler/nativeGen/PIC.hs | 24 +- compiler/nativeGen/PPC/CodeGen.hs | 3 +- compiler/nativeGen/PPC/RegInfo.hs | 4 +- compiler/nativeGen/PPC/Regs.hs | 2 +- compiler/nativeGen/SPARC/Imm.hs | 2 +- compiler/nativeGen/SPARC/ShortcutJump.hs | 4 +- compiler/nativeGen/X86/CodeGen.hs | 7 +- compiler/nativeGen/X86/Instr.hs | 4 +- compiler/nativeGen/X86/Ppr.hs | 2 +- compiler/nativeGen/X86/Regs.hs | 2 +- compiler/prelude/PrelRules.hs | 79 +- compiler/prelude/TysWiredIn.hs-boot | 2 + compiler/simplCore/CoreMonad.hs | 24 +- compiler/stgSyn/CoreToStg.hs | 9 - compiler/typecheck/TcEnv.hs | 74 +- compiler/typecheck/TcErrors.hs | 8 +- compiler/typecheck/TcRnMonad.hs | 16 +- compiler/typecheck/TcValidity.hs | 5 +- compiler/utils/Outputable.hs | 5 +- includes/rts/storage/ClosureMacros.h | 5 +- includes/rts/storage/InfoTables.h | 93 +- includes/stg/MiscClosures.h | 16 + libraries/base/GHC/Real.hs | 56 +- libraries/base/GHC/Weak.hs | 5 +- libraries/base/tests/T13167.hs | 29 + libraries/base/tests/T13167.stdout | 1 + libraries/base/tests/all.T | 2 + libraries/base/tests/enumNumeric.hs | 7 + libraries/base/tests/enumNumeric.stdout | 5 + libraries/ghci/GHCi/InfoTable.hsc | 8 + rts/RetainerProfile.c | 2 +- rts/RtsAPI.c | 2 +- rts/RtsSymbols.c | 16 + rts/StgMiscClosures.cmm | 55 +- rts/package.conf.in | 10 + rts/rts.cabal.in | 6 + rts/sm/Compact.c | 2 +- rts/sm/Evac.c | 6 +- rts/sm/Sanity.c | 2 +- rts/sm/Scav.c | 113 +-- .../tests/deSugar/should_compile/T2431.stderr | 6 +- testsuite/tests/deriving/should_fail/T15073.hs | 8 + testsuite/tests/deriving/should_fail/T15073.stderr | 22 + testsuite/tests/deriving/should_fail/T15073a.hs | 5 + testsuite/tests/deriving/should_fail/all.T | 2 + testsuite/tests/ghc-api/T4891/T4891.hs | 15 +- testsuite/tests/numeric/should_run/T10962.hs | 26 +- .../tests/numeric/should_run/T10962.stdout-ws-32 | 8 +- .../tests/numeric/should_run/T10962.stdout-ws-64 | 8 +- testsuite/tests/numeric/should_run/all.T | 2 +- .../tests/partial-sigs/should_compile/T15039a.hs | 41 + .../partial-sigs/should_compile/T15039a.stderr | 55 ++ .../tests/partial-sigs/should_compile/T15039b.hs | 41 + .../partial-sigs/should_compile/T15039b.stderr | 56 ++ .../tests/partial-sigs/should_compile/T15039c.hs | 41 + .../partial-sigs/should_compile/T15039c.stderr | 55 ++ .../tests/partial-sigs/should_compile/T15039d.hs | 41 + .../partial-sigs/should_compile/T15039d.stderr | 58 ++ testsuite/tests/partial-sigs/should_compile/all.T | 6 +- .../tests/patsyn/should_compile/T14394.stdout | 2 +- testsuite/tests/perf/should_run/all.T | 3 +- testsuite/tests/regalloc/regalloc_unit_tests.hs | 2 +- .../tests/roles/should_compile/Roles13.stderr | 2 +- .../tests/typecheck/should_compile/T13032.stderr | 2 +- .../tests/typecheck/should_fail/T14390.stderr | 2 +- 93 files changed, 2025 insertions(+), 797 deletions(-) From git at git.haskell.org Wed May 16 21:26:55 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 21:26:55 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1's head updated: Merge branch 'master' into wip/T11295-part1 (a279e29) Message-ID: <20180516212655.2D7463ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T11295-part1' now includes: bb338f2 Algebraically simplify add/sub with carry/overflow bb3fa2d Less Tc inside simplCore (Phase 1 for #14391) a18e7df Force findPtr to be included in the binary eb8e692 An overhaul of the SRT representation fbd28e2 Allow CmmLabelDiffOff with different widths 2b0918c Save a word in the info table on x86_64 838b690 Merge FUN_STATIC closure with its SRT 01bb17f Make finalizers more reliable. 3310f7f InfoTables: Fix #if uses introduced by D4634 126b412 Add pprTraceM to Outputable as analog to traceM. 99f8cc8 Fix #15039 by pretty-printing equalities more systematically 4ffaf4b Improve numeric stability of numericEnumFrom for floating numbers 0c7db22 Fix #15073 by suggesting UnboxedTuples in an error message a279e29 Merge branch 'master' into wip/T11295-part1 From git at git.haskell.org Wed May 16 22:36:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 22:36:34 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: Merge branch 'master' into wip/kavon-nosplit-llvm (c06d5fb) Message-ID: <20180516223634.52CD73ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/c06d5fb467f82e6aa589b88091eab66c482e1702/ghc >--------------------------------------------------------------- commit c06d5fb467f82e6aa589b88091eab66c482e1702 Merge: 4790509 01bb17f Author: Kavon Farvardin Date: Wed May 16 14:16:41 2018 -0500 Merge branch 'master' into wip/kavon-nosplit-llvm >--------------------------------------------------------------- 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 c06d5fb467f82e6aa589b88091eab66c482e1702 From git at git.haskell.org Wed May 16 22:36:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 22:36:37 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: fix mistake in merge conflict (873074d) Message-ID: <20180516223637.2266A3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/873074dbed6d0a467c1079fec0b8d3867ed0eed1/ghc >--------------------------------------------------------------- commit 873074dbed6d0a467c1079fec0b8d3867ed0eed1 Author: Kavon Farvardin Date: Wed May 16 17:34:09 2018 -0500 fix mistake in merge conflict >--------------------------------------------------------------- 873074dbed6d0a467c1079fec0b8d3867ed0eed1 compiler/main/CodeOutput.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/CodeOutput.hs b/compiler/main/CodeOutput.hs index 1f2e62d..ac8b811 100644 --- a/compiler/main/CodeOutput.hs +++ b/compiler/main/CodeOutput.hs @@ -93,7 +93,7 @@ codeOutput dflags this_mod filenm location foreign_stubs foreign_fps pkg_deps } ; stubs_exist <- outputForeignStubs dflags this_mod location foreign_stubs - ; case hscTarget dflags of { + ; info <- case hscTarget dflags of { HscAsm -> outputAsm dflags this_mod location filenm linted_cmm_stream; HscC -> outputC dflags filenm linted_cmm_stream pkg_deps; From git at git.haskell.org Wed May 16 22:36:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 22:36:40 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: kill dead debuggging code (756aae5) Message-ID: <20180516223640.0761F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/756aae5da58752f34643c5f9e7110a3d771a8b6c/ghc >--------------------------------------------------------------- commit 756aae5da58752f34643c5f9e7110a3d771a8b6c Author: Kavon Farvardin Date: Wed May 16 17:34:22 2018 -0500 kill dead debuggging code >--------------------------------------------------------------- 756aae5da58752f34643c5f9e7110a3d771a8b6c compiler/codeGen/StgCmmMonad.hs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index 38aabdb..db6b885 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -252,16 +252,6 @@ combineReturnKinds rks = foldl combine AssignedDirectly rks equals (x:xs) (y:ys) = cmmEqType_ignoring_ptrhood x y && equals xs ys equals _ _ = False - -- debugging only XXX(kavon) - cmmTy2String :: [CmmType] -> String - cmmTy2String tys = concat [showSDocUnsafe (ppr t) ++ ", " | t <- tys] - - -- debugging only XXX(kavon) - tryCheck a b = res - where - !x = trace ("\ntrying to combine: \n\t[" ++ cmmTy2String a ++ "]\n\t[" ++ cmmTy2String b ++ "]\n") () - res = check a b - -- Note [sharing continuations] -- From git at git.haskell.org Wed May 16 22:36:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 22:36:42 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: fix another mistake in merge conflict (44ff660) Message-ID: <20180516223642.D3DAE3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/44ff66072108cf5c065aeca779d0d86d0dd237a4/ghc >--------------------------------------------------------------- commit 44ff66072108cf5c065aeca779d0d86d0dd237a4 Author: Kavon Farvardin Date: Wed May 16 17:35:23 2018 -0500 fix another mistake in merge conflict >--------------------------------------------------------------- 44ff66072108cf5c065aeca779d0d86d0dd237a4 compiler/cmm/CmmBuildInfoTables.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/cmm/CmmBuildInfoTables.hs b/compiler/cmm/CmmBuildInfoTables.hs index 2969ff0..af1fb43 100644 --- a/compiler/cmm/CmmBuildInfoTables.hs +++ b/compiler/cmm/CmmBuildInfoTables.hs @@ -437,7 +437,7 @@ emptySRT mod = -- - the closure label for a top-level function (not a CAF) getLabelledBlocks :: CmmDeclPlus -> [(Label, CAFLabel)] getLabelledBlocks (CmmData _ _) = [] -getLabelledBlocks (CmmProc top_info _ _ _) = +getLabelledBlocks (CmmProc (top_info,_) _ _ _) = [ (blockId, mkCAFLabel (cit_lbl info)) | (blockId, info) <- mapToList (info_tbls top_info) , let rep = cit_rep info @@ -454,7 +454,7 @@ getLabelledBlocks (CmmProc top_info _ _ _) = -- resolve references in the CAF's SRT. getCAFs :: CmmDeclPlus -> [(Label, CAFLabel)] getCAFs (CmmData _ _) = [] -getCAFs (CmmProc top_info topLbl _ g) +getCAFs (CmmProc (top_info,_) topLbl _ g) | Just info <- mapLookup (g_entry g) (info_tbls top_info) , let rep = cit_rep info , isStaticRep rep && isThunkRep rep = [(g_entry g, mkCAFLabel topLbl)] @@ -465,7 +465,7 @@ getCAFs (CmmProc top_info topLbl _ g) -- SRT we can merge it with the static closure. [FUN] getStaticFuns :: CmmDeclPlus -> [(BlockId, CLabel)] getStaticFuns (CmmData _ _) = [] -getStaticFuns (CmmProc top_info _ _ g) +getStaticFuns (CmmProc (top_info,_) _ _ g) | Just info <- mapLookup (g_entry g) (info_tbls top_info) , let rep = cit_rep info , Just (id, _) <- cit_clo info @@ -718,11 +718,11 @@ updInfoSRTs -> CmmDeclPlus -> [CmmDeclPlus] -updInfoSRTs dflags srt_env funSRTEnv (CmmProc top_info top_l live g) +updInfoSRTs dflags srt_env funSRTEnv (CmmProc (top_info, rty) top_l live g) | Just (_,closure) <- maybeStaticClosure = [ proc, closure ] | otherwise = [ proc ] where - proc = CmmProc top_info { info_tbls = newTopInfo } top_l live g + proc = CmmProc (top_info { info_tbls = newTopInfo }, rty) top_l live g newTopInfo = mapMapWithKey updInfoTbl (info_tbls top_info) updInfoTbl l info_tbl | l == g_entry g, Just (inf, _) <- maybeStaticClosure = inf From git at git.haskell.org Wed May 16 22:36:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 22:36:45 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: update the translation of CmmStatics based on the SRT overhaul. (f9b84f6) Message-ID: <20180516223645.A0ECF3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/f9b84f633c9eee144824c7dc0a441caa2e04281a/ghc >--------------------------------------------------------------- commit f9b84f633c9eee144824c7dc0a441caa2e04281a Author: Kavon Farvardin Date: Wed May 16 17:36:19 2018 -0500 update the translation of CmmStatics based on the SRT overhaul. [skip-ci] >--------------------------------------------------------------- f9b84f633c9eee144824c7dc0a441caa2e04281a compiler/llvmGen/LlvmCodeGen/Data.hs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs index d549d0c..75493d1 100644 --- a/compiler/llvmGen/LlvmCodeGen/Data.hs +++ b/compiler/llvmGen/LlvmCodeGen/Data.hs @@ -193,23 +193,24 @@ cvtForMangler (Statics _ datum) = do -- -- then a == b. We rely on this property when creating -- its corresponding byte string. - cvtLit (CmmLabelDiffOff srt _ off) = do + cvtLit (CmmLabelDiffOff srt _ off w) = do srtVar <- getGlobalPtr =<< strCLabel_llvm srt let srtLab = asmNameOf srtVar - return $ mkDiffOff srtLab off + return $ mkDiffOff srtLab off w - cvtLit _ = return $ dbg (B.pack "## some other lit for ") + cvtLit _ = error "cvtForMangler: unexpected lit." + -- return $ dbg (B.pack "## some other lit for ") - mkDiffOff srt 0 mine = B.concat [ - szName W64, + mkDiffOff srt 0 w mine = B.concat [ + szName w, srt, B.pack "-", mine, eol ] - mkDiffOff srt off mine = B.concat [ - szName W64, + mkDiffOff srt off w mine = B.concat [ + szName w, B.pack "(", srt, B.pack "-", @@ -230,8 +231,8 @@ cvtForMangler (Statics _ datum) = do - -- XXX delete me later - dbg bstr lab = B.concat [bstr, lab, eol] + -- XXX(kavon) delete me later + -- dbg bstr lab = B.concat [bstr, lab, eol] szName :: Width -> B.ByteString szName W8 = B.pack "\t.byte\t" @@ -265,5 +266,3 @@ cvtForMangler (Statics _ datum) = do -- -- TODO(kavon): does this change on ARM? -- -- translate a size (in bytes) to its assembly directive, followed by a space. -- - - From git at git.haskell.org Wed May 16 22:36:49 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 22:36:49 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm's head updated: update the translation of CmmStatics based on the SRT overhaul. (f9b84f6) Message-ID: <20180516223649.2284F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/kavon-nosplit-llvm' now includes: 648cb28 Use docker images with non-root user b320ba8 Fix a typo about pattern synonyms in documentation. b3bfbed Users Guide: Add that --numa is available on Windows too 43fbb90 Fix typo in description of -V RTS flag d99a65a Add -fexternal-dynamic-refs 98c7749 Revert "GHCi: Don't remove shadowed bindings from typechecker scope." bc95fed Error message and doc improvements for #14335 ed6f9fb ghc-prim: Reduce scope of Clang sync_fetch_and_nand workaround 94f0254 ghc-prim: Silence -Wsync-nand warning in atomic.c 47e2a28 Remove outdated documentation bits concerning -Wmissing-methods a25b763 configure: Accept suffix in OpenBSD triple's OS name df2ea10 Compacted arrays are pinned for isByteArrayPinned# dd3906b UNREG: fix implicit declarations from pdep and pext 8e34101 Fix a debug print in disassembler (#14905) e3ae0eb testsuite: disable T13615 on non-smp targets 5c804e5 Remove splitEithers, use partitionEithers from base 02b3dad Bump Cabal submodule 50972d6 Comment improvements on interpreter breakpoint IO action ba57979 Update a comment in Exception.cmm 152055a Drop GHC 8.0 compatibility cb6d858 Slighly improve infix con app pattern errors 1522cf0 aclocal.m4: allow more GNU/Hurd tuples 0693b0b aclocal.m4: add OSHurd (debian patch) 2a3702d Comments and tiny refactor 5a1ad23 Update test for #5129: f9a6d42 Add a build with 32bit Ubuntu container 2918abf rts: Add --internal-counters RTS flag and several counters 3d378d9 Also check local rules with -frules-check 39c7406 Be more selective in which conditionals we invert fad822e Improve the warning message of qualified unused imports. 0db0e46 Get rid of more CPP in cmm/ and codeGen/ bbcea13 Hoopl: improve postorder calculation a00b88b Implement -dword-hex-literals b37a87b PPC nativeGen: Add support for MO_SS_Conv_W32_W64 5241f29 SPARC nativeGen: Support for MO_SS_Conv_W32_W64 d27336e [RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386 20cbb01 Improve accuracy of get/setAllocationCounter 256577f CmmUtils: get rid of insertBlock fbd9b88 Implement equalKeysUFM the right way 9868f91 Turn a TH Name for built-in syntax into an unqualified RdrName e358854 Require GHC 8.2 to bootstrap GHC c3aea39 Fix #14934 by including axSub0R in typeNatCoAxiomRules f748c52 Don't permit data types with return kind Constraint fdec06a Update tests for #12870 to pass with a slow run of the testsuite. 98c1f22 Bump array submodule 960cd42 Fix typo in user guide about ConstraintKinds 82e8d1f Fix typo b3b394b gen-data-layout.sh: Use bash array for readability 2d4bda2 rts, base: Refactor stats.c to improve --machine-readable report afad556 Add -flate-specialise which runs a later specialisation pass 6a71ef7 Bump autoconf version bound to >= 2.69 d718023 relnotes: Fix parsing of Version: field from Cabal file 60aa53d configure: Accept version suffix in solaris name 57001d9 Update T5129 test: 0a778eb Revert "rts, base: Refactor stats.c to improve --machine-readable report" abaf43d Fix seq# case of exprOkForSpeculation 49ac3f0 Fix #14869 by being more mindful of Type vs. Constraint 411a97e Allow as-patterns in unidirectional patttern synonyms 3446cee Fix two obscure bugs in rule matching efc844f Fix over-eager constant folding in bitInteger 034c32f Improve shortOutIndirections slightly d5577f4 Special-case record fields ending with hash when deriving Read affdea8 Allow PartialTypeSignatures in standalone deriving contexts ceb9147 Support adding objects from TH 7bb1fde testsuite: Add test for #14931 10566a8 Support iOS variants elsewhere when configuring 9893042 Fix two pernicious bugs in DeriveAnyClass cf80995 Add Note [BLACKHOLE points to IND] f7bbc34 Run C finalizers incrementally during mutation fb462f9 Fix panic on module re-exports of DuplicateRcordFields c16df60 document: fix trac issue #14229 9a00bfb rts/RetainerProfile: Dump closure type if push() fails 0703c00 testsuite: Add test for #14925 20f14b4 Fix #14916 with an additional validity check in deriveTyData 0cbb13b Don't refer to blocks in debug info when -g1 a3986d7 Fix scoped type variables in TH for several constructs 41db237 llvmGen: Pass -optlo flags last to opt 20ae19f base: Fix Unicode handling of TyCon's Show instance ecfb4d3 Add new debugging flag -dinline-check efd70cf Add unaligned bytearray access primops. Fixes #4442. d152dab Add a job running on Fedora 60e29dc circleci: Bump Hackage index state f0b258b rts, base: Refactor stats.c to improve --machine-readable report 41c1558 Make it evident in types that StgLam can't have empty args 97e1f30 Fix compilation stopper on macOS with -Werror e3dbb44 Fix #12919 by making the flattener homegeneous. b47a6c3 Fix performance of flattener patch (#12919) f13a0fc Comments only 1fce2c3 Avoid quadratic complexity in typeKind 71d50db Minor refactor and commments 9cc6a18 White space only a7628dc Deal with join points with RULES 3ebf05f Fix the test for #13938 8cfd2e4 configure: Throw error if OS is found to be msys d5c4d46 CmmPipeline: add a second pass of CmmCommonBlockElim d1fb583 testsuite: Add test for #14965 ab9e986 rts: Fix profiled build after D4529 b58282a More format string fixes 88f06d4 rts: One last formatting string fix bf2b9cc Update Note [Documenting optimisation flags] d06a5a9 Rename CI docker images 0951e03 Full AppVeyor build with tests 0017a7b Fix syntax in -flate-specialise docs c00b6d2 Update a few comments regarding CAF lists afb686a printClosure: slightly improve MVAR printing 4de585a Remove MAX_PATH restrictions from RTS, I/O manager and various utilities ca535f9 testsuite: allow accepting of fine grained results [skip ci] 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 b14c037 Some cleanup of the Exitification code 48f55e7 Bump template-haskell to 2.14.0.0 1aa1d40 Restore Trees That Grow reverted commits ae0cff0 CSE: Walk past join point lambdas (#15002) a1fcdf3 Add a forgotten newline in a debug print b2eb9ad Fix GHC collector flavor for Fedora job (Circle CI) 3f59d38 Add test case for #15005 635a784 Remove PARALLEL_HASKELL comments 5161609 testsuite: Add test for negative sqrts (#10010) d5f6d7a rts/RetainerProfile: Handle BLOCKING_QUEUES 81e7980 Minor typofix in LoadArchive.c 2534164 Move gmp/config.mk.in to config.mk.in, fix #14972 c054162 Revert "Fix #14838 by marking TH-spliced code as FromSource" 7bb7f99 Discard reflexive casts during Simplify 3cfb12d In Exitify, zap idInfo of abstracted variables (fixes #15005) a323f21 Move T14925.stdout to its correct location, remove expect_broken ed57a34 Schedule.c: remove unused code 74e768e Schedule.c: remove some unused parameters 270e3e9 No need for sortQuantVars in Exitify after all 111556f Remove fs files from rts install-includes. 4e6da0f Revert "Remove fs files from rts install-includes." 5417c68 Remove fs files from rts install-includes. b138694 TTG for HsBinds and Data instances Plan B c4814ab Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0 f02309f users-guide: Update release notes and language extensions 78ff6e5 Revert "CmmPipeline: add a second pass of CmmCommonBlockElim" a303584 Fix processHeapClosureForDead CONSTR_NOCAF case: 120a261 Update JMP_TBL targets during shortcutting in X86 NCG. f78df87 Fix rts.cabal.in 6f62303 Remove unused function: mkFunCos 7613a81 Fix #9438 by converting a panic to an error message 6a78a40 Use newtype deriving for Hoopl code 9430901 Revert "Fix processHeapClosureForDead CONSTR_NOCAF case:" ce27c7d Correct FixIOException's @since annotation retroactively 00b8ecb Declare `catchRetry#` lazy in its first argument 3c7f9e7 Make shortcutting at the asm stage toggleable and default for O2. 9e89092 Omit ways depending on rts flags for #12870 related tests. 4b831c2 Configure option to disable dtrace fea04de Enhanced constant folding 09128f3 users guide: Note improved constant folding in 8.6 release notes 0e37361 Revert "Enhanced constant folding" 90283b5 rts: Comment wibbles 4d30bc8 Remove markSignalHandlers 7889659 Minor comments in CSE fe325d3 Comments only 4a16804 Fix markup in the UNPACK pragma section of the user's guide. cab3e6b Proper safe coercions paper link 5d76846 Introduce a $tooldir variable for nicer toolchain detection on Windows 447d126 Fix #14710 with more validity checks during renaming 2fdfe05 Bump unix submodule to version 2.8.0.0 19ddd04 Add a test case from the nested CPR work 803178a users-guide: Override mathjax_path 48b8842 rts: fix format arguments for debugBelch calls on 32-bit systems f7f567d Add a test for #14815: cac8be6 Better error message for empty character literal, for Trac #13450. b08a6d7 Fix #15012 with a well-placed use of Any 8f19ecc Bump base to version 4.12.0.0 d9d8015 testsuite: Fix `./validate --slow` 3c3e731 parsec: Make version hack compatible with Windows cbd73bb configure: Use -Werror to check for existence of -no-pie 8fa688a boot: Fix computation of TOP 257c13d Lint types in newFamInst a26983a Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412) b41a42e Bump transformers submodule 2fbe0b5 Caching coercion roles in NthCo and coercionKindsRole refactoring 8b10b89 Inline wrappers earlier f6db0b2 comments only 430e6fe Remove broken top-level shell.nix 698db813 Fix implementation of rnIfaceBndr da74385 base: Add a test for T10412 2a5bdd9 Remove unnecessary check in simplCast 98b0c3f s/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci] ea01daf rts: Use g0 for &generations[0] c7c53c6 Remove a outdated comment [skip ci] bfc1fc2 Typo fix in scavenge_one comment [skip ci] f19b07a users-guide: Fix up formatting in 8.6 release notes 2eafd76 coercion: Improve debugging output f04ac4d Add testcase for #15050 e732210 ghc-prim: Refactor and document __sync_fetch_and_nand workaround 1126e69 testsuite: Fix overflow in T13623 on 32-bit machines ec9638b testsuite: Fix T4442 on 32-bit architectures acb7361 Stable.c: minor refactoring, add/update some comments 625eea9 Update Hadrian submodule 3d38e82 Do not unpack class dictionaries with INLINABLE 693857f Comments only 705dcb0 Refactor in OccurAnal 313720a Rename a local variable c3823cb TTG : complete for balance of hsSyn AST 56bbe1e Add missing stdout file for T14955 512f503 Minor refactoring in Exitify 69119b2 Comments only: the FVAnn invariant 0c01224 Refactor tcExtendLocalFamInst a bit 08003e7 Make out-of-scope errors more prominent 6da5b87 Better linting for types 4e45ebe Add test case for #15108 07cc603 Don't crash when pretty-printing bad joins d4cc74f Preserve join-point arity in CoreOpt b5739bd rts: Don't disable formatting warning in RetainerSet.c 6212d01 testsuite: Bump performance meterics due to 3d38e8284b73 260e23b rts: Add -hT to the rts usage message b7b6617 rts: Allow profiling by closure type in prof way 60f9e46 Exitify: Do not trip over shadowing (fixes #15110) dc655bf errorWithoutStackTrace: omit profiling stack trace (#14970) 4cb5595 storageAddCapabilities: fix bug in updating nursery pointers 198db04 Set arity for absentError 6742ce2 Test Trac #15114 5de0be8 Add regression tests for #14904 358b508 Compute DW_FORM_block length correctly; also fixes #15068 e34e30e Warn against using Data.Monoid.First 90589a9 document the plan for removing Data.Semigroup.Option cf35ab9 minor improvement to wording of warning against First. Add warning against Last 107d2cb Don't shadow "result" in JUnit driver 1ad0277 CircleCI: Save test results as JUnit XML 75361b1 Fix NUMA support on Windows (#15049) 6132d7c Correctly add unwinding info in manifestSp and makeFixupBlocks 866525a Move the ResponseFile module from haddock into base 721e826 GHCi: Improve the error message for hidden packages 6462d90 rts: Throw better error if --numa is used without libnuma support 79c4f10 Enable warning flags to safe-guard against regressions in `base` 5697432 Normalize T14999 test output some more 33de71f Simplify callSiteInline a little b750dcc testsuite: Bump T9630 allocations as a result of 33de71fa06d0 56e8c6f Update docker images to use GHC 8.4.2 and cabal-install-2.2 13e8bc0 Fix typo in user guide about promoted list 49f5943 rel-notes: Note that -hT is now allowed 426ae98 Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module. 361d23a Normalize the element type of ListPat, fix #14547 0f046aa testsuite: Add test for #15067 cb1ee7e Do not supply `-mcpu` if `-optlc` provides `-mcpu` already. 418881f Use unsafeInsertNew to create timers in TimerManager 6243bba Add 'addWordC#' PrimOp be580b4 Add test for invertability of `Floating` methods. d814dd3 Add hyperbolic functions to test of Float-inverses 3ea3341 Stable area hyperbolic sine for `Double` and `Float`. 46548ed base/changelog: Note stabilization of asinh (#14927) 7271db4 testsuite: Bump T5631 expected allocations 875b61e printStackChunk: recognise a few more ret frames 61b245a Small refactoring in Exitify 5b3104a Used named fields for DataDeclRn aa03ad8 Simplify the kind checking for type/class decls 37acca7 users-guide: Move discussion MAX_PATH out of release notes 280de0c Revert "Normalize the element type of ListPat, fix #14547" 981bf47 Normalize the element type of ListPat, fix #14547 849547b Revert "Normalize the element type of ListPat, fix #14547" ba6e445 Normalize the element type of ListPat, fix #14547 5fe6aaa Add -fghci-leak-check to check for space leaks b2ff5dd Fix #15038 e5bb515 rts: remove unused round_up_to_mblocks function 87e169a Revert "Add -fghci-leak-check to check for space leaks" 40a76c9 BlockAlloc.c: reuse tail_of function cb5c2fe Fix unwinding of C -> Haskell FFI calls with -threaded 3781034 Expand $tooldir in ghc --info output 2323ffd Adds CTRL-C handler in Windows's timeout (trac issue #12721) bec2e71 Revert "Fix unwinding of C -> Haskell FFI calls with -threaded" 78db41e Use correct source spans for EmptyCase 00049e2 Emit info-level log message when package envs are loaded 6ab7cf9 Simplify -ddump-json implementation 9039f84 base: Fix handling of showEFloat (Just 0) f0212a9 TcInteract: Ensure that tycons have representations before solving for Typeable 2188427 Bump array submodule 7c665f9 Refactor LitString eb39f98 Fix a few GCC warnings 2828dbf Fix changelog message for asinh cdbe00f Remove unused things from utils/Digraph d4abd03 rts: Compile with gcc -Og 30c887d GHCi: Include a note in the hint to expose a hidden package 48dee7c Clarify what the FFI spec says bf6cad8 Add note documenting refineDefaultAlt 21e1a00 Fix #14875 by introducing PprPrec, and using it cf88c2b ghc-pkg: Configure handle encodings 8f3c149 Add support for opting out of package environments ca3d303 Fix another batch of `./validate --slow` failures b713986 Improve some Foldable methods for NonEmpty 6d57a92 utils/fs: use , not e408d03 Fix #14973 1e27209 Revert "rts: Compile with gcc -Og" d92c755 Fix performance regressions from #14737 79bbb23 rts: export new absentSumFieldError from base f49f90b Tidy up error suppression df6670e testsuite: Fix expected allocations of T9020 and T12425 9dbf66d Revert "Simplify callSiteInline a little" 45ad0c3 Ensure that RTS cabal file reflects dependency on libnuma 1154c9b More explicit comment on switch in registerDelay af986f9 testsuite: Disable T14697 on Windows 01b15b8 Calling GetLastError() on Windows for socket IO (trac issue #12012) bb338f2 Algebraically simplify add/sub with carry/overflow bb3fa2d Less Tc inside simplCore (Phase 1 for #14391) a18e7df Force findPtr to be included in the binary eb8e692 An overhaul of the SRT representation fbd28e2 Allow CmmLabelDiffOff with different widths 2b0918c Save a word in the info table on x86_64 838b690 Merge FUN_STATIC closure with its SRT 01bb17f Make finalizers more reliable. c06d5fb Merge branch 'master' into wip/kavon-nosplit-llvm 873074d fix mistake in merge conflict 756aae5 kill dead debuggging code 44ff660 fix another mistake in merge conflict f9b84f6 update the translation of CmmStatics based on the SRT overhaul. From git at git.haskell.org Wed May 16 23:21:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 May 2018 23:21:19 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: fix bug with missing symbols in info table on Linux (3bee4f8) Message-ID: <20180516232119.998E43ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/3bee4f8515db7aa3d644085da431ecf330575983/ghc >--------------------------------------------------------------- commit 3bee4f8515db7aa3d644085da431ecf330575983 Author: Kavon Farvardin Date: Wed May 16 18:13:04 2018 -0500 fix bug with missing symbols in info table on Linux [skip-ci] >--------------------------------------------------------------- 3bee4f8515db7aa3d644085da431ecf330575983 compiler/llvmGen/LlvmCodeGen/Data.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs index 75493d1..355fca0 100644 --- a/compiler/llvmGen/LlvmCodeGen/Data.hs +++ b/compiler/llvmGen/LlvmCodeGen/Data.hs @@ -195,7 +195,7 @@ cvtForMangler (Statics _ datum) = do -- its corresponding byte string. cvtLit (CmmLabelDiffOff srt _ off w) = do srtVar <- getGlobalPtr =<< strCLabel_llvm srt - let srtLab = asmNameOf srtVar + srtLab <- asmNameOf srtVar return $ mkDiffOff srtLab off w cvtLit _ = error "cvtForMangler: unexpected lit." @@ -220,11 +220,12 @@ cvtForMangler (Statics _ datum) = do eol ] - -- TODO(kavon): consult dflags to put the right number of underscores on the name - asmNameOf (LMGlobalVar fs _ _ _ _ _) = let - llName = "_" ++ unpackFS fs - in - B.pack llName + asmNameOf (LMGlobalVar fs _ _ _ _ _) = do + dflags <- getDynFlags + return $ B.pack $ case platformOS (targetPlatform dflags) of + OSDarwin -> "_" ++ unpackFS fs + OSLinux -> unpackFS fs + _ -> panic "please update cvtForMangler" asmNameOf _ = error "asmNameOf -- unexpected name kind" From git at git.haskell.org Thu May 17 10:22:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 May 2018 10:22:53 +0000 (UTC) Subject: [commit: ghc] master: Comments and refactoring only (f2d27c1) Message-ID: <20180517102253.C33CB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2d27c1ad69321872a87a37144fe41e815301f5b/ghc >--------------------------------------------------------------- commit f2d27c1ad69321872a87a37144fe41e815301f5b Author: Simon Marlow Date: Wed May 16 14:03:55 2018 +0100 Comments and refactoring only Addressing review comments on D4637 >--------------------------------------------------------------- f2d27c1ad69321872a87a37144fe41e815301f5b compiler/cmm/Cmm.hs | 12 ++++++++++++ compiler/cmm/CmmBuildInfoTables.hs | 30 ++++++++++++++++++------------ compiler/codeGen/StgCmmClosure.hs | 2 +- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs index 4c8e528..eb34618 100644 --- a/compiler/cmm/Cmm.hs +++ b/compiler/cmm/Cmm.hs @@ -143,6 +143,18 @@ data CmmInfoTable cit_clo :: Maybe (Id, CostCentreStack) -- Just (id,ccs) <=> build a static closure later -- Nothing <=> don't build a static closure + -- + -- Static closures for FUNs and THUNKs are *not* generated by + -- the code generator, because we might want to add SRT + -- entries to them later (for FUNs at least; THUNKs are + -- treated the same for consistency). See Note [SRTs] in + -- CmmBuildInfoTables, in particular the [FUN] optimisation. + -- + -- This is strictly speaking not a part of the info table that + -- will be finally generated, but it's the only convenient + -- place to convey this information from the code generator to + -- where we build the static closures in + -- CmmBuildInfoTables.doSRTs. } data ProfilingInfo diff --git a/compiler/cmm/CmmBuildInfoTables.hs b/compiler/cmm/CmmBuildInfoTables.hs index d9408df..bef4d98 100644 --- a/compiler/cmm/CmmBuildInfoTables.hs +++ b/compiler/cmm/CmmBuildInfoTables.hs @@ -463,15 +463,16 @@ getCAFs (CmmProc top_info topLbl _ g) -- | Get the list of blocks that correspond to the entry points for -- FUN_STATIC closures. These are the blocks for which if we have an -- SRT we can merge it with the static closure. [FUN] -getStaticFuns :: CmmDecl -> [(BlockId, CLabel)] -getStaticFuns (CmmData _ _) = [] -getStaticFuns (CmmProc top_info _ _ g) - | Just info <- mapLookup (g_entry g) (info_tbls top_info) +getStaticFuns :: [CmmDecl] -> [(BlockId, CLabel)] +getStaticFuns decls = + [ (g_entry g, lbl) + | CmmProc top_info _ _ g <- decls + , Just info <- [mapLookup (g_entry g) (info_tbls top_info)] + , Just (id, _) <- [cit_clo info] , let rep = cit_rep info - , Just (id, _) <- cit_clo info + , isStaticRep rep && isFunRep rep , let lbl = mkLocalClosureLabel (idName id) (idCafInfo id) - , isStaticRep rep && isFunRep rep = [(g_entry g, lbl)] - | otherwise = [] + ] -- | Put the labelled blocks that we will be annotating with SRTs into @@ -527,7 +528,7 @@ doSRTs -> [(CAFEnv, [CmmDecl])] -> IO (ModuleSRTInfo, [CmmDecl]) -doSRTs dflags topSRT tops = do +doSRTs dflags moduleSRTInfo tops = do us <- mkSplitUniqSupply 'u' -- Ignore the original grouping of decls, and combine all the @@ -535,7 +536,7 @@ doSRTs dflags topSRT tops = do let (cafEnvs, declss) = unzip tops cafEnv = mapUnions cafEnvs decls = concat declss - staticFuns = mapFromList (concatMap getStaticFuns decls) + staticFuns = mapFromList (getStaticFuns decls) -- Put the decls in dependency order. Why? So that we can implement -- [Shortcut] and [Filter]. If we need to refer to an SRT that has @@ -547,9 +548,14 @@ doSRTs dflags topSRT tops = do -- On each strongly-connected group of decls, construct the SRT -- closures and the SRT fields for info tables. - let ((result, _srtMap), topSRT') = + let result :: + [ ( [CmmDecl] -- generated SRTs + , [(Label, CLabel)] -- SRT fields for info tables + , [(Label, [SRTEntry])] -- SRTs to attach to static functions + ) ] + ((result, _srtMap), moduleSRTInfo') = initUs_ us $ - flip runStateT topSRT $ + flip runStateT moduleSRTInfo $ flip runStateT Map.empty $ mapM (doSCC dflags staticFuns) sccs @@ -561,7 +567,7 @@ doSRTs dflags topSRT tops = do funSRTMap = mapFromList (concat funSRTs) decls' = concatMap (updInfoSRTs dflags srtFieldMap funSRTMap) decls - return (topSRT', concat declss ++ decls') + return (moduleSRTInfo', concat declss ++ decls') -- | Build the SRT for a strongly-connected component of blocks diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index e0306ee..b021fe0 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -1045,7 +1045,7 @@ mkDataConInfoTable dflags data_con is_static ptr_wds nonptr_wds , cit_rep = sm_rep , cit_prof = prof , cit_srt = Nothing - , cit_clo = Nothing } + , cit_clo = Nothing } where name = dataConName data_con info_lbl = mkConInfoTableLabel name NoCafRefs From git at git.haskell.org Thu May 17 10:22:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 May 2018 10:22:56 +0000 (UTC) Subject: [commit: ghc] master: Add /* fallthrough */ to fix -Wimplicit-fallthrough warning (5f15d53) Message-ID: <20180517102256.921D63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f15d53a98ad2f26465730d8c3463ccc58f6d94a/ghc >--------------------------------------------------------------- commit 5f15d53a98ad2f26465730d8c3463ccc58f6d94a Author: Simon Marlow Date: Thu May 17 09:04:05 2018 +0100 Add /* fallthrough */ to fix -Wimplicit-fallthrough warning >--------------------------------------------------------------- 5f15d53a98ad2f26465730d8c3463ccc58f6d94a rts/sm/Scav.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 5db0acb..770865c 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -1722,9 +1722,11 @@ scavenge_static(void) case FUN_STATIC: scavenge_fun_srt(info); - // fallthrough: a FUN_STATIC can also be an SRT, so it may have pointer - // fields. See Note [SRTs] in CmmBuildInfoTables, specifically the [FUN] - // optimisation. + /* fallthrough */ + + // a FUN_STATIC can also be an SRT, so it may have pointer + // fields. See Note [SRTs] in CmmBuildInfoTables, specifically + // the [FUN] optimisation. case CONSTR: case CONSTR_NOCAF: From git at git.haskell.org Thu May 17 10:22:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 May 2018 10:22:59 +0000 (UTC) Subject: [commit: ghc] master: Update Cabal submodule (b701e47) Message-ID: <20180517102259.5FFEB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b701e4754d1d6286e233c73d7360926f3eaae577/ghc >--------------------------------------------------------------- commit b701e4754d1d6286e233c73d7360926f3eaae577 Author: Simon Marlow Date: Thu May 17 08:48:40 2018 +0100 Update Cabal submodule >--------------------------------------------------------------- b701e4754d1d6286e233c73d7360926f3eaae577 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index 335fa8d..cbdb135 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 335fa8d82520bad1a6980fd55230e65889c99860 +Subproject commit cbdb135bdadab9595f1a80be4c65453b49a9dde2 From git at git.haskell.org Thu May 17 14:18:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 May 2018 14:18:50 +0000 (UTC) Subject: [commit: ghc] master: Fix GHCi space leaks (#15111) (f27e4f6) Message-ID: <20180517141850.62E373ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f27e4f624fe1270e8027ff0a14f03514f5be31b7/ghc >--------------------------------------------------------------- commit f27e4f624fe1270e8027ff0a14f03514f5be31b7 Author: Simon Marlow Date: Tue May 1 16:52:05 2018 +0100 Fix GHCi space leaks (#15111) Summary: There were a number of leaks causing previously loaded modules to be retained after a new `:load`. This fixes enough leaks to get the tests to pass from D4658. Test Plan: See new tests in D4658 Reviewers: niteria, bgamari, simonpj, erikd Subscribers: thomie, carter GHC Trac Issues: #15111 Differential Revision: https://phabricator.haskell.org/D4659 >--------------------------------------------------------------- f27e4f624fe1270e8027ff0a14f03514f5be31b7 compiler/iface/LoadIface.hs | 52 ++++++++++++++++++++++++++++++++++++- compiler/main/HscTypes.hs | 3 ++- compiler/typecheck/TcRnDriver.hs | 7 +++-- compiler/typecheck/TcRnTypes.hs | 12 ++++++--- testsuite/tests/perf/compiler/all.T | 5 +++- testsuite/tests/perf/haddock/all.T | 9 ++++--- 6 files changed, 76 insertions(+), 12 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f27e4f624fe1270e8027ff0a14f03514f5be31b7 From git at git.haskell.org Thu May 17 15:07:46 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 May 2018 15:07:46 +0000 (UTC) Subject: [commit: ghc] master: Fix unwinding of C -> Haskell FFI calls with -threaded (2nd try) (5d3b15e) Message-ID: <20180517150746.4F3923ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5d3b15ecbf17b7747c2f7313a981c60a2d22904d/ghc >--------------------------------------------------------------- commit 5d3b15ecbf17b7747c2f7313a981c60a2d22904d Author: Bartosz Nitka Date: Thu May 17 08:06:33 2018 -0700 Fix unwinding of C -> Haskell FFI calls with -threaded (2nd try) Summary: See the new note. This should fix cb5c2fe875965b7aedbc189012803fc62e48fb3f enough to unbreak Windows and OS X builds. Test Plan: manual testing with patched gdb Reviewers: bgamari, simonmar, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4694 >--------------------------------------------------------------- 5d3b15ecbf17b7747c2f7313a981c60a2d22904d includes/rts/Constants.h | 13 +++ rts/RtsMessages.c | 4 +- rts/RtsUtils.h | 3 + rts/StgCRun.c | 200 ++++++++++++++++++++++++++++++++++++++++++++--- rts/StgStartup.cmm | 18 +---- 5 files changed, 210 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 5d3b15ecbf17b7747c2f7313a981c60a2d22904d From git at git.haskell.org Fri May 18 15:52:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 15:52:00 +0000 (UTC) Subject: [commit: ghc] master: Add regression tests for #11515 and #12563 (819b9cf) Message-ID: <20180518155200.A401D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/819b9cfd21a1773091cec4e34716a0fd7c7d05c6/ghc >--------------------------------------------------------------- commit 819b9cfd21a1773091cec4e34716a0fd7c7d05c6 Author: Ryan Scott Date: Fri May 18 11:50:07 2018 -0400 Add regression tests for #11515 and #12563 Happily, both of these issues appear to have been fixed in GHC 8.2. Let's add regression tests for them to ensure that they stay fixed. >--------------------------------------------------------------- 819b9cfd21a1773091cec4e34716a0fd7c7d05c6 testsuite/tests/partial-sigs/should_fail/T11515.hs | 8 ++++++++ testsuite/tests/partial-sigs/should_fail/T11515.stderr | 5 +++++ testsuite/tests/partial-sigs/should_fail/all.T | 1 + testsuite/tests/typecheck/should_fail/T12563.hs | 7 +++++++ testsuite/tests/typecheck/should_fail/T12563.stderr | 11 +++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 6 files changed, 33 insertions(+) diff --git a/testsuite/tests/partial-sigs/should_fail/T11515.hs b/testsuite/tests/partial-sigs/should_fail/T11515.hs new file mode 100644 index 0000000..2a03e24 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T11515.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE ConstraintKinds, TypeFamilies #-} + +module T11515 where + +type family ShowSyn a where ShowSyn a = Show a + +foo :: (ShowSyn a, _) => a -> String +foo x = show x diff --git a/testsuite/tests/partial-sigs/should_fail/T11515.stderr b/testsuite/tests/partial-sigs/should_fail/T11515.stderr new file mode 100644 index 0000000..2870457 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T11515.stderr @@ -0,0 +1,5 @@ + +T11515.hs:7:20: error: + • Found type wildcard ‘_’ standing for ‘()’ + To use the inferred type, enable PartialTypeSignatures + • In the type signature: foo :: (ShowSyn a, _) => a -> String diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T index 2439f64..9866029 100644 --- a/testsuite/tests/partial-sigs/should_fail/all.T +++ b/testsuite/tests/partial-sigs/should_fail/all.T @@ -59,6 +59,7 @@ test('T10615', normal, compile_fail, ['']) test('T10045', normal, compile_fail, ['']) test('T10999', normal, compile_fail, ['']) test('T11122', normal, compile, ['']) +test('T11515', normal, compile_fail, ['']) test('T11976', normal, compile_fail, ['']) test('PatBind3', normal, compile_fail, ['']) test('T12039', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/T12563.hs b/testsuite/tests/typecheck/should_fail/T12563.hs new file mode 100644 index 0000000..394fa61 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T12563.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes #-} +module T12563 where + +foo :: ((forall a. f a) -> f r) -> f r +foo g = undefined + +x = \g -> foo g diff --git a/testsuite/tests/typecheck/should_fail/T12563.stderr b/testsuite/tests/typecheck/should_fail/T12563.stderr new file mode 100644 index 0000000..f32e99d --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T12563.stderr @@ -0,0 +1,11 @@ + +T12563.hs:7:15: error: + • Cannot instantiate unification variable ‘p0’ + with a type involving foralls: (forall a. f0 a) -> f0 r0 + GHC doesn't yet support impredicative polymorphism + • In the first argument of ‘foo’, namely ‘g’ + In the expression: foo g + In the expression: \ g -> foo g + • Relevant bindings include + g :: p0 (bound at T12563.hs:7:6) + x :: p0 -> f0 r0 (bound at T12563.hs:7:1) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index e4aa682..5a3e733 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -415,6 +415,7 @@ test('T12170a', normal, compile_fail, ['']) test('T12124', normal, compile_fail, ['']) test('T12589', normal, compile_fail, ['']) test('T12529', normal, compile_fail, ['']) +test('T12563', normal, compile_fail, ['']) test('T12648', normal, compile_fail, ['']) test('T12729', normal, compile_fail, ['']) test('T12785b', normal, compile_fail, ['']) From git at git.haskell.org Fri May 18 16:16:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 16:16:38 +0000 (UTC) Subject: [commit: ghc] master: Tiny refactor (efe4054) Message-ID: <20180518161638.8A2F03ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/efe405447b9fa88cebce718a6329091755deb9ad/ghc >--------------------------------------------------------------- commit efe405447b9fa88cebce718a6329091755deb9ad Author: Simon Peyton Jones Date: Thu May 10 17:30:43 2018 +0100 Tiny refactor >--------------------------------------------------------------- efe405447b9fa88cebce718a6329091755deb9ad compiler/typecheck/TcRnMonad.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index d41f586..8f4812e 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -1533,8 +1533,8 @@ setTcLevel tclvl thing_inside isTouchableTcM :: TcTyVar -> TcM Bool isTouchableTcM tv - = do { env <- getLclEnv - ; return (isTouchableMetaTyVar (tcl_tclvl env) tv) } + = do { lvl <- getTcLevel + ; return (isTouchableMetaTyVar lvl tv) } getLclTypeEnv :: TcM TcTypeEnv getLclTypeEnv = do { env <- getLclEnv; return (tcl_env env) } From git at git.haskell.org Fri May 18 16:16:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 16:16:42 +0000 (UTC) Subject: [commit: ghc] master: Orient TyVar/TyVar equalities with deepest on the left (2bbdd00) Message-ID: <20180518161642.65FB13ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2bbdd00c6d70bdc31ff78e2a42b26159c8717856/ghc >--------------------------------------------------------------- commit 2bbdd00c6d70bdc31ff78e2a42b26159c8717856 Author: Simon Peyton Jones Date: Fri May 18 08:43:11 2018 +0100 Orient TyVar/TyVar equalities with deepest on the left Trac #15009 showed that, for Given TyVar/TyVar equalities, we really want to orient them with the deepest-bound skolem on the left. As it happens, we also want to do the same for Wanteds, but for a different reason (more likely to be touchable). Either way, deepest wins: see TcUnify Note [Deeper level on the left]. This observation led me to some significant changes: * A SkolemTv already had a TcLevel, but the level wasn't really being used. Now it is! * I updated added invariant (SkolInf) to TcType Note [TcLevel and untouchable type variables], documenting that the level number of all the ic_skols should be the same as the ic_tclvl of the implication * FlatSkolTvs and FlatMetaTvs previously had a dummy level-number of zero, which messed the scheme up. Now they get a level number the same way as all other TcTyVars, instead of being a special case. * To make sure that FlatSkolTvs and FlatMetaTvs are untouchable (which was previously done via their magic zero level) isTouchableMetaTyVar just tests for those two cases. * TcUnify.swapOverTyVars is the crucial orientation function; see the new Note [TyVar/TyVar orientation]. I completely rewrote this function, and it's now much much easier to understand. I ended up doing some related refactoring, of course * I noticed that tcImplicitTKBndrsX and tcExplicitTKBndrsX were doing a lot of useless work in the case where there are no skolems; I added a fast-patch * Elminate the un-used tcExplicitTKBndrsSig; and thereby get rid of the higher-order parameter to tcExpliciTKBndrsX. * Replace TcHsType.emitTvImplication with TcUnify.checkTvConstraints, by analogy with TcUnify.checkConstraints. * Inline TcUnify.buildImplication into its only call-site in TcUnify.checkConstraints * TcS.buildImplication becomes TcS.CheckConstraintsTcS, with a simpler API * Now that we have NoEvBindsVar we have no need of termEvidenceAllowed; nuke the latter, adding Note [No evidence bindings] to TcEvidence. >--------------------------------------------------------------- 2bbdd00c6d70bdc31ff78e2a42b26159c8717856 compiler/typecheck/TcCanonical.hs | 29 +-- compiler/typecheck/TcErrors.hs | 5 +- compiler/typecheck/TcEvidence.hs | 20 +- compiler/typecheck/TcHsType.hs | 102 ++++----- compiler/typecheck/TcMType.hs | 23 +- compiler/typecheck/TcPatSyn.hs | 6 +- compiler/typecheck/TcRnTypes.hs | 9 - compiler/typecheck/TcSMonad.hs | 76 ++++--- compiler/typecheck/TcSimplify.hs | 8 +- compiler/typecheck/TcType.hs | 91 ++++---- compiler/typecheck/TcUnify.hs | 246 +++++++++++++++------ testsuite/tests/ado/T13242a.stderr | 5 +- .../tests/dependent/should_fail/T14066d.stderr | 10 +- .../tests/deriving/should_compile/T14578.stderr | 8 +- testsuite/tests/gadt/T15009.hs | 20 ++ testsuite/tests/gadt/all.T | 1 + .../should_compile/PushedInAsGivens.stderr | 12 +- .../tests/indexed-types/should_fail/T13784.stderr | 34 ++- .../tests/partial-sigs/should_fail/T14040a.stderr | 26 ++- testsuite/tests/polykinds/T13555.stderr | 5 +- testsuite/tests/polykinds/T14846.hs | 4 +- testsuite/tests/polykinds/T14846.stderr | 51 ++--- testsuite/tests/polykinds/T7230.stderr | 4 +- testsuite/tests/polykinds/T8566.stderr | 4 +- testsuite/tests/polykinds/T9222.stderr | 2 +- .../typecheck/should_compile/ExPatFail.stderr | 6 +- .../tests/typecheck/should_compile/T9834.stderr | 10 +- .../tests/typecheck/should_compile/tc141.stderr | 12 +- testsuite/tests/typecheck/should_fail/T14607.hs | 7 + .../tests/typecheck/should_fail/T14607.stderr | 13 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 18 +- testsuite/tests/typecheck/should_fail/T7869.stderr | 8 +- testsuite/tests/typecheck/should_fail/all.T | 4 +- .../tests/typecheck/should_fail/tcfail068.stderr | 36 +-- .../tests/typecheck/should_fail/tcfail076.stderr | 10 +- .../tests/typecheck/should_fail/tcfail099.stderr | 6 +- .../tests/typecheck/should_fail/tcfail103.stderr | 10 +- .../tests/typecheck/should_fail/tcfail174.stderr | 11 +- .../tests/typecheck/should_fail/tcfail198.stderr | 6 +- 39 files changed, 531 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 2bbdd00c6d70bdc31ff78e2a42b26159c8717856 From git at git.haskell.org Fri May 18 16:16:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 16:16:45 +0000 (UTC) Subject: [commit: ghc] master: Comments only (797a462) Message-ID: <20180518161645.35BA13ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/797a46239d958841219f0f7769b0016b1b23d5ca/ghc >--------------------------------------------------------------- commit 797a46239d958841219f0f7769b0016b1b23d5ca Author: Simon Peyton Jones Date: Thu May 10 17:30:09 2018 +0100 Comments only >--------------------------------------------------------------- 797a46239d958841219f0f7769b0016b1b23d5ca compiler/typecheck/TcInteract.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 41afe3f..c71a01a 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2507,8 +2507,8 @@ matchInstEnv dflags short_cut_solver clas tys loc ([(ispec, inst_tys)], [], False) | short_cut_solver , isOverlappable ispec - -- If the instance has OVERLAPPABLE or OVERLAPS then - -- don't let the short-cut solver choose it, because a + -- If the instance has OVERLAPPABLE or OVERLAPS or INCOHERENT + -- then don't let the short-cut solver choose it, because a -- later instance might overlap it. Trac #14434 is an example -- See Note [Shortcut solving: overlap] -> do { traceTcS "matchClass: ingnoring overlappable" (ppr pred) From git at git.haskell.org Fri May 18 16:16:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 16:16:48 +0000 (UTC) Subject: [commit: ghc] master: Debug tracing only (5a7c657) Message-ID: <20180518161648.0A0143ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5a7c657e02b1e801c84f26ea383f326234cd993c/ghc >--------------------------------------------------------------- commit 5a7c657e02b1e801c84f26ea383f326234cd993c Author: Simon Peyton Jones Date: Fri May 18 08:47:26 2018 +0100 Debug tracing only >--------------------------------------------------------------- 5a7c657e02b1e801c84f26ea383f326234cd993c compiler/typecheck/TcHsType.hs | 4 +++- compiler/typecheck/TcRnTypes.hs | 9 +++++---- compiler/typecheck/TcSimplify.hs | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 125891f..ba1fc3f 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -213,7 +213,8 @@ tcHsSigType :: UserTypeCtxt -> LHsSigType GhcRn -> TcM Type -- See Note [Recipe for checking a signature] tcHsSigType ctxt sig_ty = addSigCtxt ctxt (hsSigType sig_ty) $ - do { kind <- case expectedKindInCtxt ctxt of + do { traceTc "tcHsSigType {" (ppr sig_ty) + ; kind <- case expectedKindInCtxt ctxt of AnythingKind -> newMetaKindVar TheKind k -> return k OpenKind -> newOpenTypeKind @@ -227,6 +228,7 @@ tcHsSigType ctxt sig_ty else tc_hs_sig_type skol_info sig_ty kind ; checkValidType ctxt ty + ; traceTc "end tcHsSigType }" (ppr ty) ; return ty } where skol_info = SigTypeSkol ctxt diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index cc5c7ec..ba07ff8 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -2511,8 +2511,9 @@ instance Outputable Implication where ppr (Implic { ic_tclvl = tclvl, ic_skols = skols , ic_given = given, ic_no_eqs = no_eqs , ic_wanted = wanted, ic_status = status - , ic_binds = binds, ic_need_inner = need_in - , ic_need_outer = need_out, ic_info = info }) + , ic_binds = binds +-- , ic_need_inner = need_in, ic_need_outer = need_out + , ic_info = info }) = hang (text "Implic" <+> lbrace) 2 (sep [ text "TcLevel =" <+> ppr tclvl , text "Skolems =" <+> pprTyVars skols @@ -2521,8 +2522,8 @@ instance Outputable Implication where , hang (text "Given =") 2 (pprEvVars given) , hang (text "Wanted =") 2 (ppr wanted) , text "Binds =" <+> ppr binds - , text "Needed inner =" <+> ppr need_in - , text "Needed outer =" <+> ppr need_out +-- , text "Needed inner =" <+> ppr need_in +-- , text "Needed outer =" <+> ppr need_out , pprSkolInfo info ] <+> rbrace) instance Outputable ImplicStatus where diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 136e60a..84f4eca 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -154,6 +154,8 @@ solveLocalEqualities thing_inside ; traceTc "solveLocalEqualities: running solver }" (ppr reduced_wanted) ; emitConstraints reduced_wanted + + ; traceTc "solveLocalEqualities end }" empty ; return result } -- | Type-check a thing that emits only equality constraints, then From git at git.haskell.org Fri May 18 16:19:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 16:19:27 +0000 (UTC) Subject: [commit: ghc] master: Do not unify representational equalities (ae292c6) Message-ID: <20180518161927.EEB513ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ae292c6d1362f34117be75a2553049cec7022244/ghc >--------------------------------------------------------------- commit ae292c6d1362f34117be75a2553049cec7022244 Author: Simon Peyton Jones Date: Fri May 18 13:58:25 2018 +0100 Do not unify representational equalities This patch is an easy fix to Trac #15144, which was caused by accidentally unifying a representational equality in the unflattener. (The main code in TcInteract was always careful not to do so, but I'd missed the test in the unflattener.) See Note [Do not unify representational equalities] in TcInteract >--------------------------------------------------------------- ae292c6d1362f34117be75a2553049cec7022244 compiler/typecheck/TcFlatten.hs | 5 ++++- compiler/typecheck/TcInteract.hs | 20 ++++++++++++++++++-- .../tests/indexed-types/should_compile/T15144.hs | 18 ++++++++++++++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 45435a1..e2244a9 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -2015,7 +2015,10 @@ unflattenWanteds tv_eqs funeqs unflatten_eq :: TcLevel -> Ct -> Cts -> TcS Cts unflatten_eq tclvl ct@(CTyEqCan { cc_ev = ev, cc_tyvar = tv , cc_rhs = rhs, cc_eq_rel = eq_rel }) rest - | isFmvTyVar tv -- Previously these fmvs were untouchable, + + | NomEq <- eq_rel -- See Note [Do not unify representational equalities] + -- in TcInteract + , isFmvTyVar tv -- Previously these fmvs were untouchable, -- but now they are touchable -- NB: unlike unflattenFmv, filling a fmv here /does/ -- bump the unification count; it is "improvement" diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index c71a01a..7f85d6b 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -1600,8 +1600,8 @@ interactTyVarEq inerts workItem@(CTyEqCan { cc_tyvar = tv ; stopWith ev "Solved from inert" } - | ReprEq <- eq_rel -- We never solve representational - = unsolved_inert -- equalities by unification + | ReprEq <- eq_rel -- See Note [Do not unify representational equalities] + = unsolved_inert | isGiven ev -- See Note [Touchables and givens] = unsolved_inert @@ -1672,6 +1672,22 @@ See also Note [No touchables as FunEq RHS] in TcSMonad; avoiding double unifications is the main reason we disallow touchable unification variables as RHS of type family equations: F xis ~ alpha. +Note [Do not unify representational equalities] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider [W] alpha ~R# b +where alpha is touchable. Should we unify alpha := b? + +Certainly not! Unifying forces alpha and be to be the same; but they +only need to be representationally equal types. + +For example, we might have another constraint [W] alpha ~# N b +where + newtype N b = MkN b +and we want to get alpha := N b. + +See also Trac #15144, which was caused by unifying a representational +equality (in the unflattener). + ************************************************************************ * * diff --git a/testsuite/tests/indexed-types/should_compile/T15144.hs b/testsuite/tests/indexed-types/should_compile/T15144.hs new file mode 100644 index 0000000..c6f0856 --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/T15144.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} +module T15144 where + +import Data.Coerce +import Data.Proxy + +type family F x + +f :: Coercible (F a) b => Proxy a -> F a -> b +f _ = coerce + +-- In #15144, we inferred the less-general type +-- g :: Proxy a -> F a -> F a +g p x = f p x + +h :: Coercible (F a) b => Proxy a -> F a -> b +h p x = g p x diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T index 6074a35..9f0d9b4 100644 --- a/testsuite/tests/indexed-types/should_compile/all.T +++ b/testsuite/tests/indexed-types/should_compile/all.T @@ -280,3 +280,4 @@ test('T14237', normal, compile, ['']) test('T14554', normal, compile, ['']) test('T14680', normal, compile, ['']) test('T15057', normal, compile, ['']) +test('T15144', normal, compile, ['']) From git at git.haskell.org Fri May 18 20:13:44 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 May 2018 20:13:44 +0000 (UTC) Subject: [commit: ghc] wip/T11295-part1: Revert "update hadrian with support for llvm-passes" (8ea3693) Message-ID: <20180518201344.3AD9E3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11295-part1 Link : http://ghc.haskell.org/trac/ghc/changeset/8ea3693cd0cf5363cb47ca9839f2db02e03c5aa3/ghc >--------------------------------------------------------------- commit 8ea3693cd0cf5363cb47ca9839f2db02e03c5aa3 Author: Kavon Farvardin Date: Fri May 18 15:09:27 2018 -0500 Revert "update hadrian with support for llvm-passes" This reverts commit 6bc2425a0281b07a01bbf9949911913ef3b0a49a. >--------------------------------------------------------------- 8ea3693cd0cf5363cb47ca9839f2db02e03c5aa3 hadrian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadrian b/hadrian index 112588a..7c3c45f 160000 --- a/hadrian +++ b/hadrian @@ -1 +1 @@ -Subproject commit 112588a45989a8bc108b747ae47128b5776b102a +Subproject commit 7c3c45f4539af8e75764a1c100dfbb35a86f4be3 From git at git.haskell.org Sat May 19 07:11:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 19 May 2018 07:11:14 +0000 (UTC) Subject: [commit: ghc] master: Fix retainer profiling after SRT overhaul (d78dde9) Message-ID: <20180519071114.D65663ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d78dde9ff685830bc9d6bb24a158eb31bb8a7028/ghc >--------------------------------------------------------------- commit d78dde9ff685830bc9d6bb24a158eb31bb8a7028 Author: Simon Marlow Date: Sat May 19 08:43:52 2018 +0300 Fix retainer profiling after SRT overhaul Recent changes to SRTs (D4632, D4637) also required changes to RetainerProfile.c. This should hopefully get things working again. Test Plan: validate with profiling turned on Reviewers: bgamari, osa1, tdammers, erikd Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4707 >--------------------------------------------------------------- d78dde9ff685830bc9d6bb24a158eb31bb8a7028 rts/RetainerProfile.c | 175 ++++++++------------------------------------------ 1 file changed, 28 insertions(+), 147 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 d78dde9ff685830bc9d6bb24a158eb31bb8a7028 From git at git.haskell.org Sun May 20 15:42:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 15:42:20 +0000 (UTC) Subject: [commit: ghc] master: base: Add Foldable and Traversable instances for Alt (c617c1f) Message-ID: <20180520154220.7F9B83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c617c1fb9403dc80f95c8083db9d347ce839b70f/ghc >--------------------------------------------------------------- commit c617c1fb9403dc80f95c8083db9d347ce839b70f Author: Jack Henahan Date: Wed May 16 16:39:15 2018 -0400 base: Add Foldable and Traversable instances for Alt Add Foldable and Traversable instances for Data.Monoid.Alt Signed-off-by: Jack Henahan Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie, carter GHC Trac Issues: #15099 Differential Revision: https://phabricator.haskell.org/D4698 >--------------------------------------------------------------- c617c1fb9403dc80f95c8083db9d347ce839b70f libraries/base/Data/Foldable.hs | 4 ++++ libraries/base/Data/Traversable.hs | 8 +++++++- libraries/base/changelog.md | 2 ++ testsuite/tests/polykinds/T13393.stderr | 2 +- testsuite/tests/typecheck/should_fail/T10971b.stderr | 8 ++++---- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs index 573d4c8..b3a46be 100644 --- a/libraries/base/Data/Foldable.hs +++ b/libraries/base/Data/Foldable.hs @@ -436,6 +436,10 @@ instance Foldable First where instance Foldable Last where foldMap f = foldMap f . getLast +-- | @since 4.12.0.0 +instance (Foldable f) => Foldable (Alt f) where + foldMap f = foldMap f . getAlt + -- Instances for GHC.Generics -- | @since 4.9.0.0 instance Foldable U1 where diff --git a/libraries/base/Data/Traversable.hs b/libraries/base/Data/Traversable.hs index 2a654b7..dcf7412 100644 --- a/libraries/base/Data/Traversable.hs +++ b/libraries/base/Data/Traversable.hs @@ -60,7 +60,8 @@ import Data.Foldable ( Foldable ) import Data.Functor import Data.Functor.Identity ( Identity(..) ) import Data.Functor.Utils ( StateL(..), StateR(..) ) -import Data.Monoid ( Dual(..), Sum(..), Product(..), First(..), Last(..) ) +import Data.Monoid ( Dual(..), Sum(..), Product(..), + First(..), Last(..), Alt(..) ) import Data.Proxy ( Proxy(..) ) import GHC.Arr @@ -289,6 +290,10 @@ instance Traversable First where instance Traversable Last where traverse f (Last x) = Last <$> traverse f x +-- | @since 4.12.0.0 +instance (Traversable f) => Traversable (Alt f) where + traverse f (Alt x) = Alt <$> traverse f x + -- | @since 4.9.0.0 instance Traversable ZipList where traverse f (ZipList x) = ZipList <$> traverse f x @@ -296,6 +301,7 @@ instance Traversable ZipList where -- | @since 4.9.0.0 deriving instance Traversable Identity + -- Instances for GHC.Generics -- | @since 4.9.0.0 instance Traversable U1 where diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index d4b6261..6909220 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -20,6 +20,8 @@ * `Numeric.showEFloat (Just 0)` now respects the user's requested precision. (#15115) + * `Data.Monoid.Alt` now has `Foldable` and `Traversable` instances. (#15099) + ## 4.11.1.0 *TBA* * Bundled with GHC 8.4.2 diff --git a/testsuite/tests/polykinds/T13393.stderr b/testsuite/tests/polykinds/T13393.stderr index 26aa577..ca67007 100644 --- a/testsuite/tests/polykinds/T13393.stderr +++ b/testsuite/tests/polykinds/T13393.stderr @@ -8,7 +8,7 @@ T13393.hs:61:3: error: instance Traversable Identity -- Defined in ‘Data.Traversable’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ ...plus two others - ...plus 25 instances involving out-of-scope types + ...plus 26 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of a 'do' block: mapM putBackLeftOverInputAndReturnOutput undefined diff --git a/testsuite/tests/typecheck/should_fail/T10971b.stderr b/testsuite/tests/typecheck/should_fail/T10971b.stderr index 2754a3f..2abbcb0 100644 --- a/testsuite/tests/typecheck/should_fail/T10971b.stderr +++ b/testsuite/tests/typecheck/should_fail/T10971b.stderr @@ -11,7 +11,7 @@ T10971b.hs:4:11: error: instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ ...plus one other - ...plus 26 instances involving out-of-scope types + ...plus 27 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: length x In the expression: \ x -> length x @@ -29,7 +29,7 @@ T10971b.hs:5:13: error: instance Traversable Maybe -- Defined in ‘Data.Traversable’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ ...plus one other - ...plus 26 instances involving out-of-scope types + ...plus 27 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: fmapDefault f x In the expression: \ f x -> fmapDefault f x @@ -47,7 +47,7 @@ T10971b.hs:6:14: error: instance Traversable Maybe -- Defined in ‘Data.Traversable’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ ...plus one other - ...plus 26 instances involving out-of-scope types + ...plus 27 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: fmapDefault f x In the expression: (fmapDefault f x, length x) @@ -65,7 +65,7 @@ T10971b.hs:6:31: error: instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ ...plus one other - ...plus 26 instances involving out-of-scope types + ...plus 27 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: length x In the expression: (fmapDefault f x, length x) From git at git.haskell.org Sun May 20 15:42:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 15:42:35 +0000 (UTC) Subject: [commit: ghc] master: base: Fix typo (9171c7f) Message-ID: <20180520154235.44B493ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9171c7f847bc71770a4bb351c4274069d64cd847/ghc >--------------------------------------------------------------- commit 9171c7f847bc71770a4bb351c4274069d64cd847 Author: Ben Gamari Date: Wed May 16 23:44:34 2018 -0400 base: Fix typo >--------------------------------------------------------------- 9171c7f847bc71770a4bb351c4274069d64cd847 libraries/base/GHC/Conc/IO.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/Conc/IO.hs b/libraries/base/GHC/Conc/IO.hs index 3c37cbd..7e97041 100644 --- a/libraries/base/GHC/Conc/IO.hs +++ b/libraries/base/GHC/Conc/IO.hs @@ -188,7 +188,7 @@ threadDelay time case delay# time# s of { s' -> (# s', () #) }} --- | Switch the value of returned 'TVar' from intial value 'False' to 'True' +-- | Switch the value of returned 'TVar' from initial value 'False' to 'True' -- after a given number of microseconds. The caveats associated with -- 'threadDelay' also apply. -- From git at git.haskell.org Sun May 20 15:42:50 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 15:42:50 +0000 (UTC) Subject: [commit: ghc] master: Another batch of './validation --slow' tweaks (c4219d9) Message-ID: <20180520154250.3124B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4219d9f7d122a106fc8fb1e5cd9a62dadadf76c/ghc >--------------------------------------------------------------- commit c4219d9f7d122a106fc8fb1e5cd9a62dadadf76c Author: Alp Mestanogullari Date: Sat May 19 14:00:21 2018 -0400 Another batch of './validation --slow' tweaks This finally gets us to a green ./validate --slow on linux for a ghc checkout from the beginning of this week, see https://circleci.com/gh/ghc/ghc/4739 This is hopefully the final (or second to final) patch to address #14890. Test Plan: ./validate --slow Reviewers: bgamari, hvr, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14890 Differential Revision: https://phabricator.haskell.org/D4712 >--------------------------------------------------------------- c4219d9f7d122a106fc8fb1e5cd9a62dadadf76c libraries/base/tests/all.T | 3 ++- libraries/ghc-compact/tests/all.T | 5 ++++- testsuite/tests/cabal/all.T | 5 ++++- testsuite/tests/dependent/should_compile/all.T | 11 ++++++++++- testsuite/tests/partial-sigs/should_compile/all.T | 11 ++++++++++- testsuite/tests/patsyn/should_run/all.T | 11 ++++++++++- testsuite/tests/profiling/should_run/all.T | 6 +++--- testsuite/tests/rts/all.T | 10 ++++++---- testsuite/tests/simplCore/should_compile/all.T | 17 ++++++++++++++--- testsuite/tests/th/all.T | 4 +++- testsuite/tests/th/should_compile/T13949/all.T | 12 +++++++++++- testsuite/tests/th/should_compile/T8025/all.T | 11 +++++++++-- testsuite/tests/typecheck/should_compile/all.T | 11 +++++++++-- 13 files changed, 95 insertions(+), 22 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 c4219d9f7d122a106fc8fb1e5cd9a62dadadf76c From git at git.haskell.org Sun May 20 15:43:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 15:43:05 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix compaction of SmallMutArrPtrs (12deb9a) Message-ID: <20180520154305.E65A23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12deb9a97c05ad462ef04e8d2062c3d11c52c6ff/ghc >--------------------------------------------------------------- commit 12deb9a97c05ad462ef04e8d2062c3d11c52c6ff Author: Ben Gamari Date: Sat May 19 14:00:59 2018 -0400 rts: Fix compaction of SmallMutArrPtrs This was blatantly wrong due to copy-paste blindness: * labels were shadowed, which GHC doesn't warn about(!), resulting in plainly wrong behavior * the sharing check was omitted * the wrong closure layout was being used Moreover, the test wasn't being run due to its primitive dependency, so I didn't even notice. Sillyness. Test Plan: install `primitive`, `make test TEST=compact_small_array` Reviewers: simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13857. Differential Revision: https://phabricator.haskell.org/D4702 >--------------------------------------------------------------- 12deb9a97c05ad462ef04e8d2062c3d11c52c6ff .../ghc-compact/tests/compact_small_ptr_array.hs | 2 +- .../tests/compact_small_ptr_array.stdout | 1 + rts/Compact.cmm | 28 ++++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.hs b/libraries/ghc-compact/tests/compact_small_ptr_array.hs index 8599c71..77c9fa8 100644 --- a/libraries/ghc-compact/tests/compact_small_ptr_array.hs +++ b/libraries/ghc-compact/tests/compact_small_ptr_array.hs @@ -3,6 +3,6 @@ import Data.Primitive.SmallArray main :: IO () main = do - arr <- newSmallArray 5 (Just 'a') + arr <- newSmallArray 5 (Just 'a') >>= unsafeFreezeSmallArray arr' <- compact arr print $ getCompact arr' diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.stdout b/libraries/ghc-compact/tests/compact_small_ptr_array.stdout new file mode 100644 index 0000000..24b514e --- /dev/null +++ b/libraries/ghc-compact/tests/compact_small_ptr_array.stdout @@ -0,0 +1 @@ +fromListN 5 [Just 'a',Just 'a',Just 'a',Just 'a',Just 'a'] diff --git a/rts/Compact.cmm b/rts/Compact.cmm index 719dac8..2c8a030 100644 --- a/rts/Compact.cmm +++ b/rts/Compact.cmm @@ -189,24 +189,26 @@ eval: SMALL_MUT_ARR_PTRS_FROZEN0, SMALL_MUT_ARR_PTRS_FROZEN: { - W_ i, size, ptrs; - size = SIZEOF_StgMutArrPtrs + WDS(StgMutArrPtrs_size(p)); - ptrs = StgMutArrPtrs_ptrs(p); - ALLOCATE(compact, BYTES_TO_WDS(size), p, to, tag); + (should) = ccall shouldCompact(compact "ptr", p "ptr"); + if (should == SHOULDCOMPACT_IN_CNF) { P_[pp] = p; return(); } + + CHECK_HASH(); + + W_ i, ptrs; + ptrs = StgSmallMutArrPtrs_ptrs(p); + ALLOCATE(compact, BYTES_TO_WDS(SIZEOF_StgSmallMutArrPtrs) + ptrs, p, to, tag); P_[pp] = tag | to; SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p)); - StgMutArrPtrs_ptrs(to) = ptrs; - StgMutArrPtrs_size(to) = StgMutArrPtrs_size(p); - prim %memcpy(to, p, size, 1); + StgSmallMutArrPtrs_ptrs(to) = ptrs; i = 0; - loop0: + loop1: if (i < ptrs) ( likely: True ) { W_ q; q = to + SIZEOF_StgSmallMutArrPtrs + WDS(i); call stg_compactAddWorkerzh( compact, P_[p + SIZEOF_StgSmallMutArrPtrs + WDS(i)], q); i = i + 1; - goto loop0; + goto loop1; } return(); } @@ -238,16 +240,16 @@ eval: // First, copy the non-pointers if (nptrs > 0) { i = ptrs; - loop1: + loop2: StgClosure_payload(to,i) = StgClosure_payload(p,i); i = i + 1; - if (i < ptrs + nptrs) ( likely: True ) goto loop1; + if (i < ptrs + nptrs) ( likely: True ) goto loop2; } // Next, recursively compact and copy the pointers if (ptrs == 0) { return(); } i = 0; - loop2: + loop3: W_ q; q = to + SIZEOF_StgHeader + OFFSET_StgClosure_payload + WDS(i); // Tail-call the last one. This means we don't build up a deep @@ -257,7 +259,7 @@ eval: } call stg_compactAddWorkerzh(compact, StgClosure_payload(p,i), q); i = i + 1; - goto loop2; + goto loop3; } // these might be static closures that we can avoid copying into From git at git.haskell.org Sun May 20 15:43:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 15:43:21 +0000 (UTC) Subject: [commit: ghc] master: Add HeapView functionality (ec22f7d) Message-ID: <20180520154321.085C23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ec22f7ddc81b40a9dbcf140e5cf44730cb776d00/ghc >--------------------------------------------------------------- commit ec22f7ddc81b40a9dbcf140e5cf44730cb776d00 Author: Patrick Dougherty Date: Wed May 16 16:50:13 2018 -0400 Add HeapView functionality This pulls parts of Joachim Breitner's ghc-heap-view library inside GHC. The bits added are the C hooks into the RTS and a basic Haskell wrapper to these C hooks. The main reason for these to be added to GHC proper is that the code needs to be kept in sync with the closure types defined by the RTS. It is expected that the version of HeapView shipped with GHC will always work with that version of GHC and that extra functionality can be layered on top with a library like ghc-heap-view distributed via Hackage. Test Plan: validate Reviewers: simonmar, hvr, nomeata, austin, Phyx, bgamari, erikd Reviewed By: bgamari Subscribers: carter, patrickdoc, tmcgilchrist, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3055 >--------------------------------------------------------------- ec22f7ddc81b40a9dbcf140e5cf44730cb776d00 .gitignore | 1 + compiler/ghc.cabal.in | 2 +- compiler/ghci/ByteCodeLink.hs | 3 +- compiler/ghci/ByteCodeTypes.hs | 2 +- compiler/ghci/DebuggerUtils.hs | 132 ------- compiler/ghci/RtClosureInspect.hs | 259 +++++-------- compiler/prelude/primops.txt.pp | 9 +- configure.ac | 2 +- ghc.mk | 3 +- includes/Rts.h | 1 + includes/rts/storage/Heap.h | 18 + libraries/ghc-heap/.gitignore | 5 + libraries/ghc-heap/GHC/Exts/Heap.hs | 254 +++++++++++++ libraries/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs | 98 +++++ libraries/ghc-heap/GHC/Exts/Heap/Closures.hs | 313 +++++++++++++++ libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc | 16 + libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc | 77 ++++ .../ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc | 37 ++ libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc | 73 ++++ libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc | 128 +++++++ libraries/ghc-heap/LICENSE | 30 ++ libraries/{ghc-compact => ghc-heap}/Setup.hs | 0 libraries/ghc-heap/cbits/HeapPrim.cmm | 13 + libraries/ghc-heap/ghc-heap.cabal.in | 38 ++ libraries/{base => ghc-heap}/tests/Makefile | 0 libraries/ghc-heap/tests/all.T | 8 + libraries/ghc-heap/tests/heap_all.hs | 421 +++++++++++++++++++++ libraries/ghc-heap/tests/heap_all.stdout | 1 + libraries/ghci/GHCi/InfoTable.hsc | 137 ++----- libraries/ghci/GHCi/Message.hs | 2 +- libraries/ghci/ghci.cabal.in | 1 + rts/Heap.c | 220 +++++++++++ rts/PrimOps.cmm | 88 ++--- rts/rts.cabal.in | 2 + testsuite/tests/ghc-api/T4891/T4891.hs | 24 +- 35 files changed, 1935 insertions(+), 483 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 ec22f7ddc81b40a9dbcf140e5cf44730cb776d00 From git at git.haskell.org Sun May 20 18:35:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:35:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: 8.4.2-notes: Make wording on #13930 a bit stronger (11cb70b) Message-ID: <20180520183553.89C843ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/11cb70ba4f6bdad1cceb770bdd96f543c185dd7f/ghc >--------------------------------------------------------------- commit 11cb70ba4f6bdad1cceb770bdd96f543c185dd7f Author: Ben Gamari Date: Wed May 2 16:00:23 2018 -0400 8.4.2-notes: Make wording on #13930 a bit stronger >--------------------------------------------------------------- 11cb70ba4f6bdad1cceb770bdd96f543c185dd7f docs/users_guide/8.4.2-notes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/8.4.2-notes.rst b/docs/users_guide/8.4.2-notes.rst index 7e182f3..e36c3be 100644 --- a/docs/users_guide/8.4.2-notes.rst +++ b/docs/users_guide/8.4.2-notes.rst @@ -11,7 +11,8 @@ This is a bug-fix release resolving several regressions introduced in 8.4.1. The highlights, since the 8.4.1 release, are: - Fixed a regression causing uses of ``Control.Exception.evaluate`` to be - incorrectly optimised, resulting in space leaks (:ghc-ticket:`13930`) + incorrectly optimised, resulting in incorrect evaluation behavior + (:ghc-ticket:`13930`) - Fix a regression causing the interpreter to segmentation fault when built with profiling (:ghc-ticket:`14705`) From git at git.haskell.org Sun May 20 18:36:04 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:36:04 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: users-guide: Override mathjax_path (da3ed4d) Message-ID: <20180520183604.62A4C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/da3ed4d4e90afe96a6071891e53f9db2d0f764f9/ghc >--------------------------------------------------------------- commit da3ed4d4e90afe96a6071891e53f9db2d0f764f9 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 (cherry picked from commit 803178a5383cdb5383e5b9fedd8feb3d65f9183b) >--------------------------------------------------------------- da3ed4d4e90afe96a6071891e53f9db2d0f764f9 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 Sun May 20 18:36:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:36:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: rts: Fix compaction of SmallMutArrPtrs (0d40fd7) Message-ID: <20180520183615.341053ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/0d40fd758de02ef9898883f611102288eac18c51/ghc >--------------------------------------------------------------- commit 0d40fd758de02ef9898883f611102288eac18c51 Author: Ben Gamari Date: Sat May 19 14:00:59 2018 -0400 rts: Fix compaction of SmallMutArrPtrs This was blatantly wrong due to copy-paste blindness: * labels were shadowed, which GHC doesn't warn about(!), resulting in plainly wrong behavior * the sharing check was omitted * the wrong closure layout was being used Moreover, the test wasn't being run due to its primitive dependency, so I didn't even notice. Sillyness. Test Plan: install `primitive`, `make test TEST=compact_small_array` Reviewers: simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13857. Differential Revision: https://phabricator.haskell.org/D4702 (cherry picked from commit 12deb9a97c05ad462ef04e8d2062c3d11c52c6ff) >--------------------------------------------------------------- 0d40fd758de02ef9898883f611102288eac18c51 .../ghc-compact/tests/compact_small_ptr_array.hs | 2 +- .../tests/compact_small_ptr_array.stdout | 1 + rts/Compact.cmm | 28 ++++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.hs b/libraries/ghc-compact/tests/compact_small_ptr_array.hs index 8599c71..77c9fa8 100644 --- a/libraries/ghc-compact/tests/compact_small_ptr_array.hs +++ b/libraries/ghc-compact/tests/compact_small_ptr_array.hs @@ -3,6 +3,6 @@ import Data.Primitive.SmallArray main :: IO () main = do - arr <- newSmallArray 5 (Just 'a') + arr <- newSmallArray 5 (Just 'a') >>= unsafeFreezeSmallArray arr' <- compact arr print $ getCompact arr' diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.stdout b/libraries/ghc-compact/tests/compact_small_ptr_array.stdout new file mode 100644 index 0000000..24b514e --- /dev/null +++ b/libraries/ghc-compact/tests/compact_small_ptr_array.stdout @@ -0,0 +1 @@ +fromListN 5 [Just 'a',Just 'a',Just 'a',Just 'a',Just 'a'] diff --git a/rts/Compact.cmm b/rts/Compact.cmm index 174444d..d1c8ead 100644 --- a/rts/Compact.cmm +++ b/rts/Compact.cmm @@ -189,24 +189,26 @@ eval: SMALL_MUT_ARR_PTRS_FROZEN0, SMALL_MUT_ARR_PTRS_FROZEN: { - W_ i, size, ptrs; - size = SIZEOF_StgMutArrPtrs + WDS(StgMutArrPtrs_size(p)); - ptrs = StgMutArrPtrs_ptrs(p); - ALLOCATE(compact, BYTES_TO_WDS(size), p, to, tag); + (should) = ccall shouldCompact(compact "ptr", p "ptr"); + if (should == SHOULDCOMPACT_IN_CNF) { P_[pp] = p; return(); } + + CHECK_HASH(); + + W_ i, ptrs; + ptrs = StgSmallMutArrPtrs_ptrs(p); + ALLOCATE(compact, BYTES_TO_WDS(SIZEOF_StgSmallMutArrPtrs) + ptrs, p, to, tag); P_[pp] = tag | to; SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p)); - StgMutArrPtrs_ptrs(to) = ptrs; - StgMutArrPtrs_size(to) = StgMutArrPtrs_size(p); - prim %memcpy(to, p, size, 1); + StgSmallMutArrPtrs_ptrs(to) = ptrs; i = 0; - loop0: + loop1: if (i < ptrs) { W_ q; q = to + SIZEOF_StgSmallMutArrPtrs + WDS(i); call stg_compactAddWorkerzh( compact, P_[p + SIZEOF_StgSmallMutArrPtrs + WDS(i)], q); i = i + 1; - goto loop0; + goto loop1; } return(); } @@ -238,16 +240,16 @@ eval: // First, copy the non-pointers if (nptrs > 0) { i = ptrs; - loop1: + loop2: StgClosure_payload(to,i) = StgClosure_payload(p,i); i = i + 1; - if (i < ptrs + nptrs) goto loop1; + if (i < ptrs + nptrs) goto loop2; } // Next, recursively compact and copy the pointers if (ptrs == 0) { return(); } i = 0; - loop2: + loop3: W_ q; q = to + SIZEOF_StgHeader + OFFSET_StgClosure_payload + WDS(i); // Tail-call the last one. This means we don't build up a deep @@ -257,7 +259,7 @@ eval: } call stg_compactAddWorkerzh(compact, StgClosure_payload(p,i), q); i = i + 1; - goto loop2; + goto loop3; } // these might be static closures that we can avoid copying into From git at git.haskell.org Sun May 20 18:36:27 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:36:27 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Fix #15038 (64ecfc3) Message-ID: <20180520183627.AACAF3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/64ecfc37d6e3fcf7e11f9baeceb7236975c0e4c6/ghc >--------------------------------------------------------------- commit 64ecfc37d6e3fcf7e11f9baeceb7236975c0e4c6 Author: Ömer Sinan Ağacan Date: Thu May 10 11:13:37 2018 +0300 Fix #15038 We introduce a new Id for unused pointer values in unboxed sums that is not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY definitions CAFFY, fixing #15038. To make sure anything referenced by the new id will be retained we get a stable pointer to in on RTS startup. Test Plan: Passes validate Reviewers: simonmar, simonpj, hvr, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15038 Differential Revision: https://phabricator.haskell.org/D4680 (cherry picked from commit b2ff5dde399cd012218578945ada1d9ff68daa35) >--------------------------------------------------------------- 64ecfc37d6e3fcf7e11f9baeceb7236975c0e4c6 compiler/coreSyn/MkCore.hs | 36 ++++- compiler/prelude/PrelNames.hs | 7 +- compiler/simplStg/UnariseStg.hs | 10 +- libraries/base/Control/Exception/Base.hs | 6 +- rts/Prelude.h | 2 + rts/RtsStartup.c | 7 + testsuite/tests/codeGen/should_run/T15038/Makefile | 9 ++ testsuite/tests/codeGen/should_run/T15038/all.T | 4 + .../should_run/T15038/common/Data/Trie/Naive.hs | 80 ++++++++++ .../codeGen/should_run/T15038/src/Packed/Bytes.hs | 80 ++++++++++ .../should_run/T15038/src/Packed/Bytes/Parser.hs | 165 +++++++++++++++++++++ .../T15038/src/Packed/Bytes/Stream/ST.hs | 61 ++++++++ .../tests/codeGen/should_run/T15038/test/Main.hs | 4 + .../tests/codeGen/should_run/T15038/test/Parser.hs | 61 ++++++++ 14 files changed, 521 insertions(+), 11 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 64ecfc37d6e3fcf7e11f9baeceb7236975c0e4c6 From git at git.haskell.org Sun May 20 18:36:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:36:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: rts: export new absentSumFieldError from base (e4e61f7) Message-ID: <20180520183638.58C1C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/e4e61f77a7d5ee1d13d229bc926ee35a9d19b00a/ghc >--------------------------------------------------------------- commit e4e61f77a7d5ee1d13d229bc926ee35a9d19b00a Author: Sergei Trofimovich Date: Mon May 14 21:51:48 2018 +0100 rts: export new absentSumFieldError from base commit b2ff5dde399cd012218578945ada1d9ff68daa35 "Fix #15038" added new stable closure 'absentSumFieldError_closure' to base package. This closure is used in rts package. Unfortunately the symbol was not explicitly exported and build failed on windows as: ``` "inplace/bin/ghc-stage1" -o ...hsc2hs.exe ... rts/dist/build/libHSrts.a(RtsStartup.o): In function `hs_init_ghc': rts/RtsStartup.c:272:0: error: undefined reference to `base_ControlziExceptionziBase_absentSumFieldError_closure' | 272 | getStablePtr((StgPtr)absentSumFieldError_closure); | ^ ``` This change adds 'absentSumFieldError_closure' to explicit export into libHSbase.def. Signed-off-by: Sergei Trofimovich (cherry picked from commit 79bbb23fd3085c3dc52497175e9e74f73f7f6b68) >--------------------------------------------------------------- e4e61f77a7d5ee1d13d229bc926ee35a9d19b00a rts/package.conf.in | 2 ++ rts/rts.cabal.in | 2 ++ rts/win32/libHSbase.def | 1 + 3 files changed, 5 insertions(+) diff --git a/rts/package.conf.in b/rts/package.conf.in index 05d98a5..14e9258 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -93,6 +93,7 @@ ld-options: , "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure" , "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure" , "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure" + , "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure" , "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure" , "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure" , "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure" @@ -190,6 +191,7 @@ ld-options: , "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure" , "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure" , "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure" + , "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure" , "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure" , "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure" , "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure" diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index 71aef3d..664a8f1 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -175,6 +175,7 @@ library "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure" "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure" "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure" + "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure" "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure" "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure" "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure" @@ -244,6 +245,7 @@ library "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure" "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure" "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure" + "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure" "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure" "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure" "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure" diff --git a/rts/win32/libHSbase.def b/rts/win32/libHSbase.def index 496893a..d4ec1fa 100644 --- a/rts/win32/libHSbase.def +++ b/rts/win32/libHSbase.def @@ -42,6 +42,7 @@ EXPORTS base_GHCziIOziException_cannotCompactPinned_closure base_GHCziIOziException_cannotCompactMutable_closure + base_ControlziExceptionziBase_absentSumFieldError_closure base_ControlziExceptionziBase_nonTermination_closure base_ControlziExceptionziBase_nestedAtomically_closure base_GHCziEventziThread_blockedOnBadFD_closure From git at git.haskell.org Sun May 20 18:36:49 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:36:49 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Compute DW_FORM_block length correctly; also fixes #15068 (56812d6) Message-ID: <20180520183649.361AB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/56812d6fac79f6ed9f9132de973f83b528191b62/ghc >--------------------------------------------------------------- commit 56812d6fac79f6ed9f9132de973f83b528191b62 Author: Bertram Felgenhauer Date: Thu May 3 18:03:53 2018 +0300 Compute DW_FORM_block length correctly; also fixes #15068 Before this patch, the pprUnwindwExpr function computed the length of by the following assembly fragment: .uleb128 1f-.-1 1: That is, to compute the length, it takes the difference of the label 1 and the address of the .uleb128 directive, and subtracts 1. In #15068 it was reported that `as` from binutils 4.30 has trouble with evaluating the `.` part of the expression. However, there is actually a problem with the expression, if the length of the data ever becomes larger than 128: In that case, the .uleb128 directive will emit more than 1 byte, and the computed length will be wrong. The present patch changes the assembly fragment to use two labels, which fixes both these problems. .uleb128 2f-1f 1: 2: Test Plan: validate Reviewers: bgamari, osa1 Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15068 Differential Revision: https://phabricator.haskell.org/D4654 (cherry picked from commit 358b508051333882d4099acca8f269e6fb2b7d65) >--------------------------------------------------------------- 56812d6fac79f6ed9f9132de973f83b528191b62 compiler/nativeGen/Dwarf/Types.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs index 23a2c92..579ed0d 100644 --- a/compiler/nativeGen/Dwarf/Types.hs +++ b/compiler/nativeGen/Dwarf/Types.hs @@ -492,9 +492,11 @@ pprUnwindExpr spIsCFA expr pprE (UwPlus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_plus pprE (UwMinus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_minus pprE (UwTimes u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_mul - in text "\t.uleb128 1f-.-1" $$ -- DW_FORM_block length + in text "\t.uleb128 2f-1f" $$ -- DW_FORM_block length + -- computed as the difference of the following local labels 2: and 1: + text "1:" $$ pprE expr $$ - text "1:" + text "2:" -- | Generate code for re-setting the unwind information for a -- register to @undefined@ From git at git.haskell.org Sun May 20 18:37:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:37:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: Emit info-level log message when package envs are loaded (de3ade6) Message-ID: <20180520183700.146C43ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/de3ade6080cebd7ed71d3b70556d31d509cca4b0/ghc >--------------------------------------------------------------- commit de3ade6080cebd7ed71d3b70556d31d509cca4b0 Author: Herbert Valerio Riedel Date: Sun May 13 19:32:29 2018 +0200 Emit info-level log message when package envs are loaded A common complaint with the new package environment files feature is that it's not obvious when package environments have been picked up. This patch applies the same strategy that was already used for `.ghci` files (which exhibit similar potential for confusion, c.f. #11389) to package environment files. For instance, this new notification looks like below for a GHCi invocation which loads both, a GHCi configuration as well as a package environment: GHCi, version 8.5.20180512: http://www.haskell.org/ghc/ :? for help Loaded package environment from /tmp/parsec-3.1.13.0/.ghc.environment.x86_64-linux-8.5.20180512 Loaded GHCi configuration from /home/hvr/.ghci Prelude> Addresses #15145 Reviewed By: bgamari, angerman GHC Trac Issues: #15145 Differential Revision: https://phabricator.haskell.org/D4689 (cherry picked from commit 00049e2dce93b1e468c3fde3287371eb988aafdc) >--------------------------------------------------------------- de3ade6080cebd7ed71d3b70556d31d509cca4b0 compiler/main/DynFlags.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 5e9003a..5b512a1 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -4845,6 +4845,9 @@ interpretPackageEnv dflags = do return dflags Just envfile -> do content <- readFile envfile + putLogMsg dflags NoReason SevInfo noSrcSpan + (defaultUserStyle dflags) + (text ("Loaded package environment from " ++ envfile)) let setFlags :: DynP () setFlags = do setGeneralFlag Opt_HideAllPackages From git at git.haskell.org Sun May 20 18:37:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 May 2018 18:37:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.4: storageAddCapabilities: fix bug in updating nursery pointers (31d3806) Message-ID: <20180520183711.E3E4C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.4 Link : http://ghc.haskell.org/trac/ghc/changeset/31d38067c9f15ebdc1c338ca34fc994d8412ae92/ghc >--------------------------------------------------------------- commit 31d38067c9f15ebdc1c338ca34fc994d8412ae92 Author: Simon Marlow Date: Fri Apr 27 11:31:19 2018 -0700 storageAddCapabilities: fix bug in updating nursery pointers Summary: We were unconditionally updating the nursery pointers to be `nurseries[cap->no]`, but when using nursery chunks this might be wrong. This manifested as a later assertion failure in allocate(). Test Plan: new test case Reviewers: bgamari, niteria, erikd Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4649 (cherry picked from commit 4cb5595e5e800818721a623a5419cad29a528000) >--------------------------------------------------------------- 31d38067c9f15ebdc1c338ca34fc994d8412ae92 rts/sm/Storage.c | 7 +++++-- testsuite/tests/rts/all.T | 7 +++++++ testsuite/tests/rts/nursery-chunks1.hs | 12 ++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index e801c34..c6e1cb4 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -224,6 +224,7 @@ initStorage (void) void storageAddCapabilities (uint32_t from, uint32_t to) { uint32_t n, g, i, new_n_nurseries; + nursery *old_nurseries; if (RtsFlags.GcFlags.nurseryChunkSize == 0) { new_n_nurseries = to; @@ -233,6 +234,7 @@ void storageAddCapabilities (uint32_t from, uint32_t to) stg_max(to, total_alloc / RtsFlags.GcFlags.nurseryChunkSize); } + old_nurseries = nurseries; if (from > 0) { nurseries = stgReallocBytes(nurseries, new_n_nurseries * sizeof(struct nursery_), @@ -244,8 +246,9 @@ void storageAddCapabilities (uint32_t from, uint32_t to) // we've moved the nurseries, so we have to update the rNursery // pointers from the Capabilities. - for (i = 0; i < to; i++) { - capabilities[i]->r.rNursery = &nurseries[i]; + for (i = 0; i < from; i++) { + uint32_t index = capabilities[i]->r.rNursery - old_nurseries; + capabilities[i]->r.rNursery = &nurseries[index]; } /* The allocation area. Policy: keep the allocation area diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 7c5b9c7..9e2a6ac 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -382,3 +382,10 @@ test('T12903', [when(opsys('mingw32'), skip)], compile_and_run, ['']) test('T13832', exit_code(1), compile_and_run, ['-threaded']) test('T13894', normal, compile_and_run, ['']) test('T14497', normal, compile_and_run, ['-O']) + +test('nursery-chunks1', + [ extra_run_opts('4 100 +RTS -n32k -A1m -RTS') + , only_ways(['threaded1','threaded2']) + ], + compile_and_run, + ['']) diff --git a/testsuite/tests/rts/nursery-chunks1.hs b/testsuite/tests/rts/nursery-chunks1.hs new file mode 100644 index 0000000..f8f9f6a --- /dev/null +++ b/testsuite/tests/rts/nursery-chunks1.hs @@ -0,0 +1,12 @@ +-- Test for a bug that provoked the following assertion failure: +-- nursery-chunks1: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 903 +module Main (main) where + +import Control.Monad +import System.Environment +import GHC.Conc + +main = do + [n,m] <- fmap read <$> getArgs + forM_ [1..n] $ \n' -> + when (sum [1.. m::Integer] > 0) $ setNumCapabilities (fromIntegral n') From git at git.haskell.org Mon May 21 00:43:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 00:43:43 +0000 (UTC) Subject: [commit: ghc] master: ghc-prim: Bump version (e1fd946) Message-ID: <20180521004343.DFB583ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e1fd946103fba2b8bfc4f5b3096de4307a7e6f81/ghc >--------------------------------------------------------------- commit e1fd946103fba2b8bfc4f5b3096de4307a7e6f81 Author: Ben Gamari Date: Sun May 20 19:47:43 2018 -0400 ghc-prim: Bump version unpackClosure#'s behavior and type has changed. This caused a CPP guard in the new ghc-heap package to fail when bootstrapping with GHC 8.4. Test Plan: Validate bootstrapping with GHC 8.4 Reviewers: RyanGlScott Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4716 >--------------------------------------------------------------- e1fd946103fba2b8bfc4f5b3096de4307a7e6f81 libraries/ghc-compact/ghc-compact.cabal | 2 +- libraries/ghc-heap/GHC/Exts/Heap.hs | 2 +- libraries/ghc-prim/changelog.md | 6 +++++- libraries/ghc-prim/ghc-prim.cabal | 2 +- testsuite/tests/ado/ado004.stderr | 2 +- testsuite/tests/backpack/should_compile/bkp16.stderr | 2 +- testsuite/tests/determinism/determ021/determ021.stdout | 4 ++-- testsuite/tests/driver/json2.stderr | 2 +- 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 +- .../tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Defaulting1MROn.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr | 2 +- testsuite/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 +- .../tests/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/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/typecheck/should_compile/T12763.stderr | 2 +- testsuite/tests/typecheck/should_compile/tc231.stderr | 2 +- 65 files changed, 70 insertions(+), 66 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e1fd946103fba2b8bfc4f5b3096de4307a7e6f81 From git at git.haskell.org Mon May 21 00:43:58 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 00:43:58 +0000 (UTC) Subject: [commit: ghc] master: ghc-pkg: recompute `abi-depends` for updated packages (1cdc14f) Message-ID: <20180521004358.F30963ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1cdc14f9c014f1a520638f7c0a01799ac6d104e6/ghc >--------------------------------------------------------------- commit 1cdc14f9c014f1a520638f7c0a01799ac6d104e6 Author: Austin Seipp Date: Sun May 20 13:25:09 2018 -0400 ghc-pkg: recompute `abi-depends` for updated packages See `Note [Recompute abi-depends]` for more information. Signed-off-by: Austin Seipp Test Plan: `./validate` Reviewers: bgamari, ezyang Reviewed By: bgamari Subscribers: tdammers, juhp, carter, alexbiehl, shlevy, cocreature, rwbarton, thomie GHC Trac Issues: #14381 Differential Revision: https://phabricator.haskell.org/D4159 >--------------------------------------------------------------- 1cdc14f9c014f1a520638f7c0a01799ac6d104e6 .../backpack/cabal/bkpcabal02/bkpcabal02.stdout | 5 +++ testsuite/tests/cabal/T12485a.stdout | 1 + testsuite/tests/cabal/T5442d.stdout | 1 + testsuite/tests/cabal/cabal01/cabal01.stdout | 1 + testsuite/tests/cabal/cabal06/cabal06.stdout | 4 ++ testsuite/tests/cabal/cabal08/cabal08.stdout | 2 + testsuite/tests/cabal/shadow.stdout | 1 + testsuite/tests/driver/recomp007/recomp007.stdout | 2 + .../tests/safeHaskell/check/pkg01/safePkg01.stdout | 20 +++++---- testsuite/tests/typecheck/T13168/T13168.stdout | 2 + utils/ghc-pkg/Main.hs | 52 +++++++++++++++++++++- 11 files changed, 82 insertions(+), 9 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 1cdc14f9c014f1a520638f7c0a01799ac6d104e6 From git at git.haskell.org Mon May 21 08:38:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 08:38:34 +0000 (UTC) Subject: [commit: ghc] master: Do better sharing in the short-cut solver (f2ce86c) Message-ID: <20180521083834.77E073ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2ce86c2edc0840f5e731d5286a2a5e484263e3f/ghc >--------------------------------------------------------------- commit f2ce86c2edc0840f5e731d5286a2a5e484263e3f Author: Simon Peyton Jones Date: Sun May 20 21:43:45 2018 +0100 Do better sharing in the short-cut solver Trac #15164 showed that it sometimes really matters to share sub-proofs when solving constraints. Without it, we can get exponentialy bad behaviour. Fortunately, it's easily solved. Note [Shortcut try_solve_from_instance] explains. I did some minor assocaited refactoring. >--------------------------------------------------------------- f2ce86c2edc0840f5e731d5286a2a5e484263e3f compiler/typecheck/TcEvidence.hs | 6 +- compiler/typecheck/TcInteract.hs | 159 ++++++---- compiler/typecheck/TcSMonad.hs | 18 +- testsuite/tests/perf/compiler/T15164.hs | 501 ++++++++++++++++++++++++++++++++ testsuite/tests/perf/compiler/all.T | 10 + 5 files changed, 631 insertions(+), 63 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 f2ce86c2edc0840f5e731d5286a2a5e484263e3f From git at git.haskell.org Mon May 21 10:03:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 10:03:12 +0000 (UTC) Subject: [commit: ghc] master: Fix perf numbers for #15164 (5f3fb71) Message-ID: <20180521100312.D289B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f3fb71213e78838cd3060be37ad2d9dd1ed247f/ghc >--------------------------------------------------------------- commit 5f3fb71213e78838cd3060be37ad2d9dd1ed247f Author: Simon Peyton Jones Date: Mon May 21 11:02:57 2018 +0100 Fix perf numbers for #15164 >--------------------------------------------------------------- 5f3fb71213e78838cd3060be37ad2d9dd1ed247f testsuite/tests/perf/compiler/all.T | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 7b90ebf..0f912d2 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1287,9 +1287,7 @@ test ('T9630', test ('T15164', [ compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 3424183288, 10), - - (wordsize(64), 6824183288, 10) + [(wordsize(64), 3423873408, 10) ]) ], compile, From git at git.haskell.org Mon May 21 12:04:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 12:04:25 +0000 (UTC) Subject: [commit: ghc] master: Make dischargeFmv handle Deriveds (57858fc) Message-ID: <20180521120425.882AB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57858fc8b519078ae89a4859ce7588adb39f6e96/ghc >--------------------------------------------------------------- commit 57858fc8b519078ae89a4859ce7588adb39f6e96 Author: Simon Peyton Jones Date: Mon May 21 10:38:03 2018 +0100 Make dischargeFmv handle Deriveds A Derived CFunEqCan does not "own" its FlatMetaTv (fmv), and should not update it. But one caller (canCFunEqCan) was failing to satisfy the precondition to dischargeFmv, which led to a crash (Trac #15170). I fixed this by making dischargeFmv handle Deriveds (to avoid forcing each caller to do so separately). NB: this does not completely fix the original #15170 bug, but I'll explain that on the ticket. The test case for this patch is actually the program in comment:1. >--------------------------------------------------------------- 57858fc8b519078ae89a4859ce7588adb39f6e96 compiler/typecheck/TcFlatten.hs | 10 ++++++---- compiler/typecheck/TcInteract.hs | 10 ++-------- compiler/typecheck/TcRnTypes.hs | 4 ++-- compiler/typecheck/TcSMonad.hs | 19 +++++++++++++++---- testsuite/tests/polykinds/T15170.hs | 26 ++++++++++++++++++++++++++ testsuite/tests/polykinds/all.T | 1 + 6 files changed, 52 insertions(+), 18 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index e2244a9..32a9307 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -82,15 +82,17 @@ Note [The flattening story] - We unflatten Wanteds at the end of each attempt to simplify the wanteds; see unflattenWanteds, called from solveSimpleWanteds. -* Each canonical [G], [W], or [WD] CFunEqCan x : F xis ~ fsk/fmv - has its own distinct evidence variable x and flatten-skolem fsk/fmv. +* Ownership of fsk/fmv. Each canonical [G], [W], or [WD] + CFunEqCan x : F xis ~ fsk/fmv + "owns" a distinct evidence variable x, and flatten-skolem fsk/fmv. Why? We make a fresh fsk/fmv when the constraint is born; and we never rewrite the RHS of a CFunEqCan. - In contrast a [D] CFunEqCan shares its fmv with its partner [W], + In contrast a [D] CFunEqCan /shares/ its fmv with its partner [W], but does not "own" it. If we reduce a [D] F Int ~ fmv, where say type instance F Int = ty, then we don't discharge fmv := ty. - Rather we simply generate [D] fmv ~ ty (in TcInteract.reduce_top_fun_eq) + Rather we simply generate [D] fmv ~ ty (in TcInteract.reduce_top_fun_eq, + and dischargeFmv) * Inert set invariant: if F xis1 ~ fsk1, F xis2 ~ fsk2 then xis1 /= xis2 diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index ab94ad2..09cfd15 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -1442,15 +1442,9 @@ reactFunEq from_this fsk1 solve_this fsk2 ; new_ev <- newGivenEvVar loc (fsk_eq_pred, evCoercion fsk_eq_co) ; emitWorkNC [new_ev] } - | CtDerived { ctev_loc = loc } <- solve_this - = do { traceTcS "reactFunEq (Derived)" (ppr from_this $$ ppr fsk1 $$ - ppr solve_this $$ ppr fsk2) - ; emitNewDerivedEq loc Nominal (mkTyVarTy fsk1) (mkTyVarTy fsk2) } - -- FunEqs are always at Nominal role - | otherwise -- Wanted - = do { traceTcS "reactFunEq" (ppr from_this $$ ppr fsk1 $$ - ppr solve_this $$ ppr fsk2) + = do { traceTcS "reactFunEq (Wanted/Derived)" + (vcat [ppr from_this, ppr fsk1, ppr solve_this, ppr fsk2]) ; dischargeFmv solve_this fsk2 (ctEvCoercion from_this) (mkTyVarTy fsk1) ; traceTcS "reactFunEq done" (ppr from_this $$ ppr fsk1 $$ ppr solve_this $$ ppr fsk2) } diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index ba07ff8..17d9504 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1690,8 +1690,8 @@ data Ct -- *never* over-saturated (because if so -- we should have decomposed) - cc_fsk :: TcTyVar -- [Given] always a FlatSkolTv - -- [Wanted] always a FlatMetaTv + cc_fsk :: TcTyVar -- [G] always a FlatSkolTv + -- [W], [WD], or [D] always a FlatMetaTv -- See Note [The flattening story] in TcFlatten } diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 580a33c..f5d6ca9 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -3045,23 +3045,34 @@ demoteUnfilledFmv fmv ----------------------------- dischargeFmv :: CtEvidence -> TcTyVar -> TcCoercion -> TcType -> TcS () --- (dischargeFmv x fmv co ty) +-- (dischargeFmv ev fmv co ty) -- [W] ev :: F tys ~ fmv -- co :: F tys ~ xi -- Precondition: fmv is not filled, and fmv `notElem` xi --- ev is Wanted +-- ev is Wanted or Derived -- --- Then set fmv := xi, +-- Then for [W] or [WD], we actually fill in the fmv: +-- set fmv := xi, -- set ev := co -- kick out any inert things that are now rewritable -- --- Does not evaluate 'co' if 'ev' is Derived +-- For [D], we instead emit an equality that must ultimately hold +-- emit xi ~ fmv +-- Does not evaluate 'co' if 'ev' is Derived +-- +-- See TcFlatten Note [The flattening story], +-- especially "Ownership of fsk/fmv" dischargeFmv ev@(CtWanted { ctev_dest = dest }) fmv co xi = ASSERT2( not (fmv `elemVarSet` tyCoVarsOfType xi), ppr ev $$ ppr fmv $$ ppr xi ) do { setWantedEvTerm dest (EvExpr (evCoercion co)) ; unflattenFmv fmv xi ; n_kicked <- kickOutAfterUnification fmv ; traceTcS "dischargeFmv" (ppr fmv <+> equals <+> ppr xi $$ pprKicked n_kicked) } + +dischargeFmv (CtDerived { ctev_loc = loc }) fmv _co xi + = emitNewDerivedEq loc Nominal xi (mkTyVarTy fmv) + -- FunEqs are always at Nominal role + dischargeFmv ev _ _ _ = pprPanic "dischargeFmv" (ppr ev) pprKicked :: Int -> SDoc diff --git a/testsuite/tests/polykinds/T15170.hs b/testsuite/tests/polykinds/T15170.hs new file mode 100644 index 0000000..a105ca5 --- /dev/null +++ b/testsuite/tests/polykinds/T15170.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeOperators #-} +module T15170 where + +import Data.Kind +import Data.Proxy + +data TyFun :: Type -> Type -> Type +type a ~> b = TyFun a b -> Type +infixr 0 ~> + +type family Apply (f :: k1 ~> k2) (x :: k1) :: k2 +type f @@ x = Apply f x +infixl 9 @@ + +wat :: forall (a :: Type) + (b :: a ~> Type) + (c :: forall (x :: a). Proxy x ~> b @@ x ~> Type) + (f :: forall (x :: a) (y :: b @@ x). Proxy x ~> Proxy y ~> c @@ ('Proxy :: Proxy x) @@ y) + (x :: a). + (forall (xx :: a) (yy :: b @@ xx). Proxy (f @@ ('Proxy :: Proxy xx) @@ ('Proxy :: Proxy yy))) + -> () +wat _ = () diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 7992e28..5aaa217 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -190,3 +190,4 @@ test('T14873', normal, compile, ['']) test('SigTvKinds3', normal, compile_fail, ['']) test('T15116', normal, compile_fail, ['']) test('T15116a', normal, compile_fail, ['']) +test('T15170', normal, compile, ['']) From git at git.haskell.org Mon May 21 12:04:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 12:04:28 +0000 (UTC) Subject: [commit: ghc] master: Remove TcType.toTcType (b7e80ae) Message-ID: <20180521120428.706A63ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b7e80ae005d0072eda79135c371a794dc48f70e1/ghc >--------------------------------------------------------------- commit b7e80ae005d0072eda79135c371a794dc48f70e1 Author: Simon Peyton Jones Date: Mon May 21 09:00:32 2018 +0100 Remove TcType.toTcType In the olden days we insisted that only TcTyVars could appear in a TcType. But now we are more accommodating; see TcType Note [TcTyVars and TyVars in the typechecker] This patch removes a function that converted a Type to a TcType. It didn't do anything useful except statisfy an invariant that we no longer have. Now it's gone. >--------------------------------------------------------------- b7e80ae005d0072eda79135c371a794dc48f70e1 compiler/deSugar/Check.hs | 8 ++--- compiler/deSugar/DsBinds.hs | 2 +- compiler/deSugar/Match.hs | 3 +- compiler/typecheck/TcType.hs | 76 ++++++++------------------------------------ 4 files changed, 20 insertions(+), 69 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 b7e80ae005d0072eda79135c371a794dc48f70e1 From git at git.haskell.org Mon May 21 12:39:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 May 2018 12:39:43 +0000 (UTC) Subject: [commit: ghc] master: Check for type families in an instance context (af0757d) Message-ID: <20180521123943.164883ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af0757de4649ca562a0e9a624ebef155113531ab/ghc >--------------------------------------------------------------- commit af0757de4649ca562a0e9a624ebef155113531ab Author: Simon Peyton Jones Date: Mon May 21 13:38:12 2018 +0100 Check for type families in an instance context This patch adds a check for type families to the instance-decl termination check. See Note [Type families in instance contexts] and Trac #15172. >--------------------------------------------------------------- af0757de4649ca562a0e9a624ebef155113531ab compiler/typecheck/TcValidity.hs | 15 ++++++++++++++- testsuite/tests/indexed-types/should_fail/T15172.hs | 11 +++++++++++ testsuite/tests/indexed-types/should_fail/T15172.stderr | 5 +++++ testsuite/tests/indexed-types/should_fail/all.T | 1 + testsuite/tests/typecheck/should_fail/tcfail214.stderr | 2 +- 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index bdda6cd..35e6a95 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -1405,8 +1405,10 @@ checkInstTermination tys theta check2 pred pred_size | not (null bad_tvs) = addErrTc (noMoreMsg bad_tvs what) + | not (isTyFamFree pred) = addErrTc (nestedMsg what) | pred_size >= head_size = addErrTc (smallerMsg what) | otherwise = return () + -- isTyFamFree: see Note [Type families in instance contexts] where what = text "constraint" <+> quotes (ppr pred) bad_tvs = fvType pred \\ head_fvs @@ -1432,7 +1434,18 @@ undecidableMsg, constraintKindsMsg :: SDoc undecidableMsg = text "Use UndecidableInstances to permit this" constraintKindsMsg = text "Use ConstraintKinds to permit this" -{- +{- Note [Type families in instance contexts] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Are these OK? + type family F a + instance F a => C (Maybe [a]) where ... + intance C (F a) => C [[[a]]] where ... + +No: the type family in the instance head might blow up to an +arbitrarily large type, depending on how 'a' is instantiated. +So we require UndecidableInstances if we have a type family +in the instance head. Trac #15172. + Note [Associated type instances] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We allow this: diff --git a/testsuite/tests/indexed-types/should_fail/T15172.hs b/testsuite/tests/indexed-types/should_fail/T15172.hs new file mode 100644 index 0000000..da7a8f8 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T15172.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TypeFamilies, ConstraintKinds, FlexibleInstances #-} +module ShouldFail where + +import GHC.Exts( Constraint ) + +type family F a :: Constraint + +class C a where + +-- Should be rejected because of the type family +instance (F a) => C [[a]] where diff --git a/testsuite/tests/indexed-types/should_fail/T15172.stderr b/testsuite/tests/indexed-types/should_fail/T15172.stderr new file mode 100644 index 0000000..8c28c51 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T15172.stderr @@ -0,0 +1,5 @@ + +T15172.hs:11:10: error: + • Illegal nested constraint ‘F a’ + (Use UndecidableInstances to permit this) + • In the instance declaration for ‘C [[a]]’ diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 4d25d97..61025d6 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -141,3 +141,4 @@ test('T14033', normal, compile_fail, ['']) test('T14045a', normal, compile_fail, ['']) test('T14175', normal, compile_fail, ['']) test('T14369', normal, compile_fail, ['']) +test('T15172', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail214.stderr b/testsuite/tests/typecheck/should_fail/tcfail214.stderr index c6a4387..83fa344 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail214.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail214.stderr @@ -1,5 +1,5 @@ tcfail214.hs:9:10: error: - • The constraint ‘F a’ is no smaller than the instance head + • Illegal nested constraint ‘F a’ (Use UndecidableInstances to permit this) • In the instance declaration for ‘C [a]’ From git at git.haskell.org Tue May 22 03:08:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 May 2018 03:08:19 +0000 (UTC) Subject: [commit: ghc] master: Revert "ghc-pkg: recompute `abi-depends` for updated packages" (97121b6) Message-ID: <20180522030819.8A4693ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/97121b62bada0206e1b79137ade04f859a6eee5e/ghc >--------------------------------------------------------------- commit 97121b62bada0206e1b79137ade04f859a6eee5e Author: Ben Gamari Date: Mon May 21 16:37:31 2018 -0400 Revert "ghc-pkg: recompute `abi-depends` for updated packages" This reverts commit 1cdc14f9c014f1a520638f7c0a01799ac6d104e6. This is causing non-deterministic testsuite output. >--------------------------------------------------------------- 97121b62bada0206e1b79137ade04f859a6eee5e .../backpack/cabal/bkpcabal02/bkpcabal02.stdout | 5 --- testsuite/tests/cabal/T12485a.stdout | 1 - testsuite/tests/cabal/T5442d.stdout | 1 - testsuite/tests/cabal/cabal01/cabal01.stdout | 1 - testsuite/tests/cabal/cabal06/cabal06.stdout | 4 -- testsuite/tests/cabal/cabal08/cabal08.stdout | 2 - testsuite/tests/cabal/shadow.stdout | 1 - testsuite/tests/driver/recomp007/recomp007.stdout | 2 - .../tests/safeHaskell/check/pkg01/safePkg01.stdout | 20 ++++----- testsuite/tests/typecheck/T13168/T13168.stdout | 2 - utils/ghc-pkg/Main.hs | 52 +--------------------- 11 files changed, 9 insertions(+), 82 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 97121b62bada0206e1b79137ade04f859a6eee5e From git at git.haskell.org Tue May 22 16:50:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 May 2018 16:50:37 +0000 (UTC) Subject: [commit: ghc] master: Improve performance of CallArity (db6085b) Message-ID: <20180522165037.3907D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/db6085b84139f4454cebf34f887cb5560a4fbc7b/ghc >--------------------------------------------------------------- commit db6085b84139f4454cebf34f887cb5560a4fbc7b Author: Joachim Breitner Date: Mon May 21 11:24:05 2018 -0400 Improve performance of CallArity the hot path contained a call to v `elemUnVarSet` (neighbors g v) and creating the set of neighbors just to check if `v` is inside accounted for half the allocations of the test case of #15164. By introducing a non-allocating function `hasLoopAt` for this we shave off half the allocations. This brings the total cost of Call Arity down to 20% of time and 23% of allocations, according to a profiled run. Not amazing, but still much better. Differential Revision: https://phabricator.haskell.org/D4718 >--------------------------------------------------------------- db6085b84139f4454cebf34f887cb5560a4fbc7b compiler/simplCore/CallArity.hs | 2 +- compiler/utils/UnVarGraph.hs | 8 ++++++++ testsuite/tests/perf/compiler/all.T | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs index 64684f3..ed9fc90 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/simplCore/CallArity.hs @@ -735,7 +735,7 @@ domRes (_, ae) = varEnvDom ae lookupCallArityRes :: CallArityRes -> Var -> (Arity, Bool) lookupCallArityRes (g, ae) v = case lookupVarEnv ae v of - Just a -> (a, not (v `elemUnVarSet` (neighbors g v))) + Just a -> (a, not (g `hasLoopAt` v)) Nothing -> (0, False) calledWith :: CallArityRes -> Var -> UnVarSet diff --git a/compiler/utils/UnVarGraph.hs b/compiler/utils/UnVarGraph.hs index a540132..35ae405 100644 --- a/compiler/utils/UnVarGraph.hs +++ b/compiler/utils/UnVarGraph.hs @@ -24,6 +24,7 @@ module UnVarGraph , unionUnVarGraph, unionUnVarGraphs , completeGraph, completeBipartiteGraph , neighbors + , hasLoopAt , delNode ) where @@ -121,6 +122,13 @@ neighbors (UnVarGraph g) v = unionUnVarSets $ concatMap go $ bagToList g go (CBPG s1 s2) = (if v `elemUnVarSet` s1 then [s2] else []) ++ (if v `elemUnVarSet` s2 then [s1] else []) +-- hasLoopAt G v <=> v--v ∈ G +hasLoopAt :: UnVarGraph -> Var -> Bool +hasLoopAt (UnVarGraph g) v = any go $ bagToList g + where go (CG s) = v `elemUnVarSet` s + go (CBPG s1 s2) = v `elemUnVarSet` s1 && v `elemUnVarSet` s2 + + delNode :: UnVarGraph -> Var -> UnVarGraph delNode (UnVarGraph g) v = prune $ UnVarGraph $ mapBag go g where go (CG s) = CG (s `delUnVarSet` v) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 0f912d2..f652415 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1287,7 +1287,9 @@ test ('T9630', test ('T15164', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 3423873408, 10) + [(wordsize(64), 1945564312, 10) + # initial: 3423873408 + # 2018-05-22: 1945564312 Fix bottleneck in CallArity ]) ], compile, From git at git.haskell.org Wed May 23 08:16:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 08:16:15 +0000 (UTC) Subject: [commit: ghc] wip/T2893: Implement QuantifiedConstraints (50e0984) Message-ID: <20180523081615.F19513ABA2@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T2893 Link : http://ghc.haskell.org/trac/ghc/changeset/50e0984d15f6b948dd6e043cfa75f686fc145cf0/ghc >--------------------------------------------------------------- commit 50e0984d15f6b948dd6e043cfa75f686fc145cf0 Author: Simon Peyton Jones Date: Sat Jan 27 14:32:34 2018 +0000 Implement QuantifiedConstraints We have wanted quantified constraints for ages and, as I hoped, they proved remarkably simple to implement. All the machinery was already in place. The main ticket is Trac #2893, but also relevant are #5927 #8516 #9123 (especially! higher kinded roles) #14070 #14317 The wiki page is https://ghc.haskell.org/trac/ghc/wiki/QuantifiedConstraints which in turn contains a link to the GHC Proposal where the change is specified. Here is the relevant Note: Note [Quantified constraints] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The -XQuantifiedConstraints extension allows type-class contexts like this: data Rose f x = Rose x (f (Rose f x)) instance (Eq a, forall b. Eq b => Eq (f b)) => Eq (Rose f a) where (Rose x1 rs1) == (Rose x2 rs2) = x1==x2 && rs1 >= rs2 Note the (forall b. Eq b => Eq (f b)) in the instance contexts. This quantified constraint is needed to solve the [W] (Eq (f (Rose f x))) constraint which arises form the (==) definition. Here are the moving parts * Language extension {-# LANGUAGE QuantifiedConstraints #-} and add it to ghc-boot-th:GHC.LanguageExtensions.Type.Extension * A new form of evidence, EvDFun, that is used to discharge such wanted constraints * checkValidType gets some changes to accept forall-constraints only in the right places. * Type.PredTree gets a new constructor ForAllPred, and and classifyPredType analyses a PredType to decompose the new forall-constraints * Define a type TcRnTypes.QCInst, which holds a given quantified constraint in the inert set * TcSMonad.InertCans gets an extra field, inert_insts :: [QCInst], which holds all the Given forall-constraints. In effect, such Given constraints are like local instance decls. * When trying to solve a class constraint, via TcInteract.matchInstEnv, use the InstEnv from inert_insts so that we include the local Given forall-constraints in the lookup. (See TcSMonad.getInstEnvs.) * topReactionsStage calls doTopReactOther for CIrredCan and CTyEqCan, so they can try to react with any given quantified constraints (TcInteract.matchLocalInst) * TcCanonical.canForAll deals with solving a forall-constraint. See Note [Solving a Wanted forall-constraint] Note [Solving a Wanted forall-constraint] * We augment the kick-out code to kick out an inert forall constraint if it can be rewritten by a new type equality; see TcSMonad.kick_out_rewritable Some other related refactoring ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Move SCC on evidence bindings to post-desugaring, which fixed #14735, and is generally nicer anyway because we can use existing CoreSyn free-var functions. (Quantified constraints made the free-vars of an ev-term a bit more complicated.) * In LookupInstResult, replace GenInst with OneInst and NotSure, using the latter for multiple matches and/or one or more unifiers >--------------------------------------------------------------- 50e0984d15f6b948dd6e043cfa75f686fc145cf0 compiler/basicTypes/Id.hs | 2 +- compiler/deSugar/DsBinds.hs | 42 ++- compiler/main/DynFlags.hs | 2 + compiler/specialise/Specialise.hs | 1 + compiler/typecheck/Inst.hs | 12 +- compiler/typecheck/TcCanonical.hs | 413 ++++++++++++++++----- compiler/typecheck/TcErrors.hs | 4 +- compiler/typecheck/TcEvTerm.hs | 5 +- compiler/typecheck/TcEvidence.hs | 126 ++++--- compiler/typecheck/TcHsSyn.hs | 39 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcInteract.hs | 378 +++++++++++-------- compiler/typecheck/TcMType.hs | 11 +- compiler/typecheck/TcPatSyn.hs | 7 +- compiler/typecheck/TcPluginM.hs | 4 +- compiler/typecheck/TcRnTypes.hs | 67 +++- compiler/typecheck/TcSMonad.hs | 319 +++++++++++----- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcType.hs | 4 +- compiler/typecheck/TcValidity.hs | 100 +++-- compiler/types/Class.hs | 54 +-- compiler/types/InstEnv.hs | 75 ++-- compiler/types/Kind.hs | 2 + compiler/types/Type.hs | 26 +- docs/users_guide/glasgow_exts.rst | 260 ++++++++++++- .../ghc-boot-th/GHC/LanguageExtensions/Type.hs | 1 + testsuite/tests/driver/T4437.hs | 3 +- .../tests/{ado => quantified-constraints}/Makefile | 0 testsuite/tests/quantified-constraints/T14833.hs | 28 ++ testsuite/tests/quantified-constraints/T14835.hs | 20 + testsuite/tests/quantified-constraints/T14863.hs | 27 ++ testsuite/tests/quantified-constraints/T14961.hs | 98 +++++ testsuite/tests/quantified-constraints/T2893.hs | 18 + testsuite/tests/quantified-constraints/T2893a.hs | 27 ++ testsuite/tests/quantified-constraints/T2893c.hs | 15 + testsuite/tests/quantified-constraints/T9123.hs | 25 ++ testsuite/tests/quantified-constraints/T9123a.hs | 30 ++ testsuite/tests/quantified-constraints/all.T | 10 + testsuite/tests/rebindable/T5908.hs | 0 testsuite/tests/typecheck/should_compile/T14735.hs | 30 ++ testsuite/tests/typecheck/should_compile/all.T | 2 + testsuite/tests/typecheck/should_fail/T7019.stderr | 1 + .../tests/typecheck/should_fail/T7019a.stderr | 1 + testsuite/tests/typecheck/should_fail/T9196.stderr | 8 +- 44 files changed, 1760 insertions(+), 541 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 50e0984d15f6b948dd6e043cfa75f686fc145cf0 From git at git.haskell.org Wed May 23 08:16:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 08:16:20 +0000 (UTC) Subject: [commit: ghc] wip/T2893's head updated: Implement QuantifiedConstraints (50e0984) Message-ID: <20180523081620.C3FCA3ABA2@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T2893' now includes: 96d2eb2 Invert likeliness when improving conditionals 1205629 Add likely annotation to cmm files in a few obvious places. 5e8d314 Update outputs of T12962, scc003 47031db A bit more tc-tracing e7c3878 Move zonkWC to the right place in simplfyInfer 0f43d0d More tc-tracing efba054 Prioritise equalities when solving, incl deriveds e9ae0ca Look inside implications in simplifyRule 55aea8f testsuite: Mark scc001 and T5363 as broken due to #14705 370b167 circleci: Add Dockerfile for x86_64-linux b37dc23 appveyor: Don't install gcc fe6fdf6 testsuite: Fix test output of T14715 7d9812e testsuite: Fix test output broken by efba054640d3 5f922fb appveyor: Refactor 0171e09 Make RTS keep less memory (fixes #14702) 0bff9e6 Don't add targets that can't be found in GHCi be84823 Implement BlockArguments (#10843) 1a911f2 Sequester deriving-related validity check into cond_stdOK 382c12d rts: Ensure that forkOS releases Task on termination add4e1f Mark xmm6 as caller saved in the register allocator for windows. e4ab65b Optimize coercionKind (Trac #11735) ced9fbd UnboxedTuples can't be used as constraints 618a805 Experiment with eliminating the younger tyvar db5a4b8 Re-center improved perf for T3064 efce943 Add -ddump-ds-preopt e31b41b Flag `-fdefer-typed-holes` also implies `-fdefer-out-of-scope-variables`. 2974b2b Hoopl.Collections: change right folds to strict left folds c3ccd83 testsuite: Fix scc001 profile output 7fb3287 Add HasDebugCallStack to nameModule 4f52bc1 DriverPhases: Fix flipped input extensions for cmm and cmmcpp 3441b14 integer-gmp: Simplify gmp/configure invocation fdf518c Upgrade containers submodule 217e417 ghc-prim: Emulate C11 atomics when not available d8a0e6d Don't apply dataToTag's caseRules for data families e5d0101 base: Deprecate STM invariant checking primitives 50adbd7 cmm: Revert more aggressive CBE due to #14226 606edbf testsuite: Add testcase for #14754 d987f71 Improve unboxed sum documentation 326df5d Bump Cabal submodule d2511e3 Compute the union of imp_finsts on the side 7ad72eb cmm: Remove unnecessary HsVersion.h includes 1512b63 rts: Fix format of failed memory commit message 4d1c3b7 rts: Add format attribute to barf 4c36440 Restore 'It is a member of hidden package' message. 2987b04 Improve X86CodeGen's pprASCII. 3cd1305 rts: Use BITS_IN macro in bitmap calculations 00f1a4a rts: fix some barf format specifiers. da46813 testsuite: Add test for #14768 4aa98f4 Fix utterly bogus TagToEnum rule in caseRules 41d29d5 Comments only 6506980 Fix solveOneFromTheOther for RecursiveSuperclasses be53d19 Use SPDX syntax in rts/package.conf.in 059596d rts: fix barf format attribute 6edafe3 Fix isDroppableCt (Trac #14763) f489c12 Simplify Foreign.Marshal.Alloc functions with ScopedTypeVariables 583f561 Evac.c: remove unused CPP guard c9a88db Make ($!) representation-polymorphic 5957405 Collect CCs in CorePrep, including CCs in unfoldings 0c9777b Fix tests broken by c9a88db3ac4f1c3e97e3492ebe076f2df6463540 8936ab6 Raise parse error for `data T where`. df449e1 Various documentation improvements ec9aacf adds -latomic to. ghc-prim d5ff33d Adds `smp` flag to rts.cabal. e03ca71 Update .cabal files for Cabal 2.1 0c2350c rts.cabal.in: advertise profiling flavours of libraries, behind a flag 8529fbb Get eqTypeRep to inline 7c173b9 Move `iserv` into `utils` and change package name from `iserv-bin` to `iserv` d5ac582 Fix #14811 by wiring in $tcUnit# a644dff circleci: Add nightly build using devel2 flavour 9080466 base: Fix changelog entry for openTempFile 1ede46d Implement stopgap solution for #14728 918c0b3 Add valid refinement substitution suggestions for typed holes 9ff4cce Build Haddocks with --quickjump bfb90bc Remove doubled words ccda486 Tidy up and consolidate canned CmmReg and CmmGlobals c05529c myThreadId# is trivial; make it an inline primop 4e513bf CBE: re-introduce bgamari's fixes d924c17 testsuite: Add newline to test output fc33f8b Improve error message for UNPACK/strictness annotations. 7f389a5 StgLint overhaul 043466b Rename the types in a GADT constructor in toposorted order 5b63240 Increase the amount of parallelism in circleci. 9fc4608 Bump haddock submodule again 2382bbf Bump process submodule fc04a8f Bump filepath submodule d20524e Bump pretty submodule 9ad3fa1 Bump stm submodule to 2.4.5.0 bd0af2a Bump primitive submodule to 0.6.3.0 e26d774 Bump parsec submodule to 0.3.13.0 1ee5abc Bump haskeline submodule to 0.7.4.2 2cb19b4 Bump text submodule to 1.2.3.0 71294f3 testsuite: Bump allocations for T1969 and T5837 eb2daa2 Change how includes for input file directory works 517c194 Document missing dataToTag# . tagToEnum# rule 81a5e05 circleci: Skip performance tests f511bb5 Add ghc-prim.buildinfo to .gitignore f433659 Slight refactor of stock deriving internals abfe104 Revert "Move `iserv` into `utils` and change package name a032ff7 Add references to #6087 0a3629a Don't use ld.gold when building libraries for GHCi 3483423 Comments in Unify, fixing #12442 bf3f0a6 Update Hadrian submodule c969c98 driver/utils/dynwrapper.c: Remove unused variable be498a2 RTS: Remember to free some pointers cb89ba8 RTS: Remove unused retainer schemes 3d43fd5 Introduce the flag -dsuppress-timestamps to avoid timestamps in dumps. 5e5e60d boot: Create GNUmakefiles for libraries f57c305 testsuite: Bump allocations for T9630 ffdb110 Update .gitignore da4766c circleci: Simplify Hadrian build 8c1d6b7 Tiny refactor in Core Lint 40fa420 Comments only e99fdf7 Fix a nasty bug in the pure unifier d675a35 Better stats for T5837 3dec923 Test for Trac #13075 is working now 51e0a38 Comments only b2996f1 Fix test for Trac #13075 df2c3b3 Build quick flavor and run some tests on Windows 2756117 Revert "Better stats for T5837" b8f03bb Cache the fingerprint of sOpt_P e261b85 forkProcess: fix task mutex release order 8dab89b rts: Note functions which must take all_tasks_mutex. f8e3cd3 Only load plugins once d8e47a2 Make cost centre symbol names deterministic. 8c7a155 Move Data.Functor.Contravariant from the contravariant package to base. e8e9f6a Improve exhaustive checking for guards in pattern bindings and MultiIf. 125d151 Add regression test for #12790 aef2b42 Fix #14817 by not double-printing data family instance kind signatures 4a0d0d8 Various Windows / Cross Compile to Windows fixes 1773964 DynFlags: Support British spelling of GeneralisedNewtypeDeriving 969e747 GHCi info: Use src file for cache invalidation 6a7e159 Improve missing-home-modules warning formatting 5c28ee8 Add @since annotations for derived instances in base 6e4fa81 rts/win32: Assert that the IO manager has been initialised bc1bcaa configure: Enable LD_NO_GOLD is set in all codepaths 7782b47 Add Applicative, Semigroup, and Monoid instances in GHC.Generics e4dcebf Adds *-cross-ncg flavour. 6835702 Permit conversion of partially applied PromotedTupleTs ffb2738 Fix #14838 by marking TH-spliced code as FromSource 5f6fcf7 Compile with `--via-asm` when cross compiling. 44ba60f doCorePass: Expand catch-all 821daad Correct default -A value in RTS flag usage info a2d03c6 Fix the coverage checker's treatment of existential tyvars 99c556d Parenthesize (() :: Constraint) in argument position 4631ceb Bump hsc2hs submodule 8f0b2f5 Bump Cabal submodule to 2.2 a9f680f Bump Cabal submodule e7653bc Wombling around in Trac #14808 3d25203 Respect Note [The tcType invariant] 6ee831f Fix #14888 by adding more special cases for ArrowT 1c062b7 Simplify rnLHsInstType df7ac37 Fixup include of gmp/config.mk to use new location f6cf400 `--via-asm` only for windows targets cf5bc96 add CCX=$(CXX) to integer-gmp ee597e9 Schedule.c: remove a redundant CPP guard 5bc195a Allow top level ticked string literals 9bccfcd Correct -g flag description 64c0af7 cmm/: Avoid using lazy left folds 08345bd Make accumArray and accum stricter 1488591 Bump nofib submodule 488d63d Fix interpreter with profiling 40c4313 Add perf test for #14052 b120e64 Add bindist-list.uniq to .gitignore d9d4632 Schedule.c: remove unreachable code block 648cb28 Use docker images with non-root user b320ba8 Fix a typo about pattern synonyms in documentation. b3bfbed Users Guide: Add that --numa is available on Windows too 43fbb90 Fix typo in description of -V RTS flag d99a65a Add -fexternal-dynamic-refs 98c7749 Revert "GHCi: Don't remove shadowed bindings from typechecker scope." bc95fed Error message and doc improvements for #14335 ed6f9fb ghc-prim: Reduce scope of Clang sync_fetch_and_nand workaround 94f0254 ghc-prim: Silence -Wsync-nand warning in atomic.c 47e2a28 Remove outdated documentation bits concerning -Wmissing-methods a25b763 configure: Accept suffix in OpenBSD triple's OS name df2ea10 Compacted arrays are pinned for isByteArrayPinned# dd3906b UNREG: fix implicit declarations from pdep and pext 8e34101 Fix a debug print in disassembler (#14905) e3ae0eb testsuite: disable T13615 on non-smp targets 5c804e5 Remove splitEithers, use partitionEithers from base 02b3dad Bump Cabal submodule 50972d6 Comment improvements on interpreter breakpoint IO action ba57979 Update a comment in Exception.cmm 152055a Drop GHC 8.0 compatibility cb6d858 Slighly improve infix con app pattern errors 1522cf0 aclocal.m4: allow more GNU/Hurd tuples 0693b0b aclocal.m4: add OSHurd (debian patch) 2a3702d Comments and tiny refactor 5a1ad23 Update test for #5129: f9a6d42 Add a build with 32bit Ubuntu container 2918abf rts: Add --internal-counters RTS flag and several counters 3d378d9 Also check local rules with -frules-check 39c7406 Be more selective in which conditionals we invert fad822e Improve the warning message of qualified unused imports. 0db0e46 Get rid of more CPP in cmm/ and codeGen/ bbcea13 Hoopl: improve postorder calculation a00b88b Implement -dword-hex-literals b37a87b PPC nativeGen: Add support for MO_SS_Conv_W32_W64 5241f29 SPARC nativeGen: Support for MO_SS_Conv_W32_W64 d27336e [RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386 20cbb01 Improve accuracy of get/setAllocationCounter 256577f CmmUtils: get rid of insertBlock fbd9b88 Implement equalKeysUFM the right way 9868f91 Turn a TH Name for built-in syntax into an unqualified RdrName e358854 Require GHC 8.2 to bootstrap GHC c3aea39 Fix #14934 by including axSub0R in typeNatCoAxiomRules f748c52 Don't permit data types with return kind Constraint fdec06a Update tests for #12870 to pass with a slow run of the testsuite. 98c1f22 Bump array submodule 960cd42 Fix typo in user guide about ConstraintKinds 82e8d1f Fix typo b3b394b gen-data-layout.sh: Use bash array for readability 2d4bda2 rts, base: Refactor stats.c to improve --machine-readable report afad556 Add -flate-specialise which runs a later specialisation pass 6a71ef7 Bump autoconf version bound to >= 2.69 d718023 relnotes: Fix parsing of Version: field from Cabal file 60aa53d configure: Accept version suffix in solaris name 57001d9 Update T5129 test: 0a778eb Revert "rts, base: Refactor stats.c to improve --machine-readable report" abaf43d Fix seq# case of exprOkForSpeculation 49ac3f0 Fix #14869 by being more mindful of Type vs. Constraint 411a97e Allow as-patterns in unidirectional patttern synonyms 3446cee Fix two obscure bugs in rule matching efc844f Fix over-eager constant folding in bitInteger 034c32f Improve shortOutIndirections slightly d5577f4 Special-case record fields ending with hash when deriving Read affdea8 Allow PartialTypeSignatures in standalone deriving contexts ceb9147 Support adding objects from TH 7bb1fde testsuite: Add test for #14931 10566a8 Support iOS variants elsewhere when configuring 9893042 Fix two pernicious bugs in DeriveAnyClass cf80995 Add Note [BLACKHOLE points to IND] f7bbc34 Run C finalizers incrementally during mutation fb462f9 Fix panic on module re-exports of DuplicateRcordFields c16df60 document: fix trac issue #14229 9a00bfb rts/RetainerProfile: Dump closure type if push() fails 0703c00 testsuite: Add test for #14925 20f14b4 Fix #14916 with an additional validity check in deriveTyData 0cbb13b Don't refer to blocks in debug info when -g1 a3986d7 Fix scoped type variables in TH for several constructs 41db237 llvmGen: Pass -optlo flags last to opt 20ae19f base: Fix Unicode handling of TyCon's Show instance ecfb4d3 Add new debugging flag -dinline-check efd70cf Add unaligned bytearray access primops. Fixes #4442. d152dab Add a job running on Fedora 60e29dc circleci: Bump Hackage index state f0b258b rts, base: Refactor stats.c to improve --machine-readable report 41c1558 Make it evident in types that StgLam can't have empty args 97e1f30 Fix compilation stopper on macOS with -Werror e3dbb44 Fix #12919 by making the flattener homegeneous. b47a6c3 Fix performance of flattener patch (#12919) f13a0fc Comments only 1fce2c3 Avoid quadratic complexity in typeKind 71d50db Minor refactor and commments 9cc6a18 White space only a7628dc Deal with join points with RULES 3ebf05f Fix the test for #13938 8cfd2e4 configure: Throw error if OS is found to be msys d5c4d46 CmmPipeline: add a second pass of CmmCommonBlockElim d1fb583 testsuite: Add test for #14965 ab9e986 rts: Fix profiled build after D4529 b58282a More format string fixes 88f06d4 rts: One last formatting string fix bf2b9cc Update Note [Documenting optimisation flags] d06a5a9 Rename CI docker images 0951e03 Full AppVeyor build with tests 0017a7b Fix syntax in -flate-specialise docs c00b6d2 Update a few comments regarding CAF lists afb686a printClosure: slightly improve MVAR printing 4de585a Remove MAX_PATH restrictions from RTS, I/O manager and various utilities ca535f9 testsuite: allow accepting of fine grained results [skip ci] 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 b14c037 Some cleanup of the Exitification code 48f55e7 Bump template-haskell to 2.14.0.0 1aa1d40 Restore Trees That Grow reverted commits ae0cff0 CSE: Walk past join point lambdas (#15002) a1fcdf3 Add a forgotten newline in a debug print b2eb9ad Fix GHC collector flavor for Fedora job (Circle CI) 3f59d38 Add test case for #15005 635a784 Remove PARALLEL_HASKELL comments 5161609 testsuite: Add test for negative sqrts (#10010) d5f6d7a rts/RetainerProfile: Handle BLOCKING_QUEUES 81e7980 Minor typofix in LoadArchive.c 2534164 Move gmp/config.mk.in to config.mk.in, fix #14972 c054162 Revert "Fix #14838 by marking TH-spliced code as FromSource" 7bb7f99 Discard reflexive casts during Simplify 3cfb12d In Exitify, zap idInfo of abstracted variables (fixes #15005) a323f21 Move T14925.stdout to its correct location, remove expect_broken ed57a34 Schedule.c: remove unused code 74e768e Schedule.c: remove some unused parameters 270e3e9 No need for sortQuantVars in Exitify after all 111556f Remove fs files from rts install-includes. 4e6da0f Revert "Remove fs files from rts install-includes." 5417c68 Remove fs files from rts install-includes. b138694 TTG for HsBinds and Data instances Plan B c4814ab Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0 f02309f users-guide: Update release notes and language extensions 78ff6e5 Revert "CmmPipeline: add a second pass of CmmCommonBlockElim" a303584 Fix processHeapClosureForDead CONSTR_NOCAF case: 120a261 Update JMP_TBL targets during shortcutting in X86 NCG. f78df87 Fix rts.cabal.in 6f62303 Remove unused function: mkFunCos 7613a81 Fix #9438 by converting a panic to an error message 6a78a40 Use newtype deriving for Hoopl code 9430901 Revert "Fix processHeapClosureForDead CONSTR_NOCAF case:" ce27c7d Correct FixIOException's @since annotation retroactively 00b8ecb Declare `catchRetry#` lazy in its first argument 3c7f9e7 Make shortcutting at the asm stage toggleable and default for O2. 9e89092 Omit ways depending on rts flags for #12870 related tests. 4b831c2 Configure option to disable dtrace fea04de Enhanced constant folding 09128f3 users guide: Note improved constant folding in 8.6 release notes 0e37361 Revert "Enhanced constant folding" 90283b5 rts: Comment wibbles 4d30bc8 Remove markSignalHandlers 7889659 Minor comments in CSE fe325d3 Comments only 4a16804 Fix markup in the UNPACK pragma section of the user's guide. cab3e6b Proper safe coercions paper link 5d76846 Introduce a $tooldir variable for nicer toolchain detection on Windows 447d126 Fix #14710 with more validity checks during renaming 2fdfe05 Bump unix submodule to version 2.8.0.0 19ddd04 Add a test case from the nested CPR work 803178a users-guide: Override mathjax_path 48b8842 rts: fix format arguments for debugBelch calls on 32-bit systems f7f567d Add a test for #14815: cac8be6 Better error message for empty character literal, for Trac #13450. b08a6d7 Fix #15012 with a well-placed use of Any 8f19ecc Bump base to version 4.12.0.0 d9d8015 testsuite: Fix `./validate --slow` 3c3e731 parsec: Make version hack compatible with Windows cbd73bb configure: Use -Werror to check for existence of -no-pie 8fa688a boot: Fix computation of TOP 257c13d Lint types in newFamInst a26983a Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412) b41a42e Bump transformers submodule 2fbe0b5 Caching coercion roles in NthCo and coercionKindsRole refactoring 8b10b89 Inline wrappers earlier f6db0b2 comments only 430e6fe Remove broken top-level shell.nix 698db813 Fix implementation of rnIfaceBndr da74385 base: Add a test for T10412 2a5bdd9 Remove unnecessary check in simplCast 98b0c3f s/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci] ea01daf rts: Use g0 for &generations[0] c7c53c6 Remove a outdated comment [skip ci] bfc1fc2 Typo fix in scavenge_one comment [skip ci] f19b07a users-guide: Fix up formatting in 8.6 release notes 2eafd76 coercion: Improve debugging output f04ac4d Add testcase for #15050 e732210 ghc-prim: Refactor and document __sync_fetch_and_nand workaround 1126e69 testsuite: Fix overflow in T13623 on 32-bit machines ec9638b testsuite: Fix T4442 on 32-bit architectures acb7361 Stable.c: minor refactoring, add/update some comments 625eea9 Update Hadrian submodule 3d38e82 Do not unpack class dictionaries with INLINABLE 693857f Comments only 705dcb0 Refactor in OccurAnal 313720a Rename a local variable c3823cb TTG : complete for balance of hsSyn AST 56bbe1e Add missing stdout file for T14955 512f503 Minor refactoring in Exitify 69119b2 Comments only: the FVAnn invariant 0c01224 Refactor tcExtendLocalFamInst a bit 08003e7 Make out-of-scope errors more prominent 6da5b87 Better linting for types 4e45ebe Add test case for #15108 07cc603 Don't crash when pretty-printing bad joins d4cc74f Preserve join-point arity in CoreOpt b5739bd rts: Don't disable formatting warning in RetainerSet.c 6212d01 testsuite: Bump performance meterics due to 3d38e8284b73 260e23b rts: Add -hT to the rts usage message b7b6617 rts: Allow profiling by closure type in prof way 60f9e46 Exitify: Do not trip over shadowing (fixes #15110) dc655bf errorWithoutStackTrace: omit profiling stack trace (#14970) 4cb5595 storageAddCapabilities: fix bug in updating nursery pointers 198db04 Set arity for absentError 6742ce2 Test Trac #15114 5de0be8 Add regression tests for #14904 358b508 Compute DW_FORM_block length correctly; also fixes #15068 e34e30e Warn against using Data.Monoid.First 90589a9 document the plan for removing Data.Semigroup.Option cf35ab9 minor improvement to wording of warning against First. Add warning against Last 107d2cb Don't shadow "result" in JUnit driver 1ad0277 CircleCI: Save test results as JUnit XML 75361b1 Fix NUMA support on Windows (#15049) 6132d7c Correctly add unwinding info in manifestSp and makeFixupBlocks 866525a Move the ResponseFile module from haddock into base 721e826 GHCi: Improve the error message for hidden packages 6462d90 rts: Throw better error if --numa is used without libnuma support 79c4f10 Enable warning flags to safe-guard against regressions in `base` 5697432 Normalize T14999 test output some more 33de71f Simplify callSiteInline a little b750dcc testsuite: Bump T9630 allocations as a result of 33de71fa06d0 56e8c6f Update docker images to use GHC 8.4.2 and cabal-install-2.2 13e8bc0 Fix typo in user guide about promoted list 49f5943 rel-notes: Note that -hT is now allowed 426ae98 Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module. 361d23a Normalize the element type of ListPat, fix #14547 0f046aa testsuite: Add test for #15067 cb1ee7e Do not supply `-mcpu` if `-optlc` provides `-mcpu` already. 418881f Use unsafeInsertNew to create timers in TimerManager 6243bba Add 'addWordC#' PrimOp be580b4 Add test for invertability of `Floating` methods. d814dd3 Add hyperbolic functions to test of Float-inverses 3ea3341 Stable area hyperbolic sine for `Double` and `Float`. 46548ed base/changelog: Note stabilization of asinh (#14927) 7271db4 testsuite: Bump T5631 expected allocations 875b61e printStackChunk: recognise a few more ret frames 61b245a Small refactoring in Exitify 5b3104a Used named fields for DataDeclRn aa03ad8 Simplify the kind checking for type/class decls 37acca7 users-guide: Move discussion MAX_PATH out of release notes 280de0c Revert "Normalize the element type of ListPat, fix #14547" 981bf47 Normalize the element type of ListPat, fix #14547 849547b Revert "Normalize the element type of ListPat, fix #14547" ba6e445 Normalize the element type of ListPat, fix #14547 5fe6aaa Add -fghci-leak-check to check for space leaks b2ff5dd Fix #15038 e5bb515 rts: remove unused round_up_to_mblocks function 87e169a Revert "Add -fghci-leak-check to check for space leaks" 40a76c9 BlockAlloc.c: reuse tail_of function cb5c2fe Fix unwinding of C -> Haskell FFI calls with -threaded 3781034 Expand $tooldir in ghc --info output 2323ffd Adds CTRL-C handler in Windows's timeout (trac issue #12721) bec2e71 Revert "Fix unwinding of C -> Haskell FFI calls with -threaded" 78db41e Use correct source spans for EmptyCase 00049e2 Emit info-level log message when package envs are loaded 6ab7cf9 Simplify -ddump-json implementation 9039f84 base: Fix handling of showEFloat (Just 0) f0212a9 TcInteract: Ensure that tycons have representations before solving for Typeable 2188427 Bump array submodule 7c665f9 Refactor LitString eb39f98 Fix a few GCC warnings 2828dbf Fix changelog message for asinh cdbe00f Remove unused things from utils/Digraph d4abd03 rts: Compile with gcc -Og 30c887d GHCi: Include a note in the hint to expose a hidden package 48dee7c Clarify what the FFI spec says bf6cad8 Add note documenting refineDefaultAlt 21e1a00 Fix #14875 by introducing PprPrec, and using it cf88c2b ghc-pkg: Configure handle encodings 8f3c149 Add support for opting out of package environments ca3d303 Fix another batch of `./validate --slow` failures b713986 Improve some Foldable methods for NonEmpty 6d57a92 utils/fs: use , not e408d03 Fix #14973 1e27209 Revert "rts: Compile with gcc -Og" d92c755 Fix performance regressions from #14737 79bbb23 rts: export new absentSumFieldError from base f49f90b Tidy up error suppression df6670e testsuite: Fix expected allocations of T9020 and T12425 9dbf66d Revert "Simplify callSiteInline a little" 45ad0c3 Ensure that RTS cabal file reflects dependency on libnuma 1154c9b More explicit comment on switch in registerDelay af986f9 testsuite: Disable T14697 on Windows 01b15b8 Calling GetLastError() on Windows for socket IO (trac issue #12012) bb338f2 Algebraically simplify add/sub with carry/overflow bb3fa2d Less Tc inside simplCore (Phase 1 for #14391) a18e7df Force findPtr to be included in the binary eb8e692 An overhaul of the SRT representation fbd28e2 Allow CmmLabelDiffOff with different widths 2b0918c Save a word in the info table on x86_64 838b690 Merge FUN_STATIC closure with its SRT 01bb17f Make finalizers more reliable. 3310f7f InfoTables: Fix #if uses introduced by D4634 126b412 Add pprTraceM to Outputable as analog to traceM. 99f8cc8 Fix #15039 by pretty-printing equalities more systematically 4ffaf4b Improve numeric stability of numericEnumFrom for floating numbers 0c7db22 Fix #15073 by suggesting UnboxedTuples in an error message f2d27c1 Comments and refactoring only b701e47 Update Cabal submodule 5f15d53 Add /* fallthrough */ to fix -Wimplicit-fallthrough warning f27e4f6 Fix GHCi space leaks (#15111) 5d3b15e Fix unwinding of C -> Haskell FFI calls with -threaded (2nd try) 819b9cf Add regression tests for #11515 and #12563 797a462 Comments only efe4054 Tiny refactor 2bbdd00 Orient TyVar/TyVar equalities with deepest on the left 5a7c657 Debug tracing only ae292c6 Do not unify representational equalities d78dde9 Fix retainer profiling after SRT overhaul c617c1f base: Add Foldable and Traversable instances for Alt 9171c7f base: Fix typo c4219d9 Another batch of './validation --slow' tweaks 12deb9a rts: Fix compaction of SmallMutArrPtrs ec22f7d Add HeapView functionality e1fd946 ghc-prim: Bump version 1cdc14f ghc-pkg: recompute `abi-depends` for updated packages f2ce86c Do better sharing in the short-cut solver 5f3fb71 Fix perf numbers for #15164 b7e80ae Remove TcType.toTcType 57858fc Make dischargeFmv handle Deriveds af0757d Check for type families in an instance context 97121b6 Revert "ghc-pkg: recompute `abi-depends` for updated packages" db6085b Improve performance of CallArity 50e0984 Implement QuantifiedConstraints From git at git.haskell.org Wed May 23 13:38:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 13:38:00 +0000 (UTC) Subject: [commit: ghc] master: Typo in comments (928f606) Message-ID: <20180523133800.DB9DC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/928f606b80f6409aae41080e41c1daf075759d0a/ghc >--------------------------------------------------------------- commit 928f606b80f6409aae41080e41c1daf075759d0a Author: Gabor Greif Date: Wed Feb 7 16:54:38 2018 +0100 Typo in comments >--------------------------------------------------------------- 928f606b80f6409aae41080e41c1daf075759d0a compiler/basicTypes/PatSyn.hs | 2 +- compiler/cmm/CLabel.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/PatSyn.hs b/compiler/basicTypes/PatSyn.hs index 35ba8e9..2e838d6 100644 --- a/compiler/basicTypes/PatSyn.hs +++ b/compiler/basicTypes/PatSyn.hs @@ -162,7 +162,7 @@ type (T [a] Bool). For example, this is ill-typed f :: T p q -> String f (P x) = "urk" -This is differnet to the situation with GADTs: +This is different to the situation with GADTs: data S a where MkS :: Int -> S Bool diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 38efd12..3dfd7a7 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -1187,7 +1187,7 @@ pprCLbl (SRTLabel u) pprCLbl (LargeBitmapLabel u) = text "b" <> pprUniqueAlways u <> pp_cSEP <> text "btm" -- Some bitsmaps for tuple constructors have a numeric tag (e.g. '7') -- until that gets resolved we'll just force them to start --- with a letter so the label will be legal assmbly code. +-- with a letter so the label will be legal assembly code. pprCLbl (CmmLabel _ str CmmCode) = ftext str From git at git.haskell.org Wed May 23 14:11:33 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 14:11:33 +0000 (UTC) Subject: [commit: ghc] master: Remove special case from TcTyVar level check (49a832d) Message-ID: <20180523141133.094B83ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49a832dd38bb87dc5f6c865e86a60319b44fdf5a/ghc >--------------------------------------------------------------- commit 49a832dd38bb87dc5f6c865e86a60319b44fdf5a Author: Simon Peyton Jones Date: Wed May 23 13:14:50 2018 +0100 Remove special case from TcTyVar level check In TcMType.writeMetaTyVarRef we have an assertion check, level_check_ok, that the type being written to a unification variable is not deeper than the level of the unification varaible itself. This check used to have a special case for fmv/fsk flatten vars, but this commit changed fmv/fsks to have an ordinary level number: commit 2bbdd00c6d70bdc31ff78e2a42b26159c8717856 Author: Simon Peyton Jones Date: Fri May 18 08:43:11 2018 +0100 Orient TyVar/TyVar equalities with deepest on the left So we can delete the isFlattenTyVar special case from the level_check_ok assertion. Simpler, less ad hoc. >--------------------------------------------------------------- 49a832dd38bb87dc5f6c865e86a60319b44fdf5a compiler/typecheck/TcMType.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 398d345..e4e9854 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -754,8 +754,7 @@ writeMetaTyVarRef tyvar ref ty tv_lvl = tcTyVarLevel tyvar ty_lvl = tcTypeLevel ty - level_check_ok = isFlattenTyVar tyvar - || not (ty_lvl `strictlyDeeperThan` tv_lvl) + level_check_ok = not (ty_lvl `strictlyDeeperThan` tv_lvl) level_check_msg = ppr ty_lvl $$ ppr tv_lvl $$ ppr tyvar $$ ppr ty double_upd_msg details = hang (text "Double update of meta tyvar") From git at git.haskell.org Wed May 23 14:11:35 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 14:11:35 +0000 (UTC) Subject: [commit: ghc] master: Don't expose strictness when sm_inline is False (d191db4) Message-ID: <20180523141135.C67253ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d191db48c43469ee1818887715bcbc5c0eb1d91f/ghc >--------------------------------------------------------------- commit d191db48c43469ee1818887715bcbc5c0eb1d91f Author: Simon Peyton Jones Date: Wed May 23 13:30:21 2018 +0100 Don't expose strictness when sm_inline is False This is very much a corner case, but Trac #15163 showed that if you have a RULE like forall x. f (g x) = ..x.. and g = undefined, then the simplifier is likely to discard that 'x' argument. It is usually right to do so; but not here because then x is used on the right but not bound on the left. The fix is a narrow one, aimed at this rather pathalogical case. See Note [Do not expose strictness if sm_inline=False] in SimplUtils. >--------------------------------------------------------------- d191db48c43469ee1818887715bcbc5c0eb1d91f compiler/simplCore/SimplUtils.hs | 81 ++++++++++++++++++++++++++-------------- compiler/simplCore/Simplify.hs | 2 +- 2 files changed, 55 insertions(+), 28 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index fbf9b3e..3b16628 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -449,23 +449,25 @@ contArgs cont ------------------- -mkArgInfo :: Id +mkArgInfo :: SimplEnv + -> Id -> [CoreRule] -- Rules for function -> Int -- Number of value args -> SimplCont -- Context of the call -> ArgInfo -mkArgInfo fun rules n_val_args call_cont +mkArgInfo env fun rules n_val_args call_cont | n_val_args < idArity fun -- Note [Unsaturated functions] = ArgInfo { ai_fun = fun, ai_args = [], ai_type = fun_ty - , ai_rules = fun_rules, ai_encl = False + , ai_rules = fun_rules + , ai_encl = False , ai_strs = vanilla_stricts , ai_discs = vanilla_discounts } | otherwise = ArgInfo { ai_fun = fun, ai_args = [], ai_type = fun_ty , ai_rules = fun_rules - , ai_encl = interestingArgContext rules call_cont - , ai_strs = add_type_str fun_ty arg_stricts + , ai_encl = interestingArgContext rules call_cont + , ai_strs = arg_stricts , ai_discs = arg_discounts } where fun_ty = idType fun @@ -483,7 +485,11 @@ mkArgInfo fun rules n_val_args call_cont vanilla_stricts = repeat False arg_stricts - = case splitStrictSig (idStrictness fun) of + | not (sm_inline (seMode env)) + = vanilla_stricts -- See Note [Do not expose strictness if sm_inline=False] + | otherwise + = add_type_str fun_ty $ + case splitStrictSig (idStrictness fun) of (demands, result_info) | not (demands `lengthExceeds` n_val_args) -> -- Enough args, use the strictness given. @@ -505,26 +511,25 @@ mkArgInfo fun rules n_val_args call_cont add_type_str :: Type -> [Bool] -> [Bool] -- If the function arg types are strict, record that in the 'strictness bits' -- No need to instantiate because unboxed types (which dominate the strict - -- types) can't instantiate type variables. - -- add_type_str is done repeatedly (for each call); might be better - -- once-for-all in the function + -- types) can't instantiate type variables. + -- add_type_str is done repeatedly (for each call); + -- might be better once-for-all in the function -- But beware primops/datacons with no strictness - add_type_str - = go - where - go _ [] = [] - go fun_ty strs -- Look through foralls - | Just (_, fun_ty') <- splitForAllTy_maybe fun_ty -- Includes coercions - = go fun_ty' strs - go fun_ty (str:strs) -- Add strict-type info - | Just (arg_ty, fun_ty') <- splitFunTy_maybe fun_ty - = (str || Just False == isLiftedType_maybe arg_ty) : go fun_ty' strs - -- If the type is levity-polymorphic, we can't know whether it's - -- strict. isLiftedType_maybe will return Just False only when - -- we're sure the type is unlifted. - go _ strs - = strs + add_type_str _ [] = [] + add_type_str fun_ty all_strs@(str:strs) + | Just (arg_ty, fun_ty') <- splitFunTy_maybe fun_ty -- Add strict-type info + = (str || Just False == isLiftedType_maybe arg_ty) + : add_type_str fun_ty' strs + -- If the type is levity-polymorphic, we can't know whether it's + -- strict. isLiftedType_maybe will return Just False only when + -- we're sure the type is unlifted. + + | Just (_, fun_ty') <- splitForAllTy_maybe fun_ty + = add_type_str fun_ty' all_strs -- Look through foralls + + | otherwise + = all_strs {- Note [Unsaturated functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -534,6 +539,28 @@ Consider (test eyeball/inline4) where f has arity 2. Then we do not want to inline 'x', because it'll just be floated out again. Even if f has lots of discounts on its first argument -- it must be saturated for these to kick in + +Note [Do not expose strictness if sm_inline=False] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Trac #15163 showed a case in which we had + + {-# INLINE [1] zip #-} + zip = undefined + + {-# RULES "foo" forall as bs. stream (zip as bs) = ..blah... #-} + +If we expose zip's bottoming nature when simplifing the LHS of the +RULE we get + {-# RULES "foo" forall as bs. + stream (case zip of {}) = ..blah... #-} +discarding the arguments to zip. Usually this is fine, but on the +LHS of a rule it's not, because 'as' and 'bs' are now not bound on +the LHS. + +This is a pretty pathalogical example, so I'm not losing sleep over +it, but the simplest solution was to check sm_inline; if it is False, +which it is on the LHS of a rule (see updModeForRules), then don't +make use of the strictness info for the function. -} @@ -784,9 +811,9 @@ updModeForStableUnfoldings inline_rule_act current_mode updModeForRules :: SimplMode -> SimplMode -- See Note [Simplifying rules] updModeForRules current_mode - = current_mode { sm_phase = InitialPhase - , sm_inline = False - , sm_rules = False + = current_mode { sm_phase = InitialPhase + , sm_inline = False -- See Note [Do not expose strictness if sm_inline=False] + , sm_rules = False , sm_eta_expand = False } {- Note [Simplifying rules] diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index b50771a..5e514c5 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1734,7 +1734,7 @@ completeCall env var cont | otherwise -- Don't inline; instead rebuild the call = do { rule_base <- getSimplRules - ; let info = mkArgInfo var (getRules rule_base var) + ; let info = mkArgInfo env var (getRules rule_base var) n_val_args call_cont ; rebuildCall env info cont } From git at git.haskell.org Wed May 23 14:11:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 14:11:38 +0000 (UTC) Subject: [commit: ghc] master: Add missing check to isReflCoVar_maybe (86bba7d) Message-ID: <20180523141138.929D33ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/86bba7d519fb6050f78b7e3bac2b3f54273fd70e/ghc >--------------------------------------------------------------- commit 86bba7d519fb6050f78b7e3bac2b3f54273fd70e Author: Simon Peyton Jones Date: Wed May 23 13:19:33 2018 +0100 Add missing check to isReflCoVar_maybe isReflCoVar_maybe is called, by CoreLint, on all sorts of Vars (tyvars, term vars, coercion vars). But it was silently assuming that it was always called on a CoVar, and as a result could crash fatally. This is the immediate cause of the panic in Trac #15163. It's easy to fix. NB: this does not completely fix Trac #15163; more to come >--------------------------------------------------------------- 86bba7d519fb6050f78b7e3bac2b3f54273fd70e compiler/types/Coercion.hs | 10 ++++++---- compiler/types/Coercion.hs-boot | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 4255e4a..3a3231d 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -360,12 +360,12 @@ splitForAllCo_maybe _ = Nothing ------------------------------------------------------- -- and some coercion kind stuff -coVarTypes :: CoVar -> Pair Type +coVarTypes :: HasDebugCallStack => CoVar -> Pair Type coVarTypes cv | (_, _, ty1, ty2, _) <- coVarKindsTypesRole cv = Pair ty1 ty2 -coVarKindsTypesRole :: CoVar -> (Kind,Kind,Type,Type,Role) +coVarKindsTypesRole :: HasDebugCallStack => CoVar -> (Kind,Kind,Type,Type,Role) coVarKindsTypesRole cv | Just (tc, [k1,k2,ty1,ty2]) <- splitTyConApp_maybe (varType cv) = let role @@ -420,10 +420,12 @@ mkRuntimeRepCo co kind_co = mkKindCo co -- kind_co :: TYPE r1 ~ TYPE r2 -- (up to silliness with Constraint) -isReflCoVar_maybe :: CoVar -> Maybe Coercion +isReflCoVar_maybe :: Var -> Maybe Coercion -- If cv :: t~t then isReflCoVar_maybe cv = Just (Refl t) +-- Works on all kinds of Vars, not just CoVars isReflCoVar_maybe cv - | Pair ty1 ty2 <- coVarTypes cv + | isCoVar cv + , Pair ty1 ty2 <- coVarTypes cv , ty1 `eqType` ty2 = Just (Refl (coVarRole cv) ty1) | otherwise diff --git a/compiler/types/Coercion.hs-boot b/compiler/types/Coercion.hs-boot index 75fdd77..15e4585 100644 --- a/compiler/types/Coercion.hs-boot +++ b/compiler/types/Coercion.hs-boot @@ -36,7 +36,7 @@ mkProofIrrelCo :: Role -> Coercion -> Coercion -> Coercion -> Coercion isReflCo :: Coercion -> Bool isReflexiveCo :: Coercion -> Bool decomposePiCos :: Kind -> [Type] -> Coercion -> ([Coercion], Coercion) -coVarKindsTypesRole :: CoVar -> (Kind, Kind, Type, Type, Role) +coVarKindsTypesRole :: HasDebugCallStack => CoVar -> (Kind, Kind, Type, Type, Role) coVarRole :: CoVar -> Role mkCoercionType :: Role -> Type -> Type -> Type From git at git.haskell.org Wed May 23 14:12:02 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 14:12:02 +0000 (UTC) Subject: [commit: ghc] master: Use dischargeFunEq consistently (a32c8f7) Message-ID: <20180523141202.407023ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a32c8f7514c8192fa064537fb93d5a5c224991a0/ghc >--------------------------------------------------------------- commit a32c8f7514c8192fa064537fb93d5a5c224991a0 Author: Simon Peyton Jones Date: Wed May 23 13:06:53 2018 +0100 Use dischargeFunEq consistently Trac #15122 turned out to be interesting. * Were calling dischargeFmv in three places. * In all three cases we dealt with the Given case separately. * In two of the three cases the Given code was right, (albeit duplicated). * In the third case (in TcCanonical.canCFunEqCan), we had ; case flav of Given -> return () -- nothing more to do. which was utterly wrong. The solution is easy: move the Given-case handling into dischargeFmv (now reenamed dischargeFunEq), and delete it from the call sites. Result: less code, easier to understand (dischargeFunEq handles all three cases, not just two out of three), and Trac #15122 is fixed. >--------------------------------------------------------------- a32c8f7514c8192fa064537fb93d5a5c224991a0 compiler/typecheck/TcCanonical.hs | 36 +++++++--------- compiler/typecheck/TcInteract.hs | 49 +++++----------------- compiler/typecheck/TcSMonad.hs | 34 +++++++++------ .../tests/indexed-types/should_compile/T15122.hs | 16 +++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 5 files changed, 64 insertions(+), 72 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 a32c8f7514c8192fa064537fb93d5a5c224991a0 From git at git.haskell.org Wed May 23 16:05:55 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 16:05:55 +0000 (UTC) Subject: [commit: ghc] master: Fix a bug in SRT generation (d424d4a) Message-ID: <20180523160555.A15843ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d424d4a46a729f8530e9273282d22b6b8f34daaa/ghc >--------------------------------------------------------------- commit d424d4a46a729f8530e9273282d22b6b8f34daaa Author: Simon Marlow Date: Tue May 22 15:19:55 2018 +0100 Fix a bug in SRT generation Summary: I had good intentions, but they were not being followed. In particular, this comment: ``` --- - we never resolve a reference to a CAF to the contents of its SRT, since --- the point of SRTs is to keep CAFs alive. ``` was not true, because we updated the srtMap after generating the SRT for a CAF. Therefore it was possible for another CAF to refer to an earlier CAF, and the reference to the earlier CAF would be shortcutted to refer to its SRT instead of pointing to the CAF itself. The fix is just to not update the srtMap when generating the SRT for a CAF, but I also refactored the code and comments around this to be a bit better organised. Test Plan: Harbourmaster Reviewers: bgamari, michalt, simonpj, erikd Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15173, #15168 Differential Revision: https://phabricator.haskell.org/D4721 >--------------------------------------------------------------- d424d4a46a729f8530e9273282d22b6b8f34daaa compiler/cmm/CmmBuildInfoTables.hs | 99 ++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/compiler/cmm/CmmBuildInfoTables.hs b/compiler/cmm/CmmBuildInfoTables.hs index bef4d98..ecbe89d 100644 --- a/compiler/cmm/CmmBuildInfoTables.hs +++ b/compiler/cmm/CmmBuildInfoTables.hs @@ -30,6 +30,7 @@ import CostCentre import StgCmmHeap import PprCmm() +import Control.Monad import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) @@ -445,20 +446,44 @@ getLabelledBlocks (CmmProc top_info _ _ _) = ] --- | Get (Label,CLabel) pairs for each block that represents a CAF. +-- | Put the labelled blocks that we will be annotating with SRTs into +-- dependency order. This is so that we can process them one at a +-- time, resolving references to earlier blocks to point to their +-- SRTs. CAFs themselves are not included here; see getCAFs below. +depAnalSRTs + :: CAFEnv + -> [CmmDecl] + -> [SCC (Label, CAFLabel, Set CAFLabel)] +depAnalSRTs cafEnv decls = + srtTrace "depAnalSRTs" (ppr graph) graph + where + labelledBlocks = concatMap getLabelledBlocks decls + labelToBlock = Map.fromList (map swap labelledBlocks) + graph = stronglyConnCompFromEdgedVerticesOrd + [ let cafs' = Set.delete lbl cafs in + DigraphNode (l,lbl,cafs') l + (mapMaybe (flip Map.lookup labelToBlock) (Set.toList cafs')) + | (l, lbl) <- labelledBlocks + , Just cafs <- [mapLookup l cafEnv] ] + + +-- | Get (Label, CAFLabel, Set CAFLabel) for each block that represents a CAF. -- These are treated differently from other labelled blocks: --- - we never resolve a reference to a CAF to the contents of its SRT, since --- the point of SRTs is to keep CAFs alive. +-- - we never [Shortcut] a reference to a CAF to the contents of its +-- SRT, since the point of SRTs is to keep CAFs alive. -- - CAFs therefore don't take part in the dependency analysis in depAnalSRTs. -- instead we generate their SRTs after everything else, so that we can --- resolve references in the CAF's SRT. -getCAFs :: CmmDecl -> [(Label, CAFLabel)] -getCAFs (CmmData _ _) = [] -getCAFs (CmmProc top_info topLbl _ g) - | Just info <- mapLookup (g_entry g) (info_tbls top_info) +-- [Shortcut] references from the CAF's SRT. +getCAFs :: CAFEnv -> [CmmDecl] -> [(Label, CAFLabel, Set CAFLabel)] +getCAFs cafEnv decls = + [ (g_entry g, mkCAFLabel topLbl, cafs) + | CmmProc top_info topLbl _ g <- decls + , Just info <- [mapLookup (g_entry g) (info_tbls top_info)] , let rep = cit_rep info - , isStaticRep rep && isThunkRep rep = [(g_entry g, mkCAFLabel topLbl)] - | otherwise = [] + , isStaticRep rep && isThunkRep rep + , Just cafs <- [mapLookup (g_entry g) cafEnv] + ] + -- | Get the list of blocks that correspond to the entry points for -- FUN_STATIC closures. These are the blocks for which if we have an @@ -475,35 +500,6 @@ getStaticFuns decls = ] --- | Put the labelled blocks that we will be annotating with SRTs into --- dependency order. This is so that we can process them one at a --- time, resolving references to earlier blocks to point to their --- SRTs. -depAnalSRTs - :: CAFEnv - -> [CmmDecl] - -> [SCC (Label, CAFLabel, Set CAFLabel)] - -depAnalSRTs cafEnv decls = - srtTrace "depAnalSRTs" (ppr blockToLabel $$ ppr (graph ++ cafSCCs)) $ - (graph ++ cafSCCs) - where - cafs = concatMap getCAFs decls - cafSCCs = [ AcyclicSCC (blockid, lbl, cafs) - | (blockid, lbl) <- cafs - , Just cafs <- [mapLookup blockid cafEnv] ] - labelledBlocks = concatMap getLabelledBlocks decls - blockToLabel :: LabelMap CAFLabel - blockToLabel = mapFromList (cafs ++ labelledBlocks) - labelToBlock = Map.fromList (map swap labelledBlocks) - graph = stronglyConnCompFromEdgedVerticesOrd - [ let cafs' = Set.delete lbl cafs in - DigraphNode (l,lbl,cafs') l - (mapMaybe (flip Map.lookup labelToBlock) (Set.toList cafs')) - | (l, lbl) <- labelledBlocks - , Just cafs <- [mapLookup l cafEnv] ] - - -- | Maps labels from 'cafAnal' to the final CLabel that will appear -- in the SRT. -- - closures with singleton SRTs resolve to their single entry @@ -544,7 +540,9 @@ doSRTs dflags moduleSRTInfo tops = do -- don't need to generate the singleton SRT in the first place. But -- to do this we need to process blocks before things that depend on -- them. - let sccs = depAnalSRTs cafEnv decls + let + sccs = depAnalSRTs cafEnv decls + cafsWithSRTs = getCAFs cafEnv decls -- On each strongly-connected group of decls, construct the SRT -- closures and the SRT fields for info tables. @@ -556,8 +554,11 @@ doSRTs dflags moduleSRTInfo tops = do ((result, _srtMap), moduleSRTInfo') = initUs_ us $ flip runStateT moduleSRTInfo $ - flip runStateT Map.empty $ - mapM (doSCC dflags staticFuns) sccs + flip runStateT Map.empty $ do + nonCAFs <- mapM (doSCC dflags staticFuns) sccs + cAFs <- forM cafsWithSRTs $ \(l, cafLbl, cafs) -> + oneSRT dflags staticFuns [l] [cafLbl] True{-is a CAF-} cafs + return (nonCAFs ++ cAFs) (declss, pairs, funSRTs) = unzip3 result @@ -583,13 +584,13 @@ doSCC ) doSCC dflags staticFuns (AcyclicSCC (l, cafLbl, cafs)) = - oneSRT dflags staticFuns [l] [cafLbl] cafs + oneSRT dflags staticFuns [l] [cafLbl] False cafs doSCC dflags staticFuns (CyclicSCC nodes) = do -- build a single SRT for the whole cycle let (blockids, lbls, cafsets) = unzip3 nodes cafs = Set.unions cafsets `Set.difference` Set.fromList lbls - oneSRT dflags staticFuns blockids lbls cafs + oneSRT dflags staticFuns blockids lbls False cafs -- | Build an SRT for a set of blocks @@ -598,6 +599,7 @@ oneSRT -> LabelMap CLabel -- which blocks are static function entry points -> [Label] -- blocks in this set -> [CAFLabel] -- labels for those blocks + -> Bool -- True <=> this SRT is for a CAF -> Set CAFLabel -- SRT for this set -> StateT SRTMap (StateT ModuleSRTInfo UniqSM) @@ -606,7 +608,7 @@ oneSRT , [(Label, [SRTEntry])] -- SRTs to attach to static functions ) -oneSRT dflags staticFuns blockids lbls cafs = do +oneSRT dflags staticFuns blockids lbls isCAF cafs = do srtMap <- get topSRT <- lift get let @@ -629,9 +631,10 @@ oneSRT dflags staticFuns blockids lbls cafs = do (ppr cafs <+> ppr resolved <+> ppr allBelow <+> ppr filtered) $ return () let - updateSRTMap srtEntry = do - let newSRTMap = Map.fromList [(cafLbl, srtEntry) | cafLbl <- lbls] - put (Map.union newSRTMap srtMap) + updateSRTMap srtEntry = + when (not isCAF) $ do -- NB. no [Shortcut] for CAFs + let newSRTMap = Map.fromList [(cafLbl, srtEntry) | cafLbl <- lbls] + put (Map.union newSRTMap srtMap) case Set.toList filtered of [] -> do From git at git.haskell.org Wed May 23 20:50:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 May 2018 20:50:15 +0000 (UTC) Subject: [commit: ghc] master: Disable the SRT offset optimisation on MachO platforms (bf10456) Message-ID: <20180523205015.031CB3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf10456edaa03dc010821cd4c3d9f49cb11d89da/ghc >--------------------------------------------------------------- commit bf10456edaa03dc010821cd4c3d9f49cb11d89da Author: Ben Gamari Date: Tue May 22 09:36:35 2018 -0400 Disable the SRT offset optimisation on MachO platforms Unfortunately, this optimisation is infeasible on MachO platforms (e.g. Darwin) due to an object format limitation. Specifically, linking fails with errors of the form: error: unsupported relocation with subtraction expression, symbol '_integerzmgmp_GHCziIntegerziType_quotInteger_closure' can not be undefined in a subtraction expression Apparently MachO does not permit relocations' subtraction expressions to refer to undefined symbols. As far as I can tell this means that it is essentially impossible to express an offset between symbols living in different compilation units. This means that we lively can't use this optimisation on MachO platforms. Test Plan: Validate on Darwin Reviewers: simonmar, erikd Subscribers: rwbarton, thomie, carter, angerman GHC Trac Issues: #15169 Differential Revision: https://phabricator.haskell.org/D4715 >--------------------------------------------------------------- bf10456edaa03dc010821cd4c3d9f49cb11d89da compiler/cmm/CLabel.hs | 22 ++++++++++++++++++++-- compiler/cmm/CmmBuildInfoTables.hs | 18 ++++++++++++++++-- compiler/cmm/CmmInfo.hs | 5 ++++- includes/rts/storage/InfoTables.h | 3 +++ 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 3dfd7a7..8f614ab 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -94,10 +94,12 @@ module CLabel ( mkHpcTicksLabel, + -- * Predicates hasCAF, needsCDecl, maybeLocalBlockLabel, externallyVisibleCLabel, isMathFun, isCFunctionLabel, isGcPtrLabel, labelDynamic, + isLocalCLabel, -- * Conversions toClosureLbl, toSlowEntryLbl, toEntryLbl, toInfoLbl, hasHaskellName, @@ -975,13 +977,29 @@ idInfoLabelType info = -- ----------------------------------------------------------------------------- --- Does a CLabel need dynamic linkage? +-- | Is a 'CLabel' defined in the current module being compiled? +-- +-- Sometimes we can optimise references within a compilation unit in ways that +-- we couldn't for inter-module references. This provides a conservative +-- estimate of whether a 'CLabel' lives in the current module. +isLocalCLabel :: Module -> CLabel -> Bool +isLocalCLabel this_mod lbl = + case lbl of + IdLabel name _ _ + | isInternalName name -> True + | otherwise -> nameModule name == this_mod + LocalBlockLabel _ -> True + _ -> False + +-- ----------------------------------------------------------------------------- + +-- | Does a 'CLabel' need dynamic linkage? +-- -- When referring to data in code, we need to know whether -- that data resides in a DLL or not. [Win32 only.] -- @labelDynamic@ returns @True@ if the label is located -- in a DLL, be it a data reference or not. - labelDynamic :: DynFlags -> Module -> CLabel -> Bool labelDynamic dflags this_mod lbl = case lbl of diff --git a/compiler/cmm/CmmBuildInfoTables.hs b/compiler/cmm/CmmBuildInfoTables.hs index ecbe89d..3d13fc7 100644 --- a/compiler/cmm/CmmBuildInfoTables.hs +++ b/compiler/cmm/CmmBuildInfoTables.hs @@ -16,6 +16,7 @@ import Hoopl.Label import Hoopl.Collections import Hoopl.Dataflow import Module +import Platform import Digraph import CLabel import PprCmmDecl () @@ -120,7 +121,7 @@ offset to the SRT can be stored in 32 bits (all code lives within a the info table by storing the srt_offset in the srt field, which is half a word. -On x86_64 with TABLES_NEXT_TO_CODE: +On x86_64 with TABLES_NEXT_TO_CODE (except on MachO, due to #15169): - info->srt is zero if there's no SRT, otherwise: - info->srt is an offset from the info pointer to the SRT object @@ -636,14 +637,27 @@ oneSRT dflags staticFuns blockids lbls isCAF cafs = do let newSRTMap = Map.fromList [(cafLbl, srtEntry) | cafLbl <- lbls] put (Map.union newSRTMap srtMap) + this_mod = thisModule topSRT + case Set.toList filtered of [] -> do srtTrace "oneSRT: empty" (ppr lbls) $ return () updateSRTMap Nothing return ([], [], []) + -- When we have only one entry there is no need to build a new SRT at all. [one@(SRTEntry lbl)] - | not (labelDynamic dflags (thisModule topSRT) lbl) -> do + | -- Info tables refer to SRTs by offset (as noted in the section + -- "Referring to an SRT from the info table" of Note [SRTs]). However, + -- when dynamic linking is used we cannot guarantee that the offset + -- between the SRT and the info table will fit in the offset field. + -- Consequently we build a singleton SRT in in this case. + not (labelDynamic dflags this_mod lbl) + + -- MachO relocations can't express offsets between compilation units at + -- all, so we are always forced to build a singleton SRT in this case. + && (not (osMachOTarget $ platformOS $ targetPlatform dflags) + || isLocalCLabel this_mod lbl) -> do updateSRTMap (Just one) return ([], map (,lbl) blockids, []) diff --git a/compiler/cmm/CmmInfo.hs b/compiler/cmm/CmmInfo.hs index 3b2eea1..43cba25 100644 --- a/compiler/cmm/CmmInfo.hs +++ b/compiler/cmm/CmmInfo.hs @@ -271,7 +271,10 @@ mkSRTLit dflags _ Nothing = ([], CmmInt 0 (halfWordWidth dflags)) mkSRTLit dflags _ (Just lbl) = ([CmmLabel lbl], CmmInt 1 (halfWordWidth dflags)) --- | is the SRT offset field inline in the info table on this platform? +-- | Is the SRT offset field inline in the info table on this platform? +-- +-- See the section "Referring to an SRT from the info table" in +-- Note [SRTs] in CmmBuildInfoTables.hs inlineSRT :: DynFlags -> Bool inlineSRT dflags = platformArch (targetPlatform dflags) == ArchX86_64 && tablesNextToCode dflags diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h index 137cfe2..db50d16 100644 --- a/includes/rts/storage/InfoTables.h +++ b/includes/rts/storage/InfoTables.h @@ -156,6 +156,9 @@ typedef union { #if defined(x86_64_TARGET_ARCH) && defined(TABLES_NEXT_TO_CODE) // On x86_64 we can fit a pointer offset in half a word, so put the SRT offset // in the info->srt field directly. +// +// See the section "Referring to an SRT from the info table" in +// Note [SRTs] in CmmBuildInfoTables.hs #define USE_INLINE_SRT_FIELD #endif From git at git.haskell.org Thu May 24 11:17:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 11:17:57 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T14381' created Message-ID: <20180524111757.BEF8B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T14381 Referencing: fd9cab1ce00e2b33ec92996e26ede30ad7a374e3 From git at git.haskell.org Thu May 24 11:18:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 11:18:00 +0000 (UTC) Subject: [commit: ghc] wip/T14381: Revert "Revert "ghc-pkg: recompute `abi-depends` for updated packages"" (cd086f4) Message-ID: <20180524111800.9894C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14381 Link : http://ghc.haskell.org/trac/ghc/changeset/cd086f457f1f39c8bc14d93f93a0756746d9dc13/ghc >--------------------------------------------------------------- commit cd086f457f1f39c8bc14d93f93a0756746d9dc13 Author: Tobias Dammers Date: Tue May 22 10:32:03 2018 +0200 Revert "Revert "ghc-pkg: recompute `abi-depends` for updated packages"" This reverts commit 97121b62bada0206e1b79137ade04f859a6eee5e. >--------------------------------------------------------------- cd086f457f1f39c8bc14d93f93a0756746d9dc13 .../backpack/cabal/bkpcabal02/bkpcabal02.stdout | 5 +++ testsuite/tests/cabal/T12485a.stdout | 1 + testsuite/tests/cabal/T5442d.stdout | 1 + testsuite/tests/cabal/cabal01/cabal01.stdout | 1 + testsuite/tests/cabal/cabal06/cabal06.stdout | 4 ++ testsuite/tests/cabal/cabal08/cabal08.stdout | 2 + testsuite/tests/cabal/shadow.stdout | 1 + testsuite/tests/driver/recomp007/recomp007.stdout | 2 + .../tests/safeHaskell/check/pkg01/safePkg01.stdout | 20 +++++---- testsuite/tests/typecheck/T13168/T13168.stdout | 2 + utils/ghc-pkg/Main.hs | 52 +++++++++++++++++++++- 11 files changed, 82 insertions(+), 9 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 cd086f457f1f39c8bc14d93f93a0756746d9dc13 From git at git.haskell.org Thu May 24 11:18:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 11:18:03 +0000 (UTC) Subject: [commit: ghc] wip/T14381: Check entire package DB stack for abi-depends (f599b9c) Message-ID: <20180524111803.5E1D43ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14381 Link : http://ghc.haskell.org/trac/ghc/changeset/f599b9c5e58dea5f2e20f4b993c22906a7164c3d/ghc >--------------------------------------------------------------- commit f599b9c5e58dea5f2e20f4b993c22906a7164c3d Author: Tobias Dammers Date: Tue May 22 10:48:33 2018 +0200 Check entire package DB stack for abi-depends >--------------------------------------------------------------- f599b9c5e58dea5f2e20f4b993c22906a7164c3d utils/ghc-pkg/Main.hs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index b2efbb8..926c20a 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -1077,6 +1077,10 @@ initPackageDB filename verbosity _flags = do packageDbLock = GhcPkg.DbOpenReadWrite lock, packages = [] } + -- We can get away with passing an empty stack here, because the new DB is + -- going to be initially empty, so no dependencies are going to be actually + -- looked up. + [] -- ----------------------------------------------------------------------------- -- Registering @@ -1144,7 +1148,7 @@ registerPackage input verbosity my_flags multi_instance -- Only remove things that were instantiated the same way! instantiatedWith p == instantiatedWith pkg ] -- - changeDB verbosity (removes ++ [AddPackage pkg]) db_to_operate_on + changeDB verbosity (removes ++ [AddPackage pkg]) db_to_operate_on db_stack parsePackageInfo :: String @@ -1169,12 +1173,12 @@ data DBOp = RemovePackage InstalledPackageInfo | AddPackage InstalledPackageInfo | ModifyPackage InstalledPackageInfo -changeDB :: Verbosity -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite -> IO () -changeDB verbosity cmds db = do +changeDB :: Verbosity -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite -> PackageDBStack -> IO () +changeDB verbosity cmds db db_stack = do let db' = updateInternalDB db cmds db'' <- adjustOldFileStylePackageDB db' createDirectoryIfMissing True (location db'') - changeDBDir verbosity cmds db'' + changeDBDir verbosity cmds db'' db_stack updateInternalDB :: PackageDB 'GhcPkg.DbReadWrite -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite @@ -1187,10 +1191,10 @@ updateInternalDB db cmds = db{ packages = foldl do_cmd (packages db) cmds } do_cmd (do_cmd pkgs (RemovePackage p)) (AddPackage p) -changeDBDir :: Verbosity -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite -> IO () -changeDBDir verbosity cmds db = do +changeDBDir :: Verbosity -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite -> PackageDBStack -> IO () +changeDBDir verbosity cmds db db_stack = do mapM_ do_cmd cmds - updateDBCache verbosity db + updateDBCache verbosity db db_stack where do_cmd (RemovePackage p) = do let file = location db display (installedUnitId p) <.> "conf" @@ -1203,16 +1207,19 @@ changeDBDir verbosity cmds db = do do_cmd (ModifyPackage p) = do_cmd (AddPackage p) -updateDBCache :: Verbosity -> PackageDB 'GhcPkg.DbReadWrite -> IO () -updateDBCache verbosity db = do +updateDBCache :: Verbosity -> PackageDB 'GhcPkg.DbReadWrite -> PackageDBStack -> IO () +updateDBCache verbosity db db_stack = do let filename = location db cachefilename pkgsCabalFormat :: [InstalledPackageInfo] pkgsCabalFormat = packages db + allPkgsCabalFormat :: [InstalledPackageInfo] + allPkgsCabalFormat = allPackagesInStack db_stack + pkgsGhcCacheFormat :: [PackageCacheFormat] pkgsGhcCacheFormat - = map (recomputeValidAbiDeps pkgsCabalFormat) -- Note [Recompute abi-depends] + = map (recomputeValidAbiDeps allPkgsCabalFormat) -- Note [Recompute abi-depends] $ map convertPackageInfoToCacheFormat pkgsCabalFormat @@ -1421,14 +1428,14 @@ modifyPackage fn pkgarg verbosity my_flags force = do dieOrForceAll force ("unregistering would break the following packages: " ++ unwords (map displayQualPkgId newly_broken)) - changeDB verbosity cmds db + changeDB verbosity cmds db db_stack recache :: Verbosity -> [Flag] -> IO () recache verbosity my_flags = do (_db_stack, GhcPkg.DbOpenReadWrite db_to_operate_on, _flag_dbs) <- getPkgDatabases verbosity (GhcPkg.DbOpenReadWrite TopOne) True{-use user-} False{-no cache-} False{-expand vars-} my_flags - changeDB verbosity [] db_to_operate_on + changeDB verbosity [] db_to_operate_on _db_stack -- ----------------------------------------------------------------------------- -- Listing packages From git at git.haskell.org Thu May 24 11:18:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 11:18:06 +0000 (UTC) Subject: [commit: ghc] wip/T14381: ghc-pkg: use inferred abi-depends correctly, only warn if different (4f1e069) Message-ID: <20180524111806.24FA73ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14381 Link : http://ghc.haskell.org/trac/ghc/changeset/4f1e069a1775113d95f0da19070f0f40d9034952/ghc >--------------------------------------------------------------- commit 4f1e069a1775113d95f0da19070f0f40d9034952 Author: Tobias Dammers Date: Thu May 24 13:12:01 2018 +0200 ghc-pkg: use inferred abi-depends correctly, only warn if different >--------------------------------------------------------------- 4f1e069a1775113d95f0da19070f0f40d9034952 utils/ghc-pkg/Main.hs | 79 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 926c20a..2604b62 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -577,6 +577,15 @@ data DbModifySelector = TopOne | ContainsPkg PackageArg allPackagesInStack :: PackageDBStack -> [InstalledPackageInfo] allPackagesInStack = concatMap packages +-- | Retain only the part of the stack up to and including the given package +-- DB (where the global package DB is the bottom of the stack). The resulting +-- package DB stack contains exactly the packages that packages from the +-- specified package DB can depend on, since dependencies can only extend +-- down the stack, not up (e.g. global packages cannot depend on user +-- packages). +stackUpTo :: FilePath -> PackageDBStack -> PackageDBStack +stackUpTo to_modify = dropWhile ((/= to_modify) . location) + getPkgDatabases :: Verbosity -> GhcPkg.DbOpenMode mode DbModifySelector -> Bool -- use the user db @@ -1130,7 +1139,7 @@ registerPackage input verbosity my_flags multi_instance let top_dir = takeDirectory (location (last db_stack)) pkg_expanded = mungePackagePaths top_dir pkgroot pkg - let truncated_stack = dropWhile ((/= to_modify).location) db_stack + let truncated_stack = stackUpTo to_modify db_stack -- truncate the stack for validation, because we don't allow -- packages lower in the stack to refer to those higher up. validatePackageConfig pkg_expanded verbosity truncated_stack @@ -1173,7 +1182,11 @@ data DBOp = RemovePackage InstalledPackageInfo | AddPackage InstalledPackageInfo | ModifyPackage InstalledPackageInfo -changeDB :: Verbosity -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite -> PackageDBStack -> IO () +changeDB :: Verbosity + -> [DBOp] + -> PackageDB 'GhcPkg.DbReadWrite + -> PackageDBStack + -> IO () changeDB verbosity cmds db db_stack = do let db' = updateInternalDB db cmds db'' <- adjustOldFileStylePackageDB db' @@ -1191,7 +1204,11 @@ updateInternalDB db cmds = db{ packages = foldl do_cmd (packages db) cmds } do_cmd (do_cmd pkgs (RemovePackage p)) (AddPackage p) -changeDBDir :: Verbosity -> [DBOp] -> PackageDB 'GhcPkg.DbReadWrite -> PackageDBStack -> IO () +changeDBDir :: Verbosity + -> [DBOp] + -> PackageDB 'GhcPkg.DbReadWrite + -> PackageDBStack + -> IO () changeDBDir verbosity cmds db db_stack = do mapM_ do_cmd cmds updateDBCache verbosity db db_stack @@ -1207,19 +1224,25 @@ changeDBDir verbosity cmds db db_stack = do do_cmd (ModifyPackage p) = do_cmd (AddPackage p) -updateDBCache :: Verbosity -> PackageDB 'GhcPkg.DbReadWrite -> PackageDBStack -> IO () +updateDBCache :: Verbosity + -> PackageDB 'GhcPkg.DbReadWrite + -> PackageDBStack + -> IO () updateDBCache verbosity db db_stack = do let filename = location db cachefilename + db_stack_below = stackUpTo (location db) db_stack pkgsCabalFormat :: [InstalledPackageInfo] pkgsCabalFormat = packages db - allPkgsCabalFormat :: [InstalledPackageInfo] - allPkgsCabalFormat = allPackagesInStack db_stack + -- | All the packages we can legally depend on in this step. + dependablePkgsCabalFormat :: [InstalledPackageInfo] + dependablePkgsCabalFormat = allPackagesInStack db_stack_below - pkgsGhcCacheFormat :: [PackageCacheFormat] + pkgsGhcCacheFormat :: [(PackageCacheFormat, Bool)] pkgsGhcCacheFormat - = map (recomputeValidAbiDeps allPkgsCabalFormat) -- Note [Recompute abi-depends] + -- See Note [Recompute abi-depends] + = map (recomputeValidAbiDeps dependablePkgsCabalFormat) $ map convertPackageInfoToCacheFormat pkgsCabalFormat @@ -1228,13 +1251,24 @@ updateDBCache verbosity db db_stack = do -- warn when we find any (possibly-)bogus abi-depends fields; -- Note [Recompute abi-depends] - when (any hasAnyAbiDepends pkgsCabalFormat) $ - infoLn "ignoring (possibly broken) abi-depends field for packages" + let definitelyBrokenPackages = + nub . sort . map (unPackageName . GhcPkg.packageName . fst) . filter snd $ pkgsGhcCacheFormat + when (definitelyBrokenPackages /= []) $ do + infoLn "overriding broken abi-depends field for packages: " + forM_ definitelyBrokenPackages $ \pkg -> + infoLn $ " " ++ pkg + when (verbosity > Normal) $ do + let possiblyBrokenPackages = + nub . sort . map (unPackageName . pkgName . packageId) . filter hasAnyAbiDepends $ pkgsCabalFormat + when (possiblyBrokenPackages /= []) $ do + infoLn "ignoring (possibly broken) abi-depends field for packages: " + forM_ possiblyBrokenPackages $ \pkg -> + infoLn $ " " ++ pkg when (verbosity > Normal) $ infoLn ("writing cache " ++ filename) - GhcPkg.writePackageDb filename pkgsGhcCacheFormat pkgsCabalFormat + GhcPkg.writePackageDb filename (map fst pkgsGhcCacheFormat) pkgsCabalFormat `catchIO` \e -> if isPermissionError e then die $ filename ++ ": you don't have permission to modify this file" @@ -1280,16 +1314,25 @@ So, instead, we do two things here: See Trac #14381, and Cabal issue #4728. +Additionally, because we are throwing away the original (declared) ABI deps, we +return a boolean that indicates whether any abi-depends were actually +overridden. + -} -recomputeValidAbiDeps :: [InstalledPackageInfo] -> PackageCacheFormat -> PackageCacheFormat -recomputeValidAbiDeps db pkg = pkg { GhcPkg.abiDepends = catMaybes (newAbiDeps) } +recomputeValidAbiDeps :: [InstalledPackageInfo] + -> PackageCacheFormat + -> (PackageCacheFormat, Bool) +recomputeValidAbiDeps db pkg = + (pkg { GhcPkg.abiDepends = newAbiDeps }, abiDepsUpdated) where - newAbiDeps = flip map (GhcPkg.abiDepends pkg) $ \(k, _) -> - case filter (\d -> installedUnitId d == k) db of - [] -> Nothing - [x] -> Just (k, unAbiHash (abiHash x)) - _ -> Nothing -- ??? + newAbiDeps = + catMaybes . flip map (GhcPkg.abiDepends pkg) $ \(k, _) -> + case filter (\d -> installedUnitId d == k) db of + [x] -> Just (k, unAbiHash (abiHash x)) + _ -> Nothing + abiDepsUpdated = + GhcPkg.abiDepends pkg /= newAbiDeps convertPackageInfoToCacheFormat :: InstalledPackageInfo -> PackageCacheFormat convertPackageInfoToCacheFormat pkg = From git at git.haskell.org Thu May 24 11:18:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 11:18:08 +0000 (UTC) Subject: [commit: ghc] wip/T14381: Update tests to reflect new ghc-pkg behavior (fd9cab1) Message-ID: <20180524111808.DDBF23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14381 Link : http://ghc.haskell.org/trac/ghc/changeset/fd9cab1ce00e2b33ec92996e26ede30ad7a374e3/ghc >--------------------------------------------------------------- commit fd9cab1ce00e2b33ec92996e26ede30ad7a374e3 Author: Tobias Dammers Date: Thu May 24 13:13:22 2018 +0200 Update tests to reflect new ghc-pkg behavior >--------------------------------------------------------------- fd9cab1ce00e2b33ec92996e26ede30ad7a374e3 .../backpack/cabal/bkpcabal02/bkpcabal02.stdout | 5 ----- testsuite/tests/cabal/T12485a.stdout | 3 ++- testsuite/tests/cabal/T5442d.stdout | 1 - testsuite/tests/cabal/cabal01/cabal01.stdout | 1 - testsuite/tests/cabal/cabal06/cabal06.stdout | 8 ++++---- testsuite/tests/cabal/cabal08/cabal08.stdout | 2 -- testsuite/tests/cabal/shadow.stdout | 1 - testsuite/tests/driver/recomp007/recomp007.stdout | 2 -- .../tests/safeHaskell/check/pkg01/safePkg01.stdout | 20 ++++++++------------ testsuite/tests/typecheck/T13168/T13168.stdout | 2 -- 10 files changed, 14 insertions(+), 31 deletions(-) diff --git a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout index 1e51c3c..2f17fdf 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout +++ b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout @@ -1,11 +1,6 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Preprocessing library 'p' for bkpcabal01-0.1.0.0.. Building library 'p' instantiated with H = for bkpcabal01-0.1.0.0.. -ignoring (possibly broken) abi-depends field for packages Preprocessing library 'q' for bkpcabal01-0.1.0.0.. Building library 'q' instantiated with H = for bkpcabal01-0.1.0.0.. -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages diff --git a/testsuite/tests/cabal/T12485a.stdout b/testsuite/tests/cabal/T12485a.stdout index af722c5..270a0b5 100644 --- a/testsuite/tests/cabal/T12485a.stdout +++ b/testsuite/tests/cabal/T12485a.stdout @@ -1,4 +1,5 @@ -ignoring (possibly broken) abi-depends field for packages +overriding broken abi-depends field for packages: + shadowdep should SUCCEED should SUCCEED should SUCCEED diff --git a/testsuite/tests/cabal/T5442d.stdout b/testsuite/tests/cabal/T5442d.stdout index 0cb7375..f321457 100644 --- a/testsuite/tests/cabal/T5442d.stdout +++ b/testsuite/tests/cabal/T5442d.stdout @@ -1,7 +1,6 @@ Reading package info from "shadow1.pkg" ... done. Reading package info from "shadow4.pkg" ... done. Reading package info from "shadow2.pkg" ... done. -ignoring (possibly broken) abi-depends field for packages global (should be empty): user: shadow-2 diff --git a/testsuite/tests/cabal/cabal01/cabal01.stdout b/testsuite/tests/cabal/cabal01/cabal01.stdout index 1378031..e828cbe 100644 --- a/testsuite/tests/cabal/cabal01/cabal01.stdout +++ b/testsuite/tests/cabal/cabal01/cabal01.stdout @@ -1,4 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages install1: bin lib diff --git a/testsuite/tests/cabal/cabal06/cabal06.stdout b/testsuite/tests/cabal/cabal06/cabal06.stdout index 3813639..cc5cada 100644 --- a/testsuite/tests/cabal/cabal06/cabal06.stdout +++ b/testsuite/tests/cabal/cabal06/cabal06.stdout @@ -1,7 +1,7 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages +overriding broken abi-depends field for packages: + q +overriding broken abi-depends field for packages: + q Does the first instance of q depend on p-1.0? 1 Does the second instance of q depend on p-1.0? diff --git a/testsuite/tests/cabal/cabal08/cabal08.stdout b/testsuite/tests/cabal/cabal08/cabal08.stdout index d70d778..06a164b 100644 --- a/testsuite/tests/cabal/cabal08/cabal08.stdout +++ b/testsuite/tests/cabal/cabal08/cabal08.stdout @@ -1,5 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... p2 diff --git a/testsuite/tests/cabal/shadow.stdout b/testsuite/tests/cabal/shadow.stdout index c70767d..a47ce15 100644 --- a/testsuite/tests/cabal/shadow.stdout +++ b/testsuite/tests/cabal/shadow.stdout @@ -1,4 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages databases 1 and 2: localshadow1.package.conf (shadow-1) diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout index d5da3da..d834315 100644 --- a/testsuite/tests/driver/recomp007/recomp007.stdout +++ b/testsuite/tests/driver/recomp007/recomp007.stdout @@ -1,5 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Preprocessing executable 'test' for b-1.0.. Building executable 'test' for b-1.0.. [1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A changed] diff --git a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout index 8d63784..6967d97 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout +++ b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout @@ -1,53 +1,49 @@ -ignoring (possibly broken) abi-depends field for packages pdb.safePkg01/local.db safePkg01-1.0 trusted: False M_SafePkg -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.12.0.0* ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: safe require own pkg trusted: False M_SafePkg2 -package dependencies: base-4.11.0.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.12.0.0 ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: trustworthy require own pkg trusted: False M_SafePkg3 -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.12.0.0* ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: safe require own pkg trusted: True M_SafePkg4 -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.12.0.0* ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: safe require own pkg trusted: True M_SafePkg5 -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.12.0.0* ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: safe require own pkg trusted: True M_SafePkg6 -package dependencies: array-0.5.2.0 base-4.11.0.0* bytestring-0.10.8.2* deepseq-1.4.3.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: array-0.5.2.0 base-4.12.0.0* bytestring-0.10.8.2* deepseq-1.4.4.0 ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: trustworthy require own pkg trusted: False M_SafePkg7 -package dependencies: array-0.5.2.0 base-4.11.0.0* bytestring-0.10.8.2* deepseq-1.4.3.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: array-0.5.2.0 base-4.12.0.0* bytestring-0.10.8.2* deepseq-1.4.4.0 ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: safe require own pkg trusted: False M_SafePkg8 -package dependencies: array-0.5.2.0 base-4.11.0.0 bytestring-0.10.8.2* deepseq-1.4.3.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: array-0.5.2.0 base-4.12.0.0 bytestring-0.10.8.2* deepseq-1.4.4.0 ghc-prim-0.5.3 integer-gmp-1.0.2.0 trusted: trustworthy require own pkg trusted: False Testing setting trust -ignoring (possibly broken) abi-depends field for packages trusted: True -ignoring (possibly broken) abi-depends field for packages trusted: False -ignoring (possibly broken) abi-depends field for packages trusted: False diff --git a/testsuite/tests/typecheck/T13168/T13168.stdout b/testsuite/tests/typecheck/T13168/T13168.stdout index 32eec3e..a935d2f 100644 --- a/testsuite/tests/typecheck/T13168/T13168.stdout +++ b/testsuite/tests/typecheck/T13168/T13168.stdout @@ -1,3 +1 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Window From git at git.haskell.org Thu May 24 14:00:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:00:37 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump OS X performance numbers (49691c4) Message-ID: <20180524140037.512803ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49691c4f2b7971c5f3b562116811a197554514c0/ghc >--------------------------------------------------------------- commit 49691c4f2b7971c5f3b562116811a197554514c0 Author: Ben Gamari Date: Thu May 24 09:59:43 2018 -0400 testsuite: Bump OS X performance numbers Sadly I can't easily determine the cause of T13701's regression since the tree was broken. >--------------------------------------------------------------- 49691c4f2b7971c5f3b562116811a197554514c0 testsuite/tests/perf/compiler/all.T | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index f652415..3b37344 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1204,7 +1204,7 @@ test('ManyAlternatives', test('T13701', [ compiler_stats_num_field('bytes allocated', - [(platform('x86_64-apple-darwin'), 2217187888, 10), + [(platform('x86_64-apple-darwin'), 2549206272, 10), (platform('x86_64-unknown-linux'), 2413253392, 10), # initial: 2511285600 # 2017-06-23: 2188045288 treat banged variable bindings as FunBinds @@ -1235,9 +1235,10 @@ test('T13719', test('T14697', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 337290376, 10), + [(wordsize(64), 371030912, 10), # initial: 635573784 # 2018-02-23: 337290376 Cache the fingerprint of sOpt_P + # 2018-05-24: 371030912 Unknown ]), # This generates too large of a command-line for poor Windows when(opsys('mingw32'), expect_broken(15072)), From git at git.haskell.org Thu May 24 14:34:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:11 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T15155' created Message-ID: <20180524143411.61E863ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T15155 Referencing: cbcb17110934dad751fb5005ba03dfb528bec340 From git at git.haskell.org Thu May 24 14:34:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:14 +0000 (UTC) Subject: [commit: ghc] wip/T15155: WIP: triggering CI for Simon's patch (1407258) Message-ID: <20180524143414.329EC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/1407258585a5d65f90b82516f83b5cadb3101541/ghc >--------------------------------------------------------------- commit 1407258585a5d65f90b82516f83b5cadb3101541 Author: Gabor Greif Date: Wed Jan 17 14:47:00 2018 +0100 WIP: triggering CI for Simon's patch >--------------------------------------------------------------- 1407258585a5d65f90b82516f83b5cadb3101541 compiler/codeGen/StgCmmClosure.hs | 8 ++++++++ compiler/coreSyn/CoreOpt.hs | 20 +++++++++++++++++++- compiler/prelude/PrelRules.hs | 9 ++------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index b021fe0..c051c91 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -68,6 +68,8 @@ module StgCmmClosure ( import GhcPrelude +import CoreSyn( isValueUnfolding, maybeUnfoldingTemplate ) +import CoreOpt( exprIsSatConApp_maybe ) import StgSyn import SMRep import Cmm @@ -327,6 +329,11 @@ mkLFImported id -- We assume that the constructor is evaluated so that -- the id really does point directly to the constructor + | isValueUnfolding unf + , Just expr <- maybeUnfoldingTemplate unf + , Just con <- exprIsSatConApp_maybe expr + = LFCon con + | arity > 0 = LFReEntrant TopLevel noOneShotInfo arity True (panic "arg_descr") @@ -334,6 +341,7 @@ mkLFImported id = mkLFArgument id -- Not sure of exact arity where arity = idFunRepArity id + unf = realIdUnfolding id ------------- mkLFStringLit :: LambdaFormInfo diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 2027928..816c5e2 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -12,7 +12,8 @@ module CoreOpt ( joinPointBinding_maybe, joinPointBindings_maybe, -- ** Predicates on expressions - exprIsConApp_maybe, exprIsLiteral_maybe, exprIsLambda_maybe, + exprIsConApp_maybe, exprIsLiteral_maybe, + exprIsLambda_maybe, exprIsSatConApp_maybe, -- ** Coercions and casts pushCoArg, pushCoValArg, pushCoTyArg, collectBindersPushingCo @@ -812,6 +813,23 @@ exprIsConApp_maybe (in_scope, id_unf) expr extend (Right s) v e = Right (extendSubst s v e) +exprIsSatConApp_maybe :: CoreExpr -> Maybe DataCon +-- Returns (Just dc) for a saturated application of dc +-- Simpler than exprIsConApp_maybe +exprIsSatConApp_maybe e = go 0 e + where + go :: Arity -> CoreExpr -> Maybe DataCon + go n_val_args (Var v) + | Just dc <- isDataConWorkId_maybe v + , dataConRepArity dc == n_val_args + = Just dc + go n_val_args (App f a) + | isTypeArg a = go n_val_args f + | otherwise = go (n_val_args + 1) f + go n_val_args (Cast e _) = go n_val_args e + go n_val_args (Tick _ e) = go n_val_args e + go _ _ = Nothing + -- See Note [exprIsConApp_maybe on literal strings] dealWithStringLiteral :: Var -> BS.ByteString -> Coercion -> Maybe (DataCon, [Type], [CoreExpr]) diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index d0ad6c5..a1f0b0b 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -33,7 +33,7 @@ import CoreSyn import MkCore import Id import Literal -import CoreOpt ( exprIsLiteral_maybe ) +import CoreOpt ( exprIsLiteral_maybe, exprIsSatConApp_maybe ) import PrimOp ( PrimOp(..), tagToEnumKey ) import TysWiredIn import TysPrim @@ -41,7 +41,6 @@ import TyCon ( tyConDataCons_maybe, isAlgTyCon, isEnumerationTyCon , isNewTyCon, unwrapNewTyCon_maybe, tyConDataCons ) import DataCon ( DataCon, dataConTagZ, dataConTyCon, dataConWorkId ) import CoreUtils ( cheapEqExpr, exprIsHNF, exprType ) -import CoreUnfold ( exprIsConApp_maybe ) import Type import OccName ( occNameFS ) import PrelNames @@ -745,9 +744,6 @@ removeOp32 = do getArgs :: RuleM [CoreExpr] getArgs = RuleM $ \_ _ args -> Just args -getInScopeEnv :: RuleM InScopeEnv -getInScopeEnv = RuleM $ \_ iu _ -> Just iu - -- return the n-th argument of this rule, if it is a literal -- argument indices start from 0 getLiteral :: Int -> RuleM Literal @@ -1006,8 +1002,7 @@ dataToTagRule = a `mplus` b b = do dflags <- getDynFlags [_, val_arg] <- getArgs - in_scope <- getInScopeEnv - (dc,_,_) <- liftMaybe $ exprIsConApp_maybe in_scope val_arg + dc <- liftMaybe $ exprIsSatConApp_maybe val_arg ASSERT( not (isNewTyCon (dataConTyCon dc)) ) return () return $ mkIntVal dflags (toInteger (dataConTagZ dc)) From git at git.haskell.org Thu May 24 14:34:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:17 +0000 (UTC) Subject: [commit: ghc] wip/T15155: Revert "WIP: triggering CI for Simon's patch" (0bf9705) Message-ID: <20180524143417.083133ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/0bf9705463ba3f2caeeb479548468d24d97fa703/ghc >--------------------------------------------------------------- commit 0bf9705463ba3f2caeeb479548468d24d97fa703 Author: Gabor Greif Date: Thu May 24 11:11:11 2018 +0200 Revert "WIP: triggering CI for Simon's patch" This reverts commit 1407258585a5d65f90b82516f83b5cadb3101541. >--------------------------------------------------------------- 0bf9705463ba3f2caeeb479548468d24d97fa703 compiler/codeGen/StgCmmClosure.hs | 8 -------- compiler/coreSyn/CoreOpt.hs | 20 +------------------- compiler/prelude/PrelRules.hs | 9 +++++++-- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index c051c91..b021fe0 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -68,8 +68,6 @@ module StgCmmClosure ( import GhcPrelude -import CoreSyn( isValueUnfolding, maybeUnfoldingTemplate ) -import CoreOpt( exprIsSatConApp_maybe ) import StgSyn import SMRep import Cmm @@ -329,11 +327,6 @@ mkLFImported id -- We assume that the constructor is evaluated so that -- the id really does point directly to the constructor - | isValueUnfolding unf - , Just expr <- maybeUnfoldingTemplate unf - , Just con <- exprIsSatConApp_maybe expr - = LFCon con - | arity > 0 = LFReEntrant TopLevel noOneShotInfo arity True (panic "arg_descr") @@ -341,7 +334,6 @@ mkLFImported id = mkLFArgument id -- Not sure of exact arity where arity = idFunRepArity id - unf = realIdUnfolding id ------------- mkLFStringLit :: LambdaFormInfo diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 816c5e2..2027928 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -12,8 +12,7 @@ module CoreOpt ( joinPointBinding_maybe, joinPointBindings_maybe, -- ** Predicates on expressions - exprIsConApp_maybe, exprIsLiteral_maybe, - exprIsLambda_maybe, exprIsSatConApp_maybe, + exprIsConApp_maybe, exprIsLiteral_maybe, exprIsLambda_maybe, -- ** Coercions and casts pushCoArg, pushCoValArg, pushCoTyArg, collectBindersPushingCo @@ -813,23 +812,6 @@ exprIsConApp_maybe (in_scope, id_unf) expr extend (Right s) v e = Right (extendSubst s v e) -exprIsSatConApp_maybe :: CoreExpr -> Maybe DataCon --- Returns (Just dc) for a saturated application of dc --- Simpler than exprIsConApp_maybe -exprIsSatConApp_maybe e = go 0 e - where - go :: Arity -> CoreExpr -> Maybe DataCon - go n_val_args (Var v) - | Just dc <- isDataConWorkId_maybe v - , dataConRepArity dc == n_val_args - = Just dc - go n_val_args (App f a) - | isTypeArg a = go n_val_args f - | otherwise = go (n_val_args + 1) f - go n_val_args (Cast e _) = go n_val_args e - go n_val_args (Tick _ e) = go n_val_args e - go _ _ = Nothing - -- See Note [exprIsConApp_maybe on literal strings] dealWithStringLiteral :: Var -> BS.ByteString -> Coercion -> Maybe (DataCon, [Type], [CoreExpr]) diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index a1f0b0b..d0ad6c5 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -33,7 +33,7 @@ import CoreSyn import MkCore import Id import Literal -import CoreOpt ( exprIsLiteral_maybe, exprIsSatConApp_maybe ) +import CoreOpt ( exprIsLiteral_maybe ) import PrimOp ( PrimOp(..), tagToEnumKey ) import TysWiredIn import TysPrim @@ -41,6 +41,7 @@ import TyCon ( tyConDataCons_maybe, isAlgTyCon, isEnumerationTyCon , isNewTyCon, unwrapNewTyCon_maybe, tyConDataCons ) import DataCon ( DataCon, dataConTagZ, dataConTyCon, dataConWorkId ) import CoreUtils ( cheapEqExpr, exprIsHNF, exprType ) +import CoreUnfold ( exprIsConApp_maybe ) import Type import OccName ( occNameFS ) import PrelNames @@ -744,6 +745,9 @@ removeOp32 = do getArgs :: RuleM [CoreExpr] getArgs = RuleM $ \_ _ args -> Just args +getInScopeEnv :: RuleM InScopeEnv +getInScopeEnv = RuleM $ \_ iu _ -> Just iu + -- return the n-th argument of this rule, if it is a literal -- argument indices start from 0 getLiteral :: Int -> RuleM Literal @@ -1002,7 +1006,8 @@ dataToTagRule = a `mplus` b b = do dflags <- getDynFlags [_, val_arg] <- getArgs - dc <- liftMaybe $ exprIsSatConApp_maybe val_arg + in_scope <- getInScopeEnv + (dc,_,_) <- liftMaybe $ exprIsConApp_maybe in_scope val_arg ASSERT( not (isNewTyCon (dataConTyCon dc)) ) return () return $ mkIntVal dflags (toInteger (dataConTagZ dc)) From git at git.haskell.org Thu May 24 14:34:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:19 +0000 (UTC) Subject: [commit: ghc] wip/T15155: WIP: asm-emit-time IND_STATIC elimination (9da6b6c) Message-ID: <20180524143419.CD59D3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/9da6b6ca857fbdf60b75658fb592647ce90df17b/ghc >--------------------------------------------------------------- commit 9da6b6ca857fbdf60b75658fb592647ce90df17b Author: Gabor Greif Date: Mon Jan 29 14:34:25 2018 +0100 WIP: asm-emit-time IND_STATIC elimination >--------------------------------------------------------------- 9da6b6ca857fbdf60b75658fb592647ce90df17b compiler/nativeGen/X86/Ppr.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index c03bf4f..2a673ec 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -144,6 +144,16 @@ pprBasicBlock info_env (BasicBlock blockid instrs) _other -> empty pprDatas :: (Alignment, CmmStatics) -> SDoc + +pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, _, _]) + | lbl == mkIndStaticInfoLabel + , let labelInd (CmmLabelOff l _) = Just l + labelInd (CmmLabel l) = Just l + labelInd _ = Nothing + , Just ind' <- labelInd ind + , let equate = pprGloblDecl alias $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind') + = pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate + pprDatas (align, (Statics lbl dats)) = vcat (pprAlign align : pprLabel lbl : map pprData dats) From git at git.haskell.org Thu May 24 14:34:22 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:22 +0000 (UTC) Subject: [commit: ghc] wip/T15155: WIP: alias only local symbols for now (f86ef75) Message-ID: <20180524143422.96BF23ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/f86ef7548280b5eedaf73e87146c14022d484cdd/ghc >--------------------------------------------------------------- commit f86ef7548280b5eedaf73e87146c14022d484cdd Author: Gabor Greif Date: Mon Jan 29 23:57:45 2018 +0100 WIP: alias only local symbols for now otherwise it seems to trip up darwin ld62 and gnu linkers >--------------------------------------------------------------- f86ef7548280b5eedaf73e87146c14022d484cdd compiler/nativeGen/X86/Ppr.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 2a673ec..ea26e18 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -151,6 +151,7 @@ pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, _ labelInd (CmmLabel l) = Just l labelInd _ = Nothing , Just ind' <- labelInd ind + , not $ externallyVisibleCLabel ind' -- trips ld64 otherwise , let equate = pprGloblDecl alias $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind') = pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate From git at git.haskell.org Thu May 24 14:34:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:25 +0000 (UTC) Subject: [commit: ghc] wip/T15155: WIP: assert that other fields are zeroed out (b259ea6) Message-ID: <20180524143425.5FA613ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/b259ea6cdcef70d62bc2bdd8298894cadfe03f59/ghc >--------------------------------------------------------------- commit b259ea6cdcef70d62bc2bdd8298894cadfe03f59 Author: Gabor Greif Date: Thu May 24 16:20:07 2018 +0200 WIP: assert that other fields are zeroed out >--------------------------------------------------------------- b259ea6cdcef70d62bc2bdd8298894cadfe03f59 compiler/nativeGen/X86/Ppr.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index ea26e18..b5571bd 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -32,6 +32,7 @@ import Instruction import Format import Reg import PprBase +import Util (debugIsOn) import Hoopl.Collections @@ -145,7 +146,7 @@ pprBasicBlock info_env (BasicBlock blockid instrs) pprDatas :: (Alignment, CmmStatics) -> SDoc -pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, _, _]) +pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, x, y]) | lbl == mkIndStaticInfoLabel , let labelInd (CmmLabelOff l _) = Just l labelInd (CmmLabel l) = Just l @@ -153,7 +154,8 @@ pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, _ , Just ind' <- labelInd ind , not $ externallyVisibleCLabel ind' -- trips ld64 otherwise , let equate = pprGloblDecl alias $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind') - = pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate + = ASSERT( (case x of CmmStaticLit (CmmInt 0 _) -> True; _ -> False) && (case y of CmmStaticLit (CmmInt 0 _) -> True; _ -> False) ) + pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate pprDatas (align, (Statics lbl dats)) = vcat (pprAlign align : pprLabel lbl : map pprData dats) From git at git.haskell.org Thu May 24 14:34:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 14:34:28 +0000 (UTC) Subject: [commit: ghc] wip/T15155: WIP: remove tracing (cbcb171) Message-ID: <20180524143428.29A7B3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/cbcb17110934dad751fb5005ba03dfb528bec340/ghc >--------------------------------------------------------------- commit cbcb17110934dad751fb5005ba03dfb528bec340 Author: Gabor Greif Date: Thu May 24 16:33:43 2018 +0200 WIP: remove tracing >--------------------------------------------------------------- cbcb17110934dad751fb5005ba03dfb528bec340 compiler/nativeGen/X86/Ppr.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index b5571bd..bcb7c78 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -155,7 +155,7 @@ pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, x , not $ externallyVisibleCLabel ind' -- trips ld64 otherwise , let equate = pprGloblDecl alias $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind') = ASSERT( (case x of CmmStaticLit (CmmInt 0 _) -> True; _ -> False) && (case y of CmmStaticLit (CmmInt 0 _) -> True; _ -> False) ) - pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate + equate pprDatas (align, (Statics lbl dats)) = vcat (pprAlign align : pprLabel lbl : map pprData dats) From git at git.haskell.org Thu May 24 15:19:39 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 15:19:39 +0000 (UTC) Subject: [commit: ghc] master: Check for mismatched class methods during typechecking (1879d9d) Message-ID: <20180524151939.2B5F03ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1879d9d2c95239f6705af0cbac5fed7d9b220f28/ghc >--------------------------------------------------------------- commit 1879d9d2c95239f6705af0cbac5fed7d9b220f28 Author: Ryan Scott Date: Thu May 24 10:31:28 2018 -0400 Check for mismatched class methods during typechecking Summary: Template Haskell provides a wormhole through which you can sneak methods that don't belong to a class into an instance for that class, bypassing the renamer's validity checks. The solution adopted here is to mirror the treatment for associated type family instances, which have an additional check in the typechecker which catch mismatched associated type families that were snuck through using Template Haskell. I've put a similar check for class methods into `tcMethods`. Test Plan: make test TEST=T12387 Reviewers: bgamari, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #12387 Differential Revision: https://phabricator.haskell.org/D4710 >--------------------------------------------------------------- 1879d9d2c95239f6705af0cbac5fed7d9b220f28 compiler/hsSyn/HsUtils.hs | 2 +- compiler/rename/RnEnv.hs | 6 ++++-- compiler/typecheck/TcInstDcls.hs | 37 +++++++++++++++++++++++++++++++++++++ compiler/typecheck/TcValidity.hs | 2 ++ testsuite/tests/th/T12387.hs | 10 ++++++++++ testsuite/tests/th/T12387.stderr | 4 ++++ testsuite/tests/th/all.T | 1 + 7 files changed, 59 insertions(+), 3 deletions(-) diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index e23b096..fe22fb3 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -997,7 +997,7 @@ collect_bind omitPatSyn (PatSynBind _ (PSB { psb_id = L _ ps })) acc collect_bind _ (PatSynBind _ (XPatSynBind _)) acc = acc collect_bind _ (XHsBindsLR _) acc = acc -collectMethodBinders :: LHsBindsLR GhcPs idR -> [Located RdrName] +collectMethodBinders :: LHsBindsLR idL idR -> [Located (IdP idL)] -- Used exclusively for the bindings of an instance decl which are all FunBinds collectMethodBinders binds = foldrBag (get . unLoc) [] binds where diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 5873c6f..6d94029 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -651,8 +651,10 @@ lookupSubBndrOcc warn_if_deprec the_parent doc rdr_name = do NameNotFound -> return (Left (unknownSubordinateErr doc rdr_name)) FoundName _p n -> return (Right n) FoundFL fl -> return (Right (flSelector fl)) - IncorrectParent {} -> return $ Left (unknownSubordinateErr doc rdr_name) - + IncorrectParent {} + -- See [Mismatched class methods and associated type families] + -- in TcInstDecls. + -> return $ Left (unknownSubordinateErr doc rdr_name) {- Note [Family instance binders] diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index c319378..7b869fd 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -60,6 +60,7 @@ import DynFlags import ErrUtils import FastString import Id +import ListSetOps import MkId import Name import NameSet @@ -1306,6 +1307,7 @@ tcMethods dfun_id clas tyvars dfun_ev_vars inst_tys -- The lexical_tvs scope over the 'where' part do { traceTc "tcInstMeth" (ppr sigs $$ ppr binds) ; checkMinimalDefinition + ; checkMethBindMembership ; (ids, binds, mb_implics) <- set_exts exts $ mapAndUnzip3M tc_item op_items ; return (ids, listToBag binds, listToBag (catMaybes mb_implics)) } @@ -1368,6 +1370,41 @@ tcMethods dfun_id clas tyvars dfun_ev_vars inst_tys methodExists meth = isJust (findMethodBind meth binds prag_fn) + ---------------------- + -- Check if any method bindings do not correspond to the class. + -- See Note [Mismatched class methods and associated type families]. + checkMethBindMembership + = let bind_nms = map unLoc $ collectMethodBinders binds + cls_meth_nms = map (idName . fst) op_items + mismatched_meths = bind_nms `minusList` cls_meth_nms + in forM_ mismatched_meths $ \mismatched_meth -> + addErrTc $ hsep + [ text "Class", quotes (ppr (className clas)) + , text "does not have a method", quotes (ppr mismatched_meth)] + +{- +Note [Mismatched class methods and associated type families] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +It's entirely possible for someone to put methods or associated type family +instances inside of a class in which it doesn't belong. For instance, we'd +want to fail if someone wrote this: + + instance Eq () where + type Rep () = Maybe + compare = undefined + +Since neither the type family `Rep` nor the method `compare` belong to the +class `Eq`. Normally, this is caught in the renamer when resolving RdrNames, +since that would discover that the parent class `Eq` is incorrect. + +However, there is a scenario in which the renamer could fail to catch this: +if the instance was generated through Template Haskell, as in #12387. In that +case, Template Haskell will provide fully resolved names (e.g., +`GHC.Classes.compare`), so the renamer won't notice the sleight-of-hand going +on. For this reason, we also put an extra validity check for this in the +typechecker as a last resort. +-} + ------------------------ tcMethodBody :: Class -> [TcTyVar] -> [EvVar] -> [TcType] -> TcEvBinds -> Bool diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 35e6a95..ab31e2e 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -1590,6 +1590,8 @@ checkConsistentFamInst checkConsistentFamInst Nothing _ _ _ = return () checkConsistentFamInst (Just (clas, inst_tvs, mini_env)) fam_tc at_tys pp_hs_pats = do { -- Check that the associated type indeed comes from this class + -- See [Mismatched class methods and associated type families] + -- in TcInstDecls. checkTc (Just clas == tyConAssoc_maybe fam_tc) (badATErr (className clas) (tyConName fam_tc)) diff --git a/testsuite/tests/th/T12387.hs b/testsuite/tests/th/T12387.hs new file mode 100644 index 0000000..550fc99 --- /dev/null +++ b/testsuite/tests/th/T12387.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TemplateHaskell #-} +module T12387 where + +import Language.Haskell.TH.Lib + +data Foo = Foo + +$(do d <- instanceD (cxt []) (conT ''Eq `appT` conT ''Foo) + [funD 'compare [clause [] (normalB $ varE 'undefined) []]] + return [d]) diff --git a/testsuite/tests/th/T12387.stderr b/testsuite/tests/th/T12387.stderr new file mode 100644 index 0000000..81c2eef --- /dev/null +++ b/testsuite/tests/th/T12387.stderr @@ -0,0 +1,4 @@ + +T12387.hs:8:3: error: + • Class ‘Eq’ does not have a method ‘compare’ + • In the instance declaration for ‘Eq Foo’ diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 4fcf700..e103184 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -360,6 +360,7 @@ test('T11629', normal, compile, ['-v0']) test('T8761', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T12130', [], multimod_compile, ['T12130', '-v0 ' + config.ghc_th_way_flags]) +test('T12387', normal, compile_fail, ['-v0']) test('T12403', omit_ways(['ghci']), compile_and_run, ['-v0 -ddump-splices -dsuppress-uniques']) test('T12407', omit_ways(['ghci']), compile, ['-v0']) From git at git.haskell.org Thu May 24 15:19:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 15:19:42 +0000 (UTC) Subject: [commit: ghc] master: Clean up the conflicting data family instances error message (979f085) Message-ID: <20180524151942.C2D9F3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/979f085c4f87a93f48d6b567076d3c556d490fa8/ghc >--------------------------------------------------------------- commit 979f085c4f87a93f48d6b567076d3c556d490fa8 Author: Ryan Scott Date: Thu May 24 10:33:51 2018 -0400 Clean up the conflicting data family instances error message Summary: The way we were pretty-printing conflicting data family instances in an error message was far from ideal: 1. If a data type had no constructors, it would print an equals sign with nothing to the right of it. 2. It would try to print GADTs using Haskell98 syntax. 3. It eta-reduced away some type variables from the LHS. This patch addresses these three issues: 1. We no longer print constructors at all in this error message. There's really no reason to do so in the first place, since duplicate data family instances always conflict, regardless of their constructors. 2. Since we no longer print constructors, we no longer have to worry about whether we're using GADT or Haskell98 syntax. 3. I've put in a fix to ensure that type variables are no longer eta-reduced away from the LHS. Test Plan: make test TEST=T14179 Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14179 Differential Revision: https://phabricator.haskell.org/D4711 >--------------------------------------------------------------- 979f085c4f87a93f48d6b567076d3c556d490fa8 compiler/types/Coercion.hs | 33 +++++++++++++++++----- .../tests/indexed-types/should_fail/Over.stderr | 4 +-- .../should_fail/OverDirectThisMod.stderr | 4 +-- .../should_fail/OverIndirectThisMod.stderr | 6 ++-- .../indexed-types/should_fail/SimpleFail11a.stderr | 8 +++--- .../indexed-types/should_fail/SimpleFail11b.stderr | 8 +++--- .../indexed-types/should_fail/SimpleFail11c.stderr | 8 +++--- .../indexed-types/should_fail/SimpleFail11d.stderr | 6 ++-- .../indexed-types/should_fail/SimpleFail2b.stderr | 6 ++-- .../tests/indexed-types/should_fail/T14179.hs | 20 +++++++++++++ .../tests/indexed-types/should_fail/T14179.stderr | 15 ++++++++++ .../tests/indexed-types/should_fail/T2334A.stderr | 26 ++++++++--------- .../tests/indexed-types/should_fail/T9371.stderr | 6 ++-- testsuite/tests/indexed-types/should_fail/all.T | 1 + .../should_compile/DataFamilyInstanceLHS.stderr | 2 +- .../NamedWildcardInDataFamilyInstanceLHS.stderr | 2 +- 16 files changed, 104 insertions(+), 51 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 979f085c4f87a93f48d6b567076d3c556d490fa8 From git at git.haskell.org Thu May 24 15:19:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 15:19:45 +0000 (UTC) Subject: [commit: ghc] master: Minor typos (5ca623a) Message-ID: <20180524151945.991633ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5ca623a5a06b96478efe0ac6e37bae4789c1d1c0/ghc >--------------------------------------------------------------- commit 5ca623a5a06b96478efe0ac6e37bae4789c1d1c0 Author: Ryan Scott Date: Thu May 24 10:37:35 2018 -0400 Minor typos >--------------------------------------------------------------- 5ca623a5a06b96478efe0ac6e37bae4789c1d1c0 compiler/typecheck/TcDerivInfer.hs | 4 ++-- compiler/typecheck/TcEnv.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index ec779c5..49578d9 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -746,8 +746,8 @@ simplifyDeriv pred tvs thetas Note [Overlap and deriving] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider some overlapping instances: - data Show a => Show [a] where .. - data Show [Char] where ... + instance Show a => Show [a] where .. + instance Show [Char] where ... Now a data type with deriving: data T a = MkT [a] deriving( Show ) diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index 6a2f6ce..81ef54e 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -442,7 +442,7 @@ tcExtendKindEnvList :: [(Name, TcTyThing)] -> TcM r -> TcM r -- ATcTyCon or APromotionErr -- No need to update the global tyvars, or tcl_th_bndrs, or tcl_rdr tcExtendKindEnvList things thing_inside - = do { traceTc "txExtendKindEnvList" (ppr things) + = do { traceTc "tcExtendKindEnvList" (ppr things) ; updLclEnv upd_env thing_inside } where upd_env env = env { tcl_env = extendNameEnvList (tcl_env env) things } @@ -450,7 +450,7 @@ tcExtendKindEnvList things thing_inside tcExtendKindEnv :: NameEnv TcTyThing -> TcM r -> TcM r -- A variant of tcExtendKindEvnList tcExtendKindEnv extra_env thing_inside - = do { traceTc "txExtendKindEnv" (ppr extra_env) + = do { traceTc "tcExtendKindEnv" (ppr extra_env) ; updLclEnv upd_env thing_inside } where upd_env env = env { tcl_env = tcl_env env `plusNameEnv` extra_env } From git at git.haskell.org Thu May 24 15:38:56 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 May 2018 15:38:56 +0000 (UTC) Subject: [commit: ghc] wip/T15155: WIP: remove tracing (b2b2d2b) Message-ID: <20180524153856.EF9A53ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T15155 Link : http://ghc.haskell.org/trac/ghc/changeset/b2b2d2b7b8cb5aafa419a057972d3a0ff440f6df/ghc >--------------------------------------------------------------- commit b2b2d2b7b8cb5aafa419a057972d3a0ff440f6df Author: Gabor Greif Date: Thu May 24 16:33:43 2018 +0200 WIP: remove tracing >--------------------------------------------------------------- b2b2d2b7b8cb5aafa419a057972d3a0ff440f6df compiler/nativeGen/X86/Ppr.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index b5571bd..1e00e03 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -146,7 +146,7 @@ pprBasicBlock info_env (BasicBlock blockid instrs) pprDatas :: (Alignment, CmmStatics) -> SDoc -pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, x, y]) +pprDatas (_, Statics alias [CmmStaticLit (CmmLabel lbl), CmmStaticLit ind, x, y]) | lbl == mkIndStaticInfoLabel , let labelInd (CmmLabelOff l _) = Just l labelInd (CmmLabel l) = Just l @@ -155,7 +155,7 @@ pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, x , not $ externallyVisibleCLabel ind' -- trips ld64 otherwise , let equate = pprGloblDecl alias $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind') = ASSERT( (case x of CmmStaticLit (CmmInt 0 _) -> True; _ -> False) && (case y of CmmStaticLit (CmmInt 0 _) -> True; _ -> False) ) - pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate + equate pprDatas (align, (Statics lbl dats)) = vcat (pprAlign align : pprLabel lbl : map pprData dats) From git at git.haskell.org Fri May 25 09:08:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 May 2018 09:08:11 +0000 (UTC) Subject: [commit: ghc] master: Add -fghci-leak-check to check for space leaks (5b6ef59) Message-ID: <20180525090811.54D623ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b6ef59f99590128394b9dd9717b07fa971f6fc0/ghc >--------------------------------------------------------------- commit 5b6ef59f99590128394b9dd9717b07fa971f6fc0 Author: Simon Marlow Date: Wed May 2 11:01:13 2018 +0100 Add -fghci-leak-check to check for space leaks Summary: (re-applying this patch now that D4659 is committed) Space leaks in GHCi emerge from time to time and tend to come back again after they get fixed. This is an attempt to limit regressions by * adding a reliable detection for some classes of space leaks in GHCi * turning on leak checking for all GHCi tests in the test suite, so that we'll notice if the leak appears again. The idea for detecting space leaks is quite simple: * find some data that we expect to be GC'd later, make a weak pointer to it * when we expect the data to be dead, do a `performGC` and then check the status of the weak pointer. It would be nice to apply this trick to lots of things in GHC, e.g. ensuring that HsSyn is not retained after the desugarer, or ensuring that CoreSyn from the previous simplifier pass is not retained. Test Plan: validate Reviewers: bgamari, simonpj, erikd, niteria Subscribers: thomie, carter GHC Trac Issues: #15111 >--------------------------------------------------------------- 5b6ef59f99590128394b9dd9717b07fa971f6fc0 compiler/main/DynFlags.hs | 2 + docs/users_guide/ghci.rst | 11 ++++++ ghc/GHCi/Leak.hs | 59 +++++++++++++++++++++++++++++ ghc/GHCi/UI.hs | 15 +++++++- ghc/ghc-bin.cabal.in | 1 + testsuite/config/ghc | 2 +- testsuite/tests/ghci/scripts/T9293.stdout | 4 ++ testsuite/tests/ghci/scripts/ghci057.stdout | 4 ++ 8 files changed, 96 insertions(+), 2 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5b6ef59f99590128394b9dd9717b07fa971f6fc0 From git at git.haskell.org Fri May 25 09:08:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 May 2018 09:08:14 +0000 (UTC) Subject: [commit: ghc] master: isDllName: use Opt_ExternalDynamicRefs, not WayDyn (c618732) Message-ID: <20180525090814.233DC3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c618732ebb234d09abb9f2ef4858d1f96b889a74/ghc >--------------------------------------------------------------- commit c618732ebb234d09abb9f2ef4858d1f96b889a74 Author: Simon Marlow Date: Thu May 24 11:18:48 2018 +0100 isDllName: use Opt_ExternalDynamicRefs, not WayDyn This should have been part of D4477, but got missed. >--------------------------------------------------------------- c618732ebb234d09abb9f2ef4858d1f96b889a74 compiler/main/Packages.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index e8e9032..f27e597 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -2007,7 +2007,7 @@ isDllName :: DynFlags -> Module -> Name -> Bool -- the symbol comes from another dynamically-linked package, -- and applies on all platforms, not just Windows isDllName dflags this_mod name - | WayDyn `notElem` ways dflags = False + | not (gopt Opt_ExternalDynamicRefs dflags) = False | Just mod <- nameModule_maybe name -- Issue #8696 - when GHC is dynamically linked, it will attempt -- to load the dynamic dependencies of object files at compile From git at git.haskell.org Fri May 25 11:33:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 May 2018 11:33:42 +0000 (UTC) Subject: [commit: ghc] master: Comments about the substition invariant (40d5b9e) Message-ID: <20180525113342.26C5C3ABA0@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/40d5b9e970149e85f0b5cbc1a795fa36f24a981a/ghc >--------------------------------------------------------------- commit 40d5b9e970149e85f0b5cbc1a795fa36f24a981a Author: Simon Peyton Jones Date: Fri May 25 12:23:43 2018 +0100 Comments about the substition invariant >--------------------------------------------------------------- 40d5b9e970149e85f0b5cbc1a795fa36f24a981a compiler/coreSyn/CoreSubst.hs | 34 ++++++++------------ compiler/types/TyCoRep.hs | 75 +++++++++++++++++++++++++------------------ 2 files changed, 57 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 40d5b9e970149e85f0b5cbc1a795fa36f24a981a From git at git.haskell.org Sat May 26 08:05:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 26 May 2018 08:05:17 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Don't rely on find command in T15038 (11eed2f) Message-ID: <20180526080517.2A2BA3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/11eed2f41f7a1ad461ab0717d2e4e46d0cca0f03/ghc >--------------------------------------------------------------- commit 11eed2f41f7a1ad461ab0717d2e4e46d0cca0f03 Author: Ben Gamari Date: Sat May 26 11:04:18 2018 +0300 testsuite: Don't rely on find command in T15038 Test Plan: Validate Reviewers: int-index, osa1 Reviewed By: osa1 Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15038 Differential Revision: https://phabricator.haskell.org/D4723 >--------------------------------------------------------------- 11eed2f41f7a1ad461ab0717d2e4e46d0cca0f03 testsuite/tests/codeGen/should_run/T15038/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/T15038/Makefile b/testsuite/tests/codeGen/should_run/T15038/Makefile index 5084949..48493c0 100644 --- a/testsuite/tests/codeGen/should_run/T15038/Makefile +++ b/testsuite/tests/codeGen/should_run/T15038/Makefile @@ -4,6 +4,12 @@ include $(TOP)/mk/test.mk .PHONY: T15038 T15038: - '$(TEST_HC)' $(TEST_HC_OPTS) $(shell find . -iname '*.hs') -O2 -o Main \ + '$(TEST_HC)' $(TEST_HC_OPTS) -O2 -o Main \ + ./test/Main.hs \ + ./test/Parser.hs \ + ./src/Packed/Bytes/Stream/ST.hs \ + ./src/Packed/Bytes/Parser.hs \ + ./src/Packed/Bytes.hs \ + ./common/Data/Trie/Naive.hs \ -package containers -package ghc-prim -package primitive ./Main From git at git.haskell.org Sat May 26 14:30:21 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 26 May 2018 14:30:21 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #11766 (72835ff) Message-ID: <20180526143021.701863ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72835ff223e103c8a187f782146e5f452d74aef6/ghc >--------------------------------------------------------------- commit 72835ff223e103c8a187f782146e5f452d74aef6 Author: Ryan Scott Date: Sat May 26 10:29:22 2018 -0400 Add regression test for #11766 >--------------------------------------------------------------- 72835ff223e103c8a187f782146e5f452d74aef6 testsuite/tests/typecheck/should_compile/T11766.hs | 30 ++++++++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 31 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T11766.hs b/testsuite/tests/typecheck/should_compile/T11766.hs new file mode 100644 index 0000000..123dec0 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11766.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE UndecidableInstances #-} +module T11766 where + +import Data.Maybe (isJust) + +data Wrapper a = Wrapper a deriving (Show) + +class Resolution a +instance Resolution (Wrapper a) + +class (Resolution b, Resolution d) => C a b c d | a -> b, c -> d, a d -> c, b c -> a where + cfun :: (b -> d) -> a -> c + +instance {-# OVERLAPPABLE #-} (Resolution b, Resolution d, a ~ b, c ~ d) => C a b c d where + cfun = ($) + +instance {-# OVERLAPPING #-} (C b c d e) => C (Maybe a -> b) c (Maybe a -> d) e where + cfun f b = \x -> cfun f (b x) + +foo :: Maybe a -> Wrapper Bool +foo = Wrapper . isJust + +t1 = cfun id foo $! Nothing +t2 = let f = cfun id foo in f Nothing +t3 = cfun id foo Nothing +t4 = cfun id foo $ Nothing diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index afba48d..0d5b210 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -499,6 +499,7 @@ test('T11401', normal, compile, ['']) test('T11699', normal, compile, ['']) test('T11512', normal, compile, ['']) test('T11754', normal, compile, ['']) +test('T11766', normal, compile, ['']) test('T11811', normal, compile, ['']) test('T11793', normal, compile, ['']) test('T11348', normal, compile, ['']) From git at git.haskell.org Sat May 26 15:40:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 26 May 2018 15:40:15 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #14172 (00f7e28) Message-ID: <20180526154015.AEA813ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/00f7e2850396c69938ddb017bc8d87ca1ecd882a/ghc >--------------------------------------------------------------- commit 00f7e2850396c69938ddb017bc8d87ca1ecd882a Author: Ryan Scott Date: Sat May 26 11:39:26 2018 -0400 Add regression test for #14172 Commit 433b80dec1cfef787fc1327a9eada1791b11c12e fixed #14172. Let's add a regression test to ensure that it stays fixed. >--------------------------------------------------------------- 00f7e2850396c69938ddb017bc8d87ca1ecd882a testsuite/tests/polykinds/T14172.hs | 7 ++ testsuite/tests/polykinds/T14172.stderr | 40 ++++++++++ .../T13585a.hs => polykinds/T14172a.hs} | 86 +++++++++------------- testsuite/tests/polykinds/all.T | 1 + 4 files changed, 84 insertions(+), 50 deletions(-) diff --git a/testsuite/tests/polykinds/T14172.hs b/testsuite/tests/polykinds/T14172.hs new file mode 100644 index 0000000..10fff5a --- /dev/null +++ b/testsuite/tests/polykinds/T14172.hs @@ -0,0 +1,7 @@ +module T14172 where + +import Data.Functor.Compose +import T14172a + +traverseCompose :: (a -> f b) -> g a -> f (h _) +traverseCompose = _Wrapping Compose . traverse diff --git a/testsuite/tests/polykinds/T14172.stderr b/testsuite/tests/polykinds/T14172.stderr new file mode 100644 index 0000000..487b006 --- /dev/null +++ b/testsuite/tests/polykinds/T14172.stderr @@ -0,0 +1,40 @@ + +T14172.hs:6:46: error: + • Found type wildcard ‘_’ standing for ‘a'’ + Where: ‘a'’ is a rigid type variable bound by + the inferred type of + traverseCompose :: (a -> f b) -> g a -> f (h a') + at T14172.hs:7:1-46 + To use the inferred type, enable PartialTypeSignatures + • In the type signature: + traverseCompose :: (a -> f b) -> g a -> f (h _) + +T14172.hs:7:19: error: + • Occurs check: cannot construct the infinite type: a ~ g'1 a + Expected type: (f'0 a -> f (f'0 b)) + -> Compose f'0 g'1 a -> f (h a') + Actual type: (Unwrapped (Compose f'0 g'1 a) + -> f (Unwrapped (h a'))) + -> Compose f'0 g'1 a -> f (h a') + • In the first argument of ‘(.)’, namely ‘_Wrapping Compose’ + In the expression: _Wrapping Compose . traverse + In an equation for ‘traverseCompose’: + traverseCompose = _Wrapping Compose . traverse + • Relevant bindings include + traverseCompose :: (a -> f b) -> g a -> f (h a') + (bound at T14172.hs:7:1) + +T14172.hs:7:19: error: + • Couldn't match type ‘g’ with ‘Compose f'0 g'1’ + ‘g’ is a rigid type variable bound by + the inferred type of + traverseCompose :: (a -> f b) -> g a -> f (h a') + at T14172.hs:7:1-46 + Expected type: (a -> f b) -> g a -> f (h a') + Actual type: (a -> f b) -> Compose f'0 g'1 a -> f (h a') + • In the expression: _Wrapping Compose . traverse + In an equation for ‘traverseCompose’: + traverseCompose = _Wrapping Compose . traverse + • Relevant bindings include + traverseCompose :: (a -> f b) -> g a -> f (h a') + (bound at T14172.hs:7:1) diff --git a/testsuite/tests/typecheck/should_compile/T13585a.hs b/testsuite/tests/polykinds/T14172a.hs similarity index 50% copy from testsuite/tests/typecheck/should_compile/T13585a.hs copy to testsuite/tests/polykinds/T14172a.hs index fda3d70..b831372 100644 --- a/testsuite/tests/typecheck/should_compile/T13585a.hs +++ b/testsuite/tests/polykinds/T14172a.hs @@ -1,81 +1,67 @@ -{-# LANGUAGE KindSignatures, RankNTypes, TypeFamilies, MultiParamTypeClasses, FlexibleInstances,UndecidableInstances #-} - -module T13585a where - -import Data.Monoid (First(..)) +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +module T14172a where + +import Data.Coerce +import Data.Functor.Compose import Data.Functor.Identity class Profunctor p where dimap :: (a -> b) -> (c -> d) -> p b c -> p a d - dimap f g = lmap f . rmap g + (#.) :: Coercible c b => (b -> c) -> p a b -> p a c + +instance Profunctor (->) where + dimap ab cd bc = cd . bc . ab {-# INLINE dimap #-} + (#.) _ = coerce (\x -> x :: b) :: forall a b. Coercible b a => a -> b + {-# INLINE (#.) #-} - lmap :: (a -> b) -> p b c -> p a c - lmap f = dimap f id - {-# INLINE lmap #-} +type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t) +type Iso' s a = Iso s s a a - rmap :: (b -> c) -> p a b -> p a c - rmap = dimap id - {-# INLINE rmap #-} +iso :: (s -> a) -> (b -> t) -> Iso s t a b +iso sa bt = dimap sa (fmap bt) +{-# INLINE iso #-} +type AnIso s t a b = Exchange a b a (Identity b) -> Exchange a b s (Identity t) data Exchange a b s t = Exchange (s -> a) (b -> t) -instance Functor (Exchange a b s) where - fmap f (Exchange sa bt) = Exchange sa (f . bt) - {-# INLINE fmap #-} - instance Profunctor (Exchange a b) where dimap f g (Exchange sa bt) = Exchange (sa . f) (g . bt) {-# INLINE dimap #-} - lmap f (Exchange sa bt) = Exchange (sa . f) bt - {-# INLINE lmap #-} - rmap f (Exchange sa bt) = Exchange sa (f . bt) - {-# INLINE rmap #-} - - + (#.) _ = coerce + {-# INLINE ( #. ) #-} withIso :: AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r withIso ai k = case ai (Exchange id Identity) of - Exchange sa bt -> k sa (runIdentity undefined bt) + Exchange sa bt -> k sa (runIdentity #. bt) {-# INLINE withIso #-} -type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t) -type Iso' s a = Iso s s a a -type AnIso s t a b = Exchange a b a (Identity b) -> Exchange a b s (Identity t) +class Wrapped s where + type Unwrapped s :: * + _Wrapped' :: Iso' s (Unwrapped s) + +class Wrapped s => Rewrapped (s :: *) (t :: *) class (Rewrapped s t, Rewrapped t s) => Rewrapping s t instance (Rewrapped s t, Rewrapped t s) => Rewrapping s t - -instance (t ~ First b) => Rewrapped (First a) t -instance Wrapped (First a) where - type Unwrapped (First a) = Maybe a - _Wrapped' = iso getFirst First - {-# INLINE _Wrapped' #-} - -class Wrapped s => Rewrapped (s :: *) (t :: *) - -class Wrapped s where - type Unwrapped s :: * - _Wrapped' :: Iso' s (Unwrapped s) +instance (t ~ Compose f' g' a') => Rewrapped (Compose f g a) t +instance Wrapped (Compose f g a) where + type Unwrapped (Compose f g a) = f (g a) + _Wrapped' = iso getCompose Compose _Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t) _Wrapping _ = _Wrapped {-# INLINE _Wrapping #-} -iso :: (s -> a) -> (b -> t) -> Iso s t a b -iso sa bt = dimap sa (fmap bt) -{-# INLINE iso #-} - _Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped = withIso _Wrapped' $ \ sa _ -> withIso _Wrapped' $ \ _ bt -> iso sa bt {-# INLINE _Wrapped #-} - -au :: Functor f => AnIso s t a b -> ((b -> t) -> f s) -> f a -au k = withIso k $ \ sa bt f -> fmap sa (f bt) -{-# INLINE au #-} - -ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s) -ala = au . _Wrapping -{-# INLINE ala #-} diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 5aaa217..788832d 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -174,6 +174,7 @@ test('T13391', normal, compile_fail, ['']) test('T13391a', normal, compile, ['']) test('T14270', normal, compile, ['']) test('T14450', normal, compile_fail, ['']) +test('T14172', normal, multimod_compile_fail, ['T14172.hs','-v0']) test('T14174', normal, compile_fail, ['']) test('T14174a', normal, compile, ['']) test('T14520', normal, compile_fail, ['']) From git at git.haskell.org Sat May 26 15:58:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 26 May 2018 15:58:25 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #14246 (9ed7e8d) Message-ID: <20180526155825.3D6353ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ed7e8d6a31b96ea2f171f1ad064294ee618b032/ghc >--------------------------------------------------------------- commit 9ed7e8d6a31b96ea2f171f1ad064294ee618b032 Author: Ryan Scott Date: Sat May 26 11:58:03 2018 -0400 Add regression test for #14246 >--------------------------------------------------------------- 9ed7e8d6a31b96ea2f171f1ad064294ee618b032 .../tests/indexed-types/should_fail/T14246.hs | 23 +++++++++++++++++++++ .../tests/indexed-types/should_fail/T14246.stderr | 24 ++++++++++++++++++++++ testsuite/tests/indexed-types/should_fail/all.T | 1 + 3 files changed, 48 insertions(+) diff --git a/testsuite/tests/indexed-types/should_fail/T14246.hs b/testsuite/tests/indexed-types/should_fail/T14246.hs new file mode 100644 index 0000000..cf947e8 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T14246.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE RankNTypes, GADTs, TypeOperators, PolyKinds, DataKinds, TypeFamilies, AllowAmbiguousTypes, UndecidableInstances, TypeInType #-} + +module T14246 where + +import Data.Kind -- necessary for * + +data Nat = Z | S Nat + +data Vect :: Nat -> Type -> Type where + Nil :: Vect Z a + Cons :: a -> Vect n a -> Vect (S n) a + +data Label a = Label a + +data L + +type family KLN (n :: k) :: Nat where + KLN (f :: v -> k) = S (KLN (forall t. f t)) + KLN (f :: *) = Z + +type family Reveal (n :: k) (l :: Vect (KLN n) L) :: * where + Reveal (f :: v -> k) (Cons (Label (t :: v)) l) = Reveal (f t) l + Reveal (a :: *) Nil = a diff --git a/testsuite/tests/indexed-types/should_fail/T14246.stderr b/testsuite/tests/indexed-types/should_fail/T14246.stderr new file mode 100644 index 0000000..0f0a3e5 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T14246.stderr @@ -0,0 +1,24 @@ + +T14246.hs:18:5: error: + • Illegal polymorphic type: forall (t :: v). f t + • In the equations for closed type family ‘KLN’ + In the type family declaration for ‘KLN’ + +T14246.hs:22:27: error: + • Expected kind ‘Vect (KLN f) L’, + but ‘Cons (Label (t :: v)) l’ has kind ‘Vect ('S (KLN (f t))) *’ + • In the second argument of ‘Reveal’, namely + ‘(Cons (Label (t :: v)) l)’ + In the type family declaration for ‘Reveal’ + +T14246.hs:22:67: error: + • Expected kind ‘Vect (KLN (f t)) L’, + but ‘l’ has kind ‘Vect (KLN (f t)) *’ + • In the second argument of ‘Reveal’, namely ‘l’ + In the type ‘Reveal (f t) l’ + In the type family declaration for ‘Reveal’ + +T14246.hs:23:21: error: + • Expected kind ‘Vect (KLN a) L’, but ‘Nil’ has kind ‘Vect 'Z L’ + • In the second argument of ‘Reveal’, namely ‘Nil’ + In the type family declaration for ‘Reveal’ diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 80ea5da..ef5eee2 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -141,5 +141,6 @@ test('T14033', normal, compile_fail, ['']) test('T14045a', normal, compile_fail, ['']) test('T14175', normal, compile_fail, ['']) test('T14179', normal, compile_fail, ['']) +test('T14246', normal, compile_fail, ['']) test('T14369', normal, compile_fail, ['']) test('T15172', normal, compile_fail, ['']) From git at git.haskell.org Sat May 26 16:39:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 26 May 2018 16:39:03 +0000 (UTC) Subject: [commit: ghc] master: Mark #12447's test case as expected to pass (6a9b9b4) Message-ID: <20180526163903.14BC03ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6a9b9b431dcc94849d14c13639eb2f713e5aa1f4/ghc >--------------------------------------------------------------- commit 6a9b9b431dcc94849d14c13639eb2f713e5aa1f4 Author: Ryan Scott Date: Sat May 26 12:38:08 2018 -0400 Mark #12447's test case as expected to pass This appears to have been fixed at some point between GHC 8.0 and 8.2. >--------------------------------------------------------------- 6a9b9b431dcc94849d14c13639eb2f713e5aa1f4 testsuite/tests/ghci/scripts/T12447.stdout | 4 ++-- testsuite/tests/ghci/scripts/all.T | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/ghci/scripts/T12447.stdout b/testsuite/tests/ghci/scripts/T12447.stdout index 67bbc9b..6c469ee 100644 --- a/testsuite/tests/ghci/scripts/T12447.stdout +++ b/testsuite/tests/ghci/scripts/T12447.stdout @@ -1,3 +1,3 @@ deferEither @(_ ~ _) - :: Deferrable (w2 ~ w1) => - proxy (w2 ~ w1) -> (w2 ~ w1 => r) -> Either String r + :: (Typeable w1, Typeable w2) => + proxy (w1 ~ w2) -> ((w1 ~ w2) => r) -> Either String r diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 06f1ec4..f4b4177 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -245,7 +245,7 @@ test('T12091', [extra_run_opts('-fobject-code')], ghci_script, test('T12523', normal, ghci_script, ['T12523.script']) test('T12024', normal, ghci_script, ['T12024.script']) test('T12158', expect_broken(12158), ghci_script, ['T12158.script']) -test('T12447', expect_broken(12447), ghci_script, ['T12447.script']) +test('T12447', normal, ghci_script, ['T12447.script']) test('T10249', normal, ghci_script, ['T10249.script']) test('T12550', normal, ghci_script, ['T12550.script']) test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) From git at git.haskell.org Sun May 27 21:20:41 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 27 May 2018 21:20:41 +0000 (UTC) Subject: [commit: ghc] master: base: Introduce Data.Monoid.Ap (b67e8a3) Message-ID: <20180527212041.1A8D43ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b67e8a3f107f7e7b2cefb526a5f956a4a3abc852/ghc >--------------------------------------------------------------- commit b67e8a3f107f7e7b2cefb526a5f956a4a3abc852 Author: chessai Date: Wed Apr 11 18:28:41 2018 -0400 base: Introduce Data.Monoid.Ap This data type witnesses the lifting of a monoid into an applicative pointwise. >--------------------------------------------------------------- b67e8a3f107f7e7b2cefb526a5f956a4a3abc852 libraries/base/Control/Monad/Fix.hs | 6 ++- libraries/base/Data/Data.hs | 3 ++ libraries/base/Data/Foldable.hs | 4 ++ libraries/base/Data/Monoid.hs | 60 +++++++++++++++++++--- libraries/base/Data/Traversable.hs | 6 ++- libraries/base/changelog.md | 2 + .../tests/annotations/should_fail/annfail10.stderr | 4 +- testsuite/tests/ghci/scripts/T10963.stderr | 2 +- testsuite/tests/polykinds/T13393.stderr | 2 +- .../tests/typecheck/should_compile/T14273.stderr | 4 +- .../tests/typecheck/should_compile/holes2.stderr | 2 +- .../should_compile/valid_substitutions.stderr | 4 +- .../tests/typecheck/should_fail/T10971b.stderr | 8 +-- .../tests/typecheck/should_fail/T12921.stderr | 2 +- .../tests/typecheck/should_fail/T14884.stderr | 2 +- 15 files changed, 87 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 b67e8a3f107f7e7b2cefb526a5f956a4a3abc852 From git at git.haskell.org Mon May 28 07:00:24 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 May 2018 07:00:24 +0000 (UTC) Subject: [commit: ghc] master: Update GHC.Stats docs (a5446c4) Message-ID: <20180528070024.759413ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a5446c4501cf30aa06eab636823d031bb98db739/ghc >--------------------------------------------------------------- commit a5446c4501cf30aa06eab636823d031bb98db739 Author: Ömer Sinan Ağacan Date: Mon May 28 09:59:55 2018 +0300 Update GHC.Stats docs Make it clear that max_live_bytes is updated after a major GC whereas live_bytes is updated after all GCs (including minor collections) and considers data in uncollected generations as live. Reviewers: bgamari, simonmar, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4734 >--------------------------------------------------------------- a5446c4501cf30aa06eab636823d031bb98db739 includes/RtsAPI.h | 7 +++++-- libraries/base/GHC/Stats.hsc | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 69ec607..79c4d8e 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -127,7 +127,9 @@ typedef struct GCDetails_ { uint32_t threads; // Number of bytes allocated since the previous GC uint64_t allocated_bytes; - // Total amount of live data in the heap (incliudes large + compact data) + // Total amount of live data in the heap (incliudes large + compact data). + // Updated after every GC. Data in uncollected generations (in minor GCs) + // are considered live. uint64_t live_bytes; // Total amount of live data in large objects uint64_t large_objects_bytes; @@ -165,7 +167,8 @@ typedef struct _RTSStats { uint32_t major_gcs; // Total bytes allocated uint64_t allocated_bytes; - // Maximum live data (including large objects + compact regions) + // Maximum live data (including large objects + compact regions) in the + // heap. Updated after a major GC. uint64_t max_live_bytes; // Maximum live data in large objects uint64_t max_large_objects_bytes; diff --git a/libraries/base/GHC/Stats.hsc b/libraries/base/GHC/Stats.hsc index d81173f..58b5e22 100644 --- a/libraries/base/GHC/Stats.hsc +++ b/libraries/base/GHC/Stats.hsc @@ -56,7 +56,8 @@ data RTSStats = RTSStats { , major_gcs :: Word32 -- | Total bytes allocated , allocated_bytes :: Word64 - -- | Maximum live data (including large objects + compact regions) + -- | Maximum live data (including large objects + compact regions) in the + -- heap. Updated after a major GC. , max_live_bytes :: Word64 -- | Maximum live data in large objects , max_large_objects_bytes :: Word64 @@ -120,7 +121,9 @@ data GCDetails = GCDetails { , gcdetails_threads :: Word32 -- | Number of bytes allocated since the previous GC , gcdetails_allocated_bytes :: Word64 - -- | Total amount of live data in the heap (incliudes large + compact data) + -- | Total amount of live data in the heap (incliudes large + compact data). + -- Updated after every GC. Data in uncollected generations (in minor GCs) + -- are considered live. , gcdetails_live_bytes :: Word64 -- | Total amount of live data in large objects , gcdetails_large_objects_bytes :: Word64 From git at git.haskell.org Mon May 28 07:03:53 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 May 2018 07:03:53 +0000 (UTC) Subject: [commit: ghc] wip/T14381: ghc-pkg: properly recompute `abi-depends` for updated packages. (7cb9fd8) Message-ID: <20180528070353.677573ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14381 Link : http://ghc.haskell.org/trac/ghc/changeset/7cb9fd83ae6e4de8ffef280cf67d53a9a6d663d4/ghc >--------------------------------------------------------------- commit 7cb9fd83ae6e4de8ffef280cf67d53a9a6d663d4 Author: Tobias Dammers Date: Tue May 22 10:32:03 2018 +0200 ghc-pkg: properly recompute `abi-depends` for updated packages. The `abi-depends:` Cabal field turns out to be problematic due to cached package dependencies; from the perspective of ghc-pkg, this field is unreliable, and also redundant, because the required information is already available in the existing package database. So we do the following: - Ignore declared abi-depends - Infer correct abi-depends from existing package data - Warn about any packages that declare abi-depends that differ from what we inferred - In verbose mode, warn about any packages that declare abi-depends at all. Previous work on this had been done in 1cdc14f9c0, however, that solution suffered from a few minor drawbacks which we fix here: - The previous solution only looked at the current package database; we now inspect the entire stack of databases, to correctly reflect possible dependencies. - We now output warnings on stderr, not stdout. - When issuing a warning, we list the offending packages (otherwise, the warning wouldn't be very useful in practice). - By default, we only warn about packages that deviate (declare abi-depends /= inferred abi-depends). - Warnings can now be controlled through verbosity. - Testsuite reflects new situation. >--------------------------------------------------------------- 7cb9fd83ae6e4de8ffef280cf67d53a9a6d663d4 testsuite/tests/cabal/cabal05/cabal05.stderr | 4 + .../tests/safeHaskell/check/pkg01/safePkg01.stdout | 16 +-- utils/ghc-pkg/Main.hs | 142 ++++++++++++++++++--- 3 files changed, 139 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 7cb9fd83ae6e4de8ffef280cf67d53a9a6d663d4 From git at git.haskell.org Mon May 28 07:47:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 May 2018 07:47:26 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Turn "inaccessible code" error into a warning (b166d8c) Message-ID: <20180528074726.7946E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/b166d8ccb56cc6c7ca56442429a91c7c6dd32121/ghc >--------------------------------------------------------------- commit b166d8ccb56cc6c7ca56442429a91c7c6dd32121 Author: Tobias Dammers Date: Tue May 8 13:54:28 2018 +0200 Turn "inaccessible code" error into a warning With GADTs, it is possible to write programs such that the type constraints make some code branches inaccessible. Take, for example, the following program :: {-# LANGUAGE GADTs #-} data Foo a where Foo1 :: Foo Char Foo2 :: Foo Int data TyEquality a b where Refl :: TyEquality a a checkTEQ :: Foo t -> Foo u -> Maybe (TyEquality t u) checkTEQ x y = error "unimportant" step2 :: Bool step2 = case checkTEQ Foo1 Foo2 of Just Refl -> True -- Inaccessible code Nothing -> False Clearly, the `Just Refl` case cannot ever be reached, because the `Foo1` and `Foo2` constructors say `t ~ Char` and `u ~ Int`, while the `Refl` constructor essentially mandates `t ~ u`, and thus `Char ~ Int`. Previously, GHC would reject such programs entirely; however, in practice this is too harsh. Accepting such code does little harm, since attempting to use the "impossible" code will still produce errors down the chain, while rejecting it means we cannot legally write or generate such code at all. Hence, we turn the error into a warning, and provide `-Winaccessible-code` to control GHC's behavior upon encountering this situation. Test Plan: ./validate GHC Trac issue: #11066 >--------------------------------------------------------------- b166d8ccb56cc6c7ca56442429a91c7c6dd32121 compiler/main/DynFlags.hs | 5 ++++- compiler/typecheck/TcErrors.hs | 2 +- docs/users_guide/using-warnings.rst | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 0406d0e..993d393 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -797,6 +797,7 @@ data WarningFlag = | Opt_WarnMissingHomeModules -- Since 8.2 | Opt_WarnPartialFields -- Since 8.4 | Opt_WarnMissingExportList + | Opt_WarnInaccessibleCode deriving (Eq, Show, Enum) data Language = Haskell98 | Haskell2010 @@ -3755,6 +3756,7 @@ wWarningFlagsDeps = [ flagSpec "redundant-constraints" Opt_WarnRedundantConstraints, flagSpec "duplicate-exports" Opt_WarnDuplicateExports, flagSpec "hi-shadowing" Opt_WarnHiShadows, + flagSpec "inaccessible-code" Opt_WarnInaccessibleCode, flagSpec "implicit-prelude" Opt_WarnImplicitPrelude, flagSpec "incomplete-patterns" Opt_WarnIncompletePatterns, flagSpec "incomplete-record-updates" Opt_WarnIncompletePatternsRecUpd, @@ -4455,7 +4457,8 @@ standardWarnings -- see Note [Documenting warning flags] Opt_WarnUnsupportedLlvmVersion, Opt_WarnTabs, Opt_WarnUnrecognisedWarningFlags, - Opt_WarnSimplifiableClassConstraints + Opt_WarnSimplifiableClassConstraints, + Opt_WarnInaccessibleCode ] -- | Things you get with -W diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 1172c0a..177b1b3 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -710,7 +710,7 @@ mkGivenErrorReporter implic ctxt cts Nothing ty1 ty2 ; traceTc "mkGivenErrorReporter" (ppr ct) - ; maybeReportError ctxt err } + ; reportWarning (Reason Opt_WarnInaccessibleCode) err } where (ct : _ ) = cts -- Never empty (ty1, ty2) = getEqPredTys (ctPred ct) diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index b72ae42..87ddcda 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -33,6 +33,7 @@ generally likely to indicate bugs in your program. These are: * :ghc-flag:`-Wunsupported-llvm-version` * :ghc-flag:`-Wtabs` * :ghc-flag:`-Wunrecognised-warning-flags` + * :ghc-flag:`-Winaccessible-code` The following flags are simple ways to select standard "packages" of warnings: @@ -1088,6 +1089,43 @@ of ``-W(no-)*``. second pattern overlaps it. More often than not, redundant patterns is a programmer mistake/error, so this option is enabled by default. +.. ghc-flag:: -Winaccessible-code + :shortdesc: warn about inaccessible code + :type: dynamic + :reverse: -Wno-inaccessible-code + :category: + + .. index:: + single: inaccessible code, warning + single: inaccessible + + By default, the compiler will warn you if types make a branch inaccessible. + This generally requires GADTs or similar extensions. + + Take, for example, the following program :: + + {-# LANGUAGE GADTs #-} + + data Foo a where + Foo1 :: Foo Char + Foo2 :: Foo Int + + data TyEquality a b where + Refl :: TyEquality a a + + checkTEQ :: Foo t -> Foo u -> Maybe (TyEquality t u) + checkTEQ x y = error "unimportant" + + step2 :: Bool + step2 = case checkTEQ Foo1 Foo2 of + Just Refl -> True -- Inaccessible code + Nothing -> False + + The ``Just Refl`` case in ``step2`` is inaccessible, because in order for + ``checkTEQ`` to be able to produce a ``Just``, ``t ~ u`` must hold, but + since we're passing ``Foo1`` and ``Foo2`` here, it follows that ``t ~ + Char``, and ``u ~ Int``, and thus ``t ~ u`` cannot hold. + .. ghc-flag:: -Wsimplifiable-class-constraints :shortdesc: 2arn about class constraints in a type signature that can be simplified using a top-level instance declaration. From git at git.haskell.org Mon May 28 07:47:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 May 2018 07:47:29 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066's head updated: Turn "inaccessible code" error into a warning (b166d8c) Message-ID: <20180528074729.9B2963ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/tdammers/T11066' now includes: 5de0be8 Add regression tests for #14904 358b508 Compute DW_FORM_block length correctly; also fixes #15068 e34e30e Warn against using Data.Monoid.First 90589a9 document the plan for removing Data.Semigroup.Option cf35ab9 minor improvement to wording of warning against First. Add warning against Last 107d2cb Don't shadow "result" in JUnit driver 1ad0277 CircleCI: Save test results as JUnit XML 75361b1 Fix NUMA support on Windows (#15049) 6132d7c Correctly add unwinding info in manifestSp and makeFixupBlocks 866525a Move the ResponseFile module from haddock into base 721e826 GHCi: Improve the error message for hidden packages 6462d90 rts: Throw better error if --numa is used without libnuma support 79c4f10 Enable warning flags to safe-guard against regressions in `base` 5697432 Normalize T14999 test output some more 33de71f Simplify callSiteInline a little b750dcc testsuite: Bump T9630 allocations as a result of 33de71fa06d0 56e8c6f Update docker images to use GHC 8.4.2 and cabal-install-2.2 13e8bc0 Fix typo in user guide about promoted list 49f5943 rel-notes: Note that -hT is now allowed 426ae98 Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module. 361d23a Normalize the element type of ListPat, fix #14547 0f046aa testsuite: Add test for #15067 cb1ee7e Do not supply `-mcpu` if `-optlc` provides `-mcpu` already. 418881f Use unsafeInsertNew to create timers in TimerManager 6243bba Add 'addWordC#' PrimOp be580b4 Add test for invertability of `Floating` methods. d814dd3 Add hyperbolic functions to test of Float-inverses 3ea3341 Stable area hyperbolic sine for `Double` and `Float`. 46548ed base/changelog: Note stabilization of asinh (#14927) 7271db4 testsuite: Bump T5631 expected allocations 875b61e printStackChunk: recognise a few more ret frames 61b245a Small refactoring in Exitify 5b3104a Used named fields for DataDeclRn aa03ad8 Simplify the kind checking for type/class decls 37acca7 users-guide: Move discussion MAX_PATH out of release notes 280de0c Revert "Normalize the element type of ListPat, fix #14547" 981bf47 Normalize the element type of ListPat, fix #14547 849547b Revert "Normalize the element type of ListPat, fix #14547" ba6e445 Normalize the element type of ListPat, fix #14547 5fe6aaa Add -fghci-leak-check to check for space leaks b2ff5dd Fix #15038 e5bb515 rts: remove unused round_up_to_mblocks function 87e169a Revert "Add -fghci-leak-check to check for space leaks" 40a76c9 BlockAlloc.c: reuse tail_of function cb5c2fe Fix unwinding of C -> Haskell FFI calls with -threaded 3781034 Expand $tooldir in ghc --info output 2323ffd Adds CTRL-C handler in Windows's timeout (trac issue #12721) bec2e71 Revert "Fix unwinding of C -> Haskell FFI calls with -threaded" 78db41e Use correct source spans for EmptyCase 00049e2 Emit info-level log message when package envs are loaded 6ab7cf9 Simplify -ddump-json implementation 9039f84 base: Fix handling of showEFloat (Just 0) f0212a9 TcInteract: Ensure that tycons have representations before solving for Typeable 2188427 Bump array submodule 7c665f9 Refactor LitString eb39f98 Fix a few GCC warnings 2828dbf Fix changelog message for asinh cdbe00f Remove unused things from utils/Digraph d4abd03 rts: Compile with gcc -Og 30c887d GHCi: Include a note in the hint to expose a hidden package 48dee7c Clarify what the FFI spec says bf6cad8 Add note documenting refineDefaultAlt 21e1a00 Fix #14875 by introducing PprPrec, and using it cf88c2b ghc-pkg: Configure handle encodings 8f3c149 Add support for opting out of package environments ca3d303 Fix another batch of `./validate --slow` failures b713986 Improve some Foldable methods for NonEmpty 6d57a92 utils/fs: use , not e408d03 Fix #14973 1e27209 Revert "rts: Compile with gcc -Og" d92c755 Fix performance regressions from #14737 79bbb23 rts: export new absentSumFieldError from base f49f90b Tidy up error suppression df6670e testsuite: Fix expected allocations of T9020 and T12425 9dbf66d Revert "Simplify callSiteInline a little" 45ad0c3 Ensure that RTS cabal file reflects dependency on libnuma 1154c9b More explicit comment on switch in registerDelay af986f9 testsuite: Disable T14697 on Windows 01b15b8 Calling GetLastError() on Windows for socket IO (trac issue #12012) bb338f2 Algebraically simplify add/sub with carry/overflow bb3fa2d Less Tc inside simplCore (Phase 1 for #14391) a18e7df Force findPtr to be included in the binary eb8e692 An overhaul of the SRT representation fbd28e2 Allow CmmLabelDiffOff with different widths 2b0918c Save a word in the info table on x86_64 838b690 Merge FUN_STATIC closure with its SRT 01bb17f Make finalizers more reliable. 3310f7f InfoTables: Fix #if uses introduced by D4634 126b412 Add pprTraceM to Outputable as analog to traceM. 99f8cc8 Fix #15039 by pretty-printing equalities more systematically 4ffaf4b Improve numeric stability of numericEnumFrom for floating numbers 0c7db22 Fix #15073 by suggesting UnboxedTuples in an error message f2d27c1 Comments and refactoring only b701e47 Update Cabal submodule 5f15d53 Add /* fallthrough */ to fix -Wimplicit-fallthrough warning f27e4f6 Fix GHCi space leaks (#15111) 5d3b15e Fix unwinding of C -> Haskell FFI calls with -threaded (2nd try) 819b9cf Add regression tests for #11515 and #12563 797a462 Comments only efe4054 Tiny refactor 2bbdd00 Orient TyVar/TyVar equalities with deepest on the left 5a7c657 Debug tracing only ae292c6 Do not unify representational equalities d78dde9 Fix retainer profiling after SRT overhaul c617c1f base: Add Foldable and Traversable instances for Alt 9171c7f base: Fix typo c4219d9 Another batch of './validation --slow' tweaks 12deb9a rts: Fix compaction of SmallMutArrPtrs ec22f7d Add HeapView functionality e1fd946 ghc-prim: Bump version 1cdc14f ghc-pkg: recompute `abi-depends` for updated packages f2ce86c Do better sharing in the short-cut solver 5f3fb71 Fix perf numbers for #15164 b7e80ae Remove TcType.toTcType 57858fc Make dischargeFmv handle Deriveds af0757d Check for type families in an instance context 97121b6 Revert "ghc-pkg: recompute `abi-depends` for updated packages" db6085b Improve performance of CallArity 928f606 Typo in comments 49a832d Remove special case from TcTyVar level check 86bba7d Add missing check to isReflCoVar_maybe d191db4 Don't expose strictness when sm_inline is False a32c8f7 Use dischargeFunEq consistently d424d4a Fix a bug in SRT generation bf10456 Disable the SRT offset optimisation on MachO platforms 49691c4 testsuite: Bump OS X performance numbers 1879d9d Check for mismatched class methods during typechecking 979f085 Clean up the conflicting data family instances error message 5ca623a Minor typos 5b6ef59 Add -fghci-leak-check to check for space leaks c618732 isDllName: use Opt_ExternalDynamicRefs, not WayDyn 40d5b9e Comments about the substition invariant 11eed2f testsuite: Don't rely on find command in T15038 72835ff Add regression test for #11766 00f7e28 Add regression test for #14172 9ed7e8d Add regression test for #14246 6a9b9b4 Mark #12447's test case as expected to pass b67e8a3 base: Introduce Data.Monoid.Ap a5446c4 Update GHC.Stats docs b166d8c Turn "inaccessible code" error into a warning From git at git.haskell.org Mon May 28 18:29:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 May 2018 18:29:59 +0000 (UTC) Subject: [commit: ghc] master: Fix 32 bit windows build (4778cba) Message-ID: <20180528182959.287703ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4778cba1dbb6adf495930322d7f9e9db0af60d8f/ghc >--------------------------------------------------------------- commit 4778cba1dbb6adf495930322d7f9e9db0af60d8f Author: Tamar Christina Date: Mon May 28 19:19:18 2018 +0100 Fix 32 bit windows build Summary: Fix a number of issues that have broken the 32 bit build. This makes it build again. Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4691 >--------------------------------------------------------------- 4778cba1dbb6adf495930322d7f9e9db0af60d8f libraries/base/System/Environment/ExecutablePath.hsc | 3 ++- rts/Adjustor.c | 1 + rts/win32/OSThreads.c | 2 +- rts/win32/veh_excn.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/base/System/Environment/ExecutablePath.hsc b/libraries/base/System/Environment/ExecutablePath.hsc index 448cade..095b25c 100644 --- a/libraries/base/System/Environment/ExecutablePath.hsc +++ b/libraries/base/System/Environment/ExecutablePath.hsc @@ -40,6 +40,7 @@ import Foreign.C import Foreign.Marshal.Array import Foreign.Ptr #include +#include #else import Foreign.C import Foreign.Marshal.Alloc @@ -169,7 +170,7 @@ getExecutablePath = go 2048 -- plenty, PATH_MAX is 512 under Win32 getFinalPath :: FilePath -> IO FilePath getFinalPath path = withCWString path $ \s -> bracket (createFile s) c_closeHandle $ \h -> do - let invalid = h == wordPtrToPtr (#const INVALID_HANDLE_VALUE) + let invalid = h == wordPtrToPtr (#const (intptr_t)INVALID_HANDLE_VALUE) if invalid then pure path else go h bufSize where go h sz = allocaArray (fromIntegral sz) $ \outPath -> do diff --git a/rts/Adjustor.c b/rts/Adjustor.c index f2b4355..a1bfeb9 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -357,6 +357,7 @@ static int totalArgumentSize(char *typeString) sz += 2; break; } + /* fall through */ // everything else is one word. default: sz += 1; diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c index cc67353..c67d621 100644 --- a/rts/win32/OSThreads.c +++ b/rts/win32/OSThreads.c @@ -578,7 +578,7 @@ void setThreadNode (uint32_t node) { if (osNumaAvailable()) { - StgWord mask = 0; + uint64_t mask = 0; if (!GetNumaNodeProcessorMask(node, &mask) && !SetThreadAffinityMask(GetCurrentThread(), mask)) { sysErrorBelch( diff --git a/rts/win32/veh_excn.c b/rts/win32/veh_excn.c index a4e5ef6..2d9de52 100644 --- a/rts/win32/veh_excn.c +++ b/rts/win32/veh_excn.c @@ -314,7 +314,7 @@ void generateStack (EXCEPTION_POINTERS* pExceptionPointers) fprintf (stderr, " * 0x%" PRIxPTR "\t%ls\n", (uintptr_t)stackFrame.AddrFrame.Offset, resolveSymbolAddr ((wchar_t*)&buffer, 1024, - (SymbolAddr*)stackFrame.AddrPC.Offset, + (SymbolAddr*)(intptr_t)stackFrame.AddrPC.Offset, &topSp)); if (lastBp >= stackFrame.AddrFrame.Offset) { From git at git.haskell.org Mon May 28 19:05:42 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 May 2018 19:05:42 +0000 (UTC) Subject: [commit: ghc] master: Clean up Windows testsuite failures (60fb2b2) Message-ID: <20180528190542.606673ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60fb2b2160aa16194b74262f4df8fad5af171b0f/ghc >--------------------------------------------------------------- commit 60fb2b2160aa16194b74262f4df8fad5af171b0f Author: Tamar Christina Date: Mon May 28 19:34:11 2018 +0100 Clean up Windows testsuite failures Summary: Another round and attempt at getting these down to 0. We really should re-enable the CI and not wait for those cloud based ones. I've disabled the backpack tests on windows as they are too broad, they test as much the shell as they do the compiler. The perf tests have been too long to track down. but the numbers are horrible but I don't see them getting fixed so just have to accept them. T9293 has new windows specific output because a Dyn way only flag was added. This will of course not work on non-Dyn way builds. Test Plan: ./validate Reviewers: bgamari, hvr, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15107 Differential Revision: https://phabricator.haskell.org/D4668 >--------------------------------------------------------------- 60fb2b2160aa16194b74262f4df8fad5af171b0f libraries/base/tests/System/all.T | 2 +- libraries/base/tests/all.T | 17 ++++++++++++++++- .../{tempfiles.stdout => tempfiles.stdout-mingw32} | 8 ++++---- testsuite/driver/testlib.py | 4 ++++ testsuite/tests/backpack/cabal/bkpcabal06/all.T | 3 ++- testsuite/tests/backpack/cabal/bkpcabal07/all.T | 3 ++- .../ghci/scripts/{T9293.stdout => T9293.stdout-mingw32} | 8 -------- .../scripts/{ghci024.stdout => ghci024.stdout-mingw32} | 1 - .../scripts/{T9293.stdout => ghci057.stdout-mingw32} | 8 -------- testsuite/tests/perf/compiler/all.T | 1 + testsuite/tests/perf/should_run/all.T | 6 ++++-- testsuite/tests/rts/all.T | 5 +++-- 12 files changed, 37 insertions(+), 29 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 60fb2b2160aa16194b74262f4df8fad5af171b0f From git at git.haskell.org Tue May 29 07:37:18 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 07:37:18 +0000 (UTC) Subject: [commit: ghc] master: Factor stack chunk printing out of printTSO (f804811) Message-ID: <20180529073718.3C4553ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f8048112c2398ed58fbaff8f1c0faeb052a2534a/ghc >--------------------------------------------------------------- commit f8048112c2398ed58fbaff8f1c0faeb052a2534a Author: Ömer Sinan Ağacan Date: Tue May 29 10:36:16 2018 +0300 Factor stack chunk printing out of printTSO Makes it possible to print STACK (StgStack) objects easily in gdb >--------------------------------------------------------------- f8048112c2398ed58fbaff8f1c0faeb052a2534a rts/Printer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rts/Printer.c b/rts/Printer.c index d184423..46a2076 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -624,10 +624,14 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) } } +static void printStack( StgStack *stack ) +{ + printStackChunk( stack->sp, stack->stack + stack->stack_size ); +} + void printTSO( StgTSO *tso ) { - printStackChunk( tso->stackobj->sp, - tso->stackobj->stack+tso->stackobj->stack_size); + printStack( tso->stackobj ); } /* -------------------------------------------------------------------------- From git at git.haskell.org Tue May 29 10:26:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 10:26:48 +0000 (UTC) Subject: [commit: ghc] master: Typofixes [ci skip] (25f01db) Message-ID: <20180529102648.A1E5F3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/25f01db0fa7b20a22136ef770da6361bc3b7a82b/ghc >--------------------------------------------------------------- commit 25f01db0fa7b20a22136ef770da6361bc3b7a82b Author: Gabor Greif Date: Fri May 25 15:33:21 2018 +0200 Typofixes [ci skip] >--------------------------------------------------------------- 25f01db0fa7b20a22136ef770da6361bc3b7a82b compiler/basicTypes/Name.hs | 4 ++-- compiler/main/HscMain.hs | 2 +- utils/genprimopcode/Main.hs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs index 6941dd9..c005c03 100644 --- a/compiler/basicTypes/Name.hs +++ b/compiler/basicTypes/Name.hs @@ -262,7 +262,7 @@ nameIsLocalOrFrom :: Module -> Name -> Bool -- you can find details (type, fixity, instances) in the -- TcGblEnv or TcLclEnv -- --- The isInteractiveModule part is because successive interactions of a GCHi session +-- The isInteractiveModule part is because successive interactions of a GHCi session -- each give rise to a fresh module (Ghci1, Ghci2, etc), but they all come -- from the magic 'interactive' package; and all the details are kept in the -- TcLclEnv, TcGblEnv, NOT in the HPT or EPT. @@ -295,7 +295,7 @@ nameIsHomePackageImport this_mod this_pkg = moduleUnitId this_mod -- | Returns True if the Name comes from some other package: neither this --- pacakge nor the interactive package. +-- package nor the interactive package. nameIsFromExternalPackage :: UnitId -> Name -> Bool nameIsFromExternalPackage this_pkg name | Just mod <- nameModule_maybe name diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 9012025..cf1a4fb 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -918,7 +918,7 @@ hscCheckSafeImports tcg_env = do -- | Validate that safe imported modules are actually safe. For modules in the -- HomePackage (the package the module we are compiling in resides) this just -- involves checking its trust type is 'Safe' or 'Trustworthy'. For modules --- that reside in another package we also must check that the external pacakge +-- that reside in another package we also must check that the external package -- is trusted. See the Note [Safe Haskell Trust Check] above for more -- information. -- diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index 07eab0d..c409050 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -263,7 +263,7 @@ gen_hs_source (Info defaults entries) = ++ "default ()" -- If we don't say this then the default type include Integer -- so that runs off and loads modules that are not part of - -- pacakge ghc-prim at all. And that in turn somehow ends up + -- package ghc-prim at all. And that in turn somehow ends up -- with Declaration for $fEqMaybe: -- attempting to use module ‘GHC.Classes’ -- (libraries/ghc-prim/./GHC/Classes.hs) which is not loaded From git at git.haskell.org Tue May 29 10:26:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 10:26:51 +0000 (UTC) Subject: [commit: ghc] master: remove dead maybeIsLFCon (6848a99) Message-ID: <20180529102651.744763ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6848a992ad38a4b21d1063c8acbbc398b06ab921/ghc >--------------------------------------------------------------- commit 6848a992ad38a4b21d1063c8acbbc398b06ab921 Author: Gabor Greif Date: Mon May 28 14:14:59 2018 +0200 remove dead maybeIsLFCon >--------------------------------------------------------------- 6848a992ad38a4b21d1063c8acbbc398b06ab921 compiler/codeGen/StgCmmClosure.hs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index b021fe0..6f0feaa 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -27,7 +27,7 @@ module StgCmmClosure ( mkApLFInfo, mkLFImported, mkLFArgument, mkLFLetNoEscape, mkLFStringLit, lfDynTag, - maybeIsLFCon, isLFThunk, isLFReEntrant, lfUpdatable, + isLFThunk, isLFReEntrant, lfUpdatable, -- * Used by other modules CgLoc(..), SelfLoopInfo, CallMethod(..), @@ -387,11 +387,6 @@ lfDynTag _ _other = 0 -- Observing LambdaFormInfo ----------------------------------------------------------------------------- -------------- -maybeIsLFCon :: LambdaFormInfo -> Maybe DataCon -maybeIsLFCon (LFCon con) = Just con -maybeIsLFCon _ = Nothing - ------------ isLFThunk :: LambdaFormInfo -> Bool isLFThunk (LFThunk {}) = True From git at git.haskell.org Tue May 29 10:26:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 10:26:54 +0000 (UTC) Subject: [commit: ghc] master: Minor refactoring (d14b1ec) Message-ID: <20180529102654.3FFEA3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d14b1ec658b72f20aceed6835ae37e4c3d5bc5b9/ghc >--------------------------------------------------------------- commit d14b1ec658b72f20aceed6835ae37e4c3d5bc5b9 Author: Gabor Greif Date: Tue May 29 12:16:23 2018 +0200 Minor refactoring >--------------------------------------------------------------- d14b1ec658b72f20aceed6835ae37e4c3d5bc5b9 compiler/main/HscMain.hs | 2 +- compiler/simplCore/SetLevels.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index cf1a4fb..21224eb 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -363,7 +363,7 @@ hscParse' mod_summary srcs0 = nub $ filter (not . (tmpDir dflags `isPrefixOf`)) $ filter (not . (== n_hspp)) $ map FilePath.normalise - $ filter (not . (isPrefixOf "<")) + $ filter (not . isPrefixOf "<") $ map unpackFS $ srcfiles pst srcs1 = case ml_hs_file (ms_location mod_summary) of diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 2b73128..25b2018 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -1648,7 +1648,7 @@ newLvlVar lvld_rhs join_arity_maybe is_mk_static = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise - = mkLocalIdOrCoVar (mkSystemVarName uniq (mkFastString "lvl")) rhs_ty + = mkSysLocalOrCoVar (mkFastString "lvl") uniq rhs_ty cloneCaseBndrs :: LevelEnv -> Level -> [Var] -> LvlM (LevelEnv, [Var]) cloneCaseBndrs env@(LE { le_subst = subst, le_lvl_env = lvl_env, le_env = id_env }) From git at git.haskell.org Tue May 29 10:26:57 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 10:26:57 +0000 (UTC) Subject: [commit: ghc] master: Typofix in manual [ci skip] (36656b9) Message-ID: <20180529102657.0D78F3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36656b9dfbc46da3c915dc453c301d20463899ff/ghc >--------------------------------------------------------------- commit 36656b9dfbc46da3c915dc453c301d20463899ff Author: Gabor Greif Date: Tue May 29 12:15:18 2018 +0200 Typofix in manual [ci skip] >--------------------------------------------------------------- 36656b9dfbc46da3c915dc453c301d20463899ff docs/users_guide/debugging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index ada0018..370fa4a 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -235,7 +235,7 @@ subexpression elimination pass. :shortdesc: Dump simplifier stats :type: dynamic - Dump statistics about how many of each kind of transformation too + Dump statistics about how many of each kind of transformation took place. If you add ``-dppr-debug`` you get more detailed information. .. ghc-flag:: -dverbose-core2core From git at git.haskell.org Tue May 29 17:25:01 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 17:25:01 +0000 (UTC) Subject: [commit: ghc] tag 'ghc-8.4.3-release' created Message-ID: <20180529172501.288A73ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New tag : ghc-8.4.3-release Referencing: 949341c3733086867f2a51215db4d3ebc799ffa6 From git at git.haskell.org Tue May 29 17:25:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 17:25:03 +0000 (UTC) Subject: [commit: ghc] : Set RELEASE=YES, version 8.4.3 (c70d515) Message-ID: <20180529172503.F06573ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/c70d515e48e573e60a6be6705d4ad2eb8c862c8b/ghc >--------------------------------------------------------------- commit c70d515e48e573e60a6be6705d4ad2eb8c862c8b Author: Ben Gamari Date: Sun May 20 18:52:53 2018 -0400 Set RELEASE=YES, version 8.4.3 >--------------------------------------------------------------- c70d515e48e573e60a6be6705d4ad2eb8c862c8b configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8bed181..255f0f3 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.2], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.4.3], [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 Tue May 29 17:25:07 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 17:25:07 +0000 (UTC) Subject: [commit: ghc] : users guide: initial commit of 8.4.3 release notes (daa4de1) Message-ID: <20180529172507.108983ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/daa4de1f81149c63d322a1c332662d7ff5a2a070/ghc >--------------------------------------------------------------- commit daa4de1f81149c63d322a1c332662d7ff5a2a070 Author: Ben Gamari Date: Sun May 20 19:06:35 2018 -0400 users guide: initial commit of 8.4.3 release notes >--------------------------------------------------------------- daa4de1f81149c63d322a1c332662d7ff5a2a070 .../{8.4.2-notes.rst => 8.4.3-notes.rst} | 50 +++++++--------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/docs/users_guide/8.4.2-notes.rst b/docs/users_guide/8.4.3-notes.rst similarity index 63% copy from docs/users_guide/8.4.2-notes.rst copy to docs/users_guide/8.4.3-notes.rst index e36c3be..f931c10 100644 --- a/docs/users_guide/8.4.2-notes.rst +++ b/docs/users_guide/8.4.3-notes.rst @@ -1,6 +1,6 @@ -.. _release-8-4-2: +.. _release-8-4-3: -Release notes for version 8.4.2 +Release notes for version 8.4.3 =============================== Highlights @@ -8,20 +8,18 @@ Highlights This is a bug-fix release resolving several regressions introduced in 8.4.1. -The highlights, since the 8.4.1 release, are: +The highlights, since the 8.4.2 release, are: -- Fixed a regression causing uses of ``Control.Exception.evaluate`` to be - incorrectly optimised, resulting in incorrect evaluation behavior - (:ghc-ticket:`13930`) +- A bug (:ghc-ticket:`15068`) causing GHC to produce assembler that would be rejected by + some versions of GNU Binutils, has been fixed. -- Fix a regression causing the interpreter to segmentation fault when built with - profiling (:ghc-ticket:`14705`) +- ``GHC.Compact.compact`` now properly handles ``SmallArray``\ s (:ghc-ticket:`13857`) -- DWARF debug information support has been significantly improved - (:ghc-ticket:`14894`, :ghc-ticket:`14779`) +- A bug (:ghc-ticket:`15038`) resulting in memory corruption and crashes in some uses of + unboxed sums has been fixed. -- A regression in runtime performance of code involving ``newtype``\s has been - fixed (:ghc-ticket:`14936`) +- GHC now logs a message when an :ref:`environment file ` + is loaded (:ghc-ticket:`15145`). Full details ------------ @@ -32,25 +30,15 @@ other issues, described below. Compiler ~~~~~~~~ -- 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. +No changes beyond those listed in Highlights. Runtime system ~~~~~~~~~~~~~~ -- A bug causing panics while running programs with retainer profiling - (:rts-flag:`-hr`) was fixed (:ghc-ticket:`14947`) +- A bug causing aggressive potentially resulting in crashes when + (:rts-flag:`nursery chunks <-n ⟨size⟩>`) are used with a changing capability + count has been fixed. Template Haskell ~~~~~~~~~~~~~~~~ @@ -74,18 +62,12 @@ No changes. ``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. +No changes. 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`) +No changes. Included libraries ------------------ From git at git.haskell.org Tue May 29 17:25:09 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 17:25:09 +0000 (UTC) Subject: [commit: ghc] : ghc-pkg: recompute `abi-depends` for updated packages (51abb1c) Message-ID: <20180529172509.D73E13ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : Link : http://ghc.haskell.org/trac/ghc/changeset/51abb1c88b53e2989a2a8c2939ac4abc04bef194/ghc >--------------------------------------------------------------- commit 51abb1c88b53e2989a2a8c2939ac4abc04bef194 Author: Austin Seipp Date: Sun May 20 13:25:09 2018 -0400 ghc-pkg: recompute `abi-depends` for updated packages See `Note [Recompute abi-depends]` for more information. Signed-off-by: Austin Seipp Test Plan: `./validate` Reviewers: bgamari, ezyang Reviewed By: bgamari Subscribers: tdammers, juhp, carter, alexbiehl, shlevy, cocreature, rwbarton, thomie GHC Trac Issues: #14381 Differential Revision: https://phabricator.haskell.org/D4159 (cherry picked from commit 1cdc14f9c014f1a520638f7c0a01799ac6d104e6) >--------------------------------------------------------------- 51abb1c88b53e2989a2a8c2939ac4abc04bef194 .../backpack/cabal/bkpcabal02/bkpcabal02.stdout | 5 +++ testsuite/tests/cabal/T12485a.stdout | 1 + testsuite/tests/cabal/T5442d.stdout | 1 + testsuite/tests/cabal/cabal01/cabal01.stdout | 1 + testsuite/tests/cabal/cabal06/cabal06.stdout | 4 ++ testsuite/tests/cabal/cabal08/cabal08.stdout | 2 + testsuite/tests/cabal/shadow.stdout | 1 + testsuite/tests/driver/recomp007/recomp007.stdout | 2 + .../tests/safeHaskell/check/pkg01/safePkg01.stdout | 20 +++++---- testsuite/tests/typecheck/T13168/T13168.stdout | 2 + utils/ghc-pkg/Main.hs | 52 +++++++++++++++++++++- 11 files changed, 82 insertions(+), 9 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 51abb1c88b53e2989a2a8c2939ac4abc04bef194 From git at git.haskell.org Tue May 29 19:31:38 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 19:31:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.4's head updated: ghc-pkg: recompute `abi-depends` for updated packages (51abb1c) Message-ID: <20180529193138.11CA13ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'ghc-8.4' now includes: c70d515 Set RELEASE=YES, version 8.4.3 daa4de1 users guide: initial commit of 8.4.3 release notes 51abb1c ghc-pkg: recompute `abi-depends` for updated packages From git at git.haskell.org Tue May 29 20:57:47 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 20:57:47 +0000 (UTC) Subject: [commit: ghc] master: Use a less confusing type variable in a few types (9969863) Message-ID: <20180529205747.2BF8C3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9969863adbd8f467d029254b5520c3340dacd980/ghc >--------------------------------------------------------------- commit 9969863adbd8f467d029254b5520c3340dacd980 Author: Simon Jakobi Date: Mon May 21 20:04:07 2018 +0200 Use a less confusing type variable in a few types >--------------------------------------------------------------- 9969863adbd8f467d029254b5520c3340dacd980 compiler/hsSyn/HsImpExp.hs | 4 ++-- compiler/hsSyn/HsSyn.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/hsSyn/HsImpExp.hs b/compiler/hsSyn/HsImpExp.hs index 6f38ba3..39bd9b7 100644 --- a/compiler/hsSyn/HsImpExp.hs +++ b/compiler/hsSyn/HsImpExp.hs @@ -41,7 +41,7 @@ One per \tr{import} declaration in a module. -} -- | Located Import Declaration -type LImportDecl name = Located (ImportDecl name) +type LImportDecl pass = Located (ImportDecl pass) -- ^ When in a list this may have -- -- - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSemi' @@ -166,7 +166,7 @@ type LIEWrappedName name = Located (IEWrappedName name) -- | Located Import or Export -type LIE name = Located (IE name) +type LIE pass = Located (IE pass) -- ^ When in a list this may have -- -- - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma' diff --git a/compiler/hsSyn/HsSyn.hs b/compiler/hsSyn/HsSyn.hs index b9abcf2..e04abbf 100644 --- a/compiler/hsSyn/HsSyn.hs +++ b/compiler/hsSyn/HsSyn.hs @@ -63,12 +63,12 @@ import Data.Data hiding ( Fixity ) -- | Haskell Module -- -- All we actually declare here is the top-level structure for a module. -data HsModule name +data HsModule pass = HsModule { hsmodName :: Maybe (Located ModuleName), -- ^ @Nothing@: \"module X where\" is omitted (in which case the next -- field is Nothing too) - hsmodExports :: Maybe (Located [LIE name]), + hsmodExports :: Maybe (Located [LIE pass]), -- ^ Export list -- -- - @Nothing@: export list omitted, so export everything @@ -82,11 +82,11 @@ data HsModule name -- ,'ApiAnnotation.AnnClose' -- For details on above see note [Api annotations] in ApiAnnotation - hsmodImports :: [LImportDecl name], + hsmodImports :: [LImportDecl pass], -- ^ We snaffle interesting stuff out of the imported interfaces early -- on, adding that info to TyDecls/etc; so this list is often empty, -- downstream. - hsmodDecls :: [LHsDecl name], + hsmodDecls :: [LHsDecl pass], -- ^ Type, class, value, and interface signature decls hsmodDeprecMessage :: Maybe (Located WarningTxt), -- ^ reason\/explanation for warning/deprecation of this module From git at git.haskell.org Tue May 29 20:57:49 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 20:57:49 +0000 (UTC) Subject: [commit: ghc] master: base: Improve zip documentation (576078a) Message-ID: <20180529205749.E8F873ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/576078a8a126f24c3dfdd16e2b6d1db50dd9050f/ghc >--------------------------------------------------------------- commit 576078a8a126f24c3dfdd16e2b6d1db50dd9050f Author: Taylor Fausak Date: Tue May 22 09:29:43 2018 -0400 base: Improve zip documentation >--------------------------------------------------------------- 576078a8a126f24c3dfdd16e2b6d1db50dd9050f libraries/base/GHC/List.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index af50213..793ff49 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -947,12 +947,19 @@ foldr2_left k _z x r (y:ys) = k x y (r ys) ---------------------------------------------- -- | 'zip' takes two lists and returns a list of corresponding pairs. +-- +-- > zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')] +-- -- If one input list is short, excess elements of the longer list are --- discarded. +-- discarded: +-- +-- > zip [1] ['a', 'b'] = [(1, 'a')] +-- > zip [1, 2] ['a'] = [(1, 'a')] -- -- 'zip' is right-lazy: -- -- > zip [] _|_ = [] +-- > zip _|_ [] = _|_ {-# NOINLINE [1] zip #-} zip :: [a] -> [b] -> [(a,b)] zip [] _bs = [] From git at git.haskell.org Tue May 29 20:57:52 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 20:57:52 +0000 (UTC) Subject: [commit: ghc] master: Unmask readMVar in readChan (5e91cde) Message-ID: <20180529205752.B54AA3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5e91cdecc39d326e7fc42b3ea41de66c2302484f/ghc >--------------------------------------------------------------- commit 5e91cdecc39d326e7fc42b3ea41de66c2302484f Author: David Feuer Date: Tue May 29 16:51:16 2018 -0400 Unmask readMVar in readChan When `readMVar` was implemented using `takeMVar` and `putMVar`, we needed to use `modifyMVarMasked` in `readChan` just in case the `readMVar` was interrupted between taking and putting. Now that `readMVar` uses an atomic primop, this is impossible, so we can safely unmask `readMVar`. Reviewers: hvr, bgamari, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4738 >--------------------------------------------------------------- 5e91cdecc39d326e7fc42b3ea41de66c2302484f libraries/base/Control/Concurrent/Chan.hs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/libraries/base/Control/Concurrent/Chan.hs b/libraries/base/Control/Concurrent/Chan.hs index d752a89..d0fed4a 100644 --- a/libraries/base/Control/Concurrent/Chan.hs +++ b/libraries/base/Control/Concurrent/Chan.hs @@ -106,21 +106,12 @@ writeChan (Chan _ writeVar) val = do -- thread holds a reference to the channel. readChan :: Chan a -> IO a readChan (Chan readVar _) = do - modifyMVarMasked readVar $ \read_end -> do -- Note [modifyMVarMasked] + modifyMVar readVar $ \read_end -> do (ChItem val new_read_end) <- readMVar read_end -- Use readMVar here, not takeMVar, -- else dupChan doesn't work return (new_read_end, val) --- Note [modifyMVarMasked] --- This prevents a theoretical deadlock if an asynchronous exception --- happens during the readMVar while the MVar is empty. In that case --- the read_end MVar will be left empty, and subsequent readers will --- deadlock. Using modifyMVarMasked prevents this. The deadlock can --- be reproduced, but only by expanding readMVar and inserting an --- artificial yield between its takeMVar and putMVar operations. - - -- |Duplicate a 'Chan': the duplicate channel begins empty, but data written to -- either channel from then on will be available from both. Hence this creates -- a kind of broadcast channel, where data written by anyone is seen by From git at git.haskell.org Tue May 29 21:45:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 21:45:25 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix incorrectly capitalized True in testlib.py (fa2d7e1) Message-ID: <20180529214525.4C21D3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa2d7e1b75757bf1f6472f13ab5a09b13e778038/ghc >--------------------------------------------------------------- commit fa2d7e1b75757bf1f6472f13ab5a09b13e778038 Author: Ben Gamari Date: Tue May 29 17:36:13 2018 -0400 testsuite: Fix incorrectly capitalized True in testlib.py >--------------------------------------------------------------- fa2d7e1b75757bf1f6472f13ab5a09b13e778038 testsuite/driver/testlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index e63c118..6e86cdc 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -871,7 +871,7 @@ def do_test(name, way, func, args, files): if_verbose(1, '** pre_cmd was "{0}". Running trace'.format(override_options(opts.pre_cmd))) runCmd('cd "{0}" && strace {1}'.format(opts.testdir, override_options(opts.pre_cmd)), stderr = subprocess.STDOUT, - print_output = true) + print_output = True) result = func(*[name,way] + args) From git at git.haskell.org Tue May 29 21:45:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 May 2018 21:45:28 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Use /usr/bin/env instead of /bin/bash (1245835) Message-ID: <20180529214528.1CEB23ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12458359c9312b0e2b7332a6b527d7dfa4325667/ghc >--------------------------------------------------------------- commit 12458359c9312b0e2b7332a6b527d7dfa4325667 Author: Ben Gamari Date: Tue May 29 17:37:01 2018 -0400 testsuite: Use /usr/bin/env instead of /bin/bash Namely in T13719 and T13701. >--------------------------------------------------------------- 12458359c9312b0e2b7332a6b527d7dfa4325667 testsuite/tests/perf/compiler/genT13701 | 3 ++- testsuite/tests/perf/compiler/genT13719 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/genT13701 b/testsuite/tests/perf/compiler/genT13701 index f2b7c4e..7401cdd 100755 --- a/testsuite/tests/perf/compiler/genT13701 +++ b/testsuite/tests/perf/compiler/genT13701 @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + # Generate $DEPTH layers of modules with $WIDTH modules on each layer # Every module on layer N imports all the modules on layer N-1 # MultiLayerModules.hs imports all the modules from the last layer diff --git a/testsuite/tests/perf/compiler/genT13719 b/testsuite/tests/perf/compiler/genT13719 index ccc078e..886fdd1 100755 --- a/testsuite/tests/perf/compiler/genT13719 +++ b/testsuite/tests/perf/compiler/genT13719 @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + # Generate $DEPTH layers of modules with $WIDTH modules on each layer # Every module on layer N imports all the modules on layer N-1 # $ROOT.hs imports all the modules from the last layer From git at git.haskell.org Wed May 30 08:59:28 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 08:59:28 +0000 (UTC) Subject: [commit: ghc] master: Handle TREC_CHUNK in printClosure (929bbe4) Message-ID: <20180530085928.72C5E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/929bbe4fb2bc701d4820bcf7a1b1ff074f8d6226/ghc >--------------------------------------------------------------- commit 929bbe4fb2bc701d4820bcf7a1b1ff074f8d6226 Author: Ömer Sinan Ağacan Date: Wed May 30 11:55:02 2018 +0300 Handle TREC_CHUNK in printClosure >--------------------------------------------------------------- 929bbe4fb2bc701d4820bcf7a1b1ff074f8d6226 rts/Printer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rts/Printer.c b/rts/Printer.c index 46a2076..ae76a41 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -412,6 +412,9 @@ printClosure( const StgClosure *obj ) (W_)((StgCompactNFData *)obj)->totalW * (W_)sizeof(W_)); break; + case TREC_CHUNK: + debugBelch("TREC_CHUNK\n"); + break; default: //barf("printClosure %d",get_itbl(obj)->type); From git at git.haskell.org Wed May 30 10:10:59 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:10:59 +0000 (UTC) Subject: [commit: ghc] master: Move printMutableList to Printer.c next to other printers (857005a) Message-ID: <20180530101059.1A5BC3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/857005a762a12e021c3cc65b729bd6263b7145fb/ghc >--------------------------------------------------------------- commit 857005a762a12e021c3cc65b729bd6263b7145fb Author: Ömer Sinan Ağacan Date: Wed May 30 13:02:53 2018 +0300 Move printMutableList to Printer.c next to other printers >--------------------------------------------------------------- 857005a762a12e021c3cc65b729bd6263b7145fb rts/Printer.c | 22 +++++++++++++++------- rts/Printer.h | 1 + rts/sm/GCUtils.c | 21 --------------------- rts/sm/GCUtils.h | 5 ----- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/rts/Printer.c b/rts/Printer.c index ae76a41..01f1692 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -425,6 +425,21 @@ printClosure( const StgClosure *obj ) } } +void +printMutableList(bdescr *bd) +{ + StgPtr p; + + debugBelch("mutable list %p: ", bd); + + for (; bd != NULL; bd = bd->link) { + for (p = bd->start; p < bd->free; p++) { + debugBelch("%p (%s), ", (void *)*p, info_type((StgClosure *)*p)); + } + } + debugBelch("\n"); +} + // If you know you have an UPDATE_FRAME, but want to know exactly which. const char *info_update_frame(const StgClosure *closure) { @@ -444,13 +459,6 @@ const char *info_update_frame(const StgClosure *closure) } } -/* -void printGraph( StgClosure *obj ) -{ - printClosure(obj); -} -*/ - static void printSmallBitmap( StgPtr spBottom, StgPtr payload, StgWord bitmap, uint32_t size ) diff --git a/rts/Printer.h b/rts/Printer.h index dd268be..d2eaf01 100644 --- a/rts/Printer.h +++ b/rts/Printer.h @@ -24,6 +24,7 @@ const char * info_update_frame ( const StgClosure *closure ); extern void printClosure ( const StgClosure *obj ); extern void printStackChunk ( StgPtr sp, StgPtr spLim ); extern void printTSO ( StgTSO *tso ); +extern void printMutableList( bdescr *bd ); extern void DEBUG_LoadSymbols( const char *name ); diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 0373c2b..24f7b5e 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -341,24 +341,3 @@ alloc_todo_block (gen_workspace *ws, uint32_t size) return ws->todo_free; } - -/* ----------------------------------------------------------------------------- - * Debugging - * -------------------------------------------------------------------------- */ - -#if defined(DEBUG) -void -printMutableList(bdescr *bd) -{ - StgPtr p; - - debugBelch("mutable list %p: ", bd); - - for (; bd != NULL; bd = bd->link) { - for (p = bd->start; p < bd->free; p++) { - debugBelch("%p (%s), ", (void *)*p, info_type((StgClosure *)*p)); - } - } - debugBelch("\n"); -} -#endif /* DEBUG */ diff --git a/rts/sm/GCUtils.h b/rts/sm/GCUtils.h index 2e2d4b1..3c17449 100644 --- a/rts/sm/GCUtils.h +++ b/rts/sm/GCUtils.h @@ -50,11 +50,6 @@ isPartiallyFull(bdescr *bd) return (bd->free + WORK_UNIT_WORDS < bd->start + BLOCK_SIZE_W); } - -#if defined(DEBUG) -void printMutableList (bdescr *bd); -#endif - // Version of recordMutableGen for use during GC. This uses the // mutable lists attached to the current gc_thread structure, which // are the same as the mutable lists on the Capability. From git at git.haskell.org Wed May 30 10:46:16 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:16 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Fix 32 bit windows build (7abe373) Message-ID: <20180530104616.ED3C63ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/7abe373661d741afa5dce79641a7daf9cb563b3a/ghc >--------------------------------------------------------------- commit 7abe373661d741afa5dce79641a7daf9cb563b3a Author: Tamar Christina Date: Mon May 28 19:19:18 2018 +0100 Fix 32 bit windows build Summary: Fix a number of issues that have broken the 32 bit build. This makes it build again. Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4691 >--------------------------------------------------------------- 7abe373661d741afa5dce79641a7daf9cb563b3a libraries/base/System/Environment/ExecutablePath.hsc | 3 ++- rts/Adjustor.c | 1 + rts/win32/OSThreads.c | 2 +- rts/win32/veh_excn.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/base/System/Environment/ExecutablePath.hsc b/libraries/base/System/Environment/ExecutablePath.hsc index 448cade..095b25c 100644 --- a/libraries/base/System/Environment/ExecutablePath.hsc +++ b/libraries/base/System/Environment/ExecutablePath.hsc @@ -40,6 +40,7 @@ import Foreign.C import Foreign.Marshal.Array import Foreign.Ptr #include +#include #else import Foreign.C import Foreign.Marshal.Alloc @@ -169,7 +170,7 @@ getExecutablePath = go 2048 -- plenty, PATH_MAX is 512 under Win32 getFinalPath :: FilePath -> IO FilePath getFinalPath path = withCWString path $ \s -> bracket (createFile s) c_closeHandle $ \h -> do - let invalid = h == wordPtrToPtr (#const INVALID_HANDLE_VALUE) + let invalid = h == wordPtrToPtr (#const (intptr_t)INVALID_HANDLE_VALUE) if invalid then pure path else go h bufSize where go h sz = allocaArray (fromIntegral sz) $ \outPath -> do diff --git a/rts/Adjustor.c b/rts/Adjustor.c index f2b4355..a1bfeb9 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -357,6 +357,7 @@ static int totalArgumentSize(char *typeString) sz += 2; break; } + /* fall through */ // everything else is one word. default: sz += 1; diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c index cc67353..c67d621 100644 --- a/rts/win32/OSThreads.c +++ b/rts/win32/OSThreads.c @@ -578,7 +578,7 @@ void setThreadNode (uint32_t node) { if (osNumaAvailable()) { - StgWord mask = 0; + uint64_t mask = 0; if (!GetNumaNodeProcessorMask(node, &mask) && !SetThreadAffinityMask(GetCurrentThread(), mask)) { sysErrorBelch( diff --git a/rts/win32/veh_excn.c b/rts/win32/veh_excn.c index a4e5ef6..2d9de52 100644 --- a/rts/win32/veh_excn.c +++ b/rts/win32/veh_excn.c @@ -314,7 +314,7 @@ void generateStack (EXCEPTION_POINTERS* pExceptionPointers) fprintf (stderr, " * 0x%" PRIxPTR "\t%ls\n", (uintptr_t)stackFrame.AddrFrame.Offset, resolveSymbolAddr ((wchar_t*)&buffer, 1024, - (SymbolAddr*)stackFrame.AddrPC.Offset, + (SymbolAddr*)(intptr_t)stackFrame.AddrPC.Offset, &topSp)); if (lastBp >= stackFrame.AddrFrame.Offset) { From git at git.haskell.org Wed May 30 10:46:19 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:19 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Typofixes [ci skip] (2529be0) Message-ID: <20180530104619.B7EB93ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/2529be09068c6d6c8a8e697b5cc219403da7e2a1/ghc >--------------------------------------------------------------- commit 2529be09068c6d6c8a8e697b5cc219403da7e2a1 Author: Gabor Greif Date: Fri May 25 15:33:21 2018 +0200 Typofixes [ci skip] >--------------------------------------------------------------- 2529be09068c6d6c8a8e697b5cc219403da7e2a1 compiler/basicTypes/Name.hs | 4 ++-- compiler/main/HscMain.hs | 2 +- utils/genprimopcode/Main.hs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs index 6941dd9..c005c03 100644 --- a/compiler/basicTypes/Name.hs +++ b/compiler/basicTypes/Name.hs @@ -262,7 +262,7 @@ nameIsLocalOrFrom :: Module -> Name -> Bool -- you can find details (type, fixity, instances) in the -- TcGblEnv or TcLclEnv -- --- The isInteractiveModule part is because successive interactions of a GCHi session +-- The isInteractiveModule part is because successive interactions of a GHCi session -- each give rise to a fresh module (Ghci1, Ghci2, etc), but they all come -- from the magic 'interactive' package; and all the details are kept in the -- TcLclEnv, TcGblEnv, NOT in the HPT or EPT. @@ -295,7 +295,7 @@ nameIsHomePackageImport this_mod this_pkg = moduleUnitId this_mod -- | Returns True if the Name comes from some other package: neither this --- pacakge nor the interactive package. +-- package nor the interactive package. nameIsFromExternalPackage :: UnitId -> Name -> Bool nameIsFromExternalPackage this_pkg name | Just mod <- nameModule_maybe name diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 9012025..cf1a4fb 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -918,7 +918,7 @@ hscCheckSafeImports tcg_env = do -- | Validate that safe imported modules are actually safe. For modules in the -- HomePackage (the package the module we are compiling in resides) this just -- involves checking its trust type is 'Safe' or 'Trustworthy'. For modules --- that reside in another package we also must check that the external pacakge +-- that reside in another package we also must check that the external package -- is trusted. See the Note [Safe Haskell Trust Check] above for more -- information. -- diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index 07eab0d..c409050 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -263,7 +263,7 @@ gen_hs_source (Info defaults entries) = ++ "default ()" -- If we don't say this then the default type include Integer -- so that runs off and loads modules that are not part of - -- pacakge ghc-prim at all. And that in turn somehow ends up + -- package ghc-prim at all. And that in turn somehow ends up -- with Declaration for $fEqMaybe: -- attempting to use module ‘GHC.Classes’ -- (libraries/ghc-prim/./GHC/Classes.hs) which is not loaded From git at git.haskell.org Wed May 30 10:46:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:23 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Clean up Windows testsuite failures (b35fdbc) Message-ID: <20180530104623.A18983ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/b35fdbc660fbe1c36070df298f7a02e986c8a113/ghc >--------------------------------------------------------------- commit b35fdbc660fbe1c36070df298f7a02e986c8a113 Author: Tamar Christina Date: Mon May 28 19:34:11 2018 +0100 Clean up Windows testsuite failures Summary: Another round and attempt at getting these down to 0. We really should re-enable the CI and not wait for those cloud based ones. I've disabled the backpack tests on windows as they are too broad, they test as much the shell as they do the compiler. The perf tests have been too long to track down. but the numbers are horrible but I don't see them getting fixed so just have to accept them. T9293 has new windows specific output because a Dyn way only flag was added. This will of course not work on non-Dyn way builds. Test Plan: ./validate Reviewers: bgamari, hvr, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15107 Differential Revision: https://phabricator.haskell.org/D4668 >--------------------------------------------------------------- b35fdbc660fbe1c36070df298f7a02e986c8a113 libraries/base/tests/System/all.T | 2 +- libraries/base/tests/all.T | 17 ++++++++++++++++- .../{tempfiles.stdout => tempfiles.stdout-mingw32} | 8 ++++---- testsuite/driver/testlib.py | 4 ++++ testsuite/tests/backpack/cabal/bkpcabal06/all.T | 3 ++- testsuite/tests/backpack/cabal/bkpcabal07/all.T | 3 ++- .../ghci/scripts/{T9293.stdout => T9293.stdout-mingw32} | 8 -------- .../scripts/{ghci024.stdout => ghci024.stdout-mingw32} | 1 - .../scripts/{T9293.stdout => ghci057.stdout-mingw32} | 8 -------- testsuite/tests/perf/compiler/all.T | 1 + testsuite/tests/perf/should_run/all.T | 6 ++++-- testsuite/tests/rts/all.T | 5 +++-- 12 files changed, 37 insertions(+), 29 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 b35fdbc660fbe1c36070df298f7a02e986c8a113 From git at git.haskell.org Wed May 30 10:46:26 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:26 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: remove dead maybeIsLFCon (54407b7) Message-ID: <20180530104626.6ECEB3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/54407b768543ad9202f9594ba718723c43d280c2/ghc >--------------------------------------------------------------- commit 54407b768543ad9202f9594ba718723c43d280c2 Author: Gabor Greif Date: Mon May 28 14:14:59 2018 +0200 remove dead maybeIsLFCon >--------------------------------------------------------------- 54407b768543ad9202f9594ba718723c43d280c2 compiler/codeGen/StgCmmClosure.hs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index b021fe0..6f0feaa 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -27,7 +27,7 @@ module StgCmmClosure ( mkApLFInfo, mkLFImported, mkLFArgument, mkLFLetNoEscape, mkLFStringLit, lfDynTag, - maybeIsLFCon, isLFThunk, isLFReEntrant, lfUpdatable, + isLFThunk, isLFReEntrant, lfUpdatable, -- * Used by other modules CgLoc(..), SelfLoopInfo, CallMethod(..), @@ -387,11 +387,6 @@ lfDynTag _ _other = 0 -- Observing LambdaFormInfo ----------------------------------------------------------------------------- -------------- -maybeIsLFCon :: LambdaFormInfo -> Maybe DataCon -maybeIsLFCon (LFCon con) = Just con -maybeIsLFCon _ = Nothing - ------------ isLFThunk :: LambdaFormInfo -> Bool isLFThunk (LFThunk {}) = True From git at git.haskell.org Wed May 30 10:46:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:29 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Factor stack chunk printing out of printTSO (1be0f50) Message-ID: <20180530104629.378DF3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/1be0f5090af1d75458e4b200d1ae2c5a57766a04/ghc >--------------------------------------------------------------- commit 1be0f5090af1d75458e4b200d1ae2c5a57766a04 Author: Ömer Sinan Ağacan Date: Tue May 29 10:36:16 2018 +0300 Factor stack chunk printing out of printTSO Makes it possible to print STACK (StgStack) objects easily in gdb >--------------------------------------------------------------- 1be0f5090af1d75458e4b200d1ae2c5a57766a04 rts/Printer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rts/Printer.c b/rts/Printer.c index d184423..46a2076 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -624,10 +624,14 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) } } +static void printStack( StgStack *stack ) +{ + printStackChunk( stack->sp, stack->stack + stack->stack_size ); +} + void printTSO( StgTSO *tso ) { - printStackChunk( tso->stackobj->sp, - tso->stackobj->stack+tso->stackobj->stack_size); + printStack( tso->stackobj ); } /* -------------------------------------------------------------------------- From git at git.haskell.org Wed May 30 10:46:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:32 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Unmask readMVar in readChan (35e5106) Message-ID: <20180530104632.04C833ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/35e510699dd02bd157a1ceabb0c9495f70665eb7/ghc >--------------------------------------------------------------- commit 35e510699dd02bd157a1ceabb0c9495f70665eb7 Author: David Feuer Date: Tue May 29 16:51:16 2018 -0400 Unmask readMVar in readChan When `readMVar` was implemented using `takeMVar` and `putMVar`, we needed to use `modifyMVarMasked` in `readChan` just in case the `readMVar` was interrupted between taking and putting. Now that `readMVar` uses an atomic primop, this is impossible, so we can safely unmask `readMVar`. Reviewers: hvr, bgamari, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4738 >--------------------------------------------------------------- 35e510699dd02bd157a1ceabb0c9495f70665eb7 libraries/base/Control/Concurrent/Chan.hs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/libraries/base/Control/Concurrent/Chan.hs b/libraries/base/Control/Concurrent/Chan.hs index d752a89..d0fed4a 100644 --- a/libraries/base/Control/Concurrent/Chan.hs +++ b/libraries/base/Control/Concurrent/Chan.hs @@ -106,21 +106,12 @@ writeChan (Chan _ writeVar) val = do -- thread holds a reference to the channel. readChan :: Chan a -> IO a readChan (Chan readVar _) = do - modifyMVarMasked readVar $ \read_end -> do -- Note [modifyMVarMasked] + modifyMVar readVar $ \read_end -> do (ChItem val new_read_end) <- readMVar read_end -- Use readMVar here, not takeMVar, -- else dupChan doesn't work return (new_read_end, val) --- Note [modifyMVarMasked] --- This prevents a theoretical deadlock if an asynchronous exception --- happens during the readMVar while the MVar is empty. In that case --- the read_end MVar will be left empty, and subsequent readers will --- deadlock. Using modifyMVarMasked prevents this. The deadlock can --- be reproduced, but only by expanding readMVar and inserting an --- artificial yield between its takeMVar and putMVar operations. - - -- |Duplicate a 'Chan': the duplicate channel begins empty, but data written to -- either channel from then on will be available from both. Hence this creates -- a kind of broadcast channel, where data written by anyone is seen by From git at git.haskell.org Wed May 30 10:46:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:34 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Use a less confusing type variable in a few types (fb287df) Message-ID: <20180530104634.C42D83ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/fb287dfbff8663513740b9d1fa0f6f8048cd522b/ghc >--------------------------------------------------------------- commit fb287dfbff8663513740b9d1fa0f6f8048cd522b Author: Simon Jakobi Date: Mon May 21 20:04:07 2018 +0200 Use a less confusing type variable in a few types >--------------------------------------------------------------- fb287dfbff8663513740b9d1fa0f6f8048cd522b compiler/hsSyn/HsImpExp.hs | 4 ++-- compiler/hsSyn/HsSyn.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/hsSyn/HsImpExp.hs b/compiler/hsSyn/HsImpExp.hs index 6f38ba3..39bd9b7 100644 --- a/compiler/hsSyn/HsImpExp.hs +++ b/compiler/hsSyn/HsImpExp.hs @@ -41,7 +41,7 @@ One per \tr{import} declaration in a module. -} -- | Located Import Declaration -type LImportDecl name = Located (ImportDecl name) +type LImportDecl pass = Located (ImportDecl pass) -- ^ When in a list this may have -- -- - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSemi' @@ -166,7 +166,7 @@ type LIEWrappedName name = Located (IEWrappedName name) -- | Located Import or Export -type LIE name = Located (IE name) +type LIE pass = Located (IE pass) -- ^ When in a list this may have -- -- - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma' diff --git a/compiler/hsSyn/HsSyn.hs b/compiler/hsSyn/HsSyn.hs index b9abcf2..e04abbf 100644 --- a/compiler/hsSyn/HsSyn.hs +++ b/compiler/hsSyn/HsSyn.hs @@ -63,12 +63,12 @@ import Data.Data hiding ( Fixity ) -- | Haskell Module -- -- All we actually declare here is the top-level structure for a module. -data HsModule name +data HsModule pass = HsModule { hsmodName :: Maybe (Located ModuleName), -- ^ @Nothing@: \"module X where\" is omitted (in which case the next -- field is Nothing too) - hsmodExports :: Maybe (Located [LIE name]), + hsmodExports :: Maybe (Located [LIE pass]), -- ^ Export list -- -- - @Nothing@: export list omitted, so export everything @@ -82,11 +82,11 @@ data HsModule name -- ,'ApiAnnotation.AnnClose' -- For details on above see note [Api annotations] in ApiAnnotation - hsmodImports :: [LImportDecl name], + hsmodImports :: [LImportDecl pass], -- ^ We snaffle interesting stuff out of the imported interfaces early -- on, adding that info to TyDecls/etc; so this list is often empty, -- downstream. - hsmodDecls :: [LHsDecl name], + hsmodDecls :: [LHsDecl pass], -- ^ Type, class, value, and interface signature decls hsmodDeprecMessage :: Maybe (Located WarningTxt), -- ^ reason\/explanation for warning/deprecation of this module From git at git.haskell.org Wed May 30 10:46:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:37 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: base: Improve zip documentation (258b383) Message-ID: <20180530104637.8C8403ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/258b3835e03cdc5893bdf79d3565a0658b7f5f8f/ghc >--------------------------------------------------------------- commit 258b3835e03cdc5893bdf79d3565a0658b7f5f8f Author: Taylor Fausak Date: Tue May 22 09:29:43 2018 -0400 base: Improve zip documentation >--------------------------------------------------------------- 258b3835e03cdc5893bdf79d3565a0658b7f5f8f libraries/base/GHC/List.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index af50213..793ff49 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -947,12 +947,19 @@ foldr2_left k _z x r (y:ys) = k x y (r ys) ---------------------------------------------- -- | 'zip' takes two lists and returns a list of corresponding pairs. +-- +-- > zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')] +-- -- If one input list is short, excess elements of the longer list are --- discarded. +-- discarded: +-- +-- > zip [1] ['a', 'b'] = [(1, 'a')] +-- > zip [1, 2] ['a'] = [(1, 'a')] -- -- 'zip' is right-lazy: -- -- > zip [] _|_ = [] +-- > zip _|_ [] = _|_ {-# NOINLINE [1] zip #-} zip :: [a] -> [b] -> [(a,b)] zip [] _bs = [] From git at git.haskell.org Wed May 30 10:46:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:40 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Minor refactoring (7573ce2) Message-ID: <20180530104640.56CEC3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/7573ce2e9e770f6e09230200f149c014867ada06/ghc >--------------------------------------------------------------- commit 7573ce2e9e770f6e09230200f149c014867ada06 Author: Gabor Greif Date: Tue May 29 12:16:23 2018 +0200 Minor refactoring >--------------------------------------------------------------- 7573ce2e9e770f6e09230200f149c014867ada06 compiler/main/HscMain.hs | 2 +- compiler/simplCore/SetLevels.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index cf1a4fb..21224eb 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -363,7 +363,7 @@ hscParse' mod_summary srcs0 = nub $ filter (not . (tmpDir dflags `isPrefixOf`)) $ filter (not . (== n_hspp)) $ map FilePath.normalise - $ filter (not . (isPrefixOf "<")) + $ filter (not . isPrefixOf "<") $ map unpackFS $ srcfiles pst srcs1 = case ml_hs_file (ms_location mod_summary) of diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 2b73128..25b2018 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -1648,7 +1648,7 @@ newLvlVar lvld_rhs join_arity_maybe is_mk_static = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise - = mkLocalIdOrCoVar (mkSystemVarName uniq (mkFastString "lvl")) rhs_ty + = mkSysLocalOrCoVar (mkFastString "lvl") uniq rhs_ty cloneCaseBndrs :: LevelEnv -> Level -> [Var] -> LvlM (LevelEnv, [Var]) cloneCaseBndrs env@(LE { le_subst = subst, le_lvl_env = lvl_env, le_env = id_env }) From git at git.haskell.org Wed May 30 10:46:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:43 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: testsuite: Fix incorrectly capitalized True in testlib.py (a0f8db4) Message-ID: <20180530104643.221703ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/a0f8db4d0f7bdba75b226abcc45913400e6c647f/ghc >--------------------------------------------------------------- commit a0f8db4d0f7bdba75b226abcc45913400e6c647f Author: Ben Gamari Date: Tue May 29 17:36:13 2018 -0400 testsuite: Fix incorrectly capitalized True in testlib.py >--------------------------------------------------------------- a0f8db4d0f7bdba75b226abcc45913400e6c647f testsuite/driver/testlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index e63c118..6e86cdc 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -871,7 +871,7 @@ def do_test(name, way, func, args, files): if_verbose(1, '** pre_cmd was "{0}". Running trace'.format(override_options(opts.pre_cmd))) runCmd('cd "{0}" && strace {1}'.format(opts.testdir, override_options(opts.pre_cmd)), stderr = subprocess.STDOUT, - print_output = true) + print_output = True) result = func(*[name,way] + args) From git at git.haskell.org Wed May 30 10:46:45 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:45 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Typofix in manual [ci skip] (0210651) Message-ID: <20180530104645.E1A383ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/0210651161fe1cdd26ddfe1870b7ad5cdca70747/ghc >--------------------------------------------------------------- commit 0210651161fe1cdd26ddfe1870b7ad5cdca70747 Author: Gabor Greif Date: Tue May 29 12:15:18 2018 +0200 Typofix in manual [ci skip] >--------------------------------------------------------------- 0210651161fe1cdd26ddfe1870b7ad5cdca70747 docs/users_guide/debugging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index ada0018..370fa4a 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -235,7 +235,7 @@ subexpression elimination pass. :shortdesc: Dump simplifier stats :type: dynamic - Dump statistics about how many of each kind of transformation too + Dump statistics about how many of each kind of transformation took place. If you add ``-dppr-debug`` you get more detailed information. .. ghc-flag:: -dverbose-core2core From git at git.haskell.org Wed May 30 10:46:48 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:48 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Turn "inaccessible code" error into a warning (2d3e275) Message-ID: <20180530104648.AF2AE3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/2d3e275816cb8831e8804217854cae2f1299be6f/ghc >--------------------------------------------------------------- commit 2d3e275816cb8831e8804217854cae2f1299be6f Author: Tobias Dammers Date: Tue May 8 13:54:28 2018 +0200 Turn "inaccessible code" error into a warning With GADTs, it is possible to write programs such that the type constraints make some code branches inaccessible. Take, for example, the following program :: {-# LANGUAGE GADTs #-} data Foo a where Foo1 :: Foo Char Foo2 :: Foo Int data TyEquality a b where Refl :: TyEquality a a checkTEQ :: Foo t -> Foo u -> Maybe (TyEquality t u) checkTEQ x y = error "unimportant" step2 :: Bool step2 = case checkTEQ Foo1 Foo2 of Just Refl -> True -- Inaccessible code Nothing -> False Clearly, the `Just Refl` case cannot ever be reached, because the `Foo1` and `Foo2` constructors say `t ~ Char` and `u ~ Int`, while the `Refl` constructor essentially mandates `t ~ u`, and thus `Char ~ Int`. Previously, GHC would reject such programs entirely; however, in practice this is too harsh. Accepting such code does little harm, since attempting to use the "impossible" code will still produce errors down the chain, while rejecting it means we cannot legally write or generate such code at all. Hence, we turn the error into a warning, and provide `-Winaccessible-code` to control GHC's behavior upon encountering this situation. Test Plan: ./validate GHC Trac issue: #11066 >--------------------------------------------------------------- 2d3e275816cb8831e8804217854cae2f1299be6f compiler/main/DynFlags.hs | 5 ++++- compiler/typecheck/TcErrors.hs | 2 +- docs/users_guide/using-warnings.rst | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 0406d0e..993d393 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -797,6 +797,7 @@ data WarningFlag = | Opt_WarnMissingHomeModules -- Since 8.2 | Opt_WarnPartialFields -- Since 8.4 | Opt_WarnMissingExportList + | Opt_WarnInaccessibleCode deriving (Eq, Show, Enum) data Language = Haskell98 | Haskell2010 @@ -3755,6 +3756,7 @@ wWarningFlagsDeps = [ flagSpec "redundant-constraints" Opt_WarnRedundantConstraints, flagSpec "duplicate-exports" Opt_WarnDuplicateExports, flagSpec "hi-shadowing" Opt_WarnHiShadows, + flagSpec "inaccessible-code" Opt_WarnInaccessibleCode, flagSpec "implicit-prelude" Opt_WarnImplicitPrelude, flagSpec "incomplete-patterns" Opt_WarnIncompletePatterns, flagSpec "incomplete-record-updates" Opt_WarnIncompletePatternsRecUpd, @@ -4455,7 +4457,8 @@ standardWarnings -- see Note [Documenting warning flags] Opt_WarnUnsupportedLlvmVersion, Opt_WarnTabs, Opt_WarnUnrecognisedWarningFlags, - Opt_WarnSimplifiableClassConstraints + Opt_WarnSimplifiableClassConstraints, + Opt_WarnInaccessibleCode ] -- | Things you get with -W diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 1172c0a..177b1b3 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -710,7 +710,7 @@ mkGivenErrorReporter implic ctxt cts Nothing ty1 ty2 ; traceTc "mkGivenErrorReporter" (ppr ct) - ; maybeReportError ctxt err } + ; reportWarning (Reason Opt_WarnInaccessibleCode) err } where (ct : _ ) = cts -- Never empty (ty1, ty2) = getEqPredTys (ctPred ct) diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index b72ae42..87ddcda 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -33,6 +33,7 @@ generally likely to indicate bugs in your program. These are: * :ghc-flag:`-Wunsupported-llvm-version` * :ghc-flag:`-Wtabs` * :ghc-flag:`-Wunrecognised-warning-flags` + * :ghc-flag:`-Winaccessible-code` The following flags are simple ways to select standard "packages" of warnings: @@ -1088,6 +1089,43 @@ of ``-W(no-)*``. second pattern overlaps it. More often than not, redundant patterns is a programmer mistake/error, so this option is enabled by default. +.. ghc-flag:: -Winaccessible-code + :shortdesc: warn about inaccessible code + :type: dynamic + :reverse: -Wno-inaccessible-code + :category: + + .. index:: + single: inaccessible code, warning + single: inaccessible + + By default, the compiler will warn you if types make a branch inaccessible. + This generally requires GADTs or similar extensions. + + Take, for example, the following program :: + + {-# LANGUAGE GADTs #-} + + data Foo a where + Foo1 :: Foo Char + Foo2 :: Foo Int + + data TyEquality a b where + Refl :: TyEquality a a + + checkTEQ :: Foo t -> Foo u -> Maybe (TyEquality t u) + checkTEQ x y = error "unimportant" + + step2 :: Bool + step2 = case checkTEQ Foo1 Foo2 of + Just Refl -> True -- Inaccessible code + Nothing -> False + + The ``Just Refl`` case in ``step2`` is inaccessible, because in order for + ``checkTEQ`` to be able to produce a ``Just``, ``t ~ u`` must hold, but + since we're passing ``Foo1`` and ``Foo2`` here, it follows that ``t ~ + Char``, and ``u ~ Int``, and thus ``t ~ u`` cannot hold. + .. ghc-flag:: -Wsimplifiable-class-constraints :shortdesc: 2arn about class constraints in a type signature that can be simplified using a top-level instance declaration. From git at git.haskell.org Wed May 30 10:46:51 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:51 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: testsuite: Use /usr/bin/env instead of /bin/bash (ea6c689) Message-ID: <20180530104651.7B8AA3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/ea6c6896fafa696cb89504014f76c18b3fd17a7b/ghc >--------------------------------------------------------------- commit ea6c6896fafa696cb89504014f76c18b3fd17a7b Author: Ben Gamari Date: Tue May 29 17:37:01 2018 -0400 testsuite: Use /usr/bin/env instead of /bin/bash Namely in T13719 and T13701. >--------------------------------------------------------------- ea6c6896fafa696cb89504014f76c18b3fd17a7b testsuite/tests/perf/compiler/genT13701 | 3 ++- testsuite/tests/perf/compiler/genT13719 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/genT13701 b/testsuite/tests/perf/compiler/genT13701 index f2b7c4e..7401cdd 100755 --- a/testsuite/tests/perf/compiler/genT13701 +++ b/testsuite/tests/perf/compiler/genT13701 @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + # Generate $DEPTH layers of modules with $WIDTH modules on each layer # Every module on layer N imports all the modules on layer N-1 # MultiLayerModules.hs imports all the modules from the last layer diff --git a/testsuite/tests/perf/compiler/genT13719 b/testsuite/tests/perf/compiler/genT13719 index ccc078e..886fdd1 100755 --- a/testsuite/tests/perf/compiler/genT13719 +++ b/testsuite/tests/perf/compiler/genT13719 @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + # Generate $DEPTH layers of modules with $WIDTH modules on each layer # Every module on layer N imports all the modules on layer N-1 # $ROOT.hs imports all the modules from the last layer From git at git.haskell.org Wed May 30 10:46:54 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 10:46:54 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Make some tests pass (70cbf00) Message-ID: <20180530104654.43F993ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/70cbf008126ab2ba3abc416ed77ea15a3ade6104/ghc >--------------------------------------------------------------- commit 70cbf008126ab2ba3abc416ed77ea15a3ade6104 Author: Tobias Dammers Date: Wed May 30 10:46:52 2018 +0200 Make some tests pass >--------------------------------------------------------------- 70cbf008126ab2ba3abc416ed77ea15a3ade6104 testsuite/tests/gadt/T3651.stderr | 27 ++++++++-------------- testsuite/tests/gadt/T7294.stderr | 2 +- testsuite/tests/gadt/T7558.stderr | 13 +++++------ testsuite/tests/ghci/scripts/Defer02.stderr | 2 +- .../typecheck/should_fail/FrozenErrorTests.stderr | 9 -------- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/testsuite/tests/gadt/T3651.stderr b/testsuite/tests/gadt/T3651.stderr index 14216eb..62e3bf1 100644 --- a/testsuite/tests/gadt/T3651.stderr +++ b/testsuite/tests/gadt/T3651.stderr @@ -1,21 +1,14 @@ -T3651.hs:11:11: error: - • Couldn't match type ‘Bool’ with ‘()’ - Inaccessible code in - a pattern with constructor: U :: Z (), in an equation for ‘unsafe1’ - • In the pattern: U +T3651.hs:11:15: error: + • Couldn't match type ‘()’ with ‘Bool’ + Expected type: a + Actual type: () + • In the expression: () In an equation for ‘unsafe1’: unsafe1 B U = () -T3651.hs:14:11: error: - • Couldn't match type ‘Bool’ with ‘()’ - Inaccessible code in - a pattern with constructor: U :: Z (), in an equation for ‘unsafe2’ - • In the pattern: U +T3651.hs:14:15: error: + • Couldn't match type ‘()’ with ‘Bool’ + Expected type: a + Actual type: () + • In the expression: () In an equation for ‘unsafe2’: unsafe2 B U = () - -T3651.hs:17:11: error: - • Couldn't match type ‘Bool’ with ‘()’ - Inaccessible code in - a pattern with constructor: U :: Z (), in an equation for ‘unsafe3’ - • In the pattern: U - In an equation for ‘unsafe3’: unsafe3 B U = True diff --git a/testsuite/tests/gadt/T7294.stderr b/testsuite/tests/gadt/T7294.stderr index 2782b8a..63b3e0e 100644 --- a/testsuite/tests/gadt/T7294.stderr +++ b/testsuite/tests/gadt/T7294.stderr @@ -3,7 +3,7 @@ T7294.hs:25:1: warning: [-Woverlapping-patterns (in -Wdefault)] Pattern match is redundant In an equation for ‘nth’: nth Nil _ = ... -T7294.hs:25:5: warning: [-Wdeferred-type-errors (in -Wdefault)] +T7294.hs:25:5: warning: [-Winaccessible-code (in -Wdefault)] • Couldn't match type ‘'True’ with ‘'False’ Inaccessible code in a pattern with constructor: Nil :: forall a. Vec a 'Zero, diff --git a/testsuite/tests/gadt/T7558.stderr b/testsuite/tests/gadt/T7558.stderr index f3d7436..29d7fa6 100644 --- a/testsuite/tests/gadt/T7558.stderr +++ b/testsuite/tests/gadt/T7558.stderr @@ -1,11 +1,10 @@ -T7558.hs:8:4: error: +T7558.hs:8:18: error: • Occurs check: cannot construct the infinite type: a ~ Maybe a - Inaccessible code in - a pattern with constructor: - MkT :: forall a b. (a ~ Maybe b) => a -> Maybe b -> T a b, - in an equation for ‘f’ - • In the pattern: MkT x y - In an equation for ‘f’: f (MkT x y) = [x, y] `seq` True + • In the expression: y + In the first argument of ‘seq’, namely ‘[x, y]’ + In the expression: [x, y] `seq` True • Relevant bindings include + y :: Maybe a (bound at T7558.hs:8:10) + x :: a (bound at T7558.hs:8:8) f :: T a a -> Bool (bound at T7558.hs:8:1) diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index 5aa67f0..33c82bb 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -21,7 +21,7 @@ Defer01.hs:25:1: warning: [-Woverlapping-patterns (in -Wdefault)] Pattern match has inaccessible right hand side In an equation for ‘c’: c (C2 x) = ... -Defer01.hs:25:4: warning: [-Wdeferred-type-errors (in -Wdefault)] +Defer01.hs:25:4: warning: [-Winaccessible-code (in -Wdefault)] • Couldn't match type ‘Int’ with ‘Bool’ Inaccessible code in a pattern with constructor: C2 :: Bool -> C Bool, diff --git a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr index 6abb044..613d92b 100644 --- a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr +++ b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr @@ -1,13 +1,4 @@ -FrozenErrorTests.hs:12:12: error: - • Couldn't match type ‘Int’ with ‘Bool’ - Inaccessible code in - a pattern with constructor: MkT3 :: forall a. (a ~ Bool) => T a, - in a case alternative - • In the pattern: MkT3 - In a case alternative: MkT3 -> () - In the expression: case x of { MkT3 -> () } - FrozenErrorTests.hs:26:9: error: • Occurs check: cannot construct the infinite type: a ~ [a] arising from a use of ‘goo1’ From git at git.haskell.org Wed May 30 14:02:29 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:02:29 +0000 (UTC) Subject: [commit: ghc] master: llvm-targets: Add versioned ARM targets (e4003b6) Message-ID: <20180530140229.3454A3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e4003b6dc6a84d870116de9f47057c15b1576f36/ghc >--------------------------------------------------------------- commit e4003b6dc6a84d870116de9f47057c15b1576f36 Author: Guillaume GARDET Date: Fri May 18 08:56:28 2018 +0200 llvm-targets: Add versioned ARM targets Namely armv6l-unknown-linux-gnueabihf and armv7l-unknown-linux-gnueabihf. >--------------------------------------------------------------- e4003b6dc6a84d870116de9f47057c15b1576f36 llvm-targets | 4 +++- utils/llvm-targets/gen-data-layout.sh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/llvm-targets b/llvm-targets index 3c9da1e..b67ee6c 100644 --- a/llvm-targets +++ b/llvm-targets @@ -3,10 +3,12 @@ ,("x86_64-unknown-windows", ("e-m:w-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) ,("arm-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align")) ,("armv6-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1136jf-s", "+strict-align")) +,("armv6l-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align")) ,("armv7-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) +,("armv7a-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) +,("armv7l-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) ,("aarch64-unknown-linux-gnu", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) ,("aarch64-unknown-linux", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) -,("armv7a-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) ,("i386-unknown-linux-gnu", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", "")) ,("i386-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", "")) ,("x86_64-unknown-linux-gnu", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) diff --git a/utils/llvm-targets/gen-data-layout.sh b/utils/llvm-targets/gen-data-layout.sh index 4f0b240..3d9ded1 100755 --- a/utils/llvm-targets/gen-data-layout.sh +++ b/utils/llvm-targets/gen-data-layout.sh @@ -22,8 +22,8 @@ TARGETS=( "i386-unknown-windows" "i686-unknown-windows" "x86_64-unknown-windows" # Linux ARM - "arm-unknown-linux-gnueabihf" "armv6-unknown-linux-gnueabihf" - "armv7-unknown-linux-gnueabihf" "armv7a-unknown-linux-gnueabi" + "arm-unknown-linux-gnueabihf" "armv6-unknown-linux-gnueabihf" "armv6l-unknown-linux-gnueabihf" + "armv7-unknown-linux-gnueabihf" "armv7a-unknown-linux-gnueabi" "armv7l-unknown-linux-gnueabihf" "aarch64-unknown-linux-gnu" "aarch64-unknown-linux" # Linux x86 "i386-unknown-linux-gnu" "i386-unknown-linux" "x86_64-unknown-linux-gnu" "x86_64-unknown-linux" From git at git.haskell.org Wed May 30 14:02:32 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:02:32 +0000 (UTC) Subject: [commit: ghc] master: Remove incorrect comment (8fe99c7) Message-ID: <20180530140232.093E13ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8fe99c746261da298c4542640cb11f234838813b/ghc >--------------------------------------------------------------- commit 8fe99c746261da298c4542640cb11f234838813b Author: Simon Jakobi Date: Sun May 27 01:03:58 2018 +0200 Remove incorrect comment Moving fingerprintByteString to GHC.Fingerprint would require adding a dependency on bytestring to base. >--------------------------------------------------------------- 8fe99c746261da298c4542640cb11f234838813b compiler/utils/Fingerprint.hsc | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/utils/Fingerprint.hsc b/compiler/utils/Fingerprint.hsc index 4c89ec0..01de554 100644 --- a/compiler/utils/Fingerprint.hsc +++ b/compiler/utils/Fingerprint.hsc @@ -42,7 +42,6 @@ readHexFingerprint s = Fingerprint w1 w2 [(w1,"")] = readHex s1 [(w2,"")] = readHex (take 16 s2) --- this can move to GHC.Fingerprint in GHC 8.6 fingerprintByteString :: BS.ByteString -> Fingerprint fingerprintByteString bs = unsafeDupablePerformIO $ BS.unsafeUseAsCStringLen bs $ \(ptr, len) -> fingerprintData (castPtr ptr) len From git at git.haskell.org Wed May 30 14:02:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:02:34 +0000 (UTC) Subject: [commit: ghc] master: Delete duplicate definition of fingerprintByteString (9ded0d6) Message-ID: <20180530140234.C62643ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ded0d6cd43737fa414a99582c2702237249bab0/ghc >--------------------------------------------------------------- commit 9ded0d6cd43737fa414a99582c2702237249bab0 Author: Simon Jakobi Date: Sun May 27 01:19:52 2018 +0200 Delete duplicate definition of fingerprintByteString >--------------------------------------------------------------- 9ded0d6cd43737fa414a99582c2702237249bab0 compiler/basicTypes/Module.hs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs index 5b198b3..e4dc1a8 100644 --- a/compiler/basicTypes/Module.hs +++ b/compiler/basicTypes/Module.hs @@ -151,13 +151,10 @@ import Util import Data.List import Data.Ord import GHC.PackageDb (BinaryStringRep(..), DbUnitIdModuleRep(..), DbModule(..), DbUnitId(..)) +import Fingerprint import qualified Data.ByteString as BS -import qualified Data.ByteString.Unsafe as BS import qualified Data.ByteString.Char8 as BS.Char8 -import System.IO.Unsafe -import Foreign.Ptr (castPtr) -import GHC.Fingerprint import Encoding import qualified Text.ParserCombinators.ReadP as Parse @@ -847,11 +844,6 @@ rawHashUnitId sorted_holes = fastStringToByteString (unitIdFS (moduleUnitId b)), BS.Char8.singleton ':', toStringRep (moduleName b), BS.Char8.singleton '\n'] -fingerprintByteString :: BS.ByteString -> Fingerprint -fingerprintByteString bs = unsafePerformIO - . BS.unsafeUseAsCStringLen bs - $ \(p,l) -> fingerprintData (castPtr p) l - fingerprintUnitId :: BS.ByteString -> Fingerprint -> BS.ByteString fingerprintUnitId prefix (Fingerprint a b) = BS.concat From git at git.haskell.org Wed May 30 14:02:37 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:02:37 +0000 (UTC) Subject: [commit: ghc] master: Fix validate for GHCi without TABLES_NEXT_TO_CODE (bdfc85b) Message-ID: <20180530140237.931C83ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bdfc85b8cbcb49cc879aebad4cc1b50123f8c02c/ghc >--------------------------------------------------------------- commit bdfc85b8cbcb49cc879aebad4cc1b50123f8c02c Author: Peter Trommler Date: Sun May 27 11:11:37 2018 -0400 Fix validate for GHCi without TABLES_NEXT_TO_CODE Suppress warning about unused match. Fixes #15187 Reviewers: bgamari, simonmar, erikd, hvr Reviewed By: bgamari, simonmar Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4741 >--------------------------------------------------------------- bdfc85b8cbcb49cc879aebad4cc1b50123f8c02c libraries/ghci/GHCi/InfoTable.hsc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc index cd712ba..ca57572 100644 --- a/libraries/ghci/GHCi/InfoTable.hsc +++ b/libraries/ghci/GHCi/InfoTable.hsc @@ -320,11 +320,11 @@ data StgConInfoTable = StgConInfoTable { pokeConItbl :: Ptr StgConInfoTable -> Ptr StgConInfoTable -> StgConInfoTable -> IO () -pokeConItbl wr_ptr ex_ptr itbl = do +pokeConItbl wr_ptr _ex_ptr itbl = do #if defined(TABLES_NEXT_TO_CODE) -- Write the offset to the con_desc from the end of the standard InfoTable -- at the first byte. - let con_desc_offset = conDesc itbl `minusPtr` (ex_ptr `plusPtr` conInfoTableSizeB) + let con_desc_offset = conDesc itbl `minusPtr` (_ex_ptr `plusPtr` conInfoTableSizeB) (#poke StgConInfoTable, con_desc) wr_ptr con_desc_offset #else -- Write the con_desc address after the end of the info table. From git at git.haskell.org Wed May 30 14:02:40 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:02:40 +0000 (UTC) Subject: [commit: ghc] master: Improve the documentation of lexically scoped type variables (2ea93a7) Message-ID: <20180530140240.61B043ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ea93a7db7dcd9381b6d9e017ff015addd2adf5c/ghc >--------------------------------------------------------------- commit 2ea93a7db7dcd9381b6d9e017ff015addd2adf5c Author: AntC Date: Sat May 19 19:23:39 2018 +1200 Improve the documentation of lexically scoped type variables Section 10.16 in the Users Guide. Also reviewed mentions/links from other sections: none need revision. Fixes #15146. >--------------------------------------------------------------- 2ea93a7db7dcd9381b6d9e017ff015addd2adf5c docs/users_guide/glasgow_exts.rst | 87 ++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 23 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 90ccb44..0de1a7a 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9809,6 +9809,18 @@ Lexically scoped type variables Enable lexical scoping of type variables explicitly introduced with ``forall``. +.. tip:: + + ``ScopedTypeVariables`` breaks GHC's usual rule that explicit ``forall`` is optional and doesn't affect semantics. + For the :ref:`decl-type-sigs` (or :ref:`exp-type-sigs`) examples in this section, + the explicit ``forall`` is required. + (If omitted, usually the program will not compile; in a few cases it will compile but the functions get a different signature.) + To trigger those forms of ``ScopedTypeVariables``, the ``forall`` must appear against the top-level signature (or outer expression) + but *not* against nested signatures referring to the same type variables. + + Explicit ``forall`` is not always required -- see :ref:`pattern signature equivalent pattern-equiv-form` for the example in this section, or :ref:`pattern-type-sigs` . + + GHC supports *lexically scoped type variables*, without which some type signatures are simply impossible to write. For example: :: @@ -9827,6 +9839,21 @@ signature for ``ys``. In Haskell 98 it is not possible to declare a type for ``ys``; a major benefit of scoped type variables is that it becomes possible to do so. +.. _pattern-equiv-form: + +An equivalent form for that example, avoiding explicit ``forall`` uses :ref:`pattern-type-sigs`: :: + + f :: [a] -> [a] + f (xs :: [aa]) = xs ++ ys + where + ys :: [aa] + ys = reverse xs + +Unlike the ``forall`` form, type variable ``a`` from ``f``'s signature is not scoped over ``f``'s equation(s). +Type variable ``aa`` bound by the pattern signature is scoped over the right-hand side of ``f``'s equation. +(Therefore there is no need to use a distinct type variable; using ``a`` would be equivalent.) + + Overview -------- @@ -9925,10 +9952,12 @@ This only happens if: f3 :: forall a. [a] -> [a] Just f3 = Just (\(x:xs) -> xs ++ [ x :: a ]) -- Not OK! - The binding for ``f3`` is a pattern binding, and so its type - signature does not bring ``a`` into scope. However ``f1`` is a - function binding, and ``f2`` binds a bare variable; in both cases the - type signature brings ``a`` into scope. + ``f1`` is a function binding, and ``f2`` binds a bare variable; + in both cases the type signature brings ``a`` into scope. + However the binding for ``f3`` is a pattern binding, + and so ``f3`` is a fresh variable brought into scope by the pattern, + not connected with top level ``f3``. + Then type variable ``a`` is not in scope of the right-hand side of ``Just f3 = ...``. .. _exp-type-sigs: @@ -9974,17 +10003,28 @@ example: :: f xs = (n, zs) where (ys::[a], n) = (reverse xs, length xs) -- OK - zs::[a] = xs ++ ys -- OK + (zs::[a]) = xs ++ ys -- OK - Just (v::b) = ... -- Not OK; b is not in scope + Just (v::b) = ... -- Not OK; b is not in scope Here, the pattern signatures for ``ys`` and ``zs`` are fine, but the one for ``v`` is not because ``b`` is not in scope. However, in all patterns *other* than pattern bindings, a pattern type signature may mention a type variable that is not in scope; in this -case, *the signature brings that type variable into scope*. This is -particularly important for existential data constructors. For example: :: +case, *the signature brings that type variable into scope*. For example: :: + + -- same f and g as above, now assuming that 'a' is not already in scope + f = \(x::Int, y::a) -> x -- 'a' is in scope on RHS of -> + + g (x::a) = x :: a + + hh (Just (v :: b)) = v :: b + +The pattern type signature makes the type variable available on the right-hand side of the equation. + +Bringing type variables into scope is particularly important +for existential data constructors. For example: :: data T = forall a. MkT [a] @@ -9992,28 +10032,30 @@ particularly important for existential data constructors. For example: :: k (MkT [t::a]) = MkT t3 where - t3::[a] = [t,t,t] + (t3::[a]) = [t,t,t] -Here, the pattern type signature ``(t::a)`` mentions a lexical type -variable that is not already in scope. Indeed, it *cannot* already be in -scope, because it is bound by the pattern match. GHC's rule is that in -this situation (and only then), a pattern type signature can mention a -type variable that is not already in scope; the effect is to bring it -into scope, standing for the existentially-bound type variable. +Here, the pattern type signature ``[t::a]`` mentions a lexical type +variable that is not already in scope. Indeed, it *must not* already be in +scope, because it is bound by the pattern match. +The effect is to bring it into scope, +standing for the existentially-bound type variable. When a pattern type signature binds a type variable in this way, GHC insists that the type variable is bound to a *rigid*, or fully-known, type variable. This means that any user-written type signature always stands for a completely known type. -If all this seems a little odd, we think so too. But we must have *some* -way to bring such type variables into scope, else we could not name -existentially-bound type variables in subsequent type signatures. +It does seem odd that the existentially-bound type variable *must not* +be already in scope. Contrast that usually name-bindings merely shadow +(make a 'hole') in a same-named outer variable's scope. +But we must have *some* way to bring such type variables into scope, +else we could not name existentially-bound type variables +in subsequent type signatures. -This is (now) the *only* situation in which a pattern type signature is -allowed to mention a lexical variable that is not already in scope. For -example, both ``f`` and ``g`` would be illegal if ``a`` was not already -in scope. +Compare the two (identical) definitions for examples ``f``, ``g``; +they are both legal whether or not ``a`` is already in scope. +They differ in that *if* ``a`` is already in scope, the signature constrains +the pattern, rather than the pattern binding the variable. .. _cls-inst-scoped-tyvars: @@ -15668,4 +15710,3 @@ compilation with ``-prof``. On the other hand, as the ``CallStack`` is built up explicitly via the ``HasCallStack`` constraints, it will generally not contain as much information as the simulated call-stacks maintained by the RTS. - From git at git.haskell.org Wed May 30 14:02:43 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:02:43 +0000 (UTC) Subject: [commit: ghc] master: Update repository sub-dir for ghc-heap in ghc-heap.cabal.in (bd429dc) Message-ID: <20180530140243.2B5C93ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bd429dc6e9da62bed13015b44dcb79f77897319c/ghc >--------------------------------------------------------------- commit bd429dc6e9da62bed13015b44dcb79f77897319c Author: Alp Mestanogullari Date: Sun May 27 11:13:37 2018 -0400 Update repository sub-dir for ghc-heap in ghc-heap.cabal.in Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4735 >--------------------------------------------------------------- bd429dc6e9da62bed13015b44dcb79f77897319c libraries/ghc-heap/ghc-heap.cabal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ghc-heap/ghc-heap.cabal.in b/libraries/ghc-heap/ghc-heap.cabal.in index 780dda3..6f9bd2d 100644 --- a/libraries/ghc-heap/ghc-heap.cabal.in +++ b/libraries/ghc-heap/ghc-heap.cabal.in @@ -17,7 +17,7 @@ tested-with: GHC==7.11 source-repository head type: git location: http://git.haskell.org/ghc.git - subdir: libraries/heapview + subdir: libraries/ghc-heap library default-language: Haskell2010 From git at git.haskell.org Wed May 30 14:39:34 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 14:39:34 +0000 (UTC) Subject: [commit: ghc] wip/tdammers/T11066: Make some tests pass (5d01baf) Message-ID: <20180530143934.5A1CF3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/tdammers/T11066 Link : http://ghc.haskell.org/trac/ghc/changeset/5d01bafdd6c6331102f3ba6a2b5b5a9e0857e2bc/ghc >--------------------------------------------------------------- commit 5d01bafdd6c6331102f3ba6a2b5b5a9e0857e2bc Author: Tobias Dammers Date: Wed May 30 10:46:52 2018 +0200 Make some tests pass >--------------------------------------------------------------- 5d01bafdd6c6331102f3ba6a2b5b5a9e0857e2bc testsuite/tests/gadt/T3651.stderr | 27 ++++++++-------------- testsuite/tests/gadt/T7293.stderr | 6 ++++- testsuite/tests/gadt/T7294.stderr | 2 +- testsuite/tests/gadt/T7558.stderr | 13 +++++------ testsuite/tests/gadt/all.T | 2 +- testsuite/tests/ghci/scripts/Defer02.stderr | 2 +- .../typecheck/should_fail/FrozenErrorTests.stderr | 9 -------- testsuite/tests/typecheck/should_fail/all.T | 2 +- .../tests/typecheck/should_fail/tcfail167.stderr | 6 ++++- .../tests/typecheck/should_run/Typeable1.stderr | 2 +- testsuite/tests/typecheck/should_run/all.T | 2 +- 11 files changed, 32 insertions(+), 41 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 5d01bafdd6c6331102f3ba6a2b5b5a9e0857e2bc From git at git.haskell.org Wed May 30 20:31:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:03 +0000 (UTC) Subject: [commit: ghc] master: Extract hard-coded LLVM opt flags into a file (a4ae199) Message-ID: <20180530203103.260243ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a4ae199cf810a63444a4ef24a44b33329023cd93/ghc >--------------------------------------------------------------- commit a4ae199cf810a63444a4ef24a44b33329023cd93 Author: Kavon Farvardin Date: Sun May 27 11:49:25 2018 -0400 Extract hard-coded LLVM opt flags into a file To resolve ticket #11295, I think it makes sense to stop hard-coding the pass sequences used by GHC when compiling with LLVM into the compiler itself. This patchset introduces a companion to the existing `llvm-targets` file called `llvm-passes`. The passes file is a simple association list that holds the default LLVM `opt` pass sequence used by GHC. This allows end users to easily save their favorite optimization flags when compiling with LLVM. The main benefit for ticket #11295 is that when adding a custom pass sequence, it tends to be an extremely long string that would be unsightly in the code. This is essentially part 1 of 2 for ticket #11295. Test Plan: ./validate Reviewers: bgamari, angerman Reviewed By: angerman Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4695 >--------------------------------------------------------------- a4ae199cf810a63444a4ef24a44b33329023cd93 compiler/main/DriverPipeline.hs | 10 ++++++---- compiler/main/DynFlags.hs | 13 +++++++++---- compiler/main/GHC.hs | 4 ++-- compiler/main/SysTools.hs | 26 ++++++++++++++++---------- ghc.mk | 7 ++++--- ghc/GHCi/UI.hs | 8 ++++++-- ghc/ghc.mk | 6 +++++- llvm-passes | 5 +++++ 8 files changed, 53 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 a4ae199cf810a63444a4ef24a44b33329023cd93 From git at git.haskell.org Wed May 30 20:31:05 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:05 +0000 (UTC) Subject: [commit: ghc] master: rts: Don't madvise if mmap failed (34464fe) Message-ID: <20180530203105.E44DE3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/34464fed463c7be07d4664e2f4b96eaf1acfc37b/ghc >--------------------------------------------------------------- commit 34464fed463c7be07d4664e2f4b96eaf1acfc37b Author: Ben Gamari Date: Sun May 27 11:48:53 2018 -0400 rts: Don't madvise if mmap failed On 32-bit Linux `outofmem` did not fail with the expected out-of-memory error message, instead failing with, outofmem: internal error: getMBlock: mmap: Invalid argument This happened because, `my_mmap` would attempt to `madvise` even if the `mmap` call failed. So while `mmap` returns `ENOMEM` we nevertheless try to `madvise`, which clobbers `errno`, giving us the unexpected `EINVAL` error. Consequently we don't detect this to be an out-of-memory error. This should fix #15060. Test Plan: `make test TEST=outofmem` on i386 Reviewers: simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15060 Differential Revision: https://phabricator.haskell.org/D4704 >--------------------------------------------------------------- 34464fed463c7be07d4664e2f4b96eaf1acfc37b rts/posix/OSMem.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 9ecd53e..1df18ab 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -192,16 +192,18 @@ my_mmap (void *addr, W_ size, int operation) } } - if (operation & MEM_COMMIT) { - madvise(ret, size, MADV_WILLNEED); + if (ret != (void *)-1) { + if (operation & MEM_COMMIT) { + madvise(ret, size, MADV_WILLNEED); #if defined(MADV_DODUMP) - madvise(ret, size, MADV_DODUMP); + madvise(ret, size, MADV_DODUMP); #endif - } else { - madvise(ret, size, MADV_DONTNEED); + } else { + madvise(ret, size, MADV_DONTNEED); #if defined(MADV_DONTDUMP) - madvise(ret, size, MADV_DONTDUMP); + madvise(ret, size, MADV_DONTDUMP); #endif + } } #else From git at git.haskell.org Wed May 30 20:31:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:08 +0000 (UTC) Subject: [commit: ghc] master: Define MCoercion type (9aac442) Message-ID: <20180530203108.B06E43ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9aac442f70b0b58decd56fb52dd4ec2289b03759/ghc >--------------------------------------------------------------- commit 9aac442f70b0b58decd56fb52dd4ec2289b03759 Author: ningning Date: Sun May 27 11:49:06 2018 -0400 Define MCoercion type An attempt on #14975: During compilation, reflexive casts is discarded for computation. Currently in some places we use Maybe coercion as inputs. So if a cast is reflexive it is denoted as Nothing, otherwise Just coercion. This patch defines the type data MCoercion = MRefl | MCo Coercion which is isomorphic to Maybe Coercion but useful in a number of places, and super-helpful documentation. Test Plan: validate Reviewers: bgamari, goldfire, simonpj Reviewed By: goldfire Subscribers: mpickering, rwbarton, thomie, carter GHC Trac Issues: #14975 Differential Revision: https://phabricator.haskell.org/D4699 >--------------------------------------------------------------- 9aac442f70b0b58decd56fb52dd4ec2289b03759 compiler/coreSyn/CoreOpt.hs | 26 +++++++++++++------------- compiler/coreSyn/CoreSyn.hs | 3 ++- compiler/simplCore/Simplify.hs | 8 ++++---- compiler/types/Coercion.hs | 2 +- compiler/types/TyCoRep.hs | 10 ++++++++++ 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 2027928..73bb427 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -754,8 +754,8 @@ exprIsConApp_maybe (in_scope, id_unf) expr | Just (args', m_co1') <- pushCoArgs (subst_co subst co1) args -- See Note [Push coercions in exprIsConApp_maybe] = case m_co1' of - Just co1' -> go subst expr (CC args' (co1' `mkTransCo` co2)) - Nothing -> go subst expr (CC args' co2) + MCo co1' -> go subst expr (CC args' (co1' `mkTransCo` co2)) + MRefl -> 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) @@ -949,15 +949,15 @@ Here we implement the "push rules" from FC papers: by pushing the coercion into the arguments -} -pushCoArgs :: CoercionR -> [CoreArg] -> Maybe ([CoreArg], Maybe Coercion) -pushCoArgs co [] = return ([], Just co) +pushCoArgs :: CoercionR -> [CoreArg] -> Maybe ([CoreArg], MCoercion) +pushCoArgs co [] = return ([], MCo 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 + MCo co1 -> do { (args', m_co2) <- pushCoArgs co1 args ; return (arg':args', m_co2) } - Nothing -> return (arg':args, Nothing) } + MRefl -> return (arg':args, MRefl) } -pushCoArg :: CoercionR -> CoreArg -> Maybe (CoreArg, Maybe Coercion) +pushCoArg :: CoercionR -> CoreArg -> Maybe (CoreArg, MCoercion) -- 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 @@ -969,7 +969,7 @@ pushCoArg co (Type ty) = do { (ty', m_co') <- pushCoTyArg co ty pushCoArg co val_arg = do { (arg_co, m_co') <- pushCoValArg co ; return (val_arg `mkCast` arg_co, m_co') } -pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR) +pushCoTyArg :: CoercionR -> Type -> Maybe (Type, MCoercionR) -- We have (fun |> co) @ty -- Push the coercion through to return -- (fun @ty') |> co' @@ -983,11 +983,11 @@ pushCoTyArg co ty -- -- = Just (ty, Nothing) | isReflCo co - = Just (ty, Nothing) + = Just (ty, MRefl) | isForAllTy tyL = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty ) - Just (ty `mkCastTy` mkSymCo co1, Just co2) + Just (ty `mkCastTy` mkSymCo co1, MCo co2) | otherwise = Nothing @@ -1007,7 +1007,7 @@ pushCoTyArg co ty -- co2 :: ty1[ (ty|>co1)/a1 ] ~ ty2[ ty/a2 ] -- Arg of mkInstCo is always nominal, hence mkNomReflCo -pushCoValArg :: CoercionR -> Maybe (Coercion, Maybe Coercion) +pushCoValArg :: CoercionR -> Maybe (Coercion, MCoercion) -- We have (fun |> co) arg -- Push the coercion through to return -- (fun (arg |> co_arg)) |> co_res @@ -1021,7 +1021,7 @@ pushCoValArg co -- -- = Just (mkRepReflCo arg, Nothing) | isReflCo co - = Just (mkRepReflCo arg, Nothing) + = Just (mkRepReflCo arg, MRefl) | isFunTy tyL , (co1, co2) <- decomposeFunCo Representational co @@ -1029,7 +1029,7 @@ pushCoValArg co -- then co1 :: tyL1 ~ tyR1 -- co2 :: tyL2 ~ tyR2 = ASSERT2( isFunTy tyR, ppr co $$ ppr arg ) - Just (mkSymCo co1, Just co2) + Just (mkSymCo co1, MCo co2) | otherwise = Nothing diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 2cb8079..729825f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -18,7 +18,7 @@ module CoreSyn ( InId, InBind, InExpr, InAlt, InArg, InType, InKind, InBndr, InVar, InCoercion, InTyVar, InCoVar, OutId, OutBind, OutExpr, OutAlt, OutArg, OutType, OutKind, - OutBndr, OutVar, OutCoercion, OutTyVar, OutCoVar, + OutBndr, OutVar, OutCoercion, OutTyVar, OutCoVar, MOutCoercion, -- ** 'Expr' construction mkLet, mkLets, mkLetNonRec, mkLetRec, mkLams, @@ -793,6 +793,7 @@ type OutBind = CoreBind type OutExpr = CoreExpr type OutAlt = CoreAlt type OutArg = CoreArg +type MOutCoercion = MCoercion {- ********************************************************************* diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 5e514c5..6d1b434 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1248,11 +1248,11 @@ simplCast env body co0 cont0 else addCoerce co1 cont0 ; {-#SCC "simplCast-simplExprF" #-} simplExprF env body cont1 } where - -- If the first parameter is Nothing, then simplifying revealed a + -- If the first parameter is MRefl, then simplifying revealed a -- reflexive coercion. Omit. - addCoerceM :: Maybe OutCoercion -> SimplCont -> SimplM SimplCont - addCoerceM Nothing cont = return cont - addCoerceM (Just co) cont = addCoerce co cont + addCoerceM :: MOutCoercion -> SimplCont -> SimplM SimplCont + addCoerceM MRefl cont = return cont + addCoerceM (MCo co) cont = addCoerce co cont addCoerce :: OutCoercion -> SimplCont -> SimplM SimplCont addCoerce co1 (CastIt co2 cont) -- See Note [Optimising reflexivity] diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index d0c5eed..8085e10 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -10,7 +10,7 @@ -- module Coercion ( -- * Main data type - Coercion, CoercionN, CoercionR, CoercionP, + Coercion, CoercionN, CoercionR, CoercionP, MCoercion(..), MCoercionR, UnivCoProvenance, CoercionHole(..), coHoleCoVar, setCoHoleCoVar, LeftOrRight(..), Var, CoVar, TyCoVar, diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 27f28ae..bd10ac8 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -34,6 +34,7 @@ module TyCoRep ( UnivCoProvenance(..), CoercionHole(..), coHoleCoVar, setCoHoleCoVar, CoercionN, CoercionR, CoercionP, KindCoercion, + MCoercion(..), MCoercionR, -- * Functions over types mkTyConTy, mkTyVarTy, mkTyVarTys, @@ -942,6 +943,15 @@ type CoercionR = Coercion -- always representational type CoercionP = Coercion -- always phantom type KindCoercion = CoercionN -- always nominal +-- | A semantically more meaningful type to represent what may or may not be a +-- useful 'Coercion'. +data MCoercion + = MRefl + -- A trivial Reflexivity coercion + | MCo Coercion + -- Other coercions +type MCoercionR = MCoercion + {- Note [Refl invariant] ~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Wed May 30 20:31:12 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:12 +0000 (UTC) Subject: [commit: ghc] master: Put the `ev_binds` of main function inside `runMainIO` (49e423e) Message-ID: <20180530203112.4EA643ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49e423e9940a9122a4a417cfc7580b9984fb49eb/ghc >--------------------------------------------------------------- commit 49e423e9940a9122a4a417cfc7580b9984fb49eb Author: HE, Tao Date: Sun May 27 11:48:20 2018 -0400 Put the `ev_binds` of main function inside `runMainIO` This ensures that the deferred type error can be emitted correctly. For `main` function in `Main` module, we have :Main.main = GHC.TopHandler.runMainIO main When the type of `main` is not `IO t` and the `-fdefer-type-errors` is enabled, the `ev_binds` of `main` function will contain deferred type errors. Previously, the `ev_binds` are bound to `runMainIO main`, rather than `main`, the type error exception at runtime cannot be handled properly. See Trac #13838. This patch fix that. Test Plan: make test TEST="T13838" Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13838 Differential Revision: https://phabricator.haskell.org/D4708 >--------------------------------------------------------------- 49e423e9940a9122a4a417cfc7580b9984fb49eb compiler/typecheck/TcRnDriver.hs | 8 ++++++-- testsuite/tests/typecheck/should_run/T13838.hs | 6 ++++++ testsuite/tests/typecheck/should_run/T13838.stderr | 6 ++++++ testsuite/tests/typecheck/should_run/all.T | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 63fe36d..d20d43a 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1692,8 +1692,12 @@ check_main dflags tcg_env explicit_mod_hdr ; root_main_id = Id.mkExportedVanillaId root_main_name (mkTyConApp ioTyCon [res_ty]) ; co = mkWpTyApps [res_ty] - ; rhs = mkHsDictLet ev_binds $ - nlHsApp (mkLHsWrap co (nlHsVar run_main_id)) main_expr + -- The ev_binds of the `main` function may contain deferred + -- type error when type of `main` is not `IO a`. The `ev_binds` + -- must be put inside `runMainIO` to ensure the deferred type + -- error can be emitted correctly. See Trac #13838. + ; rhs = nlHsApp (mkLHsWrap co (nlHsVar run_main_id)) $ + mkHsDictLet ev_binds main_expr ; main_bind = mkVarBind root_main_id rhs } ; return (tcg_env { tcg_main = Just main_name, diff --git a/testsuite/tests/typecheck/should_run/T13838.hs b/testsuite/tests/typecheck/should_run/T13838.hs new file mode 100644 index 0000000..265fdb0 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T13838.hs @@ -0,0 +1,6 @@ +{-# OPTIONS_GHC -fdefer-type-errors #-} + +module Main where + +main :: () -> () +main = undefined diff --git a/testsuite/tests/typecheck/should_run/T13838.stderr b/testsuite/tests/typecheck/should_run/T13838.stderr new file mode 100644 index 0000000..b2129f7 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T13838.stderr @@ -0,0 +1,6 @@ +T13838.exe: T13838.hs:6:1: error: + • Couldn't match expected type ‘IO t0’ with actual type ‘() -> ()’ + • Probable cause: ‘main’ is applied to too few arguments + In the expression: main + When checking the type of the IO action ‘main’ +(deferred type error) diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 3cf70b6..b7f37b7 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -130,6 +130,7 @@ test('TypeableEq', normal, compile_and_run, ['']) test('T13435', normal, compile_and_run, ['']) test('T11715', exit_code(1), compile_and_run, ['']) test('T13594a', normal, ghci_script, ['T13594a.script']) +test('T13838', [exit_code(1)], compile_and_run, ['-fdefer-type-errors']) test('T14218', normal, compile_and_run, ['']) test('T14236', normal, compile_and_run, ['']) test('T14925', normal, compile_and_run, ['']) From git at git.haskell.org Wed May 30 20:31:15 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:15 +0000 (UTC) Subject: [commit: ghc] master: T14732 now passes with the profasm way (c65159d) Message-ID: <20180530203115.18BD33ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c65159dcf401d36e8920f43fec300264533642b9/ghc >--------------------------------------------------------------- commit c65159dcf401d36e8920f43fec300264533642b9 Author: Alp Mestanogullari Date: Sun May 27 11:48:01 2018 -0400 T14732 now passes with the profasm way Simon PJ recently fixed the problem behind this failure so we can now expect this test to pass in all ways again. The fixes got introduced in the following commits: 86bba7d519fb6050f78b7e3bac2b3f54273fd70e d191db48c43469ee1818887715bcbc5c0eb1d91f Test Plan: T14732 (profasm way) Reviewers: bgamari, RyanGlScott, simonpj Reviewed By: RyanGlScott, simonpj Subscribers: simonpj, RyanGlScott, rwbarton, thomie, carter GHC Trac Issues: #15163 Differential Revision: https://phabricator.haskell.org/D4725 >--------------------------------------------------------------- c65159dcf401d36e8920f43fec300264533642b9 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 0d5b210..7ed58f5 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -598,7 +598,7 @@ test('T14590', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutio # output we expect (T13032.stderr). test('T13032', omit_ways(['hpc', 'profasm']), compile, ['']) test('T14273', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions']) -test('T14732', expect_broken_for(15163, ['profasm']), compile, ['']) +test('T14732', normal, compile, ['']) test('T14774', [], run_command, ['$MAKE -s --no-print-directory T14774']) test('T14763', normal, compile, ['']) test('T14811', normal, compile, ['']) From git at git.haskell.org Wed May 30 20:31:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:17 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Point out GNTD may require additional extensions (b876c1b) Message-ID: <20180530203117.DF54C3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b876c1bb5c8ccd73a203c0f94bac3cbb9c7e2d65/ghc >--------------------------------------------------------------- commit b876c1bb5c8ccd73a203c0f94bac3cbb9c7e2d65 Author: Ben Gamari Date: Sun May 27 11:50:21 2018 -0400 users-guide: Point out GNTD may require additional extensions As noted in #15073, GeneralizedNewtypeDeriving may produce code that uses extensions that do not directly appear in the code written by the user. Make this clear in the users guide. [skip ci] Test Plan: Read it Reviewers: RyanGlScott Reviewed By: RyanGlScott Subscribers: fosskers, rwbarton, thomie, carter GHC Trac Issues: #15073 Differential Revision: https://phabricator.haskell.org/D4701 >--------------------------------------------------------------- b876c1bb5c8ccd73a203c0f94bac3cbb9c7e2d65 docs/users_guide/glasgow_exts.rst | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 0de1a7a..01d65be 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -4666,7 +4666,7 @@ In this case the derived instance declaration is of the form :: instance Monad (State [tok] (Failure m)) => Monad (Parser tok m) Notice that, since ``Monad`` is a constructor class, the instance is a -*partial application* of the new type, not the entire left hand side. We +*partial application* of the newtype, not the entire left hand side. We can imagine that the type declaration is "eta-converted" to generate the context of the instance declaration. @@ -4694,6 +4694,43 @@ declarations are treated uniformly (and implemented just by reusing the dictionary for the representation type), *except* ``Show`` and ``Read``, which really behave differently for the newtype and its representation. +.. note:: + + It is sometimes necessary to enable additional language extensions when + deriving instances via :extension:`GeneralizedNewtypeDeriving`. For instance, + consider a simple class and instance using :extension:`UnboxedTuples` + syntax: :: + + {-# LANGUAGE UnboxedTuples #-} + + module Lib where + + class AClass a where + aMethod :: a -> (# Int, a #) + + instance AClass Int where + aMethod x = (# x, x #) + + The following will fail with an "Illegal unboxed tuple" error, since the + derived instance produced by the compiler makes use of unboxed tuple syntax, + :: + + {-# LANGUAGE GeneralizedNewtypeDeriving #-} + + import Lib + + newtype Int' = Int' Int + deriving (AClass) + + However, enabling the :extension:`UnboxedTuples` extension allows the module + to compile. Similar errors may occur with a variety of extensions, + including: + + * :extension:`UnboxedTuples` + * :extension:`TypeInType` + * :extension:`MultiParamTypeClasses` + * :extension:`FlexibleContexts` + .. _precise-gnd-specification: A more precise specification From git at git.haskell.org Wed May 30 20:31:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 20:31:20 +0000 (UTC) Subject: [commit: ghc] master: Improved Valid Hole Fits (e0b44e2) Message-ID: <20180530203120.E420E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e0b44e2eccd4053852b6c4c3de75a714301ec080/ghc >--------------------------------------------------------------- commit e0b44e2eccd4053852b6c4c3de75a714301ec080 Author: Matthías Páll Gissurarson Date: Sun May 27 11:50:49 2018 -0400 Improved Valid Hole Fits I've changed the name from `Valid substitutions` to `Valid hole fits`, since "substitution" already has a well defined meaning within the theory. As part of this change, the flags and output is reanamed, with substitution turning into hole-fit in most cases. "hole fit" was already used internally in the code, it's clear and shouldn't cause any confusion. In this update, I've also reworked how we manage side-effects in the hole we are considering. This allows us to consider local bindings such as where clauses and arguments to functions, suggesting e.g. `a` for `head (x:xs) where head :: [a] -> a`. It also allows us to find suggestions such as `maximum` for holes of type `Ord a => a -> [a]`, and `max` when looking for a match for the hole in `g = foldl1 _`, where `g :: Ord a => [a] -> a`. We also show much improved output for refinement hole fits, and fixes #14990. We now show the correct type of the function, but we also now show what the arguments to the function should be e.g. `foldl1 (_ :: Integer -> Integer -> Integer)` when looking for `[Integer] -> Integer`. I've moved the bulk of the code from `TcErrors.hs` to a new file, `TcHoleErrors.hs`, since it was getting too big to not live on it's own. This addresses the considerations raised in #14969, and takes proper care to set the `tcLevel` of the variables to the right level before passing it to the simplifier. We now also zonk the suggestions properly, which improves the output of the refinement hole fits considerably. This also filters out suggestions from the `GHC.Err` module, since even though `error` and `undefined` are indeed valid hole fits, they are "trivial", and almost never useful to the user. We now find the hole fits using the proper manner, namely by solving nested implications. This entails that the givens are passed along using the implications the hole was nested in, which in turn should mean that there will be fewer weird bugs in the typed holes. I've also added a new sorting method (as suggested by SPJ) and sort by the size of the types needed to turn the hole fits into the type of the hole. This gives a reasonable approximation to relevance, and is much faster than the subsumption check. I've also added a flag to toggle whether to use this new sorting algorithm (as is done by default) or the subsumption algorithm. This fixes #14969 I've also added documentation for these new flags and update the documentation according to the new output. Reviewers: bgamari, goldfire Reviewed By: bgamari Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #14969, #14990, #10946 Differential Revision: https://phabricator.haskell.org/D4444 >--------------------------------------------------------------- e0b44e2eccd4053852b6c4c3de75a714301ec080 compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 120 ++- compiler/typecheck/TcErrors.hs | 489 +---------- compiler/typecheck/TcHoleErrors.hs | 917 +++++++++++++++++++++ compiler/typecheck/TcHoleErrors.hs-boot | 12 + compiler/typecheck/TcMType.hs | 9 +- compiler/typecheck/TcRnTypes.hs | 28 +- compiler/typecheck/TcSimplify.hs | 37 +- compiler/typecheck/TcSimplify.hs-boot | 11 - docs/users_guide/8.6.1-notes.rst | 4 + docs/users_guide/glasgow_exts.rst | 461 ++++++----- testsuite/tests/gadt/T12468.stderr | 8 +- testsuite/tests/ghci/scripts/T10248.stderr | 4 +- testsuite/tests/ghci/scripts/T10249.stderr | 3 - testsuite/tests/ghci/scripts/T8353.stderr | 45 +- testsuite/tests/module/mod71.stderr | 5 +- .../partial-sigs/should_compile/T12531.stderr | 5 +- testsuite/tests/th/T10267.stderr | 58 +- testsuite/tests/th/all.T | 2 +- .../tests/typecheck/should_compile/T13050.stderr | 225 +++-- .../tests/typecheck/should_compile/T14273.stderr | 27 +- .../tests/typecheck/should_compile/T14590.stderr | 304 ++++--- .../tests/typecheck/should_compile/T9497a.stderr | 9 +- .../typecheck/should_compile/ValidHoleFits.hs | 4 + .../tests/typecheck/should_compile/ValidSubs.hs | 4 - ...tutions.hs => abstract_refinement_hole_fits.hs} | 0 .../abstract_refinement_hole_fits.stderr | 277 +++++++ .../abstract_refinement_substitutions.stderr | 410 --------- testsuite/tests/typecheck/should_compile/all.T | 31 +- .../should_compile/constraint_hole_fits.hs | 4 + .../should_compile/constraint_hole_fits.stderr | 65 ++ .../should_compile/free_monad_hole_fits.hs | 25 + .../should_compile/free_monad_hole_fits.stderr | 81 ++ .../should_compile/hole_constraints.stderr | 44 +- .../should_compile/hole_constraints_nested.stderr | 9 +- .../tests/typecheck/should_compile/holes.stderr | 574 +++---------- .../tests/typecheck/should_compile/holes2.stderr | 24 +- .../tests/typecheck/should_compile/holes3.stderr | 574 +++---------- .../typecheck/should_compile/local_hole_fits.hs | 11 + .../should_compile/local_hole_fits.stderr | 28 + ...nt_substitutions.hs => refinement_hole_fits.hs} | 0 .../should_compile/refinement_hole_fits.stderr | 236 ++++++ .../should_compile/refinement_substitutions.stderr | 330 -------- .../should_compile/subsumption_sort_hole_fits.hs | 5 + .../subsumption_sort_hole_fits.stderr | 39 + .../should_compile/type_in_type_hole_fits.hs | 88 ++ .../should_compile/type_in_type_hole_fits.stderr | 78 ++ .../{valid_substitutions.hs => valid_hole_fits.hs} | 4 +- .../should_compile/valid_hole_fits.stderr | 255 ++++++ ...ractions.hs => valid_hole_fits_interactions.hs} | 0 .../valid_hole_fits_interactions.stderr | 11 + .../should_compile/valid_substitutions.stderr | 258 ------ .../valid_substitutions_interactions.stderr | 16 - .../tests/typecheck/should_fail/T12177.stderr | 8 - .../tests/typecheck/should_fail/T14884.stderr | 17 +- .../tests/typecheck/should_fail/T9497d.stderr | 9 +- .../tests/typecheck/should_run/T9497a-run.stderr | 9 +- .../tests/typecheck/should_run/T9497b-run.stderr | 9 +- .../tests/typecheck/should_run/T9497c-run.stderr | 9 +- 59 files changed, 3284 insertions(+), 3046 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 e0b44e2eccd4053852b6c4c3de75a714301ec080 From git at git.haskell.org Wed May 30 22:07:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 22:07:14 +0000 (UTC) Subject: [commit: ghc] master: Implement "An API for deciding whether plugins should cause recompilation" (1d1e2b7) Message-ID: <20180530220714.7A95E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1d1e2b77fdc2babdf4fff72b9120c6831e7b422f/ghc >--------------------------------------------------------------- commit 1d1e2b77fdc2babdf4fff72b9120c6831e7b422f Author: Matthew Pickering Date: Sun May 27 11:57:27 2018 -0400 Implement "An API for deciding whether plugins should cause recompilation" This patch implements the API proposed as pull request #108 for plugin authors to influence the recompilation checker. It adds a new field to a plugin which computes a `FingerPrint`. This is recorded in interface files and if it changes then we recompile the module. There are also helper functions such as `purePlugin` and `impurePlugin` for constructing plugins which have simple recompilation semantics but in general, an author can compute a hash as they wish. Fixes #12567 and #7414 https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002 2-plugin-recompilation.rst Reviewers: bgamari, ggreif Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #7414, #12567 Differential Revision: https://phabricator.haskell.org/D4366 >--------------------------------------------------------------- 1d1e2b77fdc2babdf4fff72b9120c6831e7b422f compiler/deSugar/Desugar.hs | 6 +- compiler/deSugar/DsUsage.hs | 21 +++++-- compiler/iface/LoadIface.hs | 1 + compiler/iface/MkIface.hs | 70 +++++++++++++++++++++- compiler/main/DynamicLoading.hs | 18 +++--- compiler/main/HscTypes.hs | 6 ++ compiler/main/Plugins.hs | 64 +++++++++++++++++--- compiler/simplCore/CoreMonad.hs | 6 +- compiler/simplCore/SimplCore.hs | 5 +- docs/users_guide/extending_ghc.rst | 57 ++++++++++++++++++ testsuite/tests/plugins/Makefile | 27 ++++++++- testsuite/tests/plugins/T12567a.stderr | 5 -- testsuite/tests/plugins/all.T | 18 ++++++ testsuite/tests/plugins/plugin-recomp-flags.stderr | 6 ++ testsuite/tests/plugins/plugin-recomp-flags.stdout | 4 ++ .../tests/plugins/plugin-recomp-impure.stderr | 6 ++ .../tests/plugins/plugin-recomp-impure.stdout | 4 ++ testsuite/tests/plugins/plugin-recomp-pure.stderr | 3 + testsuite/tests/plugins/plugin-recomp-pure.stdout | 2 + testsuite/tests/plugins/plugin-recomp-test.hs | 8 +++ testsuite/tests/plugins/plugin-recomp/Common.hs | 17 ++++++ .../plugins/plugin-recomp/FingerprintPlugin.hs | 10 ++++ .../tests/plugins/plugin-recomp/ImpurePlugin.hs | 10 ++++ .../LICENSE | 0 .../{simple-plugin => plugin-recomp}/Makefile | 0 .../tests/plugins/plugin-recomp/PurePlugin.hs | 10 ++++ .../Setup.hs | 0 .../plugins/plugin-recomp/plugin-recomp.cabal | 20 +++++++ .../tests/plugins/simple-plugin/Simple/Plugin.hs | 3 +- 29 files changed, 371 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 1d1e2b77fdc2babdf4fff72b9120c6831e7b422f From git at git.haskell.org Wed May 30 22:07:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 22:07:17 +0000 (UTC) Subject: [commit: ghc] master: ghc-heap: Add dependency from GHC.Exts.Heap.Closures to InfoTableProf (64fd0fa) Message-ID: <20180530220717.4446E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/64fd0fac838426fb87322712da34dabd211c3d89/ghc >--------------------------------------------------------------- commit 64fd0fac838426fb87322712da34dabd211c3d89 Author: Ben Gamari Date: Wed May 30 11:20:58 2018 -0400 ghc-heap: Add dependency from GHC.Exts.Heap.Closures to InfoTableProf `ghc -M` currently doesn't properly account for ways when generating dependencies (#15197). This import ensures correct build-ordering between this module and GHC.Exts.Heap.InfoTableProf. Otherwise the profiled build may fail as described in #15197. >--------------------------------------------------------------- 64fd0fac838426fb87322712da34dabd211c3d89 libraries/ghc-heap/GHC/Exts/Heap/Closures.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs index f355a62..09a94a0 100644 --- a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs +++ b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs @@ -23,6 +23,12 @@ import GHC.Exts.Heap.Constants import GHC.Exts.Heap.InfoTableProf #else import GHC.Exts.Heap.InfoTable + +-- `ghc -M` currently doesn't properly account for ways when generating +-- dependencies (#15197). This import ensures correct build-ordering between +-- this module and GHC.Exts.Heap.InfoTableProf. It should be removed when #15197 +-- is fixed. +import GHC.Exts.Heap.InfoTableProf () #endif import Data.Bits From git at git.haskell.org Wed May 30 22:07:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 May 2018 22:07:20 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix hashbangs (5030109) Message-ID: <20180530220720.0B3903ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/50301093515c97e9c9e7249367ec9c32b52d34b5/ghc >--------------------------------------------------------------- commit 50301093515c97e9c9e7249367ec9c32b52d34b5 Author: Ben Gamari Date: Wed May 30 15:19:30 2018 -0400 testsuite: Fix hashbangs >--------------------------------------------------------------- 50301093515c97e9c9e7249367ec9c32b52d34b5 testsuite/tests/perf/compiler/genMultiLayerModules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/genMultiLayerModules b/testsuite/tests/perf/compiler/genMultiLayerModules index b98c481..8220c08 100755 --- a/testsuite/tests/perf/compiler/genMultiLayerModules +++ b/testsuite/tests/perf/compiler/genMultiLayerModules @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Generate $DEPTH layers of modules with $WIDTH modules on each layer # Every module on layer N imports all the modules on layer N-1 # MultiLayerModules.hs imports all the modules from the last layer From git at git.haskell.org Thu May 31 02:06:00 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:00 +0000 (UTC) Subject: [commit: ghc] master: rts/posix: Use less aggressive backoff schedule for heap reservation sizing (730781b) Message-ID: <20180531020600.72BEB3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/730781b42a003604cfa047a02280757a07b09581/ghc >--------------------------------------------------------------- commit 730781b42a003604cfa047a02280757a07b09581 Author: Ben Gamari Date: Wed May 30 12:30:52 2018 -0400 rts/posix: Use less aggressive backoff schedule for heap reservation sizing When we allocate the heap on POSIX platforms we generally just ask for a 1TB chunk of address space and call it a day. However, if the user has set a ulimit then this request will fail. In this case we would previously try successively smaller allocation requests, reducing the request size by a factor of two each time. However, this means that GHC will significantly allocate a significantly smaller heap than the available physical memory size in some circumstances. Imagine, for instance, a machine with 512 GB of physical memory but a ulimit of 511 GB: we would be limited to a 256 GB heap. We now use a less aggressive back-off policy, reducing by one-eighth the last allocation size each try. Thanks to luispedro for the suggested approach. Test Plan: Validate Reviewers: simonmar, erikd Subscribers: rwbarton, thomie GHC Trac Issues: #14492 Differential Revision: https://phabricator.haskell.org/D4215 >--------------------------------------------------------------- 730781b42a003604cfa047a02280757a07b09581 rts/posix/OSMem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 1df18ab..9ae9a4b 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -514,9 +514,14 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) if (at == NULL) { // This means that mmap failed which we take to mean that we asked // for too much memory. This can happen due to POSIX resource - // limits. In this case we reduce our allocation request by a factor - // of two and try again. - *len /= 2; + // limits. In this case we reduce our allocation request by a + // fraction of the current size and try again. + // + // Note that the previously would instead decrease the request size + // by a factor of two; however, this meant that significant amounts + // of memory will be wasted (e.g. imagine a machine with 512GB of + // physical memory but a 511GB ulimit). See #14492. + *len -= *len / 8; } else if ((W_)at >= minimumAddress) { // Success! We were given a block of memory starting above the 8 GB // mark, which is what we were looking for. From git at git.haskell.org Thu May 31 02:06:03 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:03 +0000 (UTC) Subject: [commit: ghc] master: dead strip dylibs on macOS (b592bd9) Message-ID: <20180531020603.3F5A73ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b592bd98ff25730bbe3c13d6f62a427df8c78e28/ghc >--------------------------------------------------------------- commit b592bd98ff25730bbe3c13d6f62a427df8c78e28 Author: Moritz Angermann Date: Wed May 30 20:40:11 2018 -0400 dead strip dylibs on macOS When linking dynamic libraries or executables, we compute the full transitive closure over the dependencies, and instruct the linker to link all dependencies. With deep dependency trees the number of transitive dependencies can grow quickly. macOS since the Sierra release has an upper limit on the load command sizes the linker parses when loading dynamic lirbaries. As such it is mandatory to keep the number of load commands (and their size) small on recent macOS releases. An approach that would just link direct dependencies as specified by the -package-id flag is insufficient, because GHC can inline across packages and the library or executable being linked could refer to symbols deep in the dependency tree. If we just recursively linked librarys and re-exported their symbols, this increases the number of symbols in libraries with many dependencies and ultimately puts excessive strain on the linker to the point where linking takes a lot longer than even the compilation of the modules. We can however build a list of symbols from the obejcts we want to link, and try to compute the libraries we need to link that contain those symbols from the transitive dependency closure. Luckily, we don't need to write this ourselves, but can use the ld64 `-dead_strip_dylibs` linker flag on macOS to achive the same result. This will link only the libraries that are actually referenced, which is usually a small subset of the full transitive dependency closure. As such we should stay within the load command size limit for almost all but pathological cases. Reviewers: bgamari Reviewed By: bgamari Subscribers: lelf, rwbarton, thomie, carter GHC Trac Issues: #14444 Differential Revision: https://phabricator.haskell.org/D4714 >--------------------------------------------------------------- b592bd98ff25730bbe3c13d6f62a427df8c78e28 compiler/main/DriverPipeline.hs | 3 +++ compiler/main/SysTools.hs | 1 + 2 files changed, 4 insertions(+) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 5ea83ce..e4a9fa2 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1884,6 +1884,9 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ pkg_framework_opts ++ debug_opts ++ thread_opts + ++ (if platformOS platform == OSDarwin + then [ "-Wl,-dead_strip_dylibs" ] + else []) )) exeFileName :: Bool -> DynFlags -> FilePath diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 2e52ef9..d987d7d 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -540,6 +540,7 @@ linkDynLib dflags0 o_files dep_packages ++ map Option pkg_lib_path_opts ++ map Option pkg_link_opts ++ map Option pkg_framework_opts + ++ [ Option "-Wl,-dead_strip_dylibs" ] ) _ -> do ------------------------------------------------------------------- From git at git.haskell.org Thu May 31 02:06:06 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:06 +0000 (UTC) Subject: [commit: ghc] master: base: Improve documentation of indexArray# (15ece72) Message-ID: <20180531020606.0BF3E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/15ece727d0cce777880ec2e3a1b3061f35dfce2c/ghc >--------------------------------------------------------------- commit 15ece727d0cce777880ec2e3a1b3061f35dfce2c Author: Andrew Martin Date: Fri Apr 20 12:58:54 2018 -0400 base: Improve documentation of indexArray# >--------------------------------------------------------------- 15ece727d0cce777880ec2e3a1b3061f35dfce2c compiler/prelude/primops.txt.pp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 9165c6f..8eb39c3 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -829,8 +829,13 @@ primop SizeofMutableArrayOp "sizeofMutableArray#" GenPrimOp primop IndexArrayOp "indexArray#" GenPrimOp Array# a -> Int# -> (# a #) - {Read from specified index of immutable array. Result is packaged into - an unboxed singleton; the result itself is not yet evaluated.} + {Read from the specified index of an immutable array. The result is packaged + into an unboxed unary tuple; the result itself is not yet + evaluated. Pattern matching on the tuple forces the indexing of the + array to happen but does not evaluate the element itself. Evaluating + the thunk prevents additional thunks from building up on the + heap. Avoiding these thunks, in turn, reduces references to the + argument array, allowing it to be garbage collected more promptly.} with can_fail = True From git at git.haskell.org Thu May 31 02:06:08 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:08 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Make T3234 more robust (91a82de) Message-ID: <20180531020608.F1B463ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/91a82de011d3bc1783f849168d90268bc24ceeee/ghc >--------------------------------------------------------------- commit 91a82de011d3bc1783f849168d90268bc24ceeee Author: roland Date: Sat May 19 18:21:42 2018 +0200 testsuite: Make T3234 more robust Just look for the rule firing that we want to see instead of matching on the entire dump. Fixes #15088. >--------------------------------------------------------------- 91a82de011d3bc1783f849168d90268bc24ceeee testsuite/tests/simplCore/should_compile/Makefile | 4 ++ .../tests/simplCore/should_compile/T3234.stderr | 71 ---------------------- .../tests/simplCore/should_compile/T3234.stdout | 1 + testsuite/tests/simplCore/should_compile/all.T | 6 +- 4 files changed, 8 insertions(+), 74 deletions(-) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 1f1bf25..5f077b2 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -13,6 +13,10 @@ T13468: # Expecting no output from the grep, hence "-" # If the case branch is not eliminated, we get a patError +T3234: + $(RM) -f T3234.o T3234.hi + '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl-stats T3234.hs | grep 'fold/build' + T3990: $(RM) -f T3990.o T3990.hi '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T3990.hs | grep 'test_case' diff --git a/testsuite/tests/simplCore/should_compile/T3234.stderr b/testsuite/tests/simplCore/should_compile/T3234.stderr deleted file mode 100644 index 223650a..0000000 --- a/testsuite/tests/simplCore/should_compile/T3234.stderr +++ /dev/null @@ -1,71 +0,0 @@ - -==================== FloatOut stats: ==================== -2 Lets floated to top level; 0 Lets floated elsewhere; from 1 Lambda groups - - - -==================== FloatOut stats: ==================== -0 Lets floated to top level; 0 Lets floated elsewhere; from 0 Lambda groups - - - -==================== Grand total simplifier statistics ==================== -Total ticks: 52 - -18 PreInlineUnconditionally - 1 g - 1 xs - 1 ys - 1 c - 1 n - 1 a - 1 a - 1 g - 1 h - 1 n - 1 k - 1 z - 1 g - 1 c - 1 n - 1 lvl - 1 lvl - 1 lvl -1 PostInlineUnconditionally 1 c -1 UnfoldingDone 1 GHC.Base.build -5 RuleFired - 1 ++ - 1 augment/build - 1 fold/build - 1 unpack - 1 unpack-list -2 LetFloatFromLet 2 -25 BetaReduction - 1 a - 1 g - 1 a - 1 xs - 1 ys - 1 b - 1 c - 1 n - 1 a - 1 b - 1 a - 1 a - 1 g - 1 h - 1 b - 1 c - 1 n - 1 b - 1 a - 1 k - 1 z - 1 g - 1 a - 1 c - 1 n -10 SimplifierDone 10 - - diff --git a/testsuite/tests/simplCore/should_compile/T3234.stdout b/testsuite/tests/simplCore/should_compile/T3234.stdout new file mode 100644 index 0000000..725c379 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T3234.stdout @@ -0,0 +1 @@ + 1 fold/build \ No newline at end of file diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 9a3b8f9..1bc42af 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -44,9 +44,9 @@ test('T3016', when(fast(), skip), compile, ['']) test('T1647', normal, compile, ['-fdicts-strict -dcore-lint']) test('T3234', - only_ways(['optasm']), - compile, - ['-ddump-simpl-stats -dsuppress-uniques']) + normal, + run_command, + ['$MAKE -s --no-print-directory T3234']) test('T3717', only_ways(['optasm']), compile, From git at git.haskell.org Thu May 31 02:06:11 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:11 +0000 (UTC) Subject: [commit: ghc] master: Make HsDocString a newtype of ByteString (d1beebb) Message-ID: <20180531020611.BFD103ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d1beebb881722109d6935941e541eb175a9d6c62/ghc >--------------------------------------------------------------- commit d1beebb881722109d6935941e541eb175a9d6c62 Author: Simon Jakobi Date: Wed May 30 20:38:18 2018 -0400 Make HsDocString a newtype of ByteString Docstrings don't profit from FastString's interning, so we switch to a different type that doesn't incur this overhead. Updates the haddock submodule. Reviewers: alexbiehl, bgamari Reviewed By: alexbiehl, bgamari Subscribers: rwbarton, thomie, mpickering, carter GHC Trac Issues: #15157 Differential Revision: https://phabricator.haskell.org/D4743 >--------------------------------------------------------------- d1beebb881722109d6935941e541eb175a9d6c62 compiler/hsSyn/HsDoc.hs | 45 +++++++++++++++++++++++++++++++++++++-------- compiler/parser/Parser.y | 10 +++++----- compiler/rename/RnHsDoc.hs | 2 +- utils/haddock | 2 +- 4 files changed, 44 insertions(+), 15 deletions(-) diff --git a/compiler/hsSyn/HsDoc.hs b/compiler/hsSyn/HsDoc.hs index 7c6bdd9..cbe1d94 100644 --- a/compiler/hsSyn/HsDoc.hs +++ b/compiler/hsSyn/HsDoc.hs @@ -1,32 +1,61 @@ {-# LANGUAGE CPP, DeriveDataTypeable #-} -module HsDoc ( - HsDocString(..), - LHsDocString, - ppr_mbDoc +module HsDoc + ( HsDocString + , LHsDocString + , mkHsDocString + , mkHsDocStringUtf8ByteString + , unpackHDS + , hsDocStringToByteString + , ppr_mbDoc ) where #include "HsVersions.h" import GhcPrelude +import Encoding +import FastFunctions import Outputable import SrcLoc -import FastString +import Data.ByteString (ByteString) +import qualified Data.ByteString.Internal as BS import Data.Data +import Foreign -- | Haskell Documentation String -newtype HsDocString = HsDocString FastString +-- +-- Internally this is a UTF8-Encoded 'ByteString'. +newtype HsDocString = HsDocString ByteString deriving (Eq, Show, Data) -- | Located Haskell Documentation String type LHsDocString = Located HsDocString instance Outputable HsDocString where - ppr (HsDocString fs) = ftext fs + ppr = text . unpackHDS + +mkHsDocString :: String -> HsDocString +mkHsDocString s = + inlinePerformIO $ do + let len = utf8EncodedLength s + buf <- mallocForeignPtrBytes len + withForeignPtr buf $ \ptr -> do + utf8EncodeString ptr s + pure (HsDocString (BS.fromForeignPtr buf 0 len)) + +-- | Create a 'HsDocString' from a UTF8-encoded 'ByteString'. +mkHsDocStringUtf8ByteString :: ByteString -> HsDocString +mkHsDocStringUtf8ByteString = HsDocString + +unpackHDS :: HsDocString -> String +unpackHDS = utf8DecodeByteString . hsDocStringToByteString + +-- | Return the contents of a 'HsDocString' as a UTF8-encoded 'ByteString'. +hsDocStringToByteString :: HsDocString -> ByteString +hsDocStringToByteString (HsDocString bs) = bs ppr_mbDoc :: Maybe LHsDocString -> SDoc ppr_mbDoc (Just doc) = ppr doc ppr_mbDoc Nothing = empty - diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 4c66fd7..c6face8 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -3470,24 +3470,24 @@ bars :: { ([SrcSpan],Int) } -- One or more bars -- Documentation comments docnext :: { LHsDocString } - : DOCNEXT {% return (sL1 $1 (HsDocString (mkFastString (getDOCNEXT $1)))) } + : DOCNEXT {% return (sL1 $1 (mkHsDocString (getDOCNEXT $1))) } docprev :: { LHsDocString } - : DOCPREV {% return (sL1 $1 (HsDocString (mkFastString (getDOCPREV $1)))) } + : DOCPREV {% return (sL1 $1 (mkHsDocString (getDOCPREV $1))) } docnamed :: { Located (String, HsDocString) } : DOCNAMED {% let string = getDOCNAMED $1 (name, rest) = break isSpace string - in return (sL1 $1 (name, HsDocString (mkFastString rest))) } + in return (sL1 $1 (name, mkHsDocString rest)) } docsection :: { Located (Int, HsDocString) } : DOCSECTION {% let (n, doc) = getDOCSECTION $1 in - return (sL1 $1 (n, HsDocString (mkFastString doc))) } + return (sL1 $1 (n, mkHsDocString doc)) } moduleheader :: { Maybe LHsDocString } : DOCNEXT {% let string = getDOCNEXT $1 in - return (Just (sL1 $1 (HsDocString (mkFastString string)))) } + return (Just (sL1 $1 (mkHsDocString string))) } maybe_docprev :: { Maybe LHsDocString } : docprev { Just $1 } diff --git a/compiler/rename/RnHsDoc.hs b/compiler/rename/RnHsDoc.hs index ac0731d..ac2589d 100644 --- a/compiler/rename/RnHsDoc.hs +++ b/compiler/rename/RnHsDoc.hs @@ -21,5 +21,5 @@ rnLHsDoc (L pos doc) = do return (L pos doc') rnHsDoc :: HsDocString -> RnM HsDocString -rnHsDoc (HsDocString s) = return (HsDocString s) +rnHsDoc = pure diff --git a/utils/haddock b/utils/haddock index 46ff230..90ad5b5 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 46ff2306f580c44915a6f3adb652f02b7f4edfe9 +Subproject commit 90ad5b5c3a1d8532babac7934ee5189c09ef484b From git at git.haskell.org Thu May 31 02:06:14 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:14 +0000 (UTC) Subject: [commit: ghc] master: SplicePat's should not trip -Wunused-pattern-binds (b57a54f) Message-ID: <20180531020614.8B10E3ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b57a54f6be600541dbcc4d8489c751a17a85bec0/ghc >--------------------------------------------------------------- commit b57a54f6be600541dbcc4d8489c751a17a85bec0 Author: Alec Theriault Date: Tue May 8 12:24:26 2018 -0700 SplicePat's should not trip -Wunused-pattern-binds The warning does not consider the fact that the splice pattern may very well end up binding variables. >--------------------------------------------------------------- b57a54f6be600541dbcc4d8489c751a17a85bec0 compiler/rename/RnBinds.hs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/compiler/rename/RnBinds.hs b/compiler/rename/RnBinds.hs index d7790ca..79b5502 100644 --- a/compiler/rename/RnBinds.hs +++ b/compiler/rename/RnBinds.hs @@ -470,9 +470,10 @@ rnBind _ bind@(PatBind { pat_lhs = pat ok_nobind_pat = -- See Note [Pattern bindings that bind no variables] case pat of - L _ (WildPat {}) -> True - L _ (BangPat {}) -> True -- #9127, #13646 - _ -> False + L _ (WildPat {}) -> True + L _ (BangPat {}) -> True -- #9127, #13646 + L _ (SplicePat {}) -> True + _ -> False -- Warn if the pattern binds no variables -- See Note [Pattern bindings that bind no variables] @@ -518,7 +519,7 @@ rnBind _ b = pprPanic "rnBind" (ppr b) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Generally, we want to warn about pattern bindings like Just _ = e -because they don't do anything! But we have two exceptions: +because they don't do anything! But we have three exceptions: * A wildcard pattern _ = rhs @@ -532,6 +533,12 @@ because they don't do anything! But we have two exceptions: Moreover, Trac #13646 argues that even for single constructor types, you might want to write the constructor. See also #9127. +* A splice pattern + $(th-lhs) = rhs + It is impossible to determine whether or not th-lhs really + binds any variable. We should disable the warning for any pattern + which contain splices, but that is a more expensive check. + Note [Free-variable space leak] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We have From git at git.haskell.org Thu May 31 02:06:17 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:17 +0000 (UTC) Subject: [commit: ghc] master: configure: Make sphinx-build version test work on recent versions (533d345) Message-ID: <20180531020617.548E73ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/533d34516c795388d70f34123f14de1845f8b81b/ghc >--------------------------------------------------------------- commit 533d34516c795388d70f34123f14de1845f8b81b Author: Jens Petersen Date: Mon May 28 12:31:49 2018 +0900 configure: Make sphinx-build version test work on recent versions On Fedora: `/usr/libexec/sphinx-build --version` outputs `sphinx-build 1.7.2`. In bindir we actually have sphinx-build-2 and sphinx-build-3 (python2 and python3 versions), which output `sphinx-build-2 1.7.2` and `sphinx-build-3 1.7.2` respectively. Dunno what version others are using but at least this change should works for most versions I suppose. >--------------------------------------------------------------- 533d34516c795388d70f34123f14de1845f8b81b configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 57d0943..21f9f16 100644 --- a/configure.ac +++ b/configure.ac @@ -842,7 +842,7 @@ AC_PATH_PROG(SPHINXBUILD,sphinx-build) AC_CACHE_CHECK([for version of sphinx-build], fp_cv_sphinx_version, changequote(, )dnl [if test -n "$SPHINXBUILD"; then - fp_cv_sphinx_version=`"$SPHINXBUILD" --version 2>&1 | sed 's/Sphinx\( (sphinx-build)\)\? v\?\([0-9]\.[0-9]\.[0-9]\)/\2/' | head -n1`; + fp_cv_sphinx_version=`"$SPHINXBUILD" --version 2>&1 | sed 's/.* v\?\([0-9]\.[0-9]\.[0-9]\)/\1/' | head -n1`; fi; changequote([, ])dnl ]) From git at git.haskell.org Thu May 31 02:06:20 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:20 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Fix various issues in debugging flags section (471b2a0) Message-ID: <20180531020620.251633ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/471b2a099a949549558b01f356a063d7ad73a5f4/ghc >--------------------------------------------------------------- commit 471b2a099a949549558b01f356a063d7ad73a5f4 Author: Ben Gamari Date: Wed May 30 20:38:06 2018 -0400 users-guide: Fix various issues in debugging flags section Reviewers: ggreif Reviewed By: ggreif Subscribers: rwbarton, thomie, carter, ggreif Differential Revision: https://phabricator.haskell.org/D4750 >--------------------------------------------------------------- 471b2a099a949549558b01f356a063d7ad73a5f4 docs/users_guide/debugging.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index 370fa4a..dd9af94 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -216,11 +216,10 @@ subexpression elimination pass. :shortdesc: Dump desugarer output. :type: dynamic - Dump desugarer output. `-ddump-ds` dumps the output after the very simple - optimiser has run (which discards a lot of clutter and - hence is a sensible default. `-ddump-ds-preopt` shows - the output after desugaring but before the very simple - optimiser. + Dump desugarer output. :ghc-flag:`-ddump-ds` dumps the output after the very + simple optimiser has run (which discards a lot of clutter and hence is a + sensible default. :ghc-flag:`-ddump-ds-preopt` shows the output after + desugaring but before the very simple optimiser. .. ghc-flag:: -ddump-simpl-iterations @@ -228,15 +227,14 @@ subexpression elimination pass. :type: dynamic Show the output of each *iteration* of the simplifier (each run of - the simplifier has a maximum number of iterations, normally 4). This - outputs even more information than ``-ddump-simpl-phases``. + the simplifier has a maximum number of iterations, normally 4). .. ghc-flag:: -ddump-simpl-stats :shortdesc: Dump simplifier stats :type: dynamic Dump statistics about how many of each kind of transformation took - place. If you add ``-dppr-debug`` you get more detailed information. + place. If you add :ghc-flag:`-dppr-debug` you get more detailed information. .. ghc-flag:: -dverbose-core2core :shortdesc: Show output from each core-to-core pass From git at git.haskell.org Thu May 31 02:06:23 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:23 +0000 (UTC) Subject: [commit: ghc] master: base/TimerManager: Clamp timer expiration time to maxBound (21a9fb5) Message-ID: <20180531020623.06B843ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/21a9fb5ff3714addf28dbe270af5d10640d89ad9/ghc >--------------------------------------------------------------- commit 21a9fb5ff3714addf28dbe270af5d10640d89ad9 Author: Ben Gamari Date: Wed May 30 20:39:12 2018 -0400 base/TimerManager: Clamp timer expiration time to maxBound Previously we would allow the expiration time to overflow, which in practice meant that `threadDelay maxBound` we return far earlier than circa 2500 CE. For now we fix this by simply clamping to maxBound. Fixes #15158. Test Plan: Validate, run T8089 Reviewers: simonmar, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15158 Differential Revision: https://phabricator.haskell.org/D4719 >--------------------------------------------------------------- 21a9fb5ff3714addf28dbe270af5d10640d89ad9 libraries/base/GHC/Event/TimerManager.hs | 22 ++++++++++++++++------ libraries/base/tests/all.T | 3 +-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libraries/base/GHC/Event/TimerManager.hs b/libraries/base/GHC/Event/TimerManager.hs index a28d361..946f233 100644 --- a/libraries/base/GHC/Event/TimerManager.hs +++ b/libraries/base/GHC/Event/TimerManager.hs @@ -45,8 +45,9 @@ import Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef, import GHC.Base import GHC.Clock (getMonotonicTimeNSec) import GHC.Conc.Signal (runHandlers) +import GHC.Enum (maxBound) import GHC.Num (Num(..)) -import GHC.Real (fromIntegral) +import GHC.Real (quot, fromIntegral) import GHC.Show (Show(..)) import GHC.Event.Control import GHC.Event.Internal (Backend, Event, evtRead, Timeout(..)) @@ -208,6 +209,18 @@ wakeManager mgr = sendWakeup (emControl mgr) ------------------------------------------------------------------------ -- Registering interest in timeout events +expirationTime :: Int -> IO Q.Prio +expirationTime us = do + now <- getMonotonicTimeNSec + let expTime + -- Currently we treat overflows by clamping to maxBound. If humanity + -- still exists in 2500 CE we will ned to be a bit more careful here. + -- See #15158. + | (maxBound - now) `quot` 1000 < fromIntegral us = maxBound + | otherwise = now + ns + where ns = 1000 * fromIntegral us + return expTime + -- | Register a timeout in the given number of microseconds. The -- returned 'TimeoutKey' can be used to later unregister or update the -- timeout. The timeout is automatically unregistered after the given @@ -217,8 +230,7 @@ registerTimeout mgr us cb = do !key <- newUnique (emUniqueSource mgr) if us <= 0 then cb else do - now <- getMonotonicTimeNSec - let expTime = fromIntegral us * 1000 + now + expTime <- expirationTime us -- "unsafeInsertNew" is safe - the key must not exist in the PSQ. It -- doesn't because we just generated it from a unique supply. @@ -234,9 +246,7 @@ unregisterTimeout mgr (TK key) = do -- microseconds. updateTimeout :: TimerManager -> TimeoutKey -> Int -> IO () updateTimeout mgr (TK key) us = do - now <- getMonotonicTimeNSec - let expTime = fromIntegral us * 1000 + now - + expTime <- expirationTime us editTimeouts mgr (Q.adjust (const expTime) key) editTimeouts :: TimerManager -> TimeoutEdit -> IO () diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 710b176..3d3ebbc 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -203,8 +203,7 @@ test('T9681', normal, compile_fail, ['']) # make an educated guess how long it needs to be guaranteed to reach the C # call." test('T8089', - [exit_code(99), run_timeout_multiplier(0.01), - expect_broken_for(15158, ['ghci', 'threaded1', 'threaded2', 'profthreaded'])], + [exit_code(99), run_timeout_multiplier(0.01)], compile_and_run, ['']) test('T8684', expect_broken(8684), compile_and_run, ['']) test('T9826',normal, compile_and_run,['']) From git at git.haskell.org Thu May 31 02:06:25 2018 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 31 May 2018 02:06:25 +0000 (UTC) Subject: [commit: ghc] master: Change jump targets in JMP_TBL from blocks to X86.JumpDest. (5748c79) Message-ID: <20180531020625.C38183ABA1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5748c79e5a7a6bd1b0bfffc514d8f4f4da92e815/ghc >--------------------------------------------------------------- commit 5748c79e5a7a6bd1b0bfffc514d8f4f4da92e815 Author: Andreas Klebinger Date: Wed May 30 20:40:49 2018 -0400 Change jump targets in JMP_TBL from blocks to X86.JumpDest. Jump tables always point to blocks when we first generate them. However there are rare situations where we can shortcut one of these blocks to a static address during the asm shortcutting pass. While we already updated the data section accordingly this patch also extends this to the references stored in JMP_TBL. Test Plan: ci Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15104 Differential Revision: https://phabricator.haskell.org/D4595 >--------------------------------------------------------------- 5748c79e5a7a6bd1b0bfffc514d8f4f4da92e815 compiler/nativeGen/X86/CodeGen.hs | 9 +++++++-- compiler/nativeGen/X86/Instr.hs | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 579c726..4551754 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -2857,11 +2857,16 @@ genSwitch dflags expr targets JMP_TBL op ids (Section ReadOnlyData lbl) lbl ] return code - where (offset, ids) = switchTargetsToTable targets + where + (offset, blockIds) = switchTargetsToTable targets + ids = map (fmap DestBlockId) blockIds generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl (Alignment, CmmStatics) Instr) generateJumpTableForInstr dflags (JMP_TBL _ ids section lbl) - = Just (createJumpTable dflags ids section lbl) + = let getBlockId (DestBlockId id) = id + getBlockId _ = panic "Non-Label target in Jump Table" + blockIds = map (fmap getBlockId) ids + in Just (createJumpTable dflags blockIds section lbl) generateJumpTableForInstr _ _ = Nothing createJumpTable :: DynFlags -> [Maybe BlockId] -> Section -> CLabel diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs index d15f2f7..ee3e64c 100644 --- a/compiler/nativeGen/X86/Instr.hs +++ b/compiler/nativeGen/X86/Instr.hs @@ -8,7 +8,7 @@ -- ----------------------------------------------------------------------------- -module X86.Instr (Instr(..), Operand(..), PrefetchVariant(..), JumpDest, +module X86.Instr (Instr(..), Operand(..), PrefetchVariant(..), JumpDest(..), getJumpDestBlockId, canShortcut, shortcutStatics, shortcutJump, i386_insert_ffrees, allocMoreStack, maxSpillSlots, archWordFormat) @@ -322,7 +322,7 @@ data Instr | JXX_GBL Cond Imm -- non-local version of JXX -- Table jump | JMP_TBL Operand -- Address to jump to - [Maybe BlockId] -- Blocks in the jump table + [Maybe JumpDest] -- Targets of the jump table Section -- Data section jump table should be put in CLabel -- Label of jump table | CALL (Either Imm Reg) [Reg] @@ -704,7 +704,7 @@ x86_jumpDestsOfInstr x86_jumpDestsOfInstr insn = case insn of JXX _ id -> [id] - JMP_TBL _ ids _ _ -> [id | Just id <- ids] + JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] _ -> [] @@ -715,8 +715,12 @@ x86_patchJumpInstr insn patchF = case insn of JXX cc id -> JXX cc (patchF id) JMP_TBL op ids section lbl - -> JMP_TBL op (map (fmap patchF) ids) section lbl + -> JMP_TBL op (map (fmap (patchJumpDest patchF)) ids) section lbl _ -> insn + where + patchJumpDest f (DestBlockId id) = DestBlockId (f id) + patchJumpDest _ dest = dest + @@ -1036,13 +1040,11 @@ shortcutJump fn insn = shortcutJump' fn (setEmpty :: LabelSet) insn 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) = + let updateBlock (Just (DestBlockId bid)) = case fn bid of - Nothing -> Just bid - Just (DestBlockId bid') -> Just bid' - Just (DestImm _) -> - panic "Can't shortcut jump table to immediate" + Nothing -> Just (DestBlockId bid ) + Just dest -> Just dest + updateBlock dest = dest blocks' = map updateBlock blocks in JMP_TBL addr blocks' section tblId shortcutJump' _ _ other = other