diff options
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/CodeGen.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Make.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/SetLevels.hs | 17 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Specialise.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/WorkWrap/Utils.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Core/Subst.hs | 18 | ||||
-rw-r--r-- | compiler/GHC/StgToJS/Linker/Utils.hs | 3 | ||||
-rw-r--r-- | libraries/base/GHC/Event/Manager.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Event/TimerManager.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Fingerprint.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Fingerprint/Type.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/IO/Encoding/Types.hs | 1 | ||||
-rw-r--r-- | utils/deriveConstants/Main.hs | 1 |
13 files changed, 30 insertions, 33 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs index bf1c36bf55..d6ef821c9f 100644 --- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs @@ -2715,7 +2715,7 @@ genCCall64 addr conv dest_regs args = do <- load_args prom_args (allIntArgRegs platform) (allFPArgRegs platform) nilOL nilOL - let used_regs rs as = reverse (drop (length rs) (reverse as)) + let used_regs rs as = dropTail (length rs) as fregs_used = used_regs fregs (allFPArgRegs platform) aregs_used = used_regs aregs (allIntArgRegs platform) return (stack_args, aregs_used, fregs_used, load_args_code diff --git a/compiler/GHC/Core/Make.hs b/compiler/GHC/Core/Make.hs index c11f84d9ba..a0f659f318 100644 --- a/compiler/GHC/Core/Make.hs +++ b/compiler/GHC/Core/Make.hs @@ -556,7 +556,8 @@ chunkify xs where n_xs = length xs split [] = [] - split xs = take mAX_TUPLE_SIZE xs : split (drop mAX_TUPLE_SIZE xs) + split xs = let (as, bs) = splitAt mAX_TUPLE_SIZE xs + in as : split bs {- diff --git a/compiler/GHC/Core/Opt/SetLevels.hs b/compiler/GHC/Core/Opt/SetLevels.hs index 95084cf7b6..bcd01bec04 100644 --- a/compiler/GHC/Core/Opt/SetLevels.hs +++ b/compiler/GHC/Core/Opt/SetLevels.hs @@ -1752,13 +1752,12 @@ newLvlVar lvld_rhs join_arity_maybe is_mk_static cloneCaseBndrs :: LevelEnv -> Level -> [Var] -> LvlM (LevelEnv, [Var]) cloneCaseBndrs env@(LE { le_subst = subst, le_lvl_env = lvl_env, le_env = id_env }) new_lvl vs - = do { us <- getUniqueSupplyM - ; let (subst', vs') = cloneBndrs subst us vs + = do { (subst', vs') <- cloneBndrs subst vs -- N.B. We are not moving the body of the case, merely its case -- binders. Consequently we should *not* set le_ctxt_lvl and -- le_join_ceil. See Note [Setting levels when floating -- single-alternative cases]. - env' = env { le_lvl_env = addLvls new_lvl lvl_env vs' + ; let env' = env { le_lvl_env = addLvls new_lvl lvl_env vs' , le_subst = subst' , le_env = foldl' add_id id_env (vs `zip` vs') } @@ -1773,13 +1772,13 @@ cloneLetVars :: RecFlag -> LevelEnv -> Level -> [InVar] cloneLetVars is_rec env@(LE { le_subst = subst, le_lvl_env = lvl_env, le_env = id_env }) dest_lvl vs - = do { us <- getUniqueSupplyM - ; let vs1 = map zap vs + = do { let vs1 = map zap vs -- See Note [Zapping the demand info] - (subst', vs2) = case is_rec of - NonRecursive -> cloneBndrs subst us vs1 - Recursive -> cloneRecIdBndrs subst us vs1 - prs = vs `zip` vs2 + ; (subst', vs2) <- case is_rec of + NonRecursive -> cloneBndrs subst vs1 + Recursive -> cloneRecIdBndrs subst vs1 + + ; let prs = vs `zip` vs2 env' = env { le_lvl_env = addLvls dest_lvl lvl_env vs2 , le_subst = subst' , le_env = foldl' add_id id_env prs } diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs index cfeaf59649..826bb96d4a 100644 --- a/compiler/GHC/Core/Opt/Specialise.hs +++ b/compiler/GHC/Core/Opt/Specialise.hs @@ -3461,9 +3461,8 @@ cloneBndrSM env@(SE { se_subst = subst }) bndr cloneRecBndrsSM :: SpecEnv -> [Id] -> SpecM (SpecEnv, [Id]) cloneRecBndrsSM env@(SE { se_subst = subst }) bndrs - = do { us <- getUniqueSupplyM - ; let (subst', bndrs') = Core.cloneRecIdBndrs subst us bndrs - env' = env { se_subst = subst' } + = do { (subst', bndrs') <- Core.cloneRecIdBndrs subst bndrs + ; let env' = env { se_subst = subst' } ; return (env', bndrs') } newDictBndr :: SpecEnv -> CoreBndr -> SpecM (SpecEnv, CoreBndr) diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs index 488eeaf5f4..7eb68556fd 100644 --- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs +++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs @@ -213,12 +213,11 @@ mkWwBodies opts fun_id arg_vars res_ty demands res_cpr -- Clone and prepare arg_vars of the original fun RHS -- See Note [Freshen WW arguments] -- and Note [Zap IdInfo on worker args] - ; uniq_supply <- getUniqueSupplyM ; let args_free_tcvs = tyCoVarsOfTypes (res_ty : map varType arg_vars) empty_subst = mkEmptySubst (mkInScopeSet args_free_tcvs) zapped_arg_vars = map zap_var arg_vars - (subst, cloned_arg_vars) = cloneBndrs empty_subst uniq_supply zapped_arg_vars - res_ty' = substTyUnchecked subst res_ty + ; (subst, cloned_arg_vars) <- cloneBndrs empty_subst zapped_arg_vars + ; let res_ty' = substTyUnchecked subst res_ty init_str_marks = map (const NotMarkedStrict) cloned_arg_vars ; (useful1, work_args_str, wrap_fn_str, fn_args) diff --git a/compiler/GHC/Core/Subst.hs b/compiler/GHC/Core/Subst.hs index f0ad737fb6..e6fd91dc0a 100644 --- a/compiler/GHC/Core/Subst.hs +++ b/compiler/GHC/Core/Subst.hs @@ -417,11 +417,12 @@ cloneIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id]) cloneIdBndrs subst us ids = mapAccumL (clone_id subst) subst (ids `zip` uniqsFromSupply us) -cloneBndrs :: Subst -> UniqSupply -> [Var] -> (Subst, [Var]) +cloneBndrs :: MonadUnique m => Subst -> [Var] -> m (Subst, [Var]) -- Works for all kinds of variables (typically case binders) -- not just Ids -cloneBndrs subst us vs - = mapAccumL (\subst (v, u) -> cloneBndr subst u v) subst (vs `zip` uniqsFromSupply us) +cloneBndrs subst vs + = do us <- getUniquesM + pure $ mapAccumL (\subst (v, u) -> cloneBndr subst u v) subst (vs `zip` us) cloneBndr :: Subst -> Unique -> Var -> (Subst, Var) cloneBndr subst uniq v @@ -429,12 +430,11 @@ cloneBndr subst uniq v | otherwise = clone_id subst subst (v,uniq) -- Works for coercion variables too -- | Clone a mutually recursive group of 'Id's -cloneRecIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id]) -cloneRecIdBndrs subst us ids - = (subst', ids') - where - (subst', ids') = mapAccumL (clone_id subst') subst - (ids `zip` uniqsFromSupply us) +cloneRecIdBndrs :: MonadUnique m => Subst -> [Id] -> m (Subst, [Id]) +cloneRecIdBndrs subst ids + = do us <- getUniquesM + let (subst', ids') = mapAccumL (clone_id subst') subst (ids `zip` us) + pure (subst', ids') -- Just like substIdBndr, except that it always makes a new unique -- It is given the unique to use diff --git a/compiler/GHC/StgToJS/Linker/Utils.hs b/compiler/GHC/StgToJS/Linker/Utils.hs index 36a190fed6..539bc8e593 100644 --- a/compiler/GHC/StgToJS/Linker/Utils.hs +++ b/compiler/GHC/StgToJS/Linker/Utils.hs @@ -41,6 +41,7 @@ import GHC.StgToJS.Types import Prelude import GHC.Platform +import GHC.Utils.Misc import Data.List (isPrefixOf) import System.IO import Data.Char (isSpace) @@ -299,7 +300,7 @@ getJsOptions handle = do parseJsOptions :: String -> [JSOption] parseJsOptions xs = go xs where - trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace + trim = dropWhileEndLE isSpace . dropWhile isSpace go [] = [] go xs = let (tok, rest) = break (== ',') xs tok' = trim tok diff --git a/libraries/base/GHC/Event/Manager.hs b/libraries/base/GHC/Event/Manager.hs index 88bf450426..bdc2c3616a 100644 --- a/libraries/base/GHC/Event/Manager.hs +++ b/libraries/base/GHC/Event/Manager.hs @@ -467,7 +467,7 @@ onFdEvent mgr fd evs IT.delete (fromIntegral fd) tbl >>= maybe (return []) (selectCallbacks tbl) forM_ fdds $ \(FdData reg _ cb) -> cb reg evs where - -- | Here we look through the list of registrations for the fd of interest + -- Here we look through the list of registrations for the fd of interest -- and sort out which match the events that were triggered. We, -- -- 1. re-arm the fd as appropriate diff --git a/libraries/base/GHC/Event/TimerManager.hs b/libraries/base/GHC/Event/TimerManager.hs index b334924a9d..2d68f65902 100644 --- a/libraries/base/GHC/Event/TimerManager.hs +++ b/libraries/base/GHC/Event/TimerManager.hs @@ -175,7 +175,7 @@ step mgr = do state `seq` return (state == Running) where - -- | Call all expired timer callbacks and return the time to the + -- Call all expired timer callbacks and return the time to the -- next timeout. mkTimeout :: IO Timeout mkTimeout = do diff --git a/libraries/base/GHC/Fingerprint.hs b/libraries/base/GHC/Fingerprint.hs index cb5e3456c9..5b803d8a74 100644 --- a/libraries/base/GHC/Fingerprint.hs +++ b/libraries/base/GHC/Fingerprint.hs @@ -84,7 +84,7 @@ getFileHash path = withBinaryFile path ReadMode $ \h -> where _BUFSIZE = 4096 - -- | Loop over _BUFSIZE sized chunks read from the handle, + -- Loop over _BUFSIZE sized chunks read from the handle, -- passing the callback a block of bytes and its size. processChunks :: Handle -> (Ptr Word8 -> Int -> IO ()) -> IO () processChunks h f = allocaBytes _BUFSIZE $ \arrPtr -> diff --git a/libraries/base/GHC/Fingerprint/Type.hs b/libraries/base/GHC/Fingerprint/Type.hs index 234bac1d43..15e9d73983 100644 --- a/libraries/base/GHC/Fingerprint/Type.hs +++ b/libraries/base/GHC/Fingerprint/Type.hs @@ -30,7 +30,7 @@ data Fingerprint = Fingerprint {-# UNPACK #-} !Word64 {-# UNPACK #-} !Word64 instance Show Fingerprint where show (Fingerprint w1 w2) = hex16 w1 ++ hex16 w2 where - -- | Formats a 64 bit number as 16 digits hex. + -- Formats a 64 bit number as 16 digits hex. hex16 :: Word64 -> String hex16 i = let hex = showHex i "" in replicate (16 - length hex) '0' ++ hex diff --git a/libraries/base/GHC/IO/Encoding/Types.hs b/libraries/base/GHC/IO/Encoding/Types.hs index 2f8ffd5e59..d0ee5a3124 100644 --- a/libraries/base/GHC/IO/Encoding/Types.hs +++ b/libraries/base/GHC/IO/Encoding/Types.hs @@ -119,7 +119,6 @@ data TextEncoding -- | @since 4.3.0.0 instance Show TextEncoding where - -- | Returns the value of 'textEncodingName' show te = textEncodingName te -- | @since 4.4.0.0 diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index f1d1cd742c..c51f14382c 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -27,7 +27,6 @@ needing to run the program, by inspecting the object file using 'nm'. import Control.Monad (when, unless) import Data.Bits (shiftL) -import Data.Char (toLower) import Data.List (elemIndex, stripPrefix, intercalate) import Data.Map (Map) import qualified Data.Map as Map |