From git at git.haskell.org Tue Nov 1 14:11:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 Nov 2016 14:11:49 +0000 (UTC) Subject: [commit: ghc] master: Have static pointers work with -fno-full-laziness. (0b70ec0) Message-ID: <20161101141149.993853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0b70ec0c3b72a7f87776743e64b47b65ef0ca4a5/ghc >--------------------------------------------------------------- commit 0b70ec0c3b72a7f87776743e64b47b65ef0ca4a5 Author: Facundo Domínguez Date: Fri Oct 28 19:25:05 2016 -0300 Have static pointers work with -fno-full-laziness. Summary: Before this patch, static pointers wouldn't be floated to the top-level. Test Plan: ./validate Reviewers: simonpj, bgamari, austin Subscribers: mboes, thomie Differential Revision: https://phabricator.haskell.org/D2662 GHC Trac Issues: #11656 >--------------------------------------------------------------- 0b70ec0c3b72a7f87776743e64b47b65ef0ca4a5 compiler/simplCore/SimplCore.hs | 26 ++++++++++++++-------- ...inters.hs => CgStaticPointersNoFullLazyness.hs} | 0 ...tdout => CgStaticPointersNoFullLazyness.stdout} | 0 testsuite/tests/codeGen/should_run/all.T | 2 ++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 0af167e..ca869dc 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -204,16 +204,20 @@ getCoreToDo dflags [simpl_phase 0 ["post-worker-wrapper"] max_iter] )) + -- Static forms are moved to the top level with the FloatOut pass. + -- See Note [Grand plan for static forms]. + static_ptrs_float_outwards = + runWhen static_ptrs $ CoreDoFloatOutwards FloatOutSwitches + { floatOutLambdas = Just 0 + , floatOutConstants = True + , floatOutOverSatApps = False + , floatToTopLevelOnly = True + } + core_todo = if opt_level == 0 then [ vectorisation, - -- Static forms are moved to the top level with the FloatOut pass. - -- See Note [Grand plan for static forms]. - runWhen static_ptrs $ CoreDoFloatOutwards FloatOutSwitches { - floatOutLambdas = Just 0, - floatOutConstants = True, - floatOutOverSatApps = False, - floatToTopLevelOnly = True }, + static_ptrs_float_outwards, CoreDoSimplify max_iter (base_mode { sm_phase = Phase 0 , sm_names = ["Non-opt simplification"] }) @@ -238,12 +242,12 @@ getCoreToDo dflags -- so that overloaded functions have all their dictionary lambdas manifest runWhen do_specialise CoreDoSpecialising, - runWhen full_laziness $ + if full_laziness then CoreDoFloatOutwards FloatOutSwitches { floatOutLambdas = Just 0, floatOutConstants = True, floatOutOverSatApps = False, - floatToTopLevelOnly = False }, + floatToTopLevelOnly = False } -- Was: gentleFloatOutSwitches -- -- I have no idea why, but not floating constants to @@ -261,6 +265,10 @@ getCoreToDo dflags -- difference at all to performance if we do it here, -- but maybe we save some unnecessary to-and-fro in -- the simplifier. + else + -- Even with full laziness turned off, we still need to float static + -- forms to the top level. See Note [Grand plan for static forms]. + static_ptrs_float_outwards, simpl_phases, diff --git a/testsuite/tests/codeGen/should_run/CgStaticPointers.hs b/testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs similarity index 100% copy from testsuite/tests/codeGen/should_run/CgStaticPointers.hs copy to testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs diff --git a/testsuite/tests/codeGen/should_run/CgStaticPointers.stdout b/testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.stdout similarity index 100% copy from testsuite/tests/codeGen/should_run/CgStaticPointers.stdout copy to testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.stdout diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 65e3dc0..23caa8c 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -119,6 +119,8 @@ test('T8256', normal, compile_and_run, ['-dcore-lint -O1']) test('T6084',normal, compile_and_run, ['-O2']) test('CgStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))], compile_and_run, ['']) +test('CgStaticPointersNoFullLazyness', [when(doing_ghci(), extra_hc_opts('-fobject-code'))], + compile_and_run, ['-O -fno-full-laziness']) test('StaticArraySize', [when(doing_ghci(), extra_hc_opts('-fobject-code'))], compile_and_run, ['-O2']) test('StaticByteArraySize', normal, compile_and_run, ['-O2']) From git at git.haskell.org Tue Nov 1 19:32:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 1 Nov 2016 19:32:18 +0000 (UTC) Subject: [commit: ghc] master: Sparc*: Prevent GHC from doing unaligned accesses (19ce8a5) Message-ID: <20161101193218.C9AFD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/19ce8a53e8074a7e56fd462e43750386e67edcd4/ghc >--------------------------------------------------------------- commit 19ce8a53e8074a7e56fd462e43750386e67edcd4 Author: Erik de Castro Lopo Date: Wed Nov 2 06:26:22 2016 +1100 Sparc*: Prevent GHC from doing unaligned accesses This is specifically for the C backend on Sparc64 (which has no native backend) but is also required for Sparc when building un-registerised. Bug reported via Debian (patch included): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842780 Test Plan: validate Reviewers: hvr, Phyx, bgamari, austin, simonmar Reviewed By: Phyx Subscribers: jrtc27, thomie Differential Revision: https://phabricator.haskell.org/D2661 GHC Trac Issues: #12793 >--------------------------------------------------------------- 19ce8a53e8074a7e56fd462e43750386e67edcd4 compiler/cmm/PprC.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 331dd67..6380451 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -1110,6 +1110,8 @@ cLoad expr rep bewareLoadStoreAlignment ArchMipsel = True bewareLoadStoreAlignment (ArchARM {}) = True bewareLoadStoreAlignment ArchARM64 = True + bewareLoadStoreAlignment ArchSPARC = True + bewareLoadStoreAlignment ArchSPARC64 = True -- Pessimistically assume that they will also cause problems -- on unknown arches bewareLoadStoreAlignment ArchUnknown = True From git at git.haskell.org Wed Nov 2 12:34:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 12:34:02 +0000 (UTC) Subject: [commit: ghc] master: Simplify the API for TcHsType.kcHsTyVarBndrs (7a50966) Message-ID: <20161102123402.950FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7a509660b5ea3d0c387c8fa32146b60955364b17/ghc >--------------------------------------------------------------- commit 7a509660b5ea3d0c387c8fa32146b60955364b17 Author: Simon Peyton Jones Date: Wed Nov 2 11:48:51 2016 +0000 Simplify the API for TcHsType.kcHsTyVarBndrs Pass in a Bool rather than return a funcion! No change in behaviour. >--------------------------------------------------------------- 7a509660b5ea3d0c387c8fa32146b60955364b17 compiler/typecheck/TcHsType.hs | 21 ++++++++++----------- compiler/typecheck/TcTyClsDecls.hs | 30 ++++++++++++++---------------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index a9d90f2..3b19298 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1262,16 +1262,15 @@ tcWildCardBindersX new_wc wc_names thing_inside -- -- This function does not do telescope checking. kcHsTyVarBndrs :: Name -- ^ of the thing being checked + -> Bool -- ^ True <=> the TyCon being kind-checked can be unsaturated -> Bool -- ^ True <=> the decl being checked has a CUSK -> Bool -- ^ True <=> the decl is an open type/data family -> Bool -- ^ True <=> all the hsq_implicit are *kind* vars -- (will give these kind * if -XNoTypeInType) -> LHsQTyVars Name - -> TcM (Kind, r) -- ^ the result kind, possibly with other info - -> TcM (Bool -> TcTyCon, r) - -- ^ a way to make a TcTyCon, with the other info. - -- The Bool says whether the tycon can be unsaturated. -kcHsTyVarBndrs name cusk open_fam all_kind_vars + -> TcM (Kind, r) -- ^ The result kind, possibly with other info + -> TcM (TcTyCon, r) -- ^ A suitably-kinded TcTyCon +kcHsTyVarBndrs name unsat cusk open_fam all_kind_vars (HsQTvs { hsq_implicit = kv_ns, hsq_explicit = hs_tvs , hsq_dependent = dep_names }) thing_inside | cusk @@ -1310,13 +1309,13 @@ kcHsTyVarBndrs name cusk open_fam all_kind_vars ; let final_binders = map (mkNamedTyConBinder Specified) good_tvs ++ tc_binders - mk_tctc unsat = mkTcTyCon name final_binders res_kind - unsat (scoped_kvs ++ tc_tvs) + tycon = mkTcTyCon name final_binders res_kind + unsat (scoped_kvs ++ tc_tvs) -- the tvs contain the binders already -- in scope from an enclosing class, but -- re-adding tvs to the env't doesn't cause -- harm - ; return ( mk_tctc, stuff ) }} + ; return (tycon, stuff) }} | otherwise = do { kv_kinds <- mk_kv_kinds @@ -1327,9 +1326,9 @@ kcHsTyVarBndrs name cusk open_fam all_kind_vars bind_telescope hs_tvs thing_inside ; let -- NB: Don't add scoped_kvs to tyConTyVars, because they -- must remain lined up with the binders - mk_tctc unsat = mkTcTyCon name binders res_kind unsat - (scoped_kvs ++ binderVars binders) - ; return (mk_tctc, stuff) } + tycon = mkTcTyCon name binders res_kind unsat + (scoped_kvs ++ binderVars binders) + ; return (tycon, stuff) } where -- if -XNoTypeInType and we know all the implicits are kind vars, -- just give the kind *. This prevents test diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index fefe1e9..0b471d2 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -437,12 +437,11 @@ getInitialKind :: TyClDecl Name -- No family instances are passed to getInitialKinds getInitialKind decl@(ClassDecl { tcdLName = L _ name, tcdTyVars = ktvs, tcdATs = ats }) - = do { (mk_tctc, inner_prs) <- - kcHsTyVarBndrs name cusk False True ktvs $ + = do { (tycon, inner_prs) <- + kcHsTyVarBndrs name True cusk False True ktvs $ do { inner_prs <- getFamDeclInitialKinds (Just cusk) ats ; return (constraintKind, inner_prs) } - ; let main_pr = mkTcTyConPair (mk_tctc True) - ; return (main_pr : inner_prs) } + ; return (mkTcTyConPair tycon : inner_prs) } where cusk = hsDeclHasCusk decl @@ -450,16 +449,15 @@ getInitialKind decl@(DataDecl { tcdLName = L _ name , tcdTyVars = ktvs , tcdDataDefn = HsDataDefn { dd_kindSig = m_sig , dd_cons = cons } }) - = do { (mk_tctc, _) <- - kcHsTyVarBndrs name (hsDeclHasCusk decl) False True ktvs $ + = do { (tycon, _) <- + kcHsTyVarBndrs name True (hsDeclHasCusk decl) False True ktvs $ do { res_k <- case m_sig of Just ksig -> tcLHsKind ksig Nothing -> return liftedTypeKind ; return (res_k, ()) } - ; let main_pr = mkTcTyConPair (mk_tctc True) - inner_prs = [ (unLoc con, APromotionErr RecDataConPE) + ; let inner_prs = [ (unLoc con, APromotionErr RecDataConPE) | L _ con' <- cons, con <- getConNames con' ] - ; return (main_pr : inner_prs) } + ; return (mkTcTyConPair tycon : inner_prs) } getInitialKind (FamDecl { tcdFam = decl }) = getFamDeclInitialKind Nothing decl @@ -482,8 +480,8 @@ getFamDeclInitialKind mb_cusk decl@(FamilyDecl { fdLName = L _ name , fdTyVars = ktvs , fdResultSig = L _ resultSig , fdInfo = info }) - = do { (mk_tctc, _) <- - kcHsTyVarBndrs name cusk open True ktvs $ + = do { (tycon, _) <- + kcHsTyVarBndrs name unsat cusk open True ktvs $ do { res_k <- case resultSig of KindSig ki -> tcLHsKind ki TyVarSig (L _ (KindedTyVar _ ki)) -> tcLHsKind ki @@ -493,7 +491,7 @@ getFamDeclInitialKind mb_cusk decl@(FamilyDecl { fdLName = L _ name -- by default | otherwise -> newMetaKindVar ; return (res_k, ()) } - ; return [ mkTcTyConPair (mk_tctc unsat) ] } + ; return [ mkTcTyConPair tycon ] } where cusk = famDeclHasCusk mb_cusk decl (open, unsat) = case info of @@ -523,13 +521,13 @@ kcSynDecl decl@(SynDecl { tcdTyVars = hs_tvs, tcdLName = L _ name , tcdRhs = rhs }) -- Returns a possibly-unzonked kind = tcAddDeclCtxt decl $ - do { (mk_tctc, _) <- - kcHsTyVarBndrs name (hsDeclHasCusk decl) False True hs_tvs $ + do { (tycon, _) <- + kcHsTyVarBndrs name False (hsDeclHasCusk decl) False True hs_tvs $ do { traceTc "kcd1" (ppr name <+> brackets (ppr hs_tvs)) ; (_, rhs_kind) <- tcLHsType rhs ; traceTc "kcd2" (ppr name) ; return (rhs_kind, ()) } - ; return (mk_tctc False) } + ; return tycon } kcSynDecl decl = pprPanic "kcSynDecl" (ppr decl) ------------------------------------------------------------------------ @@ -588,7 +586,7 @@ kcConDecl (ConDeclH98 { con_name = name, con_qvars = ex_tvs -- the 'False' says that the existentials don't have a CUSK, as the -- concept doesn't really apply here. We just need to bring the variables -- into scope. - do { _ <- kcHsTyVarBndrs (unLoc name) False False False + do { _ <- kcHsTyVarBndrs (unLoc name) False False False False ((fromMaybe emptyLHsQTvs ex_tvs)) $ do { _ <- tcHsContext (fromMaybe (noLoc []) ex_ctxt) ; mapM_ (tcHsOpenType . getBangType) (hsConDeclArgTys details) From git at git.haskell.org Wed Nov 2 12:34:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 12:34:05 +0000 (UTC) Subject: [commit: ghc] master: Use substTyUnchecked in TcMType.new_meta_tv_x (f4a14d6) Message-ID: <20161102123405.46FEC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4a14d6c535bdf52b19f441fe185ea13d62fdc24/ghc >--------------------------------------------------------------- commit f4a14d6c535bdf52b19f441fe185ea13d62fdc24 Author: Simon Peyton Jones Date: Wed Nov 2 11:50:10 2016 +0000 Use substTyUnchecked in TcMType.new_meta_tv_x Sadly, one of the indirect callers of this function doesn't yet enforce the in-scope set. It's in the TcHsType.tc_infer_args swamp, so I'm not going to wade in there today. The assertion tripped when investigating Trac #12785; but this patch does NOT fix the actual bug reported there. >--------------------------------------------------------------- f4a14d6c535bdf52b19f441fe185ea13d62fdc24 compiler/typecheck/TcMType.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index a290047..0892f64 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -806,7 +806,12 @@ new_meta_tv_x info subst tv ; details <- newMetaDetails info ; let name = mkSystemName uniq (getOccName tv) -- See Note [Name of an instantiated type variable] - kind = substTy subst (tyVarKind tv) + kind = substTyUnchecked subst (tyVarKind tv) + -- Unchecked because we call newMetaTyVarX from + -- tcInstBinderX, which is called from tc_infer_args + -- which does not yet take enough trouble to ensure + -- the in-scope set is right; e.g. Trac #12785 trips + -- if we use substTy here new_tv = mkTcTyVar name kind details subst1 = extendTvSubstWithClone subst tv new_tv ; return (subst1, new_tv) } From git at git.haskell.org Wed Nov 2 12:34:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 12:34:08 +0000 (UTC) Subject: [commit: ghc] master: Fix Trac #12797: approximateWC (13508ba) Message-ID: <20161102123408.7710F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/13508bad4810d4fa8581afbcb4f41c97fe4c92e2/ghc >--------------------------------------------------------------- commit 13508bad4810d4fa8581afbcb4f41c97fe4c92e2 Author: Simon Peyton Jones Date: Wed Nov 2 11:53:21 2016 +0000 Fix Trac #12797: approximateWC This patch makes approximateWC a bit more gung-ho when called from the defaulting code. See Note [ApproximateWC], item (1). >--------------------------------------------------------------- 13508bad4810d4fa8581afbcb4f41c97fe4c92e2 compiler/typecheck/TcSimplify.hs | 28 ++++++++++++---------- testsuite/tests/typecheck/should_compile/T12797.hs | 15 ++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index ddf0bce..0594313 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -595,7 +595,7 @@ simplifyInfer rhs_tclvl infer_mode sigs name_taus wanteds -- NB: must include derived errors in this test, -- hence "incl_derivs" - else do { let quant_cand = approximateWC wanted_transformed + else do { let quant_cand = approximateWC False wanted_transformed meta_tvs = filter isMetaTyVar $ tyCoVarsOfCtsList quant_cand @@ -1606,10 +1606,10 @@ defaultTyVarTcS the_tv | otherwise = return False -- the common case -approximateWC :: WantedConstraints -> Cts +approximateWC :: Bool -> WantedConstraints -> Cts -- Postcondition: Wanted or Derived Cts -- See Note [ApproximateWC] -approximateWC wc +approximateWC float_past_equalities wc = float_wc emptyVarSet wc where float_wc :: TcTyCoVarSet -> WantedConstraints -> Cts @@ -1630,18 +1630,17 @@ approximateWC wc float_implic :: TcTyCoVarSet -> Implication -> Cts float_implic trapping_tvs imp - | ic_no_eqs imp -- No equalities, so float + | float_past_equalities || ic_no_eqs imp = float_wc new_trapping_tvs (ic_wanted imp) - | otherwise -- Don't float out of equalities - = emptyCts -- See Note [ApproximateWC] + | otherwise -- Take care with equalities + = emptyCts -- See (1) under Note [ApproximateWC] where new_trapping_tvs = trapping_tvs `extendVarSetList` ic_skols imp do_bag :: (a -> Bag c) -> Bag a -> Bag c do_bag f = foldrBag (unionBags.f) emptyBag -{- -Note [ApproximateWC] -~~~~~~~~~~~~~~~~~~~~ +{- Note [ApproximateWC] +~~~~~~~~~~~~~~~~~~~~~~~ approximateWC takes a constraint, typically arising from the RHS of a let-binding whose type we are *inferring*, and extracts from it some *simple* constraints that we might plausibly abstract over. Of course @@ -1653,8 +1652,9 @@ to applyDefaultingRules) to extract constraints that that might be defaulted. There are two caveats: -1. We do *not* float anything out if the implication binds equality - constraints, because that defeats the OutsideIn story. Consider +1. When infering most-general types (in simplifyInfer), we do *not* + float anything out if the implication binds equality constraints, + because that defeats the OutsideIn story. Consider data T a where TInt :: T Int MkT :: T a @@ -1669,6 +1669,10 @@ There are two caveats: float out of such implications, which meant it would happily infer non-principal types.) + HOWEVER (Trac #12797) in findDefaultableGroups we are not worried about + the most-general type; and we /do/ want to float out of equalities. + Hence the boolean flag to approximateWC. + 2. We do not float out an inner constraint that shares a type variable (transitively) with one that is trapped by a skolem. Eg forall a. F a ~ beta, Integral beta @@ -2000,7 +2004,7 @@ findDefaultableGroups (default_tys, (ovl_strings, extended_defaults)) wanteds , defaultable_tyvar tv , defaultable_classes (map sndOf3 group) ] where - simples = approximateWC wanteds + simples = approximateWC True wanteds (unaries, non_unaries) = partitionWith find_unary (bagToList simples) unary_groups = equivClasses cmp_tv unaries diff --git a/testsuite/tests/typecheck/should_compile/T12797.hs b/testsuite/tests/typecheck/should_compile/T12797.hs new file mode 100644 index 0000000..01bf5af --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12797.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE NoMonomorphismRestriction #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE ExtendedDefaultRules #-} + +module T12797 where + +import Prelude +import Control.Monad.IO.Class + +type family FuncArg (m :: (* -> *)) :: Maybe * + +test2 :: (MonadIO m, FuncArg m ~ 'Nothing) => m () +test2 = liftIO $ print 6 + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 93f1b5f..08a24d7 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -551,3 +551,4 @@ test('T12507', normal, compile, ['']) test('T12734', normal, compile, ['']) test('T12734a', normal, compile_fail, ['']) test('T12763', normal, compile, ['']) +test('T12797', normal, compile, ['']) From git at git.haskell.org Wed Nov 2 12:34:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 12:34:11 +0000 (UTC) Subject: [commit: ghc] master: Tiny refactor (79fb6e6) Message-ID: <20161102123411.25A823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/79fb6e663908041eebc5a88987f67dd875326d94/ghc >--------------------------------------------------------------- commit 79fb6e663908041eebc5a88987f67dd875326d94 Author: Simon Peyton Jones Date: Tue Nov 1 14:03:57 2016 +0000 Tiny refactor Swap order of calls in genInst just to make the two cases the same Plus some alpha-renaming >--------------------------------------------------------------- 79fb6e663908041eebc5a88987f67dd875326d94 compiler/typecheck/TcDeriv.hs | 4 ++-- compiler/typecheck/TcGenDeriv.hs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index af5e730..946ff2e 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1367,9 +1367,9 @@ genInst spec@(DS { ds_tvs = tvs, ds_tc = rep_tycon , Just $ getName $ head $ tyConDataCons rep_tycon ) } -- See Note [Newtype deriving and unused constructors] | otherwise - = do { (meth_binds, deriv_stuff) <- genDerivStuff mechanism loc clas + = do { inst_spec <- newDerivClsInst theta spec + ; (meth_binds, deriv_stuff) <- genDerivStuff mechanism loc clas rep_tycon tys tvs - ; inst_spec <- newDerivClsInst theta spec ; doDerivInstErrorChecks2 clas inst_spec mechanism ; traceTc "newder" (ppr inst_spec) ; let inst_info diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index 6c44d0d..2408e42 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -1600,7 +1600,7 @@ gen_Newtype_binds :: SrcSpan -> Type -- the representation type (already eta-reduced) -> LHsBinds RdrName -- See Note [Newtype-deriving instances] -gen_Newtype_binds loc cls inst_tvs cls_tys rhs_ty +gen_Newtype_binds loc cls inst_tvs inst_tys rhs_ty = listToBag $ map mk_bind (classMethods cls) where coerce_RDR = getRdrName coerceId @@ -1611,7 +1611,7 @@ gen_Newtype_binds loc cls inst_tvs cls_tys rhs_ty (FunRhs (L loc meth_RDR) Prefix) [] rhs_expr] where - Pair from_ty to_ty = mkCoerceClassMethEqn cls inst_tvs cls_tys rhs_ty meth_id + Pair from_ty to_ty = mkCoerceClassMethEqn cls inst_tvs inst_tys rhs_ty meth_id meth_RDR = getRdrName meth_id @@ -1638,14 +1638,14 @@ mkCoerceClassMethEqn :: Class -- the class being derived -- See Note [Newtype-deriving instances] -- The pair is the (from_type, to_type), where to_type is -- the type of the method we are tyrying to get -mkCoerceClassMethEqn cls inst_tvs cls_tys rhs_ty id +mkCoerceClassMethEqn cls inst_tvs inst_tys rhs_ty id = Pair (substTy rhs_subst user_meth_ty) (substTy lhs_subst user_meth_ty) where cls_tvs = classTyVars cls in_scope = mkInScopeSet $ mkVarSet inst_tvs - lhs_subst = mkTvSubst in_scope (zipTyEnv cls_tvs cls_tys) - rhs_subst = mkTvSubst in_scope (zipTyEnv cls_tvs (changeLast cls_tys rhs_ty)) + lhs_subst = mkTvSubst in_scope (zipTyEnv cls_tvs inst_tys) + rhs_subst = mkTvSubst in_scope (zipTyEnv cls_tvs (changeLast inst_tys rhs_ty)) (_class_tvs, _class_constraint, user_meth_ty) = tcSplitMethodTy (varType id) From git at git.haskell.org Wed Nov 2 12:34:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 12:34:13 +0000 (UTC) Subject: [commit: ghc] master: Get rid of TcTyVars more assiduously (9968949) Message-ID: <20161102123413.D5EDA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/996894922c3c23f0ed68f0e344d0e5b573f95212/ghc >--------------------------------------------------------------- commit 996894922c3c23f0ed68f0e344d0e5b573f95212 Author: Simon Peyton Jones Date: Wed Nov 2 11:42:37 2016 +0000 Get rid of TcTyVars more assiduously * I found a bug in 'generalize' in TcTyClsDecls.kcTyClGroup, where the kind variables weren't being turned into proper TyVars, so we got (skolem) TcTyVars in TyCons, which shouldn't happen. Fix was easy. * Similarly TcHsType.kindGeneralizeType wasn't turning the forall'd TcTyVars into TyVars. To achieve this I defined TcHsTyn.zonkSigType. * All this allowed me to remove awkward and ill-explained bit of footwork on DFunIds in Inst.newClsInst This is just refactoring, but it does make the printout from -ddump-deriv make a bit more sense by not grautuitiously cloning type variables. In the display I was seeing instance C [a_df4] where f x = ...a_dx5... where actually the d_df4 and a_dx5 were the same. >--------------------------------------------------------------- 996894922c3c23f0ed68f0e344d0e5b573f95212 compiler/typecheck/Inst.hs | 16 +++++++++------- compiler/typecheck/TcHsSyn.hs | 17 ++++++++++++++++- compiler/typecheck/TcHsType.hs | 5 ++++- compiler/typecheck/TcTyClsDecls.hs | 13 ++++++------- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs index e5b8020..0a50de4 100644 --- a/compiler/typecheck/Inst.hs +++ b/compiler/typecheck/Inst.hs @@ -638,13 +638,15 @@ newClsInst overlap_mode dfun_name tvs theta clas tys = do { (subst, tvs') <- freshenTyVarBndrs tvs -- Be sure to freshen those type variables, -- so they are sure not to appear in any lookup - ; let tys' = substTys subst tys - theta' = substTheta subst theta - dfun = mkDictFunId dfun_name tvs' theta' clas tys' - -- Substituting in the DFun type just makes sure that - -- we are using TyVars rather than TcTyVars - -- Not sure if this is really the right place to do so, - -- but it'll do fine + ; let tys' = substTys subst tys + + dfun = mkDictFunId dfun_name tvs theta clas tys + -- The dfun uses the original 'tvs' because + -- (a) they don't need to be fresh + -- (b) they may be mentioned in the ib_binds field of + -- an InstInfo, and in TcEnv.pprInstInfoDetails it's + -- helpful to use the same names + ; oflag <- getOverlapFlag overlap_mode ; let inst = mkLocalInstance dfun oflag tvs' clas tys' ; warnIf (Reason Opt_WarnOrphans) diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index 618c3c0..2589576 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -30,7 +30,7 @@ module TcHsSyn ( zonkTyConBinders, emptyZonkEnv, mkEmptyZonkEnv, zonkTcTypeToType, zonkTcTypeToTypes, zonkTyVarOcc, - zonkCoToCo, + zonkCoToCo, zonkSigType, zonkEvBinds, -- * Validity checking @@ -187,6 +187,8 @@ the environment manipulation is tiresome. -- Confused by zonking? See Note [What is zonking?] in TcMType. type UnboundTyVarZonker = TcTyVar -> TcM Type -- How to zonk an unbound type variable + -- The TcTyVar is (a) a MetaTv (b) Flexi and + -- (c) its kind is alrady zonked -- Note [Zonking the LHS of a RULE] -- | A ZonkEnv carries around several bits. @@ -1595,6 +1597,19 @@ zonkTcTypeToTypes env tys = mapM (zonkTcTypeToType env) tys zonkCoToCo :: ZonkEnv -> Coercion -> TcM Coercion zonkCoToCo = mapCoercion zonk_tycomapper +zonkSigType :: TcType -> TcM Type +-- Zonk the type obtained from a user type signature +-- We want to turn any quantified (forall'd) variables into TyVars +-- but we may find some free TcTyVars, and we want to leave them +-- completely alone. They may even have unification variables inside +-- e.g. f (x::a) = ...(e :: a -> a).... +-- The type sig for 'e' mentions a free 'a' which will be a +-- unification SigTv variable. +zonkSigType = zonkTcTypeToType (mkEmptyZonkEnv zonk_unbound_tv) + where + zonk_unbound_tv :: UnboundTyVarZonker + zonk_unbound_tv tv = return (mkTyVarTy tv) + zonkTvSkolemising :: UnboundTyVarZonker -- This variant is used for the LHS of rules -- See Note [Zonking the LHS of a RULE]. diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 17bac58..a9d90f2 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -55,6 +55,7 @@ import TcUnify import TcIface import TcSimplify ( solveEqualities ) import TcType +import TcHsSyn( zonkSigType ) import Inst ( tcInstBinders, tcInstBindersX, tcInstBinderX ) import Type import Kind @@ -1543,7 +1544,9 @@ kindGeneralizeType :: Type -> TcM Type -- Result is zonked kindGeneralizeType ty = do { kvs <- kindGeneralize ty - ; zonkTcType (mkInvForAllTys kvs ty) } + ; ty <- zonkSigType (mkInvForAllTys kvs ty) + ; traceTc "kindGen" (ppr (mkInvForAllTys kvs ty) $$ ppr ty) + ; return ty } kindGeneralize :: TcType -> TcM [KindVar] -- Quantify the free kind variables of a kind or type diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index aa6d44f..fefe1e9 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -350,19 +350,18 @@ kcTyClGroup decls kc_res_kind = tyConResKind tc kc_tyvars = tyConTyVars tc ; kvs <- kindGeneralize (mkTyConKind kc_binders kc_res_kind) + ; let all_binders = mkNamedTyConBinders Inferred kvs ++ kc_binders - ; (env, kc_binders') <- zonkTyConBinders emptyZonkEnv kc_binders - ; kc_res_kind' <- zonkTcTypeToType env kc_res_kind + ; (env, all_binders') <- zonkTyConBinders emptyZonkEnv all_binders + ; kc_res_kind' <- zonkTcTypeToType env kc_res_kind -- Make sure kc_kind' has the final, zonked kind variables ; traceTc "Generalise kind" $ - vcat [ ppr name, ppr kc_binders, ppr kc_res_kind - , ppr kvs, ppr kc_binders', ppr kc_res_kind' + vcat [ ppr name, ppr kc_binders, ppr kvs, ppr all_binders, ppr kc_res_kind + , ppr all_binders', ppr kc_res_kind' , ppr kc_tyvars, ppr (tcTyConScopedTyVars tc)] - ; return (mkTcTyCon name - (mkNamedTyConBinders Inferred kvs ++ kc_binders') - kc_res_kind' + ; return (mkTcTyCon name all_binders' kc_res_kind' (mightBeUnsaturatedTyCon tc) (tcTyConScopedTyVars tc)) } From git at git.haskell.org Wed Nov 2 16:51:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 16:51:00 +0000 (UTC) Subject: [commit: ghc] master: Renaming and comments in CorePrep (623b8e4) Message-ID: <20161102165100.36AE23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/623b8e44b1647083ff5d85ef40b7cf88870acef5/ghc >--------------------------------------------------------------- commit 623b8e44b1647083ff5d85ef40b7cf88870acef5 Author: Simon Peyton Jones Date: Wed Nov 2 16:48:38 2016 +0000 Renaming and comments in CorePrep In particular I renamed 'triv' to 'arg' CpeTriv to CpeArg in Note [CorePrep invariants], with knock on consequences. This is groundwork for the fix to Trac #11158 >--------------------------------------------------------------- 623b8e44b1647083ff5d85ef40b7cf88870acef5 compiler/coreSyn/CorePrep.hs | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index 510b178..efcf0d3 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -127,17 +127,17 @@ when type erasure is done for conversion to STG, we don't end up with any trivial or useless bindings. -Invariants -~~~~~~~~~~ +Note [CorePrep invariants] +~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is the syntax of the Core produced by CorePrep: Trivial expressions - triv ::= lit | var - | triv ty | /\a. triv - | truv co | /\c. triv | triv |> co + arg ::= lit | var + | arg ty | /\a. arg + | truv co | /\c. arg | arg |> co Applications - app ::= lit | var | app triv | app ty | app co | app |> co + app ::= lit | var | app arg | app ty | app co | app |> co Expressions body ::= app @@ -153,7 +153,7 @@ We define a synonym for each of these non-terminals. Functions with the corresponding name produce a result in that syntax. -} -type CpeTriv = CoreExpr -- Non-terminal 'triv' +type CpeArg = CoreExpr -- Non-terminal 'arg' type CpeApp = CoreExpr -- Non-terminal 'app' type CpeBody = CoreExpr -- Non-terminal 'body' type CpeRhs = CoreExpr -- Non-terminal 'rhs' @@ -649,9 +649,9 @@ rhsToBody expr = return (emptyFloats, expr) -- CpeApp: produces a result satisfying CpeApp -- --------------------------------------------------------------------------- -data CpeArg = CpeArg CoreArg - | CpeCast Coercion - | CpeTick (Tickish Id) +data ArgInfo = CpeApp CoreArg + | CpeCast Coercion + | CpeTick (Tickish Id) {- Note [runRW arg] ~~~~~~~~~~~~~~~~~~~ @@ -674,16 +674,16 @@ cpeApp top_env expr where -- We have a nested data structure of the form -- e `App` a1 `App` a2 ... `App` an, convert it into - -- (e, [CpeArg a1, CpeArg a2, ..., CpeArg an], depth) - -- We use 'CpeArg' because we may also need to + -- (e, [CpeApp a1, CpeApp a2, ..., CpeApp an], depth) + -- We use 'ArgInfo' because we may also need to -- record casts and ticks. Depth counts the number -- of arguments that would consume strictness information -- (so, no type or coercion arguments.) - collect_args :: CoreExpr -> (CoreExpr, [CpeArg], Int) + collect_args :: CoreExpr -> (CoreExpr, [ArgInfo], Int) collect_args e = go e [] 0 where go (App fun arg) as depth - = go fun (CpeArg arg : as) + = go fun (CpeApp arg : as) (if isTyCoArg arg then depth else depth + 1) go (Cast fun co) as depth = go fun (CpeCast co : as) depth @@ -695,10 +695,10 @@ cpeApp top_env expr cpe_app :: CorePrepEnv -> CoreExpr - -> [CpeArg] + -> [ArgInfo] -> Int -> UniqSM (Floats, CpeRhs) - cpe_app env (Var f) (CpeArg Type{} : CpeArg arg : args) depth + cpe_app env (Var f) (CpeApp Type{} : CpeApp arg : args) depth | f `hasKey` lazyIdKey -- Replace (lazy a) with a, and || f `hasKey` noinlineIdKey -- Replace (noinline a) with a -- Consider the code: @@ -716,13 +716,13 @@ cpeApp top_env expr -- rather than the far superior "f x y". Test case is par01. = let (terminal, args', depth') = collect_args arg in cpe_app env terminal (args' ++ args) (depth + depth' - 1) - cpe_app env (Var f) [CpeArg _runtimeRep at Type{}, CpeArg _type at Type{}, CpeArg arg] 1 + cpe_app env (Var f) [CpeApp _runtimeRep at Type{}, CpeApp _type at Type{}, CpeApp arg] 1 | f `hasKey` runRWKey -- Replace (runRW# f) by (f realWorld#), beta reducing if possible (this -- is why we return a CorePrepEnv as well) = case arg of Lam s body -> cpe_app (extendCorePrepEnv env s realWorldPrimId) body [] 0 - _ -> cpe_app env arg [CpeArg (Var realWorldPrimId)] 1 + _ -> cpe_app env arg [CpeApp (Var realWorldPrimId)] 1 cpe_app env (Var v) args depth = do { v1 <- fiddleCCall v ; let e2 = lookupCorePrepEnv env v1 @@ -773,7 +773,7 @@ cpeApp top_env expr -- all of which are used to possibly saturate this application if it -- has a constructor or primop at the head. rebuild_app - :: [CpeArg] -- The arguments (inner to outer) + :: [ArgInfo] -- The arguments (inner to outer) -> CpeApp -> Type -> Floats @@ -783,11 +783,11 @@ cpeApp top_env expr MASSERT(null ss) -- make sure we used all the strictness info return (app, floats) rebuild_app (a : as) fun' fun_ty floats ss = case a of - CpeArg arg@(Type arg_ty) -> + CpeApp arg@(Type arg_ty) -> rebuild_app as (App fun' arg) (piResultTy fun_ty arg_ty) floats ss - CpeArg arg@(Coercion {}) -> + CpeApp arg@(Coercion {}) -> rebuild_app as (App fun' arg) (funResultTy fun_ty) floats ss - CpeArg arg -> do + CpeApp arg -> do let (ss1, ss_rest) -- See Note [lazyId magic] in MkId = case (ss, isLazyExpr arg) of (_ : ss_rest, True) -> (topDmd, ss_rest) @@ -817,7 +817,7 @@ isLazyExpr _ = False -- This is where we arrange that a non-trivial argument is let-bound cpeArg :: CorePrepEnv -> Demand - -> CoreArg -> Type -> UniqSM (Floats, CpeTriv) + -> CoreArg -> Type -> UniqSM (Floats, CpeArg) cpeArg env dmd arg arg_ty = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; (floats2, arg2) <- if want_float floats1 arg1 From git at git.haskell.org Wed Nov 2 20:14:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:14:52 +0000 (UTC) Subject: [commit: ghc] master: Uninstall signal handlers (8a5960a) Message-ID: <20161102201452.35D0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a5960ad874d31fcf631b4d427ccd9fae571745c/ghc >--------------------------------------------------------------- commit 8a5960ad874d31fcf631b4d427ccd9fae571745c Author: Sylvain HENRY Date: Wed Nov 2 14:55:06 2016 -0400 Uninstall signal handlers GHC installs signal handlers in runGhc/runGhcT to handle ^C but it never uninstalls them. It can be an issue, especially when using GHC as a library. Test Plan: validate Reviewers: bgamari, erikd, austin, simonmar Reviewed By: bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2633 GHC Trac Issues: #4162 >--------------------------------------------------------------- 8a5960ad874d31fcf631b4d427ccd9fae571745c compiler/main/GHC.hs | 10 ++----- compiler/utils/Panic.hs | 79 +++++++++++++++++++++++++++++++++++-------------- ghc/GHCi/UI.hs | 10 +++---- 3 files changed, 65 insertions(+), 34 deletions(-) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 5122329..8eb77ef 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -13,7 +13,7 @@ module GHC ( defaultErrorHandler, defaultCleanupHandler, prettyPrintGhcErrors, - installSignalHandlers, + withSignalHandlers, withCleanupSession, -- * GHC Monad @@ -438,13 +438,10 @@ runGhc :: Maybe FilePath -- ^ See argument to 'initGhcMonad'. runGhc mb_top_dir ghc = do ref <- newIORef (panic "empty session") let session = Session ref - flip unGhc session $ do - liftIO installSignalHandlers -- catch ^C + flip unGhc session $ withSignalHandlers $ do -- catch ^C initGhcMonad mb_top_dir withCleanupSession ghc - -- XXX: unregister interrupt handlers here? - -- | Run function for 'GhcT' monad transformer. -- -- It initialises the GHC session and warnings via 'initGhcMonad'. Each call @@ -458,8 +455,7 @@ runGhcT :: ExceptionMonad m => runGhcT mb_top_dir ghct = do ref <- liftIO $ newIORef (panic "empty session") let session = Session ref - flip unGhcT session $ do - liftIO installSignalHandlers -- catch ^C + flip unGhcT session $ withSignalHandlers $ do -- catch ^C initGhcMonad mb_top_dir withCleanupSession ghct diff --git a/compiler/utils/Panic.hs b/compiler/utils/Panic.hs index 721198e..6a7e96a 100644 --- a/compiler/utils/Panic.hs +++ b/compiler/utils/Panic.hs @@ -8,7 +8,7 @@ It's hard to put these functions anywhere else without causing some unnecessary loops in the module dependency graph. -} -{-# LANGUAGE CPP, ScopedTypeVariables #-} +{-# LANGUAGE CPP, ScopedTypeVariables, LambdaCase #-} module Panic ( GhcException(..), showGhcException, @@ -23,7 +23,7 @@ module Panic ( Exception.Exception(..), showException, safeShowException, try, tryMost, throwTo, - installSignalHandlers, + withSignalHandlers, ) where #include "HsVersions.h" @@ -32,17 +32,18 @@ import {-# SOURCE #-} Outputable (SDoc, showSDocUnsafe) import Config import Exception +import Control.Monad.IO.Class import Control.Concurrent import Debug.Trace ( trace ) import System.IO.Unsafe import System.Environment #ifndef mingw32_HOST_OS -import System.Posix.Signals +import System.Posix.Signals as S #endif #if defined(mingw32_HOST_OS) -import GHC.ConsoleHandler +import GHC.ConsoleHandler as S #endif import GHC.Stack @@ -222,15 +223,23 @@ tryMost action = do r <- try action Nothing -> throwIO se Right v -> return (Right v) +-- | We use reference counting for signal handlers +{-# NOINLINE signalHandlersRefCount #-} +#if !defined(mingw32_HOST_OS) +signalHandlersRefCount :: MVar (Word, Maybe (S.Handler,S.Handler + ,S.Handler,S.Handler)) +#else +signalHandlersRefCount :: MVar (Word, Maybe S.Handler) +#endif +signalHandlersRefCount = unsafePerformIO $ newMVar (0,Nothing) --- | Install standard signal handlers for catching ^C, which just throw an --- exception in the target thread. The current target thread is the --- thread at the head of the list in the MVar passed to --- installSignalHandlers. -installSignalHandlers :: IO () -installSignalHandlers = do - main_thread <- myThreadId - wtid <- mkWeakThreadId main_thread + +-- | Temporarily install standard signal handlers for catching ^C, which just +-- throw an exception in the current thread. +withSignalHandlers :: (ExceptionMonad m, MonadIO m) => m a -> m a +withSignalHandlers act = do + main_thread <- liftIO myThreadId + wtid <- liftIO (mkWeakThreadId main_thread) let interrupt = do @@ -240,14 +249,23 @@ installSignalHandlers = do Just t -> throwTo t UserInterrupt #if !defined(mingw32_HOST_OS) - _ <- installHandler sigQUIT (Catch interrupt) Nothing - _ <- installHandler sigINT (Catch interrupt) Nothing - -- see #3656; in the future we should install these automatically for - -- all Haskell programs in the same way that we install a ^C handler. - let fatal_signal n = throwTo main_thread (Signal (fromIntegral n)) - _ <- installHandler sigHUP (Catch (fatal_signal sigHUP)) Nothing - _ <- installHandler sigTERM (Catch (fatal_signal sigTERM)) Nothing - return () + let installHandlers = do + let installHandler' a b = installHandler a b Nothing + hdlQUIT <- installHandler' sigQUIT (Catch interrupt) + hdlINT <- installHandler' sigINT (Catch interrupt) + -- see #3656; in the future we should install these automatically for + -- all Haskell programs in the same way that we install a ^C handler. + let fatal_signal n = throwTo main_thread (Signal (fromIntegral n)) + hdlHUP <- installHandler' sigHUP (Catch (fatal_signal sigHUP)) + hdlTERM <- installHandler' sigTERM (Catch (fatal_signal sigTERM)) + return (hdlQUIT,hdlINT,hdlHUP,hdlTERM) + + let uninstallHandlers (hdlQUIT,hdlINT,hdlHUP,hdlTERM) = do + _ <- installHandler sigQUIT hdlQUIT Nothing + _ <- installHandler sigINT hdlINT Nothing + _ <- installHandler sigHUP hdlHUP Nothing + _ <- installHandler sigTERM hdlTERM Nothing + return () #else -- GHC 6.3+ has support for console events on Windows -- NOTE: running GHCi under a bash shell for some reason requires @@ -258,6 +276,23 @@ installSignalHandlers = do sig_handler Break = interrupt sig_handler _ = return () - _ <- installHandler (Catch sig_handler) - return () + let installHandlers = installHandler (Catch sig_handler) + let uninstallHandlers = installHandler -- directly install the old handler #endif + + -- install signal handlers if necessary + let mayInstallHandlers = liftIO $ modifyMVar_ signalHandlersRefCount $ \case + (0,Nothing) -> do + hdls <- installHandlers + return (1,Just hdls) + (c,oldHandlers) -> return (c+1,oldHandlers) + + -- uninstall handlers if necessary + let mayUninstallHandlers = liftIO $ modifyMVar_ signalHandlersRefCount $ \case + (1,Just hdls) -> do + uninstallHandlers hdls + return (0,Nothing) + (c,oldHandlers) -> return (c-1,oldHandlers) + + mayInstallHandlers + act `gfinally` mayUninstallHandlers diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 3cc3f5c..a3cb955 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -1139,9 +1139,9 @@ afterRunStmt step_here run_result = do afterRunStmt step_here >> return () flushInterpBuffers - liftIO installSignalHandlers - b <- isOptionSet RevertCAFs - when b revertCAFs + withSignalHandlers $ do + b <- isOptionSet RevertCAFs + when b revertCAFs return run_result @@ -3626,8 +3626,8 @@ handler :: SomeException -> GHCi Bool handler exception = do flushInterpBuffers - liftIO installSignalHandlers - ghciHandle handler (showException exception >> return False) + withSignalHandlers $ + ghciHandle handler (showException exception >> return False) showException :: SomeException -> GHCi () showException se = From git at git.haskell.org Wed Nov 2 20:14:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:14:56 +0000 (UTC) Subject: [commit: ghc] master: linker: Split MachO implementation into new source file (f6c47df) Message-ID: <20161102201456.45E4C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f6c47df34acee1b906146a6e54665192d02d15b6/ghc >--------------------------------------------------------------- commit f6c47df34acee1b906146a6e54665192d02d15b6 Author: Ben Gamari Date: Wed Nov 2 15:02:25 2016 -0400 linker: Split MachO implementation into new source file Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2649 >--------------------------------------------------------------- f6c47df34acee1b906146a6e54665192d02d15b6 rts/Linker.c | 1227 +-------------------------------------------------- rts/linker/MachO.c | 1244 ++++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/MachO.h | 21 + 3 files changed, 1266 insertions(+), 1226 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 f6c47df34acee1b906146a6e54665192d02d15b6 From git at git.haskell.org Wed Nov 2 20:14:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:14:59 +0000 (UTC) Subject: [commit: ghc] master: linker: Shuffle configuration into LinkerInternals.h (abfa319) Message-ID: <20161102201459.237353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/abfa3196a19cd8912fdbae121641474b3261d7cf/ghc >--------------------------------------------------------------- commit abfa3196a19cd8912fdbae121641474b3261d7cf Author: Ben Gamari Date: Wed Nov 2 15:00:44 2016 -0400 linker: Shuffle configuration into LinkerInternals.h Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2644 >--------------------------------------------------------------- abfa3196a19cd8912fdbae121641474b3261d7cf rts/Linker.c | 17 ----------------- rts/LinkerInternals.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 3e94069..74b4822 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -56,23 +56,6 @@ #include #endif -/* PowerPC and ARM have relative branch instructions with only 24 bit - * displacements and therefore need jump islands contiguous with each object - * code module. - */ -#if defined(powerpc_HOST_ARCH) -#define SHORT_REL_BRANCH 1 -#endif -#if defined(arm_HOST_ARCH) -#define SHORT_REL_BRANCH 1 -#endif - -#if (RTS_LINKER_USE_MMAP && defined(SHORT_REL_BRANCH) && defined(linux_HOST_OS)) -#define USE_CONTIGUOUS_MMAP 1 -#else -#define USE_CONTIGUOUS_MMAP 0 -#endif - #if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) # define OBJFORMAT_ELF # include // regex is already used by dlopen() so this is OK diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 729cf1d..460beae 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -301,4 +301,28 @@ getting, here. */ #endif /* OBJFORMAT_PEi386 */ + +/************************************************* + * Various bits of configuration + *************************************************/ + +/* PowerPC and ARM have relative branch instructions with only 24 bit + * displacements and therefore need jump islands contiguous with each object + * code module. + */ +#if defined(powerpc_HOST_ARCH) +#define SHORT_REL_BRANCH 1 +#endif +#if defined(arm_HOST_ARCH) +#define SHORT_REL_BRANCH 1 +#endif + +#if (RTS_LINKER_USE_MMAP && defined(SHORT_REL_BRANCH) && defined(linux_HOST_OS)) +#define USE_CONTIGUOUS_MMAP 1 +#else +#define USE_CONTIGUOUS_MMAP 0 +#endif + + + #endif /* LINKERINTERNALS_H */ From git at git.haskell.org Wed Nov 2 20:15:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:03 +0000 (UTC) Subject: [commit: ghc] master: linker: Split PEi386 implementation into new source file (6ea0b4f) Message-ID: <20161102201503.19DFD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ea0b4f1a6a0478eeeacb0a7be62e426d4aa58e5/ghc >--------------------------------------------------------------- commit 6ea0b4f1a6a0478eeeacb0a7be62e426d4aa58e5 Author: Ben Gamari Date: Wed Nov 2 15:02:13 2016 -0400 linker: Split PEi386 implementation into new source file Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2648 >--------------------------------------------------------------- 6ea0b4f1a6a0478eeeacb0a7be62e426d4aa58e5 rts/Linker.c | 1647 ++----------------------------------------------- rts/LinkerInternals.h | 118 +--- rts/linker/PEi386.c | 1589 +++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/PEi386.h | 161 +++++ 4 files changed, 1798 insertions(+), 1717 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 6ea0b4f1a6a0478eeeacb0a7be62e426d4aa58e5 From git at git.haskell.org Wed Nov 2 20:15:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:06 +0000 (UTC) Subject: [commit: ghc] master: linker: Split out CacheFlush logic (f4fb3bc) Message-ID: <20161102201506.947B93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4fb3bc15f49997962e223c4f8c489566d7f5d91/ghc >--------------------------------------------------------------- commit f4fb3bc15f49997962e223c4f8c489566d7f5d91 Author: Ben Gamari Date: Wed Nov 2 14:58:59 2016 -0400 linker: Split out CacheFlush logic Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2643 >--------------------------------------------------------------- f4fb3bc15f49997962e223c4f8c489566d7f5d91 rts/Linker.c | 69 +---------------------------------------------- rts/linker/CacheFlush.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/CacheFlush.h | 12 +++++++++ 3 files changed, 84 insertions(+), 68 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 7600ba8..3e94069 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -28,6 +28,7 @@ #include "Profiling.h" #include "sm/OSMem.h" #include "linker/M32Alloc.h" +#include "linker/CacheFlush.h" #include "PathUtils.h" #if !defined(mingw32_HOST_OS) @@ -2775,29 +2776,6 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) #endif #endif // NEED_SYMBOL_EXTRAS -#if defined(arm_HOST_ARCH) - -static void -ocFlushInstructionCache( ObjectCode *oc ) -{ - int i; - // Object code - for (i=0; i < oc->n_sections; i++) { - Section *s = &oc->sections[i]; - // This is a bit too broad but we don't have any way to determine what - // is certainly code - if (s->kind == SECTIONKIND_CODE_OR_RODATA) - __clear_cache(s->start, (void*) ((uintptr_t) s->start + s->size)); - } - - // Jump islands - // Note the (+1) to ensure that the last symbol extra is covered by the - // flush. - __clear_cache(oc->symbol_extras, &oc->symbol_extras[oc->n_symbol_extras+1]); -} - -#endif - #if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) #if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) @@ -2905,51 +2883,6 @@ static SymbolExtra* makeArmSymbolExtra( ObjectCode* oc, } #endif // arm_HOST_ARCH -/* -------------------------------------------------------------------------- - * PowerPC specifics (instruction cache flushing) - * ------------------------------------------------------------------------*/ - -#ifdef powerpc_HOST_ARCH -/* - ocFlushInstructionCache - - Flush the data & instruction caches. - Because the PPC has split data/instruction caches, we have to - do that whenever we modify code at runtime. - */ - -static void -ocFlushInstructionCacheFrom(void* begin, size_t length) -{ - size_t n = (length + 3) / 4; - unsigned long* p = begin; - - while (n--) - { - __asm__ volatile ( "dcbf 0,%0\n\t" - "sync\n\t" - "icbi 0,%0" - : - : "r" (p) - ); - p++; - } - __asm__ volatile ( "sync\n\t" - "isync" - ); -} - -static void -ocFlushInstructionCache( ObjectCode *oc ) -{ - /* The main object code */ - ocFlushInstructionCacheFrom(oc->image + oc->misalignment, oc->fileSize); - - /* Jump Islands */ - ocFlushInstructionCacheFrom(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras); -} -#endif /* powerpc_HOST_ARCH */ - /* -------------------------------------------------------------------------- * PEi386(+) specifics (Win32 targets) diff --git a/rts/linker/CacheFlush.c b/rts/linker/CacheFlush.c new file mode 100644 index 0000000..206b2ef --- /dev/null +++ b/rts/linker/CacheFlush.c @@ -0,0 +1,71 @@ +/* Platform-dependent cache flushing logic */ + +#include "Rts.h" +#include "linker/CacheFlush.h" + +#if defined(arm_HOST_ARCH) + +void +ocFlushInstructionCache( ObjectCode *oc ) +{ + int i; + // Object code + for (i=0; i < oc->n_sections; i++) { + Section *s = &oc->sections[i]; + // This is a bit too broad but we don't have any way to determine what + // is certainly code + if (s->kind == SECTIONKIND_CODE_OR_RODATA) + __clear_cache(s->start, (void*) ((uintptr_t) s->start + s->size)); + } + + // Jump islands + // Note the (+1) to ensure that the last symbol extra is covered by the + // flush. + __clear_cache(oc->symbol_extras, &oc->symbol_extras[oc->n_symbol_extras+1]); +} + +#elif defined(powerpc_HOST_ARCH) +/* + ocFlushInstructionCache + + Flush the data & instruction caches. + Because the PPC has split data/instruction caches, we have to + do that whenever we modify code at runtime. + */ + +static void +ocFlushInstructionCacheFrom(void* begin, size_t length) +{ + size_t n = (length + 3) / 4; + unsigned long* p = begin; + + while (n--) + { + __asm__ volatile ( "dcbf 0,%0\n\t" + "sync\n\t" + "icbi 0,%0" + : + : "r" (p) + ); + p++; + } + __asm__ volatile ( "sync\n\t" + "isync" + ); +} + +void +ocFlushInstructionCache( ObjectCode *oc ) +{ + /* The main object code */ + ocFlushInstructionCacheFrom(oc->image + oc->misalignment, oc->fileSize); + + /* Jump Islands */ + ocFlushInstructionCacheFrom(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras); +} + +#else + +void ocFlushInstructionCache( ObjectCode *oc STG_UNUSED ) {} + +#endif /* powerpc_HOST_ARCH */ diff --git a/rts/linker/CacheFlush.h b/rts/linker/CacheFlush.h new file mode 100644 index 0000000..f4d939d --- /dev/null +++ b/rts/linker/CacheFlush.h @@ -0,0 +1,12 @@ +#ifndef CACHE_FLUSH_H +#define CACHE_FLUSH_H + +#include "LinkerInternals.h" + +#include "BeginPrivate.h" + +void ocFlushInstructionCache( ObjectCode *oc ); + +#include "EndPrivate.h" + +#endif /* CACHE_FLUSH_H */ From git at git.haskell.org Wed Nov 2 20:15:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:09 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Simplify kernel32 glue logic (cc4710a) Message-ID: <20161102201509.621503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cc4710af723ca4bbcf77172ff715af22f9ce8419/ghc >--------------------------------------------------------------- commit cc4710af723ca4bbcf77172ff715af22f9ce8419 Author: Ben Gamari Date: Wed Nov 2 14:58:30 2016 -0400 testsuite: Simplify kernel32 glue logic On Windows the testsuite driver calls kernel32 to set the current terminal codepage. The previous implementation of this was significantly more complex than necessary, and was wrong in the case of MSYS2, which requires that we explicitly load the library using the name of its DLL, including its file extension. Test Plan: Validate on Windows Reviewers: austin, RyanGlScott, Phyx Reviewed By: RyanGlScott, Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2641 GHC Trac Issues: #12661 >--------------------------------------------------------------- cc4710af723ca4bbcf77172ff715af22f9ce8419 testsuite/driver/runtests.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index f36725e..c97323b 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -160,17 +160,18 @@ if windows: if windows: import ctypes # Windows and mingw* Python provide windll, msys2 python provides cdll. - if hasattr(ctypes, 'windll'): - mydll = ctypes.windll + if hasattr(ctypes, 'WinDLL'): + mydll = ctypes.WinDLL else: - mydll = ctypes.cdll + mydll = ctypes.CDLL # This actually leaves the terminal in codepage 65001 (UTF8) even # after python terminates. We ought really remember the old codepage # and set it back. - if mydll.kernel32.SetConsoleCP(65001) == 0: + kernel32 = mydll('kernel32.dll') + if kernel32.SetConsoleCP(65001) == 0: raise Exception("Failure calling SetConsoleCP(65001)") - if mydll.kernel32.SetConsoleOutputCP(65001) == 0: + if kernel32.SetConsoleOutputCP(65001) == 0: raise Exception("Failure calling SetConsoleOutputCP(65001)") else: # Try and find a utf8 locale to use From git at git.haskell.org Wed Nov 2 20:15:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:13 +0000 (UTC) Subject: [commit: ghc] master: linker: Split symbol extras logic into new source file (3f05126) Message-ID: <20161102201513.177BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f05126253a7d68b37a388c26b586d94e871614e/ghc >--------------------------------------------------------------- commit 3f05126253a7d68b37a388c26b586d94e871614e Author: Ben Gamari Date: Wed Nov 2 15:01:15 2016 -0400 linker: Split symbol extras logic into new source file Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2646 >--------------------------------------------------------------- 3f05126253a7d68b37a388c26b586d94e871614e rts/Linker.c | 201 +------------------------------------------- rts/linker/SymbolExtras.c | 209 ++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/SymbolExtras.h | 30 +++++++ 3 files changed, 240 insertions(+), 200 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 3f05126253a7d68b37a388c26b586d94e871614e From git at git.haskell.org Wed Nov 2 20:15:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:15 +0000 (UTC) Subject: [commit: ghc] master: Shuffle declarations into LinkerInternals.h (c3446c6) Message-ID: <20161102201515.D4BC53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c3446c63d64bdc5c2fa627f345c59e893ba0c176/ghc >--------------------------------------------------------------- commit c3446c63d64bdc5c2fa627f345c59e893ba0c176 Author: Ben Gamari Date: Wed Nov 2 15:01:27 2016 -0400 Shuffle declarations into LinkerInternals.h Summary: These will be needed across source files shortly. Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2647 >--------------------------------------------------------------- c3446c63d64bdc5c2fa627f345c59e893ba0c176 rts/Linker.c | 31 ++++--------------------------- rts/LinkerInternals.h | 32 ++++++++++++++++++++++++++++++++ rts/RtsSymbols.h | 4 +--- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 8147ed8..d735889 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -91,24 +91,6 @@ #include #endif -/* SymbolInfo tracks a symbol's address, the object code from which - it originated, and whether or not it's weak. - - RtsSymbolInfo is used to track the state of the symbols currently - loaded or to be loaded by the Linker. - - Where the information in the `ObjectCode` is used to track the - original status of the symbol inside the `ObjectCode`. - - A weak symbol that has been used will still be marked as weak - in the `ObjectCode` but in the `RtsSymbolInfo` it won't be. -*/ -typedef struct _RtsSymbolInfo { - SymbolAddr* value; - ObjectCode *owner; - HsBool weak; -} RtsSymbolInfo; - /* `symhash` is a Hash table mapping symbol names to RtsSymbolInfo. This hashtable will contain information on all symbols that we know of, however the .o they are in may not be loaded. @@ -206,9 +188,6 @@ Mutex linker_mutex; Mutex linker_unloaded_mutex; #endif -/* Type of the initializer */ -typedef void (*init_t) (int argc, char **argv, char **env); - static HsInt isAlreadyLoaded( pathchar *path ); static HsInt loadOc( ObjectCode* oc ); static ObjectCode* mkOc( pathchar *path, char *image, int imageSize, @@ -307,8 +286,6 @@ typedef DLL_DIRECTORY_COOKIE(WINAPI *LPAddDLLDirectory)(PCWSTR NewDirectory); typedef WINBOOL(WINAPI *LPRemoveDLLDirectory)(DLL_DIRECTORY_COOKIE Cookie); #endif /* OBJFORMAT_PEi386 */ -static void freeProddableBlocks (ObjectCode *oc); - /* on x86_64 we have a problem with relocating symbol references in * code that was compiled without -fPIC. By default, the small memory * model is used, which assumes that symbol references can fit in a @@ -2606,7 +2583,7 @@ HsInt purgeObj (pathchar *path) * which may be prodded during relocation, and abort if we try and write * outside any of these. */ -static void +void addProddableBlock ( ObjectCode* oc, void* start, int size ) { ProddableBlock* pb @@ -2620,7 +2597,7 @@ addProddableBlock ( ObjectCode* oc, void* start, int size ) oc->proddables = pb; } -static void +void checkProddableBlock (ObjectCode *oc, void *addr, size_t size ) { ProddableBlock* pb; @@ -2634,7 +2611,7 @@ checkProddableBlock (ObjectCode *oc, void *addr, size_t size ) barf("checkProddableBlock: invalid fixup in runtime linker: %p", addr); } -static void freeProddableBlocks (ObjectCode *oc) +void freeProddableBlocks (ObjectCode *oc) { ProddableBlock *pb, *next; @@ -2648,7 +2625,7 @@ static void freeProddableBlocks (ObjectCode *oc) /* ----------------------------------------------------------------------------- * Section management. */ -static void +void addSection (Section *s, SectionKind kind, SectionAlloc alloc, void* start, StgWord size, StgWord mapped_offset, void* mapped_start, StgWord mapped_size) diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 2fe9ff9..1d5288b 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -14,6 +14,9 @@ #include "BeginPrivate.h" +typedef void SymbolAddr; +typedef char SymbolName; + /* See Linker.c Note [runtime-linker-phases] */ typedef enum { OBJECT_LOADED, @@ -182,12 +185,41 @@ extern Mutex linker_mutex; extern Mutex linker_unloaded_mutex; #endif +/* Type of the initializer */ +typedef void (*init_t) (int argc, char **argv, char **env); + +/* SymbolInfo tracks a symbol's address, the object code from which + it originated, and whether or not it's weak. + + RtsSymbolInfo is used to track the state of the symbols currently + loaded or to be loaded by the Linker. + + Where the information in the `ObjectCode` is used to track the + original status of the symbol inside the `ObjectCode`. + + A weak symbol that has been used will still be marked as weak + in the `ObjectCode` but in the `RtsSymbolInfo` it won't be. +*/ +typedef struct _RtsSymbolInfo { + SymbolAddr* value; + ObjectCode *owner; + HsBool weak; +} RtsSymbolInfo; + void exitLinker( void ); void freeObjectCode (ObjectCode *oc); void *mmapForLinker (size_t bytes, uint32_t flags, int fd, int offset); +void addProddableBlock ( ObjectCode* oc, void* start, int size ); +void checkProddableBlock (ObjectCode *oc, void *addr, size_t size ); +void freeProddableBlocks (ObjectCode *oc); + +void addSection (Section *s, SectionKind kind, SectionAlloc alloc, + void* start, StgWord size, StgWord mapped_offset, + void* mapped_start, StgWord mapped_size); + #if defined(mingw32_HOST_OS) typedef unsigned char UChar; diff --git a/rts/RtsSymbols.h b/rts/RtsSymbols.h index b820163..dab2373 100644 --- a/rts/RtsSymbols.h +++ b/rts/RtsSymbols.h @@ -10,6 +10,7 @@ #define RTS_SYMBOLS_H #include "ghcautoconf.h" +#include "LinkerInternals.h" #ifdef LEADING_UNDERSCORE #define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s) @@ -17,9 +18,6 @@ #define MAYBE_LEADING_UNDERSCORE_STR(s) (s) #endif -typedef char SymbolName; -typedef void SymbolAddr; - typedef struct _RtsSymbolVal { const SymbolName* lbl; SymbolAddr* addr; From git at git.haskell.org Wed Nov 2 20:15:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:18 +0000 (UTC) Subject: [commit: ghc] master: linker: Move mmapForLinker declaration into LinkerInternals.h (43c8c1c) Message-ID: <20161102201518.994953A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/43c8c1c4a21c3b0a281433394163ba46a124a925/ghc >--------------------------------------------------------------- commit 43c8c1c4a21c3b0a281433394163ba46a124a925 Author: Ben Gamari Date: Wed Nov 2 15:01:03 2016 -0400 linker: Move mmapForLinker declaration into LinkerInternals.h Test Plan: Validate Reviewers: simonmar, erikd, austin Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2645 >--------------------------------------------------------------- 43c8c1c4a21c3b0a281433394163ba46a124a925 rts/LinkerInternals.h | 6 +++++- rts/linker/M32Alloc.c | 1 + rts/linker/M32Alloc.h | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 460beae..2fe9ff9 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -12,6 +12,8 @@ #include "Rts.h" #include "Hash.h" +#include "BeginPrivate.h" + /* See Linker.c Note [runtime-linker-phases] */ typedef enum { OBJECT_LOADED, @@ -184,6 +186,8 @@ void exitLinker( void ); void freeObjectCode (ObjectCode *oc); +void *mmapForLinker (size_t bytes, uint32_t flags, int fd, int offset); + #if defined(mingw32_HOST_OS) typedef unsigned char UChar; @@ -323,6 +327,6 @@ getting, here. */ #define USE_CONTIGUOUS_MMAP 0 #endif - +#include "EndPrivate.h" #endif /* LINKERINTERNALS_H */ diff --git a/rts/linker/M32Alloc.c b/rts/linker/M32Alloc.c index bdc2fdb..73f9be9 100644 --- a/rts/linker/M32Alloc.c +++ b/rts/linker/M32Alloc.c @@ -9,6 +9,7 @@ #include "Rts.h" #include "sm/OSMem.h" #include "linker/M32Alloc.h" +#include "LinkerInternals.h" #include #include diff --git a/rts/linker/M32Alloc.h b/rts/linker/M32Alloc.h index 3d53a26..db3d8c0 100644 --- a/rts/linker/M32Alloc.h +++ b/rts/linker/M32Alloc.h @@ -40,8 +40,6 @@ void m32_free(void *addr, size_t size) M32_NO_RETURN; void * m32_alloc(size_t size, size_t alignment) M32_NO_RETURN; -void * mmapForLinker (size_t bytes, uint32_t flags, int fd, int offset); - #include "EndPrivate.h" #endif From git at git.haskell.org Wed Nov 2 20:15:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:21 +0000 (UTC) Subject: [commit: ghc] master: Add notes describing SRT concepts (80076fa) Message-ID: <20161102201521.6302A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/80076fa68f68e337d74c42311f9c3ebebbdc4680/ghc >--------------------------------------------------------------- commit 80076fa68f68e337d74c42311f9c3ebebbdc4680 Author: Ben Gamari Date: Wed Nov 2 15:06:31 2016 -0400 Add notes describing SRT concepts Test Plan: Read it Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2663 >--------------------------------------------------------------- 80076fa68f68e337d74c42311f9c3ebebbdc4680 compiler/stgSyn/CoreToStg.hs | 28 ++++++++++++++++++++++++++++ includes/rts/storage/InfoTables.h | 13 ++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/compiler/stgSyn/CoreToStg.hs b/compiler/stgSyn/CoreToStg.hs index d130b74..0e33918 100644 --- a/compiler/stgSyn/CoreToStg.hs +++ b/compiler/stgSyn/CoreToStg.hs @@ -86,6 +86,34 @@ import Control.Monad (liftM, ap) -- live then so is `q'. Furthermore, if `e' mentions an enclosing -- let-no-escaped variable, then its free variables are also live if `v' is. +-- Note [What are these SRTs all about?] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- +-- Consider the Core program, +-- +-- fibs = go 1 1 +-- where go a b = let c = a + c +-- in c : go b c +-- add x = map (\y -> x*y) fibs +-- +-- In this case we have a CAF, 'fibs', which is quite large after evaluation and +-- has only one possible user, 'add'. Consequently, we want to ensure that when +-- all references to 'add' die we can garbage collect any bit of 'fibs' that we +-- have evaluated. +-- +-- However, how do we know whether there are any references to 'fibs' still +-- around? Afterall, the only reference to it is buried in the code generated +-- for 'add'. The answer is that we record the CAFs referred to by a definition +-- in its info table, namely a part of it known as the Static Reference Table +-- (SRT). +-- +-- Since SRTs are so common, we use a special compact encoding for them in: we +-- produce one table containing a list of CAFs in a module and then include a +-- bitmap in each info table describing which entries of this table the closure +-- references. +-- +-- See also: Commentary/Rts/Storage/GC/CAFs on the GHC Wiki. + -- Note [Collecting live CAF info] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h index fb14ac5..bb1bac0 100644 --- a/includes/rts/storage/InfoTables.h +++ b/includes/rts/storage/InfoTables.h @@ -223,10 +223,21 @@ typedef struct StgInfoTable_ { them doesn't affect the layout). - If srt_bitmap (in the std info table part) is zero, then the srt - field may be omitted. This only applies if the slow_apply and + field needn't be set. This only applies if the slow_apply and bitmap fields have also been omitted. -------------------------------------------------------------------------- */ +/* + Note [Encoding static reference tables] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + As static reference tables appear frequently in code, we use a special + compact encoding for the common case of a module defining only a few CAFs: We + produce one table containing a list of CAFs in the module and then include a + bitmap in each info table describing which entries of this table the closure + references. + */ + typedef struct StgFunInfoExtraRev_ { OFFSET_FIELD(slow_apply_offset); /* apply to args on the stack */ union { From git at git.haskell.org Wed Nov 2 20:15:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:25 +0000 (UTC) Subject: [commit: ghc] master: linker: Split ELF implementation into separate source file (bdc262c) Message-ID: <20161102201525.8CB4D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bdc262cc0ee511aa7bcd5c458f25ea1e4cc38583/ghc >--------------------------------------------------------------- commit bdc262cc0ee511aa7bcd5c458f25ea1e4cc38583 Author: Ben Gamari Date: Wed Nov 2 15:02:36 2016 -0400 linker: Split ELF implementation into separate source file Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2650 >--------------------------------------------------------------- bdc262cc0ee511aa7bcd5c458f25ea1e4cc38583 rts/Linker.c | 1714 +------------------------------------------------ rts/LinkerInternals.h | 12 + rts/linker/Elf.c | 1709 ++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/Elf.h | 17 + 4 files changed, 1743 insertions(+), 1709 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 bdc262cc0ee511aa7bcd5c458f25ea1e4cc38583 From git at git.haskell.org Wed Nov 2 20:15:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:28 +0000 (UTC) Subject: [commit: ghc] master: Hoopl/Dataflow: make the module more self-contained (dc4d596) Message-ID: <20161102201528.5852E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dc4d59621dff31908dc7646082a2c5a362deb10f/ghc >--------------------------------------------------------------- commit dc4d59621dff31908dc7646082a2c5a362deb10f Author: Michal Terepeta Date: Wed Nov 2 15:05:19 2016 -0400 Hoopl/Dataflow: make the module more self-contained This makes the GHC's Dataflow module more self-contained by also forking the `DataflowLattice` (instead of only the analysis algorithm). Effects/benefits: - We no longer need to use the deprecated Hoopl functions (and can remove `-fno-warn-warnings-deprecations` from two modules). - We can remove the unnecessary `Label` parameter of `JoinFun` (already ignored in all our implementations). - We no longer mix Hoopl's `Dataflow` module and GHC's one. - We can replace some calls to lazy folds in Hoopl with the strict ones (see `joinOutFacts` and `mkFactBase`). Signed-off-by: Michal Terepeta Test Plan: validate Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2660 >--------------------------------------------------------------- dc4d59621dff31908dc7646082a2c5a362deb10f compiler/cmm/CmmBuildInfoTables.hs | 12 +++---- compiler/cmm/CmmLive.hs | 12 +++---- compiler/cmm/CmmProcPoint.hs | 12 +++---- compiler/cmm/Hoopl.hs | 30 ++--------------- compiler/cmm/Hoopl/Dataflow.hs | 68 ++++++++++++++++++++++++++++++++++---- 5 files changed, 82 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 dc4d59621dff31908dc7646082a2c5a362deb10f From git at git.haskell.org Wed Nov 2 20:15:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 2 Nov 2016 20:15:31 +0000 (UTC) Subject: [commit: ghc] master: linker: Move ARM interworking note to SymbolExtras.c (6fecb7e) Message-ID: <20161102201531.0E8413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6fecb7e784daabe3f62ef8090e7019d7ad384080/ghc >--------------------------------------------------------------- commit 6fecb7e784daabe3f62ef8090e7019d7ad384080 Author: Ben Gamari Date: Fri Oct 28 09:26:08 2016 -0400 linker: Move ARM interworking note to SymbolExtras.c >--------------------------------------------------------------- 6fecb7e784daabe3f62ef8090e7019d7ad384080 rts/Linker.c | 24 ------------------------ rts/linker/SymbolExtras.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 27a8ffc..e46fc05 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -202,30 +202,6 @@ int ocTryLoad( ObjectCode* oc ); #endif /* - Note [The ARM/Thumb Story] - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Support for the ARM architecture is complicated by the fact that ARM has not - one but several instruction encodings. The two relevant ones here are the original - ARM encoding and Thumb, a more dense variant of ARM supporting only a subset - of the instruction set. - - How the CPU decodes a particular instruction is determined by a mode bit. This - mode bit is set on jump instructions, the value being determined by the low - bit of the target address: An odd address means the target is a procedure - encoded in the Thumb encoding whereas an even address means it's a traditional - ARM procedure (the actual address jumped to is even regardless of the encoding bit). - - Interoperation between Thumb- and ARM-encoded object code (known as "interworking") - is tricky. If the linker needs to link a call by an ARM object into Thumb code - (or vice-versa) it will produce a jump island. This, however, is incompatible with - GHC's tables-next-to-code. For this reason, it is critical that GHC emit - exclusively ARM or Thumb objects for all Haskell code. - - We still do, however, need to worry about foreign code. -*/ - -/* * Due to the small memory model (see above), on x86_64 we have to map * all our non-PIC object files into the low 2Gb of the address space * (why 2Gb and not 4Gb? Because all addresses must be reachable diff --git a/rts/linker/SymbolExtras.c b/rts/linker/SymbolExtras.c index c985104..1973f7b 100644 --- a/rts/linker/SymbolExtras.c +++ b/rts/linker/SymbolExtras.c @@ -141,6 +141,34 @@ SymbolExtra* makeSymbolExtra( ObjectCode* oc, #endif #ifdef arm_HOST_ARCH +/* + Note [The ARM/Thumb Story] + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Support for the ARM architecture is complicated by the fact that ARM has not + one but several instruction encodings. The two relevant ones here are the original + ARM encoding and Thumb, a more dense variant of ARM supporting only a subset + of the instruction set. + + How the CPU decodes a particular instruction is determined by a mode bit. This + mode bit is set on jump instructions, the value being determined by the low + bit of the target address: An odd address means the target is a procedure + encoded in the Thumb encoding whereas an even address means it's a traditional + ARM procedure (the actual address jumped to is even regardless of the encoding bit). + + Interoperation between Thumb- and ARM-encoded object code (known as "interworking") + is tricky. If the linker needs to link a call by an ARM object into Thumb code + (or vice-versa) it will produce a jump island using makeArmSymbolExtra. This, + however, is incompatible with GHC's tables-next-to-code since pointers + fixed-up in this way will point to a bit of generated code, not a info + table/Haskell closure like TNTC expects. For this reason, it is critical that + GHC emit exclusively ARM or Thumb objects for all Haskell code. + + We still do, however, need to worry about calls to foreign code, hence the + need for makeArmSymbolExtra. +*/ + +/* Produce a jump island for ARM/Thumb interworking */ SymbolExtra* makeArmSymbolExtra( ObjectCode* oc, unsigned long symbolNumber, unsigned long target, From git at git.haskell.org Thu Nov 3 02:43:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 Nov 2016 02:43:10 +0000 (UTC) Subject: [commit: ghc] master: Add testcase for #12757 (b5460dd) Message-ID: <20161103024310.A959E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b5460dd6e54f4ba54bfb11469221e8c8f957e964/ghc >--------------------------------------------------------------- commit b5460dd6e54f4ba54bfb11469221e8c8f957e964 Author: Ben Gamari Date: Wed Nov 2 17:02:14 2016 -0400 Add testcase for #12757 Test Plan: Validate, expected to fail Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2665 GHC Trac Issues: #12757 >--------------------------------------------------------------- b5460dd6e54f4ba54bfb11469221e8c8f957e964 testsuite/tests/codeGen/should_run/T12757.hs | 28 ++++++++++++++++++++++ .../should_run/T12757.stdout} | 2 +- testsuite/tests/codeGen/should_run/all.T | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/T12757.hs b/testsuite/tests/codeGen/should_run/T12757.hs new file mode 100644 index 0000000..148fe7a --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T12757.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Main (main) where + +import Data.ByteString (ByteString) +import qualified Data.ByteString as B + +answers :: [ByteString] +answers = map (B.filter (/= 0x20)) + [ "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855" + , "d7a8fbb3 07d78094 69ca9abc b0082e4f 8d5651e4 6d3cdb76 2d02d0bf 37c9e592" + , "e4c4d8f3 bf76b692 de791a17 3e053211 50f7a345 b46484fe 427f6acc 7ecc81be" + , "ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad" + , "248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1" + , "cf5b16a7 78af8380 036ce59e 7b049237 0b249b11 e8f07a51 afac4503 7afee9d1" + , "cdc76e5c 9914fb92 81a1c7e2 84d73e67 f1809a48 a497200e 046d39cc c7112cd0" + ] + +x, y :: ByteString +x = "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855" +y = B.filter (/= 0x20) x + +main :: IO () +main = do + print (seq x ()) + print (seq y ()) + print (length answers) + print (seq (head answers) ()) -- segfault! diff --git a/testsuite/tests/deriving/should_run/T3087.stdout b/testsuite/tests/codeGen/should_run/T12757.stdout similarity index 75% copy from testsuite/tests/deriving/should_run/T3087.stdout copy to testsuite/tests/codeGen/should_run/T12757.stdout index 35735b4..0c66d1a 100644 --- a/testsuite/tests/deriving/should_run/T3087.stdout +++ b/testsuite/tests/codeGen/should_run/T12757.stdout @@ -1,4 +1,4 @@ () () -() +7 () diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 23caa8c..4e68448 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -146,3 +146,4 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) +test('T12757', normal, compile_and_run, ['']) From git at git.haskell.org Thu Nov 3 02:43:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 Nov 2016 02:43:13 +0000 (UTC) Subject: [commit: ghc] master: Merge cpe_ExprIsTrivial and exprIsTrivial (967dd5c) Message-ID: <20161103024313.5DA0A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/967dd5c9f59e532fe9d6484888a2bae7d02fba11/ghc >--------------------------------------------------------------- commit 967dd5c9f59e532fe9d6484888a2bae7d02fba11 Author: Ben Gamari Date: Wed Nov 2 17:03:05 2016 -0400 Merge cpe_ExprIsTrivial and exprIsTrivial Strangely my previous attempts at resolving this all seemed to end in perplexing segmentation faults in the GHC testsuite (including some rather recent attempts). Somehow this attempt miraculously works. However, there was one wrinkle that I still need to work out fully: we need to consider Lits as non-trivial in cpeArg. Failure to do this means that we would transform something like, $trModule = TrModule "HelloWorld"# into $trModule = case "HelloWorld"# of x { __DEFAULT -> TrModule x } Which then fails the consistentStgInfo check in CoreToStg for reasons that I am still trying to work out. Mark T12757 as fixed Reviewers: simonmar, simonpj, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2666 GHC Trac Issues: #11158 >--------------------------------------------------------------- 967dd5c9f59e532fe9d6484888a2bae7d02fba11 compiler/basicTypes/Literal.hs | 33 +++++++++++++++++++- compiler/coreSyn/CorePrep.hs | 71 ++++++++++++++++++++++++++---------------- 2 files changed, 76 insertions(+), 28 deletions(-) diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs index 769bb51..8137596 100644 --- a/compiler/basicTypes/Literal.hs +++ b/compiler/basicTypes/Literal.hs @@ -344,7 +344,38 @@ nullAddrLit = MachNullAddr -} -- | True if there is absolutely no penalty to duplicating the literal. --- False principally of strings +-- False principally of strings. +-- +-- "Why?", you say? I'm glad you asked. Well, for one duplicating strings would +-- blow up code sizes. Not only this, it's also unsafe. +-- +-- Consider a program that wants to traverse a string. One way it might do this +-- is to first compute the Addr# pointing to the end of the string, and then, +-- starting from the beginning, bump a pointer using eqAddr# to determine the +-- end. For instance, +-- +-- @ +-- -- Given pointers to the start and end of a string, count how many zeros +-- -- the string contains. +-- countZeros :: Addr# -> Addr# -> -> Int +-- countZeros start end = go start 0 +-- where +-- go off n +-- | off `addrEq#` end = n +-- | otherwise = go (off `plusAddr#` 1) n' +-- where n' | isTrue# (indexInt8OffAddr# off 0# ==# 0#) = n + 1 +-- | otherwise = n +-- @ +-- +-- Consider what happens if we considered strings to be trivial (and therefore +-- duplicable) and emitted a call like @countZeros "hello"# ("hello"# +-- `plusAddr`# 5)@. The beginning and end pointers do not belong to the same +-- string, meaning that an iteration like the above would blow up terribly. +-- This is what happened in #12757. +-- +-- Ultimately the solution here is to make primitive strings a bit more +-- structured, ensuring that the compiler can't inline in ways that will break +-- user code. One approach to this is described in #8472. litIsTrivial :: Literal -> Bool -- c.f. CoreUtils.exprIsTrivial litIsTrivial (MachStr _) = False diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index efcf0d3..1547e85 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -5,7 +5,7 @@ Core pass to saturate constructors and PrimOps -} -{-# LANGUAGE BangPatterns, CPP #-} +{-# LANGUAGE BangPatterns, CPP, MultiWayIf #-} module CorePrep ( corePrepPgm, corePrepExpr, cvtLitInteger, @@ -379,7 +379,7 @@ cpeBind top_lvl env (NonRec bndr rhs) is_unlifted env bndr1 rhs -- See Note [Inlining in CorePrep] - ; if cpe_ExprIsTrivial rhs2 && isNotTopLevel top_lvl + ; if exprIsTrivial rhs2 && isNotTopLevel top_lvl then return (extendCorePrepEnvExpr env bndr rhs2, floats) else do { @@ -730,7 +730,7 @@ cpeApp top_env expr -- NB: depth from collect_args is right, because e2 is a trivial expression -- and thus its embedded Id *must* be at the same depth as any -- Apps it is under are type applications only (c.f. - -- cpe_ExprIsTrivial). But note that we need the type of the + -- exprIsTrivial). But note that we need the type of the -- expression, not the id. ; (app, floats) <- rebuild_app args e2 (exprType e2) emptyFloats stricts ; mb_saturate hd app floats depth } @@ -815,6 +815,40 @@ isLazyExpr _ = False -- CpeArg: produces a result satisfying CpeArg -- --------------------------------------------------------------------------- +{- +Note [ANF-ising literal string arguments] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Consider a program like, + + data Foo = Foo Addr# + + foo = Foo "turtle"# + +When we go to ANFise this we might think that we want to float the string +literal like we do any other non-trivial argument. This would look like, + + foo = u\ [] case "turtle"# of s { __DEFAULT__ -> Foo s } + +However, this 1) isn't necessary since strings are in a sense "trivial"; and 2) +wreaks havoc on the CAF annotations that we produce here since we the result +above is caffy since it is updateable. Ideally at some point in the future we +would like to just float the literal to the top level as suggested in #11312, + + s = "turtle"# + foo = Foo s + +However, until then we simply add a special case excluding literals from the +floating done by cpeArg. +-} + +-- | Is an argument okay to CPE? +okCpeArg :: CoreExpr -> Bool +-- Don't float literals. See Note [ANF-ising literal string arguments]. +okCpeArg (Lit _) = False +-- Do not eta expand a trivial argument +okCpeArg expr = not (exprIsTrivial expr) + -- This is where we arrange that a non-trivial argument is let-bound cpeArg :: CorePrepEnv -> Demand -> CoreArg -> Type -> UniqSM (Floats, CpeArg) @@ -826,13 +860,13 @@ cpeArg env dmd arg arg_ty -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds - ; if cpe_ExprIsTrivial arg2 -- Do not eta expand a trivial argument - then return (floats2, arg2) - else do - { v <- newVar arg_ty - ; let arg3 = cpeEtaExpand (exprArity arg2) arg2 - arg_float = mkFloat dmd is_unlifted v arg3 - ; return (addFloat floats2 arg_float, varToCoreExpr v) } } + ; if okCpeArg arg2 + then do { v <- newVar arg_ty + ; let arg3 = cpeEtaExpand (exprArity arg2) arg2 + arg_float = mkFloat dmd is_unlifted v arg3 + ; return (addFloat floats2 arg_float, varToCoreExpr v) } + else return (floats2, arg2) + } where is_unlifted = isUnliftedType arg_ty want_float = wantFloatNested NonRecursive dmd is_unlifted @@ -919,23 +953,6 @@ of the scope of a `seq`, or dropped the `seq` altogether. ************************************************************************ -} -cpe_ExprIsTrivial :: CoreExpr -> Bool --- This function differs from CoreUtils.exprIsTrivial only in its --- treatment of (Lit l). Otherwise it's identical. --- No one knows why this difference is important: Trac #11158. --- Someone should find out -cpe_ExprIsTrivial (Var _) = True -cpe_ExprIsTrivial (Type _) = True -cpe_ExprIsTrivial (Coercion _) = True -cpe_ExprIsTrivial (Lit _) = True -cpe_ExprIsTrivial (App e arg) = not (isRuntimeArg arg) && cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Lam b e) = not (isRuntimeVar b) && cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Tick t e) = not (tickishIsCode t) && cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Cast e _) = cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Case e _ _ []) = cpe_ExprIsTrivial e - -- See Note [Empty case is trivial] in CoreUtils -cpe_ExprIsTrivial _ = False - {- -- ----------------------------------------------------------------------------- -- Eta reduction From git at git.haskell.org Thu Nov 3 02:43:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 Nov 2016 02:43:16 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update T10858 allocations (eaa3482) Message-ID: <20161103024316.10FB03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eaa348238bc6ea6a553240334602647ee48f8cf5/ghc >--------------------------------------------------------------- commit eaa348238bc6ea6a553240334602647ee48f8cf5 Author: Ben Gamari Date: Wed Nov 2 22:41:56 2016 -0400 testsuite: Update T10858 allocations >--------------------------------------------------------------- eaa348238bc6ea6a553240334602647ee48f8cf5 testsuite/tests/deriving/perf/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/deriving/perf/all.T b/testsuite/tests/deriving/perf/all.T index b45f724..a6f9cc9 100644 --- a/testsuite/tests/deriving/perf/all.T +++ b/testsuite/tests/deriving/perf/all.T @@ -1,6 +1,6 @@ test('T10858', [compiler_stats_num_field('bytes allocated', - [ (wordsize(64), 241655120, 8) ]), + [ (wordsize(64), 222312440, 8) ]), only_ways(['normal']), when(msys(), expect_broken(12713)) ], From git at git.haskell.org Thu Nov 3 18:05:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 Nov 2016 18:05:36 +0000 (UTC) Subject: [commit: ghc] master: Add test for #12788 (ec22bac) Message-ID: <20161103180536.3C4713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ec22bacdd625b04d28228dd5522d59d0bc8b1152/ghc >--------------------------------------------------------------- commit ec22bacdd625b04d28228dd5522d59d0bc8b1152 Author: Ryan Scott Date: Thu Nov 3 14:01:54 2016 -0400 Add test for #12788 Commit bce99086e9f54909f51ff5a74cb8c666083bb021 (#12584) fixed #12788. Let's add a test to make sure it stays fixed. >--------------------------------------------------------------- ec22bacdd625b04d28228dd5522d59d0bc8b1152 testsuite/tests/th/T12788.hs | 9 +++++++++ testsuite/tests/th/T12788.stderr | 2 ++ testsuite/tests/th/T12788_Lib.hs | 22 ++++++++++++++++++++++ testsuite/tests/th/all.T | 3 +++ 4 files changed, 36 insertions(+) diff --git a/testsuite/tests/th/T12788.hs b/testsuite/tests/th/T12788.hs new file mode 100644 index 0000000..dc13c4f --- /dev/null +++ b/testsuite/tests/th/T12788.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TemplateHaskell #-} +module T12788 where + +import Language.Haskell.TH +import T12788_Lib + +data Bad = Bad { _bad :: String } deriving (Eq, Ord, Show) + +$(deriveJSON defaultOptions{} ''Bad) diff --git a/testsuite/tests/th/T12788.stderr b/testsuite/tests/th/T12788.stderr new file mode 100644 index 0000000..485b200 --- /dev/null +++ b/testsuite/tests/th/T12788.stderr @@ -0,0 +1,2 @@ + +T12788.hs:9:14: error: Empty record update diff --git a/testsuite/tests/th/T12788_Lib.hs b/testsuite/tests/th/T12788_Lib.hs new file mode 100644 index 0000000..2924eef --- /dev/null +++ b/testsuite/tests/th/T12788_Lib.hs @@ -0,0 +1,22 @@ +module T12788_Lib where + +import Language.Haskell.TH + +data Options = Options + { fieldLabelModifier :: String -> String + , constructorTagModifier :: String -> String + , allNullaryToStringTag :: Bool + , omitNothingFields :: Bool + , sumEncoding :: SumEncoding + , unwrapUnaryRecords :: Bool + } + +data SumEncoding = + TaggedObject { tagFieldName :: String + , contentsFieldName :: String + } + | ObjectWithSingleField + | TwoElemArray + +deriveJSON :: Options -> Name -> Q [Dec] +deriveJSON _ _ = return [] diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index b2aee12..4f21121 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -433,3 +433,6 @@ test('T12478_3', omit_ways(['ghci']), compile, ['-v0']) test('T12478_4', omit_ways(['ghci']), compile_fail, ['-v0']) test('T12513', omit_ways(['ghci']), compile_fail, ['-v0']) test('T12530', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) +test('T12788', extra_clean(['T12788_Lib.hi', 'T12788_Lib.o']), + multimod_compile_fail, + ['T12788.hs', '-v0 ' + config.ghc_th_way_flags]) From git at git.haskell.org Thu Nov 3 18:45:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 Nov 2016 18:45:29 +0000 (UTC) Subject: [commit: ghc] master: API Annotations: make all ModuleName Located (f46bfeb) Message-ID: <20161103184529.0AE043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f46bfeb8344e1818f42066c3dd9717f49e8b511b/ghc >--------------------------------------------------------------- commit f46bfeb8344e1818f42066c3dd9717f49e8b511b Author: Alan Zimmerman Date: Thu Nov 3 14:40:12 2016 +0200 API Annotations: make all ModuleName Located Summary: This also changes the backpack Renaming type to use a Maybe for the renameTo field, to more accurately reflect the parsed source. Updates haddock submodule to match AST changes Test Plan: ./validate Reviewers: ezyang, bgamari, austin Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2670 >--------------------------------------------------------------- f46bfeb8344e1818f42066c3dd9717f49e8b511b compiler/backpack/BkpSyn.hs | 3 ++- compiler/backpack/DriverBkp.hs | 9 ++++++--- compiler/hsSyn/HsImpExp.hs | 2 +- compiler/parser/Parser.y | 10 +++++----- compiler/rename/RnNames.hs | 2 +- ghc/GHCi/UI.hs | 2 +- testsuite/tests/ghc-api/annotations/T10312.stdout | 1 - testsuite/tests/ghc-api/annotations/annotations.stdout | 2 -- testsuite/tests/ghc-api/annotations/exampleTest.stdout | 1 - testsuite/tests/ghc-api/annotations/listcomps.stdout | 16 +++++++--------- testsuite/tests/ghc-api/annotations/parseTree.stdout | 2 -- utils/haddock | 2 +- 12 files changed, 24 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 f46bfeb8344e1818f42066c3dd9717f49e8b511b From git at git.haskell.org Thu Nov 3 21:55:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 3 Nov 2016 21:55:23 +0000 (UTC) Subject: [commit: ghc] master: Omit unnecessary linker flags (a977c96) Message-ID: <20161103215523.C558A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a977c96537bb7077c6445f02db98636b150e6e14/ghc >--------------------------------------------------------------- commit a977c96537bb7077c6445f02db98636b150e6e14 Author: Simon Marlow Date: Thu Oct 27 12:52:00 2016 +0100 Omit unnecessary linker flags Summary: This omits -L and -l flags from the linker command line that shouldn't be necessary because GHC will already add them via the -package-id flags we pass. This also reverts part of 90538d86af579595987826cd893828d6f379f35a that rearranges the linker command line and causes some knock-on problems (see D2618). Test Plan: validate (need to validate on Windows too) Reviewers: Phyx, bgamari, niteria, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2639 GHC Trac Issues: #12738 >--------------------------------------------------------------- a977c96537bb7077c6445f02db98636b150e6e14 compiler/main/SysTools.hs | 21 ++------------------- rules/distdir-opts.mk | 5 ----- utils/ghc-cabal/Main.hs | 3 --- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index d5fd0c5..5fb92c8 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -910,26 +910,9 @@ runLink dflags args = do let (p,args0) = pgm_l dflags args1 = map Option (getOpts dflags opt_l) args2 = args0 ++ linkargs ++ args1 ++ args - args3 = argFixup args2 [] - mb_env <- getGccEnv args3 - runSomethingResponseFile dflags ld_filter "Linker" p args3 mb_env + mb_env <- getGccEnv args2 + runSomethingResponseFile dflags ld_filter "Linker" p args2 mb_env where - testLib lib = "-l" `isPrefixOf` lib || ".a" `isSuffixOf` lib - {- GHC is just blindly appending linker arguments from libraries and - the commandline together. This results in very problematic link orders - which will cause incorrect linking. Since we're changing the link - arguments anyway, let's just make sure libraries are last. - This functions moves libraries on the link all the way back - but keeps the order amongst them the same. -} - argFixup [] r = [] ++ r - -- retain any lib in "-o" position. - argFixup (o@(Option "-o"):o'@(FileOption _ _):xs) r = o:o':argFixup xs r - argFixup (o@(Option opt):xs) r = if testLib opt - then argFixup xs (r ++ [o]) - else o:argFixup xs r - argFixup (o@(FileOption _ opt):xs) r = if testLib opt - then argFixup xs (r ++ [o]) - else o:argFixup xs r ld_filter = case (platformOS (targetPlatform dflags)) of OSSolaris2 -> sunos_ld_filter _ -> id diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index 0d60f99..b3dfba1 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -44,16 +44,11 @@ $1_$2_DIST_CC_OPTS = \ $$($1_$2_DEP_CC_OPTS) \ $$(SRC_CC_WARNING_OPTS) -ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)),) -$1_$2_DIST_LD_LIB_DIRS := $$(subst $$(space)',$$(space)-L',$$(space)$$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)) -endif - $1_$2_DIST_LD_OPTS = \ $$(SRC_LD_OPTS) \ $$($1_LD_OPTS) \ $$($1_$2_LD_OPTS) \ $$($1_$2_DIST_LD_LIB_DIRS) \ - $$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \ $$($1_$2_DEP_LD_OPTS) # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 4b6b496..3b55fe7 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -399,7 +399,6 @@ generate directory distdir dll0Modules config_args mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build" libraryRelDirs = map mkLibraryRelDir transitiveDepNames wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs - wrappedLibraryDirs <- wrap libraryDirs let variablePrefix = directory ++ '_':distdir mods = map display modules @@ -439,11 +438,9 @@ generate directory distdir dll0Modules config_args variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), - variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS = " ++ unwords libraryRelDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs, - variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), "", From git at git.haskell.org Fri Nov 4 09:17:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 Nov 2016 09:17:50 +0000 (UTC) Subject: [commit: ghc] master: Add comments from Trac #12768 (e43f05b) Message-ID: <20161104091750.8289C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e43f05b62053f4742b105636b7ebf4ce8486b13b/ghc >--------------------------------------------------------------- commit e43f05b62053f4742b105636b7ebf4ce8486b13b Author: Simon Peyton Jones Date: Thu Nov 3 14:54:01 2016 +0000 Add comments from Trac #12768 >--------------------------------------------------------------- e43f05b62053f4742b105636b7ebf4ce8486b13b compiler/typecheck/TcGenDeriv.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index 2408e42..650bad5 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -1591,6 +1591,33 @@ The type checker checks this code, and it currently requires so ew have to switch that flag on locally in TcDeriv.genInst. See #8503 for more discussion. + +Note [Newtype-deriving trickiness] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider (Trac #12768): + class C a where { op :: D a => a -> a } + + instance C a => C [a] where { op = opList } + + opList :: (C a, D [a]) => [a] -> [a] + opList = ... + +Now suppose we try GND on this: + newtype N a = MkN [a] deriving( C ) + +The GND is expecting to get an implementation of op for N by +coercing opList, thus: + + instance C a => C (N a) where { op = opN } + + opN :: (C a, D (N a)) => N a -> N a + opN = coerce @(D [a] => [a] -> [a]) + @(D (N a) => [N a] -> [N a] + opList + +But there is no reason to suppose that (D [a]) and (D (N a)) +are inter-coercible; these instances might completely different. +So GHC rightly rejects this code. -} gen_Newtype_binds :: SrcSpan @@ -1636,6 +1663,7 @@ mkCoerceClassMethEqn :: Class -- the class being derived -> Id -- the method to look at -> Pair Type -- See Note [Newtype-deriving instances] +-- See also Note [Newtype-deriving trickiness] -- The pair is the (from_type, to_type), where to_type is -- the type of the method we are tyrying to get mkCoerceClassMethEqn cls inst_tvs inst_tys rhs_ty id From git at git.haskell.org Fri Nov 4 09:17:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 Nov 2016 09:17:53 +0000 (UTC) Subject: [commit: ghc] master: Remove a debug trace (7b0ae41) Message-ID: <20161104091753.41AF53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b0ae417026c587dbc9697f678d560b1dc975d50/ghc >--------------------------------------------------------------- commit 7b0ae417026c587dbc9697f678d560b1dc975d50 Author: Simon Peyton Jones Date: Thu Nov 3 14:54:45 2016 +0000 Remove a debug trace I added this when debugging something else, but in general it doesn't work (with -ddump-tc-trace) because of typecking recursive groups of TyCons. So removing it again. >--------------------------------------------------------------- 7b0ae417026c587dbc9697f678d560b1dc975d50 compiler/typecheck/TcHsType.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 3b19298..6e6bcd0 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1544,7 +1544,6 @@ kindGeneralizeType :: Type -> TcM Type kindGeneralizeType ty = do { kvs <- kindGeneralize ty ; ty <- zonkSigType (mkInvForAllTys kvs ty) - ; traceTc "kindGen" (ppr (mkInvForAllTys kvs ty) $$ ppr ty) ; return ty } kindGeneralize :: TcType -> TcM [KindVar] From git at git.haskell.org Fri Nov 4 12:32:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 Nov 2016 12:32:51 +0000 (UTC) Subject: [commit: ghc] master: Take account of injectivity when doing fundeps (2cdd9bd) Message-ID: <20161104123251.76F173A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2cdd9bd5208e3ad78d7a3b8b82c8ae1be486b34d/ghc >--------------------------------------------------------------- commit 2cdd9bd5208e3ad78d7a3b8b82c8ae1be486b34d Author: Simon Peyton Jones Date: Fri Nov 4 10:43:36 2016 +0000 Take account of injectivity when doing fundeps This fixes Trac #12803. Yikes! See Note [Care with type functions]. >--------------------------------------------------------------- 2cdd9bd5208e3ad78d7a3b8b82c8ae1be486b34d compiler/prelude/TysWiredIn.hs | 5 ++ compiler/typecheck/FamInst.hs | 62 ++++++++++++---------- compiler/typecheck/FunDeps.hs | 39 ++++++++++++-- compiler/types/Class.hs | 2 +- testsuite/tests/typecheck/should_fail/T12803.hs | 10 ++++ .../tests/typecheck/should_fail/T12803.stderr | 8 +++ testsuite/tests/typecheck/should_fail/all.T | 1 + 7 files changed, 94 insertions(+), 33 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2cdd9bd5208e3ad78d7a3b8b82c8ae1be486b34d From git at git.haskell.org Fri Nov 4 21:26:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 4 Nov 2016 21:26:57 +0000 (UTC) Subject: [commit: hsc2hs] master: Fix type signature of main test function (fe2de68) Message-ID: <20161104212657.DA1633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/fe2de68c064cf6215b5077740d33cb2a67920b14 >--------------------------------------------------------------- commit fe2de68c064cf6215b5077740d33cb2a67920b14 Author: Erik de Castro Lopo Date: Sat Nov 5 08:19:36 2016 +1100 Fix type signature of main test function During C compiler feature testing, the `main` function was defined with a parameter list of `(int argc, char *argv [])` but these parameters were not used. This results in compiler warnings when the generated file is compiled with the `-Wextra` warning flag added to the `cc-options` of the cabal file. Reviewers: hvr, RyanGlScott, bgamari, rwbarton Reviewed By: rwbarton Differential Revision: https://phabricator.haskell.org/D2677 >--------------------------------------------------------------- fe2de68c064cf6215b5077740d33cb2a67920b14 DirectCodegen.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DirectCodegen.hs b/DirectCodegen.hs index 37564ee..2a88784 100644 --- a/DirectCodegen.hs +++ b/DirectCodegen.hs @@ -63,7 +63,7 @@ outputDirect config outName outDir outBase name toks = do outTemplateHeaderCProg (cTemplate config)++ concatMap outFlagHeaderCProg flags++ concatMap outHeaderCProg specials++ - "\nint main (int argc, char *argv [])\n{\n"++ + "\nint main (void)\n{\n"++ outHeaderHs flags (if needsH then Just outHName else Nothing) specials++ outHsLine (SourcePos name 0)++ concatMap outTokenHs toks++ From git at git.haskell.org Sat Nov 5 22:09:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 Nov 2016 22:09:49 +0000 (UTC) Subject: [commit: ghc] master: Handle types w/ type variables in signatures inside patterns (DsMeta) (b012120) Message-ID: <20161105220949.30BBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2/ghc >--------------------------------------------------------------- commit b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2 Author: Mikhail Vorozhtsov Date: Sat Nov 5 22:06:39 2016 +0000 Handle types w/ type variables in signatures inside patterns (DsMeta) The comment indicated that scoping of type variables was a large problem but Simon fixed it in e21e13fb52b99b14770cc5857df57bbcc9c85102. Thus, we can implement repP for signatures very easily in the usual way now. Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2490 GHC Trac Issues: #12164 >--------------------------------------------------------------- b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2 compiler/deSugar/DsMeta.hs | 14 +++---- .../PatternSplice.hs} | 3 +- testsuite/tests/partial-sigs/should_compile/all.T | 1 + .../ExtraConstraintsWildcardInPatternSplice.hs | 2 +- .../ExtraConstraintsWildcardInPatternSplice.stderr | 13 ++++++- testsuite/tests/th/TH_repPatSig.hs | 16 ++++---- testsuite/tests/th/TH_repPatSig.stderr | 4 -- .../th/{TH_repPatSig.hs => TH_repPatSigTVar.hs} | 9 +---- testsuite/tests/th/TH_repPatSigTVar.stderr | 8 ++++ testsuite/tests/th/TH_repPatSig_asserts.hs | 44 ++++++++++++++++++++++ testsuite/tests/th/all.T | 6 ++- 11 files changed, 87 insertions(+), 33 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2 From git at git.haskell.org Sat Nov 5 22:16:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 5 Nov 2016 22:16:22 +0000 (UTC) Subject: [commit: ghc] master: Update release notes for type sigs in TH patterns patch (1cab42d) Message-ID: <20161105221622.29FB83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1cab42d88d91f61528a160c212a163f9b2147760/ghc >--------------------------------------------------------------- commit 1cab42d88d91f61528a160c212a163f9b2147760 Author: Matthew Pickering Date: Sat Nov 5 22:15:14 2016 +0000 Update release notes for type sigs in TH patterns patch [skip ci] >--------------------------------------------------------------- 1cab42d88d91f61528a160c212a163f9b2147760 docs/users_guide/8.2.1-notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 8988630..8edc7a2 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -80,6 +80,8 @@ Template Haskell correctly. Previously, Template Haskell would implicitly remove the parentheses when splicing, which would turn ``(# Int #)`` into ``Int``. +- Add support for type signatures in patterns. (:ghc-ticket:`12164`) + Runtime system ~~~~~~~~~~~~~~ From git at git.haskell.org Sun Nov 6 12:48:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 Nov 2016 12:48:20 +0000 (UTC) Subject: [commit: ghc] master: Stop -dno-debug-output suppressing -ddump-tc-trace (1c886ea) Message-ID: <20161106124820.4A6AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1c886eadcfbb593bb06bfff7b8a4914b5349f080/ghc >--------------------------------------------------------------- commit 1c886eadcfbb593bb06bfff7b8a4914b5349f080 Author: Matthew Pickering Date: Sun Nov 6 12:46:40 2016 +0000 Stop -dno-debug-output suppressing -ddump-tc-trace Summary: The user manual states that -dno-debug-output should suppress *unsolicited* debugging output which essentially amounts to calls to `pprTrace`. Before I unified the interface of `traceTc` and `traceRn`, the flag suppressed calls to `traceTc` but not to `traceRn` or any other tracing function already controlled by a flag. Thus, in order to make the behaviour more uniform, it seemed best to remove this one special case. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2628 GHC Trac Issues: #12691 >--------------------------------------------------------------- 1c886eadcfbb593bb06bfff7b8a4914b5349f080 compiler/typecheck/TcRnMonad.hs | 14 +++++++------- testsuite/tests/indexed-types/should_fail/T8129.stdout | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index d3ae058..b958cf8 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -662,18 +662,18 @@ updTcRef ref fn = liftIO $ do { old <- readIORef ref -- Typechecker trace traceTc :: String -> SDoc -> TcRn () traceTc = - guardedTraceOptTcRn Opt_D_dump_tc_trace + labelledTraceOptTcRn Opt_D_dump_tc_trace -- Renamer Trace traceRn :: String -> SDoc -> TcRn () traceRn = - guardedTraceOptTcRn Opt_D_dump_rn_trace + labelledTraceOptTcRn Opt_D_dump_rn_trace --- | Do not display a trace if `-dno-debug-output` is on -guardedTraceOptTcRn :: DumpFlag -> String -> SDoc -> TcRn () -guardedTraceOptTcRn flag herald doc = do - unless opt_NoDebugOutput - ( traceOptTcRn flag (formatTraceMsg herald doc) ) +-- | Trace when a certain flag is enabled. This is like `traceOptTcRn` +-- but accepts a string as a label and formats the trace message uniformly. +labelledTraceOptTcRn :: DumpFlag -> String -> SDoc -> TcRn () +labelledTraceOptTcRn flag herald doc = do + traceOptTcRn flag (formatTraceMsg herald doc) formatTraceMsg :: String -> SDoc -> SDoc formatTraceMsg herald doc = hang (text herald) 2 doc diff --git a/testsuite/tests/indexed-types/should_fail/T8129.stdout b/testsuite/tests/indexed-types/should_fail/T8129.stdout index bffa3da..f2bab63 100644 --- a/testsuite/tests/indexed-types/should_fail/T8129.stdout +++ b/testsuite/tests/indexed-types/should_fail/T8129.stdout @@ -1 +1,3 @@ • Could not deduce (C x0 (F x0)) + • Could not deduce (C x0 (F x0)) + • Could not deduce (C x0 (F x0)) From git at git.haskell.org Sun Nov 6 12:48:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 Nov 2016 12:48:23 +0000 (UTC) Subject: [commit: ghc] master: Add tracing infrastructure to pattern match checker (25c8e80) Message-ID: <20161106124823.11B043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/25c8e80eccc512d05c0ca8df401271db65b5987b/ghc >--------------------------------------------------------------- commit 25c8e80eccc512d05c0ca8df401271db65b5987b Author: Matthew Pickering Date: Sun Nov 6 12:47:48 2016 +0000 Add tracing infrastructure to pattern match checker Summary: This is the start of some tracing infrastructure which I found useful when working through how the pattern match checker worked. It adds the flag -ddump-ec-trace in order to turn on the trace. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2658 >--------------------------------------------------------------- 25c8e80eccc512d05c0ca8df401271db65b5987b compiler/deSugar/Check.hs | 60 +++++++++++++++++++++++++++++++++++++++--- compiler/deSugar/DsMonad.hs | 6 ++++- compiler/hsSyn/HsExpr.hs | 4 +++ compiler/main/DynFlags.hs | 4 +++ docs/users_guide/debugging.rst | 5 ++++ 5 files changed, 75 insertions(+), 4 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 25c8e80eccc512d05c0ca8df401271db65b5987b From git at git.haskell.org Sun Nov 6 14:21:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 Nov 2016 14:21:09 +0000 (UTC) Subject: [commit: ghc] master: Allow GeneralizedNewtypeDeriving for classes with associated type families (630d881) Message-ID: <20161106142109.6E0A23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/630d88176e8dd3ccc269451bca8f55398ef5265c/ghc >--------------------------------------------------------------- commit 630d88176e8dd3ccc269451bca8f55398ef5265c Author: Ryan Scott Date: Sun Nov 6 09:09:36 2016 -0500 Allow GeneralizedNewtypeDeriving for classes with associated type families Summary: This implements the ability to derive associated type family instances for newtypes automatically using `GeneralizedNewtypeDeriving`. Refer to the users' guide additions for how this works; I essentially follow the pattern laid out in https://ghc.haskell.org/trac/ghc/ticket/8165#comment:18. Fixes #2721 and #8165. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2636 GHC Trac Issues: #2721, #8165 >--------------------------------------------------------------- 630d88176e8dd3ccc269451bca8f55398ef5265c compiler/typecheck/TcDeriv.hs | 301 ++++++++++++++++----- compiler/typecheck/TcGenDeriv.hs | 56 +++- compiler/utils/Util.hs | 8 + docs/users_guide/8.2.1-notes.rst | 5 + docs/users_guide/glasgow_exts.rst | 127 +++++++++ .../{should_fail => should_compile}/T2721.hs | 2 +- testsuite/tests/deriving/should_compile/T8165.hs | 52 ++++ testsuite/tests/deriving/should_compile/all.T | 2 + testsuite/tests/deriving/should_fail/T2721.stderr | 6 - testsuite/tests/deriving/should_fail/T4083.hs | 14 + testsuite/tests/deriving/should_fail/T4083.stderr | 7 + .../tests/deriving/should_fail/T8165_fail1.hs | 28 ++ .../tests/deriving/should_fail/T8165_fail1.stderr | 17 ++ .../tests/deriving/should_fail/T8165_fail2.hs | 9 + .../tests/deriving/should_fail/T8165_fail2.stderr | 5 + testsuite/tests/deriving/should_fail/all.T | 4 +- testsuite/tests/generics/GenDerivOutput.stderr | 4 +- testsuite/tests/generics/GenDerivOutput1_0.stderr | 4 +- testsuite/tests/generics/GenDerivOutput1_1.stderr | 4 +- .../tests/generics/T10604/T10604_deriving.stderr | 4 +- 20 files changed, 569 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 630d88176e8dd3ccc269451bca8f55398ef5265c From git at git.haskell.org Sun Nov 6 14:47:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 Nov 2016 14:47:09 +0000 (UTC) Subject: [commit: ghc] master: Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes (ead83db) Message-ID: <20161106144709.86DE73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ead83db8a7db772a9f248af9767a4283218a5c9f/ghc >--------------------------------------------------------------- commit ead83db8a7db772a9f248af9767a4283218a5c9f Author: Ryan Scott Date: Sun Nov 6 09:40:48 2016 -0500 Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes GHC 8.0.2 introduced a bugfix involving GeneralizedNewtypeDeriving in 96d451450923a80b043b5314c5eaaa9d0eab7c56. This made typechecking of GND-produced code a bit stricter, and an unfortunate side effect of this was that there were a couple of corner-case programs that stopped compiling when transitioning from GHC 8.0.1 to 8.0.2. Since the number of affected programs seems quite small, and since the fix is so straightforward, we opt to simply note this discrepancy in the 8.0.2 release notes. Resolves #12768. >--------------------------------------------------------------- ead83db8a7db772a9f248af9767a4283218a5c9f docs/users_guide/8.0.2-notes.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index c8e76ed..43ee70f 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -29,6 +29,23 @@ Language presence of :ghc-flag:`-XRebindableSyntax` and :ghc-flag:`-XOverloadedStrings` (:ghc-ticket:`12688`). +- GHC is now a bit more strict in typechecking code generated by + :ghc-flag:`-XGeneralizedNewtypeDeriving`. For example, GHC will now reject + this program: :: + + class C m where + foo :: C m => m () + + newtype N m a = N (m a) + deriving C -- This is now an error + + This is in contrast to GHC 8.0.1 and earlier, which would accept this code. + To fix this code, simply remove the ``C m`` constraint from ``foo``, as it + is wholly unnecessary: :: + + class C m where + foo :: m () + Compiler ~~~~~~~~ From git at git.haskell.org Sun Nov 6 19:11:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 Nov 2016 19:11:19 +0000 (UTC) Subject: [commit: ghc] master: Some minor linker cleanups. (1964d86) Message-ID: <20161106191119.57D553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1964d8690aa41313de31f4ae0113a498d6943d44/ghc >--------------------------------------------------------------- commit 1964d8690aa41313de31f4ae0113a498d6943d44 Author: Tamar Christina Date: Sun Nov 6 19:08:40 2016 +0000 Some minor linker cleanups. Summary: Just some cleanups to some oddities I've noticed while investigating a linker issue. Particularly the dll name returned by `findSysDll` was decorated. So foo.dll is returned. We make it `foo.dll.dll` and later drop one `.dll` when passed to `addDll` which expects it without extension, but still tries the name *as is* which is why it worked. This should be slightly faster, since we don't try 4 loads before we succeed. Test Plan: ./validate Reviewers: austin, hvr, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2680 >--------------------------------------------------------------- 1964d8690aa41313de31f4ae0113a498d6943d44 compiler/ghci/Linker.hs | 2 +- compiler/main/HscTypes.hs | 5 ++--- rts/linker/PEi386.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index 73d0fac..4a0b62f 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -1349,7 +1349,7 @@ locateLib hsc_env is_hs dirs lib in liftM2 (<|>) local linked findHSDll = liftM (fmap DLLPath) $ findFile dirs hs_dyn_lib_file findDll = liftM (fmap DLLPath) $ findFile dirs dyn_lib_file - findSysDll = fmap (fmap $ DLL . takeFileName) $ findSystemLibrary hsc_env so_name + findSysDll = fmap (fmap $ DLL . dropExtension . takeFileName) $ findSystemLibrary hsc_env so_name tryGcc = let short = liftM (fmap DLLPath) $ searchForLibUsingGcc dflags so_name dirs full = liftM (fmap DLLPath) $ searchForLibUsingGcc dflags lib_so_name dirs in liftM2 (<|>) short full diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index 9b2584d..44b5634 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -2521,9 +2521,8 @@ updNameCacheIO hsc_env upd_fn mkSOName :: Platform -> FilePath -> FilePath mkSOName platform root = case platformOS platform of - OSDarwin -> ("lib" ++ root) <.> "dylib" - OSMinGW32 -> root <.> "dll" - _ -> ("lib" ++ root) <.> "so" + OSMinGW32 -> root <.> soExt platform + _ -> ("lib" ++ root) <.> soExt platform mkHsSOName :: Platform -> FilePath -> FilePath mkHsSOName platform root = ("lib" ++ root) <.> soExt platform diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index b8c5231..56975ed 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -1559,7 +1559,7 @@ SymbolAddr *lookupSymbol_PEi386(SymbolName *lbl) RtsSymbolInfo *pinfo; if (!ghciLookupSymbolInfo(symhash, lbl, &pinfo)) { - IF_DEBUG(linker, debugBelch("lookupSymbol: symbol not found\n")); + IF_DEBUG(linker, debugBelch("lookupSymbol: symbol '%s' not found\n", lbl)); SymbolAddr* sym; From git at git.haskell.org Sun Nov 6 22:04:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 6 Nov 2016 22:04:57 +0000 (UTC) Subject: [commit: ghc] master: Fix broken validate build. (7d988dd) Message-ID: <20161106220457.E54833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7d988dd4b2aa270a3b2c3561b3e930b2dc1a675c/ghc >--------------------------------------------------------------- commit 7d988dd4b2aa270a3b2c3561b3e930b2dc1a675c Author: Tamar Christina Date: Sun Nov 6 22:04:40 2016 +0000 Fix broken validate build. >--------------------------------------------------------------- 7d988dd4b2aa270a3b2c3561b3e930b2dc1a675c compiler/utils/Panic.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/utils/Panic.hs b/compiler/utils/Panic.hs index 6a7e96a..b12d677 100644 --- a/compiler/utils/Panic.hs +++ b/compiler/utils/Panic.hs @@ -290,7 +290,7 @@ withSignalHandlers act = do -- uninstall handlers if necessary let mayUninstallHandlers = liftIO $ modifyMVar_ signalHandlersRefCount $ \case (1,Just hdls) -> do - uninstallHandlers hdls + _ <- uninstallHandlers hdls return (0,Nothing) (c,oldHandlers) -> return (c-1,oldHandlers) From git at git.haskell.org Mon Nov 7 08:38:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 08:38:09 +0000 (UTC) Subject: [commit: ghc] master: Fix hs_try_putmvar003 (#12800) (91f9e13) Message-ID: <20161107083809.DAD1B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/91f9e13887f49c28e4dbde4edc2c5c65de44c9e9/ghc >--------------------------------------------------------------- commit 91f9e13887f49c28e4dbde4edc2c5c65de44c9e9 Author: Simon Marlow Date: Fri Nov 4 14:10:39 2016 -0700 Fix hs_try_putmvar003 (#12800) Summary: There was a race condition on some shared data when creating the callback thread. I couldn't repro the issue without inserting a dummy usleep(100), but it's definitely a bug. Test Plan: validate Reviewers: bgamari, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2678 GHC Trac Issues: #12800 >--------------------------------------------------------------- 91f9e13887f49c28e4dbde4edc2c5c65de44c9e9 testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c b/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c index c499b72..aa65144 100644 --- a/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c +++ b/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c @@ -54,9 +54,9 @@ struct callback_queue* mkCallbackQueue(int use_foreign_export) pthread_t t; pthread_mutex_init(&q->lock, NULL); pthread_cond_init(&q->cond, NULL); - pthread_create(&t, NULL, (threadfunc*)callback, q); q->pending = NULL; q->use_foreign_export = use_foreign_export; + pthread_create(&t, NULL, (threadfunc*)callback, q); return q; } From git at git.haskell.org Mon Nov 7 13:58:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 13:58:17 +0000 (UTC) Subject: [commit: ghc] master: Update 8.0.2 release notes for #12784 (2e8463b) Message-ID: <20161107135818.0072A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2e8463b232054b788b73e6551947a9434aa76009/ghc >--------------------------------------------------------------- commit 2e8463b232054b788b73e6551947a9434aa76009 Author: Ryan Scott Date: Mon Nov 7 08:56:22 2016 -0500 Update 8.0.2 release notes for #12784 Summary: The fix for #12220 exposed some ill-typed programs which passed the typechecker in GHC 8.0.1 but now fail to typecheck in GHC 8.0.2. It's a bit difficult to characterize what exactly triggers this bug, but we at least have a minimal example and a simple fix to illustrate the problem and solution, so let's add that the the 8.0.2 release notes to advertise this change. Resolves #12784. Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2682 GHC Trac Issues: #12784 >--------------------------------------------------------------- 2e8463b232054b788b73e6551947a9434aa76009 docs/users_guide/8.0.2-notes.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 43ee70f..34cc4b5 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -46,6 +46,10 @@ Language class C m where foo :: m () +- Some programs using :ghc-flag:`-XDefaultSignatures` that incorrectly + type-checked in GHC 8.0.1 are now rejected by GHC 8.0.2. See + :ghc-ticket:`12784` for details. + Compiler ~~~~~~~~ From git at git.haskell.org Mon Nov 7 19:42:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 19:42:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump filepath submodule (c310f1a) Message-ID: <20161107194203.2671C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c310f1af196ff4d5cee53ac3c12bb69aec8f1896/ghc >--------------------------------------------------------------- commit c310f1af196ff4d5cee53ac3c12bb69aec8f1896 Author: Ben Gamari Date: Tue Nov 1 15:26:04 2016 -0400 Bump filepath submodule >--------------------------------------------------------------- c310f1af196ff4d5cee53ac3c12bb69aec8f1896 libraries/filepath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/filepath b/libraries/filepath index f510e50..07b334b 160000 --- a/libraries/filepath +++ b/libraries/filepath @@ -1 +1 @@ -Subproject commit f510e50feefe9995334769dd5e26c79edbe6fdc1 +Subproject commit 07b334b406a45057a80e821e72c4b973117caae9 From git at git.haskell.org Mon Nov 7 19:42:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 19:42:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix failure in setnumcapabilities001 (#12728) (2722cd5) Message-ID: <20161107194205.D07F73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2722cd55431452ad7fc7fcae030b1587086dec8f/ghc >--------------------------------------------------------------- commit 2722cd55431452ad7fc7fcae030b1587086dec8f Author: Simon Marlow Date: Fri Oct 21 12:02:57 2016 -0400 Fix failure in setnumcapabilities001 (#12728) The value of enabled_capabilities can change across a call to requestSync(), and we were erroneously using an old value, causing things to go wrong later. It manifested as an assertion failure, I'm not sure whether there are worse consequences or not, but we should get this fix into 8.0.2 anyway. The failure didn't happen for me because it only shows up on machines with fewer than 4 processors, due to the new logic to enable -qn automatically. I've bumped the test parameter 8 to make it more likely to exercise that code. Test Plan: Ran setnumcapabilities001 many times Reviewers: niteria, austin, erikd, rwbarton, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2617 GHC Trac Issues: #12728 (cherry picked from commit acc98510c5e32474b0bba9fba54e78df2b11078c) >--------------------------------------------------------------- 2722cd55431452ad7fc7fcae030b1587086dec8f rts/Schedule.c | 45 +++++++++++++++++------------ testsuite/tests/concurrent/should_run/all.T | 2 +- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 74859af..1f42e42 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1543,27 +1543,14 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS, gc_type = SYNC_GC_SEQ; } - if (gc_type == SYNC_GC_PAR && RtsFlags.ParFlags.parGcThreads > 0) { - need_idle = stg_max(0, enabled_capabilities - - RtsFlags.ParFlags.parGcThreads); - } else { - need_idle = 0; - } - // In order to GC, there must be no threads running Haskell code. - // Therefore, the GC thread needs to hold *all* the capabilities, - // and release them after the GC has completed. + // Therefore, for single-threaded GC, the GC thread needs to hold *all* the + // capabilities, and release them after the GC has completed. For parallel + // GC, we synchronise all the running threads using requestSync(). // - // This seems to be the simplest way: previous attempts involved - // making all the threads with capabilities give up their - // capabilities and sleep except for the *last* one, which - // actually did the GC. But it's quite hard to arrange for all - // the other tasks to sleep and stay asleep. - // - - /* Other capabilities are prevented from running yet more Haskell - threads if pending_sync is set. Tested inside - yieldCapability() and releaseCapability() in Capability.c */ + // Other capabilities are prevented from running yet more Haskell threads if + // pending_sync is set. Tested inside yieldCapability() and + // releaseCapability() in Capability.c PendingSync sync = { .type = gc_type, @@ -1575,6 +1562,26 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS, SyncType prev_sync = 0; rtsBool was_syncing; do { + // If -qn is not set and we have more capabilities than cores, set + // the number of GC threads to #cores. We do this here rather than + // in normaliseRtsOpts() because here it will work if the program + // calls setNumCapabilities. + // + n_gc_threads = RtsFlags.ParFlags.parGcThreads; + if (n_gc_threads == 0 && + enabled_capabilities > getNumberOfProcessors()) { + n_gc_threads = getNumberOfProcessors(); + } + + // This calculation must be inside the loop because + // enabled_capabilities may change if requestSync() below fails and + // we retry. + if (gc_type == SYNC_GC_PAR && n_gc_threads > 0) { + need_idle = stg_max(0, enabled_capabilities - n_gc_threads); + } else { + need_idle = 0; + } + // We need an array of size n_capabilities, but since this may // change each time around the loop we must allocate it afresh. idle_cap = (rtsBool *)stgMallocBytes(n_capabilities * diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T index 3d5e08b..e7537ec 100644 --- a/testsuite/tests/concurrent/should_run/all.T +++ b/testsuite/tests/concurrent/should_run/all.T @@ -246,7 +246,7 @@ test('conc068', [ omit_ways('threaded2'), exit_code(1) ], compile_and_run, ['']) test('setnumcapabilities001', [ only_ways(['threaded1','threaded2']), - extra_run_opts('4 12 2000'), + extra_run_opts('8 12 2000'), req_smp ], compile_and_run, ['']) From git at git.haskell.org Mon Nov 7 19:42:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 19:42:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix the in-scope set for extendTvSubstWithClone (cc3a950) Message-ID: <20161107194208.84DFA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/cc3a9504f638fe14fd6532c3b616343a2ee947dd/ghc >--------------------------------------------------------------- commit cc3a9504f638fe14fd6532c3b616343a2ee947dd Author: Simon Peyton Jones Date: Sun Jun 12 00:04:30 2016 +0100 Fix the in-scope set for extendTvSubstWithClone We'd forgotten the variables free in the kind. Ditto extendCvSubstWithClone (cherry picked from commit 15fc52819c440f9e9b91ce92fcfda3c264cbe1c1) >--------------------------------------------------------------- cc3a9504f638fe14fd6532c3b616343a2ee947dd compiler/types/TyCoRep.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index fc2ac90..527270b 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1718,9 +1718,11 @@ extendTvSubst (TCvSubst in_scope tenv cenv) tv ty extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst -- Adds a new tv -> tv mapping, /and/ extends the in-scope set extendTvSubstWithClone (TCvSubst in_scope tenv cenv) tv tv' - = TCvSubst (extendInScopeSet in_scope tv') + = TCvSubst (extendInScopeSetSet in_scope new_in_scope) (extendVarEnv tenv tv (mkTyVarTy tv')) cenv + where + new_in_scope = tyCoVarsOfType (tyVarKind tv') `extendVarSet` tv' extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst extendCvSubst (TCvSubst in_scope tenv cenv) v co @@ -1728,9 +1730,11 @@ extendCvSubst (TCvSubst in_scope tenv cenv) v co extendCvSubstWithClone :: TCvSubst -> CoVar -> CoVar -> TCvSubst extendCvSubstWithClone (TCvSubst in_scope tenv cenv) cv cv' - = TCvSubst (extendInScopeSet in_scope cv') + = TCvSubst (extendInScopeSetSet in_scope new_in_scope) tenv (extendVarEnv cenv cv (mkCoVarCo cv')) + where + new_in_scope = tyCoVarsOfType (varType cv') `extendVarSet` cv' extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst -- Also extends the in-scope set From git at git.haskell.org Mon Nov 7 19:42:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 19:42:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Refine ASSERT in buildPatSyn for the nullary case. (c33aad1) Message-ID: <20161107194211.B57C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c33aad1e77bdfa929f52cefa8ebf7c5917b60405/ghc >--------------------------------------------------------------- commit c33aad1e77bdfa929f52cefa8ebf7c5917b60405 Author: Matthew Pickering Date: Wed Oct 26 11:19:48 2016 -0400 Refine ASSERT in buildPatSyn for the nullary case. For a nullary pattern synonym we add an extra void argument to the matcher in order to preserve laziness. The check in buildPatSyn wasn't aware of this special case which was causing the assertion to fail. Reviewers: austin, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2624 GHC Trac Issues: #12746 (cherry picked from commit 23143f60680f78f80762754fe060a3e8c6dc9a01) >--------------------------------------------------------------- c33aad1e77bdfa929f52cefa8ebf7c5917b60405 compiler/iface/BuildTyCl.hs | 10 +++++++++- testsuite/tests/patsyn/should_compile/T12746.hs | 7 +++++++ testsuite/tests/patsyn/should_compile/T12746A.hs | 5 +++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/compiler/iface/BuildTyCl.hs b/compiler/iface/BuildTyCl.hs index a012906..30c744c 100644 --- a/compiler/iface/BuildTyCl.hs +++ b/compiler/iface/BuildTyCl.hs @@ -19,6 +19,7 @@ module BuildTyCl ( import IfaceEnv import FamInstEnv( FamInstEnvs, mkNewTypeCoAxiom ) import TysWiredIn( isCTupleTyConName ) +import TysPrim ( voidPrimTy ) import DataCon import PatSyn import Var @@ -197,7 +198,7 @@ buildPatSyn src_name declared_infix matcher@(matcher_id,_) builder , pat_ty `eqType` substTy subst pat_ty1 , prov_theta `eqTypes` substTys subst prov_theta1 , req_theta `eqTypes` substTys subst req_theta1 - , arg_tys `eqTypes` substTys subst arg_tys1 + , compareArgTys arg_tys (substTys subst arg_tys1) ]) , (vcat [ ppr univ_tvs <+> twiddle <+> ppr univ_tvs1 , ppr ex_tvs <+> twiddle <+> ppr ex_tvs1 @@ -218,6 +219,13 @@ buildPatSyn src_name declared_infix matcher@(matcher_id,_) builder subst = zipTvSubst (univ_tvs1 ++ ex_tvs1) (mkTyVarTys (univ_tvs ++ ex_tvs)) + -- For a nullary pattern synonym we add a single void argument to the + -- matcher to preserve laziness in the case of unlifted types. + -- See #12746 + compareArgTys :: [Type] -> [Type] -> Bool + compareArgTys [] [x] = x `eqType` voidPrimTy + compareArgTys arg_tys matcher_arg_tys = arg_tys `eqTypes` matcher_arg_tys + ------------------------------------------------------ type TcMethInfo -- A temporary intermediate, to communicate -- between tcClassSigs and buildClass. diff --git a/testsuite/tests/patsyn/should_compile/T12746.hs b/testsuite/tests/patsyn/should_compile/T12746.hs new file mode 100644 index 0000000..4c44c0f --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T12746.hs @@ -0,0 +1,7 @@ +module T12746 where + +import T12746A + +foo a = case a of + Foo -> True + _ -> False diff --git a/testsuite/tests/patsyn/should_compile/T12746A.hs b/testsuite/tests/patsyn/should_compile/T12746A.hs new file mode 100644 index 0000000..4cf7b07 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T12746A.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE ScopedTypeVariables, PatternSynonyms #-} +module T12746A where + +pattern Foo :: Int +pattern Foo = 0x00000001 diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 875449c..dd52a48 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -59,3 +59,4 @@ test('T12615', normal, compile, ['']) test('T11987', normal, multimod_compile, ['T11987', '-v0']) test('T12615', normal, compile, ['']) test('T12698', normal, compile, ['']) +test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) From git at git.haskell.org Mon Nov 7 19:42:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 7 Nov 2016 19:42:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Omit unnecessary linker flags (5c91d07) Message-ID: <20161107194214.667EB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/5c91d076c8017a89ceb43811506b9427ab85ad7e/ghc >--------------------------------------------------------------- commit 5c91d076c8017a89ceb43811506b9427ab85ad7e Author: Simon Marlow Date: Thu Oct 27 12:52:00 2016 +0100 Omit unnecessary linker flags This omits -L and -l flags from the linker command line that shouldn't be necessary because GHC will already add them via the -package-id flags we pass. This also reverts part of 90538d86af579595987826cd893828d6f379f35a that rearranges the linker command line and causes some knock-on problems (see D2618). Test Plan: validate (need to validate on Windows too) Reviewers: Phyx, bgamari, niteria, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2639 GHC Trac Issues: #12738 (cherry picked from commit a977c96537bb7077c6445f02db98636b150e6e14) >--------------------------------------------------------------- 5c91d076c8017a89ceb43811506b9427ab85ad7e compiler/main/SysTools.hs | 19 ++----------------- rules/distdir-opts.mk | 5 ----- utils/ghc-cabal/Main.hs | 3 --- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 87fa75e..236bcfd 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -942,24 +942,9 @@ runLink dflags args = do let (p,args0) = pgm_l dflags args1 = map Option (getOpts dflags opt_l) args2 = args0 ++ linkargs ++ args1 ++ args - args3 = argFixup args2 [] - mb_env <- getGccEnv args3 - runSomethingResponseFile dflags ld_filter "Linker" p args3 mb_env + mb_env <- getGccEnv args2 + runSomethingResponseFile dflags ld_filter "Linker" p args2 mb_env where - testLib lib = "-l" `isPrefixOf` lib || ".a" `isSuffixOf` lib - {- GHC is just blindly appending linker arguments from libraries and - the commandline together. This results in very problematic link orders - which will cause incorrect linking. Since we're changing the link - arguments anyway, let's just make sure libraries are last. - This functions moves libraries on the link all the way back - but keeps the order amongst them the same. -} - argFixup [] r = [] ++ r - argFixup (o@(Option opt):xs) r = if testLib opt - then argFixup xs (r ++ [o]) - else o:argFixup xs r - argFixup (o@(FileOption _ opt):xs) r = if testLib opt - then argFixup xs (r ++ [o]) - else o:argFixup xs r ld_filter = case (platformOS (targetPlatform dflags)) of OSSolaris2 -> sunos_ld_filter _ -> id diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index e411559..51e111a 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -44,16 +44,11 @@ $1_$2_DIST_CC_OPTS = \ $$($1_$2_DEP_CC_OPTS) \ $$(SRC_CC_WARNING_OPTS) -ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)),) -$1_$2_DIST_LD_LIB_DIRS := $$(subst $$(space)',$$(space)-L',$$(space)$$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)) -endif - $1_$2_DIST_LD_OPTS = \ $$(SRC_LD_OPTS) \ $$($1_LD_OPTS) \ $$($1_$2_LD_OPTS) \ $$($1_$2_DIST_LD_LIB_DIRS) \ - $$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \ $$($1_$2_DEP_LD_OPTS) # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 1937392..0ec2a2a 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -402,7 +402,6 @@ generate directory distdir dll0Modules config_args mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build" libraryRelDirs = map mkLibraryRelDir transitiveDepNames wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs - wrappedLibraryDirs <- wrap libraryDirs let variablePrefix = directory ++ '_':distdir mods = map display modules @@ -442,11 +441,9 @@ generate directory distdir dll0Modules config_args variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), - variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS = " ++ unwords libraryRelDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs, - variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), "", From git at git.haskell.org Wed Nov 9 21:19:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 9 Nov 2016 21:19:30 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T3384' created Message-ID: <20161109211930.73E263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T3384 Referencing: 8cf5f4898a314194324600860e2b8e67fd450a42 From git at git.haskell.org Wed Nov 9 21:19:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 9 Nov 2016 21:19:34 +0000 (UTC) Subject: [commit: ghc] wip/T3384: Add HsSyn prettyprinter tests (8cf5f48) Message-ID: <20161109211934.E3ACD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/8cf5f4898a314194324600860e2b8e67fd450a42/ghc >--------------------------------------------------------------- commit 8cf5f4898a314194324600860e2b8e67fd450a42 Author: Alan Zimmerman Date: Tue Nov 8 21:37:48 2016 +0200 Add HsSyn prettyprinter tests Add prettyprinter tests, which take a file, parse it, pretty print it, re-parse the pretty printed version and then compare the original and new ASTs (ignoring locations) Trac issue: #3384 >--------------------------------------------------------------- 8cf5f4898a314194324600860e2b8e67fd450a42 compiler/hsSyn/HsExpr.hs | 9 +- ghc.mk | 3 + testsuite/mk/boilerplate.mk | 1 + testsuite/tests/boxy/Base1.stderr | 4 +- testsuite/tests/generics/GenDerivOutput.stderr | 32 +-- testsuite/tests/generics/GenDerivOutput1_0.stderr | 8 +- testsuite/tests/generics/GenDerivOutput1_1.stderr | 65 +++---- .../tests/generics/T10604/T10604_deriving.stderr | 32 +-- testsuite/tests/printer/Makefile | 22 +++ testsuite/tests/printer/Ppr001.hs | 7 + testsuite/tests/printer/Ppr002.hs | 46 +++++ testsuite/tests/printer/all.T | 4 + .../tests/typecheck/should_compile/T11339.stderr | 4 +- .../tests/typecheck/should_fail/T12124.stderr | 4 +- .../tests/typecheck/should_fail/T7748a.stderr | 4 +- utils/check-ppr/Main.hs | 216 +++++++++++++++++++++ utils/check-ppr/README | 19 ++ utils/check-ppr/check-ppr.cabal | 32 +++ {driver/ghc => utils/check-ppr}/ghc.mk | 18 +- 19 files changed, 438 insertions(+), 92 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 8cf5f4898a314194324600860e2b8e67fd450a42 From git at git.haskell.org Thu Nov 10 14:16:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 14:16:49 +0000 (UTC) Subject: [commit: ghc] master: Fix comment about pointer tagging (2325afe) Message-ID: <20161110141649.15A9A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2325afe92cf73479756d3a29af82588b7bbe9d92/ghc >--------------------------------------------------------------- commit 2325afe92cf73479756d3a29af82588b7bbe9d92 Author: Alex Biehl Date: Thu Nov 10 13:12:30 2016 +0100 Fix comment about pointer tagging `Lcall` enters the closure. If it has tags we jump directly to `Lret`. Confirmed with some generated cmm code: ``` R1 = _s2pP::P64; Sp = Sp - 8; if (R1 & 7 != 0) goto c2x0; else goto c2x1; c2x1: call (I64[R1])(R1) returns to c2x0, args: 8, res: 8, upd: 8; c2x0: _s2pQ::P64 = R1; ``` >--------------------------------------------------------------- 2325afe92cf73479756d3a29af82588b7bbe9d92 compiler/codeGen/StgCmmExpr.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index fdd902d..cd73ec5 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -872,7 +872,7 @@ emitEnter fun = do -- The generated code will be something like this: -- -- R1 = fun -- copyout - -- if (fun & 7 != 0) goto Lcall else goto Lret + -- if (fun & 7 != 0) goto Lret else goto Lcall -- Lcall: -- call [fun] returns to Lret -- Lret: From git at git.haskell.org Thu Nov 10 16:03:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 16:03:57 +0000 (UTC) Subject: [commit: ghc] master: Adapt the (commented out) pprTrace in OccurAnal (7fe7163) Message-ID: <20161110160357.0E5613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7fe71636dc14a219c26def5cac2da9fa20689540/ghc >--------------------------------------------------------------- commit 7fe71636dc14a219c26def5cac2da9fa20689540 Author: Simon Peyton Jones Date: Thu Nov 10 15:50:57 2016 +0000 Adapt the (commented out) pprTrace in OccurAnal I did this while investigating Trac #12776 >--------------------------------------------------------------- 7fe71636dc14a219c26def5cac2da9fa20689540 compiler/simplCore/OccurAnal.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 1186d0d..ac1736c 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -770,8 +770,9 @@ occAnalRec (CyclicSCC nodes) (body_uds, binds) | otherwise -- At this point we always build a single Rec = -- pprTrace "occAnalRec" (vcat - -- [ text "tagged nodes" <+> ppr tagged_nodes - -- , text "lb edges" <+> ppr loop_breaker_edges]) + -- [ text "weak_fvs" <+> ppr weak_fvs + -- , text "tagged nodes" <+> ppr tagged_nodes + -- , text "lb edges" <+> ppr loop_breaker_edges]) (final_uds, Rec pairs : binds) where From git at git.haskell.org Thu Nov 10 16:03:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 16:03:59 +0000 (UTC) Subject: [commit: ghc] master: Refactoring of mkNewTypeEqn (f05d685) Message-ID: <20161110160359.B524D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f05d685ae05ec293083f2fa7ec7ba057fbe64869/ghc >--------------------------------------------------------------- commit f05d685ae05ec293083f2fa7ec7ba057fbe64869 Author: Simon Peyton Jones Date: Thu Nov 10 15:52:31 2016 +0000 Refactoring of mkNewTypeEqn The refactoring here is very small. I did it while studying Trac #12814. To implement the change in #12814, we can just un-comment the lines at line 1275. It's ready to go but I didn't want to pull the trigger in this commit >--------------------------------------------------------------- f05d685ae05ec293083f2fa7ec7ba057fbe64869 compiler/typecheck/TcDeriv.hs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 4722f16..0ff70fd 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1256,6 +1256,7 @@ mkNewTypeEqn dflags overlap_mode tvs -- Next we figure out what superclass dictionaries to use -- See Note [Newtype deriving superclasses] above + sc_theta :: [PredOrigin] cls_tyvars = classTyVars cls dfun_tvs = tyCoVarsOfTypesWellScoped inst_tys inst_ty = mkTyConApp tycon tc_args @@ -1264,24 +1265,24 @@ mkNewTypeEqn dflags overlap_mode tvs substTheta (zipTvSubst cls_tyvars inst_tys) $ classSCTheta cls - -- Next we collect Coercible constraints between - -- the Class method types, instantiated with the representation and the - -- newtype type; precisely the constraints required for the - -- calls to coercible that we are going to generate. - coercible_constraints = - [ let (Pair t1 t2) = mkCoerceClassMethEqn cls dfun_tvs inst_tys rep_inst_ty meth - in mkPredOrigin (DerivOriginCoerce meth t1 t2) TypeLevel - (mkReprPrimEqPred t1 t2) - | meth <- classMethods cls ] - - -- If there are no tyvars, there's no need - -- to abstract over the dictionaries we need - -- Example: newtype T = MkT Int deriving( C ) - -- We get the derived instance - -- instance C T - -- rather than - -- instance C Int => C T - all_preds = rep_pred_o : coercible_constraints ++ sc_theta -- NB: rep_pred comes first + -- Next we collect constraints for the class methods + -- If there are no methods, we don't need any constraints + -- Otherwise we need (C rep_ty), for the representation methods, + -- and constraints to coerce each individual method + meth_theta :: [PredOrigin] + meths = classMethods cls + meth_theta = rep_pred_o : coercible_constraints +-- meth_theta | null meths = [] -- No methods => no constraints (Trac #12814) +-- | otherwise = rep_pred_o : coercible_constraints + coercible_constraints + = [ mkPredOrigin (DerivOriginCoerce meth t1 t2) TypeLevel + (mkReprPrimEqPred t1 t2) + | meth <- meths + , let (Pair t1 t2) = mkCoerceClassMethEqn cls dfun_tvs + inst_tys rep_inst_ty meth ] + + all_preds :: [PredOrigin] + all_preds = meth_theta ++ sc_theta ------------------------------------------------------------------- -- Figuring out whether we can only do this newtype-deriving thing From git at git.haskell.org Thu Nov 10 16:04:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 16:04:02 +0000 (UTC) Subject: [commit: ghc] master: Refactor CallStack defaulting slightly (317236d) Message-ID: <20161110160402.6B8593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/317236db308d9bd497a11fa4c455428fc7477405/ghc >--------------------------------------------------------------- commit 317236db308d9bd497a11fa4c455428fc7477405 Author: Simon Peyton Jones Date: Thu Nov 10 16:02:42 2016 +0000 Refactor CallStack defaulting slightly This moves call-stack defaulting from simpl_top to solveWanteds, for reasons described in Note [CallStack defaulting]. No change in visible behaviour. >--------------------------------------------------------------- 317236db308d9bd497a11fa4c455428fc7477405 compiler/typecheck/TcSimplify.hs | 74 +++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 0594313..c943596 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -148,42 +148,7 @@ simpl_top wanteds then do { wc_residual <- nestTcS (solveWantedsAndDrop wc) ; try_class_defaulting wc_residual } -- See Note [Overview of implicit CallStacks] in TcEvidence - else try_callstack_defaulting wc } - - try_callstack_defaulting :: WantedConstraints -> TcS WantedConstraints - try_callstack_defaulting wc - | isEmptyWC wc - = return wc - | otherwise - = defaultCallStacks wc - --- | Default any remaining @CallStack@ constraints to empty @CallStack at s. -defaultCallStacks :: WantedConstraints -> TcS WantedConstraints --- See Note [Overview of implicit CallStacks] in TcEvidence -defaultCallStacks wanteds - = do simples <- handle_simples (wc_simple wanteds) - implics <- mapBagM handle_implic (wc_impl wanteds) - return (wanteds { wc_simple = simples, wc_impl = implics }) - - where - - handle_simples simples - = catBagMaybes <$> mapBagM defaultCallStack simples - - handle_implic implic - = do { wanteds <- setEvBindsTcS (ic_binds implic) $ - -- defaultCallStack sets a binding, so - -- we must set the correct binding group - defaultCallStacks (ic_wanted implic) - ; return (implic { ic_wanted = wanteds }) } - - defaultCallStack ct - | Just _ <- isCallStackPred (ctPred ct) - = do { solveCallStack (cc_ev ct) EvCsEmpty - ; return Nothing } - - defaultCallStack ct - = return (Just ct) + else return wc } {- Note [Fail fast on kind errors] @@ -1105,9 +1070,12 @@ solveWanteds wc@(WC { wc_simple = simples, wc_insol = insols, wc_impl = implics ; (floated_eqs, implics2) <- solveNestedImplications (implics `unionBags` implics1) ; dflags <- getDynFlags - ; final_wc <- simpl_loop 0 (solverIterations dflags) floated_eqs no_new_scs - (WC { wc_simple = simples1, wc_impl = implics2 - , wc_insol = insols `unionBags` insols1 }) + ; wc2 <- simpl_loop 0 (solverIterations dflags) floated_eqs no_new_scs + (WC { wc_simple = simples1, wc_impl = implics2 + , wc_insol = insols `unionBags` insols1 }) + + -- Do call-stack defaultin + ; final_wc <- defaultCallStacks wc2 ; bb <- TcS.getTcEvBindsMap ; traceTcS "solveWanteds }" $ @@ -1556,8 +1524,36 @@ Conclusion: we should call solveNestedImplications only if we did some unifiction in solveSimpleWanteds; because that's the only way we'll get more Givens (a unificaiton is like adding a Given) to allow the implication to make progress. + +Note [CallStack defaulting] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +See Note [Overview of implicit CallStacks] in TcEvidence. + +We default an unsolved call stack to EvCsEmpty, in solveWanteds, after +solving the wanteds as hard as we can, because that means that there +are no gratuitous unsolved CallStack constraints lying around to +clutter up the constraint tree. (Previously it was done in simpl_top, +but that's really not the right place, because it left us with +Unsolved impliations that has no wanted constraints, because +defaultCallStacks had got rid of them.) -} +-- | Default any remaining @CallStack@ constraints to empty @CallStack at s. +-- See Note [CallStack defaulting] +defaultCallStacks :: WantedConstraints -> TcS WantedConstraints +defaultCallStacks wanteds@(WC { wc_simple = simples }) + = do { simples' <- catBagMaybes <$> mapBagM defaultCallStack simples + ; return (wanteds { wc_simple = simples' }) } + where + defaultCallStack ct + | Just _ <- isCallStackPred (ctEvPred ev) + = do { solveCallStack ev EvCsEmpty + ; return Nothing } + + | otherwise = return (Just ct) + where + ev = ctEvidence ct + promoteTyVar :: TcLevel -> TcTyVar -> TcM () -- When we float a constraint out of an implication we must restore -- invariant (MetaTvInv) in Note [TcLevel and untouchable type variables] in TcType From git at git.haskell.org Thu Nov 10 18:44:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 18:44:33 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T12819' created Message-ID: <20161110184433.E15693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T12819 Referencing: ed0515682851f592e3f949cef26ee6d06f11e88f From git at git.haskell.org Thu Nov 10 18:44:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 18:44:36 +0000 (UTC) Subject: [commit: ghc] wip/T12819: Reshuffle levity polymorphism checks. (ed05156) Message-ID: <20161110184436.9AD323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12819 Link : http://ghc.haskell.org/trac/ghc/changeset/ed0515682851f592e3f949cef26ee6d06f11e88f/ghc >--------------------------------------------------------------- commit ed0515682851f592e3f949cef26ee6d06f11e88f Author: Richard Eisenberg Date: Thu Nov 10 13:41:30 2016 -0500 Reshuffle levity polymorphism checks. Previously, GHC checked for bad levity polymorphism to the left of all arrows in data constructors. This was wrong, as reported in #??? (where an example is also shown). The solution is to check each individual argument for bad levity polymorphism. Thus the check has been moved from TcValidity to TcTyClsDecls. A similar situation exists with pattern synonyms, also fixed here. This patch also nabs #12819 while I was in town. Test cases: ??? >--------------------------------------------------------------- ed0515682851f592e3f949cef26ee6d06f11e88f compiler/typecheck/TcSigs.hs | 28 ++++++++++++++++++++++------ compiler/typecheck/TcTyClsDecls.hs | 2 ++ compiler/typecheck/TcValidity.hs | 3 --- compiler/types/Type.hs | 5 +++-- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcSigs.hs b/compiler/typecheck/TcSigs.hs index 9c4fd2b..3e63493 100644 --- a/compiler/typecheck/TcSigs.hs +++ b/compiler/typecheck/TcSigs.hs @@ -30,6 +30,8 @@ import TcRnTypes import TcRnMonad import TcType import TcMType +import TcHsSyn ( checkForRepresentationPolymorphism ) +import TcValidity ( checkValidType ) import TcUnify( tcSkolemise, unifyType, noThing ) import Inst( topInstantiate ) import TcEnv( tcLookupId ) @@ -367,16 +369,12 @@ tcPatSynSig name sig_ty -- Kind generalisation ; kvs <- kindGeneralize $ - mkSpecForAllTys (implicit_tvs ++ univ_tvs) $ - mkFunTys req $ - mkSpecForAllTys ex_tvs $ - mkFunTys prov $ - body_ty + build_patsyn_type [] implicit_tvs univ_tvs req + ex_tvs prov body_ty -- These are /signatures/ so we zonk to squeeze out any kind -- unification variables. Do this after quantifyTyVars which may -- default kind variables to *. - -- ToDo: checkValidType? ; traceTc "about zonk" empty ; implicit_tvs <- mapM zonkTcTyCoVarBndr implicit_tvs ; univ_tvs <- mapM zonkTcTyCoVarBndr univ_tvs @@ -385,6 +383,15 @@ tcPatSynSig name sig_ty ; prov <- zonkTcTypes prov ; body_ty <- zonkTcType body_ty + -- Now do validity checking + ; checkValidType ctxt $ + build_patsyn_type kvs implicit_tvs univ_tvs req ex_tvs prov body_ty + + -- arguments become the types of binders. We thus cannot allow + -- levity polymorphism here + ; let (arg_tys, _) = tcSplitFunTys body_ty + ; mapM_ (checkForRepresentationPolymorphism empty) arg_tys + ; traceTc "tcTySig }" $ vcat [ text "implicit_tvs" <+> ppr_tvs implicit_tvs , text "kvs" <+> ppr_tvs kvs @@ -402,6 +409,15 @@ tcPatSynSig name sig_ty , patsig_prov = prov , patsig_body_ty = body_ty }) } where + ctxt = PatSynCtxt name + + build_patsyn_type kvs imp univ req ex prov body + = mkInvForAllTys kvs $ + mkSpecForAllTys (imp ++ univ) $ + mkFunTys req $ + mkSpecForAllTys ex $ + mkFunTys prov $ + body ppr_tvs :: [TyVar] -> SDoc ppr_tvs tvs = braces (vcat [ ppr tv <+> dcolon <+> ppr (tyVarKind tv) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 0b471d2..67fd036 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -2295,6 +2295,8 @@ checkValidDataCon dflags existential_ok tc con -- Check all argument types for validity ; checkValidType ctxt (dataConUserType con) + ; mapM_ (checkForRepresentationPolymorphism empty) + (dataConOrigArgTys con) -- Extra checks for newtype data constructors ; when (isNewTyCon tc) (checkNewDataCon con) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index b316fe2..87c742a 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -39,7 +39,6 @@ import TyCon -- others: import HsSyn -- HsType import TcRnMonad -- TcType, amongst others -import TcHsSyn ( checkForRepresentationPolymorphism ) import TcEnv ( tcGetInstEnvs ) import FunDeps import InstEnv ( ClsInst, lookupInstEnv, isOverlappable ) @@ -487,8 +486,6 @@ check_type _ _ _ (TyVarTy _) = return () check_type env ctxt rank (FunTy arg_ty res_ty) = do { check_type env ctxt arg_rank arg_ty - ; when (representationPolymorphismForbidden ctxt) $ - checkForRepresentationPolymorphism empty arg_ty ; check_type env ctxt res_rank res_ty } where (arg_rank, res_rank) = funArgResRank rank diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index f615757..81798fb 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1196,12 +1196,13 @@ interfaces. Notably this plays a role in tcTySigs in TcBinds.hs. ~~~~~~~~ -} --- | Make a dependent forall. +-- | Make a dependent forall over an Inferred (as opposed to Specified) +-- variable mkInvForAllTy :: TyVar -> Type -> Type mkInvForAllTy tv ty = ASSERT( isTyVar tv ) ForAllTy (TvBndr tv Inferred) ty --- | Like mkForAllTys, but assumes all variables are dependent and invisible, +-- | Like mkForAllTys, but assumes all variables are dependent and Inferred, -- a common case mkInvForAllTys :: [TyVar] -> Type -> Type mkInvForAllTys tvs ty = ASSERT( all isTyVar tvs ) From git at git.haskell.org Thu Nov 10 18:50:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 18:50:51 +0000 (UTC) Subject: [commit: ghc] master: build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS (816d2e4) Message-ID: <20161110185051.22E7B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/816d2e415a32651ed6876c19adb6d33b94c08864/ghc >--------------------------------------------------------------- commit 816d2e415a32651ed6876c19adb6d33b94c08864 Author: Ben Gamari Date: Fri Nov 4 15:03:44 2016 -0400 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS This ensures that artifacts built with build-prog see these options. Also spruce up comments. Test Plan: Carefully read it. Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2673 >--------------------------------------------------------------- 816d2e415a32651ed6876c19adb6d33b94c08864 configure.ac | 5 +++++ rules/distdir-way-opts.mk | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5decd24..9b0b549 100644 --- a/configure.ac +++ b/configure.ac @@ -626,15 +626,20 @@ FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAG FP_GCC_EXTRA_FLAGS +# See rules/distdir-way-opts.mk for details. +# Flags passed to the C compiler AC_SUBST(CONF_CC_OPTS_STAGE0) AC_SUBST(CONF_CC_OPTS_STAGE1) AC_SUBST(CONF_CC_OPTS_STAGE2) +# Flags passed to the C compiler when we ask it to link AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2) +# Flags passed to the linker when we ask it to link AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2) +# Flags passed to the C preprocessor AC_SUBST(CONF_CPP_OPTS_STAGE0) AC_SUBST(CONF_CPP_OPTS_STAGE1) AC_SUBST(CONF_CPP_OPTS_STAGE2) diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 31329f5..6ae9807 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -34,9 +34,18 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage # # CONF_HC_OPTS GHC options from ./configure mk/config.mk.in # +# CONF_CPP_OPTS_STAGE$4 CPP options from ./configure mk/config.mk.in +# +# CONF_CC_OPTS_STAGE$4 C compiler options from mk/config.mk.in +# ./configure +# # CONF_HC_OPTS_STAGE$4 GHC options from ./configure mk/config.mk.in # specific to stage $4 # +# CONF_LD_LINKER_OPTS_STAGE$4 +# GHC options from ./configure mk/config.mk.in +# specific to stage $4 +# # WAY_$3_HC_OPTS GHC options specific to way $3 mk/ways.mk # # SRC_HC_OPTS source-tree-wide GHC options mk/config.mk.in @@ -193,7 +202,8 @@ $1_$2_$3_ALL_LD_OPTS = \ $$($1_$2_DIST_LD_OPTS) \ $$($1_$2_$3_LD_OPTS) \ $$($1_$2_EXTRA_LD_OPTS) \ - $$(EXTRA_LD_OPTS) + $$(EXTRA_LD_OPTS) \ + $$(CONF_LD_LINKER_OPTS_STAGE$4) # Options for passing to GHC when we use it for linking $1_$2_$3_GHC_LD_OPTS = \ From git at git.haskell.org Thu Nov 10 18:50:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 18:50:53 +0000 (UTC) Subject: [commit: ghc] master: configure: Pass HC_OPTS_STAGEx to build system (9030d8e) Message-ID: <20161110185053.CB5CF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9030d8e4dc321dbcd32baae33f150b4e7c8ed141/ghc >--------------------------------------------------------------- commit 9030d8e4dc321dbcd32baae33f150b4e7c8ed141 Author: Ben Gamari Date: Fri Nov 4 15:03:55 2016 -0400 configure: Pass HC_OPTS_STAGEx to build system Test Plan: Try `./configure HC_OPTS_STAGE0=-foobar` and watch it fail Reviewers: austin, hvr Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2674 >--------------------------------------------------------------- 9030d8e4dc321dbcd32baae33f150b4e7c8ed141 configure.ac | 4 ++++ mk/config.mk.in | 3 +++ 2 files changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index 9b0b549..70c4447 100644 --- a/configure.ac +++ b/configure.ac @@ -643,6 +643,10 @@ AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2) AC_SUBST(CONF_CPP_OPTS_STAGE0) AC_SUBST(CONF_CPP_OPTS_STAGE1) AC_SUBST(CONF_CPP_OPTS_STAGE2) +# Flags passed to the Haskell compiler +AC_SUBST(CONF_HC_OPTS_STAGE0) +AC_SUBST(CONF_HC_OPTS_STAGE1) +AC_SUBST(CONF_HC_OPTS_STAGE2) dnl ** Set up the variables for the platform in the settings file. dnl May need to use gcc to find platform details. diff --git a/mk/config.mk.in b/mk/config.mk.in index 2163643..35c492f 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -618,6 +618,9 @@ CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@ CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@ CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@ CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@ +CONF_HC_OPTS_STAGE0 = @CONF_HC_OPTS_STAGE0@ +CONF_HC_OPTS_STAGE1 = @CONF_HC_OPTS_STAGE1@ +CONF_HC_OPTS_STAGE2 = @CONF_HC_OPTS_STAGE2@ # The .hsc files aren't currently safe for cross-compilation on Windows: # libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160 From git at git.haskell.org Thu Nov 10 18:50:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 18:50:56 +0000 (UTC) Subject: [commit: ghc] master: ghc-cabal: Use correct name of linker flags env variable (500d90d) Message-ID: <20161110185056.7D1563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/500d90d2ec841453a2b4162307ea706aa2cb5b1e/ghc >--------------------------------------------------------------- commit 500d90d2ec841453a2b4162307ea706aa2cb5b1e Author: Ben Gamari Date: Fri Nov 4 15:03:33 2016 -0400 ghc-cabal: Use correct name of linker flags env variable Currently passing the `CONF_LD_LINKER_OPTS_STAGE0` environment variable to `configure` is broken due to this naming inconsistency. Test Plan: Try passing `CONF_LD_LINKER_OPTS_STAGE0` to `configure`. Look at resulting stage0 ghc invocation. Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2672 >--------------------------------------------------------------- 500d90d2ec841453a2b4162307ea706aa2cb5b1e utils/ghc-cabal/ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 38f7951..78a6705 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -47,7 +47,7 @@ $(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs) $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/. "$(GHC)" $(SRC_HC_OPTS) \ $(addprefix -optc, $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)) \ - $(addprefix -optl, $(SRC_LD_OPTS) $(CONF_LD_OPTS_STAGE0)) \ + $(addprefix -optl, $(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE0)) \ -hide-all-packages \ $(addprefix -package , $(CABAL_BUILD_DEPS)) \ --make utils/ghc-cabal/Main.hs -o $@ \ From git at git.haskell.org Thu Nov 10 18:50:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 18:50:59 +0000 (UTC) Subject: [commit: ghc] master: Pass -no-pie to GCC (bae4a55) Message-ID: <20161110185059.2F16B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bae4a55b1fb403f610b4b55a1b6fb3f03e9c2026/ghc >--------------------------------------------------------------- commit bae4a55b1fb403f610b4b55a1b6fb3f03e9c2026 Author: Ben Gamari Date: Thu Nov 10 13:18:09 2016 -0500 Pass -no-pie to GCC Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be default in their GCC packaging. This breaks our abuse of GCC as a linker which requires that we pass -Wl,-r, which is incompatible with PIE (since the former implies that we are generating a relocatable object file and the latter an executable). Test Plan: Validate Reviewers: hvr, austin Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D2691 GHC Trac Issues: #12759 >--------------------------------------------------------------- bae4a55b1fb403f610b4b55a1b6fb3f03e9c2026 aclocal.m4 | 18 ++++++++++++++++++ compiler/main/DriverPipeline.hs | 9 +++++++++ compiler/main/SysTools.hs | 13 +++++++++++++ configure.ac | 3 +++ distrib/configure.ac.in | 1 + 5 files changed, 44 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index df9d420..3a35fe9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1322,6 +1322,24 @@ AC_SUBST(GccIsClang) rm -f conftest.txt ]) +# FP_GCC_SUPPORTS_NO_PIE +# ---------------------- +# Does gcc support the -no-pie option? If so we should pass it to gcc when +# joining objects since -pie may be enabled by default. +AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_MSG_CHECKING([whether GCC supports -no-pie]) + echo 'int main() { return 0; }' > conftest.c + if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then + AC_DEFINE(GCC_SUPPORTS_NO_PIE, 1, [gcc supports -no-pie]) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + rm -f conftest.c conftest.o conftest +]) + dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary. dnl diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index b578612..23badbd 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1859,6 +1859,11 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ map SysTools.Option ( [] +#if GCC_SUPPORTS_NO_PIE + -- See Note [No PIE eating when linking] + ++ ["-no-pie"] +#endif + -- Permit the linker to auto link _symbol to _imp_symbol. -- This lets us link against DLLs without needing an "import library". ++ (if platformOS platform == OSMinGW32 @@ -2157,6 +2162,10 @@ joinObjectFiles dflags o_files output_fn = do SysTools.Option "-nostdlib", SysTools.Option "-Wl,-r" ] +#if GCC_SUPPORTS_NO_PIE + -- See Note [No PIE eating while linking] in SysTools + ++ [SysTools.Option "-no-pie"] +#endif ++ (if any (cc ==) [Clang, AppleClang, AppleClang51] then [] else [SysTools.Option "-nodefaultlibs"]) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 5fb92c8..82a6383 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -1546,6 +1546,15 @@ linesPlatform xs = #endif +{- +Note [No PIE eating while linking] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by +default in their gcc builds. This is incompatible with -r as it implies that we +are producing an executable. Consequently, we must manually pass -no-pie to gcc +when joining object files or linking dynamic libraries. See #12759. +-} + linkDynLib :: DynFlags -> [String] -> [InstalledUnitId] -> IO () linkDynLib dflags0 o_files dep_packages = do @@ -1711,6 +1720,10 @@ linkDynLib dflags0 o_files dep_packages ++ [ Option "-o" , FileOption "" output_fn ] +#if GCC_SUPPORTS_NO_PIE + -- See Note [No PIE eating when linking] + ++ [ Option "-no-pie" ] +#endif ++ map Option o_files ++ [ Option "-shared" ] ++ map Option bsymbolicFlag diff --git a/configure.ac b/configure.ac index 70c4447..678fa2e 100644 --- a/configure.ac +++ b/configure.ac @@ -608,6 +608,9 @@ dnl If gcc, make sure it's at least 3.0 dnl FP_GCC_VERSION +dnl ** See whether gcc supports -no-pie +FP_GCC_SUPPORTS_NO_PIE + dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 0ae716b..e733f64 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -90,6 +90,7 @@ FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION +FP_GCC_SUPPORTS_NO_PIE AC_PROG_CPP FP_PROG_LD_IS_GNU From git at git.haskell.org Thu Nov 10 21:42:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add test for #12732 (4227f3e) Message-ID: <20161110214223.2B1BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/4227f3ea715960cc272a525f37e5d67ba232ae24/ghc >--------------------------------------------------------------- commit 4227f3ea715960cc272a525f37e5d67ba232ae24 Author: Ryan Scott Date: Fri Oct 28 17:00:29 2016 -0400 Add test for #12732 (cherry picked from commit 60343a419ab44d387cfd11f0dd2b522fd922e63a) >--------------------------------------------------------------- 4227f3ea715960cc272a525f37e5d67ba232ae24 testsuite/tests/partial-sigs/should_fail/T12732.hs | 6 ++++++ testsuite/tests/partial-sigs/should_fail/T12732.stderr | 6 ++++++ testsuite/tests/partial-sigs/should_fail/all.T | 1 + 3 files changed, 13 insertions(+) diff --git a/testsuite/tests/partial-sigs/should_fail/T12732.hs b/testsuite/tests/partial-sigs/should_fail/T12732.hs new file mode 100644 index 0000000..60bcde6 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T12732.hs @@ -0,0 +1,6 @@ +module T12732 where + +(a ... b) xs + | a == x + , (l, _:r) <- break (== x) xs + = l ++ [x] diff --git a/testsuite/tests/partial-sigs/should_fail/T12732.stderr b/testsuite/tests/partial-sigs/should_fail/T12732.stderr new file mode 100644 index 0000000..5188f62 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T12732.stderr @@ -0,0 +1,6 @@ + +T12732.hs:4:10: error: Variable not in scope: x + +T12732.hs:5:27: error: Variable not in scope: x + +T12732.hs:6:11: error: Variable not in scope: x diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T index a676a02..ef200d7 100644 --- a/testsuite/tests/partial-sigs/should_fail/all.T +++ b/testsuite/tests/partial-sigs/should_fail/all.T @@ -61,3 +61,4 @@ test('T10045', normal, compile_fail, ['']) test('T10999', normal, compile_fail, ['']) test('T11122', normal, compile, ['']) test('T11976', normal, compile_fail, ['']) +test('T12732', normal, compile_fail, ['-fobject-code -fdefer-typed-holes']) From git at git.haskell.org Thu Nov 10 21:42:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix Trac #12797: approximateWC (28c62bb) Message-ID: <20161110214226.475283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/28c62bb588f7026d9985afe235cbeec5e3fd9a76/ghc >--------------------------------------------------------------- commit 28c62bb588f7026d9985afe235cbeec5e3fd9a76 Author: Simon Peyton Jones Date: Wed Nov 2 11:53:21 2016 +0000 Fix Trac #12797: approximateWC This patch makes approximateWC a bit more gung-ho when called from the defaulting code. See Note [ApproximateWC], item (1). (cherry picked from commit 13508bad4810d4fa8581afbcb4f41c97fe4c92e2) >--------------------------------------------------------------- 28c62bb588f7026d9985afe235cbeec5e3fd9a76 compiler/typecheck/TcSimplify.hs | 28 ++++++++++++---------- testsuite/tests/typecheck/should_compile/T12797.hs | 15 ++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 774b89b..87aae45 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -581,7 +581,7 @@ simplifyInfer rhs_tclvl apply_mr sigs name_taus wanteds -- NB: must include derived errors in this test, -- hence "incl_derivs" - else do { let quant_cand = approximateWC wanted_transformed + else do { let quant_cand = approximateWC False wanted_transformed meta_tvs = filter isMetaTyVar $ tyCoVarsOfCtsList quant_cand @@ -1567,10 +1567,10 @@ defaultTyVarTcS the_tv | otherwise = return False -- the common case -approximateWC :: WantedConstraints -> Cts +approximateWC :: Bool -> WantedConstraints -> Cts -- Postcondition: Wanted or Derived Cts -- See Note [ApproximateWC] -approximateWC wc +approximateWC float_past_equalities wc = float_wc emptyVarSet wc where float_wc :: TcTyCoVarSet -> WantedConstraints -> Cts @@ -1591,18 +1591,17 @@ approximateWC wc float_implic :: TcTyCoVarSet -> Implication -> Cts float_implic trapping_tvs imp - | ic_no_eqs imp -- No equalities, so float + | float_past_equalities || ic_no_eqs imp = float_wc new_trapping_tvs (ic_wanted imp) - | otherwise -- Don't float out of equalities - = emptyCts -- See Note [ApproximateWC] + | otherwise -- Take care with equalities + = emptyCts -- See (1) under Note [ApproximateWC] where new_trapping_tvs = trapping_tvs `extendVarSetList` ic_skols imp do_bag :: (a -> Bag c) -> Bag a -> Bag c do_bag f = foldrBag (unionBags.f) emptyBag -{- -Note [ApproximateWC] -~~~~~~~~~~~~~~~~~~~~ +{- Note [ApproximateWC] +~~~~~~~~~~~~~~~~~~~~~~~ approximateWC takes a constraint, typically arising from the RHS of a let-binding whose type we are *inferring*, and extracts from it some *simple* constraints that we might plausibly abstract over. Of course @@ -1614,8 +1613,9 @@ to applyDefaultingRules) to extract constraints that that might be defaulted. There are two caveats: -1. We do *not* float anything out if the implication binds equality - constraints, because that defeats the OutsideIn story. Consider +1. When infering most-general types (in simplifyInfer), we do *not* + float anything out if the implication binds equality constraints, + because that defeats the OutsideIn story. Consider data T a where TInt :: T Int MkT :: T a @@ -1630,6 +1630,10 @@ There are two caveats: float out of such implications, which meant it would happily infer non-principal types.) + HOWEVER (Trac #12797) in findDefaultableGroups we are not worried about + the most-general type; and we /do/ want to float out of equalities. + Hence the boolean flag to approximateWC. + 2. We do not float out an inner constraint that shares a type variable (transitively) with one that is trapped by a skolem. Eg forall a. F a ~ beta, Integral beta @@ -1961,7 +1965,7 @@ findDefaultableGroups (default_tys, (ovl_strings, extended_defaults)) wanteds , defaultable_tyvar tv , defaultable_classes (map sndOf3 group) ] where - simples = approximateWC wanteds + simples = approximateWC True wanteds (unaries, non_unaries) = partitionWith find_unary (bagToList simples) unary_groups = equivClasses cmp_tv unaries diff --git a/testsuite/tests/typecheck/should_compile/T12797.hs b/testsuite/tests/typecheck/should_compile/T12797.hs new file mode 100644 index 0000000..01bf5af --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12797.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE NoMonomorphismRestriction #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE ExtendedDefaultRules #-} + +module T12797 where + +import Prelude +import Control.Monad.IO.Class + +type family FuncArg (m :: (* -> *)) :: Maybe * + +test2 :: (MonadIO m, FuncArg m ~ 'Nothing) => m () +test2 = liftIO $ print 6 + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 0879f07..0551409 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -522,3 +522,4 @@ test('T12170b', normal, compile, ['']) test('T12466', normal, compile, ['']) test('T12466a', normal, compile, ['']) test('T12644', normal, compile, ['']) +test('T12797', normal, compile, ['']) From git at git.haskell.org Thu Nov 10 21:42:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update 8.0.2 release notes for #12784 (2591a4b) Message-ID: <20161110214228.EB9153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2591a4b94903d4f9d9348a92599a74aacf5eda66/ghc >--------------------------------------------------------------- commit 2591a4b94903d4f9d9348a92599a74aacf5eda66 Author: Ryan Scott Date: Mon Nov 7 08:56:22 2016 -0500 Update 8.0.2 release notes for #12784 Summary: The fix for #12220 exposed some ill-typed programs which passed the typechecker in GHC 8.0.1 but now fail to typecheck in GHC 8.0.2. It's a bit difficult to characterize what exactly triggers this bug, but we at least have a minimal example and a simple fix to illustrate the problem and solution, so let's add that the the 8.0.2 release notes to advertise this change. Resolves #12784. Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2682 GHC Trac Issues: #12784 (cherry picked from commit 2e8463b232054b788b73e6551947a9434aa76009) >--------------------------------------------------------------- 2591a4b94903d4f9d9348a92599a74aacf5eda66 docs/users_guide/8.0.2-notes.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index b1568ae..2986e38 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -25,6 +25,10 @@ Language presence of :ghc-flag:`-XRebindableSyntax` and :ghc-flag:`-XOverloadedStrings` (:ghc-ticket:`12688`). +- Some programs using :ghc-flag:`-XDefaultSignatures` that incorrectly + type-checked in GHC 8.0.1 are now rejected by GHC 8.0.2. See + :ghc-ticket:`12784` for details. + Compiler ~~~~~~~~ From git at git.haskell.org Thu Nov 10 21:42:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fundeps work even for unary type classes (8719d87) Message-ID: <20161110214232.8E28E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/8719d871bac848ee10e7455b5821a18dabd48b5b/ghc >--------------------------------------------------------------- commit 8719d871bac848ee10e7455b5821a18dabd48b5b Author: Simon Peyton Jones Date: Wed Oct 26 10:54:16 2016 +0100 Fundeps work even for unary type classes The functional-dependency improvement functions, improveFromAnother improveFromInstEnv had a side-condition that said the type class has to have at least two arguments. But not so, as Trac #12763 shows: class C a | -> a where ... is perfectly legal, albeit a bit of a corner case. (cherry picked from commit 801c26372742fc79bd3756bdcb710031c716c402) >--------------------------------------------------------------- 8719d871bac848ee10e7455b5821a18dabd48b5b compiler/typecheck/FunDeps.hs | 3 +- testsuite/tests/typecheck/should_compile/T12763.hs | 13 +++++ .../tests/typecheck/should_compile/T12763.stderr | 14 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + testsuite/tests/typecheck/should_fail/T5684.stderr | 60 +++------------------- 5 files changed, 35 insertions(+), 56 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8719d871bac848ee10e7455b5821a18dabd48b5b From git at git.haskell.org Thu Nov 10 21:42:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes (411bd2d) Message-ID: <20161110214235.3A01C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/411bd2dfed3d6cfe73cd0e4521acee67f18a8fe7/ghc >--------------------------------------------------------------- commit 411bd2dfed3d6cfe73cd0e4521acee67f18a8fe7 Author: Ryan Scott Date: Sun Nov 6 09:40:48 2016 -0500 Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes GHC 8.0.2 introduced a bugfix involving GeneralizedNewtypeDeriving in 96d451450923a80b043b5314c5eaaa9d0eab7c56. This made typechecking of GND-produced code a bit stricter, and an unfortunate side effect of this was that there were a couple of corner-case programs that stopped compiling when transitioning from GHC 8.0.1 to 8.0.2. Since the number of affected programs seems quite small, and since the fix is so straightforward, we opt to simply note this discrepancy in the 8.0.2 release notes. Resolves #12768. (cherry picked from commit ead83db8a7db772a9f248af9767a4283218a5c9f) >--------------------------------------------------------------- 411bd2dfed3d6cfe73cd0e4521acee67f18a8fe7 docs/users_guide/8.0.2-notes.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 2986e38..727e919 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -25,6 +25,23 @@ Language presence of :ghc-flag:`-XRebindableSyntax` and :ghc-flag:`-XOverloadedStrings` (:ghc-ticket:`12688`). +- GHC is now a bit more strict in typechecking code generated by + :ghc-flag:`-XGeneralizedNewtypeDeriving`. For example, GHC will now reject + this program: :: + + class C m where + foo :: C m => m () + + newtype N m a = N (m a) + deriving C -- This is now an error + + This is in contrast to GHC 8.0.1 and earlier, which would accept this code. + To fix this code, simply remove the ``C m`` constraint from ``foo``, as it + is wholly unnecessary: :: + + class C m where + foo :: m () + - Some programs using :ghc-flag:`-XDefaultSignatures` that incorrectly type-checked in GHC 8.0.1 are now rejected by GHC 8.0.2. See :ghc-ticket:`12784` for details. From git at git.haskell.org Thu Nov 10 21:42:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Align GHCi's library search order more closely with LDs (95b6aff) Message-ID: <20161110214238.A08683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/95b6affcf2c03495d6635c80bfa3c8636f684363/ghc >--------------------------------------------------------------- commit 95b6affcf2c03495d6635c80bfa3c8636f684363 Author: Tamar Christina Date: Mon Oct 31 21:03:14 2016 +0000 Align GHCi's library search order more closely with LDs Summary: Given a static library and an import library in the same folder. e.g. ``` libfoo.a libfoo.dll.a ``` running `ghci -lfoo` we should prefer the import library `libfoo.dll.a` over `libfoo.a` because we prefer having to just load the DLL. And not having to do any linking. This also more closely emulated the behaviour of LD, which has a search order of ``` libxxx.dll.a xxx.dll.a libxxx.a cygxxx.dll (*) libxxx.dll xxx.dll ``` Test Plan: ./validate Reviewers: RyanGlScott, austin, hvr, bgamari, erikd, simonmar Reviewed By: RyanGlScott Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2651 GHC Trac Issues: #12771 (cherry picked from commit 795be0ea60fc81aefdaf6ecb1dc9b03c4a5c9f86) >--------------------------------------------------------------- 95b6affcf2c03495d6635c80bfa3c8636f684363 compiler/ghci/Linker.hs | 7 ++++--- testsuite/tests/rts/T12771/Makefile | 10 ++++++++++ .../should_run/T5149.stdout => rts/T12771/T12771.stdout} | 0 testsuite/tests/rts/T12771/all.T | 5 +++++ testsuite/tests/rts/T12771/foo.c | 6 ++++++ testsuite/tests/rts/T12771/foo_dll.c | 4 ++++ testsuite/tests/rts/T12771/main.hs | 5 +++++ 7 files changed, 34 insertions(+), 3 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index e0f7b4b..d4b084f 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -1279,7 +1279,8 @@ loadFrameworks hsc_env platform pkg -- If it isn't present, we assume that addDLL in the RTS can find it, -- which generally means that it should be a dynamic library in the -- standard system search path. - +-- For GHCi we tend to prefer dynamic libraries over static ones as +-- they are easier to load and manage, have less overhead. locateLib :: HscEnv -> Bool -> [FilePath] -> String -> IO LibrarySpec locateLib hsc_env is_hs dirs lib | not is_hs @@ -1288,16 +1289,16 @@ locateLib hsc_env is_hs dirs lib -- then look in library-dirs for a static library (libfoo.a) -- then look in library-dirs and inplace GCC for a dynamic library (libfoo.so) -- then check for system dynamic libraries (e.g. kernel32.dll on windows) - -- then try "gcc --print-file-name" to search gcc's search path -- then try looking for import libraries on Windows (.dll.a, .lib) + -- then try "gcc --print-file-name" to search gcc's search path -- then look in library-dirs and inplace GCC for a static library (libfoo.a) -- for a dynamic library (#5289) -- otherwise, assume loadDLL can find it -- = findDll `orElse` findSysDll `orElse` - tryGcc `orElse` tryImpLib `orElse` + tryGcc `orElse` findArchive `orElse` assumeDll diff --git a/testsuite/tests/rts/T12771/Makefile b/testsuite/tests/rts/T12771/Makefile new file mode 100644 index 0000000..d6960a0 --- /dev/null +++ b/testsuite/tests/rts/T12771/Makefile @@ -0,0 +1,10 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +T12771: + '$(TEST_CC)' -c foo.c -o foo.o + '$(AR)' rsc libfoo.a foo.o + '$(TEST_HC)' -shared foo_dll.c -o libfoo-1.dll + mv libfoo-1.dll.a libfoo.dll.a + echo main | '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) main.hs -lfoo -L"$(PWD)" diff --git a/testsuite/tests/codeGen/should_run/T5149.stdout b/testsuite/tests/rts/T12771/T12771.stdout similarity index 100% copy from testsuite/tests/codeGen/should_run/T5149.stdout copy to testsuite/tests/rts/T12771/T12771.stdout diff --git a/testsuite/tests/rts/T12771/all.T b/testsuite/tests/rts/T12771/all.T new file mode 100644 index 0000000..50933d5 --- /dev/null +++ b/testsuite/tests/rts/T12771/all.T @@ -0,0 +1,5 @@ +test('T12771', [ extra_clean(['libfoo.a', 'libfoo-1.dll', 'foo.o', 'main.o']) + , extra_files(['foo.c', 'main.hs', 'foo_dll.c']) + , unless(opsys('mingw32'), skip) + ], + run_command, ['$MAKE -s --no-print-directory T12771']) diff --git a/testsuite/tests/rts/T12771/foo.c b/testsuite/tests/rts/T12771/foo.c new file mode 100644 index 0000000..af8ad9c --- /dev/null +++ b/testsuite/tests/rts/T12771/foo.c @@ -0,0 +1,6 @@ +extern int bar(); + +int foo () +{ + return bar(); +} diff --git a/testsuite/tests/rts/T12771/foo_dll.c b/testsuite/tests/rts/T12771/foo_dll.c new file mode 100644 index 0000000..8ea6c22 --- /dev/null +++ b/testsuite/tests/rts/T12771/foo_dll.c @@ -0,0 +1,4 @@ +int foo() +{ + return 1; +} diff --git a/testsuite/tests/rts/T12771/main.hs b/testsuite/tests/rts/T12771/main.hs new file mode 100644 index 0000000..fbc8f56 --- /dev/null +++ b/testsuite/tests/rts/T12771/main.hs @@ -0,0 +1,5 @@ +module Main where + +foreign import ccall "foo" c_foo :: Int + +main = print c_foo From git at git.haskell.org Thu Nov 10 21:42:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: ghc-cabal: Use correct name of linker flags env variable (3a0532a) Message-ID: <20161110214241.54D3E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/3a0532a8586c09a71d9a9847964928c04853cbf7/ghc >--------------------------------------------------------------- commit 3a0532a8586c09a71d9a9847964928c04853cbf7 Author: Ben Gamari Date: Fri Nov 4 15:03:33 2016 -0400 ghc-cabal: Use correct name of linker flags env variable Currently passing the `CONF_LD_LINKER_OPTS_STAGE0` environment variable to `configure` is broken due to this naming inconsistency. Test Plan: Try passing `CONF_LD_LINKER_OPTS_STAGE0` to `configure`. Look at resulting stage0 ghc invocation. Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2672 (cherry picked from commit 97505ad7b23f5e43e1e1a69c159c2c7054f600e7) >--------------------------------------------------------------- 3a0532a8586c09a71d9a9847964928c04853cbf7 utils/ghc-cabal/ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 62338ee..01562ce 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -47,7 +47,7 @@ $(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs) $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/. "$(GHC)" $(SRC_HC_OPTS) \ $(addprefix -optc, $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)) \ - $(addprefix -optl, $(SRC_LD_OPTS) $(CONF_LD_OPTS_STAGE0)) \ + $(addprefix -optl, $(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE0)) \ -hide-all-packages \ $(addprefix -package , $(CABAL_BUILD_DEPS)) \ --make utils/ghc-cabal/Main.hs -o $@ \ From git at git.haskell.org Thu Nov 10 21:42:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS (7bd5dd0) Message-ID: <20161110214244.0A83E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7bd5dd093120cc4a1952a85e665fd68377c5c80c/ghc >--------------------------------------------------------------- commit 7bd5dd093120cc4a1952a85e665fd68377c5c80c Author: Ben Gamari Date: Fri Nov 4 15:03:44 2016 -0400 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS This ensures that artifacts built with build-prog see these options. Also spruce up comments. Test Plan: Carefully read it. Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2673 (cherry picked from commit e2a9b529a8b06e2dace8c2b4c58710cf5e57ef03) >--------------------------------------------------------------- 7bd5dd093120cc4a1952a85e665fd68377c5c80c configure.ac | 5 +++++ rules/distdir-way-opts.mk | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 13d33d2..8259f0c 100644 --- a/configure.ac +++ b/configure.ac @@ -665,15 +665,20 @@ FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAG FP_GCC_EXTRA_FLAGS +# See rules/distdir-way-opts.mk for details. +# Flags passed to the C compiler AC_SUBST(CONF_CC_OPTS_STAGE0) AC_SUBST(CONF_CC_OPTS_STAGE1) AC_SUBST(CONF_CC_OPTS_STAGE2) +# Flags passed to the C compiler when we ask it to link AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2) +# Flags passed to the linker when we ask it to link AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2) +# Flags passed to the C preprocessor AC_SUBST(CONF_CPP_OPTS_STAGE0) AC_SUBST(CONF_CPP_OPTS_STAGE1) AC_SUBST(CONF_CPP_OPTS_STAGE2) diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index f099d4e..4ebbc0e 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -34,9 +34,18 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage # # CONF_HC_OPTS GHC options from ./configure mk/config.mk.in # +# CONF_CPP_OPTS_STAGE$4 CPP options from ./configure mk/config.mk.in +# +# CONF_CC_OPTS_STAGE$4 C compiler options from mk/config.mk.in +# ./configure +# # CONF_HC_OPTS_STAGE$4 GHC options from ./configure mk/config.mk.in # specific to stage $4 # +# CONF_LD_LINKER_OPTS_STAGE$4 +# GHC options from ./configure mk/config.mk.in +# specific to stage $4 +# # WAY_$3_HC_OPTS GHC options specific to way $3 mk/ways.mk # # SRC_HC_OPTS source-tree-wide GHC options mk/config.mk.in @@ -186,7 +195,8 @@ $1_$2_$3_ALL_LD_OPTS = \ $$($1_$2_DIST_LD_OPTS) \ $$($1_$2_$3_LD_OPTS) \ $$($1_$2_EXTRA_LD_OPTS) \ - $$(EXTRA_LD_OPTS) + $$(EXTRA_LD_OPTS) \ + $$(CONF_LD_LINKER_OPTS_STAGE$4) # Options for passing to GHC when we use it for linking $1_$2_$3_GHC_LD_OPTS = \ From git at git.haskell.org Thu Nov 10 21:42:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: configure: Pass HC_OPTS_STAGEx to build system (891ffe9) Message-ID: <20161110214246.ABDB03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/891ffe9066abd82c5760d1218f6ae2cd0d346146/ghc >--------------------------------------------------------------- commit 891ffe9066abd82c5760d1218f6ae2cd0d346146 Author: Ben Gamari Date: Fri Nov 4 15:03:55 2016 -0400 configure: Pass HC_OPTS_STAGEx to build system Test Plan: Try `./configure HC_OPTS_STAGE0=-foobar` and watch it fail Reviewers: austin, hvr Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2674 (cherry picked from commit c8e79c037097a4ccb40fa8241ca904d90ea84cce) >--------------------------------------------------------------- 891ffe9066abd82c5760d1218f6ae2cd0d346146 configure.ac | 4 ++++ mk/config.mk.in | 3 +++ 2 files changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index 8259f0c..57726d6 100644 --- a/configure.ac +++ b/configure.ac @@ -682,6 +682,10 @@ AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2) AC_SUBST(CONF_CPP_OPTS_STAGE0) AC_SUBST(CONF_CPP_OPTS_STAGE1) AC_SUBST(CONF_CPP_OPTS_STAGE2) +# Flags passed to the Haskell compiler +AC_SUBST(CONF_HC_OPTS_STAGE0) +AC_SUBST(CONF_HC_OPTS_STAGE1) +AC_SUBST(CONF_HC_OPTS_STAGE2) dnl ** Set up the variables for the platform in the settings file. dnl May need to use gcc to find platform details. diff --git a/mk/config.mk.in b/mk/config.mk.in index 5a4c9ca..9de3537 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -626,6 +626,9 @@ CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@ CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@ CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@ CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@ +CONF_HC_OPTS_STAGE0 = @CONF_HC_OPTS_STAGE0@ +CONF_HC_OPTS_STAGE1 = @CONF_HC_OPTS_STAGE1@ +CONF_HC_OPTS_STAGE2 = @CONF_HC_OPTS_STAGE2@ ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux" CONF_CC_OPTS += -G0 From git at git.haskell.org Thu Nov 10 21:42:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:50 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add test for #12788 (b72b7c8) Message-ID: <20161110214250.3B2B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b72b7c8a2e23196a7d5e1d72dbb8f1b790545cda/ghc >--------------------------------------------------------------- commit b72b7c8a2e23196a7d5e1d72dbb8f1b790545cda Author: Ryan Scott Date: Thu Nov 3 14:01:54 2016 -0400 Add test for #12788 Commit bce99086e9f54909f51ff5a74cb8c666083bb021 (#12584) fixed #12788. Let's add a test to make sure it stays fixed. (cherry picked from commit ec22bacdd625b04d28228dd5522d59d0bc8b1152) >--------------------------------------------------------------- b72b7c8a2e23196a7d5e1d72dbb8f1b790545cda testsuite/tests/th/T12788.hs | 9 +++++++++ testsuite/tests/th/T12788.stderr | 2 ++ testsuite/tests/th/T12788_Lib.hs | 22 ++++++++++++++++++++++ testsuite/tests/th/all.T | 3 +++ 4 files changed, 36 insertions(+) diff --git a/testsuite/tests/th/T12788.hs b/testsuite/tests/th/T12788.hs new file mode 100644 index 0000000..dc13c4f --- /dev/null +++ b/testsuite/tests/th/T12788.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TemplateHaskell #-} +module T12788 where + +import Language.Haskell.TH +import T12788_Lib + +data Bad = Bad { _bad :: String } deriving (Eq, Ord, Show) + +$(deriveJSON defaultOptions{} ''Bad) diff --git a/testsuite/tests/th/T12788.stderr b/testsuite/tests/th/T12788.stderr new file mode 100644 index 0000000..485b200 --- /dev/null +++ b/testsuite/tests/th/T12788.stderr @@ -0,0 +1,2 @@ + +T12788.hs:9:14: error: Empty record update diff --git a/testsuite/tests/th/T12788_Lib.hs b/testsuite/tests/th/T12788_Lib.hs new file mode 100644 index 0000000..2924eef --- /dev/null +++ b/testsuite/tests/th/T12788_Lib.hs @@ -0,0 +1,22 @@ +module T12788_Lib where + +import Language.Haskell.TH + +data Options = Options + { fieldLabelModifier :: String -> String + , constructorTagModifier :: String -> String + , allNullaryToStringTag :: Bool + , omitNothingFields :: Bool + , sumEncoding :: SumEncoding + , unwrapUnaryRecords :: Bool + } + +data SumEncoding = + TaggedObject { tagFieldName :: String + , contentsFieldName :: String + } + | ObjectWithSingleField + | TwoElemArray + +deriveJSON :: Options -> Name -> Q [Dec] +deriveJSON _ _ = return [] diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index a59a4e1..bee7e43 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -417,3 +417,6 @@ test('T12130', extra_clean(['T12130a.hi','T12130a.o']), multimod_compile, ['T12130', '-v0 ' + config.ghc_th_way_flags]) test('T12407', omit_ways(['ghci']), compile, ['-v0']) test('T12411', normal, compile_fail, ['']) +test('T12788', extra_clean(['T12788_Lib.hi', 'T12788_Lib.o']), + multimod_compile_fail, + ['T12788.hs', '-v0 ' + config.ghc_th_way_flags]) From git at git.haskell.org Thu Nov 10 21:42:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 10 Nov 2016 21:42:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Pass --no-pie to GCC (60c299a) Message-ID: <20161110214252.E7E103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/60c299a2278c351abed1ea51a1c2ee5459033fa9/ghc >--------------------------------------------------------------- commit 60c299a2278c351abed1ea51a1c2ee5459033fa9 Author: Ben Gamari Date: Mon Nov 7 17:54:39 2016 -0500 Pass --no-pie to GCC Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be default in their GCC packaging. This breaks our abuse of GCC as a linker which requires that we pass -Wl,-r, which is incompatible with PIE (since the former implies that we are generating a relocatable object file and the latter an executable). >--------------------------------------------------------------- 60c299a2278c351abed1ea51a1c2ee5459033fa9 aclocal.m4 | 18 ++++++++++++++++++ compiler/main/DriverPipeline.hs | 9 +++++++++ compiler/main/SysTools.hs | 13 +++++++++++++ configure.ac | 3 +++ distrib/configure.ac.in | 1 + 5 files changed, 44 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index 0c842d5..2d42925 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1258,6 +1258,24 @@ AC_SUBST(GccIsClang) rm -f conftest.txt ]) +# FP_GCC_SUPPORTS_NO_PIE +# ---------------------- +# Does gcc support the -no-pie option? If so we should pass it to gcc when +# joining objects since -pie may be enabled by default. +AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_MSG_CHECKING([whether GCC supports -no-pie]) + echo 'int main() { return 0; }' > conftest.c + if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then + AC_DEFINE(GCC_SUPPORTS_NO_PIE, 1, [gcc supports -no-pie]) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + rm -f conftest.c conftest.o conftest +]) + dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary. dnl diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index f6e5b8b..2e322a8 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1850,6 +1850,11 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ map SysTools.Option ( [] +#if GCC_SUPPORTS_NO_PIE + -- See Note [No PIE eating when linking] + ++ ["-no-pie"] +#endif + -- Permit the linker to auto link _symbol to _imp_symbol. -- This lets us link against DLLs without needing an "import library". ++ (if platformOS platform == OSMinGW32 @@ -2151,6 +2156,10 @@ joinObjectFiles dflags o_files output_fn = do SysTools.Option "-nostdlib", SysTools.Option "-Wl,-r" ] +#if GCC_SUPPORTS_NO_PIE + -- See Note [No PIE eating while linking] in SysTools + ++ [SysTools.Option "-no-pie"] +#endif ++ (if any (cc ==) [Clang, AppleClang, AppleClang51] then [] else [SysTools.Option "-nodefaultlibs"]) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 236bcfd..ba384c9 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -1578,6 +1578,15 @@ linesPlatform xs = #endif +{- +Note [No PIE eating while linking] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by +default in their gcc builds. This is incompatible with -r as it implies that we +are producing an executable. Consequently, we must manually pass -no-pie to gcc +when joining object files or linking dynamic libraries. See #12759. +-} + linkDynLib :: DynFlags -> [String] -> [UnitId] -> IO () linkDynLib dflags0 o_files dep_packages = do @@ -1743,6 +1752,10 @@ linkDynLib dflags0 o_files dep_packages ++ [ Option "-o" , FileOption "" output_fn ] +#if GCC_SUPPORTS_NO_PIE + -- See Note [No PIE eating when linking] + ++ [ Option "-no-pie" ] +#endif ++ map Option o_files ++ [ Option "-shared" ] ++ map Option bsymbolicFlag diff --git a/configure.ac b/configure.ac index 57726d6..bbb39eb 100644 --- a/configure.ac +++ b/configure.ac @@ -647,6 +647,9 @@ dnl If gcc, make sure it's at least 3.0 dnl FP_GCC_VERSION +dnl ** See whether gcc supports -no-pie +FP_GCC_SUPPORTS_NO_PIE + dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index d50ce86..fa6a177 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -92,6 +92,7 @@ FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION +FP_GCC_SUPPORTS_NO_PIE AC_PROG_CPP FP_PROG_LD_IS_GNU From git at git.haskell.org Fri Nov 11 04:50:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:50:46 +0000 (UTC) Subject: [commit: ghc] master: Add Richard Eisenberg's new email to mailmap (e06e21a) Message-ID: <20161111045046.6F3303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e06e21af1fd077067149f2c41fb5b2553622f499/ghc >--------------------------------------------------------------- commit e06e21af1fd077067149f2c41fb5b2553622f499 Author: Ben Gamari Date: Thu Nov 10 15:19:10 2016 -0500 Add Richard Eisenberg's new email to mailmap Reviewers: austin, mpickering Reviewed By: mpickering Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2689 >--------------------------------------------------------------- e06e21af1fd077067149f2c41fb5b2553622f499 .mailmap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index cc3e031..4da118d 100644 --- a/.mailmap +++ b/.mailmap @@ -201,7 +201,8 @@ Peter Wortmann scpmw at leeds.ac.uk ralf # https://ghc.haskell.org/trac/ghc/wiki/TeamGHC Ravi Nanavati # Commit 70c044. Reuben Thomas rrt -Richard Eisenberg +Richard Eisenberg +Richard Eisenberg Rob Ennals rje # SPJ's student (rje33 at cam.ac.uk) Roman Leshchinskiy rl at cse.unsw.edu.au Ross Paterson ross From git at git.haskell.org Fri Nov 11 04:50:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:50:49 +0000 (UTC) Subject: [commit: ghc] master: Read parentheses better (bef7e78) Message-ID: <20161111045049.290A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bef7e784d037f720697a215b9e21f13b385e6d3e/ghc >--------------------------------------------------------------- commit bef7e784d037f720697a215b9e21f13b385e6d3e Author: David Feuer Date: Thu Nov 10 15:20:15 2016 -0500 Read parentheses better Instead of pulling a token and looking for `'('` or `')'`, just look for the character itself. This prevents us from lexing every single item twice, once to see if it's a left parenthesis and once to actually parse it. Partially fixes #12665 Make parens faster more aggressively * Strip spaces before parsing, so we never have to strip the same spaces twice. * String parsers together manually, to try to avoid unnecessary closure creation. Test Plan: Validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2630 GHC Trac Issues: #12665 >--------------------------------------------------------------- bef7e784d037f720697a215b9e21f13b385e6d3e libraries/base/GHC/Read.hs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/libraries/base/GHC/Read.hs b/libraries/base/GHC/Read.hs index ebb72c7..ad505bb 100644 --- a/libraries/base/GHC/Read.hs +++ b/libraries/base/GHC/Read.hs @@ -287,22 +287,39 @@ lexP = lift L.lex expectP :: L.Lexeme -> ReadPrec () expectP lexeme = lift (L.expect lexeme) +expectCharP :: Char -> ReadPrec a -> ReadPrec a +expectCharP c a = do + q <- get + if q == c + then a + else pfail +{-# INLINE expectCharP #-} + +skipSpacesThenP :: ReadPrec a -> ReadPrec a +skipSpacesThenP m = + do s <- look + skip s + where + skip (c:s) | isSpace c = get *> skip s + skip _ = m + paren :: ReadPrec a -> ReadPrec a -- ^ @(paren p)@ parses \"(P0)\" -- where @p@ parses \"P0\" in precedence context zero -paren p = do expectP (L.Punc "(") - x <- reset p - expectP (L.Punc ")") - return x +paren p = skipSpacesThenP (paren' p) + +paren' :: ReadPrec a -> ReadPrec a +paren' p = expectCharP '(' $ reset p >>= \x -> + skipSpacesThenP (expectCharP ')' (pure x)) parens :: ReadPrec a -> ReadPrec a -- ^ @(parens p)@ parses \"P\", \"(P0)\", \"((P0))\", etc, -- where @p@ parses \"P\" in the current precedence context -- and parses \"P0\" in precedence context zero parens p = optional - where - optional = p +++ mandatory - mandatory = paren optional + where + optional = skipSpacesThenP (p +++ mandatory) + mandatory = paren' optional list :: ReadPrec a -> ReadPrec [a] -- ^ @(list p)@ parses a list of things parsed by @p@, From git at git.haskell.org Fri Nov 11 04:50:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:50:51 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update allocation numbers for T5631 (0a122a4) Message-ID: <20161111045051.CF2AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0a122a4ca6a3be3ce016c9c9214caaa59f285fee/ghc >--------------------------------------------------------------- commit 0a122a4ca6a3be3ce016c9c9214caaa59f285fee Author: Ben Gamari Date: Thu Nov 10 15:25:08 2016 -0500 testsuite: Update allocation numbers for T5631 >--------------------------------------------------------------- 0a122a4ca6a3be3ce016c9c9214caaa59f285fee testsuite/tests/perf/compiler/all.T | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index b4f084f..72c58c7 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -416,7 +416,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), 1024926024, 5)]), + (wordsize(64), 1077429456, 5)]), # expected value: 774595008 (amd64/Linux): # expected value: 735486328 (amd64/Linux) 2012/12/12: # expected value: 690742040 (amd64/Linux) Call Arity improvements @@ -427,6 +427,8 @@ test('T5631', # 2015-12-21: 1198327544 (Mac) TypeApplications (will fix with #11196) # 2015-03-18: 1124068664 (Mac) optimize Unify & zonking # 2016-10-19: 1024926024 (amd64/Linux) Refactor traceRn interface (#12617) + # 2016-11-10: 1077429456 (amd64/Linux) Stop -dno-debug-output supressing -ddump-tc-trace + only_ways(['normal']) ], compile, From git at git.haskell.org Fri Nov 11 04:50:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:50:55 +0000 (UTC) Subject: [commit: ghc] master: Prevent GND from inferring an instance context for method-less classes (03e8d26) Message-ID: <20161111045055.732753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03e8d26fe0a8f7981a76550118f3c584cad76c47/ghc >--------------------------------------------------------------- commit 03e8d26fe0a8f7981a76550118f3c584cad76c47 Author: Ryan Scott Date: Thu Nov 10 15:22:48 2016 -0500 Prevent GND from inferring an instance context for method-less classes When `GeneralizedNewtypeDeriving` is used with a type class that has no methods, it will generate a redundant context, and as a result, it can trigger warnings when compiled with `-Wredundant-constraints`. This is a simple change in behavior to check beforehand if a class has methods when deriving it with GND, and if it has no methods, avoid inferring the redundant context. Beware that the test for #6088, which used to be expected to fail, now compiles without issue since it doesn't infer a problematic instance context. Thanks to Simon Peyton Jones for doing the necessary refactoring in f05d685ae05ec293083f2fa7ec7ba057fbe64869. Fixes #12814. Test Plan: ./validate Reviewers: goldfire, rwbarton, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2692 GHC Trac Issues: #12814 >--------------------------------------------------------------- 03e8d26fe0a8f7981a76550118f3c584cad76c47 compiler/typecheck/TcDeriv.hs | 8 ++++---- docs/users_guide/8.2.1-notes.rst | 22 ++++++++++++++++++++++ docs/users_guide/glasgow_exts.rst | 13 +++++++++++-- .../T8165_fail2.hs => should_compile/T12814.hs} | 4 ++-- testsuite/tests/deriving/should_compile/all.T | 1 + testsuite/tests/deriving/should_fail/T3621.hs | 1 + testsuite/tests/deriving/should_fail/T3621.stderr | 15 ++++++++------- .../{should_fail => should_compile}/T6088.hs | 2 +- testsuite/tests/indexed-types/should_compile/all.T | 1 + .../tests/indexed-types/should_fail/T6088.stderr | 5 ----- testsuite/tests/indexed-types/should_fail/all.T | 1 - 11 files changed, 51 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 03e8d26fe0a8f7981a76550118f3c584cad76c47 From git at git.haskell.org Fri Nov 11 04:50:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:50:58 +0000 (UTC) Subject: [commit: ghc] master: rts: Add api to pin a thread to a numa node but without fixing a capability (122d826) Message-ID: <20161111045058.218683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/122d826d1d1b7ba6e73866331863fa1e0b3e99ea/ghc >--------------------------------------------------------------- commit 122d826d1d1b7ba6e73866331863fa1e0b3e99ea Author: Darshan Kapashi Date: Thu Nov 10 15:21:08 2016 -0500 rts: Add api to pin a thread to a numa node but without fixing a capability `rts_setInCallCapability` sets the thread affinity as well as pins the numa node. We should also have the ability to set the numa node without setting the capability affinity. `rts_pinNumaNodeForCapability` function is added and exported via `RtsAPI.h`. Previous callers of `rts_setInCallCapability` should now also call `rts_pinNumaNodeForCapability` to get the same effect as before. Test Plan: ./validate Reviewers: austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie, niteria Differential Revision: https://phabricator.haskell.org/D2637 GHC Trac Issues: #12764 >--------------------------------------------------------------- 122d826d1d1b7ba6e73866331863fa1e0b3e99ea includes/RtsAPI.h | 24 ++++++++++++++++++++++++ rts/Task.c | 18 +++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 230c982..3b6e1dc 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -172,6 +172,24 @@ void rts_unlock (Capability *token); // when there is no current capability. Capability *rts_unsafeGetMyCapability (void); +/* ---------------------------------------------------------------------------- + Which cpu should the OS thread and Haskell thread run on? + + 1. Run the current thread on the given capability: + rts_setInCallCapability(cap, 0); + + 2. Run the current thread on the given capability and set the cpu affinity + for this thread: + rts_setInCallCapability(cap, 1); + + 3. Run the current thread on the given numa node: + rts_pinThreadToNumaNode(node); + + 4. Run the current thread on the given capability and on the given numa node: + rts_setInCallCapability(cap, 0); + rts_pinThreadToNumaNode(cap); + ------------------------------------------------------------------------- */ + // Specify the Capability that the current OS thread should run on when it calls // into Haskell. The actual capability will be calculated as the supplied // value modulo the number of enabled Capabilities. @@ -185,6 +203,12 @@ Capability *rts_unsafeGetMyCapability (void); // specified capability, set by either +RTS -qa or +RTS --numa. void rts_setInCallCapability (int preferred_capability, int affinity); +// Specify the CPU Node that the current OS thread should run on when it calls +// into Haskell. The argument can be either a node number or capability number. +// The actual node will be calculated as the supplied value modulo the number +// of numa nodes. +void rts_pinThreadToNumaNode (int node); + /* ---------------------------------------------------------------------------- Building Haskell objects from C datatypes. ------------------------------------------------------------------------- */ diff --git a/rts/Task.c b/rts/Task.c index 253520f..8ce4ecc 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -506,11 +506,19 @@ void rts_setInCallCapability ( if (RtsFlags.ParFlags.setAffinity) { setThreadAffinity(preferred_capability, n_capabilities); } - if (RtsFlags.GcFlags.numa) { - task->node = capNoToNumaNode(preferred_capability); - if (!DEBUG_IS_ON || !RtsFlags.DebugFlags.numa) { // faking NUMA - setThreadNode(numa_map[task->node]); - } + } +#endif +} + +void rts_pinThreadToNumaNode ( + int node USED_IF_THREADS) +{ +#ifdef THREADED_RTS + if (RtsFlags.GcFlags.numa) { + Task *task = getTask(); + task->node = capNoToNumaNode(node); + if (!DEBUG_IS_ON || !RtsFlags.DebugFlags.numa) { // faking NUMA + setThreadNode(numa_map[task->node]); } } #endif From git at git.haskell.org Fri Nov 11 04:51:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:51:01 +0000 (UTC) Subject: [commit: ghc] master: rts/linker: Move loadArchive to new source file (aa10c67) Message-ID: <20161111045101.792333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aa10c67ec5b9cea9d89ecac88f3a22ec873439c2/ghc >--------------------------------------------------------------- commit aa10c67ec5b9cea9d89ecac88f3a22ec873439c2 Author: Ben Gamari Date: Thu Nov 10 15:21:38 2016 -0500 rts/linker: Move loadArchive to new source file Test Plan: Validate Reviewers: DemiMarie, austin, simonmar, erikd Reviewed By: DemiMarie Subscribers: Phyx, thomie, hvr Differential Revision: https://phabricator.haskell.org/D2642 GHC Trac Issues: #12388 >--------------------------------------------------------------- aa10c67ec5b9cea9d89ecac88f3a22ec873439c2 rts/Linker.c | 529 +--------------------------------------------- rts/LinkerInternals.h | 32 +++ rts/linker/LoadArchive.c | 532 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 567 insertions(+), 526 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 aa10c67ec5b9cea9d89ecac88f3a22ec873439c2 From git at git.haskell.org Fri Nov 11 04:51:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:51:04 +0000 (UTC) Subject: [commit: ghc] master: Update user's guide after D2490 (e8ae4dc) Message-ID: <20161111045104.30E603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e8ae4dc8558b5917f6c65ad196859783e90038bd/ghc >--------------------------------------------------------------- commit e8ae4dc8558b5917f6c65ad196859783e90038bd Author: Thomas Winant Date: Thu Nov 10 15:22:14 2016 -0500 Update user's guide after D2490 D2490 added support for type wildcards in TH pattern splices. The user's guide still said that they were not supported, this patch fixes this. Test Plan: build documentation Reviewers: goldfire, austin, mvv, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2686 GHC Trac Issues: #12164 >--------------------------------------------------------------- e8ae4dc8558b5917f6c65ad196859783e90038bd docs/users_guide/glasgow_exts.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 3c340fe..38afb3b 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9997,9 +9997,14 @@ splices. - Typed expression splices: the same wildcards as in (untyped) expression splices are supported. -- Pattern splices: Template Haskell doesn't support type signatures in - pattern splices. Consequently, partial type signatures are not - supported either. +- Pattern splices: anonymous and named wildcards can be used in pattern + signatures. Note that :ghc-flag:`-XScopedTypeVariables` has to be enabled + to allow pattern signatures. Extra-constraints wildcards are not supported, + just like in regular pattern signatures. + :: + + {-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-} + foo $( [p| (x :: _) |] ) = x - Type splices: only anonymous wildcards are supported in type splices. Named and extra-constraints wildcards are not. :: From git at git.haskell.org Fri Nov 11 04:51:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 04:51:06 +0000 (UTC) Subject: [commit: ghc] master: Revert "Pass -no-pie to GCC" (60bb9d1) Message-ID: <20161111045106.F05223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60bb9d1ccaa27fe6490ece215deb38ad288a9889/ghc >--------------------------------------------------------------- commit 60bb9d1ccaa27fe6490ece215deb38ad288a9889 Author: Ben Gamari Date: Thu Nov 10 23:48:27 2016 -0500 Revert "Pass -no-pie to GCC" This reverts commit bae4a55b1fb403f610b4b55a1b6fb3f03e9c2026. This will be superceded by D2693. >--------------------------------------------------------------- 60bb9d1ccaa27fe6490ece215deb38ad288a9889 aclocal.m4 | 18 ------------------ compiler/main/DriverPipeline.hs | 9 --------- compiler/main/SysTools.hs | 13 ------------- configure.ac | 3 --- distrib/configure.ac.in | 1 - 5 files changed, 44 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 3a35fe9..df9d420 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1322,24 +1322,6 @@ AC_SUBST(GccIsClang) rm -f conftest.txt ]) -# FP_GCC_SUPPORTS_NO_PIE -# ---------------------- -# Does gcc support the -no-pie option? If so we should pass it to gcc when -# joining objects since -pie may be enabled by default. -AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_MSG_CHECKING([whether GCC supports -no-pie]) - echo 'int main() { return 0; }' > conftest.c - if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then - AC_DEFINE(GCC_SUPPORTS_NO_PIE, 1, [gcc supports -no-pie]) - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - rm -f conftest.c conftest.o conftest -]) - dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary. dnl diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 23badbd..b578612 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1859,11 +1859,6 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ map SysTools.Option ( [] -#if GCC_SUPPORTS_NO_PIE - -- See Note [No PIE eating when linking] - ++ ["-no-pie"] -#endif - -- Permit the linker to auto link _symbol to _imp_symbol. -- This lets us link against DLLs without needing an "import library". ++ (if platformOS platform == OSMinGW32 @@ -2162,10 +2157,6 @@ joinObjectFiles dflags o_files output_fn = do SysTools.Option "-nostdlib", SysTools.Option "-Wl,-r" ] -#if GCC_SUPPORTS_NO_PIE - -- See Note [No PIE eating while linking] in SysTools - ++ [SysTools.Option "-no-pie"] -#endif ++ (if any (cc ==) [Clang, AppleClang, AppleClang51] then [] else [SysTools.Option "-nodefaultlibs"]) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 82a6383..5fb92c8 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -1546,15 +1546,6 @@ linesPlatform xs = #endif -{- -Note [No PIE eating while linking] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by -default in their gcc builds. This is incompatible with -r as it implies that we -are producing an executable. Consequently, we must manually pass -no-pie to gcc -when joining object files or linking dynamic libraries. See #12759. --} - linkDynLib :: DynFlags -> [String] -> [InstalledUnitId] -> IO () linkDynLib dflags0 o_files dep_packages = do @@ -1720,10 +1711,6 @@ linkDynLib dflags0 o_files dep_packages ++ [ Option "-o" , FileOption "" output_fn ] -#if GCC_SUPPORTS_NO_PIE - -- See Note [No PIE eating when linking] - ++ [ Option "-no-pie" ] -#endif ++ map Option o_files ++ [ Option "-shared" ] ++ map Option bsymbolicFlag diff --git a/configure.ac b/configure.ac index 678fa2e..70c4447 100644 --- a/configure.ac +++ b/configure.ac @@ -608,9 +608,6 @@ dnl If gcc, make sure it's at least 3.0 dnl FP_GCC_VERSION -dnl ** See whether gcc supports -no-pie -FP_GCC_SUPPORTS_NO_PIE - dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index e733f64..0ae716b 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -90,7 +90,6 @@ FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION -FP_GCC_SUPPORTS_NO_PIE AC_PROG_CPP FP_PROG_LD_IS_GNU From git at git.haskell.org Fri Nov 11 15:34:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 15:34:46 +0000 (UTC) Subject: [commit: ghc] master: Revert "Refactor CallStack defaulting slightly" (7a7bb5d) Message-ID: <20161111153446.09F303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7a7bb5d27b0e240304bd18e7ebd2f60877e4cc12/ghc >--------------------------------------------------------------- commit 7a7bb5d27b0e240304bd18e7ebd2f60877e4cc12 Author: Simon Peyton Jones Date: Fri Nov 11 15:31:56 2016 +0000 Revert "Refactor CallStack defaulting slightly" This reverts commit 317236db308d9bd497a11fa4c455428fc7477405. I totally missed that in simplifyInfer for local functions we must NOT default call stacks. So I'm reverting this. Fortunately caught by T10845, which sadly isn't run by validate --fast >--------------------------------------------------------------- 7a7bb5d27b0e240304bd18e7ebd2f60877e4cc12 compiler/typecheck/TcSimplify.hs | 74 +++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index c943596..0594313 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -148,7 +148,42 @@ simpl_top wanteds then do { wc_residual <- nestTcS (solveWantedsAndDrop wc) ; try_class_defaulting wc_residual } -- See Note [Overview of implicit CallStacks] in TcEvidence - else return wc } + else try_callstack_defaulting wc } + + try_callstack_defaulting :: WantedConstraints -> TcS WantedConstraints + try_callstack_defaulting wc + | isEmptyWC wc + = return wc + | otherwise + = defaultCallStacks wc + +-- | Default any remaining @CallStack@ constraints to empty @CallStack at s. +defaultCallStacks :: WantedConstraints -> TcS WantedConstraints +-- See Note [Overview of implicit CallStacks] in TcEvidence +defaultCallStacks wanteds + = do simples <- handle_simples (wc_simple wanteds) + implics <- mapBagM handle_implic (wc_impl wanteds) + return (wanteds { wc_simple = simples, wc_impl = implics }) + + where + + handle_simples simples + = catBagMaybes <$> mapBagM defaultCallStack simples + + handle_implic implic + = do { wanteds <- setEvBindsTcS (ic_binds implic) $ + -- defaultCallStack sets a binding, so + -- we must set the correct binding group + defaultCallStacks (ic_wanted implic) + ; return (implic { ic_wanted = wanteds }) } + + defaultCallStack ct + | Just _ <- isCallStackPred (ctPred ct) + = do { solveCallStack (cc_ev ct) EvCsEmpty + ; return Nothing } + + defaultCallStack ct + = return (Just ct) {- Note [Fail fast on kind errors] @@ -1070,12 +1105,9 @@ solveWanteds wc@(WC { wc_simple = simples, wc_insol = insols, wc_impl = implics ; (floated_eqs, implics2) <- solveNestedImplications (implics `unionBags` implics1) ; dflags <- getDynFlags - ; wc2 <- simpl_loop 0 (solverIterations dflags) floated_eqs no_new_scs - (WC { wc_simple = simples1, wc_impl = implics2 - , wc_insol = insols `unionBags` insols1 }) - - -- Do call-stack defaultin - ; final_wc <- defaultCallStacks wc2 + ; final_wc <- simpl_loop 0 (solverIterations dflags) floated_eqs no_new_scs + (WC { wc_simple = simples1, wc_impl = implics2 + , wc_insol = insols `unionBags` insols1 }) ; bb <- TcS.getTcEvBindsMap ; traceTcS "solveWanteds }" $ @@ -1524,36 +1556,8 @@ Conclusion: we should call solveNestedImplications only if we did some unifiction in solveSimpleWanteds; because that's the only way we'll get more Givens (a unificaiton is like adding a Given) to allow the implication to make progress. - -Note [CallStack defaulting] -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Overview of implicit CallStacks] in TcEvidence. - -We default an unsolved call stack to EvCsEmpty, in solveWanteds, after -solving the wanteds as hard as we can, because that means that there -are no gratuitous unsolved CallStack constraints lying around to -clutter up the constraint tree. (Previously it was done in simpl_top, -but that's really not the right place, because it left us with -Unsolved impliations that has no wanted constraints, because -defaultCallStacks had got rid of them.) -} --- | Default any remaining @CallStack@ constraints to empty @CallStack at s. --- See Note [CallStack defaulting] -defaultCallStacks :: WantedConstraints -> TcS WantedConstraints -defaultCallStacks wanteds@(WC { wc_simple = simples }) - = do { simples' <- catBagMaybes <$> mapBagM defaultCallStack simples - ; return (wanteds { wc_simple = simples' }) } - where - defaultCallStack ct - | Just _ <- isCallStackPred (ctEvPred ev) - = do { solveCallStack ev EvCsEmpty - ; return Nothing } - - | otherwise = return (Just ct) - where - ev = ctEvidence ct - promoteTyVar :: TcLevel -> TcTyVar -> TcM () -- When we float a constraint out of an implication we must restore -- invariant (MetaTvInv) in Note [TcLevel and untouchable type variables] in TcType From git at git.haskell.org Fri Nov 11 17:22:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 17:22:08 +0000 (UTC) Subject: [commit: ghc] wip/T3384: Add HsSyn prettyprinter tests (438b930) Message-ID: <20161111172208.916F23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/438b93070e785b9bae1cc7ed69c3ff271df242d1/ghc >--------------------------------------------------------------- commit 438b93070e785b9bae1cc7ed69c3ff271df242d1 Author: Alan Zimmerman Date: Tue Nov 8 21:37:48 2016 +0200 Add HsSyn prettyprinter tests Add prettyprinter tests, which take a file, parse it, pretty print it, re-parse the pretty printed version and then compare the original and new ASTs (ignoring locations) Trac issue: #3384 >--------------------------------------------------------------- 438b93070e785b9bae1cc7ed69c3ff271df242d1 compiler/hsSyn/HsExpr.hs | 9 +- ghc.mk | 3 + testsuite/mk/boilerplate.mk | 1 + testsuite/tests/boxy/Base1.stderr | 4 +- testsuite/tests/generics/GenDerivOutput.stderr | 32 +-- testsuite/tests/generics/GenDerivOutput1_0.stderr | 8 +- testsuite/tests/generics/GenDerivOutput1_1.stderr | 65 +++--- .../tests/generics/T10604/T10604_deriving.stderr | 32 +-- testsuite/tests/printer/.gitignore | 7 + testsuite/tests/printer/Makefile | 35 +++ testsuite/tests/printer/Ppr001.hs | 7 + testsuite/tests/printer/Ppr002.hs | 46 ++++ testsuite/tests/printer/Ppr003.hs | 12 + testsuite/tests/printer/Ppr004.hs | 81 +++++++ testsuite/tests/printer/Ppr005.hs | 13 ++ testsuite/tests/printer/Ppr006.hs | 258 +++++++++++++++++++++ testsuite/tests/printer/Ppr007.hs | 8 + testsuite/tests/printer/all.T | 7 + .../tests/typecheck/should_compile/T11339.stderr | 4 +- .../tests/typecheck/should_fail/T12124.stderr | 4 +- .../tests/typecheck/should_fail/T7748a.stderr | 4 +- utils/check-ppr/Main.hs | 216 +++++++++++++++++ utils/check-ppr/README | 19 ++ utils/check-ppr/check-ppr.cabal | 32 +++ utils/check-ppr/ghc.mk | 18 ++ 25 files changed, 845 insertions(+), 80 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 438b93070e785b9bae1cc7ed69c3ff271df242d1 From git at git.haskell.org Fri Nov 11 17:22:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 17:22:11 +0000 (UTC) Subject: [commit: ghc] wip/T3384: No braces/semis for a do statement (288fbee) Message-ID: <20161111172211.652B83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/288fbee906c317594e92963e135ca7c1386586d5/ghc >--------------------------------------------------------------- commit 288fbee906c317594e92963e135ca7c1386586d5 Author: Alan Zimmerman Date: Fri Nov 11 09:57:46 2016 +0200 No braces/semis for a do statement >--------------------------------------------------------------- 288fbee906c317594e92963e135ca7c1386586d5 compiler/hsSyn/HsExpr.hs | 9 +-- testsuite/tests/ado/ado002.stderr | 66 +++++++-------- testsuite/tests/ado/ado003.stderr | 6 +- testsuite/tests/ado/ado005.stderr | 12 +-- .../tests/arrows/should_fail/arrowfail004.stderr | 4 +- testsuite/tests/ghci/scripts/T8959b.stderr | 4 +- .../tests/indexed-types/should_fail/T2664.stderr | 16 ++-- .../tests/indexed-types/should_fail/T2693.stderr | 6 +- .../tests/indexed-types/should_fail/T5439.stderr | 4 +- .../tests/indexed-types/should_fail/T7786.stderr | 12 +-- testsuite/tests/monadfail/MonadFailErrors.stderr | 32 ++++---- testsuite/tests/monadfail/MonadFailWarnings.stderr | 32 ++++---- testsuite/tests/rebindable/rebindable6.stderr | 36 ++++----- .../safeHaskell/safeLanguage/SafeLang10.stderr | 6 +- .../safeHaskell/safeLanguage/SafeLang17.stderr | 6 +- .../tests/simplCore/should_compile/simpl017.stderr | 18 ++--- testsuite/tests/th/T10598_TH.stderr | 62 +++++++-------- testsuite/tests/th/T5358.stderr | 8 +- testsuite/tests/th/T5508.stderr | 8 +- testsuite/tests/th/T8761.stderr | 93 +++++++++++----------- testsuite/tests/th/TH_PromotedTuple.stderr | 6 +- testsuite/tests/th/TH_exn2.stderr | 4 +- .../tests/th/TH_foreignCallingConventions.stderr | 29 ++++--- testsuite/tests/typecheck/should_fail/T3613.stderr | 8 +- testsuite/tests/typecheck/should_fail/T7851.stderr | 8 +- testsuite/tests/typecheck/should_fail/T8603.stderr | 4 +- testsuite/tests/typecheck/should_fail/T9612.stderr | 8 +- .../tests/typecheck/should_fail/tcfail103.stderr | 8 +- .../tests/typecheck/should_fail/tcfail128.stderr | 18 ++--- .../tests/typecheck/should_fail/tcfail165.stderr | 6 +- .../tests/typecheck/should_fail/tcfail168.stderr | 18 ++--- .../wcompat-warnings/WCompatWarningsOn.stderr | 8 +- 32 files changed, 281 insertions(+), 284 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 288fbee906c317594e92963e135ca7c1386586d5 From git at git.haskell.org Fri Nov 11 17:22:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 17:22:14 +0000 (UTC) Subject: [commit: ghc] wip/T3384: No parens around HsSpliceE (ade40bf) Message-ID: <20161111172214.B030E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/ade40bf91867f58d27415f9582639d2e0c4abdc1/ghc >--------------------------------------------------------------- commit ade40bf91867f58d27415f9582639d2e0c4abdc1 Author: Alan Zimmerman Date: Fri Nov 11 10:29:58 2016 +0200 No parens around HsSpliceE >--------------------------------------------------------------- ade40bf91867f58d27415f9582639d2e0c4abdc1 compiler/hsSyn/HsExpr.hs | 1 + testsuite/tests/ghc-api/annotations/T10276.stderr | 24 ++++-------- testsuite/tests/printer/Ppr006.stderr | 45 +++++++++++++++++++++++ testsuite/tests/printer/Ppr007.stderr | 17 +++++++++ 4 files changed, 71 insertions(+), 16 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 9d93692..fe29d53 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -1067,6 +1067,7 @@ hsExprNeedsParens (HsTcBracketOut {}) = False hsExprNeedsParens (HsDo sc _ _) | isListCompExpr sc = False hsExprNeedsParens (HsRecFld{}) = False +hsExprNeedsParens (HsSpliceE{}) = False hsExprNeedsParens _ = True diff --git a/testsuite/tests/ghc-api/annotations/T10276.stderr b/testsuite/tests/ghc-api/annotations/T10276.stderr index d79fc3a..fff4c8c 100644 --- a/testsuite/tests/ghc-api/annotations/T10276.stderr +++ b/testsuite/tests/ghc-api/annotations/T10276.stderr @@ -8,8 +8,7 @@ Test10276.hs:11:29: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:11:46: error: Not in scope: type constructor or class ‘M.Map’ @@ -17,8 +16,7 @@ Test10276.hs:11:46: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:11:52: error: Not in scope: type constructor or class ‘L.Name’ @@ -26,8 +24,7 @@ Test10276.hs:11:52: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:11:60: error: Not in scope: type constructor or class ‘L.Operand’ @@ -35,8 +32,7 @@ Test10276.hs:11:60: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:14:3: error: ‘qqExp’ is not a (visible) method of class ‘QQExp2’ @@ -47,8 +43,7 @@ Test10276.hs:15:29: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:15:46: error: Not in scope: type constructor or class ‘M.Map’ @@ -56,8 +51,7 @@ Test10276.hs:15:46: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:15:52: error: Not in scope: type constructor or class ‘L.Name’ @@ -65,8 +59,7 @@ Test10276.hs:15:52: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:15:60: error: Not in scope: type constructor or class ‘L.Operand’ @@ -74,5 +67,4 @@ Test10276.hs:15:60: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] diff --git a/testsuite/tests/printer/Ppr006.stderr b/testsuite/tests/printer/Ppr006.stderr new file mode 100644 index 0000000..12f1ed6 --- /dev/null +++ b/testsuite/tests/printer/Ppr006.stderr @@ -0,0 +1,45 @@ +Ppr006.hs:4:14: error: + Not in scope: type constructor or class ‘Command’ + +Ppr006.hs:7:23: error: + Not in scope: ‘Macro.guessCommands’ + No module named ‘Macro’ is imported. + +Ppr006.hs:12:20: error: + Not in scope: ‘ListWidget.moveLast’ + No module named ‘ListWidget’ is imported. + +Ppr006.hs:12:41: error: + Not in scope: ‘ListWidget.new’ + No module named ‘ListWidget’ is imported. + +Ppr006.hs:21:19: error: + • Not in scope: ‘help’ + • In the quasi-quotation: + [help| + Bind the command {expansion} to the key {name}. The same command may + be bound to different keys. + |] + +Ppr006.ppr.hs:3:14: error: + Not in scope: type constructor or class ‘Command’ + +Ppr006.ppr.hs:8:27: error: + Not in scope: ‘Macro.guessCommands’ + No module named ‘Macro’ is imported. + +Ppr006.ppr.hs:14:19: error: + Not in scope: ‘ListWidget.moveLast’ + No module named ‘ListWidget’ is imported. + +Ppr006.ppr.hs:14:40: error: + Not in scope: ‘ListWidget.new’ + No module named ‘ListWidget’ is imported. + +Ppr006.ppr.hs:26:8: error: + • Not in scope: ‘help’ + • In the quasi-quotation: + [help| + Bind the command {expansion} to the key {name}. The same command may + be bound to different keys. + |] diff --git a/testsuite/tests/printer/Ppr007.stderr b/testsuite/tests/printer/Ppr007.stderr new file mode 100644 index 0000000..5bb122a --- /dev/null +++ b/testsuite/tests/printer/Ppr007.stderr @@ -0,0 +1,17 @@ +Ppr007.hs:7:3: error: + • Couldn't match expected type ‘Int’ with actual type ‘Char’ + • In the pattern: 'a' + In a stmt of a 'do' block: 'a' <- return (3 :: Int) + In the expression: + do x <- getChar + 'a' <- return (3 :: Int) + return () + +Ppr007.ppr.hs:5:8: error: + • Couldn't match expected type ‘Int’ with actual type ‘Char’ + • In the pattern: 'a' + In a stmt of a 'do' block: 'a' <- return (3 :: Int) + In the expression: + do x <- getChar + 'a' <- return (3 :: Int) + return () From git at git.haskell.org Fri Nov 11 17:22:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 17:22:17 +0000 (UTC) Subject: [commit: ghc] wip/T3384: FFI static keyword, hang OpApp for infix case (847d01e) Message-ID: <20161111172217.D35BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/847d01e339c67e785babbb6d10d176122f736c2d/ghc >--------------------------------------------------------------- commit 847d01e339c67e785babbb6d10d176122f736c2d Author: Alan Zimmerman Date: Fri Nov 11 19:20:01 2016 +0200 FFI static keyword, hang OpApp for infix case >--------------------------------------------------------------- 847d01e339c67e785babbb6d10d176122f736c2d compiler/hsSyn/HsDecls.hs | 15 ++++++++------- compiler/hsSyn/HsExpr.hs | 3 ++- testsuite/tests/ffi/should_fail/T10461.stderr | 2 +- testsuite/tests/ffi/should_fail/T3066.stderr | 3 +-- .../tests/ffi/should_fail/capi_value_function.stderr | 3 +-- testsuite/tests/ffi/should_fail/ccfail001.stderr | 2 +- testsuite/tests/ffi/should_fail/ccfail002.stderr | 2 +- testsuite/tests/ffi/should_fail/ccfail004.stderr | 10 +++++----- testsuite/tests/ffi/should_fail/ccfail005.stderr | 4 ++-- .../tests/haddock/haddock_examples/haddock.Test.stderr | 4 ++-- testsuite/tests/printer/Makefile | 4 ++++ testsuite/tests/printer/Ppr006.stderr | 6 +++--- .../Event/Control.hs => testsuite/tests/printer/Ppr008.hs | 9 ++++++--- testsuite/tests/printer/all.T | 1 + testsuite/tests/safeHaskell/ghci/p6.stderr | 2 +- .../tests/safeHaskell/safeLanguage/SafeLang08.stderr | 2 +- testsuite/tests/th/TH_foreignCallingConventions.stderr | 2 +- testsuite/tests/unboxedsums/ffi1.stderr | 7 +++---- 18 files changed, 44 insertions(+), 37 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 847d01e339c67e785babbb6d10d176122f736c2d From git at git.haskell.org Fri Nov 11 17:22:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 17:22:20 +0000 (UTC) Subject: [commit: ghc] wip/T3384's head updated: FFI static keyword, hang OpApp for infix case (847d01e) Message-ID: <20161111172220.7DE353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T3384' now includes: 7d988dd Fix broken validate build. 91f9e13 Fix hs_try_putmvar003 (#12800) 2e8463b Update 8.0.2 release notes for #12784 2325afe Fix comment about pointer tagging 7fe7163 Adapt the (commented out) pprTrace in OccurAnal f05d685 Refactoring of mkNewTypeEqn 317236d Refactor CallStack defaulting slightly 500d90d ghc-cabal: Use correct name of linker flags env variable 816d2e4 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS 9030d8e configure: Pass HC_OPTS_STAGEx to build system bae4a55 Pass -no-pie to GCC 438b930 Add HsSyn prettyprinter tests 288fbee No braces/semis for a do statement ade40bf No parens around HsSpliceE 847d01e FFI static keyword, hang OpApp for infix case From git at git.haskell.org Fri Nov 11 18:17:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 18:17:27 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix LoadArchive on OS X (ec0bf81) Message-ID: <20161111181727.0E9883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ec0bf8117d1aefd20711a6152ebbca63f3bd0774/ghc >--------------------------------------------------------------- commit ec0bf8117d1aefd20711a6152ebbca63f3bd0774 Author: Ben Gamari Date: Fri Nov 11 10:58:08 2016 -0500 rts: Fix LoadArchive on OS X >--------------------------------------------------------------- ec0bf8117d1aefd20711a6152ebbca63f3bd0774 rts/Linker.c | 9 +++------ rts/LinkerInternals.h | 9 +++++++++ rts/linker/LoadArchive.c | 9 ++++++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index ede5654..eba9821 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -57,17 +57,14 @@ #include #endif -#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) -# define OBJFORMAT_ELF +#if defined(OBJFORMAT_ELF) # include "linker/Elf.h" # include // regex is already used by dlopen() so this is OK // to use here without requiring an additional lib -#elif defined (mingw32_HOST_OS) -# define OBJFORMAT_PEi386 +#elif defined(OBJFORMAT_PEi386) # include "linker/PEi386.h" # include -#elif defined(darwin_HOST_OS) -# define OBJFORMAT_MACHO +#elif defined(OBJFORMAT_MACHO) # include "linker/MachO.h" # include # include diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 1093435..ce5c5eb 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -293,4 +293,13 @@ char *cstring_from_section_name( UChar* strtab); #endif /* mingw32_HOST_OS */ +/* Which object file format are we targetting? */ +#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) +# define OBJFORMAT_ELF +#elif defined (mingw32_HOST_OS) +# define OBJFORMAT_PEi386 +#elif defined(darwin_HOST_OS) +# define OBJFORMAT_MACHO +#endif + #endif /* LINKERINTERNALS_H */ diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 6e1fb29..a5af719 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -9,8 +9,15 @@ #include "PathUtils.h" #include "LinkerInternals.h" #include "linker/M32Alloc.h" + +/* Platform specific headers */ #if defined(OBJFORMAT_PEi386) -#include "linkers/PEi386.h" +# include "linkers/PEi386.h" +#elif defined(darwin_HOST_OS) +# include "linker/MachO.h" +# include +# include +# include #endif #include From git at git.haskell.org Fri Nov 11 18:17:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 18:17:29 +0000 (UTC) Subject: [commit: ghc] master: Pass -no-pie to GCC (d421a7e) Message-ID: <20161111181729.C50343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d421a7e22e0be3de32376970b8c38ec308f959da/ghc >--------------------------------------------------------------- commit d421a7e22e0be3de32376970b8c38ec308f959da Author: Ben Gamari Date: Fri Nov 11 12:05:21 2016 -0500 Pass -no-pie to GCC Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be default in their GCC packaging. This breaks our abuse of GCC as a linker which requires that we pass -Wl,-r, which is incompatible with PIE (since the former implies that we are generating a relocatable object file and the latter an executable). This is a second attempt at D2691. This attempt constrasts with D2691 in that it preserves the "does gcc support -no-pie" flag in settings, allowing this to be reconfigured by `configure` during installation of a binary distribution. Thanks for @rwbarton for drawing attention to this issue. Test Plan: Validate Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: thomie, rwbarton, erikd Differential Revision: https://phabricator.haskell.org/D2693 GHC Trac Issues: #12759 >--------------------------------------------------------------- d421a7e22e0be3de32376970b8c38ec308f959da aclocal.m4 | 21 +++++++++++++++++++++ compiler/main/DriverPipeline.hs | 10 ++++++++++ compiler/main/DynFlags.hs | 1 + compiler/main/SysTools.hs | 15 +++++++++++++++ configure.ac | 3 +++ distrib/configure.ac.in | 1 + settings.in | 1 + 7 files changed, 52 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index df9d420..aea85f4 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -509,12 +509,14 @@ AC_DEFUN([FP_SETTINGS], SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2" SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2" + SettingsCCompilerSupportsNoPie="$CONF_GCC_SUPPORTS_NO_PIE" SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2" AC_SUBST(SettingsCCompilerCommand) AC_SUBST(SettingsHaskellCPPCommand) AC_SUBST(SettingsHaskellCPPFlags) AC_SUBST(SettingsCCompilerFlags) AC_SUBST(SettingsCCompilerLinkFlags) + AC_SUBST(SettingsCCompilerSupportsNoPie) AC_SUBST(SettingsLdCommand) AC_SUBST(SettingsLdFlags) AC_SUBST(SettingsArCommand) @@ -1322,6 +1324,25 @@ AC_SUBST(GccIsClang) rm -f conftest.txt ]) +# FP_GCC_SUPPORTS_NO_PIE +# ---------------------- +# Does gcc support the -no-pie option? If so we should pass it to gcc when +# joining objects since -pie may be enabled by default. +AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_MSG_CHECKING([whether GCC supports -no-pie]) + echo 'int main() { return 0; }' > conftest.c + if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then + CONF_GCC_SUPPORTS_NO_PIE=YES + AC_MSG_RESULT([yes]) + else + CONF_GCC_SUPPORTS_NO_PIE=NO + AC_MSG_RESULT([no]) + fi + rm -f conftest.c conftest.o conftest +]) + dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary. dnl diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index b578612..167f78e 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1859,6 +1859,11 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ map SysTools.Option ( [] + -- See Note [No PIE eating when linking] + ++ (if sGccSupportsNoPie mySettings + then ["-no-pie"] + else []) + -- Permit the linker to auto link _symbol to _imp_symbol. -- This lets us link against DLLs without needing an "import library". ++ (if platformOS platform == OSMinGW32 @@ -2157,6 +2162,11 @@ joinObjectFiles dflags o_files output_fn = do SysTools.Option "-nostdlib", SysTools.Option "-Wl,-r" ] + -- See Note [No PIE eating while linking] in SysTools + ++ (if sGccSupportsNoPie mySettings + then [SysTools.Option "-no-pie"] + else []) + ++ (if any (cc ==) [Clang, AppleClang, AppleClang51] then [] else [SysTools.Option "-nodefaultlibs"]) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index fba188b..479b50d 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -955,6 +955,7 @@ data Settings = Settings { sLdSupportsBuildId :: Bool, sLdSupportsFilelist :: Bool, sLdIsGnuLd :: Bool, + sGccSupportsNoPie :: Bool, -- commands for particular phases sPgm_L :: String, sPgm_P :: (String,[Option]), diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 5fb92c8..38d866e 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -251,6 +251,7 @@ initSysTools mbMinusB -- to make that possible, so for now you can't. gcc_prog <- getSetting "C compiler command" gcc_args_str <- getSetting "C compiler flags" + gccSupportsNoPie <- getBooleanSetting "C compiler supports -no-pie" cpp_prog <- getSetting "Haskell CPP command" cpp_args_str <- getSetting "Haskell CPP flags" let unreg_gcc_args = if targetUnregisterised @@ -343,6 +344,7 @@ initSysTools mbMinusB sLdSupportsBuildId = ldSupportsBuildId, sLdSupportsFilelist = ldSupportsFilelist, sLdIsGnuLd = ldIsGnuLd, + sGccSupportsNoPie = gccSupportsNoPie, sProgramName = "ghc", sProjectVersion = cProjectVersion, sPgm_L = unlit_path, @@ -1546,6 +1548,15 @@ linesPlatform xs = #endif +{- +Note [No PIE eating while linking] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by +default in their gcc builds. This is incompatible with -r as it implies that we +are producing an executable. Consequently, we must manually pass -no-pie to gcc +when joining object files or linking dynamic libraries. See #12759. +-} + linkDynLib :: DynFlags -> [String] -> [InstalledUnitId] -> IO () linkDynLib dflags0 o_files dep_packages = do @@ -1711,6 +1722,10 @@ linkDynLib dflags0 o_files dep_packages ++ [ Option "-o" , FileOption "" output_fn ] + -- See Note [No PIE eating when linking] + ++ (if sGccSupportsNoPie (settings dflags) + then [Option "-no-pie"] + else []) ++ map Option o_files ++ [ Option "-shared" ] ++ map Option bsymbolicFlag diff --git a/configure.ac b/configure.ac index 70c4447..678fa2e 100644 --- a/configure.ac +++ b/configure.ac @@ -608,6 +608,9 @@ dnl If gcc, make sure it's at least 3.0 dnl FP_GCC_VERSION +dnl ** See whether gcc supports -no-pie +FP_GCC_SUPPORTS_NO_PIE + dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 0ae716b..e733f64 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -90,6 +90,7 @@ FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION +FP_GCC_SUPPORTS_NO_PIE AC_PROG_CPP FP_PROG_LD_IS_GNU diff --git a/settings.in b/settings.in index e8cdad3..7ec1c26 100644 --- a/settings.in +++ b/settings.in @@ -2,6 +2,7 @@ ("C compiler command", "@SettingsCCompilerCommand@"), ("C compiler flags", "@SettingsCCompilerFlags@"), ("C compiler link flags", "@SettingsCCompilerLinkFlags@"), + ("C compiler supports -no-pie", "@SettingsCCompilerSupportsNoPie@"), ("Haskell CPP command","@SettingsHaskellCPPCommand@"), ("Haskell CPP flags","@SettingsHaskellCPPFlags@"), ("ld command", "@SettingsLdCommand@"), From git at git.haskell.org Fri Nov 11 19:29:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 19:29:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Revert "Pass --no-pie to GCC" (3da461d) Message-ID: <20161111192923.1769F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/3da461d9ddc8ff6fe14ee9572b617d8e3753de2e/ghc >--------------------------------------------------------------- commit 3da461d9ddc8ff6fe14ee9572b617d8e3753de2e Author: Ben Gamari Date: Fri Nov 11 13:18:51 2016 -0500 Revert "Pass --no-pie to GCC" This reverts commit 60c299a2278c351abed1ea51a1c2ee5459033fa9. We really want to be able to change this in the binary distribution `configure` script. Trying again in D2693. >--------------------------------------------------------------- 3da461d9ddc8ff6fe14ee9572b617d8e3753de2e aclocal.m4 | 18 ------------------ compiler/main/DriverPipeline.hs | 9 --------- compiler/main/SysTools.hs | 13 ------------- configure.ac | 3 --- distrib/configure.ac.in | 1 - 5 files changed, 44 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 2d42925..0c842d5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1258,24 +1258,6 @@ AC_SUBST(GccIsClang) rm -f conftest.txt ]) -# FP_GCC_SUPPORTS_NO_PIE -# ---------------------- -# Does gcc support the -no-pie option? If so we should pass it to gcc when -# joining objects since -pie may be enabled by default. -AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_MSG_CHECKING([whether GCC supports -no-pie]) - echo 'int main() { return 0; }' > conftest.c - if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then - AC_DEFINE(GCC_SUPPORTS_NO_PIE, 1, [gcc supports -no-pie]) - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - rm -f conftest.c conftest.o conftest -]) - dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary. dnl diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 2e322a8..f6e5b8b 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1850,11 +1850,6 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ map SysTools.Option ( [] -#if GCC_SUPPORTS_NO_PIE - -- See Note [No PIE eating when linking] - ++ ["-no-pie"] -#endif - -- Permit the linker to auto link _symbol to _imp_symbol. -- This lets us link against DLLs without needing an "import library". ++ (if platformOS platform == OSMinGW32 @@ -2156,10 +2151,6 @@ joinObjectFiles dflags o_files output_fn = do SysTools.Option "-nostdlib", SysTools.Option "-Wl,-r" ] -#if GCC_SUPPORTS_NO_PIE - -- See Note [No PIE eating while linking] in SysTools - ++ [SysTools.Option "-no-pie"] -#endif ++ (if any (cc ==) [Clang, AppleClang, AppleClang51] then [] else [SysTools.Option "-nodefaultlibs"]) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index ba384c9..236bcfd 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -1578,15 +1578,6 @@ linesPlatform xs = #endif -{- -Note [No PIE eating while linking] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by -default in their gcc builds. This is incompatible with -r as it implies that we -are producing an executable. Consequently, we must manually pass -no-pie to gcc -when joining object files or linking dynamic libraries. See #12759. --} - linkDynLib :: DynFlags -> [String] -> [UnitId] -> IO () linkDynLib dflags0 o_files dep_packages = do @@ -1752,10 +1743,6 @@ linkDynLib dflags0 o_files dep_packages ++ [ Option "-o" , FileOption "" output_fn ] -#if GCC_SUPPORTS_NO_PIE - -- See Note [No PIE eating when linking] - ++ [ Option "-no-pie" ] -#endif ++ map Option o_files ++ [ Option "-shared" ] ++ map Option bsymbolicFlag diff --git a/configure.ac b/configure.ac index bbb39eb..57726d6 100644 --- a/configure.ac +++ b/configure.ac @@ -647,9 +647,6 @@ dnl If gcc, make sure it's at least 3.0 dnl FP_GCC_VERSION -dnl ** See whether gcc supports -no-pie -FP_GCC_SUPPORTS_NO_PIE - dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index fa6a177..d50ce86 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -92,7 +92,6 @@ FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION -FP_GCC_SUPPORTS_NO_PIE AC_PROG_CPP FP_PROG_LD_IS_GNU From git at git.haskell.org Fri Nov 11 19:29:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 19:29:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Pass -no-pie to GCC (fefe02c) Message-ID: <20161111192925.BC1A63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/fefe02c0324a25a52455a61f7f6e48be6d82d1ab/ghc >--------------------------------------------------------------- commit fefe02c0324a25a52455a61f7f6e48be6d82d1ab Author: Ben Gamari Date: Fri Nov 11 13:20:03 2016 -0500 Pass -no-pie to GCC Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be default in their GCC packaging. This breaks our abuse of GCC as a linker which requires that we pass -Wl,-r, which is incompatible with PIE (since the former implies that we are generating a relocatable object file and the latter an executable). This is a second attempt at D2691. This attempt constrasts with D2691 in that it preserves the "does gcc support -no-pie" flag in settings, allowing this to be reconfigured by `configure` during installation of a binary distribution. Thanks for @rwbarton for drawing attention to this issue. Test Plan: Validate Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: thomie, rwbarton, erikd Differential Revision: https://phabricator.haskell.org/D2693 GHC Trac Issues: #12759 >--------------------------------------------------------------- fefe02c0324a25a52455a61f7f6e48be6d82d1ab aclocal.m4 | 21 +++++++++++++++++++++ compiler/main/DriverPipeline.hs | 10 ++++++++++ compiler/main/DynFlags.hs | 1 + compiler/main/SysTools.hs | 17 ++++++++++++++++- configure.ac | 3 +++ distrib/configure.ac.in | 1 + settings.in | 1 + 7 files changed, 53 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 0c842d5..08ae2e5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -499,12 +499,14 @@ AC_DEFUN([FP_SETTINGS], fi SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2" SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2" + SettingsCCompilerSupportsNoPie="$CONF_GCC_SUPPORTS_NO_PIE" SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2" AC_SUBST(SettingsCCompilerCommand) AC_SUBST(SettingsHaskellCPPCommand) AC_SUBST(SettingsHaskellCPPFlags) AC_SUBST(SettingsCCompilerFlags) AC_SUBST(SettingsCCompilerLinkFlags) + AC_SUBST(SettingsCCompilerSupportsNoPie) AC_SUBST(SettingsLdCommand) AC_SUBST(SettingsLdFlags) AC_SUBST(SettingsArCommand) @@ -1258,6 +1260,25 @@ AC_SUBST(GccIsClang) rm -f conftest.txt ]) +# FP_GCC_SUPPORTS_NO_PIE +# ---------------------- +# Does gcc support the -no-pie option? If so we should pass it to gcc when +# joining objects since -pie may be enabled by default. +AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_MSG_CHECKING([whether GCC supports -no-pie]) + echo 'int main() { return 0; }' > conftest.c + if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then + CONF_GCC_SUPPORTS_NO_PIE=YES + AC_MSG_RESULT([yes]) + else + CONF_GCC_SUPPORTS_NO_PIE=NO + AC_MSG_RESULT([no]) + fi + rm -f conftest.c conftest.o conftest +]) + dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary. dnl diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index f6e5b8b..acd0d61 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1850,6 +1850,11 @@ linkBinary' staticLink dflags o_files dep_packages = do ++ map SysTools.Option ( [] + -- See Note [No PIE eating when linking] + ++ (if sGccSupportsNoPie mySettings + then ["-no-pie"] + else []) + -- Permit the linker to auto link _symbol to _imp_symbol. -- This lets us link against DLLs without needing an "import library". ++ (if platformOS platform == OSMinGW32 @@ -2151,6 +2156,11 @@ joinObjectFiles dflags o_files output_fn = do SysTools.Option "-nostdlib", SysTools.Option "-Wl,-r" ] + -- See Note [No PIE eating while linking] in SysTools + ++ (if sGccSupportsNoPie mySettings + then [SysTools.Option "-no-pie"] + else []) + ++ (if any (cc ==) [Clang, AppleClang, AppleClang51] then [] else [SysTools.Option "-nodefaultlibs"]) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 93c0ee8..e1a271a 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -947,6 +947,7 @@ data Settings = Settings { sLdSupportsBuildId :: Bool, sLdSupportsFilelist :: Bool, sLdIsGnuLd :: Bool, + sGccSupportsNoPie :: Bool, -- commands for particular phases sPgm_L :: String, sPgm_P :: (String,[Option]), diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 236bcfd..1ab5b13 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -251,6 +251,7 @@ initSysTools mbMinusB -- to make that possible, so for now you can't. gcc_prog <- getSetting "C compiler command" gcc_args_str <- getSetting "C compiler flags" + gccSupportsNoPie <- getBooleanSetting "C compiler supports -no-pie" cpp_prog <- getSetting "Haskell CPP command" cpp_args_str <- getSetting "Haskell CPP flags" let unreg_gcc_args = if targetUnregisterised @@ -343,6 +344,7 @@ initSysTools mbMinusB sLdSupportsBuildId = ldSupportsBuildId, sLdSupportsFilelist = ldSupportsFilelist, sLdIsGnuLd = ldIsGnuLd, + sGccSupportsNoPie = gccSupportsNoPie, sProgramName = "ghc", sProjectVersion = cProjectVersion, sPgm_L = unlit_path, @@ -858,7 +860,7 @@ getLinkerInfo' dflags = do -- Note [Windows stack usage] -- Force static linking of libGCC -- Note [Windows static libGCC] - , "-Xlinker", "--stack=0x800000,0x800000", "-static-libgcc" ] + , "-static-libgcc" ] _ -> do -- In practice, we use the compiler as the linker here. Pass -- -Wl,--version to get linker version info. @@ -1578,6 +1580,15 @@ linesPlatform xs = #endif +{- +Note [No PIE eating while linking] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by +default in their gcc builds. This is incompatible with -r as it implies that we +are producing an executable. Consequently, we must manually pass -no-pie to gcc +when joining object files or linking dynamic libraries. See #12759. +-} + linkDynLib :: DynFlags -> [String] -> [UnitId] -> IO () linkDynLib dflags0 o_files dep_packages = do @@ -1743,6 +1754,10 @@ linkDynLib dflags0 o_files dep_packages ++ [ Option "-o" , FileOption "" output_fn ] + -- See Note [No PIE eating when linking] + ++ (if sGccSupportsNoPie (settings dflags) + then [Option "-no-pie"] + else []) ++ map Option o_files ++ [ Option "-shared" ] ++ map Option bsymbolicFlag diff --git a/configure.ac b/configure.ac index 57726d6..bbb39eb 100644 --- a/configure.ac +++ b/configure.ac @@ -647,6 +647,9 @@ dnl If gcc, make sure it's at least 3.0 dnl FP_GCC_VERSION +dnl ** See whether gcc supports -no-pie +FP_GCC_SUPPORTS_NO_PIE + dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index d50ce86..fa6a177 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -92,6 +92,7 @@ FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION +FP_GCC_SUPPORTS_NO_PIE AC_PROG_CPP FP_PROG_LD_IS_GNU diff --git a/settings.in b/settings.in index e8cdad3..7ec1c26 100644 --- a/settings.in +++ b/settings.in @@ -2,6 +2,7 @@ ("C compiler command", "@SettingsCCompilerCommand@"), ("C compiler flags", "@SettingsCCompilerFlags@"), ("C compiler link flags", "@SettingsCCompilerLinkFlags@"), + ("C compiler supports -no-pie", "@SettingsCCompilerSupportsNoPie@"), ("Haskell CPP command","@SettingsHaskellCPPCommand@"), ("Haskell CPP flags","@SettingsHaskellCPPFlags@"), ("ld command", "@SettingsLdCommand@"), From git at git.haskell.org Fri Nov 11 20:45:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 20:45:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Accept T12227 allocations (d5518f7) Message-ID: <20161111204557.462D53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d5518f72f3033ceaadc9b56a5d9012425b3a8956/ghc >--------------------------------------------------------------- commit d5518f72f3033ceaadc9b56a5d9012425b3a8956 Author: Ben Gamari Date: Fri Nov 11 14:31:52 2016 -0500 testsuite: Accept T12227 allocations Sadly I was not able to track down the source of this but there is really no more time. Looks like we'll just need to accept it. >--------------------------------------------------------------- d5518f72f3033ceaadc9b56a5d9012425b3a8956 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 a33291f..0bd70c6 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -815,9 +815,10 @@ test('T10547', test('T12227', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1822822016, 5), + [(wordsize(64), 9257533640, 5), # 2016-07-11 5650186880 (Windows) before fix for #12227 # 2016-07-11 1822822016 (Windows) after fix for #12227 + # 2016-11-11 9257533640 Pretty: remove a harmful $! ]), ], compile, From git at git.haskell.org Fri Nov 11 20:46:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 20:46:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Fix framework failure in T12771 (6060964) Message-ID: <20161111204600.020D83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6060964cf03680d9e9356643c7190a2201be3303/ghc >--------------------------------------------------------------- commit 6060964cf03680d9e9356643c7190a2201be3303 Author: Ben Gamari Date: Fri Nov 11 14:33:30 2016 -0500 testsuite: Fix framework failure in T12771 Extraneous extra_files >--------------------------------------------------------------- 6060964cf03680d9e9356643c7190a2201be3303 testsuite/tests/rts/T12771/all.T | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/tests/rts/T12771/all.T b/testsuite/tests/rts/T12771/all.T index 50933d5..2359688 100644 --- a/testsuite/tests/rts/T12771/all.T +++ b/testsuite/tests/rts/T12771/all.T @@ -1,5 +1,4 @@ test('T12771', [ extra_clean(['libfoo.a', 'libfoo-1.dll', 'foo.o', 'main.o']) - , extra_files(['foo.c', 'main.hs', 'foo_dll.c']) , unless(opsys('mingw32'), skip) ], run_command, ['$MAKE -s --no-print-directory T12771']) From git at git.haskell.org Fri Nov 11 21:34:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 21:34:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Read parentheses better (cca8cee) Message-ID: <20161111213402.87FF03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/cca8ceec97d6b8b031dec837825b97609dd7288f/ghc >--------------------------------------------------------------- commit cca8ceec97d6b8b031dec837825b97609dd7288f Author: David Feuer Date: Fri Nov 11 15:56:00 2016 -0500 Read parentheses better Instead of pulling a token and looking for `'('` or `')'`, just look for the character itself. This prevents us from lexing every single item twice, once to see if it's a left parenthesis and once to actually parse it. Partially fixes #12665 Test Plan: Validate Reviewers: austin, bgamari, hvr Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2623 GHC Trac Issues: #12665 >--------------------------------------------------------------- cca8ceec97d6b8b031dec837825b97609dd7288f libraries/base/GHC/Read.hs | 44 +++++++++++++++++++++++++++++++---- testsuite/tests/perf/compiler/all.T | 3 ++- testsuite/tests/perf/should_run/all.T | 3 ++- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/libraries/base/GHC/Read.hs b/libraries/base/GHC/Read.hs index 5681899..52bed0e 100644 --- a/libraries/base/GHC/Read.hs +++ b/libraries/base/GHC/Read.hs @@ -262,13 +262,49 @@ lexP = lift L.lex expectP :: L.Lexeme -> ReadPrec () expectP lexeme = lift (L.expect lexeme) +expectCharP :: Char -> ReadPrec a -> ReadPrec a +expectCharP c a = do + q <- get + if q == c + then a + else pfail +{-# INLINE expectCharP #-} + +-- A version of skipSpaces that takes the next +-- parser as an argument. That is, +-- +-- skipSpacesThenP m = lift skipSpaces >> m +-- +-- Since skipSpaces is recursive, it appears that we get +-- cleaner code by providing the continuation explicitly. +-- In particular, we avoid passing an extra continuation +-- of the form +-- +-- \ () -> ... +skipSpacesThenP :: ReadPrec a -> ReadPrec a +skipSpacesThenP m = + do s <- look + skip s + where + skip (c:s) | isSpace c = get *> skip s + skip _ = m + paren :: ReadPrec a -> ReadPrec a -- ^ @(paren p)@ parses \"(P0)\" -- where @p@ parses \"P0\" in precedence context zero -paren p = do expectP (L.Punc "(") - x <- reset p - expectP (L.Punc ")") - return x +paren p = skipSpacesThenP (paren' p) + +-- We try very hard to make paren' efficient, because parens is ubiquitous. +-- Earlier code used `expectP` to look for the parentheses. The problem is that +-- this lexes a (potentially long) token just to check if it's a parenthesis or +-- not. So the first token of pretty much every value would be fully lexed +-- twice. Now, we look for the '(' by hand instead. Since there's no reason not +-- to, and it allows for faster failure, we do the same for ')'. This strategy +-- works particularly well here because neither '(' nor ')' can begin any other +-- lexeme. +paren' :: ReadPrec a -> ReadPrec a +paren' p = expectCharP '(' $ reset p >>= \x -> + skipSpacesThenP (expectCharP ')' (pure x)) parens :: ReadPrec a -> ReadPrec a -- ^ @(parens p)@ parses \"P\", \"(P0)\", \"((P0))\", etc, diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 0bd70c6..89d9316 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -280,7 +280,7 @@ test('T3064', # 2014-01-22: 23 (x86/Linux) # 2014-12-22: 23 (x86/Linux) death to silent superclasses # 2015-07-11 28 (x86/Linux, 64-bit machine) use +RTS -G1 - (wordsize(64), 54, 20)]), + (wordsize(64), 66, 20)]), # (amd64/Linux): 18 # (amd64/Linux) 2012-02-07: 26 # (amd64/Linux) 2013-02-12: 23; increased range to 10% @@ -294,6 +294,7 @@ test('T3064', # (amd64/Linux) 2014-12-22: 27: death to silent superclasses # (amd64/Linux) 2015-01-22: 32: Varies from 30 to 34, at least here. # (amd64/Linux) 2015-06-03: 54: use +RTS -G1 + # (amd64/Linux) 2016-11-03: 66: Parenthesis reading for Read compiler_stats_num_field('bytes allocated', [(wordsize(32), 153261024, 10), diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index e901f56..2234bbf 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -83,9 +83,10 @@ test('T876', [stats_num_field('bytes allocated', [(platform('x86_64-unknown-mingw32'), 71904, 5), # 2015-04-03: 71904 (amd64/Windows, unknown cause) - (wordsize(64), 63216 , 5), + (wordsize(64), 58056 , 5), # 2013-02-14: 1263712 (x86_64/Linux) # 2014-02-10: 63216 (x86_64/Linux), call arity analysis + # 2016-11-03: 58056 (x86_64/Linux), parenthesis reading for Read (wordsize(32), 53156, 5) ]), # some date: 663712 (Windows, 64-bit machine) From git at git.haskell.org Fri Nov 11 21:34:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 21:34:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: ghc-pkg: Munge dynamic library directories (e7017ca) Message-ID: <20161111213405.39F9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e7017ca8b02ad7abb7c6cd9100e44fb8a215985f/ghc >--------------------------------------------------------------- commit e7017ca8b02ad7abb7c6cd9100e44fb8a215985f Author: Ben Gamari Date: Fri Nov 11 15:53:36 2016 -0500 ghc-pkg: Munge dynamic library directories Otherwise we end up looking in the wrong place for dynamic libraries on Windows. This addresses a regression introduced by D2611. See #12479. Test Plan: validate across platforms Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2640 GHC Trac Issues: #12479 (cherry picked from commit 75e69edb498511cf2b28dec4e14e6d11232f3e32) >--------------------------------------------------------------- e7017ca8b02ad7abb7c6cd9100e44fb8a215985f utils/ghc-pkg/Main.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 3f12be4..c357ebb 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -810,6 +810,7 @@ mungePackagePaths top_dir pkgroot pkg = importDirs = munge_paths (importDirs pkg), includeDirs = munge_paths (includeDirs pkg), libraryDirs = munge_paths (libraryDirs pkg), + libraryDynDirs = munge_paths (libraryDynDirs pkg), frameworkDirs = munge_paths (frameworkDirs pkg), haddockInterfaces = munge_paths (haddockInterfaces pkg), -- haddock-html is allowed to be either a URL or a file From git at git.haskell.org Fri Nov 11 22:53:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 22:53:13 +0000 (UTC) Subject: [commit: hsc2hs] master: Bump to 0.68.1 & add changelog for release (8fed36a) Message-ID: <20161111225313.9A0463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/8fed36addd3439e01752a0ce48140ad0a56a6c61 >--------------------------------------------------------------- commit 8fed36addd3439e01752a0ce48140ad0a56a6c61 Author: Herbert Valerio Riedel Date: Fri Nov 11 23:44:08 2016 +0100 Bump to 0.68.1 & add changelog for release >--------------------------------------------------------------- 8fed36addd3439e01752a0ce48140ad0a56a6c61 changelog.md | 9 +++++++++ hsc2hs.cabal | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..87cea62 --- /dev/null +++ b/changelog.md @@ -0,0 +1,9 @@ +## 0.68.1 + + - Fix type signature of generated `main` test function + to avoid C compiler warnings about unused `argc`/`argv` + function parameters during feature testing. + + - Double-escape paths used to build call to `hsc_line` + ([#12504](http://ghc.haskell.org/ticket/12504)) + diff --git a/hsc2hs.cabal b/hsc2hs.cabal index 9d0718e..67378eb 100644 --- a/hsc2hs.cabal +++ b/hsc2hs.cabal @@ -1,5 +1,5 @@ Name: hsc2hs -Version: 0.68 +Version: 0.68.1 Copyright: 2000, Marcin Kowalczyk License: BSD3 License-File: LICENSE @@ -16,12 +16,14 @@ Description: provide Haskell counterparts of C types, values of C constants, including sizes of C types, and access to fields of C structs. . - For more details, see - . + For more details, see the + + in the GHC User's Guide. Category: Development Data-Files: template-hsc.h build-type: Simple cabal-version: >=1.10 +extra-source-files: changelog.md Executable hsc2hs Default-Language: Haskell2010 From git at git.haskell.org Fri Nov 11 22:53:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 11 Nov 2016 22:53:25 +0000 (UTC) Subject: [commit: hsc2hs] tag 'v0.68.1' created Message-ID: <20161111225325.00FF73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs New tag : v0.68.1 Referencing: c05defda25f9c019e2ba796d6a102e4492734204 From git at git.haskell.org Sat Nov 12 03:32:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 03:32:49 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Lower allocations for T876 (46e2bef) Message-ID: <20161112033249.BB9103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/46e2befd9fc63c9cd42657bffecc423eda18847d/ghc >--------------------------------------------------------------- commit 46e2befd9fc63c9cd42657bffecc423eda18847d Author: Ben Gamari Date: Fri Nov 11 20:26:13 2016 -0500 testsuite: Lower allocations for T876 If only we knew why... [skip-ci] >--------------------------------------------------------------- 46e2befd9fc63c9cd42657bffecc423eda18847d testsuite/tests/perf/should_run/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index c20807e..672ce33 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -83,9 +83,10 @@ test('T876', [stats_num_field('bytes allocated', [(platform('x86_64-unknown-mingw32'), 71904, 5), # 2015-04-03: 71904 (amd64/Windows, unknown cause) - (wordsize(64), 63216 , 5), + (wordsize(64), 58128, 5), # 2013-02-14: 1263712 (x86_64/Linux) # 2014-02-10: 63216 (x86_64/Linux), call arity analysis + # 2016-11-11: 58128 (x86_64/Linux), it's not clear (wordsize(32), 53156, 5) ]), # some date: 663712 (Windows, 64-bit machine) From git at git.haskell.org Sat Nov 12 03:32:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 03:32:52 +0000 (UTC) Subject: [commit: ghc] master: ghc-pkg: Munge dynamic library directories (7eae862) Message-ID: <20161112033252.7360D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7eae862a5af185e918aa29d63a7a9484292513e4/ghc >--------------------------------------------------------------- commit 7eae862a5af185e918aa29d63a7a9484292513e4 Author: Ben Gamari Date: Fri Nov 11 15:53:36 2016 -0500 ghc-pkg: Munge dynamic library directories Otherwise we end up looking in the wrong place for dynamic libraries on Windows. This addresses a regression introduced by D2611. See #12479. Test Plan: validate across platforms Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2640 GHC Trac Issues: #12479 >--------------------------------------------------------------- 7eae862a5af185e918aa29d63a7a9484292513e4 utils/ghc-pkg/Main.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 063a806..290993f 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -822,6 +822,7 @@ mungePackagePaths top_dir pkgroot pkg = importDirs = munge_paths (importDirs pkg), includeDirs = munge_paths (includeDirs pkg), libraryDirs = munge_paths (libraryDirs pkg), + libraryDynDirs = munge_paths (libraryDynDirs pkg), frameworkDirs = munge_paths (frameworkDirs pkg), haddockInterfaces = munge_paths (haddockInterfaces pkg), -- haddock-html is allowed to be either a URL or a file From git at git.haskell.org Sat Nov 12 03:32:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 03:32:55 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix build when linked with gold (2cfbee8) Message-ID: <20161112033255.284AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2cfbee896be349d16238c044475c7c15cfb9b3f2/ghc >--------------------------------------------------------------- commit 2cfbee896be349d16238c044475c7c15cfb9b3f2 Author: Ben Gamari Date: Fri Nov 11 22:04:32 2016 -0500 rts: Fix build when linked with gold As reported in #12812, the runtime system fails to build when linked with gold due to a missing dependency on libpthread. Additionally, rts/package.conf.in uses the WORD_SIZE_IN_BITS macro defined by MachDeps.h, which it does not #include. Fix this. Test Plan: Validate with gold linker Reviewers: hsyl20, austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2695 GHC Trac Issues: #12816 >--------------------------------------------------------------- 2cfbee896be349d16238c044475c7c15cfb9b3f2 rts/package.conf.in | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/rts/package.conf.in b/rts/package.conf.in index 5d8ab8b..49c572b 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -2,6 +2,7 @@ #include "ghcconfig.h" #include "rts/Config.h" +#include "MachDeps.h" name: rts version: 1.0 @@ -45,17 +46,7 @@ extra-libraries: ,"gdi32" /* for the linker */ ,"winmm" /* for the linker */ #endif -#ifdef freebsd_HOST_OS - , "pthread" /* for pthread_getthreadid_np() */ -#endif -#ifdef openbsd_HOST_OS -/* OpenBSD's libffi is not directly linked to the libpthread but still requires -pthread functionality. This means that any client binary which links with libffi -also need to link with libpthread. If it does not, then linking fails with -unresolved symbols. */ - , "pthread" - -#endif + , "pthread" /* for pthread_getthreadid_np, pthread_create, etc. */ #if defined(DEBUG) && defined(HAVE_LIBBFD) ,"bfd", "iberty" /* for debugging */ #endif From git at git.haskell.org Sat Nov 12 03:32:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 03:32:57 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix #include of (4e0b8f4) Message-ID: <20161112033257.CD4273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4e0b8f4d80a02be797d4fed099c1195f1bcd1189/ghc >--------------------------------------------------------------- commit 4e0b8f4d80a02be797d4fed099c1195f1bcd1189 Author: Ben Gamari Date: Fri Nov 11 22:04:45 2016 -0500 rts: Fix #include of Test Plan: Validate on Windows Reviewers: austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2696 >--------------------------------------------------------------- 4e0b8f4d80a02be797d4fed099c1195f1bcd1189 rts/linker/LoadArchive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index a5af719..1aa4daa 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -12,7 +12,7 @@ /* Platform specific headers */ #if defined(OBJFORMAT_PEi386) -# include "linkers/PEi386.h" +# include "linker/PEi386.h" #elif defined(darwin_HOST_OS) # include "linker/MachO.h" # include From git at git.haskell.org Sat Nov 12 05:12:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 05:12:43 +0000 (UTC) Subject: [commit: ghc] master: Make default output less verbose (source/object paths) (587dccc) Message-ID: <20161112051243.3DEC63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/587dcccfdfa7a319e27300a4f3885071060b1f8e/ghc >--------------------------------------------------------------- commit 587dcccfdfa7a319e27300a4f3885071060b1f8e Author: Sylvain HENRY Date: Fri Nov 11 22:54:05 2016 -0500 Make default output less verbose (source/object paths) Reviewers: simonmar, mpickering, austin, bgamari Reviewed By: bgamari Subscribers: mpickering, nomeata, thomie Differential Revision: https://phabricator.haskell.org/D2679 GHC Trac Issues: #12807 >--------------------------------------------------------------- 587dcccfdfa7a319e27300a4f3885071060b1f8e compiler/main/DynFlags.hs | 4 +- compiler/main/HscTypes.hs | 29 +++++++------- testsuite/tests/backpack/reexport/bkpreex01.stderr | 8 ++-- testsuite/tests/backpack/reexport/bkpreex02.stderr | 26 ++++++------- testsuite/tests/backpack/reexport/bkpreex03.stderr | 8 ++-- testsuite/tests/backpack/reexport/bkpreex04.stderr | 6 +-- testsuite/tests/backpack/reexport/bkpreex06.stderr | 10 ++--- .../tests/backpack/should_compile/bkp01.stderr | 14 +++---- .../tests/backpack/should_compile/bkp02.stderr | 12 +++--- .../tests/backpack/should_compile/bkp07.stderr | 6 +-- .../tests/backpack/should_compile/bkp08.stderr | 8 ++-- .../tests/backpack/should_compile/bkp09.stderr | 18 ++++----- .../tests/backpack/should_compile/bkp10.stderr | 8 ++-- .../tests/backpack/should_compile/bkp11.stderr | 10 ++--- .../tests/backpack/should_compile/bkp12.stderr | 14 +++---- .../tests/backpack/should_compile/bkp14.stderr | 14 +++---- .../tests/backpack/should_compile/bkp15.stderr | 18 ++++----- .../tests/backpack/should_compile/bkp16.stderr | 4 +- .../tests/backpack/should_compile/bkp17.stderr | 6 +-- .../tests/backpack/should_compile/bkp18.stderr | 12 +++--- .../tests/backpack/should_compile/bkp19.stderr | 12 +++--- .../tests/backpack/should_compile/bkp20.stderr | 18 ++++----- .../tests/backpack/should_compile/bkp21.stderr | 10 ++--- .../tests/backpack/should_compile/bkp23.stderr | 36 +++++++++--------- .../tests/backpack/should_compile/bkp24.stderr | 26 ++++++------- .../tests/backpack/should_compile/bkp25.stderr | 14 +++---- .../tests/backpack/should_compile/bkp26.stderr | 12 +++--- .../tests/backpack/should_compile/bkp27.stderr | 12 +++--- .../tests/backpack/should_compile/bkp28.stderr | 8 ++-- .../tests/backpack/should_compile/bkp29.stderr | 8 ++-- .../tests/backpack/should_compile/bkp30.stderr | 8 ++-- .../tests/backpack/should_compile/bkp31.stderr | 12 +++--- .../tests/backpack/should_compile/bkp32.stderr | 44 +++++++++++----------- .../tests/backpack/should_compile/bkp33.stderr | 12 +++--- .../tests/backpack/should_compile/bkp34.stderr | 8 ++-- .../tests/backpack/should_compile/bkp35.stderr | 8 ++-- .../tests/backpack/should_compile/bkp36.stderr | 10 ++--- .../tests/backpack/should_compile/bkp37.stderr | 6 +-- .../tests/backpack/should_compile/bkp38.stderr | 6 +-- .../tests/backpack/should_compile/bkp39.stderr | 10 ++--- .../tests/backpack/should_compile/bkp40.stderr | 16 ++++---- .../tests/backpack/should_fail/bkpfail01.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail03.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail04.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail05.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail06.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail07.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail09.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail10.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail11.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail12.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail13.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail14.stderr | 12 +++--- .../tests/backpack/should_fail/bkpfail15.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail16.stderr | 4 +- .../tests/backpack/should_fail/bkpfail17.stderr | 4 +- .../tests/backpack/should_fail/bkpfail18.stderr | 2 +- .../tests/backpack/should_fail/bkpfail19.stderr | 4 +- .../tests/backpack/should_fail/bkpfail20.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail21.stderr | 14 +++---- .../tests/backpack/should_fail/bkpfail22.stderr | 12 +++--- .../tests/backpack/should_fail/bkpfail23.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail24.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail25.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail26.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail27.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail28.stderr | 8 ++-- testsuite/tests/cabal/cabal08/cabal08.stdout | 4 +- testsuite/tests/deriving/should_fail/T9071.stderr | 4 +- .../tests/determinism/determ002/determ002.stdout | 4 +- .../tests/determinism/determ003/determ003.stdout | 4 +- .../tests/determinism/determ005/determ005.stdout | 4 +- .../tests/determinism/determ006/determ006.stdout | 4 +- .../tests/determinism/determ007/determ007.stdout | 4 +- .../tests/determinism/determ008/determ008.stdout | 4 +- .../tests/determinism/determ009/determ009.stdout | 4 +- .../tests/determinism/determ010/determ010.stdout | 4 +- .../tests/determinism/determ011/determ011.stdout | 4 +- .../tests/determinism/determ012/determ012.stdout | 4 +- .../tests/determinism/determ013/determ013.stdout | 4 +- .../tests/determinism/determ014/determ014.stdout | 4 +- .../tests/determinism/determ015/determ015.stdout | 4 +- .../tests/determinism/determ016/determ016.stdout | 4 +- .../tests/determinism/determ017/determ017.stdout | 4 +- .../tests/determinism/determ018/determ018.stdout | 4 +- .../tests/determinism/determ019/determ019.stdout | 4 +- .../tests/determinism/determ021/determ021.stdout | 4 +- testsuite/tests/driver/T437/T437.stdout | 8 ++-- testsuite/tests/driver/T8526/T8526.stdout | 4 +- testsuite/tests/driver/recomp002/recomp002.stdout | 6 +-- testsuite/tests/driver/recomp005/recomp005.stdout | 16 ++++---- testsuite/tests/driver/recomp006/recomp006.stdout | 4 +- testsuite/tests/driver/recomp007/recomp007.stdout | 4 +- testsuite/tests/driver/recomp011/recomp011.stdout | 6 +-- testsuite/tests/driver/recomp013/recomp013.stdout | 10 ++--- testsuite/tests/driver/recomp015/recomp015.stdout | 4 +- testsuite/tests/driver/recomp016/recomp016.stdout | 20 +++++----- testsuite/tests/driver/retc001/retc001.stdout | 10 ++--- testsuite/tests/driver/retc002/retc002.stdout | 6 +-- testsuite/tests/driver/write_interface_make.stdout | 2 +- testsuite/tests/generics/T5462No1.stderr | 4 +- testsuite/tests/ghc-api/T10052/T10052.stdout | 2 +- testsuite/tests/ghc-api/T7478/T7478.stdout | 8 ++-- testsuite/tests/ghci/prog009/ghci.prog009.stdout | 2 +- testsuite/tests/ghci/scripts/T1914.stdout | 8 ++-- testsuite/tests/ghci/scripts/T6105.stdout | 4 +- .../haddock/haddock_examples/haddock.Test.stderr | 6 +-- .../indexed-types/should_compile/impexp.stderr | 4 +- .../tests/indexed-types/should_fail/T9580.stderr | 4 +- testsuite/tests/module/T11970A.stderr | 4 +- testsuite/tests/module/base01/base01.stdout | 2 +- .../should_fail/T11167_ambiguous_fixity.stderr | 6 +-- .../should_fail/overloadedrecfldsfail04.stderr | 6 +-- .../should_fail/overloadedrecfldsfail06.stderr | 4 +- .../should_fail/overloadedrecfldsfail10.stderr | 8 ++-- .../should_fail/overloadedrecfldsfail11.stderr | 4 +- .../should_fail/overloadedrecfldsfail12.stderr | 4 +- testsuite/tests/parser/should_compile/T5243.stderr | 4 +- .../partial-sigs/should_compile/SplicesUsed.stderr | 4 +- ...ExtraConstraintsWildcardInTypeSpliceUsed.stderr | 2 +- testsuite/tests/plugins/Makefile | 2 +- testsuite/tests/plugins/T12567a.stderr | 8 ++-- testsuite/tests/plugins/frontend01.stdout | 2 +- .../tests/rename/should_compile/T11624.stderr | 6 +-- testsuite/tests/rts/T9405.stdout | 2 +- testsuite/tests/rts/linker_unload.stdout | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 4 +- testsuite/tests/safeHaskell/check/Check02.stderr | 2 +- testsuite/tests/safeHaskell/check/Check03.stderr | 2 +- testsuite/tests/safeHaskell/check/Check04.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 6 +-- testsuite/tests/safeHaskell/check/Check07.stderr | 6 +-- testsuite/tests/safeHaskell/check/Check08.stderr | 6 +-- testsuite/tests/safeHaskell/check/CheckB.stderr | 4 +- .../tests/safeHaskell/check/pkg01/ImpSafe03.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap1.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap10.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap11.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap2.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap3.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap4.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap5.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap6.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap7.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap8.stderr | 4 +- .../safeHaskell/overlapping/SH_Overlap9.stderr | 6 +-- .../safeHaskell/safeInfered/SafeInfered01.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered02.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered03.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered04.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered05.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered01.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered02.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered03.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered05.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered06.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered08.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered09.stderr | 8 ++-- .../safeHaskell/safeInfered/UnsafeInfered10.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered11.stderr | 4 +- .../safeHaskell/safeLanguage/SafeLang10.stderr | 6 +-- .../safeHaskell/safeLanguage/SafeLang12.stderr | 4 +- .../safeHaskell/safeLanguage/SafeLang17.stderr | 6 +-- .../tests/typecheck/should_compile/T6018.stderr | 10 ++--- .../tests/typecheck/should_compile/tc245.stdout | 6 +-- .../tests/typecheck/should_fail/T6018fail.stderr | 10 ++--- testsuite/tests/unboxedsums/module/sum_mod.stdout | 2 +- .../tests/warnings/should_compile/DeprU.stderr | 4 +- .../tests/warnings/should_compile/T9178.stderr | 4 +- utils/mkUserGuidePart/Options/Verbosity.hs | 5 +++ 170 files changed, 632 insertions(+), 622 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 587dcccfdfa7a319e27300a4f3885071060b1f8e From git at git.haskell.org Sat Nov 12 16:38:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 16:38:02 +0000 (UTC) Subject: [commit: ghc] master: template-haskell: Version bump (568e003) Message-ID: <20161112163802.623643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/568e003efcf9bdec6268851307f98c7c44dd9995/ghc >--------------------------------------------------------------- commit 568e003efcf9bdec6268851307f98c7c44dd9995 Author: Ben Gamari Date: Sat Nov 12 11:37:36 2016 -0500 template-haskell: Version bump >--------------------------------------------------------------- 568e003efcf9bdec6268851307f98c7c44dd9995 libraries/template-haskell/changelog.md | 3 ++- libraries/template-haskell/template-haskell.cabal | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/template-haskell/changelog.md b/libraries/template-haskell/changelog.md index 19038c7..c4b8f03 100644 --- a/libraries/template-haskell/changelog.md +++ b/libraries/template-haskell/changelog.md @@ -1,6 +1,7 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) -## next *TBA* +## 2.12.0.0 *TBA* + * Bundled with GHC *TBA* * Add support for pattern synonyms. This introduces one new constructor to diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index 0d9f468..ceffa82 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -1,5 +1,5 @@ name: template-haskell -version: 2.11.0.0 +version: 2.12.0.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Sat Nov 12 22:03:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 12 Nov 2016 22:03:59 +0000 (UTC) Subject: [commit: ghc] master: ghc: Fix ghc's template-haskell bound (ca1b986) Message-ID: <20161112220359.9B1F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ca1b986074757efff755c33c7f9a62c7eae43c7f/ghc >--------------------------------------------------------------- commit ca1b986074757efff755c33c7f9a62c7eae43c7f Author: Ben Gamari Date: Sat Nov 12 11:54:45 2016 -0500 ghc: Fix ghc's template-haskell bound >--------------------------------------------------------------- ca1b986074757efff755c33c7f9a62c7eae43c7f compiler/ghc.cabal.in | 2 +- libraries/ghci/ghci.cabal.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 721adff..ba7f619 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -54,7 +54,7 @@ Library containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, - template-haskell == 2.11.*, + template-haskell == 2.12.*, hpc == 0.6.*, transformers == 0.5.*, ghc-boot == @ProjectVersionMunged@, diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in index 547374a..922d3b2 100644 --- a/libraries/ghci/ghci.cabal.in +++ b/libraries/ghci/ghci.cabal.in @@ -65,7 +65,7 @@ library deepseq == 1.4.*, filepath == 1.4.*, ghc-boot == @ProjectVersionMunged@, - template-haskell == 2.11.*, + template-haskell == 2.12.*, transformers == 0.5.* if !os(windows) From git at git.haskell.org Sun Nov 13 21:05:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:18 +0000 (UTC) Subject: [commit: ghc] wip/T3384: No braces/semis for a do statement (5e7f233) Message-ID: <20161113210518.4B7D43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/5e7f233a64e7704bf3626e33cffda3862b58f9fc/ghc >--------------------------------------------------------------- commit 5e7f233a64e7704bf3626e33cffda3862b58f9fc Author: Alan Zimmerman Date: Fri Nov 11 09:57:46 2016 +0200 No braces/semis for a do statement >--------------------------------------------------------------- 5e7f233a64e7704bf3626e33cffda3862b58f9fc compiler/hsSyn/HsExpr.hs | 9 +-- testsuite/tests/ado/ado002.stderr | 66 +++++++-------- testsuite/tests/ado/ado003.stderr | 6 +- testsuite/tests/ado/ado005.stderr | 12 +-- .../tests/arrows/should_fail/arrowfail004.stderr | 4 +- testsuite/tests/ghci/scripts/T8959b.stderr | 4 +- .../tests/indexed-types/should_fail/T2664.stderr | 16 ++-- .../tests/indexed-types/should_fail/T2693.stderr | 6 +- .../tests/indexed-types/should_fail/T5439.stderr | 4 +- .../tests/indexed-types/should_fail/T7786.stderr | 12 +-- testsuite/tests/monadfail/MonadFailErrors.stderr | 32 ++++---- testsuite/tests/monadfail/MonadFailWarnings.stderr | 32 ++++---- testsuite/tests/rebindable/rebindable6.stderr | 36 ++++----- .../safeHaskell/safeLanguage/SafeLang10.stderr | 6 +- .../safeHaskell/safeLanguage/SafeLang17.stderr | 6 +- .../tests/simplCore/should_compile/simpl017.stderr | 18 ++--- testsuite/tests/th/T10598_TH.stderr | 62 +++++++-------- testsuite/tests/th/T5358.stderr | 8 +- testsuite/tests/th/T5508.stderr | 8 +- testsuite/tests/th/T8761.stderr | 93 +++++++++++----------- testsuite/tests/th/TH_PromotedTuple.stderr | 6 +- testsuite/tests/th/TH_exn2.stderr | 4 +- .../tests/th/TH_foreignCallingConventions.stderr | 29 ++++--- testsuite/tests/typecheck/should_fail/T3613.stderr | 8 +- testsuite/tests/typecheck/should_fail/T7851.stderr | 8 +- testsuite/tests/typecheck/should_fail/T8603.stderr | 4 +- testsuite/tests/typecheck/should_fail/T9612.stderr | 8 +- .../tests/typecheck/should_fail/tcfail103.stderr | 8 +- .../tests/typecheck/should_fail/tcfail128.stderr | 18 ++--- .../tests/typecheck/should_fail/tcfail165.stderr | 6 +- .../tests/typecheck/should_fail/tcfail168.stderr | 18 ++--- .../wcompat-warnings/WCompatWarningsOn.stderr | 8 +- 32 files changed, 281 insertions(+), 284 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 5e7f233a64e7704bf3626e33cffda3862b58f9fc From git at git.haskell.org Sun Nov 13 21:05:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:21 +0000 (UTC) Subject: [commit: ghc] wip/T3384: FFI static keyword, hang OpApp for infix case (75cbaf5) Message-ID: <20161113210521.75A8A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/75cbaf584cca88b92b73e6392aa56ca91cd801a1/ghc >--------------------------------------------------------------- commit 75cbaf584cca88b92b73e6392aa56ca91cd801a1 Author: Alan Zimmerman Date: Fri Nov 11 19:20:01 2016 +0200 FFI static keyword, hang OpApp for infix case >--------------------------------------------------------------- 75cbaf584cca88b92b73e6392aa56ca91cd801a1 compiler/hsSyn/HsDecls.hs | 15 ++++++++------- compiler/hsSyn/HsExpr.hs | 3 ++- testsuite/tests/ffi/should_fail/T10461.stderr | 2 +- testsuite/tests/ffi/should_fail/T3066.stderr | 3 +-- .../tests/ffi/should_fail/capi_value_function.stderr | 3 +-- testsuite/tests/ffi/should_fail/ccfail001.stderr | 2 +- testsuite/tests/ffi/should_fail/ccfail002.stderr | 2 +- testsuite/tests/ffi/should_fail/ccfail004.stderr | 10 +++++----- testsuite/tests/ffi/should_fail/ccfail005.stderr | 4 ++-- .../tests/haddock/haddock_examples/haddock.Test.stderr | 4 ++-- testsuite/tests/printer/Makefile | 4 ++++ testsuite/tests/printer/Ppr006.stderr | 6 +++--- .../Event/Control.hs => testsuite/tests/printer/Ppr008.hs | 9 ++++++--- testsuite/tests/printer/all.T | 1 + testsuite/tests/safeHaskell/ghci/p6.stderr | 2 +- .../tests/safeHaskell/safeLanguage/SafeLang08.stderr | 2 +- testsuite/tests/th/TH_foreignCallingConventions.stderr | 2 +- testsuite/tests/unboxedsums/ffi1.stderr | 7 +++---- 18 files changed, 44 insertions(+), 37 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 75cbaf584cca88b92b73e6392aa56ca91cd801a1 From git at git.haskell.org Sun Nov 13 21:05:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:24 +0000 (UTC) Subject: [commit: ghc] wip/T3384: No parens around HsSpliceE (7363a54) Message-ID: <20161113210524.AA93D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/7363a540251aeda951af905212eca58d792d9309/ghc >--------------------------------------------------------------- commit 7363a540251aeda951af905212eca58d792d9309 Author: Alan Zimmerman Date: Fri Nov 11 10:29:58 2016 +0200 No parens around HsSpliceE >--------------------------------------------------------------- 7363a540251aeda951af905212eca58d792d9309 compiler/hsSyn/HsExpr.hs | 1 + testsuite/tests/ghc-api/annotations/T10276.stderr | 24 ++++-------- testsuite/tests/printer/Ppr006.stderr | 45 +++++++++++++++++++++++ testsuite/tests/printer/Ppr007.stderr | 17 +++++++++ 4 files changed, 71 insertions(+), 16 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 9d93692..fe29d53 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -1067,6 +1067,7 @@ hsExprNeedsParens (HsTcBracketOut {}) = False hsExprNeedsParens (HsDo sc _ _) | isListCompExpr sc = False hsExprNeedsParens (HsRecFld{}) = False +hsExprNeedsParens (HsSpliceE{}) = False hsExprNeedsParens _ = True diff --git a/testsuite/tests/ghc-api/annotations/T10276.stderr b/testsuite/tests/ghc-api/annotations/T10276.stderr index d79fc3a..fff4c8c 100644 --- a/testsuite/tests/ghc-api/annotations/T10276.stderr +++ b/testsuite/tests/ghc-api/annotations/T10276.stderr @@ -8,8 +8,7 @@ Test10276.hs:11:29: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:11:46: error: Not in scope: type constructor or class ‘M.Map’ @@ -17,8 +16,7 @@ Test10276.hs:11:46: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:11:52: error: Not in scope: type constructor or class ‘L.Name’ @@ -26,8 +24,7 @@ Test10276.hs:11:52: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:11:60: error: Not in scope: type constructor or class ‘L.Operand’ @@ -35,8 +32,7 @@ Test10276.hs:11:60: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:14:3: error: ‘qqExp’ is not a (visible) method of class ‘QQExp2’ @@ -47,8 +43,7 @@ Test10276.hs:15:29: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:15:46: error: Not in scope: type constructor or class ‘M.Map’ @@ -56,8 +51,7 @@ Test10276.hs:15:46: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:15:52: error: Not in scope: type constructor or class ‘L.Name’ @@ -65,8 +59,7 @@ Test10276.hs:15:52: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] Test10276.hs:15:60: error: Not in scope: type constructor or class ‘L.Operand’ @@ -74,5 +67,4 @@ Test10276.hs:15:60: error: In the Template Haskell quotation [|| fst $ runState - ($$(qqExpM x)) - ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] + $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||] diff --git a/testsuite/tests/printer/Ppr006.stderr b/testsuite/tests/printer/Ppr006.stderr new file mode 100644 index 0000000..12f1ed6 --- /dev/null +++ b/testsuite/tests/printer/Ppr006.stderr @@ -0,0 +1,45 @@ +Ppr006.hs:4:14: error: + Not in scope: type constructor or class ‘Command’ + +Ppr006.hs:7:23: error: + Not in scope: ‘Macro.guessCommands’ + No module named ‘Macro’ is imported. + +Ppr006.hs:12:20: error: + Not in scope: ‘ListWidget.moveLast’ + No module named ‘ListWidget’ is imported. + +Ppr006.hs:12:41: error: + Not in scope: ‘ListWidget.new’ + No module named ‘ListWidget’ is imported. + +Ppr006.hs:21:19: error: + • Not in scope: ‘help’ + • In the quasi-quotation: + [help| + Bind the command {expansion} to the key {name}. The same command may + be bound to different keys. + |] + +Ppr006.ppr.hs:3:14: error: + Not in scope: type constructor or class ‘Command’ + +Ppr006.ppr.hs:8:27: error: + Not in scope: ‘Macro.guessCommands’ + No module named ‘Macro’ is imported. + +Ppr006.ppr.hs:14:19: error: + Not in scope: ‘ListWidget.moveLast’ + No module named ‘ListWidget’ is imported. + +Ppr006.ppr.hs:14:40: error: + Not in scope: ‘ListWidget.new’ + No module named ‘ListWidget’ is imported. + +Ppr006.ppr.hs:26:8: error: + • Not in scope: ‘help’ + • In the quasi-quotation: + [help| + Bind the command {expansion} to the key {name}. The same command may + be bound to different keys. + |] diff --git a/testsuite/tests/printer/Ppr007.stderr b/testsuite/tests/printer/Ppr007.stderr new file mode 100644 index 0000000..5bb122a --- /dev/null +++ b/testsuite/tests/printer/Ppr007.stderr @@ -0,0 +1,17 @@ +Ppr007.hs:7:3: error: + • Couldn't match expected type ‘Int’ with actual type ‘Char’ + • In the pattern: 'a' + In a stmt of a 'do' block: 'a' <- return (3 :: Int) + In the expression: + do x <- getChar + 'a' <- return (3 :: Int) + return () + +Ppr007.ppr.hs:5:8: error: + • Couldn't match expected type ‘Int’ with actual type ‘Char’ + • In the pattern: 'a' + In a stmt of a 'do' block: 'a' <- return (3 :: Int) + In the expression: + do x <- getChar + 'a' <- return (3 :: Int) + return () From git at git.haskell.org Sun Nov 13 21:05:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:28 +0000 (UTC) Subject: [commit: ghc] wip/T3384: Pretty printing HsCoreAnn properly (d6f3f5c) Message-ID: <20161113210528.2DAC63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/d6f3f5cc9af85719c7efb38291e24277adad27cf/ghc >--------------------------------------------------------------- commit d6f3f5cc9af85719c7efb38291e24277adad27cf Author: Alan Zimmerman Date: Sat Nov 12 11:55:40 2016 +0200 Pretty printing HsCoreAnn properly >--------------------------------------------------------------- d6f3f5cc9af85719c7efb38291e24277adad27cf compiler/hsSyn/HsExpr.hs | 2 +- testsuite/tests/printer/Makefile | 4 ++++ testsuite/tests/printer/Ppr009.hs | 9 +++++++++ testsuite/tests/printer/Ppr009.stderr | 28 ++++++++++++++++++++++++++++ testsuite/tests/printer/all.T | 1 + 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 024ebf6..d6e3d18 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -812,7 +812,7 @@ ppr_expr (HsOverLit lit) = ppr lit ppr_expr (HsPar e) = parens (ppr_lexpr e) ppr_expr (HsCoreAnn _ (StringLiteral _ s) e) - = vcat [text "HsCoreAnn" <+> ftext s, ppr_lexpr e] + = vcat [text "{-# CORE \"" <> ftext s <> text "\" #-}", ppr_lexpr e] ppr_expr e@(HsApp {}) = ppr_apps e [] ppr_expr e@(HsAppType {}) = ppr_apps e [] diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile index 559aa63..534e5d8 100644 --- a/testsuite/tests/printer/Makefile +++ b/testsuite/tests/printer/Makefile @@ -37,3 +37,7 @@ ppr007: .PHONY: ppr008 ppr008: $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Ppr008.hs + +.PHONY: ppr009 +ppr009: + $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Ppr009.hs diff --git a/testsuite/tests/printer/Ppr009.hs b/testsuite/tests/printer/Ppr009.hs new file mode 100644 index 0000000..d24ecdc --- /dev/null +++ b/testsuite/tests/printer/Ppr009.hs @@ -0,0 +1,9 @@ +module Ppr009 where + + +{-# INLINE strictStream #-} +strictStream (Bitstream l v) + = {-# CORE "Strict Bitstream stream" #-} + S.concatMap stream (GV.stream v) + `S.sized` + Exact l diff --git a/testsuite/tests/printer/Ppr009.stderr b/testsuite/tests/printer/Ppr009.stderr new file mode 100644 index 0000000..3aabba4 --- /dev/null +++ b/testsuite/tests/printer/Ppr009.stderr @@ -0,0 +1,28 @@ +Ppr009.hs:5:15: error: Not in scope: data constructor ‘Bitstream’ + +Ppr009.hs:7:7: error: + Not in scope: ‘S.concatMap’ + No module named ‘S’ is imported. + +Ppr009.hs:7:27: error: + Not in scope: ‘GV.stream’ + No module named ‘GV’ is imported. + +Ppr009.hs:8:7: error: + Not in scope: ‘S.sized’ + No module named ‘S’ is imported. + +Ppr009.ppr.hs:4:15: error: + Not in scope: data constructor ‘Bitstream’ + +Ppr009.ppr.hs:6:5: error: + Not in scope: ‘S.concatMap’ + No module named ‘S’ is imported. + +Ppr009.ppr.hs:6:25: error: + Not in scope: ‘GV.stream’ + No module named ‘GV’ is imported. + +Ppr009.ppr.hs:6:38: error: + Not in scope: ‘S.sized’ + No module named ‘S’ is imported. diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T index 5086c43..94a85dc 100644 --- a/testsuite/tests/printer/all.T +++ b/testsuite/tests/printer/all.T @@ -6,3 +6,4 @@ test('Ppr005', normal, run_command, ['$MAKE -s --no-print-directory ppr005']) test('Ppr006', normal, run_command, ['$MAKE -s --no-print-directory ppr006']) test('Ppr007', normal, run_command, ['$MAKE -s --no-print-directory ppr007']) test('Ppr008', normal, run_command, ['$MAKE -s --no-print-directory ppr008']) +test('Ppr009', normal, run_command, ['$MAKE -s --no-print-directory ppr009']) From git at git.haskell.org Sun Nov 13 21:05:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:30 +0000 (UTC) Subject: [commit: ghc] wip/T3384: Add HsSyn prettyprinter tests (660bb54) Message-ID: <20161113210530.E98DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/660bb54189b2c4a5effe90240c74bc1f48f98af9/ghc >--------------------------------------------------------------- commit 660bb54189b2c4a5effe90240c74bc1f48f98af9 Author: Alan Zimmerman Date: Tue Nov 8 21:37:48 2016 +0200 Add HsSyn prettyprinter tests Add prettyprinter tests, which take a file, parse it, pretty print it, re-parse the pretty printed version and then compare the original and new ASTs (ignoring locations) Trac issue: #3384 >--------------------------------------------------------------- 660bb54189b2c4a5effe90240c74bc1f48f98af9 compiler/hsSyn/HsExpr.hs | 9 +- ghc.mk | 3 + testsuite/mk/boilerplate.mk | 1 + testsuite/tests/boxy/Base1.stderr | 4 +- testsuite/tests/generics/GenDerivOutput.stderr | 32 +-- testsuite/tests/generics/GenDerivOutput1_0.stderr | 8 +- testsuite/tests/generics/GenDerivOutput1_1.stderr | 65 +++--- .../tests/generics/T10604/T10604_deriving.stderr | 32 +-- testsuite/tests/printer/.gitignore | 7 + testsuite/tests/printer/Makefile | 35 +++ testsuite/tests/printer/Ppr001.hs | 7 + testsuite/tests/printer/Ppr002.hs | 46 ++++ testsuite/tests/printer/Ppr003.hs | 12 + testsuite/tests/printer/Ppr004.hs | 81 +++++++ testsuite/tests/printer/Ppr005.hs | 13 ++ testsuite/tests/printer/Ppr006.hs | 258 +++++++++++++++++++++ testsuite/tests/printer/Ppr007.hs | 8 + testsuite/tests/printer/all.T | 7 + .../tests/typecheck/should_compile/T11339.stderr | 4 +- .../tests/typecheck/should_fail/T12124.stderr | 4 +- .../tests/typecheck/should_fail/T7748a.stderr | 4 +- utils/check-ppr/Main.hs | 216 +++++++++++++++++ utils/check-ppr/README | 19 ++ utils/check-ppr/check-ppr.cabal | 32 +++ utils/check-ppr/ghc.mk | 18 ++ 25 files changed, 845 insertions(+), 80 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 660bb54189b2c4a5effe90240c74bc1f48f98af9 From git at git.haskell.org Sun Nov 13 21:05:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:35 +0000 (UTC) Subject: [commit: ghc] wip/T3384: ppr of RuleDecls can now reparse (8ff63e7) Message-ID: <20161113210535.2945D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/8ff63e72829930b754e101e28b438845df65c5e2/ghc >--------------------------------------------------------------- commit 8ff63e72829930b754e101e28b438845df65c5e2 Author: Alan Zimmerman Date: Sat Nov 12 19:43:24 2016 +0200 ppr of RuleDecls can now reparse >--------------------------------------------------------------- 8ff63e72829930b754e101e28b438845df65c5e2 compiler/basicTypes/BasicTypes.hs | 4 +- compiler/hsSyn/HsDecls.hs | 15 +- compiler/prelude/ForeignCall.hs | 5 +- compiler/types/TyCoRep.hs | 2 +- testsuite/tests/printer/Makefile | 12 ++ testsuite/tests/printer/Ppr010.hs | 18 ++ testsuite/tests/printer/Ppr011.hs | 34 ++++ testsuite/tests/printer/Ppr011.stderr | 12 ++ .../tests/{eyeball/dead1.hs => printer/Ppr012.hs} | 4 +- testsuite/tests/printer/Ppr012.stderr | 8 + testsuite/tests/printer/Ppr012.stdout | 186 +++++++++++++++++++++ testsuite/tests/printer/all.T | 3 + testsuite/tests/roles/should_compile/T8958.stderr | 4 +- .../tests/simplCore/should_compile/T7785.stderr | 2 +- .../tests/simplCore/should_compile/T8331.stderr | 2 +- .../tests/simplCore/should_compile/T8848a.stderr | 2 +- 16 files changed, 295 insertions(+), 18 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 8ff63e72829930b754e101e28b438845df65c5e2 From git at git.haskell.org Sun Nov 13 21:05:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:38 +0000 (UTC) Subject: [commit: ghc] wip/T3384: Use SourceText to ppr Overlap Pragma (379da58) Message-ID: <20161113210538.7C5CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/379da5809e8b2d6019b68340f61b326a49b58b24/ghc >--------------------------------------------------------------- commit 379da5809e8b2d6019b68340f61b326a49b58b24 Author: Alan Zimmerman Date: Sun Nov 13 12:56:13 2016 +0200 Use SourceText to ppr Overlap Pragma >--------------------------------------------------------------- 379da5809e8b2d6019b68340f61b326a49b58b24 compiler/hsSyn/HsDecls.hs | 13 ++++++++----- testsuite/tests/printer/Makefile | 4 ++++ testsuite/tests/printer/Ppr013.hs | 14 ++++++++++++++ testsuite/tests/printer/Ppr013.stderr | 6 ++++++ testsuite/tests/printer/all.T | 1 + 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/compiler/hsSyn/HsDecls.hs b/compiler/hsSyn/HsDecls.hs index 6ad658d..840106c 100644 --- a/compiler/hsSyn/HsDecls.hs +++ b/compiler/hsSyn/HsDecls.hs @@ -1491,11 +1491,14 @@ ppOverlapPragma :: Maybe (Located OverlapMode) -> SDoc ppOverlapPragma mb = case mb of Nothing -> empty - Just (L _ (NoOverlap _)) -> text "{-# NO_OVERLAP #-}" - Just (L _ (Overlappable _)) -> text "{-# OVERLAPPABLE #-}" - Just (L _ (Overlapping _)) -> text "{-# OVERLAPPING #-}" - Just (L _ (Overlaps _)) -> text "{-# OVERLAPS #-}" - Just (L _ (Incoherent _)) -> text "{-# INCOHERENT #-}" + Just (L _ (NoOverlap s)) -> maybe_stext s "{-# NO_OVERLAP #-}" + Just (L _ (Overlappable s)) -> maybe_stext s "{-# OVERLAPPABLE #-}" + Just (L _ (Overlapping s)) -> maybe_stext s "{-# OVERLAPPING #-}" + Just (L _ (Overlaps s)) -> maybe_stext s "{-# OVERLAPS #-}" + Just (L _ (Incoherent s)) -> maybe_stext s "{-# INCOHERENT #-}" + where + maybe_stext "" alt = text alt + maybe_stext src _ = text src <+> text "#-}" instance (OutputableBndrId name) => Outputable (InstDecl name) where diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile index 4c7d6bf..0c4ad7e 100644 --- a/testsuite/tests/printer/Makefile +++ b/testsuite/tests/printer/Makefile @@ -53,3 +53,7 @@ ppr011: .PHONY: ppr012 ppr012: $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Ppr012.hs + +.PHONY: ppr013 +ppr013: + $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Ppr013.hs diff --git a/testsuite/tests/printer/Ppr013.hs b/testsuite/tests/printer/Ppr013.hs new file mode 100644 index 0000000..74788bf --- /dev/null +++ b/testsuite/tests/printer/Ppr013.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE DeriveDataTypeable #-} + +import Data.Data + +data Foo = FooA | FooB + +deriving instance Show Foo + +deriving instance {-# Overlappable #-} Eq Foo +deriving instance {-# Overlapping #-} Ord Foo +deriving instance {-# Overlaps #-} Typeable Foo +deriving instance {-# Incoherent #-} Data Foo + diff --git a/testsuite/tests/printer/Ppr013.stderr b/testsuite/tests/printer/Ppr013.stderr new file mode 100644 index 0000000..5bfa1c7 --- /dev/null +++ b/testsuite/tests/printer/Ppr013.stderr @@ -0,0 +1,6 @@ + +Ppr013.hs:1:1: error: + The IO action ‘main’ is not defined in module ‘Main’ + +Ppr013.ppr.hs:1:1: error: + The IO action ‘main’ is not defined in module ‘Main’ diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T index 4443b15..c2adc00 100644 --- a/testsuite/tests/printer/all.T +++ b/testsuite/tests/printer/all.T @@ -10,3 +10,4 @@ test('Ppr009', normal, run_command, ['$MAKE -s --no-print-directory ppr009']) test('Ppr010', normal, run_command, ['$MAKE -s --no-print-directory ppr010']) test('Ppr011', normal, run_command, ['$MAKE -s --no-print-directory ppr011']) test('Ppr012', normal, run_command, ['$MAKE -s --no-print-directory ppr012']) +test('Ppr013', normal, run_command, ['$MAKE -s --no-print-directory ppr013']) From git at git.haskell.org Sun Nov 13 21:05:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:43 +0000 (UTC) Subject: [commit: ghc] wip/T3384: Adding parens into generically generated code (c1fe13d) Message-ID: <20161113210543.3263F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T3384 Link : http://ghc.haskell.org/trac/ghc/changeset/c1fe13d3232224031f666a1157a957fc1835c987/ghc >--------------------------------------------------------------- commit c1fe13d3232224031f666a1157a957fc1835c987 Author: Alan Zimmerman Date: Sun Nov 13 23:03:49 2016 +0200 Adding parens into generically generated code And some other bits >--------------------------------------------------------------- c1fe13d3232224031f666a1157a957fc1835c987 compiler/hsSyn/HsDecls.hs | 9 +- compiler/hsSyn/HsPat.hs | 6 +- compiler/hsSyn/HsUtils.hs | 4 +- compiler/parser/Parser.y | 4 +- compiler/typecheck/TcGenDeriv.hs | 4 +- compiler/typecheck/TcGenFunctor.hs | 5 +- compiler/typecheck/TcGenGenerics.hs | 15 +- testsuite/tests/generics/GenDerivOutput.stderr | 24 +- testsuite/tests/generics/GenDerivOutput1_0.stderr | 6 +- testsuite/tests/generics/GenDerivOutput1_1.stderr | 50 +-- .../tests/generics/T10604/T10604_deriving.stderr | 36 +- .../should_compile_flag_haddock/T11768.stderr | 2 +- testsuite/tests/printer/.gitignore | 2 + testsuite/tests/printer/Makefile | 24 ++ testsuite/tests/printer/Ppr014.hs | 59 +++ testsuite/tests/printer/Ppr014.stderr | 76 ++++ testsuite/tests/printer/Ppr015.hs | 7 + testsuite/tests/printer/Ppr016.hs | 4 + testsuite/tests/printer/Ppr016.stderr | 14 + testsuite/tests/printer/Ppr017.hs | 9 + testsuite/tests/printer/Ppr017.stderr | 3 + testsuite/tests/printer/Ppr018.hs | 20 + testsuite/tests/printer/Ppr018.stderr | 12 + testsuite/tests/printer/Ppr019.hs | 427 +++++++++++++++++++++ testsuite/tests/printer/all.T | 6 + testsuite/tests/th/T10598_TH.stderr | 6 +- testsuite/tests/th/T3899a.hs | 2 +- 27 files changed, 757 insertions(+), 79 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 c1fe13d3232224031f666a1157a957fc1835c987 From git at git.haskell.org Sun Nov 13 21:05:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:05:45 +0000 (UTC) Subject: [commit: ghc] wip/T3384's head updated: Adding parens into generically generated code (c1fe13d) Message-ID: <20161113210545.CD36B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T3384' now includes: 0a122a4 testsuite: Update allocation numbers for T5631 e06e21a Add Richard Eisenberg's new email to mailmap bef7e78 Read parentheses better 122d826 rts: Add api to pin a thread to a numa node but without fixing a capability aa10c67 rts/linker: Move loadArchive to new source file e8ae4dc Update user's guide after D2490 03e8d26 Prevent GND from inferring an instance context for method-less classes 60bb9d1 Revert "Pass -no-pie to GCC" 7a7bb5d Revert "Refactor CallStack defaulting slightly" ec0bf81 rts: Fix LoadArchive on OS X d421a7e Pass -no-pie to GCC 46e2bef testsuite: Lower allocations for T876 7eae862 ghc-pkg: Munge dynamic library directories 2cfbee8 rts: Fix build when linked with gold 4e0b8f4 rts: Fix #include of 587dccc Make default output less verbose (source/object paths) 568e003 template-haskell: Version bump ca1b986 ghc: Fix ghc's template-haskell bound 660bb54 Add HsSyn prettyprinter tests 5e7f233 No braces/semis for a do statement 7363a54 No parens around HsSpliceE 75cbaf5 FFI static keyword, hang OpApp for infix case d6f3f5c Pretty printing HsCoreAnn properly 8ff63e7 ppr of RuleDecls can now reparse 379da58 Use SourceText to ppr Overlap Pragma c1fe13d Adding parens into generically generated code From git at git.haskell.org Sun Nov 13 21:08:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 21:08:21 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix references to UChar (8cb7bc5) Message-ID: <20161113210821.0EDF93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8cb7bc5c234eb8168068f65b8888597106fec302/ghc >--------------------------------------------------------------- commit 8cb7bc5c234eb8168068f65b8888597106fec302 Author: Ben Gamari Date: Sun Nov 13 16:07:59 2016 -0500 rts: Fix references to UChar Test Plan: Validate on Windows. Reviewers: erikd, austin, simonmar Reviewed By: erikd Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2700 >--------------------------------------------------------------- 8cb7bc5c234eb8168068f65b8888597106fec302 rts/LinkerInternals.h | 9 +++++---- rts/linker/PEi386.c | 27 ++------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index ce5c5eb..60370bb 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -281,16 +281,17 @@ int machoGetMisalignment( FILE * f ); arising from using normal C indexing or pointer arithmetic are just plain wrong. Sigh. */ -STATIC_INLINE UChar * +STATIC_INLINE unsigned char * myindex ( int scale, void* base, int index ) { return - ((UChar*)base) + scale * index; + ((unsigned char*)base) + scale * index; } +// Defined in linker/PEi386.c char *cstring_from_section_name( - UChar* name, - UChar* strtab); + unsigned char* name, + unsigned char* strtab); #endif /* mingw32_HOST_OS */ /* Which object file format are we targetting? */ diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index 56975ed..5eaa35a 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -64,17 +64,9 @@ #include #include -static UChar *myindex( - int scale, - void* base, - int index); - static UChar *cstring_from_COFF_symbol_name( UChar* name, UChar* strtab); -static char *cstring_from_section_name( - UChar* name, - UChar* strtab); static size_t makeSymbolExtra_PEi386( ObjectCode* oc, @@ -84,6 +76,7 @@ static size_t makeSymbolExtra_PEi386( static void addDLLHandle( pathchar* dll_name, HINSTANCE instance); + static int verifyCOFFHeader( COFF_header *hdr, pathchar *filename); @@ -553,22 +546,6 @@ int checkAndLoadImportLibrary( pathchar* arch_name, char* member_name, FILE* f) return 1; } -/* We use myindex to calculate array addresses, rather than - simply doing the normal subscript thing. That's because - some of the above structs have sizes which are not - a whole number of words. GCC rounds their sizes up to a - whole number of words, which means that the address calcs - arising from using normal C indexing or pointer arithmetic - are just plain wrong. Sigh. -*/ -static UChar * -myindex ( int scale, void* base, int index ) -{ - return - ((UChar*)base) + scale * index; -} - - static void printName ( UChar* name, UChar* strtab ) { @@ -635,7 +612,7 @@ cstring_from_COFF_symbol_name ( UChar* name, UChar* strtab ) (when it is exactly 8 bytes long there's no trailing '\0'), so for consistency we *always* copy the string; the caller must free it */ -static char * +char * cstring_from_section_name (UChar* name, UChar* strtab) { char *newstr; From git at git.haskell.org Sun Nov 13 22:25:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 13 Nov 2016 22:25:29 +0000 (UTC) Subject: [commit: ghc] master: Kill Type pretty-printer (6c0f10f) Message-ID: <20161113222529.DBAC93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5/ghc >--------------------------------------------------------------- commit 6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5 Author: Ben Gamari Date: Sun Nov 13 16:17:37 2016 -0500 Kill Type pretty-printer Here we consolidate the pretty-printing logic for types in IfaceType. We need IfaceType regardless and the printer for Type can be implemented in terms of that for IfaceType. See #11660. Note that this is very much a work-in-progress. Namely I still have yet to ponder how to ease the hs-boot file situation, still need to rip out more dead code, need to move some of the special cases for, e.g., `*` to the IfaceType printer, and need to get it to validate. That being said, it comes close to validating as-is. Test Plan: Validate Reviewers: goldfire, austin Subscribers: goldfire, thomie, simonpj Differential Revision: https://phabricator.haskell.org/D2528 GHC Trac Issues: #11660 >--------------------------------------------------------------- 6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5 compiler/basicTypes/BasicTypes.hs | 44 ++ compiler/coreSyn/CoreLint.hs | 2 +- compiler/coreSyn/PprCore.hs | 2 +- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/iface/IfaceSyn.hs | 9 +- compiler/iface/IfaceType.hs | 731 +++++++++++++-------- compiler/iface/IfaceType.hs-boot | 36 + compiler/iface/MkIface.hs | 223 +------ compiler/iface/TcIface.hs | 18 +- compiler/iface/ToIface.hs | 497 ++++++++++++++ compiler/iface/ToIface.hs-boot | 15 + compiler/main/GHC.hs | 2 +- compiler/prelude/TysWiredIn.hs | 7 +- compiler/prelude/TysWiredIn.hs-boot | 2 +- compiler/typecheck/TcDeriv.hs | 5 +- compiler/typecheck/TcDerivInfer.hs | 2 +- compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcMType.hs | 2 +- compiler/typecheck/TcPat.hs | 7 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 4 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Coercion.hs-boot | 1 + compiler/types/TyCoRep.hs | 603 ++--------------- compiler/types/TyCoRep.hs-boot | 3 +- compiler/types/TyCon.hs | 2 +- compiler/types/Type.hs | 8 +- compiler/utils/Binary.hs | 8 + .../tests/deSugar/should_compile/T2431.stderr | 2 +- .../dependent/should_fail/TypeSkolEscape.stderr | 2 +- testsuite/tests/ghci/scripts/T11252.stdout | 2 +- testsuite/tests/ghci/scripts/T2766.stdout | 2 +- testsuite/tests/ghci/scripts/ghci059.stdout | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 6 +- .../tests/typecheck/should_compile/T10632.stderr | 2 +- .../typecheck/should_fail/ClassOperator.stderr | 8 +- .../tests/typecheck/should_fail/IPFail.stderr | 2 +- .../tests/typecheck/should_fail/T7019a.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7525.stderr | 16 +- testsuite/tests/typecheck/should_fail/T8912.stderr | 10 +- .../tests/typecheck/should_fail/tcfail041.stderr | 10 +- .../tests/typecheck/should_fail/tcfail130.stderr | 9 +- .../tests/typecheck/should_fail/tcfail211.stderr | 4 +- .../tests/typecheck/should_run/tcrun045.stderr | 6 +- 48 files changed, 1200 insertions(+), 1132 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 6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5 From git at git.haskell.org Mon Nov 14 14:43:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 14:43:51 +0000 (UTC) Subject: [commit: ghc] master: Remove CONSTR_STATIC (55d535d) Message-ID: <20161114144351.B8C433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/55d535da10dd63bbaf03fb176ced7179087cd0d4/ghc >--------------------------------------------------------------- commit 55d535da10dd63bbaf03fb176ced7179087cd0d4 Author: Simon Marlow Date: Wed Nov 9 09:20:02 2016 +0000 Remove CONSTR_STATIC Summary: We currently have two info tables for a constructor * XXX_con_info: the info table for a heap-resident instance of the constructor, It has type CONSTR, or one of the specialised types like CONSTR_1_0 * XXX_static_info: the info table for a static instance of this constructor, which has type CONSTR_STATIC or CONSTR_STATIC_NOCAF. I'm getting rid of the latter, and using the `con_info` info table for both static and dynamic constructors. For rationale and more details see Note [static constructors] in SMRep.hs. I also removed these macros: `isSTATIC()`, `ip_STATIC()`, `closure_STATIC()`, since they relied on the CONSTR/CONSTR_STATIC distinction, and anyway HEAP_ALLOCED() does the same job. Test Plan: validate Reviewers: bgamari, simonpj, austin, gcampax, hvr, niteria, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2690 GHC Trac Issues: #12455 >--------------------------------------------------------------- 55d535da10dd63bbaf03fb176ced7179087cd0d4 compiler/cmm/CLabel.hs | 19 ------ compiler/cmm/SMRep.hs | 54 +++++++++++---- compiler/codeGen/StgCmm.hs | 52 ++++++-------- compiler/codeGen/StgCmmClosure.hs | 14 +--- compiler/ghci/RtClosureInspect.hs | 2 +- docs/rts/rts.tex | 2 - includes/rts/storage/ClosureTypes.h | 131 ++++++++++++++++++----------------- includes/rts/storage/InfoTables.h | 16 ++--- rts/CheckUnload.c | 3 +- rts/ClosureFlags.c | 133 ++++++++++++++++++------------------ rts/Interpreter.c | 3 +- rts/LdvProfile.c | 3 +- rts/Prelude.h | 33 --------- rts/Printer.c | 6 +- rts/ProfHeap.c | 6 +- rts/Profiling.c | 3 +- rts/RetainerProfile.c | 33 ++++----- rts/StgMiscClosures.cmm | 38 +++++------ rts/sm/CNF.c | 12 ++-- rts/sm/Compact.c | 9 ++- rts/sm/Evac.c | 13 ++-- rts/sm/GCAux.c | 2 +- rts/sm/Sanity.c | 22 ++---- rts/sm/Scav.c | 11 ++- 24 files changed, 281 insertions(+), 339 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 55d535da10dd63bbaf03fb176ced7179087cd0d4 From git at git.haskell.org Mon Nov 14 14:43:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 14:43:54 +0000 (UTC) Subject: [commit: ghc] master: Accept output for scc003 (034e01e) Message-ID: <20161114144354.6A62C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/034e01e4b0a92240883b125e2362457932e785cf/ghc >--------------------------------------------------------------- commit 034e01e4b0a92240883b125e2362457932e785cf Author: Simon Marlow Date: Wed Nov 9 10:58:57 2016 +0000 Accept output for scc003 Looks like e3f341f334d89c88f388d8e864ed8762d0890a64 broke it, but we wouldn't have noticed because the test isn't run in validate. I think the change is OK. We don't get a tick for x' any more, because it is converted directly to a case instead of a let-binding, but we still get a tick for the "pattern binding" (!x'). This could be better - f.(...) isn't all that intuitive - but it's not strictly wrong. >--------------------------------------------------------------- 034e01e4b0a92240883b125e2362457932e785cf .../tests/profiling/should_run/scc003.prof.sample | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/testsuite/tests/profiling/should_run/scc003.prof.sample b/testsuite/tests/profiling/should_run/scc003.prof.sample index b1c60e8..c809013 100644 --- a/testsuite/tests/profiling/should_run/scc003.prof.sample +++ b/testsuite/tests/profiling/should_run/scc003.prof.sample @@ -1,35 +1,34 @@ - Sat Jun 4 11:59 2016 Time and Allocation Profiling Report (Final) + Wed Nov 9 10:58 2016 Time and Allocation Profiling Report (Final) scc003 +RTS -hc -p -RTS - total time = 0.04 secs (35 ticks @ 1000 us, 1 processor) - total alloc = 48,704 bytes (excludes profiling overheads) + total time = 0.04 secs (38 ticks @ 1000 us, 1 processor) + total alloc = 48,784 bytes (excludes profiling overheads) COST CENTRE MODULE SRC %time %alloc fib Main scc003.hs:8:1-50 100.0 0.0 -MAIN MAIN 0.0 1.7 +MAIN MAIN 0.0 1.9 +CAF GHC.IO.Handle.FD 0.0 70.8 CAF GHC.IO.Encoding 0.0 5.7 CAF GHC.Conc.Signal 0.0 1.3 -CAF GHC.IO.Handle.FD 0.0 70.9 main Main scc003.hs:2:1-22 0.0 19.6 individual inherited COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc -MAIN MAIN 44 0 0.0 1.7 100.0 100.0 - CAF Main 87 0 0.0 0.0 100.0 0.7 - main Main scc003.hs:2:1-22 88 1 0.0 0.6 100.0 0.7 - f Main scc003.hs:5:1-41 90 1 0.0 0.0 100.0 0.1 - f.(...) Main scc003.hs:5:11-21 91 1 0.0 0.0 0.0 0.0 - fib Main scc003.hs:8:1-50 92 21891 0.0 0.0 0.0 0.0 - f.\ Main scc003.hs:5:32-41 94 1 0.0 0.0 100.0 0.0 - fib Main scc003.hs:8:1-50 95 2692537 100.0 0.0 100.0 0.0 - f.x' Main scc003.hs:5:11-21 93 1 0.0 0.0 0.0 0.0 - CAF GHC.IO.Handle.FD 82 0 0.0 70.9 0.0 70.9 - CAF GHC.IO.Handle.Text 81 0 0.0 0.2 0.0 0.2 - CAF GHC.Conc.Signal 79 0 0.0 1.3 0.0 1.3 - CAF GHC.IO.Encoding 76 0 0.0 5.7 0.0 5.7 - CAF GHC.IO.Encoding.Iconv 63 0 0.0 0.5 0.0 0.5 - main Main scc003.hs:2:1-22 89 0 0.0 19.0 0.0 19.0 +MAIN MAIN 104 0 0.0 1.9 100.0 100.0 + CAF Main 207 0 0.0 0.0 100.0 0.7 + main Main scc003.hs:2:1-22 208 1 0.0 0.6 100.0 0.7 + f Main scc003.hs:5:1-41 210 1 0.0 0.0 100.0 0.1 + f.(...) Main scc003.hs:5:11-21 211 1 0.0 0.0 0.0 0.0 + fib Main scc003.hs:8:1-50 212 21891 0.0 0.0 0.0 0.0 + f.\ Main scc003.hs:5:32-41 213 1 0.0 0.0 100.0 0.0 + fib Main scc003.hs:8:1-50 214 2692537 100.0 0.0 100.0 0.0 + CAF GHC.Conc.Signal 201 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 191 0 0.0 5.7 0.0 5.7 + CAF GHC.IO.Encoding.Iconv 189 0 0.0 0.5 0.0 0.5 + CAF GHC.IO.Handle.FD 181 0 0.0 70.8 0.0 70.8 + CAF GHC.IO.Handle.Text 179 0 0.0 0.2 0.0 0.2 + main Main scc003.hs:2:1-22 209 0 0.0 19.0 0.0 19.0 From git at git.haskell.org Mon Nov 14 14:43:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 14:43:57 +0000 (UTC) Subject: [commit: ghc] master: Fix numa001 failure with "too many NUMA nodes" (e0ca7ff) Message-ID: <20161114144357.1DA0D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e0ca7ff3a9df3f746f0496ae274d669fc14a17dc/ghc >--------------------------------------------------------------- commit e0ca7ff3a9df3f746f0496ae274d669fc14a17dc Author: Simon Marlow Date: Wed Nov 9 11:02:12 2016 +0000 Fix numa001 failure with "too many NUMA nodes" It seems that recent versions of the Linux kernel are using larger NUMA bitmasks; I see 1024 on my laptop running a 4.6.5 kernel. This causes the NUMA tests to fail. I'm fixing it to only fail if we have that many actual *nodes*, rather than failing if the size of the mask is too big. >--------------------------------------------------------------- e0ca7ff3a9df3f746f0496ae274d669fc14a17dc rts/posix/OSMem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 6e9af3e..febeffb 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -585,8 +585,8 @@ StgWord osNumaMask(void) #if HAVE_LIBNUMA struct bitmask *mask; mask = numa_get_mems_allowed(); - if (mask->size > sizeof(StgWord)*8) { - barf("Too many NUMA nodes"); + if (osNumaNodes() > sizeof(StgWord)*8) { + barf("osNumaMask: too many NUMA nodes (%d)", osNumaNodes()); } return mask->maskp[0]; #else From git at git.haskell.org Mon Nov 14 15:31:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 15:31:07 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix creep of T4029 (cb16890) Message-ID: <20161114153107.8FA333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb168900f88564e7d2e084c5ccd131d4109be795/ghc >--------------------------------------------------------------- commit cb168900f88564e7d2e084c5ccd131d4109be795 Author: Ben Gamari Date: Mon Nov 14 09:20:14 2016 -0500 testsuite: Fix creep of T4029 Ostensibly due to IfaceType rework, but I have my doubts. >--------------------------------------------------------------- cb168900f88564e7d2e084c5ccd131d4109be795 testsuite/tests/perf/space_leaks/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 092bc1b..9acd157 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -64,7 +64,7 @@ test('T4029', # 2016-07-13: 92 (amd64/Linux) Changes to tidyType # 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565) stats_num_field('max_bytes_used', - [(wordsize(64), 20325248, 5)]), + [(wordsize(64), 21387048 , 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -72,6 +72,7 @@ test('T4029', # 2016-07-20: 22920616 (amd64/Linux) Fix laziness of instance matching # 2016-09-01: 21648488 (amd64/Linux) Restore w/w limit (#11565) # 2016-10-13: 20325248 (amd64/Linux) Creep (downwards, yay!) + # 2016-11-14: 21387048 (amd64/Linux) Creep back upwards :( extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Mon Nov 14 19:13:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 19:13:54 +0000 (UTC) Subject: [commit: ghc] master: configure: Verify that GCC recognizes -no-pie flag (011af2b) Message-ID: <20161114191354.B9C5E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/011af2bf448c28db68a55293abaa5b294f170e37/ghc >--------------------------------------------------------------- commit 011af2bf448c28db68a55293abaa5b294f170e37 Author: Ben Gamari Date: Mon Nov 14 14:13:30 2016 -0500 configure: Verify that GCC recognizes -no-pie flag It seems like GCC versions prior to 4.8 exit with code 0 when faced with an unrecognized flag. Silly compilers. Test Plan: Validate Reviewers: hvr, austin, ggreif Reviewed By: ggreif Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2707 GHC Trac Issues: #12759 >--------------------------------------------------------------- 011af2bf448c28db68a55293abaa5b294f170e37 aclocal.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index aea85f4..5d39570 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1333,7 +1333,8 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([whether GCC supports -no-pie]) echo 'int main() { return 0; }' > conftest.c - if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then + # Some GCC versions only warn when passed an unrecognized flag. + if $CC -no-pie -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then CONF_GCC_SUPPORTS_NO_PIE=YES AC_MSG_RESULT([yes]) else From git at git.haskell.org Mon Nov 14 22:20:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump hsc2hs submodule to v0.68.1 (a23e976) Message-ID: <20161114222002.A40113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a23e9762fff63e88673e38cd14e591d277060f25/ghc >--------------------------------------------------------------- commit a23e9762fff63e88673e38cd14e591d277060f25 Author: Ben Gamari Date: Fri Nov 11 17:55:21 2016 -0500 Bump hsc2hs submodule to v0.68.1 >--------------------------------------------------------------- a23e9762fff63e88673e38cd14e591d277060f25 utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index f5ae016..8fed36a 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit f5ae016e5a69ebf42d612805e51afd9227df9389 +Subproject commit 8fed36addd3439e01752a0ce48140ad0a56a6c61 From git at git.haskell.org Mon Nov 14 22:20:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update unix submodule to 2.7.2.1 (4b8202e) Message-ID: <20161114222005.51A233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/4b8202ebb5ce1991fea0066f5e3a3f5667435b46/ghc >--------------------------------------------------------------- commit 4b8202ebb5ce1991fea0066f5e3a3f5667435b46 Author: Ben Gamari Date: Fri Nov 11 18:20:31 2016 -0500 Update unix submodule to 2.7.2.1 >--------------------------------------------------------------- 4b8202ebb5ce1991fea0066f5e3a3f5667435b46 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 7b20b4c..113fe7a 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 7b20b4cbc35a2fea3f26c988f9b2a95640babaaa +Subproject commit 113fe7a84d47010123db9501ea2885ca86277a2d From git at git.haskell.org Mon Nov 14 22:20:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump Cabal submodule to 1.24.1.0 (6e38992) Message-ID: <20161114222008.0738D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6e389923f9b8df9bf1c0da70cdc5ed2fe6f9ec58/ghc >--------------------------------------------------------------- commit 6e389923f9b8df9bf1c0da70cdc5ed2fe6f9ec58 Author: Ben Gamari Date: Fri Nov 11 18:00:11 2016 -0500 Bump Cabal submodule to 1.24.1.0 >--------------------------------------------------------------- 6e389923f9b8df9bf1c0da70cdc5ed2fe6f9ec58 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index a2b9ced..51ff8b6 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit a2b9ced8720fe5df2527d5d3c4e066934027b5ff +Subproject commit 51ff8b66468977dcccb81d19ac2d42ee27c9ccd1 From git at git.haskell.org Mon Nov 14 22:20:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Fix build when linked with gold (6bee864) Message-ID: <20161114222010.B10413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6bee8644d959ec77745d835c8c4453f2147bd8d7/ghc >--------------------------------------------------------------- commit 6bee8644d959ec77745d835c8c4453f2147bd8d7 Author: Ben Gamari Date: Fri Nov 11 22:04:32 2016 -0500 rts: Fix build when linked with gold As reported in #12812, the runtime system fails to build when linked with gold due to a missing dependency on libpthread. Additionally, rts/package.conf.in uses the WORD_SIZE_IN_BITS macro defined by MachDeps.h, which it does not #include. Fix this. Test Plan: Validate with gold linker Reviewers: hsyl20, austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2695 GHC Trac Issues: #12816 (cherry picked from commit 2cfbee896be349d16238c044475c7c15cfb9b3f2) >--------------------------------------------------------------- 6bee8644d959ec77745d835c8c4453f2147bd8d7 rts/package.conf.in | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/rts/package.conf.in b/rts/package.conf.in index 5c6d240..c0256bb 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -2,6 +2,7 @@ #include "ghcconfig.h" #include "rts/Config.h" +#include "MachDeps.h" name: rts version: 1.0 @@ -42,17 +43,7 @@ extra-libraries: ,"gdi32" /* for the linker */ ,"winmm" /* for the linker */ #endif -#ifdef freebsd_HOST_OS - , "pthread" /* for pthread_getthreadid_np() */ -#endif -#ifdef openbsd_HOST_OS -/* OpenBSD's libffi is not directly linked to the libpthread but still requires -pthread functionality. This means that any client binary which links with libffi -also need to link with libpthread. If it does not, then linking fails with -unresolved symbols. */ - , "pthread" - -#endif + , "pthread" /* for pthread_getthreadid_np, pthread_create, etc. */ #if defined(DEBUG) && defined(HAVE_LIBBFD) ,"bfd", "iberty" /* for debugging */ #endif From git at git.haskell.org Mon Nov 14 22:20:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: template-haskell: Version bump and update changelog (4639ce6) Message-ID: <20161114222013.5C7603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/4639ce6d836156c8dfeb2bb418a218d13981681e/ghc >--------------------------------------------------------------- commit 4639ce6d836156c8dfeb2bb418a218d13981681e Author: Ben Gamari Date: Sat Nov 12 11:24:39 2016 -0500 template-haskell: Version bump and update changelog >--------------------------------------------------------------- 4639ce6d836156c8dfeb2bb418a218d13981681e libraries/template-haskell/changelog.md | 9 ++++++++- libraries/template-haskell/template-haskell.cabal | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/template-haskell/changelog.md b/libraries/template-haskell/changelog.md index e746cb54..09ecacd 100644 --- a/libraries/template-haskell/changelog.md +++ b/libraries/template-haskell/changelog.md @@ -1,6 +1,13 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) -## 2.11.0.0 *TBA* +## 2.11.1.0 Nov 2016 + + * Bundled with GHC 8.0.2 + + * Fix pretty-printing of list comprehensions with only one statement. Previously this was rendered as `[Foo|]` instead of `Foo]`. + + +## 2.11.0.0 May 2016 * Bundled with GHC 8.0.1 diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index 39a70ca..e413e3d 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -1,5 +1,5 @@ name: template-haskell -version: 2.11.0.0 +version: 2.11.1.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Nov 14 22:20:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: configure: Verify that GCC recognizes -no-pie flag (cc0d5d3) Message-ID: <20161114222016.1037B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/cc0d5d30fb9e36306d68abe41fa243974a4bf245/ghc >--------------------------------------------------------------- commit cc0d5d30fb9e36306d68abe41fa243974a4bf245 Author: Ben Gamari Date: Mon Nov 14 14:13:30 2016 -0500 configure: Verify that GCC recognizes -no-pie flag It seems like GCC versions prior to 4.8 exit with code 0 when faced with an unrecognized flag. Silly compilers. Test Plan: Validate Reviewers: hvr, austin, ggreif Reviewed By: ggreif Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2707 GHC Trac Issues: #12759 (cherry picked from commit 011af2bf448c28db68a55293abaa5b294f170e37) >--------------------------------------------------------------- cc0d5d30fb9e36306d68abe41fa243974a4bf245 aclocal.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 08ae2e5..04bcf54 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1269,7 +1269,8 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([whether GCC supports -no-pie]) echo 'int main() { return 0; }' > conftest.c - if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then + # Some GCC versions only warn when passed an unrecognized flag. + if $CC -no-pie -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then CONF_GCC_SUPPORTS_NO_PIE=YES AC_MSG_RESULT([yes]) else From git at git.haskell.org Mon Nov 14 22:20:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 22:20:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: StgCmmPrim: Add missing write barrier. (8008d27) Message-ID: <20161114222018.BC35E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/8008d27c09ce36f368ab562f3f821f666d99f519/ghc >--------------------------------------------------------------- commit 8008d27c09ce36f368ab562f3f821f666d99f519 Author: Peter Trommler Date: Wed Oct 19 09:02:54 2016 -0400 StgCmmPrim: Add missing write barrier. On architectures with weak memory consistency a write barrier is needed before the write to the pointer array. Fixes #12469 Test Plan: rebuilt Stackage nightly twice on powerpc64le Reviewers: hvr, rrnewton, erikd, austin, simonmar, bgamari Reviewed By: erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2525 GHC Trac Issues: #12469 (cherry picked from commit 2cb8cc26df6af431d30b6964710ea2d859ca2bcd) >--------------------------------------------------------------- 8008d27c09ce36f368ab562f3f821f666d99f519 compiler/codeGen/StgCmmPrim.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs index 3cb9f83..54ad718 100644 --- a/compiler/codeGen/StgCmmPrim.hs +++ b/compiler/codeGen/StgCmmPrim.hs @@ -1349,6 +1349,10 @@ doWritePtrArrayOp :: CmmExpr doWritePtrArrayOp addr idx val = do dflags <- getDynFlags let ty = cmmExprType dflags val + -- This write barrier is to ensure that the heap writes to the object + -- referred to by val have happened before we write val into the array. + -- See #12469 for details. + emitPrimCall [] MO_WriteBarrier [] mkBasicIndexedWrite (arrPtrsHdrSize dflags) Nothing addr ty idx val emit (setInfo addr (CmmLit (CmmLabel mkMAP_DIRTY_infoLabel))) -- the write barrier. We must write a byte into the mark table: From git at git.haskell.org Mon Nov 14 23:08:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 23:08:39 +0000 (UTC) Subject: [commit: ghc] master: Skip 64-bit symbol tables (1b336d9) Message-ID: <20161114230839.A7B283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1b336d9064514219f370a4a12d7019f23393600e/ghc >--------------------------------------------------------------- commit 1b336d9064514219f370a4a12d7019f23393600e Author: Sylvain HENRY Date: Mon Nov 14 17:16:27 2016 -0500 Skip 64-bit symbol tables This patch makes the RTS linker skip 64-bit symbol table entries. See https://mail.haskell.org/pipermail/ghc-devs/2016-November/013210.html Test Plan: validate Reviewers: austin, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: osa1, thomie Differential Revision: https://phabricator.haskell.org/D2697 GHC Trac Issues: #12827 >--------------------------------------------------------------- 1b336d9064514219f370a4a12d7019f23393600e rts/linker/LoadArchive.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 1aa4daa..04bd455 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -288,12 +288,14 @@ static HsInt loadArchive_ (pathchar *path) memcpy(fileName, gnuFileIndex + n, thisFileNameSize); fileName[thisFileNameSize] = '\0'; } - else if (fileName[1] == ' ') { + /* Skip 32-bit symbol table ("/" + 15 blank characters) + and 64-bit symbol table ("/SYM64/" + 9 blank characters) */ + else if (fileName[1] == ' ' || (0 == strncmp(&fileName[1], "SYM64/", 6))) { fileName[0] = '\0'; thisFileNameSize = 0; } else { - barf("loadArchive: GNU-variant filename offset not found while reading filename from `%s'", path); + barf("loadArchive: invalid GNU-variant filename `%.16s' while reading filename from `%s'", fileName, path); } } /* Finally, the case where the filename field actually contains From git at git.haskell.org Mon Nov 14 23:08:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 23:08:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Skip 64-bit symbol tables (ce66c24) Message-ID: <20161114230858.D5D023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ce66c24ac91ff7893dc91f31292bcebc60df4924/ghc >--------------------------------------------------------------- commit ce66c24ac91ff7893dc91f31292bcebc60df4924 Author: Sylvain HENRY Date: Mon Nov 14 17:16:27 2016 -0500 Skip 64-bit symbol tables This patch makes the RTS linker skip 64-bit symbol table entries. See https://mail.haskell.org/pipermail/ghc-devs/2016-November/013210.html Test Plan: validate Reviewers: austin, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: osa1, thomie Differential Revision: https://phabricator.haskell.org/D2697 GHC Trac Issues: #12827 (cherry picked from commit 1b336d9064514219f370a4a12d7019f23393600e) >--------------------------------------------------------------- ce66c24ac91ff7893dc91f31292bcebc60df4924 rts/Linker.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 9412e5b..b9237b0 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -2323,12 +2323,14 @@ static HsInt loadArchive_ (pathchar *path) memcpy(fileName, gnuFileIndex + n, thisFileNameSize); fileName[thisFileNameSize] = '\0'; } - else if (fileName[1] == ' ') { + /* Skip 32-bit symbol table ("/" + 15 blank characters) + and 64-bit symbol table ("/SYM64/" + 9 blank characters) */ + else if (fileName[1] == ' ' || (0 == strncmp(&fileName[1], "SYM64/", 6))) { fileName[0] = '\0'; thisFileNameSize = 0; } else { - barf("loadArchive: GNU-variant filename offset not found while reading filename from `%s'", path); + barf("loadArchive: invalid GNU-variant filename `%.16s' while reading filename from `%s'", fileName, path); } } /* Finally, the case where the filename field actually contains From git at git.haskell.org Mon Nov 14 23:09:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 14 Nov 2016 23:09:01 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump filepath submodule to 1.4.1.1 (ee3ff0d) Message-ID: <20161114230901.89C063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ee3ff0d21fd51af269a29d371db0094397090bc8/ghc >--------------------------------------------------------------- commit ee3ff0d21fd51af269a29d371db0094397090bc8 Author: Ben Gamari Date: Mon Nov 14 17:37:45 2016 -0500 Bump filepath submodule to 1.4.1.1 >--------------------------------------------------------------- ee3ff0d21fd51af269a29d371db0094397090bc8 libraries/filepath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/filepath b/libraries/filepath index 07b334b..f6068dd 160000 --- a/libraries/filepath +++ b/libraries/filepath @@ -1 +1 @@ -Subproject commit 07b334b406a45057a80e821e72c4b973117caae9 +Subproject commit f6068dde9b62ce51900a4e303b1cb14a2a3f5651 From git at git.haskell.org Tue Nov 15 08:32:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 08:32:58 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Implement OverloadedRecordFields and modify OverloadedLabels (0bf2da8) Message-ID: <20161115083258.AC4AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/0bf2da87c75e4fb61566a035a121196de57f15c4/ghc >--------------------------------------------------------------- commit 0bf2da87c75e4fb61566a035a121196de57f15c4 Author: Adam Gundry Date: Mon Nov 14 21:11:57 2016 +0000 Implement OverloadedRecordFields and modify OverloadedLabels Summary: This implements a new OverloadedRecordFields extension and modifies the existing OverloadedLabels extension, as described in the GHC proposal: https://github.com/ghc-proposals/ghc-proposals/pull/6 This replaces D1687. The users guide documentation still needs to be written, but I'll do that after the implementation is merged, in case there are further design changes. Test Plan: new and modified tests in overloadedrecflds Reviewers: bgamari, simonpj, austin, hvr, goldfire Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2708 >--------------------------------------------------------------- 0bf2da87c75e4fb61566a035a121196de57f15c4 compiler/basicTypes/DataCon.hs | 15 ++- compiler/deSugar/Coverage.hs | 2 +- compiler/deSugar/DsBinds.hs | 3 + compiler/deSugar/DsExpr.hs | 2 +- compiler/deSugar/DsMeta.hs | 2 +- compiler/deSugar/Match.hs | 2 +- compiler/hsSyn/HsExpr.hs | 8 +- compiler/main/DynFlags.hs | 1 + compiler/parser/Lexer.x | 3 +- compiler/parser/Parser.y | 2 +- compiler/prelude/PrelNames.hs | 16 +++ compiler/rename/RnExpr.hs | 8 +- compiler/typecheck/TcEvidence.hs | 6 + compiler/typecheck/TcExpr.hs | 80 ++++++++---- compiler/typecheck/TcHsSyn.hs | 8 +- compiler/typecheck/TcInteract.hs | 135 ++++++++++++++++++++- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSMonad.hs | 12 +- compiler/typecheck/TcValidity.hs | 44 +++++++ compiler/types/TyCon.hs | 5 +- compiler/utils/FastStringEnv.hs | 5 +- libraries/base/GHC/OverloadedLabels.hs | 41 +++++-- libraries/base/GHC/Records.hs | 55 +++++++++ libraries/base/base.cabal | 1 + .../ghc-boot-th/GHC/LanguageExtensions/Type.hs | 1 + testsuite/driver/extra_files.py | 1 + testsuite/tests/driver/T4437.hs | 3 +- testsuite/tests/overloadedrecflds/ghci/all.T | 1 + ...ghci01.script => duplicaterecfldsghci01.script} | 0 ...ghci01.stdout => duplicaterecfldsghci01.stdout} | 0 .../ghci/overloadedlabelsghci01.script | 7 +- .../ghci/overloadedrecfldsghci01.script | 25 ++-- .../ghci/overloadedrecfldsghci01.stdout | 29 +---- .../should_fail/HasFieldFail01_A.hs | 3 + .../tests/overloadedrecflds/should_fail/all.T | 7 ++ .../should_fail/hasfieldfail01.hs | 9 ++ .../should_fail/hasfieldfail01.stderr | 11 ++ .../should_fail/hasfieldfail02.hs | 16 +++ .../should_fail/hasfieldfail02.stderr | 14 +++ .../should_fail/hasfieldfail03.hs | 39 ++++++ .../should_fail/hasfieldfail03.stderr | 21 ++++ .../should_fail/overloadedlabelsfail01.hs | 5 +- .../should_fail/overloadedlabelsfail01.stderr | 29 ++--- .../should_fail/overloadedlabelsfail02.hs | 3 + .../should_fail/overloadedlabelsfail02.stderr | 2 + .../should_fail/overloadedlabelsfail03.hs | 5 + .../should_fail/overloadedlabelsfail03.stderr | 10 ++ .../should_run/OverloadedLabelsRun04_A.hs | 2 +- .../tests/overloadedrecflds/should_run/T12243.hs | 25 ++++ .../overloadedrecflds/should_run/T12243.stdout | 2 + testsuite/tests/overloadedrecflds/should_run/all.T | 4 + .../overloadedrecflds/should_run/hasfieldrun01.hs | 34 ++++++ .../should_run/hasfieldrun01.stdout | 5 + .../overloadedrecflds/should_run/hasfieldrun02.hs | 12 ++ ...dedrecfldsrun06.stdout => hasfieldrun02.stdout} | 0 .../should_run/overloadedlabelsrun01.hs | 4 +- .../should_run/overloadedlabelsrun02.hs | 4 +- .../should_run/overloadedlabelsrun03.hs | 2 +- .../should_run/overloadedrecfldsrun07.hs | 42 +++++++ .../should_run/overloadedrecfldsrun07.stdout | 3 + 60 files changed, 709 insertions(+), 129 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0bf2da87c75e4fb61566a035a121196de57f15c4 From git at git.haskell.org Tue Nov 15 08:33:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 08:33:01 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Remove unnecessary extensions, in particular NoImplicitPrelude (c0ce340) Message-ID: <20161115083301.5BFBA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/c0ce34041d3eaa72e6f34a851aa9dc013caad9a8/ghc >--------------------------------------------------------------- commit c0ce34041d3eaa72e6f34a851aa9dc013caad9a8 Author: Adam Gundry Date: Tue Nov 15 08:30:03 2016 +0000 Remove unnecessary extensions, in particular NoImplicitPrelude See Note [Depend on GHC.Integer] for why this broke things. >--------------------------------------------------------------- c0ce34041d3eaa72e6f34a851aa9dc013caad9a8 libraries/base/GHC/OverloadedLabels.hs | 1 - libraries/base/GHC/Records.hs | 5 ----- 2 files changed, 6 deletions(-) diff --git a/libraries/base/GHC/OverloadedLabels.hs b/libraries/base/GHC/OverloadedLabels.hs index 30bd0fc..d2d13b4 100644 --- a/libraries/base/GHC/OverloadedLabels.hs +++ b/libraries/base/GHC/OverloadedLabels.hs @@ -3,7 +3,6 @@ , FlexibleInstances , KindSignatures , MultiParamTypeClasses - , NoImplicitPrelude , ScopedTypeVariables , TypeApplications #-} diff --git a/libraries/base/GHC/Records.hs b/libraries/base/GHC/Records.hs index 4c6aec9..753e9a2 100644 --- a/libraries/base/GHC/Records.hs +++ b/libraries/base/GHC/Records.hs @@ -1,13 +1,8 @@ {-# LANGUAGE AllowAmbiguousTypes - , DataKinds - , ExplicitForAll , FunctionalDependencies , KindSignatures , MultiParamTypeClasses - , NoImplicitPrelude , PolyKinds - , ScopedTypeVariables - , TypeApplications #-} ----------------------------------------------------------------------------- From git at git.haskell.org Tue Nov 15 08:33:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 08:33:04 +0000 (UTC) Subject: [commit: ghc] wip/hasfield's head updated: Remove unnecessary extensions, in particular NoImplicitPrelude (c0ce340) Message-ID: <20161115083304.AF58E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/hasfield' now includes: e660f4b Rework renaming of children in export lists. f2d80de Add trailing comma to fix the build. 21647bc Fix build 7b060e1 Generate a unique symbol for signature object stub files, fixes #12673 bcd3445 Do not segfault if no common root can be found 8dc72f3 Cleanup PosixSource.h 6c47f2e Default +RTS -qn to the number of cores 85e81a8 Turn on -n4m with -A16m or greater 1a9705c Escape lambda. b255ae7 Orient improvement constraints better b5c8963 Rename a parameter; trivial refactor 88eb773 Delete orphan where clause 76a5477 Move zonking out of tcFamTyPats cc5ca21 Improved stats for Trac #1969 a6111b8 More tests for Trac #12522 b5be2ec Add test case for #12689 f8d2c20 Add a broken test case for #12689 8fa5f5b Add derived shadows only for Wanted constraints d2959df Comments and equation ordering only bce9908 RnExpr: Actually fail if patterns found in expression 577effd testsuite: Bump T1969 allocations 184d7cb Add test for #12411 042c593 Add test for #12589 fef1df4 Add test for #12456 57f7a37 Add missing @since annotations 2fdf21b Further improve error handling in TcRn monad 015e9e3 Cabal submodule update. 1cccb64 Unique: Simplify encoding of sum uniques 34d933d Clean up handling of known-key Names in interface files 3991da4 MkIface: Turn a foldr into a foldl' aa06883 Improve find_lbl panic message 90df91a PrelInfo: Fix style 8c6a3d6 Add missing Semigroup instances for Monoidal datatypes in base d5a4e49 Make error when deriving an instance for a typeclass less misleading 3ce0e0b Build ghc-iserv with --export-dynamic 6c73932 Check for empty entity string in "prim" foreign imports 0d9524a Disable T-signals-child test on single-threaded runtime e39589e Fix Windows build following D2588 b501709 Fix Show derivation in the presence of RebindableSyntax/OverloadedStrings 512541b Add a forward reference for a Note afdde48 Correct name of makeStableName in haddock 3174beb Comments about -Wredundant-constraints 82b54fc Fix comment typo 692c8df Fix shadowing in mkWwBodies 609d2c8 Typo in comment a693d1c Correct order of existentials in pattern synonyms f7278a9 Fix wrapping order in matchExpectedConTy 1790762 Test Trac #12681 db71d97 Reduce trace output slightly 156db6b Add more variants of T3064 (in comments) a391a38 Comments only f43db14 Typos in comments 3adaacd Re-add accidentally-deleted line 9cb4459 testsuite: Work around #12554 deed418 testsuite: Mark break011 as broken 8b84b4f testsuite: Mark T10858 as broken on Windows 3325435 testsuite: Mark T9405 as broken on Windows 8bb960e testsuite/driver: Never symlink on Windows c6ee773 testsuite/timeout: Ensure that processes are cleaned up on Windows 17d696f validate: Allow user to override Python interpreter 7d2df32 testsuite/driver: More Unicode awareness 5b55e4b testsuite: Eliminate unnecessary compile_timeout_multiplier 2864ad7 testsuite/driver: Allow threading on Windows c5c6d80 testsuite: Mark T7037 as broken on Windows cf5eec3 Bump parallel submodule 8fa2cdb Track dep_finsts in exports hash, as it affects downstream deps. f148513 Add option to not retain CAFs to the linker API 1275994 remove unnecessary ifdef 46f5f02 fixup! Add option to not retain CAFs to the linker API 7129861 DynamicLoading: Replace map + zip with zipWith 161f463 ghc/Main.hs: Add import list to DynamicLoading fa8940e fix build failure on Solaris caused by usage of --export-dynamic a3bc93e Add some missing RTS symbols 3866481 Compute export hash based on ALL transitive orphan modules. 02f2f21 cmm/Hoopl/Dataflow: remove unused code 1f09c16 Test for newtype with unboxed argument 2cb8cc2 StgCmmPrim: Add missing write barrier. a6094fa configure.ac: Report Unregisterised setting 518f289 New story for abstract data types in hsig files. 7e77c4b Support constraint synonym implementations of abstract classes. 9df4ce4 Only delete instances when merging when there is an exact match. 01490b4 Mark previously failing backpack tests as passing, with correct output. c2142ca Fix Mac OS X build by removing space after ASSERT. c23dc61 check-cpp: Make it more robust ff225b4 Typos in comments 45bfd1a Refactor typechecking of pattern bindings 82efad7 Comments and trivial refactoring cdbc73a Test Trac #12507 d61c7e8 Make TcLevel increase by 1 not 2 3f5673f A collection of type-inference refactorings. 1f09b24 Accept 20% dedgradation in Trac #5030 compile time 9417e57 Refactor occurrence-check logic e1fc5a3 Define emitNewWantedEq, and use it 6ddba64 Improve TcCanonical.unifyWanted and unifyDerived f41a8a3 Add and use a new dynamic-library-dirs field in the ghc-pkg info acc9851 Fix failure in setnumcapabilities001 (#12728) 1050e46 rts: configure.ac should populate HAVE_LIBNUMA instead of USE_LIBNUMA a662f46 Skip T5611 on OSX as it fails non-deterministically. 3cb32d8 Add -Wcpp-undef warning flag 6e9a51c Refactoring: Delete copied function in backpack/NameShape b76cf04 cmm/Hoopl/Dataflow: minor cleanup aaede1e rts/package.conf.in: Fix CPP usage a6bcf87 Refactoring: Replace when (not ...) with unless in ErrUtils f084e68 rts: Move path utilities to separate source file 1c4a39d Prioritise class-level equality costraints 1221f81 Don't instantaite when typechecking a pattern synonym 08ba691 Take account of kinds in promoteTcType 03b0b8e Test Trac #12174 853cdae Test Trac #12081 a182c0e testsuite: Bump peak_megabytes_allocated for T3064 801c263 Fundeps work even for unary type classes 9f814b2 Delete extraneous backtick in users' guide 925d178 Make traceRn behave more like traceTc 488a9ed rts/linker: Move loadArchive to new source file 23143f6 Refine ASSERT in buildPatSyn for the nullary case. 48876ae Remove -dtrace-level b8effa7 CmmUtils: remove the last dataflow functions 3562727 Simple refactor to remove misleading comment f9308c2 Collect coercion variables, not type variables eefe86d Allow levity-polymorpic arrows 0eb8934 Fix typo in comment cc29eb5 Revert "rts/linker: Move loadArchive to new source file" 815b837 Minor doc addition as requested in #12774. 7187ded Clarify comments on kinds (Trac #12536) aae2b3d Make it possible to use +RTS -qn without -N 60343a4 Add test for #12732 5ebcb3a Document unpackClosure# primop 4b300a3 Minor refactoring in stg_unpackClosurezh 4e088b4 Fix a bug in parallel GC synchronisation 7ddbdfd Zap redundant imports 80d4a03 Typos in comments 795be0e Align GHCi's library search order more closely with LDs 0b70ec0 Have static pointers work with -fno-full-laziness. 19ce8a5 Sparc*: Prevent GHC from doing unaligned accesses 79fb6e6 Tiny refactor 9968949 Get rid of TcTyVars more assiduously 7a50966 Simplify the API for TcHsType.kcHsTyVarBndrs f4a14d6 Use substTyUnchecked in TcMType.new_meta_tv_x 13508ba Fix Trac #12797: approximateWC 623b8e4 Renaming and comments in CorePrep 8a5960a Uninstall signal handlers cc4710a testsuite: Simplify kernel32 glue logic f4fb3bc linker: Split out CacheFlush logic abfa319 linker: Shuffle configuration into LinkerInternals.h 43c8c1c linker: Move mmapForLinker declaration into LinkerInternals.h 3f05126 linker: Split symbol extras logic into new source file c3446c6 Shuffle declarations into LinkerInternals.h 6ea0b4f linker: Split PEi386 implementation into new source file f6c47df linker: Split MachO implementation into new source file bdc262c linker: Split ELF implementation into separate source file 6fecb7e linker: Move ARM interworking note to SymbolExtras.c dc4d596 Hoopl/Dataflow: make the module more self-contained 80076fa Add notes describing SRT concepts b5460dd Add testcase for #12757 967dd5c Merge cpe_ExprIsTrivial and exprIsTrivial eaa3482 testsuite: Update T10858 allocations ec22bac Add test for #12788 f46bfeb API Annotations: make all ModuleName Located a977c96 Omit unnecessary linker flags e43f05b Add comments from Trac #12768 7b0ae41 Remove a debug trace 2cdd9bd Take account of injectivity when doing fundeps b012120 Handle types w/ type variables in signatures inside patterns (DsMeta) 1cab42d Update release notes for type sigs in TH patterns patch 1c886ea Stop -dno-debug-output suppressing -ddump-tc-trace 25c8e80 Add tracing infrastructure to pattern match checker 630d881 Allow GeneralizedNewtypeDeriving for classes with associated type families ead83db Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes 1964d86 Some minor linker cleanups. 7d988dd Fix broken validate build. 91f9e13 Fix hs_try_putmvar003 (#12800) 2e8463b Update 8.0.2 release notes for #12784 2325afe Fix comment about pointer tagging 7fe7163 Adapt the (commented out) pprTrace in OccurAnal f05d685 Refactoring of mkNewTypeEqn 317236d Refactor CallStack defaulting slightly 500d90d ghc-cabal: Use correct name of linker flags env variable 816d2e4 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS 9030d8e configure: Pass HC_OPTS_STAGEx to build system bae4a55 Pass -no-pie to GCC 0a122a4 testsuite: Update allocation numbers for T5631 e06e21a Add Richard Eisenberg's new email to mailmap bef7e78 Read parentheses better 122d826 rts: Add api to pin a thread to a numa node but without fixing a capability aa10c67 rts/linker: Move loadArchive to new source file e8ae4dc Update user's guide after D2490 03e8d26 Prevent GND from inferring an instance context for method-less classes 60bb9d1 Revert "Pass -no-pie to GCC" 7a7bb5d Revert "Refactor CallStack defaulting slightly" ec0bf81 rts: Fix LoadArchive on OS X d421a7e Pass -no-pie to GCC 46e2bef testsuite: Lower allocations for T876 7eae862 ghc-pkg: Munge dynamic library directories 2cfbee8 rts: Fix build when linked with gold 4e0b8f4 rts: Fix #include of 587dccc Make default output less verbose (source/object paths) 568e003 template-haskell: Version bump ca1b986 ghc: Fix ghc's template-haskell bound 8cb7bc5 rts: Fix references to UChar 6c0f10f Kill Type pretty-printer 55d535d Remove CONSTR_STATIC 034e01e Accept output for scc003 e0ca7ff Fix numa001 failure with "too many NUMA nodes" cb16890 testsuite: Fix creep of T4029 011af2b configure: Verify that GCC recognizes -no-pie flag 0bf2da8 Implement OverloadedRecordFields and modify OverloadedLabels c0ce340 Remove unnecessary extensions, in particular NoImplicitPrelude From git at git.haskell.org Tue Nov 15 10:10:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 10:10:25 +0000 (UTC) Subject: [commit: ghc] master: Hopefully fix build on OS X (98f9759) Message-ID: <20161115101025.BB0C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/98f975961b9db2c2f308295c303028b97bc3239b/ghc >--------------------------------------------------------------- commit 98f975961b9db2c2f308295c303028b97bc3239b Author: Simon Marlow Date: Mon Nov 14 15:36:38 2016 +0000 Hopefully fix build on OS X Summary: It looks like I broke the OS X build with 55d535da10dd, hopefully this should fix it. Test Plan: Harbourmaster Reviewers: austin, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2705 GHC Trac Issues: #12455 >--------------------------------------------------------------- 98f975961b9db2c2f308295c303028b97bc3239b rts/package.conf.in | 68 ++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/rts/package.conf.in b/rts/package.conf.in index 49c572b..17d579f 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -72,28 +72,22 @@ cc-options: ld-options: #ifdef LEADING_UNDERSCORE - "-Wl,-u,_ghczmprim_GHCziTypes_Izh_static_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Czh_static_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_static_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_static_info" - , "-Wl,-u,_base_GHCziPtr_Ptr_static_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Wzh_static_info" - , "-Wl,-u,_base_GHCziInt_I8zh_static_info" - , "-Wl,-u,_base_GHCziInt_I16zh_static_info" - , "-Wl,-u,_base_GHCziInt_I32zh_static_info" - , "-Wl,-u,_base_GHCziInt_I64zh_static_info" - , "-Wl,-u,_base_GHCziWord_W8zh_static_info" - , "-Wl,-u,_base_GHCziWord_W16zh_static_info" - , "-Wl,-u,_base_GHCziWord_W32zh_static_info" - , "-Wl,-u,_base_GHCziWord_W64zh_static_info" - , "-Wl,-u,_base_GHCziStable_StablePtr_static_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info" - , "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info" - , "-Wl,-u,_base_GHCziPtr_Ptr_con_info" + "-Wl,-u,_base_GHCziInt_I16zh_con_info" + , "-Wl,-u,_base_GHCziInt_I32zh_con_info" + , "-Wl,-u,_base_GHCziInt_I64zh_con_info" + , "-Wl,-u,_base_GHCziInt_I8zh_con_info" , "-Wl,-u,_base_GHCziPtr_FunPtr_con_info" + , "-Wl,-u,_base_GHCziPtr_Ptr_con_info" , "-Wl,-u,_base_GHCziStable_StablePtr_con_info" + , "-Wl,-u,_base_GHCziWord_W16zh_con_info" + , "-Wl,-u,_base_GHCziWord_W32zh_con_info" + , "-Wl,-u,_base_GHCziWord_W64zh_con_info" + , "-Wl,-u,_base_GHCziWord_W8zh_con_info" + , "-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info" + , "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info" + , "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info" + , "-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info" + , "-Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info" , "-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure" , "-Wl,-u,_ghczmprim_GHCziTypes_False_closure" , "-Wl,-u,_ghczmprim_GHCziTypes_True_closure" @@ -169,28 +163,22 @@ ld-options: , "-Wl,-u,_hs_atomicwrite64" #endif #else - "-Wl,-u,ghczmprim_GHCziTypes_Izh_static_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Czh_static_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Fzh_static_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Dzh_static_info" - , "-Wl,-u,base_GHCziPtr_Ptr_static_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Wzh_static_info" - , "-Wl,-u,base_GHCziInt_I8zh_static_info" - , "-Wl,-u,base_GHCziInt_I16zh_static_info" - , "-Wl,-u,base_GHCziInt_I32zh_static_info" - , "-Wl,-u,base_GHCziInt_I64zh_static_info" - , "-Wl,-u,base_GHCziWord_W8zh_static_info" - , "-Wl,-u,base_GHCziWord_W16zh_static_info" - , "-Wl,-u,base_GHCziWord_W32zh_static_info" - , "-Wl,-u,base_GHCziWord_W64zh_static_info" - , "-Wl,-u,base_GHCziStable_StablePtr_static_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info" - , "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info" - , "-Wl,-u,base_GHCziPtr_Ptr_con_info" + "-Wl,-u,base_GHCziInt_I16zh_con_info" + , "-Wl,-u,base_GHCziInt_I32zh_con_info" + , "-Wl,-u,base_GHCziInt_I64zh_con_info" + , "-Wl,-u,base_GHCziInt_I8zh_con_info" , "-Wl,-u,base_GHCziPtr_FunPtr_con_info" + , "-Wl,-u,base_GHCziPtr_Ptr_con_info" , "-Wl,-u,base_GHCziStable_StablePtr_con_info" + , "-Wl,-u,base_GHCziWord_W16zh_con_info" + , "-Wl,-u,base_GHCziWord_W32zh_con_info" + , "-Wl,-u,base_GHCziWord_W64zh_con_info" + , "-Wl,-u,base_GHCziWord_W8zh_con_info" + , "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info" + , "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info" + , "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info" + , "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info" + , "-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info" , "-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure" , "-Wl,-u,ghczmprim_GHCziTypes_False_closure" , "-Wl,-u,ghczmprim_GHCziTypes_True_closure" From git at git.haskell.org Tue Nov 15 12:43:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 12:43:47 +0000 (UTC) Subject: [commit: ghc] master: Mark T12041 as expect_broken with -DDEBUG (#12826) (642adec) Message-ID: <20161115124347.A65573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/642adec4da8df4ae39b884b30c47284a3c9d0f30/ghc >--------------------------------------------------------------- commit 642adec4da8df4ae39b884b30c47284a3c9d0f30 Author: Simon Marlow Date: Tue Nov 15 10:40:24 2016 +0000 Mark T12041 as expect_broken with -DDEBUG (#12826) >--------------------------------------------------------------- 642adec4da8df4ae39b884b30c47284a3c9d0f30 testsuite/tests/indexed-types/should_fail/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 4b0e994..8403ea8 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -137,5 +137,6 @@ test('T10899', normal, compile_fail, ['']) test('T11136', normal, compile_fail, ['']) test('T7788', normal, compile_fail, ['']) test('T11450', normal, compile_fail, ['']) -test('T12041', normal, compile_fail, ['']) +test('T12041', when(compiler_debugged(), expect_broken(12826)), + compile_fail, ['']) test('T12522a', normal, compile_fail, ['']) From git at git.haskell.org Tue Nov 15 12:47:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 12:47:23 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Fix test output (08ac91d) Message-ID: <20161115124723.15F273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/08ac91d76a0906152d69d4138b3824d74cebd9db/ghc >--------------------------------------------------------------- commit 08ac91d76a0906152d69d4138b3824d74cebd9db Author: Adam Gundry Date: Tue Nov 15 12:43:59 2016 +0000 Fix test output >--------------------------------------------------------------- 08ac91d76a0906152d69d4138b3824d74cebd9db .../tests/overloadedrecflds/should_fail/hasfieldfail03.stderr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail03.stderr b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail03.stderr index 2fb8dbd..71192b2 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail03.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail03.stderr @@ -1,20 +1,20 @@ -hasfieldfail03.hs:8:10: error: +hasfieldfail03.hs:9:10: error: • Illegal instance declaration for ‘HasField "woo" a Bool’ Record data type must be specified • In the instance declaration for ‘HasField "woo" a Bool’ -hasfieldfail03.hs:12:10: error: +hasfieldfail03.hs:13:10: error: • Illegal instance declaration for ‘HasField "foo" T Int’ T already has a field ‘foo’ • In the instance declaration for ‘HasField "foo" T Int’ -hasfieldfail03.hs:16:10: error: +hasfieldfail03.hs:17:10: error: • Illegal instance declaration for ‘HasField "bar" T Bool’ T already has a field ‘bar’ • In the instance declaration for ‘HasField "bar" T Bool’ -hasfieldfail03.hs:33:10: error: +hasfieldfail03.hs:34:10: error: • Illegal instance declaration for ‘HasField "baz" (V a b c d) Bool’ Record data type may not be a data family From git at git.haskell.org Tue Nov 15 15:12:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 15:12:48 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments, notes and manual (017d11e) Message-ID: <20161115151248.6F44D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/017d11e0a36866b05ace32ece1af11adf652a619/ghc >--------------------------------------------------------------- commit 017d11e0a36866b05ace32ece1af11adf652a619 Author: Gabor Greif Date: Mon Nov 14 17:57:09 2016 +0100 Typos in comments, notes and manual >--------------------------------------------------------------- 017d11e0a36866b05ace32ece1af11adf652a619 compiler/coreSyn/CoreUtils.hs | 2 +- compiler/typecheck/TcExpr.hs | 4 ++-- compiler/typecheck/TcFlatten.hs | 2 +- compiler/typecheck/TcGenDeriv.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcMType.hs | 2 +- compiler/typecheck/TcSimplify.hs | 4 ++-- compiler/typecheck/TcUnify.hs | 2 +- compiler/vectorise/Vectorise.hs | 2 +- docs/users_guide/glasgow_exts.rst | 6 +++--- testsuite/tests/typecheck/should_fail/tcfail174.hs | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 017d11e0a36866b05ace32ece1af11adf652a619 From git at git.haskell.org Tue Nov 15 21:59:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 21:59:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump base library version (1da19e4) Message-ID: <20161115215926.092E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/1da19e4f63fe9c16e0ad20e4004f9d60c0bdabc8/ghc >--------------------------------------------------------------- commit 1da19e4f63fe9c16e0ad20e4004f9d60c0bdabc8 Author: Ben Gamari Date: Tue Nov 15 10:29:08 2016 -0500 Bump base library version >--------------------------------------------------------------- 1da19e4f63fe9c16e0ad20e4004f9d60c0bdabc8 libraries/base/base.cabal | 2 +- testsuite/tests/ado/ado004.stderr | 2 +- testsuite/tests/determinism/determ021/determ021.stdout | 4 ++-- testsuite/tests/ghci/scripts/ghci008.stdout | 4 ++-- .../tests/indexed-types/should_compile/T3017.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr3.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr4.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr5.stderr | 4 ++-- .../tests/partial-sigs/should_compile/AddAndOr6.stderr | 4 ++-- .../tests/partial-sigs/should_compile/BoolToBool.stderr | 4 ++-- .../should_compile/DataFamilyInstanceLHS.stderr | 2 +- .../partial-sigs/should_compile/Defaulting1MROn.stderr | 4 ++-- .../partial-sigs/should_compile/Defaulting2MROff.stderr | 2 +- .../partial-sigs/should_compile/Defaulting2MROn.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Either.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Every.stderr | 4 ++-- .../tests/partial-sigs/should_compile/EveryNamed.stderr | 2 +- .../partial-sigs/should_compile/ExpressionSig.stderr | 4 ++-- .../should_compile/ExpressionSigNamed.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints1.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints2.stderr | 4 ++-- .../partial-sigs/should_compile/ExtraConstraints3.stderr | 2 +- .../partial-sigs/should_compile/ExtraNumAMROff.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Forall1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/GenNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/HigherRank1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/HigherRank2.stderr | 4 ++-- .../should_compile/LocalDefinitionBug.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Meltdown.stderr | 2 +- .../partial-sigs/should_compile/MonoLocalBinds.stderr | 4 ++-- .../tests/partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../NamedWildcardInDataFamilyInstanceLHS.stderr | 2 +- .../NamedWildcardInTypeFamilyInstanceLHS.stderr | 2 +- .../should_compile/ParensAroundContext.stderr | 4 ++-- .../tests/partial-sigs/should_compile/PatBind.stderr | 4 ++-- .../tests/partial-sigs/should_compile/PatternSig.stderr | 4 ++-- .../tests/partial-sigs/should_compile/Recursive.stderr | 4 ++-- .../should_compile/ScopedNamedWildcards.stderr | 4 ++-- .../should_compile/ScopedNamedWildcardsGood.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ShowNamed.stderr | 2 +- .../tests/partial-sigs/should_compile/SimpleGen.stderr | 2 +- .../tests/partial-sigs/should_compile/SkipMany.stderr | 2 +- .../partial-sigs/should_compile/SomethingShowable.stderr | 5 ++--- .../should_compile/TypeFamilyInstanceLHS.stderr | 2 +- .../tests/partial-sigs/should_compile/Uncurry.stderr | 2 +- .../partial-sigs/should_compile/UncurryNamed.stderr | 2 +- .../should_compile/WarningWildcardInstantiations.stderr | 2 +- testsuite/tests/rename/should_fail/rnfail040.stderr | 4 ++-- testsuite/tests/roles/should_compile/Roles1.stderr | 2 +- testsuite/tests/roles/should_compile/Roles14.stderr | 2 +- testsuite/tests/roles/should_compile/Roles2.stderr | 2 +- testsuite/tests/roles/should_compile/Roles3.stderr | 2 +- testsuite/tests/roles/should_compile/Roles4.stderr | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 4 ++-- testsuite/tests/safeHaskell/check/Check06.stderr | 4 ++-- testsuite/tests/safeHaskell/check/Check08.stderr | 4 ++-- testsuite/tests/safeHaskell/check/Check09.stderr | 8 ++++---- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 4 ++-- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 4 ++-- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 4 ++-- testsuite/tests/typecheck/should_compile/T12763.stderr | 2 +- testsuite/tests/typecheck/should_compile/tc231.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 16 ++++++++-------- 67 files changed, 113 insertions(+), 114 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1da19e4f63fe9c16e0ad20e4004f9d60c0bdabc8 From git at git.haskell.org Tue Nov 15 22:00:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 22:00:24 +0000 (UTC) Subject: [commit: packages/array] master: Bump upper bound on base (bab2c23) Message-ID: <20161115220024.2A20E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/bab2c234f176fe3e95443cbe4387833da22f7e5d >--------------------------------------------------------------- commit bab2c234f176fe3e95443cbe4387833da22f7e5d Author: Ben Gamari Date: Tue Nov 15 12:33:45 2016 -0500 Bump upper bound on base >--------------------------------------------------------------- bab2c234f176fe3e95443cbe4387833da22f7e5d array.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/array.cabal b/array.cabal index d5dd036..91343e1 100644 --- a/array.cabal +++ b/array.cabal @@ -37,7 +37,7 @@ library Trustworthy, UnboxedTuples, UnliftedFFITypes - build-depends: base >= 4.5 && < 4.10 + build-depends: base >= 4.5 && < 4.11 ghc-options: -Wall exposed-modules: Data.Array From git at git.haskell.org Tue Nov 15 22:24:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 22:24:28 +0000 (UTC) Subject: [commit: packages/hpc] master: Bump upper bound on base (2ddcb82) Message-ID: <20161115222428.597723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/2ddcb82fa532b0c1db5222f2e13c8232de27db52 >--------------------------------------------------------------- commit 2ddcb82fa532b0c1db5222f2e13c8232de27db52 Author: Ben Gamari Date: Tue Nov 15 12:54:18 2016 -0500 Bump upper bound on base >--------------------------------------------------------------- 2ddcb82fa532b0c1db5222f2e13c8232de27db52 hpc.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hpc.cabal b/hpc.cabal index 7e77973..6ae6aa9 100644 --- a/hpc.cabal +++ b/hpc.cabal @@ -35,7 +35,7 @@ Library Trace.Hpc.Reflect Build-Depends: - base >= 4.4.1 && < 4.10, + base >= 4.4.1 && < 4.11, containers >= 0.4.1 && < 0.6, directory >= 1.1 && < 1.3, filepath >= 1 && < 1.5, From git at git.haskell.org Tue Nov 15 22:37:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 15 Nov 2016 22:37:36 +0000 (UTC) Subject: [commit: packages/stm] master: Bump upper bound on base (9c3c3bb) Message-ID: <20161115223736.8ACBB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/stm On branch : master Link : http://git.haskell.org/packages/stm.git/commitdiff/9c3c3bb28834d1ba9574be7f887c8914afd4232c >--------------------------------------------------------------- commit 9c3c3bb28834d1ba9574be7f887c8914afd4232c Author: Ben Gamari Date: Tue Nov 15 14:38:10 2016 -0500 Bump upper bound on base >--------------------------------------------------------------- 9c3c3bb28834d1ba9574be7f887c8914afd4232c stm.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stm.cabal b/stm.cabal index 9378d29..de07d2b 100644 --- a/stm.cabal +++ b/stm.cabal @@ -34,7 +34,7 @@ library other-extensions: Safe build-depends: - base >= 4.3 && < 4.10, + base >= 4.3 && < 4.11, array >= 0.3 && < 0.6 exposed-modules: From git at git.haskell.org Wed Nov 16 00:40:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 00:40:54 +0000 (UTC) Subject: [commit: ghc] master: fixup! Stop the simplifier from removing StaticPtr binds. (31d5b6e) Message-ID: <20161116004054.A9BA03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31d5b6efa24985d0a8be5354e6a9a38e016db0ff/ghc >--------------------------------------------------------------- commit 31d5b6efa24985d0a8be5354e6a9a38e016db0ff Author: Facundo Domínguez Date: Tue Nov 15 21:39:40 2016 -0300 fixup! Stop the simplifier from removing StaticPtr binds. >--------------------------------------------------------------- 31d5b6efa24985d0a8be5354e6a9a38e016db0ff compiler/simplCore/SetLevels.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index fc55564..f2f373d 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -1115,7 +1115,8 @@ newLvlVar lvld_rhs is_bot rhs_ty = exprType de_tagged_rhs mk_id uniq -- See Note [Grand plan for static forms] in SimplCore. - | isJust (collectStaticPtrSatArgs lvld_rhs) + | isJust $ collectStaticPtrSatArgs $ snd $ collectTyBinders $ + deTagExpr lvld_rhs = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise From git at git.haskell.org Wed Nov 16 04:08:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 04:08:45 +0000 (UTC) Subject: [commit: ghc] master: Test for unnecessary register spills (0e58652) Message-ID: <20161116040845.8E9A03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0e5865294fb810afa15b20e489e1791ead7643fa/ghc >--------------------------------------------------------------- commit 0e5865294fb810afa15b20e489e1791ead7643fa Author: Thomas Jakway Date: Tue Nov 15 21:59:28 2016 -0500 Test for unnecessary register spills Reviewers: mainland, simonmar, michalt, bgamari, austin Reviewed By: bgamari Subscribers: simonpj, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2638 GHC Trac Issues: #12744, #12745 >--------------------------------------------------------------- 0e5865294fb810afa15b20e489e1791ead7643fa compiler/nativeGen/AsmCodeGen.hs | 13 +- testsuite/tests/{ado => regalloc}/Makefile | 0 testsuite/tests/regalloc/all.T | 4 + testsuite/tests/regalloc/no_spills.cmm | 15 ++ testsuite/tests/regalloc/regalloc_unit_tests.hs | 206 +++++++++++++++++++++ .../tests/regalloc/regalloc_unit_tests.stdout | 1 + 6 files changed, 238 insertions(+), 1 deletion(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0e5865294fb810afa15b20e489e1791ead7643fa From git at git.haskell.org Wed Nov 16 04:08:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 04:08:48 +0000 (UTC) Subject: [commit: ghc] master: Update xhtml submodule (4a835f0) Message-ID: <20161116040848.4574E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4a835f0890b4848b32129ab11ceb29cb0a0769f6/ghc >--------------------------------------------------------------- commit 4a835f0890b4848b32129ab11ceb29cb0a0769f6 Author: Erik de Castro Lopo Date: Tue Nov 15 22:00:13 2016 -0500 Update xhtml submodule Test Plan: validate Reviewers: hvr, austin, Phyx, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2701 >--------------------------------------------------------------- 4a835f0890b4848b32129ab11ceb29cb0a0769f6 libraries/xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/xhtml b/libraries/xhtml index fb9e0bb..45e5cb8 160000 --- a/libraries/xhtml +++ b/libraries/xhtml @@ -1 +1 @@ -Subproject commit fb9e0bbb69e15873682a9f25d39652099a3ccac1 +Subproject commit 45e5cb820a129780407bc37968364e4f64174f7d From git at git.haskell.org Wed Nov 16 04:08:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 04:08:51 +0000 (UTC) Subject: [commit: ghc] master: Don't use mmap symbols when !RTS_LINKER_USE_MMAP (a637eeb) Message-ID: <20161116040851.189E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a637eeb7a1852adfd99b06d2c0a3496e4f238a0c/ghc >--------------------------------------------------------------- commit a637eeb7a1852adfd99b06d2c0a3496e4f238a0c Author: Shea Levy Date: Tue Nov 15 22:01:20 2016 -0500 Don't use mmap symbols when !RTS_LINKER_USE_MMAP Some usages of symbols from sys/mman.h are guarded by RTS_LINKER_USE_MMAP by C conditionals, not CPP conditionals. Since those branches are dead anyway when !RTS_LINKER_USE_MMAP, we just stub out the relevant symbols rather than increasing CPP branching. Fixes #12839. Reviewers: simonmar, austin, bgamari, erikd Reviewed By: simonmar, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2710 GHC Trac Issues: #12839 >--------------------------------------------------------------- a637eeb7a1852adfd99b06d2c0a3496e4f238a0c rts/LinkerInternals.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 60370bb..4806d53 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -303,4 +303,14 @@ char *cstring_from_section_name( # define OBJFORMAT_MACHO #endif +/* In order to simplify control flow a bit, some references to mmap-related + definitions are blocked off by a C-level if statement rather than a CPP-level + #if statement. Since those are dead branches when !RTS_LINKER_USE_MMAP, we + just stub out the relevant symbols here +*/ +#if !RTS_LINKER_USE_MMAP +#define munmap(x,y) /* nothing */ +#define MAP_ANONYMOUS 0 +#endif + #endif /* LINKERINTERNALS_H */ From git at git.haskell.org Wed Nov 16 04:08:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 04:08:53 +0000 (UTC) Subject: [commit: ghc] master: Storage.c: Pass a size to sys_icache_invalidate (0135188) Message-ID: <20161116040853.C9C3B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0135188fecfc679a498093f8fc5f665d706fa4cb/ghc >--------------------------------------------------------------- commit 0135188fecfc679a498093f8fc5f665d706fa4cb Author: Shea Levy Date: Tue Nov 15 22:01:56 2016 -0500 Storage.c: Pass a size to sys_icache_invalidate The previous code passed an end pointer, but the interface takes a size instead. Fixes #12838. Reviewers: austin, erikd, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2711 GHC Trac Issues: #12838 >--------------------------------------------------------------- 0135188fecfc679a498093f8fc5f665d706fa4cb rts/sm/Storage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 357e018..da1acbc 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1314,7 +1314,7 @@ calcNeeded (rtsBool force_major, memcount *blocks_needed) ------------------------------------------------------------------------- */ #if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && defined(ios_HOST_OS) -void sys_icache_invalidate(void *start, size_t len); +#include #endif /* On ARM and other platforms, we need to flush the cache after @@ -1327,7 +1327,7 @@ void flushExec (W_ len, AdjustorExecutable exec_addr) (void)exec_addr; #elif (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && defined(ios_HOST_OS) /* On iOS we need to use the special 'sys_icache_invalidate' call. */ - sys_icache_invalidate(exec_addr, ((unsigned char*)exec_addr)+len); + sys_icache_invalidate(exec_addr, len); #elif defined(__GNUC__) /* For all other platforms, fall back to a libgcc builtin. */ unsigned char* begin = (unsigned char*)exec_addr; From git at git.haskell.org Wed Nov 16 14:31:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 14:31:17 +0000 (UTC) Subject: [commit: ghc] master: Avoid calling newDynFlags when there are no changes (7acee06) Message-ID: <20161116143117.63CD83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7acee066c210cd469836da32375988e5ee2b32ff/ghc >--------------------------------------------------------------- commit 7acee066c210cd469836da32375988e5ee2b32ff Author: Simon Marlow Date: Tue Nov 15 17:19:04 2016 +0000 Avoid calling newDynFlags when there are no changes This is a small optimisation for :set and :unset >--------------------------------------------------------------- 7acee066c210cd469836da32375988e5ee2b32ff ghc/GHCi/UI.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 3fe42d2..d3c62e6 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -2564,7 +2564,7 @@ setOptions wds = let (plus_opts, minus_opts) = partitionWith isPlus wds mapM_ setOpt plus_opts -- then, dynamic flags - newDynFlags False minus_opts + when (not (null minus_opts)) $ newDynFlags False minus_opts packageFlagsChanged :: DynFlags -> DynFlags -> Bool packageFlagsChanged idflags1 idflags0 = @@ -2661,7 +2661,7 @@ unsetOptions str mapM_ unsetOpt plus_opts no_flags <- mapM no_flag minus_opts - newDynFlags False no_flags + when (not (null no_flags)) $ newDynFlags False no_flags isMinus :: String -> Bool isMinus ('-':_) = True From git at git.haskell.org Wed Nov 16 14:31:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 14:31:20 +0000 (UTC) Subject: [commit: ghc] master: Generalise the implicit prelude import (d3542fa) Message-ID: <20161116143120.179463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d3542fad4b72b807dd1ece415a903fb08f1e490f/ghc >--------------------------------------------------------------- commit d3542fad4b72b807dd1ece415a903fb08f1e490f Author: Simon Marlow Date: Wed Nov 16 12:47:36 2016 +0000 Generalise the implicit prelude import Now it's possible to have two lists of imports: * extra_imports are imports that are always added to the context * prelude_imports are imports that are added if we don't have any open modules in scope. No UI changes or new commands are added for now. This was functionality that we needed in our customized GHCi at Facebook, so I wanted to get it upstream to reduce the differences between our version and the upstream version. >--------------------------------------------------------------- d3542fad4b72b807dd1ece415a903fb08f1e490f ghc/GHCi/UI.hs | 62 +++++++++++++++++++++++++++++++++++++--------------- ghc/GHCi/UI/Monad.hs | 22 +++++++++++++++++++ 2 files changed, 66 insertions(+), 18 deletions(-) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index d3c62e6..29f4238 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -448,6 +448,7 @@ interactiveUI config srcs maybe_exprs = do default_editor <- liftIO $ findEditor eval_wrapper <- mkEvalWrapper default_progname default_args + let prelude_import = simpleImportDecl preludeModuleName startGHCi (runGHCi srcs maybe_exprs) GHCiState{ progname = default_progname, args = default_args, @@ -470,6 +471,8 @@ interactiveUI config srcs maybe_exprs = do cmdqueue = [], remembered_ctx = [], transient_ctx = [], + extra_imports = [], + prelude_imports = [prelude_import], ghc_e = isJust maybe_exprs, short_help = shortHelpText config, long_help = fullHelpText config, @@ -2315,13 +2318,33 @@ setGHCContextFromGHCiState = do -- the actual exception thrown by checkAdd, using tryBool to -- turn it into a Bool. iidecls <- filterM (tryBool.checkAdd) (transient_ctx st ++ remembered_ctx st) - dflags <- GHC.getSessionDynFlags - GHC.setContext $ - if xopt LangExt.ImplicitPrelude dflags && not (any isPreludeImport iidecls) - then iidecls ++ [implicitPreludeImport] - else iidecls - -- XXX put prel at the end, so that guessCurrentModule doesn't pick it up. + prel_iidecls <- getImplicitPreludeImports iidecls + valid_prel_iidecls <- filterM (tryBool . checkAdd) prel_iidecls + + extra_imports <- filterM (tryBool . checkAdd) (map IIDecl (extra_imports st)) + + GHC.setContext $ iidecls ++ extra_imports ++ valid_prel_iidecls + + +getImplicitPreludeImports :: [InteractiveImport] -> GHCi [InteractiveImport] +getImplicitPreludeImports iidecls = do + dflags <- GHC.getInteractiveDynFlags + -- allow :seti to override -XNoImplicitPrelude + st <- getGHCiState + + -- We add the prelude imports if there are no *-imports, and we also + -- allow each prelude import to be subsumed by another explicit import + -- of the same module. This means that you can override the prelude import + -- with "import Prelude hiding (map)", for example. + let prel_iidecls = + if xopt LangExt.ImplicitPrelude dflags && not (any isIIModule iidecls) + then [ IIDecl imp + | imp <- prelude_imports st + , not (any (sameImpModule imp) iidecls) ] + else [] + + return prel_iidecls -- ----------------------------------------------------------------------------- -- Utils on InteractiveImport @@ -2335,6 +2358,10 @@ mkIIDecl = IIDecl . simpleImportDecl iiModules :: [InteractiveImport] -> [ModuleName] iiModules is = [m | IIModule m <- is] +isIIModule :: InteractiveImport -> Bool +isIIModule (IIModule _) = True +isIIModule _ = False + iiModuleName :: InteractiveImport -> ModuleName iiModuleName (IIModule m) = m iiModuleName (IIDecl d) = unLoc (ideclName d) @@ -2342,12 +2369,9 @@ iiModuleName (IIDecl d) = unLoc (ideclName d) preludeModuleName :: ModuleName preludeModuleName = GHC.mkModuleName "Prelude" -implicitPreludeImport :: InteractiveImport -implicitPreludeImport = IIDecl (simpleImportDecl preludeModuleName) - -isPreludeImport :: InteractiveImport -> Bool -isPreludeImport (IIModule {}) = True -isPreludeImport (IIDecl d) = unLoc (ideclName d) == preludeModuleName +sameImpModule :: ImportDecl RdrName -> InteractiveImport -> Bool +sameImpModule _ (IIModule _) = False -- we only care about imports here +sameImpModule imp (IIDecl d) = unLoc (ideclName d) == unLoc (ideclName imp) addNotSubsumed :: InteractiveImport -> [InteractiveImport] -> [InteractiveImport] @@ -2765,15 +2789,17 @@ showImports = do = ":module +*" ++ moduleNameString star_m show_one (IIDecl imp) = showPpr dflags imp - prel_imp - | any isPreludeImport (rem_ctx ++ trans_ctx) = [] - | not (xopt LangExt.ImplicitPrelude dflags) = [] - | otherwise = ["import Prelude -- implicit"] + prel_iidecls <- getImplicitPreludeImports (rem_ctx ++ trans_ctx) + + let show_prel p = show_one p ++ " -- implicit" + show_extra p = show_one (IIDecl p) ++ " -- fixed" trans_comment s = s ++ " -- added automatically" :: String -- - liftIO $ mapM_ putStrLn (prel_imp ++ map show_one rem_ctx - ++ map (trans_comment . show_one) trans_ctx) + liftIO $ mapM_ putStrLn (map show_one rem_ctx ++ + map (trans_comment . show_one) trans_ctx ++ + map show_prel prel_iidecls ++ + map show_extra (extra_imports st)) showModules :: GHCi () showModules = do diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs index 260d92c..244595b 100644 --- a/ghc/GHCi/UI/Monad.hs +++ b/ghc/GHCi/UI/Monad.hs @@ -44,6 +44,8 @@ import SrcLoc import Module import GHCi import GHCi.RemoteTypes +import HsSyn (ImportDecl) +import RdrName (RdrName) import Exception import Numeric @@ -106,6 +108,26 @@ data GHCiState = GHCiState -- :load, :reload, and :add. In between it may be modified -- by :module. + extra_imports :: [ImportDecl RdrName], + -- ^ These are "always-on" imports, added to the + -- context regardless of what other imports we have. + -- This is useful for adding imports that are required + -- by setGHCiMonad. Be careful adding things here: + -- you can create ambiguities if these imports overlap + -- with other things in scope. + -- + -- NB. although this is not currently used by GHCi itself, + -- it was added to support other front-ends that are based + -- on the GHCi code. Potentially we could also expose + -- this functionality via GHCi commands. + + prelude_imports :: [ImportDecl RdrName], + -- ^ These imports are added to the context when + -- -XImplicitPrelude is on and we don't have a *-module + -- in the context. They can also be overridden by another + -- import for the same module, e.g. + -- "import Prelude hiding (map)" + ghc_e :: Bool, -- ^ True if this is 'ghc -e' (or runghc) short_help :: String, From git at git.haskell.org Wed Nov 16 14:31:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 14:31:23 +0000 (UTC) Subject: [commit: ghc] master: Fix -fobject-code with -fexternal-interpreter (fa70b1e) Message-ID: <20161116143123.5D8B23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa70b1ec2e4638886e610279857c1c7529d6a361/ghc >--------------------------------------------------------------- commit fa70b1ec2e4638886e610279857c1c7529d6a361 Author: Simon Marlow Date: Tue Nov 15 16:49:33 2016 +0000 Fix -fobject-code with -fexternal-interpreter If the user does :cd in GHCi with -fexternal-interpreter, then we can fail to find the object files. >--------------------------------------------------------------- fa70b1ec2e4638886e610279857c1c7529d6a361 compiler/ghci/GHCi.hs | 18 +++++++++++++++--- testsuite/driver/extra_files.py | 1 + testsuite/tests/ghci/scripts/all.T | 1 + testsuite/tests/ghci/scripts/ghci062.script | 9 +++++++++ .../tests/ghci/scripts/ghci062.stdout | 0 testsuite/tests/ghci/scripts/ghci062/Test.hs | 3 +++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/compiler/ghci/GHCi.hs b/compiler/ghci/GHCi.hs index c6d0d22..755771e 100644 --- a/compiler/ghci/GHCi.hs +++ b/compiler/ghci/GHCi.hs @@ -79,6 +79,7 @@ import GHC.IO.Handle.Types (Handle) import Foreign.C import GHC.IO.Handle.FD (fdToHandle) #else +import System.Directory import System.Posix as Posix #endif import System.Process @@ -383,13 +384,24 @@ loadDLL :: HscEnv -> String -> IO (Maybe String) loadDLL hsc_env str = iservCmd hsc_env (LoadDLL str) loadArchive :: HscEnv -> String -> IO () -loadArchive hsc_env str = iservCmd hsc_env (LoadArchive str) +loadArchive hsc_env path = do + path' <- canonicalizePath path -- Note [loadObj and relative paths] + iservCmd hsc_env (LoadArchive path') loadObj :: HscEnv -> String -> IO () -loadObj hsc_env str = iservCmd hsc_env (LoadObj str) +loadObj hsc_env path = do + path' <- canonicalizePath path -- Note [loadObj and relative paths] + iservCmd hsc_env (LoadObj path') unloadObj :: HscEnv -> String -> IO () -unloadObj hsc_env str = iservCmd hsc_env (UnloadObj str) +unloadObj hsc_env path = do + path' <- canonicalizePath path -- Note [loadObj and relative paths] + iservCmd hsc_env (UnloadObj path') + +-- Note [loadObj and relative paths] +-- the iserv process might have a different current directory from the +-- GHC process, so we must make paths absolute before sending them +-- over. addLibrarySearchPath :: HscEnv -> String -> IO (Ptr ()) addLibrarySearchPath hsc_env str = diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index eb0aa27..3b92935 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -290,6 +290,7 @@ extra_src_files = { 'ghci026': ['../prog002'], 'ghci038': ['../shell.hs'], 'ghci058': ['../shell.hs'], + 'ghci062': ['ghci062/', 'ghci062/Test.hs'], 'ghcilink001': ['TestLink.hs', 'f.c'], 'ghcilink002': ['TestLink.hs', 'f.c'], 'ghcilink004': ['TestLink.hs', 'f.c'], diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 20888ae..4927abc 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -97,6 +97,7 @@ test('ghci056', test('ghci057', normal, ghci_script, ['ghci057.script']) test('ghci060', normal, ghci_script, ['ghci060.script']) test('ghci061', normal, ghci_script, ['ghci061.script']) +test('ghci062', extra_ways(['ghci-ext']), ghci_script, ['ghci062.script']) test('T2452', normal, ghci_script, ['T2452.script']) test('T2766', normal, ghci_script, ['T2766.script']) diff --git a/testsuite/tests/ghci/scripts/ghci062.script b/testsuite/tests/ghci/scripts/ghci062.script new file mode 100644 index 0000000..80aad1a --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci062.script @@ -0,0 +1,9 @@ +-- Tests for a bug in -fexternal-interpreter where we call loadObj +-- with a local path for the object file, and the iserv process is +-- running with a different current directory so it can't load the +-- object file. + +:cd ghci062 +:set -fobject-code +:load Test +test diff --git a/libraries/base/tests/IO/T4144.stdout b/testsuite/tests/ghci/scripts/ghci062.stdout similarity index 100% copy from libraries/base/tests/IO/T4144.stdout copy to testsuite/tests/ghci/scripts/ghci062.stdout diff --git a/testsuite/tests/ghci/scripts/ghci062/Test.hs b/testsuite/tests/ghci/scripts/ghci062/Test.hs new file mode 100644 index 0000000..f840579 --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci062/Test.hs @@ -0,0 +1,3 @@ +module Test where + +test = "test" From git at git.haskell.org Wed Nov 16 14:50:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 14:50:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Kill redundant test definitions (18d04a8) Message-ID: <20161116145002.DDE9B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/18d04a87bb75ae198aace766d6b8d341b5f23083/ghc >--------------------------------------------------------------- commit 18d04a87bb75ae198aace766d6b8d341b5f23083 Author: Ben Gamari Date: Wed Nov 16 09:49:31 2016 -0500 testsuite: Kill redundant test definitions >--------------------------------------------------------------- 18d04a87bb75ae198aace766d6b8d341b5f23083 testsuite/tests/partial-sigs/should_compile/all.T | 1 - testsuite/tests/patsyn/should_compile/all.T | 1 - testsuite/tests/typecheck/should_fail/all.T | 1 - 3 files changed, 3 deletions(-) diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index 6687a03..3cec3e0 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -64,4 +64,3 @@ test('T11016', normal, compile, ['']) test('T11192', normal, compile, ['']) test('T12156', normal, compile_fail, ['-fdefer-typed-holes']) test('T12531', normal, compile, ['-fdefer-typed-holes']) -test('T12156', normal, compile, ['-fdefer-typed-holes']) diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index dd52a48..f8c466c 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -55,7 +55,6 @@ test('T12094', normal, compile, ['']) test('T12484', normal, compile, ['']) test('T12489', normal, compile, ['']) test('T11959', expect_broken(11959), multimod_compile, ['T11959', '-v0']) -test('T12615', normal, compile, ['']) test('T11987', normal, multimod_compile, ['T11987', '-v0']) test('T12615', normal, compile, ['']) test('T12698', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index df6141a..1c28f11 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -427,4 +427,3 @@ test('T11990b', normal, compile_fail, ['']) test('T12124', normal, compile_fail, ['']) test('T12529', normal, compile_fail, ['']) test('T12589', normal, compile_fail, ['']) -test('T12529', normal, compile_fail, ['']) From git at git.haskell.org Wed Nov 16 22:03:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 16 Nov 2016 22:03:35 +0000 (UTC) Subject: [commit: ghc] master: Inline compiler/NOTES into X86/Ppr.hs (8dfca69) Message-ID: <20161116220335.096383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8dfca69f2339d8d6719f57a4592d35c7d09cca5f/ghc >--------------------------------------------------------------- commit 8dfca69f2339d8d6719f57a4592d35c7d09cca5f Author: Matthew Pickering Date: Wed Nov 16 15:59:32 2016 +0000 Inline compiler/NOTES into X86/Ppr.hs Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2721 >--------------------------------------------------------------- 8dfca69f2339d8d6719f57a4592d35c7d09cca5f compiler/NOTES | 16 ---------------- compiler/nativeGen/PPC/Ppr.hs | 2 +- compiler/nativeGen/SPARC/Ppr.hs | 2 +- compiler/nativeGen/X86/Ppr.hs | 18 ++++++++++++++++++ 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/compiler/NOTES b/compiler/NOTES deleted file mode 100644 index 14a1f80..0000000 --- a/compiler/NOTES +++ /dev/null @@ -1,16 +0,0 @@ -Note [Subsections Via Symbols] - -If we are using the .subsections_via_symbols directive -(available on recent versions of Darwin), -we have to make sure that there is some kind of reference -from the entry code to a label on the _top_ of of the info table, -so that the linker will not think it is unreferenced and dead-strip -it. That's why the label is called a DeadStripPreventer (_dsp). - -The LLVM code gen already creates `iTableSuf` symbols, where -the X86 would generate the DeadStripPreventer (_dsp) symbol. -Therefore all that is left for llvm code gen, is to ensure -that all the `iTableSuf` symbols are marked as used. -As of this writing the documentation regarding the -.subsections_via_symbols and -dead_stip can be found at - \ No newline at end of file diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index a406a6f..3dbb76d 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -68,7 +68,7 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = -- elimination, it might be the target of a goto. (if platformHasSubsectionsViaSymbols platform then - -- See Note [Subsections Via Symbols] + -- See Note [Subsections Via Symbols] in X86/Ppr.hs text "\t.long " <+> ppr info_lbl <+> char '-' diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs index eb41f23..4eba1c4 100644 --- a/compiler/nativeGen/SPARC/Ppr.hs +++ b/compiler/nativeGen/SPARC/Ppr.hs @@ -76,7 +76,7 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = -- elimination, it might be the target of a goto. (if platformHasSubsectionsViaSymbols platform then - -- See Note [Subsections Via Symbols] + -- See Note [Subsections Via Symbols] in X86/Ppr.hs text "\t.long " <+> ppr info_lbl <+> char '-' diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 7809ae1..0d1ff20 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -48,6 +48,24 @@ import Data.Bits -- ----------------------------------------------------------------------------- -- Printing this stuff out +-- +-- +-- Note [Subsections Via Symbols] +-- +-- If we are using the .subsections_via_symbols directive +-- (available on recent versions of Darwin), +-- we have to make sure that there is some kind of reference +-- from the entry code to a label on the _top_ of of the info table, +-- so that the linker will not think it is unreferenced and dead-strip +-- it. That's why the label is called a DeadStripPreventer (_dsp). +-- +-- The LLVM code gen already creates `iTableSuf` symbols, where +-- the X86 would generate the DeadStripPreventer (_dsp) symbol. +-- Therefore all that is left for llvm code gen, is to ensure +-- that all the `iTableSuf` symbols are marked as used. +-- As of this writing the documentation regarding the +-- .subsections_via_symbols and -dead_stip can be found at +-- pprNatCmmDecl :: NatCmmDecl (Alignment, CmmStatics) Instr -> SDoc pprNatCmmDecl (CmmData section dats) = From git at git.haskell.org Thu Nov 17 00:47:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 00:47:05 +0000 (UTC) Subject: [commit: ghc] master: Fix windows validate (b769586) Message-ID: <20161117004705.037313A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b76958671cda1df9f6f0e1d54d681144d09cb06e/ghc >--------------------------------------------------------------- commit b76958671cda1df9f6f0e1d54d681144d09cb06e Author: Tamar Christina Date: Thu Nov 17 00:45:17 2016 +0000 Fix windows validate Summary: mark myindex as inline only and hide it from profilers. Also prevent this function from being used any other way than just for inlining. Test Plan: ./validate Reviewers: austin, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2715 >--------------------------------------------------------------- b76958671cda1df9f6f0e1d54d681144d09cb06e rts/LinkerInternals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 4806d53..befd17b 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -281,7 +281,7 @@ int machoGetMisalignment( FILE * f ); arising from using normal C indexing or pointer arithmetic are just plain wrong. Sigh. */ -STATIC_INLINE unsigned char * +INLINE_HEADER unsigned char * myindex ( int scale, void* base, int index ) { return From git at git.haskell.org Thu Nov 17 05:32:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 05:32:38 +0000 (UTC) Subject: [commit: ghc] master: Test for type synonym loops on TyCon. (31398fb) Message-ID: <20161117053238.96EAD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31398fbc6d9ee0bd95de64b08becc38faf188972/ghc >--------------------------------------------------------------- commit 31398fbc6d9ee0bd95de64b08becc38faf188972 Author: Edward Z. Yang Date: Fri Oct 28 17:54:36 2016 -0700 Test for type synonym loops on TyCon. Summary: Previously, we tested for type synonym loops by doing a syntactic test on the literal type synonym declarations. However, in some cases, loops could go through hs-boot files, leading to an infinite loop (#12042); a similar situation can occur when signature merging. This commit replaces the syntactic test with a test on TyCon, simply by walking down all type synonyms until we bottom out, or find we've looped back. It's a lot simpler. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2656 GHC Trac Issues: #12042 >--------------------------------------------------------------- 31398fbc6d9ee0bd95de64b08becc38faf188972 compiler/hsSyn/HsDecls.hs | 1 + compiler/typecheck/TcBackpack.hs | 4 + compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcTyClsDecls.hs | 157 ++- compiler/typecheck/TcTyDecls.hs | 209 ++-- compiler/types/Type.hs | 2 + docs/users_guide/8.2.1-notes.rst | 10 + docs/users_guide/glasgow_exts.rst | 4 +- testsuite/driver/extra_files.py | 1 + testsuite/tests/backpack/should_fail/all.T | 1 + .../should_fail/{bkpfail04.bkp => bkpfail29.bkp} | 12 +- .../tests/backpack/should_fail/bkpfail29.stderr | 11 + testsuite/tests/module/mod27.stderr | 2 +- testsuite/tests/typecheck/should_compile/all.T | 3 + testsuite/tests/typecheck/should_compile/tc268.hs | 5 + testsuite/tests/typecheck/should_compile/tc269.hs | 22 + testsuite/tests/typecheck/should_compile/tc270.hs | 1006 ++++++++++++++++++++ testsuite/tests/typecheck/should_fail/T12042.hs | 4 + .../tests/typecheck/should_fail/T12042.hs-boot | 3 + .../tests/typecheck/should_fail/T12042.stderr | 9 + testsuite/tests/typecheck/should_fail/T12042a.hs | 3 + testsuite/tests/typecheck/should_fail/all.T | 1 + 22 files changed, 1321 insertions(+), 153 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 31398fbc6d9ee0bd95de64b08becc38faf188972 From git at git.haskell.org Thu Nov 17 11:57:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 11:57:08 +0000 (UTC) Subject: [commit: ghc] master: Correct spelling of command-line option in comment (2878604) Message-ID: <20161117115708.419A23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2878604e87a594b815399f596e5dcad0efc26e0b/ghc >--------------------------------------------------------------- commit 2878604e87a594b815399f596e5dcad0efc26e0b Author: Gabor Greif Date: Thu Nov 17 10:13:46 2016 +0100 Correct spelling of command-line option in comment >--------------------------------------------------------------- 2878604e87a594b815399f596e5dcad0efc26e0b 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 0d1ff20..e70aa63 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -64,7 +64,7 @@ import Data.Bits -- Therefore all that is left for llvm code gen, is to ensure -- that all the `iTableSuf` symbols are marked as used. -- As of this writing the documentation regarding the --- .subsections_via_symbols and -dead_stip can be found at +-- .subsections_via_symbols and -dead_strip can be found at -- pprNatCmmDecl :: NatCmmDecl (Alignment, CmmStatics) Instr -> SDoc From git at git.haskell.org Thu Nov 17 14:08:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 14:08:35 +0000 (UTC) Subject: [commit: ghc] master: Correct name of Note in comment (cede770) Message-ID: <20161117140835.533353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cede770cc7dddd132ebbc101e60402d8bb37007e/ghc >--------------------------------------------------------------- commit cede770cc7dddd132ebbc101e60402d8bb37007e Author: Richard Eisenberg Date: Thu Nov 17 09:08:04 2016 -0500 Correct name of Note in comment >--------------------------------------------------------------- cede770cc7dddd132ebbc101e60402d8bb37007e compiler/typecheck/TcRnDriver.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 89623b5..1a6a0cc 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -2090,7 +2090,7 @@ tcRnExpr hsc_env mode rdr_expr return (snd (normaliseType fam_envs Nominal ty)) } where - -- See Note [Deeply instantiate in :type] + -- See Note [TcRnExprMode] (inst, infer_mode, perhaps_disable_default_warnings) = case mode of TM_Inst -> (True, NoRestrictions, id) TM_NoInst -> (False, NoRestrictions, id) From git at git.haskell.org Thu Nov 17 15:01:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 15:01:52 +0000 (UTC) Subject: [commit: ghc] master: Add Data instance for Const (07e40e9) Message-ID: <20161117150152.C0E5B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/07e40e905357db805e6dbb557b35d6bdf76eaec6/ghc >--------------------------------------------------------------- commit 07e40e905357db805e6dbb557b35d6bdf76eaec6 Author: Ryan Scott Date: Thu Nov 17 09:55:55 2016 -0500 Add Data instance for Const >--------------------------------------------------------------- 07e40e905357db805e6dbb557b35d6bdf76eaec6 libraries/base/Data/Data.hs | 4 ++++ libraries/base/changelog.md | 2 ++ 2 files changed, 6 insertions(+) diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index df37ab1..e43ec74 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -9,6 +9,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE Trustworthy #-} +{-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} ----------------------------------------------------------------------------- @@ -1197,6 +1198,9 @@ deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b) -- | @since 4.9.0.0 deriving instance Data a => Data (Identity a) +-- | @since 4.10.0.0 +deriving instance (Typeable k, Data a, Typeable (b :: k)) => Data (Const a b) + -- | @since 4.7.0.0 deriving instance Data Version diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index a01c878..dcc1719 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -26,6 +26,8 @@ * Add `Semigroup` instance for `IO`, as well as for `Event` and `Lifetime` from `GHC.Event` (#12464) + * Add `Data` instance for `Const` (#12438) + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Thu Nov 17 15:01:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 15:01:55 +0000 (UTC) Subject: [commit: ghc] master: Revert "Add Data instance for Const" (18eb57b) Message-ID: <20161117150155.7254E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18eb57be98cecb657febdb4d1dc45b44eff11818/ghc >--------------------------------------------------------------- commit 18eb57be98cecb657febdb4d1dc45b44eff11818 Author: Ryan Scott Date: Thu Nov 17 09:58:19 2016 -0500 Revert "Add Data instance for Const" This reverts commit 07e40e905357db805e6dbb557b35d6bdf76eaec6. This was meant for a local branch, but accidentally wound up in master. Oops. >--------------------------------------------------------------- 18eb57be98cecb657febdb4d1dc45b44eff11818 libraries/base/Data/Data.hs | 4 ---- libraries/base/changelog.md | 2 -- 2 files changed, 6 deletions(-) diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index e43ec74..df37ab1 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -9,7 +9,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} ----------------------------------------------------------------------------- @@ -1198,9 +1197,6 @@ deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b) -- | @since 4.9.0.0 deriving instance Data a => Data (Identity a) --- | @since 4.10.0.0 -deriving instance (Typeable k, Data a, Typeable (b :: k)) => Data (Const a b) - -- | @since 4.7.0.0 deriving instance Data Version diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index dcc1719..a01c878 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -26,8 +26,6 @@ * Add `Semigroup` instance for `IO`, as well as for `Event` and `Lifetime` from `GHC.Event` (#12464) - * Add `Data` instance for `Const` (#12438) - ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Thu Nov 17 16:04:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 16:04:19 +0000 (UTC) Subject: [commit: ghc] master: Have reify work for local variables with functional dependencies. (231a3ae) Message-ID: <20161117160419.4B8903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/231a3ae1644403c1f295e993105c4346d0db22db/ghc >--------------------------------------------------------------- commit 231a3ae1644403c1f295e993105c4346d0db22db Author: Facundo Domínguez Date: Thu Nov 17 10:04:13 2016 -0500 Have reify work for local variables with functional dependencies. It turned out that finalizers were run too early and information resulting from simplifying constraints was not available. This patch runs finalizers after a first call to simplifyTop, and then calls simplifyTop a second time to deal with constraints that could result from running the finalizers. Fixes T12777 Test Plan: ./validate Reviewers: goldfire, simonpj, bgamari, austin Reviewed By: simonpj Subscribers: mpickering, mboes, thomie Differential Revision: https://phabricator.haskell.org/D2659 GHC Trac Issues: #12777 >--------------------------------------------------------------- 231a3ae1644403c1f295e993105c4346d0db22db compiler/typecheck/TcRnDriver.hs | 50 +++++++++++++++++----------- compiler/typecheck/TcRnMonad.hs | 14 +++++++- compiler/typecheck/TcRnTypes.hs | 25 +++++++++++++- testsuite/tests/th/TH_reifyLocalDefs2.hs | 24 +++++++++++++ testsuite/tests/th/TH_reifyLocalDefs2.stderr | 1 + testsuite/tests/th/all.T | 1 + 6 files changed, 94 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 231a3ae1644403c1f295e993105c4346d0db22db From git at git.haskell.org Thu Nov 17 16:04:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 16:04:22 +0000 (UTC) Subject: [commit: ghc] master: LLVM generate llvm.expect for conditional branches (20fb781) Message-ID: <20161117160422.15C7B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/20fb781ed1825578c5428ff4ae408be034c6a1d8/ghc >--------------------------------------------------------------- commit 20fb781ed1825578c5428ff4ae408be034c6a1d8 Author: Alex Biehl Date: Wed Nov 16 18:16:39 2016 -0500 LLVM generate llvm.expect for conditional branches This patch adds likeliness annotations to heap and and stack checks and modifies the llvm codegen to recognize those to help it generate better code. So with this patch ``` ... if ((Sp + 8) - 24 < SpLim) (likely: False) goto c23c; else goto c23d; ... ``` roughly generates: ``` %ln23k = icmp ult i64 %ln23j, %SpLim_Arg %ln23m = call ccc i1 (i1, i1) @llvm.expect.i1( i1 %ln23k, i1 0 ) br i1 %ln23m, label %c23c, label %c23d ``` Note the call to `llvm.expect` which denotes the expected result for the comparison. Test Plan: Look at assembler code with and without this patch. If the heap-checks moved out of the way we are happy. Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2688 GHC Trac Issues: #8321 >--------------------------------------------------------------- 20fb781ed1825578c5428ff4ae408be034c6a1d8 compiler/cmm/CmmContFlowOpt.hs | 15 ++++++++----- compiler/codeGen/StgCmmHeap.hs | 7 +++--- compiler/codeGen/StgCmmMonad.hs | 40 +++++++++++++++++++++++++-------- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 35 +++++++++++++++++++++++------ 4 files changed, 73 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 20fb781ed1825578c5428ff4ae408be034c6a1d8 From git at git.haskell.org Thu Nov 17 16:04:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 16:04:24 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Rip out hack for #12554 (4d4f353) Message-ID: <20161117160424.D275F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4d4f3533e6ec8698f8af30977c81f17eed1f6970/ghc >--------------------------------------------------------------- commit 4d4f3533e6ec8698f8af30977c81f17eed1f6970 Author: Ben Gamari Date: Wed Nov 16 22:17:26 2016 -0500 testsuite: Rip out hack for #12554 @Phyx is working on correctly fixing (pun intended) the underlying issue that prompted this hack. It turns out that `timeout` it the culprit. Moreover, this hack breaks on msys python builds, which don't export `WindowsError`. Test Plan: Validate on Windows with `msys` python. Reviewers: Phyx, austin Subscribers: thomie, Phyx Differential Revision: https://phabricator.haskell.org/D2724 GHC Trac Issues: #12554 >--------------------------------------------------------------- 4d4f3533e6ec8698f8af30977c81f17eed1f6970 testsuite/driver/testlib.py | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 55d209e..7afabaa 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1850,16 +1850,7 @@ def find_expected_file(name, suff): return basename -# Windows seems to exhibit a strange behavior where processes' executables -# remain locked even after the process itself has died. When this happens -# rmtree will fail with either Error 5 or Error 32. It takes some time for this -# to resolve so we try several times to delete the directory, only eventually -# failing if things seem really stuck. See #12554. if config.msys: - try: - from exceptions import WindowsError - except: - pass import stat def cleanup(): def on_error(function, path, excinfo): @@ -1871,21 +1862,7 @@ if config.msys: os.unlink(path) testdir = getTestOpts().testdir - attempts = 0 - max_attempts = 10 - while attempts < max_attempts and os.path.exists(testdir): - try: - shutil.rmtree(testdir, ignore_errors=False, onerror=on_error) - except WindowsError as e: - #print('failed deleting %s: %s' % (testdir, e)) - if e.winerror in [5, 32]: - attempts += 1 - if attempts == max_attempts: - raise e - else: - time.sleep(0.1) - else: - raise e + shutil.rmtree(testdir, ignore_errors=False, onerror=on_error) else: def cleanup(): testdir = getTestOpts().testdir From git at git.haskell.org Thu Nov 17 16:04:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 16:04:27 +0000 (UTC) Subject: [commit: ghc] master: Pass autoconf triplets to sub-project configures (9a4983d) Message-ID: <20161117160427.AF37E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9a4983dab9893f616db1c9be551ff9112084f887/ghc >--------------------------------------------------------------- commit 9a4983dab9893f616db1c9be551ff9112084f887 Author: Shea Levy Date: Wed Nov 16 18:15:52 2016 -0500 Pass autoconf triplets to sub-project configures Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2713 GHC Trac Issues: #12840 >--------------------------------------------------------------- 9a4983dab9893f616db1c9be551ff9112084f887 configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 678fa2e..7a7e75b 100644 --- a/configure.ac +++ b/configure.ac @@ -437,7 +437,11 @@ then else CrossCompilePrefix="" fi -TargetPlatformFull="${TargetPlatform}" +# Despite its similarity in name to TargetPlatform, TargetPlatformFull is used +# in calls to subproject configure scripts and thus must be set to the autoconf +# triple, not the normalized GHC triple that TargetPlatform is set to. +# It may be better to just do away with the GHC triples all together. +TargetPlatformFull="${target}" AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) From git at git.haskell.org Thu Nov 17 16:04:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 16:04:30 +0000 (UTC) Subject: [commit: ghc] master: GHCi: Unconditionally import System.Directory (04b024a) Message-ID: <20161117160430.659A03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/04b024a9dc5c001e3e9ee97fc999a443a492fb84/ghc >--------------------------------------------------------------- commit 04b024a9dc5c001e3e9ee97fc999a443a492fb84 Author: Ben Gamari Date: Thu Nov 17 10:03:25 2016 -0500 GHCi: Unconditionally import System.Directory Both Windows and POSIX codepaths use System.Directory.canonicalizePath. >--------------------------------------------------------------- 04b024a9dc5c001e3e9ee97fc999a443a492fb84 compiler/ghci/GHCi.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ghci/GHCi.hs b/compiler/ghci/GHCi.hs index 755771e..472251d 100644 --- a/compiler/ghci/GHCi.hs +++ b/compiler/ghci/GHCi.hs @@ -79,9 +79,9 @@ import GHC.IO.Handle.Types (Handle) import Foreign.C import GHC.IO.Handle.FD (fdToHandle) #else -import System.Directory import System.Posix as Posix #endif +import System.Directory import System.Process import GHC.Conc (getNumProcessors, pseq, par) From git at git.haskell.org Thu Nov 17 18:11:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 17 Nov 2016 18:11:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Have reify work for local variables with functional dependencies. (e7c12cd) Message-ID: <20161117181111.E9F823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e7c12cdaa7df8a7c71395da026c003ed36d3cbe6/ghc >--------------------------------------------------------------- commit e7c12cdaa7df8a7c71395da026c003ed36d3cbe6 Author: Facundo Domínguez Date: Thu Nov 17 10:04:13 2016 -0500 Have reify work for local variables with functional dependencies. It turned out that finalizers were run too early and information resulting from simplifying constraints was not available. This patch runs finalizers after a first call to simplifyTop, and then calls simplifyTop a second time to deal with constraints that could result from running the finalizers. Fixes T12777 Test Plan: ./validate Reviewers: goldfire, simonpj, bgamari, austin Reviewed By: simonpj Subscribers: mpickering, mboes, thomie Differential Revision: https://phabricator.haskell.org/D2659 GHC Trac Issues: #12777 (cherry picked from commit 231a3ae1644403c1f295e993105c4346d0db22db) >--------------------------------------------------------------- e7c12cdaa7df8a7c71395da026c003ed36d3cbe6 compiler/typecheck/TcRnDriver.hs | 50 +++++++++++++++++----------- compiler/typecheck/TcRnMonad.hs | 14 +++++++- testsuite/tests/th/TH_reifyLocalDefs2.hs | 24 +++++++++++++ testsuite/tests/th/TH_reifyLocalDefs2.stderr | 1 + testsuite/tests/th/all.T | 1 + 5 files changed, 70 insertions(+), 20 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 7dd7774..25c243f 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -476,9 +476,8 @@ tcRnSrcDecls :: Bool -- False => no 'module M(..) where' header at all -- Reason: solely to report unused imports and bindings tcRnSrcDecls explicit_mod_hdr decls = do { -- Do all the declarations - ; ((tcg_env, tcl_env), lie) <- captureConstraints $ - do { envs <- tc_rn_src_decls decls - ; (tcg_env, tcl_env) <- setEnvs envs run_th_modfinalizers + ; ((tcg_env, tcl_env), lie) <- captureTopConstraints $ + do { (tcg_env, tcl_env) <- tc_rn_src_decls decls ; tcg_env <- setEnvs (tcg_env, tcl_env) $ checkMain explicit_mod_hdr @@ -490,13 +489,6 @@ tcRnSrcDecls explicit_mod_hdr decls ; setGblEnv tcg_env $ do { -#ifdef GHCI - ; finishTH -#endif /* GHCI */ - - -- wanted constraints from static forms - ; stWC <- tcg_static_wc <$> getGblEnv >>= readTcRef - -- Finish simplifying class constraints -- -- simplifyTop deals with constant or ambiguous InstIds. @@ -512,7 +504,17 @@ tcRnSrcDecls explicit_mod_hdr decls -- * the local env exposes the local Ids to simplifyTop, -- so that we get better error messages (monomorphism restriction) ; new_ev_binds <- {-# SCC "simplifyTop" #-} - simplifyTop (andWC stWC lie) + simplifyTop lie + +#ifdef GHCI + -- Finalizers must run after constraints are simplified, or some types + -- might not be complete when using reify (see #12777). + ; (tcg_env, tcl_env) <- run_th_modfinalizers + ; setEnvs (tcg_env, tcl_env) $ do { + + ; finishTH +#endif /* GHCI */ + ; traceTc "Tc9" empty ; failIfErrsM -- Don't zonk if there have been errors @@ -548,6 +550,9 @@ tcRnSrcDecls explicit_mod_hdr decls ; setGlobalTypeEnv tcg_env' final_type_env +#ifdef GHCI + } +#endif /* GHCI */ } } } #ifdef GHCI @@ -561,14 +566,21 @@ run_th_modfinalizers = do then getEnvs else do writeTcRef th_modfinalizers_var [] - sequence_ th_modfinalizers - -- Finalizers can add top-level declarations with addTopDecls. - envs <- tc_rn_src_decls [] - -- addTopDecls can add declarations which add new finalizers. - setEnvs envs run_th_modfinalizers -#else -run_th_modfinalizers :: TcM (TcGblEnv, TcLclEnv) -run_th_modfinalizers = getEnvs + (envs, lie) <- captureTopConstraints $ do + sequence_ th_modfinalizers + -- Finalizers can add top-level declarations with addTopDecls. + tc_rn_src_decls [] + setEnvs envs $ do + -- Subsequent rounds of finalizers run after any new constraints are + -- simplified, or some types might not be complete when using reify + -- (see #12777). + new_ev_binds <- {-# SCC "simplifyTop2" #-} + simplifyTop lie + updGblEnv (\tcg_env -> + tcg_env { tcg_ev_binds = tcg_ev_binds tcg_env `unionBags` new_ev_binds } + ) + -- addTopDecls can add declarations which add new finalizers. + run_th_modfinalizers #endif /* GHCI */ tc_rn_src_decls :: [LHsDecl RdrName] diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index 278082e..f2fc28d 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -96,7 +96,7 @@ module TcRnMonad( getConstraintVar, setConstraintVar, emitConstraints, emitSimple, emitSimples, emitImplication, emitImplications, emitInsoluble, - discardConstraints, captureConstraints, + discardConstraints, captureConstraints, captureTopConstraints, pushLevelAndCaptureConstraints, pushTcLevelM_, pushTcLevelM, getTcLevel, setTcLevel, isTouchableTcM, @@ -1437,6 +1437,18 @@ captureConstraints thing_inside ; failM } Right res -> return (res, lie) } +captureTopConstraints :: TcM a -> TcM (a, WantedConstraints) +-- (captureTopConstraints m) runs m, and returns the type constraints it +-- generates plus the constraints produced by static forms inside. +captureTopConstraints thing_inside + = do { (res, lie) <- captureConstraints thing_inside ; + -- wanted constraints from static forms + ; tcg_static_wc_ref <- tcg_static_wc <$> getGblEnv + ; stWC <- readTcRef tcg_static_wc_ref + ; writeTcRef tcg_static_wc_ref emptyWC + ; return (res, andWC stWC lie) + } + pushLevelAndCaptureConstraints :: TcM a -> TcM (TcLevel, WantedConstraints, a) pushLevelAndCaptureConstraints thing_inside = do { env <- getLclEnv diff --git a/testsuite/tests/th/TH_reifyLocalDefs2.hs b/testsuite/tests/th/TH_reifyLocalDefs2.hs new file mode 100644 index 0000000..06564eb --- /dev/null +++ b/testsuite/tests/th/TH_reifyLocalDefs2.hs @@ -0,0 +1,24 @@ +-- Tests that a complete type is yielded by reify for local definitions, +-- even when using functional dependencies which are resolved at the very end of +-- type checking. +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE FunctionalDependencies #-} +module TH_reifyLocalDefs2 where +import Language.Haskell.TH as TH +import Language.Haskell.TH.Syntax as TH +import System.IO + +class C a b | a -> b where + yo :: a -> IO b + +instance C Bool Int where + yo _ = return 0 + +t3 :: IO () +t3 = do + x <- yo True + $(do addModFinalizer $ do + VarI _ t _ <- TH.reify 'x + runIO $ hPutStrLn stderr $ show t + [| return () |] + ) diff --git a/testsuite/tests/th/TH_reifyLocalDefs2.stderr b/testsuite/tests/th/TH_reifyLocalDefs2.stderr new file mode 100644 index 0000000..e1b28ad --- /dev/null +++ b/testsuite/tests/th/TH_reifyLocalDefs2.stderr @@ -0,0 +1 @@ +ConT GHC.Types.Int diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index bee7e43..773b360 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -76,6 +76,7 @@ test('TH_spliceD2', test('TH_reifyDecl1', normal, compile, ['-v0']) test('TH_reifyDecl2', normal, compile, ['-v0']) test('TH_reifyLocalDefs', normal, compile, ['-v0']) +test('TH_reifyLocalDefs2', normal, compile, ['-v0']) test('TH_reifyMkName', normal, compile, ['-v0']) From git at git.haskell.org Fri Nov 18 01:47:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 Nov 2016 01:47:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Remove fancy shadowing logic; always override in package database order. (b5b9cf3) Message-ID: <20161118014722.0ECC33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b5b9cf3a424ed32e0495aedd2376a0ffdf4a967d/ghc >--------------------------------------------------------------- commit b5b9cf3a424ed32e0495aedd2376a0ffdf4a967d Author: Edward Z. Yang Date: Thu Nov 17 17:08:21 2016 -0500 Remove fancy shadowing logic; always override in package database order. This is a stopgap fix for GHC 8.0 bug #12485: in particular, it relaxes need for -package-db flags to be given in dependency order. The trade-off is that we are a lot more unsafe when there are packages with duplicate 'id's in the database stack: the new code will not do an ABI compatibility check: if two packages have the same 'id', they are assumed to be ABI compatible. If this is not true, GHC may build segfaulting executables. Missing test updates, but I'm putting it up so people can take a look. In GHC 8.2, we'll record ABIs for all dependencies, allowing GHC to make better decisions about shadowing. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: austin, niteria, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2613 GHC Trac Issues: #12485 >--------------------------------------------------------------- b5b9cf3a424ed32e0495aedd2376a0ffdf4a967d compiler/main/Packages.hs | 121 +++++++++++++++--------------------- docs/users_guide/packages.rst | 8 +-- testsuite/tests/cabal/Makefile | 22 +++---- testsuite/tests/cabal/cabal08/all.T | 4 +- testsuite/tests/cabal/shadow.stderr | 4 -- testsuite/tests/cabal/shadow.stdout | 4 +- 6 files changed, 67 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 b5b9cf3a424ed32e0495aedd2376a0ffdf4a967d From git at git.haskell.org Fri Nov 18 08:15:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 Nov 2016 08:15:25 +0000 (UTC) Subject: [commit: ghc] master: Switch to LLVM version 3.9 (9c39e09) Message-ID: <20161118081525.2A4A13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9c39e09a9aaea4ff6fdb6a4809a4cc456c7bc164/ghc >--------------------------------------------------------------- commit 9c39e09a9aaea4ff6fdb6a4809a4cc456c7bc164 Author: Erik de Castro Lopo Date: Fri Nov 18 19:14:42 2016 +1100 Switch to LLVM version 3.9 Test Plan: Build and test on x86_64/linux (perf-llvm) and armhf/linux. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2719 >--------------------------------------------------------------- 9c39e09a9aaea4ff6fdb6a4809a4cc456c7bc164 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7a7e75b..0312aed 100644 --- a/configure.ac +++ b/configure.ac @@ -551,7 +551,7 @@ esac # tools we are looking for. In the past, GHC supported a number of # versions of LLVM simultaneously, but that stopped working around # 3.5/3.6 release of LLVM. -LlvmVersion=3.8 +LlvmVersion=3.9 AC_SUBST([LlvmVersion]) sUPPORTED_LLVM_VERSION=$(echo \($LlvmVersion\) | sed 's/\./,/') AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION], ${sUPPORTED_LLVM_VERSION}, [The supported LLVM version number]) From git at git.haskell.org Fri Nov 18 08:50:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 Nov 2016 08:50:41 +0000 (UTC) Subject: [commit: ghc] master: Add missing SMP symbols to RT linker. (94d1221) Message-ID: <20161118085041.051AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/94d1221cfb31188990738e7f7cbb3ae0a30c9f98/ghc >--------------------------------------------------------------- commit 94d1221cfb31188990738e7f7cbb3ae0a30c9f98 Author: Tamar Christina Date: Fri Nov 18 08:50:11 2016 +0000 Add missing SMP symbols to RT linker. Summary: Add some missing symbols that we export from the public headers but forgot to include in the runtime linker's symbol table. This is a bit of a unsatifactory patch, since we have a bit of a cat and mouse game going. We should find a way to automate this. But I know of no good solutions at the moment that won't add all rts symbols (including those we don't have an extern declaration for.). So for now, just add the ones reported missing. Test Plan: inplace/bin/ghc-stage2.exe --interactive Reviewers: RyanGlScott, austin, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2727 GHC Trac Issues: #12846 >--------------------------------------------------------------- 94d1221cfb31188990738e7f7cbb3ae0a30c9f98 rts/RtsSymbols.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 36b2b43..60ffedb 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -872,6 +872,10 @@ SymI_HasProto(hs_spt_remove) \ SymI_HasProto(hs_spt_keys) \ SymI_HasProto(hs_spt_key_count) \ + SymI_HasProto(write_barrier) \ + SymI_HasProto(store_load_barrier) \ + SymI_HasProto(load_load_barrier) \ + SymI_HasProto(cas) \ RTS_USER_SIGNALS_SYMBOLS \ RTS_INTCHAR_SYMBOLS From git at git.haskell.org Fri Nov 18 10:16:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 Nov 2016 10:16:35 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comment only (d328abc) Message-ID: <20161118101635.C0F7A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d328abc84962dbe16763e6e82418c5bb7a2b8628/ghc >--------------------------------------------------------------- commit d328abc84962dbe16763e6e82418c5bb7a2b8628 Author: Gabor Greif Date: Fri Nov 18 10:57:46 2016 +0100 Spelling in comment only >--------------------------------------------------------------- d328abc84962dbe16763e6e82418c5bb7a2b8628 compiler/typecheck/TcRnTypes.hs | 2 +- compiler/vectorise/Vectorise.hs | 2 +- rts/Schedule.c | 2 +- rts/linker/M32Alloc.c | 4 ++-- rts/posix/Signals.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 02c9c09..ce541c3 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1177,7 +1177,7 @@ data ImportAvails -- = ModuleEnv [ImportedModsVal], -- ^ Domain is all directly-imported modules -- - -- See the documentaion on ImportedModsVal in HscTypes for the + -- See the documentation on ImportedModsVal in HscTypes for the -- meaning of the fields. -- -- We need a full ModuleEnv rather than a ModuleNameEnv here, diff --git a/compiler/vectorise/Vectorise.hs b/compiler/vectorise/Vectorise.hs index 70ea2e4..49bfeda 100644 --- a/compiler/vectorise/Vectorise.hs +++ b/compiler/vectorise/Vectorise.hs @@ -70,7 +70,7 @@ vectModule guts@(ModGuts { mg_tcs = tycons cls_vect_decls = [vd | vd@(VectClass _) <- vect_decls] -- Vectorise the type environment. This will add vectorised - -- type constructors, their representaions, and the + -- type constructors, their representations, and the -- conrresponding data constructors. Moreover, we produce -- bindings for dfuns and family instances of the classes -- and type families used in the DPH library to represent diff --git a/rts/Schedule.c b/rts/Schedule.c index 7d5654f..41c68be 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2817,7 +2817,7 @@ raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception) // // This closure represents the expression 'raise# E' where E // is the exception raise. It is used to overwrite all the - // thunks which are currently under evaluataion. + // thunks which are currently under evaluation. // // OLD COMMENT (we don't have MIN_UPD_SIZE now): diff --git a/rts/linker/M32Alloc.c b/rts/linker/M32Alloc.c index 73f9be9..c5c3623 100644 --- a/rts/linker/M32Alloc.c +++ b/rts/linker/M32Alloc.c @@ -22,10 +22,10 @@ Note [Compile Time Trickery] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This file implements two versions of each of the `m32_*` functions. At the top -of the file there is the real implementaion (compiled in when +of the file there is the real implementation (compiled in when `RTS_LINKER_USE_MMAP` is true) and a dummy implementation that exists only to satisfy the compiler and which hould never be called. If any of these dummy -implementaions are called the program will abort. +implementations are called the program will abort. The rationale for this is to allow the calling code to be written without using the C pre-processor (CPP) `#if` hackery. The value of `RTS_LINKER_USE_MMAP` is diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index d73143b..97439c5 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -561,7 +561,7 @@ empty_handler (int sig STG_UNUSED) When a process is suspeended with ^Z and resumed again, the shell makes no attempt to save and restore the terminal settings. So on - resume, any terminal setting modificaions we made (e.g. turning off + resume, any terminal setting modifications we made (e.g. turning off ICANON due to hSetBuffering NoBuffering) may well be lost. Hence, we arrange to save and restore the terminal settings ourselves. From git at git.haskell.org Fri Nov 18 14:40:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 Nov 2016 14:40:40 +0000 (UTC) Subject: [commit: ghc] master: Add Data instance for Const (3bd1dd4) Message-ID: <20161118144040.445AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3bd1dd4d75fde3b922d4de08c16f29bdeb8e05d7/ghc >--------------------------------------------------------------- commit 3bd1dd4d75fde3b922d4de08c16f29bdeb8e05d7 Author: Ryan Scott Date: Fri Nov 18 09:33:01 2016 -0500 Add Data instance for Const Summary: Fixes #12438. As discussed on the Haskell libraries mailing list here: https://mail.haskell.org/pipermail/libraries/2016-November/027396.html Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2726 GHC Trac Issues: #12438 >--------------------------------------------------------------- 3bd1dd4d75fde3b922d4de08c16f29bdeb8e05d7 libraries/base/Data/Data.hs | 4 ++++ libraries/base/changelog.md | 2 ++ testsuite/tests/annotations/should_fail/annfail10.stderr | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index df37ab1..e43ec74 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -9,6 +9,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE Trustworthy #-} +{-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} ----------------------------------------------------------------------------- @@ -1197,6 +1198,9 @@ deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b) -- | @since 4.9.0.0 deriving instance Data a => Data (Identity a) +-- | @since 4.10.0.0 +deriving instance (Typeable k, Data a, Typeable (b :: k)) => Data (Const a b) + -- | @since 4.7.0.0 deriving instance Data Version diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index a01c878..dcc1719 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -26,6 +26,8 @@ * Add `Semigroup` instance for `IO`, as well as for `Event` and `Lifetime` from `GHC.Event` (#12464) + * Add `Data` instance for `Const` (#12438) + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr index 6e7732f..6a52a9c 100644 --- a/testsuite/tests/annotations/should_fail/annfail10.stderr +++ b/testsuite/tests/annotations/should_fail/annfail10.stderr @@ -10,7 +10,7 @@ annfail10.hs:9:1: error: instance Data.Data.Data Ordering -- Defined in ‘Data.Data’ instance Data.Data.Data Integer -- Defined in ‘Data.Data’ ...plus 15 others - ...plus 39 instances involving out-of-scope types + ...plus 40 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN f 1 #-} @@ -23,6 +23,6 @@ annfail10.hs:9:11: error: instance Num Double -- Defined in ‘GHC.Float’ instance Num Float -- Defined in ‘GHC.Float’ ...plus two others - ...plus 13 instances involving out-of-scope types + ...plus 14 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN f 1 #-} From git at git.haskell.org Fri Nov 18 16:29:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 18 Nov 2016 16:29:49 +0000 (UTC) Subject: [commit: ghc] master: Optimise whole module exports (4b72f85) Message-ID: <20161118162949.844423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4b72f859cd03ad3104c3935ea83ede68d0af6220/ghc >--------------------------------------------------------------- commit 4b72f859cd03ad3104c3935ea83ede68d0af6220 Author: Matthew Pickering Date: Fri Nov 18 16:28:30 2016 +0000 Optimise whole module exports We directly build up the correct AvailInfos rather than generating lots of singleton instances and combining them with expensive calls to unionLists. There are two other small changes. * Pushed the nubAvails call into the explicit export list branch as we construct them correctly and uniquely ourselves. * fix_faminst only needs to check the first element of the export list as we maintain the (yucky) invariant that the parent is the first thing in it. Reviewers: simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, thomie, niteria Differential Revision: https://phabricator.haskell.org/D2657 GHC Trac Issues: #12754 >--------------------------------------------------------------- 4b72f859cd03ad3104c3935ea83ede68d0af6220 compiler/basicTypes/RdrName.hs | 55 ++++++++++++++++++++++++++++++++++++--- compiler/typecheck/TcRnExports.hs | 25 ++++++++++-------- 2 files changed, 65 insertions(+), 15 deletions(-) diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index 40c152b..d60522f 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -52,6 +52,7 @@ module RdrName ( -- * GlobalRdrElts gresFromAvails, gresFromAvail, localGREsFromAvail, availFromGRE, greUsedRdrName, greRdrNames, greSrcSpan, greQualModName, + gresToAvailInfo, -- ** Global 'RdrName' mapping elements: 'GlobalRdrElt', 'Provenance', 'ImportSpec' GlobalRdrElt(..), isLocalGRE, isRecFldGRE, greLabel, @@ -77,9 +78,10 @@ import Unique import UniqFM import Util import StaticFlags( opt_PprStyle_Debug ) +import NameEnv import Data.Data -import Data.List( sortBy ) +import Data.List( sortBy, foldl', nub ) {- ************************************************************************ @@ -453,7 +455,7 @@ data GlobalRdrElt , gre_par :: Parent , gre_lcl :: Bool -- ^ True <=> the thing was defined locally , gre_imp :: [ImportSpec] -- ^ In scope through these imports - } deriving Data + } deriving (Data, Eq) -- INVARIANT: either gre_lcl = True or gre_imp is non-empty -- See Note [GlobalRdrElt provenance] @@ -687,15 +689,60 @@ mkParent _ (Avail _) = NoParent mkParent n (AvailTC m _ _) | n == m = NoParent | otherwise = ParentIs m +greParentName :: GlobalRdrElt -> Maybe Name +greParentName gre = case gre_par gre of + NoParent -> Nothing + ParentIs n -> Just n + FldParent n _ -> Just n + +-- | Takes a list of distinct GREs and folds them +-- into AvailInfos. This is more efficient than mapping each individual +-- GRE to an AvailInfo and the folding using `plusAvail` but needs the +-- uniqueness assumption. +gresToAvailInfo :: [GlobalRdrElt] -> [AvailInfo] +gresToAvailInfo gres + = ASSERT( nub gres == gres ) nameEnvElts avail_env + where + avail_env :: NameEnv AvailInfo -- keyed by the parent + avail_env = foldl' add emptyNameEnv gres + + add :: NameEnv AvailInfo -> GlobalRdrElt -> NameEnv AvailInfo + add env gre = extendNameEnv_Acc comb availFromGRE env + (fromMaybe (gre_name gre) + (greParentName gre)) gre + + where + -- We want to insert the child `k` into a list of children but + -- need to maintain the invariant that the parent is first. + -- + -- We also use the invariant that `k` is not already in `ns`. + insertChildIntoChildren :: Name -> [Name] -> Name -> [Name] + insertChildIntoChildren _ [] k = [k] + insertChildIntoChildren p (n:ns) k + | p == k = k:n:ns + | otherwise = n:k:ns + + comb :: GlobalRdrElt -> AvailInfo -> AvailInfo + comb _ (Avail n) = Avail n -- Duplicated name + comb gre (AvailTC m ns fls) = + let n = gre_name gre + in case gre_par gre of + NoParent -> AvailTC m (n:ns) fls -- Not sure this ever happens + ParentIs {} -> AvailTC m (insertChildIntoChildren m ns n) fls + FldParent _ mb_lbl -> AvailTC m ns (mkFieldLabel n mb_lbl : fls) + availFromGRE :: GlobalRdrElt -> AvailInfo availFromGRE (GRE { gre_name = me, gre_par = parent }) = case parent of ParentIs p -> AvailTC p [me] [] NoParent | isTyConName me -> AvailTC me [me] [] | otherwise -> avail me - FldParent p mb_lbl -> AvailTC p [] [fld] + FldParent p mb_lbl -> AvailTC p [] [mkFieldLabel me mb_lbl] where - fld = case mb_lbl of + +mkFieldLabel :: Name -> Maybe FastString -> FieldLabel +mkFieldLabel me mb_lbl = + case mb_lbl of Nothing -> FieldLabel { flLabel = occNameFS (nameOccName me) , flIsOverloaded = False , flSelector = me } diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index 14c151b..35ff65f 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -136,10 +136,9 @@ tcRnExports explicit_mod exports -- ToDo: the 'noLoc' here is unhelpful if 'main' -- turns out to be out of scope - ; (rn_exports, avails) <- exports_from_avail real_exports rdr_env imports this_mod - ; traceRn "Exported Avails" (ppr avails) - ; let final_avails = nubAvails avails -- Combine families - final_ns = availsToNameSetWithSelectors final_avails + ; (rn_exports, final_avails) + <- exports_from_avail real_exports rdr_env imports this_mod + ; let final_ns = availsToNameSetWithSelectors final_avails ; traceRn "rnExports: Exports:" (ppr final_avails) @@ -164,9 +163,9 @@ exports_from_avail Nothing rdr_env _imports _this_mod -- The same as (module M) where M is the current module name, -- so that's how we handle it, except we also export the data family -- when a data instance is exported. - = let avails = [ fix_faminst $ availFromGRE gre - | gre <- globalRdrEnvElts rdr_env - , isLocalGRE gre ] + = let avails = + map fix_faminst . gresToAvailInfo + . filter isLocalGRE . globalRdrEnvElts $ rdr_env in return (Nothing, avails) where -- #11164: when we define a data instance @@ -174,9 +173,12 @@ exports_from_avail Nothing rdr_env _imports _this_mod -- Even though we don't check whether this is actually a data family -- only data families can locally define subordinate things (`ns` here) -- without locally defining (and instead importing) the parent (`n`) - fix_faminst (AvailTC n ns flds) - | n `notElem` ns - = AvailTC n (n:ns) flds + fix_faminst (AvailTC n ns flds) = + let new_ns = + case ns of + [] -> [n] + (p:_) -> if p == n then ns else n:ns + in AvailTC n new_ns flds fix_faminst avail = avail @@ -184,7 +186,8 @@ exports_from_avail Nothing rdr_env _imports _this_mod exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod = do ExportAccum ie_names _ exports <- checkNoErrs $ foldAndRecoverM do_litem emptyExportAccum rdr_items - return (Just ie_names, exports) + let final_exports = nubAvails exports -- Combine families + return (Just ie_names, final_exports) where do_litem :: ExportAccum -> LIE RdrName -> RnM ExportAccum do_litem acc lie = setSrcSpan (getLoc lie) (exports_from_item acc lie) From git at git.haskell.org Sun Nov 20 00:04:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 Nov 2016 00:04:34 +0000 (UTC) Subject: [commit: ghc] master: Updated code comment regarding EquationInfo. Trac #12856 (6ad94d8) Message-ID: <20161120000434.D83503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ad94d8fbc45fcb725506e9b8bc53a55c089d727/ghc >--------------------------------------------------------------- commit 6ad94d8fbc45fcb725506e9b8bc53a55c089d727 Author: Andreas Klebinger Date: Sun Nov 20 00:03:51 2016 +0000 Updated code comment regarding EquationInfo. Trac #12856 Summary: Updated code comment regarding EquationInfo. Fixes T12856 Reviewers: austin, bgamari, mpickering Reviewed By: mpickering Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2730 GHC Trac Issues: #12856 >--------------------------------------------------------------- 6ad94d8fbc45fcb725506e9b8bc53a55c089d727 compiler/deSugar/Match.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs index 288fc40..897c6e9 100644 --- a/compiler/deSugar/Match.hs +++ b/compiler/deSugar/Match.hs @@ -92,7 +92,7 @@ is an embryonic @CoreExpr@ with a ``hole'' at the end for the final ``else expression''. \end{itemize} -There is a type synonym, @EquationInfo@, defined in module @DsUtils at . +There is a data type, @EquationInfo@, defined in module @DsMonad at . An experiment with re-ordering this information about equations (in particular, having the patterns available in column-major order) From git at git.haskell.org Sun Nov 20 17:22:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 Nov 2016 17:22:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Mark T11978a as broken due to #12019 (83bee7b) Message-ID: <20161120172206.824253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/83bee7b71db47fe3d2f42f96cb8fef7f279fe853/ghc >--------------------------------------------------------------- commit 83bee7b71db47fe3d2f42f96cb8fef7f279fe853 Author: Ben Gamari Date: Sat Oct 1 17:02:49 2016 -0400 Mark T11978a as broken due to #12019 Test Plan: `validate --slow` Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2536 GHC Trac Issues: #12019 (cherry picked from commit d1b4fec12250e608ca8a863ba4ef911084c468ef) >--------------------------------------------------------------- 83bee7b71db47fe3d2f42f96cb8fef7f279fe853 testsuite/tests/profiling/should_run/all.T | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 3b28d45..7454099 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -105,5 +105,7 @@ test('T11627b', [ extra_run_opts('+RTS -i0 -RTS') # census after each GC , ['']) test('T11978a', - [only_ways(['profthreaded']), extra_run_opts('+RTS -hb -N10')], + [only_ways(['profthreaded']), + extra_run_opts('+RTS -hb -N10'), + expect_broken(12019)], compile_and_run, ['']) From git at git.haskell.org Sun Nov 20 17:22:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 Nov 2016 17:22:09 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Clean up 8.0.2 release notes (83fc125) Message-ID: <20161120172209.320463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/83fc12593cd45fe1518ff94468c4fb6f26fc3a03/ghc >--------------------------------------------------------------- commit 83fc12593cd45fe1518ff94468c4fb6f26fc3a03 Author: Ben Gamari Date: Fri Nov 18 14:46:36 2016 -0500 Clean up 8.0.2 release notes >--------------------------------------------------------------- 83fc12593cd45fe1518ff94468c4fb6f26fc3a03 docs/users_guide/8.0.2-notes.rst | 81 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 727e919..81f9ce4 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -3,24 +3,49 @@ Release notes for version 8.0.2 =============================== -TODO FIXME +The significant changes to the various parts of the compiler are listed in the +following sections. There have also been numerous bug fixes and performance +improvements over the 8.0.1 release. + +.. warning:: + + Only Cabal versions 1.24 and newer will function properly with this release. + (see :ghc-ticket:`11558`). Consequently it will likely be necessary to + recompile ``cabal-install`` before installing new packages. + + The reason for this is a change in how packages are identified in GHC + 8.0. While previous versions of Cabal identified packages to GHC with a + package key (with GHC's :ghc-flag:`-this-package-key` argument), GHC 8.0 and + later uses installed package IDs in place of package keys. + +.. note:: + + Users compiling GHC on Mac OS X with XCode 7.3 will need to tell the build + system to use the ``nm-classic`` command instead of Apple's new ``nm`` + implementation as the latter breaks POSIX compliance (see + :ghc-ticket:`11744`). This can be done by passing something like + ``--with-nm=$(xcrun --find nm-classic)`` to ``configure``. Highlights ---------- +The highlights, since the 8.0.1 release, are: + +- Compatibility fixes with macOS Sierra and recent Linux distributions. + - Many, many bug fixes. - A bug has been fixed that caused standalone derived ``Ix`` instances to fail for GADTs with exactly one constructor (:ghc-ticket:`12583`). +- Interface files produced by GHC should now be deterministic. + Full details ------------ Language ~~~~~~~~ -- TODO FIXME. - - A bug has been fixed that caused derived ``Show`` instances to fail in the presence of :ghc-flag:`-XRebindableSyntax` and :ghc-flag:`-XOverloadedStrings` (:ghc-ticket:`12688`). @@ -49,15 +74,31 @@ Language Compiler ~~~~~~~~ +- A compiler bug present in 8.0.1 resulting in undefined reference errors while + compiling some packages has been fixed. (see :ghc-ticket:`12076`). + +- A code generator bug which resulted in segmentation faults in compiled + programs has been fixed (see :ghc-ticket:`12757`). + +- GHC now supports systems whose C compiler which produce position-independent + executables by default. (see :ghc-ticket:`12579`). + +- GHC can now be built on systems which use the ``gold`` linker by default + (see :ghc-ticket:`12816`). + +- GHC now reliably runs on macOS Sierra systems. Sierra introduced a linker + limitation which GHC occassionally surpassed when compiling programs with + many package dependencies. (see :ghc-ticket:`12479`). + - The :ghc-flag:`-Wredundant-constraints` flag has been removed from the :ghc-flag:`-Wall` flag set (see :ghc-ticket:`10635`). - Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts variable out of scope variables errors into warnings. -- The RTS :ghc-flag: `-xb` now reads the base heap address in any base, - defaulting to decimal, hexadecimal if the address starts with `0x`, and - octal if the address starts with `0`. +- The RTS :ghc-flag:`-xb` now reads the base heap address in any base, + defaulting to decimal, hexadecimal if the address starts with ``0x``, and + octal if the address starts with ``0``. - Due to an oversight in GHC 8.0.1, the value of the preprocessor macro ``__GLASGOW_HASKELL_LLVM__``, which exposes the LLVM version used by GHC, was @@ -65,6 +106,16 @@ Compiler formatting is changed to be in line with ``__GLASGOW_HASKELL__`` (:ghc-ticket:`12628`). +- Parallel programs should be significantly more reliable on platforms with weak + memory consistency guarantees (:ghc-ticket:`12469`) + +- Interface files should now be bit-wise identical for a given build. + (:ghc-ticket:`4012`) + +- Nearly two-hundred more bugs. See `Trac + `_ + for a complete list. + Runtime system ~~~~~~~~~~~~~~ @@ -75,11 +126,25 @@ Runtime system `MSDN `_ . This should now introduce the same behavior both compiled and interpreted. (see :ghc-ticket:`12497`). +- Profiles from the cost-center profiler now provide source span information. + (see :ghc-ticket:`11543`). + +- The number of threads used for garbage collection is now configurable + independently from the number of capabilities with the new :ghc-flag:`-qn` + flag. + +- The runtime system should now wake-up less often with large capability counts + +- The runtime system is now a more efficient in handling programs with many + bound threads. (:ghc-ticket:`12419`) + +- A number of runtime system bugs which could result in crashes (see + :ghc-ticket:`12728`, :ghc-ticket:`10860`, :ghc-ticket:`12019`, + :ghc-ticket:`11978`, :ghc-ticket:`12038`, :ghc-ticket:`12208`) + Template Haskell ~~~~~~~~~~~~~~~~ -- TODO FIXME. - - ``addModFinalizer`` now exposes the local typing environment at the splice point. This allows ``reify`` to see local and top-level definitions in the current declaration group when used as in From git at git.haskell.org Sun Nov 20 17:22:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 Nov 2016 17:22:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add testcase for #12757 (4f7cd81) Message-ID: <20161120172212.3EBFD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/4f7cd81092074dfb86b11d1f01e2c25d1b8820fb/ghc >--------------------------------------------------------------- commit 4f7cd81092074dfb86b11d1f01e2c25d1b8820fb Author: Ben Gamari Date: Wed Nov 2 17:02:14 2016 -0400 Add testcase for #12757 Test Plan: Validate, expected to fail Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2665 GHC Trac Issues: #12757 (cherry picked from commit b5460dd6e54f4ba54bfb11469221e8c8f957e964) >--------------------------------------------------------------- 4f7cd81092074dfb86b11d1f01e2c25d1b8820fb testsuite/tests/codeGen/should_run/T12757.hs | 28 ++++++++++++++++++++++ .../should_run/T12757.stdout} | 2 +- testsuite/tests/codeGen/should_run/all.T | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/T12757.hs b/testsuite/tests/codeGen/should_run/T12757.hs new file mode 100644 index 0000000..148fe7a --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T12757.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Main (main) where + +import Data.ByteString (ByteString) +import qualified Data.ByteString as B + +answers :: [ByteString] +answers = map (B.filter (/= 0x20)) + [ "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855" + , "d7a8fbb3 07d78094 69ca9abc b0082e4f 8d5651e4 6d3cdb76 2d02d0bf 37c9e592" + , "e4c4d8f3 bf76b692 de791a17 3e053211 50f7a345 b46484fe 427f6acc 7ecc81be" + , "ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad" + , "248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1" + , "cf5b16a7 78af8380 036ce59e 7b049237 0b249b11 e8f07a51 afac4503 7afee9d1" + , "cdc76e5c 9914fb92 81a1c7e2 84d73e67 f1809a48 a497200e 046d39cc c7112cd0" + ] + +x, y :: ByteString +x = "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855" +y = B.filter (/= 0x20) x + +main :: IO () +main = do + print (seq x ()) + print (seq y ()) + print (length answers) + print (seq (head answers) ()) -- segfault! diff --git a/testsuite/tests/deriving/should_run/T3087.stdout b/testsuite/tests/codeGen/should_run/T12757.stdout similarity index 75% copy from testsuite/tests/deriving/should_run/T3087.stdout copy to testsuite/tests/codeGen/should_run/T12757.stdout index 35735b4..0c66d1a 100644 --- a/testsuite/tests/deriving/should_run/T3087.stdout +++ b/testsuite/tests/codeGen/should_run/T12757.stdout @@ -1,4 +1,4 @@ () () -() +7 () diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 15ad68b..c956733 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -144,3 +144,4 @@ test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12433', normal, compile_and_run, ['']) +test('T12757', normal, compile_and_run, ['']) From git at git.haskell.org Sun Nov 20 17:22:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 20 Nov 2016 17:22:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Merge cpe_ExprIsTrivial and exprIsTrivial (58d9f9b) Message-ID: <20161120172215.035BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/58d9f9b7a7f1b4d2c94183b9b9428983e7c83fe9/ghc >--------------------------------------------------------------- commit 58d9f9b7a7f1b4d2c94183b9b9428983e7c83fe9 Author: Ben Gamari Date: Wed Nov 2 17:03:05 2016 -0400 Merge cpe_ExprIsTrivial and exprIsTrivial Strangely my previous attempts at resolving this all seemed to end in perplexing segmentation faults in the GHC testsuite (including some rather recent attempts). Somehow this attempt miraculously works. However, there was one wrinkle that I still need to work out fully: we need to consider Lits as non-trivial in cpeArg. Failure to do this means that we would transform something like, $trModule = TrModule "HelloWorld"# into $trModule = case "HelloWorld"# of x { __DEFAULT -> TrModule x } Which then fails the consistentStgInfo check in CoreToStg for reasons that I am still trying to work out. Mark T12757 as fixed Reviewers: simonmar, simonpj, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2666 GHC Trac Issues: #11158 (cherry picked from commit 967dd5c9f59e532fe9d6484888a2bae7d02fba11) >--------------------------------------------------------------- 58d9f9b7a7f1b4d2c94183b9b9428983e7c83fe9 compiler/basicTypes/Literal.hs | 33 +++++++++++++++++++- compiler/coreSyn/CorePrep.hs | 69 +++++++++++++++++++++++++++--------------- 2 files changed, 76 insertions(+), 26 deletions(-) diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs index 18b4412..968ef6d 100644 --- a/compiler/basicTypes/Literal.hs +++ b/compiler/basicTypes/Literal.hs @@ -346,7 +346,38 @@ nullAddrLit = MachNullAddr -} -- | True if there is absolutely no penalty to duplicating the literal. --- False principally of strings +-- False principally of strings. +-- +-- "Why?", you say? I'm glad you asked. Well, for one duplicating strings would +-- blow up code sizes. Not only this, it's also unsafe. +-- +-- Consider a program that wants to traverse a string. One way it might do this +-- is to first compute the Addr# pointing to the end of the string, and then, +-- starting from the beginning, bump a pointer using eqAddr# to determine the +-- end. For instance, +-- +-- @ +-- -- Given pointers to the start and end of a string, count how many zeros +-- -- the string contains. +-- countZeros :: Addr# -> Addr# -> -> Int +-- countZeros start end = go start 0 +-- where +-- go off n +-- | off `addrEq#` end = n +-- | otherwise = go (off `plusAddr#` 1) n' +-- where n' | isTrue# (indexInt8OffAddr# off 0# ==# 0#) = n + 1 +-- | otherwise = n +-- @ +-- +-- Consider what happens if we considered strings to be trivial (and therefore +-- duplicable) and emitted a call like @countZeros "hello"# ("hello"# +-- `plusAddr`# 5)@. The beginning and end pointers do not belong to the same +-- string, meaning that an iteration like the above would blow up terribly. +-- This is what happened in #12757. +-- +-- Ultimately the solution here is to make primitive strings a bit more +-- structured, ensuring that the compiler can't inline in ways that will break +-- user code. One approach to this is described in #8472. litIsTrivial :: Literal -> Bool -- c.f. CoreUtils.exprIsTrivial litIsTrivial (MachStr _) = False diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index a3c70fd..de3fddc 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -5,7 +5,7 @@ Core pass to saturate constructors and PrimOps -} -{-# LANGUAGE BangPatterns, CPP #-} +{-# LANGUAGE BangPatterns, CPP, MultiWayIf #-} module CorePrep ( corePrepPgm, corePrepExpr, cvtLitInteger, @@ -382,7 +382,7 @@ cpeBind top_lvl env (NonRec bndr rhs) is_unlifted env bndr1 rhs -- See Note [Inlining in CorePrep] - ; if cpe_ExprIsTrivial rhs2 && isNotTopLevel top_lvl + ; if exprIsTrivial rhs2 && isNotTopLevel top_lvl then return (extendCorePrepEnvExpr env bndr rhs2, floats) else do { @@ -732,7 +732,7 @@ cpeApp top_env expr -- NB: depth from collect_args is right, because e2 is a trivial expression -- and thus its embedded Id *must* be at the same depth as any -- Apps it is under are type applications only (c.f. - -- cpe_ExprIsTrivial). But note that we need the type of the + -- exprIsTrivial). But note that we need the type of the -- expression, not the id. ; (app, floats) <- rebuild_app args e2 (exprType e2) emptyFloats stricts ; mb_saturate hd app floats depth } @@ -817,6 +817,40 @@ isLazyExpr _ = False -- CpeArg: produces a result satisfying CpeArg -- --------------------------------------------------------------------------- +{- +Note [ANF-ising literal string arguments] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Consider a program like, + + data Foo = Foo Addr# + + foo = Foo "turtle"# + +When we go to ANFise this we might think that we want to float the string +literal like we do any other non-trivial argument. This would look like, + + foo = u\ [] case "turtle"# of s { __DEFAULT__ -> Foo s } + +However, this 1) isn't necessary since strings are in a sense "trivial"; and 2) +wreaks havoc on the CAF annotations that we produce here since we the result +above is caffy since it is updateable. Ideally at some point in the future we +would like to just float the literal to the top level as suggested in #11312, + + s = "turtle"# + foo = Foo s + +However, until then we simply add a special case excluding literals from the +floating done by cpeArg. +-} + +-- | Is an argument okay to CPE? +okCpeArg :: CoreExpr -> Bool +-- Don't float literals. See Note [ANF-ising literal string arguments]. +okCpeArg (Lit _) = False +-- Do not eta expand a trivial argument +okCpeArg expr = not (exprIsTrivial expr) + -- This is where we arrange that a non-trivial argument is let-bound cpeArg :: CorePrepEnv -> Demand -> CoreArg -> Type -> UniqSM (Floats, CpeTriv) @@ -828,13 +862,13 @@ cpeArg env dmd arg arg_ty -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds - ; if cpe_ExprIsTrivial arg2 -- Do not eta expand a trivial argument - then return (floats2, arg2) - else do - { v <- newVar arg_ty - ; let arg3 = cpeEtaExpand (exprArity arg2) arg2 - arg_float = mkFloat dmd is_unlifted v arg3 - ; return (addFloat floats2 arg_float, varToCoreExpr v) } } + ; if okCpeArg arg2 + then do { v <- newVar arg_ty + ; let arg3 = cpeEtaExpand (exprArity arg2) arg2 + arg_float = mkFloat dmd is_unlifted v arg3 + ; return (addFloat floats2 arg_float, varToCoreExpr v) } + else return (floats2, arg2) + } where is_unlifted = isUnliftedType arg_ty want_float = wantFloatNested NonRecursive dmd is_unlifted @@ -921,21 +955,6 @@ of the scope of a `seq`, or dropped the `seq` altogether. ************************************************************************ -} -cpe_ExprIsTrivial :: CoreExpr -> Bool --- Version that doesn't consider an scc annotation to be trivial. --- See also 'exprIsTrivial' -cpe_ExprIsTrivial (Var _) = True -cpe_ExprIsTrivial (Type _) = True -cpe_ExprIsTrivial (Coercion _) = True -cpe_ExprIsTrivial (Lit _) = True -cpe_ExprIsTrivial (App e arg) = not (isRuntimeArg arg) && cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Lam b e) = not (isRuntimeVar b) && cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Tick t e) = not (tickishIsCode t) && cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Cast e _) = cpe_ExprIsTrivial e -cpe_ExprIsTrivial (Case e _ _ []) = cpe_ExprIsTrivial e - -- See Note [Empty case is trivial] in CoreUtils -cpe_ExprIsTrivial _ = False - {- -- ----------------------------------------------------------------------------- -- Eta reduction From git at git.haskell.org Mon Nov 21 10:34:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 Nov 2016 10:34:05 +0000 (UTC) Subject: [commit: ghc] master: A few typos in comments (ea37b83) Message-ID: <20161121103405.70FBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea37b837413e1de269e9f6dd9d70436a805b0a5c/ghc >--------------------------------------------------------------- commit ea37b837413e1de269e9f6dd9d70436a805b0a5c Author: Gabor Greif Date: Mon Nov 21 11:11:09 2016 +0100 A few typos in comments >--------------------------------------------------------------- ea37b837413e1de269e9f6dd9d70436a805b0a5c compiler/basicTypes/Module.hs | 2 +- compiler/iface/MkIface.hs | 2 +- compiler/rename/RnSource.hs | 4 ++-- compiler/typecheck/TcBinds.hs | 2 +- compiler/typecheck/TcClassDcl.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- testsuite/tests/concurrent/prog001/Trit.hs | 2 +- testsuite/tests/typecheck/should_compile/twins.hs | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs index 98c30a9..78abf21 100644 --- a/compiler/basicTypes/Module.hs +++ b/compiler/basicTypes/Module.hs @@ -189,7 +189,7 @@ import {-# SOURCE #-} Packages (componentIdString, improveUnitId, PackageConfigM -- - Same as Distribution.Package.ComponentId -- -- UnitId/InstalledUnitId: A ComponentId + a mapping from hole names --- (ModuleName) to Modules. This is how the compiler identifies instantatiated +-- (ModuleName) to Modules. This is how the compiler identifies instantiated -- components, and also is the main identifier by which GHC identifies things. -- - When Backpack is not being used, UnitId = ComponentId. -- this means a useful fiction for end-users is that there are diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 4651418..9e6fa62 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -1159,7 +1159,7 @@ check_old_iface hsc_env mod_summary src_modified maybe_iface -- two things may have changed that mean we should recompile M: -- * The interface export by a dependency of M has changed. -- * The compiler flags specified this time for M have changed --- in a manner that is significant for recompilaiton. +-- in a manner that is significant for recompilation. -- We return not just if we should recompile the object file but also -- if we should rebuild the interface file. checkVersions :: HscEnv diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index c71abfa..4d0f926 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -1267,8 +1267,8 @@ Consider this Here the declaration of S depends on the /data instance/ declaration for 'D Int'. That makes things a lot more complicated, especially -if the data instance is an assocaited type of an enclosing class instance. -(And the class instance might have several assocatiated type instances +if the data instance is an associated type of an enclosing class instance. +(And the class instance might have several associated type instances with different dependency structure!) Ugh. For now we simply don't allow promotion of data constructors for diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 60ef826..1c93962 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -1399,7 +1399,7 @@ We typecheck pattern bindings as follows. First tcLhs does this: gives us a fresh "mono_id" qm :: instantiate(ty), where qm has a fresh name. - Any fresh unification variables in instiatiate(ty) born here, not + Any fresh unification variables in instantiate(ty) born here, not deep under implications as would happen if we allocated them when we encountered q during tcPat. diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs index aa5e1c4..162e91a 100644 --- a/compiler/typecheck/TcClassDcl.hs +++ b/compiler/typecheck/TcClassDcl.hs @@ -457,7 +457,7 @@ tcATDefault emit_warn loc inst_subst defined_ats (ATI fam_tc defs) | tyConName fam_tc `elemNameSet` defined_ats = return [] - -- No user instance, have defaults ==> instatiate them + -- No user instance, have defaults ==> instantiate them -- Example: class C a where { type F a b :: *; type F a b = () } -- instance C [x] -- Then we want to generate the decl: type F [x] b = () diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 9a94eef..005be19 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -1731,7 +1731,7 @@ where G is injective; and wanted constraints [W] TF (alpha, beta) ~ fuv [W] fuv ~ (Int, ) -The injectivity will give rise to derived constraionts +The injectivity will give rise to derived constraints [D] gamma1 ~ alpha [D] Int ~ beta diff --git a/testsuite/tests/concurrent/prog001/Trit.hs b/testsuite/tests/concurrent/prog001/Trit.hs index b67d695..c42fe6d 100644 --- a/testsuite/tests/concurrent/prog001/Trit.hs +++ b/testsuite/tests/concurrent/prog001/Trit.hs @@ -61,7 +61,7 @@ subTrits x y = addTrits x (neg y) --- Shift left = *2 opertaion with Trit +-- Shift left = *2 operation with Trit shiftLeft :: Trit -> Trit shiftLeft (x, (y:ys)) = (x++ [y], ys) diff --git a/testsuite/tests/typecheck/should_compile/twins.hs b/testsuite/tests/typecheck/should_compile/twins.hs index 3fdc5b8..99c77aa 100644 --- a/testsuite/tests/typecheck/should_compile/twins.hs +++ b/testsuite/tests/typecheck/should_compile/twins.hs @@ -2,7 +2,7 @@ {-# LANGUAGE RankNTypes, LiberalTypeSynonyms #-} -- This test checks that deep skolemisation and deep --- instanatiation work right. A buggy prototype +-- instantiation work right. A buggy prototype -- of GHC 7.0, where the type checker generated wrong -- code, sent applyTypeToArgs into a loop. From git at git.haskell.org Mon Nov 21 19:22:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 Nov 2016 19:22:16 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #12855 (5bce207) Message-ID: <20161121192216.F24773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5bce207b61f105b3797d2be00dd1df2a28cbfab6/ghc >--------------------------------------------------------------- commit 5bce207b61f105b3797d2be00dd1df2a28cbfab6 Author: Ben Gamari Date: Mon Nov 21 13:42:15 2016 -0500 testsuite: Add test for #12855 Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2731 GHC Trac Issues: #12855 >--------------------------------------------------------------- 5bce207b61f105b3797d2be00dd1df2a28cbfab6 testsuite/tests/codeGen/should_run/T12855.hs | 9 +++++++++ testsuite/tests/codeGen/should_run/all.T | 1 + 2 files changed, 10 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T12855.hs b/testsuite/tests/codeGen/should_run/T12855.hs new file mode 100644 index 0000000..6cc9f2f --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T12855.hs @@ -0,0 +1,9 @@ +{- # OPTIONS_GHC -Wall -Werror #-} +module Main (main) where + +import qualified Data.ByteString as S +import qualified Data.ByteString.Char8 as S8 + +main :: IO () +main = (S8.concat (map S.singleton (S.unpack (S8.pack ""))) == S8.empty) `seq` return () + diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 4e68448..8d58222 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -147,3 +147,4 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) test('T12757', normal, compile_and_run, ['']) +test('T12855', normal, compile_and_run, ['']) From git at git.haskell.org Mon Nov 21 19:22:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 Nov 2016 19:22:20 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #12024 (926469f) Message-ID: <20161121192220.5F8FE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/926469fcd9ba25b1c8f4b8113d6b6683259b9d6d/ghc >--------------------------------------------------------------- commit 926469fcd9ba25b1c8f4b8113d6b6683259b9d6d Author: Ben Gamari Date: Mon Nov 21 13:43:35 2016 -0500 testsuite: Add test for #12024 Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2702 GHC Trac Issues: #12024 >--------------------------------------------------------------- 926469fcd9ba25b1c8f4b8113d6b6683259b9d6d testsuite/tests/ghci/scripts/T12024.script | 8 ++++++++ testsuite/tests/ghci/scripts/T12024.stdout | 1 + testsuite/tests/ghci/scripts/all.T | 1 + 3 files changed, 10 insertions(+) diff --git a/testsuite/tests/ghci/scripts/T12024.script b/testsuite/tests/ghci/scripts/T12024.script new file mode 100644 index 0000000..4e64863 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12024.script @@ -0,0 +1,8 @@ +:set -XPatternSynonyms -XGADTs +data A a where X :: A [x] + +pattern X' = X + +-- This should render the equality with ~ despite the pattern internally using +-- GHC.Prim.~#. +:info X' diff --git a/testsuite/tests/ghci/scripts/T12024.stdout b/testsuite/tests/ghci/scripts/T12024.stdout new file mode 100644 index 0000000..e01f43a --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12024.stdout @@ -0,0 +1 @@ +pattern X' :: () => a ~ [x] => A a -- Defined at :4:1 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 4927abc..6dcc6b7 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -265,3 +265,4 @@ test('T12091', [expect_broken(12091), extra_run_opts('-fobject-code')], ghci_script, ['T12091.script']) test('T12523', normal, ghci_script, ['T12523.script']) +test('T12024', normal, ghci_script, ['T12024.script']) From git at git.haskell.org Mon Nov 21 19:22:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 Nov 2016 19:22:23 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add (still broken) testcase for #12447 (b98dbdf) Message-ID: <20161121192223.BA3B63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b98dbdf667744c288f03525d5e012563d31143ce/ghc >--------------------------------------------------------------- commit b98dbdf667744c288f03525d5e012563d31143ce Author: Ben Gamari Date: Mon Nov 21 13:43:48 2016 -0500 testsuite: Add (still broken) testcase for #12447 Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2703 GHC Trac Issues: #12447 >--------------------------------------------------------------- b98dbdf667744c288f03525d5e012563d31143ce testsuite/tests/ghci/scripts/T12447.script | 9 +++++++++ testsuite/tests/ghci/scripts/T12447.stdout | 3 +++ testsuite/tests/ghci/scripts/all.T | 1 + 3 files changed, 13 insertions(+) diff --git a/testsuite/tests/ghci/scripts/T12447.script b/testsuite/tests/ghci/scripts/T12447.script new file mode 100644 index 0000000..6003a43 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12447.script @@ -0,0 +1,9 @@ +:set -XRankNTypes -XConstraintKinds -XTypeApplications + +import Data.Typeable + +class Deferrable p where deferEither :: proxy p -> (p => r) -> Either String r + +instance (Typeable a, Typeable b) => Deferrable (a ~ b) where deferEither = undefined + +:t deferEither @(_ ~ _) diff --git a/testsuite/tests/ghci/scripts/T12447.stdout b/testsuite/tests/ghci/scripts/T12447.stdout new file mode 100644 index 0000000..67bbc9b --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12447.stdout @@ -0,0 +1,3 @@ +deferEither @(_ ~ _) + :: Deferrable (w2 ~ w1) => + proxy (w2 ~ w1) -> (w2 ~ w1 => r) -> Either String r diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 6dcc6b7..e9a41a9 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -266,3 +266,4 @@ test('T12091', ghci_script, ['T12091.script']) test('T12523', normal, ghci_script, ['T12523.script']) test('T12024', normal, ghci_script, ['T12024.script']) +test('T12447', expect_broken(12447), ghci_script, ['T12447.script']) From git at git.haskell.org Mon Nov 21 19:22:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 21 Nov 2016 19:22:27 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add (still failing) testcase for #12550 (e7ec521) Message-ID: <20161121192227.1A7623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e7ec521ecf7dfcb42d39763e84d3447127747aed/ghc >--------------------------------------------------------------- commit e7ec521ecf7dfcb42d39763e84d3447127747aed Author: Ben Gamari Date: Mon Nov 21 13:44:21 2016 -0500 testsuite: Add (still failing) testcase for #12550 I thought that this would naturally resolve itself with the elimination of the Type pretty-printer but somehow all of the stars in result position of an arrow are still rendered in non-Unicode syntax. Quite odd. Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2704 GHC Trac Issues: #12550 >--------------------------------------------------------------- e7ec521ecf7dfcb42d39763e84d3447127747aed testsuite/tests/ghci/scripts/T12550.script | 10 ++++++ testsuite/tests/ghci/scripts/T12550.stdout | 53 ++++++++++++++++++++++++++++++ testsuite/tests/ghci/scripts/all.T | 1 + 3 files changed, 64 insertions(+) diff --git a/testsuite/tests/ghci/scripts/T12550.script b/testsuite/tests/ghci/scripts/T12550.script new file mode 100644 index 0000000..3964035 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12550.script @@ -0,0 +1,10 @@ +:set -fprint-unicode-syntax -fprint-explicit-foralls + +:t fmap +:i fmap +:k Functor +:m + GHC.Generics +:i Functor +:t datatypeName +:i datatypeName +:t (:*:) diff --git a/testsuite/tests/ghci/scripts/T12550.stdout b/testsuite/tests/ghci/scripts/T12550.stdout new file mode 100644 index 0000000..442bc05 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12550.stdout @@ -0,0 +1,53 @@ +fmap ∷ ∀ {f ∷ ★ → ★} {b} {a}. Functor f ⇒ (a → b) → f a → f b +class Functor (f ∷ ★ → ★) where + fmap ∷ ∀ a b. (a → b) → f a → f b + ... + -- Defined in ‘GHC.Base’ +Functor ∷ (★ → ★) → Constraint +class Functor (f ∷ ★ → ★) where + fmap ∷ ∀ a b. (a → b) → f a → f b + (<$) ∷ ∀ a b. a → f b → f a + {-# MINIMAL fmap #-} + -- Defined in ‘GHC.Base’ +instance Functor V1 -- Defined in ‘GHC.Generics’ +instance Functor (URec Char) -- Defined in ‘GHC.Generics’ +instance Functor (URec Double) -- Defined in ‘GHC.Generics’ +instance Functor (URec Float) -- Defined in ‘GHC.Generics’ +instance Functor (URec Int) -- Defined in ‘GHC.Generics’ +instance Functor (URec Word) -- Defined in ‘GHC.Generics’ +instance Functor U1 -- Defined in ‘GHC.Generics’ +instance ∀ (f ∷ ★ → ★). Functor f ⇒ Functor (Rec1 f) + -- Defined in ‘GHC.Generics’ +instance Functor Par1 -- Defined in ‘GHC.Generics’ +instance ∀ i (c ∷ Meta) (f ∷ ★ → ★). Functor f ⇒ Functor (M1 i c f) + -- Defined in ‘GHC.Generics’ +instance ∀ i c. Functor (K1 i c) -- Defined in ‘GHC.Generics’ +instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★). + (Functor g, Functor f) ⇒ + Functor (f :.: g) + -- Defined in ‘GHC.Generics’ +instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★). + (Functor g, Functor f) ⇒ + Functor (f :+: g) + -- Defined in ‘GHC.Generics’ +instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★). + (Functor g, Functor f) ⇒ + Functor (f :*: g) + -- Defined in ‘GHC.Generics’ +instance ∀ a. Functor (Either a) -- Defined in ‘Data.Either’ +instance Functor [] -- Defined in ‘GHC.Base’ +instance Functor Maybe -- Defined in ‘GHC.Base’ +instance Functor IO -- Defined in ‘GHC.Base’ +instance ∀ r. Functor ((->) r) -- Defined in ‘GHC.Base’ +instance ∀ a. Functor ((,) a) -- Defined in ‘GHC.Base’ +datatypeName + ∷ ∀ {d} {t ∷ ★ → (★ → ★) → ★ → ★} {f ∷ ★ → ★} {a}. + Datatype d ⇒ + t d f a → [Char] +class Datatype (d ∷ k) where + datatypeName ∷ ∀ k1 (t ∷ k → (k1 → ★) → k1 → ★) (f ∷ k1 + → ★) (a ∷ k1). + t d f a → [Char] + ... + -- Defined in ‘GHC.Generics’ +(:*:) ∷ ∀ {g ∷ ★ → ★} {p} {f ∷ ★ → ★}. f p → g p → (:*:) f g p diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index e9a41a9..53cb1e3 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -267,3 +267,4 @@ test('T12091', test('T12523', normal, ghci_script, ['T12523.script']) test('T12024', normal, ghci_script, ['T12024.script']) test('T12447', expect_broken(12447), ghci_script, ['T12447.script']) +test('T12550', expect_broken(12550), ghci_script, ['T12550.script']) From git at git.haskell.org Tue Nov 22 21:29:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 Nov 2016 21:29:10 +0000 (UTC) Subject: [commit: ghc] master: add ieee754 next* functions to math_funs (ea76a21) Message-ID: <20161122212910.EBA7B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea76a213d14709ded827abeb2246e4daa154e92e/ghc >--------------------------------------------------------------- commit ea76a213d14709ded827abeb2246e4daa154e92e Author: Ben Gamari Date: Mon Nov 21 17:08:38 2016 -0500 add ieee754 next* functions to math_funs Reviewers: austin, simonmar, trofi, bgamari Reviewed By: bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2671 GHC Trac Issues: #12802 >--------------------------------------------------------------- ea76a213d14709ded827abeb2246e4daa154e92e compiler/cmm/CLabel.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 0b64e3e..960220f 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -842,7 +842,12 @@ math_funs = mkUniqSet [ (fsLit "significand"), (fsLit "significandf"), (fsLit "significandl"), (fsLit "y0"), (fsLit "y0f"), (fsLit "y0l"), (fsLit "y1"), (fsLit "y1f"), (fsLit "y1l"), - (fsLit "yn"), (fsLit "ynf"), (fsLit "ynl") + (fsLit "yn"), (fsLit "ynf"), (fsLit "ynl"), + + -- These functions are described in IEEE Std 754-2008 - + -- Standard for Floating-Point Arithmetic and ISO/IEC TS 18661 + (fsLit "nextup"), (fsLit "nextupf"), (fsLit "nextupl"), + (fsLit "nextdown"), (fsLit "nextdownf"), (fsLit "nextdownl") ] -- ----------------------------------------------------------------------------- From git at git.haskell.org Tue Nov 22 21:29:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 Nov 2016 21:29:14 +0000 (UTC) Subject: [commit: ghc] master: Implement fine-grained `-Werror=...` facility (514acfe) Message-ID: <20161122212914.A94193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/514acfe4c4e61941c2fa2e06cff02f6e4424e5e6/ghc >--------------------------------------------------------------- commit 514acfe4c4e61941c2fa2e06cff02f6e4424e5e6 Author: Maciej Bielecki Date: Mon Nov 21 17:08:45 2016 -0500 Implement fine-grained `-Werror=...` facility This patch add new options `-Werror=...`, `-Wwarn=...` and `-Wno-error=...` (synonym for `-Wwarn=...`). Semantics: - `-Werror` marks all warnings as fatal, including those that don't have a warning flag, and CPP warnings. - `-Werror=...` enables a warning and marks it as fatal - `-Wwarn=...` marks a warning as non-fatal, but doesn't disable it Test Plan: validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: mpickering, svenpanne, RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2706 GHC Trac Issues: #11219 >--------------------------------------------------------------- 514acfe4c4e61941c2fa2e06cff02f6e4424e5e6 compiler/main/DynFlags.hs | 41 ++++++++++++++++++++-- compiler/main/ErrUtils.hs | 7 ++++ compiler/main/HscTypes.hs | 5 ++- docs/users_guide/using-warnings.rst | 17 +++++++++ .../tests/warnings/should_compile/Werror01.hs | 5 +++ .../tests/warnings/should_compile/Werror01.stderr | 2 ++ .../tests/warnings/should_compile/Werror02.hs | 5 +++ .../tests/warnings/should_compile/Werror02.stderr | 2 ++ testsuite/tests/warnings/should_compile/all.T | 3 ++ .../tests/warnings/should_compile/sel_werror.hs | 3 ++ testsuite/tests/warnings/should_fail/WerrorFail.hs | 6 ++++ .../tests/warnings/should_fail/WerrorFail.stderr | 6 ++++ testsuite/tests/warnings/should_fail/all.T | 1 + utils/mkUserGuidePart/Options/Warnings.hs | 10 ++++++ 14 files changed, 108 insertions(+), 5 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 514acfe4c4e61941c2fa2e06cff02f6e4424e5e6 From git at git.haskell.org Tue Nov 22 21:29:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 Nov 2016 21:29:17 +0000 (UTC) Subject: [commit: ghc] master: Ignore Hadrian build products. (4c0dc76) Message-ID: <20161122212917.7676E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4c0dc768ce8779d50a0c4827534853cfdf258ad3/ghc >--------------------------------------------------------------- commit 4c0dc768ce8779d50a0c4827534853cfdf258ad3 Author: Edward Z. Yang Date: Mon Nov 21 17:09:02 2016 -0500 Ignore Hadrian build products. Test Plan: none Reviewers: austin, snowleopard, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2722 >--------------------------------------------------------------- 4c0dc768ce8779d50a0c4827534853cfdf258ad3 .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 3c9a2fb..f58d782 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,13 @@ configure # Temporarily generated configure files confdefs.h +# Hadrian files +stage0 +stage1 +stage2 +_build +hadrian + # ----------------------------------------------------------------------------- # Ignore any overlapped darcs repos and back up files From git at git.haskell.org Tue Nov 22 21:29:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 Nov 2016 21:29:20 +0000 (UTC) Subject: [commit: ghc] master: Make transformers upstream repository location consistent with others (7e4b611) Message-ID: <20161122212920.234CF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e4b6110b43e1a9f3c41afbaae156b4dcf4a460a/ghc >--------------------------------------------------------------- commit 7e4b6110b43e1a9f3c41afbaae156b4dcf4a460a Author: Demi Obenour Date: Mon Nov 21 17:09:27 2016 -0500 Make transformers upstream repository location consistent with others Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2733 >--------------------------------------------------------------- 7e4b6110b43e1a9f3c41afbaae156b4dcf4a460a packages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages b/packages index ac4d3e5..86b1578 100644 --- a/packages +++ b/packages @@ -57,7 +57,7 @@ libraries/pretty - - https:/ libraries/process - - ssh://git at github.com/haskell/process.git libraries/terminfo - - https://github.com/judah/terminfo.git libraries/time - - https://github.com/haskell/time.git -libraries/transformers - - http://git.haskell.org/darcs-mirrors/transformers.git +libraries/transformers - - https://git.haskell.org/darcs-mirrors/transformers.git libraries/unix - - ssh://git at github.com/haskell/unix.git libraries/Win32 - - https://github.com/haskell/win32.git libraries/xhtml - - https://github.com/haskell/xhtml.git From git at git.haskell.org Tue Nov 22 21:29:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 22 Nov 2016 21:29:22 +0000 (UTC) Subject: [commit: ghc] master: ghc/hschooks.c: Fix include path of Rts.h (1399c8b) Message-ID: <20161122212922.CA6933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1399c8b481bd04848377b2f8a449e0bb09f0bb65/ghc >--------------------------------------------------------------- commit 1399c8b481bd04848377b2f8a449e0bb09f0bb65 Author: Ben Gamari Date: Tue Nov 22 00:43:19 2016 -0500 ghc/hschooks.c: Fix include path of Rts.h We need to ensure that we don't include Rts.h from bootstrap compiler. See #12796. Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2698 GHC Trac Issues: #12796 >--------------------------------------------------------------- 1399c8b481bd04848377b2f8a449e0bb09f0bb65 ghc/hschooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghc/hschooks.c b/ghc/hschooks.c index 46a0944..3a42801 100644 --- a/ghc/hschooks.c +++ b/ghc/hschooks.c @@ -5,7 +5,7 @@ in instead of the defaults. */ #include "../rts/PosixSource.h" -#include "Rts.h" +#include "../includes/Rts.h" #include "HsFFI.h" From git at git.haskell.org Wed Nov 23 03:05:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 23 Nov 2016 03:05:21 +0000 (UTC) Subject: [commit: ghc] master: Allow to unregister threadWaitReadSTM action. (f430253) Message-ID: <20161123030521.393D73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f43025340d05d3c6085c41e441d278745f34a317/ghc >--------------------------------------------------------------- commit f43025340d05d3c6085c41e441d278745f34a317 Author: Alexander Vershilov Date: Tue Nov 22 20:57:08 2016 -0500 Allow to unregister threadWaitReadSTM action. Allow to unregister threadWaitReadSTM/threadWaitWriteSTM on a non-threaded runtime. Previosly noop action was returned, as a result it was not possible to unregister action, unless data arrives to Fd or it's closed. Fixes #12852. Reviewers: simonmar, hvr, austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2729 GHC Trac Issues: #12852 >--------------------------------------------------------------- f43025340d05d3c6085c41e441d278745f34a317 libraries/base/GHC/Conc/IO.hs | 8 ++++---- libraries/base/tests/T12852.hs | 20 ++++++++++++++++++++ .../base/tests/T12852.stdout | 1 + libraries/base/tests/all.T | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/Conc/IO.hs b/libraries/base/GHC/Conc/IO.hs index 1e9ffd5..be77313 100644 --- a/libraries/base/GHC/Conc/IO.hs +++ b/libraries/base/GHC/Conc/IO.hs @@ -125,12 +125,12 @@ threadWaitReadSTM fd #endif | otherwise = do m <- Sync.newTVarIO False - _ <- Sync.forkIO $ do + t <- Sync.forkIO $ do threadWaitRead fd Sync.atomically $ Sync.writeTVar m True let waitAction = do b <- Sync.readTVar m if b then return () else retry - let killAction = return () + let killAction = Sync.killThread t return (waitAction, killAction) -- | Returns an STM action that can be used to wait until data @@ -144,12 +144,12 @@ threadWaitWriteSTM fd #endif | otherwise = do m <- Sync.newTVarIO False - _ <- Sync.forkIO $ do + t <- Sync.forkIO $ do threadWaitWrite fd Sync.atomically $ Sync.writeTVar m True let waitAction = do b <- Sync.readTVar m if b then return () else retry - let killAction = return () + let killAction = Sync.killThread t return (waitAction, killAction) -- | Close a file descriptor in a concurrency-safe way (GHC only). If diff --git a/libraries/base/tests/T12852.hs b/libraries/base/tests/T12852.hs new file mode 100644 index 0000000..5bf80d5 --- /dev/null +++ b/libraries/base/tests/T12852.hs @@ -0,0 +1,20 @@ +import GHC.Conc +import GHC.IO +import GHC.IO.FD as FD +import System.Posix.IO +import System.Posix.Types + +main = do + (rfd,wfd) <- createPipe + (waitread, unregister) <- threadWaitReadSTM rfd + unregister + result0 <- atomically $ (fmap (const False) waitread) `orElse` return True + print result0 + fdWrite wfd "test" + threadDelay 20000 + result1 <- atomically $ (fmap (const False) waitread) `orElse` return True + print result1 + (waitread1, _) <- threadWaitReadSTM rfd + threadDelay 20000 + result2 <- atomically $ (fmap (const True) waitread1) `orElse` return False + print result2 diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun03.stdout b/libraries/base/tests/T12852.stdout similarity index 66% copy from testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun03.stdout copy to libraries/base/tests/T12852.stdout index dbde422..b8ca7e7 100644 --- a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun03.stdout +++ b/libraries/base/tests/T12852.stdout @@ -1,2 +1,3 @@ True True +True diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 64ecc88..a9aee1e 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -205,3 +205,4 @@ test('T9848', test('T10149', normal, compile_and_run, ['']) test('T11334a', normal, compile_and_run, ['']) test('T11555', normal, compile_and_run, ['']) +test('T12852', when(opsys('mingw32'), skip), compile_and_run, ['']) From git at git.haskell.org Thu Nov 24 01:13:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 01:13:38 +0000 (UTC) Subject: [commit: ghc] master: Collect wildcards in sum types during renaming (#12711) (14ac372) Message-ID: <20161124011338.2B2333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/14ac3725eb1e93289f205cbf432b537f6c84c4dc/ghc >--------------------------------------------------------------- commit 14ac3725eb1e93289f205cbf432b537f6c84c4dc Author: Ömer Sinan Ağacan Date: Thu Nov 24 04:12:17 2016 +0300 Collect wildcards in sum types during renaming (#12711) This patch also removes the "catch all" pattern in the function and explicitly lists constructors to get a warning in the future if a new `HsType` was added. Reviewers: bgamari, austin, simonpj Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2753 GHC Trac Issues: #12711 >--------------------------------------------------------------- 14ac3725eb1e93289f205cbf432b537f6c84c4dc compiler/rename/RnTypes.hs | 7 +++++-- testsuite/tests/unboxedsums/T12711.script | 2 ++ testsuite/tests/unboxedsums/T12711.stdout | 1 + testsuite/tests/unboxedsums/all.T | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs index 56a0331..c548c4d 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/rename/RnTypes.hs @@ -1025,6 +1025,7 @@ collectAnonWildCards lty = go lty HsListTy ty -> go ty HsPArrTy ty -> go ty HsTupleTy _ tys -> gos tys + HsSumTy tys -> gos tys HsOpTy ty1 _ ty2 -> go ty1 `mappend` go ty2 HsParTy ty -> go ty HsIParamTy _ ty -> go ty @@ -1041,8 +1042,10 @@ collectAnonWildCards lty = go lty HsQualTy { hst_ctxt = L _ ctxt , hst_body = ty } -> gos ctxt `mappend` go ty HsSpliceTy (HsSpliced _ (HsSplicedTy ty)) _ -> go $ L noSrcSpan ty - -- HsQuasiQuoteTy, HsSpliceTy, HsCoreTy, HsTyLit - _ -> mempty + HsSpliceTy{} -> mempty + HsCoreTy{} -> mempty + HsTyLit{} -> mempty + HsTyVar{} -> mempty gos = mconcat . map go diff --git a/testsuite/tests/unboxedsums/T12711.script b/testsuite/tests/unboxedsums/T12711.script new file mode 100644 index 0000000..898fdc1 --- /dev/null +++ b/testsuite/tests/unboxedsums/T12711.script @@ -0,0 +1,2 @@ +:set -XUnboxedSums +:kind (# _ | _ #) diff --git a/testsuite/tests/unboxedsums/T12711.stdout b/testsuite/tests/unboxedsums/T12711.stdout new file mode 100644 index 0000000..13070df --- /dev/null +++ b/testsuite/tests/unboxedsums/T12711.stdout @@ -0,0 +1 @@ +(# _ | _ #) :: TYPE 'GHC.Types.UnboxedSumRep diff --git a/testsuite/tests/unboxedsums/all.T b/testsuite/tests/unboxedsums/all.T index ed41084..290ae43 100644 --- a/testsuite/tests/unboxedsums/all.T +++ b/testsuite/tests/unboxedsums/all.T @@ -22,6 +22,7 @@ test('thunk', only_ways(['normal']), compile_and_run, ['']) test('T12375', only_ways(['normal']), compile_and_run, ['']) test('empty_sum', only_ways(['normal']), compile_and_run, ['']) test('sum_rr', normal, compile_fail, ['']) +test('T12711', only_ways(['ghci']), ghci_script, ['T12711.script']) # TODO: Need to run this in --slow mode only # test('sum_api_annots', From git at git.haskell.org Thu Nov 24 09:12:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:27 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Make a panic into an ASSERT (16036a5) Message-ID: <20161124091227.CCAB73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/16036a53c0165668e9d9599eab1b4c58a725f5e0/ghc >--------------------------------------------------------------- commit 16036a53c0165668e9d9599eab1b4c58a725f5e0 Author: Simon Peyton Jones Date: Tue Oct 25 15:21:31 2016 +0100 Make a panic into an ASSERT >--------------------------------------------------------------- 16036a53c0165668e9d9599eab1b4c58a725f5e0 compiler/typecheck/FunDeps.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/FunDeps.hs b/compiler/typecheck/FunDeps.hs index 4da6795..0ca22bd 100644 --- a/compiler/typecheck/FunDeps.hs +++ b/compiler/typecheck/FunDeps.hs @@ -195,11 +195,9 @@ improveFromInstEnv :: InstEnvs -> [FunDepEqn loc] -- Needs to be a FunDepEqn because -- of quantified variables -- Post: Equations oriented from the template (matching instance) to the workitem! -improveFromInstEnv _inst_env _ pred - | not (isClassPred pred) - = panic "improveFromInstEnv: not a class predicate" improveFromInstEnv inst_env mk_loc pred - | Just (cls, tys) <- getClassPredTys_maybe pred + | Just (cls, tys) <- ASSERT2( isClassPred pred, ppr pred ) + getClassPredTys_maybe pred , let (cls_tvs, cls_fds) = classTvsFds cls instances = classInstances inst_env cls rough_tcs = roughMatchTcs tys From git at git.haskell.org Thu Nov 24 09:12:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:30 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Fix a bug in mk_superclasses_of (811bde8) Message-ID: <20161124091230.8B3BF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/811bde8637d9736373132543212a3df9b90a31fd/ghc >--------------------------------------------------------------- commit 811bde8637d9736373132543212a3df9b90a31fd Author: Simon Peyton Jones Date: Tue Oct 25 15:22:17 2016 +0100 Fix a bug in mk_superclasses_of This bug meant that we were less eager about expanding tuple superclasses than we should have been; i.e. we stopped too soon. That's not fatal, beause we expand more superclasses later, but it's less efficient. >--------------------------------------------------------------- 811bde8637d9736373132543212a3df9b90a31fd compiler/typecheck/TcCanonical.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index 3419400..209eec9 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -432,15 +432,20 @@ mk_superclasses_of :: NameSet -> CtEvidence -> Class -> [Type] -> TcS [Ct] -- Always return this class constraint, -- and expand its superclasses mk_superclasses_of rec_clss ev cls tys - | loop_found = return [this_ct] -- cc_pend_sc of this_ct = True - | otherwise = do { sc_cts <- mk_strict_superclasses rec_clss' ev cls tys + | loop_found = do { traceTcS "mk_superclasses_of: loop" (ppr cls <+> ppr tys) + ; return [this_ct] } -- cc_pend_sc of this_ct = True + | otherwise = do { traceTcS "mk_superclasses_of" (vcat [ ppr cls <+> ppr tys + , ppr (isCTupleClass cls) + , ppr rec_clss + ]) + ; sc_cts <- mk_strict_superclasses rec_clss' ev cls tys ; return (this_ct : sc_cts) } -- cc_pend_sc of this_ct = False where cls_nm = className cls - loop_found = cls_nm `elemNameSet` rec_clss - rec_clss' | isCTupleClass cls = rec_clss -- Never contribute to recursion - | otherwise = rec_clss `extendNameSet` cls_nm + loop_found = not (isCTupleClass cls) && cls_nm `elemNameSet` rec_clss + -- Tuples neveer contribute to recursion, and can be nested + rec_clss' = rec_clss `extendNameSet` cls_nm this_ct = CDictCan { cc_ev = ev, cc_class = cls, cc_tyargs = tys , cc_pend_sc = loop_found } -- NB: If there is a loop, we cut off, so we have not @@ -460,7 +465,8 @@ mk_strict_superclasses rec_clss ev cls tys = return [] -- Wanteds with no variables yield no deriveds. -- See Note [Improvement from Ground Wanteds] - | otherwise -- Wanted/Derived case, just add those SC that can lead to improvement. + | otherwise -- Wanted/Derived case, just add Derived superclasses + -- that can lead to improvement. = do { let loc = ctEvLoc ev ; sc_evs <- mapM (newDerivedNC loc) (immSuperClasses cls tys) ; concatMapM (mk_superclasses rec_clss) sc_evs } From git at git.haskell.org Thu Nov 24 09:12:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:33 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Comments only in TcType (be6709e) Message-ID: <20161124091233.3EB043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/be6709ea39c0a642c14df82bd3419ef702d8f1fe/ghc >--------------------------------------------------------------- commit be6709ea39c0a642c14df82bd3419ef702d8f1fe Author: Simon Peyton Jones Date: Tue Oct 25 15:25:03 2016 +0100 Comments only in TcType >--------------------------------------------------------------- be6709ea39c0a642c14df82bd3419ef702d8f1fe compiler/typecheck/TcType.hs | 72 +++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 4dbe4a3..99927aa 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -1436,7 +1436,13 @@ tcSplitMethodTy ty | otherwise = pprPanic "tcSplitMethodTy" (ppr ty) ------------------------ + +{- ********************************************************************* +* * + Type equalities +* * +********************************************************************* -} + tcEqKind :: TcKind -> TcKind -> Bool tcEqKind = tcEqType @@ -1546,39 +1552,9 @@ pickyEqType ty1 ty2 = isNothing $ tc_eq_type (const Nothing) ty1 ty2 -{- Note [Expanding superclasses] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When we expand superclasses, we use the following algorithm: - -expand( so_far, pred ) returns the transitive superclasses of pred, - not including pred itself - 1. If pred is not a class constraint, return empty set - Otherwise pred = C ts - 2. If C is in so_far, return empty set (breaks loops) - 3. Find the immediate superclasses constraints of (C ts) - 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss ) - -Notice that - - * With normal Haskell-98 classes, the loop-detector will never bite, - so we'll get all the superclasses. - - * Since there is only a finite number of distinct classes, expansion - must terminate. - - * The loop breaking is a bit conservative. Notably, a tuple class - could contain many times without threatening termination: - (Eq a, (Ord a, Ix a)) - And this is try of any class that we can statically guarantee - as non-recursive (in some sense). For now, we just make a special - case for tuples. Somthing better would be cool. - -See also TcTyDecls.checkClassCycles. - - -************************************************************************ +{- ********************************************************************* * * -\subsection{Predicate types} + Predicate types * * ************************************************************************ @@ -1760,7 +1736,35 @@ isImprovementPred ty ClassPred cls _ -> classHasFds cls IrredPred {} -> True -- Might have equalities after reduction? -{- +{- Note [Expanding superclasses] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When we expand superclasses, we use the following algorithm: + +expand( so_far, pred ) returns the transitive superclasses of pred, + not including pred itself + 1. If pred is not a class constraint, return empty set + Otherwise pred = C ts + 2. If C is in so_far, return empty set (breaks loops) + 3. Find the immediate superclasses constraints of (C ts) + 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss ) + +Notice that + + * With normal Haskell-98 classes, the loop-detector will never bite, + so we'll get all the superclasses. + + * Since there is only a finite number of distinct classes, expansion + must terminate. + + * The loop breaking is a bit conservative. Notably, a tuple class + could contain many times without threatening termination: + (Eq a, (Ord a, Ix a)) + And this is try of any class that we can statically guarantee + as non-recursive (in some sense). For now, we just make a special + case for tuples. Somthing better would be cool. + +See also TcTyDecls.checkClassCycles. + Note [Inheriting implicit parameters] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this: From git at git.haskell.org Thu Nov 24 09:12:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:35 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Add elemDVarEnv (3c14858) Message-ID: <20161124091235.E62833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/3c14858d2b741179964816c6bf664e15ab58c9b8/ghc >--------------------------------------------------------------- commit 3c14858d2b741179964816c6bf664e15ab58c9b8 Author: Simon Peyton Jones Date: Wed Nov 23 09:05:33 2016 +0000 Add elemDVarEnv I need this in a later patch >--------------------------------------------------------------- 3c14858d2b741179964816c6bf664e15ab58c9b8 compiler/basicTypes/VarEnv.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/basicTypes/VarEnv.hs b/compiler/basicTypes/VarEnv.hs index 146a2fc..dcb64a9 100644 --- a/compiler/basicTypes/VarEnv.hs +++ b/compiler/basicTypes/VarEnv.hs @@ -32,7 +32,7 @@ module VarEnv ( dVarEnvElts, extendDVarEnv, extendDVarEnv_C, extendDVarEnvList, - lookupDVarEnv, + lookupDVarEnv, elemDVarEnv, isEmptyDVarEnv, foldDVarEnv, mapDVarEnv, modifyDVarEnv, @@ -571,6 +571,9 @@ delDVarEnvList = delListFromUDFM isEmptyDVarEnv :: DVarEnv a -> Bool isEmptyDVarEnv = isNullUDFM +elemDVarEnv :: Var -> DVarEnv a -> Bool +elemDVarEnv = elemUDFM + extendDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> Var -> a -> DVarEnv a extendDVarEnv_C = addToUDFM_C From git at git.haskell.org Thu Nov 24 09:12:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:39 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Another major constraint-solver refactoring (6e6d93b) Message-ID: <20161124091239.823B43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/6e6d93b8b713339dc5f74e8f93e35d0d94014d63/ghc >--------------------------------------------------------------- commit 6e6d93b8b713339dc5f74e8f93e35d0d94014d63 Author: Simon Peyton Jones Date: Tue Oct 25 17:41:45 2016 +0100 Another major constraint-solver refactoring This patch takes further my refactoring of the constraint solver, which I've been doing over the last couple of months in consultation with Richard. It fixes a number of tricky bugs that made the constraint solver actually go into a loop, including Trac #12526 Trac #12444 Trac #12538 The main changes are these * Flatten unification variables (fmvs/fuvs) appear on the LHS of a tvar/tyvar equality; thus fmv ~ alpha and not alpha ~ fmv See Note [Put flatten unification variables on the left] in TcUnify. This is implemented by TcUnify.swapOverTyVars. * Don't reduce a "loopy" CFunEqCan where the fsk appears on the LHS: F t1 .. tn ~ fsk where 'fsk' is free in t1..tn. See Note [FunEq occurs-check principle] in TcInteract This neatly stops some infinite loops that people reported; and it allows us to delete some crufty code in reduce_top_fun_eq. And it appears to be no loss whatsoever. As well as fixing loops, ContextStack2 and T5837 both terminate when they didn't before. * Previously we generated "derived shadow" constraints from Wanteds, but we could (and sometimes did; Trac #xxxx) repeatedly generate a derived shadow from the same Wanted. A big change in this patch is to have two kinds of Wanteds: [WD] behaves like a pair of a Wanted and a Derived [W] behaves like a Wanted only See CtFlavour and ShadowInfo in TcRnTypes, and the ctev_nosh field of a Wanted. This turned out to be a lot simpler. A [WD] gets split into a [W] and a [D] in TcSMonad.maybeEmitShaodow. See TcSMonad Note [The improvement story and derived shadows] * Rather than have a separate inert_model in the InertCans, I've put the derived equalities back into inert_eqs. We weren't gaining anything from a separate field. * Previously we had a mode for the constraint solver in which it would more aggressively solve Derived constraints; it was used for simplifying the context of a 'deriving' clause, or a 'default' delcaration, for example. But the complexity wasn't worth it; now I just make proper Wanted constraints. See TcMType.cloneWC * Don't generate injectivity improvement for Givens; see Note [No FunEq improvement for Givens] in TcInteract * solveSimpleWanteds leaves the insolubles in-place rather than returning them. Simpler. I also did lots of work on comments. >--------------------------------------------------------------- 6e6d93b8b713339dc5f74e8f93e35d0d94014d63 compiler/iface/ToIface.hs | 2 + compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcErrors.hs | 21 +- compiler/typecheck/TcExpr.hs | 1 + compiler/typecheck/TcFlatten.hs | 307 +++--- compiler/typecheck/TcInteract.hs | 777 ++++++++------ compiler/typecheck/TcMType.hs | 25 +- compiler/typecheck/TcRnTypes.hs | 264 +++-- compiler/typecheck/TcRules.hs | 21 +- compiler/typecheck/TcSMonad.hs | 1134 +++++++++----------- compiler/typecheck/TcSimplify.hs | 146 +-- compiler/typecheck/TcType.hs | 18 + compiler/typecheck/TcUnify.hs | 45 +- .../tests/indexed-types/should_compile/T10226.hs | 57 + .../tests/indexed-types/should_compile/T10634.hs | 15 + .../tests/indexed-types/should_compile/T12526.hs | 70 ++ .../tests/indexed-types/should_compile/T12538.hs | 40 + .../indexed-types/should_compile/T12538.stderr | 13 + .../indexed-types/should_compile/T3017.stderr | 2 +- .../tests/indexed-types/should_compile/T4338.hs | 35 +- testsuite/tests/indexed-types/should_compile/all.T | 2 + .../tests/indexed-types/should_fail/T2544.stderr | 24 +- .../tests/indexed-types/should_fail/T2627b.stderr | 4 +- .../tests/indexed-types/should_fail/T3330c.stderr | 6 +- .../tests/indexed-types/should_fail/T4179.stderr | 6 +- .../tests/indexed-types/should_fail/T6123.stderr | 6 +- testsuite/tests/indexed-types/should_fail/T7786.hs | 16 +- .../tests/indexed-types/should_fail/T7786.stderr | 43 +- .../tests/indexed-types/should_fail/T8227.stderr | 13 +- .../partial-sigs/should_compile/T10403.stderr | 15 - testsuite/tests/perf/compiler/T5837.hs | 29 +- testsuite/tests/perf/compiler/T5837.stderr | 91 -- testsuite/tests/perf/compiler/all.T | 7 +- testsuite/tests/polykinds/T12444.hs | 65 ++ testsuite/tests/polykinds/T12444.stderr | 16 + testsuite/tests/polykinds/T9222.stderr | 6 +- testsuite/tests/polykinds/all.T | 1 + .../tests/typecheck/should_compile/Improvement.hs | 12 +- testsuite/tests/typecheck/should_compile/T6018.hs | 32 + .../tests/typecheck/should_compile/T6018.stderr | 8 +- .../tests/typecheck/should_fail/ContextStack2.hs | 2 + .../typecheck/should_fail/ContextStack2.stderr | 13 - testsuite/tests/typecheck/should_fail/Makefile | 5 + testsuite/tests/typecheck/should_fail/T5691.stderr | 10 +- testsuite/tests/typecheck/should_fail/T5853.stderr | 28 +- testsuite/tests/typecheck/should_fail/T8450.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9260.stderr | 11 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- 48 files changed, 1876 insertions(+), 1602 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 6e6d93b8b713339dc5f74e8f93e35d0d94014d63 From git at git.haskell.org Thu Nov 24 09:12:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:42 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Allow TyVars in TcTypes (570c318) Message-ID: <20161124091242.44DC43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/570c3181342386b5cee1862f85a8ebed7d98d712/ghc >--------------------------------------------------------------- commit 570c3181342386b5cee1862f85a8ebed7d98d712 Author: Simon Peyton Jones Date: Wed Nov 23 16:00:00 2016 +0000 Allow TyVars in TcTypes Up to now we've had a rule that a TyVar can't apppear in a type seen by the type checker; they should all be TcTyVars. But: a) With -XTypeInType it becomes much harder to exclude them; see Note [TcTyVars in the typechecker] in TcType. b) It's unnecessary to exculde them; instead we can just treat a TyVar just like vanillaSkolemTv. This is what was causing an ASSERT error in indexed-types/should_fail/T12041, reported in Trac #12826. That patch allows a TyVar in a TcType. The most significant change is to make Var.tcTyVarDetails return vanillaSkolemTv. In fact it already did, but (a) it was not documented, and (b) we never exploited it. Now we rely on it. >--------------------------------------------------------------- 570c3181342386b5cee1862f85a8ebed7d98d712 compiler/basicTypes/Var.hs | 16 +++--- compiler/typecheck/TcErrors.hs | 5 +- compiler/typecheck/TcType.hs | 76 +++++++++++++++++++------ compiler/typecheck/TcUnify.hs | 11 ++-- compiler/types/InstEnv.hs | 4 +- testsuite/tests/indexed-types/should_fail/all.T | 3 +- 6 files changed, 76 insertions(+), 39 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 570c3181342386b5cee1862f85a8ebed7d98d712 From git at git.haskell.org Thu Nov 24 09:12:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 09:12:45 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3's head updated: Allow TyVars in TcTypes (570c318) Message-ID: <20161124091245.2CD4A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/spj-tc-branch3' now includes: a182c0e testsuite: Bump peak_megabytes_allocated for T3064 801c263 Fundeps work even for unary type classes 9f814b2 Delete extraneous backtick in users' guide 925d178 Make traceRn behave more like traceTc 488a9ed rts/linker: Move loadArchive to new source file 23143f6 Refine ASSERT in buildPatSyn for the nullary case. 48876ae Remove -dtrace-level b8effa7 CmmUtils: remove the last dataflow functions 3562727 Simple refactor to remove misleading comment f9308c2 Collect coercion variables, not type variables eefe86d Allow levity-polymorpic arrows 0eb8934 Fix typo in comment cc29eb5 Revert "rts/linker: Move loadArchive to new source file" 815b837 Minor doc addition as requested in #12774. 7187ded Clarify comments on kinds (Trac #12536) aae2b3d Make it possible to use +RTS -qn without -N 60343a4 Add test for #12732 5ebcb3a Document unpackClosure# primop 4b300a3 Minor refactoring in stg_unpackClosurezh 4e088b4 Fix a bug in parallel GC synchronisation 7ddbdfd Zap redundant imports 80d4a03 Typos in comments 795be0e Align GHCi's library search order more closely with LDs 0b70ec0 Have static pointers work with -fno-full-laziness. 19ce8a5 Sparc*: Prevent GHC from doing unaligned accesses 79fb6e6 Tiny refactor 9968949 Get rid of TcTyVars more assiduously 7a50966 Simplify the API for TcHsType.kcHsTyVarBndrs f4a14d6 Use substTyUnchecked in TcMType.new_meta_tv_x 13508ba Fix Trac #12797: approximateWC 623b8e4 Renaming and comments in CorePrep 8a5960a Uninstall signal handlers cc4710a testsuite: Simplify kernel32 glue logic f4fb3bc linker: Split out CacheFlush logic abfa319 linker: Shuffle configuration into LinkerInternals.h 43c8c1c linker: Move mmapForLinker declaration into LinkerInternals.h 3f05126 linker: Split symbol extras logic into new source file c3446c6 Shuffle declarations into LinkerInternals.h 6ea0b4f linker: Split PEi386 implementation into new source file f6c47df linker: Split MachO implementation into new source file bdc262c linker: Split ELF implementation into separate source file 6fecb7e linker: Move ARM interworking note to SymbolExtras.c dc4d596 Hoopl/Dataflow: make the module more self-contained 80076fa Add notes describing SRT concepts b5460dd Add testcase for #12757 967dd5c Merge cpe_ExprIsTrivial and exprIsTrivial eaa3482 testsuite: Update T10858 allocations ec22bac Add test for #12788 f46bfeb API Annotations: make all ModuleName Located a977c96 Omit unnecessary linker flags e43f05b Add comments from Trac #12768 7b0ae41 Remove a debug trace 2cdd9bd Take account of injectivity when doing fundeps b012120 Handle types w/ type variables in signatures inside patterns (DsMeta) 1cab42d Update release notes for type sigs in TH patterns patch 1c886ea Stop -dno-debug-output suppressing -ddump-tc-trace 25c8e80 Add tracing infrastructure to pattern match checker 630d881 Allow GeneralizedNewtypeDeriving for classes with associated type families ead83db Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes 1964d86 Some minor linker cleanups. 7d988dd Fix broken validate build. 91f9e13 Fix hs_try_putmvar003 (#12800) 2e8463b Update 8.0.2 release notes for #12784 2325afe Fix comment about pointer tagging 7fe7163 Adapt the (commented out) pprTrace in OccurAnal f05d685 Refactoring of mkNewTypeEqn 317236d Refactor CallStack defaulting slightly 500d90d ghc-cabal: Use correct name of linker flags env variable 816d2e4 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS 9030d8e configure: Pass HC_OPTS_STAGEx to build system bae4a55 Pass -no-pie to GCC 0a122a4 testsuite: Update allocation numbers for T5631 e06e21a Add Richard Eisenberg's new email to mailmap bef7e78 Read parentheses better 122d826 rts: Add api to pin a thread to a numa node but without fixing a capability aa10c67 rts/linker: Move loadArchive to new source file e8ae4dc Update user's guide after D2490 03e8d26 Prevent GND from inferring an instance context for method-less classes 60bb9d1 Revert "Pass -no-pie to GCC" 7a7bb5d Revert "Refactor CallStack defaulting slightly" ec0bf81 rts: Fix LoadArchive on OS X d421a7e Pass -no-pie to GCC 46e2bef testsuite: Lower allocations for T876 7eae862 ghc-pkg: Munge dynamic library directories 2cfbee8 rts: Fix build when linked with gold 4e0b8f4 rts: Fix #include of 587dccc Make default output less verbose (source/object paths) 568e003 template-haskell: Version bump ca1b986 ghc: Fix ghc's template-haskell bound 8cb7bc5 rts: Fix references to UChar 6c0f10f Kill Type pretty-printer 55d535d Remove CONSTR_STATIC 034e01e Accept output for scc003 e0ca7ff Fix numa001 failure with "too many NUMA nodes" cb16890 testsuite: Fix creep of T4029 011af2b configure: Verify that GCC recognizes -no-pie flag 1b336d9 Skip 64-bit symbol tables 98f9759 Hopefully fix build on OS X 642adec Mark T12041 as expect_broken with -DDEBUG (#12826) 017d11e Typos in comments, notes and manual 31d5b6e fixup! Stop the simplifier from removing StaticPtr binds. 0e58652 Test for unnecessary register spills 4a835f0 Update xhtml submodule a637eeb Don't use mmap symbols when !RTS_LINKER_USE_MMAP 0135188 Storage.c: Pass a size to sys_icache_invalidate fa70b1e Fix -fobject-code with -fexternal-interpreter 7acee06 Avoid calling newDynFlags when there are no changes d3542fa Generalise the implicit prelude import 8dfca69 Inline compiler/NOTES into X86/Ppr.hs b769586 Fix windows validate 31398fb Test for type synonym loops on TyCon. 2878604 Correct spelling of command-line option in comment cede770 Correct name of Note in comment 07e40e9 Add Data instance for Const 18eb57b Revert "Add Data instance for Const" 9a4983d Pass autoconf triplets to sub-project configures 20fb781 LLVM generate llvm.expect for conditional branches 4d4f353 testsuite: Rip out hack for #12554 04b024a GHCi: Unconditionally import System.Directory 231a3ae Have reify work for local variables with functional dependencies. 9c39e09 Switch to LLVM version 3.9 94d1221 Add missing SMP symbols to RT linker. d328abc Spelling in comment only 3bd1dd4 Add Data instance for Const 4b72f85 Optimise whole module exports 6ad94d8 Updated code comment regarding EquationInfo. Trac #12856 ea37b83 A few typos in comments 5bce207 testsuite: Add test for #12855 926469f testsuite: Add test for #12024 b98dbdf testsuite: Add (still broken) testcase for #12447 e7ec521 testsuite: Add (still failing) testcase for #12550 ea76a21 add ieee754 next* functions to math_funs 514acfe Implement fine-grained `-Werror=...` facility 4c0dc76 Ignore Hadrian build products. 7e4b611 Make transformers upstream repository location consistent with others 1399c8b ghc/hschooks.c: Fix include path of Rts.h f430253 Allow to unregister threadWaitReadSTM action. 16036a5 Make a panic into an ASSERT 811bde8 Fix a bug in mk_superclasses_of be6709e Comments only in TcType 3c14858 Add elemDVarEnv 6e6d93b Another major constraint-solver refactoring 570c318 Allow TyVars in TcTypes From git at git.haskell.org Thu Nov 24 19:14:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 19:14:53 +0000 (UTC) Subject: [commit: ghc] master: Make quoting and reification return the same types (d081fcf) Message-ID: <20161124191453.1DD013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d081fcfc08cfeb3fb729ed2b1df7119ea5b4cf97/ghc >--------------------------------------------------------------- commit d081fcfc08cfeb3fb729ed2b1df7119ea5b4cf97 Author: Dominik Bollmann Date: Fri Nov 25 06:14:09 2016 +1100 Make quoting and reification return the same types Previously TH was incorrectly returning a `Dec` using a `ConT` instead of `PromotedT`. Test Plan: validate Reviewers: mainland, jstolarek, osa1, goldfire, thomie, bollmann, bgamari, RyanGlScott, austin Reviewed By: RyanGlScott Subscribers: erikd Differential Revision: https://phabricator.haskell.org/D2188 GHC Trac Issues: #11629 >--------------------------------------------------------------- d081fcfc08cfeb3fb729ed2b1df7119ea5b4cf97 compiler/typecheck/TcSplice.hs | 8 ++--- compiler/types/TyCon.hs | 20 ++++++++---- docs/users_guide/8.2.1-notes.rst | 2 ++ testsuite/tests/th/T11629.hs | 67 ++++++++++++++++++++++++++++++++++++++++ testsuite/tests/th/all.T | 2 ++ 5 files changed, 89 insertions(+), 10 deletions(-) diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index 4731e57..dd5c9f3 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1818,6 +1818,7 @@ reify_tc_app tc tys r_tc | isUnboxedSumTyCon tc = TH.UnboxedSumT (arity `div` 2) | isUnboxedTupleTyCon tc = TH.UnboxedTupleT (arity `div` 2) + | isPromotedTupleTyCon tc = TH.PromotedTupleT (arity `div` 2) -- See Note [Unboxed tuple RuntimeRep vars] in TyCon | isTupleTyCon tc = if isPromotedDataCon tc then TH.PromotedTupleT arity @@ -1828,6 +1829,7 @@ reify_tc_app tc tys | tc `hasKey` heqTyConKey = TH.EqualityT | tc `hasKey` eqPrimTyConKey = TH.EqualityT | tc `hasKey` eqReprPrimTyConKey = TH.ConT (reifyName coercibleTyCon) + | isPromotedDataCon tc = TH.PromotedT (reifyName tc) | otherwise = TH.ConT (reifyName tc) -- See Note [Kind annotations on TyConApps] @@ -1841,11 +1843,9 @@ reify_tc_app tc tys needs_kind_sig | GT <- compareLength tys tc_binders - , tcIsTyVarTy tc_res_kind - = True + = tcIsTyVarTy tc_res_kind | otherwise - = not $ - isEmptyVarSet $ + = not . isEmptyVarSet $ filterVarSet isTyVar $ tyCoVarsOfType $ mkTyConKind (dropList tys tc_binders) tc_res_kind diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 054eb2b..ebb18f0 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -45,7 +45,7 @@ module TyCon( isFunTyCon, isPrimTyCon, isTupleTyCon, isUnboxedTupleTyCon, isBoxedTupleTyCon, - isUnboxedSumTyCon, + isUnboxedSumTyCon, isPromotedTupleTyCon, isTypeSynonymTyCon, mightBeUnsaturatedTyCon, isPromotedDataCon, isPromotedDataCon_maybe, @@ -121,11 +121,12 @@ module TyCon( #include "HsVersions.h" -import {-# SOURCE #-} TyCoRep ( Kind, Type, PredType, pprType ) -import {-# SOURCE #-} TysWiredIn ( runtimeRepTyCon, constraintKind - , vecCountTyCon, vecElemTyCon, liftedTypeKind - , mkFunKind, mkForAllKind ) -import {-# SOURCE #-} DataCon ( DataCon, dataConExTyVars, dataConFieldLabels ) +import {-# SOURCE #-} TyCoRep ( Kind, Type, PredType, pprType ) +import {-# SOURCE #-} TysWiredIn ( runtimeRepTyCon, constraintKind + , vecCountTyCon, vecElemTyCon, liftedTypeKind + , mkFunKind, mkForAllKind ) +import {-# SOURCE #-} DataCon ( DataCon, dataConExTyVars, dataConFieldLabels + , dataConTyCon ) import Binary import Var @@ -1958,6 +1959,13 @@ isUnboxedSumTyCon (AlgTyCon { algTcRhs = rhs }) = True isUnboxedSumTyCon _ = False +-- | Is this the 'TyCon' for a /promoted/ tuple? +isPromotedTupleTyCon :: TyCon -> Bool +isPromotedTupleTyCon tyCon + | Just dataCon <- isPromotedDataCon_maybe tyCon + , isTupleTyCon (dataConTyCon dataCon) = True + | otherwise = False + -- | Is this a PromotedDataCon? isPromotedDataCon :: TyCon -> Bool isPromotedDataCon (PromotedDataCon {}) = True diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 1699ebb..984889f 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -119,6 +119,8 @@ Template Haskell - Add support for type signatures in patterns. (:ghc-ticket:`12164`) +- Make quoting and reification return the same types. (:ghc-ticket:`11629`) + Runtime system ~~~~~~~~~~~~~~ diff --git a/testsuite/tests/th/T11629.hs b/testsuite/tests/th/T11629.hs new file mode 100644 index 0000000..b22365f --- /dev/null +++ b/testsuite/tests/th/T11629.hs @@ -0,0 +1,67 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE FlexibleInstances #-} +module T11629 where + +import Control.Monad +import Language.Haskell.TH + +class C (a :: Bool) +class D (a :: (Bool, Bool)) +class E (a :: [Bool]) + +instance C True +instance C 'False + +instance D '(True, False) +instance D '(False, True) + +instance E '[True, False] +instance E '[False, True] + +do + let getType (InstanceD _ _ ty _) = ty + getType _ = error "getType: only defined for InstanceD" + + failMsg a ty1 ty2 = fail $ "example " ++ a + ++ ": ty1 /= ty2, where\n ty1 = " + ++ show ty1 ++ "\n ty2 = " ++ show ty2 + + withoutSig (ForallT tvs cxt ty) = ForallT tvs cxt (withoutSig ty) + withoutSig (AppT ty1 ty2) = AppT (withoutSig ty1) (withoutSig ty2) + withoutSig (SigT ty ki) = withoutSig ty + withoutSig ty = ty + + -- test #1: type quotations and reified types should agree. + ty1 <- [t| C True |] + ty2 <- [t| C 'False |] + ClassI _ insts <- reify ''C + let [ty1', ty2'] = map getType insts + + when (ty1 /= ty1') $ failMsg "A" ty1 ty1' + when (ty2 /= ty2') $ failMsg "B" ty2 ty2' + + -- test #2: type quotations and reified types should agree wrt + -- promoted tuples. + ty3 <- [t| D '(True, False) |] + ty4 <- [t| D (False, True) |] + ClassI _ insts <- reify ''D + let [ty3', ty4'] = map (withoutSig . getType) insts + + when (ty3 /= ty3') $ failMsg "C" ty3 ty3' + -- The following won't work. See https://ghc.haskell.org/trac/ghc/ticket/12853 + -- when (ty4 /= ty4') $ failMsg "D" ty4 ty4' + + -- test #3: type quotations and reified types should agree wrt to + -- promoted lists. + ty5 <- [t| E '[True, False] |] + ty6 <- [t| E [False, True] |] + + ClassI _ insts <- reify ''E + let [ty5', ty6'] = map (withoutSig . getType) insts + + when (ty5 /= ty5') $ failMsg "C" ty5 ty5' + when (ty6 /= ty6') $ failMsg "D" ty6 ty6' + + return [] diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 4f66960..b96ea78 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -424,6 +424,8 @@ test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) test('T11941', normal, compile_fail, ['-v0']) test('T11484', normal, compile, ['-v0']) +test('T11629', normal, compile, ['-v0']) + test('T8761', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T12130', extra_clean(['T12130a.hi','T12130a.o']), multimod_compile, ['T12130', '-v0 ' + config.ghc_th_way_flags]) From git at git.haskell.org Thu Nov 24 22:22:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 24 Nov 2016 22:22:54 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch3: Be a bit more selective about improvement (d8aefaa) Message-ID: <20161124222254.17C613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch3 Link : http://ghc.haskell.org/trac/ghc/changeset/d8aefaa50a3aa9794c888ea03b5b5d61895e4c99/ghc >--------------------------------------------------------------- commit d8aefaa50a3aa9794c888ea03b5b5d61895e4c99 Author: Simon Peyton Jones Date: Thu Nov 24 22:21:08 2016 +0000 Be a bit more selective about improvement This patch makes [W] constraints not participate in improvement. See Note [Do not do improvement for WOnly] in TcSMonad. Removes some senseless work duplication in some cases; should not change behaviour. >--------------------------------------------------------------- d8aefaa50a3aa9794c888ea03b5b5d61895e4c99 compiler/typecheck/TcInteract.hs | 26 +++++++++++++++++++------- compiler/typecheck/TcSMonad.hs | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 5d00e4c..8c42aa3 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -729,25 +729,32 @@ interactDict _ wi = pprPanic "interactDict" (ppr wi) addFunDepWork :: InertCans -> CtEvidence -> Class -> TcS () -- Add derived constraints from type-class functional dependencies. addFunDepWork inerts work_ev cls + | isImprovable work_ev = mapBagM_ add_fds (findDictsByClass (inert_dicts inerts) cls) -- No need to check flavour; fundeps work between -- any pair of constraints, regardless of flavour -- Importantly we don't throw workitem back in the -- worklist because this can cause loops (see #5236) + | otherwise + = return () where work_pred = ctEvPred work_ev work_loc = ctEvLoc work_ev add_fds inert_ct + | isImprovable inert_ev = emitFunDepDeriveds $ improveFromAnother derived_loc inert_pred work_pred -- We don't really rewrite tys2, see below _rewritten_tys2, so that's ok -- NB: We do create FDs for given to report insoluble equations that arise -- from pairs of Givens, and also because of floating when we approximate -- implications. The relevant test is: typecheck/should_fail/FDsFromGivens.hs + | otherwise + = return () where - inert_pred = ctPred inert_ct - inert_loc = ctLoc inert_ct + inert_ev = ctEvidence inert_ct + inert_pred = ctEvPred inert_ev + inert_loc = ctEvLoc inert_ev derived_loc = work_loc { ctl_origin = FunDepOrigin1 work_pred work_loc inert_pred inert_loc } @@ -897,7 +904,8 @@ improveLocalFunEqs :: CtEvidence -> InertCans -> TyCon -> [TcType] -> TcTyVar -- -- See Note [FunDep and implicit parameter reactions] improveLocalFunEqs ev inerts fam_tc args fsk - | isGiven ev -- See Note [No FunEq improvement for Givens] + | isGiven ev -- See Note [No FunEq improvement for Givens] + || not (isImprovable ev) = return () | null improvement_eqns @@ -941,8 +949,10 @@ improveLocalFunEqs ev inerts fam_tc args fsk -------------------- -- See Note [Type inference for type families with injectivity] - do_one_injective inj_args (CFunEqCan { cc_tyargs = iargs, cc_fsk = ifsk }) - | rhs `tcEqType` lookupFlattenTyVar ieqs ifsk + do_one_injective inj_args (CFunEqCan { cc_ev = iev, cc_tyargs = iargs + , cc_fsk = ifsk }) + | isImprovable iev + , rhs `tcEqType` lookupFlattenTyVar ieqs ifsk = [ Pair arg iarg | (arg, iarg, True) <- zip3 args iargs inj_args ] @@ -1443,7 +1453,8 @@ reduce_top_fun_eq old_ev fsk (ax_co, rhs_ty) improveTopFunEqs :: CtEvidence -> TyCon -> [TcType] -> TcTyVar -> TcS () -- See Note [FunDep and implicit parameter reactions] improveTopFunEqs ev fam_tc args fsk - | isGiven ev -- See Note [No FunEq improvement for Givens] + | isGiven ev -- See Note [No FunEq improvement for Givens] + || not (isImprovable ev) = return () | otherwise @@ -1823,7 +1834,8 @@ doTopReactDict inerts work_item@(CDictCan { cc_ev = fl, cc_class = cls ; unless s $ insertSafeOverlapFailureTcS work_item ; solve_from_instance theta mk_ev } NoInstance -> - do { try_fundep_improvement + do { when (isImprovable fl) $ + try_fundep_improvement ; continueWith work_item } } where dict_pred = mkClassPred cls xis diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 91d93d0..98782e4 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -57,6 +57,7 @@ module TcSMonad ( removeInertCts, getPendingScDicts, addInertCan, addInertEq, insertFunEq, emitInsoluble, emitWorkNC, emitWork, + isImprovable, -- The Model kickOutAfterUnification, @@ -1145,6 +1146,37 @@ them. If we forget the pend_sc flag, our cunning scheme for avoiding generating superclasses repeatedly will fail. See Trac #11379 for a case of this. + +Note [Do not do improvement for WOnly] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We do improvement between two constraints (e.g. for injectivity +or functional dependencies) only if both are "improvable". And +we improve a constraint wrt the top-level instances only if +it is improveable. + +Improvable: [G] [WD] [D} +Not improvable: [W] + +Reasons: + +* It's less work: fewer pairs to compare + +* Every [W] has a shadow [D] so nothing is lost + +* Consider [WD] C Int b, where 'b' is a skolem, and + class C a b | a -> b + instance C Int Bool + We'll do a fundep on it and emit [D] b ~ Bool + That will kick out constraint [WD] C Int b + Then we'll split it to [W] C Int b (keep in inert) + and [D] C Int b (in work list) + When processing the latter we'll rewrite it to + [D] C Int Bool + At that point it would be /stupid/ to interact it + with the inert [W] C Int b in the inert set; after all, + it's the very constraint from which the [D] C Int Bool + was split! We can avoid this by not doing improvement + on [W] constraints. -} maybeEmitShadow :: InertCans -> Ct -> TcS Ct @@ -1196,6 +1228,12 @@ intersects_with inert_eqs free_vars -- to the underlying UniqFM. A bit yukky, but efficient. +isImprovable :: CtEvidence -> Bool +-- See Note [Do not do improvement for WOnly] +isImprovable (CtWanted { ctev_nosh = WOnly }) = False +isImprovable _ = True + + {- ********************************************************************* * * Inert equalities From git at git.haskell.org Fri Nov 25 11:30:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:30 +0000 (UTC) Subject: [commit: ghc] master: Comments only in TcType (f04f118) Message-ID: <20161125113030.D73143A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f04f1188ffd39dc3540241cc09c750223f435cc1/ghc >--------------------------------------------------------------- commit f04f1188ffd39dc3540241cc09c750223f435cc1 Author: Simon Peyton Jones Date: Tue Oct 25 15:25:03 2016 +0100 Comments only in TcType >--------------------------------------------------------------- f04f1188ffd39dc3540241cc09c750223f435cc1 compiler/typecheck/TcType.hs | 72 +++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 4dbe4a3..99927aa 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -1436,7 +1436,13 @@ tcSplitMethodTy ty | otherwise = pprPanic "tcSplitMethodTy" (ppr ty) ------------------------ + +{- ********************************************************************* +* * + Type equalities +* * +********************************************************************* -} + tcEqKind :: TcKind -> TcKind -> Bool tcEqKind = tcEqType @@ -1546,39 +1552,9 @@ pickyEqType ty1 ty2 = isNothing $ tc_eq_type (const Nothing) ty1 ty2 -{- Note [Expanding superclasses] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When we expand superclasses, we use the following algorithm: - -expand( so_far, pred ) returns the transitive superclasses of pred, - not including pred itself - 1. If pred is not a class constraint, return empty set - Otherwise pred = C ts - 2. If C is in so_far, return empty set (breaks loops) - 3. Find the immediate superclasses constraints of (C ts) - 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss ) - -Notice that - - * With normal Haskell-98 classes, the loop-detector will never bite, - so we'll get all the superclasses. - - * Since there is only a finite number of distinct classes, expansion - must terminate. - - * The loop breaking is a bit conservative. Notably, a tuple class - could contain many times without threatening termination: - (Eq a, (Ord a, Ix a)) - And this is try of any class that we can statically guarantee - as non-recursive (in some sense). For now, we just make a special - case for tuples. Somthing better would be cool. - -See also TcTyDecls.checkClassCycles. - - -************************************************************************ +{- ********************************************************************* * * -\subsection{Predicate types} + Predicate types * * ************************************************************************ @@ -1760,7 +1736,35 @@ isImprovementPred ty ClassPred cls _ -> classHasFds cls IrredPred {} -> True -- Might have equalities after reduction? -{- +{- Note [Expanding superclasses] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When we expand superclasses, we use the following algorithm: + +expand( so_far, pred ) returns the transitive superclasses of pred, + not including pred itself + 1. If pred is not a class constraint, return empty set + Otherwise pred = C ts + 2. If C is in so_far, return empty set (breaks loops) + 3. Find the immediate superclasses constraints of (C ts) + 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss ) + +Notice that + + * With normal Haskell-98 classes, the loop-detector will never bite, + so we'll get all the superclasses. + + * Since there is only a finite number of distinct classes, expansion + must terminate. + + * The loop breaking is a bit conservative. Notably, a tuple class + could contain many times without threatening termination: + (Eq a, (Ord a, Ix a)) + And this is try of any class that we can statically guarantee + as non-recursive (in some sense). For now, we just make a special + case for tuples. Somthing better would be cool. + +See also TcTyDecls.checkClassCycles. + Note [Inheriting implicit parameters] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this: From git at git.haskell.org Fri Nov 25 11:30:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:33 +0000 (UTC) Subject: [commit: ghc] master: Add elemDVarEnv (0123efd) Message-ID: <20161125113033.850E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0123efde8090fc60a6bfef5943ba35440cec0c69/ghc >--------------------------------------------------------------- commit 0123efde8090fc60a6bfef5943ba35440cec0c69 Author: Simon Peyton Jones Date: Wed Nov 23 09:05:33 2016 +0000 Add elemDVarEnv I need this in a later patch >--------------------------------------------------------------- 0123efde8090fc60a6bfef5943ba35440cec0c69 compiler/basicTypes/VarEnv.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/basicTypes/VarEnv.hs b/compiler/basicTypes/VarEnv.hs index 146a2fc..dcb64a9 100644 --- a/compiler/basicTypes/VarEnv.hs +++ b/compiler/basicTypes/VarEnv.hs @@ -32,7 +32,7 @@ module VarEnv ( dVarEnvElts, extendDVarEnv, extendDVarEnv_C, extendDVarEnvList, - lookupDVarEnv, + lookupDVarEnv, elemDVarEnv, isEmptyDVarEnv, foldDVarEnv, mapDVarEnv, modifyDVarEnv, @@ -571,6 +571,9 @@ delDVarEnvList = delListFromUDFM isEmptyDVarEnv :: DVarEnv a -> Bool isEmptyDVarEnv = isNullUDFM +elemDVarEnv :: Var -> DVarEnv a -> Bool +elemDVarEnv = elemUDFM + extendDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> Var -> a -> DVarEnv a extendDVarEnv_C = addToUDFM_C From git at git.haskell.org Fri Nov 25 11:30:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:36 +0000 (UTC) Subject: [commit: ghc] master: Fix a bug in mk_superclasses_of (0476a64) Message-ID: <20161125113036.3D2EA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0476a64e70c91b326b53db2fc55adbbaa8e5c270/ghc >--------------------------------------------------------------- commit 0476a64e70c91b326b53db2fc55adbbaa8e5c270 Author: Simon Peyton Jones Date: Tue Oct 25 15:22:17 2016 +0100 Fix a bug in mk_superclasses_of This bug meant that we were less eager about expanding tuple superclasses than we should have been; i.e. we stopped too soon. That's not fatal, beause we expand more superclasses later, but it's less efficient. >--------------------------------------------------------------- 0476a64e70c91b326b53db2fc55adbbaa8e5c270 compiler/typecheck/TcCanonical.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index 3419400..209eec9 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -432,15 +432,20 @@ mk_superclasses_of :: NameSet -> CtEvidence -> Class -> [Type] -> TcS [Ct] -- Always return this class constraint, -- and expand its superclasses mk_superclasses_of rec_clss ev cls tys - | loop_found = return [this_ct] -- cc_pend_sc of this_ct = True - | otherwise = do { sc_cts <- mk_strict_superclasses rec_clss' ev cls tys + | loop_found = do { traceTcS "mk_superclasses_of: loop" (ppr cls <+> ppr tys) + ; return [this_ct] } -- cc_pend_sc of this_ct = True + | otherwise = do { traceTcS "mk_superclasses_of" (vcat [ ppr cls <+> ppr tys + , ppr (isCTupleClass cls) + , ppr rec_clss + ]) + ; sc_cts <- mk_strict_superclasses rec_clss' ev cls tys ; return (this_ct : sc_cts) } -- cc_pend_sc of this_ct = False where cls_nm = className cls - loop_found = cls_nm `elemNameSet` rec_clss - rec_clss' | isCTupleClass cls = rec_clss -- Never contribute to recursion - | otherwise = rec_clss `extendNameSet` cls_nm + loop_found = not (isCTupleClass cls) && cls_nm `elemNameSet` rec_clss + -- Tuples neveer contribute to recursion, and can be nested + rec_clss' = rec_clss `extendNameSet` cls_nm this_ct = CDictCan { cc_ev = ev, cc_class = cls, cc_tyargs = tys , cc_pend_sc = loop_found } -- NB: If there is a loop, we cut off, so we have not @@ -460,7 +465,8 @@ mk_strict_superclasses rec_clss ev cls tys = return [] -- Wanteds with no variables yield no deriveds. -- See Note [Improvement from Ground Wanteds] - | otherwise -- Wanted/Derived case, just add those SC that can lead to improvement. + | otherwise -- Wanted/Derived case, just add Derived superclasses + -- that can lead to improvement. = do { let loc = ctEvLoc ev ; sc_evs <- mapM (newDerivedNC loc) (immSuperClasses cls tys) ; concatMapM (mk_superclasses rec_clss) sc_evs } From git at git.haskell.org Fri Nov 25 11:30:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:38 +0000 (UTC) Subject: [commit: ghc] master: Make a panic into an ASSERT (9a431e5) Message-ID: <20161125113038.E30C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9a431e5116c132f08f8296c6e8fbbbe7ba7a20b6/ghc >--------------------------------------------------------------- commit 9a431e5116c132f08f8296c6e8fbbbe7ba7a20b6 Author: Simon Peyton Jones Date: Tue Oct 25 15:21:31 2016 +0100 Make a panic into an ASSERT >--------------------------------------------------------------- 9a431e5116c132f08f8296c6e8fbbbe7ba7a20b6 compiler/typecheck/FunDeps.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/FunDeps.hs b/compiler/typecheck/FunDeps.hs index 4da6795..0ca22bd 100644 --- a/compiler/typecheck/FunDeps.hs +++ b/compiler/typecheck/FunDeps.hs @@ -195,11 +195,9 @@ improveFromInstEnv :: InstEnvs -> [FunDepEqn loc] -- Needs to be a FunDepEqn because -- of quantified variables -- Post: Equations oriented from the template (matching instance) to the workitem! -improveFromInstEnv _inst_env _ pred - | not (isClassPred pred) - = panic "improveFromInstEnv: not a class predicate" improveFromInstEnv inst_env mk_loc pred - | Just (cls, tys) <- getClassPredTys_maybe pred + | Just (cls, tys) <- ASSERT2( isClassPred pred, ppr pred ) + getClassPredTys_maybe pred , let (cls_tvs, cls_fds) = classTvsFds cls instances = classInstances inst_env cls rough_tcs = roughMatchTcs tys From git at git.haskell.org Fri Nov 25 11:30:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:42 +0000 (UTC) Subject: [commit: ghc] master: Another major constraint-solver refactoring (1eec1f2) Message-ID: <20161125113042.74A693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1eec1f21268af907f59b5d5c071a9a25de7369c7/ghc >--------------------------------------------------------------- commit 1eec1f21268af907f59b5d5c071a9a25de7369c7 Author: Simon Peyton Jones Date: Tue Oct 25 17:41:45 2016 +0100 Another major constraint-solver refactoring This patch takes further my refactoring of the constraint solver, which I've been doing over the last couple of months in consultation with Richard. It fixes a number of tricky bugs that made the constraint solver actually go into a loop, including Trac #12526 Trac #12444 Trac #12538 The main changes are these * Flatten unification variables (fmvs/fuvs) appear on the LHS of a tvar/tyvar equality; thus fmv ~ alpha and not alpha ~ fmv See Note [Put flatten unification variables on the left] in TcUnify. This is implemented by TcUnify.swapOverTyVars. * Don't reduce a "loopy" CFunEqCan where the fsk appears on the LHS: F t1 .. tn ~ fsk where 'fsk' is free in t1..tn. See Note [FunEq occurs-check principle] in TcInteract This neatly stops some infinite loops that people reported; and it allows us to delete some crufty code in reduce_top_fun_eq. And it appears to be no loss whatsoever. As well as fixing loops, ContextStack2 and T5837 both terminate when they didn't before. * Previously we generated "derived shadow" constraints from Wanteds, but we could (and sometimes did; Trac #xxxx) repeatedly generate a derived shadow from the same Wanted. A big change in this patch is to have two kinds of Wanteds: [WD] behaves like a pair of a Wanted and a Derived [W] behaves like a Wanted only See CtFlavour and ShadowInfo in TcRnTypes, and the ctev_nosh field of a Wanted. This turned out to be a lot simpler. A [WD] gets split into a [W] and a [D] in TcSMonad.maybeEmitShaodow. See TcSMonad Note [The improvement story and derived shadows] * Rather than have a separate inert_model in the InertCans, I've put the derived equalities back into inert_eqs. We weren't gaining anything from a separate field. * Previously we had a mode for the constraint solver in which it would more aggressively solve Derived constraints; it was used for simplifying the context of a 'deriving' clause, or a 'default' delcaration, for example. But the complexity wasn't worth it; now I just make proper Wanted constraints. See TcMType.cloneWC * Don't generate injectivity improvement for Givens; see Note [No FunEq improvement for Givens] in TcInteract * solveSimpleWanteds leaves the insolubles in-place rather than returning them. Simpler. I also did lots of work on comments, including fixing Trac #12821. >--------------------------------------------------------------- 1eec1f21268af907f59b5d5c071a9a25de7369c7 compiler/iface/ToIface.hs | 2 + compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcErrors.hs | 21 +- compiler/typecheck/TcExpr.hs | 1 + compiler/typecheck/TcFlatten.hs | 307 +++--- compiler/typecheck/TcInteract.hs | 777 ++++++++------ compiler/typecheck/TcMType.hs | 25 +- compiler/typecheck/TcRnTypes.hs | 264 +++-- compiler/typecheck/TcRules.hs | 21 +- compiler/typecheck/TcSMonad.hs | 1134 +++++++++----------- compiler/typecheck/TcSimplify.hs | 146 +-- compiler/typecheck/TcType.hs | 18 + compiler/typecheck/TcUnify.hs | 45 +- .../tests/indexed-types/should_compile/T10226.hs | 57 + .../tests/indexed-types/should_compile/T10634.hs | 15 + .../tests/indexed-types/should_compile/T12526.hs | 69 ++ .../tests/indexed-types/should_compile/T12538.hs | 40 + .../indexed-types/should_compile/T12538.stderr | 13 + .../indexed-types/should_compile/T3017.stderr | 2 +- .../tests/indexed-types/should_compile/T4338.hs | 35 +- testsuite/tests/indexed-types/should_compile/all.T | 2 + .../tests/indexed-types/should_fail/T2544.stderr | 24 +- .../tests/indexed-types/should_fail/T2627b.stderr | 4 +- .../tests/indexed-types/should_fail/T3330c.stderr | 6 +- .../tests/indexed-types/should_fail/T4179.stderr | 6 +- .../tests/indexed-types/should_fail/T6123.stderr | 6 +- testsuite/tests/indexed-types/should_fail/T7786.hs | 16 +- .../tests/indexed-types/should_fail/T7786.stderr | 43 +- .../tests/indexed-types/should_fail/T8227.stderr | 13 +- .../partial-sigs/should_compile/T10403.stderr | 15 - testsuite/tests/perf/compiler/T5837.hs | 29 +- testsuite/tests/perf/compiler/T5837.stderr | 91 -- testsuite/tests/perf/compiler/all.T | 7 +- testsuite/tests/polykinds/T12444.hs | 65 ++ testsuite/tests/polykinds/T12444.stderr | 16 + testsuite/tests/polykinds/T9222.stderr | 6 +- testsuite/tests/polykinds/all.T | 1 + .../tests/typecheck/should_compile/Improvement.hs | 12 +- testsuite/tests/typecheck/should_compile/T6018.hs | 32 + .../tests/typecheck/should_compile/T6018.stderr | 8 +- .../tests/typecheck/should_fail/ContextStack2.hs | 2 + .../typecheck/should_fail/ContextStack2.stderr | 13 - testsuite/tests/typecheck/should_fail/Makefile | 5 + testsuite/tests/typecheck/should_fail/T5691.stderr | 10 +- testsuite/tests/typecheck/should_fail/T5853.stderr | 28 +- testsuite/tests/typecheck/should_fail/T8450.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9260.stderr | 11 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- 48 files changed, 1875 insertions(+), 1602 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 1eec1f21268af907f59b5d5c071a9a25de7369c7 From git at git.haskell.org Fri Nov 25 11:30:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:45 +0000 (UTC) Subject: [commit: ghc] master: Allow TyVars in TcTypes (18d0bdd) Message-ID: <20161125113045.37B1A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18d0bdd3848201882bae167e3b15fd797d217e93/ghc >--------------------------------------------------------------- commit 18d0bdd3848201882bae167e3b15fd797d217e93 Author: Simon Peyton Jones Date: Wed Nov 23 16:00:00 2016 +0000 Allow TyVars in TcTypes Up to now we've had a rule that a TyVar can't apppear in a type seen by the type checker; they should all be TcTyVars. But: a) With -XTypeInType it becomes much harder to exclude them; see Note [TcTyVars in the typechecker] in TcType. b) It's unnecessary to exculde them; instead we can just treat a TyVar just like vanillaSkolemTv. This is what was causing an ASSERT error in indexed-types/should_fail/T12041, reported in Trac #12826. That patch allows a TyVar in a TcType. The most significant change is to make Var.tcTyVarDetails return vanillaSkolemTv. In fact it already did, but (a) it was not documented, and (b) we never exploited it. Now we rely on it. >--------------------------------------------------------------- 18d0bdd3848201882bae167e3b15fd797d217e93 compiler/basicTypes/Var.hs | 16 +++--- compiler/typecheck/TcErrors.hs | 5 +- compiler/typecheck/TcType.hs | 76 +++++++++++++++++++------ compiler/typecheck/TcUnify.hs | 11 ++-- compiler/types/InstEnv.hs | 4 +- testsuite/tests/indexed-types/should_fail/all.T | 3 +- 6 files changed, 76 insertions(+), 39 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 18d0bdd3848201882bae167e3b15fd797d217e93 From git at git.haskell.org Fri Nov 25 11:30:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:47 +0000 (UTC) Subject: [commit: ghc] master: Remove redundant kind check (4431e48) Message-ID: <20161125113047.DE79C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4431e48e6dc0a0e47328b6d0ed34a9b8503be4b0/ghc >--------------------------------------------------------------- commit 4431e48e6dc0a0e47328b6d0ed34a9b8503be4b0 Author: Simon Peyton Jones Date: Thu Nov 24 13:57:04 2016 +0000 Remove redundant kind check The invariants for CTyEqCan mean that this check isn't needed. Turn it into an ASSERT. >--------------------------------------------------------------- 4431e48e6dc0a0e47328b6d0ed34a9b8503be4b0 compiler/typecheck/TcFlatten.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 3adbee1..4fc8414 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -1457,8 +1457,9 @@ unflatten tv_eqs funeqs -- NB: unlike unflattenFmv, filling a fmv here /does/ -- bump the unification count; it is "improvement" -- Note [Unflattening can force the solver to iterate] - , tyVarKind tv `eqType` typeKind rhs - = do { is_filled <- isFilledMetaTyVar tv + = ASSERT2( tyVarKind tv `eqType` typeKind rhs, ppr ct ) + -- CTyEqCan invariant should ensure this is true + do { is_filled <- isFilledMetaTyVar tv ; elim <- case is_filled of False -> do { traceTcS "unflatten_eq 2" (ppr ct) ; tryFill ev eq_rel tv rhs } From git at git.haskell.org Fri Nov 25 11:30:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 11:30:50 +0000 (UTC) Subject: [commit: ghc] master: Perf improvements in T6048, T10547 (90a65ad) Message-ID: <20161125113050.928883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90a65ad0eb981303d52250e7ac276ee496fd5683/ghc >--------------------------------------------------------------- commit 90a65ad0eb981303d52250e7ac276ee496fd5683 Author: Simon Peyton Jones Date: Fri Nov 25 08:29:43 2016 +0000 Perf improvements in T6048, T10547 I think this wave of commits just made these two a little better; they must have been close to the threshold before. >--------------------------------------------------------------- 90a65ad0eb981303d52250e7ac276ee496fd5683 testsuite/tests/perf/compiler/all.T | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 7c8f55a..116aeab 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -632,7 +632,7 @@ test('T6048', # 2014-12-01: 49987836 (x86 Windows) # 2016-04-06: 55701280 (x86/Linux, 64-bit machine) - (wordsize(64), 108225624, 12)]) + (wordsize(64), 94327392, 10)]) # 18/09/2012 97247032 amd64/Linux # 16/01/2014 108578664 amd64/Linux (unknown, likely foldl-via-foldr) # 18/01/2014 95960720 amd64/Linux Call Arity improvements @@ -643,6 +643,7 @@ test('T6048', # 14/09/2014 88186056 amd64/Linux BPP part1 change (more NoImplicitPreludes in base) # 08/01/2014 95946688 amd64/Linux Mostly 4c834fd. Occasional spikes to 103822120! # 11/03/2016 108225624 amd64/Linux unknown reason sadly; likely gradual creep. + # 25/11/2016 94327392 amd64/Linux Back down again hooray; still not sure why ], compile,['']) @@ -851,7 +852,10 @@ test('T10370', test('T10547', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 39165544, 20), + [(wordsize(64), 31041520, 20), + # initial: 39165544 + # 25/11/2106: 31041520 Linux Around the time of refactoring the constraint solver; + # but I think that only pushed it over the edge ]), ], compile_fail, From git at git.haskell.org Fri Nov 25 13:11:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 13:11:51 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments (e319466) Message-ID: <20161125131151.0EB863A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e31946600b0c4ecfb88eaa64fa2aeebf9194a809/ghc >--------------------------------------------------------------- commit e31946600b0c4ecfb88eaa64fa2aeebf9194a809 Author: Gabor Greif Date: Fri Nov 25 14:09:47 2016 +0100 Typos in comments >--------------------------------------------------------------- e31946600b0c4ecfb88eaa64fa2aeebf9194a809 compiler/typecheck/TcType.hs | 2 +- testsuite/driver/testlib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 0468b39..bbf4712 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -1821,7 +1821,7 @@ Notice that (Eq a, (Ord a, Ix a)) And this is try of any class that we can statically guarantee as non-recursive (in some sense). For now, we just make a special - case for tuples. Somthing better would be cool. + case for tuples. Something better would be cool. See also TcTyDecls.checkClassCycles. diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 7afabaa..d9d3335 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1651,7 +1651,7 @@ def normalise_prof (str): # sometimes under MAIN. str = re.sub('[ \t]*main[ \t]+Main.*\n','',str) - # We have somthing like this: + # We have something like this: # # MAIN MAIN 53 0 0.0 0.2 0.0 100.0 # CAF Main 105 0 0.0 0.3 0.0 62.5 From git at git.haskell.org Fri Nov 25 16:33:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 16:33:59 +0000 (UTC) Subject: [commit: ghc] master: Fix a name-space problem with promotion (c1b4b76) Message-ID: <20161125163359.1B1A53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c1b4b76931a58c59e5b269477e38db659cf7aea8/ghc >--------------------------------------------------------------- commit c1b4b76931a58c59e5b269477e38db659cf7aea8 Author: Simon Peyton Jones Date: Fri Nov 25 14:31:33 2016 +0000 Fix a name-space problem with promotion Trac #12686 showed that we were allowing a term variable into a type, by promotion. I chose to squash this in the renamer. >--------------------------------------------------------------- c1b4b76931a58c59e5b269477e38db659cf7aea8 compiler/rename/RnEnv.hs | 26 +++++++++++++++++++++++- testsuite/tests/rename/should_fail/T12686.hs | 13 ++++++++++++ testsuite/tests/rename/should_fail/T12686.stderr | 4 ++++ testsuite/tests/rename/should_fail/all.T | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 056f25c..801bc27 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -697,6 +697,9 @@ lookupOccRn rdr_name lookupKindOccRn :: RdrName -> RnM Name -- Looking up a name occurring in a kind lookupKindOccRn rdr_name + | isVarOcc (rdrNameOcc rdr_name) -- See Note [Promoted variables in types] + = badVarInType rdr_name + | otherwise = do { typeintype <- xoptM LangExt.TypeInType ; if | typeintype -> lookupTypeOccRn rdr_name -- With -XNoTypeInType, treat any usage of * in kinds as in scope @@ -709,6 +712,9 @@ lookupKindOccRn rdr_name lookupTypeOccRn :: RdrName -> RnM Name -- see Note [Demotion] lookupTypeOccRn rdr_name + | isVarOcc (rdrNameOcc rdr_name) -- See Note [Promoted variables in types] + = badVarInType rdr_name + | otherwise = do { mb_name <- lookupOccRn_maybe rdr_name ; case mb_name of { Just name -> return name ; @@ -758,7 +764,25 @@ is_star, is_uni_star :: RdrName -> Bool is_star = (fsLit "*" ==) . occNameFS . rdrNameOcc is_uni_star = (fsLit "★" ==) . occNameFS . rdrNameOcc -{- +badVarInType :: RdrName -> RnM Name +badVarInType rdr_name + = do { addErr (text "Illegal promoted term variable in a type:" + <+> ppr rdr_name) + ; return (mkUnboundNameRdr rdr_name) } + +{- Note [Promoted variables in types] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider this (Trac #12686): + x = True + data Bad = Bad 'x + +The parser treats the quote in 'x as saying "use the term +namespace", so we'll get (Bad x{v}), with 'x' in the +VarName namespace. If we don't test for this, the renamer +will happily rename it to the x bound at top level, and then +the typecheck falls over because it doesn't have 'x' in scope +when kind-checking. + Note [Demotion] ~~~~~~~~~~~~~~~ When the user writes: diff --git a/testsuite/tests/rename/should_fail/T12686.hs b/testsuite/tests/rename/should_fail/T12686.hs new file mode 100644 index 0000000..5d652f9 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T12686.hs @@ -0,0 +1,13 @@ +module T12686 where + +import Data.Proxy + +x = True + +data Bad = Bad 'x +-- The 'x should be rejeted in a civilised way + +data AlsoBad = AlsoBad { + a :: Int, + b :: Either Int 'a } +-- Ditto 'a here diff --git a/testsuite/tests/rename/should_fail/T12686.stderr b/testsuite/tests/rename/should_fail/T12686.stderr new file mode 100644 index 0000000..24acc9c --- /dev/null +++ b/testsuite/tests/rename/should_fail/T12686.stderr @@ -0,0 +1,4 @@ + +T12686.hs:7:16: error: Illegal promoted term variable in a type: x + +T12686.hs:12:19: error: Illegal promoted term variable in a type: a diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index f956bde..b8c1ac5 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -141,3 +141,4 @@ test('T11071a', normal, compile_fail, ['']) test('T11663', normal, compile_fail, ['']) test('T12229', normal, compile, ['']) test('T12681', normal, multimod_compile_fail, ['T12681','-v0']) +test('T12686', normal, compile_fail, ['']) From git at git.haskell.org Fri Nov 25 17:47:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:13 +0000 (UTC) Subject: [commit: ghc] master: Improve pretty-printing of types (5f349fe) Message-ID: <20161125174713.E61ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f349fe24066e7b0af85934664e27636d2e84fe5/ghc >--------------------------------------------------------------- commit 5f349fe24066e7b0af85934664e27636d2e84fe5 Author: Simon Peyton Jones Date: Thu Nov 24 12:32:11 2016 +0000 Improve pretty-printing of types In this commit commit 6c0f10fac767c49b65ed71e8eb8e78ca4f9062d5 Author: Ben Gamari Date: Sun Nov 13 16:17:37 2016 -0500 Kill Type pretty-printer we switched to pretty-printing a type by converting it to an IfaceType and pretty printing that. Very good. This patch fixes two things * The new story is terrible for debug-printing with -ddump-tc-trace, because all the extra info in an open type was discarded ty the conversion to IfaceType. This patch adds IfaceTcTyVar to IfaceType, to carry a TcTyVar in debug situations. Quite an easy change, happily. These things never show up in interface files. * Now that we are going via IfaceType, it's essential to tidy before converting; otherwise forall k_23 k_34. blah is printed as forall k k. blah which is very unhelpful. Again this only shows up in debug printing. >--------------------------------------------------------------- 5f349fe24066e7b0af85934664e27636d2e84fe5 compiler/backpack/RnModIface.hs | 3 ++- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 34 ++++++++++++++++++++++++++++++---- compiler/iface/TcIface.hs | 1 + compiler/iface/ToIface.hs | 20 ++++++++++---------- compiler/types/TyCoRep.hs | 27 ++++++++++++++++++++------- 6 files changed, 64 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 5f349fe24066e7b0af85934664e27636d2e84fe5 From git at git.haskell.org Fri Nov 25 17:47:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:17 +0000 (UTC) Subject: [commit: ghc] master: Fix inference of partial signatures (1bfff60) Message-ID: <20161125174717.3B4493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1bfff60fc57cd564382b86bdfb1f2764ca15d44f/ghc >--------------------------------------------------------------- commit 1bfff60fc57cd564382b86bdfb1f2764ca15d44f Author: Simon Peyton Jones Date: Fri Nov 25 11:35:50 2016 +0000 Fix inference of partial signatures When we had f :: ( _ ) => blah we were failing to call growThetaTyVars, as we do in the no-type-signature case, and that meant that we weren't generalising over the right type variables. I'm quite surprised this didn't cause problems earlier. Anyway Trac #12844 showed it up and this patch fixes it >--------------------------------------------------------------- 1bfff60fc57cd564382b86bdfb1f2764ca15d44f compiler/typecheck/TcBinds.hs | 7 ++++-- .../tests/partial-sigs/should_compile/T12844.hs | 20 +++++++++++++++++ .../partial-sigs/should_compile/T12844.stderr | 25 ++++++++++++++++++++++ testsuite/tests/partial-sigs/should_compile/all.T | 1 + 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 1c93962..d13af8b 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -822,8 +822,11 @@ chooseInferredQuantifiers inferred_theta tau_tvs qtvs | Just wc_var <- wcx = do { annotated_theta <- zonkTcTypes annotated_theta - ; let free_tvs = closeOverKinds (tyCoVarsOfTypes annotated_theta - `unionVarSet` tau_tvs) + ; let free_tvs = closeOverKinds (growThetaTyVars inferred_theta seed_tvs) + -- growThetaVars just like the no-type-sig case + -- Omitting this caused #12844 + seed_tvs = tyCoVarsOfTypes annotated_theta -- These are put there + `unionVarSet` tau_tvs -- by the user my_theta = pickCapturedPreds free_tvs inferred_theta -- Report the inferred constraints for an extra-constraints wildcard/hole as diff --git a/testsuite/tests/partial-sigs/should_compile/T12844.hs b/testsuite/tests/partial-sigs/should_compile/T12844.hs new file mode 100644 index 0000000..d47b82c --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T12844.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + +module T12844 where + +barWraper :: ('(r,r') ~ Head rngs, Foo rngs) => FooData rngs +barWraper = bar + +bar :: (_) => FooData rngs +bar = foo + +data FooData rngs + +class Foo xs where foo :: (Head xs ~ '(r,r')) => FooData xs + +type family Head (xs :: [k]) where Head (x ': xs) = x + diff --git a/testsuite/tests/partial-sigs/should_compile/T12844.stderr b/testsuite/tests/partial-sigs/should_compile/T12844.stderr new file mode 100644 index 0000000..8ad3777 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T12844.stderr @@ -0,0 +1,25 @@ + +T12844.hs:12:9: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ + standing for ‘(Head rngs ~ '(r, r'), Foo rngs)’ + Where: ‘r’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘r'’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘rngs’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘k’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘k1’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + • In the type signature: bar :: _ => FooData rngs diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index b320851..10cdfaa 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -68,3 +68,4 @@ test('T11670', normal, compile, ['']) test('T12156', normal, compile_fail, ['-fdefer-typed-holes']) test('T12531', normal, compile, ['-fdefer-typed-holes']) test('T12845', normal, compile, ['']) +test('T12844', normal, compile, ['']) From git at git.haskell.org Fri Nov 25 17:47:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:20 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #12845 (83a952d) Message-ID: <20161125174720.9A9AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/83a952d14012ff4706a366a3155712f8caa69ead/ghc >--------------------------------------------------------------- commit 83a952d14012ff4706a366a3155712f8caa69ead Author: Simon Peyton Jones Date: Thu Nov 24 12:15:34 2016 +0000 Test Trac #12845 >--------------------------------------------------------------- 83a952d14012ff4706a366a3155712f8caa69ead .../tests/partial-sigs/should_compile/T12845.hs | 23 ++++++++++++++++++++++ .../partial-sigs/should_compile/T12845.stderr | 7 +++++++ testsuite/tests/partial-sigs/should_compile/all.T | 1 + 3 files changed, 31 insertions(+) diff --git a/testsuite/tests/partial-sigs/should_compile/T12845.hs b/testsuite/tests/partial-sigs/should_compile/T12845.hs new file mode 100644 index 0000000..d9b8a99 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T12845.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + +module T12845 where + +import Data.Proxy + +data Foo (m :: Bool) + +type family Head (xs :: [(Bool, Bool)]) where Head (x ': xs) = x + +type family Bar (x :: Bool) (y :: Bool) :: Bool + +-- to trigger the bug, r and r' cannot *both* appear on the RHS +broken :: forall r r' rngs . ('(r,r') ~ Head rngs, Bar r r' ~ 'True, _) + => Foo r -> Proxy rngs -> () +broken x _ = let y = requireBar x :: Foo r' in () + +requireBar :: (Bar m m' ~ 'True) => Foo m -> Foo m' +requireBar = undefined diff --git a/testsuite/tests/partial-sigs/should_compile/T12845.stderr b/testsuite/tests/partial-sigs/should_compile/T12845.stderr new file mode 100644 index 0000000..0d19b1a --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T12845.stderr @@ -0,0 +1,7 @@ + +T12845.hs:18:70: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ standing for ‘() :: Constraint’ + • In the type signature: + broken :: forall r r' rngs. + ('(r, r') ~ Head rngs, Bar r r' ~ True, _) => + Foo r -> Proxy rngs -> () diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index d2c6836..b320851 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -67,3 +67,4 @@ test('T11339a', normal, compile, ['']) test('T11670', normal, compile, ['']) test('T12156', normal, compile_fail, ['-fdefer-typed-holes']) test('T12531', normal, compile, ['-fdefer-typed-holes']) +test('T12845', normal, compile, ['']) From git at git.haskell.org Fri Nov 25 17:47:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:23 +0000 (UTC) Subject: [commit: ghc] master: Use TyVars in PatSyns (12eff23) Message-ID: <20161125174723.59EF53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12eff239236c43ee903d8e29287a36c3d8e24747/ghc >--------------------------------------------------------------- commit 12eff239236c43ee903d8e29287a36c3d8e24747 Author: Simon Peyton Jones Date: Fri Nov 25 11:39:38 2016 +0000 Use TyVars in PatSyns I found that some TcTyVars were lurking in a PatSyn, because tc_patsyn_finish was using the TcType -> TcType zonker rather than the TcType -> Type zonker. Eeek. I fixing this I also tided up function naming a bit (still not terrific), and removed the unused TcTyBinder type entirely. >--------------------------------------------------------------- 12eff239236c43ee903d8e29287a36c3d8e24747 compiler/typecheck/TcHsSyn.hs | 17 ++++++++++------- compiler/typecheck/TcHsType.hs | 4 ++-- compiler/typecheck/TcMType.hs | 15 +++------------ compiler/typecheck/TcPatSyn.hs | 27 +++++++++++---------------- compiler/typecheck/TcTyClsDecls.hs | 2 +- compiler/typecheck/TcType.hs | 3 +-- 6 files changed, 28 insertions(+), 40 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 12eff239236c43ee903d8e29287a36c3d8e24747 From git at git.haskell.org Fri Nov 25 17:47:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:26 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #12867 (f0f4682) Message-ID: <20161125174726.BF5B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0f468262d8b3932de0ce79f4fd98fecf51a62a3/ghc >--------------------------------------------------------------- commit f0f468262d8b3932de0ce79f4fd98fecf51a62a3 Author: Simon Peyton Jones Date: Tue Nov 22 10:35:28 2016 +0000 Test Trac #12867 >--------------------------------------------------------------- f0f468262d8b3932de0ce79f4fd98fecf51a62a3 testsuite/tests/indexed-types/should_fail/T12867.hs | 10 ++++++++++ testsuite/tests/indexed-types/should_fail/T12867.stderr | 12 ++++++++++++ testsuite/tests/indexed-types/should_fail/all.T | 1 + 3 files changed, 23 insertions(+) diff --git a/testsuite/tests/indexed-types/should_fail/T12867.hs b/testsuite/tests/indexed-types/should_fail/T12867.hs new file mode 100644 index 0000000..e4a39ce --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T12867.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} + +module T12866 where + +type Test2 a = (Eq (TestM a)) + +class Test a where + type TestM :: * diff --git a/testsuite/tests/indexed-types/should_fail/T12867.stderr b/testsuite/tests/indexed-types/should_fail/T12867.stderr new file mode 100644 index 0000000..e712c49 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T12867.stderr @@ -0,0 +1,12 @@ + +T12867.hs:7:21: error: + • Expecting one fewer arguments to ‘TestM’ + Expected kind ‘k0 -> *’, but ‘TestM’ has kind ‘*’ + • In the first argument of ‘Eq’, namely ‘TestM a’ + In the type ‘Eq (TestM a)’ + In the type declaration for ‘Test2’ + +T12867.hs:9:1: error: + • The associated type ‘TestM’ + mentions none of the type or kind variables of the class ‘Test a’ + • In the class declaration for ‘Test’ diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 4b0e994..8c24344 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -139,3 +139,4 @@ test('T7788', normal, compile_fail, ['']) test('T11450', normal, compile_fail, ['']) test('T12041', normal, compile_fail, ['']) test('T12522a', normal, compile_fail, ['']) +test('T12867', normal, compile_fail, ['']) From git at git.haskell.org Fri Nov 25 17:47:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:29 +0000 (UTC) Subject: [commit: ghc] master: Be a bit more selective about improvement (f8c966c) Message-ID: <20161125174729.747723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f8c966c70bf4e6ca7482658d4eaca2dae367213f/ghc >--------------------------------------------------------------- commit f8c966c70bf4e6ca7482658d4eaca2dae367213f Author: Simon Peyton Jones Date: Thu Nov 24 22:21:08 2016 +0000 Be a bit more selective about improvement This patch makes [W] constraints not participate in improvement. See Note [Do not do improvement for WOnly] in TcSMonad. Removes some senseless work duplication in some cases (notably Trac #12860); should not change behaviour. >--------------------------------------------------------------- f8c966c70bf4e6ca7482658d4eaca2dae367213f compiler/typecheck/TcInteract.hs | 25 +++++++++++++++++++------ compiler/typecheck/TcSMonad.hs | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 4d49ede..0ff7a97 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -728,25 +728,32 @@ interactDict _ wi = pprPanic "interactDict" (ppr wi) addFunDepWork :: InertCans -> CtEvidence -> Class -> TcS () -- Add derived constraints from type-class functional dependencies. addFunDepWork inerts work_ev cls + | isImprovable work_ev = mapBagM_ add_fds (findDictsByClass (inert_dicts inerts) cls) -- No need to check flavour; fundeps work between -- any pair of constraints, regardless of flavour -- Importantly we don't throw workitem back in the -- worklist because this can cause loops (see #5236) + | otherwise + = return () where work_pred = ctEvPred work_ev work_loc = ctEvLoc work_ev add_fds inert_ct + | isImprovable inert_ev = emitFunDepDeriveds $ improveFromAnother derived_loc inert_pred work_pred -- We don't really rewrite tys2, see below _rewritten_tys2, so that's ok -- NB: We do create FDs for given to report insoluble equations that arise -- from pairs of Givens, and also because of floating when we approximate -- implications. The relevant test is: typecheck/should_fail/FDsFromGivens.hs + | otherwise + = return () where - inert_pred = ctPred inert_ct - inert_loc = ctLoc inert_ct + inert_ev = ctEvidence inert_ct + inert_pred = ctEvPred inert_ev + inert_loc = ctEvLoc inert_ev derived_loc = work_loc { ctl_depth = ctl_depth work_loc `maxSubGoalDepth` ctl_depth inert_loc , ctl_origin = FunDepOrigin1 work_pred work_loc @@ -895,8 +902,11 @@ improveLocalFunEqs :: CtEvidence -> InertCans -> TyCon -> [TcType] -> TcTyVar -- Generate derived improvement equalities, by comparing -- the current work item with inert CFunEqs -- E.g. x + y ~ z, x + y' ~ z => [D] y ~ y' +-- +-- See Note [FunDep and implicit parameter reactions] improveLocalFunEqs work_ev inerts fam_tc args fsk - | isGiven work_ev -- See Note [No FunEq improvement for Givens] + | isGiven work_ev -- See Note [No FunEq improvement for Givens] + || not (isImprovable work_ev) = return () | not (null improvement_eqns) @@ -943,7 +953,8 @@ improveLocalFunEqs work_ev inerts fam_tc args fsk -- See Note [Type inference for type families with injectivity] do_one_injective inj_args (CFunEqCan { cc_tyargs = inert_args , cc_fsk = ifsk, cc_ev = inert_ev }) - | rhs `tcEqType` lookupFlattenTyVar ieqs ifsk + | isImprovable inert_ev + , rhs `tcEqType` lookupFlattenTyVar ieqs ifsk = mk_fd_eqns inert_ev $ [ Pair arg iarg | (arg, iarg, True) <- zip3 args inert_args inj_args ] @@ -1460,7 +1471,8 @@ reduce_top_fun_eq old_ev fsk (ax_co, rhs_ty) improveTopFunEqs :: CtEvidence -> TyCon -> [TcType] -> TcTyVar -> TcS () -- See Note [FunDep and implicit parameter reactions] improveTopFunEqs ev fam_tc args fsk - | isGiven ev -- See Note [No FunEq improvement for Givens] + | isGiven ev -- See Note [No FunEq improvement for Givens] + || not (isImprovable ev) = return () | otherwise @@ -1824,7 +1836,8 @@ doTopReactDict inerts work_item@(CDictCan { cc_ev = fl, cc_class = cls ; if isDerived fl then finish_derived theta else finish_wanted theta mk_ev } NoInstance -> - do { try_fundep_improvement + do { when (isImprovable fl) $ + try_fundep_improvement ; continueWith work_item } } where dict_pred = mkClassPred cls xis diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 7665e44..aa7a6e1 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -57,6 +57,7 @@ module TcSMonad ( removeInertCts, getPendingScDicts, addInertCan, addInertEq, insertFunEq, emitInsoluble, emitWorkNC, emitWork, + isImprovable, -- The Model kickOutAfterUnification, @@ -1148,6 +1149,37 @@ them. If we forget the pend_sc flag, our cunning scheme for avoiding generating superclasses repeatedly will fail. See Trac #11379 for a case of this. + +Note [Do not do improvement for WOnly] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We do improvement between two constraints (e.g. for injectivity +or functional dependencies) only if both are "improvable". And +we improve a constraint wrt the top-level instances only if +it is improveable. + +Improvable: [G] [WD] [D} +Not improvable: [W] + +Reasons: + +* It's less work: fewer pairs to compare + +* Every [W] has a shadow [D] so nothing is lost + +* Consider [WD] C Int b, where 'b' is a skolem, and + class C a b | a -> b + instance C Int Bool + We'll do a fundep on it and emit [D] b ~ Bool + That will kick out constraint [WD] C Int b + Then we'll split it to [W] C Int b (keep in inert) + and [D] C Int b (in work list) + When processing the latter we'll rewrite it to + [D] C Int Bool + At that point it would be /stupid/ to interact it + with the inert [W] C Int b in the inert set; after all, + it's the very constraint from which the [D] C Int Bool + was split! We can avoid this by not doing improvement + on [W] constraints. This came up in Trac #12860. -} maybeEmitShadow :: InertCans -> Ct -> TcS Ct @@ -1199,6 +1231,12 @@ intersects_with inert_eqs free_vars -- to the underlying UniqFM. A bit yukky, but efficient. +isImprovable :: CtEvidence -> Bool +-- See Note [Do not do improvement for WOnly] +isImprovable (CtWanted { ctev_nosh = WOnly }) = False +isImprovable _ = True + + {- ********************************************************************* * * Inert equalities From git at git.haskell.org Fri Nov 25 17:47:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:32 +0000 (UTC) Subject: [commit: ghc] master: Use TyVars in a DFunUnfolding (edbe831) Message-ID: <20161125174732.2AB163A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/edbe83190582f5dad2603c0929d6b3aa41ce314e/ghc >--------------------------------------------------------------- commit edbe83190582f5dad2603c0929d6b3aa41ce314e Author: Simon Peyton Jones Date: Thu Nov 24 13:50:53 2016 +0000 Use TyVars in a DFunUnfolding En route to something else I discovered that TcInstDcls.addDFunPrags was building a DFunUnfolding that had TcTyVars in it. They should never survive beyond type checking. It was harmeless, but now affects type pretty-printing. This patch fixes it. >--------------------------------------------------------------- edbe83190582f5dad2603c0929d6b3aa41ce314e compiler/typecheck/TcInstDcls.hs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 1a46a0a..dc951b9 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -842,8 +842,7 @@ tcInstDecl2 (InstInfo { iSpec = ispec, iBinds = ibinds }) arg_wrapper = mkWpEvVarApps dfun_ev_vars <.> mkWpTyApps inst_tv_tys is_newtype = isNewTyCon class_tc - dfun_id_w_prags = addDFunPrags dfun_id dict_constr is_newtype - inst_tyvars dfun_ev_vars inst_tys sc_meth_ids + dfun_id_w_prags = addDFunPrags dfun_id sc_meth_ids dfun_spec_prags | is_newtype = SpecPrags [] | otherwise = SpecPrags spec_inst_prags @@ -867,16 +866,17 @@ tcInstDecl2 (InstInfo { iSpec = ispec, iBinds = ibinds }) dfun_id = instanceDFunId ispec loc = getSrcSpan dfun_id -addDFunPrags :: DFunId -> DataCon -> Bool - -> [TyVar] -> [Id] -> [Type] - -> [Id] -> DFunId +addDFunPrags :: DFunId -> [Id] -> DFunId -- DFuns need a special Unfolding and InlinePrag -- See Note [ClassOp/DFun selection] -- and Note [Single-method classes] -- It's easiest to create those unfoldings right here, where -- have all the pieces in hand, even though we are messing with -- Core at this point, which the typechecker doesn't usually do -addDFunPrags dfun_id dict_con is_newtype dfun_tvs dfun_evs inst_tys sc_meth_ids +-- However we take care to build the unfolding using the TyVars from +-- the DFunId rather than from the skolem pieces that the typechecker +-- is messing with. +addDFunPrags dfun_id sc_meth_ids | is_newtype = dfun_id `setIdUnfolding` mkInlineUnfolding (Just 0) con_app `setInlinePragma` alwaysInlinePragma { inl_sat = Just 0 } @@ -884,11 +884,17 @@ addDFunPrags dfun_id dict_con is_newtype dfun_tvs dfun_evs inst_tys sc_meth_ids = dfun_id `setIdUnfolding` mkDFunUnfolding dfun_bndrs dict_con dict_args `setInlinePragma` dfunInlinePragma where - dfun_bndrs = dfun_tvs ++ dfun_evs - dict_args = map Type inst_tys ++ - [mkVarApps (Var id) dfun_bndrs | id <- sc_meth_ids] con_app = mkLams dfun_bndrs $ mkApps (Var (dataConWrapId dict_con)) dict_args + dict_args = map Type inst_tys ++ + [mkVarApps (Var id) dfun_bndrs | id <- sc_meth_ids] + + (dfun_tvs, dfun_theta, clas, inst_tys) = tcSplitDFunTy (idType dfun_id) + ev_ids = mkTemplateLocalsNum 1 dfun_theta + dfun_bndrs = dfun_tvs ++ ev_ids + clas_tc = classTyCon clas + [dict_con] = tyConDataCons clas_tc + is_newtype = isNewTyCon clas_tc wrapId :: HsWrapper -> id -> HsExpr id wrapId wrapper id = mkHsWrap wrapper (HsVar (noLoc id)) From git at git.haskell.org Fri Nov 25 17:47:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:34 +0000 (UTC) Subject: [commit: ghc] master: A tiny bit more tc tracing (086b483) Message-ID: <20161125174734.CE54B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/086b4836c4b279d5ae0e330719e1a679dd16392e/ghc >--------------------------------------------------------------- commit 086b4836c4b279d5ae0e330719e1a679dd16392e Author: Simon Peyton Jones Date: Fri Nov 25 11:43:10 2016 +0000 A tiny bit more tc tracing >--------------------------------------------------------------- 086b4836c4b279d5ae0e330719e1a679dd16392e compiler/typecheck/TcUnify.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index 12502c6..fa7c517 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -684,7 +684,10 @@ tc_sub_type_ds :: CtOrigin -- used when calling uType -- Here is where the work actually happens! -- Precondition: ty_expected is deeply skolemised tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected - = go ty_actual ty_expected + = do { traceTc "tc_sub_type_ds" $ + vcat [ text "ty_actual =" <+> ppr ty_actual + , text "ty_expected =" <+> ppr ty_expected ] + ; go ty_actual ty_expected } where go ty_a ty_e | Just ty_a' <- coreView ty_a = go ty_a' ty_e | Just ty_e' <- coreView ty_e = go ty_a ty_e' From git at git.haskell.org Fri Nov 25 17:47:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:37 +0000 (UTC) Subject: [commit: ghc] master: Use 'v' instead of 'tpl' for template vars (bc35c3f) Message-ID: <20161125174737.7F01E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc35c3f9bd58465ce46cfe6cee9d911165fcdd3a/ghc >--------------------------------------------------------------- commit bc35c3f9bd58465ce46cfe6cee9d911165fcdd3a Author: Simon Peyton Jones Date: Thu Nov 24 12:36:11 2016 +0000 Use 'v' instead of 'tpl' for template vars Just affects Id.mkTemplateLocal, and should make debug prints a little less voluminous. No user-visible change here. >--------------------------------------------------------------- bc35c3f9bd58465ce46cfe6cee9d911165fcdd3a compiler/basicTypes/Id.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 4e8847b..b2be2c0 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -338,7 +338,7 @@ mkWorkerId uniq unwrkr ty -- | Create a /template local/: a family of system local 'Id's in bijection with @Int at s, typically used in unfoldings mkTemplateLocal :: Int -> Type -> Id -mkTemplateLocal i ty = mkSysLocalOrCoVar (fsLit "tpl") (mkBuiltinUnique i) ty +mkTemplateLocal i ty = mkSysLocalOrCoVar (fsLit "v") (mkBuiltinUnique i) ty -- | Create a template local for a series of types mkTemplateLocals :: [Type] -> [Id] From git at git.haskell.org Fri Nov 25 17:47:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:40 +0000 (UTC) Subject: [commit: ghc] master: Kill off ifaceTyVarsOfType (a5a3926) Message-ID: <20161125174740.37D9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a5a392649b10f956aaf3c84ac9321e242a383bbe/ghc >--------------------------------------------------------------- commit a5a392649b10f956aaf3c84ac9321e242a383bbe Author: Simon Peyton Jones Date: Thu Nov 24 12:26:24 2016 +0000 Kill off ifaceTyVarsOfType IfaceTypes are really not well suited to finding free variables etc. Nevertheless, there was quite a lot of code to do just that; but it was only used to see if a kind is variable-free so as to decide whether to print a forall binder. This patch simplifies to deal with just that case, replacing all the free-vars stuff with just ifTypeIsVarFree >--------------------------------------------------------------- a5a392649b10f956aaf3c84ac9321e242a383bbe compiler/iface/IfaceType.hs | 90 +++++++++++---------------------------------- 1 file changed, 21 insertions(+), 69 deletions(-) diff --git a/compiler/iface/IfaceType.hs b/compiler/iface/IfaceType.hs index d6a9a21..a797b9e 100644 --- a/compiler/iface/IfaceType.hs +++ b/compiler/iface/IfaceType.hs @@ -63,7 +63,6 @@ import Binary import Outputable import FastString import FastStringEnv -import UniqSet import UniqFM import Util @@ -321,73 +320,26 @@ ifTyConBinderTyVar = binderVar ifTyConBinderName :: IfaceTyConBinder -> IfLclName ifTyConBinderName tcb = ifaceTvBndrName (ifTyConBinderTyVar tcb) -ifTyVarsOfType :: IfaceType -> UniqSet IfLclName -ifTyVarsOfType ty - = case ty of - IfaceTyVar v -> unitUniqSet v - IfaceAppTy fun arg - -> ifTyVarsOfType fun `unionUniqSets` ifTyVarsOfType arg - IfaceFunTy arg res - -> ifTyVarsOfType arg `unionUniqSets` ifTyVarsOfType res - IfaceDFunTy arg res - -> ifTyVarsOfType arg `unionUniqSets` ifTyVarsOfType res - IfaceForAllTy bndr ty - -> let (free, bound) = ifTyVarsOfForAllBndr bndr in - delListFromUniqSet (ifTyVarsOfType ty) bound `unionUniqSets` free - IfaceTyConApp _ args -> ifTyVarsOfArgs args - IfaceLitTy _ -> emptyUniqSet - IfaceCastTy ty co - -> ifTyVarsOfType ty `unionUniqSets` ifTyVarsOfCoercion co - IfaceCoercionTy co -> ifTyVarsOfCoercion co - IfaceTupleTy _ _ args -> ifTyVarsOfArgs args - -ifTyVarsOfForAllBndr :: IfaceForAllBndr - -> ( UniqSet IfLclName -- names used free in the binder - , [IfLclName] ) -- names bound by this binder -ifTyVarsOfForAllBndr (TvBndr (name, kind) _) = (ifTyVarsOfType kind, [name]) - -ifTyVarsOfArgs :: IfaceTcArgs -> UniqSet IfLclName -ifTyVarsOfArgs args = argv emptyUniqSet args - where - argv vs (ITC_Vis t ts) = argv (vs `unionUniqSets` (ifTyVarsOfType t)) ts - argv vs (ITC_Invis k ks) = argv (vs `unionUniqSets` (ifTyVarsOfType k)) ks - argv vs ITC_Nil = vs - -ifTyVarsOfCoercion :: IfaceCoercion -> UniqSet IfLclName -ifTyVarsOfCoercion = go +ifTypeIsVarFree :: IfaceType -> Bool +-- Returns True if the type definitely has no variables at all +-- Just used to control pretty printing +ifTypeIsVarFree ty = go ty where - go (IfaceReflCo _ ty) = ifTyVarsOfType ty - go (IfaceFunCo _ c1 c2) = go c1 `unionUniqSets` go c2 - go (IfaceTyConAppCo _ _ cos) = ifTyVarsOfCoercions cos - go (IfaceAppCo c1 c2) = go c1 `unionUniqSets` go c2 - go (IfaceForAllCo (bound, _) kind_co co) - = go co `delOneFromUniqSet` bound `unionUniqSets` go kind_co - go (IfaceCoVarCo cv) = unitUniqSet cv - go (IfaceAxiomInstCo _ _ cos) = ifTyVarsOfCoercions cos - go (IfaceUnivCo p _ ty1 ty2) = go_prov p `unionUniqSets` - ifTyVarsOfType ty1 `unionUniqSets` - ifTyVarsOfType ty2 - go (IfaceSymCo co) = go co - go (IfaceTransCo c1 c2) = go c1 `unionUniqSets` go c2 - go (IfaceNthCo _ co) = go co - go (IfaceLRCo _ co) = go co - go (IfaceInstCo c1 c2) = go c1 `unionUniqSets` go c2 - go (IfaceCoherenceCo c1 c2) = go c1 `unionUniqSets` go c2 - go (IfaceKindCo co) = go co - go (IfaceSubCo co) = go co - go (IfaceAxiomRuleCo rule cos) - = unionManyUniqSets - [ unitUniqSet rule - , ifTyVarsOfCoercions cos ] - - go_prov IfaceUnsafeCoerceProv = emptyUniqSet - go_prov (IfacePhantomProv co) = go co - go_prov (IfaceProofIrrelProv co) = go co - go_prov (IfacePluginProv _) = emptyUniqSet - go_prov (IfaceHoleProv _) = emptyUniqSet - -ifTyVarsOfCoercions :: [IfaceCoercion] -> UniqSet IfLclName -ifTyVarsOfCoercions = foldr (unionUniqSets . ifTyVarsOfCoercion) emptyUniqSet + go (IfaceTyVar {}) = False + go (IfaceTcTyVar {}) = False + go (IfaceAppTy fun arg) = go fun && go arg + go (IfaceFunTy arg res) = go arg && go res + go (IfaceDFunTy arg res) = go arg && go res + go (IfaceForAllTy {}) = False + go (IfaceTyConApp _ args) = go_args args + go (IfaceTupleTy _ _ args) = go_args args + go (IfaceLitTy _) = True + go (IfaceCastTy {}) = False -- Safe + go (IfaceCoercionTy {}) = False -- Safe + + go_args ITC_Nil = True + go_args (ITC_Vis arg args) = go arg && go_args args + go_args (ITC_Invis arg args) = go arg && go_args args {- Substitutions on IfaceType. This is only used during pretty-printing to construct @@ -927,8 +879,8 @@ pprUserIfaceForAll tvs ppWhen (any tv_has_kind_var tvs || gopt Opt_PrintExplicitForalls dflags) $ pprIfaceForAll tvs where - tv_has_kind_var bndr - = not (isEmptyUniqSet (fst (ifTyVarsOfForAllBndr bndr))) + tv_has_kind_var (TvBndr (_,kind) _) = not (ifTypeIsVarFree kind) + ------------------- From git at git.haskell.org Fri Nov 25 17:47:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 25 Nov 2016 17:47:42 +0000 (UTC) Subject: [commit: ghc] master: Refactor functional dependencies a bit (eb55ec2) Message-ID: <20161125174742.EE1413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eb55ec2941239dee05afc6be818b129efe51660e/ghc >--------------------------------------------------------------- commit eb55ec2941239dee05afc6be818b129efe51660e Author: Simon Peyton Jones Date: Thu Nov 24 13:47:02 2016 +0000 Refactor functional dependencies a bit * Rename CoAxiom.Eqn = Pair Type to TypeEqn, and use it for fundeps * Use the FunDepEqn for injectivity, which lets us share a bit more code, and (more important) brain cells * When generating fundeps, take the max depth of the two constraints. This aimed at tackling the strange loop in Trac #12860, but there is more to come for that. * Improve pretty-printing with -ddump-tc-trace >--------------------------------------------------------------- eb55ec2941239dee05afc6be818b129efe51660e compiler/typecheck/FunDeps.hs | 16 +++-- compiler/typecheck/TcInteract.hs | 141 ++++++++++++++++++++------------------- compiler/typecheck/TcRnTypes.hs | 13 +++- compiler/typecheck/TcSMonad.hs | 10 ++- compiler/typecheck/TcTypeNats.hs | 4 +- compiler/types/CoAxiom.hs | 10 +-- 6 files changed, 106 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 eb55ec2941239dee05afc6be818b129efe51660e From git at git.haskell.org Mon Nov 28 08:36:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 Nov 2016 08:36:55 +0000 (UTC) Subject: [commit: ghc] master: Fix an long-standing bug in OccurAnal (6ec2304) Message-ID: <20161128083655.C24983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ec2304f46c9a5423943c5bf29bd8a8c062b6560/ghc >--------------------------------------------------------------- commit 6ec2304f46c9a5423943c5bf29bd8a8c062b6560 Author: Simon Peyton Jones Date: Sun Nov 27 23:35:12 2016 +0000 Fix an long-standing bug in OccurAnal This bug was beautifully characterised in Trac #12776, which showed a small program for which the inliner went into an infinite loop. Eeek. It turned out to be a genuine and long-standing bug in the occurrence analyer, specifically in the bit that identifies loop breakers. In this line pairs | isEmptyVarSet weak_fvs = reOrderNodes 0 bndr_set weak_fvs tagged_nodes [] | otherwise = loopBreakNodes 0 bndr_set weak_fvs loop_breaker_edges [] the 'tagged_nodes' should be 'loop_breaker_edges'. That's it! The diff looks a lot bigger because I did some work on comments and variable naming, but that's all it is. We were using the wrong set of dependencies! I'm astonished that this bug has not caused more trouble. It dates back to at least 2011 and maybe further. >--------------------------------------------------------------- 6ec2304f46c9a5423943c5bf29bd8a8c062b6560 compiler/simplCore/OccurAnal.hs | 228 ++++++++++++++++++++++++---------------- 1 file changed, 139 insertions(+), 89 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 6ec2304f46c9a5423943c5bf29bd8a8c062b6560 From git at git.haskell.org Mon Nov 28 09:43:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 Nov 2016 09:43:16 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments only [ci skip] (5238842) Message-ID: <20161128094316.272A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/52388421c5649431ce128cb08fb1329727023464/ghc >--------------------------------------------------------------- commit 52388421c5649431ce128cb08fb1329727023464 Author: Gabor Greif Date: Mon Nov 28 10:40:13 2016 +0100 Typos in comments only [ci skip] >--------------------------------------------------------------- 52388421c5649431ce128cb08fb1329727023464 compiler/main/Plugins.hs | 4 ++-- compiler/typecheck/TcSMonad.hs | 2 +- compiler/types/TyCoRep.hs | 2 +- compiler/utils/Digraph.hs | 6 +++--- rts/StgCRun.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/main/Plugins.hs b/compiler/main/Plugins.hs index 6a8c761..74403ed 100644 --- a/compiler/main/Plugins.hs +++ b/compiler/main/Plugins.hs @@ -17,7 +17,7 @@ type CommandLineOption = String -- | 'Plugin' is the core compiler plugin data type. Try to avoid -- constructing one of these directly, and just modify some fields of -- 'defaultPlugin' instead: this is to try and preserve source-code --- compatability when we add fields to this. +-- compatibility when we add fields to this. -- -- Nonetheless, this API is preliminary and highly likely to change in -- the future. @@ -32,7 +32,7 @@ data Plugin = Plugin { -- behaviour of the constraint solver. } --- | Default plugin: does nothing at all! For compatability reasons +-- | Default plugin: does nothing at all! For compatibility reasons -- you should base all your plugin definitions on this default value. defaultPlugin :: Plugin defaultPlugin = Plugin { diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index aa7a6e1..cff667e 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -1111,7 +1111,7 @@ But (a) I have been unable to come up with an example of this (b) see Trac #12660 for how adding the derived shadows of a Given led to an infinite loop. (c) It's unlikely that rewriting derived Givens will lead - to a unification becuse Givens don't mention touchable + to a unification because Givens don't mention touchable unification variables For (b) there may be other ways to solve the loop, but simply diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 488b669..6680ca8 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2440,7 +2440,7 @@ pprTyVars tvs = sep (map pprTyVar tvs) pprTyVar :: TyVar -> SDoc -- Print a type variable binder with its kind (but not if *) --- Here we do not go via IfaceType, becuase the duplication with +-- Here we do not go via IfaceType, because the duplication with -- pprIfaceTvBndr is minimal, and the loss of uniques etc in -- debug printing is disastrous pprTyVar tv diff --git a/compiler/utils/Digraph.hs b/compiler/utils/Digraph.hs index 93906b2..53173ba 100644 --- a/compiler/utils/Digraph.hs +++ b/compiler/utils/Digraph.hs @@ -16,7 +16,7 @@ module Digraph( findCycle, - -- For backwards compatability with the simpler version of Digraph + -- For backwards compatibility with the simpler version of Digraph stronglyConnCompFromEdgedVerticesOrd, stronglyConnCompFromEdgedVerticesOrdR, stronglyConnCompFromEdgedVerticesUniq, @@ -286,7 +286,7 @@ decodeSccs Graph { gr_int_graph = graph, gr_vertex_to_node = vertex_fn } forest mentions_itself v = v `elem` (graph ! v) --- The following two versions are provided for backwards compatability: +-- The following two versions are provided for backwards compatibility: -- See Note [Deterministic SCC] -- See Note [reduceNodesIntoVertices implementations] stronglyConnCompFromEdgedVerticesOrd @@ -297,7 +297,7 @@ stronglyConnCompFromEdgedVerticesOrd = map (fmap get_node) . stronglyConnCompFromEdgedVerticesOrdR where get_node (n, _, _) = n --- The following two versions are provided for backwards compatability: +-- The following two versions are provided for backwards compatibility: -- See Note [Deterministic SCC] -- See Note [reduceNodesIntoVertices implementations] stronglyConnCompFromEdgedVerticesUniq diff --git a/rts/StgCRun.c b/rts/StgCRun.c index c110f51..0610dd3 100644 --- a/rts/StgCRun.c +++ b/rts/StgCRun.c @@ -141,7 +141,7 @@ StgWord8 *win32AllocStack(void) * we only jump to other STG procedures, so we maintain the 16n - word_size * alignment for these jumps. * - * This gives us binary compatability with LLVM and GCC as well as dealing + * This gives us binary compatibility with LLVM and GCC as well as dealing * with the FFI. Previously we just maintianed a 16n byte alignment for * procedure entry and calls, which led to bugs (see #4211 and #5250). * From git at git.haskell.org Mon Nov 28 16:44:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 Nov 2016 16:44:38 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #12776 (605af54) Message-ID: <20161128164438.583BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/605af54aee76cd3d02afb60ff0b0dde052645fe7/ghc >--------------------------------------------------------------- commit 605af54aee76cd3d02afb60ff0b0dde052645fe7 Author: Simon Peyton Jones Date: Mon Nov 28 16:43:49 2016 +0000 Test Trac #12776 >--------------------------------------------------------------- 605af54aee76cd3d02afb60ff0b0dde052645fe7 testsuite/tests/simplCore/should_compile/T12776.hs | 42 ++++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 43 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T12776.hs b/testsuite/tests/simplCore/should_compile/T12776.hs new file mode 100644 index 0000000..e8e2c8c --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T12776.hs @@ -0,0 +1,42 @@ +{-# OPTIONS_GHC -O2 #-} + +-- This made the simplifier loop doing infinite inlining +-- in GHC 8.0 + +module T12776(distinct_degree_factorization_i) where + +import Prelude ((==), Eq); + +data Slist a = Nil_s | Cons_s a (Slist a) deriving Eq; + +map_s :: (a -> b) -> Slist a -> Slist b; +map_s f (Cons_s x21 x22) = Cons_s (f x21) (map_s f x22); + +normalize_poly_i :: (Eq a) => (a -> a) -> Slist a -> Slist a; +normalize_poly_i ops xs = if ops (lead_coeff_i xs) == lead_coeff_i xs then Nil_s else map_s ops xs; + +mod_poly_one_main_i :: (Eq a) => (a -> a) -> Slist a -> Slist a; +mod_poly_one_main_i ops d = + if d == d then d else mod_poly_one_main_i ops (normalize_poly_i ops d); + +last_s :: (Eq a) => Slist a -> a; +last_s (Cons_s x xs) = (if xs == Nil_s then x else last_s xs); + +mod_field_poly_i :: (Eq a) => (a -> a) -> Slist a -> Slist a; +mod_field_poly_i ops cf = + (if cf == cf then cf else + mod_poly_one_main_i ops (map_s (\_ -> ops (last_s cf)) cf)); + +lead_coeff_i :: Eq a => Slist a -> a; +lead_coeff_i pp = (case pp of { + Cons_s _ _ -> last_s pp; + }); + +dist_degree_factorize_main_i :: Eq a => (a -> a) -> Slist a -> [Slist a] -> [Slist a]; +dist_degree_factorize_main_i ff_ops w res = + if w == w then res + else dist_degree_factorize_main_i ff_ops (mod_field_poly_i ff_ops w) + [normalize_poly_i ff_ops (mod_field_poly_i ff_ops w)]; + +distinct_degree_factorization_i :: Eq a => (a -> a) -> [Slist a]; +distinct_degree_factorization_i ff_ops = dist_degree_factorize_main_i ff_ops Nil_s [] diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index f985b4a..19d806f 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -245,3 +245,4 @@ test('T12212', normal, compile, ['-O']) test('noinline01', only_ways(['optasm']), compile, ['-ddump-stg -dsuppress-uniques -O']) test('par01', only_ways(['optasm']), compile, ['-ddump-prep -dsuppress-uniques -O2']) +test('T12776', normal, compile, ['-O2']) From git at git.haskell.org Mon Nov 28 17:16:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 Nov 2016 17:16:15 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #12885 (27a6bdf) Message-ID: <20161128171615.B59C63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/27a6bdf029491a7bbd50377932ae86ede5b5020a/ghc >--------------------------------------------------------------- commit 27a6bdf029491a7bbd50377932ae86ede5b5020a Author: Simon Peyton Jones Date: Mon Nov 28 17:15:16 2016 +0000 Test Trac #12885 ...which is fixed by commit 0476a64e70c91b326b53db2fc55adbbaa8e5c270 Author: Simon Peyton Jones Date: Tue Oct 25 15:22:17 2016 +0100 Fix a bug in mk_superclasses_of >--------------------------------------------------------------- 27a6bdf029491a7bbd50377932ae86ede5b5020a testsuite/tests/polykinds/T12885.hs | 12 ++++++++++++ testsuite/tests/polykinds/all.T | 1 + 2 files changed, 13 insertions(+) diff --git a/testsuite/tests/polykinds/T12885.hs b/testsuite/tests/polykinds/T12885.hs new file mode 100644 index 0000000..5da4981 --- /dev/null +++ b/testsuite/tests/polykinds/T12885.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TypeFamilies, ConstraintKinds #-} + +module Foo where + +import GHC.Exts + +f :: F [a] => a -> Bool +f x = x == x + +type family F a :: Constraint +type instance F [a] = (Show a, (Show a, (Show a, (Show a, (Show a, + Show a, (Show a, (Show a, (Show a, (Show a, Eq a))))))))) diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 0e0d66a..db06932 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -155,3 +155,4 @@ test('T12593', normal, compile_fail, ['']) test('T12668', normal, compile, ['']) test('T12718', normal, compile, ['']) test('T12444', normal, compile_fail, ['']) +test('T12885', normal, compile, ['']) From git at git.haskell.org Mon Nov 28 17:44:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 28 Nov 2016 17:44:06 +0000 (UTC) Subject: [commit: ghc] master: Comments only (related to #12789) (3aa9368) Message-ID: <20161128174406.E04513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3aa936893cac8d7c3b242c882731e9a38a4ae425/ghc >--------------------------------------------------------------- commit 3aa936893cac8d7c3b242c882731e9a38a4ae425 Author: Simon Peyton Jones Date: Mon Nov 28 17:41:27 2016 +0000 Comments only (related to #12789) It took me some time to find the right Note for the fix to #12789. This comment patch tries to add pointers from relevant places. >--------------------------------------------------------------- 3aa936893cac8d7c3b242c882731e9a38a4ae425 compiler/coreSyn/CoreSyn.hs | 4 +-- compiler/iface/MkIface.hs | 72 ----------------------------------------- compiler/iface/ToIface.hs | 71 ++++++++++++++++++++++++++++++++++++++++ compiler/simplCore/OccurAnal.hs | 3 ++ 4 files changed, 76 insertions(+), 74 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 6a70f2c..01a864b 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -980,8 +980,8 @@ data Unfolding | BootUnfolding -- ^ We have no information about the unfolding, because -- this 'Id' came from an @hi-boot@ file. - -- See Note [Inlining and hs-boot files] for what - -- this is used for. + -- See Note [Inlining and hs-boot files] in ToIface + -- for what this is used for. | OtherCon [AltCon] -- ^ It ain't one of these constructors. -- @OtherCon xs@ also indicates that something has been evaluated diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 9e6fa62..4d45efd 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -1769,75 +1769,3 @@ bogusIfaceRule id_name ifRuleBndrs = [], ifRuleHead = id_name, ifRuleArgs = [], ifRuleRhs = IfaceExt id_name, ifRuleOrph = IsOrphan, ifRuleAuto = True } - ---------------------- -{- -Note [Inlining and hs-boot files] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Consider this example (Trac #10083): - - ---------- RSR.hs-boot ------------ - module RSR where - data RSR - eqRSR :: RSR -> RSR -> Bool - - ---------- SR.hs ------------ - module SR where - import {-# SOURCE #-} RSR - data SR = MkSR RSR - eqSR (MkSR r1) (MkSR r2) = eqRSR r1 r2 - - ---------- RSR.hs ------------ - module RSR where - import SR - data RSR = MkRSR SR -- deriving( Eq ) - eqRSR (MkRSR s1) (MkRSR s2) = (eqSR s1 s2) - foo x y = not (eqRSR x y) - -When compiling RSR we get this code - - RSR.eqRSR :: RSR -> RSR -> Bool - RSR.eqRSR = \ (ds1 :: RSR.RSR) (ds2 :: RSR.RSR) -> - case ds1 of _ { RSR.MkRSR s1 -> - case ds2 of _ { RSR.MkRSR s2 -> - SR.eqSR s1 s2 }} - - RSR.foo :: RSR -> RSR -> Bool - RSR.foo = \ (x :: RSR) (y :: RSR) -> not (RSR.eqRSR x y) - -Now, when optimising foo: - Inline eqRSR (small, non-rec) - Inline eqSR (small, non-rec) -but the result of inlining eqSR from SR is another call to eqRSR, so -everything repeats. Neither eqSR nor eqRSR are (apparently) loop -breakers. - -Solution: in the unfolding of eqSR in SR.hi, replace `eqRSR` in SR -with `noinline eqRSR`, so that eqRSR doesn't get inlined. This means -that when GHC inlines `eqSR`, it will not also inline `eqRSR`, exactly -as would have been the case if `foo` had been defined in SR.hs (and -marked as a loop-breaker). - -But how do we arrange for this to happen? There are two ingredients: - - 1. When we serialize out unfoldings to IfaceExprs (toIfaceVar), - for every variable reference we see if we are referring to an - 'Id' that came from an hs-boot file. If so, we add a `noinline` - to the reference. - - 2. But how do we know if a reference came from an hs-boot file - or not? We could record this directly in the 'IdInfo', but - actually we deduce this by looking at the unfolding: 'Id's - that come from boot files are given a special unfolding - (upon typechecking) 'BootUnfolding' which say that there is - no unfolding, and the reason is because the 'Id' came from - a boot file. - -Here is a solution that doesn't work: when compiling RSR, -add a NOINLINE pragma to every function exported by the boot-file -for RSR (if it exists). Doing so makes the bootstrapped GHC itself -slower by 8% overall (on Trac #9872a-d, and T1969: the reason -is that these NOINLINE'd functions now can't be profitably inlined -outside of the hs-boot loop. - --} diff --git a/compiler/iface/ToIface.hs b/compiler/iface/ToIface.hs index 8de3e3e..8e80bb3 100644 --- a/compiler/iface/ToIface.hs +++ b/compiler/iface/ToIface.hs @@ -497,3 +497,74 @@ toIfaceVar v | isExternalName name = IfaceExt name | otherwise = IfaceLcl (getOccFS name) where name = idName v + + +{- Note [Inlining and hs-boot files] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider this example (Trac #10083, #12789): + + ---------- RSR.hs-boot ------------ + module RSR where + data RSR + eqRSR :: RSR -> RSR -> Bool + + ---------- SR.hs ------------ + module SR where + import {-# SOURCE #-} RSR + data SR = MkSR RSR + eqSR (MkSR r1) (MkSR r2) = eqRSR r1 r2 + + ---------- RSR.hs ------------ + module RSR where + import SR + data RSR = MkRSR SR -- deriving( Eq ) + eqRSR (MkRSR s1) (MkRSR s2) = (eqSR s1 s2) + foo x y = not (eqRSR x y) + +When compiling RSR we get this code + + RSR.eqRSR :: RSR -> RSR -> Bool + RSR.eqRSR = \ (ds1 :: RSR.RSR) (ds2 :: RSR.RSR) -> + case ds1 of _ { RSR.MkRSR s1 -> + case ds2 of _ { RSR.MkRSR s2 -> + SR.eqSR s1 s2 }} + + RSR.foo :: RSR -> RSR -> Bool + RSR.foo = \ (x :: RSR) (y :: RSR) -> not (RSR.eqRSR x y) + +Now, when optimising foo: + Inline eqRSR (small, non-rec) + Inline eqSR (small, non-rec) +but the result of inlining eqSR from SR is another call to eqRSR, so +everything repeats. Neither eqSR nor eqRSR are (apparently) loop +breakers. + +Solution: in the unfolding of eqSR in SR.hi, replace `eqRSR` in SR +with `noinline eqRSR`, so that eqRSR doesn't get inlined. This means +that when GHC inlines `eqSR`, it will not also inline `eqRSR`, exactly +as would have been the case if `foo` had been defined in SR.hs (and +marked as a loop-breaker). + +But how do we arrange for this to happen? There are two ingredients: + + 1. When we serialize out unfoldings to IfaceExprs (toIfaceVar), + for every variable reference we see if we are referring to an + 'Id' that came from an hs-boot file. If so, we add a `noinline` + to the reference. + + 2. But how do we know if a reference came from an hs-boot file + or not? We could record this directly in the 'IdInfo', but + actually we deduce this by looking at the unfolding: 'Id's + that come from boot files are given a special unfolding + (upon typechecking) 'BootUnfolding' which say that there is + no unfolding, and the reason is because the 'Id' came from + a boot file. + +Here is a solution that doesn't work: when compiling RSR, +add a NOINLINE pragma to every function exported by the boot-file +for RSR (if it exists). Doing so makes the bootstrapped GHC itself +slower by 8% overall (on Trac #9872a-d, and T1969: the reason +is that these NOINLINE'd functions now can't be profitably inlined +outside of the hs-boot loop. + +-} diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 7e62eee..6950e56 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -276,6 +276,9 @@ Loop breaking is surprisingly subtle. First read the section 4 of We avoid infinite inlinings by choosing loop breakers, and ensuring that a loop breaker cuts each loop. +See also Note [Inlining and hs-boot files] in ToIface, which deals +with a closely related source of infinite loops. + Fundamentally, we do SCC analysis on a graph. For each recursive group we choose a loop breaker, delete all edges to that node, re-analyse the SCC, and iterate. From git at git.haskell.org Tue Nov 29 13:49:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 13:49:33 +0000 (UTC) Subject: [commit: ghc] master: Make note of #12881 in 8.0.2 release notes (abd4a4c) Message-ID: <20161129134933.D2F493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/abd4a4c13e5dbaac8f1c28d8c9d9446e383f6037/ghc >--------------------------------------------------------------- commit abd4a4c13e5dbaac8f1c28d8c9d9446e383f6037 Author: Ryan Scott Date: Tue Nov 29 08:43:46 2016 -0500 Make note of #12881 in 8.0.2 release notes Summary: Resolves #12881. Test Plan: Read it, commit it, merge it, ship it Reviewers: hvr, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2760 GHC Trac Issues: #12881 >--------------------------------------------------------------- abd4a4c13e5dbaac8f1c28d8c9d9446e383f6037 docs/users_guide/8.0.2-notes.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 34cc4b5..b28b923 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -50,6 +50,21 @@ Language type-checked in GHC 8.0.1 are now rejected by GHC 8.0.2. See :ghc-ticket:`12784` for details. +- Some programs which combine default type class method implementations and + overlapping instances may now fail to type-check. Here is an example: :: + + class Foo a where + foo :: a -> [a] + foo _ = [] + + instance Foo a + instance Foo Int + + The problem is that the overlapping ``Foo Int`` instance is not explicitly + marked as overlapping. To fix this, simply add an ``OVERLAPPING`` pragma: :: + + instance {-# OVERLAPPING #-} Foo Int + Compiler ~~~~~~~~ From git at git.haskell.org Tue Nov 29 14:06:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 14:06:17 +0000 (UTC) Subject: [commit: ghc] master: Zonk the free tvs of a RULE lhs to TyVars (f8c8de8) Message-ID: <20161129140617.57EAF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f8c8de8ebf73cd77faa0249d92f280e33a8d2624/ghc >--------------------------------------------------------------- commit f8c8de8ebf73cd77faa0249d92f280e33a8d2624 Author: Simon Peyton Jones Date: Tue Nov 29 14:03:46 2016 +0000 Zonk the free tvs of a RULE lhs to TyVars Previously we were making them into skolem TcTyVars, which is wrong for the output of the type checker, which no TcTyVars should surive. See Note [Zonking the LHS of a RULE] in TcHsSyn This was flushed out by the new IfaceTcTyVar thing; I found some more TcTyVars that were being serialised into an interface file, which is wrong wrong wrong. >--------------------------------------------------------------- f8c8de8ebf73cd77faa0249d92f280e33a8d2624 compiler/deSugar/DsBinds.hs | 2 +- compiler/typecheck/TcHsSyn.hs | 20 ++++++++++++++------ compiler/typecheck/TcMType.hs | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 143d209..4253255 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -895,7 +895,7 @@ Consider After type checking the LHS becomes (foo alpha (C alpha)), where alpha is an unbound meta-tyvar. The zonker in TcHsSyn is careful not to turn the free alpha into Any (as it usually does). Instead it turns it -into a skolem 'a'. See TcHsSyn Note [Zonking the LHS of a RULE]. +into a TyVar 'a'. See TcHsSyn Note [Zonking the LHS of a RULE]. Now we must quantify over that 'a'. It's /really/ inconvenient to do that in the zonker, because the HsExpr data type is very large. But it's /easy/ diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index 5a455ea..ebdc617 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -187,7 +187,9 @@ the environment manipulation is tiresome. -- Confused by zonking? See Note [What is zonking?] in TcMType. type UnboundTyVarZonker = TcTyVar -> TcM Type -- How to zonk an unbound type variable - -- The TcTyVar is (a) a MetaTv (b) Flexi and + -- The TcTyVar is + -- (a) a MetaTv + -- (b) Flexi and -- (c) its kind is alrady zonked -- Note [Zonking the LHS of a RULE] @@ -1617,8 +1619,13 @@ zonkTvSkolemising :: UnboundTyVarZonker -- This variant is used for the LHS of rules -- See Note [Zonking the LHS of a RULE]. zonkTvSkolemising tv - = do { tv' <- skolemiseUnboundMetaTyVar tv - ; return (mkTyVarTy tv') } + = do { let tv' = mkTyVar (tyVarName tv) (tyVarKind tv) + -- NB: the kind of tv is already zonked + ty = mkTyVarTy tv' + -- Make a proper TyVar (remember we + -- are now done with type checking) + ; writeMetaTyVar tv ty + ; return ty } zonkTypeZapping :: UnboundTyVarZonker -- This variant is used for everything except the LHS of rules @@ -1652,9 +1659,10 @@ over it! We do this in two stages. -* During zonking, we skolemise 'alpha' to 'a'. We do this by using - zonkTvSkolemising as the UnboundTyVarZonker in the ZonkEnv. - (This is the whole reason that the ZonkEnv has a UnboundTyVarZonker.) +* During zonking, we skolemise the TcTyVar 'alpha' to TyVar 'a'. We + do this by using zonkTvSkolemising as the UnboundTyVarZonker in the + ZonkEnv. (This is in fact the whole reason that the ZonkEnv has a + UnboundTyVarZonker.) * In DsBinds, we quantify over it. See DsBinds Note [Free tyvars on rule LHS] diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index eae7305..b5104a1 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -68,7 +68,7 @@ module TcMType ( zonkTidyTcType, zonkTidyOrigin, mkTypeErrorThing, mkTypeErrorThingArgs, tidyEvVar, tidyCt, tidySkolemInfo, - skolemiseUnboundMetaTyVar, skolemiseRuntimeUnk, + skolemiseRuntimeUnk, zonkTcTyVar, zonkTcTyVars, zonkTcTyVarToTyVar, zonkTyCoVarsAndFV, zonkTcTypeAndFV, zonkTyCoVarsAndFVList, From git at git.haskell.org Tue Nov 29 15:37:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 15:37:38 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments (e755930) Message-ID: <20161129153738.418683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e755930d7f1e5f2b6161cf61aae267ed3094bfe6/ghc >--------------------------------------------------------------- commit e755930d7f1e5f2b6161cf61aae267ed3094bfe6 Author: Gabor Greif Date: Tue Nov 29 16:18:07 2016 +0100 Typos in comments >--------------------------------------------------------------- e755930d7f1e5f2b6161cf61aae267ed3094bfe6 compiler/coreSyn/CoreLint.hs | 2 +- compiler/deSugar/DsMeta.hs | 4 ++-- compiler/iface/BuildTyCl.hs | 2 +- compiler/iface/TcIface.hs | 2 +- compiler/main/TidyPgm.hs | 2 +- compiler/typecheck/TcHsSyn.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 314bf3e..50c1ac1 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1832,7 +1832,7 @@ lintInScope loc_msg var = ensureEqTys :: OutType -> OutType -> MsgDoc -> LintM () -- check ty2 is subtype of ty1 (ie, has same structure but usage -- annotations need only be consistent, not equal) --- Assumes ty1,ty2 are have alrady had the substitution applied +-- Assumes ty1,ty2 are have already had the substitution applied ensureEqTys ty1 ty2 msg = lintL (ty1 `eqType` ty2) msg lintRole :: Outputable thing diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 6b40a04..556fbf9 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1392,7 +1392,7 @@ repBinds (HsValBinds decs) ; return (ss, core_list) } rep_val_binds :: HsValBinds Name -> DsM [(SrcSpan, Core TH.DecQ)] --- Assumes: all the binders of the binding are alrady in the meta-env +-- Assumes: all the binders of the binding are already in the meta-env rep_val_binds (ValBindsOut binds sigs) = do { core1 <- rep_binds' (unionManyBags (map snd binds)) ; core2 <- rep_sigs' sigs @@ -1408,7 +1408,7 @@ rep_binds' :: LHsBinds Name -> DsM [(SrcSpan, Core TH.DecQ)] rep_binds' = mapM rep_bind . bagToList rep_bind :: LHsBind Name -> DsM (SrcSpan, Core TH.DecQ) --- Assumes: all the binders of the binding are alrady in the meta-env +-- Assumes: all the binders of the binding are already in the meta-env -- Note GHC treats declarations of a variable (not a pattern) -- e.g. x = g 5 as a Fun MonoBinds. This is indicated by a single match diff --git a/compiler/iface/BuildTyCl.hs b/compiler/iface/BuildTyCl.hs index 2617f32..0337abc 100644 --- a/compiler/iface/BuildTyCl.hs +++ b/compiler/iface/BuildTyCl.hs @@ -431,7 +431,7 @@ newImplicitBinder :: Name -- Base name -> TcRnIf m n Name -- Implicit name -- Called in BuildTyCl to allocate the implicit binders of type/class decls -- For source type/class decls, this is the first occurrence --- For iface ones, the LoadIface has alrady allocated a suitable name in the cache +-- For iface ones, the LoadIface has already allocated a suitable name in the cache newImplicitBinder base_name mk_sys_occ = newImplicitBinderLoc base_name mk_sys_occ (nameSrcSpan base_name) diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 1b0fdf8..6baffed 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -743,7 +743,7 @@ tcIfaceDataCons tycon_name tycon tc_tybinders if_cons ifConStricts = if_stricts, ifConSrcStricts = if_src_stricts}) = -- Universally-quantified tyvars are shared with - -- parent TyCon, and are alrady in scope + -- parent TyCon, and are already in scope bindIfaceForAllBndrs ex_bndrs $ \ ex_tv_bndrs -> do { traceIf (text "Start interface-file tc_con_decl" <+> ppr dc_name) diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index e59a389..9f2723c 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -954,7 +954,7 @@ findExternalRules omit_prags binds imp_id_rules unfold_env -- local binder (on LHS or RHS) that we have now discarded. -- (NB: ruleFreeVars only includes LocalIds) -- - -- LHS: we have alrady filtered out rules that mention internal Ids + -- LHS: we have already filtered out rules that mention internal Ids -- on LHS but that isn't enough because we might have by now -- discarded a binding with an external Id. (How? -- chooseExternalIds is a bit conservative.) diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index ebdc617..3926532 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -190,7 +190,7 @@ type UnboundTyVarZonker = TcTyVar -> TcM Type -- The TcTyVar is -- (a) a MetaTv -- (b) Flexi and - -- (c) its kind is alrady zonked + -- (c) its kind is already zonked -- Note [Zonking the LHS of a RULE] -- | A ZonkEnv carries around several bits. diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index da1eeee..96d598e 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -175,7 +175,7 @@ pprSigCtxt ctxt hs_ty tcHsSigWcType :: UserTypeCtxt -> LHsSigWcType Name -> TcM Type -- This one is used when we have a LHsSigWcType, but in -- a place where wildards aren't allowed. The renamer has --- alrady checked this, so we can simply ignore it. +-- already checked this, so we can simply ignore it. tcHsSigWcType ctxt sig_ty = tcHsSigType ctxt (dropWildCards sig_ty) kcHsSigType :: [Located Name] -> LHsSigType Name -> TcM () From git at git.haskell.org Tue Nov 29 19:08:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:08:31 +0000 (UTC) Subject: [commit: ghc] master: Store string as parsed in SourceText for CImport (36e3622) Message-ID: <20161129190831.817EE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36e36227e438d95fae367d10183ea43b4819854f/ghc >--------------------------------------------------------------- commit 36e36227e438d95fae367d10183ea43b4819854f Author: Alan Zimmerman Date: Tue Nov 29 21:06:52 2016 +0200 Store string as parsed in SourceText for CImport >--------------------------------------------------------------- 36e36227e438d95fae367d10183ea43b4819854f compiler/parser/RdrHsSyn.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index 3c1792b..ab5708e 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -1315,7 +1315,7 @@ mkImport cconv safety (L loc (StringLiteral esrc entity), v, ty) = -- name (cf section 8.5.1 in Haskell 2010 report). mkCImport = do let e = unpackFS entity - case parseCImport cconv safety (mkExtName (unLoc v)) e (L loc e) of + case parseCImport cconv safety (mkExtName (unLoc v)) e (L loc esrc) of Nothing -> parseErrorSDoc loc (text "Malformed entity string") Just importSpec -> returnSpec importSpec From git at git.haskell.org Tue Nov 29 19:40:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:09 +0000 (UTC) Subject: [commit: ghc] master: Make diagnostics slightly more colorful (f1fc8cb) Message-ID: <20161129194009.DF3033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f1fc8cbf511c88cb88bf9f46724ee2711f54891a/ghc >--------------------------------------------------------------- commit f1fc8cbf511c88cb88bf9f46724ee2711f54891a Author: Phil Ruffwind Date: Tue Nov 29 13:31:01 2016 -0500 Make diagnostics slightly more colorful This is a preliminary commit to add colors to diagnostics (warning and error messages). The aesthetic changes are: - 'warning', 'error', and 'fatal' are all colored magenta, red, and red respectively. - The warning annotation [-Wsomething] shares the same color. - Warnings and errors are also bolded (this is consistent with what other compilers do). A new flag has been added to control the behavior: -fdiagnostics-color=(always|auto|never) This flag is 'auto' by default. However, auto-detection is not implemented yet, so it effectively it defaults to off. Test Plan: validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2716 GHC Trac Issues: #8809 >--------------------------------------------------------------- f1fc8cbf511c88cb88bf9f46724ee2711f54891a compiler/main/DynFlags.hs | 27 +++++++++++- compiler/main/DynFlags.hs-boot | 6 ++- compiler/main/ErrUtils.hs | 22 ++++++---- compiler/utils/Outputable.hs | 66 +++++++++++++++++++++++------- docs/users_guide/using.rst | 9 ++++ utils/mkUserGuidePart/Options/Verbosity.hs | 4 ++ 6 files changed, 111 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 f1fc8cbf511c88cb88bf9f46724ee2711f54891a From git at git.haskell.org Tue Nov 29 19:40:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:12 +0000 (UTC) Subject: [commit: ghc] master: Minor cleanup of foldRegs{Used,Defd} (da5a61e) Message-ID: <20161129194012.8D5A53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da5a61eb15237d406e4d1fb4390d47602ee4c34c/ghc >--------------------------------------------------------------- commit da5a61eb15237d406e4d1fb4390d47602ee4c34c Author: Michal Terepeta Date: Tue Nov 29 13:31:28 2016 -0500 Minor cleanup of foldRegs{Used,Defd} This makes the two functions strict in the accumulator - it seems that there are only two users of those functions: `CmmLive` and `CmmSink` and in both cases the strict fold fits better. The commit also removes a few unused functions (`filterRegsUsed`), instances (for `Maybe` and `RegSet`) and gets rid of unnecessary inculde of `HsVersions.h`. The performance effect of avoiding unnecessary thunks is mostly negligible, although we do allocate a tiny bit less (nofib's section on compile allocations): ``` -1 s.d. ----- -0.2% +1 s.d. ----- -0.1% Average ----- -0.2% ``` Signed-off-by: Michal Terepeta Test Plan: validate Reviewers: simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2723 >--------------------------------------------------------------- da5a61eb15237d406e4d1fb4390d47602ee4c34c compiler/cmm/CmmExpr.hs | 33 ++++++++------------------------- compiler/cmm/CmmNode.hs | 33 +++++++++++++++------------------ 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/compiler/cmm/CmmExpr.hs b/compiler/cmm/CmmExpr.hs index 985db0e..bb610a0 100644 --- a/compiler/cmm/CmmExpr.hs +++ b/compiler/cmm/CmmExpr.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -13,7 +14,7 @@ module CmmExpr , VGcPtr(..) , DefinerOfRegs, UserOfRegs - , foldRegsDefd, foldRegsUsed, filterRegsUsed + , foldRegsDefd, foldRegsUsed , foldLocalRegsDefd, foldLocalRegsUsed , RegSet, LocalRegSet, GlobalRegSet @@ -27,8 +28,6 @@ module CmmExpr ) where -#include "HsVersions.h" - import BlockId import CLabel import CmmMachOp @@ -38,6 +37,7 @@ import Outputable (panic) import Unique import Data.Set (Set) +import Data.List import qualified Data.Set as Set ----------------------------------------------------------------------------- @@ -318,12 +318,6 @@ foldLocalRegsDefd :: DefinerOfRegs LocalReg a => DynFlags -> (b -> LocalReg -> b) -> b -> a -> b foldLocalRegsDefd = foldRegsDefd -filterRegsUsed :: UserOfRegs r e => DynFlags -> (r -> Bool) -> e -> RegSet r -filterRegsUsed dflags p e = - foldRegsUsed dflags - (\regs r -> if p r then extendRegSet regs r else regs) - emptyRegSet e - instance UserOfRegs LocalReg CmmReg where foldRegsUsed _ f z (CmmLocal reg) = f z reg foldRegsUsed _ _ z (CmmGlobal _) = z @@ -346,13 +340,10 @@ instance Ord r => UserOfRegs r r where instance Ord r => DefinerOfRegs r r where foldRegsDefd _ f z r = f z r -instance Ord r => UserOfRegs r (RegSet r) where - foldRegsUsed _ f = Set.fold (flip f) - instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r CmmExpr where -- The (Ord r) in the context is necessary here -- See Note [Recursive superclasses] in TcInstDcls - foldRegsUsed dflags f z e = expr z e + foldRegsUsed dflags f !z e = expr z e where expr z (CmmLit _) = z expr z (CmmLoad addr _) = foldRegsUsed dflags f z addr expr z (CmmReg r) = foldRegsUsed dflags f z r @@ -360,21 +351,13 @@ instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r CmmExpr where expr z (CmmRegOff r _) = foldRegsUsed dflags f z r expr z (CmmStackSlot _ _) = z -instance UserOfRegs r a => UserOfRegs r (Maybe a) where - foldRegsUsed dflags f z (Just x) = foldRegsUsed dflags f z x - foldRegsUsed _ _ z Nothing = z - instance UserOfRegs r a => UserOfRegs r [a] where - foldRegsUsed _ _ set [] = set - foldRegsUsed dflags f set (x:xs) = foldRegsUsed dflags f (foldRegsUsed dflags f set x) xs + foldRegsUsed dflags f set as = foldl' (foldRegsUsed dflags f) set as + {-# INLINABLE foldRegsUsed #-} instance DefinerOfRegs r a => DefinerOfRegs r [a] where - foldRegsDefd _ _ set [] = set - foldRegsDefd dflags f set (x:xs) = foldRegsDefd dflags f (foldRegsDefd dflags f set x) xs - -instance DefinerOfRegs r a => DefinerOfRegs r (Maybe a) where - foldRegsDefd _ _ set Nothing = set - foldRegsDefd dflags f set (Just x) = foldRegsDefd dflags f set x + foldRegsDefd dflags f set as = foldl' (foldRegsDefd dflags f) set as + {-# INLINABLE foldRegsDefd #-} ----------------------------------------------------------------------------- -- Global STG registers diff --git a/compiler/cmm/CmmNode.hs b/compiler/cmm/CmmNode.hs index bba9bd7..1103fdb 100644 --- a/compiler/cmm/CmmNode.hs +++ b/compiler/cmm/CmmNode.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE FlexibleContexts #-} @@ -308,7 +309,7 @@ foreignTargetHints target -- Instances of register and slot users / definers instance UserOfRegs LocalReg (CmmNode e x) where - foldRegsUsed dflags f z n = case n of + foldRegsUsed dflags f !z n = case n of CmmAssign _ expr -> fold f z expr CmmStore addr rval -> fold f (fold f z addr) rval CmmUnsafeForeignCall t _ args -> fold f (fold f z t) args @@ -317,13 +318,12 @@ instance UserOfRegs LocalReg (CmmNode e x) where CmmCall {cml_target=tgt} -> fold f z tgt CmmForeignCall {tgt=tgt, args=args} -> fold f (fold f z tgt) args _ -> z - where fold :: forall a b. - UserOfRegs LocalReg a => - (b -> LocalReg -> b) -> b -> a -> b + where fold :: forall a b. UserOfRegs LocalReg a + => (b -> LocalReg -> b) -> b -> a -> b fold f z n = foldRegsUsed dflags f z n instance UserOfRegs GlobalReg (CmmNode e x) where - foldRegsUsed dflags f z n = case n of + foldRegsUsed dflags f !z n = case n of CmmAssign _ expr -> fold f z expr CmmStore addr rval -> fold f (fold f z addr) rval CmmUnsafeForeignCall t _ args -> fold f (fold f z t) args @@ -332,39 +332,36 @@ instance UserOfRegs GlobalReg (CmmNode e x) where CmmCall {cml_target=tgt, cml_args_regs=args} -> fold f (fold f z args) tgt CmmForeignCall {tgt=tgt, args=args} -> fold f (fold f z tgt) args _ -> z - where fold :: forall a b. - UserOfRegs GlobalReg a => - (b -> GlobalReg -> b) -> b -> a -> b + where fold :: forall a b. UserOfRegs GlobalReg a + => (b -> GlobalReg -> b) -> b -> a -> b fold f z n = foldRegsUsed dflags f z n instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r ForeignTarget where -- The (Ord r) in the context is necessary here -- See Note [Recursive superclasses] in TcInstDcls - foldRegsUsed _ _ z (PrimTarget _) = z - foldRegsUsed dflags f z (ForeignTarget e _) = foldRegsUsed dflags f z e + foldRegsUsed _ _ !z (PrimTarget _) = z + foldRegsUsed dflags f !z (ForeignTarget e _) = foldRegsUsed dflags f z e instance DefinerOfRegs LocalReg (CmmNode e x) where - foldRegsDefd dflags f z n = case n of + foldRegsDefd dflags f !z n = case n of CmmAssign lhs _ -> fold f z lhs CmmUnsafeForeignCall _ fs _ -> fold f z fs CmmForeignCall {res=res} -> fold f z res _ -> z - where fold :: forall a b. - DefinerOfRegs LocalReg a => - (b -> LocalReg -> b) -> b -> a -> b + where fold :: forall a b. DefinerOfRegs LocalReg a + => (b -> LocalReg -> b) -> b -> a -> b fold f z n = foldRegsDefd dflags f z n instance DefinerOfRegs GlobalReg (CmmNode e x) where - foldRegsDefd dflags f z n = case n of + foldRegsDefd dflags f !z n = case n of CmmAssign lhs _ -> fold f z lhs CmmUnsafeForeignCall tgt _ _ -> fold f z (foreignTargetRegs tgt) CmmCall {} -> fold f z activeRegs CmmForeignCall {} -> fold f z activeRegs -- See Note [Safe foreign calls clobber STG registers] _ -> z - where fold :: forall a b. - DefinerOfRegs GlobalReg a => - (b -> GlobalReg -> b) -> b -> a -> b + where fold :: forall a b. DefinerOfRegs GlobalReg a + => (b -> GlobalReg -> b) -> b -> a -> b fold f z n = foldRegsDefd dflags f z n platform = targetPlatform dflags From git at git.haskell.org Tue Nov 29 19:40:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:15 +0000 (UTC) Subject: [commit: ghc] master: Replace -fshow-source-paths with -fhide-source-paths (3ec8563) Message-ID: <20161129194015.4B7423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3ec856308cbfb89299daba56337eda866ac88d6e/ghc >--------------------------------------------------------------- commit 3ec856308cbfb89299daba56337eda866ac88d6e Author: Sylvain Henry Date: Tue Nov 29 13:39:28 2016 -0500 Replace -fshow-source-paths with -fhide-source-paths This patch reverts the change introduced with 587dcccfdfa7a319e27300a4f3885071060b1f8e and restores the previous default output of GHC (i.e., show source path and object path for each compiled module). The -fhide-source-paths flag can be used to hide these paths and reduce the line noise. Reviewers: gracjan, nomeata, austin, bgamari, simonmar, hvr Reviewed By: hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2728 GHC Trac Issues: #12851 >--------------------------------------------------------------- 3ec856308cbfb89299daba56337eda866ac88d6e compiler/main/DynFlags.hs | 4 +- compiler/main/HscTypes.hs | 28 +++++++------- docs/users_guide/using.rst | 5 +++ testsuite/tests/backpack/reexport/bkpreex01.stderr | 8 ++-- testsuite/tests/backpack/reexport/bkpreex02.stderr | 26 ++++++------- testsuite/tests/backpack/reexport/bkpreex03.stderr | 8 ++-- testsuite/tests/backpack/reexport/bkpreex04.stderr | 6 +-- testsuite/tests/backpack/reexport/bkpreex06.stderr | 10 ++--- .../tests/backpack/should_compile/bkp01.stderr | 14 +++---- .../tests/backpack/should_compile/bkp02.stderr | 12 +++--- .../tests/backpack/should_compile/bkp07.stderr | 6 +-- .../tests/backpack/should_compile/bkp08.stderr | 8 ++-- .../tests/backpack/should_compile/bkp09.stderr | 18 ++++----- .../tests/backpack/should_compile/bkp10.stderr | 8 ++-- .../tests/backpack/should_compile/bkp11.stderr | 10 ++--- .../tests/backpack/should_compile/bkp12.stderr | 14 +++---- .../tests/backpack/should_compile/bkp14.stderr | 14 +++---- .../tests/backpack/should_compile/bkp15.stderr | 18 ++++----- .../tests/backpack/should_compile/bkp16.stderr | 4 +- .../tests/backpack/should_compile/bkp17.stderr | 6 +-- .../tests/backpack/should_compile/bkp18.stderr | 12 +++--- .../tests/backpack/should_compile/bkp19.stderr | 12 +++--- .../tests/backpack/should_compile/bkp20.stderr | 18 ++++----- .../tests/backpack/should_compile/bkp21.stderr | 10 ++--- .../tests/backpack/should_compile/bkp23.stderr | 36 +++++++++--------- .../tests/backpack/should_compile/bkp24.stderr | 26 ++++++------- .../tests/backpack/should_compile/bkp25.stderr | 14 +++---- .../tests/backpack/should_compile/bkp26.stderr | 12 +++--- .../tests/backpack/should_compile/bkp27.stderr | 12 +++--- .../tests/backpack/should_compile/bkp28.stderr | 8 ++-- .../tests/backpack/should_compile/bkp29.stderr | 8 ++-- .../tests/backpack/should_compile/bkp30.stderr | 8 ++-- .../tests/backpack/should_compile/bkp31.stderr | 12 +++--- .../tests/backpack/should_compile/bkp32.stderr | 44 +++++++++++----------- .../tests/backpack/should_compile/bkp33.stderr | 12 +++--- .../tests/backpack/should_compile/bkp34.stderr | 8 ++-- .../tests/backpack/should_compile/bkp35.stderr | 8 ++-- .../tests/backpack/should_compile/bkp36.stderr | 10 ++--- .../tests/backpack/should_compile/bkp37.stderr | 6 +-- .../tests/backpack/should_compile/bkp38.stderr | 6 +-- .../tests/backpack/should_compile/bkp39.stderr | 10 ++--- .../tests/backpack/should_compile/bkp40.stderr | 16 ++++---- .../tests/backpack/should_fail/bkpfail01.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail03.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail04.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail05.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail06.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail07.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail09.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail10.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail11.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail12.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail13.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail14.stderr | 12 +++--- .../tests/backpack/should_fail/bkpfail15.stderr | 10 ++--- .../tests/backpack/should_fail/bkpfail16.stderr | 4 +- .../tests/backpack/should_fail/bkpfail17.stderr | 4 +- .../tests/backpack/should_fail/bkpfail18.stderr | 2 +- .../tests/backpack/should_fail/bkpfail19.stderr | 4 +- .../tests/backpack/should_fail/bkpfail20.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail21.stderr | 14 +++---- .../tests/backpack/should_fail/bkpfail22.stderr | 12 +++--- .../tests/backpack/should_fail/bkpfail23.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail24.stderr | 6 +-- .../tests/backpack/should_fail/bkpfail25.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail26.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail27.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail28.stderr | 8 ++-- .../tests/backpack/should_fail/bkpfail29.stderr | 6 +-- testsuite/tests/cabal/cabal08/cabal08.stdout | 4 +- testsuite/tests/deriving/should_fail/T9071.stderr | 4 +- .../tests/determinism/determ002/determ002.stdout | 4 +- .../tests/determinism/determ003/determ003.stdout | 4 +- .../tests/determinism/determ005/determ005.stdout | 4 +- .../tests/determinism/determ006/determ006.stdout | 4 +- .../tests/determinism/determ007/determ007.stdout | 4 +- .../tests/determinism/determ008/determ008.stdout | 4 +- .../tests/determinism/determ009/determ009.stdout | 4 +- .../tests/determinism/determ010/determ010.stdout | 4 +- .../tests/determinism/determ011/determ011.stdout | 4 +- .../tests/determinism/determ012/determ012.stdout | 4 +- .../tests/determinism/determ013/determ013.stdout | 4 +- .../tests/determinism/determ014/determ014.stdout | 4 +- .../tests/determinism/determ015/determ015.stdout | 4 +- .../tests/determinism/determ016/determ016.stdout | 4 +- .../tests/determinism/determ017/determ017.stdout | 4 +- .../tests/determinism/determ018/determ018.stdout | 4 +- .../tests/determinism/determ019/determ019.stdout | 4 +- .../tests/determinism/determ021/determ021.stdout | 4 +- testsuite/tests/driver/T437/T437.stdout | 8 ++-- testsuite/tests/driver/T8526/T8526.stdout | 4 +- testsuite/tests/driver/recomp002/recomp002.stdout | 6 +-- testsuite/tests/driver/recomp005/recomp005.stdout | 16 ++++---- testsuite/tests/driver/recomp006/recomp006.stdout | 4 +- testsuite/tests/driver/recomp007/recomp007.stdout | 4 +- testsuite/tests/driver/recomp011/recomp011.stdout | 6 +-- testsuite/tests/driver/recomp013/recomp013.stdout | 10 ++--- testsuite/tests/driver/recomp015/recomp015.stdout | 4 +- testsuite/tests/driver/recomp016/recomp016.stdout | 20 +++++----- testsuite/tests/driver/retc001/retc001.stdout | 10 ++--- testsuite/tests/driver/retc002/retc002.stdout | 6 +-- testsuite/tests/driver/write_interface_make.stdout | 2 +- testsuite/tests/generics/T5462No1.stderr | 4 +- testsuite/tests/ghc-api/T10052/T10052.stdout | 2 +- testsuite/tests/ghc-api/T7478/T7478.stdout | 8 ++-- testsuite/tests/ghci/prog009/ghci.prog009.stdout | 2 +- testsuite/tests/ghci/scripts/T1914.stdout | 8 ++-- testsuite/tests/ghci/scripts/T6105.stdout | 4 +- .../haddock/haddock_examples/haddock.Test.stderr | 6 +-- .../indexed-types/should_compile/impexp.stderr | 4 +- .../tests/indexed-types/should_fail/T9580.stderr | 4 +- testsuite/tests/module/T11970A.stderr | 4 +- testsuite/tests/module/base01/base01.stdout | 2 +- .../should_fail/T11167_ambiguous_fixity.stderr | 6 +-- .../should_fail/overloadedrecfldsfail04.stderr | 4 +- .../should_fail/overloadedrecfldsfail06.stderr | 4 +- .../should_fail/overloadedrecfldsfail10.stderr | 8 ++-- .../should_fail/overloadedrecfldsfail11.stderr | 4 +- .../should_fail/overloadedrecfldsfail12.stderr | 4 +- testsuite/tests/parser/should_compile/T5243.stderr | 4 +- .../partial-sigs/should_compile/SplicesUsed.stderr | 4 +- ...ExtraConstraintsWildcardInTypeSpliceUsed.stderr | 2 +- testsuite/tests/plugins/Makefile | 2 +- testsuite/tests/plugins/T12567a.stderr | 8 ++-- testsuite/tests/plugins/frontend01.stdout | 2 +- .../tests/rename/should_compile/T11624.stderr | 6 +-- testsuite/tests/rts/T9405.stdout | 2 +- testsuite/tests/rts/linker_unload.stdout | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check02.stderr | 2 +- testsuite/tests/safeHaskell/check/Check03.stderr | 2 +- testsuite/tests/safeHaskell/check/Check04.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 4 +- testsuite/tests/safeHaskell/check/Check07.stderr | 6 +-- testsuite/tests/safeHaskell/check/Check08.stderr | 6 +-- testsuite/tests/safeHaskell/check/CheckB.stderr | 4 +- .../tests/safeHaskell/check/pkg01/ImpSafe03.stderr | 2 +- .../safeHaskell/overlapping/SH_Overlap1.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap10.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap11.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap2.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap3.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap4.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap5.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap6.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap7.stderr | 6 +-- .../safeHaskell/overlapping/SH_Overlap8.stderr | 4 +- .../safeHaskell/overlapping/SH_Overlap9.stderr | 6 +-- .../safeHaskell/safeInfered/SafeInfered01.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered02.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered03.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered04.stderr | 4 +- .../safeHaskell/safeInfered/SafeInfered05.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered01.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered02.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered03.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered05.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered06.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered08.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered09.stderr | 6 +-- .../safeHaskell/safeInfered/UnsafeInfered10.stderr | 4 +- .../safeHaskell/safeInfered/UnsafeInfered11.stderr | 4 +- .../safeHaskell/safeLanguage/SafeLang10.stderr | 6 +-- .../safeHaskell/safeLanguage/SafeLang12.stderr | 4 +- .../safeHaskell/safeLanguage/SafeLang17.stderr | 6 +-- .../tests/typecheck/should_compile/T6018.stderr | 6 +-- .../tests/typecheck/should_compile/tc245.stdout | 6 +-- .../tests/typecheck/should_fail/T12042.stderr | 6 +-- .../tests/typecheck/should_fail/T6018fail.stderr | 10 ++--- testsuite/tests/unboxedsums/module/sum_mod.stdout | 2 +- .../tests/warnings/should_compile/DeprU.stderr | 4 +- .../tests/warnings/should_compile/T9178.stderr | 4 +- utils/mkUserGuidePart/Options/Verbosity.hs | 4 +- 173 files changed, 623 insertions(+), 618 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 3ec856308cbfb89299daba56337eda866ac88d6e From git at git.haskell.org Tue Nov 29 19:40:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:17 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Mention CLEANUP option in README (2d99da0) Message-ID: <20161129194017.F1F643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d99da0b230128440e12df9556dc15789be36ef8/ghc >--------------------------------------------------------------- commit 2d99da0b230128440e12df9556dc15789be36ef8 Author: Ben Gamari Date: Tue Nov 29 13:38:37 2016 -0500 testsuite: Mention CLEANUP option in README Test Plan: Read it Reviewers: austin Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2747 >--------------------------------------------------------------- 2d99da0b230128440e12df9556dc15789be36ef8 testsuite/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/README.md b/testsuite/README.md index 8fc3efd..31193d6 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -12,6 +12,8 @@ Commands to run testsuite: * Reduced (fast) testsuite: `make fast` * Run a specific test: `make TEST=tc054` * Test a specific 'way': `make WAY=optllvm` + * Keeping the run directory after test run: `make CLEANUP=0`. You will find a + directory `{test_name}.run` in the test's source directory. * Test a specifc stage of GHC: `make stage=1` * Skip performance tests: `make SKIP_PERF_TESTS=YES` * Set verbosity: `make VERBOSE=n` From git at git.haskell.org Tue Nov 29 19:40:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:20 +0000 (UTC) Subject: [commit: ghc] master: Define thread primitives if they're supported. (1732d7a) Message-ID: <20161129194020.A25883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1732d7ac43ca578deca39ea5a63cbf34f3cd9dd5/ghc >--------------------------------------------------------------- commit 1732d7ac43ca578deca39ea5a63cbf34f3cd9dd5 Author: Shea Levy Date: Tue Nov 29 13:28:27 2016 -0500 Define thread primitives if they're supported. On iOS, we use the pthread-based implementation of Itimer.c even for a non-threaded RTS. Since 999c464, this relies on synchronization primitives like Mutex, so ensure those primitives are defined whenever they are supported, even if !THREADED_RTS. Fixes #12799. Reviewers: erikd, austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2712 GHC Trac Issues: #12799 >--------------------------------------------------------------- 1732d7ac43ca578deca39ea5a63cbf34f3cd9dd5 includes/rts/OSThreads.h | 46 +++++++++++++++++++++++++--------------------- rts/posix/OSThreads.c | 37 +++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h index 2eb5897..efd2406 100644 --- a/includes/rts/OSThreads.h +++ b/includes/rts/OSThreads.h @@ -15,15 +15,13 @@ #ifndef RTS_OSTHREADS_H #define RTS_OSTHREADS_H -#if defined(THREADED_RTS) /* to near the end */ - #if defined(HAVE_PTHREAD_H) && !defined(mingw32_HOST_OS) #if CMINUSMINUS -#define ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex) -#define RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex) -#define ASSERT_LOCK_HELD(mutex) /* nothing */ +#define OS_ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex) +#define OS_RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex) +#define OS_ASSERT_LOCK_HELD(mutex) /* nothing */ #else @@ -47,7 +45,7 @@ typedef pthread_key_t ThreadLocalKey; #endif /* Always check the result of lock and unlock. */ -#define ACQUIRE_LOCK(mutex) \ +#define OS_ACQUIRE_LOCK(mutex) \ LOCK_DEBUG_BELCH("ACQUIRE_LOCK", mutex); \ if (pthread_mutex_lock(mutex) == EDEADLK) { \ barf("multiple ACQUIRE_LOCK: %s %d", __FILE__,__LINE__); \ @@ -61,7 +59,7 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex) return pthread_mutex_trylock(mutex); } -#define RELEASE_LOCK(mutex) \ +#define OS_RELEASE_LOCK(mutex) \ LOCK_DEBUG_BELCH("RELEASE_LOCK", mutex); \ if (pthread_mutex_unlock(mutex) != 0) { \ barf("RELEASE_LOCK: I do not own this lock: %s %d", __FILE__,__LINE__); \ @@ -72,7 +70,7 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex) // have been created with PTHREAD_MUTEX_ERRORCHECK, otherwise this // assertion will hang. We always initialise mutexes with // PTHREAD_MUTEX_ERRORCHECK when DEBUG is on (see rts/posix/OSThreads.h). -#define ASSERT_LOCK_HELD(mutex) ASSERT(pthread_mutex_lock(mutex) == EDEADLK) +#define OS_ASSERT_LOCK_HELD(mutex) ASSERT(pthread_mutex_lock(mutex) == EDEADLK) #endif // CMINUSMINUS @@ -83,9 +81,9 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex) /* We jump through a hoop here to get a CCall EnterCriticalSection and LeaveCriticalSection, as that's what C-- wants. */ -#define ACQUIRE_LOCK(mutex) foreign "stdcall" EnterCriticalSection(mutex) -#define RELEASE_LOCK(mutex) foreign "stdcall" LeaveCriticalSection(mutex) -#define ASSERT_LOCK_HELD(mutex) /* nothing */ +#define OS_ACQUIRE_LOCK(mutex) foreign "stdcall" EnterCriticalSection(mutex) +#define OS_RELEASE_LOCK(mutex) foreign "stdcall" LeaveCriticalSection(mutex) +#define OS_ASSERT_LOCK_HELD(mutex) /* nothing */ #else @@ -115,23 +113,23 @@ typedef CRITICAL_SECTION Mutex; #ifdef LOCK_DEBUG -#define ACQUIRE_LOCK(mutex) \ +#define OS_ACQUIRE_LOCK(mutex) \ debugBelch("ACQUIRE_LOCK(0x%p) %s %d\n", mutex,__FILE__,__LINE__); \ EnterCriticalSection(mutex) -#define RELEASE_LOCK(mutex) \ +#define OS_RELEASE_LOCK(mutex) \ debugBelch("RELEASE_LOCK(0x%p) %s %d\n", mutex,__FILE__,__LINE__); \ LeaveCriticalSection(mutex) -#define ASSERT_LOCK_HELD(mutex) /* nothing */ +#define OS_ASSERT_LOCK_HELD(mutex) /* nothing */ #else -#define ACQUIRE_LOCK(mutex) EnterCriticalSection(mutex) +#define OS_ACQUIRE_LOCK(mutex) EnterCriticalSection(mutex) #define TRY_ACQUIRE_LOCK(mutex) (TryEnterCriticalSection(mutex) == 0) -#define RELEASE_LOCK(mutex) LeaveCriticalSection(mutex) +#define OS_RELEASE_LOCK(mutex) LeaveCriticalSection(mutex) // I don't know how to do this. TryEnterCriticalSection() doesn't do // the right thing. -#define ASSERT_LOCK_HELD(mutex) /* nothing */ +#define OS_ASSERT_LOCK_HELD(mutex) /* nothing */ #endif @@ -141,22 +139,22 @@ typedef HANDLE Mutex; // casting to (Mutex *) here required due to use in .cmm files where // the argument has (void *) type. -#define ACQUIRE_LOCK(mutex) \ +#define OS_ACQUIRE_LOCK(mutex) \ if (WaitForSingleObject(*((Mutex *)mutex),INFINITE) == WAIT_FAILED) { \ barf("WaitForSingleObject: %d", GetLastError()); \ } -#define RELEASE_LOCK(mutex) \ +#define OS_RELEASE_LOCK(mutex) \ if (ReleaseMutex(*((Mutex *)mutex)) == 0) { \ barf("ReleaseMutex: %d", GetLastError()); \ } -#define ASSERT_LOCK_HELD(mutex) /* nothing */ +#define OS_ASSERT_LOCK_HELD(mutex) /* nothing */ #endif #endif // CMINUSMINUS -# else +# elif defined(THREADED_RTS) # error "Threads not supported" # endif @@ -205,6 +203,12 @@ void setThreadNode (uint32_t node); void releaseThreadNode (void); #endif // !CMINUSMINUS +#ifdef THREADED_RTS + +#define ACQUIRE_LOCK(l) OS_ACQUIRE_LOCK(l) +#define RELEASE_LOCK(l) OS_RELEASE_LOCK(l) +#define ASSERT_LOCK_HELD(l) OS_ASSERT_LOCK_HELD(l) + #else #define ACQUIRE_LOCK(l) diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 63e9790..a52fbe5 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -35,7 +35,6 @@ #endif #endif -#if defined(THREADED_RTS) #include "RtsUtils.h" #include "Task.h" @@ -215,6 +214,8 @@ freeThreadLocalKey (ThreadLocalKey *key) } } +#if defined(THREADED_RTS) + static void * forkOS_createThreadWrapper ( void * entry ) { @@ -266,6 +267,23 @@ getNumberOfProcessors (void) return nproc; } +#else /* !defined(THREADED_RTS) */ + +int +forkOS_createThread ( HsStablePtr entry STG_UNUSED ) +{ + return -1; +} + +void freeThreadingResources (void) { /* nothing */ } + +uint32_t getNumberOfProcessors (void) +{ + return 1; +} + +#endif /* defined(THREADED_RTS) */ + #if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETAFFINITY) // Schedules the thread to run on CPU n of m. m may be less than the // number of physical CPUs, in which case, the thread will be allowed @@ -353,23 +371,6 @@ interruptOSThread (OSThreadId id) pthread_kill(id, SIGPIPE); } -#else /* !defined(THREADED_RTS) */ - -int -forkOS_createThread ( HsStablePtr entry STG_UNUSED ) -{ - return -1; -} - -void freeThreadingResources (void) { /* nothing */ } - -uint32_t getNumberOfProcessors (void) -{ - return 1; -} - -#endif /* defined(THREADED_RTS) */ - KernelThreadId kernelThreadId (void) { #if defined(linux_HOST_OS) From git at git.haskell.org Tue Nov 29 19:40:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:23 +0000 (UTC) Subject: [commit: ghc] master: users_guide: Bring 8.0.2 release notes up-to-date with ghc-8.0 branch (30cecae) Message-ID: <20161129194023.6321B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/30cecaec4701b32ab9fd6399193c5d2740b63b11/ghc >--------------------------------------------------------------- commit 30cecaec4701b32ab9fd6399193c5d2740b63b11 Author: Ben Gamari Date: Tue Nov 29 13:29:54 2016 -0500 users_guide: Bring 8.0.2 release notes up-to-date with ghc-8.0 branch I've been editing the release notes on the `ghc-8.0` branch; fold those changes into `master`. >--------------------------------------------------------------- 30cecaec4701b32ab9fd6399193c5d2740b63b11 docs/users_guide/8.0.2-notes.rst | 132 ++++++++++++++++++++++++--------------- 1 file changed, 83 insertions(+), 49 deletions(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index b28b923..063d947 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -3,12 +3,42 @@ Release notes for version 8.0.2 =============================== -TODO FIXME +The significant changes to the various parts of the compiler are listed in the +following sections. There have also been numerous bug fixes and performance +improvements over the 8.0.1 release. + +.. warning:: + + Only Cabal versions 1.24 and newer will function properly with this release. + (see :ghc-ticket:`11558`). Consequently it will likely be necessary to + recompile ``cabal-install`` before installing new packages. + + The reason for this is a change in how packages are identified in GHC + 8.0. While previous versions of Cabal identified packages to GHC with a + package key (with GHC's :ghc-flag:`-this-package-key` argument), GHC 8.0 and + later uses installed package IDs in place of package keys. + +.. note:: + + Users compiling GHC on Mac OS X with XCode 7.3 will need to tell the build + system to use the ``nm-classic`` command instead of Apple's new ``nm`` + implementation as the latter breaks POSIX compliance (see + :ghc-ticket:`11744`). This can be done by passing something like + ``--with-nm=$(xcrun --find nm-classic)`` to ``configure``. Highlights ---------- -TODO FIXME. +The highlights, since the 8.0.1 release, are: + +- Compatibility fixes with macOS Sierra and recent Linux distributions. + +- Many, many bug fixes. + +- A bug has been fixed that caused standalone derived ``Ix`` instances to fail + for GADTs with exactly one constructor (:ghc-ticket:`12583`). + +- Interface files produced by GHC should now be deterministic. Full details ------------ @@ -16,15 +46,6 @@ Full details Language ~~~~~~~~ -- TODO FIXME. - -- :ghc-flag:`-XStaticPointers` now allows the body of the ``static`` form to - refer to closed local bindings. For instance, this is now permitted: - ``f = static x where x = 'a'``. - -- A bug has been fixed that caused standalone derived ``Ix`` instances to fail - for GADTs with exactly one constructor (:ghc-ticket:`12583`). - - A bug has been fixed that caused derived ``Show`` instances to fail in the presence of :ghc-flag:`-XRebindableSyntax` and :ghc-flag:`-XOverloadedStrings` (:ghc-ticket:`12688`). @@ -68,17 +89,31 @@ Language Compiler ~~~~~~~~ +- A compiler bug present in 8.0.1 resulting in undefined reference errors while + compiling some packages has been fixed. (see :ghc-ticket:`12076`). + +- A code generator bug which resulted in segmentation faults in compiled + programs has been fixed (see :ghc-ticket:`12757`). + +- GHC now supports systems whose C compiler which produce position-independent + executables by default. (see :ghc-ticket:`12579`). + +- GHC can now be built on systems which use the ``gold`` linker by default + (see :ghc-ticket:`12816`). + +- GHC now reliably runs on macOS Sierra systems. Sierra introduced a linker + limitation which GHC occassionally surpassed when compiling programs with + many package dependencies. (see :ghc-ticket:`12479`). + - The :ghc-flag:`-Wredundant-constraints` flag has been removed from the :ghc-flag:`-Wall` flag set (see :ghc-ticket:`10635`). -- The :ghc-flag:`-ddump-cmm` now dumps the result after C-- pipeline pass. Two - more flags were added: :ghc-flag:`-ddump-cmm-from-stg` to allow to get the - initial cmm from STG-to-C-- code generation and :ghc-flag:`-ddump-cmm-verbose` - to obtain the intermediates from all C-- pipeline stages. +- Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts variable + out of scope variables errors into warnings. -- The RTS :ghc-flag: `-xb` now reads the base heap address in any base, - defaulting to decimal, hexadecimal if the address starts with `0x`, and - octal if the address starts with `0`. +- The RTS :ghc-flag:`-xb` now reads the base heap address in any base, + defaulting to decimal, hexadecimal if the address starts with ``0x``, and + octal if the address starts with ``0``. - Due to an oversight in GHC 8.0.1, the value of the preprocessor macro ``__GLASGOW_HASKELL_LLVM__``, which exposes the LLVM version used by GHC, was @@ -86,6 +121,16 @@ Compiler formatting is changed to be in line with ``__GLASGOW_HASKELL__`` (:ghc-ticket:`12628`). +- Parallel programs should be significantly more reliable on platforms with weak + memory consistency guarantees (:ghc-ticket:`12469`) + +- Interface files should now be bit-wise identical for a given build. + (:ghc-ticket:`4012`) + +- Nearly two-hundred more bugs. See `Trac + `_ + for a complete list. + Runtime system ~~~~~~~~~~~~~~ @@ -96,14 +141,25 @@ Runtime system `MSDN `_ . This should now introduce the same behavior both compiled and interpreted. (see :ghc-ticket:`12497`). -- Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts variable - out of scope variables errors into warnings. +- Profiles from the cost-center profiler now provide source span information. + (see :ghc-ticket:`11543`). + +- The number of threads used for garbage collection is now configurable + independently from the number of capabilities with the new :ghc-flag:`-qn` + flag. + +- The runtime system should now wake-up less often with large capability counts + +- The runtime system is now a more efficient in handling programs with many + bound threads. (:ghc-ticket:`12419`) + +- A number of runtime system bugs which could result in crashes (see + :ghc-ticket:`12728`, :ghc-ticket:`10860`, :ghc-ticket:`12019`, + :ghc-ticket:`11978`, :ghc-ticket:`12038`, :ghc-ticket:`12208`) Template Haskell ~~~~~~~~~~~~~~~~ -- TODO FIXME. - - ``addModFinalizer`` now exposes the local typing environment at the splice point. This allows ``reify`` to see local and top-level definitions in the current declaration group when used as in @@ -112,32 +168,10 @@ Template Haskell f x = $(addModFinalizer (reify 'x >>= runIO . print) >> [| x |]) -TODO FIXME Heading title -~~~~~~~~~~~~~~~~~~~~~~~~ - -- GHCi now supports two new commands. :ghci-cmd:`:type` ``+d`` performs - defaulting on the type before reporting it to the user, and - :ghci-cmd:`:type` ``+v`` refrains from instantiating any variables before - reporting, which is useful in concert with :ghc-flag:`-XTypeApplications`. - - .. code-block:: none - - *X> :type +d length - length :: [a] -> Int - - *X> :set -fprint-explicit-foralls - *X> :type length - length :: forall {a} {t :: * -> *}. Foldable t => t a -> Int - *X> :type +v length - length :: forall (t :: * -> *). Foldable t => forall a. t a -> Int - -Libraries ---------- +``ghc`` library +~~~~~~~~~~~~~~~ -ghc -~~~ +- Accessors are now exposed for ``ErrUtils.ErrMsg`` and ``ErrUtils.ErrDoc``. -- The ``GHC.initGhcMonad`` function no longer installs signal handlers by - default. This means that the RTS won't attempt to handle Ctrl-C gracefully. - If you would like to use GHC's signal handlers, call - ``GHC.installSignalHandlers`` during initialization. +- There is now a ``createIservProcessHook`` to allow API users to redirect the + ``stdout`` and ``stderr`` handles. From git at git.haskell.org Tue Nov 29 19:40:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 19:40:26 +0000 (UTC) Subject: [commit: ghc] master: Detect color support (52222f9b) Message-ID: <20161129194026.161D63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/52222f9bf705ad64bc4a212088d153d8918b6173/ghc >--------------------------------------------------------------- commit 52222f9bf705ad64bc4a212088d153d8918b6173 Author: Phil Ruffwind Date: Tue Nov 29 13:31:16 2016 -0500 Detect color support Test Plan: validate Reviewers: erikd, Phyx, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2717 GHC Trac Issues: #8809 >--------------------------------------------------------------- 52222f9bf705ad64bc4a212088d153d8918b6173 compiler/ghc.cabal.in | 7 ++++ compiler/main/DynFlags.hs | 102 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 2 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 0a85ff1..9538e2c 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -40,6 +40,11 @@ Flag stage3 Default: False Manual: True +Flag terminfo + Description: Build GHC with terminfo support on non-Windows platforms. + Default: True + Manual: True + Library Default-Language: Haskell2010 Exposed: False @@ -64,6 +69,8 @@ Library if os(windows) Build-Depends: Win32 == 2.3.* else + if flag(terminfo) + Build-Depends: terminfo == 0.4.* Build-Depends: unix == 2.7.* if flag(ghci) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d1819a8..10c523e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE ScopedTypeVariables #-} ------------------------------------------------------------------------------- -- @@ -155,6 +156,16 @@ module DynFlags ( #include "HsVersions.h" +#if defined mingw32_HOST_OS && !defined WINAPI +# if defined i386_HOST_ARCH +# define WINAPI stdcall +# elif defined x86_64_HOST_ARCH +# define WINAPI ccall +# else +# error unknown architecture +# endif +#endif + import Platform import PlatformConstants import Module @@ -187,7 +198,7 @@ import Control.Monad.Trans.Class import Control.Monad.Trans.Writer import Control.Monad.Trans.Reader import Control.Monad.Trans.Except -import Control.Exception (throwIO) +import Control.Exception (catch, throwIO) import Data.Ord import Data.Bits @@ -204,6 +215,15 @@ import System.Directory import System.Environment (getEnv) import System.IO import System.IO.Error +#if defined MIN_VERSION_terminfo +import System.Console.Terminfo (SetupTermError, Terminal, getCapability, + setupTermFromEnv, termColors) +import System.Posix (queryTerminal, stdError) +#elif defined mingw32_HOST_OS +import Foreign (Ptr, with, peek) +import System.Environment (lookupEnv) +import qualified Graphics.Win32 as Win32 +#endif import Text.ParserCombinators.ReadP hiding (char) import Text.ParserCombinators.ReadP as R @@ -1455,7 +1475,7 @@ initDynFlags dflags = do do str' <- peekCString enc cstr return (str == str')) `catchIOError` \_ -> return False - canUseColor <- return False -- FIXME: Not implemented + canUseColor <- stderrSupportsAnsiColors return dflags{ canGenerateDynamicToo = refCanGenerateDynamicToo, nextTempSuffix = refNextTempSuffix, @@ -1470,6 +1490,84 @@ initDynFlags dflags = do rtccInfo = refRtccInfo } +-- | Check if ANSI escape sequences can be used to control color in stderr. +stderrSupportsAnsiColors :: IO Bool +stderrSupportsAnsiColors = do +#if defined MIN_VERSION_terminfo + queryTerminal stdError `andM` do + (termSupportsColors <$> setupTermFromEnv) + `catch` \ (_ :: SetupTermError) -> + pure False + + where + + andM :: Monad m => m Bool -> m Bool -> m Bool + andM mx my = do + x <- mx + if x + then my + else pure x + + termSupportsColors :: Terminal -> Bool + termSupportsColors term = fromMaybe 0 (getCapability term termColors) > 0 + +#elif defined mingw32_HOST_OS + foldl1 orM + [ (/= "") <$> getEnvLM "ANSICON" + , (== "on") <$> getEnvLM "ConEmuANSI" + , (== "xterm") <$> getEnvLM "TERM" + , do + h <- Win32.getStdHandle Win32.sTD_ERROR_HANDLE + mode <- getConsoleMode h + if modeHasVTP mode + then pure True + else do + setConsoleMode h (modeAddVTP mode) + modeHasVTP <$> getConsoleMode h + `catch` \ (_ :: IOError) -> + pure False + ] + + where + + orM :: Monad m => m Bool -> m Bool -> m Bool + orM mx my = do + x <- mx + if x + then pure x + else my + + getEnvLM :: String -> IO String + getEnvLM name = map toLower . fromMaybe "" <$> lookupEnv name + + modeHasVTP :: Win32.DWORD -> Bool + modeHasVTP mode = mode .&. eNABLE_VIRTUAL_TERMINAL_PROCESSING /= 0 + + modeAddVTP :: Win32.DWORD -> Win32.DWORD + modeAddVTP mode = mode .|. eNABLE_VIRTUAL_TERMINAL_PROCESSING + +eNABLE_VIRTUAL_TERMINAL_PROCESSING :: Win32.DWORD +eNABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 + +getConsoleMode :: Win32.HANDLE -> IO Win32.DWORD +getConsoleMode h = with 64 $ \ mode -> do + Win32.failIfFalse_ "GetConsoleMode" (c_GetConsoleMode h mode) + peek mode + +setConsoleMode :: Win32.HANDLE -> Win32.DWORD -> IO () +setConsoleMode h mode = do + Win32.failIfFalse_ "SetConsoleMode" (c_SetConsoleMode h mode) + +foreign import WINAPI unsafe "windows.h GetConsoleMode" c_GetConsoleMode + :: Win32.HANDLE -> Ptr Win32.DWORD -> IO Win32.BOOL + +foreign import WINAPI unsafe "windows.h SetConsoleMode" c_SetConsoleMode + :: Win32.HANDLE -> Win32.DWORD -> IO Win32.BOOL + +#else + pure False +#endif + -- | 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 -> DynFlags From git at git.haskell.org Tue Nov 29 21:37:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:37:54 +0000 (UTC) Subject: [commit: ghc] master: Refactor Pattern Match Checker to use ListT (c2268ba) Message-ID: <20161129213754.09F083A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2268ba0eeb36a48da77ba95c72525c398c8b306/ghc >--------------------------------------------------------------- commit c2268ba0eeb36a48da77ba95c72525c398c8b306 Author: Matthew Pickering Date: Tue Nov 29 14:43:43 2016 -0500 Refactor Pattern Match Checker to use ListT Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2725 >--------------------------------------------------------------- c2268ba0eeb36a48da77ba95c72525c398c8b306 compiler/deSugar/Check.hs | 326 ++++++++++++++++++++++++++++++---------------- compiler/ghc.cabal.in | 1 + compiler/utils/ListT.hs | 71 ++++++++++ 3 files changed, 287 insertions(+), 111 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c2268ba0eeb36a48da77ba95c72525c398c8b306 From git at git.haskell.org Tue Nov 29 21:37:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:37:57 +0000 (UTC) Subject: [commit: ghc] master: Purge GHC of literate Perl (6845087) Message-ID: <20161129213757.5BC113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/68450878b44ddb63beb3c589cd60d43461900986/ghc >--------------------------------------------------------------- commit 68450878b44ddb63beb3c589cd60d43461900986 Author: Demi Obenour Date: Tue Nov 29 14:44:05 2016 -0500 Purge GHC of literate Perl Test Plan: GHC CI Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: snowleopard, thomie Maniphest Tasks: T74 Differential Revision: https://phabricator.haskell.org/D2732 >--------------------------------------------------------------- 68450878b44ddb63beb3c589cd60d43461900986 compiler/nativeGen/PIC.hs | 2 +- driver/split/{ghc-split.lprl => ghc-split.pl} | 18 ++++++++---------- driver/split/ghc.mk | 2 +- rules/build-perl.mk | 10 ++++------ utils/count_lines/{count_lines.lprl => count_lines.pl} | 5 ----- utils/count_lines/ghc.mk | 3 +-- 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs index 1a76728..2529f91 100644 --- a/compiler/nativeGen/PIC.hs +++ b/compiler/nativeGen/PIC.hs @@ -560,7 +560,7 @@ pprGotDeclaration _ _ _ -- and one for non-PIC. -- -- Whenever you change something in this assembler output, make sure --- the splitter in driver/split/ghc-split.lprl recognizes the new output +-- the splitter in driver/split/ghc-split.pl recognizes the new output pprImportedSymbol :: DynFlags -> Platform -> CLabel -> SDoc pprImportedSymbol dflags platform@(Platform { platformArch = ArchPPC, platformOS = OSDarwin }) importedLbl diff --git a/driver/split/ghc-split.lprl b/driver/split/ghc-split.pl similarity index 97% rename from driver/split/ghc-split.lprl rename to driver/split/ghc-split.pl index dd12a8a..1ddc079 100644 --- a/driver/split/ghc-split.lprl +++ b/driver/split/ghc-split.pl @@ -1,10 +1,9 @@ -%************************************************************************ -%* * -\section[Driver-obj-splitting]{Splitting into many \tr{.o} files (for libraries)} -%* * -%************************************************************************ +#************************************************************************ +#* * +#* \section[Driver-obj-splitting]{Splitting into many \tr{.o} files (for libraries)} +#* * +#************************************************************************ -\begin{code} $TargetPlatform = $TARGETPLATFORM; ($Pgm = $0) =~ s|.*/||; @@ -209,13 +208,14 @@ sub ReadTMPIUpToAMarker { $str =~ tr/\r//d if $TargetPlatform =~ /-mingw32$/m; # in case Perl doesn't convert line endings $str; } -\end{code} +=pod We must (a)~strip the marker off the block, (b)~record any literal C constants that are defined here, and (c)~inject copies of any C constants that are used-but-not-defined here. -\begin{code} +=cut + sub process_asm_block { local($str) = @_; @@ -430,5 +430,3 @@ sub tidy_up_and_die { print STDERR $msg; exit (($return_val == 0) ? 0 : 1); } -\end{code} - diff --git a/driver/split/ghc.mk b/driver/split/ghc.mk index 20b244d..9d34a59 100644 --- a/driver/split/ghc.mk +++ b/driver/split/ghc.mk @@ -10,7 +10,7 @@ # # ----------------------------------------------------------------------------- -driver/split_PERL_SRC = ghc-split.lprl +driver/split_PERL_SRC = ghc-split.pl driver/split_dist_PROGNAME = ghc-split driver/split_dist_TOPDIR = YES driver/split_dist_INSTALL = YES diff --git a/rules/build-perl.mk b/rules/build-perl.mk index 58660fc..6bec7d9 100644 --- a/rules/build-perl.mk +++ b/rules/build-perl.mk @@ -13,7 +13,7 @@ # Build a perl script. Invoke like this: # -# driver/mangler_PERL_SRC = ghc-asm.lprl +# driver/mangler_PERL_SRC = ghc-asm.pl # driver/mangler_dist_PROGNAME = ghc-asm # # $(eval $(call build-perl,driver/mangler,dist)) @@ -50,14 +50,12 @@ $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE)) clean_$1 : clean_$1_$2 ifneq "$$(BINDIST)" "YES" -$1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/. - "$$(unlit_INPLACE)" $$(UNLIT_OPTS) $$< $$@ -$1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl +$1/$2/$$($1_$2_PROG): $1/$$/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/. $$(call removeFiles,$$@) echo '#!$$(PERL)' >> $$@ - echo '$$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@ - echo '$$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@ + echo 'my $$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@ + echo 'my $$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@ cat $$< >> $$@ $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/. diff --git a/utils/count_lines/count_lines.lprl b/utils/count_lines/count_lines.pl similarity index 98% rename from utils/count_lines/count_lines.lprl rename to utils/count_lines/count_lines.pl index 49b11ee..a54f163 100644 --- a/utils/count_lines/count_lines.lprl +++ b/utils/count_lines/count_lines.pl @@ -1,7 +1,5 @@ #!/usr/bin/env perl -\begin{code} - use FindBin; %DirCount = (); @@ -69,6 +67,3 @@ foreach $m (sort (keys %ModCount)) { $totcmts += $ModComments{$m}; } printf "\n%-20s %6d %6d\n", 'TOTAL:', $tot, $totcmts; - -\end{code} - diff --git a/utils/count_lines/ghc.mk b/utils/count_lines/ghc.mk index 4f3f43e..5fec518 100644 --- a/utils/count_lines/ghc.mk +++ b/utils/count_lines/ghc.mk @@ -1,5 +1,4 @@ - -utils/count_lines_PERL_SRC = count_lines.lprl +utils/count_lines_PERL_SRC = count_lines.pl utils/count_lines_dist_PROGNAME = count_lines $(eval $(call build-perl,utils/count_lines,dist)) From git at git.haskell.org Tue Nov 29 21:38:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:38:00 +0000 (UTC) Subject: [commit: ghc] master: Use newBlockId instead of newLabelC (4d4e7a5) Message-ID: <20161129213800.251323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4d4e7a512aa4ecbb5811cccc1dab335379e63efa/ghc >--------------------------------------------------------------- commit 4d4e7a512aa4ecbb5811cccc1dab335379e63efa Author: Ben Gamari Date: Tue Nov 29 14:44:19 2016 -0500 Use newBlockId instead of newLabelC This seems like a clearer name and the fewer functions that one needs to remember, the better. Test Plan: validate Reviewers: austin, simonmar, michalt Reviewed By: simonmar, michalt Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2735 >--------------------------------------------------------------- 4d4e7a512aa4ecbb5811cccc1dab335379e63efa compiler/cmm/BlockId.hs | 5 +++++ compiler/cmm/CmmLayoutStack.hs | 3 +-- compiler/codeGen/StgCmmBind.hs | 3 ++- compiler/codeGen/StgCmmExpr.hs | 6 +++--- compiler/codeGen/StgCmmExtCode.hs | 11 +++++++---- compiler/codeGen/StgCmmForeign.hs | 3 ++- compiler/codeGen/StgCmmHeap.hs | 13 +++++++------ compiler/codeGen/StgCmmLayout.hs | 11 ++++++----- compiler/codeGen/StgCmmMonad.hs | 25 ++++++++++--------------- compiler/codeGen/StgCmmPrim.hs | 3 ++- compiler/codeGen/StgCmmUtils.hs | 6 +++--- 11 files changed, 48 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 4d4e7a512aa4ecbb5811cccc1dab335379e63efa From git at git.haskell.org Tue Nov 29 21:38:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:38:02 +0000 (UTC) Subject: [commit: ghc] master: AsmCodeGen: Refactor worker in cmmNativeGens (7753273) Message-ID: <20161129213802.CCF583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/775327350c6b16acdf01e49ac174722cc91e4973/ghc >--------------------------------------------------------------- commit 775327350c6b16acdf01e49ac174722cc91e4973 Author: Ben Gamari Date: Tue Nov 29 14:44:57 2016 -0500 AsmCodeGen: Refactor worker in cmmNativeGens Test Plan: Validate Reviewers: austin, simonmar, michalt Reviewed By: simonmar, michalt Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2736 >--------------------------------------------------------------- 775327350c6b16acdf01e49ac174722cc91e4973 compiler/nativeGen/AsmCodeGen.hs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index 29bf26c..affb3e4 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -416,7 +416,8 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs -- | Do native code generation on all these cmms. -- -cmmNativeGens :: (Outputable statics, Outputable instr, Instruction instr) +cmmNativeGens :: forall statics instr jumpDest. + (Outputable statics, Outputable instr, Instruction instr) => DynFlags -> Module -> ModLocation -> NcgImpl statics instr jumpDest @@ -428,12 +429,15 @@ cmmNativeGens :: (Outputable statics, Outputable instr, Instruction instr) -> Int -> IO (NativeGenAcc statics instr, UniqSupply) -cmmNativeGens _ _ _ _ _ _ us [] ngs !_ - = return (ngs, us) +cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap = go + where + go :: UniqSupply -> [RawCmmDecl] -> NativeGenAcc statics instr -> Int + -> IO (NativeGenAcc statics instr, UniqSupply) -cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap us - (cmm : cmms) ngs count - = do + go us [] ngs !_ = + return (ngs, us) + + go us (cmm : cmms) ngs count = do let fileIds = ngs_dwarfFiles ngs (us', fileIds', native, imports, colorStats, linearStats) <- {-# SCC "cmmNativeGen" #-} @@ -468,11 +472,10 @@ cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap us , ngs_labels = ngs_labels ngs ++ labels' , ngs_dwarfFiles = fileIds' } - cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap us' - cmms ngs' (count + 1) + go us' cmms ngs' (count + 1) - where seqString [] = () - seqString (x:xs) = x `seq` seqString xs + seqString [] = () + seqString (x:xs) = x `seq` seqString xs emitNativeCode :: DynFlags -> BufHandle -> SDoc -> IO () From git at git.haskell.org Tue Nov 29 21:38:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:38:05 +0000 (UTC) Subject: [commit: ghc] master: NCGMonad: Add MonadUnique NatM instance (6d5c2e7) Message-ID: <20161129213805.7B2553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6d5c2e7b428844a8ff80245579c980c015e6b7e8/ghc >--------------------------------------------------------------- commit 6d5c2e7b428844a8ff80245579c980c015e6b7e8 Author: Ben Gamari Date: Tue Nov 29 14:45:04 2016 -0500 NCGMonad: Add MonadUnique NatM instance Test Plan: Validate Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2737 >--------------------------------------------------------------- 6d5c2e7b428844a8ff80245579c980c015e6b7e8 compiler/nativeGen/NCGMonad.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/nativeGen/NCGMonad.hs b/compiler/nativeGen/NCGMonad.hs index 43547d0..b790d97 100644 --- a/compiler/nativeGen/NCGMonad.hs +++ b/compiler/nativeGen/NCGMonad.hs @@ -95,6 +95,14 @@ instance Applicative NatM where instance Monad NatM where (>>=) = thenNat +instance MonadUnique NatM where + getUniqueSupplyM = NatM $ \st -> + case splitUniqSupply (natm_us st) of + (us1, us2) -> (us1, st {natm_us = us2}) + + getUniqueM = NatM $ \st -> + case takeUniqFromSupply (natm_us st) of + (uniq, us') -> (uniq, st {natm_us = us'}) thenNat :: NatM a -> (a -> NatM b) -> NatM b thenNat expr cont From git at git.haskell.org Tue Nov 29 21:38:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:38:08 +0000 (UTC) Subject: [commit: ghc] master: OrdList: Add Foldable, Traversable instances (eaed140) Message-ID: <20161129213808.39C123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eaed140c438255263b984d73f66483a76ef5474e/ghc >--------------------------------------------------------------- commit eaed140c438255263b984d73f66483a76ef5474e Author: Ben Gamari Date: Tue Nov 29 14:45:19 2016 -0500 OrdList: Add Foldable, Traversable instances Test Plan: Validate Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2740 >--------------------------------------------------------------- eaed140c438255263b984d73f66483a76ef5474e compiler/utils/OrdList.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs index 625886d..3c5b9d7 100644 --- a/compiler/utils/OrdList.hs +++ b/compiler/utils/OrdList.hs @@ -49,6 +49,15 @@ instance Monoid (OrdList a) where mappend = appOL mconcat = concatOL +instance Functor OrdList where + fmap = mapOL + +instance Foldable OrdList where + foldr = foldrOL + +instance Traversable OrdList where + traverse f xs = toOL <$> traverse f (fromOL xs) + nilOL :: OrdList a isNilOL :: OrdList a -> Bool @@ -98,9 +107,6 @@ mapOL f (Snoc xs x) = Snoc (mapOL f xs) (f x) mapOL f (Two x y) = Two (mapOL f x) (mapOL f y) mapOL f (Many xs) = Many (map f xs) -instance Functor OrdList where - fmap = mapOL - foldrOL :: (a->b->b) -> b -> OrdList a -> b foldrOL _ z None = z foldrOL k z (One x) = k x z From git at git.haskell.org Tue Nov 29 21:38:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 21:38:10 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump haddock.compiler allocations (fe3748b) Message-ID: <20161129213810.E1D463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe3748bc8631afb9a7cd1a74340783eee7c495f6/ghc >--------------------------------------------------------------- commit fe3748bc8631afb9a7cd1a74340783eee7c495f6 Author: Ben Gamari Date: Tue Nov 29 15:58:36 2016 -0500 testsuite: Bump haddock.compiler allocations Unfortunately it's quite unclear what caused this. >--------------------------------------------------------------- fe3748bc8631afb9a7cd1a74340783eee7c495f6 testsuite/tests/perf/haddock/all.T | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index f2083a1..712debb 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -127,6 +127,7 @@ test('haddock.compiler', # 2015-12-15: 49395782136 (amd64/Linux) more creep, following kind-equalities # 2015-12-17: 58017214568 (amd64/Linux) update Haddock to master # 2016-06-21: 55314944264 (amd64/Linux) D2350: Make checkFamInstConsistency less expensive + # 2016-11-29: 60911147344 (amd64/Linux) unknown cause ,(platform('i386-unknown-mingw32'), 902576468, 10) # 2012-10-30: 13773051312 (x86/Windows) From git at git.haskell.org Tue Nov 29 22:19:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 22:19:33 +0000 (UTC) Subject: [commit: ghc] master: hschooks.c: Ensure correct header file is included (795f8bd) Message-ID: <20161129221933.154BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/795f8bd460d604c792a5df8cfec937b2a74c3956/ghc >--------------------------------------------------------------- commit 795f8bd460d604c792a5df8cfec937b2a74c3956 Author: Ben Gamari Date: Tue Nov 29 16:50:04 2016 -0500 hschooks.c: Ensure correct header file is included Consider the case of building a stage1 compiler. `hschooks.c` will be built by stage0 `ghc` and linked against the `stage0` RTS. Despite this it was #including the stage1 `Rts.h`. There is, of course, no guarantee that this is ABI-compatible with the stage0 RTS and when they diverge Bad Things happen (e.g. bells ringing at inappropriate times in D2699). Test Plan: Validate Reviewers: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2763 >--------------------------------------------------------------- 795f8bd460d604c792a5df8cfec937b2a74c3956 ghc/hschooks.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ghc/hschooks.c b/ghc/hschooks.c index 3a42801..9b1be56 100644 --- a/ghc/hschooks.c +++ b/ghc/hschooks.c @@ -5,11 +5,18 @@ in instead of the defaults. */ #include "../rts/PosixSource.h" -#include "../includes/Rts.h" + +/* + * This should be linked against Rts.h from the compiler which is compiling us. + * For instance, if we are compiling this file to produce the stage1 compiler, + * we should use Rts.h from stage0. + */ +#include "Rts.h" #include "HsFFI.h" #include +#include #ifdef HAVE_UNISTD_H #include From git at git.haskell.org Tue Nov 29 22:19:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 22:19:35 +0000 (UTC) Subject: [commit: ghc] master: Make globals use sharedCAF (6f7ed1e) Message-ID: <20161129221935.D1C563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6f7ed1e51bf360621a3c2a447045ab3012f68575/ghc >--------------------------------------------------------------- commit 6f7ed1e51bf360621a3c2a447045ab3012f68575 Author: Moritz Angermann Date: Tue Nov 29 16:50:32 2016 -0500 Make globals use sharedCAF The use of globals is quite painful when multiple rts are loaded, e.g. when plugins are loaded, which bring in a second rts. The sharedCAF appraoch was employed for the FastStringTable; I've taken the libery to extend this to the other globals I could find. Reviewers: rwbarton, simonmar, austin, hvr, erikd, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2575 >--------------------------------------------------------------- 6f7ed1e51bf360621a3c2a447045ab3012f68575 compiler/HsVersions.h | 16 +++++ compiler/ghci/Linker.hs | 44 ++++++------ compiler/main/DynFlags.hs | 15 ++++ compiler/main/StaticFlags.hs | 20 +++++- compiler/simplCore/CoreMonad.hs | 75 ++------------------ compiler/utils/FastString.hs | 7 -- compiler/utils/Util.hs | 34 ++++++++++ docs/users_guide/extending_ghc.rst | 13 ---- includes/rts/Globals.h | 27 +++++--- libraries/base/GHC/Conc/Sync.hs | 2 +- rts/Globals.c | 79 +++++++--------------- testsuite/tests/plugins/LinkerTicklingPlugin.hs | 4 +- .../tests/plugins/annotation-plugin/SayAnnNames.hs | 1 - .../should_compile/T7702plugin/T7702Plugin.hs | 1 - 14 files changed, 156 insertions(+), 182 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 6f7ed1e51bf360621a3c2a447045ab3012f68575 From git at git.haskell.org Tue Nov 29 22:19:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 22:19:38 +0000 (UTC) Subject: [commit: ghc] master: Fix type of GarbageCollect declaration (56d7451) Message-ID: <20161129221938.8E70A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/56d74515396c8b6360ba7898cbc4b68f0f1fb2ea/ghc >--------------------------------------------------------------- commit 56d74515396c8b6360ba7898cbc4b68f0f1fb2ea Author: Ben Gamari Date: Tue Nov 29 16:51:07 2016 -0500 Fix type of GarbageCollect declaration Test Plan: Validate Reviewers: simonmar, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2764 >--------------------------------------------------------------- 56d74515396c8b6360ba7898cbc4b68f0f1fb2ea rts/sm/GC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/sm/GC.h b/rts/sm/GC.h index 707d4b5..44ae7e3 100644 --- a/rts/sm/GC.h +++ b/rts/sm/GC.h @@ -18,7 +18,7 @@ #include "HeapAlloc.h" -void GarbageCollect (rtsBool force_major_gc, +void GarbageCollect (uint32_t collect_gen, rtsBool do_heap_census, uint32_t gc_type, Capability *cap, rtsBool idle_cap[]); From git at git.haskell.org Tue Nov 29 22:19:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 29 Nov 2016 22:19:41 +0000 (UTC) Subject: [commit: ghc] master: Use C99's bool (428e152) Message-ID: <20161129221941.763A53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/428e152be6bb0fd3867e41cee82a6d5968a11a26/ghc >--------------------------------------------------------------- commit 428e152be6bb0fd3867e41cee82a6d5968a11a26 Author: Ben Gamari Date: Tue Nov 29 16:51:30 2016 -0500 Use C99's bool Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699 >--------------------------------------------------------------- 428e152be6bb0fd3867e41cee82a6d5968a11a26 compiler/main/DriverPipeline.hs | 6 +- docs/storage-mgt/ldv.tex | 4 +- docs/storage-mgt/rp.tex | 2 +- docs/storage-mgt/sm.tex | 16 +-- ghc/hschooks.c | 2 +- includes/Cmm.h | 5 +- includes/rts/Flags.h | 76 +++++----- includes/rts/Hpc.h | 2 +- includes/rts/OSThreads.h | 10 +- includes/rts/Threads.h | 2 +- includes/rts/Types.h | 6 +- includes/rts/storage/ClosureMacros.h | 10 +- includes/rts/storage/GC.h | 4 +- rts/AwaitEvent.h | 6 +- rts/Capability.c | 74 +++++----- rts/Capability.h | 30 ++-- rts/CheckUnload.c | 32 ++--- rts/Hpc.c | 6 +- rts/Interpreter.c | 8 +- rts/Linker.c | 10 +- rts/LinkerInternals.h | 2 +- rts/Messages.c | 2 +- rts/Printer.c | 8 +- rts/ProfHeap.c | 76 +++++----- rts/ProfHeap.h | 4 +- rts/Profiling.c | 28 ++-- rts/Proftimer.c | 18 +-- rts/Proftimer.h | 2 +- rts/RaiseAsync.c | 22 +-- rts/RaiseAsync.h | 4 +- rts/RetainerProfile.c | 28 ++-- rts/RetainerSet.c | 2 +- rts/RetainerSet.h | 16 +-- rts/RtsAPI.c | 2 +- rts/RtsDllMain.c | 2 +- rts/RtsFlags.c | 259 ++++++++++++++++++----------------- rts/RtsSignals.h | 2 +- rts/RtsStartup.c | 12 +- rts/RtsUtils.c | 4 +- rts/RtsUtils.h | 2 +- rts/STM.c | 119 +++++++--------- rts/STM.h | 2 +- rts/Schedule.c | 154 ++++++++++----------- rts/Schedule.h | 10 +- rts/Sparks.h | 8 +- rts/Stable.c | 2 +- rts/Stable.h | 2 +- rts/Stats.c | 34 ++--- rts/Task.c | 20 +-- rts/Task.h | 12 +- rts/ThreadPaused.c | 10 +- rts/Threads.c | 26 ++-- rts/Threads.h | 8 +- rts/Ticker.h | 2 +- rts/Ticky.c | 6 +- rts/Timer.c | 2 +- rts/Timer.h | 2 +- rts/Trace.c | 2 +- rts/WSDeque.c | 6 +- rts/WSDeque.h | 6 +- rts/Weak.c | 8 +- rts/Weak.h | 2 +- rts/hooks/OutOfHeap.c | 2 +- rts/hooks/StackOverflow.c | 2 +- rts/linker/Elf.c | 21 ++- rts/linker/LoadArchive.c | 2 +- rts/linker/SymbolExtras.c | 2 +- rts/posix/OSMem.c | 12 +- rts/posix/OSThreads.c | 10 +- rts/posix/Select.c | 14 +- rts/posix/Signals.c | 10 +- rts/posix/Signals.h | 2 +- rts/posix/itimer/Pthread.c | 2 +- rts/posix/itimer/Setitimer.c | 2 +- rts/posix/itimer/TimerCreate.c | 2 +- rts/sm/CNF.c | 102 +++++++------- rts/sm/Evac.c | 38 ++--- rts/sm/GC.c | 60 ++++---- rts/sm/GC.h | 14 +- rts/sm/GCThread.h | 8 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MarkStack.h | 2 +- rts/sm/MarkWeak.c | 42 +++--- rts/sm/MarkWeak.h | 2 +- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 14 +- rts/sm/Sanity.h | 6 +- rts/sm/Scav.c | 160 +++++++++++----------- rts/sm/Storage.c | 28 ++-- rts/sm/Storage.h | 8 +- rts/win32/AsyncIO.c | 6 +- rts/win32/AsyncIO.h | 4 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/ConsoleHandler.c | 28 ++-- rts/win32/ConsoleHandler.h | 2 +- rts/win32/IOManager.c | 22 +-- rts/win32/IOManager.h | 2 +- rts/win32/OSMem.c | 4 +- rts/win32/OSThreads.c | 16 +-- rts/win32/ThrIOManager.c | 4 +- rts/win32/Ticker.c | 2 +- rts/win32/WorkQueue.c | 30 ++-- 103 files changed, 953 insertions(+), 993 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 428e152be6bb0fd3867e41cee82a6d5968a11a26 From git at git.haskell.org Wed Nov 30 01:38:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 01:38:35 +0000 (UTC) Subject: [commit: ghc] master: Remove most functions from cmm/BlockId (23dc6c4) Message-ID: <20161130013835.5F2893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/23dc6c459b61b400c7140ffc49b3b8b45a4a1159/ghc >--------------------------------------------------------------- commit 23dc6c459b61b400c7140ffc49b3b8b45a4a1159 Author: Michal Terepeta Date: Tue Nov 29 17:49:27 2016 -0500 Remove most functions from cmm/BlockId It seems that `BlockId` module could simply go away in favor of Hoopl's `Label`. This is the first step to do that. In a few places I had to add some type signatures, but most of them seem to help with code readability. Signed-off-by: Michal Terepeta Test Plan: ./validate Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2765 >--------------------------------------------------------------- 23dc6c459b61b400c7140ffc49b3b8b45a4a1159 compiler/cmm/BlockId.hs | 22 +++------------------- compiler/cmm/CmmContFlowOpt.hs | 2 +- compiler/cmm/CmmProcPoint.hs | 24 +++++++++++++++++++----- compiler/nativeGen/AsmCodeGen.hs | 3 ++- compiler/nativeGen/RegAlloc/Graph/Spill.hs | 6 +++--- compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | 2 +- compiler/nativeGen/RegAlloc/Linear/Main.hs | 2 +- compiler/nativeGen/RegAlloc/Liveness.hs | 10 +++++----- 8 files changed, 35 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 23dc6c459b61b400c7140ffc49b3b8b45a4a1159 From git at git.haskell.org Wed Nov 30 01:38:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 01:38:38 +0000 (UTC) Subject: [commit: ghc] master: rts: Add missing #include (758b81d) Message-ID: <20161130013838.213A13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/758b81d28f15910fa56168d3bf9ab6945f8925c4/ghc >--------------------------------------------------------------- commit 758b81d28f15910fa56168d3bf9ab6945f8925c4 Author: Ben Gamari Date: Tue Nov 29 18:46:15 2016 -0500 rts: Add missing #include >--------------------------------------------------------------- 758b81d28f15910fa56168d3bf9ab6945f8925c4 rts/win32/WorkQueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/win32/WorkQueue.c b/rts/win32/WorkQueue.c index 562d048..e560bd2 100644 --- a/rts/win32/WorkQueue.c +++ b/rts/win32/WorkQueue.c @@ -4,6 +4,7 @@ * (c) sof, 2002-2003. */ #include "WorkQueue.h" +#include #include #include #include From git at git.haskell.org Wed Nov 30 01:38:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 01:38:40 +0000 (UTC) Subject: [commit: ghc] master: Added Eq1, Ord1, Read1 and Show1 instances for NonEmpty (b92f8e3) Message-ID: <20161130013840.D90E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b92f8e38b1d58bef55b4fec67c1f0807e960512d/ghc >--------------------------------------------------------------- commit b92f8e38b1d58bef55b4fec67c1f0807e960512d Author: Shane Date: Tue Nov 29 17:53:44 2016 -0500 Added Eq1, Ord1, Read1 and Show1 instances for NonEmpty Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2755 >--------------------------------------------------------------- b92f8e38b1d58bef55b4fec67c1f0807e960512d libraries/base/Data/List/NonEmpty.hs | 23 +++++++++++++++++++++++ libraries/base/changelog.md | 2 ++ 2 files changed, 25 insertions(+) diff --git a/libraries/base/Data/List/NonEmpty.hs b/libraries/base/Data/List/NonEmpty.hs index 1cba3e5..b4da532 100644 --- a/libraries/base/Data/List/NonEmpty.hs +++ b/libraries/base/Data/List/NonEmpty.hs @@ -109,7 +109,9 @@ import Data.Data (Data) import Data.Foldable hiding (length, toList) import qualified Data.Foldable as Foldable import Data.Function (on) +import Data.Functor.Classes (Eq1(..), Ord1(..), Read1(..), Show1(..)) import qualified Data.List as List +import Data.Monoid ((<>)) import Data.Ord (comparing) import qualified GHC.Exts as Exts (IsList(..)) import GHC.Generics (Generic, Generic1) @@ -122,6 +124,27 @@ infixr 5 :|, <| data NonEmpty a = a :| [a] deriving ( Eq, Ord, Show, Read, Data, Generic, Generic1 ) +-- | @since 4.10.0.0 +instance Eq1 NonEmpty where + liftEq eq (a :| as) (b :| bs) = eq a b && liftEq eq as bs + +-- | @since 4.10.0.0 +instance Ord1 NonEmpty where + liftCompare cmp (a :| as) (b :| bs) = cmp a b <> liftCompare cmp as bs + +-- | @since 4.10.0.0 +instance Read1 NonEmpty where + liftReadsPrec rdP rdL p s = readParen (p > 5) (\s' -> do + (a, s'') <- rdP 6 s' + (":|", s''') <- lex s'' + (as, s'''') <- rdL s''' + return (a :| as, s'''')) s + +-- | @since 4.10.0.0 +instance Show1 NonEmpty where + liftShowsPrec shwP shwL p (a :| as) = showParen (p > 5) $ + shwP 6 a . showString " :| " . shwL as + -- | @since 4.9.0.0 instance Exts.IsList (NonEmpty a) where type Item (NonEmpty a) = a diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index dcc1719..5983747 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -28,6 +28,8 @@ * Add `Data` instance for `Const` (#12438) + * Added `Eq1`, `Ord1`, `Read1` and `Show1` instances for `NonEmpty`. + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Wed Nov 30 01:38:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 01:38:43 +0000 (UTC) Subject: [commit: ghc] master: Hoopl/Dataflow: use block-oriented interface (679ccd1) Message-ID: <20161130013843.8F8E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/679ccd1c8860f1ef4b589c9593b74d04c97ae836/ghc >--------------------------------------------------------------- commit 679ccd1c8860f1ef4b589c9593b74d04c97ae836 Author: Michal Terepeta Date: Tue Nov 29 17:54:12 2016 -0500 Hoopl/Dataflow: use block-oriented interface This introduces the new interface for dataflow analysis, where transfer functions operate on a whole basic block. The main changes are: - Hoopl.Dataflow: implement the new interface and remove the old code; expose a utility function to do a strict fold over the nodes of a basic block (for analyses that do want to look at all the nodes) - Refactor all the analyses to use the new interface. One of the nice effects is that we can remove the `analyzeFwdBlocks` hack that ignored the middle nodes (that existed for analyses that didn't need to go over all the nodes). Now this is no longer a special case and fits well with the new interface. Signed-off-by: Michal Terepeta Test Plan: validate, earlier version of the patch had assertions comparing the results with the old implementation Reviewers: erikd, austin, simonmar, hvr, goldfire, bgamari Reviewed By: bgamari Subscribers: goldfire, erikd, thomie Differential Revision: https://phabricator.haskell.org/D2754 >--------------------------------------------------------------- 679ccd1c8860f1ef4b589c9593b74d04c97ae836 compiler/cmm/CmmBuildInfoTables.hs | 33 +++-- compiler/cmm/CmmLive.hs | 61 ++++---- compiler/cmm/CmmProcPoint.hs | 73 +++++----- compiler/cmm/Hoopl/Dataflow.hs | 285 ++++++++++--------------------------- 4 files changed, 160 insertions(+), 292 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 679ccd1c8860f1ef4b589c9593b74d04c97ae836 From git at git.haskell.org Wed Nov 30 02:13:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 02:13:58 +0000 (UTC) Subject: [commit: ghc] master: Update test output for Windows (dd9ba50) Message-ID: <20161130021358.A4D333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd9ba503bd4a2b3851098a7fa69e15682ab1c536/ghc >--------------------------------------------------------------- commit dd9ba503bd4a2b3851098a7fa69e15682ab1c536 Author: Tamar Christina Date: Tue Nov 29 16:58:04 2016 -0500 Update test output for Windows Following D2684 these two tests need to be updated: * T7037: timeout.exe now waits until all processes are finished. this makes T7037 reliable. So enabled. * T876: Unknown reason, allocations are much lower than before. Test Plan: ./validate Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2759 GHC Trac Issues: #12725, #12004 >--------------------------------------------------------------- dd9ba503bd4a2b3851098a7fa69e15682ab1c536 testsuite/tests/perf/should_run/all.T | 3 ++- testsuite/tests/rts/all.T | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 672ce33..da75f42 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -81,8 +81,9 @@ test('lazy-bs-alloc', test('T876', [stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 71904, 5), + [(platform('x86_64-unknown-mingw32'), 66928, 5), # 2015-04-03: 71904 (amd64/Windows, unknown cause) + # 2016-11-27: 66928 (amd64/Windows, unknown cause) (wordsize(64), 58128, 5), # 2013-02-14: 1263712 (x86_64/Linux) # 2014-02-10: 63216 (x86_64/Linux), call arity analysis diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index f5c7587..9c55b21 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -199,8 +199,7 @@ test('T6006', [ omit_ways(prof_ways + ['ghci']), compile_and_run, ['T6006_c.c -no-hs-main']) test('T7037', - [ extra_clean(['T7037_main.o','T7037_main']), - when(opsys("mingw32"), expect_broken(12725))], + [ extra_clean(['T7037_main.o','T7037_main'])], run_command, ['$MAKE -s --no-print-directory T7037']) From git at git.haskell.org Wed Nov 30 02:14:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 02:14:01 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Use python3 by default (605bb9b) Message-ID: <20161130021401.5E2613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/605bb9b4608121c462fb3d9f9281e7427f7ccc72/ghc >--------------------------------------------------------------- commit 605bb9b4608121c462fb3d9f9281e7427f7ccc72 Author: Ben Gamari Date: Tue Nov 29 16:58:24 2016 -0500 testsuite: Use python3 by default Summary: It turns out that Phyx's fix for #12554 (D2684) still fails with mingw-w64 python 2.7. However, Python 3 (both msys2 and mingw-w64) work fine. Given that supporting Python 2 has already become rather tiresome (as @thomie warned it would), let's just move to python3 by default. Test Plan: Validate Reviewers: austin, Phyx Reviewed By: Phyx Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2766 GHC Trac Issues: #12554 >--------------------------------------------------------------- 605bb9b4608121c462fb3d9f9281e7427f7ccc72 testsuite/driver/runtests.py | 5 ++--- testsuite/mk/boilerplate.mk | 10 +--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 1b6fe12..28b393a 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + # # (c) Simon Marlow 2002 # @@ -24,9 +26,6 @@ import re import subprocess PYTHON3 = sys.version_info >= (3, 0) -if PYTHON3: - print("*** WARNING: running testsuite using Python 3.\n" - "*** Python 3 support is experimental. See Trac #9184.") from testutil import * from testglobals import * diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk index 1aa58ab..93b4f01 100644 --- a/testsuite/mk/boilerplate.mk +++ b/testsuite/mk/boilerplate.mk @@ -217,15 +217,7 @@ $(eval $(call canonicalise,TOP_ABS)) GS = gs CP = cp RM = rm -f -# Allow the user to override the python version, just like with validate -ifeq "$(shell $(SHELL) -c '$(PYTHON) -c 0' 2> /dev/null && echo exists)" "exists" -else -ifeq "$(shell $(SHELL) -c 'python2 -c 0' 2> /dev/null && echo exists)" "exists" -PYTHON = python2 -else -PYTHON = python -endif -endif +PYTHON = python3 CHECK_API_ANNOTATIONS := $(abspath $(TOP)/../inplace/bin/check-api-annotations) From git at git.haskell.org Wed Nov 30 02:14:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 02:14:04 +0000 (UTC) Subject: [commit: ghc] master: Update Mingw-w64 bindist for Windows (20c0614) Message-ID: <20161130021404.17DE53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/20c06143a7bfc6548351e610350a8e1c0d8a0bb9/ghc >--------------------------------------------------------------- commit 20c06143a7bfc6548351e610350a8e1c0d8a0bb9 Author: Tamar Christina Date: Tue Nov 29 16:58:53 2016 -0500 Update Mingw-w64 bindist for Windows This updates the binary dists for windows to GCC 6.2.0 and binutils 2.27.2 which has fixes required for LLVM. Test Plan: ./validate Reviewers: simonmar, erikd, austin, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2749 GHC Trac Issues: #12871, #8974 >--------------------------------------------------------------- 20c06143a7bfc6548351e610350a8e1c0d8a0bb9 docs/users_guide/8.2.1-notes.rst | 3 ++ mk/get-win32-tarballs.sh | 65 +++++++++++++++++++++++++++------------- rts/linker/M32Alloc.c | 1 - 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 984889f..70b1f80 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -97,6 +97,9 @@ Compiler data TSyn = (T :: (forall k. k -> Type) -> Type) +- The Mingw-w64 toolchain for the Windows version of GHC has been updated. GHC now uses + `GCC 6.2.0` and `binutils 1.27.2`. + GHCi ~~~~ diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index a358dbc..64133de 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -35,8 +35,11 @@ download_file() { fi fi - echo "${file_md5} *${dest_file}" | md5sum --quiet -c - || - fail "ERROR: ${description} appears to be corrupted, please delete it and try again." + if test "$verify" = "1" + then + echo "${file_md5} *${dest_file}" | md5sum --quiet -c - || + fail "ERROR: ${description} appears to be corrupted, please delete it and try again." + fi } download_mingw() { @@ -44,11 +47,14 @@ download_mingw() { local file_md5sum_x86="$2" local file_md5sum_x64="$3" - if test "$mingw_arch" = "i686" + if ! test "$mingw_arch" = "sources" then - local file_md5sum="${file_md5sum_x86}" - else - local file_md5sum="${file_md5sum_x64}" + if test "$mingw_arch" = "i686" + then + local file_md5sum="${file_md5sum_x86}" + else + local file_md5sum="${file_md5sum_x64}" + fi fi local mingw_toolchain="$(basename $mingw_url)" @@ -64,23 +70,23 @@ download_mingw() { } download_tarballs() { - local mingw_base_url="https://downloads.haskell.org/~ghc/mingw" + local mingw_base_url="http://repo.msys2.org/mingw" local package_prefix="mingw-w64" local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}-${mingw_arch}" - download_mingw "${format_url}-crt-git-5.0.0.4531.49c7046-1-any.pkg.tar.xz" "dd39323140c0c1b3e065e9edb1a66779" "ac22cedd38229bcd57f5999e4734054f" - download_mingw "${format_url}-winpthreads-git-5.0.0.4538.78dca70-1-any.pkg.tar.xz" "0b14fe27790e94db454fbb3564e79a73" "65cf07b6f42a1a62d1844e08190cab0d" - download_mingw "${format_url}-headers-git-5.0.0.4531.49c7046-1-any.pkg.tar.xz" "6ee9e3c2f9d3e507f60ee33d19417dc2" "f49a19cdea93998c33ac90ceb9570350" - download_mingw "${format_url}-libwinpthread-git-5.0.0.4538.78dca70-1-any.pkg.tar.xz" "fbb2114aa7fbb5507e21d8a2ea265cfd" "31ed10e2d8891f6251d968f81bfdd274" - download_mingw "${format_url}-zlib-1.2.8-8-any.pkg.tar.xz" "7f519cb6defa27a90c5353160cf088d4" "6a2f4a70ccb24acca70a01da331699a6" - download_mingw "${format_url}-isl-0.14.1-2-any.pkg.tar.xz" "4cd20fe75ed9ef03e260d529042cb742" "dc0e0a7fd23a8193cccb0bf8d7267685" + download_mingw "${format_url}-crt-git-5.0.0.4745.d2384c2-1-any.pkg.tar.xz" "03c9e74ce17702b0f13db8cb2c7ca8ca" "035f08a61ced0b81bb6c09974f7be897" + download_mingw "${format_url}-winpthreads-git-5.0.0.4741.2c8939a-1-any.pkg.tar.xz" "155845f8c897f0c70adee83cfa9ec30c" "ba417ad9fb7cd3ee56e713b2b070adb9" + download_mingw "${format_url}-headers-git-5.0.0.4747.0f8f626-1-any.pkg.tar.xz" "b724d1aaae73c329022ad22374481817" "e8065928b81c9b379286515913eccd68" + download_mingw "${format_url}-libwinpthread-git-5.0.0.4741.2c8939a-1-any.pkg.tar.xz" "65b18b67eef3c3d5e5707577dfa8f831" "c280f60a4b80ed6722ce4d9b4f6c550e" + download_mingw "${format_url}-zlib-1.2.8-9-any.pkg.tar.xz" "87c65e9b2930436a75dfd7d459ae98cb" "60c3a388478f411b7a0908441ebeb537" + download_mingw "${format_url}-isl-0.17.1-1-any.pkg.tar.xz" "9fce16db004f00e967eb15efe0cdf86b" "39c8b3b8e56b3b0bdef86cf32f1e09ba" download_mingw "${format_url}-mpc-1.0.3-2-any.pkg.tar.xz" "719e76fa7a54a8676d2e60af3bb13c45" "df1a7d4050568d83c265ae78c32ef30b" - download_mingw "${format_url}-mpfr-3.1.3.p0-2-any.pkg.tar.xz" "e9cbd2402ac1afe6e86c102223b90dcb" "6e3b9ec27edab394aa41536839afdafe" - download_mingw "${format_url}-gmp-6.0.0-3-any.pkg.tar.xz" "c02f9759cd0140a6d8ea69ef5a88e167" "2970d4d8b176f8f36ae2d39269b25cce" - download_mingw "${format_url}-gcc-libs-5.2.0-3-any.pkg.tar.xz" "a9bd2e65cb350cc8f8a6deb6d3b346a8" "9c2ed24989e14fdf0c548a5215374660" - download_mingw "${format_url}-binutils-2.25.1-1-any.pkg.tar.xz" "997e9c2166fb851916cd8ac1bc9c6180" "7cb9f5f50a7103da41f7ec7547c09707" - download_mingw "${format_url}-libiconv-1.14-5-any.pkg.tar.xz" "2c99a163689ba8257627bb07274b3f86" "37418c6be92ef20be17cdc9fe844af35" - download_mingw "${format_url}-gcc-5.2.0-3-any.pkg.tar.xz" "efe6d6afc18aab89dc01e7ddcd2523a6" "0b697ce61112ba6e5a3c4d565957ea4e" + download_mingw "${format_url}-mpfr-3.1.4.p3-4-any.pkg.tar.xz" "6fdad8f6a522c779932ca4e54e4d7977" "de629f78e908274086a272196c14d37c" + download_mingw "${format_url}-gmp-6.1.1-1-any.pkg.tar.xz" "e8cc05fc566ddc6c16266da9aec2ddd3" "0faa10641da9266ef4cb39a8f6a4fa19" + download_mingw "${format_url}-gcc-libs-6.2.0-2-any.pkg.tar.xz" "e6f74da9dcb856cfe9e1da0ed45732e0" "f523d52a6ad940e1cda2bf3065927bd4" + download_mingw "${format_url}-binutils-2.27-2-any.pkg.tar.xz" "d263d1362dee0c24df80b461eb2ec489" "b1f21340136b75f1660d6ad36bd0768a" + download_mingw "${format_url}-libidn-1.32-3-any.pkg.tar.xz" "9ecd264a3da0f0f6af8b392c1b183a7b" "6f68259e17b68bbf19efc7b4fb5c1968" + download_mingw "${format_url}-gcc-6.2.0-2-any.pkg.tar.xz" "095dc33fb7a1cab5dab982aa57713a96" "303bf95f8e6ac5bc068b2ab95749b8f3" download_file "https://github.com/ghc/ghc-tarballs/blob/master/perl/ghc-perl-1.tar.gz?raw=true" "b21d1681b61cf7a024e854096285b02e" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" "--insecure" @@ -102,6 +108,12 @@ download_x86_64() { download_tarballs } +download_sources() { + mingw_arch="sources" + tarball_dest_dir="mingw-w64/sources" + download_tarballs +} + usage() { echo "$0 - Download GHC mingw toolchain tarballs" echo @@ -109,16 +121,23 @@ usage() { echo echo "Where is one of," echo " download download the necessary tarballs for the given architecture" + echo " fetch download the necessary tarballs for the given architecture but doesn't verify their md5."d echo " verify verify the existance and correctness of the necessary tarballs" - echo "and is one of i386, x86_64, or all" + echo "and is one of i386, x86_64,all or mirror (which includes sources)" } case $1 in download) download=1 + verify=1 + ;; + fetch) + download=1 + verify=0 ;; verify) download=0 + verify=1 ;; *) usage @@ -137,6 +156,12 @@ case $2 in download_i386 download_x86_64 ;; + mirror) + download_i386 + download_x86_64 + verify=0 + download_sources + ;; *) usage exit 1 diff --git a/rts/linker/M32Alloc.c b/rts/linker/M32Alloc.c index c5c3623..6a2996d 100644 --- a/rts/linker/M32Alloc.c +++ b/rts/linker/M32Alloc.c @@ -336,7 +336,6 @@ void * m32_alloc(size_t size STG_UNUSED, size_t alignment STG_UNUSED) { barf("%s: RTS_LINKER_USE_MMAP is %d", __func__, RTS_LINKER_USE_MMAP); - return NULL; } #else From git at git.haskell.org Wed Nov 30 02:14:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 02:14:06 +0000 (UTC) Subject: [commit: ghc] master: Fix testsuite threading, timeout, encoding and performance issues on Windows (0ce59be) Message-ID: <20161130021406.CD7513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ce59be3a2723f814a3e929fd32a44ff4e890a49/ghc >--------------------------------------------------------------- commit 0ce59be3a2723f814a3e929fd32a44ff4e890a49 Author: Tamar Christina Date: Tue Nov 29 16:56:08 2016 -0500 Fix testsuite threading, timeout, encoding and performance issues on Windows In a land far far away, a project called Cygwin was born. Cygwin used newlib as it's standard C library implementation. But Cygwin wanted to emulate POSIX systems as closely as possible. So it implemented `execv` using the Windows function `spawnve`. Specifically ``` spawnve (_P_OVERLAY, path, argv, cur_environ ()) ``` `_P_OVERLAY` is crucial, as it makes the function behave *sort of* like execv on linux. the child process replaces the original process. With one major difference because of the difference in process models on Windows: the original process signals the caller that it's done. this is why the file is still locked. because it's still running, control was returned because the parent process was destroyed, but the child is still running. I think it's just pure dumb luck, that the older runtimes are slow enough to give the process time to terminate before we tried deleting the file. Which explains why you do have sporadic failures even on older runtimes like 2.5.0, of a test or two (like T7307). So this patch fixes a couple of things. I leverage the existing `timeout.exe` to implement a workaround for this issue. a) The old timeout used to start the process then assign it to the job. This is slightly faulty since child processes are only assigned to a job is their parent were assigned at the time they started. So this was a race condition. I now create the process suspended, assign it to the job and then resume it. Which means all child processes are not running under the same job. b) First things, Is to prevent dangling child processes. I mark the job with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` so when the last process in the job is done, it insures all processes under the job are killed. c) Secondly, I change the way we wait for results. Instead of waiting for the parent process to terminate, I wait for the job itself to terminate. There's a slight subtlety there, we can't wait on the job itself. Instead we have to create an I/O Completion port and wait for signals on it. See https://blogs.msdn.microsoft.com/oldnewthing/20130405-00/?p=4743 This fixes the issues on all runtimes for me and makes T7307 pass consistenly. The threading was also simplified by hiding all the locking in a single semaphore and a completion class. Futhermore some additional error reporting was added. For encoding the testsuite now no longer passes a file handle to the subprocess since on windows, sh.exe seems to acquire a lock on the file that is not released in a timely fashion. I suspect this because cygwin seems to emulate console handles by creating file handles and using those for std handles. So when we give it an existing file handle it just locks the file. I what's happening is that it's not releasing the handle until all shared cygwin processes are dead. Which explains why it worked in single threaded mode. So now instead we pass a pipe and do not interpret the resulting data. Any bytes written to stdin or read out of stdout/stderr are done so in binary mode and we do not interpret the data. The reason for this is that we have encoding tests in GHC which pass invalid utf-8. If we try to handle the data as text then python will throw an exception instead of a test comparison failing. Also I have fixed the ability to override `PYTHON` when calling `make tests`. This now works the same as with `.\validate`. Finally, after cleaning up the locks I was able to make the abort behavior work correctly as I believe it was intended: when you press Ctrl+C and send an interrupt signal, the testsuite finishes the active tests and then gracefully exits showing you a report of the progress it did make. So using Ctrl+C will not just *die* as it did before. These changes lift the restriction on which python version you use (msys/mingw) or which runtime or python 3 or python 2. All combinations should now be supported. Test Plan: PATH=/usr/local/bin:/mingw64/bin:$APPDATA/cabal/bin:$PATH && PYTHON=/usr/bin/python THREADS=9 make test THREADS=9 make test PATH=/usr/local/bin:/mingw64/bin:$APPDATA/cabal/bin:$PATH && PYTHON=/usr/bin/python ./validate --quiet --testsuite-only Reviewers: erikd, RyanGlScott, bgamari, austin Subscribers: jrtc27, mpickering, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2684 GHC Trac Issues: #12725, #12554, #12661, #12004 >--------------------------------------------------------------- 0ce59be3a2723f814a3e929fd32a44ff4e890a49 testsuite/driver/runtests.py | 45 ++++--- testsuite/driver/testlib.py | 174 +++++++++++++------------ testsuite/driver/testutil.py | 24 ++++ testsuite/mk/boilerplate.mk | 7 +- testsuite/timeout/WinCBindings.hsc | 258 ++++++++++++++++++++++++++++++++++++- testsuite/timeout/timeout.hs | 27 +++- 6 files changed, 424 insertions(+), 111 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0ce59be3a2723f814a3e929fd32a44ff4e890a49 From git at git.haskell.org Wed Nov 30 08:56:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 08:56:09 +0000 (UTC) Subject: [commit: ghc] master: Fix windows validate. (ef37580) Message-ID: <20161130085609.2A5BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ef37580d16a23d1601795548b13b88b9f5373010/ghc >--------------------------------------------------------------- commit ef37580d16a23d1601795548b13b88b9f5373010 Author: Tamar Christina Date: Wed Nov 30 08:55:42 2016 +0000 Fix windows validate. >--------------------------------------------------------------- ef37580d16a23d1601795548b13b88b9f5373010 compiler/main/DynFlags.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 686fed0..c35834f 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -220,7 +220,6 @@ import System.Console.Terminfo (SetupTermError, Terminal, getCapability, setupTermFromEnv, termColors) import System.Posix (queryTerminal, stdError) #elif defined mingw32_HOST_OS -import Foreign (Ptr, with, peek) import System.Environment (lookupEnv) import qualified Graphics.Win32 as Win32 #endif From git at git.haskell.org Wed Nov 30 09:21:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 09:21:56 +0000 (UTC) Subject: [commit: ghc] master: Tweaks to grammar and such. (be8a47f) Message-ID: <20161130092156.E37BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/be8a47f5b7645f395543feb7c8779482a8f6d221/ghc >--------------------------------------------------------------- commit be8a47f5b7645f395543feb7c8779482a8f6d221 Author: Gabor Greif Date: Wed Nov 30 10:21:04 2016 +0100 Tweaks to grammar and such. >--------------------------------------------------------------- be8a47f5b7645f395543feb7c8779482a8f6d221 docs/users_guide/8.0.2-notes.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 063d947..9bc78ea 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -95,7 +95,7 @@ Compiler - A code generator bug which resulted in segmentation faults in compiled programs has been fixed (see :ghc-ticket:`12757`). -- GHC now supports systems whose C compiler which produce position-independent +- GHC now supports systems whose C compiler produces position-independent executables by default. (see :ghc-ticket:`12579`). - GHC can now be built on systems which use the ``gold`` linker by default @@ -108,8 +108,8 @@ Compiler - The :ghc-flag:`-Wredundant-constraints` flag has been removed from the :ghc-flag:`-Wall` flag set (see :ghc-ticket:`10635`). -- Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts variable - out of scope variables errors into warnings. +- Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts + out-of-scope variable errors into warnings. - The RTS :ghc-flag:`-xb` now reads the base heap address in any base, defaulting to decimal, hexadecimal if the address starts with ``0x``, and @@ -135,11 +135,11 @@ Runtime system ~~~~~~~~~~~~~~ - The Runtime linker on Windows is once again recognizing POSIX functions under their - "deprecated" name. e.g. "strdup" will now be recognizes and internally forwarded to "_strdup". + "deprecated" name. e.g. "strdup" will now be recognized and internally forwarded to "_strdup". If you have existing code already using the correct names (e.g. _strdup) then this will just continue to work and no change is needed. For more information about how the forwarding is done please see - `MSDN `_ . This should now introduce the same behavior - both compiled and interpreted. (see :ghc-ticket:`12497`). + `MSDN `_ . This should now introduce the same + behavior both compiled and interpreted. (see :ghc-ticket:`12497`). - Profiles from the cost-center profiler now provide source span information. (see :ghc-ticket:`11543`). From git at git.haskell.org Wed Nov 30 10:03:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 10:03:25 +0000 (UTC) Subject: [commit: ghc] master: Rename RuntimeRepPolymorphism to LevityPolymorphism (03766cd) Message-ID: <20161130100325.0F2343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03766cdbd26855e50719bd8ffcaf19898bd33f16/ghc >--------------------------------------------------------------- commit 03766cdbd26855e50719bd8ffcaf19898bd33f16 Author: Simon Peyton Jones Date: Wed Nov 30 09:45:35 2016 +0000 Rename RuntimeRepPolymorphism to LevityPolymorphism Richard and I decided to make this change in our paper, and I'm just propagating it to GHC >--------------------------------------------------------------- 03766cdbd26855e50719bd8ffcaf19898bd33f16 compiler/coreSyn/CoreLint.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 21 ++++++++++++++++++--- compiler/typecheck/TcType.hs | 2 +- compiler/types/Kind.hs | 10 +++++----- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 50c1ac1..8f47d5e 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1030,7 +1030,7 @@ lintAndScopeId id linterF (text "Non-local Id binder" <+> ppr id) -- See Note [Checking for global Ids] ; (ty, k) <- lintInTy (idType id) - ; lintL (not (isRuntimeRepPolymorphic k)) + ; lintL (not (isLevityPolymorphic k)) (text "RuntimeRep-polymorphic binder:" <+> (ppr id <+> dcolon <+> parens (ppr ty <+> dcolon <+> ppr k))) ; let id' = setIdType id ty diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 01a864b..cb84e27 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -169,10 +169,11 @@ These data types are the heart of the compiler -- * Primitive literals -- -- * Applications: note that the argument may be a 'Type'. --- --- See "CoreSyn#let_app_invariant" for another invariant +-- See Note [CoreSyn let/app invariant] +-- See Note [Levity polymorphism invariants] -- -- * Lambda abstraction +-- See Note [Levity polymorphism invariants] -- -- * Recursive and non recursive @let at s. Operationally -- this corresponds to allocating a thunk for the things @@ -186,6 +187,7 @@ These data types are the heart of the compiler -- the meaning of /lifted/ vs. /unlifted/). -- -- See Note [CoreSyn let/app invariant] +-- See Note [Levity polymorphism invariants] -- -- #type_let# -- We allow a /non-recursive/ let to bind a type variable, thus: @@ -199,7 +201,7 @@ These data types are the heart of the compiler -- in a Let expression, rather than at top level. We may want to revist -- this choice. -- --- * Case split. Operationally this corresponds to evaluating +-- * Case expression. Operationally this corresponds to evaluating -- the scrutinee (expression examined) to weak head normal form -- and then examining at most one level of resulting constructor (i.e. you -- cannot do nested pattern matching directly with this). @@ -381,6 +383,19 @@ Note [CoreSyn case invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ See #case_invariants# +Note [Levity polymorphism invariants] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The levity-polymorphism invariants are these: + +* The type of a term-binder must not be levity-polymorphic +* The type of the argument of an App must not be levity-polymorphic. + +A type (t::TYPE r) is "levity polymorphic" if 'r' has any free variables. + +For example + (\(r::RuntimeRep). \(a::TYPE r). \(x::a). e +is illegal because x's type has kind (TYPE r), which has 'r' free. + Note [CoreSyn let goal] ~~~~~~~~~~~~~~~~~~~~~~~ * The simplifier tries to ensure that if the RHS of a let is a constructor diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 099502d..d31ed3a 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -142,7 +142,7 @@ module TcType ( mkClassPred, isDictLikeTy, tcSplitDFunTy, tcSplitDFunHead, tcSplitMethodTy, - isRuntimeRepVar, isRuntimeRepPolymorphic, + isRuntimeRepVar, isLevityPolymorphic, isVisibleBinder, isInvisibleBinder, -- Type substitutions diff --git a/compiler/types/Kind.hs b/compiler/types/Kind.hs index c31169e..4db98fc 100644 --- a/compiler/types/Kind.hs +++ b/compiler/types/Kind.hs @@ -14,7 +14,7 @@ module Kind ( classifiesTypeWithValues, isStarKind, isStarKindSynonymTyCon, - isRuntimeRepPolymorphic + isLevityPolymorphic ) where #include "HsVersions.h" @@ -77,10 +77,10 @@ returnsTyCon _ _ = False returnsConstraintKind :: Kind -> Bool returnsConstraintKind = returnsTyCon constraintKindTyConKey --- | Tests whether the given type (which should look like "TYPE ...") has any --- free variables -isRuntimeRepPolymorphic :: Kind -> Bool -isRuntimeRepPolymorphic k +-- | Tests whether the given kind (which should look like "TYPE ...") +-- has any free variables +isLevityPolymorphic :: Kind -> Bool +isLevityPolymorphic k = not $ isEmptyVarSet $ tyCoVarsOfType k -------------------------------------------- From git at git.haskell.org Wed Nov 30 15:56:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 15:56:33 +0000 (UTC) Subject: [commit: ghc] master: Revert "Make globals use sharedCAF" (e2330b6) Message-ID: <20161130155633.AD2043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e2330b6dde805a5507898c3c4ddf38599df969da/ghc >--------------------------------------------------------------- commit e2330b6dde805a5507898c3c4ddf38599df969da Author: Ben Gamari Date: Wed Nov 30 10:54:45 2016 -0500 Revert "Make globals use sharedCAF" This reverts commit 6f7ed1e51bf360621a3c2a447045ab3012f68575 due to breakage of the build on Windows. >--------------------------------------------------------------- e2330b6dde805a5507898c3c4ddf38599df969da compiler/HsVersions.h | 16 ----- compiler/ghci/Linker.hs | 44 ++++++------ compiler/main/DynFlags.hs | 15 ---- compiler/main/StaticFlags.hs | 20 +----- compiler/simplCore/CoreMonad.hs | 75 ++++++++++++++++++-- compiler/utils/FastString.hs | 7 ++ compiler/utils/Util.hs | 34 ---------- docs/users_guide/extending_ghc.rst | 13 ++++ includes/rts/Globals.h | 27 +++----- libraries/base/GHC/Conc/Sync.hs | 2 +- rts/Globals.c | 79 +++++++++++++++------- testsuite/tests/plugins/LinkerTicklingPlugin.hs | 4 +- .../tests/plugins/annotation-plugin/SayAnnNames.hs | 1 + .../should_compile/T7702plugin/T7702Plugin.hs | 1 + 14 files changed, 182 insertions(+), 156 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 e2330b6dde805a5507898c3c4ddf38599df969da From git at git.haskell.org Wed Nov 30 19:53:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 30 Nov 2016 19:53:32 +0000 (UTC) Subject: [commit: ghc] master: Revert "Fix windows validate." (c2a2911) Message-ID: <20161130195332.B86743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2a2911fe6c9047bc078bb0b370c6a90454cde55/ghc >--------------------------------------------------------------- commit c2a2911fe6c9047bc078bb0b370c6a90454cde55 Author: Tamar Christina Date: Wed Nov 30 19:51:43 2016 +0000 Revert "Fix windows validate." This reverts commit ef37580d16a23d1601795548b13b88b9f5373010. Now that commit e2330b6dde805a5507898c3c4ddf38599df969da has been reverted this change is now needed. >--------------------------------------------------------------- c2a2911fe6c9047bc078bb0b370c6a90454cde55 compiler/main/DynFlags.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index f56ec63..30bfa5e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -220,6 +220,7 @@ import System.Console.Terminfo (SetupTermError, Terminal, getCapability, setupTermFromEnv, termColors) import System.Posix (queryTerminal, stdError) #elif defined mingw32_HOST_OS +import Foreign (Ptr, with, peek) import System.Environment (lookupEnv) import qualified Graphics.Win32 as Win32 #endif