From git at git.haskell.org Fri Sep 1 04:08:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 04:08:20 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: more workarounds (afc55a4) Message-ID: <20170901040820.07E783A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/afc55a495da59e6b3402e3f59010e03fb742cff8/ghc >--------------------------------------------------------------- commit afc55a495da59e6b3402e3f59010e03fb742cff8 Author: Kavon Farvardin Date: Thu Aug 31 23:08:12 2017 -0500 more workarounds >--------------------------------------------------------------- afc55a495da59e6b3402e3f59010e03fb742cff8 compiler/main/DriverPipeline.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index f885424..a65fff9 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1517,8 +1517,13 @@ runPhase (RealPhaseWithInfo mangInfo LlvmLlc) input_fn dflags return (doNext, output_fn) where - -- TODO(kavon): temporary - cpscall_workaround = ["-disable-machine-cse", "-enable-shrink-wrap=false"] + -- TODO(kavon): These workarounds are temporary until I fix them in LLVM. + -- + -- * Disabling CSE and LICM are related to constants spills (ghc-llvm issue #11) + -- * Disabling shrink wrapping is related to inserting prologues at each return point + -- for stack alignment purposes. + -- * Disabling jump-table switches is discussed in ghc-llvm issue #20. + cpscall_workaround = ["-disable-machine-cse", "-disable-machine-licm", "-enable-shrink-wrap=false", "-min-jump-table-entries=1000"] -- Bug in LLVM at O3 on OSX. llvmOpts = if platformOS (targetPlatform dflags) == OSDarwin From git at git.haskell.org Fri Sep 1 14:03:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 14:03:37 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (8b128ae) Message-ID: <20170901140337.650233A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/8b128aeac3b2d615a4478a07102d993ae907791e/ghc >--------------------------------------------------------------- commit 8b128aeac3b2d615a4478a07102d993ae907791e Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 8b128aeac3b2d615a4478a07102d993ae907791e compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/SimplCore.hs | 17 ++++++++++------- compiler/simplCore/SimplUtils.hs | 6 ++++-- compiler/simplCore/Simplify.hs | 5 +++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 3cb23cb..993b904 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -173,19 +173,22 @@ data SimplifierMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplifierMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index c699478..1207089 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -141,19 +141,22 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index bdbd6a1..62e80ac 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -713,7 +713,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1065,7 +1067,7 @@ preInlineUnconditionally dflags env top_lvl bndr rhs | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | not (gopt Opt_SimplPreInlining dflags) = False | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode, isExitJoinId bndr = False | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 5582419..29b5433 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3354,8 +3354,9 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplUnfolding env top_lvl cont_mb id unf - | isExitJoinId id -- Do not inline exit join points - = return unf + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id + = return unf -- Do not inline exit join points | otherwise = is_bottoming `seq` -- See Note [Force bottoming field] do { dflags <- getDynFlags From git at git.haskell.org Fri Sep 1 14:58:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 14:58:31 +0000 (UTC) Subject: [commit: ghc] master: Improve stm haddocks (dd643bc) Message-ID: <20170901145831.317FE3A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd643bcc970ac59507cab3b464905050d013b071/ghc >--------------------------------------------------------------- commit dd643bcc970ac59507cab3b464905050d013b071 Author: Ben Gamari Date: Thu Aug 31 16:40:28 2017 -0400 Improve stm haddocks While looking at #14171 I noticed these readability issues. Fix them. >--------------------------------------------------------------- dd643bcc970ac59507cab3b464905050d013b071 libraries/base/GHC/Conc/Sync.hs | 59 ++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs index f9514d6..06da99b 100644 --- a/libraries/base/GHC/Conc/Sync.hs +++ b/libraries/base/GHC/Conc/Sync.hs @@ -487,7 +487,7 @@ myThreadId = IO $ \s -> case (myThreadId# s) of (# s1, tid #) -> (# s1, ThreadId tid #) --- |The 'yield' action allows (forces, in a co-operative multitasking +-- | The 'yield' action allows (forces, in a co-operative multitasking -- implementation) a context-switch to any other currently runnable -- threads (if any), and is occasionally useful when implementing -- concurrency abstractions. @@ -591,7 +591,7 @@ threadStatus (ThreadId t) = IO $ \s -> mk_stat 17 = ThreadDied mk_stat _ = ThreadBlocked BlockedOnOther --- | returns the number of the capability on which the thread is currently +-- | Returns the number of the capability on which the thread is currently -- running, and a boolean indicating whether the thread is locked to -- that capability or not. A thread is locked to a capability if it -- was created with @forkOn at . @@ -602,7 +602,7 @@ threadCapability (ThreadId t) = IO $ \s -> case threadStatus# t s of (# s', _, cap#, locked# #) -> (# s', (I# cap#, isTrue# (locked# /=# 0#)) #) --- | make a weak pointer to a 'ThreadId'. It can be important to do +-- | Make a weak pointer to a 'ThreadId'. It can be important to do -- this if you want to hold a reference to a 'ThreadId' while still -- allowing the thread to receive the @BlockedIndefinitely@ family of -- exceptions (e.g. 'BlockedIndefinitelyOnMVar'). Holding a normal @@ -714,7 +714,7 @@ instance MonadPlus STM unsafeIOToSTM :: IO a -> STM a unsafeIOToSTM (IO m) = STM m --- |Perform a series of STM actions atomically. +-- | Perform a series of STM actions atomically. -- -- You cannot use 'atomically' inside an 'unsafePerformIO' or 'unsafeInterleaveIO'. -- Any attempt to do so will result in a runtime error. (Reason: allowing @@ -727,19 +727,20 @@ unsafeIOToSTM (IO m) = STM m atomically :: STM a -> IO a atomically (STM m) = IO (\s -> (atomically# m) s ) --- |Retry execution of the current memory transaction because it has seen --- values in TVars which mean that it should not continue (e.g. the TVars +-- | Retry execution of the current memory transaction because it has seen +-- values in 'TVar's which mean that it should not continue (e.g. the 'TVar's -- represent a shared buffer that is now empty). The implementation may --- block the thread until one of the TVars that it has read from has been +-- block the thread until one of the 'TVar's that it has read from has been -- updated. (GHC only) retry :: STM a retry = STM $ \s# -> retry# s# --- |Compose two alternative STM actions (GHC only). If the first action --- completes without retrying then it forms the result of the orElse. --- Otherwise, if the first action retries, then the second action is --- tried in its place. If both actions retry then the orElse as a --- whole retries. +-- | Compose two alternative STM actions (GHC only). +-- +-- If the first action completes without retrying then it forms the result of +-- the 'orElse'. Otherwise, if the first action retries, then the second action +-- is tried in its place. If both actions retry then the 'orElse' as a whole +-- retries. orElse :: STM a -> STM a -> STM a orElse (STM m) e = STM $ \s -> catchRetry# m (unSTM e) s @@ -772,16 +773,17 @@ catchSTM (STM m) handler = STM $ catchSTM# m handler' Just e' -> unSTM (handler e') Nothing -> raiseIO# e --- | Low-level primitive on which always and alwaysSucceeds are built. --- checkInv differs form these in that (i) the invariant is not --- checked when checkInv is called, only at the end of this and --- subsequent transcations, (ii) the invariant failure is indicated --- by raising an exception. +-- | Low-level primitive on which 'always' and 'alwaysSucceeds' are built. +-- 'checkInv' differs from these in that, +-- +-- 1. the invariant is not checked when 'checkInv' is called, only at the end of +-- this and subsequent transactions +-- 2. the invariant failure is indicated by raising an exception. checkInv :: STM a -> STM () checkInv (STM m) = STM (\s -> case (check# m) s of s' -> (# s', () #)) --- | alwaysSucceeds adds a new invariant that must be true when passed --- to alwaysSucceeds, at the end of the current transaction, and at +-- | 'alwaysSucceeds' adds a new invariant that must be true when passed +-- to 'alwaysSucceeds', at the end of the current transaction, and at -- the end of every subsequent transaction. If it fails at any -- of those points then the transaction violating it is aborted -- and the exception raised by the invariant is propagated. @@ -789,9 +791,9 @@ alwaysSucceeds :: STM a -> STM () alwaysSucceeds i = do ( i >> retry ) `orElse` ( return () ) checkInv i --- | always is a variant of alwaysSucceeds in which the invariant is --- expressed as an STM Bool action that must return True. Returning --- False or raising an exception are both treated as invariant failures. +-- | 'always' is a variant of 'alwaysSucceeds' in which the invariant is +-- expressed as an @STM Bool@ action that must return @True at . Returning +-- @False@ or raising an exception are both treated as invariant failures. always :: STM Bool -> STM () always i = alwaysSucceeds ( do v <- i if (v) then return () else ( errorWithoutStackTrace "Transactional invariant violation" ) ) @@ -803,13 +805,13 @@ data TVar a = TVar (TVar# RealWorld a) instance Eq (TVar a) where (TVar tvar1#) == (TVar tvar2#) = isTrue# (sameTVar# tvar1# tvar2#) --- |Create a new TVar holding a value supplied +-- | Create a new 'TVar' holding a value supplied newTVar :: a -> STM (TVar a) newTVar val = STM $ \s1# -> case newTVar# val s1# of (# s2#, tvar# #) -> (# s2#, TVar tvar# #) --- |@IO@ version of 'newTVar'. This is useful for creating top-level +-- | @IO@ version of 'newTVar'. This is useful for creating top-level -- 'TVar's using 'System.IO.Unsafe.unsafePerformIO', because using -- 'atomically' inside 'System.IO.Unsafe.unsafePerformIO' isn't -- possible. @@ -818,7 +820,7 @@ newTVarIO val = IO $ \s1# -> case newTVar# val s1# of (# s2#, tvar# #) -> (# s2#, TVar tvar# #) --- |Return the current value stored in a TVar. +-- | Return the current value stored in a 'TVar'. -- This is equivalent to -- -- > readTVarIO = atomically . readTVar @@ -828,11 +830,11 @@ newTVarIO val = IO $ \s1# -> readTVarIO :: TVar a -> IO a readTVarIO (TVar tvar#) = IO $ \s# -> readTVarIO# tvar# s# --- |Return the current value stored in a TVar +-- |Return the current value stored in a 'TVar'. readTVar :: TVar a -> STM a readTVar (TVar tvar#) = STM $ \s# -> readTVar# tvar# s# --- |Write the supplied value into a TVar +-- |Write the supplied value into a 'TVar'. writeTVar :: TVar a -> a -> STM () writeTVar (TVar tvar#) val = STM $ \s1# -> case writeTVar# tvar# val s1# of @@ -842,6 +844,8 @@ writeTVar (TVar tvar#) val = STM $ \s1# -> -- MVar utilities ----------------------------------------------------------------------------- +-- | Provide an 'IO' action with the current value of an 'MVar'. The 'MVar' +-- will be empty for the duration that the action is running. withMVar :: MVar a -> (a -> IO b) -> IO b withMVar m io = mask $ \restore -> do @@ -851,6 +855,7 @@ withMVar m io = putMVar m a return b +-- | Modify the value of an 'MVar'. modifyMVar_ :: MVar a -> (a -> IO a) -> IO () modifyMVar_ m io = mask $ \restore -> do From git at git.haskell.org Fri Sep 1 14:58:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 14:58:33 +0000 (UTC) Subject: [commit: ghc] master: Fix order of PrelRule (1f052c5) Message-ID: <20170901145833.E56353A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1f052c50c1bcdfb838774eba5a83ae95a54f4702/ghc >--------------------------------------------------------------- commit 1f052c50c1bcdfb838774eba5a83ae95a54f4702 Author: Ben Gamari Date: Fri Sep 1 10:52:34 2017 -0400 Fix order of PrelRule Test Plan: Added testcase in D3905. Reviewers: austin Subscribers: angerman, rwbarton, thomie GHC Trac Issues: #14178 Differential Revision: https://phabricator.haskell.org/D3904 >--------------------------------------------------------------- 1f052c50c1bcdfb838774eba5a83ae95a54f4702 compiler/prelude/PrelRules.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index 2dbc5e8..8ee0f82 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -1423,7 +1423,7 @@ caseRules dflags (App (App (Var f) (Lit l)) v) -- x# `op` v , Just x <- isLitValue_maybe l , Just adjust_lit <- adjustDyadicLeft x op = Just (v, tx_lit_con dflags adjust_lit - , \v -> (App (App (Var f) (Var v)) (Lit l))) + , \v -> (App (App (Var f) (Lit l)) (Var v))) caseRules dflags (App (Var f) v ) -- op v From git at git.haskell.org Fri Sep 1 14:58:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 14:58:37 +0000 (UTC) Subject: [commit: ghc] master: Add testcase for #14178 (8a1de42) Message-ID: <20170901145837.1D4AD3A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a1de424143f5b75e12976ca739e58fe04ae04d6/ghc >--------------------------------------------------------------- commit 8a1de424143f5b75e12976ca739e58fe04ae04d6 Author: Ben Gamari Date: Fri Sep 1 10:52:47 2017 -0400 Add testcase for #14178 Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14178 Differential Revision: https://phabricator.haskell.org/D3905 >--------------------------------------------------------------- 8a1de424143f5b75e12976ca739e58fe04ae04d6 testsuite/tests/simplCore/should_run/T14178.hs | 33 ++++++++++++++++++++++ .../should_run/T14178.stdout} | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 3 files changed, 35 insertions(+) diff --git a/testsuite/tests/simplCore/should_run/T14178.hs b/testsuite/tests/simplCore/should_run/T14178.hs new file mode 100644 index 0000000..ef76324 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T14178.hs @@ -0,0 +1,33 @@ +import System.Exit +import Control.Monad.Trans.State.Strict + +eval :: Int -> State Int a -> a +eval p = fst . flip runState p + +advance :: Int -> State Int () +advance = modify' . (+) + +loc :: State Int Int +loc = get + +emit1 :: State Int () +emit1 = advance 1 + +emitN :: Int -> State Int () +-- adding in the 0 case, breaks with HEAD. 8.2.1 is fine with it. +-- emitN 0 = advance 0 +emitN 0 = pure () +emitN n = advance n + +align8 :: State Int () +align8 = do + bits <- (`mod` 8) <$> loc + emitN (8 - bits) + +main :: IO () +main = do + let p = eval 0 (emit1 >> align8 >> loc) + putStrLn $ show p + if p == 8 + then putStrLn "OK" >> exitSuccess + else putStrLn "FAIL" >> exitFailure diff --git a/testsuite/tests/driver/T11763.stdout b/testsuite/tests/simplCore/should_run/T14178.stdout similarity index 60% copy from testsuite/tests/driver/T11763.stdout copy to testsuite/tests/simplCore/should_run/T14178.stdout index d86bac9..f91f66e 100644 --- a/testsuite/tests/driver/T11763.stdout +++ b/testsuite/tests/simplCore/should_run/T14178.stdout @@ -1 +1,2 @@ +8 OK diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 75ff431..4ba5a71 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -77,3 +77,4 @@ test('T13733', expect_broken(13733), compile_and_run, ['']) test('T13429', normal, compile_and_run, ['']) test('T13429_2', normal, compile_and_run, ['']) test('T13750', normal, compile_and_run, ['']) +test('T14178', normal, compile_and_run, ['']) From git at git.haskell.org Fri Sep 1 15:37:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 15:37:38 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: undebug (110efc6) Message-ID: <20170901153738.078503A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/110efc64df920234024e1282a357b0f4ad7e2614/ghc >--------------------------------------------------------------- commit 110efc64df920234024e1282a357b0f4ad7e2614 Author: Ben Gamari Date: Sat Aug 19 10:37:22 2017 -0400 undebug >--------------------------------------------------------------- 110efc64df920234024e1282a357b0f4ad7e2614 Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1103e80..9f4118f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -159,8 +159,6 @@ def buildGhc(params) { String makeCmd = params?.makeCmd ?: 'make' withGhcSrcDist() { - echo "${targetTriple}" - echo "${params}" stage('Configure') { sh 'echo $PATH' sh "which ghc" From git at git.haskell.org Fri Sep 1 15:37:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 15:37:43 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Fix package names (1c4a912) Message-ID: <20170901153743.7C9773A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/1c4a912883abbe571b63385499d2b0864800da35/ghc >--------------------------------------------------------------- commit 1c4a912883abbe571b63385499d2b0864800da35 Author: Ben Gamari Date: Fri Sep 1 11:37:14 2017 -0400 Fix package names >--------------------------------------------------------------- 1c4a912883abbe571b63385499d2b0864800da35 Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e55a89..6bbe333 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ * Pipeline Utility steps plugin Linux (Debian) worker dependencies: - * xutil-dev curl automake autoconf libtool python3 python3-sphinx, llvm-4.0 + * xutils-dev curl automake autoconf libtool python3 python3-sphinx llvm-4.0 Requires approvals for: * new net.sf.json.JSONObject From git at git.haskell.org Fri Sep 1 15:37:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 15:37:40 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Don't test unregisterised aarch64 (1774e10) Message-ID: <20170901153740.B76C83A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/1774e10c480bbe4d24ad47908dcb5ec94fd07a51/ghc >--------------------------------------------------------------- commit 1774e10c480bbe4d24ad47908dcb5ec94fd07a51 Author: Ben Gamari Date: Sat Aug 19 10:37:26 2017 -0400 Don't test unregisterised aarch64 >--------------------------------------------------------------- 1774e10c480bbe4d24ad47908dcb5ec94fd07a51 Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f4118f..3e55a89 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ parallel ( } }, "linux x86-64 -> aarch64 unreg" : { - node(label: 'linux && amd64') {buildAndTestGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu', unreg: true)} + node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu', unreg: true)} }, "linux x86-64 -> aarch64" : { node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu')} From git at git.haskell.org Fri Sep 1 15:37:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 15:37:46 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Don't remove temporary directories (5c65d49) Message-ID: <20170901153746.391FD3A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/5c65d49f38d0dde9fc38848da002de59a08485ff/ghc >--------------------------------------------------------------- commit 5c65d49f38d0dde9fc38848da002de59a08485ff Author: Ben Gamari Date: Fri Sep 1 11:37:19 2017 -0400 Don't remove temporary directories >--------------------------------------------------------------- 5c65d49f38d0dde9fc38848da002de59a08485ff Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6bbe333..28c30d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -234,7 +234,7 @@ def withTempDir(String name, Closure f) { f() } } finally { - sh "rm -Rf ${name}" + //sh "rm -Rf ${name}" } } From git at git.haskell.org Fri Sep 1 16:58:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 16:58:37 +0000 (UTC) Subject: [commit: ghc] master: Remove broken citeseer citation links (f089c32) Message-ID: <20170901165837.8E3943A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f089c32693ffbd83662102c0a0e299426caef05c/ghc >--------------------------------------------------------------- commit f089c32693ffbd83662102c0a0e299426caef05c Author: Chris Martin Date: Tue Aug 29 17:32:17 2017 -0400 Remove broken citeseer citation links >--------------------------------------------------------------- f089c32693ffbd83662102c0a0e299426caef05c docs/users_guide/bugs.rst | 2 +- docs/users_guide/glasgow_exts.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst index f139db1..7d41d87 100644 --- a/docs/users_guide/bugs.rst +++ b/docs/users_guide/bugs.rst @@ -143,7 +143,7 @@ group is generalised (`Haskell Report, Section 4.5.2 `__). Following a suggestion of Mark Jones, in his paper `Typing Haskell in -Haskell `__, GHC implements a +Haskell `__, GHC implements a more general scheme. In GHC *the dependency analysis ignores references to variables that have an explicit type signature*. As a result of this refined dependency analysis, the dependency groups are smaller, and more bindings will diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 672670e..59d5934 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -5730,7 +5730,7 @@ More documentation can be found in the `Haskell Wiki .. [Jones2000] "`Type Classes with Functional - Dependencies `__", + Dependencies `__", Mark P. Jones, In *Proceedings of the 9th European Symposium on Programming*, ESOP 2000, Berlin, Germany, March 2000, Springer-Verlag LNCS 1782, . From git at git.haskell.org Fri Sep 1 20:17:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 20:17:30 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Disable cross compilation for now (af4939a) Message-ID: <20170901201730.AFC383A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/af4939aca6c0b2bc22026c82587e2a9aed845a9a/ghc >--------------------------------------------------------------- commit af4939aca6c0b2bc22026c82587e2a9aed845a9a Author: Ben Gamari Date: Fri Sep 1 16:17:12 2017 -0400 Disable cross compilation for now >--------------------------------------------------------------- af4939aca6c0b2bc22026c82587e2a9aed845a9a Jenkinsfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 28c30d9..cec4c38 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,13 +71,13 @@ parallel ( } } }, - "linux x86-64 -> aarch64 unreg" : { - node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu', unreg: true)} - }, - "linux x86-64 -> aarch64" : { - node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu')} - node(label: 'linux && aarch64') {testGhc(targetTriple: 'aarch64-linux-gnu')} - }, + //"linux x86-64 -> aarch64 unreg" : { + // node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu', unreg: true)} + //}, + //"linux x86-64 -> aarch64" : { + // node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu')} + // node(label: 'linux && aarch64') {testGhc(targetTriple: 'aarch64-linux-gnu')} + //}, "aarch64" : { node(label: 'linux && aarch64') {buildGhc(targetTriple: 'aarch64-linux-gnu')} }, From git at git.haskell.org Fri Sep 1 21:59:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 21:59:24 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Rename comparison to collect_stats and fix minor issues related to phab review (5534803) Message-ID: <20170901215924.75B653A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/5534803e1d793dd263f409641da5816f0162dc31/ghc >--------------------------------------------------------------- commit 5534803e1d793dd263f409641da5816f0162dc31 Author: Jared Weakly Date: Fri Sep 1 13:27:59 2017 -0700 Rename comparison to collect_stats and fix minor issues related to phab review >--------------------------------------------------------------- 5534803e1d793dd263f409641da5816f0162dc31 libraries/base/tests/all.T | 7 +- testsuite/driver/perf_notes.py | 31 ++++----- testsuite/driver/runtests.py | 4 +- testsuite/driver/testglobals.py | 4 +- testsuite/driver/testlib.py | 21 +++--- testsuite/tests/callarity/perf/all.T | 3 +- testsuite/tests/deriving/perf/all.T | 3 +- testsuite/tests/perf/compiler/all.T | 89 +++++++++++++------------- testsuite/tests/perf/haddock/all.T | 7 +- testsuite/tests/perf/join_points/all.T | 9 +-- testsuite/tests/perf/should_run/all.T | 85 ++++++++++++------------ testsuite/tests/perf/space_leaks/all.T | 13 ++-- testsuite/tests/primops/should_run/all.T | 3 +- testsuite/tests/simplCore/should_compile/all.T | 2 +- testsuite/tests/simplStg/should_run/all.T | 3 +- 15 files changed, 148 insertions(+), 136 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 5534803e1d793dd263f409641da5816f0162dc31 From git at git.haskell.org Fri Sep 1 21:59:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Sep 2017 21:59:27 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Add more documentation and a README to the testsuite driver. (94aa273) Message-ID: <20170901215927.9451F3A5C1@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/94aa273523b5dcec69d4e0d17ad063f502097c5b/ghc >--------------------------------------------------------------- commit 94aa273523b5dcec69d4e0d17ad063f502097c5b Author: Jared Weakly Date: Fri Sep 1 14:53:27 2017 -0700 Add more documentation and a README to the testsuite driver. Additionally, add the modified make file that was left out of the last commit by mistake. >--------------------------------------------------------------- 94aa273523b5dcec69d4e0d17ad063f502097c5b testsuite/driver/README.md | 80 +++++++++++++++++++++++++++++++++++++++++ testsuite/driver/perf_notes.py | 60 ++++++++++++++++++++++++------- testsuite/driver/runtests.py | 5 +-- testsuite/driver/testglobals.py | 5 ++- testsuite/driver/testutil.py | 11 ++++-- testsuite/mk/test.mk | 4 --- 6 files changed, 140 insertions(+), 25 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 94aa273523b5dcec69d4e0d17ad063f502097c5b From git at git.haskell.org Sat Sep 2 11:14:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 11:14:31 +0000 (UTC) Subject: [commit: ghc] master: Update transformers submodule (590e737) Message-ID: <20170902111431.8F6543A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/590e7376de357a61555181d78f5201cf2f503aa5/ghc >--------------------------------------------------------------- commit 590e7376de357a61555181d78f5201cf2f503aa5 Author: Herbert Valerio Riedel Date: Sat Sep 2 10:24:39 2017 +0200 Update transformers submodule This updates `transformers` from the v0.5.2 release to the v0.5.4 release + unreleased changes This is a pre-requisite for the Semigroup=>Monoid implementation >--------------------------------------------------------------- 590e7376de357a61555181d78f5201cf2f503aa5 libraries/transformers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/transformers b/libraries/transformers index 10348c4..36311d3 160000 --- a/libraries/transformers +++ b/libraries/transformers @@ -1 +1 @@ -Subproject commit 10348c4bbf60debbfc82463e1035aca1cb7b51bc +Subproject commit 36311d39bc545261dab85d4a27af562db1868ed6 From git at git.haskell.org Sat Sep 2 19:34:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 19:34:51 +0000 (UTC) Subject: [commit: ghc] master: Document the intricacies of ForallC variable quantification better (6330b0b) Message-ID: <20170902193451.2E2333A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6330b0b0938bc7b27463b3bbfa0df661e4a966b1/ghc >--------------------------------------------------------------- commit 6330b0b0938bc7b27463b3bbfa0df661e4a966b1 Author: Ryan Scott Date: Sat Sep 2 15:32:56 2017 -0400 Document the intricacies of ForallC variable quantification better Summary: I recently (re-)discovered that `ForallC` quantifies different type variables depending on whether `GadtC` is present or not. This is an important enough gotcha where I feel like this fact should also be advertised in the `template-haskell` documentation itself, so this patch does just that. Test Plan: Read it Reviewers: goldfire, austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13885 Differential Revision: https://phabricator.haskell.org/D3880 >--------------------------------------------------------------- 6330b0b0938bc7b27463b3bbfa0df661e4a966b1 .../template-haskell/Language/Haskell/TH/Syntax.hs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index aacc8c3..3087c69 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -1833,6 +1833,35 @@ data DecidedStrictness = DecidedLazy | DecidedUnpack deriving (Show, Eq, Ord, Data, Generic) +-- | A single data constructor. +-- +-- The constructors for 'Con' can roughly be divided up into two categories: +-- those for constructors with \"vanilla\" syntax ('NormalC', 'RecC', and +-- 'InfixC'), and those for constructors with GADT syntax ('GadtC' and +-- 'RecGadtC'). The 'ForallC' constructor, which quantifies additional type +-- variables and class contexts, can surround either variety of constructor. +-- However, the type variables that it quantifies are different depending +-- on what constructor syntax is used: +-- +-- * If a 'ForallC' surrounds a constructor with vanilla syntax, then the +-- 'ForallC' will only quantify /existential/ type variables. For example: +-- +-- @ +-- data Foo a = forall b. MkFoo a b +-- @ +-- +-- In @MkFoo@, 'ForallC' will quantify @b@, but not @a at . +-- +-- * If a 'ForallC' surrounds a constructor with GADT syntax, then the +-- 'ForallC' will quantify /all/ type variables used in the constructor. +-- For example: +-- +-- @ +-- data Bar a b where +-- MkBar :: (a ~ b) => c -> MkBar a b +-- @ +-- +-- In @MkBar@, 'ForallC' will quantify @a@, @b@, and @c at . data Con = NormalC Name [BangType] -- ^ @C Int a@ | RecC Name [VarBangType] -- ^ @C { v :: Int, w :: a }@ | InfixC BangType Name BangType -- ^ @Int :+ a@ From git at git.haskell.org Sat Sep 2 19:34:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 19:34:55 +0000 (UTC) Subject: [commit: ghc] master: Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns (5dd6b13) Message-ID: <20170902193455.154C63A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5dd6b13c6e2942976aa3b5f4906ff7d0f959272d/ghc >--------------------------------------------------------------- commit 5dd6b13c6e2942976aa3b5f4906ff7d0f959272d Author: Ryan Scott Date: Sat Sep 2 15:33:11 2017 -0400 Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns Summary: GHC was allowing implicitly bidirectional pattern synonyms with bang patterns and irrefutable patterns in the RHS, like so: ```lang=haskell pattern StrictJust a = Just !a ``` This has multiple problems: 1. `Just !a` isn't a valid expression, so it feels strange to allow it in an implicitly bidirectional pattern synonym. 2. `StrictJust` doesn't provide the strictness properties one would expect from a strict constructor. (One could imagine a design where the `StrictJust` builder infers a bang pattern for its pattern variable, but accomplishing this inference in a way that accounts for all possible patterns on the RHS, including other pattern synonyms, is somewhat awkward, so we do not pursue this design.) We nip these issues in the bud by simply disallowing bang/irrefutable patterns on the RHS. Test Plan: make test TEST="T14112 unidir" Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #14112 Differential Revision: https://phabricator.haskell.org/D3896 >--------------------------------------------------------------- 5dd6b13c6e2942976aa3b5f4906ff7d0f959272d compiler/typecheck/TcPatSyn.hs | 32 +++++++++++++++++++----- docs/users_guide/8.4.1-notes.rst | 14 +++++++++++ docs/users_guide/glasgow_exts.rst | 15 +++++++++++ testsuite/tests/patsyn/should_fail/T14112.hs | 5 ++++ testsuite/tests/patsyn/should_fail/T14112.stderr | 7 ++++++ testsuite/tests/patsyn/should_fail/all.T | 1 + testsuite/tests/patsyn/should_fail/unidir.stderr | 4 ++- 7 files changed, 71 insertions(+), 7 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 5dd6b13c6e2942976aa3b5f4906ff7d0f959272d From git at git.haskell.org Sat Sep 2 19:34:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 19:34:57 +0000 (UTC) Subject: [commit: ghc] master: Fix #14167 by using isGadtSyntaxTyCon in more places (8e4229a) Message-ID: <20170902193457.D2CCE3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e4229ab3dc3e1717ad557ef00f3518da6b5c523/ghc >--------------------------------------------------------------- commit 8e4229ab3dc3e1717ad557ef00f3518da6b5c523 Author: Ryan Scott Date: Sat Sep 2 15:33:25 2017 -0400 Fix #14167 by using isGadtSyntaxTyCon in more places Summary: Two places in GHC effectively attempt to //guess// whether a data type was declared using GADT syntax: 1. When reifying a data type in Template Haskell 2. When pretty-printing a data type (e.g., via `:info` in GHCi) But there's no need for heuristics here, since we have a 100% accurate way to determine whether a data type was declared using GADT syntax: the `isGadtSyntaxTyCon` function! By simply using that as the metric, we obtain far more accurate TH reification and pretty-printing results. This is technically a breaking change, since Template Haskell reification will now reify some data type constructors as `(Rec)GadtC` that it didn't before, and some data type constructors that were previously reified as `(Rec)GadtC` will no longer be reified as such. But it's a very understandable breaking change, since the previous behavior was simply incorrect. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #14167 Differential Revision: https://phabricator.haskell.org/D3901 >--------------------------------------------------------------- 8e4229ab3dc3e1717ad557ef00f3518da6b5c523 compiler/iface/IfaceSyn.hs | 49 ++++++++++------------ compiler/iface/IfaceType.hs | 9 +++- compiler/typecheck/TcSplice.hs | 34 ++------------- docs/users_guide/8.4.1-notes.rst | 6 +++ testsuite/tests/ghci/scripts/T7730.stdout | 3 +- testsuite/tests/ghci/scripts/T7873.stdout | 4 +- testsuite/tests/ghci/scripts/T9181.stdout | 30 +++++++------ testsuite/tests/ghci/scripts/ghci030.stdout | 8 +--- .../tests/rename/should_fail/rnfail055.stderr | 6 +-- testsuite/tests/th/T4188.stderr | 11 ++--- testsuite/tests/typecheck/should_fail/T3468.stderr | 3 +- 11 files changed, 70 insertions(+), 93 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 8e4229ab3dc3e1717ad557ef00f3518da6b5c523 From git at git.haskell.org Sat Sep 2 19:35:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 19:35:00 +0000 (UTC) Subject: [commit: ghc] master: Document the Generic(1) laws (0ec4376) Message-ID: <20170902193500.902DA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ec4376902ee88a77a9f2ac9f3c03a4432455320/ghc >--------------------------------------------------------------- commit 0ec4376902ee88a77a9f2ac9f3c03a4432455320 Author: Ryan Scott Date: Sat Sep 2 15:33:34 2017 -0400 Document the Generic(1) laws Summary: Some code that @dfeuer was writing implicitly depended on these laws, but they didn't appear to be enshrined in the Haddocks. Let's do so. Test Plan: Read it Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie, dfeuer Differential Revision: https://phabricator.haskell.org/D3908 >--------------------------------------------------------------- 0ec4376902ee88a77a9f2ac9f3c03a4432455320 libraries/base/GHC/Generics.hs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Generics.hs b/libraries/base/GHC/Generics.hs index d4e9583..5bc9c55 100644 --- a/libraries/base/GHC/Generics.hs +++ b/libraries/base/GHC/Generics.hs @@ -1147,8 +1147,15 @@ instance (SingI mn, SingI su, SingI ss, SingI ds) selSourceStrictness _ = fromSing (sing :: Sing ss) selDecidedStrictness _ = fromSing (sing :: Sing ds) --- | Representable types of kind *. --- This class is derivable in GHC with the DeriveGeneric flag on. +-- | Representable types of kind @*@. +-- This class is derivable in GHC with the @DeriveGeneric@ flag on. +-- +-- A 'Generic' instance must satisfy the following laws: +-- +-- @ +-- 'from' . 'to' ≡ 'id' +-- 'to' . 'from' ≡ 'id' +-- @ class Generic a where -- | Generic representation type type Rep a :: * -> * @@ -1161,6 +1168,13 @@ class Generic a where -- | Representable types of kind @* -> *@ (or kind @k -> *@, when @PolyKinds@ -- is enabled). -- This class is derivable in GHC with the @DeriveGeneric@ flag on. +-- +-- A 'Generic1' instance must satisfy the following laws: +-- +-- @ +-- 'from1' . 'to1' ≡ 'id' +-- 'to1' . 'from1' ≡ 'id' +-- @ class Generic1 (f :: k -> *) where -- | Generic representation type type Rep1 f :: k -> * From git at git.haskell.org Sat Sep 2 21:44:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:44:53 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Can now load up git note data into python (80194f0) Message-ID: <20170902214453.B5C833A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/80194f070b2be8d9f41c07d69a3c86962b7fbe12/ghc >--------------------------------------------------------------- commit 80194f070b2be8d9f41c07d69a3c86962b7fbe12 Author: Jared Weakly Date: Tue Jul 18 12:17:57 2017 -0700 Can now load up git note data into python >--------------------------------------------------------------- 80194f070b2be8d9f41c07d69a3c86962b7fbe12 testsuite/driver/runtests.py | 6 ++++-- testsuite/driver/testutil.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 30f320a..e102a94 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -306,8 +306,10 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) - print("Only perf tests: " + str(config.only_perf_tests) + "\n") - print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") + + if config.use_git_notes: + note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) + parse_git_notes('perf') # Should this be hardcoded? Most likely not... if config.summary_file: with open(config.summary_file, 'w') as file: diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index c6297ff..59906a0 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -47,9 +47,15 @@ def lndir(srcdir, dstdir): os.mkdir(dst) lndir(src, dst) -# def git_append(note): -# def print_metrics(): -# print(config.accumulate_metrics) +# This function allows one to read in git notes from the commandline +# and then breaks it into a list of dictionaries that can be parsed +# later on in the testing functions. +def parse_git_notes(namespace): + logFields = ['TEST_ENV','TEST','WAY','METRIC','VALUE'] + log = subprocess.check_output(['git', 'notes', '--ref=' + namespace, 'show']).decode('utf-8') + log = log.strip('\n').split('\n') + log = [entry.strip('\t').split('\t') for entry in log] + log = [dict(zip(logFields, row)) for row in log] # On Windows, os.symlink is not defined with Python 2.7, but is in Python 3 # when using msys2, as GHC does. Unfortunately, only Administrative users have From git at git.haskell.org Sat Sep 2 21:44:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:44:56 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Added initial metric comparison tooling (428a377) Message-ID: <20170902214456.720823A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/428a377ee7dfbc8d93a11119781b48677b762064/ghc >--------------------------------------------------------------- commit 428a377ee7dfbc8d93a11119781b48677b762064 Author: Jared Weakly Date: Thu Jul 20 17:30:21 2017 -0700 Added initial metric comparison tooling >--------------------------------------------------------------- 428a377ee7dfbc8d93a11119781b48677b762064 testsuite/driver/runtests.py | 9 +++------ testsuite/driver/testutil.py | 10 ++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 8d0b337..6e8a712 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -307,14 +307,11 @@ else: summary(t, sys.stdout, config.no_print_summary) - # This here is loading up all of the git notes into memory. - # It's most likely in the wrong spot and I haven't fully fleshed out - # where exactly I'm putting this and how I'm refactoring the performance - # test running logic. - # Currently this is useful for debugging, at least. + # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - parse_git_notes('perf') # Should this be hardcoded? Most likely not... + # v-- This is in a nonsensical area. It should be happening before all of the tests are even run. + # parse_git_notes('perf') # Should it even be happening in the test-driver logic anymore? if config.summary_file: with open(config.summary_file, 'w') as file: diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index 1fe1c20..bf9ed2a 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -3,7 +3,6 @@ import os import platform import subprocess import shutil - import threading def strip_quotes(s): @@ -50,14 +49,17 @@ def lndir(srcdir, dstdir): # This function allows one to read in git notes from the commandline # and then breaks it into a list of dictionaries that can be parsed # later on in the testing functions. -def parse_git_notes(namespace): +# I wanted to put it in perf_notes.py but couldn't figure out a nice way to do that. +def parse_git_notes(namespace, commits=['HEAD']): logFields = ['TEST_ENV','TEST','WAY','METRIC','VALUE'] - log = subprocess.check_output(['git', 'notes', '--ref=' + namespace, 'show']).decode('utf-8') + log = "" + for commit in commits: + log += subprocess.check_output(['git', 'notes', '--ref=' + namespace, 'show', commit]).decode('utf-8') + log = log.strip('\n').split('\n') log = [line.strip('\t').split('\t') for line in log] log = [dict(zip(logFields, field)) for field in log] return log - # Add a print statement here if you want to see what's being loaded from git notes. # On Windows, os.symlink is not defined with Python 2.7, but is in Python 3 # when using msys2, as GHC does. Unfortunately, only Administrative users have From git at git.haskell.org Sat Sep 2 21:44:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:44:59 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Can now load up git note data into python (d5a6c20) Message-ID: <20170902214459.3F8E23A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/d5a6c2080daf54624f422f00dd6c409181b11ae5/ghc >--------------------------------------------------------------- commit d5a6c2080daf54624f422f00dd6c409181b11ae5 Author: Jared Weakly Date: Tue Jul 18 12:17:57 2017 -0700 Can now load up git note data into python >--------------------------------------------------------------- d5a6c2080daf54624f422f00dd6c409181b11ae5 testsuite/driver/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 8d158f8..25643e9 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -306,8 +306,10 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) - print("Only perf tests: " + str(config.only_perf_tests) + "\n") - print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") + + if config.use_git_notes: + note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) + parse_git_notes('perf') # Should this be hardcoded? Most likely not... # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:45:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:02 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Initial tooling to compare across commits (but for actual this time) (1a07b1c) Message-ID: <20170902214502.4C5453A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/1a07b1cd1e43465fd1b8e4e0686e5597c732dad0/ghc >--------------------------------------------------------------- commit 1a07b1cd1e43465fd1b8e4e0686e5597c732dad0 Author: Jared Weakly Date: Thu Jul 20 17:43:27 2017 -0700 Initial tooling to compare across commits (but for actual this time) >--------------------------------------------------------------- 1a07b1cd1e43465fd1b8e4e0686e5597c732dad0 testsuite/driver/perf_notes.py | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py new file mode 100644 index 0000000..ea289fc --- /dev/null +++ b/testsuite/driver/perf_notes.py @@ -0,0 +1,85 @@ +#1/usr/bin/env python3 + +# +# (c) Jared Weakly 2017 +# +# This file will be a utility to help facilitate the comparison of performance +# metrics across arbitrary commits. The file will produce a table comparing +# metrics between measurements taken for given commits in the environment given +# by --test-env. +# +# The file will also (for now) exist as a library to import git-note +# functionality for the project into other files so everywhere has access to +# functions such as parse_git_notes. +# +# It will take a few arguments: +# --test-env= +# --test-name= (optional: If given, filters table to include only tests matching the given regular expression.) +# --min-delta= (optional: Display only tests where the relative spread is greater than the given value.) +# All following arguments will be the commits to compare. + +from __future__ import print_function + +# TODO: Actually figure out what imports I need. +import argparse +import re +import os +import string +import subprocess + +from testutil import parse_git_notes + +# --------- Comparison Utilities -------- # +parser = argparse.ArgumentParser() +parser.add_argument("--test-env", + help="The given test environment to be compared.") #, + # required=True) # Should I make this required? +parser.add_argument("--test-name", + help="Optional: If given, filters table to include only \ + tests matching the given regular expression.") +parser.add_argument("--min-delta", + help="Optional: Display only tests where the relative \ + spread is greater than the given value.") +parser.add_argument("commits", nargs=argparse.REMAINDER) + +args = parser.parse_args() + +# Defaults +env = 'local' +name = re.compile('.*') +metrics = [] + +# I should figure out a nice way to mark data with the commit it comes from +# so that I can display test performance numbers in order from oldest to newest commit. +if args.commits: + print(args.commits) + metrics = parse_git_notes('perf',args.commits) + +if args.test_env: + env = args.test_env + metrics = [test for test in metrics if test['TEST_ENV'] == env] + +if args.test_name: + name = re.compile(args.test_name) + metrics = [test for test in metrics if name.search(test.get('TEST',''))] + +# Logic should probably go here to sort, group, and otherwise prepare the list +# of dicts for being pretty printed. +print(metrics) + +# I'll redo this table almost entirely, it's just a proof of concept for now. +# Ideally the list of metrics should be grouped by same test and organized from oldest to newest commits +# and each test will have its own small paragraph. I'm envisioning something like: +# -------------------------------- +# Test Foo: test_env, test_way, metric +# --------------------------------- +# commit1 commit2 commit3 ... +# number1 number2 number3 ... +# +# Gosh, I want to just print a list of dictionaries pretty like but don't want to just add some random dependency... +# Table is hardcoded and pretty ugly, but... it works. +# For now, this table just pretty prints the list of dictionaries. +print("{:<12} {:<10} {:<10} {:<20} {:<15}".format('TEST_ENV','TEST','WAY','METRIC','VALUE')) +for key in metrics: + print("{:<12} {:<10} {:<10} {:<20} {:<15}" + .format(key['TEST_ENV'],key['TEST'],key['WAY'],key['METRIC'],key['VALUE'])) From git at git.haskell.org Sat Sep 2 21:45:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:05 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: ONLY_PERF_TESTS=YES now fully implemented (49403a8) Message-ID: <20170902214505.0B9E93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/49403a81e4511a3e0eaa5e4e5ab903dac73cebd8/ghc >--------------------------------------------------------------- commit 49403a81e4511a3e0eaa5e4e5ab903dac73cebd8 Author: Jared Weakly Date: Wed Jul 12 17:30:31 2017 -0700 ONLY_PERF_TESTS=YES now fully implemented >--------------------------------------------------------------- 49403a81e4511a3e0eaa5e4e5ab903dac73cebd8 testsuite/driver/runtests.py | 2 ++ testsuite/driver/testlib.py | 1 + 2 files changed, 3 insertions(+) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 3e03ed3..30f320a 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -306,6 +306,8 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) + print("Only perf tests: " + str(config.only_perf_tests) + "\n") + print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") if config.summary_file: with open(config.summary_file, 'w') as file: diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 0da86f2..45b44a5 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -714,6 +714,7 @@ def test_common_work(watcher, name, opts, func, args): and (getTestOpts().only_ways == None or way in getTestOpts().only_ways) \ and (config.cmdline_ways == [] or way in config.cmdline_ways) \ and (not (config.skip_perf_tests and isStatsTest())) \ + and (not (config.only_perf_tests and (not isStatsTest()))) \ and way not in getTestOpts().omit_ways # Which ways we are asked to skip From git at git.haskell.org Sat Sep 2 21:45:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:07 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (525a171) Message-ID: <20170902214507.BE7743A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/525a1712424cda67bfb7cbbab6a836eb689e813a/ghc >--------------------------------------------------------------- commit 525a1712424cda67bfb7cbbab6a836eb689e813a Author: Jared Weakly Date: Tue Jul 18 17:35:34 2017 -0700 Small changes to address Ben's comments Signed-off-by: Jared Weakly >--------------------------------------------------------------- 525a1712424cda67bfb7cbbab6a836eb689e813a testsuite/driver/runtests.py | 4 ---- testsuite/driver/testlib.py | 1 - 2 files changed, 5 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 25643e9..8d0b337 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -307,10 +307,6 @@ else: summary(t, sys.stdout, config.no_print_summary) - if config.use_git_notes: - note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - parse_git_notes('perf') # Should this be hardcoded? Most likely not... - # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out # where exactly I'm putting this and how I'm refactoring the performance diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a24ee6c..8fc3ed7 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,7 +1086,6 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): - full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:45:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:13 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Basic metrics collection and command line options working (70e07cf) Message-ID: <20170902214513.39AA53A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/70e07cf0e94c4c545adb91edec4d8877639c13db/ghc >--------------------------------------------------------------- commit 70e07cf0e94c4c545adb91edec4d8877639c13db Author: Jared Weakly Date: Thu Jul 6 17:16:49 2017 -0700 Basic metrics collection and command line options working >--------------------------------------------------------------- 70e07cf0e94c4c545adb91edec4d8877639c13db testsuite/driver/testlib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8fc3ed7..a24ee6c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,6 +1086,7 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): + full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:45:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:10 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (e0117dc) Message-ID: <20170902214510.7A5E73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/e0117dc3a4fb0a9152dda7aff4f9e38b879d5e20/ghc >--------------------------------------------------------------- commit e0117dc3a4fb0a9152dda7aff4f9e38b879d5e20 Author: Jared Weakly Date: Tue Jul 18 17:35:34 2017 -0700 Small changes to address Ben's comments Signed-off-by: Jared Weakly >--------------------------------------------------------------- e0117dc3a4fb0a9152dda7aff4f9e38b879d5e20 testsuite/driver/runtests.py | 5 +++++ testsuite/driver/testglobals.py | 2 +- testsuite/driver/testlib.py | 5 ++--- testsuite/driver/testutil.py | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index e102a94..8d0b337 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -307,6 +307,11 @@ else: summary(t, sys.stdout, config.no_print_summary) + # This here is loading up all of the git notes into memory. + # It's most likely in the wrong spot and I haven't fully fleshed out + # where exactly I'm putting this and how I'm refactoring the performance + # test running logic. + # Currently this is useful for debugging, at least. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) parse_git_notes('perf') # Should this be hardcoded? Most likely not... diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 5ed54bd..6d8cd3d 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -125,7 +125,7 @@ class TestConfig: # To accumulate the metrics for the git notes self.accumulate_metrics = [] # Has the user defined a custom test environment? Local is default. - self.TEST_ENV = 'local' + self.test_env = 'local' global config config = TestConfig() diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 45b44a5..8fc3ed7 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,7 +1086,6 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): - full_name = name + '(' + way + ')' result = passed() @@ -1112,8 +1111,8 @@ def checkStats(name, way, stats_file, range_fields): # Add val into the git note if option is set. if config.use_git_notes: - test_env = config.TEST_ENV - config.accumulate_metrics.append(test_env + '\t' + name + '\t' + way + '\t' + field + '\t' + str(val)) + test_env = config.test_env + config.accumulate_metrics.append('\t'.join([test_env, name, way, field, str(val)])) if val < lowerBound: print(field, 'value is too low:') diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index 59906a0..1fe1c20 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -54,8 +54,10 @@ def parse_git_notes(namespace): logFields = ['TEST_ENV','TEST','WAY','METRIC','VALUE'] log = subprocess.check_output(['git', 'notes', '--ref=' + namespace, 'show']).decode('utf-8') log = log.strip('\n').split('\n') - log = [entry.strip('\t').split('\t') for entry in log] - log = [dict(zip(logFields, row)) for row in log] + log = [line.strip('\t').split('\t') for line in log] + log = [dict(zip(logFields, field)) for field in log] + return log + # Add a print statement here if you want to see what's being loaded from git notes. # On Windows, os.symlink is not defined with Python 2.7, but is in Python 3 # when using msys2, as GHC does. Unfortunately, only Administrative users have From git at git.haskell.org Sat Sep 2 21:45:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:15 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Basic metrics collection and command line options working (0ae1afe) Message-ID: <20170902214515.EA3F93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/0ae1afe4bbb9cc0fe7916abafaf2fe2016607bb3/ghc >--------------------------------------------------------------- commit 0ae1afe4bbb9cc0fe7916abafaf2fe2016607bb3 Author: Jared Weakly Date: Thu Jul 6 17:16:49 2017 -0700 Basic metrics collection and command line options working >--------------------------------------------------------------- 0ae1afe4bbb9cc0fe7916abafaf2fe2016607bb3 testsuite/driver/testglobals.py | 11 ++++++++++- testsuite/driver/testlib.py | 6 ++++++ testsuite/driver/testutil.py | 4 ++++ testsuite/mk/test.mk | 12 ++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 5e7142d..5ed54bd 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -117,6 +117,16 @@ class TestConfig: # Should we skip performance tests self.skip_perf_tests = False + # Only do performance tests + self.only_perf_tests = False + + # Should we dump statistics to git notes? + self.use_git_notes = False + # To accumulate the metrics for the git notes + self.accumulate_metrics = [] + # Has the user defined a custom test environment? Local is default. + self.TEST_ENV = 'local' + global config config = TestConfig() @@ -284,4 +294,3 @@ default_testopts = TestOptions() # (bug, directory, name) of tests marked broken global brokens brokens = [] - diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 15c773e..0da86f2 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1085,6 +1085,7 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): + full_name = name + '(' + way + ')' result = passed() @@ -1108,6 +1109,11 @@ def checkStats(name, way, stats_file, range_fields): deviation = round(((float(val) * 100)/ expected) - 100, 1) + # Add val into the git note if option is set. + if config.use_git_notes: + test_env = config.TEST_ENV + config.accumulate_metrics.append(test_env + '\t' + name + '\t' + way + '\t' + field + '\t' + str(val)) + if val < lowerBound: print(field, 'value is too low:') print('(If this is because you have improved GHC, please') diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index dcba177..c6297ff 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -47,6 +47,10 @@ def lndir(srcdir, dstdir): os.mkdir(dst) lndir(src, dst) +# def git_append(note): +# def print_metrics(): +# print(config.accumulate_metrics) + # On Windows, os.symlink is not defined with Python 2.7, but is in Python 3 # when using msys2, as GHC does. Unfortunately, only Administrative users have # the privileges necessary to create symbolic links by default. Consequently we diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index a21c4bb..273b37b 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -195,6 +195,18 @@ ifeq "$(SKIP_PERF_TESTS)" "YES" RUNTEST_OPTS += --skip-perf-tests endif +ifeq "$(ONLY_PERF_TESTS)" "YES" +RUNTEST_OPTS += --only-perf-tests +endif + +ifeq "$(USE_GIT_NOTES)" "YES" +RUNTEST_OPTS += --use-git-notes +endif + +ifneq "$(TEST_ENV)" "" +RUNTEST_OPTS += --TEST_ENV="$(TEST_ENV)" +endif + ifeq "$(CLEANUP)" "0" RUNTEST_OPTS += -e config.cleanup=False else ifeq "$(CLEANUP)" "NO" From git at git.haskell.org Sat Sep 2 21:45:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:18 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: ONLY_PERF_TESTS=YES now fully implemented (1cc6b8e) Message-ID: <20170902214518.A353D3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/1cc6b8e591238a2f14d1a7671e634a3fb44d3373/ghc >--------------------------------------------------------------- commit 1cc6b8e591238a2f14d1a7671e634a3fb44d3373 Author: Jared Weakly Date: Wed Jul 12 17:30:31 2017 -0700 ONLY_PERF_TESTS=YES now fully implemented >--------------------------------------------------------------- 1cc6b8e591238a2f14d1a7671e634a3fb44d3373 testsuite/driver/runtests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 8d0b337..8d158f8 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -306,6 +306,8 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) + print("Only perf tests: " + str(config.only_perf_tests) + "\n") + print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:45:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:21 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: ONLY_PERF_TESTS=YES now fully implemented (e232d04) Message-ID: <20170902214521.619F23A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/e232d04ccd1c470a9b6f37ed6d6f1ce042e7a1c5/ghc >--------------------------------------------------------------- commit e232d04ccd1c470a9b6f37ed6d6f1ce042e7a1c5 Author: Jared Weakly Date: Wed Jul 12 17:30:31 2017 -0700 ONLY_PERF_TESTS=YES now fully implemented >--------------------------------------------------------------- e232d04ccd1c470a9b6f37ed6d6f1ce042e7a1c5 testsuite/driver/runtests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index fe7aa61..9351a3c 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -328,6 +328,8 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) + print("Only perf tests: " + str(config.only_perf_tests) + "\n") + print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:45:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:24 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: ONLY_PERF_TESTS=YES now fully implemented (4fd81a3) Message-ID: <20170902214524.1DDE33A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/4fd81a33f6034d13c0616cbd05c64e00f38fece2/ghc >--------------------------------------------------------------- commit 4fd81a33f6034d13c0616cbd05c64e00f38fece2 Author: Jared Weakly Date: Wed Jul 12 17:30:31 2017 -0700 ONLY_PERF_TESTS=YES now fully implemented >--------------------------------------------------------------- 4fd81a33f6034d13c0616cbd05c64e00f38fece2 testsuite/driver/runtests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 7e3dc9a..79433c0 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -328,6 +328,8 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) + print("Only perf tests: " + str(config.only_perf_tests) + "\n") + print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: From git at git.haskell.org Sat Sep 2 21:45:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:26 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Can now load up git note data into python (4ce5480) Message-ID: <20170902214526.D8D993A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/4ce5480488731e7d1d152dc5805de5a9233a820a/ghc >--------------------------------------------------------------- commit 4ce5480488731e7d1d152dc5805de5a9233a820a Author: Jared Weakly Date: Tue Jul 18 12:17:57 2017 -0700 Can now load up git note data into python >--------------------------------------------------------------- 4ce5480488731e7d1d152dc5805de5a9233a820a testsuite/driver/runtests.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 9351a3c..fe7aa61 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -328,8 +328,6 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) - print("Only perf tests: " + str(config.only_perf_tests) + "\n") - print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:45:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:29 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Cleaning up my trash code for the perf_notes comparison tool (04fa630) Message-ID: <20170902214529.9761A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/04fa63072bfdd4124452af67581f47e946263321/ghc >--------------------------------------------------------------- commit 04fa63072bfdd4124452af67581f47e946263321 Author: Jared Weakly Date: Sat Jul 22 20:48:48 2017 -0700 Cleaning up my trash code for the perf_notes comparison tool >--------------------------------------------------------------- 04fa63072bfdd4124452af67581f47e946263321 testsuite/driver/perf_notes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 060cc7b..4445596 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -7,6 +7,11 @@ # metrics across arbitrary commits. The file will produce a table comparing # metrics between measurements taken for given commits in the environment given # by --test-env. +<<<<<<< HEAD +======= + +from __future__ import print_function +>>>>>>> Cleaning up my trash code for the perf_notes comparison tool import argparse import re From git at git.haskell.org Sat Sep 2 21:45:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:32 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Can now load up git note data into python (002a313) Message-ID: <20170902214532.566C23A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/002a313bb87902302e4fcbb56adad842c81be5b2/ghc >--------------------------------------------------------------- commit 002a313bb87902302e4fcbb56adad842c81be5b2 Author: Jared Weakly Date: Tue Jul 18 12:17:57 2017 -0700 Can now load up git note data into python >--------------------------------------------------------------- 002a313bb87902302e4fcbb56adad842c81be5b2 testsuite/driver/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 9351a3c..0131c13 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -328,8 +328,10 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) - print("Only perf tests: " + str(config.only_perf_tests) + "\n") - print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") + + if config.use_git_notes: + note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) + parse_git_notes('perf') # Should this be hardcoded? Most likely not... # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:45:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:37 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: This should actually split things out this time (01c8587) Message-ID: <20170902214537.C8C383A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/01c8587738631c574dc6d201cc70ac3742af0c10/ghc >--------------------------------------------------------------- commit 01c8587738631c574dc6d201cc70ac3742af0c10 Author: Jared Weakly Date: Wed Jul 26 13:52:07 2017 -0700 This should actually split things out this time >--------------------------------------------------------------- 01c8587738631c574dc6d201cc70ac3742af0c10 testsuite/driver/runtests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index c200c21..7ebb900 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -6,7 +6,6 @@ from __future__ import print_function -import argparse import signal import sys import os From git at git.haskell.org Sat Sep 2 21:45:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:35 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Cleaning up my trash code for the perf_notes comparison tool (ce4f6cb) Message-ID: <20170902214535.1B96A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/ce4f6cb20d04e752c9c54f34855c55ecd8180488/ghc >--------------------------------------------------------------- commit ce4f6cb20d04e752c9c54f34855c55ecd8180488 Author: Jared Weakly Date: Sat Jul 22 20:48:48 2017 -0700 Cleaning up my trash code for the perf_notes comparison tool >--------------------------------------------------------------- ce4f6cb20d04e752c9c54f34855c55ecd8180488 testsuite/driver/perf_notes.py | 105 +++++++++++++---------------------------- 1 file changed, 34 insertions(+), 71 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 ce4f6cb20d04e752c9c54f34855c55ecd8180488 From git at git.haskell.org Sat Sep 2 21:45:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:40 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Clean up refactoring of stats_num_field (6e1d9be) Message-ID: <20170902214540.8BA9A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/6e1d9beb0b446f78cb2520fb3e65650c17ce87a7/ghc >--------------------------------------------------------------- commit 6e1d9beb0b446f78cb2520fb3e65650c17ce87a7 Author: Jared Weakly Date: Sun Aug 27 11:53:40 2017 -0700 Clean up refactoring of stats_num_field >--------------------------------------------------------------- 6e1d9beb0b446f78cb2520fb3e65650c17ce87a7 testsuite/driver/perf_notes.py | 68 ++++++++++++++++--------------------- testsuite/driver/runtests.py | 1 - testsuite/driver/testglobals.py | 5 ++- testsuite/driver/testlib.py | 74 ++++++++--------------------------------- 4 files changed, 47 insertions(+), 101 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 6e1d9beb0b446f78cb2520fb3e65650c17ce87a7 From git at git.haskell.org Sat Sep 2 21:45:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:43 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Changed perf_notes quite a bit. Should be much closer to actually usable now (3bceaad) Message-ID: <20170902214543.48A4A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/3bceaad3076067ce2e7b5f8fb0a178dc500ea8a7/ghc >--------------------------------------------------------------- commit 3bceaad3076067ce2e7b5f8fb0a178dc500ea8a7 Author: Jared Weakly Date: Sat Jul 22 20:18:22 2017 -0700 Changed perf_notes quite a bit. Should be much closer to actually usable now >--------------------------------------------------------------- 3bceaad3076067ce2e7b5f8fb0a178dc500ea8a7 testsuite/driver/runtests.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 8177b24..6e8a712 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -313,12 +313,6 @@ else: # v-- This is in a nonsensical area. It should be happening before all of the tests are even run. # parse_git_notes('perf') # Should it even be happening in the test-driver logic anymore? - # Write our accumulated metrics into the git notes for this commit. - if config.use_git_notes: - note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - # v-- This is in a nonsensical area. It should be happening before all of the tests are even run. - # parse_git_notes('perf') # Should it even be happening in the test-driver logic anymore? - if config.summary_file: with open(config.summary_file, 'w') as file: summary(t, file) From git at git.haskell.org Sat Sep 2 21:45:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:46 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: ONLY_PERF_TESTS=YES now fully implemented (3b05c15) Message-ID: <20170902214546.042A43A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/3b05c15e8abe6d63a8f5680362a57e92f7c5210b/ghc >--------------------------------------------------------------- commit 3b05c15e8abe6d63a8f5680362a57e92f7c5210b Author: Jared Weakly Date: Wed Jul 12 17:30:31 2017 -0700 ONLY_PERF_TESTS=YES now fully implemented >--------------------------------------------------------------- 3b05c15e8abe6d63a8f5680362a57e92f7c5210b testsuite/driver/runtests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index fe7aa61..9351a3c 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -328,6 +328,8 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) + print("Only perf tests: " + str(config.only_perf_tests) + "\n") + print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:45:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:49 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Changed perf_notes quite a bit. Should be much closer to actually usable now (c6e6160) Message-ID: <20170902214549.62C933A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/c6e61600b4433d7f6d430a9824f2acd825a2d1d0/ghc >--------------------------------------------------------------- commit c6e61600b4433d7f6d430a9824f2acd825a2d1d0 Author: Jared Weakly Date: Sat Jul 22 20:18:22 2017 -0700 Changed perf_notes quite a bit. Should be much closer to actually usable now >--------------------------------------------------------------- c6e61600b4433d7f6d430a9824f2acd825a2d1d0 testsuite/driver/perf_notes.py | 84 +++++++++++++++++++++++++++++++++++++++--- testsuite/driver/test_val | 76 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 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 c6e61600b4433d7f6d430a9824f2acd825a2d1d0 From git at git.haskell.org Sat Sep 2 21:45:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:52 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (075bf7e) Message-ID: <20170902214552.231AF3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/075bf7ecf7e234cf48e519721c2e7d0a74aeec80/ghc >--------------------------------------------------------------- commit 075bf7ecf7e234cf48e519721c2e7d0a74aeec80 Author: Jared Weakly Date: Tue Jul 18 17:35:34 2017 -0700 Small changes to address Ben's comments Signed-off-by: Jared Weakly >--------------------------------------------------------------- 075bf7ecf7e234cf48e519721c2e7d0a74aeec80 testsuite/driver/testlib.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a24ee6c..8fc3ed7 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,7 +1086,6 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): - full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:45:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:54 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Basic metrics collection and command line options working (65a1ce8) Message-ID: <20170902214554.D14393A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/65a1ce81afaf9f845e67553a827e65988b656f5e/ghc >--------------------------------------------------------------- commit 65a1ce81afaf9f845e67553a827e65988b656f5e Author: Jared Weakly Date: Thu Jul 6 17:16:49 2017 -0700 Basic metrics collection and command line options working >--------------------------------------------------------------- 65a1ce81afaf9f845e67553a827e65988b656f5e testsuite/driver/testlib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8fc3ed7..a24ee6c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,6 +1086,7 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): + full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:45:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:45:57 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Greatly improved printing. Fixed the delta function. Made things simpler (27c5ae6) Message-ID: <20170902214557.93D633A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/27c5ae62888da697113dc0294be129fb49b1eef5/ghc >--------------------------------------------------------------- commit 27c5ae62888da697113dc0294be129fb49b1eef5 Author: Jared Weakly Date: Wed Jul 26 18:30:37 2017 -0700 Greatly improved printing. Fixed the delta function. Made things simpler Signed-off-by: Jared Weakly >--------------------------------------------------------------- 27c5ae62888da697113dc0294be129fb49b1eef5 testsuite/driver/perf_notes.py | 104 +++++++++++++++++++---------------------- testsuite/driver/testutil.py | 9 ++-- 2 files changed, 51 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 27c5ae62888da697113dc0294be129fb49b1eef5 From git at git.haskell.org Sat Sep 2 21:46:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:00 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Added initial metric comparison tooling (614117e) Message-ID: <20170902214600.518D83A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/614117eb0028ba1fded9fdd40ae7f10fae9a8f6b/ghc >--------------------------------------------------------------- commit 614117eb0028ba1fded9fdd40ae7f10fae9a8f6b Author: Jared Weakly Date: Thu Jul 20 17:30:21 2017 -0700 Added initial metric comparison tooling >--------------------------------------------------------------- 614117eb0028ba1fded9fdd40ae7f10fae9a8f6b testsuite/driver/runtests.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index cf2cb92..c200c21 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -329,14 +329,11 @@ else: summary(t, sys.stdout, config.no_print_summary) - # This here is loading up all of the git notes into memory. - # It's most likely in the wrong spot and I haven't fully fleshed out - # where exactly I'm putting this and how I'm refactoring the performance - # test running logic. - # Currently this is useful for debugging, at least. + # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - parse_git_notes('perf') # Should this be hardcoded? Most likely not... + # v-- This is in a nonsensical area. It should be happening before all of the tests are even run. + # parse_git_notes('perf') # Should it even be happening in the test-driver logic anymore? # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:46:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:03 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Rebase the branch to linearize the history (9159c65) Message-ID: <20170902214603.151063A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/9159c655d99066c9d6fbdf9809435b235f60c6d9/ghc >--------------------------------------------------------------- commit 9159c655d99066c9d6fbdf9809435b235f60c6d9 Author: Jared Weakly Date: Fri Jul 28 16:38:49 2017 -0700 Rebase the branch to linearize the history >--------------------------------------------------------------- 9159c655d99066c9d6fbdf9809435b235f60c6d9 testsuite/driver/runtests.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 7ebb900..68d86a0 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -4,8 +4,7 @@ # (c) Simon Marlow 2002 # -from __future__ import print_function - +import argparse import signal import sys import os @@ -115,9 +114,7 @@ if args.verbose: config.skip_perf_tests = args.skip_perf_tests config.only_perf_tests = args.only_perf_tests config.use_git_notes = args.use_git_notes - -if args.test_env: - config.test_env = args.test_env +config.test_env = args.test_env config.cygwin = False config.msys = False From git at git.haskell.org Sat Sep 2 21:46:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:05 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Basic metrics collection and command line options working (733c670) Message-ID: <20170902214605.C315D3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/733c670372680f4d3a68f7266b8a2ac9965493e7/ghc >--------------------------------------------------------------- commit 733c670372680f4d3a68f7266b8a2ac9965493e7 Author: Jared Weakly Date: Thu Jul 6 17:16:49 2017 -0700 Basic metrics collection and command line options working >--------------------------------------------------------------- 733c670372680f4d3a68f7266b8a2ac9965493e7 testsuite/driver/testlib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8fc3ed7..a24ee6c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,6 +1086,7 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): + full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:46:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:08 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Fix importing issue in testsuite driver (8cf1fe9) Message-ID: <20170902214608.7CF513A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/8cf1fe907656d31ab0560e2c2007e599f41f7dc2/ghc >--------------------------------------------------------------- commit 8cf1fe907656d31ab0560e2c2007e599f41f7dc2 Author: Jared Weakly Date: Thu Aug 24 14:24:36 2017 -0700 Fix importing issue in testsuite driver >--------------------------------------------------------------- 8cf1fe907656d31ab0560e2c2007e599f41f7dc2 testsuite/driver/perf_notes.py | 39 ++++++++++++++++++++++----------------- testsuite/driver/testutil.py | 22 +++++++++++++++++++++- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 92ec4bb..7fbea15 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -6,7 +6,6 @@ # This file will be a utility to help facilitate the comparison of performance # metrics across arbitrary commits. The file will produce a table comparing # metrics between measurements taken for given commits in the environment given - # by --test-env. import argparse @@ -205,12 +204,12 @@ def evaluate_metric(test, field, deviation, contents): # # String utilities for pretty-printing # - -string = '' -for i in args.commits: - string+='{:18}' -commits = string.format(*[c[:10] for c in args.commits]) -latest_commit = [test for test in metrics if test['commit'] == args.commits[0]] +def main_2(): + string = '' + for i in args.commits: + string+='{:18}' + commits = string.format(*[c[:10] for c in args.commits]) + latest_commit = [test for test in metrics if test['commit'] == args.commits[0]] def cmtline(insert): return string.format(*[insert for c in args.commits]).strip() @@ -248,15 +247,21 @@ def commit_string(test, flag): # The pretty-printed output # -header('commit') -# Printing out metrics. -for test in latest_commit: - print("{:27}{:30}".format(test['test'], test['metric']) + commit_string(test['test'],'metrics')) +def main_3(): + header('commit') + # Printing out metrics. + for test in latest_commit: + print("{:27}{:30}".format(test['test'], test['metric']) + commit_string(test['test'],'metrics')) -# Has no meaningful output if there is no commit to compare to. -if not singleton_commit: - header('percent') + # Has no meaningful output if there is no commit to compare to. + if not singleton_commit: + header('percent') - # Printing out percentages. - for test in latest_commit: - print("{:27}{:30}".format(test['test'], test['metric']) + commit_string(test['test'],'percentages')) + # Printing out percentages. + for test in latest_commit: + print("{:27}{:30}".format(test['test'], test['metric']) + commit_string(test['test'],'percentages')) + +if __name__ == '__main__': + main() + main_2() + main_3() diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index cc80b28..cb6ffe1 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -4,7 +4,6 @@ import platform import subprocess import shutil import threading -from perf_notes import parse_git_notes def strip_quotes(s): # Don't wrap commands to subprocess.call/Popen in quotes. @@ -47,6 +46,27 @@ def lndir(srcdir, dstdir): os.mkdir(dst) lndir(src, dst) + +# This function allows one to read in git notes from the commandline +# and then breaks it into a list of dictionaries that can be parsed +# later on in the testing functions. +# Silently returns an empty string if the note is not found. +def parse_git_notes(namespace, commit='HEAD'): + logFields = ['test_env','test','way','metric','value','commit'] + + try: + log = subprocess.check_output(['git', 'notes', '--ref=' + namespace, 'show', commit], stderr=subprocess.STDOUT).decode('utf-8') + except subprocess.CalledProcessError: + return [] + + log = log.strip('\n').split('\n') + log = list(filter(None, log)) + log = [line.strip('\t').split('\t') for line in log] + [x.append(commit) for x in log] + log = [dict(zip(logFields, field)) for field in log] + return log + + # On Windows, os.symlink is not defined with Python 2.7, but is in Python 3 # when using msys2, as GHC does. Unfortunately, only Administrative users have # the privileges necessary to create symbolic links by default. Consequently we From git at git.haskell.org Sat Sep 2 21:46:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:11 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Tentatively setup test driver to rip out metrics from all.T files (a08e9bf) Message-ID: <20170902214611.3E4A83A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/a08e9bf59d9acf612ed48e53321eb288956355e5/ghc >--------------------------------------------------------------- commit a08e9bf59d9acf612ed48e53321eb288956355e5 Author: Jared Weakly Date: Wed Aug 16 16:09:24 2017 -0700 Tentatively setup test driver to rip out metrics from all.T files >--------------------------------------------------------------- a08e9bf59d9acf612ed48e53321eb288956355e5 testsuite/driver/perf_notes.py | 129 +++++++++++++++++++++++++++++++++++++--- testsuite/driver/testglobals.py | 4 +- testsuite/driver/testlib.py | 104 +++++++++++++++++++++----------- testsuite/driver/testutil.py | 15 +---- 4 files changed, 194 insertions(+), 58 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a08e9bf59d9acf612ed48e53321eb288956355e5 From git at git.haskell.org Sat Sep 2 21:46:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:13 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (58d179e) Message-ID: <20170902214613.F37F93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/58d179eec838331761533d863a8b85eaeb525a3b/ghc >--------------------------------------------------------------- commit 58d179eec838331761533d863a8b85eaeb525a3b Author: Jared Weakly Date: Tue Jul 18 17:35:34 2017 -0700 Small changes to address Ben's comments Signed-off-by: Jared Weakly >--------------------------------------------------------------- 58d179eec838331761533d863a8b85eaeb525a3b testsuite/driver/runtests.py | 5 +++++ testsuite/driver/testlib.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 621c0bb..fe7aa61 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -329,6 +329,11 @@ else: summary(t, sys.stdout, config.no_print_summary) + # This here is loading up all of the git notes into memory. + # It's most likely in the wrong spot and I haven't fully fleshed out + # where exactly I'm putting this and how I'm refactoring the performance + # test running logic. + # Currently this is useful for debugging, at least. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) parse_git_notes('perf') # Should this be hardcoded? Most likely not... diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a24ee6c..8fc3ed7 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,7 +1086,6 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): - full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:46:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:16 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (cabb629) Message-ID: <20170902214616.B30B93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/cabb6292f2879307c655bfd33d0e8f2c085a17ac/ghc >--------------------------------------------------------------- commit cabb6292f2879307c655bfd33d0e8f2c085a17ac Author: Jared Weakly Date: Tue Jul 18 17:35:34 2017 -0700 Small changes to address Ben's comments Signed-off-by: Jared Weakly >--------------------------------------------------------------- cabb6292f2879307c655bfd33d0e8f2c085a17ac testsuite/driver/runtests.py | 5 +++++ testsuite/driver/testlib.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 0131c13..cf2cb92 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -329,6 +329,11 @@ else: summary(t, sys.stdout, config.no_print_summary) + # This here is loading up all of the git notes into memory. + # It's most likely in the wrong spot and I haven't fully fleshed out + # where exactly I'm putting this and how I'm refactoring the performance + # test running logic. + # Currently this is useful for debugging, at least. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) parse_git_notes('perf') # Should this be hardcoded? Most likely not... diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a24ee6c..8fc3ed7 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,7 +1086,6 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): - full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:46:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:19 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Added initial metric comparison tooling (9c20d12) Message-ID: <20170902214619.78EE73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/9c20d122f901b8477ce9809201de6eda26cc5855/ghc >--------------------------------------------------------------- commit 9c20d122f901b8477ce9809201de6eda26cc5855 Author: Jared Weakly Date: Thu Jul 20 17:30:21 2017 -0700 Added initial metric comparison tooling >--------------------------------------------------------------- 9c20d122f901b8477ce9809201de6eda26cc5855 testsuite/driver/runtests.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 1aa691d..8177b24 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -307,14 +307,11 @@ else: summary(t, sys.stdout, config.no_print_summary) - # This here is loading up all of the git notes into memory. - # It's most likely in the wrong spot and I haven't fully fleshed out - # where exactly I'm putting this and how I'm refactoring the performance - # test running logic. - # Currently this is useful for debugging, at least. + # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - parse_git_notes('perf') # Should this be hardcoded? Most likely not... + # v-- This is in a nonsensical area. It should be happening before all of the tests are even run. + # parse_git_notes('perf') # Should it even be happening in the test-driver logic anymore? # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: From git at git.haskell.org Sat Sep 2 21:46:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:22 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Change output of comparison tool to resemble nofib (c123b83) Message-ID: <20170902214622.3D6553A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/c123b838f7ec4aa27a09b4f3b0bcd609a9156d11/ghc >--------------------------------------------------------------- commit c123b838f7ec4aa27a09b4f3b0bcd609a9156d11 Author: Jared Weakly Date: Thu Aug 10 01:02:21 2017 -0700 Change output of comparison tool to resemble nofib >--------------------------------------------------------------- c123b838f7ec4aa27a09b4f3b0bcd609a9156d11 testsuite/driver/perf_notes.py | 94 +++++++++++++++++++++++++++++------------- testsuite/driver/runtests.py | 46 +++++++++++++++------ testsuite/mk/test.mk | 2 +- 3 files changed, 99 insertions(+), 43 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c123b838f7ec4aa27a09b4f3b0bcd609a9156d11 From git at git.haskell.org Sat Sep 2 21:46:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:24 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Greatly improved printing. Fixed the delta function. Made things simpler (e85de08) Message-ID: <20170902214624.F2B5A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/e85de088f4427dd5f5c4f8cba602b2555a2f8032/ghc >--------------------------------------------------------------- commit e85de088f4427dd5f5c4f8cba602b2555a2f8032 Author: Jared Weakly Date: Wed Jul 26 18:30:37 2017 -0700 Greatly improved printing. Fixed the delta function. Made things simpler Signed-off-by: Jared Weakly >--------------------------------------------------------------- e85de088f4427dd5f5c4f8cba602b2555a2f8032 testsuite/driver/perf_notes.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 4445596..060cc7b 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -7,11 +7,6 @@ # metrics across arbitrary commits. The file will produce a table comparing # metrics between measurements taken for given commits in the environment given # by --test-env. -<<<<<<< HEAD -======= - -from __future__ import print_function ->>>>>>> Cleaning up my trash code for the perf_notes comparison tool import argparse import re From git at git.haskell.org Sat Sep 2 21:46:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:27 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: ONLY_PERF_TESTS=YES now fully implemented (6a46160) Message-ID: <20170902214627.B0E043A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/6a46160f356f3a885a2de7394a7920c185d9ff1c/ghc >--------------------------------------------------------------- commit 6a46160f356f3a885a2de7394a7920c185d9ff1c Author: Jared Weakly Date: Wed Jul 12 17:30:31 2017 -0700 ONLY_PERF_TESTS=YES now fully implemented >--------------------------------------------------------------- 6a46160f356f3a885a2de7394a7920c185d9ff1c testsuite/driver/runtests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 6e8a712..2b79a9f 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -306,6 +306,8 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) + print("Only perf tests: " + str(config.only_perf_tests) + "\n") + print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: From git at git.haskell.org Sat Sep 2 21:46:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:30 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (187a17c) Message-ID: <20170902214630.71B233A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/187a17c430774cd5d4102aa10855e3af4c1e8902/ghc >--------------------------------------------------------------- commit 187a17c430774cd5d4102aa10855e3af4c1e8902 Author: Jared Weakly Date: Tue Jul 18 17:35:34 2017 -0700 Small changes to address Ben's comments Signed-off-by: Jared Weakly >--------------------------------------------------------------- 187a17c430774cd5d4102aa10855e3af4c1e8902 testsuite/driver/runtests.py | 5 +++++ testsuite/driver/testlib.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index f122cfb..1aa691d 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -307,6 +307,11 @@ else: summary(t, sys.stdout, config.no_print_summary) + # This here is loading up all of the git notes into memory. + # It's most likely in the wrong spot and I haven't fully fleshed out + # where exactly I'm putting this and how I'm refactoring the performance + # test running logic. + # Currently this is useful for debugging, at least. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) parse_git_notes('perf') # Should this be hardcoded? Most likely not... diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a24ee6c..8fc3ed7 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,7 +1086,6 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): - full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:46:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:33 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Setup initial support new configure function to replace num_stats_field (4455115) Message-ID: <20170902214633.3BCDE3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/44551151fb62ea79f7a86f89c0a2b9cbba62d681/ghc >--------------------------------------------------------------- commit 44551151fb62ea79f7a86f89c0a2b9cbba62d681 Author: Jared Weakly Date: Sat Aug 26 16:16:40 2017 -0700 Setup initial support new configure function to replace num_stats_field >--------------------------------------------------------------- 44551151fb62ea79f7a86f89c0a2b9cbba62d681 testsuite/driver/perf_notes.py | 273 ++++++++++++++++++++-------------------- testsuite/driver/testglobals.py | 4 +- testsuite/driver/testlib.py | 162 ++++++++---------------- 3 files changed, 191 insertions(+), 248 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 44551151fb62ea79f7a86f89c0a2b9cbba62d681 From git at git.haskell.org Sat Sep 2 21:46:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:35 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Can now load up git note data into python (fbbff50) Message-ID: <20170902214635.F3F783A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/fbbff50e70a6220c2ff4e921ccc1ace47c6c2b59/ghc >--------------------------------------------------------------- commit fbbff50e70a6220c2ff4e921ccc1ace47c6c2b59 Author: Jared Weakly Date: Tue Jul 18 12:17:57 2017 -0700 Can now load up git note data into python >--------------------------------------------------------------- fbbff50e70a6220c2ff4e921ccc1ace47c6c2b59 testsuite/driver/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 2b79a9f..f122cfb 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -306,8 +306,10 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) - print("Only perf tests: " + str(config.only_perf_tests) + "\n") - print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") + + if config.use_git_notes: + note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) + parse_git_notes('perf') # Should this be hardcoded? Most likely not... # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: From git at git.haskell.org Sat Sep 2 21:46:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:38 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Basic metrics collection and command line options working (c17d727) Message-ID: <20170902214638.B952F3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/c17d72778d7da043730d5c0bc3a21a4470da8794/ghc >--------------------------------------------------------------- commit c17d72778d7da043730d5c0bc3a21a4470da8794 Author: Jared Weakly Date: Thu Jul 6 17:16:49 2017 -0700 Basic metrics collection and command line options working >--------------------------------------------------------------- c17d72778d7da043730d5c0bc3a21a4470da8794 testsuite/driver/testlib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8fc3ed7..a24ee6c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,6 +1086,7 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): + full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:46:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:41 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Change output of comparison tool to resemble nofib (1376834) Message-ID: <20170902214641.7E9533A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/1376834e7f86731bdffc27e4ba13a01b649f32f1/ghc >--------------------------------------------------------------- commit 1376834e7f86731bdffc27e4ba13a01b649f32f1 Author: Jared Weakly Date: Thu Aug 10 01:02:21 2017 -0700 Change output of comparison tool to resemble nofib >--------------------------------------------------------------- 1376834e7f86731bdffc27e4ba13a01b649f32f1 testsuite/driver/runtests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 68d86a0..f4fcf43 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -114,7 +114,9 @@ if args.verbose: config.skip_perf_tests = args.skip_perf_tests config.only_perf_tests = args.only_perf_tests config.use_git_notes = args.use_git_notes -config.test_env = args.test_env + +if args.test_env: + config.test_env = args.test_env config.cygwin = False config.msys = False @@ -328,8 +330,6 @@ else: # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - # v-- This is in a nonsensical area. It should be happening before all of the tests are even run. - # parse_git_notes('perf') # Should it even be happening in the test-driver logic anymore? # This here is loading up all of the git notes into memory. # It's most likely in the wrong spot and I haven't fully fleshed out From git at git.haskell.org Sat Sep 2 21:46:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:44 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Basic metrics collection and command line options working (99994a8) Message-ID: <20170902214644.4C4B23A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/99994a84966440bf8d5966d8be6f4a35f536b066/ghc >--------------------------------------------------------------- commit 99994a84966440bf8d5966d8be6f4a35f536b066 Author: Jared Weakly Date: Thu Jul 6 17:16:49 2017 -0700 Basic metrics collection and command line options working >--------------------------------------------------------------- 99994a84966440bf8d5966d8be6f4a35f536b066 testsuite/driver/testlib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8fc3ed7..a24ee6c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1086,6 +1086,7 @@ def stats( name, way, stats_file ): # Check -t stats info def checkStats(name, way, stats_file, range_fields): + full_name = name + '(' + way + ')' result = passed() From git at git.haskell.org Sat Sep 2 21:46:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:47 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Tentatively setup test driver to rip out metrics from all.T files (ea017b0) Message-ID: <20170902214647.137753A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/ea017b0a0bbffb326059b6af9fc434b58061b424/ghc >--------------------------------------------------------------- commit ea017b0a0bbffb326059b6af9fc434b58061b424 Author: Jared Weakly Date: Tue Aug 22 17:31:26 2017 -0700 Tentatively setup test driver to rip out metrics from all.T files >--------------------------------------------------------------- ea017b0a0bbffb326059b6af9fc434b58061b424 testsuite/driver/perf_notes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 763f063..92ec4bb 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -256,6 +256,7 @@ for test in latest_commit: # Has no meaningful output if there is no commit to compare to. if not singleton_commit: header('percent') + # Printing out percentages. for test in latest_commit: print("{:27}{:30}".format(test['test'], test['metric']) + commit_string(test['test'],'percentages')) From git at git.haskell.org Sat Sep 2 21:46:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:49 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Can now load up git note data into python (872fc24) Message-ID: <20170902214649.DD51C3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/872fc245f3be4aaca8fd517a6e442761385a2e53/ghc >--------------------------------------------------------------- commit 872fc245f3be4aaca8fd517a6e442761385a2e53 Author: Jared Weakly Date: Tue Jul 18 12:17:57 2017 -0700 Can now load up git note data into python >--------------------------------------------------------------- 872fc245f3be4aaca8fd517a6e442761385a2e53 testsuite/driver/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 79433c0..621c0bb 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -328,8 +328,10 @@ else: sys.stdout.flush() summary(t, sys.stdout, config.no_print_summary) - print("Only perf tests: " + str(config.only_perf_tests) + "\n") - print("Skip perf tests: " + str(config.skip_perf_tests) + "\n") + + if config.use_git_notes: + note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) + parse_git_notes('perf') # Should this be hardcoded? Most likely not... # Write our accumulated metrics into the git notes for this commit. if config.use_git_notes: From git at git.haskell.org Sat Sep 2 21:46:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:52 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Change the all.T files to new format (fcebcc4) Message-ID: <20170902214652.A9E373A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/fcebcc46e31fdbd866c31054392565b3ab44e533/ghc >--------------------------------------------------------------- commit fcebcc46e31fdbd866c31054392565b3ab44e533 Author: Jared Weakly Date: Sun Aug 27 18:08:29 2017 -0700 Change the all.T files to new format >--------------------------------------------------------------- fcebcc46e31fdbd866c31054392565b3ab44e533 libraries/base/tests/all.T | 16 +- testsuite/driver/perf_notes.py | 1 + testsuite/driver/runtests.py | 2 +- testsuite/driver/testlib.py | 11 +- testsuite/tests/callarity/perf/all.T | 11 +- testsuite/tests/deriving/perf/all.T | 10 +- testsuite/tests/perf/compiler/all.T | 942 ++----------------------- testsuite/tests/perf/haddock/all.T | 162 +---- testsuite/tests/perf/join_points/all.T | 15 +- testsuite/tests/perf/should_run/all.T | 325 ++------- testsuite/tests/perf/space_leaks/all.T | 74 +- testsuite/tests/primops/should_run/all.T | 6 +- testsuite/tests/simplCore/should_compile/all.T | 3 +- testsuite/tests/simplStg/should_run/all.T | 4 +- 14 files changed, 129 insertions(+), 1453 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 fcebcc46e31fdbd866c31054392565b3ab44e533 From git at git.haskell.org Sat Sep 2 21:46:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:55 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Correct error causing incorrect differentiation between compiler and regular performance tests (228a692) Message-ID: <20170902214655.6C1AA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/228a6925e4a2ff726e27d97f4da1b3daf87b2244/ghc >--------------------------------------------------------------- commit 228a6925e4a2ff726e27d97f4da1b3daf87b2244 Author: Jared Weakly Date: Mon Aug 28 11:36:39 2017 -0700 Correct error causing incorrect differentiation between compiler and regular performance tests >--------------------------------------------------------------- 228a6925e4a2ff726e27d97f4da1b3daf87b2244 testsuite/driver/perf_notes.py | 16 +++++++++++++--- testsuite/driver/testlib.py | 23 +++++++++++------------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index a2bc8dd..d0b229e 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -154,13 +154,24 @@ def _comparison(name, opts, metric, deviation, is_compiler_test): if tests == [] or test == []: # There are no prior metrics for this test. - opts.stats_range_fields[metric] = (0,0) + if isinstance(metric, str): + if metric == 'all': + for field in testing_metrics: + opts.stats_range_fields[field] = (0,0) + else: + opts.stats_range_fields[metric] = (0,0) + if isinstance(metric, list): + for field in metric: + opts.stats_range_fields[field] = (0,0) + return + if is_compiler_test: + opts.is_compiler_test = True + # Compiler performance numbers change when debugging is on, making the results # useless and confusing. Therefore, skip if debugging is on. if config.compiler_debugged and is_compiler_test: - opts.is_compiler_test = True opts.skip = 1 # 'all' is a shorthand to test for bytes allocated, peak megabytes allocated, and max bytes used. @@ -193,7 +204,6 @@ def evaluate_metric(opts, test, field, deviation, contents, way): test_env = config.test_env config.accumulate_metrics.append('\t'.join([test_env, test, way, field, str(val)])) - print("WTF 01") if expected == 0: return my_passed('no prior metrics for this test') diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index b32cbf5..d57dbf9 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1109,11 +1109,7 @@ def simple_build(name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, b else: to_do = '-c' # just compile - print("SANITY CHECK") - print(name) - print(opts.is_compiler_test) stats_file = name + '.comp.stats' - print(stats_file) if opts.is_compiler_test: extra_hc_opts += ' +RTS -V0 -t' + stats_file + ' --machine-readable -RTS' if backpack: @@ -1147,13 +1143,13 @@ def simple_build(name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, b # ToDo: if the sub-shell was killed by ^C, then exit - statsResult = checkStats(name, way, stats_file, opts.stats_range_fields) - print(stats_file) - print(opts.stats_range_fields) - print(statsResult) + if opts.is_compiler_test: + statsResult = checkStats(name, way, stats_file, opts.stats_range_fields) + else: + statsResult = passed() - if badResult(statsResult): - return statsResult + # if badResult(statsResult): + # return statsResult if should_fail: if exit_code == 0: @@ -1162,7 +1158,7 @@ def simple_build(name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, b if exit_code != 0: return failBecause('exit code non-0') - return passed() + return statsResult # ----------------------------------------------------------------------------- # Run a program and check its output @@ -1229,7 +1225,10 @@ def simple_run(name, way, prog, extra_run_opts): if check_prof and not check_prof_ok(name, way): return failBecause('bad profile') - return checkStats(name, way, stats_file, opts.stats_range_fields) + if not opts.is_compiler_test: + return checkStats(name, way, stats_file, opts.stats_range_fields) + else: + return passed() def rts_flags(way): args = config.way_rts_flags.get(way, []) From git at git.haskell.org Sat Sep 2 21:46:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:46:58 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Add name format verification to comparison function and fix boolean conditional in some test functions (88ce55a) Message-ID: <20170902214658.346563A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/88ce55ae661df68a31e28518caece32dfc3a8a0e/ghc >--------------------------------------------------------------- commit 88ce55ae661df68a31e28518caece32dfc3a8a0e Author: Jared Weakly Date: Tue Aug 29 08:13:53 2017 -0700 Add name format verification to comparison function and fix boolean conditional in some test functions >--------------------------------------------------------------- 88ce55ae661df68a31e28518caece32dfc3a8a0e testsuite/driver/perf_notes.py | 10 ++++++++-- testsuite/driver/testlib.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index d0b229e..97e6d1c 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -102,6 +102,8 @@ def main(): testing_metrics = ['bytes allocated', 'peak_megabytes_allocated', 'max_bytes_used'] +# These my_ functions are duplicates of functions in testlib.py that I can't import here. +# and are mostly a consequence of some semi-ugly refactoring. def my_passed(reason=''): return {'passFail': 'pass', 'reason' : reason} @@ -121,9 +123,9 @@ def test_cmp(full_name, field, val, expected, dev=20): if val < lowerBound: result = my_failBecause('value is too low:\n(If this is \ because you have improved GHC, please\nupdate the test so that GHC \ - doesn\'t regress again)') + doesn\'t regress again)','stat') if val > upperBound: - result = my_failBecause('value is too high:\nstat is not good enough') + result = my_failBecause('value is too high:\nstat is not good enough','stat') if val < lowerBound or val > upperBound or config.verbose >= 4: length = max(len(str(x)) for x in [expected, lowerBound, upperBound, val]) @@ -147,6 +149,10 @@ def comparison(metric='all', deviation=20, compiler=False): return lambda name, opts, m=metric, d=deviation, c=compiler: _comparison(name, opts, m, d, c) def _comparison(name, opts, metric, deviation, is_compiler_test): + if not re.match('^[0-9]*[a-zA-Z][a-zA-Z0-9._-]*$', name): + # my_framework_fail(name, 'bad_name', 'This test has an invalid name') + my_failBecause('This test has an invalid name.') + tests = parse_git_notes('perf','HEAD^') # Might have multiple metrics being measured for a single test. diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 042e330..7cb3269 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1192,7 +1192,7 @@ def simple_run(name, way, prog, extra_run_opts): my_rts_flags = rts_flags(way) stats_file = name + '.stats' - if not opts.is_compiler_test: + if isStatsTest() and not opts.is_compiler_test: stats_args = ' +RTS -V0 -t' + stats_file + ' --machine-readable -RTS' else: stats_args = '' From git at git.haskell.org Sat Sep 2 21:47:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:47:01 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Change stuff in testlib.py (308bd11) Message-ID: <20170902214701.039C23A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/308bd11e97398e50aa8cca2d286002b7fb5f6686/ghc >--------------------------------------------------------------- commit 308bd11e97398e50aa8cca2d286002b7fb5f6686 Author: Jared Weakly Date: Mon Aug 28 17:26:30 2017 -0700 Change stuff in testlib.py >--------------------------------------------------------------- 308bd11e97398e50aa8cca2d286002b7fb5f6686 testsuite/driver/testlib.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index d57dbf9..042e330 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1040,6 +1040,11 @@ def multimod_compile_and_run( name, way, top_mod, extra_hc_opts ): def multi_compile_and_run( name, way, top_mod, extra_mods, extra_hc_opts ): return compile_and_run__( name, way, top_mod, extra_mods, extra_hc_opts) +def stats( name, way, stats_file ): + """This function is used by some performance tests""" + opts = getTestOpts() + return checkStats(name, way, stats_file, opts.stats_range_fields) + # ----------------------------------------------------------------------------- # Check -t stats info From git at git.haskell.org Sat Sep 2 21:47:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:47:03 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Rename comparison to collect_stats and fix minor issues related to phab review (7240a66) Message-ID: <20170902214703.EF5493A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/7240a6615d294ef9fd530aebc8ddad00686feec2/ghc >--------------------------------------------------------------- commit 7240a6615d294ef9fd530aebc8ddad00686feec2 Author: Jared Weakly Date: Fri Sep 1 13:27:59 2017 -0700 Rename comparison to collect_stats and fix minor issues related to phab review >--------------------------------------------------------------- 7240a6615d294ef9fd530aebc8ddad00686feec2 libraries/base/tests/all.T | 6 +- testsuite/driver/perf_notes.py | 31 ++++----- testsuite/driver/runtests.py | 4 +- testsuite/driver/testglobals.py | 4 +- testsuite/driver/testlib.py | 21 +++--- testsuite/tests/callarity/perf/all.T | 3 +- testsuite/tests/deriving/perf/all.T | 3 +- testsuite/tests/perf/compiler/all.T | 89 +++++++++++++------------- testsuite/tests/perf/haddock/all.T | 7 +- testsuite/tests/perf/join_points/all.T | 9 +-- testsuite/tests/perf/should_run/all.T | 85 ++++++++++++------------ testsuite/tests/perf/space_leaks/all.T | 13 ++-- testsuite/tests/primops/should_run/all.T | 3 +- testsuite/tests/simplCore/should_compile/all.T | 2 +- testsuite/tests/simplStg/should_run/all.T | 3 +- 15 files changed, 147 insertions(+), 136 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 7240a6615d294ef9fd530aebc8ddad00686feec2 From git at git.haskell.org Sat Sep 2 21:47:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:47:06 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Add more documentation and a README to the testsuite driver. (fae73dc) Message-ID: <20170902214706.C18933A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/fae73dccc87c780e28b48546cfe238b60645dabe/ghc >--------------------------------------------------------------- commit fae73dccc87c780e28b48546cfe238b60645dabe Author: Jared Weakly Date: Fri Sep 1 14:53:27 2017 -0700 Add more documentation and a README to the testsuite driver. Additionally, add the modified make file that was left out of the last commit by mistake. >--------------------------------------------------------------- fae73dccc87c780e28b48546cfe238b60645dabe testsuite/driver/README.md | 24 ++++++++++++++++++++++-- testsuite/driver/perf_notes.py | 8 ++++---- testsuite/driver/runtests.py | 13 ------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/testsuite/driver/README.md b/testsuite/driver/README.md index 7b4b045..4417fb5 100644 --- a/testsuite/driver/README.md +++ b/testsuite/driver/README.md @@ -9,8 +9,9 @@ For more detailed documentation, please see [here][1]. 1. Entry points of the testsuite 2. Quick overview of program parts -3. Important Types -4. Quick answers for "how do I do X"? +3. How to use the comparison tool +4. Important Types +5. Quick answers for "how do I do X"? ## Entry Points of the Testsuite @@ -40,6 +41,25 @@ The relevant bits of the directory tree are as such: ├── tests -- Main tests directory. ``` +## How to Use the Comparison Tool + +The comparison tool exists in `/driver/perf_notes.py`. + +When the testsuite is ran, the performance metrics of the performance tests are saved automatically in a local git note that will be attached to the commit. +The comparison tool is designed to help analyze the performance of the compiler across commits using this performance information. + +Currently, it can only be ran by executing the file directly, like so: +``` +$ python3 perf_notes.py (arguments go here) +``` + +If you run `perf_notes.py -h` you will see a description of all of the arguments and how to use them. +The optional arguments exist to filter the output to include only commits that you're interested in. +The most typical usage of this tool will likely be running `perf_notes.py HEAD 'HEAD~1' '(commit hash)' ...` + +The way the performance metrics are stored in git notes remains strictly local to the machine; +as such, performance metrics will not exist for a commit until you checkout that commit and run the testsuite (or test). + ## Important Types * metric diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 075651f..0ff9d2d 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -5,8 +5,8 @@ # # This file will be a utility to help facilitate the comparison of performance # metrics across arbitrary commits. The file will produce a table comparing -# metrics between measurements taken for given commits in the environment given -# by --test-env. +# metrics between measurements taken for given commits in the environment +# (which defaults to 'local' if not given by --test-env). # import argparse @@ -22,10 +22,10 @@ def parse_arguments(): parser.add_argument("--test-env", help="The given test environment to be compared.") parser.add_argument("--test-name", - help="Optional: If given, filters table to include only \ + help="If given, filters table to include only \ tests matching the given regular expression.") parser.add_argument("--min-delta",type=float, - help="Optional: Display only tests where the relative \ + help="Display only tests where the relative \ spread is greater than the given value. \ This will not be run if you only pass in one commit.") parser.add_argument("--add-note", nargs=3, diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index da2ba3b..59d9e45 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -327,19 +327,6 @@ else: # Write our accumulated metrics into the git notes for this commit. note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - # This here is loading up all of the git notes into memory. - # It's most likely in the wrong spot and I haven't fully fleshed out - # where exactly I'm putting this and how I'm refactoring the performance - # test running logic. - # Currently this is useful for debugging, at least. - if config.use_git_notes: - note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - parse_git_notes('perf') # Should this be hardcoded? Most likely not... - - # Write our accumulated metrics into the git notes for this commit. - if config.use_git_notes: - note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - if config.summary_file: with open(config.summary_file, 'w') as file: summary(t, file) From git at git.haskell.org Sat Sep 2 21:47:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:47:09 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Add more documentation and a README to the testsuite driver. (730d286) Message-ID: <20170902214709.EA85A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/730d2869a4fbfc4a97bf7c1d85ddc98cb8912212/ghc >--------------------------------------------------------------- commit 730d2869a4fbfc4a97bf7c1d85ddc98cb8912212 Author: Jared Weakly Date: Fri Sep 1 14:53:27 2017 -0700 Add more documentation and a README to the testsuite driver. Additionally, add the modified make file that was left out of the last commit by mistake. >--------------------------------------------------------------- 730d2869a4fbfc4a97bf7c1d85ddc98cb8912212 testsuite/driver/README.md | 80 +++++++++++++++++++++++++++++++++++++++++ testsuite/driver/perf_notes.py | 60 ++++++++++++++++++++++++------- testsuite/driver/runtests.py | 5 +-- testsuite/driver/testglobals.py | 5 ++- testsuite/driver/testutil.py | 11 ++++-- testsuite/mk/test.mk | 4 --- 6 files changed, 140 insertions(+), 25 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 730d2869a4fbfc4a97bf7c1d85ddc98cb8912212 From git at git.haskell.org Sat Sep 2 21:47:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:47:12 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Rebase on origin/master and modify some tests introduced by rebase (40d6fdf) Message-ID: <20170902214712.C115A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/40d6fdffe69dfce4cbb9af89b516addc7ff45ad4/ghc >--------------------------------------------------------------- commit 40d6fdffe69dfce4cbb9af89b516addc7ff45ad4 Author: Jared Weakly Date: Sat Sep 2 14:20:35 2017 -0700 Rebase on origin/master and modify some tests introduced by rebase >--------------------------------------------------------------- 40d6fdffe69dfce4cbb9af89b516addc7ff45ad4 libraries/base/tests/all.T | 2 +- testsuite/tests/perf/compiler/all.T | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 26ea796..6bf0da8 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -208,6 +208,6 @@ test('T13525', when(opsys('mingw32'), skip), compile_and_run, ['']) test('T13097', normal, compile_and_run, ['']) test('functorOperators', normal, compile_and_run, ['']) test('T3474', - [stats_num_field('max_bytes_used', [ (wordsize(64), 44504, 5) ]), + [collect_stats('max_bytes_used',5), only_ways(['normal'])], compile_and_run, ['-O']) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 676bdf3..75ec285 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -293,10 +293,7 @@ test('T12707', test('T12150', [ only_ways(['optasm']), - compiler_stats_num_field('bytes allocated', - [(wordsize(64), 74358208, 5) - # initial: 70773000 - # 2017-08-25: 74358208 Refactor the Mighty Simplifier + collect_stats('bytes allocated',5,True), ]), ], compile, From git at git.haskell.org Sat Sep 2 21:47:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Sep 2017 21:47:15 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite's head updated: Rebase on origin/master and modify some tests introduced by rebase (40d6fdf) Message-ID: <20170902214715.DA5CA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/perf-testsuite' now includes: a4f347c Split out inferConstraintsDataConArgs from inferConstraints 3f05e5f Don't suppress unimplemented type family warnings with DeriveAnyClass 7d69978 Use NonEmpty lists to represent lists of duplicate elements 4f1f986 Change isClosedAlgType to be TYPE-aware, and rename it to pmIsClosedType 0bb1e84 Expand type synonyms during role inference c6462ab Add test for #14101 7c37ffe Point to FunDeps documentation on Haskell wiki ad7b945 Fix #14060 by more conservatively annotating TH-reified types 0a891c8 Properly handle dlerror() message on FreeBSD when linking linker scripts ddb870b Don't drop GHCi-defined functions with -fobject-code enabled ed7a830 Use a ReaderT in TcDeriv to avoid some tedious plumbing 21bd9b2 Recognize FreeBSD compiler as Clang. a520adc Bump mtl, parsec, text submodules 441c52d Add Semigroup/Monoid instances to ST monad b0285d1 Bump nofib submodule e054c5f Bump mtl, parsec, text submodules 6e9c8eb Bump mtl, parsec, text submodules (again) a8da0de Speed up compilation of profiling stubs b0ed07f Allow TcDerivInfer to compile with GHC 8.0.1 38260a9 Fix #13972 by producing tidier errors 039fa1b Suggest how to fix illegally nested foralls in GADT constructor type signatures c948b78 Fix #11785 by making reifyKind = reifyType af9f3fa Remove extra ` from "kind-indexed GADTs" doc 03327bf Handle ListPat in isStrictPattern 36d1b08 Doctest for Void.absurd 49ddea9 Sections with undefined operators have non-standard behavior 43b0c2c Insert missing blank line to fix Applicative doc 63397cb Add some Monoid doctests f762181 Mention the category laws explicitly a30187d Convert documentation examples to doctests for ReadP module bfa9048 Loads of doc(test)s 2c0ab47 Add missing initial version for extension doc. 0e1b6f8 Fix index entries in "separate compilation" section 3385669 user-guide: fix examples of ghci commands 69a0f01 rts: Enable USDT probes object on Linux 82ee71f user-guide: add `:type +d` and `:type +v` in release highlight dc42c0d Fix #13399 by documenting higher-rank kinds. 0385347 Remove unneeded reqlibs for mtl and parsec in the GHC testsuite c5605ae Make function intToSBigNat# preserve sign (fixes #14085) 0286214 testsuite: Add test for #13916 fee253f CSE.cseOneExpr: Set InScopeSet correctly 6257fb5 Comments about GlobalRdrEnv shadowing 118efb0 Restrict Lint's complaints about recursive INLINEs somewhat 698adb5 Tracing in OccAnal (commented out) 4c6fcd7 Comments only 61c4246 Test Trac #14110 f50e30e Doctests for Data.Tuple 6267d8c Enable -Wcpp-undef for GHC and runtime system cf8ab1c users_guide: Convert mkUserGuidePart generation to a Sphinx extension 8e5b6ec Add strict variant of iterate ee2e9ec Correct incorrect free in PE linker 1cdceb9 Revert "Add strict variant of iterate" 34bd43d Fix loading of dlls on 32bit windows 6982ee9 Fix #14125 by normalizing data family instances more aggressively a89bb80 Fix #14114 by checking for duplicate vars on pattern synonym RHSes 79b259a Fix #13885 by freshening reified GADT constructors' universal tyvars 8476097 Revise function arity mismatch errors involving TypeApplications 8fd9599 Make the Read instance for Proxy (and friends) ignore precedence afc2f79 Move validate cleaning from distclean to clean 4717ce8 Fix incorrect retypecheck loop in -j (#14075) 9afaebe StgLint: Allow join point bindings of unlifted type cd5a970 Make law for Foldable.length explicit 20c7053 Bump haddock submodule 090d896 fix typo (expreesions -> expressions) 028645c Fixed a typo in template-haskell documentation dbaa9a2 DynFlags: Add inverse of -dno-debug-output 3625728 Add support for producing position-independent executables 7463a95 users-guide: Better error messages on incomplete ghc-flag directives 74af2e7 Typo fixed 11657c4 Better pretty-printing for CHoleCan a211dca Fix defer-out-of-scope-variables aeb4bd9 Remove typeKind from Type.hs-boot 5f3d2d3 CNF: Implement compaction for small pointer arrays a0b7b10 Restrict exprOkForSpeculation/case to unlifted types 407c11b Bottoming expressions should not be expandable 33452df Refactor the Mighty Simplifier 8649535 Don't do the RhsCtxt thing for join points dd89a13 Comments, plus adjust debug print of TcTyThing(ATyVar) a67b66e Add strict variant of iterate f135fb2 rts: Fix warnings on aarch64 and clean up style 80ccea8 rts: Fix references to Note [BFD import library] 76e59a2 rts: Fix ASSERTs with space before opening paren 8f19c65 Rip out mkUserGuidePart 83484a6 Fix two typos in the ImpredicativeTypes user guide a055f24 Adjust test suite stats 682e8e6 Actually bump T12150 29da01e Make parsed AST dump output lazily 6e0e0b0 Comments only 8834d48 Better debug-printing for Outputable TyConBinder 547e4c0 A bit more -ddump-tc tracing 6f050d9 Add TcRnMonad.unlessXOptM 0257dac Refactor bindHsQTyVars and friends 86e6a5f Small refactoring of meta-tyvar cloning 4455c86 Use a well-kinded substitution to instantiate 8eead4d Improve kind-application-error message a6c448b Small refactor of getRuntimeRep aed7d43 Add HasDebugStack for typeKind 248ad30 testsuite: Add test for #14128 db3a8e1 desugar: Ensure that a module's dep_orphs doesn't contain itself 5266ab9 Remove dll-split. 895a765 Refactor type family instance abstract syntax declarations 3c6b2fc Fix decomposition error on Windows 5f6a820 Add gen-dll as replacement for dll-split f86de44 ghc-pkg: Try opening lockfiles in read-write mode first a27bb1b base: Add support for file unlocking 779b9e6 PackageDb: Explicitly unlock package database before closing 9d57d8c nativeGen: Don't index into linked lists 651b4dc StgLint: Show type of out-of-scope binders a36b34c StgLint: Enforce MultiValAlt liveness invariant only after unariser f17f106 StgLint: Give up on trying to compare types 1561525 HsExpr: Fix typo 6f1ccaa Add a Note describing #14128 567dca6 Add some traceRn and (Outputable StmtTree) 628b666 Add comments to RnTypes fca1962 Define and use HsArg 805b29b Add debugPprType 3790ea9 Small changes to ddump-tc tracing 2c133b6 Really fix Trac #14158 c0feee9 Add missing Semigroup instances to compiler b2c2e3e Add missing Semigroup instances in utils/{hpc,runghc} dd643bc Improve stm haddocks 1f052c5 Fix order of PrelRule 8a1de42 Add testcase for #14178 f089c32 Remove broken citeseer citation links 590e737 Update transformers submodule 6330b0b Document the intricacies of ForallC variable quantification better 5dd6b13 Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns 8e4229a Fix #14167 by using isGadtSyntaxTyCon in more places 0ec4376 Document the Generic(1) laws 0ae1afe Basic metrics collection and command line options working 49403a8 ONLY_PERF_TESTS=YES now fully implemented 80194f0 Can now load up git note data into python e0117dc Small changes to address Ben's comments 70e07cf Basic metrics collection and command line options working 1cc6b8e ONLY_PERF_TESTS=YES now fully implemented d5a6c20 Can now load up git note data into python 525a171 Small changes to address Ben's comments 428a377 Added initial metric comparison tooling 1a07b1c Initial tooling to compare across commits (but for actual this time) c6e6160 Changed perf_notes quite a bit. Should be much closer to actually usable now ce4f6cb Cleaning up my trash code for the perf_notes comparison tool 27c5ae6 Greatly improved printing. Fixed the delta function. Made things simpler 6a46160 ONLY_PERF_TESTS=YES now fully implemented 733c670 Basic metrics collection and command line options working fbbff50 Can now load up git note data into python 187a17c Small changes to address Ben's comments 9c20d12 Added initial metric comparison tooling 3bceaad Changed perf_notes quite a bit. Should be much closer to actually usable now c123b83 Change output of comparison tool to resemble nofib 4fd81a3 ONLY_PERF_TESTS=YES now fully implemented 99994a8 Basic metrics collection and command line options working 872fc24 Can now load up git note data into python 58d179e Small changes to address Ben's comments 65a1ce8 Basic metrics collection and command line options working 3b05c15 ONLY_PERF_TESTS=YES now fully implemented 4ce5480 Can now load up git note data into python 075bf7e Small changes to address Ben's comments c17d727 Basic metrics collection and command line options working e232d04 ONLY_PERF_TESTS=YES now fully implemented 002a313 Can now load up git note data into python cabb629 Small changes to address Ben's comments 614117e Added initial metric comparison tooling 04fa630 Cleaning up my trash code for the perf_notes comparison tool 01c8587 This should actually split things out this time e85de08 Greatly improved printing. Fixed the delta function. Made things simpler 9159c65 Rebase the branch to linearize the history 1376834 Change output of comparison tool to resemble nofib a08e9bf Tentatively setup test driver to rip out metrics from all.T files ea017b0 Tentatively setup test driver to rip out metrics from all.T files 8cf1fe9 Fix importing issue in testsuite driver 4455115 Setup initial support new configure function to replace num_stats_field 6e1d9be Clean up refactoring of stats_num_field fcebcc4 Change the all.T files to new format 228a692 Correct error causing incorrect differentiation between compiler and regular performance tests 308bd11 Change stuff in testlib.py 88ce55a Add name format verification to comparison function and fix boolean conditional in some test functions 7240a66 Rename comparison to collect_stats and fix minor issues related to phab review 730d286 Add more documentation and a README to the testsuite driver. fae73dc Add more documentation and a README to the testsuite driver. 40d6fdf Rebase on origin/master and modify some tests introduced by rebase From git at git.haskell.org Sun Sep 3 08:29:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 3 Sep 2017 08:29:07 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitify: The rhs of join points are also in tail-call position (b727e28) Message-ID: <20170903082907.3A7EE3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/b727e282d2332e43dcb73237dcb379aad4ffc2e7/ghc >--------------------------------------------------------------- commit b727e282d2332e43dcb73237dcb379aad4ffc2e7 Author: Joachim Breitner Date: Sun Sep 3 09:26:44 2017 +0100 Exitify: The rhs of join points are also in tail-call position >--------------------------------------------------------------- b727e282d2332e43dcb73237dcb379aad4ffc2e7 compiler/simplCore/Exitify.hs | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 8913c3e..6fe17ac 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -135,12 +135,36 @@ exitify in_scope pairs = return (dc, pats, rhs') return $ Case (deAnnotate scrut) bndr ty alts' - go captured (_, AnnLet ann_bind body) = do - let bind = deAnnBind ann_bind - body' <- go (bindersOf bind ++ captured) body - return $ Let bind body' - - go _ ann_e = return (deAnnotate ann_e) -- TODO: What else is a tail-call position? + go captured (_, AnnLet ann_bind body) + -- join point, RHS and body are tail-called + | AnnNonRec j rhs <- ann_bind + , Just join_arity <- isJoinId_maybe j + = do let (params, join_body) = collectNAnnBndrs join_arity rhs + join_body' <- go (params ++ captured) join_body + let rhs' = mkLams params join_body' + body' <- go (j : captured) body + return $ Let (NonRec j rhs') body' + + -- rec join point, RHSs and body are tail-called + | AnnRec pairs <- ann_bind + , isJoinId (fst (head pairs)) + = do let js = map fst pairs + pairs' <- forM pairs $ \(j,rhs) -> do + let join_arity = idJoinArity j + (params, join_body) = collectNAnnBndrs join_arity rhs + join_body' <- go (params ++ js ++ captured) join_body + let rhs' = mkLams params join_body' + return (j, rhs') + body' <- go (js ++ captured) body + return $ Let (Rec pairs') body' + + -- normal Let, only the body is tail-called + | otherwise + = do body' <- go (bindersOf bind ++ captured) body + return $ Let bind body' + where bind = deAnnBind ann_bind + + go _ ann_e = return (deAnnotate ann_e) -- Picks a new unique, which is disjoint from From git at git.haskell.org Sun Sep 3 08:29:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 3 Sep 2017 08:29:09 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitification: The body of a let is also in tail-call position (915c152) Message-ID: <20170903082909.EC8853A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/915c1524773dedbf4b61b420b0c5a5c4b99f632a/ghc >--------------------------------------------------------------- commit 915c1524773dedbf4b61b420b0c5a5c4b99f632a Author: Joachim Breitner Date: Sun Sep 3 09:15:02 2017 +0100 Exitification: The body of a let is also in tail-call position >--------------------------------------------------------------- 915c1524773dedbf4b61b420b0c5a5c4b99f632a compiler/coreSyn/CoreSyn.hs | 10 +++++----- compiler/simplCore/Exitify.hs | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 99478d2..4c87b62 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -77,7 +77,7 @@ module CoreSyn ( collectAnnArgs, collectAnnArgsTicks, -- ** Operations on annotations - deAnnotate, deAnnotate', deAnnAlt, + deAnnotate, deAnnotate', deAnnAlt, deAnnBind, collectAnnBndrs, collectNAnnBndrs, -- * Orphanhood @@ -2158,16 +2158,16 @@ deAnnotate' (AnnTick tick body) = Tick tick (deAnnotate body) deAnnotate' (AnnLet bind body) = Let (deAnnBind bind) (deAnnotate body) - where - deAnnBind (AnnNonRec var rhs) = NonRec var (deAnnotate rhs) - deAnnBind (AnnRec pairs) = Rec [(v,deAnnotate rhs) | (v,rhs) <- pairs] - deAnnotate' (AnnCase scrut v t alts) = Case (deAnnotate scrut) v t (map deAnnAlt alts) deAnnAlt :: AnnAlt bndr annot -> Alt bndr deAnnAlt (con,args,rhs) = (con,args,deAnnotate rhs) +deAnnBind :: AnnBind b annot -> Bind b +deAnnBind (AnnNonRec var rhs) = NonRec var (deAnnotate rhs) +deAnnBind (AnnRec pairs) = Rec [(v,deAnnotate rhs) | (v,rhs) <- pairs] + -- | As 'collectBinders' but for 'AnnExpr' rather than 'Expr' collectAnnBndrs :: AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot) collectAnnBndrs e diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index cc4172d..8913c3e 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -135,6 +135,11 @@ exitify in_scope pairs = return (dc, pats, rhs') return $ Case (deAnnotate scrut) bndr ty alts' + go captured (_, AnnLet ann_bind body) = do + let bind = deAnnBind ann_bind + body' <- go (bindersOf bind ++ captured) body + return $ Let bind body' + go _ ann_e = return (deAnnotate ann_e) -- TODO: What else is a tail-call position? From git at git.haskell.org Sun Sep 3 08:29:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 3 Sep 2017 08:29:12 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (e004f98) Message-ID: <20170903082912.C5DF93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/e004f985a17d3284524932ff1af51e2a34199538/ghc >--------------------------------------------------------------- commit e004f985a17d3284524932ff1af51e2a34199538 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- e004f985a17d3284524932ff1af51e2a34199538 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/SimplCore.hs | 17 ++++++++++------- compiler/simplCore/SimplUtils.hs | 6 ++++-- compiler/simplCore/Simplify.hs | 5 +++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 3cb23cb..993b904 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -173,19 +173,22 @@ data SimplifierMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplifierMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index c699478..1207089 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -141,19 +141,22 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index bdbd6a1..62e80ac 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -713,7 +713,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1065,7 +1067,7 @@ preInlineUnconditionally dflags env top_lvl bndr rhs | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | not (gopt Opt_SimplPreInlining dflags) = False | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode, isExitJoinId bndr = False | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 5582419..29b5433 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3354,8 +3354,9 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplUnfolding env top_lvl cont_mb id unf - | isExitJoinId id -- Do not inline exit join points - = return unf + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id + = return unf -- Do not inline exit join points | otherwise = is_bottoming `seq` -- See Note [Force bottoming field] do { dflags <- getDynFlags From git at git.haskell.org Mon Sep 4 15:49:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 15:49:00 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitify: The rhs of join points are also in tail-call position (4c3157d) Message-ID: <20170904154900.7DA8C3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/4c3157d2c31ce379141575d83a1eb97fedfac128/ghc >--------------------------------------------------------------- commit 4c3157d2c31ce379141575d83a1eb97fedfac128 Author: Joachim Breitner Date: Sun Sep 3 09:26:44 2017 +0100 Exitify: The rhs of join points are also in tail-call position >--------------------------------------------------------------- 4c3157d2c31ce379141575d83a1eb97fedfac128 compiler/simplCore/Exitify.hs | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index de29170..eb882e52 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -144,12 +144,36 @@ exitify in_scope pairs = return (dc, pats, rhs') return $ Case (deAnnotate scrut) bndr ty alts' - go captured (_, AnnLet ann_bind body) = do - let bind = deAnnBind ann_bind - body' <- go (bindersOf bind ++ captured) body - return $ Let bind body' - - go _ ann_e = return (deAnnotate ann_e) -- TODO: What else is a tail-call position? + go captured (_, AnnLet ann_bind body) + -- join point, RHS and body are tail-called + | AnnNonRec j rhs <- ann_bind + , Just join_arity <- isJoinId_maybe j + = do let (params, join_body) = collectNAnnBndrs join_arity rhs + join_body' <- go (params ++ captured) join_body + let rhs' = mkLams params join_body' + body' <- go (j : captured) body + return $ Let (NonRec j rhs') body' + + -- rec join point, RHSs and body are tail-called + | AnnRec pairs <- ann_bind + , isJoinId (fst (head pairs)) + = do let js = map fst pairs + pairs' <- forM pairs $ \(j,rhs) -> do + let join_arity = idJoinArity j + (params, join_body) = collectNAnnBndrs join_arity rhs + join_body' <- go (params ++ js ++ captured) join_body + let rhs' = mkLams params join_body' + return (j, rhs') + body' <- go (js ++ captured) body + return $ Let (Rec pairs') body' + + -- normal Let, only the body is tail-called + | otherwise + = do body' <- go (bindersOf bind ++ captured) body + return $ Let bind body' + where bind = deAnnBind ann_bind + + go _ ann_e = return (deAnnotate ann_e) -- Picks a new unique, which is disjoint from From git at git.haskell.org Mon Sep 4 15:49:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 15:49:03 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitification: Do not try to abstract over join points (46c9cb7) Message-ID: <20170904154903.505F13A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/46c9cb7fe25a5cf3e1e1df9299e7afe27b66c5e3/ghc >--------------------------------------------------------------- commit 46c9cb7fe25a5cf3e1e1df9299e7afe27b66c5e3 Author: Joachim Breitner Date: Mon Sep 4 16:48:12 2017 +0100 Exitification: Do not try to abstract over join points >--------------------------------------------------------------- 46c9cb7fe25a5cf3e1e1df9299e7afe27b66c5e3 compiler/simplCore/Exitify.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index cc4172d..6381b14 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -106,11 +106,13 @@ exitify in_scope pairs = -- Do not touch a boring expression | is_exit, not is_interesting = return e + -- Cannot float out if local join points are used + | is_exit, captures_join_points = return e + -- We have something to float out! | is_exit = do -- Assemble the RHS of the exit join point - let args = filter (`elemVarSet` fvs) captured - rhs = mkLams args e + let rhs = mkLams args e ty = exprType rhs -- Pick a suitable name v <- mkExitJoinId ty (length args) captured @@ -121,10 +123,17 @@ exitify in_scope pairs = where -- An exit expression has no recursive calls is_exit = disjointVarSet fvs recursive_calls + -- An interesting exit expression has free variables from -- outside the recursive group is_interesting = not (isEmptyVarSet (fvs `minusVarSet` mkVarSet captured)) + -- The possible arguments of this exit join point + args = filter (`elemVarSet` fvs) captured + + -- We cannot abstract over join points + captures_join_points = any isJoinId args + e = deAnnotate ann_e fvs = dVarSetToVarSet (freeVarsOf ann_e) From git at git.haskell.org Mon Sep 4 15:49:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 15:49:08 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitification: The body of a let is also in tail-call position (23c3a9e) Message-ID: <20170904154908.C8CD53A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/23c3a9e58a0933b0f80c5b1dc92365f3714d66e6/ghc >--------------------------------------------------------------- commit 23c3a9e58a0933b0f80c5b1dc92365f3714d66e6 Author: Joachim Breitner Date: Sun Sep 3 09:15:02 2017 +0100 Exitification: The body of a let is also in tail-call position >--------------------------------------------------------------- 23c3a9e58a0933b0f80c5b1dc92365f3714d66e6 compiler/coreSyn/CoreSyn.hs | 10 +++++----- compiler/simplCore/Exitify.hs | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 99478d2..4c87b62 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -77,7 +77,7 @@ module CoreSyn ( collectAnnArgs, collectAnnArgsTicks, -- ** Operations on annotations - deAnnotate, deAnnotate', deAnnAlt, + deAnnotate, deAnnotate', deAnnAlt, deAnnBind, collectAnnBndrs, collectNAnnBndrs, -- * Orphanhood @@ -2158,16 +2158,16 @@ deAnnotate' (AnnTick tick body) = Tick tick (deAnnotate body) deAnnotate' (AnnLet bind body) = Let (deAnnBind bind) (deAnnotate body) - where - deAnnBind (AnnNonRec var rhs) = NonRec var (deAnnotate rhs) - deAnnBind (AnnRec pairs) = Rec [(v,deAnnotate rhs) | (v,rhs) <- pairs] - deAnnotate' (AnnCase scrut v t alts) = Case (deAnnotate scrut) v t (map deAnnAlt alts) deAnnAlt :: AnnAlt bndr annot -> Alt bndr deAnnAlt (con,args,rhs) = (con,args,deAnnotate rhs) +deAnnBind :: AnnBind b annot -> Bind b +deAnnBind (AnnNonRec var rhs) = NonRec var (deAnnotate rhs) +deAnnBind (AnnRec pairs) = Rec [(v,deAnnotate rhs) | (v,rhs) <- pairs] + -- | As 'collectBinders' but for 'AnnExpr' rather than 'Expr' collectAnnBndrs :: AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot) collectAnnBndrs e diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 6381b14..de29170 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -144,6 +144,11 @@ exitify in_scope pairs = return (dc, pats, rhs') return $ Case (deAnnotate scrut) bndr ty alts' + go captured (_, AnnLet ann_bind body) = do + let bind = deAnnBind ann_bind + body' <- go (bindersOf bind ++ captured) body + return $ Let bind body' + go _ ann_e = return (deAnnotate ann_e) -- TODO: What else is a tail-call position? From git at git.haskell.org Mon Sep 4 15:49:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 15:49:06 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (5a3d4f1) Message-ID: <20170904154906.103643A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/5a3d4f10736a1a5eb700ae6a78826daedd7b09d4/ghc >--------------------------------------------------------------- commit 5a3d4f10736a1a5eb700ae6a78826daedd7b09d4 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 5a3d4f10736a1a5eb700ae6a78826daedd7b09d4 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/SimplCore.hs | 17 ++++++++++------- compiler/simplCore/SimplUtils.hs | 6 ++++-- compiler/simplCore/Simplify.hs | 5 +++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 3cb23cb..993b904 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -173,19 +173,22 @@ data SimplifierMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplifierMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index c699478..1207089 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -141,19 +141,22 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index bdbd6a1..62e80ac 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -713,7 +713,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1065,7 +1067,7 @@ preInlineUnconditionally dflags env top_lvl bndr rhs | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | not (gopt Opt_SimplPreInlining dflags) = False | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode, isExitJoinId bndr = False | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 5582419..29b5433 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3354,8 +3354,9 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplUnfolding env top_lvl cont_mb id unf - | isExitJoinId id -- Do not inline exit join points - = return unf + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id + = return unf -- Do not inline exit join points | otherwise = is_bottoming `seq` -- See Note [Force bottoming field] do { dflags <- getDynFlags From git at git.haskell.org Mon Sep 4 20:22:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 20:22:02 +0000 (UTC) Subject: [commit: ghc] master: Move NonEmpty definition into GHC.Base (cb3363e) Message-ID: <20170904202202.E56033A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb3363e921fa58f9ad462d4bf5f4c819f910bf2a/ghc >--------------------------------------------------------------- commit cb3363e921fa58f9ad462d4bf5f4c819f910bf2a Author: Herbert Valerio Riedel Date: Sat Sep 2 21:52:21 2017 +0200 Move NonEmpty definition into GHC.Base This is a preparatory refactoring for Semigroup=>Monoid as it prevents a messy .hs-boot file which would interact inconveniently with the buildsystem... >--------------------------------------------------------------- cb3363e921fa58f9ad462d4bf5f4c819f910bf2a libraries/base/Control/Monad/Fix.hs | 10 ++- libraries/base/Control/Monad/Zip.hs | 7 ++ libraries/base/Data/Data.hs | 3 + libraries/base/Data/Foldable.hs | 10 +++ libraries/base/Data/Functor/Classes.hs | 22 ++++++ libraries/base/Data/List/NonEmpty.hs | 86 +--------------------- libraries/base/Data/Traversable.hs | 6 +- libraries/base/GHC/Base.hs | 29 ++++++++ libraries/base/GHC/Exts.hs | 9 +++ libraries/base/GHC/Generics.hs | 4 +- libraries/base/GHC/Read.hs | 2 + libraries/base/GHC/Show.hs | 1 + testsuite/tests/ado/T13242a.stderr | 4 +- .../tests/annotations/should_fail/annfail10.stderr | 2 +- .../tests/ghci.debugger/scripts/break006.stderr | 4 +- .../tests/ghci.debugger/scripts/print019.stderr | 2 +- .../tests/indexed-types/should_fail/T12522a.stderr | 2 +- .../should_fail/overloadedlistsfail01.stderr | 4 +- .../partial-sigs/should_compile/T10403.stderr | 2 +- .../tests/partial-sigs/should_fail/T10999.stderr | 4 +- testsuite/tests/polykinds/T13393.stderr | 2 +- .../tests/typecheck/should_compile/holes2.stderr | 2 +- .../tests/typecheck/should_fail/T10971b.stderr | 8 +- .../tests/typecheck/should_fail/T12921.stderr | 2 +- .../tests/typecheck/should_fail/T13292.stderr | 2 +- testsuite/tests/typecheck/should_fail/T5095.stderr | 4 +- .../tests/typecheck/should_fail/tcfail072.stderr | 4 +- .../tests/typecheck/should_fail/tcfail133.stderr | 2 +- .../tests/typecheck/should_fail/tcfail181.stderr | 2 +- 29 files changed, 128 insertions(+), 113 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 cb3363e921fa58f9ad462d4bf5f4c819f910bf2a From git at git.haskell.org Mon Sep 4 22:15:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 22:15:58 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (f432062) Message-ID: <20170904221558.4AE413A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/f4320629423ca77ddaccf09c1116417271b0cf79/ghc >--------------------------------------------------------------- commit f4320629423ca77ddaccf09c1116417271b0cf79 Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- f4320629423ca77ddaccf09c1116417271b0cf79 compiler/basicTypes/Id.hs | 5 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 3 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 204 +++++++++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 6 ++ compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 7 +- 11 files changed, 236 insertions(+), 8 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 f4320629423ca77ddaccf09c1116417271b0cf79 From git at git.haskell.org Mon Sep 4 22:16:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Sep 2017 22:16:01 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (9239e54) Message-ID: <20170904221601.1ACEA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/9239e54aeaef9a26a646eadeaa54bf30a363f8dc/ghc >--------------------------------------------------------------- commit 9239e54aeaef9a26a646eadeaa54bf30a363f8dc Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 9239e54aeaef9a26a646eadeaa54bf30a363f8dc compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/SimplCore.hs | 17 ++++++++++------- compiler/simplCore/SimplUtils.hs | 6 ++++-- compiler/simplCore/Simplify.hs | 5 +++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 3cb23cb..993b904 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -173,19 +173,22 @@ data SimplifierMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplifierMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index c699478..1207089 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -141,19 +141,22 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index bdbd6a1..62e80ac 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -713,7 +713,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1065,7 +1067,7 @@ preInlineUnconditionally dflags env top_lvl bndr rhs | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | not (gopt Opt_SimplPreInlining dflags) = False | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode, isExitJoinId bndr = False | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 5582419..29b5433 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3354,8 +3354,9 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplUnfolding env top_lvl cont_mb id unf - | isExitJoinId id -- Do not inline exit join points - = return unf + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id + = return unf -- Do not inline exit join points | otherwise = is_bottoming `seq` -- See Note [Force bottoming field] do { dflags <- getDynFlags From git at git.haskell.org Tue Sep 5 11:22:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:00 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #14129 (b996e12) Message-ID: <20170905112200.A6C253A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b996e12d2c6a838a9c6d8096142f07de5cb7fedc/ghc >--------------------------------------------------------------- commit b996e12d2c6a838a9c6d8096142f07de5cb7fedc Author: Ben Gamari Date: Mon Sep 4 07:59:07 2017 -0400 testsuite: Add test for #14129 It's not impossible that this will also get caught by another test given a suitably configured compiler, but this is minimal enough that it seems worth including. Test Plan: Validate with `DYNAMIC_GHC_PROGRAMS=NO` Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14129 Differential Revision: https://phabricator.haskell.org/D3924 >--------------------------------------------------------------- b996e12d2c6a838a9c6d8096142f07de5cb7fedc testsuite/tests/annotations/should_compile/T14129.hs | 3 +++ testsuite/tests/annotations/should_compile/all.T | 1 + 2 files changed, 4 insertions(+) diff --git a/testsuite/tests/annotations/should_compile/T14129.hs b/testsuite/tests/annotations/should_compile/T14129.hs new file mode 100644 index 0000000..131a29d --- /dev/null +++ b/testsuite/tests/annotations/should_compile/T14129.hs @@ -0,0 +1,3 @@ +module T14129 where + +{-# ANN module "KABOOM" #-} diff --git a/testsuite/tests/annotations/should_compile/all.T b/testsuite/tests/annotations/should_compile/all.T index b2c9a59..be81c4f 100644 --- a/testsuite/tests/annotations/should_compile/all.T +++ b/testsuite/tests/annotations/should_compile/all.T @@ -3,6 +3,7 @@ # program twice and use -osuf p_o (see the TH_spliceE5_prof test). For # now, just disable the profiling ways. test('ann01', [req_interp, omit_ways(prof_ways)], compile, ['-v0']) +test('T14129', [req_interp, omit_ways(prof_ways)], compile, ['-v0']) """" Helpful things to C+P: From git at git.haskell.org Tue Sep 5 11:22:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:03 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix validation of ways (31281a4) Message-ID: <20170905112203.7368E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31281a476ded406091d0eaefc9d6f466272c985f/ghc >--------------------------------------------------------------- commit 31281a476ded406091d0eaefc9d6f466272c985f Author: Ben Gamari Date: Mon Sep 4 07:58:48 2017 -0400 testsuite: Fix validation of ways Test Plan: Run `make test WAY=prof` Reviewers: angerman, austin Subscribers: rwbarton, thomie GHC Trac Issues: #14181 Differential Revision: https://phabricator.haskell.org/D3917 >--------------------------------------------------------------- 31281a476ded406091d0eaefc9d6f466272c985f testsuite/driver/runtests.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 3e03ed3..9f74494 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -51,8 +51,8 @@ parser.add_argument("--rootdir", action='append', help="root of tree containing parser.add_argument("--summary-file", help="file in which to save the (human-readable) summary") parser.add_argument("--no-print-summary", action="store_true", help="should we print the summary?") parser.add_argument("--only", action="append", help="just this test (can be give multiple --only= flags)") -parser.add_argument("--way", choices=config.run_ways+config.compile_ways+config.other_ways, help="just this way") -parser.add_argument("--skipway", action="append", choices=config.run_ways+config.compile_ways+config.other_ways, help="skip this way") +parser.add_argument("--way", action="append", help="just this way") +parser.add_argument("--skipway", action="append", help="skip this way") parser.add_argument("--threads", type=int, help="threads to run simultaneously") parser.add_argument("--check-files-written", help="check files aren't written by multiple tests") # NOTE: This doesn't seem to exist? parser.add_argument("--verbose", type=int, choices=[0,1,2,3,4,5], help="verbose (Values 0 through 5 accepted)") @@ -71,6 +71,7 @@ for arg in args.config: field, value = arg.split('=', 1) setattr(config, field, value) +all_ways = config.run_ways+config.compile_ways+config.other_ways config.rootdirs = args.rootdir config.summary_file = args.summary_file config.no_print_summary = args.no_print_summary @@ -80,15 +81,23 @@ if args.only: config.run_only_some_tests = True if args.way: - config.cmdline_ways = [args.way] + config.cmdline_ways - if (args.way in config.other_ways): - config.run_ways = [args.way] + config.run_ways - config.compile_ways = [args.way] + config.compile_ways + for way in args.way: + if way not in all_ways: + print('WARNING: Unknown WAY %s in --way' % way) + else: + config.cmdline_ways += [way] + if way in config.other_ways: + config.run_ways += [way] + config.compile_ways += [way] if args.skipway: - config.other_ways = [w for w in config.other_ways if w != args.skipway] - config.run_ways = [w for w in config.run_ways if w != args.skipway] - config.compile_ways = [w for w in config.compile_ways if w != args.skipway] + for way in args.skipway: + if way not in all_ways: + print('WARNING: Unknown WAY %s in --skipway' % way) + + config.other_ways = [w for w in config.other_ways if w not in args.skipway] + config.run_ways = [w for w in config.run_ways if w not in args.skipway] + config.compile_ways = [w for w in config.compile_ways if w not in args.skipway] if args.threads: config.threads = args.threads From git at git.haskell.org Tue Sep 5 11:22:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:06 +0000 (UTC) Subject: [commit: ghc] master: Remember the AvailInfo for each IE (7e5d4a0) Message-ID: <20170905112206.6D9F53A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e5d4a0e8e673f79b93ff63c4a4d0cd2b71e3063/ghc >--------------------------------------------------------------- commit 7e5d4a0e8e673f79b93ff63c4a4d0cd2b71e3063 Author: alexbiehl Date: Mon Sep 4 07:59:48 2017 -0400 Remember the AvailInfo for each IE This is another take on https://phabricator.haskell.org/D3844. This patch removes then need for haddock to reimplement the calculation of exported names from modules. Instead when renaming export lists ghc annotates each IE with its exported names. Haddocks current export logic has caused lots of trouble in the past (on the Github issue tracker): - https://github.com/haskell/haddock/issues/121 - https://github.com/haskell/haddock/issues/174 - https://github.com/haskell/haddock/issues/225 - https://github.com/haskell/haddock/issues/344 - https://github.com/haskell/haddock/issues/584 - https://github.com/haskell/haddock/issues/591 - https://github.com/haskell/haddock/issues/597 Updates haddock submodule. Reviewers: austin, bgamari, ezyang Reviewed By: bgamari, ezyang Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3864 >--------------------------------------------------------------- 7e5d4a0e8e673f79b93ff63c4a4d0cd2b71e3063 compiler/basicTypes/Avail.hs | 4 +++- compiler/main/GHC.hs | 2 +- compiler/main/HscMain.hs | 3 ++- compiler/typecheck/TcBackpack.hs | 2 +- compiler/typecheck/TcRnExports.hs | 36 ++++++++++++++++++++---------------- compiler/typecheck/TcRnTypes.hs | 6 ++++-- utils/haddock | 2 +- 7 files changed, 32 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 7e5d4a0e8e673f79b93ff63c4a4d0cd2b71e3063 From git at git.haskell.org Tue Sep 5 11:22:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:10 +0000 (UTC) Subject: [commit: ghc] master: Fix egregious duplication of vars in RnTypes (b9ac9e0) Message-ID: <20170905112211.000183A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b9ac9e05b29c58efc93b78bf7fca43d61ead50c7/ghc >--------------------------------------------------------------- commit b9ac9e05b29c58efc93b78bf7fca43d61ead50c7 Author: Ryan Scott Date: Mon Sep 4 08:00:29 2017 -0400 Fix egregious duplication of vars in RnTypes `RnTypes` contains a fairly intricate algorithm to extract the kind and type variables of an HsType. This algorithm carefully maintains the separation between type variables and kind variables so that the difference between `-XPolyKinds` and `-XTypeInType` can be respected. But after doing all this, `rmDupsInRdrTyVars` stupidly just concatenated the lists of type and kind variables at the end. If a variable were used as both a type and a kind, the algorithm would produce *both*! This led to all kinds of problems, including #13988. This is mostly Richard Eisenberg's patch. The only original contribution I made was adapting call sites of `rnImplicitBndrs` to work with the new definition of `rmDupsInRdrTyVars`. That is, `rnImplicitBndrs` checks for variables that are illegally used in both type and kind positions without using `-XTypeInType`, but in order to check this, one cannot have filtered duplicate variables out before passing them to `rnImplicitBndrs`. To accommodate for this, I needed to concoct variations on the existing `extract-` functions in `RnTypes` which do not remove duplicates, and use those near `rnImplicitBndrs` call sites. test case: ghci/scripts/T13988 Test Plan: make test TEST=T13988 Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: goldfire, simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #13988 Differential Revision: https://phabricator.haskell.org/D3902 >--------------------------------------------------------------- b9ac9e05b29c58efc93b78bf7fca43d61ead50c7 compiler/rename/RnTypes.hs | 131 ++++++++++++++++++++++------- testsuite/tests/ghci/scripts/T13988.hs | 8 ++ testsuite/tests/ghci/scripts/T13988.script | 2 + testsuite/tests/ghci/scripts/T13988.stdout | 1 + testsuite/tests/ghci/scripts/all.T | 1 + 5 files changed, 114 insertions(+), 29 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b9ac9e05b29c58efc93b78bf7fca43d61ead50c7 From git at git.haskell.org Tue Sep 5 11:22:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:14 +0000 (UTC) Subject: [commit: ghc] master: base: Update acosh to handle -1::Complex (6458b8d) Message-ID: <20170905112214.6BBDE3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6458b8dcbd33b3c32f3c23f7e5b08fdc6e73ed46/ghc >--------------------------------------------------------------- commit 6458b8dcbd33b3c32f3c23f7e5b08fdc6e73ed46 Author: Alex Bradley Date: Mon Sep 4 08:08:46 2017 -0400 base: Update acosh to handle -1::Complex Summary: Fixes #8532 Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #8532 Differential Revision: https://phabricator.haskell.org/D3916 >--------------------------------------------------------------- 6458b8dcbd33b3c32f3c23f7e5b08fdc6e73ed46 libraries/base/Data/Complex.hs | 3 ++- testsuite/tests/numeric/should_run/all.T | 1 + testsuite/tests/numeric/should_run/numrun016.hs | 8 ++++++++ testsuite/tests/numeric/should_run/numrun016.stdout | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Complex.hs b/libraries/base/Data/Complex.hs index dd3e0ec..e4ed4e8 100644 --- a/libraries/base/Data/Complex.hs +++ b/libraries/base/Data/Complex.hs @@ -197,7 +197,8 @@ instance (RealFloat a) => Floating (Complex a) where where (x':+y') = log (((1-y):+x) / sqrt (1+z*z)) asinh z = log (z + sqrt (1+z*z)) - acosh z = log (z + (z+1) * sqrt ((z-1)/(z+1))) + -- Take care to allow (-1)::Complex, fixing #8532 + acosh z = log (z + (sqrt $ z+1) * (sqrt $ z-1)) atanh z = 0.5 * log ((1.0+z) / (1.0-z)) log1p x@(a :+ b) diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index 2d2353b..fd9c05f 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -34,6 +34,7 @@ test('numrun012', normal, compile_and_run, ['']) test('numrun013', normal, compile_and_run, ['']) test('numrun014', normal, compile_and_run, ['']) test('numrun015', normal, compile_and_run, ['']) +test('numrun016', normal, compile_and_run, ['']) test('arith016', normal, compile_and_run, ['']) test('arith017', normal, compile_and_run, ['']) test('arith018', normal, compile_and_run, ['']) diff --git a/testsuite/tests/numeric/should_run/numrun016.hs b/testsuite/tests/numeric/should_run/numrun016.hs new file mode 100644 index 0000000..c45e322 --- /dev/null +++ b/testsuite/tests/numeric/should_run/numrun016.hs @@ -0,0 +1,8 @@ +-- test for trac #8532 + +import Data.Complex + +main :: IO () +main = do + print $ acosh ((-1)::Complex Double) + print $ acosh ((-1)::Complex Float) diff --git a/testsuite/tests/numeric/should_run/numrun016.stdout b/testsuite/tests/numeric/should_run/numrun016.stdout new file mode 100644 index 0000000..25676f7 --- /dev/null +++ b/testsuite/tests/numeric/should_run/numrun016.stdout @@ -0,0 +1,2 @@ +0.0 :+ 3.141592653589793 +0.0 :+ 3.1415927 \ No newline at end of file From git at git.haskell.org Tue Sep 5 11:22:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:17 +0000 (UTC) Subject: [commit: ghc] master: get-win32-tarballs: Use bash, not sh (1300afa) Message-ID: <20170905112217.31E2E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1300afaa6d0ab20d7891b2f42d0f02268582692b/ghc >--------------------------------------------------------------- commit 1300afaa6d0ab20d7891b2f42d0f02268582692b Author: Ben Gamari Date: Mon Sep 4 08:00:48 2017 -0400 get-win32-tarballs: Use bash, not sh The script appears to use the local keyword, which I'm fairly certain is a feature of bash and not sh. Reviewers: Phyx, austin Reviewed By: Phyx Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3906 >--------------------------------------------------------------- 1300afaa6d0ab20d7891b2f42d0f02268582692b mk/get-win32-tarballs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index 7f3b544..75889ee 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash tarball_dir='ghc-tarballs' missing_files=0 From git at git.haskell.org Tue Sep 5 11:22:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:20 +0000 (UTC) Subject: [commit: ghc] master: get-win32-tarballs: Use correct `find` (a4c2ac2) Message-ID: <20170905112220.097E43A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a4c2ac2cef3d0ad3c968b8195daf651e672d3435/ghc >--------------------------------------------------------------- commit a4c2ac2cef3d0ad3c968b8195daf651e672d3435 Author: Ben Gamari Date: Mon Sep 4 08:01:04 2017 -0400 get-win32-tarballs: Use correct `find` This fixes #12502 by using the `find` utility found by FP_PROG_FIND instead of the first one in PATH. Test Plan: Validate on Windows Reviewers: Phyx, austin, hvr Reviewed By: Phyx Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #12502 Differential Revision: https://phabricator.haskell.org/D3907 >--------------------------------------------------------------- a4c2ac2cef3d0ad3c968b8195daf651e672d3435 distrib/configure.ac.in | 6 ++++++ mk/get-win32-tarballs.sh | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 7c27dad..9a94cf2 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -63,6 +63,12 @@ dnl ** figure out how to do a BSD-ish install ** AC_PROG_INSTALL # +dnl ** find `find`, used by get-win32-tarballs.sh (see #12502) +# +FP_PROG_FIND() +export FIND + +# dnl ** how to do symlinks ** # AC_PROG_LN_S() diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index 75889ee..b3c9e07 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -3,6 +3,9 @@ tarball_dir='ghc-tarballs' missing_files=0 +# see #12502 +if test -z "$FIND"; then FIND="find"; fi + fail() { echo >&2 echo "$1" >&2 @@ -148,16 +151,16 @@ sync_binaries_and_sources() { verify=0 download_sources - for f in $(find ghc-tarballs/mingw-w64 -iname '*.sig'); do + for f in $($FIND ghc-tarballs/mingw-w64 -iname '*.sig'); do echo "Verifying $f" gpg --verify $f done - md5sum `find ghc-tarballs -type f -a -not -iname '*.sig'` >| mk/win32-tarballs.md5sum + md5sum `$FIND ghc-tarballs -type f -a -not -iname '*.sig'` >| mk/win32-tarballs.md5sum chmod -R ugo+rX ghc-tarballs rsync -av ghc-tarballs/mingw-w64/* downloads.haskell.org:public_html/mingw - for f in $(find ghc-tarballs/mingw-w64); do + for f in $($FIND ghc-tarballs/mingw-w64); do curl -XPURGE http://downloads.haskell.org/~ghc/mingw/$f done } From git at git.haskell.org Tue Sep 5 11:22:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:22 +0000 (UTC) Subject: [commit: ghc] master: SetLevels: Substitute in ticks in lvlMFE (cd857dd) Message-ID: <20170905112222.C14E73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cd857dd415378ac4204a164407d350b0c3ede5ae/ghc >--------------------------------------------------------------- commit cd857dd415378ac4204a164407d350b0c3ede5ae Author: Ben Gamari Date: Mon Sep 4 08:05:33 2017 -0400 SetLevels: Substitute in ticks in lvlMFE Previously SetLevels.lvlMFE would fail to substitute in ticks, unlike lvlExpr. This lead to #13481. Fix this. Test Plan: `make test TEST=T12622 WAY=ghci` Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13481 Differential Revision: https://phabricator.haskell.org/D3920 >--------------------------------------------------------------- cd857dd415378ac4204a164407d350b0c3ede5ae compiler/simplCore/SetLevels.hs | 3 ++- testsuite/tests/codeGen/should_run/all.T | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 57b1671..f6077dc 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -558,7 +558,8 @@ lvlMFE env _ (_, AnnType ty) -- and then inline lvl. Better just to float out the payload. lvlMFE env strict_ctxt (_, AnnTick t e) = do { e' <- lvlMFE env strict_ctxt e - ; return (Tick t e') } + ; let t' = substTickish (le_subst env) t + ; return (Tick t' e') } lvlMFE env strict_ctxt (_, AnnCast e (_, co)) = do { e' <- lvlMFE env strict_ctxt e diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 6318341..271a420 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -148,7 +148,7 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) -test('T12622', expect_broken_for(13481, ['ghci']), multimod_compile_and_run, ['T12622', '-O']) +test('T12622', normal, multimod_compile_and_run, ['T12622', '-O']) test('T12757', normal, compile_and_run, ['']) test('T12855', normal, compile_and_run, ['']) test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), From git at git.haskell.org Tue Sep 5 11:22:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:26 +0000 (UTC) Subject: [commit: ghc] master: Replace hashing function for string keys implementation with xxhash (542f89f) Message-ID: <20170905112226.AA7ED3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/542f89ff23e4deb66debca0b5de3ac3047befb28/ghc >--------------------------------------------------------------- commit 542f89ff23e4deb66debca0b5de3ac3047befb28 Author: Tamar Christina Date: Mon Sep 4 08:02:15 2017 -0400 Replace hashing function for string keys implementation with xxhash When doing profiling on startup time of ghci on Windows, both cold and startup loading static LLVM libs, the profiler is showing a glaring red spot on the division operation of the the hashStr function. In fact profiling shows 14% of the time is spent hashing the keys. So I am replacing the hash function with xxHash which is a very fast non-crypto hash. It's faster than MurMurHash which node etc use. It also passes SMHasher. I can provide if required the collected raw data. But from analysis done on the keys, xxHash does not introduce more collisions than before, the amount splits seem about the same and the distributions among the buckets are slightly more uniform than before. However the runtime dropped enough to remove the function completely from the profiler's report. There's also a noticeable improvement in responsiveness. xxHash is BSD licensed and can be found https://github.com/Cyan4973/xxHash Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13165 Differential Revision: https://phabricator.haskell.org/D3909 >--------------------------------------------------------------- 542f89ff23e4deb66debca0b5de3ac3047befb28 rts/Hash.c | 17 +- rts/ghc.mk | 2 + rts/xxhash.c | 888 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rts/xxhash.h | 293 ++++++++++++++++++++ 4 files changed, 1190 insertions(+), 10 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 542f89ff23e4deb66debca0b5de3ac3047befb28 From git at git.haskell.org Tue Sep 5 11:22:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:29 +0000 (UTC) Subject: [commit: ghc] master: StgLint: Show constructor arity in mismatch message (c2881a2) Message-ID: <20170905112229.67F793A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2881a23319d91c6e1301a6fd149ca37a3bcfc1e/ghc >--------------------------------------------------------------- commit c2881a23319d91c6e1301a6fd149ca37a3bcfc1e Author: Ben Gamari Date: Mon Sep 4 08:14:11 2017 -0400 StgLint: Show constructor arity in mismatch message Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3921 >--------------------------------------------------------------- c2881a23319d91c6e1301a6fd149ca37a3bcfc1e compiler/stgSyn/StgLint.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/stgSyn/StgLint.hs b/compiler/stgSyn/StgLint.hs index 5140a47..90628f0 100644 --- a/compiler/stgSyn/StgLint.hs +++ b/compiler/stgSyn/StgLint.hs @@ -490,7 +490,7 @@ mkAlgAltMsg3 :: DataCon -> [Id] -> MsgDoc mkAlgAltMsg3 con alts = vcat [ text "In some algebraic case alternative, number of arguments doesn't match constructor:", - ppr con, + ppr con <+> parens (text "arity" <+> ppr (dataConRepArity con)), ppr alts ] From git at git.haskell.org Tue Sep 5 11:22:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:32 +0000 (UTC) Subject: [commit: ghc] master: rts: Add heap breakdown type for -hT (24e50f9) Message-ID: <20170905112232.251663A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/24e50f988f775c6bba7d1daaee2e23c13650aa3b/ghc >--------------------------------------------------------------- commit 24e50f988f775c6bba7d1daaee2e23c13650aa3b Author: Ben Gamari Date: Mon Sep 4 08:15:08 2017 -0400 rts: Add heap breakdown type for -hT Test Plan: Build, program with `-eventlog`, try running with `+RTS -h` Reviewers: austin, erikd, simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14096 Differential Revision: https://phabricator.haskell.org/D3922 >--------------------------------------------------------------- 24e50f988f775c6bba7d1daaee2e23c13650aa3b docs/users_guide/profiling.rst | 4 ++++ includes/rts/EventLogFormat.h | 1 + rts/eventlog/EventLog.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 589fbdb..def3596 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -687,6 +687,10 @@ All the different profile types yield a graph of live heap against time, but they differ in how the live heap is broken down into bands. The following RTS options select which break-down to use: +.. rts-flag:: -hT + + Breaks down the graph by heap closure type. + .. rts-flag:: -hc -h diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h index d7b465a..b3ad52b 100644 --- a/includes/rts/EventLogFormat.h +++ b/includes/rts/EventLogFormat.h @@ -241,6 +241,7 @@ typedef enum { HEAP_PROF_BREAKDOWN_TYPE_DESCR, HEAP_PROF_BREAKDOWN_RETAINER, HEAP_PROF_BREAKDOWN_BIOGRAPHY, + HEAP_PROF_BREAKDOWN_CLOSURE_TYPE, } HeapProfBreakdown; #if !defined(EVENTLOG_CONSTANTS_ONLY) diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index c8b4485..619d576 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -1109,6 +1109,8 @@ static HeapProfBreakdown getHeapProfBreakdown(void) return HEAP_PROF_BREAKDOWN_RETAINER; case HEAP_BY_LDV: return HEAP_PROF_BREAKDOWN_BIOGRAPHY; + case HEAP_BY_CLOSURE_TYPE: + return HEAP_PROF_BREAKDOWN_CLOSURE_TYPE; default: barf("getHeapProfBreakdown: unknown heap profiling mode"); } From git at git.haskell.org Tue Sep 5 11:22:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 11:22:34 +0000 (UTC) Subject: [commit: ghc] master: eventlog: Clean up profiling heap breakdown type (822abbb) Message-ID: <20170905112234.E068E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/822abbb1b4300ebaa3f12014b9fc477261283143/ghc >--------------------------------------------------------------- commit 822abbb1b4300ebaa3f12014b9fc477261283143 Author: Ben Gamari Date: Mon Sep 4 08:14:38 2017 -0400 eventlog: Clean up profiling heap breakdown type Reviewers: austin, erikd, simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14096 Differential Revision: https://phabricator.haskell.org/D3923 >--------------------------------------------------------------- 822abbb1b4300ebaa3f12014b9fc477261283143 docs/users_guide/eventlog-formats.rst | 13 +++++++------ docs/users_guide/profiling.rst | 29 +++++++++++++++-------------- includes/rts/EventLogFormat.h | 12 ++++++++++++ rts/eventlog/EventLog.c | 9 --------- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst index 8b1427d..9910d4d 100644 --- a/docs/users_guide/eventlog-formats.rst +++ b/docs/users_guide/eventlog-formats.rst @@ -33,12 +33,13 @@ A single fixed-width event emitted during program start-up describing the sample * ``Word64``: Sampling period in nanoseconds * ``Word32``: Sample break-down type. One of, - * ``SAMPLE_TYPE_COST_CENTER`` (output from ``-hc``) - * ``SAMPLE_TYPE_CLOSURE_DESCR`` (output from ``-hd``) - * ``SAMPLE_TYPE_RETAINER`` (output from ``-hr``) - * ``SAMPLE_TYPE_MODULE`` (output from ``-hm``) - * ``SAMPLE_TYPE_TYPE_DESCR`` (output from ``-hy``) - * ``SAMPLE_TYPE_BIOGRAPHY`` (output from ``-hb``) + * ``HEAP_PROF_BREAKDOWN_COST_CENTER`` (output from :rts-flag:`-hc`) + * ``HEAP_PROF_BREAKDOWN_CLOSURE_DESCR`` (output from :rts-flag:`-hd`) + * ``HEAP_PROF_BREAKDOWN_RETAINER`` (output from :rts-flag:`-hr`) + * ``HEAP_PROF_BREAKDOWN_MODULE`` (output from :rts-flag:`-hm`) + * ``HEAP_PROF_BREAKDOWN_TYPE_DESCR`` (output from :rts-flag:`-hy`) + * ``HEAP_PROF_BREAKDOWN_BIOGRAPHY`` (output from :rts-flag:`-hb`) + * ``HEAP_PROF_BREAKDOWN_CLOSURE_TYPE`` (output from :rts-flag:`-hT`) * ``String``: Module filter * ``String``: Closure description filter diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index ded6675..589fbdb 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -690,35 +690,36 @@ following RTS options select which break-down to use: .. rts-flag:: -hc -h - (can be shortened to :rts-flag:`-h`). Breaks down the graph by the - cost-centre stack which produced the data. + *Requires :ghc-flag:`-prof`.* Breaks down the graph by the cost-centre stack + which produced the data. .. rts-flag:: -hm - Break down the live heap by the module containing the code which - produced the data. + *Requires :ghc-flag:`-prof`.* Break down the live heap by the module + containing the code which produced the data. .. rts-flag:: -hd - Breaks down the graph by closure description. For actual data, the - description is just the constructor name, for other closures it is a - compiler-generated string identifying the closure. + *Requires :ghc-flag:`-prof`.* Breaks down the graph by closure description. + For actual data, the description is just the constructor name, for other + closures it is a compiler-generated string identifying the closure. .. rts-flag:: -hy - Breaks down the graph by type. For closures which have function type - or unknown/polymorphic type, the string will represent an - approximation to the actual type. + *Requires :ghc-flag:`-prof`.* Breaks down the graph by type. For closures + which have function type or unknown/polymorphic type, the string will + represent an approximation to the actual type. .. rts-flag:: -hr - Break down the graph by retainer set. Retainer profiling is - described in more detail below (:ref:`retainer-prof`). + *Requires :ghc-flag:`-prof`.* Break down the graph by retainer set. Retainer + profiling is described in more detail below (:ref:`retainer-prof`). .. rts-flag:: -hb - Break down the graph by biography. Biographical profiling is - described in more detail below (:ref:`biography-prof`). + *Requires :ghc-flag:`-prof`.* Break down the graph by biography. + Biographical profiling is described in more detail below + (:ref:`biography-prof`). .. rts-flag:: -l diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h index f839be0..d7b465a 100644 --- a/includes/rts/EventLogFormat.h +++ b/includes/rts/EventLogFormat.h @@ -231,6 +231,18 @@ #define CAPSET_TYPE_OSPROCESS 2 /* caps belong to the same OS process */ #define CAPSET_TYPE_CLOCKDOMAIN 3 /* caps share a local clock/time */ +/* + * Heap profile breakdown types. See EVENT_HEAP_PROF_BEGIN. + */ +typedef enum { + HEAP_PROF_BREAKDOWN_COST_CENTRE = 0x1, + HEAP_PROF_BREAKDOWN_MODULE, + HEAP_PROF_BREAKDOWN_CLOSURE_DESCR, + HEAP_PROF_BREAKDOWN_TYPE_DESCR, + HEAP_PROF_BREAKDOWN_RETAINER, + HEAP_PROF_BREAKDOWN_BIOGRAPHY, +} HeapProfBreakdown; + #if !defined(EVENTLOG_CONSTANTS_ONLY) typedef StgWord16 EventTypeNum; diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index ed297b8..c8b4485 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -1094,15 +1094,6 @@ void postBlockMarker (EventsBuf *eb) postCapNo(eb, eb->capno); } -typedef enum { - HEAP_PROF_BREAKDOWN_COST_CENTRE = 0x1, - HEAP_PROF_BREAKDOWN_MODULE, - HEAP_PROF_BREAKDOWN_CLOSURE_DESCR, - HEAP_PROF_BREAKDOWN_TYPE_DESCR, - HEAP_PROF_BREAKDOWN_RETAINER, - HEAP_PROF_BREAKDOWN_BIOGRAPHY, -} HeapProfBreakdown; - static HeapProfBreakdown getHeapProfBreakdown(void) { switch (RtsFlags.ProfFlags.doHeapProfile) { From git at git.haskell.org Tue Sep 5 15:10:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 15:10:20 +0000 (UTC) Subject: [commit: ghc] master: Implicitly bind kind variables in type family instance RHSes when it's sensible (0829821) Message-ID: <20170905151020.917A33A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0829821a6b886788a3ba6989e57e25a037bb6d05/ghc >--------------------------------------------------------------- commit 0829821a6b886788a3ba6989e57e25a037bb6d05 Author: Ryan Scott Date: Tue Sep 5 11:00:56 2017 -0400 Implicitly bind kind variables in type family instance RHSes when it's sensible Summary: Before, there was a discrepancy in how GHC renamed type synonyms as opposed to type family instances. That is, GHC would accept definitions like this one: ```lang=haskell type T = (Nothing :: Maybe a) ``` However, it would not accept a very similar type family instance: ```lang=haskell type family T :: Maybe a type instance T = (Nothing :: Maybe a) ``` The primary goal of this patch is to bring the renaming of type family instances up to par with that of type synonyms, causing the latter definition to be accepted, and fixing #14131. In particular, we now allow kind variables on the right-hand sides of type (and data) family instances to be //implicitly// bound by LHS type (or kind) patterns (as opposed to type variables, which must always be explicitly bound by LHS type patterns only). As a consequence, this allows programs reported in #7938 and #9574 to typecheck, whereas before they would have been rejected. Implementation-wise, there isn't much trickery involved in making this happen. We simply need to bind additional kind variables from the RHS of a type family in the right place (in particular, see `RnSource.rnFamInstEqn`, which has undergone a minor facelift). While doing this has the upside of fixing #14131, it also made it easier to trigger #13985, so I decided to fix that while I was in town. This was accomplished by a careful blast of `reportFloatingKvs` in `tcFamTyPats`. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #13985, #14131 Differential Revision: https://phabricator.haskell.org/D3872 >--------------------------------------------------------------- 0829821a6b886788a3ba6989e57e25a037bb6d05 compiler/rename/RnSource.hs | 81 ++++--- compiler/rename/RnTypes.hs | 15 +- compiler/typecheck/TcHsType.hs | 42 ++++ compiler/typecheck/TcTyClsDecls.hs | 30 ++- docs/users_guide/8.4.1-notes.rst | 18 ++ docs/users_guide/glasgow_exts.rst | 72 +++++- .../tests/indexed-types/should_compile/T14131.hs | 29 +++ testsuite/tests/indexed-types/should_compile/all.T | 1 + .../tests/indexed-types/should_fail/T5515.stderr | 8 +- .../tests/indexed-types/should_fail/T7938.stderr | 8 +- .../tests/parser/should_compile/DumpRenamedAst.hs | 9 +- .../parser/should_compile/DumpRenamedAst.stderr | 263 +++++++++++++++++---- testsuite/tests/polykinds/T13985.hs | 27 +++ testsuite/tests/polykinds/T13985.stderr | 39 +++ testsuite/tests/polykinds/T9574.stderr | 4 - testsuite/tests/polykinds/all.T | 3 +- 16 files changed, 542 insertions(+), 107 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 0829821a6b886788a3ba6989e57e25a037bb6d05 From git at git.haskell.org Tue Sep 5 17:48:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 17:48:05 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Fix small syntax error in perf/compiler/all.T (bd197c8) Message-ID: <20170905174805.EBB223A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/bd197c80381caaedcbe1b69ea89303f8a78f1b5c/ghc >--------------------------------------------------------------- commit bd197c80381caaedcbe1b69ea89303f8a78f1b5c Author: Jared Weakly Date: Tue Sep 5 10:50:06 2017 -0700 Fix small syntax error in perf/compiler/all.T >--------------------------------------------------------------- bd197c80381caaedcbe1b69ea89303f8a78f1b5c testsuite/driver/test_val | 76 ------------------------------------- testsuite/tests/perf/compiler/all.T | 2 - 2 files changed, 78 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bd197c80381caaedcbe1b69ea89303f8a78f1b5c From git at git.haskell.org Tue Sep 5 22:56:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Sep 2017 22:56:15 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Fix small issue in using perf_notes as a comparison tool and add redundancy to git note append in case of failure (fcf513d) Message-ID: <20170905225615.2DEB33A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/fcf513d52e15a8a3c6b2b31702406ae58a27be83/ghc >--------------------------------------------------------------- commit fcf513d52e15a8a3c6b2b31702406ae58a27be83 Author: Jared Weakly Date: Tue Sep 5 15:58:08 2017 -0700 Fix small issue in using perf_notes as a comparison tool and add redundancy to git note append in case of failure >--------------------------------------------------------------- fcf513d52e15a8a3c6b2b31702406ae58a27be83 testsuite/driver/perf_notes.py | 246 ++++++++++++++++++++--------------------- testsuite/driver/runtests.py | 16 +-- 2 files changed, 129 insertions(+), 133 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 fcf513d52e15a8a3c6b2b31702406ae58a27be83 From git at git.haskell.org Wed Sep 6 13:47:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 13:47:15 +0000 (UTC) Subject: [commit: ghc] wip/kavon-nosplit-llvm: adding linux support for table inserter (79dd250) Message-ID: <20170906134715.912F63A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/kavon-nosplit-llvm Link : http://ghc.haskell.org/trac/ghc/changeset/79dd250fb3dcb6e220f32a5fb2d8e59e562860d3/ghc >--------------------------------------------------------------- commit 79dd250fb3dcb6e220f32a5fb2d8e59e562860d3 Author: Kavon Farvardin Date: Wed Sep 6 14:46:47 2017 +0100 adding linux support for table inserter >--------------------------------------------------------------- 79dd250fb3dcb6e220f32a5fb2d8e59e562860d3 compiler/llvmGen/LlvmMangler.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs index a21b135..25c46dc 100644 --- a/compiler/llvmGen/LlvmMangler.hs +++ b/compiler/llvmGen/LlvmMangler.hs @@ -12,9 +12,9 @@ module LlvmMangler ( llvmFixupAsm, ManglerInfo, ManglerStr ) where import DynFlags ( DynFlags, targetPlatform ) -import Platform ( platformArch, Arch(..) ) +import Platform ( platformArch, Arch(..), platformOS, OS(..) ) import ErrUtils ( withTiming ) -import Outputable ( text ) +import Outputable ( text, panic ) import Control.Exception import qualified Data.ByteString.Char8 as B @@ -80,15 +80,22 @@ type LabRewrite = State -> Rewrite -- | This rewrite looks for return points of a llvm.cpscall and adds GC info -- above that label. addInfoTable :: LabelMap ManglerStr -> LabRewrite -addInfoTable info FirstLabel _ line = do +addInfoTable info FirstLabel dflags line = do retPt <- B.stripPrefix labPrefix line (i, _) <- B.readInt retPt statics <- mapLookup (toKey i) info fullName <- B.stripSuffix colon line return $ B.concat $ (map (\f -> f fullName) statics) ++ [line] where - -- TODO(kavon): check if prefix changes on different platforms. - labPrefix = B.pack "L" + + -- At a minimum, Mac and Linux assembly output from LLVM use different prefixes + -- basic block labels. It may be the case that one of the prefixes is very common, + -- but I have not looked into it (kavon) + labPrefix = case platformOS (targetPlatform dflags) of + OSDarwin -> B.pack "L" + OSLinux -> B.pack ".L" + otherwise -> panic "Please update LLVM Mangler for this OS." + colon = B.pack ":" toKey = uniqueToLbl . intToUnique From git at git.haskell.org Wed Sep 6 13:56:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 13:56:39 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix use of #if (0cd467b) Message-ID: <20170906135639.C4F3A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0cd467b2269595e1ae2bc273c3acf9e14adeb9e7/ghc >--------------------------------------------------------------- commit 0cd467b2269595e1ae2bc273c3acf9e14adeb9e7 Author: Ben Gamari Date: Wed Sep 6 09:48:58 2017 -0400 rts: Fix use of #if >--------------------------------------------------------------- 0cd467b2269595e1ae2bc273c3acf9e14adeb9e7 rts/Hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/Hash.c b/rts/Hash.c index 702e5a2..b9a3cf6 100644 --- a/rts/Hash.c +++ b/rts/Hash.c @@ -79,7 +79,7 @@ hashWord(const HashTable *table, StgWord key) int hashStr(const HashTable *table, char *key) { -#if x86_64_HOST_ARCH +#ifdef x86_64_HOST_ARCH StgWord h = XXH64 (key, strlen(key), 1048583); #else StgWord h = XXH32 (key, strlen(key), 1048583); From git at git.haskell.org Wed Sep 6 14:19:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 14:19:13 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Make Exitify CPP-free (168f8f3) Message-ID: <20170906141913.274C83A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/168f8f3d0f6c28efa23ad167a72e1f1d3e3b9706/ghc >--------------------------------------------------------------- commit 168f8f3d0f6c28efa23ad167a72e1f1d3e3b9706 Author: Joachim Breitner Date: Wed Sep 6 15:01:15 2017 +0100 Make Exitify CPP-free >--------------------------------------------------------------- 168f8f3d0f6c28efa23ad167a72e1f1d3e3b9706 compiler/simplCore/Exitify.hs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index eb882e52..2079347 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -1,21 +1,15 @@ -{-# LANGUAGE CPP #-} - module Exitify ( exitifyProgram ) where -#include "HsVersions.h" - import Var import Id import IdInfo import CoreSyn import CoreUtils -import Util import State import Unique import VarSet import VarEnv import CoreFVs -import Outputable import FastString import Data.Bifunctor @@ -64,7 +58,6 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - ASSERT (all (isJoinId . fst) pairs) \body ->mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' From git at git.haskell.org Wed Sep 6 14:19:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 14:19:15 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Slight refactoring (pull out ExitifyM) (4bfa11c) Message-ID: <20170906141915.DC2E43A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/4bfa11ce5dc8b55b06739f85d550b2e2eb2c5211/ghc >--------------------------------------------------------------- commit 4bfa11ce5dc8b55b06739f85d550b2e2eb2c5211 Author: Joachim Breitner Date: Wed Sep 6 15:09:21 2017 +0100 Slight refactoring (pull out ExitifyM) (will be squashed in the final push) >--------------------------------------------------------------- 4bfa11ce5dc8b55b06739f85d550b2e2eb2c5211 compiler/simplCore/Exitify.hs | 65 +++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 2079347..916ae73 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -11,6 +11,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import Type import Data.Bifunctor import Control.Monad @@ -107,10 +108,9 @@ exitify in_scope pairs = -- Assemble the RHS of the exit join point let rhs = mkLams args e ty = exprType rhs - -- Pick a suitable name - v <- mkExitJoinId ty (length args) captured - -- Remember this binding - addExit v rhs + let avoid = in_scope `extendInScopeSetList` captured + -- Remember this binding under a suitable name + v <- addExit avoid ty (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -169,29 +169,34 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) - -- Picks a new unique, which is disjoint from - -- * the free variables of the whole joinrec - -- * any bound variables (captured) - -- * any exit join points created so far. - mkExitJoinId ty join_arity captured = do - fs <- get - let avoid = in_scope `extendInScopeSetList` captured - `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) - where - exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty - `asJoinId` join_arity - `setIdOccInfo` exit_occ_info - - exit_occ_info = - OneOcc { occ_in_lam = True - , occ_one_br = True - , occ_int_cxt = False - , occ_tail = AlwaysTailCalled join_arity } - - addExit v rhs = do - fs <- get - put ((v,rhs):fs) - - +-- Picks a new unique, which is disjoint from +-- * the free variables of the whole joinrec +-- * any bound variables (captured) +-- * any exit join points created so far. +mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId in_scope ty join_arity = do + fs <- get + let avoid = in_scope `extendInScopeSetList` (map fst fs) + `extendInScopeSet` exit_id_tmpl -- just cosmetics + return (uniqAway avoid exit_id_tmpl) + where + exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty + `asJoinId` join_arity + `setIdOccInfo` exit_occ_info + + exit_occ_info = + OneOcc { occ_in_lam = True + , occ_one_br = True + , occ_int_cxt = False + , occ_tail = AlwaysTailCalled join_arity } + +addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId +addExit in_scope ty join_arity rhs = do + -- Pick a suitable name + v <- mkExitJoinId in_scope ty join_arity + fs <- get + put ((v,rhs):fs) + return v + + +type ExitifyM = State [(JoinId, CoreExpr)] From git at git.haskell.org Wed Sep 6 14:19:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 14:19:18 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (154fc88) Message-ID: <20170906141918.9C33F3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/154fc8861eb12656ba1bf56ea257ac4483d63d21/ghc >--------------------------------------------------------------- commit 154fc8861eb12656ba1bf56ea257ac4483d63d21 Author: Joachim Breitner Date: Wed Sep 6 15:17:12 2017 +0100 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) >--------------------------------------------------------------- 154fc8861eb12656ba1bf56ea257ac4483d63d21 compiler/simplCore/Exitify.hs | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 916ae73..c1b64b1 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -11,6 +11,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -71,13 +72,14 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',st) = (`runState` ExitifyState [] emptyTM) $ do forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs body' <- go args body let rhs' = mkLams args body' return (x, rhs') + exits = es_joins st -- main working function. Goes through the RHS (tail-call positions only), -- checks if there are no more recursive calls, if so, abstracts over @@ -87,7 +89,7 @@ exitify in_scope pairs = go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free variables @@ -175,8 +177,8 @@ exitify in_scope pairs = -- * any exit join points created so far. mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) + st <- get + let avoid = in_scope `extendInScopeSetList` (map fst (es_joins st)) `extendInScopeSet` exit_id_tmpl -- just cosmetics return (uniqAway avoid exit_id_tmpl) where @@ -190,13 +192,24 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } +-- Adds a new exit join point +-- (or re-uses an existing one) addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] + st <- get + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId in_scope ty join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v + +data ExitifyState = ExitifyState { es_joins :: [(JoinId, CoreExpr)] + , es_map :: CoreMap JoinId + } + +type ExitifyM = State ExitifyState From git at git.haskell.org Wed Sep 6 16:08:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 16:08:03 +0000 (UTC) Subject: [commit: ghc] master: Clean up opt and llc (2273353) Message-ID: <20170906160803.D97423A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/22733532171330136d87533d523f565f2a4f102f/ghc >--------------------------------------------------------------- commit 22733532171330136d87533d523f565f2a4f102f Author: Moritz Angermann Date: Wed Sep 6 11:31:01 2017 -0400 Clean up opt and llc The LLVM backend shells out to LLVMs `opt` and `llc` tools. This clean up introduces a shared data structure to carry the arguments we pass to each tool so that corresponding flags are next to each other. It drops the hard coded data layouts in favor of using `-mtriple` and have LLVM infer them. Furthermore we add `clang` as a proper tool, so we don't rely on assuming that `clang` is called `clang` on the `PATH` when using `clang` as the assembler. Finally this diff also changes the type of `optLevel` from `Int` to `Word`, as we do not have negative optimization levels. Reviewers: erikd, hvr, austin, rwbarton, bgamari, kavon Reviewed By: kavon Subscribers: michalt, Ericson2314, ryantrinkle, dfeuer, carter, simonpj, kavon, simonmar, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3352 >--------------------------------------------------------------- 22733532171330136d87533d523f565f2a4f102f aclocal.m4 | 7 + compiler/llvmGen/LlvmCodeGen.hs | 11 +- compiler/llvmGen/LlvmCodeGen/Ppr.hs | 63 +------- compiler/main/DriverPipeline.hs | 237 ++++++++++++++++++----------- compiler/main/DynFlags.hs | 36 ++++- compiler/main/GHC.hs | 3 +- compiler/main/SysTools.hs | 21 ++- compiler/nativeGen/RegAlloc/Linear/Main.hs | 2 +- configure.ac | 7 + ghc.mk | 7 +- ghc/GHCi/UI.hs | 4 +- ghc/ghc.mk | 5 + llvm-targets | 22 +++ mk/config.mk.in | 1 + settings.in | 3 +- testsuite/mk/ghc-config.hs | 1 + testsuite/tests/perf/compiler/all.T | 6 +- utils/llvm-targets/gen-data-layout.sh | 80 ++++++++++ 18 files changed, 342 insertions(+), 174 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 22733532171330136d87533d523f565f2a4f102f From git at git.haskell.org Wed Sep 6 19:19:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 19:19:38 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Improve documentation, consider only newest version of test metric in evaluate_metric, and add error message if appending git notes fails (13e7672) Message-ID: <20170906191938.358DA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/13e76724144102d0ddddd6b6faee2ed3e81cb86b/ghc >--------------------------------------------------------------- commit 13e76724144102d0ddddd6b6faee2ed3e81cb86b Author: Jared Weakly Date: Wed Sep 6 12:21:38 2017 -0700 Improve documentation, consider only newest version of test metric in evaluate_metric, and add error message if appending git notes fails >--------------------------------------------------------------- 13e76724144102d0ddddd6b6faee2ed3e81cb86b testsuite/driver/README.md | 30 ++++++++++++++++++++++++++++++ testsuite/driver/perf_notes.py | 13 ++++++++----- testsuite/driver/runtests.py | 6 +++++- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/testsuite/driver/README.md b/testsuite/driver/README.md index 4417fb5..b66394d 100644 --- a/testsuite/driver/README.md +++ b/testsuite/driver/README.md @@ -23,6 +23,35 @@ The purpose of the function is to tell the test driver what metrics to compare w From the perspective of the test-suite, its entry point is the runtests.py file. In that file contains the main logic for running the individual tests, collecting information, handling failure, and outputting the final results. +## Overview of how the performance test bits work. +During a Haskell Summer of Code project, an intern went through and revamped most of the performance test code, as such there have been a few changes to it that might be unusual to anyone previously familiar with the testsuite. +One of the biggest immediate benefits is that all platform differences, compiler differences, and things such as that are not necessary to be considered by the test writer anymore. +This is due to the fact that the test comparison relies entirely on locally collected metrics on the testing machine. + +As such, it is perfectly sufficient to write `collect_stats('all',5)` to measure the 3 potential stats that can be collected for that test and automatically test them for regressions, failing if there is more than a 5% change in any direction. +In fact, even that is not necessary as `collect_stats()` defaults to 'all', and 20% deviation allowed. +See the implementation of collect_stats in /driver/perf_notes.py for more information. + +If the performance of a test is improved so much that the test fails, the value will still be recorded and treated as the new best value in subsequent commits. +The warning that will be emitted is merely a precaution so that the programmer can double-check that they didn't introduce a bug; +something that might be suspicious if the test suddenly improves by 70%, for example. + +Performance metrics for performance tests are now stored in git notes under the namespace 'perf'. +The format of the git note file is that each line represents a single metric for a particular test: +`$test_env $test_name $test_way $metric_measured $value_collected` (delimited by tabs). + +One can view the maximum deviation a test allows by looking inside its respective all.T file; +additionally, if one sets the verbosity level of the test-suite to a value >= 4, they will see a good amount of output per test detailing all the information about values. +This information will also print if the test falls outside of the allowed bounds. +(see the test_cmp function in /driver/perf_notes.py for exact formatting of the message) + +The git notes are only appended to by the testsuite in a single atomic python subprocess at the end of the test run; +if the run is canceled at any time, the notes will not be written. +The note appending command will be retried up to 4 times in the event of a failure (such as one happening due to a lock on the repo) although this is never anticipated to happen. +If, for some reason, the 5 attempts were not enough, an error message will be printed out. +Further, there is no current process or method for stripping duplicates, updating values, etc, so if the testsuite is ran multiple times per commit there will be multiple values in the git notes corresponding to the tests ran. +This does seem to be the most sane behavior; as such, only the latest appearing "version" of a test is considered per commit. + ## Quick overview of program parts The relevant bits of the directory tree are as such: @@ -75,6 +104,7 @@ as such, performance metrics will not exist for a commit until you checkout that 'value' : 'val', 'commit' : 'val', } ``` + (Occasionally slightly different names are used in the source code; 'test' is usually called 'name' in testutil.py, for example) * stats_range_fields - Exists in testglobals.py. - Is a list of tuples of the form `('metric', value, allowed deviation)` diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 969fc28..b94d456 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -63,8 +63,7 @@ def test_cmp(full_name, field, val, expected, dev=20): if val < lowerBound: result = my_failBecause('value is too low:\n(If this is \ - because you have improved GHC, please\nupdate the test so that GHC \ - doesn\'t regress again)','stat') + because you have improved GHC, feel\nfree to ignore this error)','stat') if val > upperBound: result = my_failBecause('value is too high:\nstat is not good enough','stat') @@ -142,15 +141,19 @@ def _collect_stats(name, opts, metric, deviation, is_compiler_stats_test): if isinstance(metric, str): if metric == 'all': for field in testing_metrics: - opts.stats_range_fields[field] = ([t['value'] for t in test if t['metric'] == field][0], deviation) + # As there might be multiple "duplicates" of a test, the list + # comprehension considers the latest (ie the last item) to be + # the one we care about. + # (Ideally the list comprehension would result in a singleton list) + opts.stats_range_fields[field] = ([t['value'] for t in test if t['metric'] == field][-1], deviation) return else: - opts.stats_range_fields[metric] = ([t['value'] for t in test if t['metric'] == metric][0], deviation) + opts.stats_range_fields[metric] = ([t['value'] for t in test if t['metric'] == metric][-1], deviation) return if isinstance(metric, list): for field in metric: - opts.stats_range_fields[field] = ([t['value'] for t in test if t['metric'] == field][0], deviation) + opts.stats_range_fields[field] = ([t['value'] for t in test if t['metric'] == field][-1], deviation) def evaluate_metric(opts, test, field, deviation, contents, way): full_name = test + ' (' + way + ' )' diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 94512e9..036a53a 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -323,7 +323,7 @@ else: # Each try will wait 1 second. tries = 0 note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) - while b'Git - fatal' in note and tries < 4: + while b'Git - fatal' in note and tries < 5: time.sleep(1) tries += 1 note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)]) @@ -336,6 +336,10 @@ else: if args.junit: junit(t).write(args.junit) + if b'Git - fatal' in note and tries >= 5: + print("\nAn error occured while writing the performance metrics to git notes.\n \ + This is usually due to a lock-file existing somewhere in the git repo.") + cleanup_and_exit(0) # Note [Running tests in /tmp] From git at git.haskell.org Wed Sep 6 23:30:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 23:30:59 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Get in_scope_set right for CSE’ed exitification (bfa9c26) Message-ID: <20170906233059.37FBF3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/bfa9c262a87480e1852a16422d0b9f5a2601db5b/ghc >--------------------------------------------------------------- commit bfa9c262a87480e1852a16422d0b9f5a2601db5b Author: Joachim Breitner Date: Thu Sep 7 00:23:13 2017 +0100 Get in_scope_set right for CSE’ed exitification (this patch will be squashed with the CSE patch) >--------------------------------------------------------------- bfa9c262a87480e1852a16422d0b9f5a2601db5b compiler/simplCore/Exitify.hs | 58 ++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index c1b64b1..b9973e2 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -60,7 +60,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -72,14 +72,13 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',st) = (`runState` ExitifyState [] emptyTM) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs body' <- go args body let rhs' = mkLams args body' return (x, rhs') - exits = es_joins st -- main working function. Goes through the RHS (tail-call positions only), -- checks if there are no more recursive calls, if so, abstracts over @@ -109,10 +108,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -171,16 +170,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to call an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do st <- get - let avoid = in_scope `extendInScopeSetList` (map fst (es_joins st)) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -194,22 +218,16 @@ mkExitJoinId in_scope ty join_arity = do -- Adds a new exit join point -- (or re-uses an existing one) -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do st <- get case lookupTM rhs (es_map st) of Just v -> return v Nothing -> do -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity + v <- mkExitJoinId (exprType rhs) join_arity st <- get put (st { es_joins = (v,rhs) : es_joins st , es_map = insertTM rhs v (es_map st) }) return v - -data ExitifyState = ExitifyState { es_joins :: [(JoinId, CoreExpr)] - , es_map :: CoreMap JoinId - } - -type ExitifyM = State ExitifyState From git at git.haskell.org Wed Sep 6 23:31:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 23:31:02 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitification: Lots of Notes! (5919ee3) Message-ID: <20170906233102.018863A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/5919ee30f4b1038efe811cf1be647ccd0610f1aa/ghc >--------------------------------------------------------------- commit 5919ee30f4b1038efe811cf1be647ccd0610f1aa Author: Joachim Breitner Date: Wed Sep 6 15:51:19 2017 +0100 Exitification: Lots of Notes! >--------------------------------------------------------------- 5919ee30f4b1038efe811cf1be647ccd0610f1aa compiler/simplCore/Exitify.hs | 154 +++++++++++++++++++++++++++++++++++++-- compiler/simplCore/SimplUtils.hs | 3 +- compiler/simplCore/Simplify.hs | 2 +- 3 files changed, 149 insertions(+), 10 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5919ee30f4b1038efe811cf1be647ccd0610f1aa From git at git.haskell.org Wed Sep 6 23:32:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Sep 2017 23:32:50 +0000 (UTC) Subject: [commit: ghc] master: Cleanups, remove commented-out code (c6726d6) Message-ID: <20170906233250.C847A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c6726d6ad99c74ba161a600ca15f4396ad2beb0f/ghc >--------------------------------------------------------------- commit c6726d6ad99c74ba161a600ca15f4396ad2beb0f Author: Gabor Greif Date: Thu Sep 7 00:47:43 2017 +0200 Cleanups, remove commented-out code and join type signatures >--------------------------------------------------------------- c6726d6ad99c74ba161a600ca15f4396ad2beb0f compiler/cmm/CmmUtils.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs index 74524c9..b22639e 100644 --- a/compiler/cmm/CmmUtils.hs +++ b/compiler/cmm/CmmUtils.hs @@ -340,7 +340,6 @@ cmmEqWord dflags e1 e2 = CmmMachOp (mo_wordEq dflags) [e1, e2] cmmULtWord dflags e1 e2 = CmmMachOp (mo_wordULt dflags) [e1, e2] cmmUGeWord dflags e1 e2 = CmmMachOp (mo_wordUGe dflags) [e1, e2] cmmUGtWord dflags e1 e2 = CmmMachOp (mo_wordUGt dflags) [e1, e2] ---cmmShlWord dflags e1 e2 = CmmMachOp (mo_wordShl dflags) [e1, e2] cmmSLtWord dflags e1 e2 = CmmMachOp (mo_wordSLt dflags) [e1, e2] cmmUShrWord dflags e1 e2 = CmmMachOp (mo_wordUShr dflags) [e1, e2] cmmAddWord dflags e1 e2 = CmmMachOp (mo_wordAdd dflags) [e1, e2] @@ -392,23 +391,20 @@ hasNoGlobalRegs _ = False --------------------------------------------------- -- Tag bits mask ---cmmTagBits = CmmLit (mkIntCLit tAG_BITS) cmmTagMask, cmmPointerMask :: DynFlags -> CmmExpr cmmTagMask dflags = mkIntExpr dflags (tAG_MASK dflags) cmmPointerMask dflags = mkIntExpr dflags (complement (tAG_MASK dflags)) -- Used to untag a possibly tagged pointer -- A static label need not be untagged -cmmUntag :: DynFlags -> CmmExpr -> CmmExpr +cmmUntag, cmmIsTagged, cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr cmmUntag _ e@(CmmLit (CmmLabel _)) = e -- Default case cmmUntag dflags e = cmmAndWord dflags e (cmmPointerMask dflags) -- Test if a closure pointer is untagged -cmmIsTagged :: DynFlags -> CmmExpr -> CmmExpr cmmIsTagged dflags e = cmmNeWord dflags (cmmAndWord dflags e (cmmTagMask dflags)) (zeroExpr dflags) -cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr -- Get constructor tag, but one based. cmmConstrTag1 dflags e = cmmAndWord dflags e (cmmTagMask dflags) From git at git.haskell.org Thu Sep 7 08:27:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 08:27:44 +0000 (UTC) Subject: [commit: ghc] master: Update xhtml submodule (a04cfcf) Message-ID: <20170907082744.4435E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a04cfcfb50078ace5f5efb797f1bf544d975b520/ghc >--------------------------------------------------------------- commit a04cfcfb50078ace5f5efb797f1bf544d975b520 Author: Herbert Valerio Riedel Date: Thu Sep 7 00:59:28 2017 +0200 Update xhtml submodule This fixes a minor thinko about future module exports related to Semigroup/Monoid >--------------------------------------------------------------- a04cfcfb50078ace5f5efb797f1bf544d975b520 libraries/xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/xhtml b/libraries/xhtml index 6358594..c5c623e 160000 --- a/libraries/xhtml +++ b/libraries/xhtml @@ -1 +1 @@ -Subproject commit 6358594eb5139f6760e2ada72718d69fed5a1015 +Subproject commit c5c623e497f13ec187e0d228e0e8a3d9ee39a715 From git at git.haskell.org Thu Sep 7 09:06:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 09:06:25 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (046a84d) Message-ID: <20170907090625.0EF803A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/046a84da57333875be05f6ad6233b6b90b62c1d7/ghc >--------------------------------------------------------------- commit 046a84da57333875be05f6ad6233b6b90b62c1d7 Author: Joachim Breitner Date: Wed Sep 6 15:17:12 2017 +0100 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- 046a84da57333875be05f6ad6233b6b90b62c1d7 compiler/simplCore/Exitify.hs | 97 +++++++++++++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 8b01eef..0a4a060 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -41,6 +41,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -89,7 +90,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -101,7 +102,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -116,7 +117,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free @@ -138,10 +139,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -202,16 +203,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to call an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -224,16 +250,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -314,4 +346,25 @@ this kind of inlining. In the `final` run of the simplifier, we do allow inlining of exit join points, via a `SimplifierMode` flag. + +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = call go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = call exit x + go 10 x y = call exit x + go (n-1) x y = call go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. -} From git at git.haskell.org Thu Sep 7 09:06:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 09:06:31 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (26d2355) Message-ID: <20170907090631.228403A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/26d2355c6cdffee1b1d74eeaa8e7da2945d08999/ghc >--------------------------------------------------------------- commit 26d2355c6cdffee1b1d74eeaa8e7da2945d08999 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 26d2355c6cdffee1b1d74eeaa8e7da2945d08999 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 2 ++ compiler/simplCore/SimplCore.hs | 17 ++++++++++------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 3cb23cb..993b904 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -173,19 +173,22 @@ data SimplifierMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplifierMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 546011f..8b01eef 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -312,4 +312,6 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +In the `final` run of the simplifier, we do allow inlining of exit join points, +via a `SimplifierMode` flag. -} diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index c699478..1207089 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -141,19 +141,22 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index bdbd6a1..f101dba 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -713,7 +713,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1065,7 +1067,8 @@ preInlineUnconditionally dflags env top_lvl bndr rhs | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | not (gopt Opt_SimplPreInlining dflags) = False | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode + , isExitJoinId bndr = False -- Note [Do not inline exit join points] | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d01fae0..253f682 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3354,7 +3354,8 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplUnfolding env top_lvl cont_mb id unf - | isExitJoinId id + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id = return unf -- see Note [Do not inline exit join points] | otherwise = is_bottoming `seq` -- See Note [Force bottoming field] From git at git.haskell.org Thu Sep 7 09:06:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 09:06:28 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (3b8f879) Message-ID: <20170907090628.61D4A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/3b8f879cb1856eedacb57875dad5b3d783a61fbc/ghc >--------------------------------------------------------------- commit 3b8f879cb1856eedacb57875dad5b3d783a61fbc Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- 3b8f879cb1856eedacb57875dad5b3d783a61fbc compiler/basicTypes/Id.hs | 5 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 3 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 315 +++++++++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 6 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 7 +- 11 files changed, 347 insertions(+), 8 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 3b8f879cb1856eedacb57875dad5b3d783a61fbc From git at git.haskell.org Thu Sep 7 09:08:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 09:08:35 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (efb12db) Message-ID: <20170907090835.6D7813A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/efb12db861b60780d1ab1d494a1fda60371c085f/ghc >--------------------------------------------------------------- commit efb12db861b60780d1ab1d494a1fda60371c085f Author: Joachim Breitner Date: Wed Sep 6 15:17:12 2017 +0100 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- efb12db861b60780d1ab1d494a1fda60371c085f compiler/simplCore/Exitify.hs | 96 +++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 546011f..9cabb8e 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -41,6 +41,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -89,7 +90,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -101,7 +102,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -116,7 +117,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free @@ -138,10 +139,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -202,16 +203,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to call an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -224,16 +250,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -312,4 +344,24 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = call go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = call exit x + go 10 x y = call exit x + go (n-1) x y = call go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. -} From git at git.haskell.org Thu Sep 7 09:08:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 09:08:38 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (d619e1d) Message-ID: <20170907090838.34C0F3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/d619e1de1ee6d5b1da88d43c3a5c5f1eacce82f7/ghc >--------------------------------------------------------------- commit d619e1de1ee6d5b1da88d43c3a5c5f1eacce82f7 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- d619e1de1ee6d5b1da88d43c3a5c5f1eacce82f7 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 17 ++++++++++------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 3cb23cb..993b904 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -173,19 +173,22 @@ data SimplifierMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplifierMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 9cabb8e..0a4a060 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -344,6 +344,9 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +In the `final` run of the simplifier, we do allow inlining of exit join points, +via a `SimplifierMode` flag. + Note [Avoid duplicate exit points] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index c699478..1207089 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -141,19 +141,22 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index bdbd6a1..f101dba 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -713,7 +713,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1065,7 +1067,8 @@ preInlineUnconditionally dflags env top_lvl bndr rhs | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | not (gopt Opt_SimplPreInlining dflags) = False | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode + , isExitJoinId bndr = False -- Note [Do not inline exit join points] | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d01fae0..253f682 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3354,7 +3354,8 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplUnfolding env top_lvl cont_mb id unf - | isExitJoinId id + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id = return unf -- see Note [Do not inline exit join points] | otherwise = is_bottoming `seq` -- See Note [Force bottoming field] From git at git.haskell.org Thu Sep 7 11:04:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 11:04:59 +0000 (UTC) Subject: [commit: ghc] wip/travis2: Travis: Boot with ghc-8.2.1, and disable test suite (fb85240) Message-ID: <20170907110459.1FC203A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis2 Link : http://ghc.haskell.org/trac/ghc/changeset/fb85240fc28e727daa6b2e7451000db87fbcd1ac/ghc >--------------------------------------------------------------- commit fb85240fc28e727daa6b2e7451000db87fbcd1ac Author: Joachim Breitner Date: Sat Aug 19 15:33:52 2017 +0200 Travis: Boot with ghc-8.2.1, and disable test suite by only building, we can hopefully be in the build time limit, while still providing a bit of useful service, e.g. indicating early when GitHub pull requests (with seemingly innocent results) fail to build. >--------------------------------------------------------------- fb85240fc28e727daa6b2e7451000db87fbcd1ac .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 218f5ba..09d9fef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,15 +17,15 @@ addons: #- llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test packages: - - cabal-install-1.18 - - ghc-7.10.3 - - alex-3.1.3 - - happy-1.19.4 + - cabal-install-2.0 + - ghc-8.2.1 + - alex-3.1.7 + - happy-1.19.5 - python3 #- llvm-3.7 before_install: - - export PATH=/opt/ghc/7.10.3/bin:/opt/cabal/1.18/bin:/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:/usr/lib/llvm-3.7/bin:$PATH + - export PATH=/opt/ghc/8.2.1/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:/usr/lib/llvm-3.7/bin:$PATH # Be explicit about which protocol to use, such that we don't have to repeat the rewrite command for each. - git config remote.origin.url git://github.com/${TRAVIS_REPO_SLUG}.git @@ -57,4 +57,5 @@ script: # when DEBUG_STAGE2=NO), causing Travis to again kill our job. # * Use --fast, to stay within the time limits set by Travis. # See Note [validate and testsuite speed] in toplevel Makefile. - - THREADS=3 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet + # Actually, do not run test suite. Takes too long. + - THREADS=3 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet --build-only From git at git.haskell.org Thu Sep 7 11:05:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 11:05:01 +0000 (UTC) Subject: [commit: ghc] wip/travis2's head updated: Travis: Boot with ghc-8.2.1, and disable test suite (fb85240) Message-ID: <20170907110501.BED7B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/travis2' now includes: 6257fb5 Comments about GlobalRdrEnv shadowing 118efb0 Restrict Lint's complaints about recursive INLINEs somewhat 698adb5 Tracing in OccAnal (commented out) 4c6fcd7 Comments only 61c4246 Test Trac #14110 f50e30e Doctests for Data.Tuple 6267d8c Enable -Wcpp-undef for GHC and runtime system cf8ab1c users_guide: Convert mkUserGuidePart generation to a Sphinx extension 8e5b6ec Add strict variant of iterate ee2e9ec Correct incorrect free in PE linker 1cdceb9 Revert "Add strict variant of iterate" 34bd43d Fix loading of dlls on 32bit windows 6982ee9 Fix #14125 by normalizing data family instances more aggressively a89bb80 Fix #14114 by checking for duplicate vars on pattern synonym RHSes 79b259a Fix #13885 by freshening reified GADT constructors' universal tyvars 8476097 Revise function arity mismatch errors involving TypeApplications 8fd9599 Make the Read instance for Proxy (and friends) ignore precedence afc2f79 Move validate cleaning from distclean to clean 4717ce8 Fix incorrect retypecheck loop in -j (#14075) 9afaebe StgLint: Allow join point bindings of unlifted type cd5a970 Make law for Foldable.length explicit 20c7053 Bump haddock submodule 090d896 fix typo (expreesions -> expressions) 028645c Fixed a typo in template-haskell documentation dbaa9a2 DynFlags: Add inverse of -dno-debug-output 3625728 Add support for producing position-independent executables 7463a95 users-guide: Better error messages on incomplete ghc-flag directives 74af2e7 Typo fixed 11657c4 Better pretty-printing for CHoleCan a211dca Fix defer-out-of-scope-variables aeb4bd9 Remove typeKind from Type.hs-boot 5f3d2d3 CNF: Implement compaction for small pointer arrays a0b7b10 Restrict exprOkForSpeculation/case to unlifted types 407c11b Bottoming expressions should not be expandable 33452df Refactor the Mighty Simplifier 8649535 Don't do the RhsCtxt thing for join points dd89a13 Comments, plus adjust debug print of TcTyThing(ATyVar) a67b66e Add strict variant of iterate f135fb2 rts: Fix warnings on aarch64 and clean up style 80ccea8 rts: Fix references to Note [BFD import library] 76e59a2 rts: Fix ASSERTs with space before opening paren 8f19c65 Rip out mkUserGuidePart 83484a6 Fix two typos in the ImpredicativeTypes user guide a055f24 Adjust test suite stats 682e8e6 Actually bump T12150 29da01e Make parsed AST dump output lazily 6e0e0b0 Comments only 8834d48 Better debug-printing for Outputable TyConBinder 547e4c0 A bit more -ddump-tc tracing 6f050d9 Add TcRnMonad.unlessXOptM 0257dac Refactor bindHsQTyVars and friends 86e6a5f Small refactoring of meta-tyvar cloning 4455c86 Use a well-kinded substitution to instantiate 8eead4d Improve kind-application-error message a6c448b Small refactor of getRuntimeRep aed7d43 Add HasDebugStack for typeKind 248ad30 testsuite: Add test for #14128 db3a8e1 desugar: Ensure that a module's dep_orphs doesn't contain itself 5266ab9 Remove dll-split. 895a765 Refactor type family instance abstract syntax declarations 3c6b2fc Fix decomposition error on Windows 5f6a820 Add gen-dll as replacement for dll-split f86de44 ghc-pkg: Try opening lockfiles in read-write mode first a27bb1b base: Add support for file unlocking 779b9e6 PackageDb: Explicitly unlock package database before closing 9d57d8c nativeGen: Don't index into linked lists 651b4dc StgLint: Show type of out-of-scope binders a36b34c StgLint: Enforce MultiValAlt liveness invariant only after unariser f17f106 StgLint: Give up on trying to compare types 1561525 HsExpr: Fix typo 6f1ccaa Add a Note describing #14128 567dca6 Add some traceRn and (Outputable StmtTree) 628b666 Add comments to RnTypes fca1962 Define and use HsArg 805b29b Add debugPprType 3790ea9 Small changes to ddump-tc tracing 2c133b6 Really fix Trac #14158 c0feee9 Add missing Semigroup instances to compiler b2c2e3e Add missing Semigroup instances in utils/{hpc,runghc} dd643bc Improve stm haddocks 1f052c5 Fix order of PrelRule 8a1de42 Add testcase for #14178 f089c32 Remove broken citeseer citation links 590e737 Update transformers submodule 6330b0b Document the intricacies of ForallC variable quantification better 5dd6b13 Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns 8e4229a Fix #14167 by using isGadtSyntaxTyCon in more places 0ec4376 Document the Generic(1) laws cb3363e Move NonEmpty definition into GHC.Base 31281a4 testsuite: Fix validation of ways b996e12 testsuite: Add test for #14129 7e5d4a0 Remember the AvailInfo for each IE b9ac9e0 Fix egregious duplication of vars in RnTypes 1300afa get-win32-tarballs: Use bash, not sh a4c2ac2 get-win32-tarballs: Use correct `find` 542f89f Replace hashing function for string keys implementation with xxhash cd857dd SetLevels: Substitute in ticks in lvlMFE 6458b8d base: Update acosh to handle -1::Complex c2881a2 StgLint: Show constructor arity in mismatch message 822abbb eventlog: Clean up profiling heap breakdown type 24e50f9 rts: Add heap breakdown type for -hT 0829821 Implicitly bind kind variables in type family instance RHSes when it's sensible 0cd467b rts: Fix use of #if 2273353 Clean up opt and llc c6726d6 Cleanups, remove commented-out code a04cfcf Update xhtml submodule fb85240 Travis: Boot with ghc-8.2.1, and disable test suite From git at git.haskell.org Thu Sep 7 11:49:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 11:49:05 +0000 (UTC) Subject: [commit: ghc] master: Handle W80 in floatFormat (fee403f) Message-ID: <20170907114905.E99D03A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fee403fd935479e8a1ad563fd07585d91c7e04a2/ghc >--------------------------------------------------------------- commit fee403fd935479e8a1ad563fd07585d91c7e04a2 Author: Gabor Greif Date: Wed Sep 6 12:39:58 2017 +0200 Handle W80 in floatFormat >--------------------------------------------------------------- fee403fd935479e8a1ad563fd07585d91c7e04a2 compiler/nativeGen/Format.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/nativeGen/Format.hs b/compiler/nativeGen/Format.hs index 00811f1..1e32185 100644 --- a/compiler/nativeGen/Format.hs +++ b/compiler/nativeGen/Format.hs @@ -68,6 +68,7 @@ floatFormat width = case width of W32 -> FF32 W64 -> FF64 + W80 -> FF80 other -> pprPanic "Format.floatFormat" (ppr other) From git at git.haskell.org Thu Sep 7 11:49:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 11:49:08 +0000 (UTC) Subject: [commit: ghc] master: Fix typos in diagnostics, testsuite and comments (d97a6fe) Message-ID: <20170907114908.C2DDB3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d97a6fe2b97c81a167219eae892d3820c0685435/ghc >--------------------------------------------------------------- commit d97a6fe2b97c81a167219eae892d3820c0685435 Author: Gabor Greif Date: Wed Sep 6 14:42:02 2017 +0200 Fix typos in diagnostics, testsuite and comments >--------------------------------------------------------------- d97a6fe2b97c81a167219eae892d3820c0685435 compiler/basicTypes/Literal.hs | 2 +- compiler/codeGen/StgCmmHeap.hs | 2 +- compiler/deSugar/DsBinds.hs | 2 +- compiler/deSugar/DsCCall.hs | 2 +- compiler/nativeGen/PPC/Regs.hs | 2 +- compiler/nativeGen/SPARC/Regs.hs | 2 +- compiler/nativeGen/X86/Regs.hs | 2 +- compiler/rename/RnEnv.hs | 2 +- compiler/simplCore/OccurAnal.hs | 2 +- compiler/simplCore/SetLevels.hs | 2 +- compiler/specialise/SpecConstr.hs | 2 +- compiler/stgSyn/StgLint.hs | 2 +- compiler/typecheck/TcGenDeriv.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcUnify.hs | 4 ++-- compiler/types/Type.hs | 4 ++-- compiler/utils/Binary.hs | 2 +- compiler/utils/Digraph.hs | 4 ++-- libraries/ghci/GHCi/CreateBCO.hs | 6 +++--- libraries/ghci/GHCi/ResolvedBCO.hs | 6 +++--- rts/RtsSymbolInfo.h | 2 +- rts/linker/Elf.c | 2 +- testsuite/tests/eyeball/inline2.hs | 2 +- testsuite/tests/indexed-types/should_compile/CoTest3.hs | 2 +- testsuite/tests/programs/andy_cherry/Interp.hs | 2 +- testsuite/tests/programs/andy_cherry/andy_cherry.stdout | 2 +- testsuite/tests/programs/andy_cherry/mygames.pgn | 2 +- testsuite/tests/programs/galois_raytrace/Geometry.hs | 2 +- testsuite/tests/simplCore/should_compile/T14137.hs | 2 +- testsuite/tests/simplCore/should_run/simplrun002.hs | 4 ++-- 30 files changed, 38 insertions(+), 38 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d97a6fe2b97c81a167219eae892d3820c0685435 From git at git.haskell.org Thu Sep 7 12:43:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 12:43:17 +0000 (UTC) Subject: [commit: ghc] master: Travis: Boot with ghc-8.2.1, and disable test suite (055d73c) Message-ID: <20170907124317.39F793A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/055d73c6576bed2affaf96ef6a6b89aeb2cd2e9f/ghc >--------------------------------------------------------------- commit 055d73c6576bed2affaf96ef6a6b89aeb2cd2e9f Author: Joachim Breitner Date: Sat Aug 19 15:33:52 2017 +0200 Travis: Boot with ghc-8.2.1, and disable test suite by only building, we can hopefully be in the build time limit, while still providing a bit of useful service, e.g. indicating early when GitHub pull requests (with seemingly innocent results) fail to build. >--------------------------------------------------------------- 055d73c6576bed2affaf96ef6a6b89aeb2cd2e9f .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 218f5ba..09d9fef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,15 +17,15 @@ addons: #- llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test packages: - - cabal-install-1.18 - - ghc-7.10.3 - - alex-3.1.3 - - happy-1.19.4 + - cabal-install-2.0 + - ghc-8.2.1 + - alex-3.1.7 + - happy-1.19.5 - python3 #- llvm-3.7 before_install: - - export PATH=/opt/ghc/7.10.3/bin:/opt/cabal/1.18/bin:/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:/usr/lib/llvm-3.7/bin:$PATH + - export PATH=/opt/ghc/8.2.1/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:/usr/lib/llvm-3.7/bin:$PATH # Be explicit about which protocol to use, such that we don't have to repeat the rewrite command for each. - git config remote.origin.url git://github.com/${TRAVIS_REPO_SLUG}.git @@ -57,4 +57,5 @@ script: # when DEBUG_STAGE2=NO), causing Travis to again kill our job. # * Use --fast, to stay within the time limits set by Travis. # See Note [validate and testsuite speed] in toplevel Makefile. - - THREADS=3 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet + # Actually, do not run test suite. Takes too long. + - THREADS=3 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet --build-only From git at git.haskell.org Thu Sep 7 12:43:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 12:43:32 +0000 (UTC) Subject: [commit: ghc] branch 'wip/travis2' deleted Message-ID: <20170907124332.2D5293A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/travis2 From git at git.haskell.org Thu Sep 7 16:33:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 16:33:12 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (7eacc7b) Message-ID: <20170907163312.0BC4A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/7eacc7b1e76ba1e8514fec9064d26c37418e630c/ghc >--------------------------------------------------------------- commit 7eacc7b1e76ba1e8514fec9064d26c37418e630c Author: Joachim Breitner Date: Wed Sep 6 15:17:12 2017 +0100 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- 7eacc7b1e76ba1e8514fec9064d26c37418e630c compiler/simplCore/Exitify.hs | 96 +++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 546011f..9cabb8e 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -41,6 +41,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -89,7 +90,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -101,7 +102,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -116,7 +117,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free @@ -138,10 +139,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -202,16 +203,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to call an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -224,16 +250,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -312,4 +344,24 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = call go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = call exit x + go 10 x y = call exit x + go (n-1) x y = call go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. -} From git at git.haskell.org Thu Sep 7 16:33:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 16:33:15 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (2ef8373) Message-ID: <20170907163315.6079D3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/2ef8373b9620b93cbf9fc8b9de7cd5c9e9418888/ghc >--------------------------------------------------------------- commit 2ef8373b9620b93cbf9fc8b9de7cd5c9e9418888 Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- 2ef8373b9620b93cbf9fc8b9de7cd5c9e9418888 compiler/basicTypes/Id.hs | 5 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 6 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 315 ++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 8 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 3 + docs/users_guide/using-optimisation.rst | 10 + 12 files changed, 360 insertions(+), 6 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2ef8373b9620b93cbf9fc8b9de7cd5c9e9418888 From git at git.haskell.org Thu Sep 7 16:33:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 16:33:18 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (5374dec) Message-ID: <20170907163318.2051E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/5374dec7a871fb7b75472a3055adc738660fbb1b/ghc >--------------------------------------------------------------- commit 5374dec7a871fb7b75472a3055adc738660fbb1b Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 5374dec7a871fb7b75472a3055adc738660fbb1b compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 19 +++++++++++-------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 03b380d..46d81df 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -175,19 +175,22 @@ data SimplMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 9cabb8e..0a4a060 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -344,6 +344,9 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +In the `final` run of the simplifier, we do allow inlining of exit join points, +via a `SimplifierMode` flag. + Note [Avoid duplicate exit points] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 4b41792..70d5e0f 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -142,20 +142,23 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_dflags = dflags - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_dflags = dflags + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index b9e1664..3ba340c 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -736,7 +736,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1088,7 +1090,8 @@ preInlineUnconditionally env top_lvl bndr rhs | isStableUnfolding (idUnfolding bndr) = False -- Note [Stable unfoldings and preInlineUnconditionally] | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode + , isExitJoinId bndr = False -- Note [Do not inline exit join points] | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 10e7859..c2d3279 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3243,7 +3243,8 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplStableUnfolding env top_lvl cont_mb id unf - | isExitJoinId id + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id = return unf -- see Note [Do not inline exit join points] | otherwise = mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs From git at git.haskell.org Thu Sep 7 16:33:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 16:33:20 +0000 (UTC) Subject: [commit: ghc] wip/T14152's head updated: Inline exit join points in the "final" simplifier iteration (5374dec) Message-ID: <20170907163320.CB88C3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T14152' now includes: 6257fb5 Comments about GlobalRdrEnv shadowing 118efb0 Restrict Lint's complaints about recursive INLINEs somewhat 698adb5 Tracing in OccAnal (commented out) 4c6fcd7 Comments only 61c4246 Test Trac #14110 f50e30e Doctests for Data.Tuple 6267d8c Enable -Wcpp-undef for GHC and runtime system cf8ab1c users_guide: Convert mkUserGuidePart generation to a Sphinx extension 8e5b6ec Add strict variant of iterate ee2e9ec Correct incorrect free in PE linker 1cdceb9 Revert "Add strict variant of iterate" 34bd43d Fix loading of dlls on 32bit windows 6982ee9 Fix #14125 by normalizing data family instances more aggressively a89bb80 Fix #14114 by checking for duplicate vars on pattern synonym RHSes 79b259a Fix #13885 by freshening reified GADT constructors' universal tyvars 8476097 Revise function arity mismatch errors involving TypeApplications 8fd9599 Make the Read instance for Proxy (and friends) ignore precedence afc2f79 Move validate cleaning from distclean to clean 4717ce8 Fix incorrect retypecheck loop in -j (#14075) 9afaebe StgLint: Allow join point bindings of unlifted type cd5a970 Make law for Foldable.length explicit 20c7053 Bump haddock submodule 090d896 fix typo (expreesions -> expressions) 028645c Fixed a typo in template-haskell documentation dbaa9a2 DynFlags: Add inverse of -dno-debug-output 3625728 Add support for producing position-independent executables 7463a95 users-guide: Better error messages on incomplete ghc-flag directives 74af2e7 Typo fixed 11657c4 Better pretty-printing for CHoleCan a211dca Fix defer-out-of-scope-variables aeb4bd9 Remove typeKind from Type.hs-boot 5f3d2d3 CNF: Implement compaction for small pointer arrays a0b7b10 Restrict exprOkForSpeculation/case to unlifted types 407c11b Bottoming expressions should not be expandable 33452df Refactor the Mighty Simplifier 8649535 Don't do the RhsCtxt thing for join points dd89a13 Comments, plus adjust debug print of TcTyThing(ATyVar) a67b66e Add strict variant of iterate f135fb2 rts: Fix warnings on aarch64 and clean up style 80ccea8 rts: Fix references to Note [BFD import library] 76e59a2 rts: Fix ASSERTs with space before opening paren 8f19c65 Rip out mkUserGuidePart 83484a6 Fix two typos in the ImpredicativeTypes user guide a055f24 Adjust test suite stats 682e8e6 Actually bump T12150 29da01e Make parsed AST dump output lazily 6e0e0b0 Comments only 8834d48 Better debug-printing for Outputable TyConBinder 547e4c0 A bit more -ddump-tc tracing 6f050d9 Add TcRnMonad.unlessXOptM 0257dac Refactor bindHsQTyVars and friends 86e6a5f Small refactoring of meta-tyvar cloning 4455c86 Use a well-kinded substitution to instantiate 8eead4d Improve kind-application-error message a6c448b Small refactor of getRuntimeRep aed7d43 Add HasDebugStack for typeKind 248ad30 testsuite: Add test for #14128 db3a8e1 desugar: Ensure that a module's dep_orphs doesn't contain itself 5266ab9 Remove dll-split. 895a765 Refactor type family instance abstract syntax declarations 3c6b2fc Fix decomposition error on Windows 5f6a820 Add gen-dll as replacement for dll-split f86de44 ghc-pkg: Try opening lockfiles in read-write mode first a27bb1b base: Add support for file unlocking 779b9e6 PackageDb: Explicitly unlock package database before closing 9d57d8c nativeGen: Don't index into linked lists 651b4dc StgLint: Show type of out-of-scope binders a36b34c StgLint: Enforce MultiValAlt liveness invariant only after unariser f17f106 StgLint: Give up on trying to compare types 1561525 HsExpr: Fix typo 6f1ccaa Add a Note describing #14128 567dca6 Add some traceRn and (Outputable StmtTree) 628b666 Add comments to RnTypes fca1962 Define and use HsArg 805b29b Add debugPprType 3790ea9 Small changes to ddump-tc tracing 2c133b6 Really fix Trac #14158 c0feee9 Add missing Semigroup instances to compiler b2c2e3e Add missing Semigroup instances in utils/{hpc,runghc} dd643bc Improve stm haddocks 1f052c5 Fix order of PrelRule 8a1de42 Add testcase for #14178 f089c32 Remove broken citeseer citation links 590e737 Update transformers submodule 6330b0b Document the intricacies of ForallC variable quantification better 5dd6b13 Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns 8e4229a Fix #14167 by using isGadtSyntaxTyCon in more places 0ec4376 Document the Generic(1) laws cb3363e Move NonEmpty definition into GHC.Base 31281a4 testsuite: Fix validation of ways b996e12 testsuite: Add test for #14129 7e5d4a0 Remember the AvailInfo for each IE b9ac9e0 Fix egregious duplication of vars in RnTypes 1300afa get-win32-tarballs: Use bash, not sh a4c2ac2 get-win32-tarballs: Use correct `find` 542f89f Replace hashing function for string keys implementation with xxhash cd857dd SetLevels: Substitute in ticks in lvlMFE 6458b8d base: Update acosh to handle -1::Complex c2881a2 StgLint: Show constructor arity in mismatch message 822abbb eventlog: Clean up profiling heap breakdown type 24e50f9 rts: Add heap breakdown type for -hT 0829821 Implicitly bind kind variables in type family instance RHSes when it's sensible 0cd467b rts: Fix use of #if 2273353 Clean up opt and llc c6726d6 Cleanups, remove commented-out code a04cfcf Update xhtml submodule fee403f Handle W80 in floatFormat d97a6fe Fix typos in diagnostics, testsuite and comments 055d73c Travis: Boot with ghc-8.2.1, and disable test suite 2ef8373 Implement a dedicated exitfication pass #14152 7eacc7b Do some ad-hoc CSE in Exitification 5374dec Inline exit join points in the "final" simplifier iteration From git at git.haskell.org Thu Sep 7 21:46:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Sep 2017 21:46:37 +0000 (UTC) Subject: [commit: ghc] master: Make Semigroup a superclass of Monoid (re #14191) (8ae263c) Message-ID: <20170907214637.3412A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8ae263ceb3566a7c82336400b09cb8f381217405/ghc >--------------------------------------------------------------- commit 8ae263ceb3566a7c82336400b09cb8f381217405 Author: Herbert Valerio Riedel Date: Tue Sep 5 07:29:36 2017 +0200 Make Semigroup a superclass of Monoid (re #14191) Unfortunately, this requires introducing a couple of .hs-boot files to break up import cycles (mostly to provide class & typenames in order to be able to write type signatures). This does not yet re-export `(<>)` from Prelude (while the class-name `Semigroup` is reexported); that will happen in a future commit. Test Plan: local ./validate passed Reviewers: ekmett, austin, bgamari, erikd, RyanGlScott Reviewed By: ekmett, RyanGlScott GHC Trac Issues: #14191 Differential Revision: https://phabricator.haskell.org/D3927 >--------------------------------------------------------------- 8ae263ceb3566a7c82336400b09cb8f381217405 compiler/prelude/PrelNames.hs | 8 +- libraries/base/Data/Either.hs | 12 + libraries/base/Data/Functor/Const.hs | 4 +- libraries/base/Data/Functor/Identity.hs | 4 +- libraries/base/Data/Functor/Utils.hs | 36 +-- libraries/base/Data/Monoid.hs | 165 +----------- libraries/base/Data/Ord.hs | 1 + libraries/base/Data/Proxy.hs | 7 +- libraries/base/Data/Semigroup.hs | 296 ++------------------- libraries/base/Data/Semigroup/Internal.hs | 258 ++++++++++++++++++ libraries/base/Data/Semigroup/Internal.hs-boot | 12 + libraries/base/Data/Void.hs | 6 + libraries/base/GHC/Base.hs | 171 +++++++++--- libraries/base/GHC/Base.hs-boot | 10 + libraries/base/GHC/Event/Internal.hs | 18 +- libraries/base/GHC/Real.hs-boot | 7 + libraries/base/GHC/ST.hs | 5 +- libraries/base/Prelude.hs | 3 +- libraries/base/base.cabal | 1 + libraries/base/changelog.md | 6 + testsuite/tests/ghci/scripts/T10963.script | 4 +- testsuite/tests/ghci/scripts/T4175.stdout | 3 + testsuite/tests/ghci/scripts/T7627.stdout | 3 + testsuite/tests/ghci/scripts/T8535.stdout | 1 + testsuite/tests/ghci/scripts/T9881.stdout | 4 + testsuite/tests/ghci/scripts/ghci011.stdout | 4 + testsuite/tests/ghci/scripts/ghci020.stdout | 1 + testsuite/tests/ghci/should_run/T10145.stdout | 1 + testsuite/tests/perf/compiler/all.T | 3 +- testsuite/tests/perf/should_run/T4978.hs | 7 +- testsuite/tests/polykinds/MonoidsFD.hs | 5 +- testsuite/tests/polykinds/MonoidsTF.hs | 6 +- testsuite/tests/polykinds/T7332.hs | 3 +- testsuite/tests/semigroup/Makefile | 3 - testsuite/tests/semigroup/SemigroupWarnings.hs | 34 --- testsuite/tests/semigroup/SemigroupWarnings.stderr | 8 - testsuite/tests/semigroup/all.T | 1 - testsuite/tests/simplCore/should_run/T13429a.hs | 6 +- testsuite/tests/typecheck/should_run/T6117.hs | 2 + .../tests/wcompat-warnings/WCompatWarningsNotOn.hs | 2 +- .../tests/wcompat-warnings/WCompatWarningsOff.hs | 2 +- .../tests/wcompat-warnings/WCompatWarningsOn.hs | 2 +- .../wcompat-warnings/WCompatWarningsOn.stderr | 2 +- .../tests/wcompat-warnings/WCompatWarningsOnOff.hs | 2 +- 44 files changed, 579 insertions(+), 560 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 8ae263ceb3566a7c82336400b09cb8f381217405 From git at git.haskell.org Fri Sep 8 02:53:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Sep 2017 02:53:47 +0000 (UTC) Subject: [commit: ghc] master: includes/rts: Drop trailing comma (be514a6) Message-ID: <20170908025347.720A73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/be514a694f2cddbb1b23af971430364a223eb894/ghc >--------------------------------------------------------------- commit be514a694f2cddbb1b23af971430364a223eb894 Author: Ben Gamari Date: Thu Sep 7 22:49:22 2017 -0400 includes/rts: Drop trailing comma This trailing comma snuck in in a recent patch. There is nothing wrong with the comma; it's perfectly valid C99, yet nevertheless Mac OS X's dtrace utility chokes on it with, dtrace: failed to compile script rts/RtsProbes.d: "includes/rts/EventLogFormat.h", line 245: syntax error near "}" make[1]: *** [rts/dist/build/RtsProbes.h] Error 1 >--------------------------------------------------------------- be514a694f2cddbb1b23af971430364a223eb894 includes/rts/EventLogFormat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h index b3ad52b..ccfe03b 100644 --- a/includes/rts/EventLogFormat.h +++ b/includes/rts/EventLogFormat.h @@ -241,7 +241,7 @@ typedef enum { HEAP_PROF_BREAKDOWN_TYPE_DESCR, HEAP_PROF_BREAKDOWN_RETAINER, HEAP_PROF_BREAKDOWN_BIOGRAPHY, - HEAP_PROF_BREAKDOWN_CLOSURE_TYPE, + HEAP_PROF_BREAKDOWN_CLOSURE_TYPE } HeapProfBreakdown; #if !defined(EVENTLOG_CONSTANTS_ONLY) From git at git.haskell.org Fri Sep 8 02:53:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Sep 2017 02:53:50 +0000 (UTC) Subject: [commit: ghc] master: Drop special handling of iOS and Android (cb4878f) Message-ID: <20170908025350.2EC673A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f/ghc >--------------------------------------------------------------- commit cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f Author: Moritz Angermann Date: Thu Sep 7 22:52:27 2017 -0400 Drop special handling of iOS and Android As far as GHC is concerned, iOS **is** Darwin, and Android **is** Linux. Depends on D3352 Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: Ericson2314, ryantrinkle, rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3579 >--------------------------------------------------------------- cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f aclocal.m4 | 10 ++-------- compiler/main/DriverPipeline.hs | 2 +- compiler/main/HscTypes.hs | 1 - compiler/main/SysTools.hs | 5 +---- compiler/utils/Platform.hs | 7 ------- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index d365dba..8146e79 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -237,13 +237,10 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], checkOS() { case [$]1 in - linux) + linux|linux-android) test -z "[$]2" || eval "[$]2=OSLinux" ;; - ios) - test -z "[$]2" || eval "[$]2=OSiOS" - ;; - darwin) + darwin|ios) test -z "[$]2" || eval "[$]2=OSDarwin" ;; solaris2) @@ -279,9 +276,6 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], aix) test -z "[$]2" || eval "[$]2=OSAIX" ;; - linux-android) - test -z "[$]2" || eval "[$]2=OSAndroid" - ;; *) echo "Unknown OS '[$]1'" exit 1 diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index ef31238..bf39ee1 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -2006,7 +2006,7 @@ linkBinary' staticLink dflags o_files dep_packages = do -- on x86. ++ (if sLdSupportsCompactUnwind mySettings && not staticLink && - (platformOS platform == OSDarwin || platformOS platform == OSiOS) && + (platformOS platform == OSDarwin) && case platformArch platform of ArchX86 -> True ArchX86_64 -> True diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index e064147..2d8e19c 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -2602,7 +2602,6 @@ soExt :: Platform -> FilePath soExt platform = case platformOS platform of OSDarwin -> "dylib" - OSiOS -> "dylib" OSMinGW32 -> "dll" _ -> "so" diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index cd7a23d..04f4107 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -822,9 +822,6 @@ getLinkerInfo' dflags = do -- that doesn't support --version. We can just assume that's -- what we're using. return $ DarwinLD [] - OSiOS -> - -- Ditto for iOS - return $ DarwinLD [] OSMinGW32 -> -- GHC doesn't support anything but GNU ld on Windows anyway. -- Process creation is also fairly expensive on win32, so @@ -1488,7 +1485,7 @@ linkDynLib dflags0 o_files dep_packages ++ pkg_lib_path_opts ++ pkg_link_opts )) - _ | os `elem` [OSDarwin, OSiOS] -> do + _ | os == OSDarwin -> do ------------------------------------------------------------------- -- Making a darwin dylib ------------------------------------------------------------------- diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index 7f74970..8cd1fa7 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -75,7 +75,6 @@ data OS = OSUnknown | OSLinux | OSDarwin - | OSiOS | OSSolaris2 | OSMinGW32 | OSFreeBSD @@ -85,7 +84,6 @@ data OS | OSKFreeBSD | OSHaiku | OSQNXNTO - | OSAndroid | OSAIX deriving (Read, Show, Eq) @@ -131,12 +129,10 @@ osElfTarget OSOpenBSD = True osElfTarget OSNetBSD = True osElfTarget OSSolaris2 = True osElfTarget OSDarwin = False -osElfTarget OSiOS = False osElfTarget OSMinGW32 = False osElfTarget OSKFreeBSD = True osElfTarget OSHaiku = True osElfTarget OSQNXNTO = False -osElfTarget OSAndroid = True osElfTarget OSAIX = False osElfTarget OSUnknown = False -- Defaulting to False is safe; it means don't rely on any @@ -147,12 +143,10 @@ osElfTarget OSUnknown = False -- | This predicate tells us whether the OS support Mach-O shared libraries. osMachOTarget :: OS -> Bool osMachOTarget OSDarwin = True -osMachOTarget OSiOS = True osMachOTarget _ = False osUsesFrameworks :: OS -> Bool osUsesFrameworks OSDarwin = True -osUsesFrameworks OSiOS = True osUsesFrameworks _ = False platformUsesFrameworks :: Platform -> Bool @@ -160,6 +154,5 @@ platformUsesFrameworks = osUsesFrameworks . platformOS osSubsectionsViaSymbols :: OS -> Bool osSubsectionsViaSymbols OSDarwin = True -osSubsectionsViaSymbols OSiOS = True osSubsectionsViaSymbols _ = False From git at git.haskell.org Fri Sep 8 03:55:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Sep 2017 03:55:37 +0000 (UTC) Subject: [commit: ghc] master: Deal with unbreakable blocks in Applicative Do (011e15a) Message-ID: <20170908035537.C69EE3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/011e15aa2d6949fc56126f1028ea25d5497196d9/ghc >--------------------------------------------------------------- commit 011e15aa2d6949fc56126f1028ea25d5497196d9 Author: David Feuer Date: Thu Sep 7 23:56:35 2017 -0400 Deal with unbreakable blocks in Applicative Do The renamer wasn't able to deal with more than a couple strict patterns in a row with `ApplicativeDo` when using the heuristic splitter. Update it to work with them properly. Reviewers: simonmar, austin, bgamari, hvr Reviewed By: simonmar Subscribers: RyanGlScott, lippling, rwbarton, thomie GHC Trac Issues: #14163 Differential Revision: https://phabricator.haskell.org/D3900 >--------------------------------------------------------------- 011e15aa2d6949fc56126f1028ea25d5497196d9 compiler/rename/RnExpr.hs | 7 +++++-- testsuite/tests/ado/T14163.hs | 13 +++++++++++++ testsuite/tests/ado/T14163.stdin | 3 +++ testsuite/tests/ado/T14163.stdout | 1 + testsuite/tests/ado/all.T | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index 477a448..5ccefb8 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -1821,9 +1821,12 @@ slurpIndependentStmts slurpIndependentStmts stmts = go [] [] emptyNameSet stmts where -- If we encounter a BindStmt that doesn't depend on a previous BindStmt - -- in this group, then add it to the group. + -- in this group, then add it to the group. We have to be careful about + -- strict patterns though; splitSegments expects that if we return Just + -- then we have actually done some splitting. Otherwise it will go into + -- an infinite loop (#14163). go lets indep bndrs ((L loc (BindStmt pat body bind_op fail_op ty), fvs) : rest) - | isEmptyNameSet (bndrs `intersectNameSet` fvs) + | isEmptyNameSet (bndrs `intersectNameSet` fvs) && not (isStrictPattern pat) = go lets ((L loc (BindStmt pat body bind_op fail_op ty), fvs) : indep) bndrs' rest where bndrs' = bndrs `unionNameSet` mkNameSet (collectPatBinders pat) diff --git a/testsuite/tests/ado/T14163.hs b/testsuite/tests/ado/T14163.hs new file mode 100644 index 0000000..9463c1c --- /dev/null +++ b/testsuite/tests/ado/T14163.hs @@ -0,0 +1,13 @@ +{-# language ApplicativeDo #-} + +import GHC.Exts + +readIt :: IO (Int, Int) +readIt = readLn + +main :: IO () +main = do + (_, _) <- readIt + (_, _) <- readIt + (_, _) <- readIt + print "Done" diff --git a/testsuite/tests/ado/T14163.stdin b/testsuite/tests/ado/T14163.stdin new file mode 100644 index 0000000..0f62046 --- /dev/null +++ b/testsuite/tests/ado/T14163.stdin @@ -0,0 +1,3 @@ +(1,2) +(3,4) +(5,6) diff --git a/testsuite/tests/ado/T14163.stdout b/testsuite/tests/ado/T14163.stdout new file mode 100644 index 0000000..5a32621 --- /dev/null +++ b/testsuite/tests/ado/T14163.stdout @@ -0,0 +1 @@ +"Done" diff --git a/testsuite/tests/ado/all.T b/testsuite/tests/ado/all.T index bb1cc16..d88e907 100644 --- a/testsuite/tests/ado/all.T +++ b/testsuite/tests/ado/all.T @@ -11,3 +11,4 @@ test('T12490', normal, compile, ['']) test('T13242', normal, compile, ['']) test('T13242a', normal, compile_fail, ['']) test('T13875', normal, compile_and_run, ['']) +test('T14163', normal, compile_and_run, ['']) From git at git.haskell.org Sat Sep 9 00:09:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 00:09:10 +0000 (UTC) Subject: [commit: ghc] master: Bump T783 expected allocations (22f11f1) Message-ID: <20170909000910.239D13A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/22f11f1975ba5bfa6934a32cc8922491cb7f494d/ghc >--------------------------------------------------------------- commit 22f11f1975ba5bfa6934a32cc8922491cb7f494d Author: Ben Gamari Date: Fri Sep 8 20:08:20 2017 -0400 Bump T783 expected allocations >--------------------------------------------------------------- 22f11f1975ba5bfa6934a32cc8922491cb7f494d 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 7227ebf..313c3ce 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -496,7 +496,7 @@ test('T783', # 2016-04-06: 249332816 (x86/Linux, 64-bit machine) # 2017-03-24: 225911912 (x86/Linux, 64-bit machine) - (wordsize(64), 436978192, 10)]), + (wordsize(64), 481875416, 10)]), # prev: 349263216 (amd64/Linux) # 07/08/2012: 384479856 (amd64/Linux) # 29/08/2012: 436927840 (amd64/Linux) @@ -526,6 +526,7 @@ test('T783', # 2016-02-03: 488592288 (amd64/Linux) # (D1795: Another overhaul of pattern match checker, #11374) # 2017-02-14 436978192 Early inlining: 5% improvement + # 2017-09-08 481875416 Unknown extra_hc_opts('-static') ], From git at git.haskell.org Sat Sep 9 08:54:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 08:54:59 +0000 (UTC) Subject: [commit: ghc] master: Remove now redundant CPP (cf6b4d1) Message-ID: <20170909085459.689233A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf6b4d1c603c0e81eeae8d4e4d8025e84ca5d63b/ghc >--------------------------------------------------------------- commit cf6b4d1c603c0e81eeae8d4e4d8025e84ca5d63b Author: Herbert Valerio Riedel Date: Sat Sep 9 10:53:56 2017 +0200 Remove now redundant CPP Resulting from requiring to boot with GHC 8.0 or later >--------------------------------------------------------------- cf6b4d1c603c0e81eeae8d4e4d8025e84ca5d63b compiler/prelude/PrelRules.hs | 4 ---- compiler/prelude/PrimOp.hs | 2 -- compiler/utils/UniqMap.hs | 5 ----- 3 files changed, 11 deletions(-) diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index 8ee0f82..13f4f12 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -56,9 +56,7 @@ import Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..)) import Control.Applicative ( Alternative(..) ) import Control.Monad -#if __GLASGOW_HASKELL__ > 710 import qualified Control.Monad.Fail as MonadFail -#endif import Data.Bits as Bits import qualified Data.ByteString as BS import Data.Int @@ -651,10 +649,8 @@ instance Monad RuleM where Just r -> runRuleM (g r) dflags iu e fail _ = mzero -#if __GLASGOW_HASKELL__ > 710 instance MonadFail.MonadFail RuleM where fail _ = mzero -#endif instance Alternative RuleM where empty = RuleM $ \_ _ _ -> Nothing diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs index 3a84906..79bec86 100644 --- a/compiler/prelude/PrimOp.hs +++ b/compiler/prelude/PrimOp.hs @@ -7,9 +7,7 @@ {-# LANGUAGE CPP #-} -- The default is a bit too low for the quite large primOpInfo definition -#if __GLASGOW_HASKELL__ >= 801 {-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} -#endif module PrimOp ( PrimOp(..), PrimOpVecCat(..), allThePrimOps, diff --git a/compiler/utils/UniqMap.hs b/compiler/utils/UniqMap.hs index 012409b..5bd609e 100644 --- a/compiler/utils/UniqMap.hs +++ b/compiler/utils/UniqMap.hs @@ -1,6 +1,5 @@ {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TupleSections #-} -{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# OPTIONS_GHC -Wall #-} @@ -50,9 +49,7 @@ import UniqFM import Unique import Outputable -#if __GLASGOW_HASKELL__ > 710 import Data.Semigroup ( Semigroup(..) ) -#endif import Data.Coerce import Data.Maybe import Data.Typeable @@ -63,10 +60,8 @@ newtype UniqMap k a = UniqMap (UniqFM (k, a)) deriving (Data, Eq, Functor, Typeable) type role UniqMap nominal representational -#if __GLASGOW_HASKELL__ > 710 instance Semigroup (UniqMap k a) where (<>) = plusUniqMap -#endif instance Monoid (UniqMap k a) where mempty = emptyUniqMap From git at git.haskell.org Sat Sep 9 12:34:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:34:59 +0000 (UTC) Subject: [commit: ghc] branch 'wip/GrowableAST' created Message-ID: <20170909123459.CA3603A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/GrowableAST Referencing: d7e3b6162b506ef9348a4b0af6f8d55213a8d7ef From git at git.haskell.org Sat Sep 9 12:35:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:35:03 +0000 (UTC) Subject: [commit: ghc] wip/GrowableAST: Growable AST: - first compiling commit (1c77176) Message-ID: <20170909123503.A51D83A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/GrowableAST Link : http://ghc.haskell.org/trac/ghc/changeset/1c771765295bf789d4cda228a1f87c5a2e8e42b5/ghc >--------------------------------------------------------------- commit 1c771765295bf789d4cda228a1f87c5a2e8e42b5 Author: shayan-najd Date: Wed Jul 26 07:49:41 2017 +0000 Growable AST: - first compiling commit Growable AST: - first compiling commit Growable AST: - adding NPat and NPlusK to AST Growable AST: - re-organising HsExp.hs (no removal / addition) Growable AST: - intermediate commit Growable AST: - Reorganising HsBinds.hs (without removing or adding) Growable AST: - before grand uncommenting latest changes Growable AST: - current version, before bug hunt Growable AST: - fixing the issues, finally! Growable AST: - re-adding parts that relied on Expr Growable AST: - organising HsDecls (no addition /removal) Growable AST: - Making HsDecl extensible with the following remaining (a) transfering the documentations, (b) updating the module export list. Growable AST: - reorganising HsImpExp Growable AST: - Making HsImpExp growable Growable AST: - reorganising HsSyn Growable AST: - making HsSyn growable - making a remaining datatype in HsImpExp growable Growable AST: - some clean up Growable AST: - Transferring documentations in HsDecl Growable AST: - fixing some warnings >--------------------------------------------------------------- 1c771765295bf789d4cda228a1f87c5a2e8e42b5 compiler/deSugar/DsArrows.hs | 20 +- compiler/deSugar/DsBinds.hs | 6 +- compiler/deSugar/DsExpr.hs | 4 +- compiler/deSugar/DsForeign.hs | 4 +- compiler/deSugar/DsMeta.hs | 11 +- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/hsSyn/AST.hs | 2979 ++++++++++++++++++++++ compiler/hsSyn/Convert.hs | 42 +- compiler/hsSyn/HsBinds.hs | 2051 +++++++++------ compiler/hsSyn/HsDecls.hs | 4338 ++++++++++++++++++++----------- compiler/hsSyn/HsDoc.hs | 54 +- compiler/hsSyn/HsExpr.hs | 4924 +++++++++++++++++++++++------------- compiler/hsSyn/HsExpr.hs-boot | 27 +- compiler/hsSyn/HsExtension.hs | 29 + compiler/hsSyn/HsImpExp.hs | 605 +++-- compiler/hsSyn/HsLit.hs | 407 ++- compiler/hsSyn/HsPat.hs | 1154 ++++++--- compiler/hsSyn/HsPat.hs-boot | 13 +- compiler/hsSyn/HsSyn.hs | 160 +- compiler/hsSyn/HsTypes.hs | 2700 ++++++++++++-------- compiler/hsSyn/HsUtils.hs | 48 +- compiler/parser/HaddockUtils.hs | 3 +- compiler/parser/Parser.y | 4 +- compiler/parser/RdrHsSyn.hs | 39 +- compiler/rename/RnBinds.hs | 48 +- compiler/rename/RnExpr.hs | 86 +- compiler/rename/RnExpr.hs-boot | 8 +- compiler/rename/RnSource.hs | 61 +- compiler/rename/RnTypes.hs | 14 +- compiler/typecheck/TcBinds.hs | 16 +- compiler/typecheck/TcClassDcl.hs | 6 +- compiler/typecheck/TcDeriv.hs | 2 +- compiler/typecheck/TcErrors.hs | 4 +- compiler/typecheck/TcForeign.hs | 16 +- compiler/typecheck/TcHsSyn.hs | 40 +- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 20 +- compiler/typecheck/TcInteract.hs | 3 +- compiler/typecheck/TcMatches.hs | 54 +- compiler/typecheck/TcPatSyn.hs | 4 +- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcSplice.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 28 +- 44 files changed, 13799 insertions(+), 6241 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 1c771765295bf789d4cda228a1f87c5a2e8e42b5 From git at git.haskell.org Sat Sep 9 12:35:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:35:07 +0000 (UTC) Subject: [commit: ghc] wip/GrowableAST: # This is a combination of 9 commits. # This is the 1st commit message: Growable AST: - first compiling commit (e38574d) Message-ID: <20170909123507.B10DD3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/GrowableAST Link : http://ghc.haskell.org/trac/ghc/changeset/e38574dcd045ba7b36bfb282da4073cc73224b24/ghc >--------------------------------------------------------------- commit e38574dcd045ba7b36bfb282da4073cc73224b24 Merge: 1c77176 0bb1e84 Author: Shayan Najd Date: Sun Aug 13 12:45:24 2017 +0000 # This is a combination of 9 commits. # This is the 1st commit message: Growable AST: - first compiling commit Growable AST: - adding NPat and NPlusK to AST # This is the commit message #2: Growable AST: - re-organising HsExp.hs (no removal / addition) # This is the commit message #3: Growable AST: - intermediate commit # This is the commit message #4: Growable AST: - Reorganising HsBinds.hs (without removing or adding) # This is the commit message #5: Growable AST: - before grand uncommenting # This is the commit message #6: latest changes # This is the commit message #7: Growable AST: - current version, before bug hunt # This is the commit message #8: Growable AST: - fixing the issues, finally! # This is the commit message #9: Growable AST: - re-adding parts that relied on Expr # This is the commit message #10: Growable AST: - organising HsDecls (no addition /removal) # This is the commit message #1: Growable AST: - Making HsDecl extensible with the following remaining (a) transfering the documentations, (b) updating the module export list. # This is the commit message #2: Growable AST: - reorganising HsImpExp # This is the commit message #3: Growable AST: - Making HsImpExp growable # This is the commit message #4: Growable AST: - reorganising HsSyn # This is the commit message #5: Growable AST: - making HsSyn growable - making a remaining datatype in HsImpExp growable # This is the commit message #6: Growable AST: - some clean up # This is the commit message #7: Growable AST: - Transferring documentations in HsDecl # This is the commit message #8: Growable AST: - fixing some warnings # This is the commit message #9: Growable AST: - fixing some warnings >--------------------------------------------------------------- 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 e38574dcd045ba7b36bfb282da4073cc73224b24 From git at git.haskell.org Sat Sep 9 12:35:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:35:11 +0000 (UTC) Subject: [commit: ghc] wip/GrowableAST: Merge branch 'master' of git://git.haskell.org/ghc (da9369c) Message-ID: <20170909123511.A46423A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/GrowableAST Link : http://ghc.haskell.org/trac/ghc/changeset/da9369cbe6575a946025cb5b0bc3ae050820beed/ghc >--------------------------------------------------------------- commit da9369cbe6575a946025cb5b0bc3ae050820beed Merge: e38574d c6462ab Author: Shayan Najd Date: Sun Aug 13 12:45:30 2017 +0000 Merge branch 'master' of git://git.haskell.org/ghc >--------------------------------------------------------------- da9369cbe6575a946025cb5b0bc3ae050820beed testsuite/tests/roles/should_compile/T14101.hs | 10 ++++++++++ testsuite/tests/roles/should_compile/all.T | 1 + 2 files changed, 11 insertions(+) From git at git.haskell.org Sat Sep 9 12:35:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:35:15 +0000 (UTC) Subject: [commit: ghc] wip/GrowableAST: Merge branch 'master' of git://git.haskell.org/ghc into GrowableAST (6752680) Message-ID: <20170909123515.A5C413A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/GrowableAST Link : http://ghc.haskell.org/trac/ghc/changeset/6752680ee9253aec991cfde4dc447479564e06e7/ghc >--------------------------------------------------------------- commit 6752680ee9253aec991cfde4dc447479564e06e7 Merge: 1c77176 c6462ab Author: Shayan Najd Date: Sun Aug 13 18:37:54 2017 +0000 Merge branch 'master' of git://git.haskell.org/ghc into GrowableAST # Conflicts: # compiler/deSugar/DsArrows.hs # compiler/deSugar/DsBinds.hs # compiler/hsSyn/HsBinds.hs # compiler/hsSyn/HsDecls.hs # compiler/hsSyn/HsExpr.hs # compiler/hsSyn/HsLit.hs # compiler/hsSyn/HsPat.hs # compiler/typecheck/TcBinds.hs # compiler/typecheck/TcClassDcl.hs # compiler/typecheck/TcHsSyn.hs >--------------------------------------------------------------- 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 6752680ee9253aec991cfde4dc447479564e06e7 From git at git.haskell.org Sat Sep 9 12:35:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:35:18 +0000 (UTC) Subject: [commit: ghc] wip/GrowableAST: erge branch 'master' into GrowableAST (9ffe092) Message-ID: <20170909123518.B79C73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/GrowableAST Link : http://ghc.haskell.org/trac/ghc/changeset/9ffe09200d1a32fcfb8ba22f64d1684ac416f989/ghc >--------------------------------------------------------------- commit 9ffe09200d1a32fcfb8ba22f64d1684ac416f989 Merge: 6752680 da9369c Author: Shayan Najd Date: Sun Aug 13 20:21:53 2017 +0000 erge branch 'master' into GrowableAST >--------------------------------------------------------------- 9ffe09200d1a32fcfb8ba22f64d1684ac416f989 From git at git.haskell.org Sat Sep 9 12:35:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:35:21 +0000 (UTC) Subject: [commit: ghc] wip/GrowableAST: Growable AST: - fixed some testcases (d7e3b61) Message-ID: <20170909123521.87D7A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/GrowableAST Link : http://ghc.haskell.org/trac/ghc/changeset/d7e3b6162b506ef9348a4b0af6f8d55213a8d7ef/ghc >--------------------------------------------------------------- commit d7e3b6162b506ef9348a4b0af6f8d55213a8d7ef Author: Shayan Najd Date: Mon Aug 14 10:49:34 2017 +0000 Growable AST: - fixed some testcases >--------------------------------------------------------------- d7e3b6162b506ef9348a4b0af6f8d55213a8d7ef .../ghc-api/annotations-literals/parsed.stdout | 4 +- .../parser/should_compile/DumpParsedAst.stderr | 194 +++++++---- .../parser/should_compile/DumpRenamedAst.stderr | 208 ++++++----- .../should_compile/DumpTypecheckedAst.stderr | 385 +++++++++++++-------- 4 files changed, 487 insertions(+), 304 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 d7e3b6162b506ef9348a4b0af6f8d55213a8d7ef From git at git.haskell.org Sat Sep 9 12:56:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:56:13 +0000 (UTC) Subject: [commit: ghc] master: Remove now redundant cabal conditionals in {ghc, template-haskell}.cabal (122f183) Message-ID: <20170909125613.BD3583A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/122f183d47fe46a54d2964111ce269939706b0f8/ghc >--------------------------------------------------------------- commit 122f183d47fe46a54d2964111ce269939706b0f8 Author: Herbert Valerio Riedel Date: Sat Sep 9 12:15:00 2017 +0200 Remove now redundant cabal conditionals in {ghc,template-haskell}.cabal In the past we needed the construct below for wired-in packages, but since GHC 8.0 (which we require at least for stage0 now) the CLI has stabilised, so we can unconditionally use `-this-unit-id` since GHC 8.0. if impl( ghc >= 7.11 ) ghc-options: -this-unit-id template-haskell else if impl( ghc >= 7.9 ) ghc-options: -this-package-key template-haskell else ghc-options: -package-name template-haskell >--------------------------------------------------------------- 122f183d47fe46a54d2964111ce269939706b0f8 compiler/ghc.cabal.in | 12 +++--------- libraries/template-haskell/template-haskell.cabal | 14 ++++---------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 152e156..4348d50 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -49,7 +49,7 @@ Library Default-Language: Haskell2010 Exposed: False - Build-Depends: base >= 4 && < 5, + Build-Depends: base >= 4.9 && < 5, deepseq >= 1.4 && < 1.5, directory >= 1 && < 1.4, process >= 1 && < 1.7, @@ -111,14 +111,8 @@ Library Include-Dirs: . parser utils -- We need to set the unit id to ghc (without a version number) - -- as it's magic. But we can't set it for old versions of GHC (e.g. - -- when bootstrapping) because those versions of GHC don't understand - -- that GHC is wired-in. - if impl ( ghc >= 7.11 ) - GHC-Options: -this-unit-id ghc - else - if impl( ghc >= 7.9 ) - GHC-Options: -this-package-key ghc + -- as it's magic. + GHC-Options: -this-unit-id ghc if flag(stage1) Include-Dirs: stage1 diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index fcfa448..1f01a15 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -51,18 +51,12 @@ Library Language.Haskell.TH.Lib.Map build-depends: - base >= 4.8 && < 4.11, + base >= 4.9 && < 4.11, ghc-boot-th == 8.3, pretty == 1.1.* - -- We need to set the unit ID to template-haskell (without a - -- version number) as it's magic. ghc-options: -Wall - if impl( ghc >= 7.11 ) - ghc-options: -this-unit-id template-haskell - else - if impl( ghc >= 7.9 ) - ghc-options: -this-package-key template-haskell - else - ghc-options: -package-name template-haskell + -- We need to set the unit ID to template-haskell (without a + -- version number) as it's magic. + ghc-options: -this-unit-id template-haskell From git at git.haskell.org Sat Sep 9 12:56:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 12:56:16 +0000 (UTC) Subject: [commit: ghc] master: Remove makefile logic for legacy -this-package-key (400ead8) Message-ID: <20170909125616.7AC1B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/400ead81e80f66ad7b1260b11b2a92f25ccc3e5a/ghc >--------------------------------------------------------------- commit 400ead81e80f66ad7b1260b11b2a92f25ccc3e5a Author: Herbert Valerio Riedel Date: Sat Sep 9 14:25:30 2017 +0200 Remove makefile logic for legacy -this-package-key This isn't needed anymore as we don't support GHC < 8 anymore. This is a follow-up to 122f183 >--------------------------------------------------------------- 400ead81e80f66ad7b1260b11b2a92f25ccc3e5a configure.ac | 5 ----- mk/config.mk.in | 2 -- rules/distdir-way-opts.mk | 10 ---------- 3 files changed, 17 deletions(-) diff --git a/configure.ac b/configure.ac index 92b8523..8d1a71a 100644 --- a/configure.ac +++ b/configure.ac @@ -176,11 +176,6 @@ fi GHC_PACKAGE_DB_FLAG=package-db AC_SUBST(GHC_PACKAGE_DB_FLAG) -FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.11], - SUPPORTS_THIS_UNIT_ID=NO, - SUPPORTS_THIS_UNIT_ID=YES) -AC_SUBST(SUPPORTS_THIS_UNIT_ID) - # GHC is passed to Cabal, so we need a native path if test "${WithGhc}" != "" then diff --git a/mk/config.mk.in b/mk/config.mk.in index dbcd0e4..ac1512e 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -510,8 +510,6 @@ endif GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@ -SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@ - #----------------------------------------------------------------------------- # C compiler # diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 88847e8..45dc0ce 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -105,20 +105,10 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage # $1_$2_$3_MOST_HC_OPTS is also passed to C compilations when we use # GHC as the C compiler. -ifeq "$(SUPPORTS_THIS_UNIT_ID)" "NO" -ifeq "$4" "0" -$4_USE_THIS_UNIT_ID=NO -endif -endif - $1_$2_$4_DEP_OPTS = \ $$(foreach pkg,$$($1_$2_DEP_IPIDS),-package-id $$(pkg)) -ifeq "$($4_USE_THIS_UNIT_ID)" "NO" -$4_THIS_UNIT_ID = -this-package-key -else $4_THIS_UNIT_ID = -this-unit-id -endif $1_$2_$3_MOST_HC_OPTS = \ $$(WAY_$3_HC_OPTS) \ From git at git.haskell.org Sat Sep 9 15:26:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 15:26:10 +0000 (UTC) Subject: [commit: ghc] master: Canonicalise Monoid instances in GHC (dab0e51) Message-ID: <20170909152610.621943A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dab0e515eadecaee3e9e9f5f8eee3159fa39bb27/ghc >--------------------------------------------------------------- commit dab0e515eadecaee3e9e9f5f8eee3159fa39bb27 Author: Herbert Valerio Riedel Date: Sat Sep 9 13:47:08 2017 +0200 Canonicalise Monoid instances in GHC IOW, code compiles -Wnoncanonical-monoid-instances clean now >--------------------------------------------------------------- dab0e515eadecaee3e9e9f5f8eee3159fa39bb27 compiler/ghc.cabal.in | 5 ++++- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 3 +-- compiler/typecheck/TcErrors.hs | 3 +-- compiler/utils/OrdList.hs | 2 +- compiler/utils/UniqMap.hs | 4 ++-- compiler/utils/UniqSet.hs | 10 +++------- ghc/ghc-bin.cabal.in | 3 +++ 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 4348d50..30592d1 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -73,7 +73,10 @@ Library Build-Depends: terminfo == 0.4.* Build-Depends: unix == 2.7.* - GHC-Options: -Wall -fno-warn-name-shadowing + GHC-Options: -Wall + -Wno-name-shadowing + -Wnoncanonical-monad-instances + -Wnoncanonical-monoid-instances if flag(ghci) CPP-Options: -DGHCI diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index f09237c..099e819 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -1867,8 +1867,7 @@ instance Semigroup LlvmAccum where instance Monoid LlvmAccum where mempty = LlvmAccum nilOL [] - LlvmAccum stmtsA declsA `mappend` LlvmAccum stmtsB declsB = - LlvmAccum (stmtsA `mappend` stmtsB) (declsA `mappend` declsB) + mappend = (Semigroup.<>) liftExprData :: LlvmM ExprData -> WriterT LlvmAccum LlvmM LlvmVar liftExprData action = do diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 3aa5dd8..85d5404 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -251,8 +251,7 @@ instance Semigroup Report where instance Monoid Report where mempty = Report [] [] [] - mappend (Report a1 b1 c1) (Report a2 b2 c2) - = Report (a1 ++ a2) (b1 ++ b2) (c1 ++ c2) + mappend = (Semigroup.<>) -- | Put a doc into the important msgs block. important :: SDoc -> Report diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs index 1660090..90fdefb 100644 --- a/compiler/utils/OrdList.hs +++ b/compiler/utils/OrdList.hs @@ -41,7 +41,7 @@ instance Semigroup (OrdList a) where instance Monoid (OrdList a) where mempty = nilOL - mappend = appOL + mappend = (Semigroup.<>) mconcat = concatOL instance Functor OrdList where diff --git a/compiler/utils/UniqMap.hs b/compiler/utils/UniqMap.hs index 5bd609e..c0960dd 100644 --- a/compiler/utils/UniqMap.hs +++ b/compiler/utils/UniqMap.hs @@ -49,7 +49,7 @@ import UniqFM import Unique import Outputable -import Data.Semigroup ( Semigroup(..) ) +import Data.Semigroup as Semi ( Semigroup(..) ) import Data.Coerce import Data.Maybe import Data.Typeable @@ -65,7 +65,7 @@ instance Semigroup (UniqMap k a) where instance Monoid (UniqMap k a) where mempty = emptyUniqMap - mappend = plusUniqMap + mappend = (Semi.<>) instance (Outputable k, Outputable a) => Outputable (UniqMap k a) where ppr (UniqMap m) = diff --git a/compiler/utils/UniqSet.hs b/compiler/utils/UniqSet.hs index fcac865..d09b337 100644 --- a/compiler/utils/UniqSet.hs +++ b/compiler/utils/UniqSet.hs @@ -52,7 +52,7 @@ import Data.Coerce import Outputable import Data.Foldable (foldl') import Data.Data -import qualified Data.Semigroup +import qualified Data.Semigroup as Semi -- Note [UniqSet invariant] -- ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -61,7 +61,8 @@ import qualified Data.Semigroup -- It means that to implement mapUniqSet you have to update -- both the keys and the values. -newtype UniqSet a = UniqSet {getUniqSet' :: UniqFM a} deriving Data +newtype UniqSet a = UniqSet {getUniqSet' :: UniqFM a} + deriving (Data, Semi.Semigroup, Monoid) emptyUniqSet :: UniqSet a emptyUniqSet = UniqSet emptyUFM @@ -186,11 +187,6 @@ unsafeUFMToUniqSet = UniqSet instance Outputable a => Outputable (UniqSet a) where ppr = pprUniqSet ppr -instance Data.Semigroup.Semigroup (UniqSet a) where - (<>) = mappend -instance Monoid (UniqSet a) where - mempty = UniqSet mempty - UniqSet s `mappend` UniqSet t = UniqSet (s `mappend` t) pprUniqSet :: (a -> SDoc) -> UniqSet a -> SDoc pprUniqSet f (UniqSet s) = pprUniqFM f s diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index b04c13a..06e6fc3 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -45,6 +45,9 @@ Executable ghc C-Sources: hschooks.c GHC-Options: -Wall + -Wnoncanonical-monad-instances + -Wnoncanonical-monoid-instances + if flag(ghci) -- NB: this is never built by the bootstrapping GHC+libraries Build-depends: From git at git.haskell.org Sat Sep 9 15:26:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 15:26:13 +0000 (UTC) Subject: [commit: ghc] master: Canonicalise MonoidFail instances in GHC (346e562) Message-ID: <20170909152613.224803A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/346e562adffd44edd8c31328c0280543d7dd75c1/ghc >--------------------------------------------------------------- commit 346e562adffd44edd8c31328c0280543d7dd75c1 Author: Herbert Valerio Riedel Date: Sat Sep 9 16:29:23 2017 +0200 Canonicalise MonoidFail instances in GHC IOW, code compiles -Wnoncanonical-monoidfail-instances clean now This is easy now since we require GHC 8.0/base-4.9 or later for bootstrapping. Note that we can easily enable `MonadFail` via default-extensions: MonadFailDesugaring in compiler/ghc.cabal.in which currently would point out that NatM doesn't have a proper `fail` method, even though failable patterns are made use of: compiler/nativeGen/SPARC/CodeGen.hs:425:25: error: * No instance for (Control.Monad.Fail.MonadFail NatM) arising from a do statement with the failable pattern ‘(dyn_c, [dyn_r])’ >--------------------------------------------------------------- 346e562adffd44edd8c31328c0280543d7dd75c1 compiler/cmm/CmmMonad.hs | 2 +- compiler/coreSyn/CoreLint.hs | 2 +- compiler/ghc.cabal.in | 1 + compiler/parser/Lexer.x | 4 ++-- compiler/prelude/PrelRules.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSMonad.hs | 2 +- compiler/types/Unify.hs | 2 +- compiler/utils/IOEnv.hs | 2 +- compiler/utils/ListT.hs | 4 ++++ ghc/ghc-bin.cabal.in | 1 + 12 files changed, 16 insertions(+), 10 deletions(-) diff --git a/compiler/cmm/CmmMonad.hs b/compiler/cmm/CmmMonad.hs index c035577..e225d7d 100644 --- a/compiler/cmm/CmmMonad.hs +++ b/compiler/cmm/CmmMonad.hs @@ -29,7 +29,7 @@ instance Applicative PD where instance Monad PD where (>>=) = thenPD - fail = failPD + fail = MonadFail.fail instance MonadFail.MonadFail PD where fail = failPD diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 92c14bc..6195e67 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1948,7 +1948,7 @@ instance Applicative LintM where (<*>) = ap instance Monad LintM where - fail err = failWithL (text err) + fail = MonadFail.fail m >>= k = LintM (\ env errs -> let (res, errs') = unLintM m env errs in case res of diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 30592d1..247d2ee 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -76,6 +76,7 @@ Library GHC-Options: -Wall -Wno-name-shadowing -Wnoncanonical-monad-instances + -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances if flag(ghci) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index c5332fb..5d3d65d 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -77,7 +77,7 @@ module Lexer ( -- base import Control.Monad -import Control.Monad.Fail +import Control.Monad.Fail as MonadFail import Data.Bits import Data.Char import Data.List @@ -1890,7 +1890,7 @@ instance Applicative P where instance Monad P where (>>=) = thenP - fail = failP + fail = MonadFail.fail instance MonadFail P where fail = failP diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index 13f4f12..d2b8d87 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -647,7 +647,7 @@ instance Monad RuleM where RuleM f >>= g = RuleM $ \dflags iu e -> case f dflags iu e of Nothing -> Nothing Just r -> runRuleM (g r) dflags iu e - fail _ = mzero + fail = MonadFail.fail instance MonadFail.MonadFail RuleM where fail _ = mzero diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index a0844b7..dfbb16a 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -2285,7 +2285,7 @@ instance Monad SpecM where case f y of SpecM z -> z - fail str = SpecM $ fail str + fail = MonadFail.fail instance MonadFail.MonadFail SpecM where fail str = SpecM $ fail str diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 0eff63d..0a76d23 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -3513,7 +3513,7 @@ instance Applicative TcPluginM where (<*>) = ap instance Monad TcPluginM where - fail x = TcPluginM (const $ fail x) + fail = MonadFail.fail TcPluginM m >>= k = TcPluginM (\ ev -> do a <- m ev runTcPluginM (k a) ev) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index c168c08..932237c 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -2291,7 +2291,7 @@ instance Applicative TcS where (<*>) = ap instance Monad TcS where - fail err = TcS (\_ -> fail err) + fail = MonadFail.fail m >>= k = TcS (\ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs) instance MonadFail.MonadFail TcS where diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 80cccb3..c5b7e66 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -1034,7 +1034,7 @@ instance Applicative UM where (<*>) = ap instance Monad UM where - fail _ = UM (\_ -> SurelyApart) -- failed pattern match + fail = MonadFail.fail m >>= k = UM (\state -> do { (state', v) <- unUM m state ; unUM (k v) state' }) diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs index 5a7ccd9..6fc5f9d 100644 --- a/compiler/utils/IOEnv.hs +++ b/compiler/utils/IOEnv.hs @@ -56,7 +56,7 @@ unIOEnv (IOEnv m) = m instance Monad (IOEnv m) where (>>=) = thenM (>>) = (*>) - fail _ = failM -- Ignore the string + fail = MonadFail.fail instance MonadFail.MonadFail (IOEnv m) where fail _ = failM -- Ignore the string diff --git a/compiler/utils/ListT.hs b/compiler/utils/ListT.hs index 2b81db1..7dc1aa3 100644 --- a/compiler/utils/ListT.hs +++ b/compiler/utils/ListT.hs @@ -32,6 +32,7 @@ module ListT ( import Control.Applicative import Control.Monad +import Control.Monad.Fail as MonadFail ------------------------------------------------------------------------- -- | A monad transformer for performing backtracking computations @@ -64,6 +65,9 @@ instance Alternative (ListT f) where instance Monad (ListT m) where m >>= f = ListT $ \sk fk -> unListT m (\a fk' -> unListT (f a) sk fk') fk + fail = MonadFail.fail + +instance MonadFail (ListT m) where fail _ = ListT $ \_ fk -> fk instance MonadPlus (ListT m) where diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 06e6fc3..5fe7c9d 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -46,6 +46,7 @@ Executable ghc GHC-Options: -Wall -Wnoncanonical-monad-instances + -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances if flag(ghci) From git at git.haskell.org Sat Sep 9 16:00:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 9 Sep 2017 16:00:51 +0000 (UTC) Subject: [commit: ghc] master: Retire cabal_macros_boot.h hack (838a10f) Message-ID: <20170909160051.B9FB73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/838a10fcad9168895b49b4709056b549f2888860/ghc >--------------------------------------------------------------- commit 838a10fcad9168895b49b4709056b549f2888860 Author: Herbert Valerio Riedel Date: Sat Sep 9 17:37:03 2017 +0200 Retire cabal_macros_boot.h hack I originally introduced this hack 3 years ago in b0379819e46796047c1574a6abccf186afd27afa, and finally we can retire it because starting with GHC 8.0 (which is the minimum required version to bootstrap GHC 8.4) these macros are generated natively by GHC. >--------------------------------------------------------------- 838a10fcad9168895b49b4709056b549f2888860 utils/ghc-cabal/cabal_macros_boot.h | 40 ------------------------------------- utils/ghc-cabal/ghc.mk | 9 ++------- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/utils/ghc-cabal/cabal_macros_boot.h b/utils/ghc-cabal/cabal_macros_boot.h deleted file mode 100644 index 3b130e8..0000000 --- a/utils/ghc-cabal/cabal_macros_boot.h +++ /dev/null @@ -1,40 +0,0 @@ -/* defines a few MIN_VERSION_...() macros used by some of the bootstrap packages */ - -#if __GLASGOW_HASKELL__ >= 800 -/* macros are generated accurately by GHC on the fly */ -#elif __GLASGOW_HASKELL__ >= 711 -/* package base-4.9.0.0 */ -# define MIN_VERSION_base(major1,major2,minor) (\ - (major1) < 4 || \ - (major1) == 4 && (major2) < 9 || \ - (major1) == 4 && (major2) == 9 && (minor) <= 0) -/* package bytestring-0.10.8 */ -# define MIN_VERSION_bytestring(major1,major2,minor) (\ - (major1) < 0 || \ - (major1) == 0 && (major2) < 10 || \ - (major1) == 0 && (major2) == 10 && (minor) <= 8) - -#elif __GLASGOW_HASKELL__ >= 709 -/* package base-4.8.0.0 */ -# define MIN_VERSION_base(major1,major2,minor) (\ - (major1) < 4 || \ - (major1) == 4 && (major2) < 8 || \ - (major1) == 4 && (major2) == 8 && (minor) <= 0) -/* package bytestring-0.10.6 */ -# define MIN_VERSION_bytestring(major1,major2,minor) (\ - (major1) < 0 || \ - (major1) == 0 && (major2) < 10 || \ - (major1) == 0 && (major2) == 10 && (minor) <= 6) - -#elif __GLASGOW_HASKELL__ >= 707 -/* package base-4.7.0 */ -# define MIN_VERSION_base(major1,major2,minor) (\ - (major1) < 4 || \ - (major1) == 4 && (major2) < 7 || \ - (major1) == 4 && (major2) == 7 && (minor) <= 0) -/* package bytestring-0.10.4 */ -# define MIN_VERSION_bytestring(major1,major2,minor) (\ - (major1) < 0 || \ - (major1) == 0 && (major2) < 10 || \ - (major1) == 0 && (major2) == 10 && (minor) <= 4) -#endif diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index eeae8a7..e0d2afe 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -19,13 +19,9 @@ CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION)) CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)" # Starting with GHC 8.0 we make use of GHC's native ability to -# generate MIN_VERSION_() CPP macros (rather than relying on -# the fragile `cabal_macros_boot.h` hack). The generation of those +# generate MIN_VERSION_() CPP macros. The generation of those # macros is triggered by `-hide-all-packages`, so we have to explicitly -# enumerate all packages we need in scope. In order to simplify the logic, -# we pass `-hide-all-packages` also to GHCs < 8, and we include -# `cabal_macros_boot.h` also for GHC >= 8 (in which case it becomes a -# dummy include that doesn't contribute any macro definitions). +# enumerate all packages we need in scope. ifeq "$(Windows_Host)" "YES" CABAL_BUILD_DEPS := ghc-prim base array transformers time containers bytestring deepseq process pretty directory Win32 else @@ -68,7 +64,6 @@ $(ghc-cabal_DIST_BINARY): $(CABAL_LEXER_DEP) utils/ghc-cabal/Main.hs $(TOUCH_DEP -DCABAL_VERSION=$(CABAL_VERSION) \ -DCABAL_PARSEC \ -DBOOTSTRAPPING \ - -optP-include -optPutils/ghc-cabal/cabal_macros_boot.h \ -odir bootstrapping \ -hidir bootstrapping \ $(CABAL_LEXER_DEP) \ From git at git.haskell.org Tue Sep 12 15:02:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Sep 2017 15:02:44 +0000 (UTC) Subject: [commit: ghc] master: Allow CSE'ing of work-wrapped bindings (#14186) (fe04f37) Message-ID: <20170912150244.904CB3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe04f3783b662c52c4a0ff36b2d62a7a575998a5/ghc >--------------------------------------------------------------- commit fe04f3783b662c52c4a0ff36b2d62a7a575998a5 Author: Joachim Breitner Date: Sun Sep 10 16:10:37 2017 +0100 Allow CSE'ing of work-wrapped bindings (#14186) the worker/wrapper creates an artificial INLINE pragma, which caused CSE to not do its work. We now recognize such artificial pragmas by using `NoUserInline` instead of `Inline` as the `InlineSpec`. Differential Revision: https://phabricator.haskell.org/D3939 >--------------------------------------------------------------- fe04f3783b662c52c4a0ff36b2d62a7a575998a5 compiler/basicTypes/BasicTypes.hs | 26 +- compiler/deSugar/DsBinds.hs | 8 +- compiler/deSugar/DsMeta.hs | 2 +- compiler/hsSyn/Convert.hs | 2 +- compiler/hsSyn/HsBinds.hs | 4 +- compiler/parser/Parser.y | 2 +- compiler/simplCore/CSE.hs | 10 +- compiler/specialise/Specialise.hs | 2 +- compiler/stranal/WorkWrap.hs | 6 +- compiler/typecheck/TcSigs.hs | 2 +- compiler/utils/Binary.hs | 4 +- testsuite/tests/roles/should_compile/Roles1.stderr | 45 +- .../tests/roles/should_compile/Roles14.stderr | 15 +- testsuite/tests/roles/should_compile/Roles2.stderr | 16 +- testsuite/tests/roles/should_compile/Roles3.stderr | 30 +- testsuite/tests/roles/should_compile/Roles4.stderr | 23 +- testsuite/tests/roles/should_compile/T8958.stderr | 27 +- .../tests/simplCore/should_compile/T13143.stderr | 6 +- .../tests/simplCore/should_compile/T14186.stderr | 122 +++-- .../tests/simplCore/should_compile/T3717.stderr | 30 +- .../tests/simplCore/should_compile/T3772.stdout | 2 +- .../tests/simplCore/should_compile/T4908.stderr | 61 ++- .../tests/simplCore/should_compile/T4930.stderr | 4 +- .../tests/simplCore/should_compile/T7360.stderr | 4 +- .../tests/simplCore/should_compile/T7865.stdout | 2 +- testsuite/tests/simplCore/should_compile/all.T | 2 +- .../simplCore/should_compile/spec-inline.stderr | 6 +- .../tests/stranal/should_compile/T10482.stderr | 264 ++++++++++- .../tests/stranal/should_compile/T10482a.stderr | 490 ++++++++++++++++++++- testsuite/tests/th/TH_Roles2.stderr | 8 +- 30 files changed, 1024 insertions(+), 201 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 fe04f3783b662c52c4a0ff36b2d62a7a575998a5 From git at git.haskell.org Tue Sep 12 15:02:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Sep 2017 15:02:41 +0000 (UTC) Subject: [commit: ghc] master: Add testcase for #14186 (fe35b85) Message-ID: <20170912150241.AEBA73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe35b85a8cc72582e0f98a3059be00a9a2318a4a/ghc >--------------------------------------------------------------- commit fe35b85a8cc72582e0f98a3059be00a9a2318a4a Author: Joachim Breitner Date: Sun Sep 10 15:49:43 2017 +0100 Add testcase for #14186 and move the generally useful helpers check_errmsg and grep_errmsg to testlib.py. Some documentation can be found on https://ghc.haskell.org/trac/ghc/wiki/Building/RunningTests/Adding >--------------------------------------------------------------- fe35b85a8cc72582e0f98a3059be00a9a2318a4a testsuite/driver/testlib.py | 13 +++++ testsuite/tests/simplCore/should_compile/T14186.hs | 4 ++ .../tests/simplCore/should_compile/T14186.stderr | 57 ++++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 6 ++- testsuite/tests/stranal/should_compile/all.T | 21 ++------ 5 files changed, 83 insertions(+), 18 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 15c773e..6a75068 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -520,6 +520,19 @@ def normalise_errmsg_fun( *fs ): def _normalise_errmsg_fun( name, opts, *fs ): opts.extra_errmsg_normaliser = join_normalisers(opts.extra_errmsg_normaliser, fs) +def check_errmsg(needle): + def norm(str): + if needle in str: + return "%s contained in -ddump-simpl\n" % needle + else: + return "%s not contained in -ddump-simpl\n" % needle + return normalise_errmsg_fun(norm) + +def grep_errmsg(needle): + def norm(str): + return "".join(filter(lambda l: re.search(needle, l), str.splitlines(True))) + return normalise_errmsg_fun(norm) + def normalise_whitespace_fun(f): return lambda name, opts: _normalise_whitespace_fun(name, opts, f) diff --git a/testsuite/tests/simplCore/should_compile/T14186.hs b/testsuite/tests/simplCore/should_compile/T14186.hs new file mode 100644 index 0000000..1fe1d6a --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14186.hs @@ -0,0 +1,4 @@ +module T14186 where + +foo f g (x, xs) = (f (g x), map (f . g) xs) +bar f g (x, xs) = (f (g x), map (f . g) xs) diff --git a/testsuite/tests/simplCore/should_compile/T14186.stderr b/testsuite/tests/simplCore/should_compile/T14186.stderr new file mode 100644 index 0000000..ccc9bd9 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14186.stderr @@ -0,0 +1,57 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 52, types: 99, coercions: 0, joins: 0/0} + +-- RHS size: {terms: 18, types: 29, coercions: 0, joins: 0/0} +foo + :: forall t1 b t2. + (t1 -> b) -> (t2 -> t1) -> (t2, [t2]) -> (b, [b]) +[GblId, Arity=3] +foo + = \ (@ t_aUk) + (@ b_aUs) + (@ t1_aUo) + (f_apH :: t_aUk -> b_aUs) + (g_apI :: t1_aUo -> t_aUk) + (ds_dVH :: (t1_aUo, [t1_aUo])) -> + case ds_dVH of { (x_apJ, xs_apK) -> + (f_apH (g_apI x_apJ), + map + @ t1_aUo @ b_aUs (. @ t_aUk @ b_aUs @ t1_aUo f_apH g_apI) xs_apK) + } + +-- RHS size: {terms: 18, types: 29, coercions: 0, joins: 0/0} +bar + :: forall t1 b t2. + (t1 -> b) -> (t2 -> t1) -> (t2, [t2]) -> (b, [b]) +[GblId, Arity=3] +bar = foo + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +$trModule1_rVy :: GHC.Prim.Addr# +[GblId, Caf=NoCafRefs] +$trModule1_rVy = "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$trModule2_rVX :: GHC.Types.TrName +[GblId, Caf=NoCafRefs] +$trModule2_rVX = GHC.Types.TrNameS $trModule1_rVy + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +$trModule3_rVY :: GHC.Prim.Addr# +[GblId, Caf=NoCafRefs] +$trModule3_rVY = "T14186"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$trModule4_rVZ :: GHC.Types.TrName +[GblId, Caf=NoCafRefs] +$trModule4_rVZ = GHC.Types.TrNameS $trModule3_rVY + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T14186.$trModule :: GHC.Types.Module +[GblId, Caf=NoCafRefs] +T14186.$trModule = GHC.Types.Module $trModule2_rVX $trModule4_rVZ + + + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 82a5124..3eae1ff 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -269,4 +269,8 @@ test('T12600', ['$MAKE -s --no-print-directory T12600']) test('T13658', normal, compile, ['-dcore-lint']) test('T13708', normal, compile, ['']) -test('T14137', normal, compile, ['-dsuppress-uniques -ddump-simpl']) + +# thunk should inline here, so check whether or not it appears in the Core +test('T14137', [ check_errmsg(r'thunk') ], compile, ['-dsuppress-uniques -ddump-simpl']) +# bar and foo should CSEd here, so check for that in the Core +test('T14186', [ only_ways(['optasm']), check_errmsg(r'bar = foo'), expect_broken(14186) ], compile, ['-ddump-simpl']) diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T index d8fc757..4421b24 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -1,19 +1,6 @@ # Only compile with optimisation setTestOpts( only_ways(['optasm']) ) -def checkCoreString(needle): - def norm(str): - if needle in str: - return "%s contained in -ddump-simpl\n" % needle - else: - return "%s not contained in -ddump-simpl\n" % needle - return normalise_errmsg_fun(norm) - -def grepCoreString(needle): - def norm(str): - return "".join(filter(lambda l: re.search(needle, l), str.splitlines(True))) - return normalise_errmsg_fun(norm) - test('default', normal, compile, ['']) test('fact', normal, compile, ['']) test('fun', normal, compile, ['']) @@ -39,15 +26,15 @@ test('T8743', [], multimod_compile, ['T8743', '-v0']) # with two unboxed args. See Trac #10482 for background # # Set -dppr-cols to ensure output doesn't wrap -test('T10482', [ grepCoreString(r'wfoo.*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) -test('T10482a', [ grepCoreString(r'wf.*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) +test('T10482', [ grep_errmsg(r'wfoo.*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) +test('T10482a', [ grep_errmsg(r'wf.*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) test('T9208', when(compiler_debugged(), expect_broken(9208)), compile, ['']) # T9208 fails (and should do so) if you have assertion checking on in the compiler # Hence the above expect_broken. See comments in the Trac ticket -test('T10694', [ grepCoreString(r'Str=') ], compile, ['-dppr-cols=200 -ddump-simpl']) -test('T11770', [ checkCoreString('OneShot') ], compile, ['-ddump-simpl']) +test('T10694', [ grep_errmsg(r'Str=') ], compile, ['-dppr-cols=200 -ddump-simpl']) +test('T11770', [ check_errmsg('OneShot') ], compile, ['-ddump-simpl']) test('T13031', normal, run_command, ['$MAKE -s --no-print-directory T13031']) From git at git.haskell.org Tue Sep 12 21:19:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Sep 2017 21:19:51 +0000 (UTC) Subject: [commit: ghc] master: Add a test for #14140 (0ebc8dc) Message-ID: <20170912211951.C3B053A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ebc8dc3525ddaa04a0c9e4c0c1aef70fd3fe725/ghc >--------------------------------------------------------------- commit 0ebc8dc3525ddaa04a0c9e4c0c1aef70fd3fe725 Author: David Feuer Date: Tue Sep 12 17:21:46 2017 -0400 Add a test for #14140 This issue seems to have been fixed by 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 (Re-engineer caseRules to add tagToEnum/dataToTag) but I don't think anyone realized that. Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #14140 Differential Revision: https://phabricator.haskell.org/D3934 >--------------------------------------------------------------- 0ebc8dc3525ddaa04a0c9e4c0c1aef70fd3fe725 testsuite/tests/simplCore/should_compile/Makefile | 7 ++++++ testsuite/tests/simplCore/should_compile/T14140.hs | 29 ++++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 5 ++++ 3 files changed, 41 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index f56a851..5790407 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -230,3 +230,10 @@ T11272: .PHONY: T12600 T12600: '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -ddump-prep -dsuppress-all -dsuppress-uniques -dno-suppress-type-signatures -dppr-cols=200 T12600.hs | grep "wfoo" | head -n 1 + +# We don't expect to case match on any literal numbers other than +# 0 or 1. See T14140.hs for an explanation. +T14140: + $(RM) -f T14140.o T14140.hi + -'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T14140.hs | grep '[2-9]# *->' +# Expecting no output from the grep, hence "-" diff --git a/testsuite/tests/simplCore/should_compile/T14140.hs b/testsuite/tests/simplCore/should_compile/T14140.hs new file mode 100644 index 0000000..39476a2 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14140.hs @@ -0,0 +1,29 @@ +-- We don't want to see a case match on the result +-- of dataToTag#. We check that by looking for case +-- matches on any literal other than 0# or 1#. We +-- only really expect to see 1# here (and not the tag +-- for OtherOS), but just in case GHC decides to get +-- clever with its knowledge of the possible results +-- of (==#), we also permit 0#. +{-# LANGUAGE MagicHash, BangPatterns #-} +module T14140 where +import GHC.Exts + +data OS = Linux | Windows | OSX -- tier 1 desktop OSs + | FreeBSD | OpenBSD | NetBSD -- other free Unix OSs + | DragonFly + | Solaris | AIX | HPUX | IRIX -- ageing Unix OSs + | HaLVM -- bare metal / VMs / hypervisors + | Hurd -- GNU's microkernel + | IOS | Android -- mobile OSs + | Ghcjs + | OtherOS String + +-- This is similar to the derived Eq instance. We write it +-- out manually to prevent future deriving changes from +-- changing the test. +instance Eq OS where + OtherOS x == OtherOS y = x == y + (!x) == (!y) = case dataToTag# x ==# dataToTag# y of + 1# -> True + _ -> False diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index a692007..72b872a 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -274,3 +274,8 @@ test('T13708', normal, compile, ['']) test('T14137', [ check_errmsg(r'thunk') ], compile, ['-dsuppress-uniques -ddump-simpl']) # bar and foo should CSEd here, so check for that in the Core test('T14186', [ only_ways(['optasm']), check_errmsg(r'bar = foo') ], compile, ['-ddump-simpl']) + +test('T14140', + normal, + run_command, + ['$MAKE -s --no-print-directory T14140']) From git at git.haskell.org Wed Sep 13 13:44:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 13:44:36 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #14209 (dafa012) Message-ID: <20170913134436.5295D3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dafa0128950a6b18d79818881b3eeb6dc5c855b4/ghc >--------------------------------------------------------------- commit dafa0128950a6b18d79818881b3eeb6dc5c855b4 Author: Ryan Scott Date: Wed Sep 13 09:37:24 2017 -0400 Add regression test for #14209 Summary: Commit 0257dacf228024d0cc6ba247c707130637a25580 (`Refactor bindHsQTyVars and friends`) ended up fixing #14209. Let's add a regression test so that it stays fixed. Test Plan: make test TEST=T14209 Reviewers: austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14209 Differential Revision: https://phabricator.haskell.org/D3936 >--------------------------------------------------------------- dafa0128950a6b18d79818881b3eeb6dc5c855b4 testsuite/tests/polykinds/T14209.hs | 5 +++++ testsuite/tests/polykinds/all.T | 1 + 2 files changed, 6 insertions(+) diff --git a/testsuite/tests/polykinds/T14209.hs b/testsuite/tests/polykinds/T14209.hs new file mode 100644 index 0000000..3e0181c --- /dev/null +++ b/testsuite/tests/polykinds/T14209.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TypeInType #-} +module T14209 where + +data MyProxy k (a :: k) = MyProxy +data Foo (z :: MyProxy k (a :: k)) diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 864e204..c01b73c 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -167,3 +167,4 @@ test('T13985', normal, compile_fail, ['']) test('T14110', normal, compile_fail, ['']) test('BadKindVar', normal, compile_fail, ['']) test('T13738', normal, compile_fail, ['']) +test('T14209', normal, compile, ['']) From git at git.haskell.org Wed Sep 13 13:44:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 13:44:33 +0000 (UTC) Subject: [commit: ghc] master: Check if -XStaticPointers is enabled when renaming static expressions (9ff9c35) Message-ID: <20170913134433.26E1C3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ff9c35895ecc072f289c93addd1faad884bf122/ghc >--------------------------------------------------------------- commit 9ff9c35895ecc072f289c93addd1faad884bf122 Author: Ryan Scott Date: Wed Sep 13 09:37:13 2017 -0400 Check if -XStaticPointers is enabled when renaming static expressions Summary: Trying to use `static` expressions without the `-XStaticPointers` extension enabled can lead to runtime errors. Normally, such a situation isn't possible, but Template Haskell provides a backdoor that allows it to happen, as shown in #14204. To prevent this, we ensure that `-XStaticPointers` is enabled when renaming `static` expressions. Test Plan: make test TEST=T14204 Reviewers: facundominguez, austin, bgamari, simonpj Reviewed By: facundominguez, simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #14204 Differential Revision: https://phabricator.haskell.org/D3931 >--------------------------------------------------------------- 9ff9c35895ecc072f289c93addd1faad884bf122 compiler/rename/RnExpr.hs | 10 ++++++++++ testsuite/tests/th/T14204.hs | 8 ++++++++ testsuite/tests/th/T14204.stderr | 5 +++++ testsuite/tests/th/all.T | 1 + 4 files changed, 24 insertions(+) diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index 5ccefb8..99e3f70 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -375,6 +375,16 @@ wired-in. See the Notes about the NameSorts in Name.hs. -} rnExpr e@(HsStatic _ expr) = do + -- Normally, you wouldn't be able to construct a static expression without + -- first enabling -XStaticPointers in the first place, since that extension + -- is what makes the parser treat `static` as a keyword. But this is not a + -- sufficient safeguard, as one can construct static expressions by another + -- mechanism: Template Haskell (see #14204). To ensure that GHC is + -- absolutely prepared to cope with static forms, we check for + -- -XStaticPointers here as well. + unlessXOptM LangExt.StaticPointers $ + addErr $ hang (text "Illegal static expression:" <+> ppr e) + 2 (text "Use StaticPointers to enable this extension") (expr',fvExpr) <- rnLExpr expr stage <- getStage case stage of diff --git a/testsuite/tests/th/T14204.hs b/testsuite/tests/th/T14204.hs new file mode 100644 index 0000000..e952dbd --- /dev/null +++ b/testsuite/tests/th/T14204.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T14204 where + +import GHC.StaticPtr +import Language.Haskell.TH + +main :: IO () +main = putStrLn (deRefStaticPtr $(pure (StaticE (LitE (StringL "wat"))))) diff --git a/testsuite/tests/th/T14204.stderr b/testsuite/tests/th/T14204.stderr new file mode 100644 index 0000000..90150e2 --- /dev/null +++ b/testsuite/tests/th/T14204.stderr @@ -0,0 +1,5 @@ + +T14204.hs:8:35: error: + • Illegal static expression: static "wat" + Use StaticPointers to enable this extension + • In the untyped splice: $(pure (StaticE (LitE (StringL "wat")))) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 1e737ac..aa973f7 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -394,4 +394,5 @@ test('T13856', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T13885', normal, compile_and_run, ['-v0']) test('T13887', normal, compile_and_run, ['-v0']) test('T13968', normal, compile_fail, ['-v0']) +test('T14204', normal, compile_fail, ['-v0']) test('T14060', normal, compile_and_run, ['-v0']) From git at git.haskell.org Wed Sep 13 15:17:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:17:21 +0000 (UTC) Subject: [commit: ghc] master: DriverMkDepend: Kill redundant import (d645e44) Message-ID: <20170913151721.795973A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d645e441704a02b9eb5548e7c92cc5ee30a345ef/ghc >--------------------------------------------------------------- commit d645e441704a02b9eb5548e7c92cc5ee30a345ef Author: Ben Gamari Date: Wed Sep 13 08:22:20 2017 -0400 DriverMkDepend: Kill redundant import Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3941 >--------------------------------------------------------------- d645e441704a02b9eb5548e7c92cc5ee30a345ef compiler/main/DriverMkDepend.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/main/DriverMkDepend.hs b/compiler/main/DriverMkDepend.hs index 8cf14c5..b346f66 100644 --- a/compiler/main/DriverMkDepend.hs +++ b/compiler/main/DriverMkDepend.hs @@ -19,7 +19,6 @@ import GhcMonad import DynFlags import Util import HscTypes -import FileCleanup ( newTempName ) import qualified SysTools import Module import Digraph ( SCC(..) ) From git at git.haskell.org Wed Sep 13 15:17:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:17:24 +0000 (UTC) Subject: [commit: ghc] master: rts: Print message before SIGUSR2 backtrace (b890e88) Message-ID: <20170913151724.3123A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b890e88dc20f9b45fe769538d539258c616a3f25/ghc >--------------------------------------------------------------- commit b890e88dc20f9b45fe769538d539258c616a3f25 Author: Ben Gamari Date: Wed Sep 13 08:21:20 2017 -0400 rts: Print message before SIGUSR2 backtrace Reviewers: austin, erikd, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3942 >--------------------------------------------------------------- b890e88dc20f9b45fe769538d539258c616a3f25 rts/posix/Signals.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 7471948..6b72890 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -539,6 +539,7 @@ backtrace_handler(int sig STG_UNUSED) #if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); + fprintf(stderr, "\nCaught SIGUSR2; Backtrace:\n"); libdwPrintBacktrace(session, stderr, bt); backtraceFree(bt); libdwFree(session); From git at git.haskell.org Wed Sep 13 15:17:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:17:26 +0000 (UTC) Subject: [commit: ghc] master: Clarify Data.Data documentation (f8e383f) Message-ID: <20170913151726.DEF113A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f8e383f0e4f11e6e1060888208440907bcba9248/ghc >--------------------------------------------------------------- commit f8e383f0e4f11e6e1060888208440907bcba9248 Author: David Feuer Date: Wed Sep 13 08:22:42 2017 -0400 Clarify Data.Data documentation Explain much more clearly when `dataCast1` and `dataCast2` can have non-trivial implementations. On a couple different occasions, I have attempted to write better defaults for these, only to discover that we can't really do that. The new documentation implicitly explains why that is. [skip ci] Reviewers: austin, hvr, bgamari, angerman Reviewed By: bgamari, angerman Subscribers: angerman, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3926 >--------------------------------------------------------------- f8e383f0e4f11e6e1060888208440907bcba9248 libraries/base/Data/Data.hs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index 33e8c86..a120980 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -277,22 +277,34 @@ class Typeable a => Data a where ------------------------------------------------------------------------------ -- | Mediate types and unary type constructors. - -- In 'Data' instances of the form @T a@, 'dataCast1' should be defined - -- as 'gcast1'. + -- + -- In 'Data' instances of the form + -- + -- @ + -- instance (Data a, ...) => Data (T a) + -- @ + -- + -- 'dataCast1' should be defined as 'gcast1'. -- -- The default definition is @'const' 'Nothing'@, which is appropriate - -- for non-unary type constructors. + -- for instances of other forms. dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c a) dataCast1 _ = Nothing -- | Mediate types and binary type constructors. - -- In 'Data' instances of the form @T a b@, 'dataCast2' should be - -- defined as 'gcast2'. + -- + -- In 'Data' instances of the form + -- + -- @ + -- instance (Data a, Data b, ...) => Data (T a b) + -- @ + -- + -- 'dataCast2' should be defined as 'gcast2'. -- -- The default definition is @'const' 'Nothing'@, which is appropriate - -- for non-binary type constructors. + -- for instances of other forms. dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a) From git at git.haskell.org Wed Sep 13 15:17:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:17:32 +0000 (UTC) Subject: [commit: ghc] master: [RTS] Harden against buffer overflow (e62391a) Message-ID: <20170913151732.E237A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e62391a75c8dc304f902e732fc63eefb21930aca/ghc >--------------------------------------------------------------- commit e62391a75c8dc304f902e732fc63eefb21930aca Author: Bartosz Nitka Date: Wed Sep 13 08:28:00 2017 -0400 [RTS] Harden against buffer overflow This sprintf is safe thanks to the guarantees on the format strings that we pass to it. Well, almost. The GR_FILENAME_FMT_GUM format would not have satisfied them if it was still used. If someone makes a mistake that's a potential privilege escalation, so I think it's reasonable to switch to snprintf to protect against that remote possibility. Test Plan: it builds, CI Reviewers: simonmar, bgamari, austin, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3944 >--------------------------------------------------------------- e62391a75c8dc304f902e732fc63eefb21930aca includes/rts/Flags.h | 1 - rts/RtsFlags.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index 6700f9d..6040201 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -263,7 +263,6 @@ extern RTS_FLAGS RtsFlags; #define STATS_FILENAME_MAXLEN 128 #define GR_FILENAME_FMT "%0.124s.gr" -#define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s" #define HP_FILENAME_FMT "%0.124s.hp" #define LIFE_FILENAME_FMT "%0.122s.life" #define PROF_FILENAME_FMT "%0.122s.prof" diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 06d59f0..ec21ef1 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1636,7 +1636,8 @@ openStatsFile (char *filename, // filename, or NULL } /* default . */ char stats_filename[STATS_FILENAME_MAXLEN]; - sprintf(stats_filename, filename_fmt, prog_name); + snprintf(stats_filename, STATS_FILENAME_MAXLEN, filename_fmt, + prog_name); f = fopen(stats_filename,"w"); } if (f == NULL) { From git at git.haskell.org Wed Sep 13 15:17:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:17:30 +0000 (UTC) Subject: [commit: ghc] master: Use ar for -staticlib (91262e7) Message-ID: <20170913151730.2D1833A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/91262e75dd1d80f8f28a3922934ec7e59290e28c/ghc >--------------------------------------------------------------- commit 91262e75dd1d80f8f28a3922934ec7e59290e28c Author: Moritz Angermann Date: Wed Sep 13 08:24:46 2017 -0400 Use ar for -staticlib Hopefully we can get rid of libtool, by using ar only Depends on: D3579 Test Plan: validate Reviewers: austin, hvr, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3721 >--------------------------------------------------------------- 91262e75dd1d80f8f28a3922934ec7e59290e28c aclocal.m4 | 3 + compiler/ghc.cabal.in | 1 + compiler/main/Ar.hs | 258 ++++++++++++++++++++++++++++++++++++++++ compiler/main/DriverPipeline.hs | 37 +++++- compiler/main/DynFlags.hs | 16 ++- compiler/main/FileCleanup.hs | 48 ++++++++ compiler/main/Packages.hs | 8 ++ compiler/main/SysTools.hs | 49 +++++--- settings.in | 1 + 9 files changed, 399 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 91262e75dd1d80f8f28a3922934ec7e59290e28c From git at git.haskell.org Wed Sep 13 15:17:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:17:35 +0000 (UTC) Subject: [commit: ghc] master: Make IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115 (cbd4911) Message-ID: <20170913151735.A12963A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cbd491170818070aeb7edd8c547a2f0bfa891bf1/ghc >--------------------------------------------------------------- commit cbd491170818070aeb7edd8c547a2f0bfa891bf1 Author: HE, Tao Date: Wed Sep 13 08:26:32 2017 -0400 Make IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115 Test Plan: ./validate Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #13115 Differential Revision: https://phabricator.haskell.org/D3938 >--------------------------------------------------------------- cbd491170818070aeb7edd8c547a2f0bfa891bf1 libraries/base/Data/Data.hs | 8 ++++++++ libraries/base/changelog.md | 2 ++ testsuite/tests/annotations/should_fail/annfail10.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/T12921.stderr | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index a120980..3d257e0 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -140,6 +140,8 @@ import GHC.Real -- So we can give Data instance for Ratio --import GHC.IOBase -- So we can give Data instance for IO, Handle import GHC.Ptr -- So we can give Data instance for Ptr import GHC.ForeignPtr -- So we can give Data instance for ForeignPtr +import Foreign.Ptr (IntPtr(..), WordPtr(..)) + -- So we can give Data instance for IntPtr and WordPtr --import GHC.Stable -- So we can give Data instance for StablePtr --import GHC.ST -- So we can give Data instance for ST --import GHC.Conc -- So we can give Data instance for MVar & Co. @@ -1204,6 +1206,12 @@ instance Data a => Data (ForeignPtr a) where dataTypeOf _ = mkNoRepType "GHC.ForeignPtr.ForeignPtr" dataCast1 x = gcast1 x +-- | @since 4.11.0.0 +deriving instance Data IntPtr + +-- | @since 4.11.0.0 +deriving instance Data WordPtr + ------------------------------------------------------------------------------ -- The Data instance for Array preserves data abstraction at the cost of -- inefficiency. We omit reflection services for the sake of data abstraction. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index b9b1756..047f6d9 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -30,6 +30,8 @@ * Add `iterate'`, a strict version of `iterate`, to `Data.List` and `Data.OldList` (#3474) + * Add `Data` instances for `IntPtr` and `WordPtr` (#13115) + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr index ee9fbe1..f7866fa 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 43 instances involving out-of-scope types + ...plus 45 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 15 instances involving out-of-scope types + ...plus 17 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN f 1 #-} diff --git a/testsuite/tests/typecheck/should_fail/T12921.stderr b/testsuite/tests/typecheck/should_fail/T12921.stderr index 2c04531..079acbf 100644 --- a/testsuite/tests/typecheck/should_fail/T12921.stderr +++ b/testsuite/tests/typecheck/should_fail/T12921.stderr @@ -10,7 +10,7 @@ T12921.hs:4:1: error: instance Data.Data.Data Ordering -- Defined in ‘Data.Data’ instance Data.Data.Data Integer -- Defined in ‘Data.Data’ ...plus 15 others - ...plus 43 instances involving out-of-scope types + ...plus 45 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN module "HLint: ignore Reduce duplication" #-} From git at git.haskell.org Wed Sep 13 15:35:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:35:48 +0000 (UTC) Subject: [commit: ghc] master: Fix @since annotations in GHC.Stats (8ff11c4) Message-ID: <20170913153548.931143A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8ff11c4e5ae475cf9bb7de4ce5271b4e62cbdeab/ghc >--------------------------------------------------------------- commit 8ff11c4e5ae475cf9bb7de4ce5271b4e62cbdeab Author: Dmitry Ivanov Date: Tue Sep 12 09:18:16 2017 +0200 Fix @since annotations in GHC.Stats >--------------------------------------------------------------- 8ff11c4e5ae475cf9bb7de4ce5271b4e62cbdeab libraries/base/GHC/Stats.hsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/Stats.hsc b/libraries/base/GHC/Stats.hsc index 58fb125..35925c9 100644 --- a/libraries/base/GHC/Stats.hsc +++ b/libraries/base/GHC/Stats.hsc @@ -45,14 +45,14 @@ foreign import ccall "getRTSStats" getRTSStats_ :: Ptr () -> IO () -- | Returns whether GC stats have been enabled (with @+RTS -T@, for example). -- --- @since 4.9.0.0 +-- @since 4.10.0.0 foreign import ccall "getRTSStatsEnabled" getRTSStatsEnabled :: IO Bool -- -- | Statistics about runtime activity since the start of the -- program. This is a mirror of the C @struct RTSStats@ in @RtsAPI.h@ -- --- @since 4.9.0.0 +-- @since 4.10.0.0 -- data RTSStats = RTSStats { -- ----------------------------------- @@ -148,7 +148,7 @@ data GCDetails = GCDetails { -- | Time values from the RTS, using a fixed resolution of nanoseconds. type RtsTime = Int64 --- @since 4.9.0.0 +-- @since 4.10.0.0 -- getRTSStats :: IO RTSStats getRTSStats = do From git at git.haskell.org Wed Sep 13 15:36:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 15:36:32 +0000 (UTC) Subject: [commit: ghc] master: Add non-ASCII isLetter True example (6139f7f) Message-ID: <20170913153632.06BF33A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6139f7f7c1e95ffda13d8c5c05a3db1cc35e40bb/ghc >--------------------------------------------------------------- commit 6139f7f7c1e95ffda13d8c5c05a3db1cc35e40bb Author: Chris Martin Date: Wed Sep 6 22:36:03 2017 -0400 Add non-ASCII isLetter True example >--------------------------------------------------------------- 6139f7f7c1e95ffda13d8c5c05a3db1cc35e40bb libraries/base/Data/Char.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/base/Data/Char.hs b/libraries/base/Data/Char.hs index 69e4db7..ac06647 100644 --- a/libraries/base/Data/Char.hs +++ b/libraries/base/Data/Char.hs @@ -132,6 +132,8 @@ digitToInt c -- True -- >>> isLetter 'A' -- True +-- >>> isLetter 'λ' +-- True -- >>> isLetter '0' -- False -- >>> isLetter '%' From git at git.haskell.org Wed Sep 13 17:52:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 17:52:52 +0000 (UTC) Subject: [commit: ghc] master: Option "-ddump-rn-ast" dumps imports and exports too (2fe6f6b) Message-ID: <20170913175252.3614F3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fe6f6baba70de071c391bccc77197ab4f81064d/ghc >--------------------------------------------------------------- commit 2fe6f6baba70de071c391bccc77197ab4f81064d Author: Alan Zimmerman Date: Wed Sep 13 14:02:42 2017 +0200 Option "-ddump-rn-ast" dumps imports and exports too Summary: Previously the renamed source decls only were dumped, now the imports, exports and doc_hdr are too. Test Plan: ./validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14197 Differential Revision: https://phabricator.haskell.org/D3949 >--------------------------------------------------------------- 2fe6f6baba70de071c391bccc77197ab4f81064d compiler/main/HscMain.hs | 34 +- compiler/typecheck/TcRnDriver.hs | 4 +- compiler/typecheck/TcRnMonad.hs | 5 +- .../parser/should_compile/DumpRenamedAst.stderr | 673 +++++++++++---------- 4 files changed, 377 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 2fe6f6baba70de071c391bccc77197ab4f81064d From git at git.haskell.org Wed Sep 13 20:53:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 20:53:49 +0000 (UTC) Subject: [commit: packages/stm] master: Add testcase for #14171 (b6e863e) Message-ID: <20170913205349.C30C63A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/stm On branch : master Link : http://git.haskell.org/packages/stm.git/commitdiff/b6e863e517bdcc3c5de1fbcb776a3fd7e6fe2103 >--------------------------------------------------------------- commit b6e863e517bdcc3c5de1fbcb776a3fd7e6fe2103 Author: Ben Gamari Date: Thu Aug 31 16:03:28 2017 -0400 Add testcase for #14171 >--------------------------------------------------------------- b6e863e517bdcc3c5de1fbcb776a3fd7e6fe2103 tests/T14171.hs | 38 ++++++++++++++++++++++++++++++++++++++ tests/T14171.stderr | 1 + tests/all.T | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/T14171.hs b/tests/T14171.hs new file mode 100644 index 0000000..d9a32b7 --- /dev/null +++ b/tests/T14171.hs @@ -0,0 +1,38 @@ +module Main where + +import Control.Concurrent.STM +import Control.Concurrent.STM.TVar + +data A = A String deriving (Eq, Show) + +data E = E { + a :: TVar [Int], + b :: TVar A, + c :: TVar [Int] + } + +consistency_1 :: E -> STM Bool +consistency_1 = \e -> do + _ <- readTVar $ c e + return True + +installSanityChecks :: E -> IO () +installSanityChecks e = do + x e + fail "You should see this failure" + +x :: E -> IO () +x e = do + -- This unexpected succeeds + atomically $ installCheck consistency_1 + -- error "derp2" + where + installCheck check = always $ check e + +main :: IO () +main = do + state <- initialize + installSanityChecks state + +initialize :: IO E +initialize = E <$> newTVarIO [] <*> newTVarIO (A "USD") <*> newTVarIO [] diff --git a/tests/T14171.stderr b/tests/T14171.stderr new file mode 100644 index 0000000..84de5c7 --- /dev/null +++ b/tests/T14171.stderr @@ -0,0 +1 @@ +T14171: user error (You should see this failure) diff --git a/tests/all.T b/tests/all.T index 213ea75..c2ea89e 100644 --- a/tests/all.T +++ b/tests/all.T @@ -28,5 +28,5 @@ test('T3049', normal, compile_and_run, ['-package stm']) test('T4057', normal, compile_and_run, ['-package stm']) test('stm064', normal, compile_and_run, ['-package stm']) test('stm065', normal, compile_and_run, ['-package stm']) - test('cloneTChan001', normal, compile_and_run, ['-package stm']) +test('T14171', exit_code(1), compile_and_run, ['-package stm']) From git at git.haskell.org Wed Sep 13 20:54:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 20:54:45 +0000 (UTC) Subject: [commit: ghc] master: Better document TypeRep patterns (f9bf621) Message-ID: <20170913205445.8034F3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f9bf621caf2fc17d829dee0ee48b204144927e72/ghc >--------------------------------------------------------------- commit f9bf621caf2fc17d829dee0ee48b204144927e72 Author: Ben Gamari Date: Wed Sep 13 12:23:47 2017 -0400 Better document TypeRep patterns As pointed out in #14199 these are rather non-trivial; extra documentation is in order. [skip ci] Test Plan: Read it Reviewers: dfeuer, austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #14199 Differential Revision: https://phabricator.haskell.org/D3943 >--------------------------------------------------------------- f9bf621caf2fc17d829dee0ee48b204144927e72 libraries/base/Data/Typeable/Internal.hs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index cf3ea07..f094d96 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -221,6 +221,13 @@ instance Ord SomeTypeRep where SomeTypeRep a `compare` SomeTypeRep b = typeRepFingerprint a `compare` typeRepFingerprint b +-- | The function type constructor. +-- +-- For instance, +-- @ +-- typeRep \@(Int -> Char) === Fun (typeRep \@Int) (typeRep \@Char) +-- @ +-- pattern Fun :: forall k (fun :: k). () => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (arg :: TYPE r1) (res :: TYPE r2). @@ -265,7 +272,14 @@ mkTrApp a b = TrApp fpr a b fpr_b = typeRepFingerprint b fpr = fingerprintFingerprints [fpr_a, fpr_b] --- | Pattern match on a type application +-- | A type application. +-- +-- For instance, +-- @ +-- typeRep \@(Maybe Int) === App (typeRep \@Maybe) (typeRep \@Int) +-- @ +-- Note that this will never match a function type (e.g. @Int -> Char@). +-- pattern App :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b) => TypeRep a -> TypeRep b -> TypeRep t @@ -287,6 +301,18 @@ pattern Con con <- TrTyCon _ con _ -- | Pattern match on a type constructor including its instantiated kind -- variables. +-- +-- For instance, +-- @ +-- App (Con' proxyTyCon ks) intRep = typeRep @(Proxy \@Int) +-- @ +-- will bring into scope, +-- @ +-- proxyTyCon :: TyCon +-- ks == [someTypeRep @Type] :: [SomeTypeRep] +-- intRep == typeRep @Int +-- @ +-- pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a pattern Con' con ks <- TrTyCon _ con ks From git at git.haskell.org Wed Sep 13 20:54:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 20:54:48 +0000 (UTC) Subject: [commit: ghc] master: Simplify Data.Type.Equality.== (4be195e) Message-ID: <20170913205448.43D293A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4be195e707d5e079dca5b6ce2e6cd34ff7624adf/ghc >--------------------------------------------------------------- commit 4be195e707d5e079dca5b6ce2e6cd34ff7624adf Author: David Feuer Date: Wed Sep 13 12:25:11 2017 -0400 Simplify Data.Type.Equality.== Contrary to previous comments, we can calculate `==` for types in an extremely general fashion. The approach used here is actually the one mistakenly rejected as impossible. There will be some cases when the previous version was able to reduce and this one is not, particularly for types in `*` that are unknown, but known equal. However, the new behavior is much more uniform. Within the established framework of equality testing by pattern matching, it does a better job than the previous version. Reviewers: goldfire, austin, hvr, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3835 >--------------------------------------------------------------- 4be195e707d5e079dca5b6ce2e6cd34ff7624adf docs/users_guide/8.4.1-notes.rst | 8 ++ libraries/base/Data/Either.hs | 9 -- libraries/base/Data/Type/Equality.hs | 201 ++++++++--------------------------- libraries/base/GHC/TypeLits.hs | 10 +- libraries/base/GHC/TypeNats.hs | 10 +- libraries/base/changelog.md | 8 ++ 6 files changed, 62 insertions(+), 184 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 4be195e707d5e079dca5b6ce2e6cd34ff7624adf From git at git.haskell.org Wed Sep 13 20:54:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 20:54:51 +0000 (UTC) Subject: [commit: ghc] master: Clarify seq documentation (4e22220) Message-ID: <20170913205451.01E043A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4e222203751e50e3c35815376090b2951bf7c9e0/ghc >--------------------------------------------------------------- commit 4e222203751e50e3c35815376090b2951bf7c9e0 Author: Sibi Prabakaran Date: Wed Sep 13 12:33:22 2017 -0400 Clarify seq documentation Improves the documentation by specifying that the first argument in seq function is evaluated to WHNF. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: harendra, rwbarton, thomie GHC Trac Issues: #14213 Differential Revision: https://phabricator.haskell.org/D3945 >--------------------------------------------------------------- 4e222203751e50e3c35815376090b2951bf7c9e0 compiler/prelude/primops.txt.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 8039913..8e020c4 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2817,8 +2817,9 @@ pseudoop "proxy#" pseudoop "seq" a -> b -> b { The value of {\tt seq a b} is bottom if {\tt a} is bottom, and - otherwise equal to {\tt b}. {\tt seq} is usually introduced to - improve performance by avoiding unneeded laziness. + otherwise equal to {\tt b}. In other words, it evaluates the first + argument {\tt a} to weak head normal form (WHNF). {\tt seq} is usually + introduced to improve performance by avoiding unneeded laziness. A note on evaluation order: the expression {\tt seq a b} does {\it not} guarantee that {\tt a} will be evaluated before {\tt b}. From git at git.haskell.org Wed Sep 13 20:54:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 20:54:53 +0000 (UTC) Subject: [commit: ghc] master: rts: Add regsterCc(s)List to RTS symbols list (4cead3c) Message-ID: <20170913205453.BE6583A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4cead3c1d5bf1c5f3cfb1898fd9d618674292f4b/ghc >--------------------------------------------------------------- commit 4cead3c1d5bf1c5f3cfb1898fd9d618674292f4b Author: Ben Gamari Date: Wed Sep 13 15:51:42 2017 -0400 rts: Add regsterCc(s)List to RTS symbols list These are helpers added in a8da0de27e600211f04601ac737c329d6603c700 to register cost centres. They are invoked while loading profiled code and therefore need to be in the RTS's symbol list. Test Plan: Validate, trying starting GHCi in profiled GHC build Reviewers: austin, erikd, simonmar Subscribers: rwbarton, thomie, RyanGlScott Differential Revision: https://phabricator.haskell.org/D3950 >--------------------------------------------------------------- 4cead3c1d5bf1c5f3cfb1898fd9d618674292f4b rts/RtsSymbols.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index e80a495..fb9be7f 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -495,6 +495,8 @@ SymI_HasProto(enterFunCCS) \ SymI_HasProto(pushCostCentre) \ SymI_HasProto(mkCostCentre) \ + SymI_HasProto(registerCcList) \ + SymI_HasProto(registerCcsList) \ SymI_HasProto(era) #else #define RTS_PROF_SYMBOLS /* empty */ From git at git.haskell.org Wed Sep 13 20:54:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 20:54:56 +0000 (UTC) Subject: [commit: ghc] master: Model divergence of retry# as ThrowsExn, not Diverges (10a1a47) Message-ID: <20170913205456.851F73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/10a1a4781c646f81ca9e2ef7a2585df2cbe3a014/ghc >--------------------------------------------------------------- commit 10a1a4781c646f81ca9e2ef7a2585df2cbe3a014 Author: Ben Gamari Date: Wed Sep 13 12:22:27 2017 -0400 Model divergence of retry# as ThrowsExn, not Diverges The demand signature of the retry# primop previously had a Diverges result. However, this caused the demand analyser to conclude that a program of the shape, catchRetry# (... >> retry#) would diverge. Of course, this is plainly wrong; catchRetry#'s sole reason to exist is to "catch" the "exception" thrown by retry#. While catchRetry#'s demand signature correctly had the ExnStr flag set on its first argument, indicating that it should catch divergence, the logic associated with this flag doesn't apply to Diverges results. This resulted in #14171. The solution here is to treat the divergence of retry# as an exception. Namely, give it a result type of ThrowsExn rather than Diverges. Updates stm submodule for tests. Test Plan: Validate with T14171 Reviewers: simonpj, austin Subscribers: rwbarton, thomie GHC Trac Issues: #14171, #8091 Differential Revision: https://phabricator.haskell.org/D3919 >--------------------------------------------------------------- 10a1a4781c646f81ca9e2ef7a2585df2cbe3a014 compiler/basicTypes/Demand.hs | 1 + compiler/prelude/primops.txt.pp | 7 +++++-- libraries/stm | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index dfff0a2..3a83cd9 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -1440,6 +1440,7 @@ postProcessDmdType du@(JD { sd = ss }) (DmdType fv _ res_ty) postProcessDmdResult :: Str () -> DmdResult -> DmdResult postProcessDmdResult Lazy _ = topRes postProcessDmdResult (Str ExnStr _) ThrowsExn = topRes -- Key point! +-- Note that only ThrowsExn results can be caught, not Diverges postProcessDmdResult _ res = res postProcessDmdEnv :: DmdShell -> DmdEnv -> DmdEnv diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 8e020c4..f2c02ec 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2094,7 +2094,7 @@ primop AtomicallyOp "atomically#" GenPrimOp out_of_line = True has_side_effects = True --- NB: retry#'s strictness information specifies it to return bottom. +-- NB: retry#'s strictness information specifies it to throw an exception -- This lets the compiler perform some extra simplifications, since retry# -- will technically never return. -- @@ -2104,10 +2104,13 @@ primop AtomicallyOp "atomically#" GenPrimOp -- with: -- retry# s1 -- where 'e' would be unreachable anyway. See Trac #8091. +-- +-- Note that it *does not* return botRes as the "exception" that is throw may be +-- "caught" by catchRetry#. This mistake caused #14171. primop RetryOp "retry#" GenPrimOp State# RealWorld -> (# State# RealWorld, a #) with - strictness = { \ _arity -> mkClosedStrictSig [topDmd] botRes } + strictness = { \ _arity -> mkClosedStrictSig [topDmd] exnRes } out_of_line = True has_side_effects = True diff --git a/libraries/stm b/libraries/stm index 9c3c3bb..b6e863e 160000 --- a/libraries/stm +++ b/libraries/stm @@ -1 +1 @@ -Subproject commit 9c3c3bb28834d1ba9574be7f887c8914afd4232c +Subproject commit b6e863e517bdcc3c5de1fbcb776a3fd7e6fe2103 From git at git.haskell.org Wed Sep 13 21:08:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:34 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Add text dependency (d93019e) Message-ID: <20170913210834.E6C663A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/d93019e9f9651055548b925f01a702270af7de6e/ghc >--------------------------------------------------------------- commit d93019e9f9651055548b925f01a702270af7de6e Author: Ben Gamari Date: Thu Jun 22 11:59:32 2017 -0400 Add text dependency >--------------------------------------------------------------- d93019e9f9651055548b925f01a702270af7de6e .gitmodules | 4 ++++ compiler/ghc.cabal.in | 1 + compiler/main/HscMain.hs | 1 + ghc/Main.hs | 1 + ghc/ghc-bin.cabal.in | 1 + 5 files changed, 8 insertions(+) diff --git a/.gitmodules b/.gitmodules index 9e0e805..bd386b1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,6 +6,10 @@ path = libraries/bytestring url = ../packages/bytestring.git ignore = untracked +[submodule "libraries/text"] + path = libraries/text + url = https://github.com/bollu/text.git + ignore = untracked [submodule "libraries/Cabal"] path = libraries/Cabal url = ../packages/Cabal.git diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 247d2ee..60df429 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -62,6 +62,7 @@ Library template-haskell == 2.12.*, hpc == 0.6.*, transformers == 0.5.*, + text == 1.2.*, ghc-boot == @ProjectVersionMunged@, ghc-boot-th == @ProjectVersionMunged@, ghci == @ProjectVersionMunged@ diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index e99ca31..30b9410 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -167,6 +167,7 @@ import qualified Data.Map as Map import qualified Data.Set as S import Data.Set (Set) +import qualified Data.Text as DontUseText #include "HsVersions.h" diff --git a/ghc/Main.hs b/ghc/Main.hs index a75aba3..ef05846 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -73,6 +73,7 @@ import Control.Monad import Data.Char import Data.List import Data.Maybe +import qualified Data.Text as DontUseText ----------------------------------------------------------------------------- -- ToDo: diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 5fe7c9d..aa5b02c 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -34,6 +34,7 @@ Executable ghc directory >= 1 && < 1.4, process >= 1 && < 1.7, filepath >= 1 && < 1.5, + text == 1.2.*, ghc-boot == @ProjectVersionMunged@, ghc == @ProjectVersionMunged@ From git at git.haskell.org Wed Sep 13 21:08:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:37 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Add pretty-printer dependency (6148f5a) Message-ID: <20170913210837.A2C7B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/6148f5a7e33b916281beaf68148294df5da454a3/ghc >--------------------------------------------------------------- commit 6148f5a7e33b916281beaf68148294df5da454a3 Author: Ben Gamari Date: Sat Jun 24 10:05:14 2017 -0400 Add pretty-printer dependency >--------------------------------------------------------------- 6148f5a7e33b916281beaf68148294df5da454a3 .gitmodules | 3 +++ compiler/ghc.cabal.in | 1 + ghc.mk | 3 ++- ghc/ghc-bin.cabal.in | 1 + libraries/prettyprinter-core | 1 + packages | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index bd386b1..0ed88ab 100644 --- a/.gitmodules +++ b/.gitmodules @@ -133,3 +133,6 @@ [submodule ".arc-linters/arcanist-external-json-linter"] path = .arc-linters/arcanist-external-json-linter url = ../arcanist-external-json-linter.git +[submodule "libraries/prettyprinter-core"] + path = libraries/prettyprinter-core + url = https://github.com/bollu/prettyprinter-core.git diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 60df429..df9ff12 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -63,6 +63,7 @@ Library hpc == 0.6.*, transformers == 0.5.*, text == 1.2.*, + prettyprinter == 1.1.*, ghc-boot == @ProjectVersionMunged@, ghc-boot-th == @ProjectVersionMunged@, ghci == @ProjectVersionMunged@ diff --git a/ghc.mk b/ghc.mk index 1e37209..8d44590 100644 --- a/ghc.mk +++ b/ghc.mk @@ -420,7 +420,7 @@ else # CLEANING # programs such as GHC and ghc-pkg, that we do not assume the stage0 # compiler already has installed (or up-to-date enough). -PACKAGES_STAGE0 = binary text transformers mtl parsec Cabal/Cabal hpc ghc-boot-th ghc-boot template-haskell ghci +PACKAGES_STAGE0 = binary text transformers mtl parsec Cabal/Cabal hpc ghc-boot-th ghc-boot template-haskell ghci prettyprinter-core ifeq "$(Windows_Host)" "NO" PACKAGES_STAGE0 += terminfo endif @@ -459,6 +459,7 @@ PACKAGES_STAGE1 += ghc-boot-th PACKAGES_STAGE1 += ghc-boot PACKAGES_STAGE1 += template-haskell PACKAGES_STAGE1 += ghc-compact +PACKAGES_STAGE1 += prettyprinter-core ifeq "$(HADDOCK_DOCS)" "YES" PACKAGES_STAGE1 += xhtml diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index aa5b02c..385c9f2a 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -35,6 +35,7 @@ Executable ghc process >= 1 && < 1.7, filepath >= 1 && < 1.5, text == 1.2.*, + prettyprinter == 1.1.*, ghc-boot == @ProjectVersionMunged@, ghc == @ProjectVersionMunged@ diff --git a/libraries/prettyprinter-core b/libraries/prettyprinter-core new file mode 160000 index 0000000..8697cc9 --- /dev/null +++ b/libraries/prettyprinter-core @@ -0,0 +1 @@ +Subproject commit 8697cc9cfe6937d6479396a96c600a4b6d556ab5 diff --git a/packages b/packages index 9af1b64..62a3373 100644 --- a/packages +++ b/packages @@ -41,6 +41,7 @@ ghc-tarballs windows ghc-tarballs.git - libffi-tarballs - - - utils/hsc2hs - - - utils/haddock - - ssh://git at github.com/haskell/haddock.git +libraries/prettyprinter-core - - https://github.com/bollu/prettyprinter-core.git libraries/array - - - libraries/binary - - https://github.com/kolmodin/binary.git libraries/bytestring - - https://github.com/haskell/bytestring.git From git at git.haskell.org Wed Sep 13 21:08:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:43 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Debugging ghc-pkg (29e9df3) Message-ID: <20170913210843.30EC93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/29e9df3b61c7d25e0ba41f3229161aff303a98e0/ghc >--------------------------------------------------------------- commit 29e9df3b61c7d25e0ba41f3229161aff303a98e0 Author: Ben Gamari Date: Fri Jul 21 00:11:14 2017 -0400 Debugging ghc-pkg >--------------------------------------------------------------- 29e9df3b61c7d25e0ba41f3229161aff303a98e0 libraries/ghc-boot/GHC/PackageDb.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs index a59c46e..c1d6b86 100644 --- a/libraries/ghc-boot/GHC/PackageDb.hs +++ b/libraries/ghc-boot/GHC/PackageDb.hs @@ -362,7 +362,7 @@ getHeader :: Get (Word32, Word32) getHeader = do magic <- getByteString (BS.length headerMagic) when (magic /= headerMagic) $ - fail "not a ghc-pkg db file, wrong file magic number" + fail $ "not a ghc-pkg db file, wrong file magic number (saw "++show magic++", expected "++show headerMagic++")" majorVersion <- get :: Get Word32 -- The major version is for incompatible changes From git at git.haskell.org Wed Sep 13 21:08:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:45 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: llvmGen: Fix another (fea1bdd) Message-ID: <20170913210845.E1AAE3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/fea1bddfc9b1cef284e4298698c80d3e94c1f1e5/ghc >--------------------------------------------------------------- commit fea1bddfc9b1cef284e4298698c80d3e94c1f1e5 Author: Ben Gamari Date: Fri Jul 21 00:18:20 2017 -0400 llvmGen: Fix another >--------------------------------------------------------------- fea1bddfc9b1cef284e4298698c80d3e94c1f1e5 compiler/llvmGen/LlvmCodeGen.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs index b2b1e35..3741f25 100644 --- a/compiler/llvmGen/LlvmCodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen.hs @@ -23,7 +23,6 @@ import Hoopl.Block import Hoopl.Collections import PprCmm -import BufWrite import DynFlags import ErrUtils import FastString From git at git.haskell.org Wed Sep 13 21:08:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:40 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Hack: Produce latin1 asm output (e53dc5b) Message-ID: <20170913210840.653F73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/e53dc5befb7ad2329c5aa7bffa4274b990104981/ghc >--------------------------------------------------------------- commit e53dc5befb7ad2329c5aa7bffa4274b990104981 Author: Ben Gamari Date: Fri Jul 21 14:28:57 2017 -0400 Hack: Produce latin1 asm output >--------------------------------------------------------------- e53dc5befb7ad2329c5aa7bffa4274b990104981 compiler/nativeGen/AsmCodeGen.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index 7802dcc..7490d94 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -98,7 +98,7 @@ import Data.Maybe import Data.Ord ( comparing ) import Control.Exception import Control.Monad -import System.IO (Handle) +import System.IO {- The native-code generator has machine-independent and @@ -330,6 +330,7 @@ nativeCodeGen' :: (Outputable statics, Outputable instr, Instruction instr) -> IO UniqSupply nativeCodeGen' dflags this_mod modLoc ncgImpl h us cmms = do + hSetEncoding h latin1 let ngs0 = NGS [] [] [] [] [] [] emptyUFM mapEmpty (ngs, us') <- cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmms ngs0 From git at git.haskell.org Wed Sep 13 21:08:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:48 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: nativeGen: Clean up warning (b3df320) Message-ID: <20170913210848.9DB413A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/b3df320303b8f3986d1724e7ae172fedba4a8342/ghc >--------------------------------------------------------------- commit b3df320303b8f3986d1724e7ae172fedba4a8342 Author: Ben Gamari Date: Fri Jul 21 00:17:27 2017 -0400 nativeGen: Clean up warning >--------------------------------------------------------------- b3df320303b8f3986d1724e7ae172fedba4a8342 compiler/nativeGen/AsmCodeGen.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index 498878f..7802dcc 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -98,7 +98,6 @@ import Data.Maybe import Data.Ord ( comparing ) import Control.Exception import Control.Monad -import System.IO import System.IO (Handle) {- From git at git.haskell.org Wed Sep 13 21:08:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:51 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: llvmGen: Clean up warning (134f2c8) Message-ID: <20170913210851.5E9FA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/134f2c8cd4388c25b9fe5e0f4700ee36d058dc72/ghc >--------------------------------------------------------------- commit 134f2c8cd4388c25b9fe5e0f4700ee36d058dc72 Author: Ben Gamari Date: Fri Jul 21 00:16:34 2017 -0400 llvmGen: Clean up warning >--------------------------------------------------------------- 134f2c8cd4388c25b9fe5e0f4700ee36d058dc72 compiler/llvmGen/LlvmCodeGen/Base.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs index 99202b7..6e42f52 100644 --- a/compiler/llvmGen/LlvmCodeGen/Base.hs +++ b/compiler/llvmGen/LlvmCodeGen/Base.hs @@ -49,7 +49,6 @@ import Outputable as Outp import Platform import UniqFM import Unique -import BufWrite ( BufHandle ) import System.IO (Handle) import UniqSet import UniqSupply From git at git.haskell.org Wed Sep 13 21:08:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:54 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Fix errant newlines (21dc11a) Message-ID: <20170913210854.1D1723A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/21dc11a1ae3ed291fe872e1a2924dca72daf68c1/ghc >--------------------------------------------------------------- commit 21dc11a1ae3ed291fe872e1a2924dca72daf68c1 Author: Ben Gamari Date: Sat Jun 24 12:40:35 2017 -0400 Fix errant newlines >--------------------------------------------------------------- 21dc11a1ae3ed291fe872e1a2924dca72daf68c1 compiler/utils/Pretty.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index 15b8c64..0f6ca4b 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -123,6 +123,7 @@ import GHC.Ptr ( Ptr(..) ) import qualified Data.Text as T import qualified Data.Text.Lazy as TL +import qualified Data.Text.Lazy.IO as TL import Data.Text.Prettyprint.Doc -- PI = PrettyprinterInternal @@ -1010,7 +1011,7 @@ printDoc :: Mode -> Int -> Handle -> Doc a -> IO () printDoc mode cols hdl doc = printDoc_ mode cols hdl (doc <> hardline) printDoc_ :: Mode -> Int -> Handle -> Doc a -> IO () -printDoc_ mode pprCols hdl doc = renderIO hdl (layoutPretty (mkLayoutOptions mode pprCols) doc) where +printDoc_ mode pprCols hdl doc = TL.hPutStr hdl (renderLazy $ layoutPretty (mkLayoutOptions mode pprCols) doc) where mkLayoutOptions :: Mode -> Int -> LayoutOptions -- Note that this should technically be 1.5 as per the old implementation. -- I have no idea why that is. From git at git.haskell.org Wed Sep 13 21:08:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:56 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Try something (dae4a38) Message-ID: <20170913210856.CD5463A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/dae4a38d0496c521fc4f5ee205cac07afca4f963/ghc >--------------------------------------------------------------- commit dae4a38d0496c521fc4f5ee205cac07afca4f963 Author: Ben Gamari Date: Sat Jun 24 13:01:37 2017 -0400 Try something >--------------------------------------------------------------- dae4a38d0496c521fc4f5ee205cac07afca4f963 compiler/utils/Pretty.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index 0f6ca4b..a7969e6 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -1008,10 +1008,10 @@ renderStyle s d = TL.unpack $ renderLazy (layoutPretty (styleToLayoutOptions s) printDoc :: Mode -> Int -> Handle -> Doc a -> IO () -- printDoc adds a newline to the end -printDoc mode cols hdl doc = printDoc_ mode cols hdl (doc <> hardline) +printDoc mode cols hdl doc = printDoc_ mode cols hdl (doc) printDoc_ :: Mode -> Int -> Handle -> Doc a -> IO () -printDoc_ mode pprCols hdl doc = TL.hPutStr hdl (renderLazy $ layoutPretty (mkLayoutOptions mode pprCols) doc) where +printDoc_ mode pprCols hdl doc = TL.hPutStrLn hdl (renderLazy $ layoutPretty (mkLayoutOptions mode pprCols) doc) where mkLayoutOptions :: Mode -> Int -> LayoutOptions -- Note that this should technically be 1.5 as per the old implementation. -- I have no idea why that is. From git at git.haskell.org Wed Sep 13 21:08:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:08:59 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Use prettyprinter (8eb56e3) Message-ID: <20170913210859.93FF63A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/8eb56e31e187f226aca9ec0bd3e87ec57b95c19b/ghc >--------------------------------------------------------------- commit 8eb56e31e187f226aca9ec0bd3e87ec57b95c19b Author: Ben Gamari Date: Sat Jun 24 10:05:38 2017 -0400 Use prettyprinter >--------------------------------------------------------------- 8eb56e31e187f226aca9ec0bd3e87ec57b95c19b compiler/llvmGen/LlvmCodeGen.hs | 4 +- compiler/llvmGen/LlvmCodeGen/Base.hs | 6 +- compiler/main/HscMain.hs | 2 + compiler/nativeGen/AsmCodeGen.hs | 23 ++--- compiler/utils/Outputable.hs | 18 ++-- compiler/utils/Pretty.hs | 185 ++++++++++++++++++++++++++++++++--- ghc/Main.hs | 1 + 7 files changed, 203 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 8eb56e31e187f226aca9ec0bd3e87ec57b95c19b From git at git.haskell.org Wed Sep 13 21:09:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:02 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Never tick primitive string literals (ccd2c23) Message-ID: <20170913210902.5EA123A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/ccd2c234a7a2f32909481bab2f3698d7398b372e/ghc >--------------------------------------------------------------- commit ccd2c234a7a2f32909481bab2f3698d7398b372e Author: Ben Gamari Date: Fri Jul 21 01:23:26 2017 -0400 Never tick primitive string literals Summary: This is a more aggressive approach to the problem initially solved in f5b275a239d2554c4da0b7621211642bf3b10650, where top-level primitive string literals were being wrapped by ticks. This breaks the Core invariant descirbed in Note [CoreSyn top-level string literals]. However, the previous approach was incomplete and left several places where inappropriate ticks could sneak in. This commit kills the problem at the source: we simply never tick any primitive string literal expression. The assumption here is that these expressions are destined for the top-level, where they cannot be ticked, anyways. So even if they haven't been floated out yet there is no reason to tick them. This partially reverts commit f5b275a239d2554c4da0b7621211642bf3b10650. Test Plan: Validate with `-g` Reviewers: scpmw, simonmar, dfeuer, simonpj, austin Subscribers: dfeuer, simonmar, thomie Differential Revision: https://phabricator.haskell.org/D3063 >--------------------------------------------------------------- ccd2c234a7a2f32909481bab2f3698d7398b372e compiler/coreSyn/CoreSyn.hs | 2 ++ compiler/coreSyn/CoreUtils.hs | 5 +++++ compiler/simplCore/FloatOut.hs | 32 ++++++++++++-------------------- compiler/simplCore/Simplify.hs | 8 +------- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 99478d2..41202c3 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -402,6 +402,8 @@ It is important to note that top-level primitive string literals cannot be wrapped in Ticks, as is otherwise done with lifted bindings. CoreToStg expects to see just a plain (Lit (MachStr ...)) expression on the RHS of primitive string bindings; anything else and things break. CoreLint checks this invariant. +To ensure that ticks don't sneak in CoreUtils.mkTick refuses to wrap any +primitive string expression with a tick. Also see Note [Compilation plan for top-level string literals]. diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 1b92a7f..e1eab21 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -300,6 +300,11 @@ mkTick t orig_expr = mkTick' id id orig_expr -> CoreExpr mkTick' top rest expr = case expr of + -- Never tick primitive string literals. These should ultimately float up to + -- the top-level where they must be unadorned. See Note + -- [CoreSyn top-level string literals] for details. + _ | exprIsLiteralString expr -> expr + -- Cost centre ticks should never be reordered relative to each -- other. Therefore we can stop whenever two collide. Tick t2 e diff --git a/compiler/simplCore/FloatOut.hs b/compiler/simplCore/FloatOut.hs index 72fc0d1..06062bd 100644 --- a/compiler/simplCore/FloatOut.hs +++ b/compiler/simplCore/FloatOut.hs @@ -21,7 +21,6 @@ import DynFlags import ErrUtils ( dumpIfSet_dyn ) import Id ( Id, idArity, idType, isBottomingId, isJoinId, isJoinId_maybe ) -import BasicTypes ( TopLevelFlag(..), isTopLevel ) import SetLevels import UniqSupply ( UniqSupply ) import Bag @@ -735,26 +734,19 @@ atJoinCeiling (fs, floats, expr') wrapTick :: Tickish Id -> FloatBinds -> FloatBinds wrapTick t (FB tops ceils defns) - = FB (mapBag (wrap_bind TopLevel) tops) - (wrap_defns NotTopLevel ceils) - (M.map (M.map (wrap_defns NotTopLevel)) defns) + = FB (mapBag wrap_bind tops) (wrap_defns ceils) + (M.map (M.map wrap_defns) defns) where - wrap_defns toplvl = mapBag (wrap_one toplvl) - - wrap_bind toplvl (NonRec binder rhs) = NonRec binder (maybe_tick toplvl rhs) - wrap_bind toplvl (Rec pairs) = Rec (mapSnd (maybe_tick toplvl) pairs) - - wrap_one toplvl (FloatLet bind) = FloatLet (wrap_bind toplvl bind) - wrap_one toplvl (FloatCase e b c bs) = FloatCase (maybe_tick toplvl e) b c bs - - maybe_tick :: TopLevelFlag -> CoreExpr -> CoreExpr - maybe_tick toplvl e - -- We must take care not to tick top-level literal - -- strings as this violated the Core invariants. See Note [CoreSyn - -- top-level string literals]. - | isTopLevel toplvl && exprIsLiteralString e = e - | exprIsHNF e = tickHNFArgs t e - | otherwise = mkTick t e + wrap_defns = mapBag wrap_one + + wrap_bind (NonRec binder rhs) = NonRec binder (maybe_tick rhs) + wrap_bind (Rec pairs) = Rec (mapSnd maybe_tick pairs) + + wrap_one (FloatLet bind) = FloatLet (wrap_bind bind) + wrap_one (FloatCase e b c bs) = FloatCase (maybe_tick e) b c bs + + maybe_tick e | exprIsHNF e = tickHNFArgs t e + | otherwise = mkTick t e -- we don't need to wrap a tick around an HNF when we float it -- outside a tick: that is an invariant of the tick semantics -- Conversely, inlining of HNFs inside an SCC is allowed, and diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index b17f2af..f2c6e2d 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -437,13 +437,7 @@ prepareRhs mode top_lvl occ _ rhs0 -- we can obtain non-counting ticks. | (not (tickishCounts t) || tickishCanSplit t) = do { (is_exp, floats, rhs') <- go n_val_args rhs - ; let tickIt (id, expr) - -- we have to take care not to tick top-level literal - -- strings. See Note [CoreSyn top-level string literals]. - | isTopLevel top_lvl && exprIsLiteralString expr - = (id, expr) - | otherwise - = (id, mkTick (mkNoCount t) expr) + ; let tickIt (id, expr) = (id, mkTick (mkNoCount t) expr) floats' = mapLetFloats floats tickIt ; return (is_exp, floats', Tick t rhs') } From git at git.haskell.org Wed Sep 13 21:09:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:05 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Hack boot (e56bacf) Message-ID: <20170913210905.29A853A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/e56bacf2d95652d380499c7ce6699af309aff185/ghc >--------------------------------------------------------------- commit e56bacf2d95652d380499c7ce6699af309aff185 Author: Ben Gamari Date: Tue Sep 12 06:32:21 2017 -0400 Hack boot >--------------------------------------------------------------- e56bacf2d95652d380499c7ce6699af309aff185 boot | 8 ++++---- libraries/prettyprinter-core | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/boot b/boot index 45f5bf0..d513695 100755 --- a/boot +++ b/boot @@ -107,10 +107,10 @@ EOF # but in an lndir tree we avoid making .git directories, # so it doesn't exist. We therefore require that every repo # has a LICENSE file instead. - if (! -f "$dir/LICENSE") { - print STDERR "Error: $dir/LICENSE doesn't exist.\n"; - die "Maybe you haven't done 'git submodule update --init'?"; - } + #if ( ! -f "$dir/LICENSE" -a ! -f "$dir/LICENSE.md" ) { + #print STDERR "Error: $dir/LICENSE doesn't exist.\n"; + #die "Maybe you haven't done 'git submodule update --init'?"; + #} } } else { diff --git a/libraries/prettyprinter-core b/libraries/prettyprinter-core deleted file mode 160000 index 8697cc9..0000000 --- a/libraries/prettyprinter-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8697cc9cfe6937d6479396a96c600a4b6d556ab5 From git at git.haskell.org Wed Sep 13 21:09:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:07 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Port to prettyprinter proper (6f2ed20) Message-ID: <20170913210907.E67663A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/6f2ed20463366ff3235691e4a2c0106313e0c39f/ghc >--------------------------------------------------------------- commit 6f2ed20463366ff3235691e4a2c0106313e0c39f Author: Ben Gamari Date: Tue Sep 12 06:32:10 2017 -0400 Port to prettyprinter proper >--------------------------------------------------------------- 6f2ed20463366ff3235691e4a2c0106313e0c39f .gitmodules | 3 +++ ghc.mk | 7 +++++-- libraries/prettyprinter | 1 + packages | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 0ed88ab..9bf1d27 100644 --- a/.gitmodules +++ b/.gitmodules @@ -136,3 +136,6 @@ [submodule "libraries/prettyprinter-core"] path = libraries/prettyprinter-core url = https://github.com/bollu/prettyprinter-core.git +[submodule "libraries/prettyprinter"] + path = libraries/prettyprinter + url = git at github.com:quchen/prettyprinter.git diff --git a/ghc.mk b/ghc.mk index 8d44590..7b7304a 100644 --- a/ghc.mk +++ b/ghc.mk @@ -420,7 +420,10 @@ else # CLEANING # programs such as GHC and ghc-pkg, that we do not assume the stage0 # compiler already has installed (or up-to-date enough). -PACKAGES_STAGE0 = binary text transformers mtl parsec Cabal/Cabal hpc ghc-boot-th ghc-boot template-haskell ghci prettyprinter-core +PACKAGES_STAGE0 = \ + binary text transformers mtl parsec Cabal/Cabal hpc ghc-boot-th ghc-boot template-haskell ghci \ + prettyprinter/prettyprinter + ifeq "$(Windows_Host)" "NO" PACKAGES_STAGE0 += terminfo endif @@ -459,7 +462,7 @@ PACKAGES_STAGE1 += ghc-boot-th PACKAGES_STAGE1 += ghc-boot PACKAGES_STAGE1 += template-haskell PACKAGES_STAGE1 += ghc-compact -PACKAGES_STAGE1 += prettyprinter-core +PACKAGES_STAGE1 += prettyprinter/prettyprinter ifeq "$(HADDOCK_DOCS)" "YES" PACKAGES_STAGE1 += xhtml diff --git a/libraries/prettyprinter b/libraries/prettyprinter new file mode 160000 index 0000000..973be20 --- /dev/null +++ b/libraries/prettyprinter @@ -0,0 +1 @@ +Subproject commit 973be208c28f0ec34c9cf7874bea9718996db776 diff --git a/packages b/packages index 62a3373..b219e7f 100644 --- a/packages +++ b/packages @@ -41,7 +41,7 @@ ghc-tarballs windows ghc-tarballs.git - libffi-tarballs - - - utils/hsc2hs - - - utils/haddock - - ssh://git at github.com/haskell/haddock.git -libraries/prettyprinter-core - - https://github.com/bollu/prettyprinter-core.git +libraries/prettyprinter/prettyprinter - - https://github.com/quchen/prettyprinter.git libraries/array - - - libraries/binary - - https://github.com/kolmodin/binary.git libraries/bytestring - - https://github.com/haskell/bytestring.git From git at git.haskell.org Wed Sep 13 21:09:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:10 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Various cleanups (52c609b) Message-ID: <20170913210910.AEA443A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/52c609bcc80082c397d70d37793ecefa1ee6ba4e/ghc >--------------------------------------------------------------- commit 52c609bcc80082c397d70d37793ecefa1ee6ba4e Author: Ben Gamari Date: Tue Sep 12 06:45:44 2017 -0400 Various cleanups >--------------------------------------------------------------- 52c609bcc80082c397d70d37793ecefa1ee6ba4e .gitmodules | 7 ------- ghc/Main.hs | 2 -- ghc/ghc-bin.cabal.in | 2 -- libraries/xhtml | 2 +- utils/haddock | 2 +- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9bf1d27..70924fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,10 +6,6 @@ path = libraries/bytestring url = ../packages/bytestring.git ignore = untracked -[submodule "libraries/text"] - path = libraries/text - url = https://github.com/bollu/text.git - ignore = untracked [submodule "libraries/Cabal"] path = libraries/Cabal url = ../packages/Cabal.git @@ -133,9 +129,6 @@ [submodule ".arc-linters/arcanist-external-json-linter"] path = .arc-linters/arcanist-external-json-linter url = ../arcanist-external-json-linter.git -[submodule "libraries/prettyprinter-core"] - path = libraries/prettyprinter-core - url = https://github.com/bollu/prettyprinter-core.git [submodule "libraries/prettyprinter"] path = libraries/prettyprinter url = git at github.com:quchen/prettyprinter.git diff --git a/ghc/Main.hs b/ghc/Main.hs index 8919649..a75aba3 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -73,8 +73,6 @@ import Control.Monad import Data.Char import Data.List import Data.Maybe -import qualified Data.Text as DontUseText -import qualified Data.Text.Prettyprint.Doc as DontUsePrettyPrint ----------------------------------------------------------------------------- -- ToDo: diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 385c9f2a..5fe7c9d 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -34,8 +34,6 @@ Executable ghc directory >= 1 && < 1.4, process >= 1 && < 1.7, filepath >= 1 && < 1.5, - text == 1.2.*, - prettyprinter == 1.1.*, ghc-boot == @ProjectVersionMunged@, ghc == @ProjectVersionMunged@ diff --git a/libraries/xhtml b/libraries/xhtml index c5c623e..6358594 160000 --- a/libraries/xhtml +++ b/libraries/xhtml @@ -1 +1 @@ -Subproject commit c5c623e497f13ec187e0d228e0e8a3d9ee39a715 +Subproject commit 6358594eb5139f6760e2ada72718d69fed5a1015 diff --git a/utils/haddock b/utils/haddock index 5fa4ef3..4540679 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 5fa4ef3028dfded480f7d54e4c736862e8892223 +Subproject commit 4540679027e9ca458823fdbdcc7ccdfb92a1f69a From git at git.haskell.org Wed Sep 13 21:09:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:13 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: More warning cleanups (96eece6) Message-ID: <20170913210913.6BFD13A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/96eece620b6475ac68251dacbb651109405922eb/ghc >--------------------------------------------------------------- commit 96eece620b6475ac68251dacbb651109405922eb Author: Ben Gamari Date: Wed Sep 13 08:39:25 2017 -0400 More warning cleanups >--------------------------------------------------------------- 96eece620b6475ac68251dacbb651109405922eb compiler/utils/Outputable.hs | 1 - compiler/utils/Pretty.hs | 6 ------ 2 files changed, 7 deletions(-) diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 772558a..971a548 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -92,7 +92,6 @@ import {-# SOURCE #-} DynFlags( DynFlags, hasPprDebug, hasNoDebugOutput, import {-# SOURCE #-} Module( UnitId, Module, ModuleName, moduleName ) import {-# SOURCE #-} OccName( OccName ) -import BufWrite (BufHandle) import FastString import qualified Pretty import Util diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index a7969e6..583fb21 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -111,16 +111,10 @@ module Pretty ( ) where -import BufWrite import FastString -import Panic import System.IO import Prelude hiding (error) ---for a RULES -import GHC.Base ( unpackCString# ) -import GHC.Ptr ( Ptr(..) ) - import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.IO as TL From git at git.haskell.org Wed Sep 13 21:09:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:16 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Fix hang (ab4481a) Message-ID: <20170913210916.2A4673A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/ab4481a27e109480e764e7c83b9ee85ed2b4d217/ghc >--------------------------------------------------------------- commit ab4481a27e109480e764e7c83b9ee85ed2b4d217 Author: Ben Gamari Date: Wed Sep 13 17:01:48 2017 -0400 Fix hang >--------------------------------------------------------------- ab4481a27e109480e764e7c83b9ee85ed2b4d217 compiler/utils/Outputable.hs | 6 +++--- compiler/utils/Pretty.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 971a548..ae3dfb7 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -701,9 +701,9 @@ fsep ds = SDoc $ \sty -> Pretty.fsep [runSDoc d sty | d <- ds] fcat ds = SDoc $ \sty -> Pretty.fcat [runSDoc d sty | d <- ds] hang :: SDoc -- ^ The header - -> Int -- ^ Amount to indent the hung body - -> SDoc -- ^ The hung body, indented and placed below the header - -> SDoc + -> Int -- ^ Amount to indent the hung body + -> SDoc -- ^ The hung body, indented and placed below the header + -> SDoc hang d1 n d2 = SDoc $ \sty -> Pretty.hang (runSDoc d1 sty) n (runSDoc d2 sty) -- | This behaves like 'hang', but does not indent the second document diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index 583fb21..a38df9d 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -392,7 +392,7 @@ isEmpty _ = False -- | @hang d1 n d2 = sep [d1, nest n d2]@ hang :: Doc a -> Int -> Doc a -> Doc a -hang d1 n d2 = sep [d1, nest n d2] +hang d1 n d2 = nest n (sep [d1, d2]) From git at git.haskell.org Wed Sep 13 21:09:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:18 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: Use hardlineCollapse (2df0b55) Message-ID: <20170913210918.DB0473A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/2df0b55c7bcf29526e4d966c4652ca0074556590/ghc >--------------------------------------------------------------- commit 2df0b55c7bcf29526e4d966c4652ca0074556590 Author: Ben Gamari Date: Wed Sep 13 17:02:27 2017 -0400 Use hardlineCollapse >--------------------------------------------------------------- 2df0b55c7bcf29526e4d966c4652ca0074556590 compiler/utils/Pretty.hs | 2 +- libraries/prettyprinter | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index a38df9d..92acb84 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -214,7 +214,7 @@ infixl 6 <+> infixl 5 $$, $+$ -} ($+$) :: Doc a -> Doc a -> Doc a -($+$) a b = vsep [a, b] +($+$) a b = a <> hardlineCollapse 1 <> b ($$) :: Doc a -> Doc a -> Doc a ($$) = ($+$) diff --git a/libraries/prettyprinter b/libraries/prettyprinter index 973be20..5c92fd0 160000 --- a/libraries/prettyprinter +++ b/libraries/prettyprinter @@ -1 +1 @@ -Subproject commit 973be208c28f0ec34c9cf7874bea9718996db776 +Subproject commit 5c92fd07537bb7070fcb560f671d4c7bb3aa7aad From git at git.haskell.org Wed Sep 13 21:09:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:21 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter: More cleanups (8507886) Message-ID: <20170913210921.94A0E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/prettyprinter Link : http://ghc.haskell.org/trac/ghc/changeset/8507886eeeee403f967981730764368c3fafbd25/ghc >--------------------------------------------------------------- commit 8507886eeeee403f967981730764368c3fafbd25 Author: Ben Gamari Date: Wed Sep 13 17:02:36 2017 -0400 More cleanups >--------------------------------------------------------------- 8507886eeeee403f967981730764368c3fafbd25 compiler/utils/Pretty.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index 92acb84..4a533c7 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -119,10 +119,9 @@ import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.IO as TL -import Data.Text.Prettyprint.Doc --- PI = PrettyprinterInternal -import Data.Text.Prettyprint.Doc.Internal as PI - +import Data.Text.Prettyprint.Doc hiding (vcat) +import qualified Data.Text.Prettyprint.Doc as P +import qualified Data.Text.Prettyprint.Doc.Internal as PI import Data.Text.Prettyprint.Doc.Render.Text import GHC.Float (float2Double) @@ -219,6 +218,8 @@ infixl 5 $$, $+$ ($$) :: Doc a -> Doc a -> Doc a ($$) = ($+$) +vcat :: [Doc a] -> Doc a +vcat = foldr ($$) mempty -- --------------------------------------------------------------------------- -- The Doc data type From git at git.haskell.org Wed Sep 13 21:09:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Sep 2017 21:09:24 +0000 (UTC) Subject: [commit: ghc] wip/prettyprinter's head updated: More cleanups (8507886) Message-ID: <20170913210924.4CE9D3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/prettyprinter' now includes: a8da0de Speed up compilation of profiling stubs b0ed07f Allow TcDerivInfer to compile with GHC 8.0.1 38260a9 Fix #13972 by producing tidier errors 039fa1b Suggest how to fix illegally nested foralls in GADT constructor type signatures c948b78 Fix #11785 by making reifyKind = reifyType af9f3fa Remove extra ` from "kind-indexed GADTs" doc 03327bf Handle ListPat in isStrictPattern 36d1b08 Doctest for Void.absurd 49ddea9 Sections with undefined operators have non-standard behavior 43b0c2c Insert missing blank line to fix Applicative doc 63397cb Add some Monoid doctests f762181 Mention the category laws explicitly a30187d Convert documentation examples to doctests for ReadP module bfa9048 Loads of doc(test)s 2c0ab47 Add missing initial version for extension doc. 0e1b6f8 Fix index entries in "separate compilation" section 3385669 user-guide: fix examples of ghci commands 69a0f01 rts: Enable USDT probes object on Linux 82ee71f user-guide: add `:type +d` and `:type +v` in release highlight dc42c0d Fix #13399 by documenting higher-rank kinds. 0385347 Remove unneeded reqlibs for mtl and parsec in the GHC testsuite c5605ae Make function intToSBigNat# preserve sign (fixes #14085) 0286214 testsuite: Add test for #13916 fee253f CSE.cseOneExpr: Set InScopeSet correctly 6257fb5 Comments about GlobalRdrEnv shadowing 118efb0 Restrict Lint's complaints about recursive INLINEs somewhat 698adb5 Tracing in OccAnal (commented out) 4c6fcd7 Comments only 61c4246 Test Trac #14110 f50e30e Doctests for Data.Tuple 6267d8c Enable -Wcpp-undef for GHC and runtime system cf8ab1c users_guide: Convert mkUserGuidePart generation to a Sphinx extension 8e5b6ec Add strict variant of iterate ee2e9ec Correct incorrect free in PE linker 1cdceb9 Revert "Add strict variant of iterate" 34bd43d Fix loading of dlls on 32bit windows 6982ee9 Fix #14125 by normalizing data family instances more aggressively a89bb80 Fix #14114 by checking for duplicate vars on pattern synonym RHSes 79b259a Fix #13885 by freshening reified GADT constructors' universal tyvars 8476097 Revise function arity mismatch errors involving TypeApplications 8fd9599 Make the Read instance for Proxy (and friends) ignore precedence afc2f79 Move validate cleaning from distclean to clean 4717ce8 Fix incorrect retypecheck loop in -j (#14075) 9afaebe StgLint: Allow join point bindings of unlifted type cd5a970 Make law for Foldable.length explicit 20c7053 Bump haddock submodule 090d896 fix typo (expreesions -> expressions) 028645c Fixed a typo in template-haskell documentation dbaa9a2 DynFlags: Add inverse of -dno-debug-output 3625728 Add support for producing position-independent executables 7463a95 users-guide: Better error messages on incomplete ghc-flag directives 74af2e7 Typo fixed 11657c4 Better pretty-printing for CHoleCan a211dca Fix defer-out-of-scope-variables aeb4bd9 Remove typeKind from Type.hs-boot 5f3d2d3 CNF: Implement compaction for small pointer arrays a0b7b10 Restrict exprOkForSpeculation/case to unlifted types 407c11b Bottoming expressions should not be expandable 33452df Refactor the Mighty Simplifier 8649535 Don't do the RhsCtxt thing for join points dd89a13 Comments, plus adjust debug print of TcTyThing(ATyVar) a67b66e Add strict variant of iterate f135fb2 rts: Fix warnings on aarch64 and clean up style 80ccea8 rts: Fix references to Note [BFD import library] 76e59a2 rts: Fix ASSERTs with space before opening paren 8f19c65 Rip out mkUserGuidePart 83484a6 Fix two typos in the ImpredicativeTypes user guide a055f24 Adjust test suite stats 682e8e6 Actually bump T12150 29da01e Make parsed AST dump output lazily 6e0e0b0 Comments only 8834d48 Better debug-printing for Outputable TyConBinder 547e4c0 A bit more -ddump-tc tracing 6f050d9 Add TcRnMonad.unlessXOptM 0257dac Refactor bindHsQTyVars and friends 86e6a5f Small refactoring of meta-tyvar cloning 4455c86 Use a well-kinded substitution to instantiate 8eead4d Improve kind-application-error message a6c448b Small refactor of getRuntimeRep aed7d43 Add HasDebugStack for typeKind 248ad30 testsuite: Add test for #14128 db3a8e1 desugar: Ensure that a module's dep_orphs doesn't contain itself 5266ab9 Remove dll-split. 895a765 Refactor type family instance abstract syntax declarations 3c6b2fc Fix decomposition error on Windows 5f6a820 Add gen-dll as replacement for dll-split f86de44 ghc-pkg: Try opening lockfiles in read-write mode first a27bb1b base: Add support for file unlocking 779b9e6 PackageDb: Explicitly unlock package database before closing 9d57d8c nativeGen: Don't index into linked lists 651b4dc StgLint: Show type of out-of-scope binders a36b34c StgLint: Enforce MultiValAlt liveness invariant only after unariser f17f106 StgLint: Give up on trying to compare types 1561525 HsExpr: Fix typo 6f1ccaa Add a Note describing #14128 567dca6 Add some traceRn and (Outputable StmtTree) 628b666 Add comments to RnTypes fca1962 Define and use HsArg 805b29b Add debugPprType 3790ea9 Small changes to ddump-tc tracing 2c133b6 Really fix Trac #14158 c0feee9 Add missing Semigroup instances to compiler b2c2e3e Add missing Semigroup instances in utils/{hpc,runghc} dd643bc Improve stm haddocks 1f052c5 Fix order of PrelRule 8a1de42 Add testcase for #14178 f089c32 Remove broken citeseer citation links 590e737 Update transformers submodule 6330b0b Document the intricacies of ForallC variable quantification better 5dd6b13 Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns 8e4229a Fix #14167 by using isGadtSyntaxTyCon in more places 0ec4376 Document the Generic(1) laws cb3363e Move NonEmpty definition into GHC.Base 31281a4 testsuite: Fix validation of ways b996e12 testsuite: Add test for #14129 7e5d4a0 Remember the AvailInfo for each IE b9ac9e0 Fix egregious duplication of vars in RnTypes 1300afa get-win32-tarballs: Use bash, not sh a4c2ac2 get-win32-tarballs: Use correct `find` 542f89f Replace hashing function for string keys implementation with xxhash cd857dd SetLevels: Substitute in ticks in lvlMFE 6458b8d base: Update acosh to handle -1::Complex c2881a2 StgLint: Show constructor arity in mismatch message 822abbb eventlog: Clean up profiling heap breakdown type 24e50f9 rts: Add heap breakdown type for -hT 0829821 Implicitly bind kind variables in type family instance RHSes when it's sensible 0cd467b rts: Fix use of #if 2273353 Clean up opt and llc c6726d6 Cleanups, remove commented-out code a04cfcf Update xhtml submodule fee403f Handle W80 in floatFormat d97a6fe Fix typos in diagnostics, testsuite and comments 055d73c Travis: Boot with ghc-8.2.1, and disable test suite 8ae263c Make Semigroup a superclass of Monoid (re #14191) be514a6 includes/rts: Drop trailing comma cb4878f Drop special handling of iOS and Android 011e15a Deal with unbreakable blocks in Applicative Do 22f11f1 Bump T783 expected allocations cf6b4d1 Remove now redundant CPP 122f183 Remove now redundant cabal conditionals in {ghc,template-haskell}.cabal 400ead8 Remove makefile logic for legacy -this-package-key dab0e51 Canonicalise Monoid instances in GHC 346e562 Canonicalise MonoidFail instances in GHC 838a10f Retire cabal_macros_boot.h hack d93019e Add text dependency 6148f5a Add pretty-printer dependency 8eb56e3 Use prettyprinter 21dc11a Fix errant newlines dae4a38 Try something 29e9df3 Debugging ghc-pkg 134f2c8 llvmGen: Clean up warning b3df320 nativeGen: Clean up warning fea1bdd llvmGen: Fix another ccd2c23 Never tick primitive string literals e53dc5b Hack: Produce latin1 asm output 6f2ed20 Port to prettyprinter proper e56bacf Hack boot 52c609b Various cleanups 96eece6 More warning cleanups ab4481a Fix hang 2df0b55 Use hardlineCollapse 8507886 More cleanups From git at git.haskell.org Thu Sep 14 09:12:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:34 +0000 (UTC) Subject: [commit: ghc] master: More refinements to debugPprType (ab2d3d5) Message-ID: <20170914091234.DB30B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ab2d3d5db6e2a16cccdfdfc89c9b6f30834fa335/ghc >--------------------------------------------------------------- commit ab2d3d5db6e2a16cccdfdfc89c9b6f30834fa335 Author: Simon Peyton Jones Date: Sat Sep 2 18:10:49 2017 +0100 More refinements to debugPprType >--------------------------------------------------------------- ab2d3d5db6e2a16cccdfdfc89c9b6f30834fa335 compiler/types/TyCoRep.hs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 80681e7..d58536b 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2435,7 +2435,11 @@ pprType = pprPrecType TopPrec pprParendType = pprPrecType TyConPrec pprPrecType :: TyPrec -> Type -> SDoc -pprPrecType prec ty = getPprStyle $ \sty -> pprPrecIfaceType prec (tidyToIfaceTypeSty ty sty) +pprPrecType prec ty + = getPprStyle $ \sty -> + if debugStyle sty -- Use pprDebugType when in + then debug_ppr_ty prec ty -- when in debug-style + else pprPrecIfaceType prec (tidyToIfaceTypeSty ty sty) pprTyLit :: TyLit -> SDoc pprTyLit = pprIfaceTyLit . toIfaceTyLit @@ -2561,9 +2565,7 @@ debug_ppr_ty _ (LitTy l) = ppr l debug_ppr_ty _ (TyVarTy tv) - = ifPprDebug (parens (ppr tv <+> dcolon - <+> (debugPprType (tyVarKind tv)))) - (ppr tv) + = ppr tv -- With -dppr-debug we get (tv :: kind) debug_ppr_ty prec (FunTy arg res) = maybeParen prec FunPrec $ @@ -2589,7 +2591,9 @@ debug_ppr_ty _ (CoercionTy co) debug_ppr_ty prec ty@(ForAllTy {}) | (tvs, body) <- split ty = maybeParen prec FunPrec $ - hang (text "forall" <+> fsep (map pp_bndr tvs) <> dot) + hang (text "forall" <+> fsep (map ppr tvs) <> dot) + -- The (map ppr tvs) will print kind-annotated + -- tvs, because we are (usually) in debug-style 2 (ppr body) where split ty | ForAllTy tv ty' <- ty @@ -2598,13 +2602,6 @@ debug_ppr_ty prec ty@(ForAllTy {}) | otherwise = ([], ty) - pp_bndr, pp_with_kind :: TyVarBinder -> SDoc - pp_bndr tv = ifPprDebug (ppr tv) (pp_with_kind tv) - - pp_with_kind tv - = parens (ppr tv <+> dcolon - <+> ppr (tyVarKind (binderVar tv))) - {- Note [When to print foralls] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Thu Sep 14 09:12:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:37 +0000 (UTC) Subject: [commit: ghc] master: No need to check ambiguity for visible type args (959a623) Message-ID: <20170914091237.9D8173A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/959a623e29309fbd4f206432ba534177ec804e18/ghc >--------------------------------------------------------------- commit 959a623e29309fbd4f206432ba534177ec804e18 Author: Simon Peyton Jones Date: Fri Aug 25 18:14:16 2017 +0100 No need to check ambiguity for visible type args Seems unnecesarry to me. >--------------------------------------------------------------- 959a623e29309fbd4f206432ba534177ec804e18 compiler/typecheck/TcValidity.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 65c7afd..fdff7e9 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -225,6 +225,7 @@ wantAmbiguityCheck ctxt = case ctxt of -- See Note [When we don't check for ambiguity] GhciCtxt -> False TySynCtxt {} -> False + TypeAppCtxt -> False _ -> True checkUserTypeError :: Type -> TcM () @@ -269,6 +270,10 @@ In a few places we do not want to check a user-specified type for ambiguity from doing an ambiguity check on a type with TyVars in it. Fixing this would not be hard, but let's wait till there's a reason. +* TypeAppCtxt: visible type application + f @ty + No need to check ty for ambiguity + ************************************************************************ * * From git at git.haskell.org Thu Sep 14 09:12:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:40 +0000 (UTC) Subject: [commit: ghc] master: Fix subtle bug in TcTyClsDecls.mkGADTVars (3a27e34) Message-ID: <20170914091240.EF6F73A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a/ghc >--------------------------------------------------------------- commit 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a Author: Simon Peyton Jones Date: Sat Sep 2 18:13:32 2017 +0100 Fix subtle bug in TcTyClsDecls.mkGADTVars This bug was revealed by Trac #14162. In a GADT-style data-family instance we ended up a data constructor whose type mentioned an out-of-scope variable. (This variable was in the kind of a variable in the kind of a variable.) Only Lint complained about this (actually only when the data constructor was injected into the bindings by CorePrep). So it doesn't matter much -- but it's a solid bug and might bite us some day. It took me quite a while to unravel because the test case was itself quite tricky. But the fix is easy; just add a missing binding to the substitution we are building up. It's in the regrettably-subtle mkGADTVars function. >--------------------------------------------------------------- 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a compiler/typecheck/TcTyClsDecls.hs | 82 ++++++++++++++-------- .../tests/indexed-types/should_compile/T14162.hs | 41 +++++++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 3 files changed, 94 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a From git at git.haskell.org Thu Sep 14 09:12:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:44 +0000 (UTC) Subject: [commit: ghc] master: Tidying could cause ill-kinded types (8bf865d) Message-ID: <20170914091244.CBB923A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0/ghc >--------------------------------------------------------------- commit 8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0 Author: Simon Peyton Jones Date: Sat Sep 2 18:29:11 2017 +0100 Tidying could cause ill-kinded types I found (Trac #14175) that the tidying we do when reporting type error messages could cause a well-kinded type to become ill-kinded. Reason: we initialised the tidy-env with a completely un-zonked TidyEnv accumulated in the TcLclEnv as we come across lexical type-varialbe bindings. Solution: zonk them. But I ended up refactoring a bit: * Get rid of tcl_tidy :: TidyEnv altogether * Instead use tcl_bndrs :: TcBinderStack This used to contain only Ids, but now I've added those lexically scoped TyVars too. * Change names: TcIdBinderStack -> TcBinderStack TcIdBinder -> TcBinder extendTcIdBndrs -> extendTcBinderStack * Now tcInitTidyEnv can grab those TyVars from the tcl_bndrs, zonk, and tidy them. The only annoyance is that I had to add TcEnv.hs-boot, to break the recursion between the zonking code and the TrRnMonad functions like addErrTc that call tcInitTidyEnv. Tiresome, but in fact that file existed already. >--------------------------------------------------------------- 8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0 compiler/typecheck/TcBinds.hs | 16 ++-- compiler/typecheck/TcEnv.hs | 86 ++++++++++++++-------- compiler/typecheck/TcEnv.hs-boot | 17 +++-- compiler/typecheck/TcErrors.hs | 18 +++-- compiler/typecheck/TcRnMonad.hs | 18 +---- compiler/typecheck/TcRnTypes.hs | 38 ++++++---- compiler/typecheck/TcValidity.hs | 2 +- .../tests/indexed-types/should_fail/T14175.hs | 7 ++ .../tests/indexed-types/should_fail/T14175.stderr | 5 ++ testsuite/tests/indexed-types/should_fail/all.T | 1 + 10 files changed, 127 insertions(+), 81 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0 From git at git.haskell.org Thu Sep 14 09:12:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:47 +0000 (UTC) Subject: [commit: ghc] master: Refactor to eliminate FamTyConShape (0390e4a) Message-ID: <20170914091247.94E603A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0390e4a0f61e37bd1dcc24a36d499e92f2561b67/ghc >--------------------------------------------------------------- commit 0390e4a0f61e37bd1dcc24a36d499e92f2561b67 Author: Simon Peyton Jones Date: Sun Sep 3 12:18:10 2017 +0100 Refactor to eliminate FamTyConShape Consider this note (TcTyClsDecls) Note [Type-checking type patterns] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When typechecking the patterns of a family instance declaration, we can't rely on using the family TyCon itself, because this is sometimes called from within a type-checking knot. (Specifically for closed type families.) The FamTyConShape gives just enough information to do the job. I realised that this exact purpose can be served by TcTyCons, and in fact rather better. So this patch * Refactors FamTyConShape out of existence, replacing it with TcTyCOn * I also got rid Type.filterOutInvisibleTyVars, which was a very complex way to do something quite simple. I replaced the calls with TyCon.tyConVisibleTyVars. No change in behaviour. >--------------------------------------------------------------- 0390e4a0f61e37bd1dcc24a36d499e92f2561b67 compiler/typecheck/TcInstDcls.hs | 4 +- compiler/typecheck/TcSplice.hs | 40 +++++-------- compiler/typecheck/TcTyClsDecls.hs | 117 +++++++++++++++---------------------- compiler/types/TyCon.hs | 14 ++++- compiler/types/Type.hs | 6 +- compiler/types/Type.hs-boot | 2 - 6 files changed, 78 insertions(+), 105 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 0390e4a0f61e37bd1dcc24a36d499e92f2561b67 From git at git.haskell.org Thu Sep 14 09:12:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:53 +0000 (UTC) Subject: [commit: ghc] master: Interim fix for a nasty type-matching bug (9218ea6) Message-ID: <20170914091253.4A2A03A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9218ea60faa744803fb41066aedd1da8f1bd9185/ghc >--------------------------------------------------------------- commit 9218ea60faa744803fb41066aedd1da8f1bd9185 Author: Simon Peyton Jones Date: Wed Sep 13 09:26:26 2017 +0100 Interim fix for a nasty type-matching bug The type matcher in types/Unify.hs was producing a substitution that had variables from the template in its range. Yikes! This patch, documented in Note [Matching in the presence of casts], is an interm fix. Richard and I don't like it much, and are pondering a better solution (Trac #14119). All this came up in investigating Trac #13910. Alas this patch doesn't fix #13910, which still has ASSERT failures, so I have not yet added a test. But the patch does fix a definite bug. >--------------------------------------------------------------- 9218ea60faa744803fb41066aedd1da8f1bd9185 compiler/types/Unify.hs | 68 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index c5b7e66..cb21899 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -769,6 +769,41 @@ dependent/should_compile/KindEqualities2, we see, for example the constraint Num (Int |> (blah ; sym blah)). We naturally want to find a dictionary for that constraint, which requires dealing with coercions in this manner. + +Note [Matching in the presence of casts] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When matching, it is crucial that no variables from the template +end up in the range of the matching substitution (obviously!). +When unifying, that's not a constraint; instead we take the fixpoint +of the substitution at the end. + +So what should we do with this, when matching? + unify_ty (tmpl |> co) tgt kco + +Previously, wrongly, we pushed 'co' in the (horrid) accumulating +'kco' argument like this: + unify_ty (tmpl |> co) tgt kco + = unify_ty tmpl tgt (kco ; co) + +But that is obviously wrong because 'co' (from the template) ends +up in 'kco', which in turn ends up in the range of the substitution. + +This all came up in Trac #13910. Because we match tycon arguments +left-to-right, the ambient substitution will already have a matching +substitution for any kinds; so there is an easy fix: just apply +the substitution-so-far to the coercion from the LHS. + +Note that + +* When matching, the first arg of unify_ty is always the template; + we never swap round. + +* The above argument is distressingly indirect. We seek a + better way. + +* One better way is to ensure that type patterns (the template + in the matchingn process) have no casts. See Trac #14119. + -} -------------- unify_ty: the main workhorse ----------- @@ -788,7 +823,12 @@ unify_ty env ty1 ty2 kco -- TODO: More commentary needed here | Just ty1' <- tcView ty1 = unify_ty env ty1' ty2 kco | Just ty2' <- tcView ty2 = unify_ty env ty1 ty2' kco - | CastTy ty1' co <- ty1 = unify_ty env ty1' ty2 (co `mkTransCo` kco) + | CastTy ty1' co <- ty1 = if um_unif env + then unify_ty env ty1' ty2 (co `mkTransCo` kco) + else -- See Note [Matching in the presence of casts] + do { subst <- getSubst env + ; let co' = substCo subst co + ; unify_ty env ty1' ty2 (co' `mkTransCo` kco) } | CastTy ty2' co <- ty2 = unify_ty env ty1 ty2' (kco `mkTransCo` mkSymCo co) unify_ty env (TyVarTy tv1) ty2 kco @@ -913,8 +953,8 @@ uVar env tv1 ty kco = do { -- Check to see whether tv1 is refined by the substitution subst <- getTvSubstEnv ; case (lookupVarEnv subst tv1) of - Just ty' | um_unif env -- Unifying, so - -> unify_ty env ty' ty kco -- call back into unify + Just ty' | um_unif env -- Unifying, so call + -> unify_ty env ty' ty kco -- back into unify | otherwise -> -- Matching, we don't want to just recur here. -- this is because the range of the subst is the target @@ -942,17 +982,19 @@ uUnrefined env tv1 ty2 ty2' kco | TyVarTy tv2 <- ty2' = do { let tv1' = umRnOccL env tv1 tv2' = umRnOccR env tv2 + ; unless (tv1' == tv2' && um_unif env) $ do + -- If we are unifying a ~ a, just return immediately + -- Do not extend the substitution -- See Note [Self-substitution when matching] - ; when (tv1' /= tv2' || not (um_unif env)) $ do - { subst <- getTvSubstEnv + -- Check to see whether tv2 is refined + { subst <- getTvSubstEnv ; case lookupVarEnv subst tv2 of { Just ty' | um_unif env -> uUnrefined env tv1 ty' ty' kco - ; _ -> do - { -- So both are unrefined + ; _ -> - -- And then bind one or the other, - -- depending on which is bindable + do { -- So both are unrefined + -- Bind one or the other, depending on which is bindable ; let b1 = tvBindFlagL env tv1 b2 = tvBindFlagR env tv2 ty1 = mkTyVarTy tv1 @@ -974,7 +1016,7 @@ uUnrefined env tv1 ty2 ty2' kco -- ty2 is not a type variable = do { occurs <- elemNiSubstSet tv1 (tyCoVarsOfType ty2') ; if um_unif env && occurs -- See Note [Self-substitution when matching] then maybeApart -- Occurs check, see Note [Fine-grained unification] - else do bindTv env tv1 (ty2 `mkCastTy` mkSymCo kco) } + else bindTv env tv1 (ty2 `mkCastTy` mkSymCo kco) } -- Bind tyvar to the synonym if poss elemNiSubstSet :: TyVar -> TyCoVarSet -> UM Bool @@ -1079,6 +1121,12 @@ getTvSubstEnv = UM $ \state -> Unifiable (state, um_tv_env state) getCvSubstEnv :: UM CvSubstEnv getCvSubstEnv = UM $ \state -> Unifiable (state, um_cv_env state) +getSubst :: UMEnv -> UM TCvSubst +getSubst env = do { tv_env <- getTvSubstEnv + ; cv_env <- getCvSubstEnv + ; let in_scope = rnInScopeSet (um_rn_env env) + ; return (mkTCvSubst in_scope (tv_env, cv_env)) } + extendTvEnv :: TyVar -> Type -> UM () extendTvEnv tv ty = UM $ \state -> Unifiable (state { um_tv_env = extendVarEnv (um_tv_env state) tv ty }, ()) From git at git.haskell.org Thu Sep 14 09:12:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 09:12:50 +0000 (UTC) Subject: [commit: ghc] master: Refactor tcInferApps (a38acda) Message-ID: <20170914091250.7316E3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a38acda69fa9c7a7f7f9f5adeaf769488a21fa48/ghc >--------------------------------------------------------------- commit a38acda69fa9c7a7f7f9f5adeaf769488a21fa48 Author: Simon Peyton Jones Date: Sun Sep 3 12:30:59 2017 +0100 Refactor tcInferApps This is a simple refactor * Remove an unnecessary accumulating argument (acc_hs_apps) from the 'go' function * And put 'n' first in the same function >--------------------------------------------------------------- a38acda69fa9c7a7f7f9f5adeaf769488a21fa48 compiler/typecheck/TcHsType.hs | 59 ++++++++++++---------- .../tests/indexed-types/should_fail/T13877.stderr | 2 +- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index bd73bf3..fdde6f1 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -31,7 +31,7 @@ module TcHsType ( tcHsLiftedType, tcHsOpenType, tcHsLiftedTypeNC, tcHsOpenTypeNC, tcLHsType, tcCheckLHsType, - tcHsContext, tcLHsPredType, tcInferApps, tcTyApps, + tcHsContext, tcLHsPredType, tcInferApps, solveEqualities, -- useful re-export typeLevelMode, kindLevelMode, @@ -727,9 +727,9 @@ tcWildCardOcc wc_info exp_kind --------------------------- -- | Call 'tc_infer_hs_type' and check its result against an expected kind. tc_infer_hs_type_ek :: TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -tc_infer_hs_type_ek mode ty ek - = do { (ty', k) <- tc_infer_hs_type mode ty - ; checkExpectedKind ty ty' k ek } +tc_infer_hs_type_ek mode hs_ty ek + = do { (ty, k) <- tc_infer_hs_type mode hs_ty + ; checkExpectedKind hs_ty ty k ek } --------------------------- tupKindSort_maybe :: TcKind -> Maybe TupleSort @@ -802,61 +802,63 @@ tcInferApps :: TcTyMode -> TcKind -- ^ Function kind (zonked) -> [LHsType GhcRn] -- ^ Args -> TcM (TcType, [TcType], TcKind) -- ^ (f args, args, result kind) -tcInferApps mode mb_kind_info orig_ty ty ki args - = do { traceTc "tcInferApps" (ppr orig_ty $$ ppr args $$ ppr ki) - ; go [] [] orig_subst ty orig_ki_binders orig_inner_ki args 1 } +tcInferApps mode mb_kind_info orig_hs_ty fun_ty fun_ki orig_hs_args + = do { traceTc "tcInferApps" (ppr orig_hs_ty $$ ppr orig_hs_args $$ ppr fun_ki) + ; go 1 [] empty_subst fun_ty orig_ki_binders orig_inner_ki orig_hs_args } where - orig_subst = mkEmptyTCvSubst $ mkInScopeSet $ tyCoVarsOfType ki - (orig_ki_binders, orig_inner_ki) = tcSplitPiTys ki + empty_subst = mkEmptyTCvSubst $ mkInScopeSet $ + tyCoVarsOfType fun_ki + (orig_ki_binders, orig_inner_ki) = tcSplitPiTys fun_ki - go :: [LHsType GhcRn] -- already type-checked args, in reverse order, for errors + go :: Int -- the # of the next argument -> [TcType] -- already type-checked args, in reverse order -> TCvSubst -- instantiating substitution -> TcType -- function applied to some args, could be knot-tied -> [TyBinder] -- binders in function kind (both vis. and invis.) -> TcKind -- function kind body (not a Pi-type) -> [LHsType GhcRn] -- un-type-checked args - -> Int -- the # of the next argument -> TcM (TcType, [TcType], TcKind) -- same as overall return type -- no user-written args left. We're done! - go _acc_hs_args acc_args subst fun ki_binders inner_ki [] _ + go _ acc_args subst fun ki_binders inner_ki [] = return (fun, reverse acc_args, substTy subst $ mkPiTys ki_binders inner_ki) -- The function's kind has a binder. Is it visible or invisible? - go acc_hs_args acc_args subst fun (ki_binder:ki_binders) inner_ki - all_args@(arg:args) n + go n acc_args subst fun (ki_binder:ki_binders) inner_ki + all_args@(arg:args) | isInvisibleBinder ki_binder -- It's invisible. Instantiate. = do { traceTc "tcInferApps (invis)" (ppr ki_binder $$ ppr subst) ; (subst', arg') <- tcInstBinder mb_kind_info subst ki_binder - ; go acc_hs_args (arg' : acc_args) subst' (mkNakedAppTy fun arg') - ki_binders inner_ki all_args n } + ; go n (arg' : acc_args) subst' (mkNakedAppTy fun arg') + ki_binders inner_ki all_args } | otherwise -- It's visible. Check the next user-written argument - = do { traceTc "tcInferApps (vis)" (ppr ki_binder $$ ppr arg $$ ppr subst) - ; arg' <- addErrCtxt (funAppCtxt orig_ty arg n) $ + = do { traceTc "tcInferApps (vis)" (vcat [ ppr ki_binder, ppr arg + , ppr (tyBinderType ki_binder) + , ppr subst ]) + ; arg' <- addErrCtxt (funAppCtxt orig_hs_ty arg n) $ tc_lhs_type mode arg (substTy subst $ tyBinderType ki_binder) ; let subst' = extendTvSubstBinderAndInScope subst ki_binder arg' - ; go (arg : acc_hs_args) (arg' : acc_args) subst' (mkNakedAppTy fun arg') - ki_binders inner_ki args (n+1) } + ; go (n+1) (arg' : acc_args) subst' (mkNakedAppTy fun arg') + ki_binders inner_ki args } -- We've run out of known binders in the functions's kind. - go acc_hs_args acc_args subst fun [] inner_ki all_args n + go n acc_args subst fun [] inner_ki all_args | not (null new_ki_binders) -- But, after substituting, we have more binders. - = go acc_hs_args acc_args zapped_subst fun new_ki_binders new_inner_ki all_args n + = go n acc_args zapped_subst fun new_ki_binders new_inner_ki all_args | otherwise -- Even after substituting, still no binders. Use matchExpectedFunKind = do { traceTc "tcInferApps (no binder)" (ppr new_inner_ki $$ ppr zapped_subst) ; (co, arg_k, res_k) - <- matchExpectedFunKind (mkHsAppTys orig_ty (reverse acc_hs_args)) + <- matchExpectedFunKind (mkHsAppTys orig_hs_ty (take (n-1) orig_hs_args)) substed_inner_ki ; let subst' = zapped_subst `extendTCvInScopeSet` tyCoVarsOfTypes [arg_k, res_k] - ; go acc_hs_args acc_args subst' (fun `mkNakedCastTy` co) - [mkAnonBinder arg_k] res_k all_args n } + ; go n acc_args subst' (fun `mkNakedCastTy` co) + [mkAnonBinder arg_k] res_k all_args } where substed_inner_ki = substTy subst inner_ki (new_ki_binders, new_inner_ki) = tcSplitPiTys substed_inner_ki @@ -873,8 +875,8 @@ tcTyApps :: TcTyMode -> TcKind -- ^ Function kind (zonked) -> [LHsType GhcRn] -- ^ Args -> TcM (TcType, TcKind) -- ^ (f args, result kind) -tcTyApps mode orig_ty ty ki args - = do { (ty', _args, ki') <- tcInferApps mode Nothing orig_ty ty ki args +tcTyApps mode orig_hs_ty ty ki args + = do { (ty', _args, ki') <- tcInferApps mode Nothing orig_hs_ty ty ki args ; return (ty', ki') } -------------------------- @@ -884,7 +886,8 @@ checkExpectedKind :: HsType GhcRn -> TcKind -> TcKind -> TcM TcType -checkExpectedKind hs_ty ty act exp = fstOf3 <$> checkExpectedKindX Nothing (ppr hs_ty) ty act exp +checkExpectedKind hs_ty ty act exp + = fstOf3 <$> checkExpectedKindX Nothing (ppr hs_ty) ty act exp checkExpectedKindX :: Maybe (VarEnv Kind) -- Possibly, instantiations for kind vars -> SDoc -- HsType whose kind we're checking diff --git a/testsuite/tests/indexed-types/should_fail/T13877.stderr b/testsuite/tests/indexed-types/should_fail/T13877.stderr index 4498d97..a90a4dd 100644 --- a/testsuite/tests/indexed-types/should_fail/T13877.stderr +++ b/testsuite/tests/indexed-types/should_fail/T13877.stderr @@ -1,6 +1,6 @@ T13877.hs:65:17: error: - • Couldn't match type ‘p xs’ with ‘Apply p xs’ + • Couldn't match type ‘Apply p (x : xs)’ with ‘p (x : xs)’ Expected type: Sing x -> Sing xs -> App [a] (':->) * p xs -> App [a] (':->) * p (x : xs) Actual type: Sing x -> Sing xs -> (p @@ xs) -> p @@ (x : xs) From git at git.haskell.org Thu Sep 14 10:42:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 10:42:20 +0000 (UTC) Subject: [commit: ghc] master: Remove unused variable binding (9e46167) Message-ID: <20170914104220.BDF083A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9e46167fc54b09bd59bc1e5f82dea19c3f4c3121/ghc >--------------------------------------------------------------- commit 9e46167fc54b09bd59bc1e5f82dea19c3f4c3121 Author: Simon Peyton Jones Date: Thu Sep 14 11:40:09 2017 +0100 Remove unused variable binding >--------------------------------------------------------------- 9e46167fc54b09bd59bc1e5f82dea19c3f4c3121 compiler/typecheck/TcSplice.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index 683b186..f31c281 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1538,7 +1538,7 @@ reifyClass cls ; let dec = TH.ClassD cxt (reifyName cls) tvs' fds' (assocTys ++ ops) ; return (TH.ClassI dec insts) } where - (tvs, fds, theta, _, ats, op_stuff) = classExtraBigSig cls + (_, fds, theta, _, ats, op_stuff) = classExtraBigSig cls fds' = map reifyFunDep fds reify_op (op, def_meth) = do { ty <- reifyType (idType op) From git at git.haskell.org Thu Sep 14 13:08:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 13:08:08 +0000 (UTC) Subject: [commit: ghc] master: [RTS] Make -po work (b6b56dd) Message-ID: <20170914130808.4888A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b6b56dd1b6adc9051593955eecaef85c9d6e96b8/ghc >--------------------------------------------------------------- commit b6b56dd1b6adc9051593955eecaef85c9d6e96b8 Author: Bartosz Nitka Date: Thu Sep 14 02:50:05 2017 -0700 [RTS] Make -po work db2a667655506c43dd3c8260d29031bde55f1bee added `-po` option, but the part that parses it was missing. Test Plan: On a simple file: ``` ./inplace/bin/ghc-stage2 A.hs -prof -main-is A; ./A +RTS -P -potest ``` produced test.prof file and didn't produce A.prof file. ``` ./A +RTS -P ``` produced A.prof file Reviewers: simonmar, bgamari, austin, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3946 >--------------------------------------------------------------- b6b56dd1b6adc9051593955eecaef85c9d6e96b8 rts/RtsFlags.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index ec21ef1..4194aa0 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -185,11 +185,12 @@ void initRtsFlagsDefaults(void) RtsFlags.DebugFlags.compact = false; #if defined(PROFILING) - RtsFlags.CcFlags.doCostCentres = 0; + RtsFlags.CcFlags.doCostCentres = COST_CENTRES_NONE; + RtsFlags.CcFlags.outputFileNameStem = NULL; #endif /* PROFILING */ RtsFlags.ProfFlags.doHeapProfile = false; - RtsFlags.ProfFlags. heapProfileInterval = USToTime(100000); // 100ms + RtsFlags.ProfFlags.heapProfileInterval = USToTime(100000); // 100ms #if defined(PROFILING) RtsFlags.ProfFlags.includeTSOs = false; @@ -1143,6 +1144,14 @@ error = true; case 'j': RtsFlags.CcFlags.doCostCentres = COST_CENTRES_JSON; break; + case 'o': + if (rts_argv[arg][3] == '\0') { + errorBelch("flag -po expects an argument"); + error = true; + break; + } + RtsFlags.CcFlags.outputFileNameStem = rts_argv[arg]+3; + break; case '\0': if (rts_argv[arg][1] == 'P') { RtsFlags.CcFlags.doCostCentres = COST_CENTRES_VERBOSE; From git at git.haskell.org Thu Sep 14 15:12:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 15:12:15 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13644' created Message-ID: <20170914151215.8D6393A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13644 Referencing: 52110a7966848538583acb65f6e064aadc751260 From git at git.haskell.org Thu Sep 14 15:12:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 15:12:18 +0000 (UTC) Subject: [commit: ghc] wip/T13644: Identify fields by selector when type-checking patterns (fixes #13644) (52110a7) Message-ID: <20170914151218.4A4DC3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13644 Link : http://ghc.haskell.org/trac/ghc/changeset/52110a7966848538583acb65f6e064aadc751260/ghc >--------------------------------------------------------------- commit 52110a7966848538583acb65f6e064aadc751260 Author: Adam Gundry Date: Thu Sep 14 15:39:23 2017 +0100 Identify fields by selector when type-checking patterns (fixes #13644) >--------------------------------------------------------------- 52110a7966848538583acb65f6e064aadc751260 compiler/typecheck/TcPat.hs | 9 +++++---- testsuite/tests/rename/should_fail/all.T | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs index 6be2a4e..8dbec2d 100644 --- a/compiler/typecheck/TcPat.hs +++ b/compiler/typecheck/TcPat.hs @@ -983,14 +983,15 @@ tcConArgs con_like arg_tys (RecCon (HsRecFields rpats dd)) penv thing_inside tc_field (L l (HsRecField (L loc (FieldOcc (L lr rdr) sel)) pat pun)) penv thing_inside = do { sel' <- tcLookupId sel - ; pat_ty <- setSrcSpan loc $ find_field_ty (occNameFS $ rdrNameOcc rdr) + ; pat_ty <- setSrcSpan loc $ find_field_ty sel + (occNameFS $ rdrNameOcc rdr) ; (pat', res) <- tcConArg (pat, pat_ty) penv thing_inside ; return (L l (HsRecField (L loc (FieldOcc (L lr rdr) sel')) pat' pun), res) } - find_field_ty :: FieldLabelString -> TcM TcType - find_field_ty lbl - = case [ty | (fl, ty) <- field_tys, flLabel fl == lbl] of + find_field_ty :: Name -> FieldLabelString -> TcM TcType + find_field_ty sel lbl + = case [ty | (fl, ty) <- field_tys, flSelector fl == sel] of -- No matching field; chances are this field label comes from some -- other record type (or maybe none). If this happens, just fail, diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index f7f7719..a98d127 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -125,6 +125,6 @@ test('T12681', normal, multimod_compile_fail, ['T12681','-v0']) test('T12686', normal, compile_fail, ['']) test('T11592', normal, compile_fail, ['']) test('T12879', normal, compile_fail, ['']) -test('T13644', expect_broken(13644), multimod_compile_fail, ['T13644','-v0']) +test('T13644', normal, multimod_compile_fail, ['T13644','-v0']) test('T13568', normal, multimod_compile_fail, ['T13568','-v0']) test('T13947', normal, compile_fail, ['']) From git at git.haskell.org Thu Sep 14 16:20:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 16:20:39 +0000 (UTC) Subject: [commit: ghc] master: Add test for Trac #14232 (93da9f9) Message-ID: <20170914162039.C09EA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/93da9f95b0c921f0d50a34bd1202c6428ff7ba5b/ghc >--------------------------------------------------------------- commit 93da9f95b0c921f0d50a34bd1202c6428ff7ba5b Author: Simon Peyton Jones Date: Thu Sep 14 17:20:14 2017 +0100 Add test for Trac #14232 >--------------------------------------------------------------- 93da9f95b0c921f0d50a34bd1202c6428ff7ba5b testsuite/tests/typecheck/should_fail/T14232.hs | 4 ++++ testsuite/tests/typecheck/should_fail/T14232.stderr | 4 ++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 9 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T14232.hs b/testsuite/tests/typecheck/should_fail/T14232.hs new file mode 100644 index 0000000..79da2cc --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14232.hs @@ -0,0 +1,4 @@ +module T14232 where + +f :: (String -> a) String -> a +f g s = g s diff --git a/testsuite/tests/typecheck/should_fail/T14232.stderr b/testsuite/tests/typecheck/should_fail/T14232.stderr new file mode 100644 index 0000000..a497be7 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14232.stderr @@ -0,0 +1,4 @@ + +T14232.hs:3:6: error: + • Expected kind ‘* -> *’, but ‘String -> a’ has kind ‘*’ + • In the type signature: f :: (String -> a) String -> a diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 5fbbee0..07a893b 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -455,3 +455,4 @@ test('T13902', normal, compile_fail, ['']) test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T14055', normal, compile_fail, ['']) +test('T14232', normal, compile_fail, ['']) From git at git.haskell.org Thu Sep 14 17:09:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:10 +0000 (UTC) Subject: [commit: ghc] master: Test #14038 in dependent/should_compile/T14038 (3b68687) Message-ID: <20170914170910.684E93A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3b686879dd60250e084852c620864d7651f1a771/ghc >--------------------------------------------------------------- commit 3b686879dd60250e084852c620864d7651f1a771 Author: Richard Eisenberg Date: Tue Aug 8 18:20:42 2017 -0400 Test #14038 in dependent/should_compile/T14038 >--------------------------------------------------------------- 3b686879dd60250e084852c620864d7651f1a771 .../should_compile/T14038.hs} | 27 +++++++++++----------- testsuite/tests/dependent/should_compile/all.T | 1 + 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/testsuite/tests/indexed-types/should_fail/T13877.hs b/testsuite/tests/dependent/should_compile/T14038.hs similarity index 72% copy from testsuite/tests/indexed-types/should_fail/T13877.hs copy to testsuite/tests/dependent/should_compile/T14038.hs index ee5f16b..839220a 100644 --- a/testsuite/tests/indexed-types/should_fail/T13877.hs +++ b/testsuite/tests/dependent/should_compile/T14038.hs @@ -1,31 +1,32 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} -module T13877 where +module T14038 where -import Data.Kind +import Data.Kind (Type) data family Sing (a :: k) data instance Sing (z :: [a]) where SNil :: Sing '[] SCons :: Sing x -> Sing xs -> Sing (x:xs) -data TyFun :: * -> * -> * -type a ~> b = TyFun a b -> * +data TyFun :: Type -> Type -> Type +type a ~> b = TyFun a b -> Type infixr 0 ~> type family Apply (f :: k1 ~> k2) (x :: k1) :: k2 type a @@ b = Apply a b infixl 9 @@ -data FunArrow = (:->) | (:~>) +data FunArrow = (:->) -- ^ '(->)' + | (:~>) -- ^ '(~>)' class FunType (arr :: FunArrow) where type Fun (k1 :: Type) arr (k2 :: Type) :: Type @@ -50,25 +51,25 @@ instance AppType (:~>) where infixr 0 -?> type (-?>) (k1 :: Type) (k2 :: Type) (arr :: FunArrow) = Fun k1 arr k2 -listElim :: forall (a :: Type) (p :: [a] -> Type) (l :: [a]). +elimList :: forall (a :: Type) (p :: [a] -> Type) (l :: [a]). Sing l -> p '[] -> (forall (x :: a) (xs :: [a]). Sing x -> Sing xs -> p xs -> p (x:xs)) -> p l -listElim = listElimPoly @(:->) @a @p @l +elimList = elimListPoly @(:->) -listElimTyFun :: forall (a :: Type) (p :: [a] ~> Type) (l :: [a]). +elimListTyFun :: forall (a :: Type) (p :: [a] ~> Type) (l :: [a]). Sing l -> p @@ '[] -> (forall (x :: a) (xs :: [a]). Sing x -> Sing xs -> p @@ xs -> p @@ (x:xs)) -> p @@ l -listElimTyFun = listElimPoly @(:->) @a @p @l +elimListTyFun = elimListPoly @(:~>) @_ @p -listElimPoly :: forall (arr :: FunArrow) (a :: Type) (p :: ([a] -?> Type) arr) (l :: [a]). +elimListPoly :: forall (arr :: FunArrow) (a :: Type) (p :: ([a] -?> Type) arr) (l :: [a]). FunApp arr => Sing l -> App [a] arr Type p '[] -> (forall (x :: a) (xs :: [a]). Sing x -> Sing xs -> App [a] arr Type p xs -> App [a] arr Type p (x:xs)) -> App [a] arr Type p l -listElimPoly SNil pNil _ = pNil -listElimPoly (SCons x (xs :: Sing xs)) pNil pCons = pCons x xs (listElimPoly @arr @a @p @xs xs pNil pCons) +elimListPoly SNil pNil _ = pNil +elimListPoly (SCons x (xs :: Sing xs)) pNil pCons = pCons x xs (elimListPoly @arr @a @p @xs xs pNil pCons) diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index b854f1d..a135892 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -25,3 +25,4 @@ test('T11966', normal, compile, ['']) test('T12442', normal, compile, ['']) test('T13538', normal, compile, ['']) test('T12176', normal, compile, ['']) +test('T14038', expect_broken(14038), compile, ['']) From git at git.haskell.org Thu Sep 14 17:09:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:13 +0000 (UTC) Subject: [commit: ghc] master: nativeGen: A few strictness fixes (ecb316c) Message-ID: <20170914170913.2DB323A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ecb316c44e56d62017c7fe1bea0dddfc6bf405a9/ghc >--------------------------------------------------------------- commit ecb316c44e56d62017c7fe1bea0dddfc6bf405a9 Author: Ben Gamari Date: Wed Sep 13 19:26:56 2017 -0400 nativeGen: A few strictness fixes Test Plan: Validate Reviewers: austin, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3948 >--------------------------------------------------------------- ecb316c44e56d62017c7fe1bea0dddfc6bf405a9 compiler/cmm/CmmContFlowOpt.hs | 5 +++-- compiler/cmm/CmmProcPoint.hs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/cmm/CmmContFlowOpt.hs b/compiler/cmm/CmmContFlowOpt.hs index 219b68e..7981671 100644 --- a/compiler/cmm/CmmContFlowOpt.hs +++ b/compiler/cmm/CmmContFlowOpt.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GADTs #-} +{-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} module CmmContFlowOpt ( cmmCfgOpts @@ -194,7 +195,7 @@ blockConcat splitting_procs g at CmmGraph { g_entry = entry_id } maybe_concat :: CmmBlock -> (LabelMap CmmBlock, LabelMap BlockId, LabelMap Int) -> (LabelMap CmmBlock, LabelMap BlockId, LabelMap Int) - maybe_concat block (blocks, shortcut_map, backEdges) + maybe_concat block (!blocks, !shortcut_map, !backEdges) -- If: -- (1) current block ends with unconditional branch to b' and -- (2) it has exactly one predecessor (namely, current block) @@ -416,4 +417,4 @@ removeUnreachableBlocksProc proc@(CmmProc info lbl live g) used_blocks = postorderDfs g used_lbls :: LabelSet - used_lbls = foldr (setInsert . entryLabel) setEmpty used_blocks + used_lbls = setFromList $ map entryLabel used_blocks diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs index 2e2c22c..5d611d1 100644 --- a/compiler/cmm/CmmProcPoint.hs +++ b/compiler/cmm/CmmProcPoint.hs @@ -19,7 +19,7 @@ import CmmUtils import CmmInfo import CmmLive import CmmSwitch -import Data.List (sortBy) +import Data.List (sortBy, foldl') import Maybes import Control.Monad import Outputable @@ -279,8 +279,8 @@ splitAtProcPoints dflags entry_label callPPs procPoints procMap where block_lbl = blockLbl pp procLabels :: LabelMap (CLabel, Maybe CLabel) - procLabels = foldl add_label mapEmpty - (filter (flip mapMember (toBlockMap g)) (setElems procPoints)) + procLabels = foldl' add_label mapEmpty + (filter (flip mapMember (toBlockMap g)) (setElems procPoints)) -- In each new graph, add blocks jumping off to the new procedures, -- and replace branches to procpoints with branches to the jump-off blocks From git at git.haskell.org Thu Sep 14 17:09:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:16 +0000 (UTC) Subject: [commit: ghc] master: Test #12938 in indexed-types/should_compile/T12938 (b977630) Message-ID: <20170914170916.6530A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b9776308f69b6c6cca39c0cf05045405cdcfc16e/ghc >--------------------------------------------------------------- commit b9776308f69b6c6cca39c0cf05045405cdcfc16e Author: Richard Eisenberg Date: Tue Aug 15 14:56:31 2017 -0400 Test #12938 in indexed-types/should_compile/T12938 >--------------------------------------------------------------- b9776308f69b6c6cca39c0cf05045405cdcfc16e testsuite/tests/indexed-types/should_compile/T12938.hs | 8 ++++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 2 files changed, 9 insertions(+) diff --git a/testsuite/tests/indexed-types/should_compile/T12938.hs b/testsuite/tests/indexed-types/should_compile/T12938.hs new file mode 100644 index 0000000..1c8f47e --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/T12938.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TypeInType, TypeFamilies #-} + +module Bug where + +import GHC.Exts + +class HasRep a where + type Rep a :: TYPE r diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T index 32528c8..67ee1b7 100644 --- a/testsuite/tests/indexed-types/should_compile/all.T +++ b/testsuite/tests/indexed-types/should_compile/all.T @@ -267,5 +267,6 @@ test('T13662', normal, compile, ['']) test('T13705', normal, compile, ['']) test('T12369', normal, compile, ['']) test('T14045', normal, compile, ['']) +test('T12938', normal, compile, ['']) test('T14131', normal, compile, ['']) test('T14162', normal, compile, ['']) From git at git.haskell.org Thu Sep 14 17:09:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:19 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix dependence on grep behavior in T8129 (3edbf5c) Message-ID: <20170914170919.29AC53A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3edbf5c6dc8eb48728e22c409fe9251038906126/ghc >--------------------------------------------------------------- commit 3edbf5c6dc8eb48728e22c409fe9251038906126 Author: Ben Gamari Date: Thu Sep 14 13:05:15 2017 -0400 testsuite: Fix dependence on grep behavior in T8129 grep was considering the output to be binary on my machine, resulting in a spurious test failure. >--------------------------------------------------------------- 3edbf5c6dc8eb48728e22c409fe9251038906126 testsuite/tests/indexed-types/should_fail/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/indexed-types/should_fail/Makefile b/testsuite/tests/indexed-types/should_fail/Makefile index d56889e..432003c 100644 --- a/testsuite/tests/indexed-types/should_fail/Makefile +++ b/testsuite/tests/indexed-types/should_fail/Makefile @@ -14,5 +14,5 @@ T8227: # an asertion failure with -ddump-tc-trace T8129: -'$(TEST_HC)' $(TEST_HC_OPTS) -c -ddump-tc-trace T8129.hs 2> T8129.trace > T8129.trace - grep deduce T8129.trace + grep -a deduce T8129.trace From git at git.haskell.org Thu Sep 14 17:09:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:22 +0000 (UTC) Subject: [commit: ghc] master: Fix #13407 by suppressing invisibles better. (04bb873) Message-ID: <20170914170922.54DF63A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/04bb8736e1b0573ac45905a0f8c96bcb91564e2d/ghc >--------------------------------------------------------------- commit 04bb8736e1b0573ac45905a0f8c96bcb91564e2d Author: Richard Eisenberg Date: Tue Aug 15 18:04:32 2017 -0400 Fix #13407 by suppressing invisibles better. Previously, the iface-invisible-suppresser assumed that all invisible things are up front. Not true! test case: ghci/scripts/T13407 >--------------------------------------------------------------- 04bb8736e1b0573ac45905a0f8c96bcb91564e2d compiler/iface/IfaceType.hs | 6 +++--- testsuite/tests/ghci/scripts/T13407.script | 4 ++++ testsuite/tests/ghci/scripts/T13407.stdout | 3 +++ testsuite/tests/ghci/scripts/all.T | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/iface/IfaceType.hs b/compiler/iface/IfaceType.hs index 1f3ee6d..dcd3ad3 100644 --- a/compiler/iface/IfaceType.hs +++ b/compiler/iface/IfaceType.hs @@ -325,9 +325,9 @@ suppressIfaceInvisibles dflags tys xs where suppress _ [] = [] suppress [] a = a - suppress (k:ks) a@(_:xs) - | isInvisibleTyConBinder k = suppress ks xs - | otherwise = a + suppress (k:ks) (x:xs) + | isInvisibleTyConBinder k = suppress ks xs + | otherwise = x : suppress ks xs stripIfaceInvisVars :: DynFlags -> [IfaceTyConBinder] -> [IfaceTyConBinder] stripIfaceInvisVars dflags tyvars diff --git a/testsuite/tests/ghci/scripts/T13407.script b/testsuite/tests/ghci/scripts/T13407.script new file mode 100644 index 0000000..f77fd42 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13407.script @@ -0,0 +1,4 @@ +:set -XTypeInType -XRankNTypes +import Data.Kind +data Foo :: (* -> *) -> (forall k. k -> *) +:info Foo diff --git a/testsuite/tests/ghci/scripts/T13407.stdout b/testsuite/tests/ghci/scripts/T13407.stdout new file mode 100644 index 0000000..7607413 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13407.stdout @@ -0,0 +1,3 @@ +type role Foo phantom phantom +data Foo (a :: * -> *) (c :: k) + -- Defined at :3:1 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index d8ba10d..fd3744e 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -257,3 +257,4 @@ test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script']) test('T13591', expect_broken(13591), ghci_script, ['T13591.script']) test('T13699', normal, ghci_script, ['T13699.script']) test('T13988', normal, ghci_script, ['T13988.script']) +test('T13407', normal, ghci_script, ['T13407.script']) From git at git.haskell.org Thu Sep 14 17:09:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:28 +0000 (UTC) Subject: [commit: ghc] master: Regression test for #12742 (c813d8c) Message-ID: <20170914170928.63C7A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c813d8c9776b2c57ec90ab29e1cc0b687fbb9c34/ghc >--------------------------------------------------------------- commit c813d8c9776b2c57ec90ab29e1cc0b687fbb9c34 Author: Richard Eisenberg Date: Tue Aug 15 14:52:53 2017 -0400 Regression test for #12742 Location: dependent/should_compile/T12742 >--------------------------------------------------------------- c813d8c9776b2c57ec90ab29e1cc0b687fbb9c34 testsuite/tests/dependent/should_compile/T12742.hs | 11 +++++++++++ testsuite/tests/dependent/should_compile/all.T | 1 + 2 files changed, 12 insertions(+) diff --git a/testsuite/tests/dependent/should_compile/T12742.hs b/testsuite/tests/dependent/should_compile/T12742.hs new file mode 100644 index 0000000..baa3e2c --- /dev/null +++ b/testsuite/tests/dependent/should_compile/T12742.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TypeInType, RankNTypes, TypeFamilies #-} + +module T12742 where + +import Data.Kind + +type family F :: forall k2. (k1, k2) + +data T :: (forall k2. (Bool, k2)) -> Type + +type S = T F diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index a135892..774cdce 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -26,3 +26,4 @@ test('T12442', normal, compile, ['']) test('T13538', normal, compile, ['']) test('T12176', normal, compile, ['']) test('T14038', expect_broken(14038), compile, ['']) +test('T12742', normal, compile, ['']) From git at git.haskell.org Thu Sep 14 17:09:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 17:09:25 +0000 (UTC) Subject: [commit: ghc] master: Bump primitive submodule (58f1f73) Message-ID: <20170914170925.1C8173A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/58f1f733b25e725355c3de44987d753fa73115bc/ghc >--------------------------------------------------------------- commit 58f1f733b25e725355c3de44987d753fa73115bc Author: Ben Gamari Date: Wed Sep 13 19:42:39 2017 -0400 Bump primitive submodule >--------------------------------------------------------------- 58f1f733b25e725355c3de44987d753fa73115bc libraries/primitive | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/primitive b/libraries/primitive index 1af8978..7e6e7b4 160000 --- a/libraries/primitive +++ b/libraries/primitive @@ -1 +1 @@ -Subproject commit 1af89788d5c9ab7a0a93ff6764e1770e6c80d957 +Subproject commit 7e6e7b4667020b61986c60e0c2d642e700e7966d From git at git.haskell.org Thu Sep 14 19:36:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 19:36:02 +0000 (UTC) Subject: [commit: ghc] master: Fix #13909 by tweaking an error message. (89c8d4d) Message-ID: <20170914193602.4638B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/89c8d4d26416381a088eab6f5b8744927e349e69/ghc >--------------------------------------------------------------- commit 89c8d4d26416381a088eab6f5b8744927e349e69 Author: Richard Eisenberg Date: Tue Aug 15 19:07:59 2017 -0400 Fix #13909 by tweaking an error message. GHC was complaining about numbers of arguments when the real problem is impredicativity. test case: typecheck/should_fail/T13909 >--------------------------------------------------------------- 89c8d4d26416381a088eab6f5b8744927e349e69 compiler/typecheck/TcErrors.hs | 7 ++++++- testsuite/tests/typecheck/should_fail/T13909.hs | 12 ++++++++++++ testsuite/tests/typecheck/should_fail/T13909.stderr | 5 +++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 7db611f..664031d 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -2019,8 +2019,11 @@ mkExpectedActualMsg ty1 ty2 (TypeEqOrigin { uo_actual = act | otherwise = text "kind" <+> quotes (ppr exp) num_args_msg = case level of - TypeLevel -> Nothing KindLevel + | not (isMetaTyVarTy exp) && not (isMetaTyVarTy act) + -- if one is a meta-tyvar, then it's possible that the user + -- has asked for something impredicative, and we couldn't unify. + -- Don't bother with counting arguments. -> let n_act = count_args act n_exp = count_args exp in case n_act - n_exp of @@ -2035,6 +2038,8 @@ mkExpectedActualMsg ty1 ty2 (TypeEqOrigin { uo_actual = act | otherwise = text "more arguments to" -- n > 1 _ -> Nothing + _ -> Nothing + maybe_num_args_msg = case num_args_msg of Nothing -> empty Just m -> m diff --git a/testsuite/tests/typecheck/should_fail/T13909.hs b/testsuite/tests/typecheck/should_fail/T13909.hs new file mode 100644 index 0000000..4f0cbdc --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13909.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TypeInType #-} +module T13909 where + +import Data.Kind + +data Hm (k :: Type) (a :: k) :: Type + +class HasName (a :: k) where + getName :: proxy a -> String + +instance HasName Hm where + getName _ = "Hm" diff --git a/testsuite/tests/typecheck/should_fail/T13909.stderr b/testsuite/tests/typecheck/should_fail/T13909.stderr new file mode 100644 index 0000000..599be5a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13909.stderr @@ -0,0 +1,5 @@ + +T13909.hs:11:18: error: + • Expected kind ‘k0’, but ‘Hm’ has kind ‘forall k -> k -> *’ + • In the first argument of ‘HasName’, namely ‘Hm’ + In the instance declaration for ‘HasName Hm’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 07a893b..230e5f4 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -455,4 +455,5 @@ test('T13902', normal, compile_fail, ['']) test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T14055', normal, compile_fail, ['']) +test('T13909', normal, compile_fail, ['']) test('T14232', normal, compile_fail, ['']) From git at git.haskell.org Thu Sep 14 19:36:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 19:36:05 +0000 (UTC) Subject: [commit: ghc] master: Make rejigConRes do kind substitutions (e5beb6e) Message-ID: <20170914193605.520E23A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5beb6ecac1497972fd538fd9a60c75e9279d68f/ghc >--------------------------------------------------------------- commit e5beb6ecac1497972fd538fd9a60c75e9279d68f Author: Richard Eisenberg Date: Wed Aug 16 10:43:41 2017 -0400 Make rejigConRes do kind substitutions This was a lurking bug discovered on the hunt for #13910, but it doesn't fix that bug. The old version of rejigConRes was just wrong, forgetting to propagate a kind-change. >--------------------------------------------------------------- e5beb6ecac1497972fd538fd9a60c75e9279d68f testsuite/tests/dependent/should_compile/T13910.hs | 147 +++++++++++++++++++++ testsuite/tests/dependent/should_compile/all.T | 1 + 2 files changed, 148 insertions(+) diff --git a/testsuite/tests/dependent/should_compile/T13910.hs b/testsuite/tests/dependent/should_compile/T13910.hs new file mode 100644 index 0000000..82d47e4 --- /dev/null +++ b/testsuite/tests/dependent/should_compile/T13910.hs @@ -0,0 +1,147 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilyDependencies #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeOperators #-} +module T13910 where + +import Data.Kind +import Data.Type.Equality + +data family Sing (a :: k) + +class SingKind k where + type Demote k = (r :: *) | r -> k + fromSing :: Sing (a :: k) -> Demote k + toSing :: Demote k -> SomeSing k + +data SomeSing k where + SomeSing :: Sing (a :: k) -> SomeSing k + +withSomeSing :: forall k r + . SingKind k + => Demote k + -> (forall (a :: k). Sing a -> r) + -> r +withSomeSing x f = + case toSing x of + SomeSing x' -> f x' + +data TyFun :: * -> * -> * +type a ~> b = TyFun a b -> * +infixr 0 ~> + +type family Apply (f :: k1 ~> k2) (x :: k1) :: k2 +type a @@ b = Apply a b +infixl 9 @@ + +data FunArrow = (:->) | (:~>) + +class FunType (arr :: FunArrow) where + type Fun (k1 :: Type) arr (k2 :: Type) :: Type + +class FunType arr => AppType (arr :: FunArrow) where + type App k1 arr k2 (f :: Fun k1 arr k2) (x :: k1) :: k2 + +type FunApp arr = (FunType arr, AppType arr) + +instance FunType (:->) where + type Fun k1 (:->) k2 = k1 -> k2 + +$(return []) -- This is only necessary for GHC 8.0 -- GHC 8.2 is smarter + +instance AppType (:->) where + type App k1 (:->) k2 (f :: k1 -> k2) x = f x + +instance FunType (:~>) where + type Fun k1 (:~>) k2 = k1 ~> k2 + +$(return []) + +instance AppType (:~>) where + type App k1 (:~>) k2 (f :: k1 ~> k2) x = f @@ x + +infixr 0 -?> +type (-?>) (k1 :: Type) (k2 :: Type) (arr :: FunArrow) = Fun k1 arr k2 + +data instance Sing (z :: a :~: b) where + SRefl :: Sing Refl + +instance SingKind (a :~: b) where + type Demote (a :~: b) = a :~: b + fromSing SRefl = Refl + toSing Refl = SomeSing SRefl + +(~>:~:) :: forall (k :: Type) (a :: k) (b :: k) (r :: a :~: b) (p :: forall (y :: k). a :~: y ~> Type). + Sing r + -> p @@ Refl + -> p @@ r +(~>:~:) SRefl pRefl = pRefl + +type WhyReplacePoly (arr :: FunArrow) (from :: t) (p :: (t -?> Type) arr) + (y :: t) (e :: from :~: y) = App t arr Type p y +data WhyReplacePolySym (arr :: FunArrow) (from :: t) (p :: (t -?> Type) arr) + :: forall (y :: t). from :~: y ~> Type +type instance Apply (WhyReplacePolySym arr from p :: from :~: y ~> Type) x + = WhyReplacePoly arr from p y x + +replace :: forall (t :: Type) (from :: t) (to :: t) (p :: t -> Type). + p from + -> from :~: to + -> p to +replace = replacePoly @(:->) + +replaceTyFun :: forall (t :: Type) (from :: t) (to :: t) (p :: t ~> Type). + p @@ from + -> from :~: to + -> p @@ to +replaceTyFun = replacePoly @(:~>) @_ @_ @_ @p + +replacePoly :: forall (arr :: FunArrow) (t :: Type) (from :: t) (to :: t) + (p :: (t -?> Type) arr). + FunApp arr + => App t arr Type p from + -> from :~: to + -> App t arr Type p to +replacePoly from eq = + withSomeSing eq $ \(singEq :: Sing r) -> + (~>:~:) @t @from @to @r @(WhyReplacePolySym arr from p) singEq from + +type WhyLeibnizPoly (arr :: FunArrow) (f :: (t -?> Type) arr) (a :: t) (z :: t) + = App t arr Type f a -> App t arr Type f z +data WhyLeibnizPolySym (arr :: FunArrow) (f :: (t -?> Type) arr) (a :: t) + :: t ~> Type +type instance Apply (WhyLeibnizPolySym arr f a) z = WhyLeibnizPoly arr f a z + +leibnizPoly :: forall (arr :: FunArrow) (t :: Type) (f :: (t -?> Type) arr) + (a :: t) (b :: t). + FunApp arr + => a :~: b + -> App t arr Type f a + -> App t arr Type f b +leibnizPoly = replaceTyFun @t @a @b @(WhyLeibnizPolySym arr f a) id + +leibniz :: forall (t :: Type) (f :: t -> Type) (a :: t) (b :: t). + a :~: b + -> f a + -> f b +leibniz = replaceTyFun @t @a @b @(WhyLeibnizPolySym (:->) f a) id +-- The line above is what you get if you inline the definition of leibnizPoly. +-- It causes a panic, however. +-- +-- An equivalent implementation is commented out below, which does *not* +-- cause GHC to panic. +-- +-- leibniz = leibnizPoly @(:->) + +leibnizTyFun :: forall (t :: Type) (f :: t ~> Type) (a :: t) (b :: t). + a :~: b + -> f @@ a + -> f @@ b +leibnizTyFun = leibnizPoly @(:~>) @_ @f diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index 774cdce..bb21df7 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -27,3 +27,4 @@ test('T13538', normal, compile, ['']) test('T12176', normal, compile, ['']) test('T14038', expect_broken(14038), compile, ['']) test('T12742', normal, compile, ['']) +test('T13910', expect_broken(13910), compile, ['']) From git at git.haskell.org Thu Sep 14 19:36:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 19:36:08 +0000 (UTC) Subject: [commit: ghc] master: Fix #13929 by adding another levity polymorphism check (fa626f3) Message-ID: <20170914193608.DDFAD3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa626f3b1c1140a1f10bba60fdde10f767863f70/ghc >--------------------------------------------------------------- commit fa626f3b1c1140a1f10bba60fdde10f767863f70 Author: Richard Eisenberg Date: Wed Aug 16 11:35:26 2017 -0400 Fix #13929 by adding another levity polymorphism check test case: typecheck/should_fail/T13929 >--------------------------------------------------------------- fa626f3b1c1140a1f10bba60fdde10f767863f70 compiler/deSugar/DsExpr.hs | 9 +++--- testsuite/tests/typecheck/should_fail/T13929.hs | 32 ++++++++++++++++++++++ .../tests/typecheck/should_fail/T13929.stderr | 12 ++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index 2d86b84..b8ed3c5 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -368,14 +368,13 @@ ds_expr _ (ExplicitTuple tup_args boxity) go (lam_vars, args) (L _ (Present expr)) -- Expressions that are present don't generate -- lambdas, just arguments. - = do { core_expr <- dsLExpr expr + = do { core_expr <- dsLExprNoLP expr ; return (lam_vars, core_expr : args) } - ; (lam_vars, args) <- foldM go ([], []) (reverse tup_args) + ; dsWhenNoErrs (foldM go ([], []) (reverse tup_args)) -- The reverse is because foldM goes left-to-right - - ; return $ mkCoreLams lam_vars $ - mkCoreTupBoxity boxity args } + (\(lam_vars, args) -> mkCoreLams lam_vars $ + mkCoreTupBoxity boxity args) } ds_expr _ (ExplicitSum alt arity expr types) = do { core_expr <- dsLExpr expr diff --git a/testsuite/tests/typecheck/should_fail/T13929.hs b/testsuite/tests/typecheck/should_fail/T13929.hs new file mode 100644 index 0000000..f0a026d --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13929.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE AllowAmbiguousTypes #-} + +module Main where + +import GHC.Exts +import Data.Kind +import GHC.Generics + +class GUnbox (f :: Type -> Type) (r :: RuntimeRep) where + type GUnboxed f r :: TYPE r + gunbox :: f p -> GUnboxed f r + +instance (GUnbox f rf, GUnbox g rg) => GUnbox (f :*: g) ('TupleRep '[rf, rg]) where + type GUnboxed (f :*: g) ('TupleRep '[rf, rg]) = (# GUnboxed f rf, GUnboxed g rg #) + -- if I remove implementation of `gunbox` it compiles successfully + gunbox (x :*: y) = (# gunbox x, gunbox y #) + +main :: IO () +main = pure () diff --git a/testsuite/tests/typecheck/should_fail/T13929.stderr b/testsuite/tests/typecheck/should_fail/T13929.stderr new file mode 100644 index 0000000..3ddf5b3 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13929.stderr @@ -0,0 +1,12 @@ + +T13929.hs:29:27: error: + A levity-polymorphic type is not allowed here: + Type: GUnboxed f rf + Kind: TYPE rf + In the type of expression: gunbox x + +T13929.hs:29:37: error: + A levity-polymorphic type is not allowed here: + Type: GUnboxed g rg + Kind: TYPE rg + In the type of expression: gunbox y diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 230e5f4..fe71e37 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -456,4 +456,5 @@ test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T14055', normal, compile_fail, ['']) test('T13909', normal, compile_fail, ['']) +test('T13929', normal, compile_fail, ['']) test('T14232', normal, compile_fail, ['']) From git at git.haskell.org Thu Sep 14 19:36:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 19:36:11 +0000 (UTC) Subject: [commit: ghc] master: Test #13938, with expect_broken (86e1db7) Message-ID: <20170914193611.E63693A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/86e1db7d6850144d6e86dfb33eb0819205f6904c/ghc >--------------------------------------------------------------- commit 86e1db7d6850144d6e86dfb33eb0819205f6904c Author: Richard Eisenberg Date: Wed Aug 16 11:49:49 2017 -0400 Test #13938, with expect_broken test case: dependent/should_compile/T13938 >--------------------------------------------------------------- 86e1db7d6850144d6e86dfb33eb0819205f6904c testsuite/tests/dependent/should_compile/{T14038.hs => T13938.hs} | 7 ++++++- testsuite/tests/dependent/should_compile/all.T | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/dependent/should_compile/T14038.hs b/testsuite/tests/dependent/should_compile/T13938.hs similarity index 94% copy from testsuite/tests/dependent/should_compile/T14038.hs copy to testsuite/tests/dependent/should_compile/T13938.hs index 839220a..3ba9e27 100644 --- a/testsuite/tests/dependent/should_compile/T14038.hs +++ b/testsuite/tests/dependent/should_compile/T13938.hs @@ -4,11 +4,12 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} -module T14038 where +module T13938 where import Data.Kind (Type) @@ -39,12 +40,16 @@ type FunApp arr = (FunType arr, AppType arr) instance FunType (:->) where type Fun k1 (:->) k2 = k1 -> k2 +$(return []) -- This is only necessary for GHC 8.0 -- GHC 8.2 is smarter + instance AppType (:->) where type App k1 (:->) k2 (f :: k1 -> k2) x = f x instance FunType (:~>) where type Fun k1 (:~>) k2 = k1 ~> k2 +$(return []) + instance AppType (:~>) where type App k1 (:~>) k2 (f :: k1 ~> k2) x = f @@ x diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index bb21df7..684602c 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -28,3 +28,4 @@ test('T12176', normal, compile, ['']) test('T14038', expect_broken(14038), compile, ['']) test('T12742', normal, compile, ['']) test('T13910', expect_broken(13910), compile, ['']) +test('T13938', expect_broken(13938), compile, ['']) From git at git.haskell.org Thu Sep 14 19:36:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 19:36:15 +0000 (UTC) Subject: [commit: ghc] master: Fix #13963. (8f99cd6) Message-ID: <20170914193615.A36403A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f99cd67262a67c46ed1af952003486825e0e9f7/ghc >--------------------------------------------------------------- commit 8f99cd67262a67c46ed1af952003486825e0e9f7 Author: Richard Eisenberg Date: Wed Aug 16 14:33:06 2017 -0400 Fix #13963. This commit fixes several things: 1. RuntimeRep arg suppression was overeager for *visibly*-quantified RuntimeReps, which should remain. 2. The choice of whether to used a Named TyConBinder or an anonymous was sometimes wrong. Now, we do an extra little pass right before constructing the tycon to fix these. 3. TyCons that normally cannot appear unsaturated can appear unsaturated in :kind. But this fact was not propagated into the type checker. It now is. >--------------------------------------------------------------- 8f99cd67262a67c46ed1af952003486825e0e9f7 compiler/iface/IfaceType.hs | 4 +- compiler/typecheck/TcHsType.hs | 63 ++++++++++++++++++++++++++---- compiler/typecheck/TcRnDriver.hs | 2 +- testsuite/tests/ghci/scripts/T13963.script | 9 +++++ testsuite/tests/ghci/scripts/T13963.stdout | 4 ++ testsuite/tests/ghci/scripts/all.T | 1 + 6 files changed, 73 insertions(+), 10 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8f99cd67262a67c46ed1af952003486825e0e9f7 From git at git.haskell.org Thu Sep 14 20:42:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 20:42:51 +0000 (UTC) Subject: [commit: nofib] master: fannkuch-redux: Implement Semigroup along with Monoid (5748d42) Message-ID: <20170914204251.CF7823A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5748d428204ea0552f70b2981eaf30d4a5cfd3e9/nofib >--------------------------------------------------------------- commit 5748d428204ea0552f70b2981eaf30d4a5cfd3e9 Author: Joachim Breitner Date: Thu Sep 14 16:41:58 2017 -0400 fannkuch-redux: Implement Semigroup along with Monoid so that it builds with GHC-8.3 post 8ae263c. >--------------------------------------------------------------- 5748d428204ea0552f70b2981eaf30d4a5cfd3e9 shootout/fannkuch-redux/Main.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shootout/fannkuch-redux/Main.hs b/shootout/fannkuch-redux/Main.hs index d115350..b920e9f 100644 --- a/shootout/fannkuch-redux/Main.hs +++ b/shootout/fannkuch-redux/Main.hs @@ -12,15 +12,17 @@ import Control.Concurrent import Control.Monad import System.Environment import Foreign hiding (rotate) -import Data.Monoid +import Data.Semigroup type Perm = Ptr Word8 data F = F {-# UNPACK #-} !Int {-# UNPACK #-} !Int +instance Semigroup F where + F s1 m1 <> F s2 m2 = F (s1 + s2) (max m1 m2) + instance Monoid F where mempty = F 0 0 - F s1 m1 `mappend` F s2 m2 = F (s1 + s2) (max m1 m2) incPtr = (`advancePtr` 1) decPtr = (`advancePtr` (-1)) From git at git.haskell.org Thu Sep 14 20:45:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Sep 2017 20:45:44 +0000 (UTC) Subject: [commit: ghc] master: Bump submodule nofib (Semigroup now required) (7b8827a) Message-ID: <20170914204544.DC1723A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b8827ab24a3af8555f1adf250b7b541e41d8f5d/ghc >--------------------------------------------------------------- commit 7b8827ab24a3af8555f1adf250b7b541e41d8f5d Author: Joachim Breitner Date: Thu Sep 14 16:42:53 2017 -0400 Bump submodule nofib (Semigroup now required) This will unblock perf.haskell.org, which got stuck after 8ae263c. >--------------------------------------------------------------- 7b8827ab24a3af8555f1adf250b7b541e41d8f5d nofib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nofib b/nofib index 999a46a..5748d42 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit 999a46a1a73832795c532e142a3e37664417f35c +Subproject commit 5748d428204ea0552f70b2981eaf30d4a5cfd3e9 From git at git.haskell.org Fri Sep 15 15:57:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 15:57:27 +0000 (UTC) Subject: [commit: packages/array] master: Bump upper bound on base (9d63218) Message-ID: <20170915155727.238EA3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/9d63218fd067ff4885c0efa43b388238421a5c89 >--------------------------------------------------------------- commit 9d63218fd067ff4885c0efa43b388238421a5c89 Author: Ben Gamari Date: Wed Sep 13 20:04:36 2017 -0400 Bump upper bound on base >--------------------------------------------------------------- 9d63218fd067ff4885c0efa43b388238421a5c89 array.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/array.cabal b/array.cabal index 1a71bab..ceaf54d 100644 --- a/array.cabal +++ b/array.cabal @@ -37,7 +37,7 @@ library Trustworthy, UnboxedTuples, UnliftedFFITypes - build-depends: base >= 4.7 && < 4.11 + build-depends: base >= 4.7 && < 4.12 ghc-options: -Wall exposed-modules: Data.Array From git at git.haskell.org Fri Sep 15 16:30:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 16:30:58 +0000 (UTC) Subject: [commit: arcanist-external-json-linter] master: Ignore phutil_module_cache (f640b15) Message-ID: <20170915163058.A80693A5D3@ghc.haskell.org> Repository : ssh://git at ghc/arcanist-external-json-linter On branch : master Link : http://git.haskell.org/arcanist-external-json-linter.git/commitdiff/f640b1582f799d16ff500c5f456f9d1037a432bb >--------------------------------------------------------------- commit f640b1582f799d16ff500c5f456f9d1037a432bb Author: Ben Gamari Date: Mon Dec 7 11:06:50 2015 +0100 Ignore phutil_module_cache >--------------------------------------------------------------- f640b1582f799d16ff500c5f456f9d1037a432bb .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b193c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.phutil_module_cache From git at git.haskell.org Fri Sep 15 16:49:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 16:49:50 +0000 (UTC) Subject: [commit: packages/stm] master: Relax base constraint to allow base-4.11 (d65fd4d) Message-ID: <20170915164950.821883A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/stm On branch : master Link : http://git.haskell.org/packages/stm.git/commitdiff/d65fd4de49635a1e53405fe6699b46363a9d134e >--------------------------------------------------------------- commit d65fd4de49635a1e53405fe6699b46363a9d134e Author: Herbert Valerio Riedel Date: Fri Sep 15 18:48:38 2017 +0200 Relax base constraint to allow base-4.11 >--------------------------------------------------------------- d65fd4de49635a1e53405fe6699b46363a9d134e stm.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stm.cabal b/stm.cabal index de07d2b..7dc2fcd 100644 --- a/stm.cabal +++ b/stm.cabal @@ -34,7 +34,7 @@ library other-extensions: Safe build-depends: - base >= 4.3 && < 4.11, + base >= 4.3 && < 4.12, array >= 0.3 && < 0.6 exposed-modules: From git at git.haskell.org Fri Sep 15 19:37:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:27 +0000 (UTC) Subject: [commit: ghc] master: Fix name of note (f043cd5) Message-ID: <20170915193727.D298A3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f043cd5580982f8beb7e3d20a73dc427da89025a/ghc >--------------------------------------------------------------- commit f043cd5580982f8beb7e3d20a73dc427da89025a Author: Ben Gamari Date: Wed Sep 13 13:13:02 2017 -0400 Fix name of note [skip ci] >--------------------------------------------------------------- f043cd5580982f8beb7e3d20a73dc427da89025a compiler/typecheck/TcMType.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index ed7835c..23b51f6 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -1265,7 +1265,7 @@ zonkTcTypeAndFV :: TcType -> TcM DTyCoVarSet -- where k2:=k1 is in the substitution. We don't want -- k2 to look free in this type! -- NB: This might be called from within the knot, so don't use --- smart constructors. See Note [Zonking within the knot] in TcHsType +-- smart constructors. See Note [Type-checking inside the knot] in TcHsType zonkTcTypeAndFV ty = tyCoVarsOfTypeDSet <$> zonkTcTypeInKnot ty From git at git.haskell.org Fri Sep 15 19:37:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:30 +0000 (UTC) Subject: [commit: ghc] master: Ignore untracked in text, parsec and mtl submodules [skip ci] (4340165) Message-ID: <20170915193730.8DF7B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/43401652fd36b650521ab66be9b20dde3a10ca4c/ghc >--------------------------------------------------------------- commit 43401652fd36b650521ab66be9b20dde3a10ca4c Author: Tamar Christina Date: Fri Sep 15 14:34:26 2017 -0400 Ignore untracked in text, parsec and mtl submodules [skip ci] ignore all untracked changes in all submodules from the top level. This matches the older settings for the other submodules and stops litering `git status` output with files created by ./boot and make. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: hvr, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3899 >--------------------------------------------------------------- 43401652fd36b650521ab66be9b20dde3a10ca4c .gitmodules | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9e0e805..f5ec0ef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -57,59 +57,59 @@ [submodule "libraries/array"] path = libraries/array url = ../packages/array.git - ignore = none + ignore = untracked [submodule "libraries/deepseq"] path = libraries/deepseq url = ../packages/deepseq.git - ignore = none + ignore = untracked [submodule "libraries/directory"] path = libraries/directory url = ../packages/directory.git - ignore = none + ignore = untracked [submodule "libraries/filepath"] path = libraries/filepath url = ../packages/filepath.git - ignore = none + ignore = untracked [submodule "libraries/hpc"] path = libraries/hpc url = ../packages/hpc.git - ignore = none + ignore = untracked [submodule "libraries/parsec"] path = libraries/parsec url = ../packages/parsec.git - ignore = none + ignore = untracked [submodule "libraries/text"] path = libraries/text url = ../packages/text.git - ignore = none + ignore = untracked [submodule "libraries/mtl"] path = libraries/mtl url = ../packages/mtl.git - ignore = none + ignore = untracked [submodule "libraries/process"] path = libraries/process url = ../packages/process.git - ignore = none + ignore = untracked [submodule "libraries/unix"] path = libraries/unix url = ../packages/unix.git - ignore = none + ignore = untracked [submodule "libraries/parallel"] path = libraries/parallel url = ../packages/parallel.git - ignore = none + ignore = untracked [submodule "libraries/stm"] path = libraries/stm url = ../packages/stm.git - ignore = none + ignore = untracked [submodule "libraries/dph"] path = libraries/dph url = ../packages/dph.git - ignore = none + ignore = untracked [submodule "utils/haddock"] path = utils/haddock url = ../haddock.git - ignore = none + ignore = untracked branch = ghc-head [submodule "nofib"] path = nofib @@ -118,11 +118,11 @@ [submodule "utils/hsc2hs"] path = utils/hsc2hs url = ../hsc2hs.git - ignore = none + ignore = untracked [submodule "libffi-tarballs"] path = libffi-tarballs url = ../libffi-tarballs.git - ignore = none + ignore = untracked [submodule "gmp-tarballs"] path = libraries/integer-gmp/gmp/gmp-tarballs url = ../gmp-tarballs.git From git at git.haskell.org Fri Sep 15 19:37:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:40 +0000 (UTC) Subject: [commit: ghc] master: base: Fix mixed tabs/spaces indentation in inputReady.c (2bfba9e) Message-ID: <20170915193740.1FD0B3A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2bfba9e45f3d3272a44658aec987445647c7f2b7/ghc >--------------------------------------------------------------- commit 2bfba9e45f3d3272a44658aec987445647c7f2b7 Author: Niklas Hambüchen Date: Fri Sep 15 14:35:35 2017 -0400 base: Fix mixed tabs/spaces indentation in inputReady.c Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3952 >--------------------------------------------------------------- 2bfba9e45f3d3272a44658aec987445647c7f2b7 libraries/base/cbits/inputReady.c | 161 +++++++++++++++++++------------------- 1 file changed, 80 insertions(+), 81 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2bfba9e45f3d3272a44658aec987445647c7f2b7 From git at git.haskell.org Fri Sep 15 19:37:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:34 +0000 (UTC) Subject: [commit: ghc] master: Fix missing fields warnings in empty record construction, fix #13870 (9e227bb) Message-ID: <20170915193734.0CF513A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9e227bb19b8ceb129ce28e72aa070b3ba85accf7/ghc >--------------------------------------------------------------- commit 9e227bb19b8ceb129ce28e72aa070b3ba85accf7 Author: HE, Tao Date: Fri Sep 15 14:34:42 2017 -0400 Fix missing fields warnings in empty record construction, fix #13870 Test Plan: make test TEST=T13870 Reviewers: RyanGlScott, austin, bgamari, mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, thomie, RyanGlScott Tags: #ghc GHC Trac Issues: #13870 Differential Revision: https://phabricator.haskell.org/D3940 >--------------------------------------------------------------- 9e227bb19b8ceb129ce28e72aa070b3ba85accf7 compiler/typecheck/TcExpr.hs | 21 ++++++++++++++------- testsuite/tests/deSugar/should_compile/T13870.hs | 14 ++++++++++++++ .../tests/deSugar/should_compile/T13870.stderr | 10 ++++++++++ testsuite/tests/deSugar/should_compile/all.T | 1 + 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 0ff7d1e..f88eb5c 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -2421,17 +2421,20 @@ checkMissingFields con_like rbinds = if any isBanged field_strs then -- Illegal if any arg is strict addErrTc (missingStrictFields con_like []) - else - return () + else do + warn <- woptM Opt_WarnMissingFields + when (warn && notNull field_strs && null field_labels) + (warnTc (Reason Opt_WarnMissingFields) True + (missingFields con_like [])) | otherwise = do -- A record unless (null missing_s_fields) (addErrTc (missingStrictFields con_like missing_s_fields)) warn <- woptM Opt_WarnMissingFields - unless (not (warn && notNull missing_ns_fields)) - (warnTc (Reason Opt_WarnMissingFields) True - (missingFields con_like missing_ns_fields)) + when (warn && notNull missing_ns_fields) + (warnTc (Reason Opt_WarnMissingFields) True + (missingFields con_like missing_ns_fields)) where missing_s_fields @@ -2692,8 +2695,12 @@ missingStrictFields con fields missingFields :: ConLike -> [FieldLabelString] -> SDoc missingFields con fields - = text "Fields of" <+> quotes (ppr con) <+> ptext (sLit "not initialised:") - <+> pprWithCommas ppr fields + = header <> rest + where + rest | null fields = Outputable.empty + | otherwise = colon <+> pprWithCommas ppr fields + header = text "Fields of" <+> quotes (ppr con) <+> + text "not initialised" -- callCtxt fun args = text "In the call" <+> parens (ppr (foldl mkHsApp fun args)) diff --git a/testsuite/tests/deSugar/should_compile/T13870.hs b/testsuite/tests/deSugar/should_compile/T13870.hs new file mode 100644 index 0000000..90ad9f0 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13870.hs @@ -0,0 +1,14 @@ +-- !!! T13870 -- missing-fields warnings for recprd-construction + +module ShouldCompile where + +import Data.Functor.Identity + +test1 :: Maybe Int +test1 = Just{} + +test2 :: Maybe Int +test2 = Nothing{} + +test3 :: Identity Int +test3 = Identity{} diff --git a/testsuite/tests/deSugar/should_compile/T13870.stderr b/testsuite/tests/deSugar/should_compile/T13870.stderr new file mode 100644 index 0000000..5586806 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13870.stderr @@ -0,0 +1,10 @@ + +T13870.hs:8:9: warning: [-Wmissing-fields (in -Wdefault)] + • Fields of ‘Just’ not initialised + • In the expression: Just {} + In an equation for ‘test1’: test1 = Just {} + +T13870.hs:14:9: warning: [-Wmissing-fields (in -Wdefault)] + • Fields of ‘Identity’ not initialised: runIdentity + • In the expression: Identity {} + In an equation for ‘test3’: test3 = Identity {} diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 7a39b1e..0a20fbb 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -98,3 +98,4 @@ test('T13043', normal, compile, ['']) test('T13215', normal, compile, ['']) test('T13290', normal, compile, ['']) test('T13257', normal, compile, ['']) +test('T13870', normal, compile, ['']) From git at git.haskell.org Fri Sep 15 19:37:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:37 +0000 (UTC) Subject: [commit: ghc] master: Fix #14228 by marking SumPats as non-irrefutable (f4d50a0) Message-ID: <20170915193737.54BC43A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4d50a0ec0d23dbcd61a014c8a773030c8fe310d/ghc >--------------------------------------------------------------- commit f4d50a0ec0d23dbcd61a014c8a773030c8fe310d Author: Ryan Scott Date: Fri Sep 15 14:34:58 2017 -0400 Fix #14228 by marking SumPats as non-irrefutable `isIrrefutableHsPat` should always return `False` for unboxed sum patterns (`SumPat`s), since they always have at least one other corresponding pattern of the same arity (since the minimum arity for a `SumPat` is 2). Failure to do so causes incorrect code to be generated for pattern synonyms that use unboxed sums, as shown in #14228. Test Plan: make test TEST=T14228 Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #14228 Differential Revision: https://phabricator.haskell.org/D3951 >--------------------------------------------------------------- f4d50a0ec0d23dbcd61a014c8a773030c8fe310d compiler/hsSyn/HsPat.hs | 27 +++++++++++++++++++++++-- testsuite/tests/patsyn/should_run/T14228.hs | 22 ++++++++++++++++++++ testsuite/tests/patsyn/should_run/T14228.stdout | 4 ++++ testsuite/tests/patsyn/should_run/all.T | 1 + 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs index bcdcca2..4450868 100644 --- a/compiler/hsSyn/HsPat.hs +++ b/compiler/hsSyn/HsPat.hs @@ -146,7 +146,7 @@ data Pat p | SumPat (LPat p) -- Sum sub-pattern ConTag -- Alternative (one-based) - Arity -- Arity + Arity -- Arity (INVARIANT: ≥ 2) (PostTc p [Type]) -- PlaceHolder before typechecker, filled in -- afterwards with the types of the -- alternative @@ -613,7 +613,8 @@ isIrrefutableHsPat pat go1 (SigPatIn pat _) = go pat go1 (SigPatOut pat _) = go pat go1 (TuplePat pats _ _) = all go pats - go1 (SumPat pat _ _ _) = go pat + go1 (SumPat _ _ _ _) = False + -- See Note [Unboxed sum patterns aren't irrefutable] go1 (ListPat {}) = False go1 (PArrPat {}) = False -- ? @@ -634,6 +635,28 @@ isIrrefutableHsPat pat -- since we cannot know until the splice is evaluated. go1 (SplicePat {}) = False +{- Note [Unboxed sum patterns aren't irrefutable] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Unlike unboxed tuples, unboxed sums are *not* irrefutable when used as +patterns. A simple example that demonstrates this is from #14228: + + pattern Just' x = (# x | #) + pattern Nothing' = (# | () #) + + foo x = case x of + Nothing' -> putStrLn "nothing" + Just' -> putStrLn "just" + +In foo, the pattern Nothing' (that is, (# x | #)) is certainly not irrefutable, +as does not match an unboxed sum value of the same arity—namely, (# | y #) +(covered by Just'). In fact, no unboxed sum pattern is irrefutable, since the +minimum unboxed sum arity is 2. + +Failing to mark unboxed sum patterns as non-irrefutable would cause the Just' +case in foo to be unreachable, as GHC would mistakenly believe that Nothing' +is the only thing that could possibly be matched! +-} + hsPatNeedsParens :: Pat a -> Bool hsPatNeedsParens (NPlusKPat {}) = True hsPatNeedsParens (SplicePat {}) = False diff --git a/testsuite/tests/patsyn/should_run/T14228.hs b/testsuite/tests/patsyn/should_run/T14228.hs new file mode 100644 index 0000000..18cddd2 --- /dev/null +++ b/testsuite/tests/patsyn/should_run/T14228.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE UnboxedSums #-} +{-# LANGUAGE PatternSynonyms #-} +module Main where + +type Maybe' t = (# t | () #) + +pattern Just' :: a -> Maybe' a +pattern Just' x = (# x | #) + +pattern Nothing' :: Maybe' a +pattern Nothing' = (# | () #) + +foo x = case x of + Nothing' -> putStrLn "nothing" + Just' _ -> putStrLn "just" + +main = do + putStrLn "Nothing'" + foo Nothing' + + putStrLn "Just'" + foo (Just' "hello") diff --git a/testsuite/tests/patsyn/should_run/T14228.stdout b/testsuite/tests/patsyn/should_run/T14228.stdout new file mode 100644 index 0000000..a8ed424 --- /dev/null +++ b/testsuite/tests/patsyn/should_run/T14228.stdout @@ -0,0 +1,4 @@ +Nothing' +nothing +Just' +just diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T index 1498c1f..b087439 100644 --- a/testsuite/tests/patsyn/should_run/all.T +++ b/testsuite/tests/patsyn/should_run/all.T @@ -15,3 +15,4 @@ test('ghci', just_ghci, ghci_script, ['ghci.script']) test('T11985', just_ghci, ghci_script, ['T11985.script']) test('T11224', normal, compile_and_run, ['']) test('T13688', normal, multimod_compile_and_run, ['T13688', '-v0']) +test('T14228', normal, compile_and_run, ['']) From git at git.haskell.org Fri Sep 15 19:37:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:43 +0000 (UTC) Subject: [commit: ghc] master: Renamer now preserves location for IEThingWith list items (9498c50) Message-ID: <20170915193743.A78D63A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9498c50ef5af2680305e0aaea6f32439cacc3da0/ghc >--------------------------------------------------------------- commit 9498c50ef5af2680305e0aaea6f32439cacc3da0 Author: Alan Zimmerman Date: Fri Sep 15 14:35:51 2017 -0400 Renamer now preserves location for IEThingWith list items Prior to this, in the RenamedSource for module Renaming.RenameInExportedType ( MyType (NT) ) where data MyType = MT Int | NT The (NT) was given the location of MyType earlier on the line in the export list. Also the location was discarded for any field labels, and replaced with a `noLoc`. Test Plan: ./validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14189 Differential Revision: https://phabricator.haskell.org/D3968 >--------------------------------------------------------------- 9498c50ef5af2680305e0aaea6f32439cacc3da0 compiler/typecheck/TcRnExports.hs | 37 +++--- testsuite/tests/parser/should_compile/T14189.hs | 6 + .../tests/parser/should_compile/T14189.stderr | 135 +++++++++++++++++++++ testsuite/tests/parser/should_compile/all.T | 1 + 4 files changed, 161 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 9498c50ef5af2680305e0aaea6f32439cacc3da0 From git at git.haskell.org Fri Sep 15 19:37:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 19:37:46 +0000 (UTC) Subject: [commit: ghc] master: Remove dead function TcUnify.wrapFunResCoercion (47a9ec7) Message-ID: <20170915193746.6A3873A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/47a9ec7b29fb4de70ba6d89a91a5c5e5034feb17/ghc >--------------------------------------------------------------- commit 47a9ec7b29fb4de70ba6d89a91a5c5e5034feb17 Author: Arnaud Spiwack Date: Fri Sep 15 14:36:39 2017 -0400 Remove dead function TcUnify.wrapFunResCoercion Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3970 >--------------------------------------------------------------- 47a9ec7b29fb4de70ba6d89a91a5c5e5034feb17 compiler/typecheck/TcUnify.hs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index 5ae8c09..6c45279 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -31,8 +31,6 @@ module TcUnify ( matchActualFunTys, matchActualFunTysPart, matchExpectedFunKind, - wrapFunResCoercion, - occCheckExpand, metaTyVarUpdateOK, occCheckForErrors, OccCheckResult(..) @@ -64,7 +62,6 @@ import Util import Pair( pFst ) import qualified GHC.LanguageExtensions as LangExt import Outputable -import FastString import Control.Monad import Control.Arrow ( second ) @@ -830,20 +827,6 @@ tcWrapResultO orig rn_expr expr actual_ty res_ty (Just rn_expr) actual_ty res_ty ; return (mkHsWrap cow expr) } ------------------------------------ -wrapFunResCoercion - :: [TcType] -- Type of args - -> HsWrapper -- HsExpr a -> HsExpr b - -> TcM HsWrapper -- HsExpr (arg_tys -> a) -> HsExpr (arg_tys -> b) -wrapFunResCoercion arg_tys co_fn_res - | isIdHsWrapper co_fn_res - = return idHsWrapper - | null arg_tys - = return co_fn_res - | otherwise - = do { arg_ids <- newSysLocalIds (fsLit "sub") arg_tys - ; return (mkWpLams arg_ids <.> co_fn_res <.> mkWpEvVarApps arg_ids) } - {- ********************************************************************** %* * From git at git.haskell.org Fri Sep 15 21:15:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Sep 2017 21:15:47 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Wrap README.md to 80 col (13efa46) Message-ID: <20170915211547.A15083A5D3@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/13efa464fc62b75c2a58cfa0fa389b82a6113a61/ghc >--------------------------------------------------------------- commit 13efa464fc62b75c2a58cfa0fa389b82a6113a61 Author: Jared Weakly Date: Fri Sep 15 14:18:07 2017 -0700 Wrap README.md to 80 col >--------------------------------------------------------------- 13efa464fc62b75c2a58cfa0fa389b82a6113a61 testsuite/driver/README.md | 133 +++++++++++++++++++++++++++------------------ 1 file changed, 81 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 13efa464fc62b75c2a58cfa0fa389b82a6113a61 From git at git.haskell.org Sat Sep 16 13:45:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Sep 2017 13:45:01 +0000 (UTC) Subject: [commit: ghc] master: base: Enable TypeInType in Data.Type.Equality (b099171) Message-ID: <20170916134501.6684F3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b09917143afe837d717feeaf97b699bcc9e016cd/ghc >--------------------------------------------------------------- commit b09917143afe837d717feeaf97b699bcc9e016cd Author: Ben Gamari Date: Fri Sep 15 18:57:43 2017 -0400 base: Enable TypeInType in Data.Type.Equality Otherwise compilation fails with, libraries/base/Data/Type/Equality.hs:145:4: error: • Data constructor ‘HRefl’ constrains the choice of kind parameter: k2 ~ k2 Use TypeInType to allow this • In the definition of data constructor ‘HRefl’ In the data type declaration for ‘:~~:’ | 145 | HRefl :: a :~~: a | ^ >--------------------------------------------------------------- b09917143afe837d717feeaf97b699bcc9e016cd libraries/base/Data/Type/Equality.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/base/Data/Type/Equality.hs b/libraries/base/Data/Type/Equality.hs index 64bb555..5caa35a 100644 --- a/libraries/base/Data/Type/Equality.hs +++ b/libraries/base/Data/Type/Equality.hs @@ -12,6 +12,7 @@ {-# LANGUAGE ExplicitNamespaces #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE TypeInType #-} {-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- From git at git.haskell.org Sat Sep 16 14:16:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Sep 2017 14:16:22 +0000 (UTC) Subject: [commit: ghc] branch 'wip/llvm-debug-info' created Message-ID: <20170916141622.D7D8C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/llvm-debug-info Referencing: 6448322d7bc56c2b435b9bfda50430c0d0748a22 From git at git.haskell.org Sat Sep 16 14:16:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Sep 2017 14:16:25 +0000 (UTC) Subject: [commit: ghc] wip/llvm-debug-info: [WIP] llvmGen: Produce debug information metadata for functions (fc2de30) Message-ID: <20170916141625.A9C7E3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/llvm-debug-info Link : http://ghc.haskell.org/trac/ghc/changeset/fc2de303e0a53392d4ab987131608bc6bdbd81db/ghc >--------------------------------------------------------------- commit fc2de303e0a53392d4ab987131608bc6bdbd81db Author: Ben Gamari Date: Fri Sep 15 16:27:55 2017 -0400 [WIP] llvmGen: Produce debug information metadata for functions Summary: It turns out that providing debug information in LLVM is relatively straightforward. At this moment this only provides debug information with procedure-level granularity. Test Plan: Validate, look at DWARF output, try poking around in GDB Reviewers: scpmw, simonmar, austin Subscribers: spacekitteh, cocreature, thomie Differential Revision: https://phabricator.haskell.org/D2343 >--------------------------------------------------------------- fc2de303e0a53392d4ab987131608bc6bdbd81db compiler/llvmGen/Llvm/AbsSyn.hs | 3 ++ compiler/llvmGen/Llvm/MetaData.hs | 57 +++++++++++++++++++++++ compiler/llvmGen/Llvm/PpLlvm.hs | 10 ++--- compiler/llvmGen/LlvmCodeGen.hs | 80 +++++++++++++++++++++++++++------ compiler/llvmGen/LlvmCodeGen/Base.hs | 27 ++++++++++- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 4 +- compiler/llvmGen/LlvmCodeGen/Ppr.hs | 51 ++++++++++++++++++--- compiler/main/CodeOutput.hs | 8 ++-- 8 files changed, 210 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fc2de303e0a53392d4ab987131608bc6bdbd81db From git at git.haskell.org Sat Sep 16 14:16:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Sep 2017 14:16:28 +0000 (UTC) Subject: [commit: ghc] wip/llvm-debug-info: Fix distinction (6448322) Message-ID: <20170916141628.7F7383A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/llvm-debug-info Link : http://ghc.haskell.org/trac/ghc/changeset/6448322d7bc56c2b435b9bfda50430c0d0748a22/ghc >--------------------------------------------------------------- commit 6448322d7bc56c2b435b9bfda50430c0d0748a22 Author: Ben Gamari Date: Fri Sep 15 19:14:02 2017 -0400 Fix distinction >--------------------------------------------------------------- 6448322d7bc56c2b435b9bfda50430c0d0748a22 compiler/llvmGen/Llvm.hs | 1 + compiler/llvmGen/Llvm/MetaData.hs | 7 +++++-- compiler/llvmGen/Llvm/PpLlvm.hs | 19 +++++++++++-------- compiler/llvmGen/LlvmCodeGen.hs | 16 ++++++++-------- compiler/llvmGen/LlvmCodeGen/Base.hs | 2 +- compiler/llvmGen/LlvmCodeGen/Ppr.hs | 22 +++++++++++----------- 6 files changed, 37 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6448322d7bc56c2b435b9bfda50430c0d0748a22 From git at git.haskell.org Sun Sep 17 03:48:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Sep 2017 03:48:34 +0000 (UTC) Subject: [commit: ghc] master: base: Add missing MonadFail instance for strict ST (4ec4ca9) Message-ID: <20170917034834.049443A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4ec4ca999ac558e1678b0a609417de5bf08c3ad5/ghc >--------------------------------------------------------------- commit 4ec4ca999ac558e1678b0a609417de5bf08c3ad5 Author: Ben Gamari Date: Sat Sep 16 23:47:37 2017 -0400 base: Add missing MonadFail instance for strict ST Test Plan: Validate Reviewers: hvr, RyanGlScott, austin Reviewed By: RyanGlScott Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3982 >--------------------------------------------------------------- 4ec4ca999ac558e1678b0a609417de5bf08c3ad5 libraries/base/GHC/ST.hs | 4 ++++ libraries/base/changelog.md | 2 ++ 2 files changed, 6 insertions(+) diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs index 9f8bb64..7f3b4ff 100644 --- a/libraries/base/GHC/ST.hs +++ b/libraries/base/GHC/ST.hs @@ -78,6 +78,10 @@ instance Monad (ST s) where (k2 new_s) }}) -- | @since 4.11.0.0 +instance Fail.MonadFail (ST s) where + fail s = errorWithoutStackTrace s + +-- | @since 4.11.0.0 instance Semigroup a => Semigroup (ST s a) where (<>) = liftA2 (<>) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 0ef5073..eac53ba 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -40,6 +40,8 @@ * Add `Data` instances for `IntPtr` and `WordPtr` (#13115) + * Add missing `MonadFail` instance for `Control.Monad.Strict.ST.ST` + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* From git at git.haskell.org Sun Sep 17 04:19:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Sep 2017 04:19:37 +0000 (UTC) Subject: [commit: ghc] master: Fix pointer tagging mistake (60a3f11) Message-ID: <20170917041937.6522C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60a3f11ff4b7e239a273498812fd9d31f6775726/ghc >--------------------------------------------------------------- commit 60a3f11ff4b7e239a273498812fd9d31f6775726 Author: David Feuer Date: Sun Sep 17 00:21:03 2017 -0400 Fix pointer tagging mistake f9c6d53fe997f1c560cda6f346f4b201711df37c led to #14036. The problem turned out to be rather simple: the `obj` pointer was being tagged using `obj + arity`. Because this is C, that's done with *pointer arithmetic*, which is not at all what we want. Add appropriate casts. Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14036 Differential Revision: https://phabricator.haskell.org/D3983 >--------------------------------------------------------------- 60a3f11ff4b7e239a273498812fd9d31f6775726 rts/Interpreter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rts/Interpreter.c b/rts/Interpreter.c index f3a6cb5..165511b 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -429,7 +429,9 @@ eval_obj: // https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging tagged_obj = newEmptyPAP(cap, - arity <= TAG_MASK ? obj + arity : obj, + arity <= TAG_MASK + ? (StgClosure *) ((intptr_t) obj + arity) + : obj, arity); } #endif From git at git.haskell.org Sun Sep 17 04:21:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Sep 2017 04:21:33 +0000 (UTC) Subject: [commit: ghc] master: base: Fix missing import of Control.Monad.Fail (a83f17e) Message-ID: <20170917042133.B339B3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a83f17e46286f1c25b5bde8e13f62d1ff3a6abaa/ghc >--------------------------------------------------------------- commit a83f17e46286f1c25b5bde8e13f62d1ff3a6abaa Author: Ben Gamari Date: Sun Sep 17 00:18:06 2017 -0400 base: Fix missing import of Control.Monad.Fail >--------------------------------------------------------------- a83f17e46286f1c25b5bde8e13f62d1ff3a6abaa libraries/base/GHC/ST.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs index 7f3b4ff..e9d79d9 100644 --- a/libraries/base/GHC/ST.hs +++ b/libraries/base/GHC/ST.hs @@ -26,6 +26,7 @@ module GHC.ST ( import GHC.Base import GHC.Show +import qualified Control.Monad.Fail as Fail default () From git at git.haskell.org Sun Sep 17 12:00:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Sep 2017 12:00:56 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix MonadFail test output for new ST instance (2258a29) Message-ID: <20170917120056.27B6B3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2258a2936bbeebcf671e19e8d6408b3a611c329d/ghc >--------------------------------------------------------------- commit 2258a2936bbeebcf671e19e8d6408b3a611c329d Author: Ben Gamari Date: Sun Sep 17 07:59:41 2017 -0400 testsuite: Fix MonadFail test output for new ST instance >--------------------------------------------------------------- 2258a2936bbeebcf671e19e8d6408b3a611c329d testsuite/tests/monadfail/MonadFailErrors.stderr | 13 ------------- testsuite/tests/monadfail/MonadFailWarnings.stderr | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/testsuite/tests/monadfail/MonadFailErrors.stderr b/testsuite/tests/monadfail/MonadFailErrors.stderr index 81ad56c..27fc3c3 100644 --- a/testsuite/tests/monadfail/MonadFailErrors.stderr +++ b/testsuite/tests/monadfail/MonadFailErrors.stderr @@ -33,19 +33,6 @@ MonadFailErrors.hs:30:5: error: = do Just x <- undefined undefined -MonadFailErrors.hs:44:5: error: - • No instance for (MonadFail (ST s)) - arising from a do statement - with the failable pattern ‘Just x’ - • In a stmt of a 'do' block: Just x <- undefined - In the expression: - do Just x <- undefined - undefined - In an equation for ‘st’: - st - = do Just x <- undefined - undefined - MonadFailErrors.hs:51:5: error: • No instance for (MonadFail ((->) r)) arising from a do statement diff --git a/testsuite/tests/monadfail/MonadFailWarnings.stderr b/testsuite/tests/monadfail/MonadFailWarnings.stderr index 7471bd9..7a341fc 100644 --- a/testsuite/tests/monadfail/MonadFailWarnings.stderr +++ b/testsuite/tests/monadfail/MonadFailWarnings.stderr @@ -33,19 +33,6 @@ MonadFailWarnings.hs:35:5: warning: [-Wmissing-monadfail-instances (in -Wcompat) = do Just x <- undefined undefined -MonadFailWarnings.hs:51:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - • No instance for (MonadFail (ST s)) - arising from the failable pattern ‘Just x’ - (this will become an error in a future GHC release) - • In a stmt of a 'do' block: Just x <- undefined - In the expression: - do Just x <- undefined - undefined - In an equation for ‘st’: - st - = do Just x <- undefined - undefined - MonadFailWarnings.hs:59:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] • No instance for (MonadFail ((->) r)) arising from the failable pattern ‘Just x’ From git at git.haskell.org Sun Sep 17 23:32:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Sep 2017 23:32:12 +0000 (UTC) Subject: [commit: ghc] wip/perf-testsuite: Split collect_stats into collect_stats and collect_compiler_stats (c26821f) Message-ID: <20170917233212.C4C1D3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/perf-testsuite Link : http://ghc.haskell.org/trac/ghc/changeset/c26821f045db51ef67bbc7c487154bdf24c73505/ghc >--------------------------------------------------------------- commit c26821f045db51ef67bbc7c487154bdf24c73505 Author: Jared Weakly Date: Sun Sep 17 16:34:20 2017 -0700 Split collect_stats into collect_stats and collect_compiler_stats >--------------------------------------------------------------- c26821f045db51ef67bbc7c487154bdf24c73505 testsuite/driver/README.md | 12 ++-- testsuite/driver/perf_notes.py | 21 ++++-- testsuite/driver/testlib.py | 2 +- testsuite/tests/deriving/perf/all.T | 2 +- testsuite/tests/perf/compiler/all.T | 88 +++++++++++++------------- testsuite/tests/simplCore/should_compile/all.T | 2 +- 6 files changed, 69 insertions(+), 58 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c26821f045db51ef67bbc7c487154bdf24c73505 From git at git.haskell.org Mon Sep 18 14:21:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Sep 2017 14:21:15 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rae-kind-gadts' created Message-ID: <20170918142115.DA7593A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rae-kind-gadts Referencing: 55b48cc29edace56bf2d1c8465f56c0cd90580bc From git at git.haskell.org Mon Sep 18 14:21:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Sep 2017 14:21:21 +0000 (UTC) Subject: [commit: ghc] wip/rae-kind-gadts: Debug (a4cfa04) Message-ID: <20170918142121.6D1193A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae-kind-gadts Link : http://ghc.haskell.org/trac/ghc/changeset/a4cfa04b698aad140b23b43f7b97dcb152f8e743/ghc >--------------------------------------------------------------- commit a4cfa04b698aad140b23b43f7b97dcb152f8e743 Author: Ben Gamari Date: Sun Sep 10 10:39:08 2017 -0400 Debug >--------------------------------------------------------------- a4cfa04b698aad140b23b43f7b97dcb152f8e743 compiler/typecheck/TcTyClsDecls.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 30dd15e..79034d9 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -2522,7 +2522,8 @@ checkValidDataCon dflags existential_ok tc con -- See Note [Wrong visibility for GADTs], though. is_invisible_eq_spec eq_spec = let eq_tv = eqSpecTyVar eq_spec - tv_index = expectJust "checkValidDataCon" $ + tv_index = pprTrace "checkValidDataCon" (ppr eq_tv $$ ppr univ_tvs) $ + expectJust "checkValidDataCon" $ elemIndex eq_tv univ_tvs tc_bndr = tc_bndrs `getNth` tv_index in From git at git.haskell.org Mon Sep 18 14:21:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Sep 2017 14:21:18 +0000 (UTC) Subject: [commit: ghc] wip/rae-kind-gadts: Debug (55b48cc) Message-ID: <20170918142118.A26BD3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae-kind-gadts Link : http://ghc.haskell.org/trac/ghc/changeset/55b48cc29edace56bf2d1c8465f56c0cd90580bc/ghc >--------------------------------------------------------------- commit 55b48cc29edace56bf2d1c8465f56c0cd90580bc Author: Ben Gamari Date: Wed Sep 13 19:20:09 2017 -0400 Debug >--------------------------------------------------------------- 55b48cc29edace56bf2d1c8465f56c0cd90580bc compiler/typecheck/TcHsType.hs | 3 ++- compiler/typecheck/TcTyClsDecls.hs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 4fd561e..52ebcf5 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1680,7 +1680,8 @@ kindGeneralize :: TcType -> TcM [KindVar] -- In the latter case the type is closed, so it has no free -- type variables. So in both cases, all the free vars are kind vars kindGeneralize kind_or_type - = do { kvs <- zonkTcTypeAndFV kind_or_type + = --pprTrace "kindGeneralize" (ppr kind_or_type) $ + do { kvs <- zonkTcTypeAndFV kind_or_type ; let dvs = DV { dv_kvs = kvs, dv_tvs = emptyDVarSet } ; gbl_tvs <- tcGetGlobalTyCoVars -- Already zonked ; quantifyTyVars gbl_tvs dvs } diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 79034d9..1f435d2 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -2512,7 +2512,8 @@ checkValidDataCon dflags existential_ok tc con (badExistential con) ; typeintype <- xoptM LangExt.TypeInType - ; let invisible_gadt_eq_specs = filter is_invisible_eq_spec (dataConEqSpec con) + ; let invisible_gadt_eq_specs = pprTrace "checkValidDataCon2" (ppr (dataConEqSpec con) $$ ppr (dataConExTyVars con) $$ ppr univ_tvs $$ ppr tc_bndrs) + $ filter is_invisible_eq_spec (dataConEqSpec con) univ_tvs = dataConUnivTyVars con tc_bndrs = tyConBinders tc @@ -2522,7 +2523,7 @@ checkValidDataCon dflags existential_ok tc con -- See Note [Wrong visibility for GADTs], though. is_invisible_eq_spec eq_spec = let eq_tv = eqSpecTyVar eq_spec - tv_index = pprTrace "checkValidDataCon" (ppr eq_tv $$ ppr univ_tvs) $ + tv_index = pprTrace "checkValidDataCon" (ppr con $$ ppr eq_tv $$ ppr univ_tvs) $ expectJust "checkValidDataCon" $ elemIndex eq_tv univ_tvs tc_bndr = tc_bndrs `getNth` tv_index From git at git.haskell.org Mon Sep 18 14:21:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Sep 2017 14:21:25 +0000 (UTC) Subject: [commit: ghc] wip/rae-kind-gadts: Fix #13391 by checking for kind-GADTs (a07d644) Message-ID: <20170918142125.1D15F3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae-kind-gadts Link : http://ghc.haskell.org/trac/ghc/changeset/a07d64454e1b0106d3d0c67b32f966ee19e23e3a/ghc >--------------------------------------------------------------- commit a07d64454e1b0106d3d0c67b32f966ee19e23e3a Author: Richard Eisenberg Date: Tue Aug 15 17:22:50 2017 -0400 Fix #13391 by checking for kind-GADTs The check is a bit gnarly, but I couldn't think of a better way. See the new code in TcTyClsDecls. test case: polykinds/T13391 >--------------------------------------------------------------- a07d64454e1b0106d3d0c67b32f966ee19e23e3a compiler/basicTypes/DataCon.hs | 2 ++ compiler/typecheck/TcTyClsDecls.hs | 29 ++++++++++++++++++++++ libraries/base/Data/Type/Equality.hs | 3 +-- testsuite/tests/dependent/should_compile/Dep2.hs | 2 +- .../dependent/should_compile/KindEqualities.hs | 6 +++-- .../dependent/should_compile/KindEqualities.stderr | 2 +- .../should_run/overloadedrecfldsrun07.hs | 7 +++--- testsuite/tests/polykinds/T13391.hs | 8 ++++++ testsuite/tests/polykinds/T13391.stderr | 7 ++++++ testsuite/tests/polykinds/all.T | 1 + 10 files changed, 58 insertions(+), 9 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a07d64454e1b0106d3d0c67b32f966ee19e23e3a From git at git.haskell.org Mon Sep 18 16:17:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Sep 2017 16:17:47 +0000 (UTC) Subject: [commit: ghc] master: [RTS] Add getObjectLoadStatus (cdaf5f2) Message-ID: <20170918161747.22C3C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdaf5f2027ea9678e9f92e9140c79da2daa78360/ghc >--------------------------------------------------------------- commit cdaf5f2027ea9678e9f92e9140c79da2daa78360 Author: Bartosz Nitka Date: Mon Sep 18 07:53:56 2017 -0700 [RTS] Add getObjectLoadStatus This adds a function to the RTS linker API which lets the user check the status of dynamically linked objects. It was initially proposed by @afarmer in D2068. It's useful for testing the linker and also for detecting retention problems in production. It takes a path, because it's easier to use path as key instead of producing some stable handle. It returns an enum instead of bool, because I see no reason for destroying information. All the complexity is already out in the open, so there's nothing to save the users from. Test Plan: ./validate Reviewers: simonmar, Phyx, bgamari, austin, erikd Reviewed By: Phyx, bgamari Subscribers: rwbarton, afarmer, thomie Differential Revision: https://phabricator.haskell.org/D3963 >--------------------------------------------------------------- cdaf5f2027ea9678e9f92e9140c79da2daa78360 includes/rts/Linker.h | 14 ++++++++++++++ rts/Linker.c | 24 ++++++++++++++++++++++++ rts/LinkerInternals.h | 9 --------- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h index 793195b..298dc6a 100644 --- a/includes/rts/Linker.h +++ b/includes/rts/Linker.h @@ -47,6 +47,20 @@ HsInt insertSymbol(pathchar* obj_name, char* key, void* data); /* lookup a symbol in the hash table */ void *lookupSymbol( char *lbl ); +/* See Linker.c Note [runtime-linker-phases] */ +typedef enum { + OBJECT_LOADED, + OBJECT_NEEDED, + OBJECT_RESOLVED, + OBJECT_UNLOADED, + OBJECT_DONT_RESOLVE, + OBJECT_NOT_LOADED /* The object was either never loaded or has been + fully unloaded */ +} OStatus; + +/* check object load status */ +OStatus getObjectLoadStatus( pathchar *path ); + /* delete an object from the pool */ HsInt unloadObj( pathchar *path ); diff --git a/rts/Linker.c b/rts/Linker.c index 18f2c6b..30d7e87 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1708,6 +1708,30 @@ HsInt purgeObj (pathchar *path) return r; } +static OStatus getObjectLoadStatus_ (pathchar *path) +{ + ObjectCode *o; + for (o = objects; o; o = o->next) { + if (0 == pathcmp(o->fileName, path)) { + return o->status; + } + } + for (o = unloaded_objects; o; o = o->next) { + if (0 == pathcmp(o->fileName, path)) { + return o->status; + } + } + return OBJECT_NOT_LOADED; +} + +OStatus getObjectLoadStatus (pathchar *path) +{ + ACQUIRE_LOCK(&linker_mutex); + OStatus r = getObjectLoadStatus_(path); + RELEASE_LOCK(&linker_mutex); + return r; +} + /* ----------------------------------------------------------------------------- * Sanity checking. For each ObjectCode, maintain a list of address ranges * which may be prodded during relocation, and abort if we try and write diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 2e84917..dd17be0 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -20,15 +20,6 @@ typedef void SymbolAddr; typedef char SymbolName; -/* See Linker.c Note [runtime-linker-phases] */ -typedef enum { - OBJECT_LOADED, - OBJECT_NEEDED, - OBJECT_RESOLVED, - OBJECT_UNLOADED, - OBJECT_DONT_RESOLVE -} OStatus; - /* Indication of section kinds for loaded objects. Needed by the GC for deciding whether or not a pointer on the stack is a code pointer. From git at git.haskell.org Mon Sep 18 21:09:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Sep 2017 21:09:47 +0000 (UTC) Subject: [commit: ghc] wip/T13644: Identify fields by selector when type-checking expressions (fixes #13847) (d42fe23) Message-ID: <20170918210947.2DEEE3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13644 Link : http://ghc.haskell.org/trac/ghc/changeset/d42fe23f7435afc796bde415fd252151a2871f9c/ghc >--------------------------------------------------------------- commit d42fe23f7435afc796bde415fd252151a2871f9c Author: Adam Gundry Date: Thu Sep 14 15:58:11 2017 +0100 Identify fields by selector when type-checking expressions (fixes #13847) >--------------------------------------------------------------- d42fe23f7435afc796bde415fd252151a2871f9c compiler/typecheck/TcExpr.hs | 9 +++++---- testsuite/tests/rename/should_fail/T13847.hs | 4 ++++ testsuite/tests/rename/should_fail/T13847.stderr | 6 ++++++ testsuite/tests/rename/should_fail/T13847A.hs | 2 ++ testsuite/tests/rename/should_fail/all.T | 1 + 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 0ff7d1e..bcfcf17 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -2351,7 +2351,7 @@ tcRecordBinds con_like arg_tys (HsRecFields rbinds dd) = do { mb_binds <- mapM do_bind rbinds ; return (HsRecFields (catMaybes mb_binds) dd) } where - fields = map flLabel $ conLikeFieldLabels con_like + fields = map flSelector $ conLikeFieldLabels con_like flds_w_tys = zipEqual "tcRecordBinds" fields arg_tys do_bind :: LHsRecField GhcRn (LHsExpr GhcRn) @@ -2373,7 +2373,8 @@ tcRecordUpd tcRecordUpd con_like arg_tys rbinds = fmap catMaybes $ mapM do_bind rbinds where - flds_w_tys = zipEqual "tcRecordUpd" (map flLabel $ conLikeFieldLabels con_like) arg_tys + fields = map flSelector $ conLikeFieldLabels con_like + flds_w_tys = zipEqual "tcRecordUpd" fields arg_tys do_bind :: LHsRecField' (AmbiguousFieldOcc GhcTc) (LHsExpr GhcRn) -> TcM (Maybe (LHsRecUpdField GhcTcId)) @@ -2392,11 +2393,11 @@ tcRecordUpd con_like arg_tys rbinds = fmap catMaybes $ mapM do_bind rbinds (selectorFieldOcc (unLoc f'))) , hsRecFieldArg = rhs' }))) } -tcRecordField :: ConLike -> Assoc FieldLabelString Type +tcRecordField :: ConLike -> Assoc Name Type -> LFieldOcc GhcRn -> LHsExpr GhcRn -> TcM (Maybe (LFieldOcc GhcTc, LHsExpr GhcTc)) tcRecordField con_like flds_w_tys (L loc (FieldOcc lbl sel_name)) rhs - | Just field_ty <- assocMaybe flds_w_tys field_lbl + | Just field_ty <- assocMaybe flds_w_tys sel_name = addErrCtxt (fieldCtxt field_lbl) $ do { rhs' <- tcPolyExprNC rhs field_ty ; let field_id = mkUserLocal (nameOccName sel_name) diff --git a/testsuite/tests/rename/should_fail/T13847.hs b/testsuite/tests/rename/should_fail/T13847.hs new file mode 100644 index 0000000..09c67de --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13847.hs @@ -0,0 +1,4 @@ +module Main where +import qualified T13847A as A +foo = "foo" +main = print $ A.foo $ A.A { foo = () } diff --git a/testsuite/tests/rename/should_fail/T13847.stderr b/testsuite/tests/rename/should_fail/T13847.stderr new file mode 100644 index 0000000..52edbf5 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13847.stderr @@ -0,0 +1,6 @@ + +T13847.hs:4:24: error: + • Constructor ‘A.A’ does not have field ‘foo’ + • In the second argument of ‘($)’, namely ‘A.A {foo = ()}’ + In the second argument of ‘($)’, namely ‘A.foo $ A.A {foo = ()}’ + In the expression: print $ A.foo $ A.A {foo = ()} diff --git a/testsuite/tests/rename/should_fail/T13847A.hs b/testsuite/tests/rename/should_fail/T13847A.hs new file mode 100644 index 0000000..e3e54a8 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13847A.hs @@ -0,0 +1,2 @@ +module T13847A where +data A = A { foo :: () } diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index a98d127..9feee3d 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -128,3 +128,4 @@ test('T12879', normal, compile_fail, ['']) test('T13644', normal, multimod_compile_fail, ['T13644','-v0']) test('T13568', normal, multimod_compile_fail, ['T13568','-v0']) test('T13947', normal, compile_fail, ['']) +test('T13847', normal, multimod_compile_fail, ['T13847','-v0']) From git at git.haskell.org Tue Sep 19 03:49:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 03:49:34 +0000 (UTC) Subject: [commit: ghc] master: Allow opt+llc from LLVM5 (120c568) Message-ID: <20170919034934.F2E8B3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/120c568a0b400fecde1cd60f665df104785e6d49/ghc >--------------------------------------------------------------- commit 120c568a0b400fecde1cd60f665df104785e6d49 Author: Moritz Angermann Date: Fri Jul 28 14:04:22 2017 +0800 Allow opt+llc from LLVM5 Summary: This bumps our LLVM version requirement to LLVM5, which will likely be released before GHC 8.4. Test Plan: validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3797 >--------------------------------------------------------------- 120c568a0b400fecde1cd60f665df104785e6d49 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8d1a71a..98fffe1 100644 --- a/configure.ac +++ b/configure.ac @@ -627,7 +627,7 @@ AC_SUBST([LibtoolCmd]) # 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=4.0 +LlvmVersion=5.0 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 Tue Sep 19 05:58:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 05:58:08 +0000 (UTC) Subject: [commit: ghc] master: Generalise constraint on `instance Monoid (Maybe a)` to Semigroup (10ca801) Message-ID: <20170919055808.DA2E53A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/10ca8018900364579123bf3912202176d338d3c6/ghc >--------------------------------------------------------------- commit 10ca8018900364579123bf3912202176d338d3c6 Author: Herbert Valerio Riedel Date: Tue Sep 19 07:54:40 2017 +0200 Generalise constraint on `instance Monoid (Maybe a)` to Semigroup This now becomes possible due to the introduction of the Semigroup=>Monoid superclass relation (see #14191). Reviewers: ekmett, RyanGlScott, austin, bgamari Reviewed By: ekmett, RyanGlScott, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3972 >--------------------------------------------------------------- 10ca8018900364579123bf3912202176d338d3c6 libraries/base/GHC/Base.hs | 9 +++++---- libraries/base/changelog.md | 3 +++ testsuite/tests/ghci/scripts/T4175.stdout | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 82b99a8..052f13f 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -413,12 +413,13 @@ instance Semigroup a => Semigroup (Maybe a) where -- | Lift a semigroup into 'Maybe' forming a 'Monoid' according to -- : \"Any semigroup @S@ may be -- turned into a monoid simply by adjoining an element @e@ not in @S@ --- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S at .\" Since --- there used to be no \"Semigroup\" typeclass providing just 'mappend', --- we use 'Monoid' instead. +-- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S at .\" +-- +-- /Since 4.11.0/: constraint on inner @a@ value generalised from +-- 'Monoid' to 'Semigroup'. -- -- @since 2.01 -instance Monoid a => Monoid (Maybe a) where +instance Semigroup a => Monoid (Maybe a) where mempty = Nothing -- | For tuples, the 'Monoid' constraint on @a@ determines diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index eac53ba..f641299 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -14,6 +14,9 @@ export `Semigroup` from `Prelude`; remove `Monoid` reexport from `Data.Semigroup` (#14191). + * Generalise `instance Monoid a => Monoid (Maybe a)` to + `instance Semigroup a => Monoid (Maybe a)`. + * Add `infixl 9 !!` declaration for `Data.List.NonEmpty.!!` * Add `<&>` operator to `Data.Functor` (#14029) diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index 7b630f1..c7421b5 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -34,7 +34,7 @@ instance Applicative Maybe -- Defined in ‘GHC.Base’ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’ instance Functor Maybe -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ -instance Monoid a => Monoid (Maybe a) -- Defined in ‘GHC.Base’ +instance Semigroup a => Monoid (Maybe a) -- Defined in ‘GHC.Base’ instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’ instance Semigroup a => Semigroup (Maybe a) -- Defined in ‘GHC.Base’ From git at git.haskell.org Tue Sep 19 06:37:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 06:37:50 +0000 (UTC) Subject: [commit: ghc] master: Remove redundant/obsolete CPP usage (a2f004b) Message-ID: <20170919063750.329353A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a2f004b68ad4d69fd02be419f7517570baa28a58/ghc >--------------------------------------------------------------- commit a2f004b68ad4d69fd02be419f7517570baa28a58 Author: Herbert Valerio Riedel Date: Tue Sep 19 08:11:50 2017 +0200 Remove redundant/obsolete CPP usage This `#if 0`/`#endif` block has been around for over 10 years and it became truly redundant in 36104d7a0d66df895c8275e3aa7cfe35a322ff04 >--------------------------------------------------------------- a2f004b68ad4d69fd02be419f7517570baa28a58 compiler/main/GHC.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index e02f6b8..9ed8aaa 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -1302,7 +1302,6 @@ pprParenSymName a = parenSymOcc (getOccName a) (ppr (getName a)) -- ---------------------------------------------------------------------------- -#if 0 -- ToDo: -- - Data and Typeable instances for HsSyn. @@ -1316,7 +1315,6 @@ pprParenSymName a = parenSymOcc (getOccName a) (ppr (getName a)) -- :browse will use either lm_toplev or inspect lm_interface, depending -- on whether the module is interpreted or not. -#endif -- Extract the filename, stringbuffer content and dynflags associed to a module -- From git at git.haskell.org Tue Sep 19 11:38:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 11:38:45 +0000 (UTC) Subject: [commit: ghc] master: Fix unused-given-constraint bug (1db0f4a) Message-ID: <20170919113845.AEEF33A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1db0f4a48e9db5e85782e32f074cc83bbc145cb7/ghc >--------------------------------------------------------------- commit 1db0f4a48e9db5e85782e32f074cc83bbc145cb7 Author: Simon Peyton Jones Date: Tue Sep 19 12:37:13 2017 +0100 Fix unused-given-constraint bug This bug was shown up by Trac #14237. It turned out to be an outright error in TcSimplify.neededEvVars, easily fixed. I improved the comments. >--------------------------------------------------------------- 1db0f4a48e9db5e85782e32f074cc83bbc145cb7 compiler/typecheck/TcEvidence.hs | 2 ++ compiler/typecheck/TcSimplify.hs | 15 +++++++++++++-- testsuite/tests/indexed-types/should_compile/T14237.hs | 7 +++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs index 4f305c6..eda4b28 100644 --- a/compiler/typecheck/TcEvidence.hs +++ b/compiler/typecheck/TcEvidence.hs @@ -376,9 +376,11 @@ data EvBindsVar ebv_binds :: IORef EvBindMap, -- The main payload: the value-level evidence bindings -- (dictionaries etc) + -- Some Given, some Wanted ebv_tcvs :: IORef CoVarSet -- The free coercion vars of the (rhss of) the coercion bindings + -- All of these are Wanted -- -- Coercions don't actually have bindings -- because we plug them in-place (via a mutable diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 1d28eee..60d8f62 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -1559,11 +1559,22 @@ neededEvVars :: (EvBindMap, TcTyVarSet) -> VarSet -> VarSet -- Find all the evidence variables that are "needed", -- and then delete all those bound by the evidence bindings -- See Note [Tracking redundant constraints] +-- +-- - Start from initial_seeds (from nested implications) +-- - Add free vars of RHS of all Wanted evidence bindings +-- and coercion variables accumulated in tcvs (all Wanted) +-- - Do transitive closure through Given bindings +-- e.g. Neede {a,b} +-- Given a = sc_sel a2 +-- Then a2 is needed too +-- - Finally delete all the binders of the evidence bindings +-- neededEvVars (ev_binds, tcvs) initial_seeds - = (needed `unionVarSet` tcvs) `minusVarSet` bndrs + = needed `minusVarSet` bndrs where - seeds = foldEvBindMap add_wanted initial_seeds ev_binds needed = transCloVarSet also_needs seeds + seeds = foldEvBindMap add_wanted initial_seeds ev_binds + `unionVarSet` tcvs bndrs = foldEvBindMap add_bndr emptyVarSet ev_binds add_wanted :: EvBind -> VarSet -> VarSet diff --git a/testsuite/tests/indexed-types/should_compile/T14237.hs b/testsuite/tests/indexed-types/should_compile/T14237.hs new file mode 100644 index 0000000..cab9fd2 --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/T14237.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -fwarn-redundant-constraints #-} + +module T14237 where + +f :: (Integer ~ a) => a -> Integer +f = (+ 1) diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T index 67ee1b7..6407324 100644 --- a/testsuite/tests/indexed-types/should_compile/all.T +++ b/testsuite/tests/indexed-types/should_compile/all.T @@ -270,3 +270,4 @@ test('T14045', normal, compile, ['']) test('T12938', normal, compile, ['']) test('T14131', normal, compile, ['']) test('T14162', normal, compile, ['']) +test('T14237', normal, compile, ['']) From git at git.haskell.org Tue Sep 19 17:43:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 17:43:37 +0000 (UTC) Subject: [commit: ghc] master: OccurAnal: Ensure SourceNotes don't interfere with join-point analysis (12a92fe) Message-ID: <20170919174337.94EF43A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12a92fedf8b1997f2e26800929be117d54536b7e/ghc >--------------------------------------------------------------- commit 12a92fedf8b1997f2e26800929be117d54536b7e Author: Ben Gamari Date: Tue Sep 19 11:16:55 2017 -0400 OccurAnal: Ensure SourceNotes don't interfere with join-point analysis In general ticks are problematic for join point analysis as described in #14242. However, source notes are intended to be a best-effort annotation which shouldn't interfere with optimization. Special-case these to ensure that tail-call information is still correct, even in the presence of source note ticks. Test Plan: Validate Reviewers: simonpj, austin Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #14242 Differential Revision: https://phabricator.haskell.org/D3978 >--------------------------------------------------------------- 12a92fedf8b1997f2e26800929be117d54536b7e compiler/simplCore/OccurAnal.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index dace6a0..0c237ca 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1723,6 +1723,12 @@ we can sort them into the right place when doing dependency analysis. -} occAnal env (Tick tickish body) + | SourceNote{} <- tickish + = (usage, Tick tickish body') + -- SourceNotes are best-effort; so we just proceed as usual. + -- If we drop a tick due to the issues described below it's + -- not the end of the world. + | tickish `tickishScopesLike` SoftScope = (markAllNonTailCalled usage, Tick tickish body') @@ -1742,6 +1748,7 @@ occAnal env (Tick tickish body) -- Making j a join point may cause the simplifier to drop t -- (if the tick is put into the continuation). So we don't -- count j 1 as a tail call. + -- See #14242. occAnal env (Cast expr co) = case occAnal env expr of { (usage, expr') -> From git at git.haskell.org Tue Sep 19 17:43:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 17:43:40 +0000 (UTC) Subject: [commit: ghc] master: rts/RetainerProfile: Adding missing closure types to isRetainer (6252292) Message-ID: <20170919174340.56FE73A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6252292d4f4061f6e55c7f92a399160147c4ca74/ghc >--------------------------------------------------------------- commit 6252292d4f4061f6e55c7f92a399160147c4ca74 Author: Ben Gamari Date: Tue Sep 19 09:51:01 2017 -0400 rts/RetainerProfile: Adding missing closure types to isRetainer orzo in `#ghc` reported seeing a crash due to the retainer profiler encountering a BLOCKING_QUEUE closure, which isRetainer didn't know about. I performed an audit to make sure that all of the valid closure types were listed; they weren't. This is my guess of how they should appear. Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14235 Differential Revision: https://phabricator.haskell.org/D3967 >--------------------------------------------------------------- 6252292d4f4061f6e55c7f92a399160147c4ca74 includes/rts/storage/ClosureTypes.h | 5 +++-- rts/RetainerProfile.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/includes/rts/storage/ClosureTypes.h b/includes/rts/storage/ClosureTypes.h index 68cc919..240982c 100644 --- a/includes/rts/storage/ClosureTypes.h +++ b/includes/rts/storage/ClosureTypes.h @@ -12,8 +12,9 @@ /* * WARNING WARNING WARNING * - * If you add or delete any closure types, don't forget to update - * the closure flags table in rts/ClosureFlags.c. + * If you add or delete any closure types, don't forget to update the following, + * - the closure flags table in rts/ClosureFlags.c + * - isRetainer in rts/RetainerProfile.c */ /* Object tag 0 raises an internal error */ diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 1d5e923..7a9b9cc 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -33,6 +33,18 @@ #include "Stable.h" /* markStableTables */ #include "sm/Storage.h" // for END_OF_STATIC_LIST +/* Note [What is a retainer?] + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +The definition of what sorts of things are counted as retainers is a bit hard to +pin down. Intuitively, we want to identify closures which will help the user +identify memory leaks due to thunks. In practice we also end up lumping mutable +objects in this group for reasons that have been lost to time. + +The definition of retainer is implemented in isRetainer(), defined later in this +file. +*/ + + /* Note: what to change in order to plug-in a new retainer profiling scheme? (1) type retainer in ../includes/StgRetainerProf.h @@ -1022,6 +1034,9 @@ isRetainer( StgClosure *c ) case MUT_VAR_DIRTY: case MUT_ARR_PTRS_CLEAN: case MUT_ARR_PTRS_DIRTY: + case SMALL_MUT_ARR_PTRS_CLEAN: + case SMALL_MUT_ARR_PTRS_DIRTY: + case BLOCKING_QUEUE: // thunks are retainers. case THUNK: @@ -1069,17 +1084,21 @@ isRetainer( StgClosure *c ) // closures. See trac #3956 for a program that hit this error. case IND_STATIC: case BLACKHOLE: + case WHITEHOLE: // static objects case FUN_STATIC: // misc case PRIM: case BCO: case ARR_WORDS: + case COMPACT_NFDATA: // STM case TREC_CHUNK: // immutable arrays case MUT_ARR_PTRS_FROZEN: case MUT_ARR_PTRS_FROZEN0: + case SMALL_MUT_ARR_PTRS_FROZEN: + case SMALL_MUT_ARR_PTRS_FROZEN0: return false; // @@ -1089,11 +1108,15 @@ isRetainer( StgClosure *c ) // legal objects during retainer profiling. case UPDATE_FRAME: case CATCH_FRAME: + case CATCH_RETRY_FRAME: + case CATCH_STM_FRAME: case UNDERFLOW_FRAME: + case ATOMICALLY_FRAME: case STOP_FRAME: case RET_BCO: case RET_SMALL: case RET_BIG: + case RET_FUN: // other cases case IND: case INVALID_OBJECT: From git at git.haskell.org Tue Sep 19 17:43:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 17:43:43 +0000 (UTC) Subject: [commit: ghc] master: nativeGen: Consistently use blockLbl to generate CLabels from BlockIds (8b007ab) Message-ID: <20170919174343.1FFB43A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8b007abbeb3045900a11529d907a835080129176/ghc >--------------------------------------------------------------- commit 8b007abbeb3045900a11529d907a835080129176 Author: Ben Gamari Date: Tue Sep 19 10:58:36 2017 -0400 nativeGen: Consistently use blockLbl to generate CLabels from BlockIds This fixes #14221, where the NCG and the DWARF code were apparently giving two different names to the same block. Test Plan: Validate with DWARF support enabled. Reviewers: simonmar, austin Subscribers: rwbarton, thomie GHC Trac Issues: #14221 Differential Revision: https://phabricator.haskell.org/D3977 >--------------------------------------------------------------- 8b007abbeb3045900a11529d907a835080129176 compiler/cmm/BlockId.hs | 2 +- compiler/nativeGen/PPC/CodeGen.hs | 5 ++--- compiler/nativeGen/PPC/Ppr.hs | 9 +++++---- compiler/nativeGen/SPARC/CodeGen.hs | 3 +-- compiler/nativeGen/SPARC/Ppr.hs | 9 +++++---- compiler/nativeGen/SPARC/ShortcutJump.hs | 4 +--- compiler/nativeGen/X86/CodeGen.hs | 5 ++--- compiler/nativeGen/X86/Ppr.hs | 7 ++++--- 8 files changed, 21 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 8b007abbeb3045900a11529d907a835080129176 From git at git.haskell.org Tue Sep 19 19:05:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 19:05:46 +0000 (UTC) Subject: [commit: ghc] master: compiler: introduce custom "GhcPrelude" Prelude (f63bc73) Message-ID: <20170919190546.AEFAB3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad/ghc >--------------------------------------------------------------- commit f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad Author: Herbert Valerio Riedel Date: Tue Sep 19 14:35:36 2017 -0400 compiler: introduce custom "GhcPrelude" Prelude This switches the compiler/ component to get compiled with -XNoImplicitPrelude and a `import GhcPrelude` is inserted in all modules. This is motivated by the upcoming "Prelude" re-export of `Semigroup((<>))` which would cause lots of name clashes in every modulewhich imports also `Outputable` Reviewers: austin, goldfire, bgamari, alanz, simonmar Reviewed By: bgamari Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari Differential Revision: https://phabricator.haskell.org/D3989 >--------------------------------------------------------------- f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad compiler/backpack/BkpSyn.hs | 2 ++ compiler/backpack/DriverBkp.hs | 2 ++ compiler/backpack/NameShape.hs | 2 ++ compiler/backpack/RnModIface.hs | 2 ++ compiler/basicTypes/Avail.hs | 2 ++ compiler/basicTypes/BasicTypes.hs | 2 ++ compiler/basicTypes/ConLike.hs | 2 ++ compiler/basicTypes/DataCon.hs | 2 ++ compiler/basicTypes/DataCon.hs-boot | 2 ++ compiler/basicTypes/Demand.hs | 2 ++ compiler/basicTypes/FieldLabel.hs | 2 ++ compiler/basicTypes/Id.hs | 2 ++ compiler/basicTypes/IdInfo.hs | 2 ++ compiler/basicTypes/IdInfo.hs-boot | 1 + compiler/basicTypes/Lexeme.hs | 2 ++ compiler/basicTypes/Literal.hs | 2 ++ compiler/basicTypes/MkId.hs | 2 ++ compiler/basicTypes/Module.hs | 2 ++ compiler/basicTypes/Module.hs-boot | 2 ++ compiler/basicTypes/Name.hs | 2 ++ compiler/basicTypes/Name.hs-boot | 2 ++ compiler/basicTypes/NameCache.hs | 2 ++ compiler/basicTypes/NameEnv.hs | 2 ++ compiler/basicTypes/NameSet.hs | 2 ++ compiler/basicTypes/OccName.hs | 2 ++ compiler/basicTypes/OccName.hs-boot | 2 ++ compiler/basicTypes/PatSyn.hs | 2 ++ compiler/basicTypes/RdrName.hs | 2 ++ compiler/basicTypes/SrcLoc.hs | 2 ++ compiler/basicTypes/UniqSupply.hs | 2 ++ compiler/basicTypes/Unique.hs | 2 ++ compiler/basicTypes/Var.hs | 2 ++ compiler/basicTypes/VarEnv.hs | 2 ++ compiler/basicTypes/VarSet.hs | 2 ++ compiler/cmm/Bitmap.hs | 2 ++ compiler/cmm/BlockId.hs | 2 ++ compiler/cmm/CLabel.hs | 2 ++ compiler/cmm/Cmm.hs | 2 ++ compiler/cmm/CmmBuildInfoTables.hs | 7 +++---- compiler/cmm/CmmCallConv.hs | 2 ++ compiler/cmm/CmmCommonBlockElim.hs | 3 ++- compiler/cmm/CmmContFlowOpt.hs | 3 ++- compiler/cmm/CmmExpr.hs | 2 ++ compiler/cmm/CmmImplementSwitchPlans.hs | 2 ++ compiler/cmm/CmmInfo.hs | 2 ++ compiler/cmm/CmmLayoutStack.hs | 4 ++-- compiler/cmm/CmmLex.x | 2 ++ compiler/cmm/CmmLint.hs | 2 ++ compiler/cmm/CmmLive.hs | 2 ++ compiler/cmm/CmmMachOp.hs | 2 ++ compiler/cmm/CmmMonad.hs | 2 ++ compiler/cmm/CmmNode.hs | 3 ++- compiler/cmm/CmmOpt.hs | 2 ++ compiler/cmm/CmmParse.y | 2 ++ compiler/cmm/CmmPipeline.hs | 2 ++ compiler/cmm/CmmProcPoint.hs | 2 +- compiler/cmm/CmmSink.hs | 2 ++ compiler/cmm/CmmSwitch.hs | 2 ++ compiler/cmm/CmmType.hs | 2 ++ compiler/cmm/CmmUtils.hs | 2 ++ compiler/cmm/Debug.hs | 2 ++ compiler/cmm/Hoopl/Block.hs | 1 + compiler/cmm/Hoopl/Collections.hs | 2 ++ compiler/cmm/Hoopl/Dataflow.hs | 2 ++ compiler/cmm/Hoopl/Graph.hs | 2 ++ compiler/cmm/Hoopl/Label.hs | 2 ++ compiler/cmm/Hoopl/Unique.hs | 2 ++ compiler/cmm/MkGraph.hs | 3 ++- compiler/cmm/PprC.hs | 2 ++ compiler/cmm/PprCmm.hs | 4 ++-- compiler/cmm/PprCmmDecl.hs | 2 ++ compiler/cmm/PprCmmExpr.hs | 2 ++ compiler/cmm/SMRep.hs | 2 ++ compiler/codeGen/CgUtils.hs | 2 ++ compiler/codeGen/CodeGen/Platform.hs | 2 ++ compiler/codeGen/CodeGen/Platform/ARM.hs | 2 ++ compiler/codeGen/CodeGen/Platform/ARM64.hs | 2 ++ compiler/codeGen/CodeGen/Platform/NoRegs.hs | 2 ++ compiler/codeGen/CodeGen/Platform/PPC.hs | 2 ++ compiler/codeGen/CodeGen/Platform/PPC_Darwin.hs | 2 ++ compiler/codeGen/CodeGen/Platform/SPARC.hs | 2 ++ compiler/codeGen/CodeGen/Platform/X86.hs | 2 ++ compiler/codeGen/CodeGen/Platform/X86_64.hs | 2 ++ compiler/codeGen/StgCmm.hs | 2 ++ compiler/codeGen/StgCmmArgRep.hs | 2 ++ compiler/codeGen/StgCmmBind.hs | 4 ++-- compiler/codeGen/StgCmmClosure.hs | 2 ++ compiler/codeGen/StgCmmCon.hs | 2 ++ compiler/codeGen/StgCmmEnv.hs | 2 ++ compiler/codeGen/StgCmmExpr.hs | 4 ++-- compiler/codeGen/StgCmmExtCode.hs | 2 ++ compiler/codeGen/StgCmmForeign.hs | 4 ++-- compiler/codeGen/StgCmmHeap.hs | 4 ++-- compiler/codeGen/StgCmmHpc.hs | 2 ++ compiler/codeGen/StgCmmLayout.hs | 2 +- compiler/codeGen/StgCmmMonad.hs | 4 ++-- compiler/codeGen/StgCmmPrim.hs | 4 ++-- compiler/codeGen/StgCmmProf.hs | 2 ++ compiler/codeGen/StgCmmTicky.hs | 2 ++ compiler/codeGen/StgCmmUtils.hs | 2 ++ compiler/coreSyn/CoreArity.hs | 2 ++ compiler/coreSyn/CoreFVs.hs | 2 ++ compiler/coreSyn/CoreLint.hs | 2 ++ compiler/coreSyn/CoreOpt.hs | 2 ++ compiler/coreSyn/CorePrep.hs | 2 ++ compiler/coreSyn/CoreSeq.hs | 2 ++ compiler/coreSyn/CoreStats.hs | 2 ++ compiler/coreSyn/CoreSubst.hs | 2 ++ compiler/coreSyn/CoreSyn.hs | 2 ++ compiler/coreSyn/CoreTidy.hs | 2 ++ compiler/coreSyn/CoreUnfold.hs | 2 ++ compiler/coreSyn/CoreUtils.hs | 2 ++ compiler/coreSyn/MkCore.hs | 2 ++ compiler/coreSyn/PprCore.hs | 2 ++ compiler/coreSyn/TrieMap.hs | 2 ++ compiler/deSugar/Check.hs | 2 ++ compiler/deSugar/Coverage.hs | 2 ++ compiler/deSugar/Desugar.hs | 2 ++ compiler/deSugar/DsArrows.hs | 2 ++ compiler/deSugar/DsBinds.hs | 2 ++ compiler/deSugar/DsCCall.hs | 2 ++ compiler/deSugar/DsExpr.hs | 2 ++ compiler/deSugar/DsForeign.hs | 2 ++ compiler/deSugar/DsGRHSs.hs | 2 ++ compiler/deSugar/DsListComp.hs | 2 ++ compiler/deSugar/DsMeta.hs | 2 ++ compiler/deSugar/DsMonad.hs | 2 ++ compiler/deSugar/DsUsage.hs | 2 ++ compiler/deSugar/DsUtils.hs | 2 ++ compiler/deSugar/Match.hs | 2 ++ compiler/deSugar/Match.hs-boot | 2 ++ compiler/deSugar/MatchCon.hs | 2 ++ compiler/deSugar/MatchLit.hs | 2 ++ compiler/deSugar/PmExpr.hs | 2 ++ compiler/deSugar/TmOracle.hs | 2 ++ compiler/ghc.cabal.in | 7 +++++++ compiler/ghc.mk | 2 ++ compiler/ghci/ByteCodeAsm.hs | 2 ++ compiler/ghci/ByteCodeGen.hs | 2 ++ compiler/ghci/ByteCodeInstr.hs | 2 ++ compiler/ghci/ByteCodeItbls.hs | 2 ++ compiler/ghci/ByteCodeLink.hs | 2 ++ compiler/ghci/ByteCodeTypes.hs | 2 ++ compiler/ghci/Debugger.hs | 2 ++ compiler/ghci/DebuggerUtils.hs | 2 ++ compiler/ghci/GHCi.hs | 2 ++ compiler/ghci/Linker.hs | 2 ++ compiler/ghci/RtClosureInspect.hs | 2 ++ compiler/hsSyn/Convert.hs | 2 ++ compiler/hsSyn/HsBinds.hs | 2 ++ compiler/hsSyn/HsDecls.hs | 2 ++ compiler/hsSyn/HsDoc.hs | 2 ++ compiler/hsSyn/HsDumpAst.hs | 2 ++ compiler/hsSyn/HsExpr.hs | 2 ++ compiler/hsSyn/HsExtension.hs | 2 ++ compiler/hsSyn/HsImpExp.hs | 2 ++ compiler/hsSyn/HsLit.hs | 2 ++ compiler/hsSyn/HsPat.hs | 2 ++ compiler/hsSyn/HsSyn.hs | 2 ++ compiler/hsSyn/HsTypes.hs | 2 ++ compiler/hsSyn/HsUtils.hs | 2 ++ compiler/hsSyn/PlaceHolder.hs | 2 ++ compiler/iface/BinFingerprint.hs | 2 ++ compiler/iface/BinIface.hs | 2 ++ compiler/iface/BuildTyCl.hs | 2 ++ compiler/iface/FlagChecker.hs | 2 ++ compiler/iface/IfaceEnv.hs | 2 ++ compiler/iface/IfaceSyn.hs | 2 ++ compiler/iface/IfaceType.hs | 2 ++ compiler/iface/LoadIface.hs | 2 ++ compiler/iface/MkIface.hs | 2 ++ compiler/iface/TcIface.hs | 2 ++ compiler/iface/TcIface.hs-boot | 1 + compiler/iface/ToIface.hs | 2 ++ compiler/llvmGen/Llvm/AbsSyn.hs | 2 ++ compiler/llvmGen/Llvm/MetaData.hs | 2 ++ compiler/llvmGen/Llvm/PpLlvm.hs | 2 ++ compiler/llvmGen/Llvm/Types.hs | 2 ++ compiler/llvmGen/LlvmCodeGen.hs | 2 ++ compiler/llvmGen/LlvmCodeGen/Base.hs | 2 ++ compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 ++ compiler/llvmGen/LlvmCodeGen/Data.hs | 2 ++ compiler/llvmGen/LlvmCodeGen/Ppr.hs | 2 ++ compiler/llvmGen/LlvmCodeGen/Regs.hs | 2 ++ compiler/llvmGen/LlvmMangler.hs | 2 ++ compiler/main/Annotations.hs | 2 ++ compiler/main/Ar.hs | 2 ++ compiler/main/CmdLineParser.hs | 2 ++ compiler/main/CodeOutput.hs | 2 ++ compiler/main/Constants.hs | 2 ++ compiler/main/DriverMkDepend.hs | 2 ++ compiler/main/DriverPhases.hs | 2 ++ compiler/main/DriverPipeline.hs | 2 ++ compiler/main/DynFlags.hs | 2 ++ compiler/main/DynFlags.hs-boot | 2 +- compiler/main/DynamicLoading.hs | 2 ++ compiler/main/Elf.hs | 2 ++ compiler/main/ErrUtils.hs | 2 ++ compiler/main/ErrUtils.hs-boot | 1 + compiler/main/FileCleanup.hs | 2 ++ compiler/main/Finder.hs | 2 ++ compiler/main/GHC.hs | 4 ++-- compiler/main/GhcMake.hs | 2 ++ compiler/main/GhcMonad.hs | 2 ++ compiler/main/HeaderInfo.hs | 2 ++ compiler/main/Hooks.hs | 2 ++ compiler/main/Hooks.hs-boot | 2 ++ compiler/main/HscMain.hs | 2 ++ compiler/main/HscStats.hs | 2 ++ compiler/main/HscTypes.hs | 2 ++ compiler/main/InteractiveEval.hs | 2 ++ compiler/main/InteractiveEvalTypes.hs | 2 ++ compiler/main/PackageConfig.hs | 2 ++ compiler/main/Packages.hs | 2 ++ compiler/main/Packages.hs-boot | 1 + compiler/main/PipelineMonad.hs | 2 ++ compiler/main/PlatformConstants.hs | 2 ++ compiler/main/Plugins.hs | 2 ++ compiler/main/PprTyThing.hs | 2 ++ compiler/main/StaticPtrTable.hs | 2 ++ compiler/main/SysTools.hs | 2 ++ compiler/main/SysTools/Terminal.hs | 2 ++ compiler/main/TidyPgm.hs | 2 ++ compiler/nativeGen/AsmCodeGen.hs | 2 ++ compiler/nativeGen/CPrim.hs | 2 ++ compiler/nativeGen/Dwarf.hs | 2 ++ compiler/nativeGen/Dwarf/Constants.hs | 2 ++ compiler/nativeGen/Dwarf/Types.hs | 2 ++ compiler/nativeGen/Format.hs | 2 ++ compiler/nativeGen/Instruction.hs | 2 ++ compiler/nativeGen/NCGMonad.hs | 2 ++ compiler/nativeGen/PIC.hs | 2 ++ compiler/nativeGen/PPC/CodeGen.hs | 2 ++ compiler/nativeGen/PPC/Cond.hs | 2 ++ compiler/nativeGen/PPC/Instr.hs | 2 ++ compiler/nativeGen/PPC/Ppr.hs | 2 ++ compiler/nativeGen/PPC/RegInfo.hs | 2 ++ compiler/nativeGen/PPC/Regs.hs | 2 ++ compiler/nativeGen/PprBase.hs | 2 ++ compiler/nativeGen/Reg.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/ArchBase.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/ArchX86.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/Coalesce.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/Main.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/Spill.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/SpillCost.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/Stats.hs | 2 ++ compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/Base.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/Main.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/PPC/FreeRegs.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/SPARC/FreeRegs.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/StackMap.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/State.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/Stats.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/X86/FreeRegs.hs | 2 ++ compiler/nativeGen/RegAlloc/Linear/X86_64/FreeRegs.hs | 2 ++ compiler/nativeGen/RegAlloc/Liveness.hs | 2 ++ compiler/nativeGen/RegClass.hs | 2 ++ compiler/nativeGen/SPARC/AddrMode.hs | 2 ++ compiler/nativeGen/SPARC/Base.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/Amode.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/Base.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/CondCode.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/Expand.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/Gen32.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/Gen64.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen/Sanity.hs | 2 ++ compiler/nativeGen/SPARC/Cond.hs | 2 ++ compiler/nativeGen/SPARC/Imm.hs | 2 ++ compiler/nativeGen/SPARC/Instr.hs | 2 ++ compiler/nativeGen/SPARC/Ppr.hs | 2 ++ compiler/nativeGen/SPARC/Regs.hs | 2 ++ compiler/nativeGen/SPARC/ShortcutJump.hs | 2 ++ compiler/nativeGen/SPARC/Stack.hs | 2 ++ compiler/nativeGen/TargetReg.hs | 2 ++ compiler/nativeGen/X86/CodeGen.hs | 2 ++ compiler/nativeGen/X86/Cond.hs | 2 ++ compiler/nativeGen/X86/Instr.hs | 2 ++ compiler/nativeGen/X86/Ppr.hs | 2 ++ compiler/nativeGen/X86/RegInfo.hs | 2 ++ compiler/nativeGen/X86/Regs.hs | 2 ++ compiler/parser/ApiAnnotation.hs | 2 ++ compiler/parser/Ctype.hs | 2 ++ compiler/parser/HaddockUtils.hs | 2 ++ compiler/parser/Lexer.x | 2 ++ compiler/parser/Parser.y | 2 +- compiler/parser/RdrHsSyn.hs | 2 ++ compiler/prelude/ForeignCall.hs | 2 ++ compiler/prelude/KnownUniques.hs | 2 ++ compiler/prelude/KnownUniques.hs-boot | 1 + compiler/prelude/PrelInfo.hs | 2 ++ compiler/prelude/PrelNames.hs | 2 ++ compiler/prelude/PrelRules.hs | 2 ++ compiler/prelude/PrimOp.hs | 2 ++ compiler/prelude/PrimOp.hs-boot | 2 ++ compiler/prelude/THNames.hs | 2 ++ compiler/prelude/TysPrim.hs | 2 ++ compiler/prelude/TysWiredIn.hs | 2 ++ compiler/profiling/CostCentre.hs | 2 ++ compiler/profiling/ProfInit.hs | 2 ++ compiler/profiling/SCCfinal.hs | 2 ++ compiler/rename/RnBinds.hs | 2 ++ compiler/rename/RnEnv.hs | 2 ++ compiler/rename/RnExpr.hs | 2 ++ compiler/rename/RnFixity.hs | 2 ++ compiler/rename/RnHsDoc.hs | 2 ++ compiler/rename/RnNames.hs | 2 ++ compiler/rename/RnPat.hs | 2 ++ compiler/rename/RnSource.hs | 2 ++ compiler/rename/RnSplice.hs | 2 ++ compiler/rename/RnSplice.hs-boot | 1 + compiler/rename/RnTypes.hs | 2 ++ compiler/rename/RnUnbound.hs | 2 ++ compiler/rename/RnUtils.hs | 2 ++ compiler/simplCore/CSE.hs | 2 ++ compiler/simplCore/CallArity.hs | 2 ++ compiler/simplCore/CoreMonad.hs | 5 ++--- compiler/simplCore/FloatIn.hs | 2 ++ compiler/simplCore/FloatOut.hs | 2 ++ compiler/simplCore/LiberateCase.hs | 2 ++ compiler/simplCore/OccurAnal.hs | 2 ++ compiler/simplCore/SAT.hs | 2 ++ compiler/simplCore/SetLevels.hs | 2 ++ compiler/simplCore/SimplCore.hs | 2 ++ compiler/simplCore/SimplEnv.hs | 2 ++ compiler/simplCore/SimplMonad.hs | 2 ++ compiler/simplCore/SimplUtils.hs | 2 ++ compiler/simplCore/Simplify.hs | 2 ++ compiler/simplStg/RepType.hs | 2 ++ compiler/simplStg/SimplStg.hs | 2 ++ compiler/simplStg/StgCse.hs | 2 ++ compiler/simplStg/StgStats.hs | 2 ++ compiler/simplStg/UnariseStg.hs | 2 ++ compiler/specialise/Rules.hs | 2 ++ compiler/specialise/SpecConstr.hs | 2 ++ compiler/specialise/Specialise.hs | 2 ++ compiler/stgSyn/CoreToStg.hs | 2 ++ compiler/stgSyn/StgLint.hs | 2 ++ compiler/stgSyn/StgSyn.hs | 2 ++ compiler/stranal/DmdAnal.hs | 2 ++ compiler/stranal/WorkWrap.hs | 2 ++ compiler/stranal/WwLib.hs | 2 ++ compiler/typecheck/FamInst.hs | 2 ++ compiler/typecheck/FunDeps.hs | 2 ++ compiler/typecheck/Inst.hs | 2 ++ compiler/typecheck/TcAnnotations.hs | 2 ++ compiler/typecheck/TcArrows.hs | 2 ++ compiler/typecheck/TcBackpack.hs | 2 ++ compiler/typecheck/TcBinds.hs | 2 ++ compiler/typecheck/TcCanonical.hs | 2 ++ compiler/typecheck/TcClassDcl.hs | 2 ++ compiler/typecheck/TcDefaults.hs | 2 ++ compiler/typecheck/TcDeriv.hs | 2 ++ compiler/typecheck/TcDerivInfer.hs | 2 ++ compiler/typecheck/TcDerivUtils.hs | 2 ++ compiler/typecheck/TcEnv.hs | 2 ++ compiler/typecheck/TcErrors.hs | 2 ++ compiler/typecheck/TcEvidence.hs | 2 ++ compiler/typecheck/TcExpr.hs | 2 ++ compiler/typecheck/TcFlatten.hs | 2 ++ compiler/typecheck/TcForeign.hs | 2 ++ compiler/typecheck/TcGenDeriv.hs | 2 ++ compiler/typecheck/TcGenFunctor.hs | 2 ++ compiler/typecheck/TcGenGenerics.hs | 2 ++ compiler/typecheck/TcHsSyn.hs | 2 ++ compiler/typecheck/TcHsType.hs | 2 ++ compiler/typecheck/TcInstDcls.hs | 2 ++ compiler/typecheck/TcInteract.hs | 2 ++ compiler/typecheck/TcMType.hs | 2 ++ compiler/typecheck/TcMatches.hs | 2 ++ compiler/typecheck/TcPat.hs | 2 ++ compiler/typecheck/TcPatSyn.hs | 2 ++ compiler/typecheck/TcPluginM.hs | 2 ++ compiler/typecheck/TcRnDriver.hs | 2 ++ compiler/typecheck/TcRnDriver.hs-boot | 1 + compiler/typecheck/TcRnExports.hs | 2 ++ compiler/typecheck/TcRnMonad.hs | 2 ++ compiler/typecheck/TcRnTypes.hs | 2 ++ compiler/typecheck/TcRules.hs | 2 ++ compiler/typecheck/TcSMonad.hs | 2 ++ compiler/typecheck/TcSigs.hs | 2 ++ compiler/typecheck/TcSimplify.hs | 2 ++ compiler/typecheck/TcSplice.hs | 2 ++ compiler/typecheck/TcSplice.hs-boot | 2 ++ compiler/typecheck/TcTyClsDecls.hs | 2 ++ compiler/typecheck/TcTyDecls.hs | 2 ++ compiler/typecheck/TcType.hs | 2 ++ compiler/typecheck/TcTypeNats.hs | 2 ++ compiler/typecheck/TcTypeable.hs | 2 ++ compiler/typecheck/TcUnify.hs | 2 ++ compiler/typecheck/TcUnify.hs-boot | 2 ++ compiler/typecheck/TcValidity.hs | 2 ++ compiler/types/Class.hs | 2 ++ compiler/types/CoAxiom.hs | 2 ++ compiler/types/Coercion.hs | 2 ++ compiler/types/Coercion.hs-boot | 2 ++ compiler/types/FamInstEnv.hs | 2 ++ compiler/types/InstEnv.hs | 2 ++ compiler/types/Kind.hs | 2 ++ compiler/types/OptCoercion.hs | 2 ++ compiler/types/TyCoRep.hs | 2 ++ compiler/types/TyCon.hs | 2 ++ compiler/types/TyCon.hs-boot | 2 ++ compiler/types/Type.hs | 2 ++ compiler/types/Type.hs-boot | 2 ++ compiler/types/Unify.hs | 2 ++ compiler/utils/AsmUtils.hs | 2 ++ compiler/utils/Bag.hs | 2 ++ compiler/utils/Binary.hs | 2 ++ compiler/utils/BooleanFormula.hs | 2 ++ compiler/utils/BufWrite.hs | 2 ++ compiler/utils/Digraph.hs | 2 ++ compiler/utils/Encoding.hs | 2 ++ compiler/utils/EnumSet.hs | 2 ++ compiler/utils/Exception.hs | 2 ++ compiler/utils/FV.hs | 2 ++ compiler/utils/FastFunctions.hs | 2 ++ compiler/utils/FastMutInt.hs | 2 ++ compiler/utils/FastString.hs | 2 ++ compiler/utils/FastStringEnv.hs | 2 ++ compiler/utils/Fingerprint.hsc | 2 ++ compiler/utils/FiniteMap.hs | 2 ++ compiler/utils/GhcPrelude.hs | 9 +++++++++ compiler/utils/GraphBase.hs | 2 ++ compiler/utils/GraphColor.hs | 2 ++ compiler/utils/GraphOps.hs | 2 ++ compiler/utils/GraphPpr.hs | 2 ++ compiler/utils/IOEnv.hs | 2 ++ compiler/utils/Json.hs | 2 ++ compiler/utils/ListSetOps.hs | 2 ++ compiler/utils/ListT.hs | 2 ++ compiler/utils/Maybes.hs | 2 ++ compiler/utils/MonadUtils.hs | 2 ++ compiler/utils/OrdList.hs | 2 ++ compiler/utils/Outputable.hs | 2 ++ compiler/utils/Outputable.hs-boot | 2 ++ compiler/utils/Pair.hs | 2 ++ compiler/utils/Panic.hs | 2 ++ compiler/utils/Platform.hs | 2 ++ compiler/utils/PprColour.hs | 2 ++ compiler/utils/Pretty.hs | 3 ++- compiler/utils/State.hs | 2 ++ compiler/utils/Stream.hs | 2 ++ compiler/utils/StringBuffer.hs | 2 ++ compiler/utils/UnVarGraph.hs | 2 ++ compiler/utils/UniqDFM.hs | 2 ++ compiler/utils/UniqDSet.hs | 2 ++ compiler/utils/UniqFM.hs | 2 ++ compiler/utils/UniqMap.hs | 2 ++ compiler/utils/UniqSet.hs | 2 ++ compiler/utils/Util.hs | 2 ++ compiler/vectorise/Vectorise.hs | 2 ++ compiler/vectorise/Vectorise/Builtins/Base.hs | 2 ++ compiler/vectorise/Vectorise/Builtins/Initialise.hs | 2 ++ compiler/vectorise/Vectorise/Convert.hs | 5 ++--- compiler/vectorise/Vectorise/Env.hs | 2 ++ compiler/vectorise/Vectorise/Exp.hs | 2 ++ compiler/vectorise/Vectorise/Generic/Description.hs | 2 ++ compiler/vectorise/Vectorise/Generic/PADict.hs | 2 ++ compiler/vectorise/Vectorise/Generic/PAMethods.hs | 2 ++ compiler/vectorise/Vectorise/Generic/PData.hs | 2 ++ compiler/vectorise/Vectorise/Monad.hs | 2 ++ compiler/vectorise/Vectorise/Monad/Base.hs | 2 ++ compiler/vectorise/Vectorise/Monad/Global.hs | 2 ++ compiler/vectorise/Vectorise/Monad/InstEnv.hs | 2 ++ compiler/vectorise/Vectorise/Monad/Local.hs | 2 ++ compiler/vectorise/Vectorise/Monad/Naming.hs | 2 ++ compiler/vectorise/Vectorise/Type/Classify.hs | 2 ++ compiler/vectorise/Vectorise/Type/Env.hs | 2 ++ compiler/vectorise/Vectorise/Type/TyConDecl.hs | 2 ++ compiler/vectorise/Vectorise/Type/Type.hs | 4 ++-- compiler/vectorise/Vectorise/Utils.hs | 2 ++ compiler/vectorise/Vectorise/Utils/Base.hs | 2 ++ compiler/vectorise/Vectorise/Utils/Closure.hs | 2 ++ compiler/vectorise/Vectorise/Utils/Hoisting.hs | 4 ++-- compiler/vectorise/Vectorise/Utils/PADict.hs | 2 ++ compiler/vectorise/Vectorise/Utils/Poly.hs | 2 ++ compiler/vectorise/Vectorise/Var.hs | 4 ++-- compiler/vectorise/Vectorise/Vect.hs | 2 ++ 484 files changed, 969 insertions(+), 43 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad From git at git.haskell.org Tue Sep 19 20:03:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 20:03:26 +0000 (UTC) Subject: [commit: ghc] master: Fix Windows build regression due to GhcPrelude change (7c7914d) Message-ID: <20170919200326.5E5223A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c7914d02a7ff189aba2f4feca31366fb4ab2664/ghc >--------------------------------------------------------------- commit 7c7914d02a7ff189aba2f4feca31366fb4ab2664 Author: Ben Gamari Date: Tue Sep 19 15:58:20 2017 -0400 Fix Windows build regression due to GhcPrelude change >--------------------------------------------------------------- 7c7914d02a7ff189aba2f4feca31366fb4ab2664 compiler/main/SysTools/Terminal.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/main/SysTools/Terminal.hs b/compiler/main/SysTools/Terminal.hs index cd33bfb..b7f343a 100644 --- a/compiler/main/SysTools/Terminal.hs +++ b/compiler/main/SysTools/Terminal.hs @@ -1,9 +1,10 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} module SysTools.Terminal (stderrSupportsAnsiColors) where -#if defined MIN_VERSION_terminfo + import GhcPrelude +#if defined MIN_VERSION_terminfo import Control.Exception (catch) import Data.Maybe (fromMaybe) import System.Console.Terminfo (SetupTermError, Terminal, getCapability, From git at git.haskell.org Tue Sep 19 21:10:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Improve error messages around kind mismatches. (6a024a5) Message-ID: <20170919211013.9D9963A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6a024a55fa5deefaa45bc2abee9efa63d290266d/ghc >--------------------------------------------------------------- commit 6a024a55fa5deefaa45bc2abee9efa63d290266d Author: Richard Eisenberg Date: Thu Jun 1 17:27:14 2017 -0400 Improve error messages around kind mismatches. Previously, when canonicalizing (or unifying, in uType) a heterogeneous equality, we emitted a kind equality and used the resulting coercion to cast one side of the heterogeneous equality. While sound, this led to terrible error messages. (See the bugs listed below.) The problem is that using the coercion built from the emitted kind equality is a bit like a wanted rewriting a wanted. The solution is to keep heterogeneous equalities as irreducible. See Note [Equalities with incompatible kinds] in TcCanonical. This commit also removes a highly suspicious switch to FM_SubstOnly when flattening in the kinds of a type variable. I have no idea why this was there, other than as a holdover from pre-TypeInType. I've not left a Note because there is simply no reason I can conceive of that the FM_SubstOnly should be there. One challenge with this patch is that the emitted derived equalities might get emitted several times: when a heterogeneous equality is in an implication and then gets floated out from the implication, the Derived is present both in and out of the implication. This causes a duplicate error message. (Test case: typecheck/should_fail/T7368) Solution: track the provenance of Derived constraints and refuse to float out a constraint that has an insoluble Derived. Lastly, this labels one test (dependent/should_fail/RAE_T32a) as expect_broken, because the problem is really #12919. The different handling of constraints in this patch exposes the error. This fixes bugs #11198, #12373, #13530, and #13610. test cases: typecheck/should_fail/{T8262,T8603,tcail122,T12373,T13530,T13610} (cherry picked from commit 8e15e3d370e9c253ae0dbb330e25b72cb00cdb76) >--------------------------------------------------------------- 6a024a55fa5deefaa45bc2abee9efa63d290266d compiler/typecheck/TcCanonical.hs | 296 ++++++++++++--------- compiler/typecheck/TcErrors.hs | 79 ++++-- compiler/typecheck/TcEvidence.hs | 8 +- compiler/typecheck/TcFlatten.hs | 31 ++- compiler/typecheck/TcRnTypes.hs | 30 ++- compiler/typecheck/TcSimplify.hs | 34 ++- compiler/typecheck/TcType.hs | 10 +- compiler/typecheck/TcUnify.hs | 28 +- compiler/types/Type.hs | 4 +- testsuite/tests/dependent/should_fail/T11471.hs | 2 +- .../tests/dependent/should_fail/T11471.stderr | 11 +- testsuite/tests/dependent/should_fail/all.T | 2 +- testsuite/tests/gadt/gadt7.stderr | 6 +- .../tests/ghci.debugger/scripts/break012.stdout | 14 +- .../indexed-types/should_fail/ExtraTcsUntch.stderr | 6 +- .../tests/indexed-types/should_fail/T5934.stderr | 13 - testsuite/tests/polykinds/T12593.stderr | 56 ++++ testsuite/tests/polykinds/T13555.stderr | 21 +- testsuite/tests/polykinds/T7438.stderr | 6 +- testsuite/tests/polykinds/T8566.stderr | 2 +- testsuite/tests/polykinds/T9017.stderr | 10 +- testsuite/tests/typecheck/should_fail/T12373.hs | 10 + .../tests/typecheck/should_fail/T12373.stderr | 8 + testsuite/tests/typecheck/should_fail/T13530.hs | 11 + .../tests/typecheck/should_fail/T13530.stderr | 7 + testsuite/tests/typecheck/should_fail/T13610.hs | 11 + .../tests/typecheck/should_fail/T13610.stderr | 14 + testsuite/tests/typecheck/should_fail/T5691.stderr | 10 +- testsuite/tests/typecheck/should_fail/T7368.stderr | 6 +- .../tests/typecheck/should_fail/T7368a.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 48 +--- testsuite/tests/typecheck/should_fail/T7696.stderr | 4 +- testsuite/tests/typecheck/should_fail/T8262.stderr | 6 +- testsuite/tests/typecheck/should_fail/T8603.hs | 4 + testsuite/tests/typecheck/should_fail/T8603.stderr | 13 +- testsuite/tests/typecheck/should_fail/all.T | 3 + .../tests/typecheck/should_fail/tcfail090.stderr | 4 +- .../tests/typecheck/should_fail/tcfail122.stderr | 8 +- .../tests/typecheck/should_fail/tcfail123.stderr | 13 +- .../tests/typecheck/should_fail/tcfail200.stderr | 6 +- 40 files changed, 542 insertions(+), 315 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 6a024a55fa5deefaa45bc2abee9efa63d290266d From git at git.haskell.org Tue Sep 19 21:10:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix tests (eb870ae) Message-ID: <20170919211016.72CFB3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/eb870ae0e9d3943268263e6f9ef1c844cdd4cdc5/ghc >--------------------------------------------------------------- commit eb870ae0e9d3943268263e6f9ef1c844cdd4cdc5 Author: Ben Gamari Date: Tue Sep 19 16:15:05 2017 -0400 Fix tests >--------------------------------------------------------------- eb870ae0e9d3943268263e6f9ef1c844cdd4cdc5 .../tests/dependent/should_fail/T11471.stderr | 14 ------ testsuite/tests/deriving/should_fail/T7148.stderr | 8 +--- testsuite/tests/gadt/T7558.stderr | 6 +-- .../indexed-types/should_fail/ExtraTcsUntch.stderr | 6 +-- testsuite/tests/polykinds/T11399.stderr | 6 +-- testsuite/tests/polykinds/T12593.stderr | 56 ---------------------- .../tests/typecheck/should_compile/FD3.stderr | 6 +-- .../tests/typecheck/should_compile/T9834.stderr | 4 +- .../tests/typecheck/should_fail/T12785b.stderr | 6 +++ .../tests/typecheck/should_fail/T13610.stderr | 4 -- testsuite/tests/typecheck/should_fail/T3950.stderr | 5 +- testsuite/tests/typecheck/should_fail/mc19.stderr | 6 +-- testsuite/tests/typecheck/should_fail/mc21.stderr | 6 +-- testsuite/tests/typecheck/should_fail/mc22.stderr | 6 +-- .../tests/typecheck/should_fail/tcfail122.stderr | 2 +- .../tests/typecheck/should_fail/tcfail123.stderr | 9 ---- .../tests/typecheck/should_fail/tcfail191.stderr | 6 +-- .../tests/typecheck/should_fail/tcfail193.stderr | 6 +-- testsuite/tests/typecheck/should_run/T7861.stderr | 6 +-- 19 files changed, 23 insertions(+), 145 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 eb870ae0e9d3943268263e6f9ef1c844cdd4cdc5 From git at git.haskell.org Tue Sep 19 21:10:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Test #11672 in typecheck/should_fail/T11672. (7172409) Message-ID: <20170919211019.EAE6A3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/717240921c440852b748cc26c60142243c51e4d1/ghc >--------------------------------------------------------------- commit 717240921c440852b748cc26c60142243c51e4d1 Author: Richard Eisenberg Date: Thu Jun 1 18:28:57 2017 -0400 Test #11672 in typecheck/should_fail/T11672. I believe this was fixed with the fix for #11198. (cherry picked from commit 9a54975665f23df8c8137da24028a5aec4c77fba) >--------------------------------------------------------------- 717240921c440852b748cc26c60142243c51e4d1 testsuite/tests/typecheck/should_fail/T11672.hs | 9 +++++++++ testsuite/tests/typecheck/should_fail/T11672.stderr | 9 +++++++++ testsuite/tests/typecheck/should_fail/all.T | 2 ++ 3 files changed, 20 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T11672.hs b/testsuite/tests/typecheck/should_fail/T11672.hs new file mode 100644 index 0000000..8c5e2fb --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11672.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE KindSignatures #-} +module BadError where + +import GHC.TypeLits +import Data.Proxy + +f :: Proxy (a :: Symbol) -> Int +f _ = f (Proxy :: Proxy (Int -> Bool)) diff --git a/testsuite/tests/typecheck/should_fail/T11672.stderr b/testsuite/tests/typecheck/should_fail/T11672.stderr new file mode 100644 index 0000000..47e1835 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11672.stderr @@ -0,0 +1,9 @@ + +T11672.hs:9:10: error: + • Couldn't match type ‘*’ with ‘Symbol’ + Expected type: Proxy a0 + Actual type: Proxy (Int -> Bool) + • In the first argument of ‘f’, namely + ‘(Proxy :: Proxy (Int -> Bool))’ + In the expression: f (Proxy :: Proxy (Int -> Bool)) + In an equation for ‘f’: f _ = f (Proxy :: Proxy (Int -> Bool)) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 3deba22..0d950f5 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -439,3 +439,5 @@ test('T14000', normal, compile_fail, ['']) test('T13530', normal, compile_fail, ['']) test('T12373', normal, compile_fail, ['']) test('T13610', normal, compile_fail, ['']) +test('T11672', normal, compile_fail, ['']) + From git at git.haskell.org Tue Sep 19 21:10:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add test for #14128 (9097961) Message-ID: <20170919211026.40DEB3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/90979616dd03b1be6e2c4fd2020140c15e034eb0/ghc >--------------------------------------------------------------- commit 90979616dd03b1be6e2c4fd2020140c15e034eb0 Author: Ben Gamari Date: Sat Aug 26 16:16:47 2017 -0400 testsuite: Add test for #14128 Reviewers: austin, goldfire Subscribers: rwbarton, thomie GHC Trac Issues: #14128 Differential Revision: https://phabricator.haskell.org/D3890 (cherry picked from commit 248ad30385acc0f81f1959b6345a7388be76dc85) >--------------------------------------------------------------- 90979616dd03b1be6e2c4fd2020140c15e034eb0 testsuite/tests/typecheck/should_compile/T14128.hs | 7 +++++++ testsuite/tests/typecheck/should_compile/T14128.hs-boot | 5 +++++ testsuite/tests/typecheck/should_compile/T14128Main.hs | 10 ++++++++++ testsuite/tests/typecheck/should_compile/T14128Type.hs | 3 +++ testsuite/tests/typecheck/should_compile/T14128a.hs | 1 + testsuite/tests/typecheck/should_compile/T14128a.hs-boot | 3 +++ testsuite/tests/typecheck/should_compile/all.T | 1 + 7 files changed, 30 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T14128.hs b/testsuite/tests/typecheck/should_compile/T14128.hs new file mode 100644 index 0000000..a1159c6 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14128.hs @@ -0,0 +1,7 @@ +module T14128 where + +import T14128Type +import {-# SOURCE #-} T14128a + +instance Show AType where + show AType = "hello" diff --git a/testsuite/tests/typecheck/should_compile/T14128.hs-boot b/testsuite/tests/typecheck/should_compile/T14128.hs-boot new file mode 100644 index 0000000..27ef36a --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14128.hs-boot @@ -0,0 +1,5 @@ +module T14128 where + +import T14128Type + +instance Show AType diff --git a/testsuite/tests/typecheck/should_compile/T14128Main.hs b/testsuite/tests/typecheck/should_compile/T14128Main.hs new file mode 100644 index 0000000..9407606 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14128Main.hs @@ -0,0 +1,10 @@ +module T14128Main where + +import T14128 + +-- Overview: +-- * T14128Main is imports T14128 +-- * T14128Type defines datatype MyType +-- * T14128 has a boot file and defines a orphan Show instance; it SOURCE +-- imports T14128 +-- * T14128a has a boot file which SOURCE imports T14128 diff --git a/testsuite/tests/typecheck/should_compile/T14128Type.hs b/testsuite/tests/typecheck/should_compile/T14128Type.hs new file mode 100644 index 0000000..f64ec48 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14128Type.hs @@ -0,0 +1,3 @@ +module T14128Type where + +data AType = AType diff --git a/testsuite/tests/typecheck/should_compile/T14128a.hs b/testsuite/tests/typecheck/should_compile/T14128a.hs new file mode 100644 index 0000000..a93b2fe --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14128a.hs @@ -0,0 +1 @@ +module T14128a where diff --git a/testsuite/tests/typecheck/should_compile/T14128a.hs-boot b/testsuite/tests/typecheck/should_compile/T14128a.hs-boot new file mode 100644 index 0000000..e38681a --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14128a.hs-boot @@ -0,0 +1,3 @@ +module T14128a where + +import {-# SOURCE #-} T14128 diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 044f2eb..6671291 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -561,4 +561,5 @@ test('T13881', normal, compile, ['']) test('T13915a', normal, multimod_compile, ['T13915a', '-v0']) test('T13915b', normal, compile, ['']) test('T13984', normal, compile, ['']) +test('T14128', normal, multimod_compile, ['T14128Main', '-v0']) test('T14154', normal, compile, ['']) From git at git.haskell.org Tue Sep 19 21:10:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add a Note describing #14128 (6cf6a69) Message-ID: <20170919211028.F00B23A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6cf6a69ccea46577b956797395466e09fb1614f2/ghc >--------------------------------------------------------------- commit 6cf6a69ccea46577b956797395466e09fb1614f2 Author: Ben Gamari Date: Tue Aug 29 19:14:22 2017 -0400 Add a Note describing #14128 I prematurely committed the D3892 before adding a Note. Fix this. (cherry picked from commit 6f1ccaa50f905bdc586a7a92ab7e38e30c1e7ff5) >--------------------------------------------------------------- 6cf6a69ccea46577b956797395466e09fb1614f2 compiler/deSugar/DsUsage.hs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/compiler/deSugar/DsUsage.hs b/compiler/deSugar/DsUsage.hs index 3f302fa..6219804 100644 --- a/compiler/deSugar/DsUsage.hs +++ b/compiler/deSugar/DsUsage.hs @@ -26,6 +26,25 @@ import Data.Map (Map) import qualified Data.Map as Map import qualified Data.Set as Set +{- Note [Module self-dependency] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +RnNames.calculateAvails asserts the invariant that a module must not occur in +its own dep_orphs or dep_finsts. However, if we aren't careful this can occur +in the presence of hs-boot files: Consider that we have two modules, A and B, +both with hs-boot files, + + A.hs contains a SOURCE import of B B.hs-boot contains a SOURCE import of A + A.hs-boot declares an orphan instance A.hs defines the orphan instance + +In this case, B's dep_orphs will contain A due to its SOURCE import of A. +Consequently, A will contain itself in its imp_orphs due to its import of B. +This fact would end up being recorded in A's interface file. This would then +break the invariant asserted by calculateAvails that a module does not itself in +its dep_orphs. This was the cause of Trac #14128. + +-} + -- | Extract information from the rename and typecheck phases to produce -- a dependencies information for the module being compiled. mkDependencies :: TcGblEnv -> IO Dependencies @@ -48,7 +67,7 @@ mkDependencies dep_orphs = filter (/= mod) (imp_orphs imports) -- We must also remove self-references from imp_orphs. See - -- #14128. + -- Note [Module self-dependency] pkgs | th_used = Set.insert (toInstalledUnitId thUnitId) (imp_dep_pkgs imports) | otherwise = imp_dep_pkgs imports From git at git.haskell.org Tue Sep 19 21:10:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: desugar: Ensure that a module's dep_orphs doesn't contain itself (609f485) Message-ID: <20170919211022.A93293A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/609f48547367cfb1f0d263bb2b6aaec88a528182/ghc >--------------------------------------------------------------- commit 609f48547367cfb1f0d263bb2b6aaec88a528182 Author: Ben Gamari Date: Sat Aug 26 16:17:18 2017 -0400 desugar: Ensure that a module's dep_orphs doesn't contain itself Consider that we have two modules, A and B, both with hs-boot files, * A.hs contains a SOURCE import of B * B.hs-boot contains a SOURCE import of A * A.hs-boot declares an orphan instance * A.hs defines the orphan instance In this case, B's dep_orphs will contain A due to its SOURCE import of A. Consequently, A will contain itself in its imp_orphs due to its import of B. This fact would end up being recorded in A's interface file. This would then break the invariant asserted by calculateAvails that a module does not itself in its dep_orphs. This was the cause of #14128. The solution is to remove self-references from imp_orphs when constructing dep_orphs; we already did a similar thing for dep_mods. I believe we should do the same for dep_finsts, although I'm treating this as a separate bug. Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3892 (cherry picked from commit db3a8e168ad81f54ec58eebc4c75a0eaad889daf) >--------------------------------------------------------------- 609f48547367cfb1f0d263bb2b6aaec88a528182 compiler/deSugar/DsUsage.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/deSugar/DsUsage.hs b/compiler/deSugar/DsUsage.hs index 8158a8e..3f302fa 100644 --- a/compiler/deSugar/DsUsage.hs +++ b/compiler/deSugar/DsUsage.hs @@ -38,7 +38,7 @@ mkDependencies -- Template Haskell used? th_used <- readIORef th_var let dep_mods = modDepsElts (delFromUFM (imp_dep_mods imports) - (moduleName mod)) + (moduleName mod)) -- M.hi-boot can be in the imp_dep_mods, but we must remove -- it before recording the modules on which this one depends! -- (We want to retain M.hi-boot in imp_dep_mods so that @@ -46,6 +46,10 @@ mkDependencies -- on M.hi-boot, and hence that we should do the hi-boot consistency -- check.) + dep_orphs = filter (/= mod) (imp_orphs imports) + -- We must also remove self-references from imp_orphs. See + -- #14128. + pkgs | th_used = Set.insert (toInstalledUnitId thUnitId) (imp_dep_pkgs imports) | otherwise = imp_dep_pkgs imports @@ -57,7 +61,7 @@ mkDependencies return Deps { dep_mods = dep_mods, dep_pkgs = dep_pkgs', - dep_orphs = sortBy stableModuleCmp (imp_orphs imports), + dep_orphs = dep_orphs, dep_finsts = sortBy stableModuleCmp (imp_finsts imports) } -- sort to get into canonical order -- NB. remember to use lexicographic ordering From git at git.haskell.org Tue Sep 19 21:10:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #14228 by marking SumPats as non-irrefutable (fb51901) Message-ID: <20170919211032.3F2093A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fb5190185b6819ff4f4b64167d37da85337c524c/ghc >--------------------------------------------------------------- commit fb5190185b6819ff4f4b64167d37da85337c524c Author: Ryan Scott Date: Fri Sep 15 14:34:58 2017 -0400 Fix #14228 by marking SumPats as non-irrefutable `isIrrefutableHsPat` should always return `False` for unboxed sum patterns (`SumPat`s), since they always have at least one other corresponding pattern of the same arity (since the minimum arity for a `SumPat` is 2). Failure to do so causes incorrect code to be generated for pattern synonyms that use unboxed sums, as shown in #14228. Test Plan: make test TEST=T14228 Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #14228 Differential Revision: https://phabricator.haskell.org/D3951 (cherry picked from commit f4d50a0ec0d23dbcd61a014c8a773030c8fe310d) >--------------------------------------------------------------- fb5190185b6819ff4f4b64167d37da85337c524c compiler/hsSyn/HsPat.hs | 25 ++++++++++++++++++++++++- testsuite/tests/patsyn/should_run/T14228.hs | 22 ++++++++++++++++++++++ testsuite/tests/patsyn/should_run/T14228.stdout | 4 ++++ testsuite/tests/patsyn/should_run/all.T | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs index 23dbd75..18457c0 100644 --- a/compiler/hsSyn/HsPat.hs +++ b/compiler/hsSyn/HsPat.hs @@ -616,7 +616,8 @@ isIrrefutableHsPat pat go1 (SigPatIn pat _) = go pat go1 (SigPatOut pat _) = go pat go1 (TuplePat pats _ _) = all go pats - go1 (SumPat pat _ _ _) = go pat + go1 (SumPat _ _ _ _) = False + -- See Note [Unboxed sum patterns aren't irrefutable] go1 (ListPat {}) = False go1 (PArrPat {}) = False -- ? @@ -637,6 +638,28 @@ isIrrefutableHsPat pat -- since we cannot know until the splice is evaluated. go1 (SplicePat {}) = False +{- Note [Unboxed sum patterns aren't irrefutable] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Unlike unboxed tuples, unboxed sums are *not* irrefutable when used as +patterns. A simple example that demonstrates this is from #14228: + + pattern Just' x = (# x | #) + pattern Nothing' = (# | () #) + + foo x = case x of + Nothing' -> putStrLn "nothing" + Just' -> putStrLn "just" + +In foo, the pattern Nothing' (that is, (# x | #)) is certainly not irrefutable, +as does not match an unboxed sum value of the same arity—namely, (# | y #) +(covered by Just'). In fact, no unboxed sum pattern is irrefutable, since the +minimum unboxed sum arity is 2. + +Failing to mark unboxed sum patterns as non-irrefutable would cause the Just' +case in foo to be unreachable, as GHC would mistakenly believe that Nothing' +is the only thing that could possibly be matched! +-} + hsPatNeedsParens :: Pat a -> Bool hsPatNeedsParens (NPlusKPat {}) = True hsPatNeedsParens (SplicePat {}) = False diff --git a/testsuite/tests/patsyn/should_run/T14228.hs b/testsuite/tests/patsyn/should_run/T14228.hs new file mode 100644 index 0000000..18cddd2 --- /dev/null +++ b/testsuite/tests/patsyn/should_run/T14228.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE UnboxedSums #-} +{-# LANGUAGE PatternSynonyms #-} +module Main where + +type Maybe' t = (# t | () #) + +pattern Just' :: a -> Maybe' a +pattern Just' x = (# x | #) + +pattern Nothing' :: Maybe' a +pattern Nothing' = (# | () #) + +foo x = case x of + Nothing' -> putStrLn "nothing" + Just' _ -> putStrLn "just" + +main = do + putStrLn "Nothing'" + foo Nothing' + + putStrLn "Just'" + foo (Just' "hello") diff --git a/testsuite/tests/patsyn/should_run/T14228.stdout b/testsuite/tests/patsyn/should_run/T14228.stdout new file mode 100644 index 0000000..a8ed424 --- /dev/null +++ b/testsuite/tests/patsyn/should_run/T14228.stdout @@ -0,0 +1,4 @@ +Nothing' +nothing +Just' +just diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T index d98a1ff..84dc788 100644 --- a/testsuite/tests/patsyn/should_run/all.T +++ b/testsuite/tests/patsyn/should_run/all.T @@ -14,3 +14,4 @@ test('records-run', normal, compile_and_run, ['']) test('ghci', just_ghci, ghci_script, ['ghci.script']) test('T11985', just_ghci, ghci_script, ['T11985.script']) test('T11224', normal, compile_and_run, ['']) +test('T14228', normal, compile_and_run, ['']) From git at git.haskell.org Tue Sep 19 21:10:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Renamer now preserves location for IEThingWith list items (a153d2f) Message-ID: <20170919211035.8CEFA3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a153d2f26263181440156380559a90ab792d8260/ghc >--------------------------------------------------------------- commit a153d2f26263181440156380559a90ab792d8260 Author: Alan Zimmerman Date: Fri Sep 15 14:35:51 2017 -0400 Renamer now preserves location for IEThingWith list items Prior to this, in the RenamedSource for module Renaming.RenameInExportedType ( MyType (NT) ) where data MyType = MT Int | NT The (NT) was given the location of MyType earlier on the line in the export list. Also the location was discarded for any field labels, and replaced with a `noLoc`. Test Plan: ./validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14189 Differential Revision: https://phabricator.haskell.org/D3968 (cherry picked from commit 9498c50ef5af2680305e0aaea6f32439cacc3da0) >--------------------------------------------------------------- a153d2f26263181440156380559a90ab792d8260 compiler/typecheck/TcRnExports.hs | 35 +++++---- testsuite/tests/parser/should_compile/T14189.hs | 6 ++ .../tests/parser/should_compile/T14189.stderr | 89 ++++++++++++++++++++++ testsuite/tests/parser/should_compile/all.T | 1 + 4 files changed, 115 insertions(+), 16 deletions(-) diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index fa4b4bc..851d848 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -293,11 +293,10 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod NoIEWildcard -> return (lname, [], []) IEWildcard _ -> lookup_ie_all ie l let name = unLoc lname - subs' = map (replaceLWrappedName l . unLoc) subs - return (IEThingWith (replaceLWrappedName l name) wc subs' - (map noLoc (flds ++ all_flds)), + return (IEThingWith (replaceLWrappedName l name) wc subs + (flds ++ (map noLoc all_flds)), AvailTC name (name : avails ++ all_avail) - (flds ++ all_flds)) + (map unLoc flds ++ all_flds)) @@ -305,16 +304,17 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod lookup_ie _ = panic "lookup_ie" -- Other cases covered earlier lookup_ie_with :: LIEWrappedName RdrName -> [LIEWrappedName RdrName] - -> RnM (Located Name, [Located Name], [Name], [FieldLabel]) + -> RnM (Located Name, [LIEWrappedName Name], [Name], + [Located FieldLabel]) lookup_ie_with (L l rdr) sub_rdrs = do name <- lookupGlobalOccRn $ ieWrappedName rdr - (non_flds, flds) <- lookupChildrenExport name - (map ieLWrappedName sub_rdrs) + (non_flds, flds) <- lookupChildrenExport name sub_rdrs if isUnboundName name then return (L l name, [], [name], []) else return (L l name, non_flds - , map unLoc non_flds - , map unLoc flds) + , map (ieWrappedName . unLoc) non_flds + , flds) + lookup_ie_all :: IE RdrName -> LIEWrappedName RdrName -> RnM (Located Name, [Name], [FieldLabel]) lookup_ie_all ie (L l rdr) = @@ -417,8 +417,8 @@ instance Monoid ChildLookupResult where FoundName n1 `mappend` _ = FoundName n1 FoundFL fls `mappend` _ = FoundFL fls -lookupChildrenExport :: Name -> [Located RdrName] - -> RnM ([Located Name], [Located FieldLabel]) +lookupChildrenExport :: Name -> [LIEWrappedName RdrName] + -> RnM ([LIEWrappedName Name], [Located FieldLabel]) lookupChildrenExport parent rdr_items = do xs <- mapAndReportM doOne rdr_items @@ -433,11 +433,11 @@ lookupChildrenExport parent rdr_items = | ns == tcName = [dataName, tcName] | otherwise = [ns] -- Process an individual child - doOne :: Located RdrName - -> RnM (Either (Located Name) (Located FieldLabel)) + doOne :: LIEWrappedName RdrName + -> RnM (Either (LIEWrappedName Name) (Located FieldLabel)) doOne n = do - let bareName = unLoc n + let bareName = (ieWrappedName . unLoc) n lkup v = lookupExportChild parent (setRdrNameSpace bareName v) name <- tryChildLookupResult $ map lkup $ @@ -451,9 +451,12 @@ lookupChildrenExport parent rdr_items = else setRdrNameSpace bareName dataName case name of - NameNotFound -> Left . L (getLoc n) <$> reportUnboundName unboundName + NameNotFound -> do { ub <- reportUnboundName unboundName + ; let l = getLoc n + ; return (Left (L l (IEName (L l ub))))} + FoundFL fls -> return $ Right (L (getLoc n) fls) - FoundName name -> return $ Left (L (getLoc n) name) + FoundName name -> return $ Left (replaceLWrappedName n name) NameErr err_msg -> reportError err_msg >> failM tryChildLookupResult :: [RnM ChildLookupResult] -> RnM ChildLookupResult diff --git a/testsuite/tests/parser/should_compile/T14189.hs b/testsuite/tests/parser/should_compile/T14189.hs new file mode 100644 index 0000000..c26ebd7 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T14189.hs @@ -0,0 +1,6 @@ +module T14189 + ( + MyType (f,NT) + ) where + +data MyType = MT Int | NT | F { f :: Int } diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr new file mode 100644 index 0000000..a2c7d92 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T14189.stderr @@ -0,0 +1,89 @@ + +==================== Renamer ==================== + +(HsGroup + (ValBindsOut + [] + []) + [] + [ + (TyClGroup + [ + ({ T14189.hs:6:1-42 } + (DataDecl + ({ T14189.hs:6:6-11 }{Name: main:T14189.MyType{tc}}) + (HsQTvs + [] + [] {NameSet: + []}) + (Prefix) + (HsDataDefn + (DataType) + ({ } + []) + (Nothing) + (Nothing) + [ + ({ T14189.hs:6:15-20 } + (ConDeclH98 + ({ T14189.hs:6:15-16 }{Name: main:T14189.MT{d}}) + (Nothing) + (Just + ({ } + [])) + (PrefixCon + [ + ({ T14189.hs:6:18-20 } + (HsTyVar + (NotPromoted) + ({ T14189.hs:6:18-20 }{Name: ghc-prim:GHC.Types.Int{(w) tc}})))]) + (Nothing))), + ({ T14189.hs:6:24-25 } + (ConDeclH98 + ({ T14189.hs:6:24-25 }{Name: main:T14189.NT{d}}) + (Nothing) + (Just + ({ } + [])) + (PrefixCon + []) + (Nothing))), + ({ T14189.hs:6:29-42 } + (ConDeclH98 + ({ T14189.hs:6:29 }{Name: main:T14189.F{d}}) + (Nothing) + (Just + ({ } + [])) + (RecCon + ({ T14189.hs:6:31-42 } + [ + ({ T14189.hs:6:33-40 } + (ConDeclField + [ + ({ T14189.hs:6:33 } + (FieldOcc + ({ T14189.hs:6:33 } + (Unqual {OccName: f})) {Name: main:T14189.f{v}}))] + ({ T14189.hs:6:38-40 } + (HsTyVar + (NotPromoted) + ({ T14189.hs:6:38-40 }{Name: ghc-prim:GHC.Types.Int{(w) tc}}))) + (Nothing)))])) + (Nothing)))] + ({ } + [])) + (True) {NameSet: + [{Name: ghc-prim:GHC.Types.Int{(w) tc}}]}))] + [] + [])] + [] + [] + [] + [] + [] + [] + [] + [] + []) + diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 2059979..597da02 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -107,3 +107,4 @@ test('T10582', expect_broken(10582), compile, ['']) test('DumpParsedAst', normal, compile, ['-dsuppress-uniques -ddump-parsed-ast']) test('DumpRenamedAst', normal, compile, ['-dsuppress-uniques -ddump-rn-ast']) test('DumpTypecheckedAst', normal, compile, ['-dsuppress-uniques -ddump-tc-ast']) +test('T14189', normal, compile, ['-dsuppress-uniques -ddump-rn-ast']) From git at git.haskell.org Tue Sep 19 21:10:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix subtle bug in TcTyClsDecls.mkGADTVars (8fda8ad) Message-ID: <20170919211038.C96DC3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8fda8aded0d2194bddbaaed43256d0e3d0632fe2/ghc >--------------------------------------------------------------- commit 8fda8aded0d2194bddbaaed43256d0e3d0632fe2 Author: Simon Peyton Jones Date: Sat Sep 2 18:13:32 2017 +0100 Fix subtle bug in TcTyClsDecls.mkGADTVars This bug was revealed by Trac #14162. In a GADT-style data-family instance we ended up a data constructor whose type mentioned an out-of-scope variable. (This variable was in the kind of a variable in the kind of a variable.) Only Lint complained about this (actually only when the data constructor was injected into the bindings by CorePrep). So it doesn't matter much -- but it's a solid bug and might bite us some day. It took me quite a while to unravel because the test case was itself quite tricky. But the fix is easy; just add a missing binding to the substitution we are building up. It's in the regrettably-subtle mkGADTVars function. (cherry picked from commit 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a) >--------------------------------------------------------------- 8fda8aded0d2194bddbaaed43256d0e3d0632fe2 compiler/typecheck/TcTyClsDecls.hs | 82 ++++++++++++++-------- .../tests/indexed-types/should_compile/T14162.hs | 41 +++++++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 3 files changed, 94 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8fda8aded0d2194bddbaaed43256d0e3d0632fe2 From git at git.haskell.org Tue Sep 19 21:10:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Really fix Trac #14158 (13cd53d) Message-ID: <20170919211041.F22353A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/13cd53df15ab38a29c5dfcbdd916ae2ada6ff979/ghc >--------------------------------------------------------------- commit 13cd53df15ab38a29c5dfcbdd916ae2ada6ff979 Author: Simon Peyton Jones Date: Wed Aug 30 16:19:37 2017 +0100 Really fix Trac #14158 I dug more into how #14158 started working. I temporarily reverted the patch that "fixed" it, namely commit a6c448b403dbe8720178ca82100f34baedb1f47e Author: Simon Peyton Jones Date: Mon Aug 28 17:33:59 2017 +0100 Small refactor of getRuntimeRep Sure enough, there was a real bug, described in the new TcExpr Note [Visible type application zonk] In general, syntactic substituion should be kind-preserving! Maybe we should check that invariant... (cherry picked from commit 2c133b67df374c73bc8069cefd7d57e1d2a14fc3) >--------------------------------------------------------------- 13cd53df15ab38a29c5dfcbdd916ae2ada6ff979 compiler/typecheck/TcExpr.hs | 44 +++++++++++++++++++++- compiler/types/Type.hs | 1 + testsuite/tests/typecheck/should_compile/T14158.hs | 7 ++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 6e2f0eb..8e65e61 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -63,7 +63,7 @@ import PrelNames import DynFlags import SrcLoc import Util -import VarEnv ( emptyTidyEnv ) +import VarEnv ( emptyTidyEnv, mkInScopeSet ) import ListSetOps import Maybes import Outputable @@ -1236,7 +1236,18 @@ tcArgs fun orig_fun_ty fun_orig orig_args herald , ppr inner_ty, pprTyVar tv , ppr vis ]) ) ; ty_arg <- tcHsTypeApp hs_ty_arg kind - ; let insted_ty = substTyWithUnchecked [tv] [ty_arg] inner_ty + + ; inner_ty <- zonkTcType inner_ty + -- See Note [Visible type application zonk] + + ; let in_scope = mkInScopeSet (tyCoVarsOfTypes [upsilon_ty, ty_arg]) + insted_ty = substTyWithInScope in_scope [tv] [ty_arg] inner_ty + -- NB: tv and ty_arg have the same kind, so this + -- substitution is kind-respecting + ; traceTc "VTA" (vcat [ppr tv, ppr kind + , ppr ty_arg + , ppr (typeKind ty_arg) + , ppr insted_ty ]) ; (inner_wrap, args', res_ty) <- go acc_args (n+1) insted_ty args -- inner_wrap :: insted_ty "->" (map typeOf args') -> res_ty @@ -1268,6 +1279,35 @@ tcArgs fun orig_fun_ty fun_orig orig_args herald text "Cannot apply expression of type" <+> quotes (ppr ty) $$ text "to a visible type argument" <+> quotes (ppr arg) } +{- Note [Visible type application zonk] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Substitutions should be kind-preserving, so we need kind(tv) = kind(ty_arg). + +* tcHsTypeApp only guarantees that + - ty_arg is zonked + - kind(zonk(tv)) = kind(ty_arg) + (checkExpectedKind zonks as it goes). + +So we must zonk inner_ty as well, to guarantee consistency between zonk(tv) +and inner_ty. Otherwise we can build an ill-kinded type. An example was +Trac #14158, where we had: + id :: forall k. forall (cat :: k -> k -> *). forall (a :: k). cat a a +and we had the visible type application + id @(->) + +* We instantiated k := kappa, yielding + forall (cat :: kappa -> kappa -> *). forall (a :: kappa). cat a a +* Then we called tcHsTypeApp (->) with expected kind (kappa -> kappa -> *). +* That instantiated (->) as ((->) q1 q1), and unified kappa := q1, + Here q1 :: RuntimeRep +* Now we substitute + cat :-> (->) q1 q1 :: TYPE q1 -> TYPE q1 -> * + but we must first zonk the inner_ty to get + forall (a :: TYPE q1). cat a a + so that the result of substitution is well-kinded + Failing to do so led to Trac #14158. +-} + ---------------- tcArg :: LHsExpr Name -- The function (for error messages) -> LHsExpr Name -- Actual arguments diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 1400ff7..23ff47d 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -178,6 +178,7 @@ module Type ( substTyUnchecked, substTysUnchecked, substThetaUnchecked, substTyWithUnchecked, substCoUnchecked, substCoWithUnchecked, + substTyWithInScope, substTyVarBndr, substTyVar, substTyVars, cloneTyVarBndr, cloneTyVarBndrs, lookupTyVar, diff --git a/testsuite/tests/typecheck/should_compile/T14158.hs b/testsuite/tests/typecheck/should_compile/T14158.hs new file mode 100644 index 0000000..88bb82e --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14158.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeApplications #-} + +module T14158 where + +import qualified Control.Category as Cat + +foo = (Cat.id @(->) >>=) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 6671291..d718ba3 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -563,3 +563,4 @@ test('T13915b', normal, compile, ['']) test('T13984', normal, compile, ['']) test('T14128', normal, multimod_compile, ['T14128Main', '-v0']) test('T14154', normal, compile, ['']) +test('T14158', normal, compile, ['']) From git at git.haskell.org Tue Sep 19 21:10:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Better document TypeRep patterns (14195b0) Message-ID: <20170919211044.A72F33A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/14195b0982135668890f79b7790caf33c6147240/ghc >--------------------------------------------------------------- commit 14195b0982135668890f79b7790caf33c6147240 Author: Ben Gamari Date: Wed Sep 13 12:23:47 2017 -0400 Better document TypeRep patterns As pointed out in #14199 these are rather non-trivial; extra documentation is in order. [skip ci] Test Plan: Read it Reviewers: dfeuer, austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #14199 Differential Revision: https://phabricator.haskell.org/D3943 (cherry picked from commit f9bf621caf2fc17d829dee0ee48b204144927e72) >--------------------------------------------------------------- 14195b0982135668890f79b7790caf33c6147240 libraries/base/Data/Typeable/Internal.hs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index cf3ea07..f094d96 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -221,6 +221,13 @@ instance Ord SomeTypeRep where SomeTypeRep a `compare` SomeTypeRep b = typeRepFingerprint a `compare` typeRepFingerprint b +-- | The function type constructor. +-- +-- For instance, +-- @ +-- typeRep \@(Int -> Char) === Fun (typeRep \@Int) (typeRep \@Char) +-- @ +-- pattern Fun :: forall k (fun :: k). () => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (arg :: TYPE r1) (res :: TYPE r2). @@ -265,7 +272,14 @@ mkTrApp a b = TrApp fpr a b fpr_b = typeRepFingerprint b fpr = fingerprintFingerprints [fpr_a, fpr_b] --- | Pattern match on a type application +-- | A type application. +-- +-- For instance, +-- @ +-- typeRep \@(Maybe Int) === App (typeRep \@Maybe) (typeRep \@Int) +-- @ +-- Note that this will never match a function type (e.g. @Int -> Char@). +-- pattern App :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b) => TypeRep a -> TypeRep b -> TypeRep t @@ -287,6 +301,18 @@ pattern Con con <- TrTyCon _ con _ -- | Pattern match on a type constructor including its instantiated kind -- variables. +-- +-- For instance, +-- @ +-- App (Con' proxyTyCon ks) intRep = typeRep @(Proxy \@Int) +-- @ +-- will bring into scope, +-- @ +-- proxyTyCon :: TyCon +-- ks == [someTypeRep @Type] :: [SomeTypeRep] +-- intRep == typeRep @Int +-- @ +-- pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a pattern Con' con ks <- TrTyCon _ con ks From git at git.haskell.org Tue Sep 19 21:10:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Deal with unbreakable blocks in Applicative Do (55b27a3) Message-ID: <20170919211047.F08653A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/55b27a3231d6c25bc257006d59b329dd43ac4118/ghc >--------------------------------------------------------------- commit 55b27a3231d6c25bc257006d59b329dd43ac4118 Author: David Feuer Date: Thu Sep 7 23:56:35 2017 -0400 Deal with unbreakable blocks in Applicative Do The renamer wasn't able to deal with more than a couple strict patterns in a row with `ApplicativeDo` when using the heuristic splitter. Update it to work with them properly. Reviewers: simonmar, austin, bgamari, hvr Reviewed By: simonmar Subscribers: RyanGlScott, lippling, rwbarton, thomie GHC Trac Issues: #14163 Differential Revision: https://phabricator.haskell.org/D3900 (cherry picked from commit 011e15aa2d6949fc56126f1028ea25d5497196d9) >--------------------------------------------------------------- 55b27a3231d6c25bc257006d59b329dd43ac4118 compiler/rename/RnExpr.hs | 7 +++++-- testsuite/tests/ado/T14163.hs | 13 +++++++++++++ testsuite/tests/ado/T14163.stdin | 3 +++ testsuite/tests/ado/T14163.stdout | 1 + testsuite/tests/ado/all.T | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index ec3ad0b..c120c26 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -1797,9 +1797,12 @@ slurpIndependentStmts slurpIndependentStmts stmts = go [] [] emptyNameSet stmts where -- If we encounter a BindStmt that doesn't depend on a previous BindStmt - -- in this group, then add it to the group. + -- in this group, then add it to the group. We have to be careful about + -- strict patterns though; splitSegments expects that if we return Just + -- then we have actually done some splitting. Otherwise it will go into + -- an infinite loop (#14163). go lets indep bndrs ((L loc (BindStmt pat body bind_op fail_op ty), fvs) : rest) - | isEmptyNameSet (bndrs `intersectNameSet` fvs) + | isEmptyNameSet (bndrs `intersectNameSet` fvs) && not (isStrictPattern pat) = go lets ((L loc (BindStmt pat body bind_op fail_op ty), fvs) : indep) bndrs' rest where bndrs' = bndrs `unionNameSet` mkNameSet (collectPatBinders pat) diff --git a/testsuite/tests/ado/T14163.hs b/testsuite/tests/ado/T14163.hs new file mode 100644 index 0000000..9463c1c --- /dev/null +++ b/testsuite/tests/ado/T14163.hs @@ -0,0 +1,13 @@ +{-# language ApplicativeDo #-} + +import GHC.Exts + +readIt :: IO (Int, Int) +readIt = readLn + +main :: IO () +main = do + (_, _) <- readIt + (_, _) <- readIt + (_, _) <- readIt + print "Done" diff --git a/testsuite/tests/ado/T14163.stdin b/testsuite/tests/ado/T14163.stdin new file mode 100644 index 0000000..0f62046 --- /dev/null +++ b/testsuite/tests/ado/T14163.stdin @@ -0,0 +1,3 @@ +(1,2) +(3,4) +(5,6) diff --git a/testsuite/tests/ado/T14163.stdout b/testsuite/tests/ado/T14163.stdout new file mode 100644 index 0000000..5a32621 --- /dev/null +++ b/testsuite/tests/ado/T14163.stdout @@ -0,0 +1 @@ +"Done" diff --git a/testsuite/tests/ado/all.T b/testsuite/tests/ado/all.T index a738c7a..86b0193 100644 --- a/testsuite/tests/ado/all.T +++ b/testsuite/tests/ado/all.T @@ -10,3 +10,4 @@ test('ado-optimal', normal, compile_and_run, ['']) test('T12490', normal, compile, ['']) test('T13242', normal, compile, ['']) test('T13875', normal, compile_and_run, ['']) +test('T14163', normal, compile_and_run, ['']) From git at git.haskell.org Tue Sep 19 21:10:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:50 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: eventlog: Clean up profiling heap breakdown type (4636799) Message-ID: <20170919211050.AA6E93A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/46367997b8fab50d442cad0ba75d13340afc8d6b/ghc >--------------------------------------------------------------- commit 46367997b8fab50d442cad0ba75d13340afc8d6b Author: Ben Gamari Date: Mon Sep 4 08:14:38 2017 -0400 eventlog: Clean up profiling heap breakdown type Reviewers: austin, erikd, simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14096 Differential Revision: https://phabricator.haskell.org/D3923 (cherry picked from commit 822abbb1b4300ebaa3f12014b9fc477261283143) >--------------------------------------------------------------- 46367997b8fab50d442cad0ba75d13340afc8d6b docs/users_guide/eventlog-formats.rst | 13 +++++++------ docs/users_guide/profiling.rst | 29 +++++++++++++++-------------- includes/rts/EventLogFormat.h | 19 ++++++++++++++----- rts/eventlog/EventLog.c | 9 --------- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst index 8b1427d..9910d4d 100644 --- a/docs/users_guide/eventlog-formats.rst +++ b/docs/users_guide/eventlog-formats.rst @@ -33,12 +33,13 @@ A single fixed-width event emitted during program start-up describing the sample * ``Word64``: Sampling period in nanoseconds * ``Word32``: Sample break-down type. One of, - * ``SAMPLE_TYPE_COST_CENTER`` (output from ``-hc``) - * ``SAMPLE_TYPE_CLOSURE_DESCR`` (output from ``-hd``) - * ``SAMPLE_TYPE_RETAINER`` (output from ``-hr``) - * ``SAMPLE_TYPE_MODULE`` (output from ``-hm``) - * ``SAMPLE_TYPE_TYPE_DESCR`` (output from ``-hy``) - * ``SAMPLE_TYPE_BIOGRAPHY`` (output from ``-hb``) + * ``HEAP_PROF_BREAKDOWN_COST_CENTER`` (output from :rts-flag:`-hc`) + * ``HEAP_PROF_BREAKDOWN_CLOSURE_DESCR`` (output from :rts-flag:`-hd`) + * ``HEAP_PROF_BREAKDOWN_RETAINER`` (output from :rts-flag:`-hr`) + * ``HEAP_PROF_BREAKDOWN_MODULE`` (output from :rts-flag:`-hm`) + * ``HEAP_PROF_BREAKDOWN_TYPE_DESCR`` (output from :rts-flag:`-hy`) + * ``HEAP_PROF_BREAKDOWN_BIOGRAPHY`` (output from :rts-flag:`-hb`) + * ``HEAP_PROF_BREAKDOWN_CLOSURE_TYPE`` (output from :rts-flag:`-hT`) * ``String``: Module filter * ``String``: Closure description filter diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 4107db2..8cf6bcb 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -660,35 +660,36 @@ following RTS options select which break-down to use: .. rts-flag:: -hc -h - (can be shortened to :rts-flag:`-h`). Breaks down the graph by the - cost-centre stack which produced the data. + *Requires :ghc-flag:`-prof`.* Breaks down the graph by the cost-centre stack + which produced the data. .. rts-flag:: -hm - Break down the live heap by the module containing the code which - produced the data. + *Requires :ghc-flag:`-prof`.* Break down the live heap by the module + containing the code which produced the data. .. rts-flag:: -hd - Breaks down the graph by closure description. For actual data, the - description is just the constructor name, for other closures it is a - compiler-generated string identifying the closure. + *Requires :ghc-flag:`-prof`.* Breaks down the graph by closure description. + For actual data, the description is just the constructor name, for other + closures it is a compiler-generated string identifying the closure. .. rts-flag:: -hy - Breaks down the graph by type. For closures which have function type - or unknown/polymorphic type, the string will represent an - approximation to the actual type. + *Requires :ghc-flag:`-prof`.* Breaks down the graph by type. For closures + which have function type or unknown/polymorphic type, the string will + represent an approximation to the actual type. .. rts-flag:: -hr - Break down the graph by retainer set. Retainer profiling is - described in more detail below (:ref:`retainer-prof`). + *Requires :ghc-flag:`-prof`.* Break down the graph by retainer set. Retainer + profiling is described in more detail below (:ref:`retainer-prof`). .. rts-flag:: -hb - Break down the graph by biography. Biographical profiling is - described in more detail below (:ref:`biography-prof`). + *Requires :ghc-flag:`-prof`.* Break down the graph by biography. + Biographical profiling is described in more detail below + (:ref:`biography-prof`). .. rts-flag:: -l diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h index d6838ab..05ce50a 100644 --- a/includes/rts/EventLogFormat.h +++ b/includes/rts/EventLogFormat.h @@ -73,8 +73,7 @@ * * -------------------------------------------------------------------------- */ -#ifndef RTS_EVENTLOGFORMAT_H -#define RTS_EVENTLOGFORMAT_H +#pragma once /* * Markers for begin/end of the Header. @@ -231,7 +230,19 @@ #define CAPSET_TYPE_OSPROCESS 2 /* caps belong to the same OS process */ #define CAPSET_TYPE_CLOCKDOMAIN 3 /* caps share a local clock/time */ -#ifndef EVENTLOG_CONSTANTS_ONLY +/* + * Heap profile breakdown types. See EVENT_HEAP_PROF_BEGIN. + */ +typedef enum { + HEAP_PROF_BREAKDOWN_COST_CENTRE = 0x1, + HEAP_PROF_BREAKDOWN_MODULE, + HEAP_PROF_BREAKDOWN_CLOSURE_DESCR, + HEAP_PROF_BREAKDOWN_TYPE_DESCR, + HEAP_PROF_BREAKDOWN_RETAINER, + HEAP_PROF_BREAKDOWN_BIOGRAPHY, +} HeapProfBreakdown; + +#if !defined(EVENTLOG_CONSTANTS_ONLY) typedef StgWord16 EventTypeNum; typedef StgWord64 EventTimestamp; /* in nanoseconds */ @@ -245,5 +256,3 @@ typedef StgWord64 EventTaskId; /* for EVENT_TASK_* */ typedef StgWord64 EventKernelThreadId; /* for EVENT_TASK_CREATE */ #endif - -#endif /* RTS_EVENTLOGFORMAT_H */ diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index ce4cb38..b3af25d 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -1119,15 +1119,6 @@ void postBlockMarker (EventsBuf *eb) postCapNo(eb, eb->capno); } -typedef enum { - HEAP_PROF_BREAKDOWN_COST_CENTRE = 0x1, - HEAP_PROF_BREAKDOWN_MODULE, - HEAP_PROF_BREAKDOWN_CLOSURE_DESCR, - HEAP_PROF_BREAKDOWN_TYPE_DESCR, - HEAP_PROF_BREAKDOWN_RETAINER, - HEAP_PROF_BREAKDOWN_BIOGRAPHY, -} HeapProfBreakdown; - static HeapProfBreakdown getHeapProfBreakdown(void) { switch (RtsFlags.ProfFlags.doHeapProfile) { From git at git.haskell.org Tue Sep 19 21:10:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: rts: Add heap breakdown type for -hT (3b2fc86) Message-ID: <20170919211053.5E4B93A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3b2fc86a2804424eafbad5ce51ce80ed8c0a4257/ghc >--------------------------------------------------------------- commit 3b2fc86a2804424eafbad5ce51ce80ed8c0a4257 Author: Ben Gamari Date: Mon Sep 4 08:15:08 2017 -0400 rts: Add heap breakdown type for -hT Test Plan: Build, program with `-eventlog`, try running with `+RTS -h` Reviewers: austin, erikd, simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14096 Differential Revision: https://phabricator.haskell.org/D3922 (cherry picked from commit 24e50f988f775c6bba7d1daaee2e23c13650aa3b) >--------------------------------------------------------------- 3b2fc86a2804424eafbad5ce51ce80ed8c0a4257 docs/users_guide/profiling.rst | 4 ++++ includes/rts/EventLogFormat.h | 1 + rts/eventlog/EventLog.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 8cf6bcb..bd56358 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -657,6 +657,10 @@ All the different profile types yield a graph of live heap against time, but they differ in how the live heap is broken down into bands. The following RTS options select which break-down to use: +.. rts-flag:: -hT + + Breaks down the graph by heap closure type. + .. rts-flag:: -hc -h diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h index 05ce50a..f47e3ea 100644 --- a/includes/rts/EventLogFormat.h +++ b/includes/rts/EventLogFormat.h @@ -240,6 +240,7 @@ typedef enum { HEAP_PROF_BREAKDOWN_TYPE_DESCR, HEAP_PROF_BREAKDOWN_RETAINER, HEAP_PROF_BREAKDOWN_BIOGRAPHY, + HEAP_PROF_BREAKDOWN_CLOSURE_TYPE, } HeapProfBreakdown; #if !defined(EVENTLOG_CONSTANTS_ONLY) diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index b3af25d..b82f578 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -1134,6 +1134,8 @@ static HeapProfBreakdown getHeapProfBreakdown(void) return HEAP_PROF_BREAKDOWN_RETAINER; case HEAP_BY_LDV: return HEAP_PROF_BREAKDOWN_BIOGRAPHY; + case HEAP_BY_CLOSURE_TYPE: + return HEAP_PROF_BREAKDOWN_CLOSURE_TYPE; default: barf("getHeapProfBreakdown: unknown heap profiling mode"); } From git at git.haskell.org Tue Sep 19 21:10:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: SetLevels: Substitute in ticks in lvlMFE (9565e52) Message-ID: <20170919211056.169DB3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9565e5267c3376f94f501ec0e1f9ee712a1f6f10/ghc >--------------------------------------------------------------- commit 9565e5267c3376f94f501ec0e1f9ee712a1f6f10 Author: Ben Gamari Date: Mon Sep 4 08:05:33 2017 -0400 SetLevels: Substitute in ticks in lvlMFE Previously SetLevels.lvlMFE would fail to substitute in ticks, unlike lvlExpr. This lead to #13481. Fix this. Test Plan: `make test TEST=T12622 WAY=ghci` Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13481 Differential Revision: https://phabricator.haskell.org/D3920 (cherry picked from commit cd857dd415378ac4204a164407d350b0c3ede5ae) >--------------------------------------------------------------- 9565e5267c3376f94f501ec0e1f9ee712a1f6f10 compiler/simplCore/SetLevels.hs | 3 ++- testsuite/tests/codeGen/should_run/all.T | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 90e1d53..b787695 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -544,7 +544,8 @@ lvlMFE env _ (_, AnnType ty) -- and then inline lvl. Better just to float out the payload. lvlMFE env strict_ctxt (_, AnnTick t e) = do { e' <- lvlMFE env strict_ctxt e - ; return (Tick t e') } + ; let t' = substTickish (le_subst env) t + ; return (Tick t' e') } lvlMFE env strict_ctxt (_, AnnCast e (_, co)) = do { e' <- lvlMFE env strict_ctxt e diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 9f334cf..ffe4b64 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -148,7 +148,7 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) -test('T12622', expect_broken_for(13481, ['ghci']), multimod_compile_and_run, ['T12622', '-O']) +test('T12622', normal, multimod_compile_and_run, ['T12622', '-O']) test('T12757', normal, compile_and_run, ['']) test('T12855', normal, compile_and_run, ['']) test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), From git at git.haskell.org Tue Sep 19 21:10:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:10:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Option "-ddump-rn-ast" dumps imports and exports too (31bf200) Message-ID: <20170919211058.CEA1C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/31bf20032ace1caddb540f45f8be4486185dff83/ghc >--------------------------------------------------------------- commit 31bf20032ace1caddb540f45f8be4486185dff83 Author: Alan Zimmerman Date: Wed Sep 13 14:02:42 2017 +0200 Option "-ddump-rn-ast" dumps imports and exports too Summary: Previously the renamed source decls only were dumped, now the imports, exports and doc_hdr are too. Test Plan: ./validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14197 Differential Revision: https://phabricator.haskell.org/D3949 (cherry picked from commit 2fe6f6baba70de071c391bccc77197ab4f81064d) >--------------------------------------------------------------- 31bf20032ace1caddb540f45f8be4486185dff83 compiler/main/HscMain.hs | 34 +- compiler/typecheck/TcRnDriver.hs | 4 +- compiler/typecheck/TcRnMonad.hs | 5 +- .../parser/should_compile/DumpRenamedAst.stderr | 375 +++++++++++---------- .../tests/parser/should_compile/T14189.stderr | 196 ++++++----- 5 files changed, 342 insertions(+), 272 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 31bf20032ace1caddb540f45f8be4486185dff83 From git at git.haskell.org Tue Sep 19 21:32:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:32:42 +0000 (UTC) Subject: [commit: ghc] branch 'wip/smaller-minJumpTableSize' created Message-ID: <20170919213242.E1F9D3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/smaller-minJumpTableSize Referencing: 6bc81c984eb11185d2df8e519f3b8b1410360ae7 From git at git.haskell.org Tue Sep 19 21:32:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:32:45 +0000 (UTC) Subject: [commit: ghc] wip/smaller-minJumpTableSize: [Experiment] Try minJumpTableSize = 3 (6bc81c9) Message-ID: <20170919213245.AAD423A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/smaller-minJumpTableSize Link : http://ghc.haskell.org/trac/ghc/changeset/6bc81c984eb11185d2df8e519f3b8b1410360ae7/ghc >--------------------------------------------------------------- commit 6bc81c984eb11185d2df8e519f3b8b1410360ae7 Author: Bartosz Nitka Date: Tue Sep 19 14:31:38 2017 -0700 [Experiment] Try minJumpTableSize = 3 Summary: I want to see gipeda results Test Plan: Reviewers: Subscribers: Tasks: Tags: Blame Revision: >--------------------------------------------------------------- 6bc81c984eb11185d2df8e519f3b8b1410360ae7 compiler/cmm/CmmSwitch.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/cmm/CmmSwitch.hs b/compiler/cmm/CmmSwitch.hs index 53d00de..f252caf 100644 --- a/compiler/cmm/CmmSwitch.hs +++ b/compiler/cmm/CmmSwitch.hs @@ -66,9 +66,9 @@ maxJumpTableHole = 7 -- | Minimum size of a jump table. If the number is smaller, the switch is -- implemented using conditionals. --- Currently 5, because an if-then-else tree of 4 values is nice and compact. +-- Currently 3, because that's the heuristic GCC and clang seem to use minJumpTableSize :: Int -minJumpTableSize = 5 +minJumpTableSize = 3 -- | Minimum non-zero offset for a jump table. See Note [Jump Table Offset]. minJumpTableOffset :: Integer @@ -302,7 +302,7 @@ splitAtHoles holeSize m = map (\range -> restrictMap range m) nonHoles -- (into singleton maps, for now). breakTooSmall :: M.Map Integer a -> [M.Map Integer a] breakTooSmall m - | M.size m > minJumpTableSize = [m] + | M.size m >= minJumpTableSize = [m] | otherwise = [M.singleton k v | (k,v) <- M.toList m] --- From git at git.haskell.org Tue Sep 19 21:54:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:54:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "Improve error messages around kind mismatches." (00c959e) Message-ID: <20170919215426.D47213A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/00c959e64370bac44591e433ef3cef7fda3ba78b/ghc >--------------------------------------------------------------- commit 00c959e64370bac44591e433ef3cef7fda3ba78b Author: Ben Gamari Date: Tue Sep 19 17:14:25 2017 -0400 Revert "Improve error messages around kind mismatches." This reverts commit eb870ae0e9d3943268263e6f9ef1c844cdd4cdc5. This reverts commit 6a024a55fa5deefaa45bc2abee9efa63d290266d. There was some disagreement in #11198 regarding whether this patch was in fact the right solution to the issue at hand. >--------------------------------------------------------------- 00c959e64370bac44591e433ef3cef7fda3ba78b compiler/typecheck/TcCanonical.hs | 296 +++++++++------------ compiler/typecheck/TcErrors.hs | 79 ++---- compiler/typecheck/TcEvidence.hs | 8 +- compiler/typecheck/TcFlatten.hs | 31 +-- compiler/typecheck/TcRnTypes.hs | 30 +-- compiler/typecheck/TcSimplify.hs | 34 +-- compiler/typecheck/TcType.hs | 10 +- compiler/typecheck/TcUnify.hs | 28 +- compiler/types/Type.hs | 4 +- testsuite/tests/dependent/should_fail/T11471.hs | 2 +- .../tests/dependent/should_fail/T11471.stderr | 13 +- testsuite/tests/dependent/should_fail/all.T | 2 +- testsuite/tests/deriving/should_fail/T7148.stderr | 8 +- testsuite/tests/gadt/T7558.stderr | 6 +- testsuite/tests/gadt/gadt7.stderr | 6 +- .../tests/ghci.debugger/scripts/break012.stdout | 14 +- .../tests/indexed-types/should_fail/T5934.stderr | 13 + testsuite/tests/polykinds/T11399.stderr | 6 +- testsuite/tests/polykinds/T13555.stderr | 21 +- testsuite/tests/polykinds/T7438.stderr | 6 +- testsuite/tests/polykinds/T8566.stderr | 2 +- testsuite/tests/polykinds/T9017.stderr | 10 +- .../tests/typecheck/should_compile/FD3.stderr | 6 +- .../tests/typecheck/should_compile/T9834.stderr | 4 +- .../tests/typecheck/should_fail/T11672.stderr | 2 +- testsuite/tests/typecheck/should_fail/T12373.hs | 10 - .../tests/typecheck/should_fail/T12373.stderr | 8 - .../tests/typecheck/should_fail/T12785b.stderr | 6 - testsuite/tests/typecheck/should_fail/T13530.hs | 11 - .../tests/typecheck/should_fail/T13530.stderr | 7 - testsuite/tests/typecheck/should_fail/T13610.hs | 11 - .../tests/typecheck/should_fail/T13610.stderr | 10 - testsuite/tests/typecheck/should_fail/T3950.stderr | 5 +- testsuite/tests/typecheck/should_fail/T5691.stderr | 10 +- testsuite/tests/typecheck/should_fail/T7368.stderr | 6 +- .../tests/typecheck/should_fail/T7368a.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 48 +++- testsuite/tests/typecheck/should_fail/T7696.stderr | 4 +- testsuite/tests/typecheck/should_fail/T8262.stderr | 6 +- testsuite/tests/typecheck/should_fail/T8603.hs | 4 - testsuite/tests/typecheck/should_fail/T8603.stderr | 13 +- testsuite/tests/typecheck/should_fail/all.T | 3 - testsuite/tests/typecheck/should_fail/mc19.stderr | 6 +- testsuite/tests/typecheck/should_fail/mc21.stderr | 6 +- testsuite/tests/typecheck/should_fail/mc22.stderr | 6 +- .../tests/typecheck/should_fail/tcfail090.stderr | 4 +- .../tests/typecheck/should_fail/tcfail122.stderr | 6 +- .../tests/typecheck/should_fail/tcfail123.stderr | 4 +- .../tests/typecheck/should_fail/tcfail191.stderr | 6 +- .../tests/typecheck/should_fail/tcfail193.stderr | 6 +- .../tests/typecheck/should_fail/tcfail200.stderr | 6 +- testsuite/tests/typecheck/should_run/T7861.stderr | 6 +- 52 files changed, 378 insertions(+), 483 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 00c959e64370bac44591e433ef3cef7fda3ba78b From git at git.haskell.org Tue Sep 19 21:55:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:25 +0000 (UTC) Subject: [commit: ghc] master: base: Fix fdReady() potentially running forever for Windows Char devices. (826c3b1) Message-ID: <20170919215525.C1D1F3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/826c3b11780abcb74e5aba987e16369d69ac79a5/ghc >--------------------------------------------------------------- commit 826c3b11780abcb74e5aba987e16369d69ac79a5 Author: Niklas Hambüchen Date: Tue Sep 19 15:10:31 2017 -0400 base: Fix fdReady() potentially running forever for Windows Char devices. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3955 >--------------------------------------------------------------- 826c3b11780abcb74e5aba987e16369d69ac79a5 libraries/base/cbits/inputReady.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 14f1c54..ab2a1c2 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -102,6 +102,8 @@ fdReady(int fd, int write, int msecs, int isSock) HANDLE hFile = (HANDLE)_get_osfhandle(fd); DWORD avail; + Time remaining = MSToTime(msecs); + switch (GetFileType(hFile)) { case FILE_TYPE_CHAR: @@ -119,7 +121,11 @@ fdReady(int fd, int write, int msecs, int isSock) while (1) // keep trying until we find a real key event { - rc = WaitForSingleObject( hFile, msecs ); + // WaitForSingleObject takes an unsigned number, + // `remaining` can be negative. Wait 0 if so. + DWORD wait_ms = (DWORD) max(0, TimeToMS(remaining)); + + rc = WaitForSingleObject( hFile, wait_ms ); switch (rc) { case WAIT_TIMEOUT: return 0; case WAIT_OBJECT_0: break; @@ -167,6 +173,9 @@ fdReady(int fd, int write, int msecs, int isSock) } } } + + Time now = getProcessElapsedTime(); + remaining = endTime - now; } } From git at git.haskell.org Tue Sep 19 21:55:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:28 +0000 (UTC) Subject: [commit: ghc] master: base: fdReady(): Improve accuracy and simplify code. (28a115e) Message-ID: <20170919215528.9A1053A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/28a115e5e2c3c19b860545f1fcde4317bac3ee2a/ghc >--------------------------------------------------------------- commit 28a115e5e2c3c19b860545f1fcde4317bac3ee2a Author: Niklas Hambüchen Date: Tue Sep 19 15:09:29 2017 -0400 base: fdReady(): Improve accuracy and simplify code. This is done by reusing the existing cross-platform `getProcessElapsedTime()` function, which already provides nanosecond monotonic clocks, and fallback for platforms that don't have those. To do this, `getProcessElapsedTime()` had to be moved from a private RTS symbol into the public interface. Accuracy is improved in 2 ways: * Use of the monotonic clock where available * Measuring the total time spent waiting instead of a sum of intervals (between which there are small gaps) Reviewers: bgamari, austin, hvr, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3953 >--------------------------------------------------------------- 28a115e5e2c3c19b860545f1fcde4317bac3ee2a includes/rts/Time.h | 4 ++++ libraries/base/cbits/inputReady.c | 31 ++++++++++--------------------- rts/GetTime.h | 1 - rts/RtsSymbols.c | 1 + 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/includes/rts/Time.h b/includes/rts/Time.h index 5fa166e..12c6d27 100644 --- a/includes/rts/Time.h +++ b/includes/rts/Time.h @@ -21,8 +21,10 @@ typedef int64_t Time; #if TIME_RESOLUTION == 1000000000 // I'm being lazy, but it's awkward to define fully general versions of these +#define TimeToMS(t) ((t) / 1000000) #define TimeToUS(t) ((t) / 1000) #define TimeToNS(t) (t) +#define MSToTime(t) ((Time)(t) * 1000000) #define USToTime(t) ((Time)(t) * 1000) #define NSToTime(t) ((Time)(t)) #else @@ -38,3 +40,5 @@ INLINE_HEADER Time fsecondsToTime (double t) { return (Time)(t * TIME_RESOLUTION); } + +Time getProcessElapsedTime (void); diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index e27851a..dbfdb28 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -7,9 +7,9 @@ /* select and supporting types is not Posix */ /* #include "PosixSource.h" */ #include "HsBase.h" +#include "Rts.h" #if !defined(_WIN32) #include -#include #endif /* @@ -25,37 +25,26 @@ fdReady(int fd, int write, int msecs, int isSock) #if !defined(_WIN32) struct pollfd fds[1]; - // if we need to track the then record the current time in case we are + // if we need to track the time then record the end time in case we are // interrupted. - struct timeval tv0; + Time endTime = 0; if (msecs > 0) { - if (gettimeofday(&tv0, NULL) != 0) { - fprintf(stderr, "fdReady: gettimeofday failed: %s\n", - strerror(errno)); - abort(); - } + endTime = getProcessElapsedTime() + MSToTime(msecs); } fds[0].fd = fd; fds[0].events = write ? POLLOUT : POLLIN; fds[0].revents = 0; + Time remaining = MSToTime(msecs); + int res; - while ((res = poll(fds, 1, msecs)) < 0) { + while ((res = poll(fds, 1, TimeToMS(remaining))) < 0) { if (errno == EINTR) { if (msecs > 0) { - struct timeval tv; - if (gettimeofday(&tv, NULL) != 0) { - fprintf(stderr, "fdReady: gettimeofday failed: %s\n", - strerror(errno)); - abort(); - } - - int elapsed = 1000 * (tv.tv_sec - tv0.tv_sec) - + (tv.tv_usec - tv0.tv_usec) / 1000; - msecs -= elapsed; - if (msecs <= 0) return 0; - tv0 = tv; + Time now = getProcessElapsedTime(); + if (now >= endTime) return 0; + remaining = endTime - now; } } else { return (-1); diff --git a/rts/GetTime.h b/rts/GetTime.h index 719b45f..97f499c 100644 --- a/rts/GetTime.h +++ b/rts/GetTime.h @@ -13,7 +13,6 @@ void initializeTimer (void); Time getProcessCPUTime (void); -Time getProcessElapsedTime (void); void getProcessTimes (Time *user, Time *elapsed); /* Get the current date and time. diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index fb9be7f..a696f44 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -605,6 +605,7 @@ SymI_HasProto(getFullProgArgv) \ SymI_HasProto(setFullProgArgv) \ SymI_HasProto(freeFullProgArgv) \ + SymI_HasProto(getProcessElapsedTime) \ SymI_HasProto(getStablePtr) \ SymI_HasProto(foreignExportStablePtr) \ SymI_HasProto(hs_init) \ From git at git.haskell.org Tue Sep 19 21:55:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:31 +0000 (UTC) Subject: [commit: ghc] master: base: Fix fdReady() potentially running forever on Windows. (c2a1fa7) Message-ID: <20170919215531.7C3BF3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2a1fa7aec426727be6df79f3db109183e42cfdc/ghc >--------------------------------------------------------------- commit c2a1fa7aec426727be6df79f3db109183e42cfdc Author: Niklas Hambüchen Date: Tue Sep 19 15:10:00 2017 -0400 base: Fix fdReady() potentially running forever on Windows. This fixes #13497 for Windows -- at least for the `if (isSock)` part; I haven't investigated the case where it's not a socket yet. Solved by copying the new current-time based waiting logic from the non-Windows implementation above. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3954 >--------------------------------------------------------------- c2a1fa7aec426727be6df79f3db109183e42cfdc libraries/base/cbits/inputReady.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index dbfdb28..14f1c54 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -21,10 +21,6 @@ int fdReady(int fd, int write, int msecs, int isSock) { - -#if !defined(_WIN32) - struct pollfd fds[1]; - // if we need to track the time then record the end time in case we are // interrupted. Time endTime = 0; @@ -32,6 +28,9 @@ fdReady(int fd, int write, int msecs, int isSock) endTime = getProcessElapsedTime() + MSToTime(msecs); } +#if !defined(_WIN32) + struct pollfd fds[1]; + fds[0].fd = fd; fds[0].events = write ? POLLOUT : POLLIN; fds[0].revents = 0; @@ -59,7 +58,8 @@ fdReady(int fd, int write, int msecs, int isSock) if (isSock) { int maxfd, ready; fd_set rfd, wfd; - struct timeval tv; + struct timeval remaining_tv; + if ((fd >= (int)FD_SETSIZE) || (fd < 0)) { fprintf(stderr, "fdReady: fd is too big"); abort(); @@ -76,12 +76,22 @@ fdReady(int fd, int write, int msecs, int isSock) * (maxfd-1) */ maxfd = fd + 1; - tv.tv_sec = msecs / 1000; - tv.tv_usec = (msecs % 1000) * 1000; - while ((ready = select(maxfd, &rfd, &wfd, NULL, &tv)) < 0 ) { - if (errno != EINTR ) { - return -1; + Time remaining = MSToTime(msecs); + remaining_tv.tv_sec = TimeToMS(remaining) / 1000; + remaining_tv.tv_usec = TimeToUS(remaining) % 1000000; + + while ((ready = select(maxfd, &rfd, &wfd, NULL, &remaining_tv)) < 0 ) { + if (errno == EINTR) { + if (msecs > 0) { + Time now = getProcessElapsedTime(); + if (now >= endTime) return 0; + remaining = endTime - now; + remaining_tv.tv_sec = TimeToMS(remaining) / 1000; + remaining_tv.tv_usec = TimeToUS(remaining) % 1000000; + } + } else { + return (-1); } } From git at git.haskell.org Tue Sep 19 21:55:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:40 +0000 (UTC) Subject: [commit: ghc] master: base: Add more detail to FD_SETSIZE related error message (022455f) Message-ID: <20170919215540.0FFE63A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/022455ffcf01e950ec020f9873874e68fbf7c666/ghc >--------------------------------------------------------------- commit 022455ffcf01e950ec020f9873874e68fbf7c666 Author: Niklas Hambüchen Date: Tue Sep 19 15:14:27 2017 -0400 base: Add more detail to FD_SETSIZE related error message Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3960 >--------------------------------------------------------------- 022455ffcf01e950ec020f9873874e68fbf7c666 libraries/base/cbits/inputReady.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 916633c..481c9de 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -80,8 +80,7 @@ fdReady(int fd, int write, int msecs, int isSock) struct timeval remaining_tv; if ((fd >= (int)FD_SETSIZE) || (fd < 0)) { - fprintf(stderr, "fdReady: fd is too big"); - abort(); + barf("fdReady: fd is too big: %d but FD_SETSIZE is %d", fd, (int)FD_SETSIZE); } FD_ZERO(&rfd); FD_ZERO(&wfd); From git at git.haskell.org Tue Sep 19 21:55:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:37 +0000 (UTC) Subject: [commit: ghc] master: base: Fix fdReady() returning immediately for pipes on Windows. (66240c9) Message-ID: <20170919215537.4990E3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/66240c9bc77408f841e8cf974d44580434fb1a48/ghc >--------------------------------------------------------------- commit 66240c9bc77408f841e8cf974d44580434fb1a48 Author: Niklas Hambüchen Date: Tue Sep 19 15:11:05 2017 -0400 base: Fix fdReady() returning immediately for pipes on Windows. See https://ghc.haskell.org/trac/ghc/ticket/13497#comment:17 Until now, the program import System.IO main = hWaitForInput stdin (5 * 1000) didn't wait 5 seconds for input on Winodws, it terminated immediately. This was because the `PeekNamedPipe()` function introduced in commit 94fee9e7 really only peeks, it doesn't block. So if there's no data, `fdReady(fd, msec)` would return immediately even when the given `msec` timeout is not zero. This commit fixes it by looping around `PeekNamedPipe()` with a `sleep(1 ms)`. Apparently there's no better way to do this on Windows without switching to IOCP. In any case, this change should be strictly better than what was there before. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3956 >--------------------------------------------------------------- 66240c9bc77408f841e8cf974d44580434fb1a48 libraries/base/cbits/inputReady.c | 46 +++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index ab2a1c2..ddeee66 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -17,6 +17,9 @@ * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is * negative). "Input is available" is defined as 'can I safely read at least a * *character* from this file object without blocking?' + * + * This function blocks until either `msecs` have passed, or input is + * available. */ int fdReady(int fd, int write, int msecs, int isSock) @@ -100,7 +103,7 @@ fdReady(int fd, int write, int msecs, int isSock) } else { DWORD rc; HANDLE hFile = (HANDLE)_get_osfhandle(fd); - DWORD avail; + DWORD avail = 0; Time remaining = MSToTime(msecs); @@ -187,23 +190,34 @@ fdReady(int fd, int write, int msecs, int isSock) // WaitForMultipleObjects() doesn't work for pipes (it // always returns WAIT_OBJECT_0 even when no data is // available). If the HANDLE is a pipe, therefore, we try - // PeekNamedPipe: + // PeekNamedPipe(): // - rc = PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL ); - if (rc != 0) { - if (avail != 0) { - return 1; + // PeekNamedPipe() does not block, so if it returns that + // there is no new data, we have to sleep and try again. + while (avail == 0) { + rc = PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL ); + if (rc != 0) { + if (avail != 0) { + return 1; + } else { // no new data + if (msecs > 0) { + Time now = getProcessElapsedTime(); + if (now >= endTime) return 0; + Sleep(1); // 1 millisecond (smallest possible time on Windows) + continue; + } else { + return 0; + } + } } else { - return 0; - } - } else { - rc = GetLastError(); - if (rc == ERROR_BROKEN_PIPE) { - return 1; // this is probably what we want - } - if (rc != ERROR_INVALID_HANDLE && rc != ERROR_INVALID_FUNCTION) { - maperrno(); - return -1; + rc = GetLastError(); + if (rc == ERROR_BROKEN_PIPE) { + return 1; // this is probably what we want + } + if (rc != ERROR_INVALID_HANDLE && rc != ERROR_INVALID_FUNCTION) { + maperrno(); + return -1; + } } } /* PeekNamedPipe didn't work - fall through to the general case */ From git at git.haskell.org Tue Sep 19 21:55:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:34 +0000 (UTC) Subject: [commit: ghc] master: rts: Update comment about FreeBSD's unsigned FD_SETSIZE (11c478b) Message-ID: <20170919215534.645643A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/11c478b50e2f56174889fadef3a4e51ed95907d3/ghc >--------------------------------------------------------------- commit 11c478b50e2f56174889fadef3a4e51ed95907d3 Author: Niklas Hambüchen Date: Tue Sep 19 15:11:38 2017 -0400 rts: Update comment about FreeBSD's unsigned FD_SETSIZE Reviewers: bgamari, austin, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3957 >--------------------------------------------------------------- 11c478b50e2f56174889fadef3a4e51ed95907d3 rts/posix/Select.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rts/posix/Select.c b/rts/posix/Select.c index 3d3b70b..270e6ff 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -256,9 +256,14 @@ awaitEvent(bool wait) for(tso = blocked_queue_hd; tso != END_TSO_QUEUE; tso = next) { next = tso->_link; - /* On FreeBSD FD_SETSIZE is unsigned. Cast it to signed int + /* On older FreeBSDs, FD_SETSIZE is unsigned. Cast it to signed int * in order to switch off the 'comparison between signed and * unsigned error message + * Newer versions of FreeBSD have switched to unsigned int: + * https://github.com/freebsd/freebsd/commit/12ae7f74a071f0439763986026525094a7032dfd + * http://fa.freebsd.cvs-all.narkive.com/bCWNHbaC/svn-commit-r265051-head-sys-sys + * So the (int) cast should be removed across the code base once + * GHC requires a version of FreeBSD that has that change in it. */ switch (tso->why_blocked) { case BlockedOnRead: From git at git.haskell.org Tue Sep 19 21:55:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:42 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix typo in comment (b7f2d12) Message-ID: <20170919215542.C73AF3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b7f2d1256949c016724577168106002c4b12169c/ghc >--------------------------------------------------------------- commit b7f2d1256949c016724577168106002c4b12169c Author: Niklas Hambüchen Date: Tue Sep 19 15:12:11 2017 -0400 rts: Fix typo in comment Reviewers: bgamari, austin, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3958 >--------------------------------------------------------------- b7f2d1256949c016724577168106002c4b12169c rts/Schedule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/Schedule.h b/rts/Schedule.h index 23a1a5b..49e094b 100644 --- a/rts/Schedule.h +++ b/rts/Schedule.h @@ -65,7 +65,7 @@ extern volatile StgWord sched_state; * The timer interrupt transitions ACTIVITY_YES into * ACTIVITY_MAYBE_NO, waits for RtsFlags.GcFlags.idleGCDelayTime, * and then: - * - if idle GC is no, set ACTIVITY_INACTIVE and wakeUpRts() + * - if idle GC is on, set ACTIVITY_INACTIVE and wakeUpRts() * - if idle GC is off, set ACTIVITY_DONE_GC and stopTimer() * * If the scheduler finds ACTIVITY_INACTIVE, then it sets From git at git.haskell.org Tue Sep 19 21:55:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 21:55:45 +0000 (UTC) Subject: [commit: ghc] master: base: Make it less likely for fdReady() to fail on Windows sockets. (ba4dcc7) Message-ID: <20170919215545.8B66B3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ba4dcc7cb77a37486368911fec854d112a1db93c/ghc >--------------------------------------------------------------- commit ba4dcc7cb77a37486368911fec854d112a1db93c Author: Niklas Hambüchen Date: Tue Sep 19 15:12:56 2017 -0400 base: Make it less likely for fdReady() to fail on Windows sockets. See the added comment for details. It's "less likely" because it can still fail if the socket happens to have an FD larger than 1023, which can happen if many files are opened. Until now, basic socket programs that use `hWaitForInput` were broken on Windows. That is because on Windows `FD_SETSIZE` defaults to 64, but pretty much all GHC programs seem to have > 64 FDs open, so you can't actually create a socket on which you can `select()`. It errors with `fdReady: fd is too big` even with an example as simple as the following (in this case, on my machine the `fd` is `284`): {-# LANGUAGE OverloadedStrings #-} import Control.Monad (forever) import Network.Socket import System.IO -- Simple echo server: Reads up to 10 chars from network, echoes them back. -- Uses the Handle API so that `hWaitForInput` can be used. main :: IO () main = do sock <- socket AF_INET Stream 0 setSocketOption sock ReuseAddr 1 bind sock (SockAddrInet 1234 0x0100007f) -- 0x0100007f == 127.0.0.1 localhost listen sock 2 forever $ do (connSock, _connAddr) <- accept sock putStrLn "Got connection" h <- socketToHandle connSock ReadWriteMode hSetBuffering h NoBuffering ready <- hWaitForInput h (5 * 1000) -- 5 seconds putStrLn $ "Ready: " ++ show ready line <- hGetLine h putStrLn "Got line" hPutStrLn h ("Got: " ++ line) hClose h I'm not sure how this was not discovered earlier; for #13525 (where `fdReady()` breaking completely was also discovered late) at least it failed only when the timeout was non-zero, which is not used in ghc beyond in `hWaitForInput`, but in this Windows socket case it breaks even on the 0-timeout. Maybe there is not actually anybody who uses sockets as handles on Windows? The workaround for now is to increase `FD_SETSIZE` on Windows; increasing it is possible on Windows and BSD, see https://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsi ze-and-select A real fix would be to move to IO Completion Ports on Windows, and thus get rid of the last uses of `select()` (the other platforms already use `poll()` but Windows doesn't have that). Reviewers: bgamari, austin, hvr, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3959 >--------------------------------------------------------------- ba4dcc7cb77a37486368911fec854d112a1db93c libraries/base/cbits/inputReady.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index ddeee66..916633c 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -4,6 +4,22 @@ * hWaitForInput Runtime Support */ +/* FD_SETSIZE defaults to 64 on Windows, which makes even the most basic + * programs break that use select() on a socket FD. + * Thus we raise it here (before any #include of network-related headers) + * to 1024 so that at least those programs would work that would work on + * Linux if that used select() (luckily it uses poll() by now). + * See https://ghc.haskell.org/trac/ghc/ticket/13497#comment:23 + * The real solution would be to remove all uses of select() + * on Windows, too, and use IO Completion Ports instead. + * Note that on Windows, one can simply define FD_SETSIZE to the desired + * size before including Winsock2.h, as described here: + * https://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx + */ +#if defined(_WIN32) +#define FD_SETSIZE 1024 +#endif + /* select and supporting types is not Posix */ /* #include "PosixSource.h" */ #include "HsBase.h" From git at git.haskell.org Tue Sep 19 22:54:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 22:54:37 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Mention changes necessary due to #13391 (bbb8cb9) Message-ID: <20170919225437.F24763A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bbb8cb92b66d83bb7d472e7905c84c28cbb0997c/ghc >--------------------------------------------------------------- commit bbb8cb92b66d83bb7d472e7905c84c28cbb0997c Author: Ben Gamari Date: Tue Sep 19 16:57:08 2017 -0400 users-guide: Mention changes necessary due to #13391 Some variant of this should also be added to the migration guide. [skip ci] Test Plan: Read it Reviewers: goldfire, austin Reviewed By: goldfire Subscribers: rwbarton, thomie GHC Trac Issues: #13391 Differential Revision: https://phabricator.haskell.org/D3966 >--------------------------------------------------------------- bbb8cb92b66d83bb7d472e7905c84c28cbb0997c docs/users_guide/8.4.1-notes.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/users_guide/8.4.1-notes.rst b/docs/users_guide/8.4.1-notes.rst index 2d03190..9a1235f 100644 --- a/docs/users_guide/8.4.1-notes.rst +++ b/docs/users_guide/8.4.1-notes.rst @@ -59,6 +59,24 @@ Language data StrictJust a <- Just !a where StrictJust !a = Just a +- GADTs with kind-polymorphic type arguments now require :ghc-flag:`TypeInType`. + For instance, consider the following, :: + + data G :: k -> * where + GInt :: G Int + GMaybe :: G Maybe + + In previous releases this would compile with :ghc-flag:`PolyKinds` alone due + to bug :ghc-ticket:`13391`. As of GHC 8.4, however, this requires + :ghc-flag:`TypeInType`. Note that since GADT kind signatures aren't generalized, + this will also require that you provide a :ref:`CUSK + ` by explicitly quantifying over the kind argument, + ``k``, :: + + data G :: forall k. k -> * where + GInt :: G Int + GMaybe :: G Maybe + Compiler ~~~~~~~~ From git at git.haskell.org Tue Sep 19 22:54:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 22:54:40 +0000 (UTC) Subject: [commit: ghc] master: Factor mkCoreApp and mkCoreApps (3198956) Message-ID: <20170919225440.AA6673A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3198956d371d1c16668b8131d1317b822f6c5cfe/ghc >--------------------------------------------------------------- commit 3198956d371d1c16668b8131d1317b822f6c5cfe Author: Arnaud Spiwack Date: Tue Sep 19 16:57:25 2017 -0400 Factor mkCoreApp and mkCoreApps `mkCoreApps` re-implemented `mkCoreApp` in a recursive function, rather than using a simple `foldl'` in order to avoid repeatingly computing the type of the function argument. I've factored the two logic into a new (internal) function `mkCoreType` which assumes that the type is known. `mkCoreApp` and `mkCoreApps` are thin wrappers around it. Differences - The assertion failure message of `mkCoreApps` has more information in it. - `mkCoreApps` now special-cases coercion argument like `mkCoreApp` (previously they were given to `mk_val_app` instead) Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3971 >--------------------------------------------------------------- 3198956d371d1c16668b8131d1317b822f6c5cfe compiler/coreSyn/MkCore.hs | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/compiler/coreSyn/MkCore.hs b/compiler/coreSyn/MkCore.hs index 2ea0c89..a3aea31 100644 --- a/compiler/coreSyn/MkCore.hs +++ b/compiler/coreSyn/MkCore.hs @@ -120,34 +120,43 @@ mkCoreLets :: [CoreBind] -> CoreExpr -> CoreExpr mkCoreLets binds body = foldr mkCoreLet body binds -- | Construct an expression which represents the application of one expression +-- paired with its type to an argument. The result is paired with its type. This +-- function is not exported and used in the definition of 'mkCoreApp' and +-- 'mkCoreApps'. +-- Respects the let/app invariant by building a case expression where necessary +-- See CoreSyn Note [CoreSyn let/app invariant] +mkCoreAppTyped :: SDoc -> (CoreExpr, Type) -> CoreExpr -> (CoreExpr, Type) +mkCoreAppTyped _ (fun, fun_ty) (Type ty) + = (App fun (Type ty), piResultTy fun_ty ty) +mkCoreAppTyped _ (fun, fun_ty) (Coercion co) + = (App fun (Coercion co), res_ty) + where + (_, res_ty) = splitFunTy fun_ty +mkCoreAppTyped d (fun, fun_ty) arg + = ASSERT2( isFunTy fun_ty, ppr fun $$ ppr arg $$ d ) + (mk_val_app fun arg arg_ty res_ty, res_ty) + where + (arg_ty, res_ty) = splitFunTy fun_ty + +-- | Construct an expression which represents the application of one expression -- to the other -mkCoreApp :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr -- Respects the let/app invariant by building a case expression where necessary -- See CoreSyn Note [CoreSyn let/app invariant] -mkCoreApp _ fun (Type ty) = App fun (Type ty) -mkCoreApp _ fun (Coercion co) = App fun (Coercion co) -mkCoreApp d fun arg = ASSERT2( isFunTy fun_ty, ppr fun $$ ppr arg $$ d ) - mk_val_app fun arg arg_ty res_ty - where - fun_ty = exprType fun - (arg_ty, res_ty) = splitFunTy fun_ty +mkCoreApp :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr +mkCoreApp s fun arg + = fst $ mkCoreAppTyped s (fun, exprType fun) arg -- | Construct an expression which represents the application of a number of -- expressions to another. The leftmost expression in the list is applied first -- Respects the let/app invariant by building a case expression where necessary -- See CoreSyn Note [CoreSyn let/app invariant] mkCoreApps :: CoreExpr -> [CoreExpr] -> CoreExpr --- Slightly more efficient version of (foldl mkCoreApp) -mkCoreApps orig_fun orig_args - = go orig_fun (exprType orig_fun) orig_args +mkCoreApps fun args + = fst $ + foldl' (mkCoreAppTyped doc_string) (fun, fun_ty) args where - go fun _ [] = fun - go fun fun_ty (Type ty : args) = go (App fun (Type ty)) (piResultTy fun_ty ty) args - go fun fun_ty (arg : args) = ASSERT2( isFunTy fun_ty, ppr fun_ty $$ ppr orig_fun - $$ ppr orig_args ) - go (mk_val_app fun arg arg_ty res_ty) res_ty args - where - (arg_ty, res_ty) = splitFunTy fun_ty + doc_string = ppr fun_ty $$ ppr fun $$ ppr args + fun_ty = exprType fun -- | Construct an expression which represents the application of a number of -- expressions to that of a data constructor expression. The leftmost expression From git at git.haskell.org Tue Sep 19 22:54:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 22:54:43 +0000 (UTC) Subject: [commit: ghc] master: cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers (7920a7d) Message-ID: <20170919225443.6D33B3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7920a7d9c53083b234e060a3e72f00b601a46808/ghc >--------------------------------------------------------------- commit 7920a7d9c53083b234e060a3e72f00b601a46808 Author: Ben Gamari Date: Tue Sep 19 16:57:41 2017 -0400 cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers As noted in #14226, the common block elimination pass currently implements an extremely strict equivalence relation, demanding that two blocks are equivalent including the names of their local registers. This is quite restrictive and severely hampers the effectiveness of the pass. Here we allow the CBE pass to collapse blocks which are equivalent up to alpha renaming of locally-bound local registers. This is completely safe and catches many more duplicate blocks. Test Plan: Validate Reviewers: austin, simonmar, michalt Reviewed By: michalt Subscribers: rwbarton, thomie GHC Trac Issues: #14226 Differential Revision: https://phabricator.haskell.org/D3973 >--------------------------------------------------------------- 7920a7d9c53083b234e060a3e72f00b601a46808 compiler/cmm/CmmCommonBlockElim.hs | 237 ++++++++++++++++++++++++++++--------- compiler/cmm/Hoopl/Block.hs | 1 + 2 files changed, 180 insertions(+), 58 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7920a7d9c53083b234e060a3e72f00b601a46808 From git at git.haskell.org Tue Sep 19 22:54:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 22:54:46 +0000 (UTC) Subject: [commit: ghc] master: Restore function powModSecInteger (0aba999) Message-ID: <20170919225446.2899C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0aba999f60babe6878a1fd2cc8410139358cad16/ghc >--------------------------------------------------------------- commit 0aba999f60babe6878a1fd2cc8410139358cad16 Author: Olivier Chéron Date: Tue Sep 19 16:58:01 2017 -0400 Restore function powModSecInteger The function existed in integer-gmp-0.5.1.0 but was removed as part of integer-gmp2 rewrite in #9281. This is to bring it back. Test Plan: Case integerGmpInternals, with GMP 4.3.2 and GMP 6.1.2 Reviewers: austin, hvr, goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3947 >--------------------------------------------------------------- 0aba999f60babe6878a1fd2cc8410139358cad16 libraries/integer-gmp/cbits/wrappers.c | 61 +++++++++++++++++++++- libraries/integer-gmp/include/HsIntegerGmp.h.in | 3 ++ .../integer-gmp/src/GHC/Integer/GMP/Internals.hs | 1 + libraries/integer-gmp/src/GHC/Integer/Type.hs | 48 +++++++++++++++++ testsuite/tests/lib/integer/integerGmpInternals.hs | 4 +- 5 files changed, 113 insertions(+), 4 deletions(-) diff --git a/libraries/integer-gmp/cbits/wrappers.c b/libraries/integer-gmp/cbits/wrappers.c index 446a681..8f147ad 100644 --- a/libraries/integer-gmp/cbits/wrappers.c +++ b/libraries/integer-gmp/cbits/wrappers.c @@ -11,6 +11,7 @@ #include "HsFFI.h" #include "MachDeps.h" +#include "HsIntegerGmp.h" #include #include @@ -626,7 +627,7 @@ integer_gmp_powm(mp_limb_t rp[], // result } const mpz_t b = CONST_MPZ_INIT(bp, mp_limb_zero_p(bp,bn) ? 0 : bn); - const mpz_t e = CONST_MPZ_INIT(ep, mp_limb_zero_p(ep,en) ? 0 : en); + const mpz_t e = CONST_MPZ_INIT(ep, en); const mpz_t m = CONST_MPZ_INIT(mp, mn); mpz_t r; @@ -687,6 +688,64 @@ integer_gmp_powm_word(const mp_limb_t b0, // base return integer_gmp_powm1(&b0, !!b0, &e0, !!e0, m0); } +/* version of integer_gmp_powm() based on mpz_powm_sec + * + * With GMP 5.0 or later execution time depends on size of arguments + * and size of result. + * + * 'M' must be odd and 'E' non-negative. + */ +mp_size_t +integer_gmp_powm_sec(mp_limb_t rp[], // result + const mp_limb_t bp[], const mp_size_t bn, // base + const mp_limb_t ep[], const mp_size_t en, // exponent + const mp_limb_t mp[], const mp_size_t mn) // mod +{ + assert(!mp_limb_zero_p(mp,mn)); + assert(mp[0] & 1); + + if ((mn == 1 || mn == -1) && mp[0] == 1) { + rp[0] = 0; + return 1; + } + + if (mp_limb_zero_p(ep,en)) { + rp[0] = 1; + return 1; + } + + assert(en > 0); + + const mpz_t b = CONST_MPZ_INIT(bp, mp_limb_zero_p(bp,bn) ? 0 : bn); + const mpz_t e = CONST_MPZ_INIT(ep, en); + const mpz_t m = CONST_MPZ_INIT(mp, mn); + + mpz_t r; + mpz_init (r); + +#if HAVE_SECURE_POWM == 0 + mpz_powm(r, b, e, m); +#else + mpz_powm_sec(r, b, e, m); +#endif + + const mp_size_t rn = r[0]._mp_size; + + if (rn) { + assert(0 < rn && rn <= mn); + memcpy(rp, r[0]._mp_d, rn*sizeof(mp_limb_t)); + } + + mpz_clear (r); + + if (!rn) { + rp[0] = 0; + return 1; + } + + return rn; +} + /* wrapper around mpz_invert() * diff --git a/libraries/integer-gmp/include/HsIntegerGmp.h.in b/libraries/integer-gmp/include/HsIntegerGmp.h.in index 4823841..08ff8df 100644 --- a/libraries/integer-gmp/include/HsIntegerGmp.h.in +++ b/libraries/integer-gmp/include/HsIntegerGmp.h.in @@ -9,3 +9,6 @@ #define GHC_GMP_VERSION_PL @GhcGmpVerPl@ #define GHC_GMP_VERSION \ (@GhcGmpVerMj@ * 10000 + @GhcGmpVerMi@ * 100 + @GhcGmpVerPl@) + +/* Whether GMP supports mpz_powm_sec */ +#define HAVE_SECURE_POWM @HaveSecurePowm@ diff --git a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs index 0d8d572..fcf4da5 100644 --- a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs +++ b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs @@ -48,6 +48,7 @@ module GHC.Integer.GMP.Internals , lcmInteger , sqrInteger , powModInteger + , powModSecInteger , recipModInteger -- ** Additional conversion operations to 'Integer' diff --git a/libraries/integer-gmp/src/GHC/Integer/Type.hs b/libraries/integer-gmp/src/GHC/Integer/Type.hs index 952ff6d..cb1ceec 100644 --- a/libraries/integer-gmp/src/GHC/Integer/Type.hs +++ b/libraries/integer-gmp/src/GHC/Integer/Type.hs @@ -25,6 +25,7 @@ module GHC.Integer.Type where #include "MachDeps.h" +#include "HsIntegerGmp.h" -- Sanity check as CPP defines are implicitly 0-valued when undefined #if !(defined(SIZEOF_LONG) && defined(SIZEOF_HSWORD) \ @@ -1376,6 +1377,32 @@ powModInteger b e m = case m of b' = integerToSBigNat b e' = integerToSBigNat e +-- | \"@'powModSecInteger' /b/ /e/ /m/@\" computes base @/b/@ raised to +-- exponent @/e/@ modulo @/m/@. It is required that @/e/ >= 0@ and +-- @/m/@ is odd. +-- +-- This is a \"secure\" variant of 'powModInteger' using the +-- @mpz_powm_sec()@ function which is designed to be resilient to side +-- channel attacks and is therefore intended for cryptographic +-- applications. +-- +-- This primitive is only available when the underlying GMP library +-- supports it (GMP >= 5). Otherwise, it internally falls back to +-- @'powModInteger'@, and a warning will be emitted when used. +-- +-- @since TODO +{-# NOINLINE powModSecInteger #-} +powModSecInteger :: Integer -> Integer -> Integer -> Integer +powModSecInteger b e m = bigNatToInteger (powModSecSBigNat b' e' m') + where + b' = integerToSBigNat b + e' = integerToSBigNat e + m' = absSBigNat (integerToSBigNat m) + +#if HAVE_SECURE_POWM == 0 +{-# WARNING powModSecInteger "The underlying GMP library does not support a secure version of powModInteger which is side-channel resistant - you need at least GMP version 5 to support this" #-} +#endif + -- | Version of 'powModInteger' operating on 'BigNat's -- -- @since 1.0.0.0 @@ -1428,6 +1455,27 @@ foreign import ccall unsafe "integer_gmp_powm1" integer_gmp_powm1# :: ByteArray# -> GmpSize# -> ByteArray# -> GmpSize# -> GmpLimb# -> GmpLimb# +-- internal non-exported helper +powModSecSBigNat :: SBigNat -> SBigNat -> BigNat -> BigNat +powModSecSBigNat b e m@(BN# m#) = runS $ do + r@(MBN# r#) <- newBigNat# mn# + I# rn_# <- liftIO (integer_gmp_powm_sec# r# b# bn# e# en# m# mn#) + let rn# = narrowGmpSize# rn_# + case isTrue# (rn# ==# mn#) of + False -> unsafeShrinkFreezeBigNat# r rn# + True -> unsafeFreezeBigNat# r + where + !(BN# b#) = absSBigNat b + !(BN# e#) = absSBigNat e + bn# = ssizeofSBigNat# b + en# = ssizeofSBigNat# e + mn# = sizeofBigNat# m + +foreign import ccall unsafe "integer_gmp_powm_sec" + integer_gmp_powm_sec# :: MutableByteArray# RealWorld + -> ByteArray# -> GmpSize# -> ByteArray# -> GmpSize# + -> ByteArray# -> GmpSize# -> IO GmpSize + -- | \"@'recipModInteger' /x/ /m/@\" computes the inverse of @/x/@ modulo @/m/@. If -- the inverse exists, the return value @/y/@ will satisfy @0 < /y/ < diff --git a/testsuite/tests/lib/integer/integerGmpInternals.hs b/testsuite/tests/lib/integer/integerGmpInternals.hs index 4edf5d6..c90df5c 100644 --- a/testsuite/tests/lib/integer/integerGmpInternals.hs +++ b/testsuite/tests/lib/integer/integerGmpInternals.hs @@ -20,13 +20,11 @@ import qualified GHC.Integer.GMP.Internals as I recipModInteger :: Integer -> Integer -> Integer recipModInteger = I.recipModInteger --- FIXME: Lacks GMP2 version gcdExtInteger :: Integer -> Integer -> (Integer, Integer) gcdExtInteger a b = case I.gcdExtInteger a b of (# g, s #) -> (g, s) --- FIXME: Lacks GMP2 version powModSecInteger :: Integer -> Integer -> Integer -> Integer -powModSecInteger = powModInteger +powModSecInteger = I.powModSecInteger powModInteger :: Integer -> Integer -> Integer -> Integer powModInteger = I.powModInteger From git at git.haskell.org Tue Sep 19 22:54:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Sep 2017 22:54:48 +0000 (UTC) Subject: [commit: ghc] master: Make zipWith and zipWith3 inlinable. (11d9615) Message-ID: <20170919225448.DA0B83A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/11d9615e9f751d6ed084f1cb20c24ad6b408230e/ghc >--------------------------------------------------------------- commit 11d9615e9f751d6ed084f1cb20c24ad6b408230e Author: HE, Tao Date: Tue Sep 19 16:58:19 2017 -0400 Make zipWith and zipWith3 inlinable. Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie GHC Trac Issues: #14224 Differential Revision: https://phabricator.haskell.org/D3986 >--------------------------------------------------------------- 11d9615e9f751d6ed084f1cb20c24ad6b408230e libraries/base/GHC/List.hs | 15 +++++++++------ libraries/base/changelog.md | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 37bba9a..af50213 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -992,9 +992,11 @@ zip3 _ _ _ = [] -- > zipWith f [] _|_ = [] {-# NOINLINE [1] zipWith #-} zipWith :: (a->b->c) -> [a]->[b]->[c] -zipWith _f [] _bs = [] -zipWith _f _as [] = [] -zipWith f (a:as) (b:bs) = f a b : zipWith f as bs +zipWith f = go + where + go [] _ = [] + go _ [] = [] + go (x:xs) (y:ys) = f x y : go xs ys -- zipWithFB must have arity 2 since it gets two arguments in the "zipWith" -- rule; it might not get inlined otherwise @@ -1011,9 +1013,10 @@ zipWithFB c f = \x y r -> (x `f` y) `c` r -- elements, as well as three lists and returns a list of their point-wise -- combination, analogous to 'zipWith'. zipWith3 :: (a->b->c->d) -> [a]->[b]->[c]->[d] -zipWith3 z (a:as) (b:bs) (c:cs) - = z a b c : zipWith3 z as bs cs -zipWith3 _ _ _ _ = [] +zipWith3 z = go + where + go (a:as) (b:bs) (c:cs) = z a b c : go as bs cs + go _ _ _ = [] -- | 'unzip' transforms a list of pairs into a list of first components -- and a list of second components. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f641299..5fd7ba3 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -45,6 +45,8 @@ * Add missing `MonadFail` instance for `Control.Monad.Strict.ST.ST` + * Make `zipWith` and `zipWith3` inlinable (#14224) + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* From git at git.haskell.org Wed Sep 20 13:32:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 13:32:45 +0000 (UTC) Subject: [commit: ghc] master: Add 'stm' package to the global package database (02ff705) Message-ID: <20170920133245.514243A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/02ff70563e490d2a7f3141eab7229803c523da57/ghc >--------------------------------------------------------------- commit 02ff70563e490d2a7f3141eab7229803c523da57 Author: Herbert Valerio Riedel Date: Wed Sep 20 15:16:24 2017 +0200 Add 'stm' package to the global package database This is a preparation for `haskeline` picking up a dependency on `stm` real soon now. See https://github.com/judah/haskeline/pull/61 for details. If we figure out a way to not bundle the libraries depended upon by the GHCi executable in the global package database (see #8919 for the original reason why we had to start bundling terminfo/haskeline in the first place) we can get rid of `stm` again... On the bright side, we were able to avoid uploading new `stm` releases for over two years already, so it shouldn't cause too much trouble if GHC imposes a strong preference on the `stm` package's version (this most likely will mostly affect Linux distributions & similiar). While at it, this also update the stm submodule to include relaxed bounds to allow the upcoming base-4.11 version. >--------------------------------------------------------------- 02ff70563e490d2a7f3141eab7229803c523da57 ghc.mk | 1 + libraries/stm | 2 +- packages | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ghc.mk b/ghc.mk index 1e37209..c9437fb 100644 --- a/ghc.mk +++ b/ghc.mk @@ -470,6 +470,7 @@ else libraries/haskeline_CONFIGURE_OPTS += --flags=-terminfo endif +PACKAGES_STAGE1 += stm PACKAGES_STAGE1 += haskeline PACKAGES_STAGE1 += ghci diff --git a/libraries/stm b/libraries/stm index b6e863e..d65fd4d 160000 --- a/libraries/stm +++ b/libraries/stm @@ -1 +1 @@ -Subproject commit b6e863e517bdcc3c5de1fbcb776a3fd7e6fe2103 +Subproject commit d65fd4de49635a1e53405fe6699b46363a9d134e diff --git a/packages b/packages index 9af1b64..c72f6f4 100644 --- a/packages +++ b/packages @@ -65,7 +65,7 @@ libraries/Win32 - - https:/ libraries/xhtml - - https://github.com/haskell/xhtml.git nofib nofib - - libraries/parallel extra - ssh://git at github.com/haskell/parallel.git -libraries/stm extra - - +libraries/stm - - ssh://git at github.com/haskell/stm.git libraries/random extra - https://github.com/haskell/random.git libraries/primitive dph - https://github.com/haskell/primitive.git libraries/vector dph - https://github.com/haskell/vector.git From git at git.haskell.org Wed Sep 20 13:44:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 13:44:24 +0000 (UTC) Subject: [commit: packages/hpc] master: Bump upper bound on base (e7cd0cd) Message-ID: <20170920134424.C82473A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/e7cd0cd59b93121c08c25e006c6dda72a17dd24e >--------------------------------------------------------------- commit e7cd0cd59b93121c08c25e006c6dda72a17dd24e Author: Ben Gamari Date: Fri Sep 15 12:11:21 2017 -0400 Bump upper bound on base >--------------------------------------------------------------- e7cd0cd59b93121c08c25e006c6dda72a17dd24e hpc.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hpc.cabal b/hpc.cabal index da0bbfe..017a609 100644 --- a/hpc.cabal +++ b/hpc.cabal @@ -35,7 +35,7 @@ Library Trace.Hpc.Reflect Build-Depends: - base >= 4.4.1 && < 4.11, + base >= 4.4.1 && < 4.12, containers >= 0.4.1 && < 0.6, directory >= 1.1 && < 1.4, filepath >= 1 && < 1.5, From git at git.haskell.org Wed Sep 20 15:59:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 15:59:14 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (4febe9a) Message-ID: <20170920155914.6A4C93A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/4febe9af4f943e2cb2605230310f2029f8fab563/ghc >--------------------------------------------------------------- commit 4febe9af4f943e2cb2605230310f2029f8fab563 Author: Joachim Breitner Date: Wed Sep 6 15:17:12 2017 +0100 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- 4febe9af4f943e2cb2605230310f2029f8fab563 compiler/simplCore/Exitify.hs | 96 +++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 73816e0..8d29719 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -46,6 +46,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -94,7 +95,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -106,7 +107,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -121,7 +122,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free @@ -143,10 +144,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -207,16 +208,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to call an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -229,16 +255,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -317,4 +349,24 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = call go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = call exit x + go 10 x y = call exit x + go (n-1) x y = call go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. -} From git at git.haskell.org Wed Sep 20 15:59:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 15:59:17 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (0bc9ed7) Message-ID: <20170920155917.E3A753A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/0bc9ed764203d8f0f608665795a8ec8ddedea29b/ghc >--------------------------------------------------------------- commit 0bc9ed764203d8f0f608665795a8ec8ddedea29b Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- 0bc9ed764203d8f0f608665795a8ec8ddedea29b compiler/basicTypes/Id.hs | 6 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 6 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 320 ++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 8 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 3 + docs/users_guide/using-optimisation.rst | 10 + 12 files changed, 366 insertions(+), 6 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0bc9ed764203d8f0f608665795a8ec8ddedea29b From git at git.haskell.org Wed Sep 20 15:59:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 15:59:20 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (8ec2062) Message-ID: <20170920155920.A7B5C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/8ec2062347fb7deba69878c84c3b93ce9ea61707/ghc >--------------------------------------------------------------- commit 8ec2062347fb7deba69878c84c3b93ce9ea61707 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 8ec2062347fb7deba69878c84c3b93ce9ea61707 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 19 +++++++++++-------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 107440a..33d1820 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -174,19 +174,22 @@ data SimplMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 8d29719..1e11e1f 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -349,6 +349,9 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +In the `final` run of the simplifier, we do allow inlining of exit join points, +via a `SimplifierMode` flag. + Note [Avoid duplicate exit points] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 956a72b..91279c9 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -144,20 +144,23 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_dflags = dflags - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_dflags = dflags + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 76ec091..3a59d70 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -738,7 +738,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1090,7 +1092,8 @@ preInlineUnconditionally env top_lvl bndr rhs | isStableUnfolding (idUnfolding bndr) = False -- Note [Stable unfoldings and preInlineUnconditionally] | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode + , isExitJoinId bndr = False -- Note [Do not inline exit join points] | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 6e80300..89e9544 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3245,7 +3245,8 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplStableUnfolding env top_lvl cont_mb id unf - | isExitJoinId id + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id = return unf -- see Note [Do not inline exit join points] | otherwise = mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs From git at git.haskell.org Wed Sep 20 15:59:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 15:59:23 +0000 (UTC) Subject: [commit: ghc] wip/T14152's head updated: Inline exit join points in the "final" simplifier iteration (8ec2062) Message-ID: <20170920155923.499483A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T14152' now includes: 8ae263c Make Semigroup a superclass of Monoid (re #14191) be514a6 includes/rts: Drop trailing comma cb4878f Drop special handling of iOS and Android 011e15a Deal with unbreakable blocks in Applicative Do 22f11f1 Bump T783 expected allocations cf6b4d1 Remove now redundant CPP 122f183 Remove now redundant cabal conditionals in {ghc,template-haskell}.cabal 400ead8 Remove makefile logic for legacy -this-package-key dab0e51 Canonicalise Monoid instances in GHC 346e562 Canonicalise MonoidFail instances in GHC 838a10f Retire cabal_macros_boot.h hack fe35b85 Add testcase for #14186 fe04f37 Allow CSE'ing of work-wrapped bindings (#14186) 0ebc8dc Add a test for #14140 9ff9c35 Check if -XStaticPointers is enabled when renaming static expressions dafa012 Add regression test for #14209 b890e88 rts: Print message before SIGUSR2 backtrace d645e44 DriverMkDepend: Kill redundant import f8e383f Clarify Data.Data documentation 91262e7 Use ar for -staticlib e62391a [RTS] Harden against buffer overflow cbd4911 Make IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115 8ff11c4 Fix @since annotations in GHC.Stats 6139f7f Add non-ASCII isLetter True example 2fe6f6b Option "-ddump-rn-ast" dumps imports and exports too f9bf621 Better document TypeRep patterns 4be195e Simplify Data.Type.Equality.== 4e22220 Clarify seq documentation 4cead3c rts: Add regsterCc(s)List to RTS symbols list 10a1a47 Model divergence of retry# as ThrowsExn, not Diverges 959a623 No need to check ambiguity for visible type args ab2d3d5 More refinements to debugPprType 3a27e34 Fix subtle bug in TcTyClsDecls.mkGADTVars 8bf865d Tidying could cause ill-kinded types 0390e4a Refactor to eliminate FamTyConShape a38acda Refactor tcInferApps 9218ea6 Interim fix for a nasty type-matching bug 9e46167 Remove unused variable binding b6b56dd [RTS] Make -po work 93da9f9 Add test for Trac #14232 3b68687 Test #14038 in dependent/should_compile/T14038 c813d8c Regression test for #12742 b977630 Test #12938 in indexed-types/should_compile/T12938 04bb873 Fix #13407 by suppressing invisibles better. ecb316c nativeGen: A few strictness fixes 58f1f73 Bump primitive submodule 3edbf5c testsuite: Fix dependence on grep behavior in T8129 89c8d4d Fix #13909 by tweaking an error message. e5beb6e Make rejigConRes do kind substitutions fa626f3 Fix #13929 by adding another levity polymorphism check 86e1db7 Test #13938, with expect_broken 8f99cd6 Fix #13963. 7b8827a Bump submodule nofib (Semigroup now required) f043cd5 Fix name of note 4340165 Ignore untracked in text, parsec and mtl submodules [skip ci] 9e227bb Fix missing fields warnings in empty record construction, fix #13870 f4d50a0 Fix #14228 by marking SumPats as non-irrefutable 2bfba9e base: Fix mixed tabs/spaces indentation in inputReady.c 9498c50 Renamer now preserves location for IEThingWith list items 47a9ec7 Remove dead function TcUnify.wrapFunResCoercion b099171 base: Enable TypeInType in Data.Type.Equality 4ec4ca9 base: Add missing MonadFail instance for strict ST 60a3f11 Fix pointer tagging mistake a83f17e base: Fix missing import of Control.Monad.Fail 2258a29 testsuite: Fix MonadFail test output for new ST instance cdaf5f2 [RTS] Add getObjectLoadStatus 120c568 Allow opt+llc from LLVM5 10ca801 Generalise constraint on `instance Monoid (Maybe a)` to Semigroup a2f004b Remove redundant/obsolete CPP usage 1db0f4a Fix unused-given-constraint bug 6252292 rts/RetainerProfile: Adding missing closure types to isRetainer 8b007ab nativeGen: Consistently use blockLbl to generate CLabels from BlockIds 12a92fe OccurAnal: Ensure SourceNotes don't interfere with join-point analysis f63bc73 compiler: introduce custom "GhcPrelude" Prelude 7c7914d Fix Windows build regression due to GhcPrelude change 28a115e base: fdReady(): Improve accuracy and simplify code. c2a1fa7 base: Fix fdReady() potentially running forever on Windows. 826c3b1 base: Fix fdReady() potentially running forever for Windows Char devices. 66240c9 base: Fix fdReady() returning immediately for pipes on Windows. 11c478b rts: Update comment about FreeBSD's unsigned FD_SETSIZE b7f2d12 rts: Fix typo in comment ba4dcc7 base: Make it less likely for fdReady() to fail on Windows sockets. 022455f base: Add more detail to FD_SETSIZE related error message bbb8cb9 users-guide: Mention changes necessary due to #13391 3198956 Factor mkCoreApp and mkCoreApps 7920a7d cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers 0aba999 Restore function powModSecInteger 11d9615 Make zipWith and zipWith3 inlinable. 02ff705 Add 'stm' package to the global package database 0bc9ed7 Implement a dedicated exitfication pass #14152 4febe9a Do some ad-hoc CSE in Exitification 8ec2062 Inline exit join points in the "final" simplifier iteration From git at git.haskell.org Wed Sep 20 16:26:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 16:26:17 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (d169843) Message-ID: <20170920162617.9C2523A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/d169843c69af695aa4531148a57c8b325c52e4dc/ghc >--------------------------------------------------------------- commit d169843c69af695aa4531148a57c8b325c52e4dc Author: Joachim Breitner Date: Wed Sep 6 15:17:12 2017 +0100 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- d169843c69af695aa4531148a57c8b325c52e4dc compiler/simplCore/Exitify.hs | 96 +++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 51dd675..0ceaf82 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -47,6 +47,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -95,7 +96,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -107,7 +108,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -122,7 +123,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free @@ -144,10 +145,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And call it from here return $ mkVarApps (Var v) args where @@ -208,16 +209,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to call an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -230,16 +256,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -318,4 +350,24 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = call go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = call exit x + go 10 x y = call exit x + go (n-1) x y = call go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. -} From git at git.haskell.org Wed Sep 20 16:26:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 16:26:23 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (87f1574) Message-ID: <20170920162623.D498E3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/87f15748ae69c6c0587d10d956e29d973daf02ae/ghc >--------------------------------------------------------------- commit 87f15748ae69c6c0587d10d956e29d973daf02ae Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- 87f15748ae69c6c0587d10d956e29d973daf02ae compiler/basicTypes/Id.hs | 6 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 6 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 321 ++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 8 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 3 + docs/users_guide/using-optimisation.rst | 10 + 12 files changed, 367 insertions(+), 6 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 87f15748ae69c6c0587d10d956e29d973daf02ae From git at git.haskell.org Wed Sep 20 16:26:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 16:26:20 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (845a0e3) Message-ID: <20170920162620.7384D3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/845a0e3bda5e093d8c380176cc2c427f80cc9bdf/ghc >--------------------------------------------------------------- commit 845a0e3bda5e093d8c380176cc2c427f80cc9bdf Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 845a0e3bda5e093d8c380176cc2c427f80cc9bdf compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 19 +++++++++++-------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 107440a..33d1820 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -174,19 +174,22 @@ data SimplMode -- See comments in SimplMonad , sm_inline :: Bool -- Whether inlining is enabled , sm_case_case :: Bool -- Whether case-of-case is enabled , sm_eta_expand :: Bool -- Whether eta-expansion is enabled + , sm_preserve_exit_joins :: Bool -- Whether exit join points must be preserved } instance Outputable SimplMode where ppr (SimplMode { sm_phase = p, sm_names = ss , sm_rules = r, sm_inline = i - , sm_eta_expand = eta, sm_case_case = cc }) + , sm_eta_expand = eta, sm_case_case = cc + , sm_preserve_exit_joins = pej }) = text "SimplMode" <+> braces ( sep [ text "Phase =" <+> ppr p <+> brackets (text (concat $ intersperse "," ss)) <> comma , pp_flag i (sLit "inline") <> comma , pp_flag r (sLit "rules") <> comma , pp_flag eta (sLit "eta-expand") <> comma - , pp_flag cc (sLit "case-of-case") ]) + , pp_flag cc (sLit "case-of-case") <> comma + , pp_flag pej (sLit "preserve-exit-joins") ]) where pp_flag f s = ppUnless f (text "no") <+> ptext s diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 0ceaf82..6b41510 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -350,6 +350,9 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +In the `final` run of the simplifier, we do allow inlining of exit join points, +via a `SimplifierMode` flag. + Note [Avoid duplicate exit points] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 956a72b..91279c9 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -144,20 +144,23 @@ getCoreToDo dflags maybe_strictness_before phase = runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_dflags = dflags - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True } + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_dflags = dflags + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_inline = True + , sm_case_case = True + , sm_preserve_exit_joins = True} simpl_phase phase names iter = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase - , sm_names = names }) + , sm_names = names + , sm_preserve_exit_joins = names /= ["final"] + }) , maybe_rule_check (Phase phase) ] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 76ec091..3a59d70 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -738,7 +738,9 @@ simplEnvForGHCi dflags , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on - , sm_case_case = True } + , sm_case_case = True + , sm_preserve_exit_joins = False + } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags @@ -1090,7 +1092,8 @@ preInlineUnconditionally env top_lvl bndr rhs | isStableUnfolding (idUnfolding bndr) = False -- Note [Stable unfoldings and preInlineUnconditionally] | isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids] | isCoVar bndr = False -- Note [Do not inline CoVars unconditionally] - | isExitJoinId bndr = False + | sm_preserve_exit_joins mode + , isExitJoinId bndr = False -- Note [Do not inline exit join points] | otherwise = case idOccInfo bndr of IAmDead -> True -- Happens in ((\x.1) v) occ at OneOcc { occ_one_br = True } diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 6e80300..89e9544 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3245,7 +3245,8 @@ simplLetUnfolding :: SimplEnv-> TopLevelFlag simplLetUnfolding env top_lvl cont_mb id new_rhs unf | isStableUnfolding unf = simplStableUnfolding env top_lvl cont_mb id unf - | isExitJoinId id + | sm_preserve_exit_joins (getMode env) + , isExitJoinId id = return unf -- see Note [Do not inline exit join points] | otherwise = mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs From git at git.haskell.org Wed Sep 20 20:22:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 20:22:15 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitification: Capture variables in the right order (062b206) Message-ID: <20170920202215.CDA8F3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/062b2062f65fb16f6defa2c3103f20825f1aff62/ghc >--------------------------------------------------------------- commit 062b2062f65fb16f6defa2c3103f20825f1aff62 Author: Joachim Breitner Date: Wed Sep 20 16:21:30 2017 -0400 Exitification: Capture variables in the right order (this commit will be squashed before merging) >--------------------------------------------------------------- 062b2062f65fb16f6defa2c3103f20825f1aff62 compiler/simplCore/Exitify.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 6b41510..d7ad33b 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -173,7 +173,7 @@ exitify in_scope pairs = -- Case right hand sides are in tail-call position go captured (_, AnnCase scrut bndr ty alts) = do alts' <- forM alts $ \(dc, pats, rhs) -> do - rhs' <- go (pats ++ bndr : captured) rhs + rhs' <- go (captured ++ [bndr] ++ pats) rhs return (dc, pats, rhs') return $ Case (deAnnotate scrut) bndr ty alts' @@ -182,9 +182,9 @@ exitify in_scope pairs = | AnnNonRec j rhs <- ann_bind , Just join_arity <- isJoinId_maybe j = do let (params, join_body) = collectNAnnBndrs join_arity rhs - join_body' <- go (params ++ captured) join_body + join_body' <- go (captured ++ params) join_body let rhs' = mkLams params join_body' - body' <- go (j : captured) body + body' <- go (captured ++ [j]) body return $ Let (NonRec j rhs') body' -- rec join point, RHSs and body are in tail-call position @@ -194,15 +194,15 @@ exitify in_scope pairs = pairs' <- forM pairs $ \(j,rhs) -> do let join_arity = idJoinArity j (params, join_body) = collectNAnnBndrs join_arity rhs - join_body' <- go (params ++ js ++ captured) join_body + join_body' <- go (captures ++ js ++ params) join_body let rhs' = mkLams params join_body' return (j, rhs') - body' <- go (js ++ captured) body + body' <- go (captured ++ js) body return $ Let (Rec pairs') body' -- normal Let, only the body is in tail-call position | otherwise - = do body' <- go (bindersOf bind ++ captured) body + = do body' <- go (captured ++ bindersOf bind ) body return $ Let bind body' where bind = deAnnBind ann_bind From git at git.haskell.org Wed Sep 20 20:25:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 20:25:23 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Exitification: Capture variables in the right order (d43f6f5) Message-ID: <20170920202523.9CA5E3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/d43f6f564a40b89c8d420fe364c0faacb6054652/ghc >--------------------------------------------------------------- commit d43f6f564a40b89c8d420fe364c0faacb6054652 Author: Joachim Breitner Date: Wed Sep 20 16:21:30 2017 -0400 Exitification: Capture variables in the right order (this commit will be squashed before merging) >--------------------------------------------------------------- d43f6f564a40b89c8d420fe364c0faacb6054652 compiler/simplCore/Exitify.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 6b41510..032e498 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -173,7 +173,7 @@ exitify in_scope pairs = -- Case right hand sides are in tail-call position go captured (_, AnnCase scrut bndr ty alts) = do alts' <- forM alts $ \(dc, pats, rhs) -> do - rhs' <- go (pats ++ bndr : captured) rhs + rhs' <- go (captured ++ [bndr] ++ pats) rhs return (dc, pats, rhs') return $ Case (deAnnotate scrut) bndr ty alts' @@ -182,9 +182,9 @@ exitify in_scope pairs = | AnnNonRec j rhs <- ann_bind , Just join_arity <- isJoinId_maybe j = do let (params, join_body) = collectNAnnBndrs join_arity rhs - join_body' <- go (params ++ captured) join_body + join_body' <- go (captured ++ params) join_body let rhs' = mkLams params join_body' - body' <- go (j : captured) body + body' <- go (captured ++ [j]) body return $ Let (NonRec j rhs') body' -- rec join point, RHSs and body are in tail-call position @@ -194,15 +194,15 @@ exitify in_scope pairs = pairs' <- forM pairs $ \(j,rhs) -> do let join_arity = idJoinArity j (params, join_body) = collectNAnnBndrs join_arity rhs - join_body' <- go (params ++ js ++ captured) join_body + join_body' <- go (captured ++ js ++ params) join_body let rhs' = mkLams params join_body' return (j, rhs') - body' <- go (js ++ captured) body + body' <- go (captured ++ js) body return $ Let (Rec pairs') body' -- normal Let, only the body is in tail-call position | otherwise - = do body' <- go (bindersOf bind ++ captured) body + = do body' <- go (captured ++ bindersOf bind ) body return $ Let bind body' where bind = deAnnBind ann_bind From git at git.haskell.org Wed Sep 20 20:25:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 20:25:26 +0000 (UTC) Subject: [commit: ghc] wip/T14152: New flag to simpl_phase to signal final phase (9dd6e49) Message-ID: <20170920202526.589BE3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/9dd6e490d4a5a0d98a1a6278e7ab309244763824/ghc >--------------------------------------------------------------- commit 9dd6e490d4a5a0d98a1a6278e7ab309244763824 Author: Joachim Breitner Date: Wed Sep 20 16:24:56 2017 -0400 New flag to simpl_phase to signal final phase (This will be squashed before merging) >--------------------------------------------------------------- 9dd6e490d4a5a0d98a1a6278e7ab309244763824 compiler/simplCore/SimplCore.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 91279c9..6c8a0d3 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -153,13 +153,13 @@ getCoreToDo dflags , sm_case_case = True , sm_preserve_exit_joins = True} - simpl_phase phase names iter + simpl_phase phase names iter is_final = CoreDoPasses $ [ maybe_strictness_before phase , CoreDoSimplify iter (base_mode { sm_phase = Phase phase , sm_names = names - , sm_preserve_exit_joins = names /= ["final"] + , sm_preserve_exit_joins = is_final }) , maybe_rule_check (Phase phase) ] @@ -188,7 +188,7 @@ getCoreToDo dflags -- inlined. I found that spectral/hartel/genfft lost some useful -- strictness in the function sumcode' if augment is not inlined -- before strictness analysis runs - simpl_phases = CoreDoPasses [ simpl_phase phase ["main"] max_iter + simpl_phases = CoreDoPasses [ simpl_phase phase ["main"] max_iter False | phase <- [phases, phases-1 .. 1] ] @@ -211,7 +211,7 @@ getCoreToDo dflags -- New demand analyser demand_analyser = (CoreDoPasses ( strictness_pass ++ - [simpl_phase 0 ["post-worker-wrapper"] max_iter] + [simpl_phase 0 ["post-worker-wrapper"] max_iter False] )) -- Static forms are moved to the top level with the FloatOut pass. @@ -300,7 +300,7 @@ getCoreToDo dflags -- ==> let k = BIG in letrec go = \xs -> ...(k x).... in go xs -- ==> let k = BIG in letrec go = \xs -> ...(BIG x).... in go xs -- Don't stop now! - simpl_phase 0 ["main"] (max max_iter 3), + simpl_phase 0 ["main"] (max max_iter 3) False, runWhen do_float_in CoreDoFloatInwards, -- Run float-inwards immediately before the strictness analyser @@ -311,7 +311,7 @@ getCoreToDo dflags runWhen call_arity $ CoreDoPasses [ CoreDoCallArity - , simpl_phase 0 ["post-call-arity"] max_iter + , simpl_phase 0 ["post-call-arity"] max_iter False ], runWhen strictness demand_analyser, @@ -342,7 +342,7 @@ getCoreToDo dflags -- strictness analysis and the simplification which follows it. runWhen liberate_case (CoreDoPasses [ CoreLiberateCase, - simpl_phase 0 ["post-liberate-case"] max_iter + simpl_phase 0 ["post-liberate-case"] max_iter False ]), -- Run the simplifier after LiberateCase to vastly -- reduce the possibility of shadowing -- Reason: see Note [Shadowing] in SpecConstr.hs @@ -352,11 +352,11 @@ getCoreToDo dflags maybe_rule_check (Phase 0), -- Final clean-up simplification: - simpl_phase 0 ["final"] max_iter, + simpl_phase 0 ["final"] max_iter True, runWhen late_dmd_anal $ CoreDoPasses ( strictness_pass ++ - [simpl_phase 0 ["post-late-ww"] max_iter] + [simpl_phase 0 ["post-late-ww"] max_iter False] ), -- Final run of the demand_analyser, ensures that one-shot thunks are From git at git.haskell.org Wed Sep 20 22:20:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Sep 2017 22:20:38 +0000 (UTC) Subject: [commit: ghc] master: aclocal.m4: call cygpath on mingw32 only (d7705f2) Message-ID: <20170920222038.4C6B33A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d7705f2fbead058700940321982a6315450dbcd1/ghc >--------------------------------------------------------------- commit d7705f2fbead058700940321982a6315450dbcd1 Author: Sergei Trofimovich Date: Wed Sep 20 23:18:22 2017 +0100 aclocal.m4: call cygpath on mingw32 only The only reason I noticed is warning these lines on linux: ``` $ ./configure --target=sparc-unknown-linux-gnu ... ./configure: line 9708: cygpath: command not found ./configure: line 9708: ArCmd: command not found ``` POSIX shell syntax requires no spaces in assignments. Fixed guarding condition while at it. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- d7705f2fbead058700940321982a6315450dbcd1 aclocal.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index d053311..203d11f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1149,8 +1149,8 @@ else fi fi]) fp_prog_ar_args=$fp_cv_prog_ar_args -if test "$HostOS" != "mingw32"; then - ArCmd = "$(cygpath -m $ArCmd)" +if test "$HostOS" = "mingw32"; then + ArCmd=$(cygpath -m $ArCmd) fi AC_SUBST([ArCmd], ["$fp_prog_ar"]) AC_SUBST([ArArgs], ["$fp_prog_ar_args"]) From git at git.haskell.org Thu Sep 21 13:12:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 13:12:20 +0000 (UTC) Subject: [commit: ghc] master: Typofixes (visiblity -> visibility) (ced2cb5) Message-ID: <20170921131220.08FB93A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ced2cb5e8fbf4493488d1c336da7b00d174923ce/ghc >--------------------------------------------------------------- commit ced2cb5e8fbf4493488d1c336da7b00d174923ce Author: Ryan Scott Date: Thu Sep 21 09:08:15 2017 -0400 Typofixes (visiblity -> visibility) >--------------------------------------------------------------- ced2cb5e8fbf4493488d1c336da7b00d174923ce compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcTyDecls.hs | 2 +- compiler/types/Class.hs | 2 +- compiler/types/TyCoRep.hs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 709206e..eb44fb4 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1329,7 +1329,7 @@ Here and T :: forall {k3} k1. forall k3 -> k1 -> k2 -> k3 -> * -See Note [TyVarBndrs, TyVarBinders, TyConBinders, and visiblity] +See Note [TyVarBndrs, TyVarBinders, TyConBinders, and visibility] in TyCoRep. kcHsTyVarBndrs uses the hsq_dependent field to decide whether diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs index e59c612..6b77cc7 100644 --- a/compiler/typecheck/TcTyDecls.hs +++ b/compiler/typecheck/TcTyDecls.hs @@ -782,7 +782,7 @@ mkDefaultMethodType cls _ (GenericDM dm_ty) = mkSigmaTy tv_bndrs [pred] dm_ty tv_bndrs = tyConTyVarBinders cls_bndrs -- NB: the Class doesn't have TyConBinders; we reach into its -- TyCon to get those. We /do/ need the TyConBinders because - -- we need the correct visiblity: these default methods are + -- we need the correct visibility: these default methods are -- used in code generated by the the fill-in for missing -- methods in instances (TcInstDcls.mkDefMethBind), and -- then typechecked. So we need the right visibilty info diff --git a/compiler/types/Class.hs b/compiler/types/Class.hs index 3bc8896..09c256a 100644 --- a/compiler/types/Class.hs +++ b/compiler/types/Class.hs @@ -62,7 +62,7 @@ data Class classTyVars :: [TyVar], -- The class kind and type variables; -- identical to those of the TyCon - -- If you want visiblity info, look at the classTyCon + -- If you want visibility info, look at the classTyCon -- This field is redundant because it's duplicated in the -- classTyCon, but classTyVars is used quite often, so maybe -- it's a bit faster to cache it here diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 27f177a..a644298 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -462,8 +462,8 @@ words, if `x` is either a function or a polytype, `x arg` makes sense (for an appropriate `arg`). -Note [TyVarBndrs, TyVarBinders, TyConBinders, and visiblity] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [TyVarBndrs, TyVarBinders, TyConBinders, and visibility] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * A ForAllTy (used for both types and kinds) contains a TyVarBinder. Each TyVarBinder TvBndr a tvis @@ -476,7 +476,7 @@ Note [TyVarBndrs, TyVarBinders, TyConBinders, and visiblity] and kind arguments for this TyCon should be visible (explicit) in source Haskell. -This table summarises the visiblity rules: +This table summarises the visibility rules: --------------------------------------------------------------------------------------- | Occurrences look like this | GHC displays type as in Haskell source code From git at git.haskell.org Thu Sep 21 13:54:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 13:54:53 +0000 (UTC) Subject: [commit: ghc] master: Initial CircleCI support. (283eb1a) Message-ID: <20170921135453.0E05A3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/283eb1a08480195deb6691b51e6407490986f5f8/ghc >--------------------------------------------------------------- commit 283eb1a08480195deb6691b51e6407490986f5f8 Author: Mathieu Boespflug Date: Sun Sep 3 16:13:06 2017 +0200 Initial CircleCI support. >--------------------------------------------------------------- 283eb1a08480195deb6691b51e6407490986f5f8 .circleci/config.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6ee6c48 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,28 @@ +version: 2 +jobs: + build: + working_directory: ~/ghc + docker: + - image: haskell:8 + resource_class: xlarge + steps: + - run: + name: git + command: | + apt-get update + apt-get install -y git openssh-client make automake autoconf gcc perl python3 + - checkout + - run: + name: submodules + command: | + # Use github.com/ghc for those submodule repositories we couldn't connect to. + git config remote.origin.url git://github.com/ghc/ghc.git + git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ + git submodule init # Don't be quiet, we want to show these urls. + git submodule --quiet update --recursive # Now we can be quiet again. + - run: + name: build + command: | + echo 'BUILD_SPHINX_HTML = NO' >> mk/validate.mk + echo 'BUILD_SPHINX_PDF = NO' >> mk/validate.mk + THREADS=8 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet From git at git.haskell.org Thu Sep 21 16:09:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 16:09:54 +0000 (UTC) Subject: [commit: ghc] master: Identify fields by selector when type-checking (fixes #13644) (72b00c3) Message-ID: <20170921160954.93DF33A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72b00c34c73ff6c63ee4928006b0cc60034a7638/ghc >--------------------------------------------------------------- commit 72b00c34c73ff6c63ee4928006b0cc60034a7638 Author: Adam Gundry Date: Tue Sep 19 19:03:16 2017 -0400 Identify fields by selector when type-checking (fixes #13644) Test Plan: new test for #13847, and the test for #13644 now passes Reviewers: mpickering, austin, bgamari, simonpj Reviewed By: mpickering, simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13644, #13847 Differential Revision: https://phabricator.haskell.org/D3988 >--------------------------------------------------------------- 72b00c34c73ff6c63ee4928006b0cc60034a7638 compiler/typecheck/TcExpr.hs | 9 +++++---- compiler/typecheck/TcPat.hs | 9 +++++---- testsuite/tests/rename/should_fail/T13847.hs | 4 ++++ testsuite/tests/rename/should_fail/T13847.stderr | 6 ++++++ testsuite/tests/rename/should_fail/T13847A.hs | 2 ++ testsuite/tests/rename/should_fail/all.T | 3 ++- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 4b9bcd1..4eb5dd1 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -2353,7 +2353,7 @@ tcRecordBinds con_like arg_tys (HsRecFields rbinds dd) = do { mb_binds <- mapM do_bind rbinds ; return (HsRecFields (catMaybes mb_binds) dd) } where - fields = map flLabel $ conLikeFieldLabels con_like + fields = map flSelector $ conLikeFieldLabels con_like flds_w_tys = zipEqual "tcRecordBinds" fields arg_tys do_bind :: LHsRecField GhcRn (LHsExpr GhcRn) @@ -2375,7 +2375,8 @@ tcRecordUpd tcRecordUpd con_like arg_tys rbinds = fmap catMaybes $ mapM do_bind rbinds where - flds_w_tys = zipEqual "tcRecordUpd" (map flLabel $ conLikeFieldLabels con_like) arg_tys + fields = map flSelector $ conLikeFieldLabels con_like + flds_w_tys = zipEqual "tcRecordUpd" fields arg_tys do_bind :: LHsRecField' (AmbiguousFieldOcc GhcTc) (LHsExpr GhcRn) -> TcM (Maybe (LHsRecUpdField GhcTcId)) @@ -2394,11 +2395,11 @@ tcRecordUpd con_like arg_tys rbinds = fmap catMaybes $ mapM do_bind rbinds (selectorFieldOcc (unLoc f'))) , hsRecFieldArg = rhs' }))) } -tcRecordField :: ConLike -> Assoc FieldLabelString Type +tcRecordField :: ConLike -> Assoc Name Type -> LFieldOcc GhcRn -> LHsExpr GhcRn -> TcM (Maybe (LFieldOcc GhcTc, LHsExpr GhcTc)) tcRecordField con_like flds_w_tys (L loc (FieldOcc lbl sel_name)) rhs - | Just field_ty <- assocMaybe flds_w_tys field_lbl + | Just field_ty <- assocMaybe flds_w_tys sel_name = addErrCtxt (fieldCtxt field_lbl) $ do { rhs' <- tcPolyExprNC rhs field_ty ; let field_id = mkUserLocal (nameOccName sel_name) diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs index f2188af..c5e367e 100644 --- a/compiler/typecheck/TcPat.hs +++ b/compiler/typecheck/TcPat.hs @@ -985,14 +985,15 @@ tcConArgs con_like arg_tys (RecCon (HsRecFields rpats dd)) penv thing_inside tc_field (L l (HsRecField (L loc (FieldOcc (L lr rdr) sel)) pat pun)) penv thing_inside = do { sel' <- tcLookupId sel - ; pat_ty <- setSrcSpan loc $ find_field_ty (occNameFS $ rdrNameOcc rdr) + ; pat_ty <- setSrcSpan loc $ find_field_ty sel + (occNameFS $ rdrNameOcc rdr) ; (pat', res) <- tcConArg (pat, pat_ty) penv thing_inside ; return (L l (HsRecField (L loc (FieldOcc (L lr rdr) sel')) pat' pun), res) } - find_field_ty :: FieldLabelString -> TcM TcType - find_field_ty lbl - = case [ty | (fl, ty) <- field_tys, flLabel fl == lbl] of + find_field_ty :: Name -> FieldLabelString -> TcM TcType + find_field_ty sel lbl + = case [ty | (fl, ty) <- field_tys, flSelector fl == sel] of -- No matching field; chances are this field label comes from some -- other record type (or maybe none). If this happens, just fail, diff --git a/testsuite/tests/rename/should_fail/T13847.hs b/testsuite/tests/rename/should_fail/T13847.hs new file mode 100644 index 0000000..09c67de --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13847.hs @@ -0,0 +1,4 @@ +module Main where +import qualified T13847A as A +foo = "foo" +main = print $ A.foo $ A.A { foo = () } diff --git a/testsuite/tests/rename/should_fail/T13847.stderr b/testsuite/tests/rename/should_fail/T13847.stderr new file mode 100644 index 0000000..52edbf5 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13847.stderr @@ -0,0 +1,6 @@ + +T13847.hs:4:24: error: + • Constructor ‘A.A’ does not have field ‘foo’ + • In the second argument of ‘($)’, namely ‘A.A {foo = ()}’ + In the second argument of ‘($)’, namely ‘A.foo $ A.A {foo = ()}’ + In the expression: print $ A.foo $ A.A {foo = ()} diff --git a/testsuite/tests/rename/should_fail/T13847A.hs b/testsuite/tests/rename/should_fail/T13847A.hs new file mode 100644 index 0000000..e3e54a8 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13847A.hs @@ -0,0 +1,2 @@ +module T13847A where +data A = A { foo :: () } diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index f7f7719..9feee3d 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -125,6 +125,7 @@ test('T12681', normal, multimod_compile_fail, ['T12681','-v0']) test('T12686', normal, compile_fail, ['']) test('T11592', normal, compile_fail, ['']) test('T12879', normal, compile_fail, ['']) -test('T13644', expect_broken(13644), multimod_compile_fail, ['T13644','-v0']) +test('T13644', normal, multimod_compile_fail, ['T13644','-v0']) test('T13568', normal, multimod_compile_fail, ['T13568','-v0']) test('T13947', normal, compile_fail, ['']) +test('T13847', normal, multimod_compile_fail, ['T13847','-v0']) From git at git.haskell.org Thu Sep 21 16:09:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 16:09:57 +0000 (UTC) Subject: [commit: ghc] master: Typeable: Generalize kind of represented type (9e46d88) Message-ID: <20170921160957.672943A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9e46d88adeea1fd399dff1208aa5710d696c542c/ghc >--------------------------------------------------------------- commit 9e46d88adeea1fd399dff1208aa5710d696c542c Author: Ben Gamari Date: Tue Sep 19 18:59:18 2017 -0400 Typeable: Generalize kind of represented type This allows withTypeable to be used with things that are of kind other than Type. Test Plan: Validate Reviewers: austin, hvr, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie, dfeuer Differential Revision: https://phabricator.haskell.org/D3996 >--------------------------------------------------------------- 9e46d88adeea1fd399dff1208aa5710d696c542c libraries/base/Data/Typeable/Internal.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index bc36fb1..f97a804 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -323,13 +323,14 @@ splitApp rep@(TrFun _ a b) = Just (IsApp (mkTrApp arr a) b) splitApp (TrTyCon{}) = Nothing -- | Use a 'TypeRep' as 'Typeable' evidence. -withTypeable :: forall a r. TypeRep a -> (Typeable a => r) -> r +withTypeable :: forall (a :: k) (r :: TYPE rep). () + => TypeRep a -> (Typeable a => r) -> r withTypeable rep k = unsafeCoerce k' rep where k' :: Gift a r k' = Gift k -- | A helper to satisfy the type checker in 'withTypeable'. -newtype Gift a r = Gift (Typeable a => r) +newtype Gift a (r :: TYPE rep) = Gift (Typeable a => r) -- | Pattern match on a type constructor pattern Con :: forall k (a :: k). TyCon -> TypeRep a From git at git.haskell.org Thu Sep 21 16:10:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 16:10:00 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add unboxed sum to T13929 (d86b237) Message-ID: <20170921161000.321AC3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d86b237d612bf6ca1faa61ff1130ad9144e32a52/ghc >--------------------------------------------------------------- commit d86b237d612bf6ca1faa61ff1130ad9144e32a52 Author: Ben Gamari Date: Tue Sep 19 19:09:58 2017 -0400 testsuite: Add unboxed sum to T13929 Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13929 Differential Revision: https://phabricator.haskell.org/D3993 >--------------------------------------------------------------- d86b237d612bf6ca1faa61ff1130ad9144e32a52 testsuite/tests/typecheck/should_fail/T13929.hs | 5 +++++ testsuite/tests/typecheck/should_fail/all.T | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_fail/T13929.hs b/testsuite/tests/typecheck/should_fail/T13929.hs index f0a026d..10a7430 100644 --- a/testsuite/tests/typecheck/should_fail/T13929.hs +++ b/testsuite/tests/typecheck/should_fail/T13929.hs @@ -28,5 +28,10 @@ instance (GUnbox f rf, GUnbox g rg) => GUnbox (f :*: g) ('TupleRep '[rf, rg]) wh -- if I remove implementation of `gunbox` it compiles successfully gunbox (x :*: y) = (# gunbox x, gunbox y #) +instance (GUnbox f rf, GUnbox g rg) => GUnbox (f :+: g) ('SumRep '[rf, rg]) where + type GUnboxed (f :+: g) ('SumRep '[rf, rg]) = (# GUnboxed f rf | GUnboxed g rg #) + gunbox (L1 l) = (# gunbox l | #) + gunbox (R1 r) = (# | gunbox r #) + main :: IO () main = pure () diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index fe71e37..5079397 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -456,5 +456,5 @@ test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T14055', normal, compile_fail, ['']) test('T13909', normal, compile_fail, ['']) -test('T13929', normal, compile_fail, ['']) +test('T13929', expect_broken(13929), compile_fail, ['']) test('T14232', normal, compile_fail, ['']) From git at git.haskell.org Thu Sep 21 16:10:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 16:10:04 +0000 (UTC) Subject: [commit: ghc] master: Typeable: Allow App to match arrow types (cc6be3a) Message-ID: <20170921161004.341903A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b/ghc >--------------------------------------------------------------- commit cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b Author: Ben Gamari Date: Tue Sep 19 18:57:38 2017 -0400 Typeable: Allow App to match arrow types Test Plan: T14236 Reviewers: austin, hvr, goldfire Reviewed By: goldfire Subscribers: RyanGlScott, simonpj, rwbarton, goldfire, thomie, dfeuer GHC Trac Issues: #14236 Differential Revision: https://phabricator.haskell.org/D3969 >--------------------------------------------------------------- cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b libraries/base/Data/Type/Equality.hs | 2 +- libraries/base/Data/Typeable/Internal.hs | 78 ++++++++++++++++++++-- libraries/base/changelog.md | 2 + testsuite/tests/typecheck/should_run/T14236.hs | 14 ++++ testsuite/tests/typecheck/should_run/T14236.stdout | 3 + testsuite/tests/typecheck/should_run/all.T | 1 + 6 files changed, 93 insertions(+), 7 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 cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b From git at git.haskell.org Thu Sep 21 16:10:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 16:10:07 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add testcase for #14253 (acd346e) Message-ID: <20170921161007.7D5263A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/acd346e3fad4d138cd8f421bb84ec6a1b357e326/ghc >--------------------------------------------------------------- commit acd346e3fad4d138cd8f421bb84ec6a1b357e326 Author: Ben Gamari Date: Tue Sep 19 19:03:33 2017 -0400 testsuite: Add testcase for #14253 Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3997 >--------------------------------------------------------------- acd346e3fad4d138cd8f421bb84ec6a1b357e326 testsuite/tests/pmcheck/complete_sigs/T14253.hs | 39 +++++++++++++++++++++++++ testsuite/tests/pmcheck/complete_sigs/all.T | 1 + 2 files changed, 40 insertions(+) diff --git a/testsuite/tests/pmcheck/complete_sigs/T14253.hs b/testsuite/tests/pmcheck/complete_sigs/T14253.hs new file mode 100644 index 0000000..88cc4f8 --- /dev/null +++ b/testsuite/tests/pmcheck/complete_sigs/T14253.hs @@ -0,0 +1,39 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeInType #-} + +module T14253 where + +import GHC.Exts +import Data.Kind + +data TypeRep (a :: k) where + Con :: TypeRep (a :: k) + TrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) + (a :: TYPE r1) (b :: TYPE r2). + TypeRep a + -> TypeRep b + -> TypeRep (a -> b) + +pattern Fun :: forall k (fun :: k). () + => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) + (arg :: TYPE r1) (res :: TYPE r2). + (k ~ Type, fun ~~ (arg -> res)) + => TypeRep arg + -> TypeRep res + -> TypeRep fun +pattern Fun arg res <- TrFun arg res + +data Dynamic where + Dynamic :: forall a. TypeRep a -> a -> Dynamic + +-- Adding this results in failure +{-# COMPLETE Con #-} + +dynApply :: Dynamic -> Dynamic -> Maybe Dynamic +-- Changing TrFun to Fun also results in failure +dynApply (Dynamic (Fun ta tr) f) (Dynamic ta' x) = undefined +dynApply _ _ = Nothing + diff --git a/testsuite/tests/pmcheck/complete_sigs/all.T b/testsuite/tests/pmcheck/complete_sigs/all.T index 4e8c33d..7e47877 100644 --- a/testsuite/tests/pmcheck/complete_sigs/all.T +++ b/testsuite/tests/pmcheck/complete_sigs/all.T @@ -13,3 +13,4 @@ test('completesig12', normal, compile, ['']) test('completesig13', normal, compile, ['']) test('completesig14', normal, compile, ['']) test('completesig15', normal, compile_fail, ['']) +test('T14253', expect_broken(14253), compile, ['']) From git at git.haskell.org Thu Sep 21 16:12:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 16:12:03 +0000 (UTC) Subject: [commit: ghc] master: base: Add changelog entry for withTypeable generalization (58a7062) Message-ID: <20170921161203.46C8F3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/58a70629a2c3efc594c88cd1d4ae9ae147d698cd/ghc >--------------------------------------------------------------- commit 58a70629a2c3efc594c88cd1d4ae9ae147d698cd Author: Ben Gamari Date: Thu Sep 21 12:11:33 2017 -0400 base: Add changelog entry for withTypeable generalization >--------------------------------------------------------------- 58a70629a2c3efc594c88cd1d4ae9ae147d698cd libraries/base/changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index dcd2e5e..6d5543e 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -49,6 +49,9 @@ * `Type.Reflection.App` now matches on function types (fixes #14236) + * `Type.Reflection.withTypeable` is now polymorphic in the `RuntimeRep` of + its result. + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* From git at git.haskell.org Thu Sep 21 18:03:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:03:10 +0000 (UTC) Subject: [commit: packages/haskeline] master: Make sections Markdown correct in README.md (f73729d) Message-ID: <20170921180310.F03A13A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/f73729dbb81fab275eb8c3177c205ac3ca3f4caf >--------------------------------------------------------------- commit f73729dbb81fab275eb8c3177c205ac3ca3f4caf Author: Grzegorz Wierzowiecki Date: Sun Aug 27 11:03:55 2017 +0200 Make sections Markdown correct in README.md >--------------------------------------------------------------- f73729dbb81fab275eb8c3177c205ac3ca3f4caf README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8724ec3..078f5f8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -#Haskeline +# Haskeline The Haskeline library provides a user interface for line input in command-line programs. This library is similar in purpose to readline, but since it is written in Haskell it is (hopefully) more easily used in other Haskell programs. -##Links +## Links The latest release, as well as the API documentation, may be obtained from [Hackage](http://hackage.haskell.org/package/haskeline). The most recent development source code can be downloaded with: @@ -15,7 +15,7 @@ Further documentation is also available at [https://github.com/judah/haskeline/wiki](https://github.com/judah/haskeline/wiki) -##Features: +## Features: - Provides a [rich line editing interface](http://trac.haskell.org/haskeline/wiki/KeyBindings). - A `~/.haskeline` file allows customization of [preferences](http://trac.haskell.org/haskeline/wiki/UserPrefs) and [custom key bindings](http://trac.haskell.org/haskeline/wiki/CustomKeyBindings). From git at git.haskell.org Thu Sep 21 18:03:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:03:13 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #64 from gwpl/patch-1 (f17e58f) Message-ID: <20170921180313.0150C3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/f17e58f06e238acf1daddd578e28fb8aa8a75dc8 >--------------------------------------------------------------- commit f17e58f06e238acf1daddd578e28fb8aa8a75dc8 Merge: d5ef581 f73729d Author: Judah Jacobson Date: Sun Aug 27 10:48:03 2017 -0700 Merge pull request #64 from gwpl/patch-1 Make sections Markdown correct in README.md >--------------------------------------------------------------- f17e58f06e238acf1daddd578e28fb8aa8a75dc8 README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) From git at git.haskell.org Thu Sep 21 18:03:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:03:15 +0000 (UTC) Subject: [commit: packages/haskeline] master: Bump upper bound on base (c534c65) Message-ID: <20170921180315.072A93A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/c534c657b379b375e26c3fe66d39b26a2e685442 >--------------------------------------------------------------- commit c534c657b379b375e26c3fe66d39b26a2e685442 Author: Ben Gamari Date: Fri Sep 15 12:10:57 2017 -0400 Bump upper bound on base >--------------------------------------------------------------- c534c657b379b375e26c3fe66d39b26a2e685442 haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskeline.cabal b/haskeline.cabal index 740e594..e15ada4 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -43,7 +43,7 @@ Library -- We require ghc>=7.4.1 (base>=4.5) to use the base library encodings, even -- though it was implemented in earlier releases, due to GHC bug #5436 which -- wasn't fixed until 7.4.1 - Build-depends: base >=4.5 && < 4.11, containers>=0.4 && < 0.6, + Build-depends: base >=4.5 && < 4.12, containers>=0.4 && < 0.6, directory>=1.1 && < 1.4, bytestring>=0.9 && < 0.11, filepath >= 1.2 && < 1.5, transformers >= 0.2 && < 0.6, process >= 1.0 && < 1.7, stm >= 2.4 && < 2.5 From git at git.haskell.org Thu Sep 21 18:03:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:03:17 +0000 (UTC) Subject: [commit: packages/haskeline] master: Move away from Chan (5d86fc9) Message-ID: <20170921180317.0F0453A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/5d86fc9f90f101b632cc9528b530b71f7ef4194c >--------------------------------------------------------------- commit 5d86fc9f90f101b632cc9528b530b71f7ef4194c Author: Ben Gamari Date: Tue Apr 11 09:51:19 2017 -0400 Move away from Chan The isEmptyChan broken has been long known to be broken >--------------------------------------------------------------- 5d86fc9f90f101b632cc9528b530b71f7ef4194c System/Console/Haskeline/Backend/Posix.hsc | 13 ++++++----- System/Console/Haskeline/Backend/Win32.hsc | 8 +++---- System/Console/Haskeline/Term.hs | 36 +++++++++++++----------------- haskeline.cabal | 2 +- 4 files changed, 27 insertions(+), 32 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5d86fc9f90f101b632cc9528b530b71f7ef4194c From git at git.haskell.org Thu Sep 21 18:03:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:03:19 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #61 from bgamari/master (8e539a4) Message-ID: <20170921180319.15C5B3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/8e539a49f921eb2f8c5610d4683b3c794a820582 >--------------------------------------------------------------- commit 8e539a49f921eb2f8c5610d4683b3c794a820582 Merge: f17e58f c534c65 Author: Judah Jacobson Date: Thu Sep 21 07:48:19 2017 -0700 Merge pull request #61 from bgamari/master Move away from Chan to STM >--------------------------------------------------------------- 8e539a49f921eb2f8c5610d4683b3c794a820582 System/Console/Haskeline/Backend/Posix.hsc | 13 ++++++----- System/Console/Haskeline/Backend/Win32.hsc | 8 +++---- System/Console/Haskeline/Term.hs | 36 +++++++++++++----------------- haskeline.cabal | 4 ++-- 4 files changed, 28 insertions(+), 33 deletions(-) From git at git.haskell.org Thu Sep 21 18:03:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:03:48 +0000 (UTC) Subject: [commit: packages/hpc] master: Fix test output (31d2496) Message-ID: <20170921180348.E5E5F3A5D4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/31d24969c3e3644fb2bad1b85a8f9c7c2cacfbaf >--------------------------------------------------------------- commit 31d24969c3e3644fb2bad1b85a8f9c7c2cacfbaf Author: Ben Gamari Date: Thu Sep 21 13:43:18 2017 -0400 Fix test output >--------------------------------------------------------------- 31d24969c3e3644fb2bad1b85a8f9c7c2cacfbaf tests/function/tough.stdout | 4 ++-- tests/function2/tough2.stdout | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/function/tough.stdout b/tests/function/tough.stdout index 0287052..01e286b 100644 --- a/tests/function/tough.stdout +++ b/tests/function/tough.stdout @@ -1,10 +1,10 @@ "Hello" "Hello" badCase -CallStack (from ImplicitParams): +CallStack (from HasCallStack): error, called at tough.hs:39:14 in main:Main badCase -CallStack (from ImplicitParams): +CallStack (from HasCallStack): error, called at tough.hs:39:14 in main:Main "Bark" "Hello" diff --git a/tests/function2/tough2.stdout b/tests/function2/tough2.stdout index dcfcd8d..2aadd7f 100644 --- a/tests/function2/tough2.stdout +++ b/tests/function2/tough2.stdout @@ -1,10 +1,10 @@ "Hello" "Hello" badCase -CallStack (from ImplicitParams): +CallStack (from HasCallStack): error, called at subdir/tough2.lhs:40:14 in main:Main badCase -CallStack (from ImplicitParams): +CallStack (from HasCallStack): error, called at subdir/tough2.lhs:40:14 in main:Main "Bark" "Hello" From git at git.haskell.org Thu Sep 21 18:07:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:07:22 +0000 (UTC) Subject: [commit: packages/terminfo] master: Bump upper bound on base (26dc1fd) Message-ID: <20170921180722.163363A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/26dc1fdf39b8375f176dffbdbbd864ead1c2eeb7 >--------------------------------------------------------------- commit 26dc1fdf39b8375f176dffbdbbd864ead1c2eeb7 Author: Ben Gamari Date: Wed Sep 13 20:22:58 2017 -0400 Bump upper bound on base >--------------------------------------------------------------- 26dc1fdf39b8375f176dffbdbbd864ead1c2eeb7 terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminfo.cabal b/terminfo.cabal index 79bb367..d8f2179 100644 --- a/terminfo.cabal +++ b/terminfo.cabal @@ -29,7 +29,7 @@ Library other-extensions: CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables if impl(ghc>=7.3) other-extensions: Safe, Trustworthy - build-depends: base >= 4.3 && < 4.11 + build-depends: base >= 4.3 && < 4.12 ghc-options: -Wall exposed-modules: System.Console.Terminfo From git at git.haskell.org Thu Sep 21 18:07:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:07:20 +0000 (UTC) Subject: [commit: packages/terminfo] master: configure.ac: check libtinfow before libtinfo (#23) (d8f725f) Message-ID: <20170921180720.12D943A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/d8f725fefc22dae45cb982b393c0364dcc24499c >--------------------------------------------------------------- commit d8f725fefc22dae45cb982b393c0364dcc24499c Author: Yoshikuni Jujo Date: Thu Aug 3 13:20:50 2017 +0900 configure.ac: check libtinfow before libtinfo (#23) >--------------------------------------------------------------- d8f725fefc22dae45cb982b393c0364dcc24499c configure.ac | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 0689aa7..e5b3cdc 100644 --- a/configure.ac +++ b/configure.ac @@ -18,11 +18,12 @@ AC_ARG_WITH([cc], [CC=$withval]) AC_PROG_CC() -AC_CHECK_LIB(tinfo, setupterm, HaveLibCurses=YES; LibCurses=tinfo, - [AC_CHECK_LIB(ncursesw, setupterm, HaveLibCurses=YES; LibCurses=ncursesw, - [AC_CHECK_LIB(ncurses, setupterm, HaveLibCurses=YES; LibCurses=ncurses, - [AC_CHECK_LIB(curses, setupterm, HaveLibCurses=YES; LibCurses=curses, - HaveLibCurses=NO; LibCurses=not-installed)])])]) +AC_CHECK_LIB(tinfow, setupterm, HaveLibCurses=YES; LibCurses=tinfow, + [AC_CHECK_LIB(tinfo, setupterm, HaveLibCurses=YES; LibCurses=tinfo, + [AC_CHECK_LIB(ncursesw, setupterm, HaveLibCurses=YES; LibCurses=ncursesw, + [AC_CHECK_LIB(ncurses, setupterm, HaveLibCurses=YES; LibCurses=ncurses, + [AC_CHECK_LIB(curses, setupterm, HaveLibCurses=YES; LibCurses=curses, + HaveLibCurses=NO; LibCurses=not-installed)])])])]) if test "x$HaveLibCurses" = "xNO" ; then AC_MSG_FAILURE([curses library not found, so this package cannot be built]) From git at git.haskell.org Thu Sep 21 18:07:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:07:24 +0000 (UTC) Subject: [commit: packages/terminfo] master: Merge pull request #26 from bgamari/master (17a0852) Message-ID: <20170921180724.1B0C73A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/17a0852ba15b32f5fa9c56daefc075b6826edc7b >--------------------------------------------------------------- commit 17a0852ba15b32f5fa9c56daefc075b6826edc7b Merge: d8f725f 26dc1fd Author: Judah Jacobson Date: Sun Sep 17 12:09:50 2017 -0700 Merge pull request #26 from bgamari/master Bump upper bound on base >--------------------------------------------------------------- 17a0852ba15b32f5fa9c56daefc075b6826edc7b terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Thu Sep 21 18:11:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:11:03 +0000 (UTC) Subject: [commit: ghc] master: Bump base to 4.11.0.0 (063e0b4) Message-ID: <20170921181103.9BBC83A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/063e0b4e5ea53a02713eb48555bbd99d934a3de5/ghc >--------------------------------------------------------------- commit 063e0b4e5ea53a02713eb48555bbd99d934a3de5 Author: Ben Gamari Date: Thu Sep 21 12:50:47 2017 -0400 Bump base to 4.11.0.0 Bumps numerous submodules. Reviewers: austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3974 >--------------------------------------------------------------- 063e0b4e5ea53a02713eb48555bbd99d934a3de5 .arc-linters/arcanist-external-json-linter | 2 +- libraries/array | 2 +- libraries/base/base.cabal | 2 +- libraries/deepseq | 2 +- libraries/directory | 2 +- libraries/filepath | 2 +- libraries/ghc-boot-th/ghc-boot-th.cabal.in | 2 +- libraries/ghc-boot/ghc-boot.cabal.in | 2 +- libraries/ghc-compact/ghc-compact.cabal | 2 +- libraries/ghci/ghci.cabal.in | 2 +- libraries/haskeline | 2 +- libraries/hpc | 2 +- libraries/parallel | 2 +- libraries/primitive | 2 +- libraries/process | 2 +- libraries/template-haskell/template-haskell.cabal | 2 +- libraries/terminfo | 2 +- libraries/unix | 2 +- nofib | 2 +- testsuite/tests/ado/ado004.stderr | 4 ++-- testsuite/tests/backpack/should_compile/bkp16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail16.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail17.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail19.stderr | 4 ++-- testsuite/tests/determinism/determ021/determ021.stdout | 4 ++-- testsuite/tests/driver/json2.stderr | 6 +++--- testsuite/tests/ghci/scripts/ghci008.stdout | 4 ++-- testsuite/tests/indexed-types/should_compile/T3017.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/AddAndOr1.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/AddAndOr2.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/AddAndOr3.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/AddAndOr4.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/AddAndOr5.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/AddAndOr6.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/BoolToBool.stderr | 4 ++-- .../tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Defaulting1MROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Either.stderr | 4 ++-- .../tests/partial-sigs/should_compile/EqualityConstraint.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Every.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ExpressionSig.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExpressionSigNamed.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExtraConstraints1.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExtraConstraints2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ExtraConstraints3.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ExtraNumAMROff.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ExtraNumAMROn.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Forall1.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/GenNamed.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/HigherRank1.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/HigherRank2.stderr | 4 ++-- .../tests/partial-sigs/should_compile/LocalDefinitionBug.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Meltdown.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/MonoLocalBinds.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr | 4 ++-- .../should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr | 4 ++-- .../should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ParensAroundContext.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/PatBind.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/PatBind2.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/PatternSig.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Recursive.stderr | 4 ++-- .../tests/partial-sigs/should_compile/ScopedNamedWildcards.stderr | 4 ++-- .../partial-sigs/should_compile/ScopedNamedWildcardsGood.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/SkipMany.stderr | 4 ++-- .../tests/partial-sigs/should_compile/SomethingShowable.stderr | 4 ++-- .../tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/Uncurry.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr | 4 ++-- .../should_compile/WarningWildcardInstantiations.stderr | 4 ++-- testsuite/tests/rename/should_fail/rnfail040.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 2 +- testsuite/tests/roles/should_compile/Roles14.stderr | 2 +- testsuite/tests/roles/should_compile/Roles2.stderr | 2 +- testsuite/tests/roles/should_compile/Roles3.stderr | 2 +- testsuite/tests/roles/should_compile/Roles4.stderr | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 2 +- testsuite/tests/safeHaskell/check/Check08.stderr | 2 +- testsuite/tests/safeHaskell/check/Check09.stderr | 4 ++-- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 2 +- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 2 +- testsuite/tests/typecheck/should_compile/T12763.stderr | 4 ++-- testsuite/tests/typecheck/should_compile/tc231.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 2 +- utils/haddock | 2 +- 95 files changed, 157 insertions(+), 157 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 063e0b4e5ea53a02713eb48555bbd99d934a3de5 From git at git.haskell.org Thu Sep 21 18:53:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 18:53:54 +0000 (UTC) Subject: [commit: ghc] master: Also show types that subsume a hole as valid substitutions for that hole. (1c92083) Message-ID: <20170921185354.5B1173A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1c9208323b5ccd6796d00763ccba9d3b4a612358/ghc >--------------------------------------------------------------- commit 1c9208323b5ccd6796d00763ccba9d3b4a612358 Author: Matthías Páll Gissurarson Date: Thu Sep 21 14:14:53 2017 -0400 Also show types that subsume a hole as valid substitutions for that hole. This builds on the previous "Valid substitutions include..." functionality, but add subsumption checking as well, so that the suggested valid substitutions show not only exact matches, but also identifiers that fit the hole by virtue of subsuming the type of the hole (i.e. being more general than the type of the hole). Building on the previous example, in the given program ``` ps :: String -> IO () ps = putStrLn ps2 :: a -> IO () ps2 _ = putStrLn "hello, world" main :: IO () main = _ "hello, world" ``` The results would be something like ``` • Found hole: _ :: [Char] -> IO () • In the expression: _ In the expression: _ "hello, world" In an equation for ‘main’: main = _ "hello, world" • Relevant bindings include main :: IO () (bound at t1.hs:8:1) Valid substitutions include ps :: String -> IO () (defined at t1.hs:2:1) ps2 :: forall a. a -> IO () (defined at t1.hs:5:1) putStrLn :: String -> IO () (imported from ‘Prelude’ at t1.hs:1:1 (and originally defined in ‘System.IO’)) fail :: forall (m :: * -> *). Monad m => forall a. String -> m a (imported from ‘Prelude’ at t1.hs:1:1 (and originally defined in ‘GHC.Base’)) mempty :: forall a. Monoid a => a (imported from ‘Prelude’ at t1.hs:1:1 (and originally defined in ‘GHC.Base’)) print :: forall a. Show a => a -> IO () (imported from ‘Prelude’ at t1.hs:1:1 (and originally defined in ‘System.IO’)) (Some substitutions suppressed; use -fmax-valid-substitutions=N or -fno-max-valid-substitutions) ``` Signed-off-by: Matthías Páll Gissurarson Modified according to suggestions from Simon PJ Accept tests that match the expectations, still a few to look better at Swithced to using tcLookup, after sit down with SPJ at ICFP. Implications are WIP. Now works with polymorphism and constraints! We still need to merge the latest master, before we can make a patch. Wrap the type of the hole, instead of implication shenanigans, As per SPJs suggestion, this is simpler and feels closer to what we actually want to do. Updated tests with the new implementation Remove debugging trace and update documentation Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3930 >--------------------------------------------------------------- 1c9208323b5ccd6796d00763ccba9d3b4a612358 compiler/typecheck/TcEnv.hs | 17 +- compiler/typecheck/TcErrors.hs | 203 +++++++++++---------- compiler/typecheck/TcRnTypes.hs | 15 ++ compiler/typecheck/TcSimplify.hs | 20 ++ compiler/typecheck/TcSimplify.hs-boot | 9 + testsuite/tests/gadt/T12468.stderr | 12 ++ testsuite/tests/ghci/scripts/T10248.stderr | 5 + testsuite/tests/ghci/scripts/T10249.stderr | 5 + testsuite/tests/ghci/scripts/T8353.stderr | 70 ++++++- testsuite/tests/module/mod71.stderr | 6 + .../partial-sigs/should_compile/T12531.stderr | 6 + testsuite/tests/th/T10267.stderr | 35 ++++ .../tests/typecheck/should_compile/T13050.stderr | 160 ++++++++++++++++ .../tests/typecheck/should_compile/T9497a.stderr | 12 ++ testsuite/tests/typecheck/should_compile/all.T | 14 +- .../should_compile/hole_constraints.stderr | 41 +++++ .../should_compile/hole_constraints_nested.stderr | 12 ++ .../tests/typecheck/should_compile/holes.stderr | 40 ++++ .../tests/typecheck/should_compile/holes2.stderr | 16 +- .../tests/typecheck/should_compile/holes3.stderr | 40 ++++ .../should_compile/valid_substitutions.stderr | 40 +++- .../tests/typecheck/should_fail/T12177.stderr | 12 ++ .../tests/typecheck/should_fail/T9497d.stderr | 12 ++ .../tests/typecheck/should_run/T9497a-run.stderr | 24 ++- .../tests/typecheck/should_run/T9497b-run.stderr | 24 ++- .../tests/typecheck/should_run/T9497c-run.stderr | 24 ++- 26 files changed, 742 insertions(+), 132 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 1c9208323b5ccd6796d00763ccba9d3b4a612358 From git at git.haskell.org Thu Sep 21 22:03:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 22:03:04 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump allocations of T12150 (ddb38b5) Message-ID: <20170921220304.A8E2E3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ddb38b51b8211247c2e31ddfcb96fe86479b9a9b/ghc >--------------------------------------------------------------- commit ddb38b51b8211247c2e31ddfcb96fe86479b9a9b Author: Ben Gamari Date: Thu Sep 21 17:23:34 2017 -0400 testsuite: Bump allocations of T12150 It looks like this is probably just drift. >--------------------------------------------------------------- ddb38b51b8211247c2e31ddfcb96fe86479b9a9b 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 313c3ce..b80900d 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1114,9 +1114,10 @@ test('T12707', test('T12150', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 74358208, 5) + [(wordsize(64), 78300680, 5) # initial: 70773000 # 2017-08-25: 74358208 Refactor the Mighty Simplifier + # 2017-08-25: 78300680 Drift ]), ], compile, From git at git.haskell.org Thu Sep 21 22:03:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 22:03:07 +0000 (UTC) Subject: [commit: ghc] master: cmm/CBE: Use foldLocalRegsDefd (9aa7389) Message-ID: <20170921220307.76E863A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9aa73892e10e90a1799b9277da593e816a827364/ghc >--------------------------------------------------------------- commit 9aa73892e10e90a1799b9277da593e816a827364 Author: Ben Gamari Date: Thu Sep 21 18:02:36 2017 -0400 cmm/CBE: Use foldLocalRegsDefd Simonpj suggested this as a follow-on to #14226 to avoid code duplication. This also gives us the ability to CBE cases involving foreign calls for free. Test Plan: Validate Reviewers: austin, simonmar, simonpj Reviewed By: simonpj Subscribers: michalt, simonpj, rwbarton, thomie GHC Trac Issues: #14226 Differential Revision: https://phabricator.haskell.org/D3999 >--------------------------------------------------------------- 9aa73892e10e90a1799b9277da593e816a827364 compiler/cmm/CmmCommonBlockElim.hs | 168 +++++++++++++++++++++---------------- compiler/cmm/CmmPipeline.hs | 2 +- 2 files changed, 95 insertions(+), 75 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9aa73892e10e90a1799b9277da593e816a827364 From git at git.haskell.org Thu Sep 21 22:29:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Sep 2017 22:29:41 +0000 (UTC) Subject: [commit: ghc] master: Reexport Semigroup's <> operator from Prelude (#14191) (feac0a3) Message-ID: <20170921222941.1D2093A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/feac0a3bc69fd376231aa3c83d031c131156ddb9/ghc >--------------------------------------------------------------- commit feac0a3bc69fd376231aa3c83d031c131156ddb9 Author: Herbert Valerio Riedel Date: Thu Sep 21 23:30:05 2017 +0200 Reexport Semigroup's <> operator from Prelude (#14191) This completes the 2nd phase of the Semigroup=>Monoid Proposal (SMP) initiated in 8ae263ceb3566a7c82336400b09cb8f381217405. This updates a couple submodules to address <> naming clashes. >--------------------------------------------------------------- feac0a3bc69fd376231aa3c83d031c131156ddb9 compiler/utils/GhcPrelude.hs | 11 +++++++++++ ghc/GHCi/UI.hs | 1 + ghc/GHCi/UI/Info.hs | 2 +- ghc/GHCi/UI/Monad.hs | 1 + ghc/Main.hs | 2 +- libraries/base/Prelude.hs | 2 +- libraries/base/changelog.md | 2 +- libraries/containers | 2 +- libraries/pretty | 2 +- libraries/template-haskell/Language/Haskell/TH/Ppr.hs | 1 + libraries/template-haskell/Language/Haskell/TH/PprLib.hs | 1 + libraries/text | 2 +- testsuite/tests/ado/ado-optimal.hs | 4 ++-- testsuite/tests/ado/ado001.hs | 4 ++-- testsuite/tests/callarity/unittest/CallArity1.hs | 2 +- testsuite/tests/rename/should_fail/T10618.hs | 2 +- testsuite/tests/rename/should_fail/T10618.stderr | 6 +++--- utils/haddock | 2 +- 18 files changed, 32 insertions(+), 17 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 feac0a3bc69fd376231aa3c83d031c131156ddb9 From git at git.haskell.org Fri Sep 22 00:13:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 00:13:20 +0000 (UTC) Subject: [commit: ghc] master: rts: Set unwind information for remaining stack frames (760b9a3) Message-ID: <20170922001320.025F83A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/760b9a363cd4e9287a05b23c74357db0e815bdf3/ghc >--------------------------------------------------------------- commit 760b9a363cd4e9287a05b23c74357db0e815bdf3 Author: Ben Gamari Date: Thu Sep 21 18:04:03 2017 -0400 rts: Set unwind information for remaining stack frames Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3985 >--------------------------------------------------------------- 760b9a363cd4e9287a05b23c74357db0e815bdf3 rts/Exception.cmm | 3 +++ rts/PrimOps.cmm | 1 + rts/StgMiscClosures.cmm | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rts/Exception.cmm b/rts/Exception.cmm index a27227d..4970aa2 100644 --- a/rts/Exception.cmm +++ b/rts/Exception.cmm @@ -110,6 +110,7 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr) INFO_TABLE_RET(stg_maskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr) return (P_ ret) { + unwind Sp = Sp + WDS(1); StgTSO_flags(CurrentTSO) = %lobits32( TO_W_(StgTSO_flags(CurrentTSO)) @@ -122,6 +123,7 @@ INFO_TABLE_RET(stg_maskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr) INFO_TABLE_RET(stg_maskUninterruptiblezh_ret, RET_SMALL, W_ info_ptr) return (P_ ret) { + unwind Sp = Sp + WDS(1); StgTSO_flags(CurrentTSO) = %lobits32( (TO_W_(StgTSO_flags(CurrentTSO)) @@ -430,6 +432,7 @@ section "data" { INFO_TABLE_RET(stg_raise_ret, RET_SMALL, W_ info_ptr, P_ exception) return (P_ ret) { + unwind Sp = Sp + WDS(2); W_[no_break_on_exception] = 1; jump stg_raisezh (exception); } diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 3d4bea4..6047b49 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -1004,6 +1004,7 @@ INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME, alt_code)) return (P_ ret) { + unwind Sp = Sp + SIZEOF_StgCatchRetryFrame; W_ r; gcptr trec, outer, arg; diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index 88371f2..361989d 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -26,7 +26,7 @@ INFO_TABLE_RET (stg_stack_underflow_frame, UNDERFLOW_FRAME, W_ info_ptr, P_ unused) /* no args => explicit stack */ { - unwind UnwindReturnReg = return; + unwind Sp = W_[Sp + WDS(2)]; W_ new_tso; W_ ret_off; @@ -61,6 +61,7 @@ INFO_TABLE_RET (stg_restore_cccs, RET_SMALL, W_ info_ptr, W_ cccs) INFO_TABLE_RET (stg_restore_cccs_eval, RET_SMALL, W_ info_ptr, W_ cccs) return (P_ ret) { + unwind Sp = Sp + WDS(2); #if defined(PROFILING) CCCS = cccs; #endif From git at git.haskell.org Fri Sep 22 00:13:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 00:13:26 +0000 (UTC) Subject: [commit: ghc] master: Implement TH addCorePlugin. (1755869) Message-ID: <20170922001326.A31BC3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/175586908963a6d438cf3c28922a38191f4eaa66/ghc >--------------------------------------------------------------- commit 175586908963a6d438cf3c28922a38191f4eaa66 Author: Facundo Domínguez Date: Thu Sep 21 18:04:56 2017 -0400 Implement TH addCorePlugin. This allows template-haskell code to add plugins to the compilation pipeline. Otherwise, the user would have to pass -fplugin=... to ghc. For now, plugin modules in the current package can't be used. This is because when TH runs, it is too late to let GHC know that the plugin modules needed to be compiled first. Test Plan: ./validate Reviewers: simonpj, bgamari, austin, goldfire Reviewed By: bgamari Subscribers: angerman, rwbarton, mboes, thomie GHC Trac Issues: #13608 Differential Revision: https://phabricator.haskell.org/D3821 >--------------------------------------------------------------- 175586908963a6d438cf3c28922a38191f4eaa66 compiler/main/DynFlags.hs | 1 + compiler/main/GHC.hs | 11 +++++++---- compiler/main/HscMain.hs | 22 +++++++++++++++------- compiler/typecheck/TcRnMonad.hs | 2 ++ compiler/typecheck/TcRnTypes.hs | 3 +++ compiler/typecheck/TcSplice.hs | 18 ++++++++++++++++++ docs/users_guide/extending_ghc.rst | 12 ++++++++++++ libraries/ghci/GHCi/Message.hs | 5 ++++- libraries/ghci/GHCi/TH.hs | 1 + .../template-haskell/Language/Haskell/TH/Syntax.hs | 14 ++++++++++++++ testsuite/tests/plugins/Makefile | 5 +++++ testsuite/tests/plugins/all.T | 5 +++++ .../tests/plugins/{plugins01.hs => plugins08.hs} | 9 ++++++--- .../plugins/{plugins01.stderr => plugins08.stderr} | 2 +- .../plugins/{plugins01.stdout => plugins08.stdout} | 0 15 files changed, 94 insertions(+), 16 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 175586908963a6d438cf3c28922a38191f4eaa66 From git at git.haskell.org Fri Sep 22 00:13:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 00:13:29 +0000 (UTC) Subject: [commit: ghc] master: Fix broken LLVM code gen (d7b8da1) Message-ID: <20170922001329.62F803A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d7b8da1f92b9ee26cd7e70028f88539e6b1ecb31/ghc >--------------------------------------------------------------- commit d7b8da1f92b9ee26cd7e70028f88539e6b1ecb31 Author: Moritz Angermann Date: Thu Sep 21 18:05:46 2017 -0400 Fix broken LLVM code gen In 8b007abbeb30 (nativeGen: Consistently use blockLbl to generate CLabels from BlockIds) all blockLbls were changed. This interfered with the `toInfoLbl` call in CmmProcPoint, and caused the LLVM backend to fall over. Reviewers: bgamari, austin, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4006 >--------------------------------------------------------------- d7b8da1f92b9ee26cd7e70028f88539e6b1ecb31 compiler/cmm/CmmProcPoint.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs index 68f80db..153872f 100644 --- a/compiler/cmm/CmmProcPoint.hs +++ b/compiler/cmm/CmmProcPoint.hs @@ -275,8 +275,9 @@ splitAtProcPoints dflags entry_label callPPs procPoints procMap let add_label map pp = mapInsert pp lbls map where lbls | pp == entry = (entry_label, fmap cit_lbl (mapLookup entry info_tbls)) | otherwise = (block_lbl, guard (setMember pp callPPs) >> - Just (toInfoLbl block_lbl)) - where block_lbl = blockLbl pp + Just info_table_lbl) + where block_lbl = blockLbl pp + info_table_lbl = infoTblLbl pp procLabels :: LabelMap (CLabel, Maybe CLabel) procLabels = foldl' add_label mapEmpty From git at git.haskell.org Fri Sep 22 00:13:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 00:13:22 +0000 (UTC) Subject: [commit: ghc] master: rts: Set unwind information for catch_frame (a9d417d) Message-ID: <20170922001322.B34383A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a9d417dab21e0b677f13c2ba99244162a8fffe3e/ghc >--------------------------------------------------------------- commit a9d417dab21e0b677f13c2ba99244162a8fffe3e Author: Ben Gamari Date: Thu Sep 21 18:04:24 2017 -0400 rts: Set unwind information for catch_frame Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3937 >--------------------------------------------------------------- a9d417dab21e0b677f13c2ba99244162a8fffe3e rts/Exception.cmm | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/Exception.cmm b/rts/Exception.cmm index 4970aa2..9661c23 100644 --- a/rts/Exception.cmm +++ b/rts/Exception.cmm @@ -370,6 +370,7 @@ INFO_TABLE_RET(stg_catch_frame, CATCH_FRAME, exceptions_blocked,handler)) return (P_ ret) { + unwind Sp = Sp + SIZEOF_StgCatchFrame; return (ret); } From git at git.haskell.org Fri Sep 22 08:37:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 08:37:41 +0000 (UTC) Subject: [commit: ghc] master: Remove 'stm' from EXTRA_PACKAGES set (5a8b843) Message-ID: <20170922083741.B7F053A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5a8b8434bd79e5597a66a2779012082e369b340b/ghc >--------------------------------------------------------------- commit 5a8b8434bd79e5597a66a2779012082e369b340b Author: Herbert Valerio Riedel Date: Fri Sep 22 10:35:02 2017 +0200 Remove 'stm' from EXTRA_PACKAGES set This effectively broke `make sdist`; the surprising thing is that ./validate didn't catch this (and thus the buildbots didn't either). Also, I would have expected `EXTRA_PACKAGES` to be populated by the data in `./packages` which already encodes that information... This is a follow-up to 02ff70563e490d2a7f3141eab7229803c523da57 >--------------------------------------------------------------- 5a8b8434bd79e5597a66a2779012082e369b340b ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghc.mk b/ghc.mk index c9437fb..8918441 100644 --- a/ghc.mk +++ b/ghc.mk @@ -1235,7 +1235,7 @@ GIT_COMMIT_ID: sdist-ghc-prep-tree : VERSION GIT_COMMIT_ID # Extra packages which shouldn't be in the source distribution: see #8801 -EXTRA_PACKAGES=parallel stm random primitive vector dph +EXTRA_PACKAGES=parallel random primitive vector dph .PHONY: sdist-ghc-prep-tree sdist-ghc-prep-tree : From git at git.haskell.org Fri Sep 22 11:06:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 11:06:01 +0000 (UTC) Subject: [commit: ghc] master: Fix build with GhcWithInterpreter=NO (2f10438) Message-ID: <20170922110602.033973A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f10438342192710025bdbe7e4abbf0aa0278081/ghc >--------------------------------------------------------------- commit 2f10438342192710025bdbe7e4abbf0aa0278081 Author: Herbert Valerio Riedel Date: Fri Sep 22 13:03:49 2017 +0200 Fix build with GhcWithInterpreter=NO This is a consequence of NoImplicitPrelude which was introduced in f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad. >--------------------------------------------------------------- 2f10438342192710025bdbe7e4abbf0aa0278081 compiler/typecheck/TcPluginM.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/typecheck/TcPluginM.hs b/compiler/typecheck/TcPluginM.hs index cc0c7a1..fe35c43 100644 --- a/compiler/typecheck/TcPluginM.hs +++ b/compiler/typecheck/TcPluginM.hs @@ -190,4 +190,7 @@ setEvBind :: EvBind -> TcPluginM () setEvBind ev_bind = do tc_evbinds <- getEvBindsTcPluginM unsafeTcPluginTcM $ TcM.addTcEvBind tc_evbinds ev_bind +#else +-- this dummy import is needed as a consequence of NoImplicitPrelude +import GhcPrelude () #endif From git at git.haskell.org Fri Sep 22 20:57:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 20:57:12 +0000 (UTC) Subject: [commit: packages/haskeline] master: Import Control.Concurrent.STM in Win32 backend (c616ea9) Message-ID: <20170922205712.85B6B3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/c616ea967dcd3f95e9384bd319a5aa993634ab47 >--------------------------------------------------------------- commit c616ea967dcd3f95e9384bd319a5aa993634ab47 Author: Ben Gamari Date: Fri Sep 22 08:35:13 2017 -0400 Import Control.Concurrent.STM in Win32 backend >--------------------------------------------------------------- c616ea967dcd3f95e9384bd319a5aa993634ab47 System/Console/Haskeline/Backend/Win32.hsc | 1 + 1 file changed, 1 insertion(+) diff --git a/System/Console/Haskeline/Backend/Win32.hsc b/System/Console/Haskeline/Backend/Win32.hsc index 1b68508..bb37a50 100644 --- a/System/Console/Haskeline/Backend/Win32.hsc +++ b/System/Console/Haskeline/Backend/Win32.hsc @@ -11,6 +11,7 @@ import Foreign.C import System.Win32 hiding (multiByteToWideChar) import Graphics.Win32.Misc(getStdHandle, sTD_OUTPUT_HANDLE) import Data.List(intercalate) +import Control.Concurrent.STM import Control.Concurrent hiding (throwTo) import Data.Char(isPrint) import Data.Maybe(mapMaybe) From git at git.haskell.org Fri Sep 22 20:57:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 20:57:14 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #67 from bgamari/master (1436a8c) Message-ID: <20170922205714.8A63F3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/1436a8c7c8ee5076c99e09fe20943bf6101237af >--------------------------------------------------------------- commit 1436a8c7c8ee5076c99e09fe20943bf6101237af Merge: 8e539a4 c616ea9 Author: Judah Jacobson Date: Fri Sep 22 10:14:02 2017 -0700 Merge pull request #67 from bgamari/master Import Control.Concurrent.STM in Win32 backend >--------------------------------------------------------------- 1436a8c7c8ee5076c99e09fe20943bf6101237af System/Console/Haskeline/Backend/Win32.hsc | 1 + 1 file changed, 1 insertion(+) From git at git.haskell.org Fri Sep 22 20:57:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Sep 2017 20:57:43 +0000 (UTC) Subject: [commit: ghc] master: Bump haskeline submodule (65943a3) Message-ID: <20170922205743.0E2DE3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/65943a3cf1edb65506b3c076d6654b4994235e2f/ghc >--------------------------------------------------------------- commit 65943a3cf1edb65506b3c076d6654b4994235e2f Author: Ben Gamari Date: Fri Sep 22 16:55:54 2017 -0400 Bump haskeline submodule Should fix the win32 build. >--------------------------------------------------------------- 65943a3cf1edb65506b3c076d6654b4994235e2f libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 8e539a4..1436a8c 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 8e539a49f921eb2f8c5610d4683b3c794a820582 +Subproject commit 1436a8c7c8ee5076c99e09fe20943bf6101237af From git at git.haskell.org Sat Sep 23 13:23:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 23 Sep 2017 13:23:16 +0000 (UTC) Subject: [commit: ghc] master: Additional LLVM_TARGET logic. (c2373b7) Message-ID: <20170923132316.BF9593A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2373b7b09939027742626e4a7bbba05ea1f6850/ghc >--------------------------------------------------------------- commit c2373b7b09939027742626e4a7bbba05ea1f6850 Author: Moritz Angermann Date: Thu Sep 21 21:28:29 2017 +0800 Additional LLVM_TARGET logic. Summary: This should help resolve the compilcation that came up in Trac #14261 Test Plan: validate on various platforms Reviewers: trofi, bgamari, austin, hvr Reviewed By: trofi Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14261 Differential Revision: https://phabricator.haskell.org/D4004 >--------------------------------------------------------------- c2373b7b09939027742626e4a7bbba05ea1f6850 aclocal.m4 | 24 ++++++++++++++++++++++-- llvm-targets | 7 ++++--- utils/llvm-targets/gen-data-layout.sh | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 203d11f..30fd220 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -109,6 +109,8 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS], GHC_CONVERT_OS([$target_os], [$TargetArch], [TargetOS]) fi + GHC_LLVM_TARGET([$target_cpu],[$target_vendor],[$target_os],[LlvmTarget]) + GHC_SELECT_FILE_EXTENSIONS([$host], [exeext_host], [soext_host]) GHC_SELECT_FILE_EXTENSIONS([$target], [exeext_target], [soext_target]) windows=NO @@ -137,12 +139,12 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS], TargetOS_CPP=` echo "$TargetOS" | sed -e 's/\./_/g' -e 's/-/_/g'` # we intend to pass trough --targets to llvm as is. - LLVMTarget_CPP=` echo "$target"` + LLVMTarget_CPP=` echo "$LlvmTarget"` echo "GHC build : $BuildPlatform" echo "GHC host : $HostPlatform" echo "GHC target : $TargetPlatform" - echo "LLVM target: $target" + echo "LLVM target: $LlvmTarget" AC_SUBST(BuildPlatform) AC_SUBST(HostPlatform) @@ -1880,6 +1882,24 @@ case "$1" in esac ]) +# GHC_LLVM_TARGET(target_cpu, target_vendor, target_os, llvm_target_var) +# -------------------------------- +# converts the canonicalized target into someting llvm can understand +AC_DEFUN([GHC_LLVM_TARGET], [ + case "$2-$3" in + hardfloat-*eabi) + llvm_target_vendor="unknown" + llvm_target_os="$3""hf" + ;; + *) + GHC_CONVERT_VENDOR([$2],[llvm_target_vendor]) + GHC_CONVERT_OS([$3],[$1],[llvm_target_os]) + ;; + esac + $4="$1-$llvm_target_vendor-$llvm_target_os" +]) + + # GHC_CONVERT_VENDOR(vendor, target_var) # -------------------------------- # converts vendor from gnu to ghc naming, and assigns the result to $target_var diff --git a/llvm-targets b/llvm-targets index 0f717b7..2ac0f87 100644 --- a/llvm-targets +++ b/llvm-targets @@ -3,19 +3,20 @@ ,("x86_64-unknown-windows", ("e-m:w-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) ,("arm-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align")) ,("armv6-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1136jf-s", "+strict-align")) -,("armv7-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", "")) +,("armv7-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) ,("aarch64-unknown-linux-gnu", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) ,("aarch64-unknown-linux", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) +,("armv7a-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+soft-float-abi")) ,("i386-unknown-linux-gnu", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", "")) ,("i386-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", "")) ,("x86_64-unknown-linux-gnu", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) ,("x86_64-unknown-linux", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) -,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", "+soft-float-abi")) +,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+soft-float-abi")) ,("aarch64-unknown-linux-android", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) ,("arm-unknown-nto-qnx-eabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+soft-float-abi +strict-align")) ,("i386-apple-darwin", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", "")) ,("x86_64-apple-darwin", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", "")) -,("armv7-apple-ios", ("e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "cortex-a8", "+soft-float-abi")) +,("armv7-apple-ios", ("e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "generic", "+soft-float-abi")) ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon")) ,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", "")) ,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", "")) diff --git a/utils/llvm-targets/gen-data-layout.sh b/utils/llvm-targets/gen-data-layout.sh index 315222f..79068e9 100755 --- a/utils/llvm-targets/gen-data-layout.sh +++ b/utils/llvm-targets/gen-data-layout.sh @@ -18,7 +18,7 @@ # Target sets WINDOWS_x86="i386-unknown-windows i686-unknown-windows x86_64-unknown-windows" -LINUX_ARM="arm-unknown-linux-gnueabihf armv6-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf aarch64-unknown-linux-gnu aarch64-unknown-linux" +LINUX_ARM="arm-unknown-linux-gnueabihf armv6-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf aarch64-unknown-linux-gnu aarch64-unknown-linux armv7a-unknown-linux-gnueabi" LINUX_x86="i386-unknown-linux-gnu i386-unknown-linux x86_64-unknown-linux-gnu x86_64-unknown-linux" ANDROID="armv7-unknown-linux-androideabi aarch64-unknown-linux-android" QNX="arm-unknown-nto-qnx-eabi" From git at git.haskell.org Sat Sep 23 13:26:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 23 Sep 2017 13:26:51 +0000 (UTC) Subject: [commit: ghc] master: Fix AsmTempLabel (d559612) Message-ID: <20170923132651.47E643A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d55961262be1b6bbacea0cd6864346f8822ee99b/ghc >--------------------------------------------------------------- commit d55961262be1b6bbacea0cd6864346f8822ee99b Author: Moritz Angermann Date: Fri Sep 22 16:17:30 2017 +0800 Fix AsmTempLabel Summary: This is another fallout from 8b007abb should fix Trac #14264. I am not sure if this is complete. It does however allow me to build an iOS LLVM cross compiler. Reviewers: bgamari, trofi, austin, simonmar Reviewed By: trofi Subscribers: rwbarton, thomie GHC Trac Issues: #14264 Differential Revision: https://phabricator.haskell.org/D4014 >--------------------------------------------------------------- d55961262be1b6bbacea0cd6864346f8822ee99b compiler/cmm/CLabel.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 28146ec..54395b6 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -1092,7 +1092,6 @@ instance Outputable CLabel where pprCLabel :: Platform -> CLabel -> SDoc pprCLabel platform (AsmTempLabel u) - | cGhcWithNativeCodeGen == "YES" = getPprStyle $ \ sty -> if asmStyle sty then ptext (asmTempLabelPrefix platform) <> pprUniqueAlways u From git at git.haskell.org Sun Sep 24 07:19:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 24 Sep 2017 07:19:14 +0000 (UTC) Subject: [commit: ghc] master: [Semigroup] fix genapply (d7b260f) Message-ID: <20170924071914.F305D3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d7b260fef51564a1c87838df391d1367207d9e12/ghc >--------------------------------------------------------------- commit d7b260fef51564a1c87838df391d1367207d9e12 Author: Moritz Angermann Date: Sat Sep 23 21:21:45 2017 +0800 [Semigroup] fix genapply Summary: The SMP causes <> to be exported from Prelude by default. When building HEAD with HEAD, genapply suffers from <> being imported from Prelude. Reviewers: hvr, bgamari, austin Reviewed By: hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4015 >--------------------------------------------------------------- d7b260fef51564a1c87838df391d1367207d9e12 utils/genapply/Main.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs index 90ae5d7..9248c22 100644 --- a/utils/genapply/Main.hs +++ b/utils/genapply/Main.hs @@ -19,6 +19,10 @@ module Main(main) where -- Needed for TAG_BITS #include "../../includes/MachDeps.h" +#if MIN_VERSION_base(4,11,0) +import Prelude hiding ((<>)) +#endif + import Text.PrettyPrint import Data.Word import Data.Bits From git at git.haskell.org Sun Sep 24 07:31:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 24 Sep 2017 07:31:27 +0000 (UTC) Subject: [commit: ghc] master: Revert "Typeable: Allow App to match arrow types" (9c7d065) Message-ID: <20170924073127.CA8363A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9c7d0657e2d6c626c6aa7aac061820e8828b857e/ghc >--------------------------------------------------------------- commit 9c7d0657e2d6c626c6aa7aac061820e8828b857e Author: Herbert Valerio Riedel Date: Sun Sep 24 08:54:28 2017 +0200 Revert "Typeable: Allow App to match arrow types" This reverts commit cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b. because it caused the regression #14270 which according to Richard probably doesn't have an easy fix. So this one goes back to the drawning board. This reopens #14236 >--------------------------------------------------------------- 9c7d0657e2d6c626c6aa7aac061820e8828b857e libraries/base/Data/Typeable/Internal.hs | 74 ++-------------------- libraries/base/changelog.md | 2 - testsuite/tests/typecheck/should_run/T14236.hs | 14 ---- testsuite/tests/typecheck/should_run/T14236.stdout | 3 - testsuite/tests/typecheck/should_run/all.T | 1 - 5 files changed, 6 insertions(+), 88 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index f97a804..ff53921 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -175,17 +175,11 @@ rnfTyCon (TyCon _ _ m n _ k) = rnfModule m `seq` rnfTrName n `seq` rnfKindRep k data TypeRep (a :: k) where TrTyCon :: {-# UNPACK #-} !Fingerprint -> !TyCon -> [SomeTypeRep] -> TypeRep (a :: k) - - -- | Invariant: Saturated arrow types (e.g. things of the form @a -> b@) - -- are represented with @'TrFun' a b@, not @TrApp (TrApp funTyCon a) b at . TrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1). {-# UNPACK #-} !Fingerprint -> TypeRep (a :: k1 -> k2) -> TypeRep (b :: k1) -> TypeRep (a b) - - -- | @TrFun fpr a b@ represents a function type @a -> b at . We use this for - -- the sake of efficiency as functions are quite ubiquitous. TrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (a :: TYPE r1) (b :: TYPE r2). {-# UNPACK #-} !Fingerprint @@ -273,13 +267,6 @@ mkTrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1). TypeRep (a :: k1 -> k2) -> TypeRep (b :: k1) -> TypeRep (a b) -mkTrApp rep@(TrApp _ (TrTyCon _ con _) (x :: TypeRep x)) (y :: TypeRep y) - | con == funTyCon -- cheap check first - , Just (IsTYPE (rx :: TypeRep rx)) <- isTYPE (typeRepKind x) - , Just (IsTYPE (ry :: TypeRep ry)) <- isTYPE (typeRepKind y) - , Just HRefl <- withTypeable x $ withTypeable rx $ withTypeable ry - $ typeRep @((->) x :: TYPE ry -> Type) `eqTypeRep` rep - = mkTrFun x y mkTrApp a b = TrApp fpr a b where fpr_a = typeRepFingerprint a @@ -289,39 +276,17 @@ mkTrApp a b = TrApp fpr a b -- | A type application. -- -- For instance, --- -- @ -- typeRep \@(Maybe Int) === App (typeRep \@Maybe) (typeRep \@Int) -- @ --- --- Note that this will also match a function type, --- --- @ --- typeRep \@(Int# -> Char) --- === --- App (App arrow (typeRep \@Int#)) (typeRep \@Char) --- @ --- --- where @arrow :: TypeRep ((->) :: TYPE IntRep -> Type -> Type)@. +-- Note that this will never match a function type (e.g. @Int -> Char@). -- pattern App :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b) => TypeRep a -> TypeRep b -> TypeRep t -pattern App f x <- (splitApp -> Just (IsApp f x)) +pattern App f x <- TrApp _ f x where App f x = mkTrApp f x -data IsApp (a :: k) where - IsApp :: forall k k' (f :: k' -> k) (x :: k'). () - => TypeRep f -> TypeRep x -> IsApp (f x) - -splitApp :: forall k (a :: k). () - => TypeRep a - -> Maybe (IsApp a) -splitApp (TrApp _ f x) = Just (IsApp f x) -splitApp rep@(TrFun _ a b) = Just (IsApp (mkTrApp arr a) b) - where arr = bareArrow rep -splitApp (TrTyCon{}) = Nothing - -- | Use a 'TypeRep' as 'Typeable' evidence. withTypeable :: forall (a :: k) (r :: TYPE rep). () => TypeRep a -> (Typeable a => r) -> r @@ -356,7 +321,6 @@ pattern Con con <- TrTyCon _ con _ pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a pattern Con' con ks <- TrTyCon _ con ks --- TODO: Remove Fun when #14253 is fixed {-# COMPLETE Fun, App, Con #-} {-# COMPLETE Fun, App, Con' #-} @@ -393,7 +357,7 @@ typeRepKind :: TypeRep (a :: k) -> TypeRep k typeRepKind (TrTyCon _ tc args) = unsafeCoerceRep $ tyConKind tc args typeRepKind (TrApp _ f _) - | TrFun _ _ res <- typeRepKind f + | Fun _ res <- typeRepKind f = res | otherwise = error ("Ill-kinded type application: " ++ show (typeRepKind f)) @@ -423,9 +387,9 @@ instantiateKindRep vars = go go (KindRepVar var) = vars A.! var go (KindRepApp f a) - = SomeTypeRep $ mkTrApp (unsafeCoerceRep $ go f) (unsafeCoerceRep $ go a) + = SomeTypeRep $ App (unsafeCoerceRep $ go f) (unsafeCoerceRep $ go a) go (KindRepFun a b) - = SomeTypeRep $ mkTrFun (unsafeCoerceRep $ go a) (unsafeCoerceRep $ go b) + = SomeTypeRep $ Fun (unsafeCoerceRep $ go a) (unsafeCoerceRep $ go b) go (KindRepTYPE r) = unkindedTypeRep $ tYPE `kApp` runtimeRepTypeRep r go (KindRepTypeLitS sort s) = mkTypeLitFromString sort (unpackCStringUtf8# s) @@ -448,7 +412,7 @@ kApp :: SomeKindedTypeRep (k -> k') -> SomeKindedTypeRep k -> SomeKindedTypeRep k' kApp (SomeKindedTypeRep f) (SomeKindedTypeRep a) = - SomeKindedTypeRep (mkTrApp f a) + SomeKindedTypeRep (App f a) kindedTypeRep :: forall (a :: k). Typeable a => SomeKindedTypeRep k kindedTypeRep = SomeKindedTypeRep (typeRep @a) @@ -514,32 +478,6 @@ vecElemTypeRep e = rep :: forall (a :: VecElem). Typeable a => SomeKindedTypeRep VecElem rep = kindedTypeRep @VecElem @a -bareArrow :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) - (a :: TYPE r1) (b :: TYPE r2). () - => TypeRep (a -> b) - -> TypeRep ((->) :: TYPE r1 -> TYPE r2 -> Type) -bareArrow (TrFun _ a b) = - mkTrCon funTyCon [SomeTypeRep rep1, SomeTypeRep rep2] - where - rep1 = getRuntimeRep $ typeRepKind a :: TypeRep r1 - rep2 = getRuntimeRep $ typeRepKind b :: TypeRep r2 -bareArrow _ = error "Data.Typeable.Internal.bareArrow: impossible" - -data IsTYPE (a :: Type) where - IsTYPE :: forall (r :: RuntimeRep). TypeRep r -> IsTYPE (TYPE r) - --- | Is a type of the form @TYPE rep@? -isTYPE :: TypeRep (a :: Type) -> Maybe (IsTYPE a) -isTYPE (TrApp _ f r) - | Just HRefl <- f `eqTypeRep` typeRep @TYPE - = Just (IsTYPE r) -isTYPE _ = Nothing - -getRuntimeRep :: forall (r :: RuntimeRep). TypeRep (TYPE r) -> TypeRep r -getRuntimeRep (TrApp _ _ r) = r -getRuntimeRep _ = error "Data.Typeable.Internal.getRuntimeRep: impossible" - - ------------------------------------------------------------- -- -- The Typeable class and friends diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 6c15a98..5b1e147 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -47,8 +47,6 @@ * Make `zipWith` and `zipWith3` inlinable (#14224) - * `Type.Reflection.App` now matches on function types (fixes #14236) - * `Type.Reflection.withTypeable` is now polymorphic in the `RuntimeRep` of its result. diff --git a/testsuite/tests/typecheck/should_run/T14236.hs b/testsuite/tests/typecheck/should_run/T14236.hs deleted file mode 100644 index c08682b..0000000 --- a/testsuite/tests/typecheck/should_run/T14236.hs +++ /dev/null @@ -1,14 +0,0 @@ -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE MagicHash #-} -import GHC.Exts -import Type.Reflection - -main = do - case typeRep @(Int -> Char) of - App a b -> print (a, b) - - case typeRep @(Int# -> Char) of - App a b -> print (a, b) - - case typeRep @(Int# -> Char) of - App a b -> print $ App a (typeRep @String) diff --git a/testsuite/tests/typecheck/should_run/T14236.stdout b/testsuite/tests/typecheck/should_run/T14236.stdout deleted file mode 100644 index a168ea8..0000000 --- a/testsuite/tests/typecheck/should_run/T14236.stdout +++ /dev/null @@ -1,3 +0,0 @@ -((->) 'LiftedRep 'LiftedRep Int,Char) -((->) 'IntRep 'LiftedRep Int#,Char) -Int# -> [Char] diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 1958001..3fc1928 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -123,4 +123,3 @@ test('TypeableEq', normal, compile_and_run, ['']) test('T13435', normal, compile_and_run, ['']) test('T11715', exit_code(1), compile_and_run, ['']) test('T13594a', normal, ghci_script, ['T13594a.script']) -test('T14236', normal, compile_and_run, ['']) From git at git.haskell.org Sun Sep 24 12:29:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 24 Sep 2017 12:29:20 +0000 (UTC) Subject: [commit: ghc] master: don't allow AsmTempLabel in UNREG mode (Trac #14264) (b3ae47c) Message-ID: <20170924122920.CC3BF3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b3ae47caf2f23cfd2c22c29dbfca646493ffe469/ghc >--------------------------------------------------------------- commit b3ae47caf2f23cfd2c22c29dbfca646493ffe469 Author: Sergei Trofimovich Date: Sun Sep 24 12:14:03 2017 +0100 don't allow AsmTempLabel in UNREG mode (Trac #14264) AsmTempLabel is really a label that describes label in assembly output (or equivalent like LLVM IR). Unregisterised build does not handle it correctly. This change does not fix UNREG build failure in Ticket #14264 but reverts back to panic: pprCLbl AsmTempLabel Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- b3ae47caf2f23cfd2c22c29dbfca646493ffe469 compiler/cmm/CLabel.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 54395b6..9c664c2 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -197,6 +197,7 @@ data CLabel {-# UNPACK #-} !Unique -- Unique says which case expression CaseLabelInfo + -- | Local temporary label used for native (or LLVM) code generation | AsmTempLabel {-# UNPACK #-} !Unique @@ -1092,6 +1093,7 @@ instance Outputable CLabel where pprCLabel :: Platform -> CLabel -> SDoc pprCLabel platform (AsmTempLabel u) + | not (platformUnregisterised platform) = getPprStyle $ \ sty -> if asmStyle sty then ptext (asmTempLabelPrefix platform) <> pprUniqueAlways u From git at git.haskell.org Mon Sep 25 13:01:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 13:01:55 +0000 (UTC) Subject: [commit: ghc] master: Make pprQuotedList use fsep not hsep (7721e8e) Message-ID: <20170925130155.9D1CE3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7721e8ee77780211a3ed4e8e5ba21bec8d54848d/ghc >--------------------------------------------------------------- commit 7721e8ee77780211a3ed4e8e5ba21bec8d54848d Author: Simon Peyton Jones Date: Thu Sep 21 17:38:08 2017 +0100 Make pprQuotedList use fsep not hsep This just does wrapping on very long lists >--------------------------------------------------------------- 7721e8ee77780211a3ed4e8e5ba21bec8d54848d compiler/utils/Outputable.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index d257e3e..c79cbc5 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -1019,7 +1019,7 @@ pprQuotedList :: Outputable a => [a] -> SDoc pprQuotedList = quotedList . map ppr quotedList :: [SDoc] -> SDoc -quotedList xs = hsep (punctuate comma (map quotes xs)) +quotedList xs = fsep (punctuate comma (map quotes xs)) quotedListWithOr :: [SDoc] -> SDoc -- [x,y,z] ==> `x', `y' or `z' From git at git.haskell.org Mon Sep 25 13:01:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 13:01:58 +0000 (UTC) Subject: [commit: ghc] master: Comments only (3b4833a) Message-ID: <20170925130158.5D4193A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3b4833a22596922d5e7a3f0037c960a5e230fb31/ghc >--------------------------------------------------------------- commit 3b4833a22596922d5e7a3f0037c960a5e230fb31 Author: Simon Peyton Jones Date: Thu Sep 21 17:38:54 2017 +0100 Comments only >--------------------------------------------------------------- 3b4833a22596922d5e7a3f0037c960a5e230fb31 compiler/types/TyCoRep.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index a644298..1174b20 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1270,7 +1270,7 @@ the evidence for unboxed equalities: they might appear in a top-level type, there is no place to bind these (unlifted) coercions in the usual way. - - A coercion for (forall a. t1) ~ forall a. t2) will look like + - A coercion for (forall a. t1) ~ (forall a. t2) will look like forall a. (coercion for t1~t2) But the coercion for (t1~t2) may mention 'a', and we don't have let-bindings within coercions. We could add them, but coercion holes are easier. From git at git.haskell.org Mon Sep 25 13:02:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 13:02:01 +0000 (UTC) Subject: [commit: ghc] master: Deal with large extra-contraints wildcards (3c74a51) Message-ID: <20170925130201.EA4713A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3c74a51232813eb733b27c43c94ce005112a0ddb/ghc >--------------------------------------------------------------- commit 3c74a51232813eb733b27c43c94ce005112a0ddb Author: Simon Peyton Jones Date: Thu Sep 21 17:35:11 2017 +0100 Deal with large extra-contraints wildcards For reasons explained in TcHsType Note [Extra-constraint holes in partial type signatures], if we had f :: (_) => blahs and the '_' was filled in by more than a 62-tuple of contraints, GHC crashed. The same Note explains the hacky solution I have adopted to evade this. Maybe there is some better way, but I couldn't see one that didn't involve a great deal of work. And the problem is a very narrow one! If the hack bites us we'll need to think again. >--------------------------------------------------------------- 3c74a51232813eb733b27c43c94ce005112a0ddb compiler/prelude/TysWiredIn.hs | 7 +- compiler/typecheck/TcBinds.hs | 18 ++-- compiler/typecheck/TcHsType.hs | 52 +++++++++++- compiler/typecheck/TcMType.hs | 7 +- .../tests/partial-sigs/should_compile/T14217.hs | 41 +++++++++ .../partial-sigs/should_compile/T14217.stderr | 99 ++++++++++++++++++++++ testsuite/tests/partial-sigs/should_compile/all.T | 1 + 7 files changed, 210 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 3c74a51232813eb733b27c43c94ce005112a0ddb From git at git.haskell.org Mon Sep 25 13:02:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 13:02:09 +0000 (UTC) Subject: [commit: ghc] master: Fix solving of implicit parameter constraints (abed9bf) Message-ID: <20170925130209.4F8473A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/abed9bf5008baf6b3e84251fe4d07de80c532ead/ghc >--------------------------------------------------------------- commit abed9bf5008baf6b3e84251fe4d07de80c532ead Author: Simon Peyton Jones Date: Mon Sep 25 11:06:34 2017 +0100 Fix solving of implicit parameter constraints Trac #14218 showed that we were not solving implicit-parameter constraints correctly. In particular, - A tuple constraint could "hide" an implicit-parameter wanted constraint, and that in turn could that we solved it from the wrong implicit-parameter binding. - As a special case the HasCallStack constraint (which is just short for (IP "callStack" CallStack), was getting mis-solved. The big change is to arrange that, in TcSMonad.findDict when looking for a dictionary, either when looking for a matching inert or solved dictionary, we fail for - Tuples that are hiding implicit parameters See Note [Tuples hiding implicit parameters] - HasCallStack constraints where we have not yet pushed on the call-site info See Note [Solving CallStack constraints] I also did a little refactoring * Move naturallyCoherentClass from Class to TcInteract, its sole use site. Class.hs seems like the wrong place. (And I also do not understand the reason that we need the eq/Coercible/ Typable stuff in this predicate, but I'll tackle that separately.) * Move the code that pushes call-site info onto a call stack from the "interact" part to the "canonicalise" part of the solver. >--------------------------------------------------------------- abed9bf5008baf6b3e84251fe4d07de80c532ead compiler/typecheck/TcCanonical.hs | 41 ++++++- compiler/typecheck/TcInteract.hs | 118 +++++++++------------ compiler/typecheck/TcSMonad.hs | 80 +++++++++++--- compiler/typecheck/TcSimplify.hs | 5 +- compiler/typecheck/TcType.hs | 23 ++-- compiler/types/Class.hs | 13 --- testsuite/tests/typecheck/should_run/T14218.hs | 34 ++++++ testsuite/tests/typecheck/should_run/T14218.stdout | 2 + testsuite/tests/typecheck/should_run/all.T | 1 + 9 files changed, 214 insertions(+), 103 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc abed9bf5008baf6b3e84251fe4d07de80c532ead From git at git.haskell.org Mon Sep 25 13:02:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 13:02:05 +0000 (UTC) Subject: [commit: ghc] master: Improve type-error reporting (1b476ab) Message-ID: <20170925130205.D8AC13A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1b476ab55be6c2c553988cc63d8e0c5473136275/ghc >--------------------------------------------------------------- commit 1b476ab55be6c2c553988cc63d8e0c5473136275 Author: Simon Peyton Jones Date: Thu Sep 21 17:39:18 2017 +0100 Improve type-error reporting This patch does two things: * When reporting a hole, we now include its kind if the kind is not just '*'. This addresses Trac #14265 * When reporting things like "'a' is a rigid type varaible bound by ...", this patch arranges to group the type variables together, so we don't repeat the "bound by..." stuff endlessly >--------------------------------------------------------------- 1b476ab55be6c2c553988cc63d8e0c5473136275 compiler/typecheck/TcBinds.hs | 2 +- compiler/typecheck/TcErrors.hs | 86 ++++++++++++++-------- compiler/typecheck/TcRnTypes.hs | 6 +- testsuite/tests/ghci/scripts/T10248.stderr | 5 +- .../partial-sigs/should_compile/SuperCls.stderr | 2 +- .../partial-sigs/should_compile/T10403.stderr | 25 +++---- .../partial-sigs/should_compile/T11016.stderr | 2 +- .../partial-sigs/should_compile/T11192.stderr | 10 +-- .../partial-sigs/should_compile/T12033.stderr | 12 +-- .../partial-sigs/should_compile/T12844.stderr | 21 +----- .../partial-sigs/should_compile/T12845.stderr | 2 +- .../WarningWildcardInstantiations.stderr | 5 +- .../tests/partial-sigs/should_fail/T10045.stderr | 7 +- .../tests/partial-sigs/should_fail/T12634.stderr | 2 +- .../should_fail/WildcardInstantiations.stderr | 5 +- testsuite/tests/perf/compiler/T13035.stderr | 2 +- testsuite/tests/polykinds/T14265.hs | 11 +++ testsuite/tests/polykinds/T14265.stderr | 24 ++++++ testsuite/tests/polykinds/all.T | 1 + 19 files changed, 129 insertions(+), 101 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 1b476ab55be6c2c553988cc63d8e0c5473136275 From git at git.haskell.org Mon Sep 25 19:16:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 19:16:00 +0000 (UTC) Subject: [commit: ghc] master: Document how GHC disambiguates between multiple COMPLETE sets (0e60cc1) Message-ID: <20170925191600.654653A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0e60cc1825aace414597b644731c30269994f7fb/ghc >--------------------------------------------------------------- commit 0e60cc1825aace414597b644731c30269994f7fb Author: Ryan Scott Date: Mon Sep 25 14:21:54 2017 -0400 Document how GHC disambiguates between multiple COMPLETE sets Summary: Up until now, the knowledge of how GHC chooses which `COMPLETE` set to use in the presence of multiple applicable `COMPLETE` sets for a single data type constructor was only documented in the GHC wiki. But this really should be advertised to anyone who uses `COMPLETE` pragmas heavily, so per SPJ's advice in https://ghc.haskell.org/trac/ghc/ticket/14253#comment:10, this adds this wisdom to the GHC users' guide. Test Plan: Read it Reviewers: austin, bgamari Subscribers: mpickering, rwbarton, thomie GHC Trac Issues: #14253 Differential Revision: https://phabricator.haskell.org/D4005 >--------------------------------------------------------------- 0e60cc1825aace414597b644731c30269994f7fb compiler/deSugar/Check.hs | 7 ++++++- docs/users_guide/glasgow_exts.rst | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 53b766f..3226a87 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -102,7 +102,12 @@ liftD m = ListT $ \sk fk -> m >>= \a -> sk a fk -- Pick the first match complete covered match or otherwise the "best" match. -- The best match is the one with the least uncovered clauses, ties broken -- by the number of inaccessible clauses followed by number of redundant --- clauses +-- clauses. +-- +-- This is specified in the +-- "Disambiguating between multiple ``COMPLETE`` pragmas" section of the +-- users' guide. If you update the implementation of this function, make sure +-- to update that section of the users' guide as well. getResult :: PmM PmResult -> DsM PmResult getResult ls = do res <- fold ls goM (pure Nothing) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 65f8629..edfee6c 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -14047,6 +14047,49 @@ the user must provide a type signature. :: foo :: [a] -> Int foo T = 5 +.. _multiple-complete-pragmas: + +Disambiguating between multiple ``COMPLETE`` pragmas +---------------------------------------------------- + +What should happen if there are multiple ``COMPLETE`` sets that apply to a +single set of patterns? Consider this example: :: + + data T = MkT1 | MkT2 | MkT2Internal + {-# COMPLETE MkT1, MkT2 #-} + {-# COMPLETE MkT1, MkT2Internal #-} + + f :: T -> Bool + f MkT1 = True + f MkT2 = False + +Which ``COMPLETE`` pragma should be used when checking the coverage of the +patterns in ``f``? If we pick the ``COMPLETE`` set that covers ``MkT1`` and +``MkT2``, then ``f`` is exhaustive, but if we pick the other ``COMPLETE`` set +that covers ``MkT1`` and ``MkT2Internal``, then ``f`` is *not* exhaustive, +since it fails to match ``MkT2Internal``. An intuitive way to solve this +dilemma is to recognize that picking the former ``COMPLETE`` set produces the +fewest number of uncovered pattern clauses, and thus is the better choice. + +GHC disambiguates between multiple ``COMPLETE`` sets based on this rationale. +To make things more formal, when the pattern-match checker requests a set of +constructors for some data type constructor ``T``, the checker returns: + +* The original set of data constructors for ``T`` +* Any ``COMPLETE`` sets of type ``T`` + +GHC then checks for pattern coverage using each of these sets. If any of these +sets passes the pattern coverage checker with no warnings, then we are done. If +each set produces at least one warning, then GHC must pick one of the sets of +warnings depending on how good the results are. The results are prioritized in +this order: + +1. Fewest uncovered clauses +2. Fewest redundant clauses +3. Fewest inaccessible clauses +4. Whether the match comes from the original set of data constructors or from a + ``COMPLETE`` pragma (prioritizing the former over the latter) + .. _overlap-pragma: ``OVERLAPPING``, ``OVERLAPPABLE``, ``OVERLAPS``, and ``INCOHERENT`` pragmas From git at git.haskell.org Mon Sep 25 19:16:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 19:16:03 +0000 (UTC) Subject: [commit: ghc] master: Bump template-haskell to 2.13.0.0 (3804a7e) Message-ID: <20170925191603.21EF93A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3804a7eb44c01ca91501e726b76b590c193ea126/ghc >--------------------------------------------------------------- commit 3804a7eb44c01ca91501e726b76b590c193ea126 Author: Ryan Scott Date: Mon Sep 25 14:22:27 2017 -0400 Bump template-haskell to 2.13.0.0 Summary: Now that `MonadIO` is a superclass of `Quasi`, it's a good time to bump the `template-haskell` version so that libraries can accommodate the change using CPP. Test Plan: ./validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4007 >--------------------------------------------------------------- 3804a7eb44c01ca91501e726b76b590c193ea126 compiler/ghc.cabal.in | 2 +- libraries/ghci/ghci.cabal.in | 2 +- libraries/template-haskell/template-haskell.cabal | 2 +- testsuite/tests/th/TH_Roles2.stderr | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 817b410..4f0fbbc 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -59,7 +59,7 @@ Library containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, - template-haskell == 2.12.*, + template-haskell == 2.13.*, hpc == 0.6.*, transformers == 0.5.*, ghc-boot == @ProjectVersionMunged@, diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in index 2e3fc94..c22f605 100644 --- a/libraries/ghci/ghci.cabal.in +++ b/libraries/ghci/ghci.cabal.in @@ -77,7 +77,7 @@ library filepath == 1.4.*, ghc-boot == @ProjectVersionMunged@, ghc-boot-th == @ProjectVersionMunged@, - template-haskell == 2.12.*, + template-haskell == 2.13.*, transformers == 0.5.* if !os(windows) diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index f38c887..887865d 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -1,5 +1,5 @@ name: template-haskell -version: 2.12.0.0 +version: 2.13.0.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 9e910cc..d00f70c 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -4,9 +4,9 @@ TYPE CONSTRUCTORS data T (a :: k) COERCION AXIOMS Dependent modules: [] -Dependent packages: [array-0.5.2.0, base-4.10.0.0, deepseq-1.4.3.0, +Dependent packages: [array-0.5.2.0, base-4.11.0.0, deepseq-1.4.3.0, ghc-boot-th-8.3, ghc-prim-0.5.1.0, integer-gmp-1.0.1.0, - pretty-1.1.3.3, template-haskell-2.12.0.0] + pretty-1.1.3.5, template-haskell-2.13.0.0] ==================== Typechecker ==================== TH_Roles2.$tcT From git at git.haskell.org Mon Sep 25 19:22:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 19:22:13 +0000 (UTC) Subject: [commit: ghc] master: Ensure text mode when calling debug functions (2b2595e) Message-ID: <20170925192213.462823A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2b2595e03d328f8c49afe55f765635c03dc81865/ghc >--------------------------------------------------------------- commit 2b2595e03d328f8c49afe55f765635c03dc81865 Author: Tamar Christina Date: Mon Sep 25 20:21:39 2017 +0100 Ensure text mode when calling debug functions Summary: Something seems to be changing stderr into binary mode, so when the `traceIO` is called, the C code that ultimately calls `vfprintf` is using a binary mode handle. This causes newlines not to be encoded properly. The patch ensures we're in text mode when writing the debug messages (% interleaving as it's not thread safe at all) and restores the previous mode when done. I'm slightly concerned about the performance implications of writing large dumps out in text mode, but I think the current behavior is not intended as I cannot see any of the printing code setting the mode of the std handles. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14188 Differential Revision: https://phabricator.haskell.org/D4018 >--------------------------------------------------------------- 2b2595e03d328f8c49afe55f765635c03dc81865 rts/RtsMessages.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c index 0859e50..5782c0d 100644 --- a/rts/RtsMessages.c +++ b/rts/RtsMessages.c @@ -21,6 +21,7 @@ #if defined(HAVE_WINDOWS_H) #include +#include #endif /* ----------------------------------------------------------------------------- @@ -137,7 +138,9 @@ isGUIApp(void) void GNU_ATTRIBUTE(__noreturn__) rtsFatalInternalErrorFn(const char *s, va_list ap) { -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) + /* Ensure we're in text mode so newlines get encoded properly. */ + int mode = _setmode (_fileno(stderr), _O_TEXT); if (isGUIApp()) { char title[BUFSIZE], message[BUFSIZE]; @@ -174,6 +177,9 @@ rtsFatalInternalErrorFn(const char *s, va_list ap) fprintf(stderr, " Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\n"); fflush(stderr); } +#if defined(mingw32_HOST_OS) + _setmode (_fileno(stderr), mode); +#endif #if defined(TRACING) if (RtsFlags.TraceFlags.tracing == TRACE_EVENTLOG) endEventLogging(); @@ -186,7 +192,9 @@ rtsFatalInternalErrorFn(const char *s, va_list ap) void rtsErrorMsgFn(const char *s, va_list ap) { -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) + /* Ensure we're in text mode so newlines get encoded properly. */ + int mode = _setmode (_fileno(stderr), _O_TEXT); if (isGUIApp()) { char buf[BUFSIZE]; @@ -211,6 +219,9 @@ rtsErrorMsgFn(const char *s, va_list ap) vfprintf(stderr, s, ap); fprintf(stderr, "\n"); } +#if defined(mingw32_HOST_OS) + _setmode (_fileno(stderr), mode); +#endif } void @@ -218,7 +229,9 @@ rtsSysErrorMsgFn(const char *s, va_list ap) { char *syserr; -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) + /* Ensure we're in text mode so newlines get encoded properly. */ + int mode = _setmode (_fileno(stderr), _O_TEXT); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | @@ -257,7 +270,7 @@ rtsSysErrorMsgFn(const char *s, va_list ap) } vfprintf(stderr, s, ap); if (syserr) { -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) // Win32 error messages have a terminating \n fprintf(stderr, ": %s", syserr); #else @@ -268,15 +281,18 @@ rtsSysErrorMsgFn(const char *s, va_list ap) } } -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) if (syserr) LocalFree(syserr); + _setmode (_fileno(stderr), mode); #endif } void rtsDebugMsgFn(const char *s, va_list ap) { -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) + /* Ensure we're in text mode so newlines get encoded properly. */ + int mode = _setmode (_fileno(stderr), _O_TEXT); if (isGUIApp()) { char buf[BUFSIZE]; @@ -294,4 +310,7 @@ rtsDebugMsgFn(const char *s, va_list ap) vfprintf(stderr, s, ap); fflush(stderr); } +#if defined(mingw32_HOST_OS) + _setmode (_fileno(stderr), mode); +#endif } From git at git.haskell.org Mon Sep 25 23:19:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 23:19:14 +0000 (UTC) Subject: [commit: ghc] master: Fix the searching of target AR tool (c839c57) Message-ID: <20170925231914.22C9E3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c839c57ed372203b05407b2042d00c188af75310/ghc >--------------------------------------------------------------- commit c839c57ed372203b05407b2042d00c188af75310 Author: Tamar Christina Date: Mon Sep 25 19:12:35 2017 +0100 Fix the searching of target AR tool Summary: Ar was being checked twice prior to D3883 where I removed one of the checks because the converted path was being overridden after the check because of the second check for Ar. However the one in configure.ac was a target check so I'm changing the path check to a target check now. Test Plan: ./configure Reviewers: angerman, austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14274 Differential Revision: https://phabricator.haskell.org/D4020 >--------------------------------------------------------------- c839c57ed372203b05407b2042d00c188af75310 aclocal.m4 | 16 ++++++++++++---- configure.ac | 4 +--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 30fd220..754a13a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1071,9 +1071,20 @@ AC_SUBST([LdHasFilelist]) # FP_PROG_AR # ---------- # Sets fp_prog_ar to a path to ar. Exits if no ar can be found +# The host normalization on Windows breaks autoconf, it no longer +# thinks that target == host so it never checks the unqualified +# tools for Windows. See #14274. AC_DEFUN([FP_PROG_AR], [if test -z "$fp_prog_ar"; then - AC_PATH_PROG([fp_prog_ar], [ar]) + if test "$HostOS" = "mingw32" + then + AC_PATH_PROG([fp_prog_ar], [ar]) + if test -n "$fp_prog_ar"; then + fp_prog_ar=$(cygpath -m $fp_prog_ar) + fi + else + AC_CHECK_TARGET_TOOL([fp_prog_ar], [ar]) + fi fi if test -z "$fp_prog_ar"; then AC_MSG_ERROR([cannot find ar in your PATH, no idea how to make a library]) @@ -1151,9 +1162,6 @@ else fi fi]) fp_prog_ar_args=$fp_cv_prog_ar_args -if test "$HostOS" = "mingw32"; then - ArCmd=$(cygpath -m $ArCmd) -fi AC_SUBST([ArCmd], ["$fp_prog_ar"]) AC_SUBST([ArArgs], ["$fp_prog_ar_args"]) diff --git a/configure.ac b/configure.ac index 98fffe1..5eae83d 100644 --- a/configure.ac +++ b/configure.ac @@ -609,9 +609,7 @@ dnl ** which libtool to use? dnl -------------------------------------------------------------- # The host normalization on Windows breaks autoconf, it no longer # thinks that target == host so it never checks the unqualified -# tools for Windows. I don't know why we do this whole normalization thing -# as it just breaks everything.. but for now, just check the unqualified one -# if on Windows. +# tools for Windows. See #14274. if test "$HostOS" = "mingw32" then AC_PATH_PROG([LIBTOOL],[libtool]) From git at git.haskell.org Mon Sep 25 23:21:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 25 Sep 2017 23:21:22 +0000 (UTC) Subject: [commit: ghc] master: Adds mingw64 to the valid GHC OSs. (abca29f) Message-ID: <20170925232122.E04CF3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/abca29f3f3e19c4af452c1714be1bf33f4ac9180/ghc >--------------------------------------------------------------- commit abca29f3f3e19c4af452c1714be1bf33f4ac9180 Author: Moritz Angermann Date: Tue Sep 26 00:19:06 2017 +0100 Adds mingw64 to the valid GHC OSs. Summary: This fixes hadrian#420 (https://github.com/snowleopard/hadrian/issues/420) specifically the "Unknown OS mingw64". Reviewers: austin, hvr, bgamari, Phyx Reviewed By: Phyx Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4016 >--------------------------------------------------------------- abca29f3f3e19c4af452c1714be1bf33f4ac9180 aclocal.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index 754a13a..af84b6f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1899,6 +1899,10 @@ AC_DEFUN([GHC_LLVM_TARGET], [ llvm_target_vendor="unknown" llvm_target_os="$3""hf" ;; + *-mingw32|*-mingw64) + llvm_target_vendor="unknown" + llvm_target_os="windows" + ;; *) GHC_CONVERT_VENDOR([$2],[llvm_target_vendor]) GHC_CONVERT_OS([$3],[$1],[llvm_target_os]) From git at git.haskell.org Tue Sep 26 02:44:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:27 +0000 (UTC) Subject: [commit: ghc] master: configure: Don't hard-code strip tool (65f7d87) Message-ID: <20170926024427.C1FD43A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/65f7d87a9bd43a6dfc077fbcb8781de07dd335c1/ghc >--------------------------------------------------------------- commit 65f7d87a9bd43a6dfc077fbcb8781de07dd335c1 Author: Ben Gamari Date: Mon Sep 25 18:41:23 2017 -0400 configure: Don't hard-code strip tool For reasons that I don't entirely understand we didn't previously detect `strip` using autoconf. This naturally broke during cross-compilation. How did this ever work? I have no idea. Test Plan: Try cross-compiling Reviewers: austin, hvr, angerman Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4008 >--------------------------------------------------------------- 65f7d87a9bd43a6dfc077fbcb8781de07dd335c1 configure.ac | 7 +++++++ distrib/configure.ac.in | 6 ++++++ mk/config.mk.in | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5eae83d..009bea0 100644 --- a/configure.ac +++ b/configure.ac @@ -605,6 +605,13 @@ fi RanlibCmd="$RANLIB" RANLIB="$RanlibCmd" +dnl ** which strip to use? +dnl -------------------------------------------------------------- +AC_CHECK_TARGET_TOOL([STRIP], [strip]) +StripCmd="$STRIP" +AC_SUBST([StripCmd]) + + dnl ** which libtool to use? dnl -------------------------------------------------------------- # The host normalization on Windows breaks autoconf, it no longer diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 9a94cf2..509e74e 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -178,6 +178,12 @@ dnl ** how to invoke `ar' and `ranlib' FP_PROG_AR_SUPPORTS_ATFILE FP_PROG_AR_NEEDS_RANLIB +dnl ** which strip to use? +dnl -------------------------------------------------------------- +AC_CHECK_TARGET_TOOL([STRIP], [strip]) +StripCmd="$STRIP" +AC_SUBST([StripCmd]) + dnl ** Have libdw? dnl -------------------------------------------------------------- dnl Check for a usable version of libdw/elfutils diff --git a/mk/config.mk.in b/mk/config.mk.in index ac1512e..92661a3 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -775,7 +775,7 @@ else ifeq "$(TARGETPLATFORM)" "arm-unknown-linux" # The hack of using `:` to disable stripping is implemented by ghc-cabal. STRIP_CMD = : else -STRIP_CMD = strip +STRIP_CMD = @StripCmd@ endif PATCH_CMD = @PatchCmd@ TAR_CMD = @TarCmd@ From git at git.haskell.org Tue Sep 26 02:44:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:30 +0000 (UTC) Subject: [commit: ghc] master: Include original process name in worker thread name (#14153) (d07b8c7) Message-ID: <20170926024430.833E23A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d07b8c7ae8bc22a7c36c96cb3fd800aecdde6eac/ghc >--------------------------------------------------------------- commit d07b8c7ae8bc22a7c36c96cb3fd800aecdde6eac Author: Echo Nolan Date: Mon Sep 25 18:33:30 2017 -0400 Include original process name in worker thread name (#14153) Prior to this commit, worker OS thread were renamed to "ghc_worker" when spawned. This was annoying when reading debugging messages that print the process name because it doesn't tell you *which* Haskell program is generating the message. This commit changes it to "original_process_name:w", truncating the original name to fit in the kernel buffer if neccesary. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4001 >--------------------------------------------------------------- d07b8c7ae8bc22a7c36c96cb3fd800aecdde6eac rts/Task.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/rts/Task.c b/rts/Task.c index 4376148..fc928d5 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -19,6 +19,8 @@ #include "Hash.h" #include "Trace.h" +#include + #if HAVE_SIGNAL_H #include #endif @@ -468,7 +470,26 @@ startWorkerTask (Capability *cap) ASSERT_LOCK_HELD(&cap->lock); cap->running_task = task; - r = createOSThread(&tid, "ghc_worker", (OSThreadProc*)workerStart, task); + // Set the name of the worker thread to the original process name followed by + // ":w", but only if we're on Linux where the program_invocation_short_name + // global is available. +#if defined(linux_HOST_OS) + size_t procname_len = strlen(program_invocation_short_name); + char worker_name[16]; + // The kernel only allocates 16 bytes for thread names, so we truncate if the + // original name is too long. Process names go in another table that has more + // capacity. + if (procname_len >= 13) { + strncpy(worker_name, program_invocation_short_name, 13); + strcpy(worker_name + 13, ":w"); + } else { + strcpy(worker_name, program_invocation_short_name); + strcpy(worker_name + procname_len, ":w"); + } +#else + char * worker_name = "ghc_worker"; +#endif + r = createOSThread(&tid, worker_name, (OSThreadProc*)workerStart, task); if (r != 0) { sysErrorBelch("failed to create OS thread"); stg_exit(EXIT_FAILURE); From git at git.haskell.org Tue Sep 26 02:44:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:33 +0000 (UTC) Subject: [commit: ghc] master: integer-gmp: Fix style (9acbeb5) Message-ID: <20170926024433.452B73A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9acbeb5a4f923726a847da4db03ca4f540ea478b/ghc >--------------------------------------------------------------- commit 9acbeb5a4f923726a847da4db03ca4f540ea478b Author: Ben Gamari Date: Mon Sep 25 18:34:13 2017 -0400 integer-gmp: Fix style Just fix a few inconsistencies that I encountered. [skip ci] Reviewers: austin, hvr, goldfire Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4024 >--------------------------------------------------------------- 9acbeb5a4f923726a847da4db03ca4f540ea478b libraries/integer-gmp/src/GHC/Integer/Type.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/integer-gmp/src/GHC/Integer/Type.hs b/libraries/integer-gmp/src/GHC/Integer/Type.hs index cb1ceec..5815950 100644 --- a/libraries/integer-gmp/src/GHC/Integer/Type.hs +++ b/libraries/integer-gmp/src/GHC/Integer/Type.hs @@ -587,15 +587,15 @@ shiftRInteger (Jn# bn) n# -- Even though the shift-amount is expressed as `Int#`, the result is -- undefined for negative shift-amounts. shiftLInteger :: Integer -> Int# -> Integer -shiftLInteger x 0# = x +shiftLInteger x 0# = x shiftLInteger (S# 0#) _ = S# 0# shiftLInteger (S# 1#) n# = bitInteger n# shiftLInteger (S# i#) n# - | isTrue# (i# >=# 0#) = bigNatToInteger (shiftLBigNat - (wordToBigNat (int2Word# i#)) n#) - | True = bigNatToNegInteger (shiftLBigNat - (wordToBigNat (int2Word# - (negateInt# i#))) n#) + | isTrue# (i# >=# 0#) = bigNatToInteger (shiftLBigNat + (wordToBigNat (int2Word# i#)) n#) + | True = bigNatToNegInteger (shiftLBigNat + (wordToBigNat (int2Word# + (negateInt# i#))) n#) shiftLInteger (Jp# bn) n# = Jp# (shiftLBigNat bn n#) shiftLInteger (Jn# bn) n# = Jn# (shiftLBigNat bn n#) {-# CONSTANT_FOLDED shiftLInteger #-} From git at git.haskell.org Tue Sep 26 02:44:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:36 +0000 (UTC) Subject: [commit: ghc] master: configure: Catch case where LLVM tools can't be found (49c1a20) Message-ID: <20170926024436.0569B3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49c1a20dbbdabc8101877e8ef2c8de9ec3a079d0/ghc >--------------------------------------------------------------- commit 49c1a20dbbdabc8101877e8ef2c8de9ec3a079d0 Author: Ben Gamari Date: Mon Sep 25 18:39:11 2017 -0400 configure: Catch case where LLVM tools can't be found Previously we didn't specify the prog-not-found value passed to AC_CHECK_TOOLS. Reported by @snowleopard in https://github.com/snowleopard/hadrian/issues/415. Test Plan: validate Reviewers: austin, hvr Subscribers: rwbarton, thomie, snowleopard, erikd Differential Revision: https://phabricator.haskell.org/D3992 >--------------------------------------------------------------- 49c1a20dbbdabc8101877e8ef2c8de9ec3a079d0 aclocal.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index af84b6f..c89ef0d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2035,7 +2035,7 @@ AC_DEFUN([XCODE_VERSION],[ # AC_DEFUN([FIND_LLVM_PROG],[ # Test for program with and without version name. - AC_CHECK_TOOLS([$1], [$2-$3 $2]) + AC_CHECK_TOOLS([$1], [$2-$3 $2], [:]) if test "$$1" != ":"; then AC_MSG_CHECKING([$$1 is version $3]) if test `$$1 --version | grep -c "version $3"` -gt 0 ; then @@ -2044,6 +2044,8 @@ AC_DEFUN([FIND_LLVM_PROG],[ AC_MSG_RESULT(no) $1="" fi + else + $1="" fi ]) From git at git.haskell.org Tue Sep 26 02:44:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:38 +0000 (UTC) Subject: [commit: ghc] master: Document Typeable's treatment of kind polymorphic tycons (6de1a5a) Message-ID: <20170926024438.C95B53A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6de1a5a96cdaba080570e9f47ff8711796e2e83b/ghc >--------------------------------------------------------------- commit 6de1a5a96cdaba080570e9f47ff8711796e2e83b Author: Ben Gamari Date: Mon Sep 25 18:33:06 2017 -0400 Document Typeable's treatment of kind polymorphic tycons Test Plan: Read it Reviewers: dfeuer, goldfire, austin, hvr Reviewed By: dfeuer Subscribers: rwbarton, thomie GHC Trac Issues: #14199 Differential Revision: https://phabricator.haskell.org/D3991 >--------------------------------------------------------------- 6de1a5a96cdaba080570e9f47ff8711796e2e83b libraries/base/Data/Typeable/Internal.hs | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index ff53921..d876a2b 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -32,6 +32,11 @@ ----------------------------------------------------------------------------- module Data.Typeable.Internal ( + -- * Typeable and kind polymorphism + -- + -- #kind_instantiation + + -- * Miscellaneous Fingerprint(..), -- * Typeable class @@ -690,3 +695,51 @@ mkTrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) mkTrFun arg res = TrFun fpr arg res where fpr = fingerprintFingerprints [ typeRepFingerprint arg , typeRepFingerprint res] + +{- $kind_instantiation + +Consider a type like 'Data.Proxy.Proxy', + +@ +data Proxy :: forall k. k -> Type +@ + +One might think that one could decompose an instantiation of this type like + at Proxy Int@ into two applications, + +@ +'App' (App a b) c === typeRep @(Proxy Int) +@ + +where, + +@ +a = typeRep @Proxy +b = typeRep @Type +c = typeRep @Int +@ + +However, this isn't the case. Instead we can only decompose into an application +and a constructor, + +@ +'App' ('Con' proxyTyCon) (typeRep @Int) === typeRep @(Proxy Int) +@ + +The reason for this is that 'Typeable' can only represent /kind-monomorphic/ +types. That is, we must saturate enough of @Proxy@\'s arguments to +fully determine its kind. In the particular case of @Proxy@ this means we must +instantiate the kind variable @k@ such that no @forall at -quantified variables +remain. + +While it is not possible to decompose the 'Con' above into an application, it is +possible to observe the kind variable instantiations of the constructor with the +'Con\'' pattern, + +@ +'App' (Con' proxyTyCon kinds) _ === typeRep @(Proxy Int) +@ + +Here @kinds@ will be @[typeRep \@Type]@. + +-} From git at git.haskell.org Tue Sep 26 02:44:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:41 +0000 (UTC) Subject: [commit: ghc] master: Add NOINLINE pragma to builtinRules (d11611f) Message-ID: <20170926024441.879C03A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d11611f5739284cc6aab9b2636ac6485352107ea/ghc >--------------------------------------------------------------- commit d11611f5739284cc6aab9b2636ac6485352107ea Author: Ben Gamari Date: Mon Sep 25 18:34:21 2017 -0400 Add NOINLINE pragma to builtinRules As mentioned in #14275, GHC will otherwise decide to produce unfoldings for this rather large binding, making recompilation more expensive than necessary. Since inlining is almost certainly not fruitful mark it as NOINLINE. [skip ci] Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14275 Differential Revision: https://phabricator.haskell.org/D4023 >--------------------------------------------------------------- d11611f5739284cc6aab9b2636ac6485352107ea compiler/prelude/PrelRules.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index fc211f4..babfe4b 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -1002,6 +1002,9 @@ builtinRules ] ] ++ builtinIntegerRules +{-# NOINLINE builtinRules #-} +-- there is no benefit to inlining these yet, despite this, GHC produces +-- unfoldings for this regardless since the floated list entries look small. builtinIntegerRules :: [CoreRule] builtinIntegerRules = From git at git.haskell.org Tue Sep 26 02:44:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:44 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Expect T13168 to be broken on Windows (2f8e6e7) Message-ID: <20170926024444.4A7163A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f8e6e7f8696213b95e3461224909c3b2ec4f7aa/ghc >--------------------------------------------------------------- commit 2f8e6e7f8696213b95e3461224909c3b2ec4f7aa Author: Ben Gamari Date: Mon Sep 25 20:40:41 2017 -0400 testsuite: Expect T13168 to be broken on Windows Spurious output pertaining to dynamic linking causes it to fail. See #14276. >--------------------------------------------------------------- 2f8e6e7f8696213b95e3461224909c3b2ec4f7aa testsuite/tests/typecheck/T13168/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/T13168/all.T b/testsuite/tests/typecheck/T13168/all.T index 43a5e1b..2ca1d0b 100644 --- a/testsuite/tests/typecheck/T13168/all.T +++ b/testsuite/tests/typecheck/T13168/all.T @@ -1,4 +1,5 @@ test('T13168', - extra_files(['package1', 'package2', 'Setup.hs']), + [extra_files(['package1', 'package2', 'Setup.hs']), + when(opsys('mingw32'), expect_broken(14276))], run_command, ['$MAKE -s --no-print-directory T13168']) From git at git.haskell.org Tue Sep 26 02:44:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 02:44:47 +0000 (UTC) Subject: [commit: ghc] master: Use SIGQUIT for DWARF backtraces instead of SIGUSR2 (9738e8b) Message-ID: <20170926024447.04E013A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9738e8b6d91685cb08ad682b511a7eca09ca1cc4/ghc >--------------------------------------------------------------- commit 9738e8b6d91685cb08ad682b511a7eca09ca1cc4 Author: Ben Gamari Date: Mon Sep 25 18:34:54 2017 -0400 Use SIGQUIT for DWARF backtraces instead of SIGUSR2 Reviewers: austin, erikd, simonmar Subscribers: NicolasT, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3979 >--------------------------------------------------------------- 9738e8b6d91685cb08ad682b511a7eca09ca1cc4 docs/users_guide/8.4.1-notes.rst | 6 ++++++ docs/users_guide/debug-info.rst | 13 +++++++++---- rts/posix/Signals.c | 12 ++++++------ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/docs/users_guide/8.4.1-notes.rst b/docs/users_guide/8.4.1-notes.rst index 9a1235f..4f3ff26 100644 --- a/docs/users_guide/8.4.1-notes.rst +++ b/docs/users_guide/8.4.1-notes.rst @@ -157,6 +157,12 @@ Runtime system - The GHCi runtime linker on Windows now supports the `big-obj` file format. +- The runtime system's :ref:`native stack backtrace ` support + on POSIX platforms is now triggered by ``SIGQUIT`` instead of ``SIGUSR2`` as + it was in previous releases. This change is to bring GHC's behavior into + compliance with the model set by the most Java virtual machine + implementations. + Template Haskell ~~~~~~~~~~~~~~~~ diff --git a/docs/users_guide/debug-info.rst b/docs/users_guide/debug-info.rst index 558da59..d1bd28c 100644 --- a/docs/users_guide/debug-info.rst +++ b/docs/users_guide/debug-info.rst @@ -185,16 +185,21 @@ Stack trace functionality is exposed for use by Haskell programs in the :base-ref:`GHC.ExecutionStack.` module. See the Haddock documentation in this module for details regarding usage. -Requesting a stack trace with ``SIGUSR2`` +.. _backtrace_signal: + +Requesting a stack trace with ``SIGQUIT`` ----------------------------------------- On POSIX-compatible platforms GHC's runtime system (when built with ``libdw`` -support) will produce a stack trace on ``stderr`` when a ``SIGUSR2`` signal is -received. For instance (using the same ``fib.hs`` as above), +support) will produce a stack trace on ``stderr`` when a ``SIGQUIT`` signal is +received (on many systems this signal can be sent using :kbd:`Ctrl-\\`). For +instance (using the same ``fib.hs`` as above), .. code-block:: sh - $ ./fib & killall -SIGUSR2 fib + $ ./fib & killall -SIGQUIT fib + + Caught SIGQUIT; Backtrace: 0x7f3176b15dd8 dwfl_thread_getframes (/usr/lib/x86_64-linux-gnu/libdw-0.163.so) 0x7f3176b1582f (null) (/usr/lib/x86_64-linux-gnu/libdw-0.163.so) 0x7f3176b15b57 dwfl_getthreads (/usr/lib/x86_64-linux-gnu/libdw-0.163.so) diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 6b72890..e75f99d 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -528,10 +528,10 @@ shutdown_handler(int sig STG_UNUSED) } /* ----------------------------------------------------------------------------- - * SIGUSR2 handler. + * SIGQUIT handler. * * We try to give the user an indication of what we are currently doing - * in response to SIGUSR2. + * in response to SIGQUIT. * -------------------------------------------------------------------------- */ static void backtrace_handler(int sig STG_UNUSED) @@ -539,7 +539,7 @@ backtrace_handler(int sig STG_UNUSED) #if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); - fprintf(stderr, "\nCaught SIGUSR2; Backtrace:\n"); + fprintf(stderr, "\nCaught SIGQUIT; Backtrace:\n"); libdwPrintBacktrace(session, stderr, bt); backtraceFree(bt); libdwFree(session); @@ -721,12 +721,12 @@ initDefaultHandlers(void) sysErrorBelch("warning: failed to install SIGPIPE handler"); } - // Print a backtrace on SIGUSR2 + // Print a backtrace on SIGQUIT action.sa_handler = backtrace_handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; - if (sigaction(SIGUSR2, &action, &oact) != 0) { - sysErrorBelch("warning: failed to install SIGUSR2 handler"); + if (sigaction(SIGQUIT, &action, &oact) != 0) { + sysErrorBelch("warning: failed to install SIGQUIT handler"); } set_sigtstp_action(true); From git at git.haskell.org Tue Sep 26 09:14:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 09:14:29 +0000 (UTC) Subject: [commit: ghc] master: A bunch of typofixes (7446c7f) Message-ID: <20170926091429.D95743A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7446c7f68bd5addd2f2db0d8d5910fb963869c47/ghc >--------------------------------------------------------------- commit 7446c7f68bd5addd2f2db0d8d5910fb963869c47 Author: Gabor Greif Date: Mon Sep 25 12:31:12 2017 +0200 A bunch of typofixes >--------------------------------------------------------------- 7446c7f68bd5addd2f2db0d8d5910fb963869c47 compiler/basicTypes/Id.hs | 2 +- compiler/cmm/CmmContFlowOpt.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 2 +- compiler/coreSyn/CoreUnfold.hs | 2 +- compiler/deSugar/DsCCall.hs | 2 +- compiler/ghci/GHCi.hs | 2 +- compiler/hsSyn/HsBinds.hs | 2 +- compiler/iface/IfaceSyn.hs | 2 +- compiler/llvmGen/Llvm/AbsSyn.hs | 4 ++-- compiler/main/InteractiveEval.hs | 8 ++++---- compiler/main/Packages.hs | 2 +- compiler/main/TidyPgm.hs | 2 +- compiler/nativeGen/PPC/CodeGen.hs | 2 +- compiler/nativeGen/SPARC/CodeGen.hs | 2 +- compiler/nativeGen/X86/CodeGen.hs | 2 +- compiler/rename/RnExpr.hs | 2 +- compiler/simplCore/SimplUtils.hs | 4 ++-- compiler/simplCore/Simplify.hs | 4 ++-- compiler/simplStg/StgCse.hs | 2 +- compiler/stranal/WorkWrap.hs | 2 +- compiler/typecheck/FunDeps.hs | 4 ++-- compiler/typecheck/TcDeriv.hs | 2 +- compiler/typecheck/TcEnv.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 4 ++-- compiler/typecheck/TcSMonad.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 2 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/TyCon.hs | 2 +- compiler/types/Unify.hs | 4 ++-- compiler/utils/EnumSet.hs | 2 +- compiler/utils/Panic.hs | 2 +- docs/ghci/ghci.tex | 8 ++++---- docs/users_guide/glasgow_exts.rst | 4 ++-- docs/users_guide/safe_haskell.rst | 2 +- docs/users_guide/separate_compilation.rst | 2 +- libraries/base/Data/Bits.hs | 2 +- libraries/base/Data/Data.hs | 2 +- libraries/base/GHC/Event/PSQ.hs | 2 +- libraries/base/GHC/Show.hs | 2 +- libraries/base/cbits/primFloat.c | 2 +- libraries/integer-simple/GHC/Integer.hs | 2 +- libraries/integer-simple/GHC/Integer/Simple/Internals.hs | 2 +- libraries/integer-simple/GHC/Integer/Type.hs | 2 +- libraries/integer-simple/integer-simple.cabal | 2 +- rts/Capability.c | 2 +- rts/PrimOps.cmm | 4 ++-- rts/Threads.c | 2 +- rts/sm/Storage.c | 2 +- testsuite/tests/concurrent/should_run/conc065.hs | 2 +- testsuite/tests/dph/nbody/Generate.hs | 2 +- testsuite/tests/dph/quickhull/TestData.hs | 2 +- testsuite/tests/programs/maessen-hashtab/Data/HashTab.hs | 2 +- testsuite/tests/typecheck/should_compile/T12734a.hs | 2 +- 54 files changed, 68 insertions(+), 68 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 7446c7f68bd5addd2f2db0d8d5910fb963869c47 From git at git.haskell.org Tue Sep 26 14:06:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 14:06:30 +0000 (UTC) Subject: [commit: ghc] master: Omit Typeable from the "naturally coherent" list (c41ccbf) Message-ID: <20170926140630.774563A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c41ccbfa8aaeb99dd9a36cb3d99993f0fa039cdc/ghc >--------------------------------------------------------------- commit c41ccbfa8aaeb99dd9a36cb3d99993f0fa039cdc Author: Simon Peyton Jones Date: Tue Sep 26 15:02:09 2017 +0100 Omit Typeable from the "naturally coherent" list In doing something else (Trac #14218) I tripped over the definition of "naturally coherent" classes. This patch - Cocuments properly what that means - Removes Typeable from the list, because now we know what it meams, Typeable clearly doesn't belong. No regressions. (Actually the term "naturally coherent" seems a bit off. More like "invertible" or something. But I left it.) >--------------------------------------------------------------- c41ccbfa8aaeb99dd9a36cb3d99993f0fa039cdc compiler/prelude/TysPrim.hs | 31 +++++++++--------- compiler/typecheck/TcInteract.hs | 70 +++++++++++++++++++++++++++++++--------- 2 files changed, 70 insertions(+), 31 deletions(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index b4a5b6b..5c099e8 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -582,18 +582,17 @@ Note [The equality types story] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GHC sports a veritable menagerie of equality types: - Hetero? Levity Result Role Defining module - ------------------------------------------------------------ - ~# hetero unlifted # nominal GHC.Prim - ~~ hetero lifted Constraint nominal GHC.Types - ~ homo lifted Constraint nominal Data.Type.Equality - :~: homo lifted * nominal Data.Type.Equality - - ~R# hetero unlifted # repr GHC.Prim - Coercible homo lifted Constraint repr GHC.Types - Coercion homo lifted * repr Data.Type.Coercion - - ~P# hetero unlifted phantom GHC.Prim + Built-in tc Hetero? Levity Result Role Defining module +----------------------------------------------------------------------------------------- +~# eqPrimTyCon hetero unlifted # nominal GHC.Prim +~~ hEqTyCon hetero lifted Constraint nominal GHC.Types +~ eqTyCon homo lifted Constraint nominal Data.Type.Equality +:~: - homo lifted * nominal Data.Type.Equality + +~R# eqReprPrimTy hetero unlifted # repr GHC.Prim +Coercible coercibleTyCon homo lifted Constraint repr GHC.Types +Coercion - homo lifted * repr Data.Type.Coercion +~P# eqPhantPrimTyCon hetero unlifted phantom GHC.Prim Recall that "hetero" means the equality can related types of different kinds. Knowing that (t1 ~# t2) or (t1 ~R# t2) or even that (t1 ~P# t2) @@ -638,8 +637,8 @@ Here's what's unusual about it: * It is "naturally coherent". This means that the solver won't hesitate to solve a goal of type (a ~~ b) even if there is, say (Int ~~ c) in the context. (Normally, it waits to learn more, just in case the given - influences what happens next.) This is quite like having - IncoherentInstances enabled. + influences what happens next.) See Note [Naturally coherent classes] + in TcInteract. * It always terminates. That is, in the UndecidableInstances checks, we don't worry if a (~~) constraint is too big, as we know that solving @@ -666,8 +665,8 @@ This is even more so an ordinary class than (~~), with the following exceptions: * It is "naturally coherent". (See (~~).) - * (~) is magical syntax, as ~ is a reserved symbol. It cannot be exported - or imported. + * (~) is magical syntax, as ~ is a reserved symbol. + It cannot be exported or imported. * It always terminates. diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 1298932..260bb4a 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2185,14 +2185,20 @@ match_class_inst dflags clas tys loc -- | If a class is "naturally coherent", then we needn't worry at all, in any -- way, about overlapping/incoherent instances. Just solve the thing! -naturallyCoherentClass :: Class -> Bool +-- See Note [Naturally coherent classes] -- See also Note [The equality class story] in TysPrim. +naturallyCoherentClass :: Class -> Bool naturallyCoherentClass cls - = isCTupleClass cls || -- See "Tuple classes" in Note [Instance and Given overlap] - cls `hasKey` heqTyConKey || - cls `hasKey` eqTyConKey || - cls `hasKey` coercibleTyConKey || - cls `hasKey` typeableClassKey + = isCTupleClass cls + || cls `hasKey` heqTyConKey + || cls `hasKey` eqTyConKey + || cls `hasKey` coercibleTyConKey +{- + || cls `hasKey` typeableClassKey + -- I have no idea why Typeable is in this list, and it looks utterly + -- wrong, according the reasoning in Note [Naturally coherent classes]. + -- So I've commented it out, and sure enough everything seems fine. +-} {- Note [Instance and Given overlap] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2249,15 +2255,6 @@ Other notes: * Another "live" example is Trac #10195; another is #10177. -* Tuple classes. For reasons described in TcSMonad - Note [Tuples hiding implicit parameters], we may have a constraint - [W] (?x::Int, C a) - with an exactly-matching Given constraint. We must decompose this - tuple and solve the components separately, otherwise we won't solve - it at all! It is perfectly safe to decompose it, because the "instance" - for class tuples is bidirectional: the Given can also be decomposed - to provide the pieces. - * We ignore the overlap problem if -XIncoherentInstances is in force: see Trac #6002 for a worked-out example where this makes a difference. @@ -2286,6 +2283,49 @@ Other notes: All of this is disgustingly delicate, so to discourage people from writing simplifiable class givens, we warn about signatures that contain them; see TcValidity Note [Simplifiable given constraints]. + +Note [Naturally coherent classes] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +A few built-in classes are "naturally coherent". This term means that +the "instance" for the class is bidirectional with its superclass(es). +For example, consider (~~), which behaves as if it was defined like +this: + class a ~# b => a ~~ b + instance a ~# b => a ~~ b +(See Note [The equality types story] in TysPrim.) + +Faced with [W] t1 ~~ t2, it's always OK to reduce it to [W] t1 ~# t2, +without worrying about Note [Instance and Given overlap]. Why? Because +if we had [G] s1 ~~ s2, then we'd get the superclass [G] s1 ~# s2, and +so the reduction of the [W] contraint does not risk losing any solutions. + +On the other hand, it can be fatal to /fail/ to reduce such +equalities, on the grounds of Note [Instance and Given overlap], +because many good things flow from [W] t1 ~# t2. + +The same reasoning applies to + +* (~~) heqTyCOn +* (~) eqTyCon +* Coercible coercibleTyCon + +And less obviously to: + +* Tuple classes. For reasons described in TcSMonad + Note [Tuples hiding implicit parameters], we may have a constraint + [W] (?x::Int, C a) + with an exactly-matching Given constraint. We must decompose this + tuple and solve the components separately, otherwise we won't solve + it at all! It is perfectly safe to decompose it, because again the + superclasses invert the instance; e.g. + class (c1, c2) => (% c1, c2 %) + instance (c1, c2) => (% c1, c2 %) + Example in Trac #14218 + +Exammples: T5853, T10432, T5315, T9222, T2627b, T3028b + +PS: the term "naturally coherent" doesn't really seem helpful. +Perhaps "invertible" or something? I left it for now though. -} From git at git.haskell.org Tue Sep 26 16:00:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 16:00:14 +0000 (UTC) Subject: [commit: ghc] master: primops: Add some notes regarding the meaning of the "type" field (6246407) Message-ID: <20170926160014.AB1123A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/62464071455ea0472903ef1d94833e5eefb8f74e/ghc >--------------------------------------------------------------- commit 62464071455ea0472903ef1d94833e5eefb8f74e Author: Ben Gamari Date: Tue Sep 26 09:33:53 2017 -0400 primops: Add some notes regarding the meaning of the "type" field The overloading of "monadic" definitely deserved some explanation. [skip ci] >--------------------------------------------------------------- 62464071455ea0472903ef1d94833e5eefb8f74e compiler/prelude/primops.txt.pp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index f2c02ec..afe5849 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -38,6 +38,14 @@ -- processors of this file to easily get hold of simple info -- (eg, out_of_line), whilst avoiding parsing complex expressions -- needed for strictness info. +-- +-- type refers to the general category of the primop. Valid settings include, +-- +-- * Compare: A comparison operation of the shape a -> a -> Int# +-- * Monadic: A unary operation of shape a -> a +-- * Dyadic: A binary operation of shape a -> a -> a +-- * GenPrimOp: Any other sort of primop +-- -- The vector attribute is rather special. It takes a list of 3-tuples, each of -- which is of the form . ELEM_TYPE is the type of From git at git.haskell.org Tue Sep 26 16:00:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 16:00:17 +0000 (UTC) Subject: [commit: ghc] master: StgCmmMonad: Remove unnecessary use of unboxed tuples (6e7c09d) Message-ID: <20170926160017.6F1883A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6e7c09d083358b07401cbecc36043be5dfe15f84/ghc >--------------------------------------------------------------- commit 6e7c09d083358b07401cbecc36043be5dfe15f84 Author: Ben Gamari Date: Tue Sep 26 08:33:34 2017 -0400 StgCmmMonad: Remove unnecessary use of unboxed tuples The simplifier can simplify this without any trouble. Moreover, the unboxed tuples cause bootstrapping issues due #14123. I also went ahead and inlined a few definitions into the Monad instance. Test Plan: Validate Reviewers: austin, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4026 >--------------------------------------------------------------- 6e7c09d083358b07401cbecc36043be5dfe15f84 compiler/codeGen/StgCmm.hs | 4 +-- compiler/codeGen/StgCmmMonad.hs | 75 ++++++++++++----------------------------- 2 files changed, 24 insertions(+), 55 deletions(-) diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs index 825c309..60be1ca 100644 --- a/compiler/codeGen/StgCmm.hs +++ b/compiler/codeGen/StgCmm.hs @@ -235,8 +235,8 @@ maybeExternaliseId dflags id | gopt Opt_SplitObjs dflags, -- See Note [Externalise when splitting] -- in StgCmmMonad isInternalName name = do { mod <- getModuleName - ; returnFC (setIdName id (externalise mod)) } - | otherwise = returnFC id + ; return (setIdName id (externalise mod)) } + | otherwise = return id where externalise mod = mkExternalName uniq mod new_occ loc name = idName id diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index 8145be1..7c38642 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -11,9 +11,8 @@ module StgCmmMonad ( FCode, -- type - initC, runC, thenC, thenFC, listCs, - returnFC, fixC, - newUnique, newUniqSupply, + initC, runC, fixC, + newUnique, emitLabel, @@ -84,8 +83,6 @@ import Outputable import Control.Monad import Data.List -infixr 9 `thenC` -- Right-associative! -infixr 9 `thenFC` -------------------------------------------------------- @@ -114,27 +111,30 @@ infixr 9 `thenFC` -------------------------------------------------------- -newtype FCode a = FCode (CgInfoDownwards -> CgState -> (# a, CgState #)) +newtype FCode a = FCode { doFCode :: CgInfoDownwards -> CgState -> (a, CgState) } instance Functor FCode where - fmap f (FCode g) = FCode $ \i s -> case g i s of (# a, s' #) -> (# f a, s' #) + fmap f (FCode g) = FCode $ \i s -> case g i s of (a, s') -> (f a, s') instance Applicative FCode where - pure = returnFC - (<*>) = ap + pure val = FCode (\_info_down state -> (val, state)) + {-# INLINE pure #-} + (<*>) = ap instance Monad FCode where - (>>=) = thenFC - -{-# INLINE thenC #-} -{-# INLINE thenFC #-} -{-# INLINE returnFC #-} + FCode m >>= k = FCode $ + \info_down state -> + case m info_down state of + (m_result, new_state) -> + case k m_result of + FCode kcode -> kcode info_down new_state + {-# INLINE (>>=) #-} instance MonadUnique FCode where getUniqueSupplyM = cgs_uniqs <$> getState getUniqueM = FCode $ \_ st -> let (u, us') = takeUniqFromSupply (cgs_uniqs st) - in (# u, st { cgs_uniqs = us' } #) + in (u, st { cgs_uniqs = us' }) initC :: IO CgState initC = do { uniqs <- mkSplitUniqSupply 'c' @@ -143,36 +143,10 @@ initC = do { uniqs <- mkSplitUniqSupply 'c' runC :: DynFlags -> Module -> CgState -> FCode a -> (a,CgState) runC dflags mod st fcode = doFCode fcode (initCgInfoDown dflags mod) st -returnFC :: a -> FCode a -returnFC val = FCode (\_info_down state -> (# val, state #)) - -thenC :: FCode () -> FCode a -> FCode a -thenC (FCode m) (FCode k) = - FCode $ \info_down state -> case m info_down state of - (# _,new_state #) -> k info_down new_state - -listCs :: [FCode ()] -> FCode () -listCs [] = return () -listCs (fc:fcs) = do - fc - listCs fcs - -thenFC :: FCode a -> (a -> FCode c) -> FCode c -thenFC (FCode m) k = FCode $ - \info_down state -> - case m info_down state of - (# m_result, new_state #) -> - case k m_result of - FCode kcode -> kcode info_down new_state - fixC :: (a -> FCode a) -> FCode a -fixC fcode = FCode ( - \info_down state -> - let - (v,s) = doFCode (fcode v) info_down state - in - (# v, s #) - ) +fixC fcode = FCode $ + \info_down state -> let (v, s) = doFCode (fcode v) info_down state + in (v, s) -------------------------------------------------------- -- The code generator environment @@ -432,10 +406,10 @@ hp_usg `maxHpHw` hw = hp_usg { virtHp = virtHp hp_usg `max` hw } -------------------------------------------------------- getState :: FCode CgState -getState = FCode $ \_info_down state -> (# state, state #) +getState = FCode $ \_info_down state -> (state, state) setState :: CgState -> FCode () -setState state = FCode $ \_info_down _ -> (# (), state #) +setState state = FCode $ \_info_down _ -> ((), state) getHpUsage :: FCode HeapUsage getHpUsage = do @@ -475,7 +449,7 @@ setBinds new_binds = do withState :: FCode a -> CgState -> FCode (a,CgState) withState (FCode fcode) newstate = FCode $ \info_down state -> case fcode info_down newstate of - (# retval, state2 #) -> (# (retval,state2), state #) + (retval, state2) -> ((retval,state2), state) newUniqSupply :: FCode UniqSupply newUniqSupply = do @@ -493,7 +467,7 @@ newUnique = do ------------------ getInfoDown :: FCode CgInfoDownwards -getInfoDown = FCode $ \info_down state -> (# info_down,state #) +getInfoDown = FCode $ \info_down state -> (info_down,state) getSelfLoop :: FCode (Maybe SelfLoopInfo) getSelfLoop = do @@ -514,11 +488,6 @@ getThisPackage = liftM thisPackage getDynFlags withInfoDown :: FCode a -> CgInfoDownwards -> FCode a withInfoDown (FCode fcode) info_down = FCode $ \_ state -> fcode info_down state -doFCode :: FCode a -> CgInfoDownwards -> CgState -> (a,CgState) -doFCode (FCode fcode) info_down state = - case fcode info_down state of - (# a, s #) -> ( a, s ) - -- ---------------------------------------------------------------------------- -- Get the current module name From git at git.haskell.org Tue Sep 26 16:00:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 16:00:20 +0000 (UTC) Subject: [commit: ghc] master: PrelRules: Handle Int left shifts of more than word-size bits (57372a7) Message-ID: <20170926160020.36E113A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57372a7cc958ebfa4ac64fc800e00baacfc3cf5c/ghc >--------------------------------------------------------------- commit 57372a7cc958ebfa4ac64fc800e00baacfc3cf5c Author: Ben Gamari Date: Tue Sep 26 08:01:44 2017 -0400 PrelRules: Handle Int left shifts of more than word-size bits This should result in zero. Failing to realize this caused us to try to constant-fold via the normal path, resulting in #14272. Test Plan: Validate with coming tests Reviewers: austin, simonpj Subscribers: simonpj, rwbarton, thomie, hvr GHC Trac Issues: #14272 Differential Revision: https://phabricator.haskell.org/D4025 >--------------------------------------------------------------- 57372a7cc958ebfa4ac64fc800e00baacfc3cf5c compiler/prelude/PrelRules.hs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs index babfe4b..810fd2b 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -122,11 +122,11 @@ primOpRules nm NotIOp = mkPrimOpRule nm 1 [ unaryLit complementOp , inversePrimOp NotIOp ] primOpRules nm IntNegOp = mkPrimOpRule nm 1 [ unaryLit negOp , inversePrimOp IntNegOp ] -primOpRules nm ISllOp = mkPrimOpRule nm 2 [ binaryLit (intOp2 Bits.shiftL) +primOpRules nm ISllOp = mkPrimOpRule nm 2 [ shiftRule (const Bits.shiftL) , rightIdentityDynFlags zeroi ] -primOpRules nm ISraOp = mkPrimOpRule nm 2 [ binaryLit (intOp2 Bits.shiftR) +primOpRules nm ISraOp = mkPrimOpRule nm 2 [ shiftRule (const Bits.shiftR) , rightIdentityDynFlags zeroi ] -primOpRules nm ISrlOp = mkPrimOpRule nm 2 [ binaryLit (intOp2' shiftRightLogical) +primOpRules nm ISrlOp = mkPrimOpRule nm 2 [ shiftRule shiftRightLogical , rightIdentityDynFlags zeroi ] -- Word operations @@ -157,8 +157,8 @@ primOpRules nm XorOp = mkPrimOpRule nm 2 [ binaryLit (wordOp2 xor) , equalArgs >> retLit zerow ] primOpRules nm NotOp = mkPrimOpRule nm 1 [ unaryLit complementOp , inversePrimOp NotOp ] -primOpRules nm SllOp = mkPrimOpRule nm 2 [ wordShiftRule (const Bits.shiftL) ] -primOpRules nm SrlOp = mkPrimOpRule nm 2 [ wordShiftRule shiftRightLogical ] +primOpRules nm SllOp = mkPrimOpRule nm 2 [ shiftRule (const Bits.shiftL) ] +primOpRules nm SrlOp = mkPrimOpRule nm 2 [ shiftRule shiftRightLogical ] -- coercions primOpRules nm Word2IntOp = mkPrimOpRule nm 1 [ liftLitDynFlags word2IntLit @@ -419,10 +419,10 @@ wordOp2 op dflags (MachWord w1) (MachWord w2) = wordResult dflags (fromInteger w1 `op` fromInteger w2) wordOp2 _ _ _ _ = Nothing -- Could find LitLit -wordShiftRule :: (DynFlags -> Integer -> Int -> Integer) -> RuleM CoreExpr +shiftRule :: (DynFlags -> Integer -> Int -> Integer) -> RuleM CoreExpr -- Shifts take an Int; hence third arg of op is Int -- See Note [Guarding against silly shifts] -wordShiftRule shift_op +shiftRule shift_op = do { dflags <- getDynFlags ; [e1, Lit (MachInt shift_len)] <- getArgs ; case e1 of @@ -431,10 +431,16 @@ wordShiftRule shift_op | shift_len < 0 || wordSizeInBits dflags < shift_len -> return (mkRuntimeErrorApp rUNTIME_ERROR_ID wordPrimTy ("Bad shift length" ++ show shift_len)) + + -- Do the shift at type Integer, but shift length is Int + Lit (MachInt x) + -> let op = shift_op dflags + in liftMaybe $ intResult dflags (x `op` fromInteger shift_len) + Lit (MachWord x) -> let op = shift_op dflags in liftMaybe $ wordResult dflags (x `op` fromInteger shift_len) - -- Do the shift at type Integer, but shift length is Int + _ -> mzero } wordSizeInBits :: DynFlags -> Integer From git at git.haskell.org Tue Sep 26 16:00:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 16:00:23 +0000 (UTC) Subject: [commit: ghc] master: rts: Inform kernel that we won't need reserved address space (1d1b991) Message-ID: <20170926160023.094B43A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1d1b991ee15e0428be16d1bfad7087051e000bdc/ghc >--------------------------------------------------------------- commit 1d1b991ee15e0428be16d1bfad7087051e000bdc Author: Ben Gamari Date: Tue Sep 26 10:09:06 2017 -0400 rts: Inform kernel that we won't need reserved address space Trac #14192 points out that currently GHC's two-step allocator results in extremely large coredumps. It seems like WebKit may have encountered similar issues and their apparent solution uses madvise(MADV_DONTNEED) while reserving address space to inform the kernel that the address space we just requested needs no backing. Perhaps this is used by the core dump logic to trim out uncommitted pages. Test Plan: Validate, try core-dumping a compiled executable Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14192, #14193 Differential Revision: https://phabricator.haskell.org/D3929 >--------------------------------------------------------------- 1d1b991ee15e0428be16d1bfad7087051e000bdc rts/posix/OSMem.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 6ccd65a..ee727a5 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -191,6 +191,19 @@ my_mmap (void *addr, W_ size, int operation) errno = ENOMEM; } } + + if (operation & MEM_COMMIT) { + madvise(ret, size, MADV_WILLNEED); +#if defined(MADV_DODUMP) + madvise(ret, size, MADV_DODUMP); +#endif + } else { + madvise(ret, size, MADV_DONTNEED); +#if defined(MADV_DONTDUMP) + madvise(ret, size, MADV_DONTDUMP); +#endif + } + #else ret = mmap(addr, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0); #endif From git at git.haskell.org Tue Sep 26 16:02:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 16:02:59 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #14272 (0ffa396) Message-ID: <20170926160259.A5E373A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ffa396d5421bc127759a62c2612920005423b15/ghc >--------------------------------------------------------------- commit 0ffa396d5421bc127759a62c2612920005423b15 Author: Ben Gamari Date: Tue Sep 26 12:02:27 2017 -0400 testsuite: Add test for #14272 Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14272 Differential Revision: https://phabricator.haskell.org/D4027 >--------------------------------------------------------------- 0ffa396d5421bc127759a62c2612920005423b15 testsuite/tests/simplCore/should_compile/T14272.hs | 7 +++++++ testsuite/tests/simplCore/should_compile/all.T | 2 ++ 2 files changed, 9 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T14272.hs b/testsuite/tests/simplCore/should_compile/T14272.hs new file mode 100644 index 0000000..d520c06 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14272.hs @@ -0,0 +1,7 @@ +import Data.Bits (bit) + +main :: IO () +main = putStrLn (show (f undefined)) + +f :: [Int] -> Int +f = sum . zipWith ((+) . bit) [0..] . map undefined . scanl undefined undefined diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 72b872a..7f21331 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -279,3 +279,5 @@ test('T14140', normal, run_command, ['$MAKE -s --no-print-directory T14140']) + +test('T14272', normal, compile, ['']) From git at git.haskell.org Tue Sep 26 17:37:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 17:37:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump Cabal submodule (5475ebe) Message-ID: <20170926173740.E8C663A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/5475ebe15b331b72a984d362fd46013095bc54f7/ghc >--------------------------------------------------------------- commit 5475ebe15b331b72a984d362fd46013095bc54f7 Author: Ben Gamari Date: Tue Sep 26 10:11:12 2017 -0400 Bump Cabal submodule >--------------------------------------------------------------- 5475ebe15b331b72a984d362fd46013095bc54f7 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index 082cf20..c84a3c7 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 082cf2066b7206d3b12a9f92d832236e2484b4c1 +Subproject commit c84a3c72196d0a5361f8ab77c6d8cb63b7a5d55d From git at git.haskell.org Tue Sep 26 17:37:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 17:37:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Document Typeable's treatment of kind polymorphic tycons (98f3bdd) Message-ID: <20170926173743.9E6FC3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/98f3bdd6af349bc020013335a1a9b17612d23115/ghc >--------------------------------------------------------------- commit 98f3bdd6af349bc020013335a1a9b17612d23115 Author: Ben Gamari Date: Mon Sep 25 18:33:06 2017 -0400 Document Typeable's treatment of kind polymorphic tycons Test Plan: Read it Reviewers: dfeuer, goldfire, austin, hvr Reviewed By: dfeuer Subscribers: rwbarton, thomie GHC Trac Issues: #14199 Differential Revision: https://phabricator.haskell.org/D3991 (cherry picked from commit 6de1a5a96cdaba080570e9f47ff8711796e2e83b) >--------------------------------------------------------------- 98f3bdd6af349bc020013335a1a9b17612d23115 libraries/base/Data/Typeable/Internal.hs | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index f094d96..7fac773 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -32,6 +32,11 @@ ----------------------------------------------------------------------------- module Data.Typeable.Internal ( + -- * Typeable and kind polymorphism + -- + -- #kind_instantiation + + -- * Miscellaneous Fingerprint(..), -- * Typeable class @@ -685,3 +690,51 @@ mkTrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) mkTrFun arg res = TrFun fpr arg res where fpr = fingerprintFingerprints [ typeRepFingerprint arg , typeRepFingerprint res] + +{- $kind_instantiation + +Consider a type like 'Data.Proxy.Proxy', + +@ +data Proxy :: forall k. k -> Type +@ + +One might think that one could decompose an instantiation of this type like + at Proxy Int@ into two applications, + +@ +'App' (App a b) c === typeRep @(Proxy Int) +@ + +where, + +@ +a = typeRep @Proxy +b = typeRep @Type +c = typeRep @Int +@ + +However, this isn't the case. Instead we can only decompose into an application +and a constructor, + +@ +'App' ('Con' proxyTyCon) (typeRep @Int) === typeRep @(Proxy Int) +@ + +The reason for this is that 'Typeable' can only represent /kind-monomorphic/ +types. That is, we must saturate enough of @Proxy@\'s arguments to +fully determine its kind. In the particular case of @Proxy@ this means we must +instantiate the kind variable @k@ such that no @forall at -quantified variables +remain. + +While it is not possible to decompose the 'Con' above into an application, it is +possible to observe the kind variable instantiations of the constructor with the +'Con\'' pattern, + +@ +'App' (Con' proxyTyCon kinds) _ === typeRep @(Proxy Int) +@ + +Here @kinds@ will be @[typeRep \@Type]@. + +-} From git at git.haskell.org Tue Sep 26 17:37:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 17:37:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Deal with large extra-contraints wildcards (2e17259) Message-ID: <20170926173747.0B1443A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/2e17259c57ff598ec87db545fb33702d86859462/ghc >--------------------------------------------------------------- commit 2e17259c57ff598ec87db545fb33702d86859462 Author: Simon Peyton Jones Date: Thu Sep 21 17:35:11 2017 +0100 Deal with large extra-contraints wildcards For reasons explained in TcHsType Note [Extra-constraint holes in partial type signatures], if we had f :: (_) => blahs and the '_' was filled in by more than a 62-tuple of contraints, GHC crashed. The same Note explains the hacky solution I have adopted to evade this. Maybe there is some better way, but I couldn't see one that didn't involve a great deal of work. And the problem is a very narrow one! If the hack bites us we'll need to think again. (cherry picked from commit 3c74a51232813eb733b27c43c94ce005112a0ddb) >--------------------------------------------------------------- 2e17259c57ff598ec87db545fb33702d86859462 compiler/prelude/TysWiredIn.hs | 7 +- compiler/typecheck/TcBinds.hs | 18 ++-- compiler/typecheck/TcHsType.hs | 52 +++++++++++- compiler/typecheck/TcMType.hs | 7 +- .../tests/partial-sigs/should_compile/T14217.hs | 41 +++++++++ .../partial-sigs/should_compile/T14217.stderr | 99 ++++++++++++++++++++++ testsuite/tests/partial-sigs/should_compile/all.T | 1 + 7 files changed, 210 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 2e17259c57ff598ec87db545fb33702d86859462 From git at git.haskell.org Tue Sep 26 17:37:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 17:37:49 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix "Glasgow Haskell Compiler Users Guide" (1d46afc) Message-ID: <20170926173749.B5A9D3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/1d46afc393410b7bafd6f956d57a16466857e7bb/ghc >--------------------------------------------------------------- commit 1d46afc393410b7bafd6f956d57a16466857e7bb Author: Bartosz Nitka Date: Mon Apr 17 12:49:34 2017 -0400 Fix "Glasgow Haskell Compiler Users Guide" If you go to https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html the window title has `` in it. I don't understand how it all works, but inspired by the line below which produces a correct string in the docs I just blindly changed it in the same way. Cabal appears to have the same problem. Test Plan: it'd be nice if I could check the result on harbormaster, can I? Reviewers: thomie, bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, simonmar Differential Revision: https://phabricator.haskell.org/D3458 >--------------------------------------------------------------- 1d46afc393410b7bafd6f956d57a16466857e7bb docs/users_guide/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/conf.py b/docs/users_guide/conf.py index cc7c0cc..3af6ac1 100644 --- a/docs/users_guide/conf.py +++ b/docs/users_guide/conf.py @@ -37,7 +37,7 @@ exclude_patterns = ['.build', "*.gen.rst"] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = "Glasgow Haskell Compiler User's Guide" +html_title = "Glasgow Haskell Compiler %s User's Guide" % release html_short_title = "GHC %s User's Guide" % release html_theme_path = ['.'] html_theme = 'ghc-theme' From git at git.haskell.org Tue Sep 26 17:37:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 17:37:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix unused-given-constraint bug (776a660) Message-ID: <20170926173753.2326C3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/776a660a66404408a36b92cb84397815d283b6a5/ghc >--------------------------------------------------------------- commit 776a660a66404408a36b92cb84397815d283b6a5 Author: Simon Peyton Jones Date: Tue Sep 19 12:37:13 2017 +0100 Fix unused-given-constraint bug This bug was shown up by Trac #14237. It turned out to be an outright error in TcSimplify.neededEvVars, easily fixed. I improved the comments. (cherry picked from commit 1db0f4a48e9db5e85782e32f074cc83bbc145cb7) >--------------------------------------------------------------- 776a660a66404408a36b92cb84397815d283b6a5 compiler/typecheck/TcEvidence.hs | 2 + compiler/typecheck/TcSimplify.hs | 15 +- .../tests/indexed-types/should_compile/T14237.hs | 7 + testsuite/tests/indexed-types/should_compile/all.T | 1 + .../partial-sigs/should_compile/SuperCls.stderr | 2 +- .../partial-sigs/should_compile/T11016.stderr | 2 +- .../partial-sigs/should_compile/T12845.stderr | 2 +- .../partial-sigs/should_compile/T14217.stderr | 4869 +++++++++++++++++++- .../tests/partial-sigs/should_fail/T12634.stderr | 2 +- 9 files changed, 4814 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 776a660a66404408a36b92cb84397815d283b6a5 From git at git.haskell.org Tue Sep 26 18:06:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 18:06:35 +0000 (UTC) Subject: [commit: ghc] master: TcInteract: Remove redundant import of Typeable (f9f1e38) Message-ID: <20170926180635.1C72B3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f9f1e38c204c0d294d31398c8c300fba3d89f450/ghc >--------------------------------------------------------------- commit f9f1e38c204c0d294d31398c8c300fba3d89f450 Author: Ben Gamari Date: Tue Sep 26 13:35:46 2017 -0400 TcInteract: Remove redundant import of Typeable >--------------------------------------------------------------- f9f1e38c204c0d294d31398c8c300fba3d89f450 compiler/typecheck/TcInteract.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 260bb4a..f95194f 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -27,7 +27,7 @@ import TcType import Name import RdrName ( lookupGRE_FieldLabel ) import PrelNames ( knownNatClassName, knownSymbolClassName, - typeableClassName, typeableClassKey, + typeableClassName, coercibleTyConKey, hasFieldClassName, heqTyConKey, eqTyConKey, ipClassKey ) From git at git.haskell.org Tue Sep 26 18:43:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 18:43:42 +0000 (UTC) Subject: [commit: ghc] master: Release console for ghci wrapper (3ec579d) Message-ID: <20170926184342.3CF933A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3ec579d5d13dd00af58380a34daa2d57f0b9aa9e/ghc >--------------------------------------------------------------- commit 3ec579d5d13dd00af58380a34daa2d57f0b9aa9e Author: Tamar Christina Date: Tue Sep 26 19:43:15 2017 +0100 Release console for ghci wrapper Summary: It seems the call that caused issues with the gcc wrapper before was needed for the ghci wrapper in order for the child process to be the one handling console events. This code slightly refactors the wrappers to make sure only ghci calls FreeConsole and nothing else. Test Plan: ./validate , open ghci.exe press ctrl+c Reviewers: RyanGlScott, austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14150 Differential Revision: https://phabricator.haskell.org/D4028 >--------------------------------------------------------------- 3ec579d5d13dd00af58380a34daa2d57f0b9aa9e driver/gcc/gcc.c | 2 +- driver/ghc/ghc.c | 2 +- driver/ghci/ghci.c | 13 +++++++++++-- driver/haddock/haddock.c | 2 +- driver/utils/cwrapper.c | 9 ++++++++- driver/utils/cwrapper.h | 6 ++++-- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/driver/gcc/gcc.c b/driver/gcc/gcc.c index b398c5e..aa63bb0 100644 --- a/driver/gcc/gcc.c +++ b/driver/gcc/gcc.c @@ -61,6 +61,6 @@ int main(int argc, char** argv) { preArgv[2] = mkString("-B%s/../lib/gcc/%s/%s" , binDir, base, version); preArgv[3] = mkString("-B%s/../libexec/gcc/%s/%s", binDir, base, version); - run(exePath, 4, preArgv, argc - 1, argv + 1); + run(exePath, 4, preArgv, argc - 1, argv + 1, NULL); } diff --git a/driver/ghc/ghc.c b/driver/ghc/ghc.c index 67f8f26..416f4ba 100644 --- a/driver/ghc/ghc.c +++ b/driver/ghc/ghc.c @@ -10,5 +10,5 @@ int main(int argc, char** argv) { binDir = getExecutablePath(); exePath = mkString("%s/ghc.exe", binDir); - run(exePath, 0, NULL, argc - 1, argv + 1); + run(exePath, 0, NULL, argc - 1, argv + 1, NULL); } diff --git a/driver/ghci/ghci.c b/driver/ghci/ghci.c index ebf13d8..a603655 100644 --- a/driver/ghci/ghci.c +++ b/driver/ghci/ghci.c @@ -11,6 +11,16 @@ BOOL fileExists(const char *path) { return r != INVALID_FILE_ATTRIBUTES && !(r & FILE_ATTRIBUTE_DIRECTORY); } +/* In order for this console program to pass on full event processing to called + process we need to remove it from the current console. Since we want the + child to inherit the handles so redirection etc all work we need to detach + from the console after the child has been created. However we don't want to + detach from the console in non-interactive scenarios otherwise we'll hit + #13411 again. So we only detach when we're sure we need to, see #14150. */ +void ReleaseResource(void) { + FreeConsole(); +} + int main(int argc, char** argv) { char *binDir; char *exePath; @@ -33,6 +43,5 @@ int main(int argc, char** argv) { exePath = mkString("%s/ghc-stage2.exe", binDir); } - run(exePath, 1, preArgv, argc - 1, argv + 1); + run(exePath, 1, preArgv, argc - 1, argv + 1, ReleaseResource); } - diff --git a/driver/haddock/haddock.c b/driver/haddock/haddock.c index e43d33f..79ab873 100644 --- a/driver/haddock/haddock.c +++ b/driver/haddock/haddock.c @@ -10,5 +10,5 @@ int main(int argc, char** argv) { binDir = getExecutablePath(); exePath = mkString("%s/haddock.exe", binDir); - run(exePath, 0, NULL, argc - 1, argv + 1); + run(exePath, 0, NULL, argc - 1, argv + 1, NULL); } diff --git a/driver/utils/cwrapper.c b/driver/utils/cwrapper.c index 5a30274..522c2b3 100644 --- a/driver/utils/cwrapper.c +++ b/driver/utils/cwrapper.c @@ -70,9 +70,12 @@ char *flattenAndQuoteArgs(char *ptr, int argc, char *argv[]) return ptr; } +/* This function takes a callback to be called after the creation of the child + process but before we block waiting for the child. Can be NULL. */ __attribute__((noreturn)) int run (char *exePath, int numArgs1, char **args1, - int numArgs2, char **args2) + int numArgs2, char **args2, + runCallback callback) { int i, cmdline_len; char *new_cmdline, *ptr; @@ -134,6 +137,10 @@ __attribute__((noreturn)) int run (char *exePath, /* Synchronize input and wait for target to be ready. */ WaitForInputIdle(pi.hProcess, INFINITE); + /* If we have a registered callback then call it before we block. */ + if (callback) + callback(); + switch (WaitForSingleObject(pi.hProcess, INFINITE) ) { case WAIT_OBJECT_0: { diff --git a/driver/utils/cwrapper.h b/driver/utils/cwrapper.h index 324470e..3e9ccd4 100644 --- a/driver/utils/cwrapper.h +++ b/driver/utils/cwrapper.h @@ -1,5 +1,7 @@ void die(const char *fmt, ...); char *mkString(const char *fmt, ...); -__attribute__((noreturn)) int run(char *exePath, int numArgs1, char **args1, int numArgs2, char **args2); - +typedef void (*runCallback)(void); +__attribute__((noreturn)) int run(char *exePath, int numArgs1, char **args1, + int numArgs2, char **args2, + runCallback callback); From git at git.haskell.org Tue Sep 26 19:39:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 19:39:47 +0000 (UTC) Subject: [commit: ghc] master: Switch VEH to VCH and allow disabling of SEH completely. (1825cbd) Message-ID: <20170926193947.DB9913A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1825cbdbdf08ed4bd6fd6794852596078953298a/ghc >--------------------------------------------------------------- commit 1825cbdbdf08ed4bd6fd6794852596078953298a Author: Ben Gamari Date: Tue Sep 26 14:34:58 2017 -0400 Switch VEH to VCH and allow disabling of SEH completely. Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911 >--------------------------------------------------------------- 1825cbdbdf08ed4bd6fd6794852596078953298a docs/users_guide/8.4.1-notes.rst | 7 +++ docs/users_guide/runtime_control.rst | 8 ++++ includes/rts/Flags.h | 1 + libraries/base/GHC/RTS/Flags.hsc | 2 + libraries/base/changelog.md | 3 ++ rts/RtsFlags.c | 19 +++++++- rts/RtsMain.c | 7 +-- rts/win32/veh_excn.c | 91 ++++++++++++++++++++++++++++++++++-- rts/win32/veh_excn.h | 1 + 9 files changed, 127 insertions(+), 12 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1825cbdbdf08ed4bd6fd6794852596078953298a From git at git.haskell.org Tue Sep 26 19:39:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 19:39:53 +0000 (UTC) Subject: [commit: ghc] master: rts: Silence missing __noreturn__ warning (7fb89e8) Message-ID: <20170926193953.596263A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7fb89e81aa26d546c468a780b57cbdd5ab189ec2/ghc >--------------------------------------------------------------- commit 7fb89e81aa26d546c468a780b57cbdd5ab189ec2 Author: Ben Gamari Date: Tue Sep 26 14:34:58 2017 -0400 rts: Silence missing __noreturn__ warning Reviewers: angerman, austin, erikd, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4034 >--------------------------------------------------------------- 7fb89e81aa26d546c468a780b57cbdd5ab189ec2 rts/linker/elf_reloc_aarch64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/linker/elf_reloc_aarch64.c b/rts/linker/elf_reloc_aarch64.c index 1d8f9e8..c50ef04 100644 --- a/rts/linker/elf_reloc_aarch64.c +++ b/rts/linker/elf_reloc_aarch64.c @@ -20,7 +20,7 @@ bool isAdrp(addr_t p); bool isLoadStore(addr_t p); bool isAddSub(addr_t p); bool isVectorOp(addr_t p); -int64_t decodeAddendAarch64(Section * section, Elf_Rel * rel); +int64_t decodeAddendAarch64(Section * section, Elf_Rel * rel) GNU_ATTRIBUTE(__noreturn__); bool encodeAddendAarch64(Section * section, Elf_Rel * rel, int64_t addend); bool isBranch(addr_t p) { From git at git.haskell.org Tue Sep 26 19:39:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 19:39:50 +0000 (UTC) Subject: [commit: ghc] master: base: fdReady(): Add note about O_NONBLOCK requirement (8f468fe) Message-ID: <20170926193950.9A57A3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f468fe05cf81ca516b3a8cf66792f842dbfcf40/ghc >--------------------------------------------------------------- commit 8f468fe05cf81ca516b3a8cf66792f842dbfcf40 Author: Niklas Hambüchen Date: Tue Sep 26 14:41:50 2017 -0400 base: fdReady(): Add note about O_NONBLOCK requirement Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3962 >--------------------------------------------------------------- 8f468fe05cf81ca516b3a8cf66792f842dbfcf40 libraries/base/cbits/inputReady.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 481c9de..c0b1a49 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -32,7 +32,11 @@ * inputReady(fd) checks to see whether input is available on the file * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is * negative). "Input is available" is defined as 'can I safely read at least a - * *character* from this file object without blocking?' + * *character* from this file object without blocking?' (this does not work + * reliably on Linux when the fd is a not-O_NONBLOCK socket, so if you pass + * socket fds to this function, ensure they have O_NONBLOCK; + * see `man 2 poll` and `man 2 select`, and + * https://ghc.haskell.org/trac/ghc/ticket/13497#comment:26). * * This function blocks until either `msecs` have passed, or input is * available. From git at git.haskell.org Tue Sep 26 19:39:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 19:39:56 +0000 (UTC) Subject: [commit: ghc] master: Rules: Show the binder type in the unbound template binder error (8c23b54) Message-ID: <20170926193956.19F133A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8c23b54f0e51b7fb028e46a52d4329235d2013ca/ghc >--------------------------------------------------------------- commit 8c23b54f0e51b7fb028e46a52d4329235d2013ca Author: Ben Gamari Date: Tue Sep 26 14:32:02 2017 -0400 Rules: Show the binder type in the unbound template binder error Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4013 >--------------------------------------------------------------- 8c23b54f0e51b7fb028e46a52d4329235d2013ca compiler/specialise/Rules.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index ec19740..edcab88 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -583,7 +583,7 @@ matchN (in_scope, id_unf) rule_name tmpl_vars tmpl_es target_es = env unbound var = pprPanic "Template variable unbound in rewrite rule" $ - vcat [ text "Variable:" <+> ppr var + vcat [ text "Variable:" <+> ppr var <+> dcolon <+> ppr (varType var) , text "Rule" <+> pprRuleName rule_name , text "Rule bndrs:" <+> ppr tmpl_vars , text "LHS args:" <+> ppr tmpl_es From git at git.haskell.org Tue Sep 26 21:44:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 21:44:09 +0000 (UTC) Subject: [commit: ghc] master: desugar: Catch levity polymorphism in unboxed sum expressions (018c40f) Message-ID: <20170926214409.E59033A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/018c40fb1bb27853d0cefa5b90a44ce13e91a856/ghc >--------------------------------------------------------------- commit 018c40fb1bb27853d0cefa5b90a44ce13e91a856 Author: Ben Gamari Date: Tue Sep 26 14:52:26 2017 -0400 desugar: Catch levity polymorphism in unboxed sum expressions Fixes #13929. >--------------------------------------------------------------- 018c40fb1bb27853d0cefa5b90a44ce13e91a856 compiler/deSugar/DsExpr.hs | 10 +++++----- testsuite/tests/typecheck/should_fail/T13929.stderr | 12 ++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index 1ed45fc..b2b98f8 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -379,11 +379,11 @@ ds_expr _ (ExplicitTuple tup_args boxity) mkCoreTupBoxity boxity args) } ds_expr _ (ExplicitSum alt arity expr types) - = do { core_expr <- dsLExpr expr - ; return $ mkCoreConApps (sumDataCon alt arity) - (map (Type . getRuntimeRep) types ++ - map Type types ++ - [core_expr]) } + = do { dsWhenNoErrs (dsLExprNoLP expr) + (\core_expr -> mkCoreConApps (sumDataCon alt arity) + (map (Type . getRuntimeRep) types ++ + map Type types ++ + [core_expr]) ) } ds_expr _ (HsSCC _ cc expr@(L loc _)) = do dflags <- getDynFlags diff --git a/testsuite/tests/typecheck/should_fail/T13929.stderr b/testsuite/tests/typecheck/should_fail/T13929.stderr index 3ddf5b3..d1e1f63 100644 --- a/testsuite/tests/typecheck/should_fail/T13929.stderr +++ b/testsuite/tests/typecheck/should_fail/T13929.stderr @@ -10,3 +10,15 @@ T13929.hs:29:37: error: Type: GUnboxed g rg Kind: TYPE rg In the type of expression: gunbox y + +T13929.hs:33:24: + A levity-polymorphic type is not allowed here: + Type: GUnboxed f rf + Kind: TYPE rf + In the type of expression: gunbox l + +T13929.hs:34:26: + A levity-polymorphic type is not allowed here: + Type: GUnboxed g rg + Kind: TYPE rg + In the type of expression: gunbox r diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 5079397..fe71e37 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -456,5 +456,5 @@ test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T14055', normal, compile_fail, ['']) test('T13909', normal, compile_fail, ['']) -test('T13929', expect_broken(13929), compile_fail, ['']) +test('T13929', normal, compile_fail, ['']) test('T14232', normal, compile_fail, ['']) From git at git.haskell.org Tue Sep 26 21:44:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 21:44:12 +0000 (UTC) Subject: [commit: ghc] master: rts: Throw proper HeapOverflow exception on allocating large array (30a1eee) Message-ID: <20170926214412.AF5813A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/30a1eeea37e224e4ade9b8e7cdd30076cb716960/ghc >--------------------------------------------------------------- commit 30a1eeea37e224e4ade9b8e7cdd30076cb716960 Author: Ben Gamari Date: Tue Sep 26 15:09:13 2017 -0400 rts: Throw proper HeapOverflow exception on allocating large array Test Plan: Validate, add tests Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4021 >--------------------------------------------------------------- 30a1eeea37e224e4ade9b8e7cdd30076cb716960 includes/rts/storage/GC.h | 5 +-- rts/PrimOps.cmm | 26 ++++++++++++--- rts/sm/Storage.c | 84 ++++++++++++++++++++++++++++++----------------- 3 files changed, 79 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 30a1eeea37e224e4ade9b8e7cdd30076cb716960 From git at git.haskell.org Tue Sep 26 21:44:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 21:44:15 +0000 (UTC) Subject: [commit: ghc] master: Revert "Switch VEH to VCH and allow disabling of SEH completely." (47888fd) Message-ID: <20170926214415.88E343A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/47888fd8b40fa1db24f107ffdf12ac1673bbe650/ghc >--------------------------------------------------------------- commit 47888fd8b40fa1db24f107ffdf12ac1673bbe650 Author: Ben Gamari Date: Tue Sep 26 15:43:47 2017 -0400 Revert "Switch VEH to VCH and allow disabling of SEH completely." Reverting to fix authorship of commit. This reverts commit 1825cbdbdf08ed4bd6fd6794852596078953298a. >--------------------------------------------------------------- 47888fd8b40fa1db24f107ffdf12ac1673bbe650 docs/users_guide/8.4.1-notes.rst | 7 --- docs/users_guide/runtime_control.rst | 8 ---- includes/rts/Flags.h | 1 - libraries/base/GHC/RTS/Flags.hsc | 2 - libraries/base/changelog.md | 3 -- rts/RtsFlags.c | 19 +------- rts/RtsMain.c | 7 ++- rts/win32/veh_excn.c | 91 ++---------------------------------- rts/win32/veh_excn.h | 1 - 9 files changed, 12 insertions(+), 127 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 47888fd8b40fa1db24f107ffdf12ac1673bbe650 From git at git.haskell.org Tue Sep 26 21:44:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Sep 2017 21:44:18 +0000 (UTC) Subject: [commit: ghc] master: Switch VEH to VCH and allow disabling of SEH completely. (1421d87) Message-ID: <20170926214418.5F6DC3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1421d87c8aabd7b1934f60bef688939882c8251c/ghc >--------------------------------------------------------------- commit 1421d87c8aabd7b1934f60bef688939882c8251c Author: Tamar Christina Date: Tue Sep 26 14:34:58 2017 -0400 Switch VEH to VCH and allow disabling of SEH completely. Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. (Reverted and recommitted to fix authorship information) Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911 >--------------------------------------------------------------- 1421d87c8aabd7b1934f60bef688939882c8251c docs/users_guide/8.4.1-notes.rst | 7 +++ docs/users_guide/runtime_control.rst | 8 ++++ includes/rts/Flags.h | 1 + libraries/base/GHC/RTS/Flags.hsc | 2 + libraries/base/changelog.md | 3 ++ rts/RtsFlags.c | 19 +++++++- rts/RtsMain.c | 7 +-- rts/win32/veh_excn.c | 91 ++++++++++++++++++++++++++++++++++-- rts/win32/veh_excn.h | 1 + 9 files changed, 127 insertions(+), 12 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1421d87c8aabd7b1934f60bef688939882c8251c From git at git.haskell.org Wed Sep 27 03:38:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 03:38:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Release console for ghci wrapper (f837db7) Message-ID: <20170927033815.B99F43A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f837db7e1cb23efca86f9804b5aa9503ae765c57/ghc >--------------------------------------------------------------- commit f837db7e1cb23efca86f9804b5aa9503ae765c57 Author: Tamar Christina Date: Tue Sep 26 19:43:15 2017 +0100 Release console for ghci wrapper Summary: It seems the call that caused issues with the gcc wrapper before was needed for the ghci wrapper in order for the child process to be the one handling console events. This code slightly refactors the wrappers to make sure only ghci calls FreeConsole and nothing else. Test Plan: ./validate , open ghci.exe press ctrl+c Reviewers: RyanGlScott, austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14150 Differential Revision: https://phabricator.haskell.org/D4028 (cherry picked from commit 3ec579d5d13dd00af58380a34daa2d57f0b9aa9e) >--------------------------------------------------------------- f837db7e1cb23efca86f9804b5aa9503ae765c57 driver/gcc/gcc.c | 2 +- driver/ghc/ghc.c | 2 +- driver/ghci/ghci.c | 13 +++++++++++-- driver/haddock/haddock.c | 2 +- driver/utils/cwrapper.c | 9 ++++++++- driver/utils/cwrapper.h | 6 ++++-- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/driver/gcc/gcc.c b/driver/gcc/gcc.c index 5c7cb15..2d53460 100644 --- a/driver/gcc/gcc.c +++ b/driver/gcc/gcc.c @@ -61,6 +61,6 @@ int main(int argc, char** argv) { preArgv[2] = mkString("-B%s/../lib/gcc/%s/%s" , binDir, base, version); preArgv[3] = mkString("-B%s/../libexec/gcc/%s/%s", binDir, base, version); - run(exePath, 4, preArgv, argc - 1, argv + 1); + run(exePath, 4, preArgv, argc - 1, argv + 1, NULL); } diff --git a/driver/ghc/ghc.c b/driver/ghc/ghc.c index 67f8f26..416f4ba 100644 --- a/driver/ghc/ghc.c +++ b/driver/ghc/ghc.c @@ -10,5 +10,5 @@ int main(int argc, char** argv) { binDir = getExecutablePath(); exePath = mkString("%s/ghc.exe", binDir); - run(exePath, 0, NULL, argc - 1, argv + 1); + run(exePath, 0, NULL, argc - 1, argv + 1, NULL); } diff --git a/driver/ghci/ghci.c b/driver/ghci/ghci.c index ebf13d8..a603655 100644 --- a/driver/ghci/ghci.c +++ b/driver/ghci/ghci.c @@ -11,6 +11,16 @@ BOOL fileExists(const char *path) { return r != INVALID_FILE_ATTRIBUTES && !(r & FILE_ATTRIBUTE_DIRECTORY); } +/* In order for this console program to pass on full event processing to called + process we need to remove it from the current console. Since we want the + child to inherit the handles so redirection etc all work we need to detach + from the console after the child has been created. However we don't want to + detach from the console in non-interactive scenarios otherwise we'll hit + #13411 again. So we only detach when we're sure we need to, see #14150. */ +void ReleaseResource(void) { + FreeConsole(); +} + int main(int argc, char** argv) { char *binDir; char *exePath; @@ -33,6 +43,5 @@ int main(int argc, char** argv) { exePath = mkString("%s/ghc-stage2.exe", binDir); } - run(exePath, 1, preArgv, argc - 1, argv + 1); + run(exePath, 1, preArgv, argc - 1, argv + 1, ReleaseResource); } - diff --git a/driver/haddock/haddock.c b/driver/haddock/haddock.c index e43d33f..79ab873 100644 --- a/driver/haddock/haddock.c +++ b/driver/haddock/haddock.c @@ -10,5 +10,5 @@ int main(int argc, char** argv) { binDir = getExecutablePath(); exePath = mkString("%s/haddock.exe", binDir); - run(exePath, 0, NULL, argc - 1, argv + 1); + run(exePath, 0, NULL, argc - 1, argv + 1, NULL); } diff --git a/driver/utils/cwrapper.c b/driver/utils/cwrapper.c index da6cec4..4b1c5c2 100644 --- a/driver/utils/cwrapper.c +++ b/driver/utils/cwrapper.c @@ -70,9 +70,12 @@ char *flattenAndQuoteArgs(char *ptr, int argc, char *argv[]) return ptr; } +/* This function takes a callback to be called after the creation of the child + process but before we block waiting for the child. Can be NULL. */ __attribute__((noreturn)) int run (char *exePath, int numArgs1, char **args1, - int numArgs2, char **args2) + int numArgs2, char **args2, + runCallback callback) { int i, cmdline_len; char *new_cmdline, *ptr; @@ -134,6 +137,10 @@ __attribute__((noreturn)) int run (char *exePath, /* Synchronize input and wait for target to be ready. */ WaitForInputIdle(pi.hProcess, INFINITE); + /* If we have a registered callback then call it before we block. */ + if (callback) + callback(); + switch (WaitForSingleObject(pi.hProcess, INFINITE) ) { case WAIT_OBJECT_0: { diff --git a/driver/utils/cwrapper.h b/driver/utils/cwrapper.h index 324470e..3e9ccd4 100644 --- a/driver/utils/cwrapper.h +++ b/driver/utils/cwrapper.h @@ -1,5 +1,7 @@ void die(const char *fmt, ...); char *mkString(const char *fmt, ...); -__attribute__((noreturn)) int run(char *exePath, int numArgs1, char **args1, int numArgs2, char **args2); - +typedef void (*runCallback)(void); +__attribute__((noreturn)) int run(char *exePath, int numArgs1, char **args1, + int numArgs2, char **args2, + runCallback callback); From git at git.haskell.org Wed Sep 27 03:38:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 03:38:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13929 by adding another levity polymorphism check (0c932d4) Message-ID: <20170927033819.2E81A3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0c932d4c854ccee953bcc305ac7642e59696b762/ghc >--------------------------------------------------------------- commit 0c932d4c854ccee953bcc305ac7642e59696b762 Author: Richard Eisenberg Date: Wed Aug 16 11:35:26 2017 -0400 Fix #13929 by adding another levity polymorphism check test case: typecheck/should_fail/T13929 (cherry picked from commit fa626f3b1c1140a1f10bba60fdde10f767863f70) >--------------------------------------------------------------- 0c932d4c854ccee953bcc305ac7642e59696b762 compiler/deSugar/DsExpr.hs | 9 +++--- testsuite/tests/typecheck/should_fail/T13929.hs | 32 ++++++++++++++++++++++ .../tests/typecheck/should_fail/T13929.stderr | 12 ++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index bacf950..3cbc917 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -372,14 +372,13 @@ dsExpr (ExplicitTuple tup_args boxity) go (lam_vars, args) (L _ (Present expr)) -- Expressions that are present don't generate -- lambdas, just arguments. - = do { core_expr <- dsLExpr expr + = do { core_expr <- dsLExprNoLP expr ; return (lam_vars, core_expr : args) } - ; (lam_vars, args) <- foldM go ([], []) (reverse tup_args) + ; dsWhenNoErrs (foldM go ([], []) (reverse tup_args)) -- The reverse is because foldM goes left-to-right - - ; return $ mkCoreLams lam_vars $ - mkCoreTupBoxity boxity args } + (\(lam_vars, args) -> mkCoreLams lam_vars $ + mkCoreTupBoxity boxity args) } dsExpr (ExplicitSum alt arity expr types) = do { core_expr <- dsLExpr expr diff --git a/testsuite/tests/typecheck/should_fail/T13929.hs b/testsuite/tests/typecheck/should_fail/T13929.hs new file mode 100644 index 0000000..f0a026d --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13929.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE AllowAmbiguousTypes #-} + +module Main where + +import GHC.Exts +import Data.Kind +import GHC.Generics + +class GUnbox (f :: Type -> Type) (r :: RuntimeRep) where + type GUnboxed f r :: TYPE r + gunbox :: f p -> GUnboxed f r + +instance (GUnbox f rf, GUnbox g rg) => GUnbox (f :*: g) ('TupleRep '[rf, rg]) where + type GUnboxed (f :*: g) ('TupleRep '[rf, rg]) = (# GUnboxed f rf, GUnboxed g rg #) + -- if I remove implementation of `gunbox` it compiles successfully + gunbox (x :*: y) = (# gunbox x, gunbox y #) + +main :: IO () +main = pure () diff --git a/testsuite/tests/typecheck/should_fail/T13929.stderr b/testsuite/tests/typecheck/should_fail/T13929.stderr new file mode 100644 index 0000000..3ddf5b3 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13929.stderr @@ -0,0 +1,12 @@ + +T13929.hs:29:27: error: + A levity-polymorphic type is not allowed here: + Type: GUnboxed f rf + Kind: TYPE rf + In the type of expression: gunbox x + +T13929.hs:29:37: error: + A levity-polymorphic type is not allowed here: + Type: GUnboxed g rg + Kind: TYPE rg + In the type of expression: gunbox y diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 65f507b..9f9752a 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -437,4 +437,5 @@ test('T13677', normal, compile_fail, ['']) test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T11672', normal, compile_fail, ['']) +test('T13929', normal, compile_fail, ['']) From git at git.haskell.org Wed Sep 27 03:38:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 03:38:21 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add unboxed sum to T13929 (e545f54) Message-ID: <20170927033821.D93313A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e545f5453a2fb46a4d9283ec6380fa63b3954adf/ghc >--------------------------------------------------------------- commit e545f5453a2fb46a4d9283ec6380fa63b3954adf Author: Ben Gamari Date: Tue Sep 19 19:09:58 2017 -0400 testsuite: Add unboxed sum to T13929 Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13929 Differential Revision: https://phabricator.haskell.org/D3993 (cherry picked from commit d86b237d612bf6ca1faa61ff1130ad9144e32a52) >--------------------------------------------------------------- e545f5453a2fb46a4d9283ec6380fa63b3954adf testsuite/tests/typecheck/should_fail/T13929.hs | 5 +++++ testsuite/tests/typecheck/should_fail/all.T | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_fail/T13929.hs b/testsuite/tests/typecheck/should_fail/T13929.hs index f0a026d..10a7430 100644 --- a/testsuite/tests/typecheck/should_fail/T13929.hs +++ b/testsuite/tests/typecheck/should_fail/T13929.hs @@ -28,5 +28,10 @@ instance (GUnbox f rf, GUnbox g rg) => GUnbox (f :*: g) ('TupleRep '[rf, rg]) wh -- if I remove implementation of `gunbox` it compiles successfully gunbox (x :*: y) = (# gunbox x, gunbox y #) +instance (GUnbox f rf, GUnbox g rg) => GUnbox (f :+: g) ('SumRep '[rf, rg]) where + type GUnboxed (f :+: g) ('SumRep '[rf, rg]) = (# GUnboxed f rf | GUnboxed g rg #) + gunbox (L1 l) = (# gunbox l | #) + gunbox (R1 r) = (# | gunbox r #) + main :: IO () main = pure () diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 9f9752a..2942639 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -437,5 +437,5 @@ test('T13677', normal, compile_fail, ['']) test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T11672', normal, compile_fail, ['']) -test('T13929', normal, compile_fail, ['']) +test('T13929', expect_broken(13929), compile_fail, ['']) From git at git.haskell.org Wed Sep 27 03:38:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 03:38:24 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: desugar: Catch levity polymorphism in unboxed sum expressions (78e6739) Message-ID: <20170927033824.A70833A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/78e673910f8759f643b263c70ad5c8fffd11a55d/ghc >--------------------------------------------------------------- commit 78e673910f8759f643b263c70ad5c8fffd11a55d Author: Ben Gamari Date: Tue Sep 26 14:52:26 2017 -0400 desugar: Catch levity polymorphism in unboxed sum expressions Fixes #13929. (cherry picked from commit 018c40fb1bb27853d0cefa5b90a44ce13e91a856) >--------------------------------------------------------------- 78e673910f8759f643b263c70ad5c8fffd11a55d compiler/deSugar/DsExpr.hs | 10 +++++----- testsuite/tests/typecheck/should_fail/T13929.stderr | 12 ++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index 3cbc917..8f236b7 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -381,11 +381,11 @@ dsExpr (ExplicitTuple tup_args boxity) mkCoreTupBoxity boxity args) } dsExpr (ExplicitSum alt arity expr types) - = do { core_expr <- dsLExpr expr - ; return $ mkCoreConApps (sumDataCon alt arity) - (map (Type . getRuntimeRep) types ++ - map Type types ++ - [core_expr]) } + = do { dsWhenNoErrs (dsLExprNoLP expr) + (\core_expr -> mkCoreConApps (sumDataCon alt arity) + (map (Type . getRuntimeRep) types ++ + map Type types ++ + [core_expr]) ) } dsExpr (HsSCC _ cc expr@(L loc _)) = do dflags <- getDynFlags diff --git a/testsuite/tests/typecheck/should_fail/T13929.stderr b/testsuite/tests/typecheck/should_fail/T13929.stderr index 3ddf5b3..d1e1f63 100644 --- a/testsuite/tests/typecheck/should_fail/T13929.stderr +++ b/testsuite/tests/typecheck/should_fail/T13929.stderr @@ -10,3 +10,15 @@ T13929.hs:29:37: error: Type: GUnboxed g rg Kind: TYPE rg In the type of expression: gunbox y + +T13929.hs:33:24: + A levity-polymorphic type is not allowed here: + Type: GUnboxed f rf + Kind: TYPE rf + In the type of expression: gunbox l + +T13929.hs:34:26: + A levity-polymorphic type is not allowed here: + Type: GUnboxed g rg + Kind: TYPE rg + In the type of expression: gunbox r diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 2942639..9f9752a 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -437,5 +437,5 @@ test('T13677', normal, compile_fail, ['']) test('T11963', normal, compile_fail, ['']) test('T14000', normal, compile_fail, ['']) test('T11672', normal, compile_fail, ['']) -test('T13929', expect_broken(13929), compile_fail, ['']) +test('T13929', normal, compile_fail, ['']) From git at git.haskell.org Wed Sep 27 08:31:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 08:31:48 +0000 (UTC) Subject: [commit: ghc] master: GHC_LLVM_TARGET: Keep android OS (07ddeaf) Message-ID: <20170927083148.CF1BF3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/07ddeaf7ea0d12c3e1f1be54ed19fdb3d9bf96b7/ghc >--------------------------------------------------------------- commit 07ddeaf7ea0d12c3e1f1be54ed19fdb3d9bf96b7 Author: Moritz Angermann Date: Wed Sep 27 09:20:31 2017 +0800 GHC_LLVM_TARGET: Keep android OS Summary: Our usual GHC_CONVERT_OS macro, will turn any andoird* into android. This however drops the essential androideabi part. As such for the GHC_LLVM_TARGET we only convert the VENDOR, not the OS. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4031 >--------------------------------------------------------------- 07ddeaf7ea0d12c3e1f1be54ed19fdb3d9bf96b7 aclocal.m4 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index c89ef0d..5425408 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1903,6 +1903,14 @@ AC_DEFUN([GHC_LLVM_TARGET], [ llvm_target_vendor="unknown" llvm_target_os="windows" ;; + # retain any android and gnueabi linux flavours + # for the LLVM Target. Otherwise these would be + # turned into just `-linux` and fail to be found + # in the `llvm-targets` file. + *-android*|-gnueabi*) + GHC_CONVERT_VENDOR([$2],[llvm_target_vendor]) + llvm_target_os="$3" + ;; *) GHC_CONVERT_VENDOR([$2],[llvm_target_vendor]) GHC_CONVERT_OS([$3],[$1],[llvm_target_os]) From git at git.haskell.org Wed Sep 27 08:32:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 08:32:54 +0000 (UTC) Subject: [commit: ghc] master: llvm-targets: drop soft-float (60b0645) Message-ID: <20170927083254.7D2F23A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60b06456ddef08bd8a8a47497a6cbefbb5e359fb/ghc >--------------------------------------------------------------- commit 60b06456ddef08bd8a8a47497a6cbefbb5e359fb Author: Moritz Angermann Date: Mon Sep 25 14:17:11 2017 +0800 llvm-targets: drop soft-float Summary: The llvm-targets file records `mattr` values, and while interrogating `clang` for the target, we might stumble upon `+soft-float-abi`, however ghc does not support full soft-float, and as such passing `+soft-float` to `llc` will result in segfaults for any function passing float registers F1, ... in the ARM Instruction Selection Pass. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4030 >--------------------------------------------------------------- 60b06456ddef08bd8a8a47497a6cbefbb5e359fb llvm-targets | 8 ++++---- utils/llvm-targets/gen-data-layout.sh | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/llvm-targets b/llvm-targets index 2ac0f87..3c9da1e 100644 --- a/llvm-targets +++ b/llvm-targets @@ -6,17 +6,17 @@ ,("armv7-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) ,("aarch64-unknown-linux-gnu", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) ,("aarch64-unknown-linux", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) -,("armv7a-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+soft-float-abi")) +,("armv7a-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) ,("i386-unknown-linux-gnu", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", "")) ,("i386-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", "")) ,("x86_64-unknown-linux-gnu", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) ,("x86_64-unknown-linux", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) -,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+soft-float-abi")) +,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "")) ,("aarch64-unknown-linux-android", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) -,("arm-unknown-nto-qnx-eabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+soft-float-abi +strict-align")) +,("arm-unknown-nto-qnx-eabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+strict-align")) ,("i386-apple-darwin", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", "")) ,("x86_64-apple-darwin", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", "")) -,("armv7-apple-ios", ("e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "generic", "+soft-float-abi")) +,("armv7-apple-ios", ("e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "generic", "")) ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon")) ,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", "")) ,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", "")) diff --git a/utils/llvm-targets/gen-data-layout.sh b/utils/llvm-targets/gen-data-layout.sh index 79068e9..95c629c 100755 --- a/utils/llvm-targets/gen-data-layout.sh +++ b/utils/llvm-targets/gen-data-layout.sh @@ -36,7 +36,20 @@ function get_cpu_and_attr() { while [ "$#" -gt 0 ]; do case "$1" in -target-cpu) CPU=$2; shift 2;; - -target-feature) ATTR+=("$2"); shift 2;; + -target-feature) + # translate clang to opt/llc target features + case "$2" in + # we don't have support in GHC for proper soft-float. + # if we extend the `llvm-target` file to contain two + # additional columns for opt and llc flags, we could + # pass -float-abi=soft; However ghc will use float + # registers unconditionally on arm, and as such true + # soft float with the registered llvm backed will is + # currently not possible. + +soft-float-abi) shift 2;; + *) ATTR+=("$2"); shift 2;; + esac + ;; *) shift 1;; esac done From git at git.haskell.org Wed Sep 27 08:39:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 08:39:10 +0000 (UTC) Subject: [commit: ghc] branch 'wip/angerman/llvmng' created Message-ID: <20170927083910.52CC63A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/angerman/llvmng Referencing: 4f367c6abca588a2f006833ee2a0327ca709a614 From git at git.haskell.org Wed Sep 27 08:39:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 08:39:18 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: Adds test (2c7ef11) Message-ID: <20170927083918.6587B3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/2c7ef11114d0f695ba6c8ef2a53ef281bc23c807/ghc >--------------------------------------------------------------- commit 2c7ef11114d0f695ba6c8ef2a53ef281bc23c807 Author: Moritz Angermann Date: Thu Sep 21 22:07:44 2017 +0800 Adds test >--------------------------------------------------------------- 2c7ef11114d0f695ba6c8ef2a53ef281bc23c807 testsuite/tests/codeGen/should_run/T14251.hs | 22 ++++++++++++++++++++++ testsuite/tests/codeGen/should_run/T14251.stdout | 1 + testsuite/tests/codeGen/should_run/all.T | 1 + 3 files changed, 24 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T14251.hs b/testsuite/tests/codeGen/should_run/T14251.hs new file mode 100644 index 0000000..6f552e1 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T14251.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE MagicHash, BangPatterns #-} +module Main where + +-- A minor modification from T8064.hs. +-- +-- The key here is that we ensure that +-- subsequently passed floats do not +-- accidentally end up in previous +-- registers. +-- + +import GHC.Exts + +{-# NOINLINE f #-} +f :: (Int# -> Float# -> Double# -> Float# -> Double# -> String) -> String +f g = g 3# 4.0# 5.0## 6.0# 6.9## ++ " World!" + +{-# NOINLINE q #-} +q :: Int# -> Float# -> Double# -> Float# -> Double# -> String +q i j k l m = "Hello " ++ show (F# l) ++ " " ++ show (D# m) + +main = putStrLn (f $ q) diff --git a/testsuite/tests/codeGen/should_run/T14251.stdout b/testsuite/tests/codeGen/should_run/T14251.stdout new file mode 100644 index 0000000..8ec577b --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T14251.stdout @@ -0,0 +1 @@ +Hello 6.0 6.9 World! diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 271a420..36e4855 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -158,3 +158,4 @@ test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), test('T13425', normal, compile_and_run, ['-O']) test('castFloatWord', normal, compile_and_run, ['-dcmm-lint']) +test('T14251', normal, compile_and_run, ['-O2']) From git at git.haskell.org Wed Sep 27 08:39:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 08:39:15 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: Adds `-llvmng` (4863a3a) Message-ID: <20170927083915.2B42C3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/4863a3a2dfc723dbb3099d08ac1328433f4234eb/ghc >--------------------------------------------------------------- commit 4863a3a2dfc723dbb3099d08ac1328433f4234eb Author: Moritz Angermann Date: Mon Jul 31 15:18:49 2017 +0800 Adds `-llvmng` >--------------------------------------------------------------- 4863a3a2dfc723dbb3099d08ac1328433f4234eb .gitmodules | 9 + compiler/cmm/CmmSwitch.hs | 1 + compiler/codeGen/StgCmmPrim.hs | 3 +- compiler/ghc.cabal.in | 8 +- compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs | 1783 ++++++++++++++++++++ compiler/llvmGen-ng/Data/BitCode/LLVM/Gen/Monad.hs | 86 + compiler/main/CodeOutput.hs | 10 + compiler/main/DriverPipeline.hs | 5 +- compiler/main/DynFlags.hs | 12 +- compiler/typecheck/TcForeign.hs | 4 +- ghc.mk | 8 + libraries/base/tests/all.T | 2 +- libraries/data-bitcode | 1 + libraries/data-bitcode-edsl | 1 + libraries/data-bitcode-llvm | 1 + mk/build.mk.sample | 13 +- mk/flavours/{prof.mk => prof-llvmng.mk} | 6 +- mk/flavours/{quick-cross.mk => quick-cross-ng.mk} | 4 +- mk/flavours/{quick.mk => quick-llvmng.mk} | 4 +- packages | 3 + testsuite/config/ghc | 16 +- 21 files changed, 1961 insertions(+), 19 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 4863a3a2dfc723dbb3099d08ac1328433f4234eb From git at git.haskell.org Wed Sep 27 08:39:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 08:39:21 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: [genapply] feed args. (4f367c6) Message-ID: <20170927083921.29DA23A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/4f367c6abca588a2f006833ee2a0327ca709a614/ghc >--------------------------------------------------------------- commit 4f367c6abca588a2f006833ee2a0327ca709a614 Author: Moritz Angermann Date: Mon Sep 25 20:34:28 2017 +0800 [genapply] feed args. >--------------------------------------------------------------- 4f367c6abca588a2f006833ee2a0327ca709a614 utils/genapply/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs index 9248c22..b30c9f8 100644 --- a/utils/genapply/Main.hs +++ b/utils/genapply/Main.hs @@ -858,7 +858,7 @@ genApplyFast regstatus args = nest 4 (vcat [ text "Sp_adj" <> parens (int (-sp_offset)) <> semi, saveRegOffs reg_locs, - mkJump regstatus fun_ret_label [] [] <> semi + mkJump regstatus fun_ret_label [] args <> semi ]), char '}' ]), From git at git.haskell.org Wed Sep 27 10:24:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 10:24:04 +0000 (UTC) Subject: [commit: ghc] master: Typofixes (4364f1e) Message-ID: <20170927102404.CDA553A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4364f1e7543b6803cfaef321105d253e0bdf08a4/ghc >--------------------------------------------------------------- commit 4364f1e7543b6803cfaef321105d253e0bdf08a4 Author: Gabor Greif Date: Wed Sep 27 12:21:33 2017 +0200 Typofixes >--------------------------------------------------------------- 4364f1e7543b6803cfaef321105d253e0bdf08a4 compiler/deSugar/Check.hs | 2 +- compiler/prelude/primops.txt.pp | 4 ++-- compiler/typecheck/TcHsType.hs | 10 +++++----- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcRnMonad.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSMonad.hs | 4 ++-- compiler/types/Unify.hs | 2 +- testsuite/tests/deriving/should_compile/drv-functor1.hs | 2 +- testsuite/tests/programs/andy_cherry/andy_cherry.stdout | 4 ++-- testsuite/tests/programs/andy_cherry/mygames.pgn | 4 ++-- 11 files changed, 19 insertions(+), 19 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 4364f1e7543b6803cfaef321105d253e0bdf08a4 From git at git.haskell.org Wed Sep 27 21:38:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 21:38:37 +0000 (UTC) Subject: [commit: ghc] master: base: fdReady(): Ensure and doc that return values are always -1/0/1 (03009aa) Message-ID: <20170927213837.B27633A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03009aa70a099867331afb9876333c687454c5d5/ghc >--------------------------------------------------------------- commit 03009aa70a099867331afb9876333c687454c5d5 Author: Niklas Hambüchen Date: Wed Sep 27 15:29:06 2017 -0400 base: fdReady(): Ensure and doc that return values are always -1/0/1 Reviewers: bgamari, austin, hvr, Phyx Reviewed By: Phyx Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4010 >--------------------------------------------------------------- 03009aa70a099867331afb9876333c687454c5d5 libraries/base/cbits/inputReady.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 21ad36d..30327ba 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -40,6 +40,10 @@ * * This function blocks until either `msecs` have passed, or input is * available. + * + * Returns: + * 1 => Input ready, 0 => not ready, -1 => error + * On error, sets `errno`. */ int fdReady(int fd, int write, int msecs, int isSock) @@ -117,8 +121,7 @@ fdReady(int fd, int write, int msecs, int isSock) } } - /* 1 => Input ready, 0 => not ready, -1 => error */ - return (ready); + return (ready > 0); } else { DWORD rc; HANDLE hFile = (HANDLE)_get_osfhandle(fd); From git at git.haskell.org Wed Sep 27 21:38:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 21:38:34 +0000 (UTC) Subject: [commit: ghc] master: configure: Make sure we try all possible linkers (a10729f) Message-ID: <20170927213834.EF62D3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a10729f028d7175980d9f65e22c9bb9a933461c2/ghc >--------------------------------------------------------------- commit a10729f028d7175980d9f65e22c9bb9a933461c2 Author: Ben Gamari Date: Wed Sep 27 15:30:18 2017 -0400 configure: Make sure we try all possible linkers Previously if we had both ld.lld and ld.gold installed but a gcc which didn't support -fuse-ld=lld we would fail when trying ld.lld and fall immediately back to plain ld. Now we will try ld.gold as well. This was brought to light by #14280, where using ld.bfd resulted in a broken stage2 compiler. Test Plan: Configure Reviewers: angerman, hvr, austin Reviewed By: angerman Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14280 Differential Revision: https://phabricator.haskell.org/D4038 >--------------------------------------------------------------- a10729f028d7175980d9f65e22c9bb9a933461c2 aclocal.m4 | 59 +++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 5425408..fb61e8d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2331,28 +2331,51 @@ AC_DEFUN([FIND_LD],[ [], [enable_ld_override=yes]) - if test "x$enable_ld_override" = "xyes"; then - TmpLd="$LD" # In case the user set LD - AC_CHECK_TARGET_TOOLS([TmpLd], [ld.lld ld.gold ld]) - - out=`$TmpLd --version` - case $out in - "GNU ld"*) FP_CC_LINKER_FLAG_TRY(bfd, $2) ;; - "GNU gold"*) FP_CC_LINKER_FLAG_TRY(gold, $2) ;; - "LLD"*) FP_CC_LINKER_FLAG_TRY(lld, $2) ;; - *) AC_MSG_NOTICE([unknown linker version $out]) ;; - esac - if test "z$$2" = "z"; then - AC_MSG_NOTICE([unable to convince '$CC' to use linker '$TmpLd']) + find_ld() { + # Make sure the user didn't specify LD manually. + if test "z$LD" != "z"; then AC_CHECK_TARGET_TOOL([LD], [ld]) - else - LD="$TmpLd" + return fi - else + + # Manually iterate over possible names since we want to ensure that, e.g., + # if ld.lld is installed but gcc doesn't support -fuse-ld=lld, that we + # then still try ld.gold and -fuse-ld=gold. + for possible_ld in ld.lld ld.gold ld; do + TmpLd="" # In case the user set LD + AC_CHECK_TARGET_TOOL([TmpLd], [$possible_ld]) + if test "x$TmpLd" = "x"; then continue; fi + + out=`$TmpLd --version` + case $out in + "GNU ld"*) FP_CC_LINKER_FLAG_TRY(bfd, $2) ;; + "GNU gold"*) FP_CC_LINKER_FLAG_TRY(gold, $2) ;; + "LLD"*) FP_CC_LINKER_FLAG_TRY(lld, $2) ;; + *) AC_MSG_NOTICE([unknown linker version $out]) ;; + esac + if test "z$$2" = "z"; then + AC_MSG_NOTICE([unable to convince '$CC' to use linker '$TmpLd']) + # a terrible hack to prevent autoconf from caching the previous + # AC_CHECK_TARGET_TOOL result since next time we'll be looking + # for another ld variant. + $as_unset ac_cv_prog_ac_ct_TmpLd + else + LD="$TmpLd" + return + fi + done + + # Fallback AC_CHECK_TARGET_TOOL([LD], [ld]) - fi + } + + if test "x$enable_ld_override" = "xyes"; then + find_ld + else + AC_CHECK_TARGET_TOOL([LD], [ld]) + fi - CHECK_LD_COPY_BUG([$1]) + CHECK_LD_COPY_BUG([$1]) ]) # LocalWords: fi From git at git.haskell.org Wed Sep 27 21:38:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 21:38:40 +0000 (UTC) Subject: [commit: ghc] master: Add TODO about getMonotonicNSec() wrapping that can no longer happen. (9bf6310) Message-ID: <20170927213840.7428A3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9bf6310d2002ef57dc726a4d9240bd520925114d/ghc >--------------------------------------------------------------- commit 9bf6310d2002ef57dc726a4d9240bd520925114d Author: Niklas Hambüchen Date: Wed Sep 27 15:24:11 2017 -0400 Add TODO about getMonotonicNSec() wrapping that can no longer happen. Knowing this is important for followup commits, where we will subtract getProcessElapsedTime() values from each other, in a way that assumes that there is no wrapping every 49 days. Reviewers: bgamari, austin, erikd, simonmar, NicolasT Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14233 Differential Revision: https://phabricator.haskell.org/D3964 >--------------------------------------------------------------- 9bf6310d2002ef57dc726a4d9240bd520925114d rts/win32/GetTime.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rts/win32/GetTime.c b/rts/win32/GetTime.c index 90c0d0d..014a676 100644 --- a/rts/win32/GetTime.c +++ b/rts/win32/GetTime.c @@ -84,6 +84,11 @@ getMonotonicNSec() } else // fallback to GetTickCount { + // TODO: Remove this code path, it cannot be taken because + // `QueryPerformanceFrequency` cannot fail on Windows >= XP + // and GHC no longer supports Windows <= XP. + // See https://ghc.haskell.org/trac/ghc/ticket/14233 + // NOTE: GetTickCount is a 32-bit millisecond value, so it wraps around // every 49 days. DWORD count = GetTickCount(); From git at git.haskell.org Wed Sep 27 21:38:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 21:38:43 +0000 (UTC) Subject: [commit: ghc] master: Move check-ppr and check-api-annotations to testsuite/utils (1e9f90a) Message-ID: <20170927213843.CC7163A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e9f90af7311c33de0f7f5b7dba594725596d675/ghc >--------------------------------------------------------------- commit 1e9f90af7311c33de0f7f5b7dba594725596d675 Author: Ben Gamari Date: Wed Sep 27 15:22:37 2017 -0400 Move check-ppr and check-api-annotations to testsuite/utils These are needed by the testsuite and consequently must be shipped in the testsuite tarball to ensure that we can test binary distributions. See #13897. Test Plan: Validate Reviewers: austin Subscribers: snowleopard, rwbarton, thomie GHC Trac Issues: #13897 Differential Revision: https://phabricator.haskell.org/D4039 >--------------------------------------------------------------- 1e9f90af7311c33de0f7f5b7dba594725596d675 .gitignore | 1 + Makefile | 10 +++++-- ghc.mk | 34 ++++++++++++++++++---- .../utils}/check-api-annotations/Main.hs | 0 .../utils}/check-api-annotations/README | 0 .../check-api-annotations.cabal | 0 testsuite/utils/check-api-annotations/ghc.mk | 20 +++++++++++++ {utils => testsuite/utils}/check-ppr/Main.hs | 0 {utils => testsuite/utils}/check-ppr/README | 0 .../utils}/check-ppr/check-ppr.cabal | 0 testsuite/utils/check-ppr/ghc.mk | 20 +++++++++++++ utils/check-api-annotations/ghc.mk | 18 ------------ utils/check-ppr/ghc.mk | 18 ------------ 13 files changed, 76 insertions(+), 45 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1e9f90af7311c33de0f7f5b7dba594725596d675 From git at git.haskell.org Wed Sep 27 21:38:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Sep 2017 21:38:46 +0000 (UTC) Subject: [commit: ghc] master: fdReady(): Fix some C -Wconversion warnings. (dddef31) Message-ID: <20170927213846.8CA743A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dddef3114246fcd79bf0993d685454802983111b/ghc >--------------------------------------------------------------- commit dddef3114246fcd79bf0993d685454802983111b Author: Niklas Hambüchen Date: Wed Sep 27 15:26:37 2017 -0400 fdReady(): Fix some C -Wconversion warnings. Btw, -Wconversion is off by default and not included in -Wall, -Wextra or -pedantic, so I used it temporarily with -optc-Wconversion. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3965 >--------------------------------------------------------------- dddef3114246fcd79bf0993d685454802983111b libraries/base/cbits/inputReady.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index c0b1a49..21ad36d 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -156,9 +156,9 @@ fdReady(int fd, int write, int msecs, int isSock) while (1) // discard non-key events { - rc = PeekConsoleInput(hFile, buf, 1, &count); + BOOL success = PeekConsoleInput(hFile, buf, 1, &count); // printf("peek, rc=%d, count=%d, type=%d\n", rc, count, buf[0].EventType); - if (rc == 0) { + if (!success) { rc = GetLastError(); if (rc == ERROR_INVALID_HANDLE || rc == ERROR_INVALID_FUNCTION) { return 1; @@ -183,8 +183,8 @@ fdReady(int fd, int write, int msecs, int isSock) { // it's a non-key event, a key up event, or a // non-character key (e.g. shift). discard it. - rc = ReadConsoleInput(hFile, buf, 1, &count); - if (rc == 0) { + BOOL success = ReadConsoleInput(hFile, buf, 1, &count); + if (!success) { rc = GetLastError(); if (rc == ERROR_INVALID_HANDLE || rc == ERROR_INVALID_FUNCTION) { return 1; @@ -214,8 +214,8 @@ fdReady(int fd, int write, int msecs, int isSock) // PeekNamedPipe() does not block, so if it returns that // there is no new data, we have to sleep and try again. while (avail == 0) { - rc = PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL ); - if (rc != 0) { + BOOL success = PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL ); + if (success) { if (avail != 0) { return 1; } else { // no new data @@ -242,7 +242,8 @@ fdReady(int fd, int write, int msecs, int isSock) /* PeekNamedPipe didn't work - fall through to the general case */ default: - rc = WaitForSingleObject( hFile, msecs ); + // This cast is OK because we assert against `msecs < 0` above. + rc = WaitForSingleObject( hFile, (DWORD) msecs ); /* 1 => Input ready, 0 => not ready, -1 => error */ switch (rc) { From git at git.haskell.org Thu Sep 28 03:12:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 03:12:14 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: [genapply] feed args. (68e9b1b) Message-ID: <20170928031214.269113A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/68e9b1b9dd482fac1e9ed2fa22f87c6947fbd12a/ghc >--------------------------------------------------------------- commit 68e9b1b9dd482fac1e9ed2fa22f87c6947fbd12a Author: Moritz Angermann Date: Mon Sep 25 20:34:28 2017 +0800 [genapply] feed args. >--------------------------------------------------------------- 68e9b1b9dd482fac1e9ed2fa22f87c6947fbd12a utils/genapply/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs index 9248c22..b30c9f8 100644 --- a/utils/genapply/Main.hs +++ b/utils/genapply/Main.hs @@ -858,7 +858,7 @@ genApplyFast regstatus args = nest 4 (vcat [ text "Sp_adj" <> parens (int (-sp_offset)) <> semi, saveRegOffs reg_locs, - mkJump regstatus fun_ret_label [] [] <> semi + mkJump regstatus fun_ret_label [] args <> semi ]), char '}' ]), From git at git.haskell.org Thu Sep 28 03:12:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 03:12:18 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: Adds `-llvmng` (d4d125f) Message-ID: <20170928031218.E37BF3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/d4d125ff9fb0800a84e5804525fd9dad79799c0c/ghc >--------------------------------------------------------------- commit d4d125ff9fb0800a84e5804525fd9dad79799c0c Author: Moritz Angermann Date: Mon Jul 31 15:18:49 2017 +0800 Adds `-llvmng` >--------------------------------------------------------------- d4d125ff9fb0800a84e5804525fd9dad79799c0c .gitmodules | 9 + compiler/cmm/CmmSwitch.hs | 1 + compiler/codeGen/StgCmmPrim.hs | 3 +- compiler/ghc.cabal.in | 8 +- compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs | 1783 ++++++++++++++++++++ compiler/llvmGen-ng/Data/BitCode/LLVM/Gen/Monad.hs | 86 + compiler/main/CodeOutput.hs | 10 + compiler/main/DriverPipeline.hs | 5 +- compiler/main/DynFlags.hs | 12 +- compiler/typecheck/TcForeign.hs | 4 +- ghc.mk | 8 + libraries/base/tests/all.T | 2 +- libraries/data-bitcode | 1 + libraries/data-bitcode-edsl | 1 + libraries/data-bitcode-llvm | 1 + mk/build.mk.sample | 13 +- mk/flavours/{prof.mk => prof-llvmng.mk} | 6 +- mk/flavours/{quick-cross.mk => quick-cross-ng.mk} | 4 +- mk/flavours/{quick.mk => quick-llvmng.mk} | 4 +- packages | 3 + testsuite/config/ghc | 16 +- 21 files changed, 1961 insertions(+), 19 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 d4d125ff9fb0800a84e5804525fd9dad79799c0c From git at git.haskell.org Thu Sep 28 03:12:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 03:12:22 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: Adds test (561da2a) Message-ID: <20170928031222.39F9C3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/561da2aa8657454efd4bf86ed53da112a7bc0cdb/ghc >--------------------------------------------------------------- commit 561da2aa8657454efd4bf86ed53da112a7bc0cdb Author: Moritz Angermann Date: Thu Sep 21 22:07:44 2017 +0800 Adds test >--------------------------------------------------------------- 561da2aa8657454efd4bf86ed53da112a7bc0cdb testsuite/tests/codeGen/should_run/T14251.hs | 22 ++++++++++++++++++++++ testsuite/tests/codeGen/should_run/T14251.stdout | 1 + testsuite/tests/codeGen/should_run/all.T | 1 + 3 files changed, 24 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T14251.hs b/testsuite/tests/codeGen/should_run/T14251.hs new file mode 100644 index 0000000..6f552e1 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T14251.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE MagicHash, BangPatterns #-} +module Main where + +-- A minor modification from T8064.hs. +-- +-- The key here is that we ensure that +-- subsequently passed floats do not +-- accidentally end up in previous +-- registers. +-- + +import GHC.Exts + +{-# NOINLINE f #-} +f :: (Int# -> Float# -> Double# -> Float# -> Double# -> String) -> String +f g = g 3# 4.0# 5.0## 6.0# 6.9## ++ " World!" + +{-# NOINLINE q #-} +q :: Int# -> Float# -> Double# -> Float# -> Double# -> String +q i j k l m = "Hello " ++ show (F# l) ++ " " ++ show (D# m) + +main = putStrLn (f $ q) diff --git a/testsuite/tests/codeGen/should_run/T14251.stdout b/testsuite/tests/codeGen/should_run/T14251.stdout new file mode 100644 index 0000000..8ec577b --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T14251.stdout @@ -0,0 +1 @@ +Hello 6.0 6.9 World! diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 271a420..36e4855 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -158,3 +158,4 @@ test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), test('T13425', normal, compile_and_run, ['-O']) test('castFloatWord', normal, compile_and_run, ['-dcmm-lint']) +test('T14251', normal, compile_and_run, ['-O2']) From git at git.haskell.org Thu Sep 28 03:12:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 03:12:25 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng: Fix Raspberry Pi target name (ae5639b) Message-ID: <20170928031225.0213A3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/angerman/llvmng Link : http://ghc.haskell.org/trac/ghc/changeset/ae5639b76fdf6f13804a9a757f8782b6c19f3cb9/ghc >--------------------------------------------------------------- commit ae5639b76fdf6f13804a9a757f8782b6c19f3cb9 Author: Moritz Angermann Date: Thu Sep 28 11:04:32 2017 +0800 Fix Raspberry Pi target name Summary: For some reson, the `*`, that was supposed to be in D4031 got lost in the diff. Reviewers: bgamari, austin, hvr Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4044 >--------------------------------------------------------------- ae5639b76fdf6f13804a9a757f8782b6c19f3cb9 aclocal.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index fb61e8d..b34f898 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1907,7 +1907,7 @@ AC_DEFUN([GHC_LLVM_TARGET], [ # for the LLVM Target. Otherwise these would be # turned into just `-linux` and fail to be found # in the `llvm-targets` file. - *-android*|-gnueabi*) + *-android*|*-gnueabi*) GHC_CONVERT_VENDOR([$2],[llvm_target_vendor]) llvm_target_os="$3" ;; From git at git.haskell.org Thu Sep 28 03:12:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 03:12:27 +0000 (UTC) Subject: [commit: ghc] wip/angerman/llvmng's head updated: Fix Raspberry Pi target name (ae5639b) Message-ID: <20170928031227.D96F53A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/angerman/llvmng' now includes: 4364f1e Typofixes 1e9f90a Move check-ppr and check-api-annotations to testsuite/utils 9bf6310 Add TODO about getMonotonicNSec() wrapping that can no longer happen. dddef31 fdReady(): Fix some C -Wconversion warnings. 03009aa base: fdReady(): Ensure and doc that return values are always -1/0/1 a10729f configure: Make sure we try all possible linkers d4d125f Adds `-llvmng` 561da2a Adds test 68e9b1b [genapply] feed args. ae5639b Fix Raspberry Pi target name From git at git.haskell.org Thu Sep 28 14:31:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 14:31:43 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (60870c0) Message-ID: <20170928143143.BDF4C3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/60870c028f874359b561bf859a0809abf1816075/ghc >--------------------------------------------------------------- commit 60870c028f874359b561bf859a0809abf1816075 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 60870c028f874359b561bf859a0809abf1816075 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 37 ++++++++++++++++++++----------------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 35 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 60870c028f874359b561bf859a0809abf1816075 From git at git.haskell.org Thu Sep 28 14:31:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 14:31:46 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Do some ad-hoc CSE in Exitification (572b0e4) Message-ID: <20170928143146.7C33E3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/572b0e429421e2cc9a0e97b744a781e36ba67659/ghc >--------------------------------------------------------------- commit 572b0e429421e2cc9a0e97b744a781e36ba67659 Author: Joachim Breitner Date: Thu Sep 28 10:30:10 2017 -0400 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- 572b0e429421e2cc9a0e97b744a781e36ba67659 compiler/simplCore/Exitify.hs | 97 +++++++++++++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index fad84852..8fa7474 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -47,6 +47,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -95,7 +96,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -107,7 +108,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -122,7 +123,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join call with no free @@ -144,10 +145,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And jump to it from here return $ mkVarApps (Var v) args where @@ -208,16 +209,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to jump to an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -230,16 +256,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -318,3 +350,24 @@ For `postInlineUnconditionally` and unfolding-based inlining, the function `simplLetUnfolding` simply gives exit join points no unfolding, which prevents this kind of inlining. +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = jump go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = jump exit x + go 10 x y = jump exit x + go (n-1) x y = jump go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. +-} From git at git.haskell.org Thu Sep 28 14:31:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 14:31:52 +0000 (UTC) Subject: [commit: ghc] wip/T14152's head updated: Inline exit join points in the "final" simplifier iteration (60870c0) Message-ID: <20170928143152.582E13A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T14152' now includes: d7705f2 aclocal.m4: call cygpath on mingw32 only ced2cb5 Typofixes (visiblity -> visibility) 283eb1a Initial CircleCI support. cc6be3a Typeable: Allow App to match arrow types 9e46d88 Typeable: Generalize kind of represented type 72b00c3 Identify fields by selector when type-checking (fixes #13644) acd346e testsuite: Add testcase for #14253 d86b237 testsuite: Add unboxed sum to T13929 58a7062 base: Add changelog entry for withTypeable generalization 063e0b4 Bump base to 4.11.0.0 1c92083 Also show types that subsume a hole as valid substitutions for that hole. ddb38b5 testsuite: Bump allocations of T12150 9aa7389 cmm/CBE: Use foldLocalRegsDefd feac0a3 Reexport Semigroup's <> operator from Prelude (#14191) 760b9a3 rts: Set unwind information for remaining stack frames a9d417d rts: Set unwind information for catch_frame 1755869 Implement TH addCorePlugin. d7b8da1 Fix broken LLVM code gen 5a8b843 Remove 'stm' from EXTRA_PACKAGES set 2f10438 Fix build with GhcWithInterpreter=NO 65943a3 Bump haskeline submodule c2373b7 Additional LLVM_TARGET logic. d559612 Fix AsmTempLabel d7b260f [Semigroup] fix genapply 9c7d065 Revert "Typeable: Allow App to match arrow types" b3ae47c don't allow AsmTempLabel in UNREG mode (Trac #14264) 3c74a51 Deal with large extra-contraints wildcards 7721e8e Make pprQuotedList use fsep not hsep 3b4833a Comments only 1b476ab Improve type-error reporting abed9bf Fix solving of implicit parameter constraints 0e60cc1 Document how GHC disambiguates between multiple COMPLETE sets 3804a7e Bump template-haskell to 2.13.0.0 2b2595e Ensure text mode when calling debug functions c839c57 Fix the searching of target AR tool abca29f Adds mingw64 to the valid GHC OSs. 6de1a5a Document Typeable's treatment of kind polymorphic tycons d07b8c7 Include original process name in worker thread name (#14153) 9acbeb5 integer-gmp: Fix style d11611f Add NOINLINE pragma to builtinRules 9738e8b Use SIGQUIT for DWARF backtraces instead of SIGUSR2 49c1a20 configure: Catch case where LLVM tools can't be found 65f7d87 configure: Don't hard-code strip tool 2f8e6e7 testsuite: Expect T13168 to be broken on Windows 7446c7f A bunch of typofixes c41ccbf Omit Typeable from the "naturally coherent" list 6e7c09d StgCmmMonad: Remove unnecessary use of unboxed tuples 6246407 primops: Add some notes regarding the meaning of the "type" field 1d1b991 rts: Inform kernel that we won't need reserved address space 57372a7 PrelRules: Handle Int left shifts of more than word-size bits 0ffa396 testsuite: Add test for #14272 f9f1e38 TcInteract: Remove redundant import of Typeable 3ec579d Release console for ghci wrapper 8c23b54 Rules: Show the binder type in the unbound template binder error 7fb89e8 rts: Silence missing __noreturn__ warning 1825cbd Switch VEH to VCH and allow disabling of SEH completely. 8f468fe base: fdReady(): Add note about O_NONBLOCK requirement 018c40f desugar: Catch levity polymorphism in unboxed sum expressions 30a1eee rts: Throw proper HeapOverflow exception on allocating large array 47888fd Revert "Switch VEH to VCH and allow disabling of SEH completely." 1421d87 Switch VEH to VCH and allow disabling of SEH completely. 07ddeaf GHC_LLVM_TARGET: Keep android OS 60b0645 llvm-targets: drop soft-float 4364f1e Typofixes 1e9f90a Move check-ppr and check-api-annotations to testsuite/utils 9bf6310 Add TODO about getMonotonicNSec() wrapping that can no longer happen. dddef31 fdReady(): Fix some C -Wconversion warnings. 03009aa base: fdReady(): Ensure and doc that return values are always -1/0/1 a10729f configure: Make sure we try all possible linkers 8f88cac Implement a dedicated exitfication pass #14152 572b0e4 Do some ad-hoc CSE in Exitification 60870c0 Inline exit join points in the "final" simplifier iteration From git at git.haskell.org Thu Sep 28 14:31:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 14:31:49 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (8f88cac) Message-ID: <20170928143149.D087F3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/8f88cac98d6312d9e23eed298e1cd5647bc9582d/ghc >--------------------------------------------------------------- commit 8f88cac98d6312d9e23eed298e1cd5647bc9582d Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- 8f88cac98d6312d9e23eed298e1cd5647bc9582d compiler/basicTypes/Id.hs | 6 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 6 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 320 ++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 8 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 3 + docs/users_guide/using-optimisation.rst | 10 + 12 files changed, 366 insertions(+), 6 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8f88cac98d6312d9e23eed298e1cd5647bc9582d From git at git.haskell.org Thu Sep 28 17:44:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 17:44:09 +0000 (UTC) Subject: [commit: ghc] master: mkDataConRep: fix bug in strictness signature (#14290) (5935acd) Message-ID: <20170928174409.C540A3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5935acdb1302263011c2023d5e7f4ec496c972c0/ghc >--------------------------------------------------------------- commit 5935acdb1302263011c2023d5e7f4ec496c972c0 Author: Simon Marlow Date: Thu Sep 28 13:08:45 2017 -0400 mkDataConRep: fix bug in strictness signature (#14290) The strictness signature for a data con wrapper wasn't including any dictionary arguments, which meant that bangs on the fields of a constructor with an existential context would be moved to the wrong fields. See T14290 for an example. Test Plan: * New test T14290 * validate Reviewers: simonpj, niteria, austin, bgamari, erikd Reviewed By: simonpj, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14290 Differential Revision: https://phabricator.haskell.org/D4040 >--------------------------------------------------------------- 5935acdb1302263011c2023d5e7f4ec496c972c0 compiler/basicTypes/MkId.hs | 6 +++++- testsuite/tests/stranal/should_run/T14290.hs | 17 +++++++++++++++++ testsuite/tests/stranal/should_run/all.T | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 03ab04a..87e40dd 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -530,7 +530,11 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con wrap_sig = mkClosedStrictSig wrap_arg_dmds (dataConCPR data_con) - wrap_arg_dmds = map mk_dmd arg_ibangs + wrap_arg_dmds = + replicate (length theta) topDmd ++ map mk_dmd arg_ibangs + -- Don't forget the dictionary arguments when building + -- the strictness signature (#14290). + mk_dmd str | isBanged str = evalDmd | otherwise = topDmd diff --git a/testsuite/tests/stranal/should_run/T14290.hs b/testsuite/tests/stranal/should_run/T14290.hs new file mode 100644 index 0000000..7093239 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T14290.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE ExistentialQuantification #-} +module Main (main) where + +main :: IO () +main = r `seq` return () + +r :: Rec +r = Rec{ a = error "xxx", b = 3, c = True } + +class C t +instance C Bool + +data Rec = forall t. C t => Rec + { a :: () + , b :: !Int + , c :: t + } diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 0764746..dada817 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -15,3 +15,4 @@ test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) +test('T14290', normal, compile_and_run, ['']) From git at git.haskell.org Thu Sep 28 18:42:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 18:42:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: mkDataConRep: fix bug in strictness signature (#14290) (a0671e2) Message-ID: <20170928184246.87E733A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a0671e2de97c5801bfba4b12f16e498492681bc1/ghc >--------------------------------------------------------------- commit a0671e2de97c5801bfba4b12f16e498492681bc1 Author: Simon Marlow Date: Thu Sep 28 13:08:45 2017 -0400 mkDataConRep: fix bug in strictness signature (#14290) The strictness signature for a data con wrapper wasn't including any dictionary arguments, which meant that bangs on the fields of a constructor with an existential context would be moved to the wrong fields. See T14290 for an example. Test Plan: * New test T14290 * validate Reviewers: simonpj, niteria, austin, bgamari, erikd Reviewed By: simonpj, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14290 Differential Revision: https://phabricator.haskell.org/D4040 (cherry picked from commit 5935acdb1302263011c2023d5e7f4ec496c972c0) >--------------------------------------------------------------- a0671e2de97c5801bfba4b12f16e498492681bc1 compiler/basicTypes/MkId.hs | 6 +++++- testsuite/tests/stranal/should_run/T14290.hs | 17 +++++++++++++++++ testsuite/tests/stranal/should_run/all.T | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index a3c82f1..1ce90bb 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -528,7 +528,11 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con wrap_sig = mkClosedStrictSig wrap_arg_dmds (dataConCPR data_con) - wrap_arg_dmds = map mk_dmd arg_ibangs + wrap_arg_dmds = + replicate (length theta) topDmd ++ map mk_dmd arg_ibangs + -- Don't forget the dictionary arguments when building + -- the strictness signature (#14290). + mk_dmd str | isBanged str = evalDmd | otherwise = topDmd diff --git a/testsuite/tests/stranal/should_run/T14290.hs b/testsuite/tests/stranal/should_run/T14290.hs new file mode 100644 index 0000000..7093239 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T14290.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE ExistentialQuantification #-} +module Main (main) where + +main :: IO () +main = r `seq` return () + +r :: Rec +r = Rec{ a = error "xxx", b = 3, c = True } + +class C t +instance C Bool + +data Rec = forall t. C t => Rec + { a :: () + , b :: !Int + , c :: t + } diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 0764746..dada817 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -15,3 +15,4 @@ test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) +test('T14290', normal, compile_and_run, ['']) From git at git.haskell.org Thu Sep 28 21:43:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 21:43:23 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #13391 by checking for kind-GADTs (3e4344a) Message-ID: <20170928214323.437663A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/3e4344ab884a284b948f7946d5543b879d6fc6a8/ghc >--------------------------------------------------------------- commit 3e4344ab884a284b948f7946d5543b879d6fc6a8 Author: Richard Eisenberg Date: Tue Aug 15 17:22:50 2017 -0400 Fix #13391 by checking for kind-GADTs The check is a bit gnarly, but I couldn't think of a better way. See the new code in TcTyClsDecls. test case: polykinds/T13391 >--------------------------------------------------------------- 3e4344ab884a284b948f7946d5543b879d6fc6a8 compiler/basicTypes/DataCon.hs | 2 ++ compiler/typecheck/TcTyClsDecls.hs | 35 ++++++++++++++++++++++ libraries/base/Data/Type/Equality.hs | 3 +- testsuite/tests/dependent/should_compile/Dep2.hs | 2 +- .../dependent/should_compile/KindEqualities.hs | 6 ++-- .../dependent/should_compile/KindEqualities.stderr | 2 +- .../should_run/overloadedrecfldsrun07.hs | 7 +++-- .../should_compile/Dep2.hs => polykinds/T13391.hs} | 6 ++-- testsuite/tests/polykinds/T13391.stderr | 7 +++++ testsuite/tests/polykinds/T13391a.hs | 7 +++++ testsuite/tests/polykinds/all.T | 2 ++ 11 files changed, 67 insertions(+), 12 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3e4344ab884a284b948f7946d5543b879d6fc6a8 From git at git.haskell.org Thu Sep 28 21:43:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 21:43:26 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Fix #13391 by checking for kind-GADTs (3e4344a) Message-ID: <20170928214326.787543A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: dbaa9a2 DynFlags: Add inverse of -dno-debug-output 3625728 Add support for producing position-independent executables 7463a95 users-guide: Better error messages on incomplete ghc-flag directives 74af2e7 Typo fixed 11657c4 Better pretty-printing for CHoleCan a211dca Fix defer-out-of-scope-variables aeb4bd9 Remove typeKind from Type.hs-boot 5f3d2d3 CNF: Implement compaction for small pointer arrays a0b7b10 Restrict exprOkForSpeculation/case to unlifted types 407c11b Bottoming expressions should not be expandable 33452df Refactor the Mighty Simplifier 8649535 Don't do the RhsCtxt thing for join points dd89a13 Comments, plus adjust debug print of TcTyThing(ATyVar) a67b66e Add strict variant of iterate f135fb2 rts: Fix warnings on aarch64 and clean up style 80ccea8 rts: Fix references to Note [BFD import library] 76e59a2 rts: Fix ASSERTs with space before opening paren 8f19c65 Rip out mkUserGuidePart 83484a6 Fix two typos in the ImpredicativeTypes user guide a055f24 Adjust test suite stats 682e8e6 Actually bump T12150 29da01e Make parsed AST dump output lazily 6e0e0b0 Comments only 8834d48 Better debug-printing for Outputable TyConBinder 547e4c0 A bit more -ddump-tc tracing 6f050d9 Add TcRnMonad.unlessXOptM 0257dac Refactor bindHsQTyVars and friends 86e6a5f Small refactoring of meta-tyvar cloning 4455c86 Use a well-kinded substitution to instantiate 8eead4d Improve kind-application-error message a6c448b Small refactor of getRuntimeRep aed7d43 Add HasDebugStack for typeKind 248ad30 testsuite: Add test for #14128 db3a8e1 desugar: Ensure that a module's dep_orphs doesn't contain itself 5266ab9 Remove dll-split. 895a765 Refactor type family instance abstract syntax declarations 3c6b2fc Fix decomposition error on Windows 5f6a820 Add gen-dll as replacement for dll-split f86de44 ghc-pkg: Try opening lockfiles in read-write mode first a27bb1b base: Add support for file unlocking 779b9e6 PackageDb: Explicitly unlock package database before closing 9d57d8c nativeGen: Don't index into linked lists 651b4dc StgLint: Show type of out-of-scope binders a36b34c StgLint: Enforce MultiValAlt liveness invariant only after unariser f17f106 StgLint: Give up on trying to compare types 1561525 HsExpr: Fix typo 6f1ccaa Add a Note describing #14128 567dca6 Add some traceRn and (Outputable StmtTree) 628b666 Add comments to RnTypes fca1962 Define and use HsArg 805b29b Add debugPprType 3790ea9 Small changes to ddump-tc tracing 2c133b6 Really fix Trac #14158 c0feee9 Add missing Semigroup instances to compiler b2c2e3e Add missing Semigroup instances in utils/{hpc,runghc} dd643bc Improve stm haddocks 1f052c5 Fix order of PrelRule 8a1de42 Add testcase for #14178 f089c32 Remove broken citeseer citation links 590e737 Update transformers submodule 6330b0b Document the intricacies of ForallC variable quantification better 5dd6b13 Disallow bang/lazy patterns in the RHSes of implicitly bidirectional patsyns 8e4229a Fix #14167 by using isGadtSyntaxTyCon in more places 0ec4376 Document the Generic(1) laws cb3363e Move NonEmpty definition into GHC.Base 31281a4 testsuite: Fix validation of ways b996e12 testsuite: Add test for #14129 7e5d4a0 Remember the AvailInfo for each IE b9ac9e0 Fix egregious duplication of vars in RnTypes 1300afa get-win32-tarballs: Use bash, not sh a4c2ac2 get-win32-tarballs: Use correct `find` 542f89f Replace hashing function for string keys implementation with xxhash cd857dd SetLevels: Substitute in ticks in lvlMFE 6458b8d base: Update acosh to handle -1::Complex c2881a2 StgLint: Show constructor arity in mismatch message 822abbb eventlog: Clean up profiling heap breakdown type 24e50f9 rts: Add heap breakdown type for -hT 0829821 Implicitly bind kind variables in type family instance RHSes when it's sensible 0cd467b rts: Fix use of #if 2273353 Clean up opt and llc c6726d6 Cleanups, remove commented-out code a04cfcf Update xhtml submodule fee403f Handle W80 in floatFormat d97a6fe Fix typos in diagnostics, testsuite and comments 055d73c Travis: Boot with ghc-8.2.1, and disable test suite 8ae263c Make Semigroup a superclass of Monoid (re #14191) be514a6 includes/rts: Drop trailing comma cb4878f Drop special handling of iOS and Android 011e15a Deal with unbreakable blocks in Applicative Do 22f11f1 Bump T783 expected allocations cf6b4d1 Remove now redundant CPP 122f183 Remove now redundant cabal conditionals in {ghc,template-haskell}.cabal 400ead8 Remove makefile logic for legacy -this-package-key dab0e51 Canonicalise Monoid instances in GHC 346e562 Canonicalise MonoidFail instances in GHC 838a10f Retire cabal_macros_boot.h hack fe35b85 Add testcase for #14186 fe04f37 Allow CSE'ing of work-wrapped bindings (#14186) 0ebc8dc Add a test for #14140 9ff9c35 Check if -XStaticPointers is enabled when renaming static expressions dafa012 Add regression test for #14209 b890e88 rts: Print message before SIGUSR2 backtrace d645e44 DriverMkDepend: Kill redundant import f8e383f Clarify Data.Data documentation 91262e7 Use ar for -staticlib e62391a [RTS] Harden against buffer overflow cbd4911 Make IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115 8ff11c4 Fix @since annotations in GHC.Stats 6139f7f Add non-ASCII isLetter True example 2fe6f6b Option "-ddump-rn-ast" dumps imports and exports too f9bf621 Better document TypeRep patterns 4be195e Simplify Data.Type.Equality.== 4e22220 Clarify seq documentation 4cead3c rts: Add regsterCc(s)List to RTS symbols list 10a1a47 Model divergence of retry# as ThrowsExn, not Diverges 959a623 No need to check ambiguity for visible type args ab2d3d5 More refinements to debugPprType 3a27e34 Fix subtle bug in TcTyClsDecls.mkGADTVars 8bf865d Tidying could cause ill-kinded types 0390e4a Refactor to eliminate FamTyConShape a38acda Refactor tcInferApps 9218ea6 Interim fix for a nasty type-matching bug 9e46167 Remove unused variable binding b6b56dd [RTS] Make -po work 93da9f9 Add test for Trac #14232 3b68687 Test #14038 in dependent/should_compile/T14038 c813d8c Regression test for #12742 b977630 Test #12938 in indexed-types/should_compile/T12938 04bb873 Fix #13407 by suppressing invisibles better. ecb316c nativeGen: A few strictness fixes 58f1f73 Bump primitive submodule 3edbf5c testsuite: Fix dependence on grep behavior in T8129 89c8d4d Fix #13909 by tweaking an error message. e5beb6e Make rejigConRes do kind substitutions fa626f3 Fix #13929 by adding another levity polymorphism check 86e1db7 Test #13938, with expect_broken 8f99cd6 Fix #13963. 7b8827a Bump submodule nofib (Semigroup now required) f043cd5 Fix name of note 4340165 Ignore untracked in text, parsec and mtl submodules [skip ci] 9e227bb Fix missing fields warnings in empty record construction, fix #13870 f4d50a0 Fix #14228 by marking SumPats as non-irrefutable 2bfba9e base: Fix mixed tabs/spaces indentation in inputReady.c 9498c50 Renamer now preserves location for IEThingWith list items 47a9ec7 Remove dead function TcUnify.wrapFunResCoercion b099171 base: Enable TypeInType in Data.Type.Equality 4ec4ca9 base: Add missing MonadFail instance for strict ST 60a3f11 Fix pointer tagging mistake a83f17e base: Fix missing import of Control.Monad.Fail 2258a29 testsuite: Fix MonadFail test output for new ST instance cdaf5f2 [RTS] Add getObjectLoadStatus 120c568 Allow opt+llc from LLVM5 10ca801 Generalise constraint on `instance Monoid (Maybe a)` to Semigroup a2f004b Remove redundant/obsolete CPP usage 1db0f4a Fix unused-given-constraint bug 6252292 rts/RetainerProfile: Adding missing closure types to isRetainer 8b007ab nativeGen: Consistently use blockLbl to generate CLabels from BlockIds 12a92fe OccurAnal: Ensure SourceNotes don't interfere with join-point analysis f63bc73 compiler: introduce custom "GhcPrelude" Prelude 7c7914d Fix Windows build regression due to GhcPrelude change 28a115e base: fdReady(): Improve accuracy and simplify code. c2a1fa7 base: Fix fdReady() potentially running forever on Windows. 826c3b1 base: Fix fdReady() potentially running forever for Windows Char devices. 66240c9 base: Fix fdReady() returning immediately for pipes on Windows. 11c478b rts: Update comment about FreeBSD's unsigned FD_SETSIZE b7f2d12 rts: Fix typo in comment ba4dcc7 base: Make it less likely for fdReady() to fail on Windows sockets. 022455f base: Add more detail to FD_SETSIZE related error message bbb8cb9 users-guide: Mention changes necessary due to #13391 3198956 Factor mkCoreApp and mkCoreApps 7920a7d cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers 0aba999 Restore function powModSecInteger 11d9615 Make zipWith and zipWith3 inlinable. 02ff705 Add 'stm' package to the global package database d7705f2 aclocal.m4: call cygpath on mingw32 only ced2cb5 Typofixes (visiblity -> visibility) 283eb1a Initial CircleCI support. cc6be3a Typeable: Allow App to match arrow types 9e46d88 Typeable: Generalize kind of represented type 72b00c3 Identify fields by selector when type-checking (fixes #13644) acd346e testsuite: Add testcase for #14253 d86b237 testsuite: Add unboxed sum to T13929 58a7062 base: Add changelog entry for withTypeable generalization 063e0b4 Bump base to 4.11.0.0 1c92083 Also show types that subsume a hole as valid substitutions for that hole. ddb38b5 testsuite: Bump allocations of T12150 9aa7389 cmm/CBE: Use foldLocalRegsDefd feac0a3 Reexport Semigroup's <> operator from Prelude (#14191) 760b9a3 rts: Set unwind information for remaining stack frames a9d417d rts: Set unwind information for catch_frame 1755869 Implement TH addCorePlugin. d7b8da1 Fix broken LLVM code gen 5a8b843 Remove 'stm' from EXTRA_PACKAGES set 2f10438 Fix build with GhcWithInterpreter=NO 65943a3 Bump haskeline submodule c2373b7 Additional LLVM_TARGET logic. d559612 Fix AsmTempLabel d7b260f [Semigroup] fix genapply 9c7d065 Revert "Typeable: Allow App to match arrow types" b3ae47c don't allow AsmTempLabel in UNREG mode (Trac #14264) 3c74a51 Deal with large extra-contraints wildcards 7721e8e Make pprQuotedList use fsep not hsep 3b4833a Comments only 1b476ab Improve type-error reporting abed9bf Fix solving of implicit parameter constraints 0e60cc1 Document how GHC disambiguates between multiple COMPLETE sets 3804a7e Bump template-haskell to 2.13.0.0 2b2595e Ensure text mode when calling debug functions c839c57 Fix the searching of target AR tool abca29f Adds mingw64 to the valid GHC OSs. 6de1a5a Document Typeable's treatment of kind polymorphic tycons d07b8c7 Include original process name in worker thread name (#14153) 9acbeb5 integer-gmp: Fix style d11611f Add NOINLINE pragma to builtinRules 9738e8b Use SIGQUIT for DWARF backtraces instead of SIGUSR2 49c1a20 configure: Catch case where LLVM tools can't be found 65f7d87 configure: Don't hard-code strip tool 2f8e6e7 testsuite: Expect T13168 to be broken on Windows 7446c7f A bunch of typofixes c41ccbf Omit Typeable from the "naturally coherent" list 6e7c09d StgCmmMonad: Remove unnecessary use of unboxed tuples 6246407 primops: Add some notes regarding the meaning of the "type" field 1d1b991 rts: Inform kernel that we won't need reserved address space 57372a7 PrelRules: Handle Int left shifts of more than word-size bits 0ffa396 testsuite: Add test for #14272 f9f1e38 TcInteract: Remove redundant import of Typeable 3ec579d Release console for ghci wrapper 8c23b54 Rules: Show the binder type in the unbound template binder error 7fb89e8 rts: Silence missing __noreturn__ warning 1825cbd Switch VEH to VCH and allow disabling of SEH completely. 8f468fe base: fdReady(): Add note about O_NONBLOCK requirement 018c40f desugar: Catch levity polymorphism in unboxed sum expressions 30a1eee rts: Throw proper HeapOverflow exception on allocating large array 47888fd Revert "Switch VEH to VCH and allow disabling of SEH completely." 1421d87 Switch VEH to VCH and allow disabling of SEH completely. 07ddeaf GHC_LLVM_TARGET: Keep android OS 60b0645 llvm-targets: drop soft-float 4364f1e Typofixes 1e9f90a Move check-ppr and check-api-annotations to testsuite/utils 9bf6310 Add TODO about getMonotonicNSec() wrapping that can no longer happen. dddef31 fdReady(): Fix some C -Wconversion warnings. 03009aa base: fdReady(): Ensure and doc that return values are always -1/0/1 a10729f configure: Make sure we try all possible linkers 3e4344a Fix #13391 by checking for kind-GADTs From git at git.haskell.org Thu Sep 28 23:27:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 23:27:12 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Implement a dedicated exitfication pass #14152 (3a239b6) Message-ID: <20170928232712.5C12A3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/3a239b64631ab30eb727db4ce3f73b590236e666/ghc >--------------------------------------------------------------- commit 3a239b64631ab30eb727db4ce3f73b590236e666 Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- 3a239b64631ab30eb727db4ce3f73b590236e666 compiler/basicTypes/Id.hs | 6 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 6 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 398 ++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 8 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 3 + docs/users_guide/using-optimisation.rst | 10 + 12 files changed, 444 insertions(+), 6 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3a239b64631ab30eb727db4ce3f73b590236e666 From git at git.haskell.org Thu Sep 28 23:27:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 23:27:15 +0000 (UTC) Subject: [commit: ghc] wip/T14152: Inline exit join points in the "final" simplifier iteration (ea8e4a2) Message-ID: <20170928232715.285D63A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152 Link : http://ghc.haskell.org/trac/ghc/changeset/ea8e4a2c9a941d03ad335ee4795e18fa0ad1878b/ghc >--------------------------------------------------------------- commit ea8e4a2c9a941d03ad335ee4795e18fa0ad1878b Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- ea8e4a2c9a941d03ad335ee4795e18fa0ad1878b compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 37 ++++++++++++++++++++----------------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 35 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 ea8e4a2c9a941d03ad335ee4795e18fa0ad1878b From git at git.haskell.org Thu Sep 28 23:27:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Sep 2017 23:27:17 +0000 (UTC) Subject: [commit: ghc] wip/T14152's head updated: Inline exit join points in the "final" simplifier iteration (ea8e4a2) Message-ID: <20170928232717.564EC3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T14152' now includes: 5935acd mkDataConRep: fix bug in strictness signature (#14290) 3a239b6 Implement a dedicated exitfication pass #14152 ea8e4a2 Inline exit join points in the "final" simplifier iteration From git at git.haskell.org Fri Sep 29 01:03:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 01:03:09 +0000 (UTC) Subject: [commit: ghc] master: Fix #13391 by checking for kind-GADTs (7aa000b) Message-ID: <20170929010309.DB7313A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7aa000b625c677534c87da43de31c27a2b969183/ghc >--------------------------------------------------------------- commit 7aa000b625c677534c87da43de31c27a2b969183 Author: Richard Eisenberg Date: Tue Aug 15 17:22:50 2017 -0400 Fix #13391 by checking for kind-GADTs The check is a bit gnarly, but I couldn't think of a better way. See the new code in TcTyClsDecls. test case: polykinds/T13391 >--------------------------------------------------------------- 7aa000b625c677534c87da43de31c27a2b969183 compiler/basicTypes/DataCon.hs | 2 ++ compiler/typecheck/TcTyClsDecls.hs | 35 ++++++++++++++++++++++ libraries/base/Data/Type/Equality.hs | 3 +- testsuite/tests/dependent/should_compile/Dep2.hs | 2 +- .../dependent/should_compile/KindEqualities.hs | 6 ++-- .../dependent/should_compile/KindEqualities.stderr | 2 +- .../should_run/overloadedrecfldsrun07.hs | 7 +++-- .../should_compile/Dep2.hs => polykinds/T13391.hs} | 6 ++-- testsuite/tests/polykinds/T13391.stderr | 7 +++++ testsuite/tests/polykinds/T13391a.hs | 7 +++++ testsuite/tests/polykinds/all.T | 2 ++ 11 files changed, 67 insertions(+), 12 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7aa000b625c677534c87da43de31c27a2b969183 From git at git.haskell.org Fri Sep 29 01:06:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 01:06:11 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #12919 by making the flattener homegeneous. (dd069c1) Message-ID: <20170929010611.D15F83A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/dd069c16d675e4fed67ba5575d8113ef90c5ffba/ghc >--------------------------------------------------------------- commit dd069c16d675e4fed67ba5575d8113ef90c5ffba Author: Richard Eisenberg Date: Thu Aug 3 15:18:39 2017 -0400 Fix #12919 by making the flattener homegeneous. This changes a key invariant of the flattener. Previously, flattening a type meant flattening its kind as well. But now, flattening is always homogeneous -- that is, the kind of the flattened type is the same as the kind of the input type. This is achieved by various wizardry in the TcFlatten.flatten_many function, as described in Note [flatten_many]. There are several knock-on effects, including some refactoring in the canonicalizer to take proper advantage of the flattener's changed behavior. In particular, the tyvar case of can_eq_nc' no longer needs to take casts into account. Another effect is that flattening a tyconapp might change it into a casted tyconapp. This might happen if the result kind of the tycon contains a variable, and that variable changes during flattening. Because the flattener is homogeneous, it tacks on a cast to keep the tyconapp kind the same. However, this is problematic when flattening CFunEqCans, which need to have an uncasted tyconapp on the LHS and must remain homogeneous. The solution is a more involved canCFunEqCan, described in Note [canCFunEqCan]. This patch fixes #13643 (as tested in typecheck/should_compile/T13643) and the panic in typecheck/should_compile/T13822 (as reported in #14024). Actually, there were two bugs in T13822: the first was just some incorrect logic in tryFill (part of the unflattener) -- also fixed in this patch -- and the other was the main bug fixed in this ticket. The changes in this patch exposed a long-standing flaw in OptCoercion, in that breaking apart an AppCo sometimes has unexpected effects on kinds. See new Note [EtaAppCo] in OptCoercion, which explains the problem and fix. Also here is a reversion of the major change in 09bf135ace55ce2572bf4168124d631e386c64bb, affecting ctEvCoercion. It turns out that making the flattener homogeneous changes the invariants on the algorithm, making the change in that patch no longer necessary. This patch also fixes #14038, and hence #13910 and #13938. >--------------------------------------------------------------- dd069c16d675e4fed67ba5575d8113ef90c5ffba compiler/typecheck/TcCanonical.hs | 317 +++++--- compiler/typecheck/TcFlatten.hs | 795 ++++++++++++++------- compiler/typecheck/TcInteract.hs | 51 +- compiler/typecheck/TcMType.hs | 11 +- compiler/typecheck/TcRnTypes.hs | 15 +- compiler/typecheck/TcSMonad.hs | 26 +- compiler/typecheck/TcType.hs | 2 +- compiler/types/Coercion.hs | 235 +++--- compiler/types/Coercion.hs-boot | 1 + compiler/types/OptCoercion.hs | 110 ++- compiler/types/TyCoRep.hs | 83 ++- compiler/types/Type.hs | 84 +-- testsuite/tests/dependent/should_compile/all.T | 6 +- .../tests/dependent/should_fail/RAE_T32a.stderr | 25 +- testsuite/tests/dependent/should_fail/all.T | 2 +- testsuite/tests/typecheck/should_compile/T13643.hs | 22 + testsuite/tests/typecheck/should_compile/all.T | 3 +- .../tests/typecheck/should_fail/T12373.stderr | 8 +- 18 files changed, 1143 insertions(+), 653 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 dd069c16d675e4fed67ba5575d8113ef90c5ffba From git at git.haskell.org Fri Sep 29 01:35:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 01:35:19 +0000 (UTC) Subject: [commit: ghc] master: Fix Raspberry Pi target name (464396d) Message-ID: <20170929013519.B8DAD3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/464396d00450efb58330987ebac4735902ba0f01/ghc >--------------------------------------------------------------- commit 464396d00450efb58330987ebac4735902ba0f01 Author: Moritz Angermann Date: Thu Sep 28 11:04:32 2017 +0800 Fix Raspberry Pi target name Summary: For some reson, the `*`, that was supposed to be in D4031 got lost in the diff. Reviewers: bgamari, austin, hvr, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4044 >--------------------------------------------------------------- 464396d00450efb58330987ebac4735902ba0f01 aclocal.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index fb61e8d..b34f898 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1907,7 +1907,7 @@ AC_DEFUN([GHC_LLVM_TARGET], [ # for the LLVM Target. Otherwise these would be # turned into just `-linux` and fail to be found # in the `llvm-targets` file. - *-android*|-gnueabi*) + *-android*|*-gnueabi*) GHC_CONVERT_VENDOR([$2],[llvm_target_vendor]) llvm_target_os="$3" ;; From git at git.haskell.org Fri Sep 29 06:57:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 06:57:19 +0000 (UTC) Subject: [commit: hsc2hs] master: Build utilities with the bootstrap compiler when cross compiling (ecdac06) Message-ID: <20170929065719.D59983A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/ecdac062b5cf1d284906487849c56f4e149b3c8e >--------------------------------------------------------------- commit ecdac062b5cf1d284906487849c56f4e149b3c8e Author: Moritz Angermann Date: Fri Sep 29 14:50:15 2017 +0800 Build utilities with the bootstrap compiler when cross compiling This should fix Trac #14297. When building a cross compiler, we have rather little use of utilities that do not run on the host, where the compiler runs. As such we should build the utilities with the bootstrap (stage 0) compiler rather than witht he in-tree (stage 1) compiler when CrossCompiling. This used to results in the utilities we ship in the binary distribution to be built for the wrong host. This diff tries to rectify the situation and allow the binary distribution to contain the utilities for the host when CrossCompiling. See also https://phabricator.haskell.org/D4048 >--------------------------------------------------------------- ecdac062b5cf1d284906487849c56f4e149b3c8e ghc.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ghc.mk b/ghc.mk index f12aea5..c5f7473 100644 --- a/ghc.mk +++ b/ghc.mk @@ -13,7 +13,18 @@ utils/hsc2hs_dist-install_INSTALL = YES utils/hsc2hs_dist-install_INSTALL_INPLACE = NO $(eval $(call build-prog,utils/hsc2hs,dist,0)) + +# When CrossCompiling, we want to ship the binary for the +# host, not for the target. As such we need to compile +# with the Bootstrap compiler rather than with the in-tree +# stage1 compiler, which would result in a binary that +# won't run on the host. +ifeq "$(CrossCompiling)" "YES" +# compile with stage 0 (bootstrap compiler) +$(eval $(call build-prog,utils/hsc2hs,dist-install,0)) +else $(eval $(call build-prog,utils/hsc2hs,dist-install,1)) +endif # After build-prog above utils/hsc2hs_dist_MODULES += Paths_hsc2hs From git at git.haskell.org Fri Sep 29 18:10:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:10:00 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T14152cse' created Message-ID: <20170929181000.A0E1C3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T14152cse Referencing: 969831966d42bc87e5e36491c8219f7b02f54f72 From git at git.haskell.org Fri Sep 29 18:10:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:10:07 +0000 (UTC) Subject: [commit: ghc] wip/T14152cse: Inline exit join points in the "final" simplifier iteration (865d9af) Message-ID: <20170929181007.2083B3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152cse Link : http://ghc.haskell.org/trac/ghc/changeset/865d9afdc8ef1d2c8eb708c076aebd628193e0b0/ghc >--------------------------------------------------------------- commit 865d9afdc8ef1d2c8eb708c076aebd628193e0b0 Author: Joachim Breitner Date: Fri Sep 1 15:02:34 2017 +0100 Inline exit join points in the "final" simplifier iteration >--------------------------------------------------------------- 865d9afdc8ef1d2c8eb708c076aebd628193e0b0 compiler/simplCore/CoreMonad.hs | 7 +++++-- compiler/simplCore/Exitify.hs | 3 +++ compiler/simplCore/SimplCore.hs | 37 ++++++++++++++++++++----------------- compiler/simplCore/SimplUtils.hs | 7 +++++-- compiler/simplCore/Simplify.hs | 3 ++- 5 files changed, 35 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 865d9afdc8ef1d2c8eb708c076aebd628193e0b0 From git at git.haskell.org Fri Sep 29 18:10:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:10:04 +0000 (UTC) Subject: [commit: ghc] wip/T14152cse: Implement a dedicated exitfication pass #14152 (af766fd) Message-ID: <20170929181004.19C953A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152cse Link : http://ghc.haskell.org/trac/ghc/changeset/af766fd8a82c3387923ed9fdefe3721ad7134979/ghc >--------------------------------------------------------------- commit af766fd8a82c3387923ed9fdefe3721ad7134979 Author: Joachim Breitner Date: Sat Aug 26 14:35:50 2017 +0200 Implement a dedicated exitfication pass #14152 >--------------------------------------------------------------- af766fd8a82c3387923ed9fdefe3721ad7134979 compiler/basicTypes/Id.hs | 6 +- compiler/basicTypes/Unique.hs | 4 + compiler/coreSyn/CoreLint.hs | 1 + compiler/coreSyn/CoreSyn.hs | 10 +- compiler/ghc.cabal.in | 1 + compiler/main/DynFlags.hs | 6 + compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/Exitify.hs | 389 ++++++++++++++++++++++++++++++++ compiler/simplCore/SimplCore.hs | 8 + compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 3 + docs/users_guide/using-optimisation.rst | 10 + 12 files changed, 435 insertions(+), 6 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc af766fd8a82c3387923ed9fdefe3721ad7134979 From git at git.haskell.org Fri Sep 29 18:10:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:10:09 +0000 (UTC) Subject: [commit: ghc] wip/T14152cse: Do some ad-hoc CSE in Exitification (9698319) Message-ID: <20170929181009.E67A03A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T14152cse Link : http://ghc.haskell.org/trac/ghc/changeset/969831966d42bc87e5e36491c8219f7b02f54f72/ghc >--------------------------------------------------------------- commit 969831966d42bc87e5e36491c8219f7b02f54f72 Author: Joachim Breitner Date: Thu Sep 28 10:30:10 2017 -0400 Do some ad-hoc CSE in Exitification So that code like this safe :: Int -> [Int] -> [[Int]] safe x2 ds6 = case ds6 of [] -> lvl6; q : l | x2 == q -> h x2 ds5 | x2 + 1 == q -> h x2 ds5 | x2 + 2 == q -> h x2 ds5 | x2 + 3 == q -> h x2 ds5 | otherwise -> safe (x+10) l only gets one exit join point, instead of 4 identically. (There is currently no CSE for join points, and even if there were, it is cheap to do it here.) This does happen at least in GHC somewhere (exhibited by a core lint error when this patch was buggy). Nofib does not show any differences, not even in code size, which makes me believe that a later pass would remove the duplication (common block elimination on the Cmm level?) and the end result is not affected. But in the interest of compilation time it still seems useful to avoid this duplication from the get-go. >--------------------------------------------------------------- 969831966d42bc87e5e36491c8219f7b02f54f72 compiler/simplCore/Exitify.hs | 100 ++++++++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 22 deletions(-) diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs index 53434bf..714baaa 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/simplCore/Exitify.hs @@ -47,6 +47,7 @@ import VarSet import VarEnv import CoreFVs import FastString +import TrieMap import Type import Data.Bifunctor @@ -95,7 +96,7 @@ exitifyProgram binds = map goTopLvl binds -- join-points outside the joinrec. exitify :: InScopeSet -> [(Var,CoreExpr)] -> (CoreExpr -> CoreExpr) exitify in_scope pairs = - \body ->mkExitLets exits (mkLetRec pairs' body) + \body -> mkExitLets exits (mkLetRec pairs' body) where mkExitLets ((exitId, exitRhs):exits') = mkLetNonRec exitId exitRhs . mkExitLets exits' mkExitLets [] = id @@ -108,7 +109,7 @@ exitify in_scope pairs = -- Which are the recursive calls? recursive_calls = mkVarSet $ map fst pairs - (pairs',exits) = (`runState` []) $ do + (pairs',exits) = runExitifyState in_scope $ forM ann_pairs $ \(x,rhs) -> do -- go past the lambdas of the join point let (args, body) = collectNAnnBndrs (idJoinArity x) rhs @@ -123,7 +124,7 @@ exitify in_scope pairs = -- It uses a state monad to keep track of floated binds go :: [Var] -- ^ variables to abstract over -> CoreExprWithFVs -- ^ current expression in tail position - -> State [(Id, CoreExpr)] CoreExpr + -> ExitifyM CoreExpr go captured ann_e -- Do not touch an expression that is already a join jump where all arguments @@ -146,10 +147,10 @@ exitify in_scope pairs = | is_exit = do -- Assemble the RHS of the exit join point let rhs = mkLams args e - ty = exprType rhs - let avoid = in_scope `extendInScopeSetList` captured + -- Remember what is in scope here + nowInScope captured -- Remember this binding under a suitable name - v <- addExit avoid ty (length args) rhs + v <- addExit (length args) rhs -- And jump to it from here return $ mkVarApps (Var v) args where @@ -214,16 +215,41 @@ exitify in_scope pairs = go _ ann_e = return (deAnnotate ann_e) +type ExitifyM = State ExitifyState +data ExitifyState = ExitifyState + { es_in_scope_acc :: InScopeSet -- ^ combined in_scope_set of all call sites + , es_in_scope :: InScopeSet -- ^ final in_scope_set + , es_joins :: [(JoinId, CoreExpr)] -- ^ exit join points + , es_map :: CoreMap JoinId + -- ^ reverse lookup map, see Note [Avoid duplicate exit points] + } + +-- Runs the ExitifyM monad, and feeds in the final es_in_scope_acc as the +-- es_in_scope to use +runExitifyState :: InScopeSet -> ExitifyM a -> (a, [(JoinId, CoreExpr)]) +runExitifyState in_scope_init f = (res, es_joins state) + where + (res, state) = runState f (ExitifyState in_scope_init in_scope [] emptyTM) + in_scope = es_in_scope_acc state + +-- Keeps track of what is in scope at all the various positions where +-- we want to jump to an exit join point +nowInScope :: [Var] -> ExitifyM () +nowInScope captured = do + st <- get + put (st { es_in_scope_acc = es_in_scope_acc st `extendInScopeSetList` captured}) + -- Picks a new unique, which is disjoint from -- * the free variables of the whole joinrec -- * any bound variables (captured) -- * any exit join points created so far. -mkExitJoinId :: InScopeSet -> Type -> JoinArity -> ExitifyM JoinId -mkExitJoinId in_scope ty join_arity = do - fs <- get - let avoid = in_scope `extendInScopeSetList` (map fst fs) - `extendInScopeSet` exit_id_tmpl -- just cosmetics - return (uniqAway avoid exit_id_tmpl) +mkExitJoinId :: Type -> JoinArity -> ExitifyM JoinId +mkExitJoinId ty join_arity = do + st <- get + let in_scope = es_in_scope st `extendInScopeSet` exit_id_tmpl -- cosmetic only + let v = uniqAway in_scope exit_id_tmpl + put (st { es_in_scope = es_in_scope st `extendInScopeSet` v}) + return v where exit_id_tmpl = mkSysLocal (fsLit "exit") initExitJoinUnique ty `asJoinId` join_arity @@ -236,16 +262,22 @@ mkExitJoinId in_scope ty join_arity = do , occ_int_cxt = False , occ_tail = AlwaysTailCalled join_arity } -addExit :: InScopeSet -> Type -> JoinArity -> CoreExpr -> ExitifyM JoinId -addExit in_scope ty join_arity rhs = do - -- Pick a suitable name - v <- mkExitJoinId in_scope ty join_arity - fs <- get - put ((v,rhs):fs) - return v - - -type ExitifyM = State [(JoinId, CoreExpr)] +-- Adds a new exit join point +-- (or re-uses an existing one) +addExit :: JoinArity -> CoreExpr -> ExitifyM JoinId +addExit join_arity rhs = do + st <- get + -- See Note [Avoid duplicate exit points] + case lookupTM rhs (es_map st) of + Just v -> return v + Nothing -> do + -- Pick a suitable name + v <- mkExitJoinId (exprType rhs) join_arity + st <- get + put (st { es_joins = (v,rhs) : es_joins st + , es_map = insertTM rhs v (es_map st) + }) + return v {- Note [Interesting expression] @@ -389,4 +421,28 @@ this kind of inlining. In the `final` run of the simplifier, we do allow inlining of exit join points, via a `SimplifierMode` flag. + +Note [Avoid duplicate exit points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If we have + + joinrec go 0 x y = t (x*x) + go 10 x y = t (x*x) + go (n-1) x y = jump go (n-1) (x+y) + in … + +we want to create only _one_ exit join point: + + join exit x = t (x*x) + joinrec go 0 x y = jump exit x + go 10 x y = jump exit x + go (n-1) x y = jump go (n-1) (x+y) + in … + +we do so by keeping a `CoreMap JoinId` around, and `addExit` checks for +if we can re-use an already created exit join point. + +Note that (at the time of writing), CSE does *not* handle join points. +See Note [CSE for join points?] -} From git at git.haskell.org Fri Sep 29 18:10:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:10:39 +0000 (UTC) Subject: [commit: ghc] wip/T14152's head updated: Inline exit join points in the "final" simplifier iteration (865d9af) Message-ID: <20170929181039.67A6D3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T14152' now includes: af766fd Implement a dedicated exitfication pass #14152 865d9af Inline exit join points in the "final" simplifier iteration From git at git.haskell.org Fri Sep 29 18:39:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:39:53 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Clean up build names (9150d49) Message-ID: <20170929183953.80FBC3A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/9150d49781377197559c474d250c1dd2495f6a10/ghc >--------------------------------------------------------------- commit 9150d49781377197559c474d250c1dd2495f6a10 Author: Ben Gamari Date: Wed Sep 27 19:17:10 2017 -0400 Clean up build names >--------------------------------------------------------------- 9150d49781377197559c474d250c1dd2495f6a10 Jenkinsfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cec4c38..63012ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,7 +62,7 @@ stage("Build source distribution") { } parallel ( - "linux x86-64" : { + "amd64 linux" : { node(label: 'linux && amd64') { buildAndTestGhc(targetTriple: 'x86_64-linux-gnu') if (params.build_docs) { @@ -71,34 +71,34 @@ parallel ( } } }, - //"linux x86-64 -> aarch64 unreg" : { + //"amd64 linux -> aarch64 linux unreg" : { // node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu', unreg: true)} //}, - //"linux x86-64 -> aarch64" : { + //"amd64 linux -> aarch64 linux" : { // node(label: 'linux && amd64') {buildGhc(crossCompiling: true, targetTriple: 'aarch64-linux-gnu')} // node(label: 'linux && aarch64') {testGhc(targetTriple: 'aarch64-linux-gnu')} //}, - "aarch64" : { + "aarch64 linux" : { node(label: 'linux && aarch64') {buildGhc(targetTriple: 'aarch64-linux-gnu')} }, - "freebsd" : { + "amd64 freebsd" : { node(label: 'freebsd && amd64') { buildGhc(targetTriple: 'x86_64-portbld-freebsd11.0', makeCmd: 'gmake', disableLargeAddrSpace: true) } }, // Requires cygpath plugin? - "windows 64" : { + "amd64 windows" : { node(label: 'windows && amd64') { withMingw('MINGW64') { buildAndTestGhc(targetTriple: 'x86_64-w64-mingw32') } } }, - "windows 32" : { + "i386 windows" : { node(label: 'windows && amd64') { withMingw('MINGW32') { buildAndTestGhc(targetTriple: 'x86_64-pc-msys') } } }, /* - "osx" : { + "amd64 darwin" : { node(label: 'darwin') {buildGhc(targetTriple: 'x86_64-apple-darwin16.0.0')} } */ From git at git.haskell.org Fri Sep 29 18:39:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Sep 2017 18:39:56 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Disable SplitSections due to #14291 (0e50000) Message-ID: <20170929183956.394C23A5DA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/0e500002067e79276b2b403ab7a2e0132ad419e4/ghc >--------------------------------------------------------------- commit 0e500002067e79276b2b403ab7a2e0132ad419e4 Author: Ben Gamari Date: Fri Sep 29 14:32:32 2017 -0400 Disable SplitSections due to #14291 >--------------------------------------------------------------- 0e500002067e79276b2b403ab7a2e0132ad419e4 Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 63012ce..815e8eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -172,6 +172,9 @@ def buildGhc(params) { ValidateSpeed=${speed} ValidateHpc=NO BUILD_DPH=NO + + # Due to #14291 + SplitSections=NO """ if (crossCompiling) { build_mk += """ From git at git.haskell.org Sat Sep 30 03:35:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 03:35:41 +0000 (UTC) Subject: [commit: libffi-tarballs] master: libffi 3.2.1 was released on November 12, 2014. (a5fc60a) Message-ID: <20170930033541.52C993A5E4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : master Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/a5fc60a3491d44d0f37c3125b61cc03a80a935f7 >--------------------------------------------------------------- commit a5fc60a3491d44d0f37c3125b61cc03a80a935f7 Author: Herbert Valerio Riedel Date: Tue Dec 8 10:23:14 2015 +0100 libffi 3.2.1 was released on November 12, 2014. The libffi-3.2.1.tar.gz tarball was retrieved from ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz and has the following checksums md5sum 83b89587607e3eb65c70d361f13bab43 sha1sum 280c265b789e041c02e5c97815793dfc283fb1e6 sha256sum d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37 >--------------------------------------------------------------- a5fc60a3491d44d0f37c3125b61cc03a80a935f7 LICENSE | 2 +- libffi-3.2.1.tar.gz | Bin 0 -> 940837 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index aa60342..a66fab4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -libffi - Copyright (c) 1996-2012 Anthony Green, Red Hat, Inc and others. +libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others. See source files for details. Permission is hereby granted, free of charge, to any person obtaining diff --git a/libffi-3.2.1.tar.gz b/libffi-3.2.1.tar.gz new file mode 100644 index 0000000..5c21bb0 Binary files /dev/null and b/libffi-3.2.1.tar.gz differ From git at git.haskell.org Sat Sep 30 03:35:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 03:35:43 +0000 (UTC) Subject: [commit: libffi-tarballs] master: Update libffi tarball (ce3a8e2) Message-ID: <20170930033543.6CA353A5E4@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : master Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/ce3a8e2558847648ee651e63c03560958ce04887 >--------------------------------------------------------------- commit ce3a8e2558847648ee651e63c03560958ce04887 Author: Ben Gamari Date: Fri Sep 29 23:22:46 2017 -0400 Update libffi tarball >--------------------------------------------------------------- ce3a8e2558847648ee651e63c03560958ce04887 README | 4 +--- libffi-3.2.1.tar.gz | Bin 940837 -> 0 bytes libffi-93d8e7d.tar.gz | Bin 0 -> 1384839 bytes 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README b/README index 042415a..23b37c2 100644 --- a/README +++ b/README @@ -1,4 +1,2 @@ - -Tarballs come from: - http://sourceware.org/libffi/ +Tarballs generated using utils/libffi/make-libffi-snapshot.sh diff --git a/libffi-3.2.1.tar.gz b/libffi-3.2.1.tar.gz deleted file mode 100644 index 5c21bb0..0000000 Binary files a/libffi-3.2.1.tar.gz and /dev/null differ diff --git a/libffi-93d8e7d.tar.gz b/libffi-93d8e7d.tar.gz new file mode 100644 index 0000000..e2d3c5b Binary files /dev/null and b/libffi-93d8e7d.tar.gz differ From git at git.haskell.org Sat Sep 30 14:21:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:21:20 +0000 (UTC) Subject: [commit: libffi-tarballs] branch 'libffi-3.99999+git20170927+93d8e7d' created Message-ID: <20170930142120.3B2C93A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs New branch : libffi-3.99999+git20170927+93d8e7d Referencing: 3fa6e0d02ee49428fa368c4aa11438d06b5591e5 From git at git.haskell.org Sat Sep 30 14:21:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:21:22 +0000 (UTC) Subject: [commit: libffi-tarballs] libffi-3.99999+git20170927+93d8e7d: Snapshot of libffi 93d8e7d (3fa6e0d) Message-ID: <20170930142122.406AB3A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : libffi-3.99999+git20170927+93d8e7d Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/3fa6e0d02ee49428fa368c4aa11438d06b5591e5 >--------------------------------------------------------------- commit 3fa6e0d02ee49428fa368c4aa11438d06b5591e5 Author: Ben Gamari Date: Sat Sep 30 10:18:49 2017 -0400 Snapshot of libffi 93d8e7d >--------------------------------------------------------------- 3fa6e0d02ee49428fa368c4aa11438d06b5591e5 README.md | 7 +++++++ libffi-3.99999+git20170927+93d8e7d.tar.gz | Bin 0 -> 1485405 bytes 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe1123f --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# libffi snapshot tarball for GHC + +This source snapshot was produced from +[libffi](https://github.com/libffi/libffi) commit +[93d8e7d](https://github.com/libffi/libffi/commit/93d8e7d) for GHC. See the +`master` branch of this repository for more information about the rationale +and tools for producing these snapshots. diff --git a/libffi-3.99999+git20170927+93d8e7d.tar.gz b/libffi-3.99999+git20170927+93d8e7d.tar.gz new file mode 100644 index 0000000..19bf4d6 Binary files /dev/null and b/libffi-3.99999+git20170927+93d8e7d.tar.gz differ From git at git.haskell.org Sat Sep 30 14:21:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:21:47 +0000 (UTC) Subject: [commit: libffi-tarballs] branch 'old' created Message-ID: <20170930142147.65DE63A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs New branch : old Referencing: b6658e5d73eb0579b3054593de21f329ab491e77 From git at git.haskell.org Sat Sep 30 14:21:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:21:58 +0000 (UTC) Subject: [commit: libffi-tarballs] master: Initial commit (139e77e) Message-ID: <20170930142158.96B8F3A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : master Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/139e77ebda342336ada10094d21d9be2589ff301 >--------------------------------------------------------------- commit 139e77ebda342336ada10094d21d9be2589ff301 Author: Ben Gamari Date: Sat Sep 30 10:06:52 2017 -0400 Initial commit >--------------------------------------------------------------- 139e77ebda342336ada10094d21d9be2589ff301 README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md new file mode 100644 index 0000000..623ac27 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# libffi tarballs for GHC + +This repository contains the source tarballs used to +build [libffi](https://github.com/libffi/libffi/issues/296) +for [GHC](https://ghc.haskell.org/). While in principle this repository should +contain official source tarballs from the libffi project, the +recent [lack of releases](https://github.com/libffi/libffi/issues/296) has meant +that we have had to start packaging our own snapshots. + +Note that in order to reduce working tree size, this repository contains only +orphan branches. Each branch contains one source tarball. These tarballs and +their branches are generated using the `mk-snapshot.sh` script. + +In order to update the `libffi` version built by GHC, first run +`mk-snapshot.sh`, then push the resulting branch to `git.haskell.org`, and +finally update the submodule commit in the `ghc` repository. From git at git.haskell.org Sat Sep 30 14:22:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:22:00 +0000 (UTC) Subject: [commit: libffi-tarballs] master: Add mk-snapshot script (eb32945) Message-ID: <20170930142200.9B29D3A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : master Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/eb32945377fd94f0d67eaceead07827766817b7c >--------------------------------------------------------------- commit eb32945377fd94f0d67eaceead07827766817b7c Author: Ben Gamari Date: Sat Sep 30 10:07:01 2017 -0400 Add mk-snapshot script >--------------------------------------------------------------- eb32945377fd94f0d67eaceead07827766817b7c mk-snapshot.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/mk-snapshot.sh b/mk-snapshot.sh new file mode 100755 index 0000000..52f33e4 --- /dev/null +++ b/mk-snapshot.sh @@ -0,0 +1,48 @@ +#!/bin/bash -e + +# Create a snapshot of the libffi repository from github, as a workaround for +# the lack of recent releases of libffi (see https://github.com/libffi/libffi/issues/296) + +GVERS=3.99999 # see configure.ac / AC_INIT + +# make a temporary directory and perform operations in there. +TMPD=$(mktemp -d) +TDIR=$(pwd) + +# clone the repository (shallow is sufficient) +git -C ${TMPD} clone --depth 1 https://github.com/libffi/libffi.git +REPO="${TMPD}/libffi" + +# record the revision and create a copy of only the files +# contained in the repository at libffi- +GHASH=$(git -C ${REPO} rev-parse --short HEAD) +GDATE=$(git -C ${REPO} log -1 --pretty=format:%cd --date=format:%Y%m%d) +SUFFIX="${GVERS}+git${GDATE}+${GHASH}" +git -C ${REPO} archive --format=tar --prefix="libffi-${SUFFIX}/" HEAD | tar -C ${TMPD} -x + +# run and remove autogen, so we don't have to run it on the CI or elsewhere +# and as such incure additional dependencies like libtool. +(cd "${TMPD}/libffi-${SUFFIX}" && ./autogen.sh && rm autogen.sh) + +# package it up +LIB="libffi-${SUFFIX}.tar.gz" +(cd "${TMPD}" && tar -czf "${LIB}" "libffi-${SUFFIX}") +mv "$TMPD/$LIB" ./$LIB + +# create orphan branch +git checkout --orphan "libffi-${SUFFIX}" +git add $LIB +cat >README.md < Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : libffi-3.99999+git20170927+93d8e7d Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/81fbf2e78a082c6ad464d4025b44402b3db8acdf >--------------------------------------------------------------- commit 81fbf2e78a082c6ad464d4025b44402b3db8acdf Author: Ben Gamari Date: Sat Sep 30 10:27:58 2017 -0400 Snapshot of libffi 93d8e7d >--------------------------------------------------------------- 81fbf2e78a082c6ad464d4025b44402b3db8acdf LICENSE | 21 +++++++++++++++++++++ README.md | 7 +++++++ libffi-3.99999+git20170927+93d8e7d.tar.gz | Bin 0 -> 1485422 bytes 3 files changed, 28 insertions(+) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..aa60342 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2012 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe1123f --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# libffi snapshot tarball for GHC + +This source snapshot was produced from +[libffi](https://github.com/libffi/libffi) commit +[93d8e7d](https://github.com/libffi/libffi/commit/93d8e7d) for GHC. See the +`master` branch of this repository for more information about the rationale +and tools for producing these snapshots. diff --git a/libffi-3.99999+git20170927+93d8e7d.tar.gz b/libffi-3.99999+git20170927+93d8e7d.tar.gz new file mode 100644 index 0000000..907555c Binary files /dev/null and b/libffi-3.99999+git20170927+93d8e7d.tar.gz differ From git at git.haskell.org Sat Sep 30 14:28:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:28:54 +0000 (UTC) Subject: [commit: libffi-tarballs] master: Add LICENSE (02a3d3f) Message-ID: <20170930142854.67D5C3A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : master Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/02a3d3f3012436461b25779d8516a36d219c59ae >--------------------------------------------------------------- commit 02a3d3f3012436461b25779d8516a36d219c59ae Author: Ben Gamari Date: Sat Sep 30 10:26:55 2017 -0400 Add LICENSE >--------------------------------------------------------------- 02a3d3f3012436461b25779d8516a36d219c59ae LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..aa60342 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2012 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From git at git.haskell.org Sat Sep 30 14:28:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 14:28:56 +0000 (UTC) Subject: [commit: libffi-tarballs] master: mk-snapshot: Move back to master after creating snapshot branch (05eae95) Message-ID: <20170930142856.6CAD13A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/libffi-tarballs On branch : master Link : http://git.haskell.org/libffi-tarballs.git/commitdiff/05eae951c0d8e1b71e5c4fa5c1261a4c0ab68c07 >--------------------------------------------------------------- commit 05eae951c0d8e1b71e5c4fa5c1261a4c0ab68c07 Author: Ben Gamari Date: Sat Sep 30 10:27:09 2017 -0400 mk-snapshot: Move back to master after creating snapshot branch >--------------------------------------------------------------- 05eae951c0d8e1b71e5c4fa5c1261a4c0ab68c07 mk-snapshot.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/mk-snapshot.sh b/mk-snapshot.sh index 52f33e4..942abdc 100755 --- a/mk-snapshot.sh +++ b/mk-snapshot.sh @@ -44,5 +44,6 @@ EOF git add README.md git rm --cached mk-snapshot.sh git commit -m "Snapshot of libffi ${GHASH}" +git checkout -f master echo "Created branch libffi-${SUFFIX}" From git at git.haskell.org Sat Sep 30 15:17:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 15:17:30 +0000 (UTC) Subject: [commit: ghc] master: iserv: Don't build vanilla iserv unless vanilla libraries are built (c15c427) Message-ID: <20170930151730.75E823A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c15c4272018f22c9576e11342464d86782934e54/ghc >--------------------------------------------------------------- commit c15c4272018f22c9576e11342464d86782934e54 Author: Ben Gamari Date: Fri Sep 29 23:33:29 2017 -0400 iserv: Don't build vanilla iserv unless vanilla libraries are built Test Plan: Validate Reviewers: austin, snowleopard Subscribers: angerman, rwbarton, thomie, int-e Differential Revision: https://phabricator.haskell.org/D4042 >--------------------------------------------------------------- c15c4272018f22c9576e11342464d86782934e54 iserv/ghc.mk | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/iserv/ghc.mk b/iserv/ghc.mk index ff8b153..c5ca6a5 100644 --- a/iserv/ghc.mk +++ b/iserv/ghc.mk @@ -69,15 +69,20 @@ iserv_stage2_INSTALL_INPLACE = YES iserv_stage2_p_INSTALL_INPLACE = YES iserv_stage2_dyn_INSTALL_INPLACE = YES -$(eval $(call build-prog,iserv,stage2,1)) - ifeq "$(CLEANING)" "YES" +NEED_iserv = YES NEED_iserv_p = YES NEED_iserv_dyn = YES else +ifneq "$(findstring v, $(GhcLibWays))" "" +NEED_iserv = YES +else +NEED_iserv = NO +endif + ifneq "$(findstring p, $(GhcLibWays))" "" NEED_iserv_p = YES else @@ -91,6 +96,10 @@ NEED_iserv_dyn = NO endif endif +ifeq "$(NEED_iserv)" "YES" +$(eval $(call build-prog,iserv,stage2,1)) +endif + ifeq "$(NEED_iserv_p)" "YES" $(eval $(call build-prog,iserv,stage2_p,1)) endif From git at git.haskell.org Sat Sep 30 15:17:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 15:17:35 +0000 (UTC) Subject: [commit: ghc] master: Allow libffi snapshots (e515c7f) Message-ID: <20170930151735.E48A93A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e515c7f37be97e1c2ccc497ddd0a730e63ddfa82/ghc >--------------------------------------------------------------- commit e515c7f37be97e1c2ccc497ddd0a730e63ddfa82 Author: Moritz Angermann Date: Sat Sep 30 09:31:12 2017 -0400 Allow libffi snapshots This is rather annoying. I'd prefer to have a stable release to use. However libffi-3.2.1 has been released November 12, 2014, and libffi-4 is TBD. See also https://github.com/libffi/libffi/issues/296 The core reason for this change is that llvm changed the supported assembly to unified syntax, which libffi-3.2.1 does not use, and hence fails to compile for arm with llvm. For refence, see the following issue: https://github.com/libffi/libffi/issues/191. This diff contains a script to generate a tarball for the `libffi-tarballs` repository from the libffi GitHub repository; as well as the necessary changes to the build system. Updates libffi-tarballs submodule. Reviewers: austin, bgamari, hvr Subscribers: hvr, erikd, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3574 >--------------------------------------------------------------- e515c7f37be97e1c2ccc497ddd0a730e63ddfa82 libffi-tarballs | 2 +- libffi/ghc.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libffi-tarballs b/libffi-tarballs index ec37a68..81fbf2e 160000 --- a/libffi-tarballs +++ b/libffi-tarballs @@ -1 +1 @@ -Subproject commit ec37a68838566cb830c33cb30bfade003a306cff +Subproject commit 81fbf2e78a082c6ad464d4025b44402b3db8acdf diff --git a/libffi/ghc.mk b/libffi/ghc.mk index 7c5bc9e..691eda7 100644 --- a/libffi/ghc.mk +++ b/libffi/ghc.mk @@ -123,7 +123,7 @@ $(libffi_STATIC_LIB): $(libffi_STAMP_INSTALL) @test -f $@ || { echo "$< exists, but $@ does not."; echo "Suggest removing $<."; exit 1; } $(libffi_HEADERS): $(libffi_STAMP_INSTALL) | $$(dir $$@)/. - cp -f libffi/build/inst/lib/libffi-*/include/$(notdir $@) $@ + cp -f libffi/build/inst/include/$(notdir $@) $@ $(eval $(call clean-target,libffi,, \ libffi/build $(wildcard libffi/stamp.ffi.*) libffi/dist-install)) From git at git.haskell.org Sat Sep 30 15:17:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 15:17:25 +0000 (UTC) Subject: [commit: ghc] master: user-guide: Document -Weverything (9c05fc4) Message-ID: <20170930151725.049683A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9c05fc4c31edde34a68317b45fdd71510d868f60/ghc >--------------------------------------------------------------- commit 9c05fc4c31edde34a68317b45fdd71510d868f60 Author: Ben Gamari Date: Fri Sep 29 23:29:47 2017 -0400 user-guide: Document -Weverything [skip ci] Reviewers: hvr, austin, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie GHC Trac Issues: #14284 Differential Revision: https://phabricator.haskell.org/D4043 >--------------------------------------------------------------- 9c05fc4c31edde34a68317b45fdd71510d868f60 docs/users_guide/using-warnings.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index 39d7de4..15b6301 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -79,6 +79,13 @@ The following flags are simple ways to select standard "packages" of warnings: * :ghc-flag:`-Widentities` * :ghc-flag:`-Wredundant-constraints` +.. ghc-flag:: -Weverything + :shortdesc: enable all warnings supported by GHC + :type: dynamic + :category: + + Turns on every single warning supported by the compiler. + .. ghc-flag:: -Wcompat :shortdesc: enable future compatibility warnings (details in :ref:`options-sanity`) From git at git.haskell.org Sat Sep 30 15:17:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 15:17:33 +0000 (UTC) Subject: [commit: ghc] master: Document a law for TH's Lift class (626f045) Message-ID: <20170930151733.320D43A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/626f0454ef1ca8f40c38064197dba97a36d52dbb/ghc >--------------------------------------------------------------- commit 626f0454ef1ca8f40c38064197dba97a36d52dbb Author: Ryan Scott Date: Fri Sep 29 23:32:41 2017 -0400 Document a law for TH's Lift class Inspired by the discussion in #14296, I've decided to document a law which is usually in the back of my mind when I'm using Template Haskell's `Lift` class, but isn't formally stated anywhere. That is, every `Lift` instance should satisfy (for all `x`): ```lang=haskell $(lift x) == x ``` Test Plan: Read it Reviewers: austin, goldfire, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4050 >--------------------------------------------------------------- 626f0454ef1ca8f40c38064197dba97a36d52dbb libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 419d944..0541a08 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -565,6 +565,9 @@ sequenceQ = sequence -- Template Haskell has no way of knowing what value @x@ will take on at -- splice-time, so it requires the type of @x@ to be an instance of 'Lift'. -- +-- A 'Lift' instance must satisfy @$(lift x) ≡ x@ for all @x@, where @$(...)@ +-- is a Template Haskell splice. +-- -- 'Lift' instances can be derived automatically by use of the @-XDeriveLift@ -- GHC language extension: -- From git at git.haskell.org Sat Sep 30 15:17:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Sep 2017 15:17:27 +0000 (UTC) Subject: [commit: ghc] master: Don't use "character" in haddocks of Char (effcd56) Message-ID: <20170930151727.B7A443A5EA@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/effcd565b6be4f945d3913d561bba515381405ed/ghc >--------------------------------------------------------------- commit effcd565b6be4f945d3913d561bba515381405ed Author: Ben Gamari Date: Fri Sep 29 23:33:03 2017 -0400 Don't use "character" in haddocks of Char Character is a terribly overloaded term and may refer to graphemes or code points. Specifically say that Char represents Unicode code points. [skip ci] Test Plan: Read it. Reviewers: hvr, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4051 >--------------------------------------------------------------- effcd565b6be4f945d3913d561bba515381405ed libraries/ghc-prim/GHC/Types.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index 3756c58..215f96c 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -122,7 +122,7 @@ data Ordering = LT | EQ | GT ********************************************************************* -} {- | The character type 'Char' is an enumeration whose values represent -Unicode (or equivalently ISO\/IEC 10646) characters (see +Unicode (or equivalently ISO\/IEC 10646) code points (i.e. characters, see for details). This set extends the ISO 8859-1 (Latin-1) character set (the first 256 characters), which is itself an extension of the ASCII character set (the first 128 characters). A character literal in