From gitlab at gitlab.haskell.org Fri Mar 1 00:13:31 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Thu, 29 Feb 2024 19:13:31 -0500 Subject: [Git][ghc/ghc][wip/T24359] More progress Message-ID: <65e11dab5e7f1_1da9522c24190972ae@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24359 at Glasgow Haskell Compiler / GHC Commits: e7a4ac08 by Simon Peyton Jones at 2024-03-01T00:12:31+00:00 More progress - - - - - 2 changed files: - compiler/GHC/HsToCore/Binds.hs - compiler/GHC/Tc/Gen/Sig.hs Changes: ===================================== compiler/GHC/HsToCore/Binds.hs ===================================== @@ -844,7 +844,9 @@ finishSpecPrag :: Maybe CoreExpr -- See the first param of dsSpec -> CoreExpr -- LHS pattern -> InlinePragma -> DsM (Maybe (OrdList (Id,CoreExpr), CoreRule)) -finishSpecPrag mb_poly_rhs spec_bndrs rule_lhs spec_inl +finishSpecPrag mb_poly_rhs rule_bndrs rule_lhs + spec_bndrs spec_bindsno + spec_inl = do { dflags <- getDynFlags ; case decomposeRuleLhs dflags spec_bndrs rule_lhs (mkVarSet spec_bndrs) of { Left msg -> do { diagnosticDs msg; return Nothing } ; ===================================== compiler/GHC/Tc/Gen/Sig.hs ===================================== @@ -823,9 +823,10 @@ We want to generate: RULE forall @a d1 d2 d3 x xs. f @Int @p @p (d1::Eq p) (d2::Eq p) (d3::Ord Int) y y True = $sf @p d1 y - $sf @p (d1::Eq p) (y::p) - = let d3 = $fOrdInt - d2 = d1 + $sf @p (dx::Eq p) (y::p) + = let d1 = dx + d2 = dx + d3 = $fOrdInt in @p @p @Int (d1::Eq p) (d2::Eq p) (d3::OrdInt) y y True Note that @@ -843,7 +844,8 @@ Note that -} tcSpecPrag _poly_id (SpecSigE nm bndrs spec_e inl) - = do { skol_info <- mkSkolemInfo (SpecESkol nm) + = do { let skol_info_anon = SpecESkol nm + ; skol_info <- mkSkolemInfo skol_info_anon ; (tc_lvl, wanted, (id_bndrs, spec_e', rho)) <- pushLevelAndCaptureConstraints $ do { (tv_bndrs, id_bndrs) <- tcRuleBndrs skol_info bndrs @@ -858,36 +860,48 @@ tcSpecPrag _poly_id (SpecSigE nm bndrs spec_e inl) -- Apply the unifications ; seed_tys <- liftZonkM (mapM zonkTcType (rho : map idType id_bndrs)) + -- Quantify ; let (quant_cts, residual_wanted) = getRuleQuantCts wanted quant_preds = ctsPreds quant_cts - + quant_wc = mkSimpleWC quant_cts ; dvs <- candidateQTyVarsOfTypes (quant_preds ++ seed_tys) ; let grown_tcvs = growThetaTyVars quant_preds (tyCoVarsOfTypes seed_tys) ; weeded_dvs = weedOutCandidates (`dVarSetIntersectVarSet` grown_tcvs) dvs - ; skol_info <- mkSkolemInfo (SpecESkol nm) ; qtkvs <- quantifyTyVars skol_info DefaultNonStandardTyVars weeded_dvs - ; bound_evs <- mk_quant_evs quant_cts - ; (implic, ev_binds) <- buildImplicationFor tc_lvl (getSkolemInfo skol_info) - qtkvs bound_evs residual_wanted - ; emitImplications implic - ; spec_binds_var <- newTcEvBinds - ; spec_cts <- setTcLevel tc_lvl $ - runTcSWithEvBinds spec_binds_var $ - solveWanteds (mkSimpleWC quant_cts) + -- Left hand side of the RULE + ; rule_evs <- mk_quant_evs quant_cts + ; (implic1, lhs_binds) <- buildImplicationFor tc_lvl skol_info_anon + qtkvs rule_evs residual_wanted + ; let lhs_expr = mkHsDictLet lhs_binds spec_e' + + -- Right hand side of the RULE + ; (spec_cts, _) <- setTcLevel tc_lvl $ runTcS $ + solveWanteds quant_wc + + -- No need to zonk; any unifications have happened already + ; let min_spec_cts :: [Ct] + min_spec_cts = mkMinimalBySCs ctPred $ + bagToList $ + approximateWC True spec_cts - ; spec_evs <- mk_quant_evs spec_cts + -- rhs_binds uses spec_evs to build rule_evs + ; spec_evs < mapM (newEvVar . ctPred) min_spec_cts + ; (implic2, rhs_binds) <- buildImplicationFor tc_lvl skol_info_anon + qtkvs spec_evs quant_wc + + ; emitImplications (implic1 `unionBags` implic2) - ; let bndrs' = mkTcRuleBndrs bndrs (qtkvs ++ bound_evs ++ id_bndrs) - lhs_expr = mkHsDictLet ev_binds spec_e' ; traceTc "tcSpecPrag:SpecSigE" $ vcat [ text "bndrs:" <+> ppr bndrs' , text "full_e:" <+> ppr full_e' , text "inl:" <+> ppr inl ] - ; return [SpecPragE (qtkvs ++ bound_evs ++ id_bndrs) lhs_expr - (qtkvs ++ spec_evs ++ id_bndrs) (TcEvBinds spec_binds_var) - inl] } - + ; return [SpecPragE { spe_bndrs = qtkvs ++ rule_evs ++ id_bndrs + , spe_lhs = lhs_expr + , spe_rhs = map ctEvTerm min_spec_cst + , spe_spec_bndrs = qtkvs ++ spec_evs ++ id_bndrs + , spe_spec_binds = rhs_binds + , spe_inl = inl }] } tcSpecPrag _ prag = pprPanic "tcSpecPrag" (ppr prag) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e7a4ac08bda1d7ec174a5e735861c3e26325480a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e7a4ac08bda1d7ec174a5e735861c3e26325480a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 00:32:46 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Thu, 29 Feb 2024 19:32:46 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/andreask/fma_globals Message-ID: <65e1222e445ac_1da952368b944989fb@gitlab.mail> Andreas Klebinger pushed new branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/andreask/fma_globals You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 01:39:23 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Thu, 29 Feb 2024 20:39:23 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] x86-ncg: Fix fma codegen when arguments are globals. Message-ID: <65e131caeb819_1da952543aa0810112b@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: c24db25d by Andreas Klebinger at 2024-03-01T02:25:33+01:00 x86-ncg: Fix fma codegen when arguments are globals. Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 3 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - + testsuite/tests/primops/should_run/T24496.hs - testsuite/tests/primops/should_run/all.T Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3424,6 +3424,7 @@ genFMA3Code :: Width -> FMASign -> CmmExpr -> CmmExpr -> CmmExpr -> NatM Register genFMA3Code w signs x y z = do + -- platform <- getPlatform -- For the FMA instruction, we want to compute x * y + z -- @@ -3445,17 +3446,41 @@ genFMA3Code w signs x y z = do -- -- Currently we follow neither of these optimisations, -- opting to always use fmadd213 for simplicity. + -- + let rep = floatFormat w (y_reg, y_code) <- getNonClobberedReg y - (z_reg, z_code) <- getNonClobberedReg z + (z_op, z_code) <- getNonClobberedOperand z x_code <- getAnyReg x + x_tmp <- getNewRegNat rep let - fma213 = FMA3 rep signs FMA213 - code dst - = y_code `appOL` + code, code_direct, code_mov :: Reg -> InstrBlock + -- Ideal: Compute the result directly into dst + code_direct dst = x_code dst `snocOL` + fma213 z_op y_reg dst + -- Fallback: Compute the result into a tmp reg and then move it. + code_mov dst = x_code x_tmp `snocOL` + fma213 z_op y_reg x_tmp `snocOL` + MOV rep (OpReg x_tmp) (OpReg dst) + + code dst = + y_code `appOL` z_code `appOL` - x_code dst `snocOL` - fma213 (OpReg z_reg) y_reg dst + ( if arg_regs_conflict then code_mov dst else code_direct dst ) + + where + -- We would like to compute `x` into `dst`, however if `dst` overlapps + -- with the other arguments we would produce garbage. See #24496 + arg_regs_conflict = + y_reg == dst || + case z_op of + OpReg z_reg -> z_reg == dst + OpAddr amode -> dst `elem` addrModeRegs amode + OpImm {} -> False + + + -- NB: Computing the result into a desired register using Any can be tricky. + -- So for now keep it simple. (See #24496). return (Any rep code) ----------- ===================================== testsuite/tests/primops/should_run/T24496.hs ===================================== @@ -0,0 +1,18 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +import GHC.Exts + +twoProductFloat# :: Float# -> Float# -> (# Float#, Float# #) +twoProductFloat# x y = let !r = x `timesFloat#` y + in (# r, fmsubFloat# x y r #) +{-# NOINLINE twoProductFloat# #-} + +twoProductDouble# :: Double# -> Double# -> (# Double#, Double# #) +twoProductDouble# x y = let !r = x *## y + in (# r, fmsubDouble# x y r #) +{-# NOINLINE twoProductDouble# #-} + +main :: IO () +main = do + print $ case twoProductFloat# 2.0# 3.0# of (# r, s #) -> (F# r, F# s) + print $ case twoProductDouble# 2.0## 3.0## of (# r, s #) -> (D# r, D# s) ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,3 +77,11 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) +test('T24496', normal, compile_and_run, ['']) +test('T24496' + , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) + , js_skip # JS backend doesn't have an FMA implementation + , when(arch('wasm32'), skip) + , when(have_llvm(), extra_ways(["optllvm"])) + ] + , compile_and_run, ['-O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c24db25d1c178352e57fa6ae797ab317e0cdfaf8 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c24db25d1c178352e57fa6ae797ab317e0cdfaf8 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 01:44:10 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Thu, 29 Feb 2024 20:44:10 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] x86-ncg: Fix fma codegen when arguments are globals. Message-ID: <65e132ea1cf1c_1da952552b5981016f8@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: 8e1b0f2c by Andreas Klebinger at 2024-03-01T02:31:03+01:00 x86-ncg: Fix fma codegen when arguments are globals. Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 3 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - + testsuite/tests/primops/should_run/T24496.hs - testsuite/tests/primops/should_run/all.T Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3424,6 +3424,7 @@ genFMA3Code :: Width -> FMASign -> CmmExpr -> CmmExpr -> CmmExpr -> NatM Register genFMA3Code w signs x y z = do + -- platform <- getPlatform -- For the FMA instruction, we want to compute x * y + z -- @@ -3445,17 +3446,44 @@ genFMA3Code w signs x y z = do -- -- Currently we follow neither of these optimisations, -- opting to always use fmadd213 for simplicity. + -- + -- We would like to compute the result directly into the requested register. + -- To do so we must first compute `x` into the destination register. This is + -- only possible if the other arguments don't use the destination register. + -- We check for this and if there is a conflict we move the result only after + -- the computation. See #24496 how this went wrong in the past. let rep = floatFormat w (y_reg, y_code) <- getNonClobberedReg y - (z_reg, z_code) <- getNonClobberedReg z + (z_op, z_code) <- getNonClobberedOperand z x_code <- getAnyReg x + x_tmp <- getNewRegNat rep let - fma213 = FMA3 rep signs FMA213 - code dst - = y_code `appOL` + code, code_direct, code_mov :: Reg -> InstrBlock + -- Ideal: Compute the result directly into dst + code_direct dst = x_code dst `snocOL` + fma213 z_op y_reg dst + -- Fallback: Compute the result into a tmp reg and then move it. + code_mov dst = x_code x_tmp `snocOL` + fma213 z_op y_reg x_tmp `snocOL` + MOV rep (OpReg x_tmp) (OpReg dst) + + code dst = + y_code `appOL` z_code `appOL` - x_code dst `snocOL` - fma213 (OpReg z_reg) y_reg dst + ( if arg_regs_conflict then code_mov dst else code_direct dst ) + + where + + arg_regs_conflict = + y_reg == dst || + case z_op of + OpReg z_reg -> z_reg == dst + OpAddr amode -> dst `elem` addrModeRegs amode + OpImm {} -> False + + + -- NB: Computing the result into a desired register using Any can be tricky. + -- So for now keep it simple. (See #24496). return (Any rep code) ----------- ===================================== testsuite/tests/primops/should_run/T24496.hs ===================================== @@ -0,0 +1,18 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +import GHC.Exts + +twoProductFloat# :: Float# -> Float# -> (# Float#, Float# #) +twoProductFloat# x y = let !r = x `timesFloat#` y + in (# r, fmsubFloat# x y r #) +{-# NOINLINE twoProductFloat# #-} + +twoProductDouble# :: Double# -> Double# -> (# Double#, Double# #) +twoProductDouble# x y = let !r = x *## y + in (# r, fmsubDouble# x y r #) +{-# NOINLINE twoProductDouble# #-} + +main :: IO () +main = do + print $ case twoProductFloat# 2.0# 3.0# of (# r, s #) -> (F# r, F# s) + print $ case twoProductDouble# 2.0## 3.0## of (# r, s #) -> (D# r, D# s) ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,3 +77,11 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) +test('T24496', normal, compile_and_run, ['']) +test('T24496' + , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) + , js_skip # JS backend doesn't have an FMA implementation + , when(arch('wasm32'), skip) + , when(have_llvm(), extra_ways(["optllvm"])) + ] + , compile_and_run, ['-O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8e1b0f2cd214f57bdd7320e78c8fddd8c3631120 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8e1b0f2cd214f57bdd7320e78c8fddd8c3631120 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 02:26:18 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 29 Feb 2024 21:26:18 -0500 Subject: [Git][ghc/ghc][master] testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e13cca6e51e_1da9526710880109196@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 4 changed files: - compiler/GHC/Iface/Ext/Utils.hs - testsuite/tests/hiefile/should_run/T23540.stdout - testsuite/tests/hiefile/should_run/TestUtils.hs - testsuite/tests/hiefile/should_run/all.T Changes: ===================================== compiler/GHC/Iface/Ext/Utils.hs ===================================== @@ -107,7 +107,13 @@ data EvidenceInfo a , evidenceSpan :: RealSrcSpan , evidenceType :: a , evidenceDetails :: Maybe (EvVarSource, Scope, Maybe Span) - } deriving (Eq,Ord,Functor) + } deriving (Eq, Functor) + +instance Ord a => Ord (EvidenceInfo a) where + compare (EvidenceInfo name span typ dets) (EvidenceInfo name' span' typ' dets') = + case stableNameCmp name name' of + EQ -> compare (span, typ, dets) (span', typ', dets') + r -> r instance (Outputable a) => Outputable (EvidenceInfo a) where ppr (EvidenceInfo name span typ dets) = ===================================== testsuite/tests/hiefile/should_run/T23540.stdout ===================================== @@ -124,35 +124,35 @@ At point (49,14), we found: At point (61,7), we found: ========================== ┌ -│ $dFunctor at T23540.hs:1:1, of type: Functor Identity' -│ is an evidence variable bound by a let, depending on: [$fFunctorIdentity'] +│ $dApplicative at T23540.hs:1:1, of type: Applicative Identity' +│ is an evidence variable bound by a let, depending on: [$fApplicativeIdentity'] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fFunctorIdentity' at T23540.hs:54:10-26, of type: Functor Identity' - │ is an evidence variable bound by an instance of class Functor + │ $fApplicativeIdentity' at T23540.hs:56:10-30, of type: Applicative Identity' + │ is an evidence variable bound by an instance of class Applicative │ with scope: ModuleScope │ - │ Defined at T23540.hs:54:10 + │ Defined at T23540.hs:56:10 └ ┌ -│ $dApplicative at T23540.hs:1:1, of type: Applicative Identity' -│ is an evidence variable bound by a let, depending on: [$fApplicativeIdentity'] +│ $dFunctor at T23540.hs:1:1, of type: Functor Identity' +│ is an evidence variable bound by a let, depending on: [$fFunctorIdentity'] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fApplicativeIdentity' at T23540.hs:56:10-30, of type: Applicative Identity' - │ is an evidence variable bound by an instance of class Applicative + │ $fFunctorIdentity' at T23540.hs:54:10-26, of type: Functor Identity' + │ is an evidence variable bound by an instance of class Functor │ with scope: ModuleScope │ - │ Defined at T23540.hs:56:10 + │ Defined at T23540.hs:54:10 └ ========================== @@ -202,33 +202,34 @@ At point (69,4), we found: At point (82,6), we found: ========================== ┌ -│ $dOrd at T23540.hs:1:1, of type: Ord Modulo1 -│ is an evidence variable bound by a let, depending on: [$fOrdModulo1] +│ $dNum at T23540.hs:1:1, of type: Num Modulo1 +│ is an evidence variable bound by a let, depending on: [$fNumModulo1] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fOrdModulo1 at T23540.hs:8:35-37, of type: Ord Modulo1 - │ is an evidence variable bound by an instance of class Ord + │ $fNumModulo1 at T23540.hs:10:10-20, of type: Num Modulo1 + │ is an evidence variable bound by an instance of class Num │ with scope: ModuleScope │ - │ Defined at T23540.hs:8:35 + │ Defined at T23540.hs:10:10 └ ┌ -│ $dNum at T23540.hs:1:1, of type: Num Modulo1 -│ is an evidence variable bound by a let, depending on: [$fNumModulo1] +│ $dOrd at T23540.hs:1:1, of type: Ord Modulo1 +│ is an evidence variable bound by a let, depending on: [$fOrdModulo1] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fNumModulo1 at T23540.hs:10:10-20, of type: Num Modulo1 - │ is an evidence variable bound by an instance of class Num + │ $fOrdModulo1 at T23540.hs:8:35-37, of type: Ord Modulo1 + │ is an evidence variable bound by an instance of class Ord │ with scope: ModuleScope │ - │ Defined at T23540.hs:10:10 - └ \ No newline at end of file + │ Defined at T23540.hs:8:35 + └ + ===================================== testsuite/tests/hiefile/should_run/TestUtils.hs ===================================== @@ -10,6 +10,7 @@ module TestUtils ) where import System.Environment +import Data.List (sort) import Data.Tree import GHC.Types.Name.Cache import GHC.Types.SrcLoc @@ -20,13 +21,13 @@ import qualified GHC.Utils.Outputable as O import GHC.Iface.Ext.Binary import GHC.Iface.Ext.Types import GHC.Iface.Ext.Utils - + import GHC.Driver.Session import GHC.SysTools makeNc :: IO NameCache makeNc = initNameCache 'z' [] - + dynFlagsForPrinting :: String -> IO DynFlags dynFlagsForPrinting libdir = do systemSettings <- initSysTools libdir @@ -53,7 +54,7 @@ explainEv df hf refmap point = do putStrLn $ replicate 26 '=' putStr $ drawForest ptrees where - trees = getEvidenceTreesAtPoint hf refmap point + trees = sort $ getEvidenceTreesAtPoint hf refmap point ptrees = fmap (pprint . fmap expandType) <$> trees ===================================== testsuite/tests/hiefile/should_run/all.T ===================================== @@ -5,5 +5,5 @@ test('T23492', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUti test('RecordDotTypes', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('SpliceTypes', [req_th, extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('HieVdq', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) -test('T23540', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs']), when(arch('i386'), fragile(24449))], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('T23540', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('T23120', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3836a110577b5c9343915fd96c1b2c64217e0082 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3836a110577b5c9343915fd96c1b2c64217e0082 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 02:26:57 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 29 Feb 2024 21:26:57 -0500 Subject: [Git][ghc/ghc][master] Reduce AtomicModifyIORef increment count Message-ID: <65e13cf14b4ae_1da95269b70701122b1@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2 changed files: - libraries/base/tests/AtomicModifyIORef.hs - libraries/base/tests/AtomicModifyIORef.stdout Changes: ===================================== libraries/base/tests/AtomicModifyIORef.hs ===================================== @@ -5,7 +5,7 @@ import Data.IORef main :: IO () main = do let nThreads = 10 - nIncrs = 10000000 + nIncrs = 10000 ref <- newIORef (42 :: Int) dones <- replicateM nThreads $ do ===================================== libraries/base/tests/AtomicModifyIORef.stdout ===================================== @@ -8,4 +8,4 @@ . . . -100000042 +100042 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/960c8d47f064644617a605b1225a18e9350be995 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/960c8d47f064644617a605b1225a18e9350be995 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 02:57:39 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 29 Feb 2024 21:57:39 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 8 commits: testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e144239d151_1da9527b8494c11585a@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 3e18a9e3 by Matthew Pickering at 2024-02-29T21:57:23-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - 95683a46 by Matthew Pickering at 2024-02-29T21:57:23-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 223e8608 by Matthew Pickering at 2024-02-29T21:57:23-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - 2e1eabdc by Matthew Pickering at 2024-02-29T21:57:23-05:00 Bump minimum bootstrap version to 9.6 - - - - - 8b2fa205 by Matthew Pickering at 2024-02-29T21:57:23-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - bdb8d342 by Matthew Pickering at 2024-02-29T21:57:23-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - 14 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Iface/Ext/Utils.hs - configure.ac - hadrian/src/Rules/BinaryDist.hs - libraries/base/tests/AtomicModifyIORef.hs - libraries/base/tests/AtomicModifyIORef.stdout - testsuite/tests/hiefile/should_run/T23540.stdout - testsuite/tests/hiefile/should_run/TestUtils.hs - testsuite/tests/hiefile/should_run/all.T Changes: ===================================== .gitlab-ci.yml ===================================== @@ -2,7 +2,7 @@ variables: GIT_SSL_NO_VERIFY: "1" # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: 08bdbb85d6711e4df23d97e1cbdb557fe752b0a4 + DOCKER_REV: 7f63b34ac87b85470eef9c668e9528e8e2f5b46a # Sequential version number of all cached things. # Bump to invalidate GitLab CI cache. @@ -101,8 +101,6 @@ workflow: # which versions of GHC to allow bootstrap with .bootstrap_matrix : &bootstrap_matrix matrix: - - GHC_VERSION: 9.4.8 - DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10-ghc9_4:$DOCKER_REV" - GHC_VERSION: 9.6.4 DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10-ghc9_6:$DOCKER_REV" - GHC_VERSION: 9.8.1 ===================================== .gitlab/ci.sh ===================================== @@ -151,6 +151,8 @@ function mingw_init() { # We always use mingw64 Python to avoid path length issues like #17483. export PYTHON="/mingw64/bin/python3" + # And need to use sphinx-build from the environment + export SPHINXBUILD="/mingw64/bin/sphinx-build.exe" } # This will contain GHC's local native toolchain @@ -305,7 +307,7 @@ function fetch_cabal() { fail "neither CABAL nor CABAL_INSTALL_VERSION are not set" fi - start_section "fetch GHC" + start_section "fetch cabal" case "$(uname)" in # N.B. Windows uses zip whereas all others use .tar.xz MSYS_*|MINGW*) @@ -332,7 +334,7 @@ function fetch_cabal() { mv cabal "$toolchain/bin" ;; esac - end_section "fetch GHC" + end_section "fetch cabal" fi } ===================================== .gitlab/darwin/nix/sources.json ===================================== @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "master", + "branch": "nixos-unstable", "description": "Nix Packages collection", "homepage": "", "owner": "nixos", "repo": "nixpkgs", - "rev": "ce1aa29621356706746c53e2d480da7c68f6c972", - "sha256": "sha256:1sbs3gi1nf4rcbmnw69fw0fpvb3qvlsa84hqimv78vkpd6xb0bgg", + "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "sha256": "1v9sy2i2dy3qksx4mf81gwzfl0jzpqccfkzq7fjxgq832f9d255i", "type": "tarball", - "url": "https://github.com/nixos/nixpkgs/archive/ce1aa29621356706746c53e2d480da7c68f6c972.tar.gz", + "url": "https://github.com/nixos/nixpkgs/archive/73de017ef2d18a04ac4bfd0c02650007ccb31c2a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } ===================================== .gitlab/darwin/toolchain.nix ===================================== @@ -4,6 +4,7 @@ let sources = import ./nix/sources.nix; nixpkgsSrc = sources.nixpkgs; pkgs = import nixpkgsSrc { inherit system; }; + hostPkgs = import nixpkgsSrc { }; in let @@ -13,23 +14,26 @@ let targetTriple = pkgs.stdenv.targetPlatform.config; ghcBindists = let version = ghc.version; in { - aarch64-darwin = pkgs.fetchurl { + aarch64-darwin = hostPkgs.fetchurl { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz"; - sha256 = "sha256-tQUHsingxBizLktswGAoi6lJf92RKWLjsHB9CisANlg="; + sha256 = "sha256-c1GTMJf3/yiW/t4QL532EswD5JVlgA4getkfsxj4TaA="; }; - x86_64-darwin = pkgs.fetchurl { + x86_64-darwin = hostPkgs.fetchurl { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; - sha256 = "sha256-OjXjVe+ZODDCc/hqtihqqz6CX25TKI0ZgORzkR5O3pQ="; + sha256 = "sha256-LrYniMG0phsvyW6dhQC+3ompvzcxnwAe6GezEqqzoTQ="; }; + }; ghc = pkgs.stdenv.mkDerivation rec { - version = "9.4.4"; + # Using 9.6.2 because of #24050 + version = "9.6.2"; name = "ghc"; src = ghcBindists.${pkgs.stdenv.hostPlatform.system}; configureFlags = [ "CC=/usr/bin/clang" "CLANG=/usr/bin/clang" + "AR=/usr/bin/ar" "LLC=${llvm}/bin/llc" "OPT=${llvm}/bin/opt" "CONF_CC_OPTS_STAGE2=--target=${targetTriple}" @@ -92,7 +96,7 @@ let }; fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; }; - llvm = pkgs.llvm_11; + llvm = pkgs.llvm_15; in pkgs.writeTextFile { name = "toolchain"; ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -397,8 +397,8 @@ opsysVariables _ FreeBSD13 = mconcat -- [1] https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html) "CONFIGURE_ARGS" =: "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib" , "HADRIAN_ARGS" =: "--docs=no-sphinx" - , "GHC_VERSION" =: "9.4.3" - , "CABAL_INSTALL_VERSION" =: "3.8.1.0" + , "GHC_VERSION" =: "9.6.4" + , "CABAL_INSTALL_VERSION" =: "3.10.2.0" ] opsysVariables _ (Linux distro) = distroVariables distro opsysVariables AArch64 (Darwin {}) = @@ -407,7 +407,7 @@ opsysVariables AArch64 (Darwin {}) = , "LANG" =: "en_US.UTF-8" , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin - , "HADRIAN_ARGS" =: "--docs=no-sphinx" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] opsysVariables Amd64 (Darwin {}) = mconcat [ "NIX_SYSTEM" =: "x86_64-darwin" @@ -421,22 +421,21 @@ opsysVariables Amd64 (Darwin {}) = , "LANG" =: "en_US.UTF-8" , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin - , "HADRIAN_ARGS" =: "--docs=no-sphinx" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] opsysVariables _ (Windows {}) = mconcat [ "MSYSTEM" =: "CLANG64" - , "HADRIAN_ARGS" =: "--docs=no-sphinx" , "LANG" =: "en_US.UTF-8" - , "CABAL_INSTALL_VERSION" =: "3.8.1.0" - , "GHC_VERSION" =: "9.4.3" ] + , "CABAL_INSTALL_VERSION" =: "3.10.2.0" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" + , "GHC_VERSION" =: "9.6.4" ] opsysVariables _ _ = mempty alpineVariables = mconcat [ -- Due to #20266 "CONFIGURE_ARGS" =: "--disable-ld-override" , "INSTALL_CONFIGURE_ARGS" =: "--disable-ld-override" - , "HADRIAN_ARGS" =: "--docs=no-sphinx" -- encoding004: due to lack of locale support -- T10458, ghcilink002: due to #17869 , "BROKEN_TESTS" =: "encoding004 T10458" @@ -450,9 +449,6 @@ distroVariables Centos7 = mconcat [ "HADRIAN_ARGS" =: "--docs=no-sphinx" , "BROKEN_TESTS" =: "T22012" -- due to #23979 ] -distroVariables Rocky8 = mconcat [ - "HADRIAN_ARGS" =: "--docs=no-sphinx" - ] distroVariables Fedora33 = mconcat -- LLC/OPT do not work for some reason in our fedora images -- These tests fail with this error: T11649 T5681 T7571 T8131b ===================================== .gitlab/jobs.yaml ===================================== @@ -57,7 +57,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", "NIX_SYSTEM": "aarch64-darwin", @@ -305,7 +305,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", "NIX_SYSTEM": "aarch64-darwin", @@ -372,7 +372,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "aarch64-linux-alpine3_18-validate", @@ -684,7 +683,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", "NIX_SYSTEM": "x86_64-darwin", @@ -751,9 +750,9 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-freebsd13-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", + "GHC_VERSION": "9.6.4", "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-freebsd13-validate", @@ -818,7 +817,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-int_native-validate+fully_static", @@ -883,7 +881,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate", @@ -948,7 +945,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static", @@ -1013,7 +1009,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_18-validate", @@ -2526,7 +2521,6 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-rocky8-validate", "XZ_OPT": "-9" @@ -2707,10 +2701,10 @@ "BIGNUM_BACKEND": "native", "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", @@ -2769,10 +2763,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", @@ -2837,7 +2831,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", @@ -2905,7 +2899,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3162,7 +3156,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", @@ -3233,7 +3227,7 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "release+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3299,7 +3293,7 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "release+fully_static+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3365,7 +3359,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3431,7 +3425,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -4143,7 +4137,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-rocky8-release", @@ -4329,10 +4323,10 @@ "BIGNUM_BACKEND": "native", "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release", "BUILD_FLAVOUR": "release", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", @@ -4392,10 +4386,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-release", "BUILD_FLAVOUR": "release", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", @@ -4461,7 +4455,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", "NIX_SYSTEM": "x86_64-darwin", @@ -4527,9 +4521,9 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-freebsd13-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", + "GHC_VERSION": "9.6.4", "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-freebsd13-validate" @@ -4593,7 +4587,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static" @@ -5585,10 +5578,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", ===================================== compiler/GHC/Iface/Ext/Utils.hs ===================================== @@ -107,7 +107,13 @@ data EvidenceInfo a , evidenceSpan :: RealSrcSpan , evidenceType :: a , evidenceDetails :: Maybe (EvVarSource, Scope, Maybe Span) - } deriving (Eq,Ord,Functor) + } deriving (Eq, Functor) + +instance Ord a => Ord (EvidenceInfo a) where + compare (EvidenceInfo name span typ dets) (EvidenceInfo name' span' typ' dets') = + case stableNameCmp name name' of + EQ -> compare (span, typ, dets) (span', typ', dets') + r -> r instance (Outputable a) => Outputable (EvidenceInfo a) where ppr (EvidenceInfo name span typ dets) = ===================================== configure.ac ===================================== @@ -205,7 +205,7 @@ if test "$WithGhc" = "" then AC_MSG_ERROR([GHC is required.]) fi -MinBootGhcVersion="9.4" +MinBootGhcVersion="9.6" FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[$MinBootGhcVersion], [AC_MSG_ERROR([GHC version $MinBootGhcVersion or later is required to compile GHC.])]) ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -145,12 +145,7 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - -- We 'need' all binaries and libraries - all_pkgs <- stagePackages Stage1 - (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs - cross <- flag CrossCompiling - iserv_targets <- if cross then pure [] else iservBins - need (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull @@ -164,6 +159,22 @@ bindistRules = do rtsIncludeDir = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir -/- "include" + -- We 'need' all binaries and libraries + all_pkgs <- stagePackages Stage1 + (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs + cross <- flag CrossCompiling + iserv_targets <- if cross then pure [] else iservBins + + let lib_exe_targets = (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + + let doc_target = if cross then [] else ["docs"] + + let other_targets = map (bindistFilesDir -/-) (["configure", "Makefile"] ++ bindistInstallFiles) + let all_targets = lib_exe_targets ++ doc_target ++ other_targets + + -- Better parallelism if everything is needed together. + need all_targets + -- We create the bindist directory at /bindist/ghc-X.Y.Z-platform/ -- and populate it with Stage2 build results createDirectory bindistFilesDir @@ -232,7 +243,6 @@ bindistRules = do cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["recache"] - unless cross $ need ["docs"] -- TODO: we should only embed the docs that have been generated -- depending on the current settings (flavours' "ghcDocs" field and @@ -274,8 +284,6 @@ bindistRules = do -- We then 'need' all the files necessary to configure and install -- (as in, './configure [...] && make install') this build on some -- other machine. - need $ map (bindistFilesDir -/-) - (["configure", "Makefile"] ++ bindistInstallFiles) copyFile ("hadrian" -/- "bindist" -/- "config.mk.in") (bindistFilesDir -/- "config.mk.in") generateBuildMk >>= writeFile' (bindistFilesDir -/- "build.mk") copyFile ("hadrian" -/- "cfg" -/- "default.target.in") (bindistFilesDir -/- "default.target.in") ===================================== libraries/base/tests/AtomicModifyIORef.hs ===================================== @@ -5,7 +5,7 @@ import Data.IORef main :: IO () main = do let nThreads = 10 - nIncrs = 10000000 + nIncrs = 10000 ref <- newIORef (42 :: Int) dones <- replicateM nThreads $ do ===================================== libraries/base/tests/AtomicModifyIORef.stdout ===================================== @@ -8,4 +8,4 @@ . . . -100000042 +100042 ===================================== testsuite/tests/hiefile/should_run/T23540.stdout ===================================== @@ -124,35 +124,35 @@ At point (49,14), we found: At point (61,7), we found: ========================== ┌ -│ $dFunctor at T23540.hs:1:1, of type: Functor Identity' -│ is an evidence variable bound by a let, depending on: [$fFunctorIdentity'] +│ $dApplicative at T23540.hs:1:1, of type: Applicative Identity' +│ is an evidence variable bound by a let, depending on: [$fApplicativeIdentity'] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fFunctorIdentity' at T23540.hs:54:10-26, of type: Functor Identity' - │ is an evidence variable bound by an instance of class Functor + │ $fApplicativeIdentity' at T23540.hs:56:10-30, of type: Applicative Identity' + │ is an evidence variable bound by an instance of class Applicative │ with scope: ModuleScope │ - │ Defined at T23540.hs:54:10 + │ Defined at T23540.hs:56:10 └ ┌ -│ $dApplicative at T23540.hs:1:1, of type: Applicative Identity' -│ is an evidence variable bound by a let, depending on: [$fApplicativeIdentity'] +│ $dFunctor at T23540.hs:1:1, of type: Functor Identity' +│ is an evidence variable bound by a let, depending on: [$fFunctorIdentity'] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fApplicativeIdentity' at T23540.hs:56:10-30, of type: Applicative Identity' - │ is an evidence variable bound by an instance of class Applicative + │ $fFunctorIdentity' at T23540.hs:54:10-26, of type: Functor Identity' + │ is an evidence variable bound by an instance of class Functor │ with scope: ModuleScope │ - │ Defined at T23540.hs:56:10 + │ Defined at T23540.hs:54:10 └ ========================== @@ -202,33 +202,34 @@ At point (69,4), we found: At point (82,6), we found: ========================== ┌ -│ $dOrd at T23540.hs:1:1, of type: Ord Modulo1 -│ is an evidence variable bound by a let, depending on: [$fOrdModulo1] +│ $dNum at T23540.hs:1:1, of type: Num Modulo1 +│ is an evidence variable bound by a let, depending on: [$fNumModulo1] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fOrdModulo1 at T23540.hs:8:35-37, of type: Ord Modulo1 - │ is an evidence variable bound by an instance of class Ord + │ $fNumModulo1 at T23540.hs:10:10-20, of type: Num Modulo1 + │ is an evidence variable bound by an instance of class Num │ with scope: ModuleScope │ - │ Defined at T23540.hs:8:35 + │ Defined at T23540.hs:10:10 └ ┌ -│ $dNum at T23540.hs:1:1, of type: Num Modulo1 -│ is an evidence variable bound by a let, depending on: [$fNumModulo1] +│ $dOrd at T23540.hs:1:1, of type: Ord Modulo1 +│ is an evidence variable bound by a let, depending on: [$fOrdModulo1] │ with scope: ModuleScope │ │ Defined at └ | `- ┌ - │ $fNumModulo1 at T23540.hs:10:10-20, of type: Num Modulo1 - │ is an evidence variable bound by an instance of class Num + │ $fOrdModulo1 at T23540.hs:8:35-37, of type: Ord Modulo1 + │ is an evidence variable bound by an instance of class Ord │ with scope: ModuleScope │ - │ Defined at T23540.hs:10:10 - └ \ No newline at end of file + │ Defined at T23540.hs:8:35 + └ + ===================================== testsuite/tests/hiefile/should_run/TestUtils.hs ===================================== @@ -10,6 +10,7 @@ module TestUtils ) where import System.Environment +import Data.List (sort) import Data.Tree import GHC.Types.Name.Cache import GHC.Types.SrcLoc @@ -20,13 +21,13 @@ import qualified GHC.Utils.Outputable as O import GHC.Iface.Ext.Binary import GHC.Iface.Ext.Types import GHC.Iface.Ext.Utils - + import GHC.Driver.Session import GHC.SysTools makeNc :: IO NameCache makeNc = initNameCache 'z' [] - + dynFlagsForPrinting :: String -> IO DynFlags dynFlagsForPrinting libdir = do systemSettings <- initSysTools libdir @@ -53,7 +54,7 @@ explainEv df hf refmap point = do putStrLn $ replicate 26 '=' putStr $ drawForest ptrees where - trees = getEvidenceTreesAtPoint hf refmap point + trees = sort $ getEvidenceTreesAtPoint hf refmap point ptrees = fmap (pprint . fmap expandType) <$> trees ===================================== testsuite/tests/hiefile/should_run/all.T ===================================== @@ -5,5 +5,5 @@ test('T23492', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUti test('RecordDotTypes', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('SpliceTypes', [req_th, extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('HieVdq', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) -test('T23540', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs']), when(arch('i386'), fragile(24449))], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('T23540', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('T23120', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/32bbeddf760ea20702cafd1a23d248b1c20af615...bdb8d342c63b7f2ea23a5a07587d39e76ea569a3 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/32bbeddf760ea20702cafd1a23d248b1c20af615...bdb8d342c63b7f2ea23a5a07587d39e76ea569a3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 07:28:35 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 01 Mar 2024 02:28:35 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: hadrian: Improve parallelism in binary-dist-dir rule Message-ID: <65e183a369187_1e361e284ad1c560a2@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 5f63616f by Matthew Pickering at 2024-03-01T02:27:59-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - 90d7e879 by Matthew Pickering at 2024-03-01T02:28:00-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 598e3105 by Matthew Pickering at 2024-03-01T02:28:00-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - 882ad3b9 by Matthew Pickering at 2024-03-01T02:28:00-05:00 Bump minimum bootstrap version to 9.6 - - - - - 91a3b79b by Matthew Pickering at 2024-03-01T02:28:00-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 4cb5e8c9 by Matthew Pickering at 2024-03-01T02:28:00-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - 8 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - configure.ac - hadrian/src/Rules/BinaryDist.hs Changes: ===================================== .gitlab-ci.yml ===================================== @@ -2,7 +2,7 @@ variables: GIT_SSL_NO_VERIFY: "1" # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: 08bdbb85d6711e4df23d97e1cbdb557fe752b0a4 + DOCKER_REV: 7f63b34ac87b85470eef9c668e9528e8e2f5b46a # Sequential version number of all cached things. # Bump to invalidate GitLab CI cache. @@ -101,8 +101,6 @@ workflow: # which versions of GHC to allow bootstrap with .bootstrap_matrix : &bootstrap_matrix matrix: - - GHC_VERSION: 9.4.8 - DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10-ghc9_4:$DOCKER_REV" - GHC_VERSION: 9.6.4 DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10-ghc9_6:$DOCKER_REV" - GHC_VERSION: 9.8.1 ===================================== .gitlab/ci.sh ===================================== @@ -151,6 +151,8 @@ function mingw_init() { # We always use mingw64 Python to avoid path length issues like #17483. export PYTHON="/mingw64/bin/python3" + # And need to use sphinx-build from the environment + export SPHINXBUILD="/mingw64/bin/sphinx-build.exe" } # This will contain GHC's local native toolchain @@ -305,7 +307,7 @@ function fetch_cabal() { fail "neither CABAL nor CABAL_INSTALL_VERSION are not set" fi - start_section "fetch GHC" + start_section "fetch cabal" case "$(uname)" in # N.B. Windows uses zip whereas all others use .tar.xz MSYS_*|MINGW*) @@ -332,7 +334,7 @@ function fetch_cabal() { mv cabal "$toolchain/bin" ;; esac - end_section "fetch GHC" + end_section "fetch cabal" fi } ===================================== .gitlab/darwin/nix/sources.json ===================================== @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "master", + "branch": "nixos-unstable", "description": "Nix Packages collection", "homepage": "", "owner": "nixos", "repo": "nixpkgs", - "rev": "ce1aa29621356706746c53e2d480da7c68f6c972", - "sha256": "sha256:1sbs3gi1nf4rcbmnw69fw0fpvb3qvlsa84hqimv78vkpd6xb0bgg", + "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "sha256": "1v9sy2i2dy3qksx4mf81gwzfl0jzpqccfkzq7fjxgq832f9d255i", "type": "tarball", - "url": "https://github.com/nixos/nixpkgs/archive/ce1aa29621356706746c53e2d480da7c68f6c972.tar.gz", + "url": "https://github.com/nixos/nixpkgs/archive/73de017ef2d18a04ac4bfd0c02650007ccb31c2a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } ===================================== .gitlab/darwin/toolchain.nix ===================================== @@ -4,6 +4,7 @@ let sources = import ./nix/sources.nix; nixpkgsSrc = sources.nixpkgs; pkgs = import nixpkgsSrc { inherit system; }; + hostPkgs = import nixpkgsSrc { }; in let @@ -13,23 +14,26 @@ let targetTriple = pkgs.stdenv.targetPlatform.config; ghcBindists = let version = ghc.version; in { - aarch64-darwin = pkgs.fetchurl { + aarch64-darwin = hostPkgs.fetchurl { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz"; - sha256 = "sha256-tQUHsingxBizLktswGAoi6lJf92RKWLjsHB9CisANlg="; + sha256 = "sha256-c1GTMJf3/yiW/t4QL532EswD5JVlgA4getkfsxj4TaA="; }; - x86_64-darwin = pkgs.fetchurl { + x86_64-darwin = hostPkgs.fetchurl { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; - sha256 = "sha256-OjXjVe+ZODDCc/hqtihqqz6CX25TKI0ZgORzkR5O3pQ="; + sha256 = "sha256-LrYniMG0phsvyW6dhQC+3ompvzcxnwAe6GezEqqzoTQ="; }; + }; ghc = pkgs.stdenv.mkDerivation rec { - version = "9.4.4"; + # Using 9.6.2 because of #24050 + version = "9.6.2"; name = "ghc"; src = ghcBindists.${pkgs.stdenv.hostPlatform.system}; configureFlags = [ "CC=/usr/bin/clang" "CLANG=/usr/bin/clang" + "AR=/usr/bin/ar" "LLC=${llvm}/bin/llc" "OPT=${llvm}/bin/opt" "CONF_CC_OPTS_STAGE2=--target=${targetTriple}" @@ -92,7 +96,7 @@ let }; fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; }; - llvm = pkgs.llvm_11; + llvm = pkgs.llvm_15; in pkgs.writeTextFile { name = "toolchain"; ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -397,8 +397,8 @@ opsysVariables _ FreeBSD13 = mconcat -- [1] https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html) "CONFIGURE_ARGS" =: "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib" , "HADRIAN_ARGS" =: "--docs=no-sphinx" - , "GHC_VERSION" =: "9.4.3" - , "CABAL_INSTALL_VERSION" =: "3.8.1.0" + , "GHC_VERSION" =: "9.6.4" + , "CABAL_INSTALL_VERSION" =: "3.10.2.0" ] opsysVariables _ (Linux distro) = distroVariables distro opsysVariables AArch64 (Darwin {}) = @@ -407,7 +407,7 @@ opsysVariables AArch64 (Darwin {}) = , "LANG" =: "en_US.UTF-8" , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin - , "HADRIAN_ARGS" =: "--docs=no-sphinx" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] opsysVariables Amd64 (Darwin {}) = mconcat [ "NIX_SYSTEM" =: "x86_64-darwin" @@ -421,22 +421,21 @@ opsysVariables Amd64 (Darwin {}) = , "LANG" =: "en_US.UTF-8" , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin - , "HADRIAN_ARGS" =: "--docs=no-sphinx" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] opsysVariables _ (Windows {}) = mconcat [ "MSYSTEM" =: "CLANG64" - , "HADRIAN_ARGS" =: "--docs=no-sphinx" , "LANG" =: "en_US.UTF-8" - , "CABAL_INSTALL_VERSION" =: "3.8.1.0" - , "GHC_VERSION" =: "9.4.3" ] + , "CABAL_INSTALL_VERSION" =: "3.10.2.0" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" + , "GHC_VERSION" =: "9.6.4" ] opsysVariables _ _ = mempty alpineVariables = mconcat [ -- Due to #20266 "CONFIGURE_ARGS" =: "--disable-ld-override" , "INSTALL_CONFIGURE_ARGS" =: "--disable-ld-override" - , "HADRIAN_ARGS" =: "--docs=no-sphinx" -- encoding004: due to lack of locale support -- T10458, ghcilink002: due to #17869 , "BROKEN_TESTS" =: "encoding004 T10458" @@ -450,9 +449,6 @@ distroVariables Centos7 = mconcat [ "HADRIAN_ARGS" =: "--docs=no-sphinx" , "BROKEN_TESTS" =: "T22012" -- due to #23979 ] -distroVariables Rocky8 = mconcat [ - "HADRIAN_ARGS" =: "--docs=no-sphinx" - ] distroVariables Fedora33 = mconcat -- LLC/OPT do not work for some reason in our fedora images -- These tests fail with this error: T11649 T5681 T7571 T8131b ===================================== .gitlab/jobs.yaml ===================================== @@ -57,7 +57,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", "NIX_SYSTEM": "aarch64-darwin", @@ -305,7 +305,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", "NIX_SYSTEM": "aarch64-darwin", @@ -372,7 +372,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "aarch64-linux-alpine3_18-validate", @@ -684,7 +683,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", "NIX_SYSTEM": "x86_64-darwin", @@ -751,9 +750,9 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-freebsd13-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", + "GHC_VERSION": "9.6.4", "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-freebsd13-validate", @@ -818,7 +817,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-int_native-validate+fully_static", @@ -883,7 +881,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate", @@ -948,7 +945,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static", @@ -1013,7 +1009,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_18-validate", @@ -2526,7 +2521,6 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-rocky8-validate", "XZ_OPT": "-9" @@ -2707,10 +2701,10 @@ "BIGNUM_BACKEND": "native", "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", @@ -2769,10 +2763,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", @@ -2837,7 +2831,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", @@ -2905,7 +2899,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3162,7 +3156,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", @@ -3233,7 +3227,7 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "release+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3299,7 +3293,7 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "release+fully_static+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3365,7 +3359,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3431,7 +3425,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -4143,7 +4137,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-rocky8-release", @@ -4329,10 +4323,10 @@ "BIGNUM_BACKEND": "native", "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release", "BUILD_FLAVOUR": "release", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", @@ -4392,10 +4386,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-release", "BUILD_FLAVOUR": "release", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", @@ -4461,7 +4455,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", "NIX_SYSTEM": "x86_64-darwin", @@ -4527,9 +4521,9 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-freebsd13-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", + "GHC_VERSION": "9.6.4", "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-freebsd13-validate" @@ -4593,7 +4587,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static" @@ -5585,10 +5578,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", ===================================== configure.ac ===================================== @@ -205,7 +205,7 @@ if test "$WithGhc" = "" then AC_MSG_ERROR([GHC is required.]) fi -MinBootGhcVersion="9.4" +MinBootGhcVersion="9.6" FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[$MinBootGhcVersion], [AC_MSG_ERROR([GHC version $MinBootGhcVersion or later is required to compile GHC.])]) ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -145,12 +145,7 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - -- We 'need' all binaries and libraries - all_pkgs <- stagePackages Stage1 - (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs - cross <- flag CrossCompiling - iserv_targets <- if cross then pure [] else iservBins - need (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull @@ -164,6 +159,22 @@ bindistRules = do rtsIncludeDir = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir -/- "include" + -- We 'need' all binaries and libraries + all_pkgs <- stagePackages Stage1 + (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs + cross <- flag CrossCompiling + iserv_targets <- if cross then pure [] else iservBins + + let lib_exe_targets = (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + + let doc_target = if cross then [] else ["docs"] + + let other_targets = map (bindistFilesDir -/-) (["configure", "Makefile"] ++ bindistInstallFiles) + let all_targets = lib_exe_targets ++ doc_target ++ other_targets + + -- Better parallelism if everything is needed together. + need all_targets + -- We create the bindist directory at /bindist/ghc-X.Y.Z-platform/ -- and populate it with Stage2 build results createDirectory bindistFilesDir @@ -232,7 +243,6 @@ bindistRules = do cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["recache"] - unless cross $ need ["docs"] -- TODO: we should only embed the docs that have been generated -- depending on the current settings (flavours' "ghcDocs" field and @@ -274,8 +284,6 @@ bindistRules = do -- We then 'need' all the files necessary to configure and install -- (as in, './configure [...] && make install') this build on some -- other machine. - need $ map (bindistFilesDir -/-) - (["configure", "Makefile"] ++ bindistInstallFiles) copyFile ("hadrian" -/- "bindist" -/- "config.mk.in") (bindistFilesDir -/- "config.mk.in") generateBuildMk >>= writeFile' (bindistFilesDir -/- "build.mk") copyFile ("hadrian" -/- "cfg" -/- "default.target.in") (bindistFilesDir -/- "default.target.in") View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bdb8d342c63b7f2ea23a5a07587d39e76ea569a3...4cb5e8c9f4a446c147f4c3d316852b135edae0cb -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bdb8d342c63b7f2ea23a5a07587d39e76ea569a3...4cb5e8c9f4a446c147f4c3d316852b135edae0cb You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 09:35:20 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Fri, 01 Mar 2024 04:35:20 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] 3 commits: Linker: Add local labels to the GOT Message-ID: <65e1a15851fa2_cb85dcb6a1010263a@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: c0eb04d3 by Sven Tennie at 2024-03-01T10:01:58+01:00 Linker: Add local labels to the GOT - - - - - b5050132 by Sven Tennie at 2024-03-01T10:05:17+01:00 Linker: uint32_t addend This seems to be a good representation: - We're dealing with negative values as well (e.g. negative PC offset) - We cannot deal with more than 20 + 12 = 32 bits - - - - - 77b14c9a by Sven Tennie at 2024-03-01T10:12:03+01:00 Linker: Rework debug traces - - - - - 2 changed files: - rts/linker/elf_got.c - rts/linker/elf_reloc_riscv64.c Changes: ===================================== rts/linker/elf_got.c ===================================== @@ -9,22 +9,35 @@ * Check if we need a global offset table slot for a * given symbol */ -bool -needGotSlot(Elf_Sym * symbol) { - /* using global here should give an upper bound */ - /* I don't believe we need to relocate STB_LOCAL - * symbols via the GOT; however I'm unsure about - * STB_WEAK. - * - * Any more restrictive filter here would result - * in a smaller GOT, which is preferable. - */ - return ELF_ST_BIND(symbol->st_info) == STB_GLOBAL - || ELF_ST_BIND(symbol->st_info) == STB_WEAK - // Section symbols exist primarily for relocation - // and as such may need a GOT slot. - || ELF_ST_TYPE(symbol->st_info) == STT_SECTION; - +bool needGotSlot(Elf_Sym *symbol) { + /* using global here should give an upper bound */ + /* I don't believe we need to relocate STB_LOCAL + * symbols via the GOT; however I'm unsure about + * STB_WEAK. + * + * Any more restrictive filter here would result + * in a smaller GOT, which is preferable. + */ + return ELF_ST_BIND(symbol->st_info) == STB_GLOBAL || + ELF_ST_BIND(symbol->st_info) == STB_WEAK + // Section symbols exist primarily for relocation + // and as such may need a GOT slot. + || ELF_ST_TYPE(symbol->st_info) == STT_SECTION +#if defined(riscv64_HOST_ARCH) + // RISCV relies much on relocations and relaxations, leaving most of + // the addressing mode heavy lifting to the linker. We're using LA to + // load local label addresses (e.g. to access `*_closure`.) This + // implies (in the medany memory model) relocation via the GOT unless + // the instruction gets relaxed to e.g. direct or PC-relative + // addressing. So, for now, we've got the special case to add GOT + // symbols for all local labels here. This could be optimized by e.g. + // adding symbols to GOT on demand: I.e. if we spot a symbol related + // relocation which cannot be relaxed to direct or PC-relative + // addressing, then add it to GOT (otherwise not.) + || (ELF_ST_BIND(symbol->st_info) == STB_LOCAL && + ELF_ST_TYPE(symbol->st_info) == STT_NOTYPE && symbol->st_name != 0) +#endif + ; } bool ===================================== rts/linker/elf_reloc_riscv64.c ===================================== @@ -73,8 +73,8 @@ char *relocationTypeToString(Elf64_Xword type) { typedef uint64_t addr_t; -int64_t decodeAddendRISCV64(Section *section, Elf_Rel *rel) STG_NORETURN; -bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int64_t addend); +int32_t decodeAddendRISCV64(Section *section, Elf_Rel *rel) STG_NORETURN; +bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int32_t addend); /* regular instructions are 32bit */ typedef uint32_t inst_t; @@ -83,7 +83,7 @@ typedef uint32_t inst_t; typedef uint16_t cinst_t; // TODO: Decide which functions should be static and/or inlined. -int64_t decodeAddendRISCV64(Section *section STG_UNUSED, +int32_t decodeAddendRISCV64(Section *section STG_UNUSED, Elf_Rel *rel STG_UNUSED) { debugBelch("decodeAddendRISCV64: Relocations with explicit addend are not " "supported."); @@ -146,10 +146,11 @@ uint32_t setLO12_S(uint32_t insn, uint32_t imm) { (extractBits(imm, 4, 0) << 7); } -void setUType(inst_t *loc, uint32_t val) { +void setUType(inst_t *loc, int32_t val) { const unsigned bits = 32; - uint64_t hi = val + 0x800; + uint32_t hi = val + 0x800; checkInt(loc, SignExtend64(hi, bits) >> 12, 20); + debugBelch("setUType: hi 0x%x val 0x%x\n", hi, val); write32le(loc, (read32le(loc) & 0xFFF) | (hi & 0xFFFFF000)); } @@ -227,16 +228,15 @@ void setCJType(cinst_t *loc, uint32_t val) { write16le(loc, insn); } -bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int64_t addend) { +bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int32_t addend) { addr_t P = (addr_t)((uint8_t *)section->start + rel->r_offset); - IF_DEBUG( - linker, - debugBelch( - "Relocation type %s 0x%lx (%lu) symbol 0x%lx addend 0x%lx (%lu / " - "%ld) P 0x%lx\n", - relocationTypeToString(rel->r_info), ELF64_R_TYPE(rel->r_info), - ELF64_R_TYPE(rel->r_info), ELF64_R_SYM(rel->r_info), addend, addend, - addend, P)); + IF_DEBUG(linker, + debugBelch( + "Relocation type %s 0x%lx (%lu) symbol 0x%lx addend 0x%x (%u / " + "%d) P 0x%lx\n", + relocationTypeToString(rel->r_info), ELF64_R_TYPE(rel->r_info), + ELF64_R_TYPE(rel->r_info), ELF64_R_SYM(rel->r_info), addend, + addend, addend, P)); switch (ELF64_R_TYPE(rel->r_info)) { case R_RISCV_32_PCREL: case R_RISCV_32: @@ -352,7 +352,7 @@ bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int64_t addend) { * @param addend The existing addend. Either explicit or implicit. * @return The new computed addend. */ -int64_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, +int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, int64_t addend, ObjectCode *oc) { /* Position where something is relocated */ @@ -438,8 +438,11 @@ int64_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, relocationTypeToString(rel->r_info), P, S, symbol->name, relocationTypeToString(rel_prime->r_info), P_prime, symbol_prime->addr, symbol_prime->name)); - return computeAddend(targetSection, (Elf_Rel *)rel_prime, - symbol_prime, addend_prime, oc); + int32_t result = computeAddend(targetSection, (Elf_Rel *)rel_prime, + symbol_prime, addend_prime, oc); + IF_DEBUG(linker, + debugBelch("Result of computeAddend: 0x%x (%d)\n", result, result)); + return result; } } } @@ -462,10 +465,9 @@ int64_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, abort(/* could not find or make stub */); } } - IF_DEBUG( - linker, - debugBelch("S = 0x%lx A = 0x%lx P = 0x%lx (S + A) - P = 0x%lx \n", S, - A, P, (S + A) - P)); + IF_DEBUG(linker, debugBelch("R_RISCV_CALL_PLT: S = 0x%lx A = 0x%lx P = " + "0x%lx (S + A) - P = 0x%lx \n", + S, A, P, (S + A) - P)); return (S + A) - P; } case R_RISCV_ADD8: @@ -504,9 +506,11 @@ int64_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, return 0; case R_RISCV_32_PCREL: return S + A - P; - case R_RISCV_GOT_HI20: - // reduced G + GOT to GOT_S - This might be wrong! + case R_RISCV_GOT_HI20: { + // Ensure that the GOT entry is set up. + CHECK(0x0 != GOT_S); return GOT_S + A - P; + } default: debugBelch("Unimplemented relocation: 0x%lx\n (%lu)", ELF64_R_TYPE(rel->r_info), ELF64_R_TYPE(rel->r_info)); View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c36bf10472d3243b25c4480dad55b9c7c7fb865c...77b14c9a1db2bf15b4a46443f7c5eb5e70257cd1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c36bf10472d3243b25c4480dad55b9c7c7fb865c...77b14c9a1db2bf15b4a46443f7c5eb5e70257cd1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 10:48:36 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 01 Mar 2024 05:48:36 -0500 Subject: [Git][ghc/ghc][master] 5 commits: hadrian: Improve parallelism in binary-dist-dir rule Message-ID: <65e1b284126c0_cb85d2ca8f801176e7@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 8 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - configure.ac - hadrian/src/Rules/BinaryDist.hs Changes: ===================================== .gitlab-ci.yml ===================================== @@ -101,8 +101,6 @@ workflow: # which versions of GHC to allow bootstrap with .bootstrap_matrix : &bootstrap_matrix matrix: - - GHC_VERSION: 9.4.8 - DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10-ghc9_4:$DOCKER_REV" - GHC_VERSION: 9.6.4 DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10-ghc9_6:$DOCKER_REV" - GHC_VERSION: 9.8.1 ===================================== .gitlab/ci.sh ===================================== @@ -151,6 +151,8 @@ function mingw_init() { # We always use mingw64 Python to avoid path length issues like #17483. export PYTHON="/mingw64/bin/python3" + # And need to use sphinx-build from the environment + export SPHINXBUILD="/mingw64/bin/sphinx-build.exe" } # This will contain GHC's local native toolchain @@ -305,7 +307,7 @@ function fetch_cabal() { fail "neither CABAL nor CABAL_INSTALL_VERSION are not set" fi - start_section "fetch GHC" + start_section "fetch cabal" case "$(uname)" in # N.B. Windows uses zip whereas all others use .tar.xz MSYS_*|MINGW*) @@ -332,7 +334,7 @@ function fetch_cabal() { mv cabal "$toolchain/bin" ;; esac - end_section "fetch GHC" + end_section "fetch cabal" fi } ===================================== .gitlab/darwin/nix/sources.json ===================================== @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "master", + "branch": "nixos-unstable", "description": "Nix Packages collection", "homepage": "", "owner": "nixos", "repo": "nixpkgs", - "rev": "ce1aa29621356706746c53e2d480da7c68f6c972", - "sha256": "sha256:1sbs3gi1nf4rcbmnw69fw0fpvb3qvlsa84hqimv78vkpd6xb0bgg", + "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "sha256": "1v9sy2i2dy3qksx4mf81gwzfl0jzpqccfkzq7fjxgq832f9d255i", "type": "tarball", - "url": "https://github.com/nixos/nixpkgs/archive/ce1aa29621356706746c53e2d480da7c68f6c972.tar.gz", + "url": "https://github.com/nixos/nixpkgs/archive/73de017ef2d18a04ac4bfd0c02650007ccb31c2a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } ===================================== .gitlab/darwin/toolchain.nix ===================================== @@ -4,6 +4,7 @@ let sources = import ./nix/sources.nix; nixpkgsSrc = sources.nixpkgs; pkgs = import nixpkgsSrc { inherit system; }; + hostPkgs = import nixpkgsSrc { }; in let @@ -13,23 +14,26 @@ let targetTriple = pkgs.stdenv.targetPlatform.config; ghcBindists = let version = ghc.version; in { - aarch64-darwin = pkgs.fetchurl { + aarch64-darwin = hostPkgs.fetchurl { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz"; - sha256 = "sha256-tQUHsingxBizLktswGAoi6lJf92RKWLjsHB9CisANlg="; + sha256 = "sha256-c1GTMJf3/yiW/t4QL532EswD5JVlgA4getkfsxj4TaA="; }; - x86_64-darwin = pkgs.fetchurl { + x86_64-darwin = hostPkgs.fetchurl { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; - sha256 = "sha256-OjXjVe+ZODDCc/hqtihqqz6CX25TKI0ZgORzkR5O3pQ="; + sha256 = "sha256-LrYniMG0phsvyW6dhQC+3ompvzcxnwAe6GezEqqzoTQ="; }; + }; ghc = pkgs.stdenv.mkDerivation rec { - version = "9.4.4"; + # Using 9.6.2 because of #24050 + version = "9.6.2"; name = "ghc"; src = ghcBindists.${pkgs.stdenv.hostPlatform.system}; configureFlags = [ "CC=/usr/bin/clang" "CLANG=/usr/bin/clang" + "AR=/usr/bin/ar" "LLC=${llvm}/bin/llc" "OPT=${llvm}/bin/opt" "CONF_CC_OPTS_STAGE2=--target=${targetTriple}" @@ -92,7 +96,7 @@ let }; fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; }; - llvm = pkgs.llvm_11; + llvm = pkgs.llvm_15; in pkgs.writeTextFile { name = "toolchain"; ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -397,8 +397,8 @@ opsysVariables _ FreeBSD13 = mconcat -- [1] https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html) "CONFIGURE_ARGS" =: "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib" , "HADRIAN_ARGS" =: "--docs=no-sphinx" - , "GHC_VERSION" =: "9.4.3" - , "CABAL_INSTALL_VERSION" =: "3.8.1.0" + , "GHC_VERSION" =: "9.6.4" + , "CABAL_INSTALL_VERSION" =: "3.10.2.0" ] opsysVariables _ (Linux distro) = distroVariables distro opsysVariables AArch64 (Darwin {}) = @@ -407,7 +407,7 @@ opsysVariables AArch64 (Darwin {}) = , "LANG" =: "en_US.UTF-8" , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin - , "HADRIAN_ARGS" =: "--docs=no-sphinx" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] opsysVariables Amd64 (Darwin {}) = mconcat [ "NIX_SYSTEM" =: "x86_64-darwin" @@ -421,22 +421,21 @@ opsysVariables Amd64 (Darwin {}) = , "LANG" =: "en_US.UTF-8" , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin - , "HADRIAN_ARGS" =: "--docs=no-sphinx" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] opsysVariables _ (Windows {}) = mconcat [ "MSYSTEM" =: "CLANG64" - , "HADRIAN_ARGS" =: "--docs=no-sphinx" , "LANG" =: "en_US.UTF-8" - , "CABAL_INSTALL_VERSION" =: "3.8.1.0" - , "GHC_VERSION" =: "9.4.3" ] + , "CABAL_INSTALL_VERSION" =: "3.10.2.0" + , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" + , "GHC_VERSION" =: "9.6.4" ] opsysVariables _ _ = mempty alpineVariables = mconcat [ -- Due to #20266 "CONFIGURE_ARGS" =: "--disable-ld-override" , "INSTALL_CONFIGURE_ARGS" =: "--disable-ld-override" - , "HADRIAN_ARGS" =: "--docs=no-sphinx" -- encoding004: due to lack of locale support -- T10458, ghcilink002: due to #17869 , "BROKEN_TESTS" =: "encoding004 T10458" @@ -450,9 +449,6 @@ distroVariables Centos7 = mconcat [ "HADRIAN_ARGS" =: "--docs=no-sphinx" , "BROKEN_TESTS" =: "T22012" -- due to #23979 ] -distroVariables Rocky8 = mconcat [ - "HADRIAN_ARGS" =: "--docs=no-sphinx" - ] distroVariables Fedora33 = mconcat -- LLC/OPT do not work for some reason in our fedora images -- These tests fail with this error: T11649 T5681 T7571 T8131b ===================================== .gitlab/jobs.yaml ===================================== @@ -57,7 +57,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", "NIX_SYSTEM": "aarch64-darwin", @@ -305,7 +305,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", "NIX_SYSTEM": "aarch64-darwin", @@ -372,7 +372,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "aarch64-linux-alpine3_18-validate", @@ -684,7 +683,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", "NIX_SYSTEM": "x86_64-darwin", @@ -751,9 +750,9 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-freebsd13-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", + "GHC_VERSION": "9.6.4", "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-freebsd13-validate", @@ -818,7 +817,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-int_native-validate+fully_static", @@ -883,7 +881,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate", @@ -948,7 +945,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static", @@ -1013,7 +1009,6 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_18-validate", @@ -2526,7 +2521,6 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-rocky8-validate", "XZ_OPT": "-9" @@ -2707,10 +2701,10 @@ "BIGNUM_BACKEND": "native", "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", @@ -2769,10 +2763,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", @@ -2837,7 +2831,7 @@ "BIN_DIST_NAME": "ghc-aarch64-darwin-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "11.0", @@ -2905,7 +2899,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3162,7 +3156,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", @@ -3233,7 +3227,7 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "release+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3299,7 +3293,7 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "release+fully_static+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3365,7 +3359,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -3431,7 +3425,7 @@ "BROKEN_TESTS": "encoding004 T10458", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", @@ -4143,7 +4137,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "HADRIAN_ARGS": "--hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-rocky8-release", @@ -4329,10 +4323,10 @@ "BIGNUM_BACKEND": "native", "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release", "BUILD_FLAVOUR": "release", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", @@ -4392,10 +4386,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-release", "BUILD_FLAVOUR": "release", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs", "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", @@ -4461,7 +4455,7 @@ "BIN_DIST_NAME": "ghc-x86_64-darwin-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MACOSX_DEPLOYMENT_TARGET": "10.13", "NIX_SYSTEM": "x86_64-darwin", @@ -4527,9 +4521,9 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-freebsd13-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", + "GHC_VERSION": "9.6.4", "HADRIAN_ARGS": "--docs=no-sphinx", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-freebsd13-validate" @@ -4593,7 +4587,6 @@ "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458", "BUILD_FLAVOUR": "validate+fully_static", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=no-sphinx", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override", "RUNTEST_ARGS": "", "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static" @@ -5585,10 +5578,10 @@ "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-windows-validate", "BUILD_FLAVOUR": "validate", - "CABAL_INSTALL_VERSION": "3.8.1.0", + "CABAL_INSTALL_VERSION": "3.10.2.0", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "GHC_VERSION": "9.4.3", - "HADRIAN_ARGS": "--docs=no-sphinx", + "GHC_VERSION": "9.6.4", + "HADRIAN_ARGS": "--docs=no-sphinx-pdfs", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", "RUNTEST_ARGS": "", ===================================== configure.ac ===================================== @@ -205,7 +205,7 @@ if test "$WithGhc" = "" then AC_MSG_ERROR([GHC is required.]) fi -MinBootGhcVersion="9.4" +MinBootGhcVersion="9.6" FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[$MinBootGhcVersion], [AC_MSG_ERROR([GHC version $MinBootGhcVersion or later is required to compile GHC.])]) ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -145,12 +145,7 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - -- We 'need' all binaries and libraries - all_pkgs <- stagePackages Stage1 - (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs - cross <- flag CrossCompiling - iserv_targets <- if cross then pure [] else iservBins - need (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull @@ -164,6 +159,22 @@ bindistRules = do rtsIncludeDir = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir -/- "include" + -- We 'need' all binaries and libraries + all_pkgs <- stagePackages Stage1 + (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs + cross <- flag CrossCompiling + iserv_targets <- if cross then pure [] else iservBins + + let lib_exe_targets = (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + + let doc_target = if cross then [] else ["docs"] + + let other_targets = map (bindistFilesDir -/-) (["configure", "Makefile"] ++ bindistInstallFiles) + let all_targets = lib_exe_targets ++ doc_target ++ other_targets + + -- Better parallelism if everything is needed together. + need all_targets + -- We create the bindist directory at /bindist/ghc-X.Y.Z-platform/ -- and populate it with Stage2 build results createDirectory bindistFilesDir @@ -232,7 +243,6 @@ bindistRules = do cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["recache"] - unless cross $ need ["docs"] -- TODO: we should only embed the docs that have been generated -- depending on the current settings (flavours' "ghcDocs" field and @@ -274,8 +284,6 @@ bindistRules = do -- We then 'need' all the files necessary to configure and install -- (as in, './configure [...] && make install') this build on some -- other machine. - need $ map (bindistFilesDir -/-) - (["configure", "Makefile"] ++ bindistInstallFiles) copyFile ("hadrian" -/- "bindist" -/- "config.mk.in") (bindistFilesDir -/- "config.mk.in") generateBuildMk >>= writeFile' (bindistFilesDir -/- "build.mk") copyFile ("hadrian" -/- "cfg" -/- "default.target.in") (bindistFilesDir -/- "default.target.in") View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/960c8d47f064644617a605b1225a18e9350be995...67ace1c59dd582919bceb4fdadbefc1d98d3449a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/960c8d47f064644617a605b1225a18e9350be995...67ace1c59dd582919bceb4fdadbefc1d98d3449a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 10:49:24 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 01 Mar 2024 05:49:24 -0500 Subject: [Git][ghc/ghc][master] ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 Message-ID: <65e1b2b4af544_cb85d31e280c12207a@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - 1 changed file: - .gitlab-ci.yml Changes: ===================================== .gitlab-ci.yml ===================================== @@ -2,7 +2,7 @@ variables: GIT_SSL_NO_VERIFY: "1" # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: 08bdbb85d6711e4df23d97e1cbdb557fe752b0a4 + DOCKER_REV: 7f63b34ac87b85470eef9c668e9528e8e2f5b46a # Sequential version number of all cached things. # Bump to invalidate GitLab CI cache. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/39583c399193b3dedc399f4dccbd222640581956 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/39583c399193b3dedc399f4dccbd222640581956 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 11:08:49 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Fri, 01 Mar 2024 06:08:49 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/ghc-prim-docs Message-ID: <65e1b74193fc1_cb85d3ad711012427e@gitlab.mail> Matthew Pickering pushed new branch wip/ghc-prim-docs at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/ghc-prim-docs You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 13:09:05 2024 From: gitlab at gitlab.haskell.org (Sylvain Henry (@hsyl20)) Date: Fri, 01 Mar 2024 08:09:05 -0500 Subject: [Git][ghc/ghc][wip/torsten.schmits/0475-tuple-syntax-2] JS linker: filter unboxed tuples Message-ID: <65e1d371c60b7_1e05a12504a2c1498e@gitlab.mail> Sylvain Henry pushed to branch wip/torsten.schmits/0475-tuple-syntax-2 at Glasgow Haskell Compiler / GHC Commits: 2825d289 by Sylvain Henry at 2024-03-01T14:08:19+01:00 JS linker: filter unboxed tuples - - - - - 1 changed file: - compiler/GHC/StgToJS/Utils.hs Changes: ===================================== compiler/GHC/StgToJS/Utils.hs ===================================== @@ -341,10 +341,16 @@ collectIds unfloated b = in seqList xs `seq` xs where acceptId i = all ($ i) [not . isForbidden] -- fixme test this: [isExported[isGlobalId, not.isForbidden] - -- the GHC.Prim module has no js source file isForbidden i - | Just m <- nameModule_maybe (getName i) = m == gHC_PRIM - | otherwise = False + -- the GHC.Prim module has no js source file + | Just m <- nameModule_maybe (getName i) + , m == gHC_PRIM + = True + -- unboxed tuples have no definition + | isUnboxedTupleDataConLikeName (getName i) + = True + | otherwise + = False ----------------------------------------------------- -- Live vars View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2825d28912ab1134a606f12f74734b1add9bdbd5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2825d28912ab1134a606f12f74734b1add9bdbd5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 14:02:49 2024 From: gitlab at gitlab.haskell.org (sheaf (@sheaf)) Date: Fri, 01 Mar 2024 09:02:49 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] Apply 1 suggestion(s) to 1 file(s) Message-ID: <65e1e009c6f7a_1e05a13eb6e8425454@gitlab.mail> sheaf pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: 6638884a by sheaf at 2024-03-01T14:02:27+00:00 Apply 1 suggestion(s) to 1 file(s) - - - - - 1 changed file: - compiler/GHC/CmmToAsm/X86/CodeGen.hs Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3458,6 +3458,8 @@ genFMA3Code w signs x y z = do x_code <- getAnyReg x x_tmp <- getNewRegNat rep let + fma213 = FMA3 rep signs FMA213 + code, code_direct, code_mov :: Reg -> InstrBlock -- Ideal: Compute the result directly into dst code_direct dst = x_code dst `snocOL` View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6638884acef42c037e214be5cb1aa27f7f2efacf -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6638884acef42c037e214be5cb1aa27f7f2efacf You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 15:16:48 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Fri, 01 Mar 2024 10:16:48 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/home-unit-closure-fast Message-ID: <65e1f1607cc7c_1e05a15da1fec319ae@gitlab.mail> Zubin pushed new branch wip/home-unit-closure-fast at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/home-unit-closure-fast You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 15:19:11 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Fri, 01 Mar 2024 10:19:11 -0500 Subject: [Git][ghc/ghc][wip/home-unit-closure-fast] driver: Make `checkHomeUnitsClosed` faster Message-ID: <65e1f1ef50910_1e05a15e99c24355f4@gitlab.mail> Zubin pushed to branch wip/home-unit-closure-fast at Glasgow Haskell Compiler / GHC Commits: 44f5a0ed by Zubin Duggal at 2024-03-01T20:49:00+05:30 driver: Make `checkHomeUnitsClosed` faster The implementation of `checkHomeUnitsClosed` was traversing every single path in the unit dependency graph - this grows exponentially and quickly grows to be infeasible on larger unit dependency graphs. Instead we replace this with a faster implementation which follows from the specificiation of the closure property - there is a closure error if there are units which are both are both (transitively) depended upon by home units and (transitively) depend on home units, but are not themselves home units. To compute the set of units required for closure, we first compute the closure of the unit dependency graph, then the transpose of this closure, and find all units that are reachable from the home units in the transpose of the closure. - - - - - 1 changed file: - compiler/GHC/Driver/Make.hs Changes: ===================================== compiler/GHC/Driver/Make.hs ===================================== @@ -1565,8 +1565,8 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots (root_errs, rootSummariesOk) <- partitionWithM getRootSummary roots -- #17549 let root_map = mkRootMap rootSummariesOk checkDuplicates root_map - (deps, pkg_deps, map0) <- loopSummaries rootSummariesOk (M.empty, Set.empty, root_map) - let closure_errs = checkHomeUnitsClosed (hsc_unit_env hsc_env) (hsc_all_home_unit_ids hsc_env) (Set.toList pkg_deps) + (deps, map0) <- loopSummaries rootSummariesOk (M.empty, root_map) + let closure_errs = checkHomeUnitsClosed (hsc_unit_env hsc_env) (hsc_all_home_unit_ids hsc_env) let unit_env = hsc_unit_env hsc_env let tmpfs = hsc_tmpfs hsc_env @@ -1660,19 +1660,19 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- This loops over all the mod summaries in the dependency graph, accumulates the actual dependencies for each module/unit loopSummaries :: [ModSummary] - -> (M.Map NodeKey ModuleGraphNode, Set.Set (UnitId, UnitId), + -> (M.Map NodeKey ModuleGraphNode, DownsweepCache) - -> IO ((M.Map NodeKey ModuleGraphNode), Set.Set (UnitId, UnitId), DownsweepCache) + -> IO ((M.Map NodeKey ModuleGraphNode), DownsweepCache) loopSummaries [] done = return done - loopSummaries (ms:next) (done, pkgs, summarised) + loopSummaries (ms:next) (done, summarised) | Just {} <- M.lookup k done - = loopSummaries next (done, pkgs, summarised) + = loopSummaries next (done, summarised) -- Didn't work out what the imports mean yet, now do that. | otherwise = do - (final_deps, pkgs1, done', summarised') <- loopImports (calcDeps ms) done summarised + (final_deps, done', summarised') <- loopImports (calcDeps ms) done summarised -- This has the effect of finding a .hs file if we are looking at the .hs-boot file. - (_, _, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised' - loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', pkgs1 `Set.union` pkgs, summarised'') + (_, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised' + loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', summarised'') where k = NodeKey_Module (msKey ms) @@ -1692,18 +1692,17 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- Visited set; the range is a list because -- the roots can have the same module names -- if allow_dup_roots is True - -> IO ([NodeKey], Set.Set (UnitId, UnitId), - + -> IO ([NodeKey], M.Map NodeKey ModuleGraphNode, DownsweepCache) -- The result is the completed NodeMap - loopImports [] done summarised = return ([], Set.empty, done, summarised) + loopImports [] done summarised = return ([], done, summarised) loopImports ((home_uid,mb_pkg, gwib) : ss) done summarised | Just summs <- M.lookup cache_key summarised = case summs of [Right ms] -> do let nk = NodeKey_Module (msKey ms) - (rest, pkgs, summarised', done') <- loopImports ss done summarised - return (nk: rest, pkgs, summarised', done') + (rest, summarised', done') <- loopImports ss done summarised + return (nk: rest, summarised', done') [Left _err] -> loopImports ss done summarised _errs -> do @@ -1715,20 +1714,20 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots Nothing excl_mods case mb_s of NotThere -> loopImports ss done summarised - External uid -> do - (other_deps, pkgs, done', summarised') <- loopImports ss done summarised - return (other_deps, Set.insert (homeUnitId home_unit, uid) pkgs, done', summarised') + External _ -> do + (other_deps, done', summarised') <- loopImports ss done summarised + return (other_deps, done', summarised') FoundInstantiation iud -> do - (other_deps, pkgs, done', summarised') <- loopImports ss done summarised - return (NodeKey_Unit iud : other_deps, pkgs, done', summarised') + (other_deps, done', summarised') <- loopImports ss done summarised + return (NodeKey_Unit iud : other_deps, done', summarised') FoundHomeWithError (_uid, e) -> loopImports ss done (Map.insert cache_key [(Left e)] summarised) FoundHome s -> do - (done', pkgs1, summarised') <- - loopSummaries [s] (done, Set.empty, Map.insert cache_key [Right s] summarised) - (other_deps, pkgs2, final_done, final_summarised) <- loopImports ss done' summarised' + (done', summarised') <- + loopSummaries [s] (done, Map.insert cache_key [Right s] summarised) + (other_deps, final_done, final_summarised) <- loopImports ss done' summarised' -- MP: This assumes that we can only instantiate non home units, which is probably fair enough for now. - return (NodeKey_Module (msKey s) : other_deps, pkgs1 `Set.union` pkgs2, final_done, final_summarised) + return (NodeKey_Module (msKey s) : other_deps, final_done, final_summarised) where cache_key = (home_uid, mb_pkg, unLoc <$> gwib) home_unit = ue_unitHomeUnit home_uid (hsc_unit_env hsc_env) @@ -1737,47 +1736,50 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- This function checks then important property that if both p and q are home units -- then any dependency of p, which transitively depends on q is also a home unit. -checkHomeUnitsClosed :: UnitEnv -> Set.Set UnitId -> [(UnitId, UnitId)] -> [DriverMessages] --- Fast path, trivially closed. -checkHomeUnitsClosed ue home_id_set home_imp_ids - | Set.size home_id_set == 1 = [] - | otherwise = - let res = foldMap loop home_imp_ids - -- Now check whether everything which transitively depends on a home_unit is actually a home_unit - -- These units are the ones which we need to load as home packages but failed to do for some reason, - -- it's a bug in the tool invoking GHC. - bad_unit_ids = Set.difference res home_id_set - in if Set.null bad_unit_ids - then [] - else [singleMessage $ mkPlainErrorMsgEnvelope rootLoc $ DriverHomePackagesNotClosed (Set.toList bad_unit_ids)] - +checkHomeUnitsClosed :: UnitEnv -> Set.Set UnitId -> [DriverMessages] +checkHomeUnitsClosed ue home_id_set + | Set.null bad_unit_ids = [] + | otherwise = [singleMessage $ mkPlainErrorMsgEnvelope rootLoc $ DriverHomePackagesNotClosed (Set.toList bad_unit_ids)] where + bad_unit_ids = upwards_closure Set.\\ home_id_set rootLoc = mkGeneralSrcSpan (fsLit "") - -- TODO: This could repeat quite a bit of work but I struggled to write this function. - -- Which units transitively depend on a home unit - loop :: (UnitId, UnitId) -> Set.Set UnitId -- The units which transitively depend on a home unit - loop (from_uid, uid) = - let us = ue_findHomeUnitEnv from_uid ue in - let um = unitInfoMap (homeUnitEnv_units us) in - case lookupUniqMap um uid of - Nothing -> pprPanic "uid not found" (ppr uid) - Just ui -> - let depends = unitDepends ui - home_depends = Set.fromList depends `Set.intersection` home_id_set - other_depends = Set.fromList depends `Set.difference` home_id_set - in - -- Case 1: The unit directly depends on a home_id - if not (null home_depends) - then - let res = foldMap (loop . (from_uid,)) other_depends - in Set.insert uid res - -- Case 2: Check the rest of the dependencies, and then see if any of them depended on - else - let res = foldMap (loop . (from_uid,)) other_depends - in - if not (Set.null res) - then Set.insert uid res - else res + + graph :: Graph (Node UnitId UnitId) + graph = graphFromEdgedVerticesUniq graphNodes + + -- downwards closure of graph + downwards_closure + = graphFromEdgedVerticesUniq [ DigraphNode uid uid (Set.toList deps) + | (uid, deps) <- M.toList (allReachable graph node_key)] + + inverse_closure = transposeG downwards_closure + + upwards_closure = Set.fromList $ map node_key $ reachablesG inverse_closure [DigraphNode uid uid [] | uid <- Set.toList home_id_set] + + all_unit_direct_deps :: UniqMap UnitId [UnitId] + all_unit_direct_deps + = unitEnv_foldWithKey go emptyUniqMap $ ue_home_unit_graph ue + where + go rest this this_uis = + addToUniqMap external_depends this (homeUnitDepends this_units) + `mappend` rest + where + external_depends = mapUniqMap unitDepends (unitInfoMap this_units) + this_units = homeUnitEnv_units this_uis + + graphNodes :: [Node UnitId UnitId] + graphNodes = go Set.empty home_id_set + where + go done todo + = case Set.minView todo of + Nothing -> [] + Just (uid, todo') + | Set.member uid done -> go done todo' + | otherwise -> case lookupUniqMap all_unit_direct_deps uid of + Nothing -> pprPanic "uid not found" (ppr (uid, all_unit_direct_deps)) + Just depends -> + let todo'' = ((Set.fromList depends) Set.\\ done) `Set.union` todo' + in DigraphNode uid uid depends : go (Set.insert uid done) todo'' -- | Update the every ModSummary that is depended on -- by a module that needs template haskell. We enable codegen to View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44f5a0ed5cc2c7780ba7d1ad94c93305b5675a29 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44f5a0ed5cc2c7780ba7d1ad94c93305b5675a29 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 15:44:50 2024 From: gitlab at gitlab.haskell.org (sheaf (@sheaf)) Date: Fri, 01 Mar 2024 10:44:50 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] Apply 1 suggestion(s) to 1 file(s) Message-ID: <65e1f7f267ccf_1e05a16abd76c4538a@gitlab.mail> sheaf pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: 33f74e4b by sheaf at 2024-03-01T15:44:46+00:00 Apply 1 suggestion(s) to 1 file(s) - - - - - 1 changed file: - testsuite/tests/primops/should_run/all.T Changes: ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,7 +77,6 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) -test('T24496', normal, compile_and_run, ['']) test('T24496' , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) , js_skip # JS backend doesn't have an FMA implementation View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/33f74e4bb268b55d9d0d1575528dc4bd0a217542 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/33f74e4bb268b55d9d0d1575528dc4bd0a217542 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 16:06:44 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Fri, 01 Mar 2024 11:06:44 -0500 Subject: [Git][ghc/ghc][wip/home-unit-closure-fast] driver: Make `checkHomeUnitsClosed` faster Message-ID: <65e1fd148c2bb_1e05a17670cf848124@gitlab.mail> Zubin pushed to branch wip/home-unit-closure-fast at Glasgow Haskell Compiler / GHC Commits: ce768e98 by Zubin Duggal at 2024-03-01T21:35:55+05:30 driver: Make `checkHomeUnitsClosed` faster The implementation of `checkHomeUnitsClosed` was traversing every single path in the unit dependency graph - this grows exponentially and quickly grows to be infeasible on larger unit dependency graphs. Instead we replace this with a faster implementation which follows from the specificiation of the closure property - there is a closure error if there are units which are both are both (transitively) depended upon by home units and (transitively) depend on home units, but are not themselves home units. To compute the set of units required for closure, we first compute the closure of the unit dependency graph, then the transpose of this closure, and find all units that are reachable from the home units in the transpose of the closure. - - - - - 1 changed file: - compiler/GHC/Driver/Make.hs Changes: ===================================== compiler/GHC/Driver/Make.hs ===================================== @@ -1565,8 +1565,8 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots (root_errs, rootSummariesOk) <- partitionWithM getRootSummary roots -- #17549 let root_map = mkRootMap rootSummariesOk checkDuplicates root_map - (deps, pkg_deps, map0) <- loopSummaries rootSummariesOk (M.empty, Set.empty, root_map) - let closure_errs = checkHomeUnitsClosed (hsc_unit_env hsc_env) (hsc_all_home_unit_ids hsc_env) (Set.toList pkg_deps) + (deps, map0) <- loopSummaries rootSummariesOk (M.empty, root_map) + let closure_errs = checkHomeUnitsClosed (hsc_unit_env hsc_env) (hsc_all_home_unit_ids hsc_env) let unit_env = hsc_unit_env hsc_env let tmpfs = hsc_tmpfs hsc_env @@ -1660,19 +1660,19 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- This loops over all the mod summaries in the dependency graph, accumulates the actual dependencies for each module/unit loopSummaries :: [ModSummary] - -> (M.Map NodeKey ModuleGraphNode, Set.Set (UnitId, UnitId), + -> (M.Map NodeKey ModuleGraphNode, DownsweepCache) - -> IO ((M.Map NodeKey ModuleGraphNode), Set.Set (UnitId, UnitId), DownsweepCache) + -> IO ((M.Map NodeKey ModuleGraphNode), DownsweepCache) loopSummaries [] done = return done - loopSummaries (ms:next) (done, pkgs, summarised) + loopSummaries (ms:next) (done, summarised) | Just {} <- M.lookup k done - = loopSummaries next (done, pkgs, summarised) + = loopSummaries next (done, summarised) -- Didn't work out what the imports mean yet, now do that. | otherwise = do - (final_deps, pkgs1, done', summarised') <- loopImports (calcDeps ms) done summarised + (final_deps, done', summarised') <- loopImports (calcDeps ms) done summarised -- This has the effect of finding a .hs file if we are looking at the .hs-boot file. - (_, _, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised' - loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', pkgs1 `Set.union` pkgs, summarised'') + (_, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised' + loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', summarised'') where k = NodeKey_Module (msKey ms) @@ -1692,18 +1692,17 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- Visited set; the range is a list because -- the roots can have the same module names -- if allow_dup_roots is True - -> IO ([NodeKey], Set.Set (UnitId, UnitId), - + -> IO ([NodeKey], M.Map NodeKey ModuleGraphNode, DownsweepCache) -- The result is the completed NodeMap - loopImports [] done summarised = return ([], Set.empty, done, summarised) + loopImports [] done summarised = return ([], done, summarised) loopImports ((home_uid,mb_pkg, gwib) : ss) done summarised | Just summs <- M.lookup cache_key summarised = case summs of [Right ms] -> do let nk = NodeKey_Module (msKey ms) - (rest, pkgs, summarised', done') <- loopImports ss done summarised - return (nk: rest, pkgs, summarised', done') + (rest, summarised', done') <- loopImports ss done summarised + return (nk: rest, summarised', done') [Left _err] -> loopImports ss done summarised _errs -> do @@ -1715,20 +1714,20 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots Nothing excl_mods case mb_s of NotThere -> loopImports ss done summarised - External uid -> do - (other_deps, pkgs, done', summarised') <- loopImports ss done summarised - return (other_deps, Set.insert (homeUnitId home_unit, uid) pkgs, done', summarised') + External _ -> do + (other_deps, done', summarised') <- loopImports ss done summarised + return (other_deps, done', summarised') FoundInstantiation iud -> do - (other_deps, pkgs, done', summarised') <- loopImports ss done summarised - return (NodeKey_Unit iud : other_deps, pkgs, done', summarised') + (other_deps, done', summarised') <- loopImports ss done summarised + return (NodeKey_Unit iud : other_deps, done', summarised') FoundHomeWithError (_uid, e) -> loopImports ss done (Map.insert cache_key [(Left e)] summarised) FoundHome s -> do - (done', pkgs1, summarised') <- - loopSummaries [s] (done, Set.empty, Map.insert cache_key [Right s] summarised) - (other_deps, pkgs2, final_done, final_summarised) <- loopImports ss done' summarised' + (done', summarised') <- + loopSummaries [s] (done, Map.insert cache_key [Right s] summarised) + (other_deps, final_done, final_summarised) <- loopImports ss done' summarised' -- MP: This assumes that we can only instantiate non home units, which is probably fair enough for now. - return (NodeKey_Module (msKey s) : other_deps, pkgs1 `Set.union` pkgs2, final_done, final_summarised) + return (NodeKey_Module (msKey s) : other_deps, final_done, final_summarised) where cache_key = (home_uid, mb_pkg, unLoc <$> gwib) home_unit = ue_unitHomeUnit home_uid (hsc_unit_env hsc_env) @@ -1737,47 +1736,52 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- This function checks then important property that if both p and q are home units -- then any dependency of p, which transitively depends on q is also a home unit. -checkHomeUnitsClosed :: UnitEnv -> Set.Set UnitId -> [(UnitId, UnitId)] -> [DriverMessages] --- Fast path, trivially closed. -checkHomeUnitsClosed ue home_id_set home_imp_ids - | Set.size home_id_set == 1 = [] - | otherwise = - let res = foldMap loop home_imp_ids - -- Now check whether everything which transitively depends on a home_unit is actually a home_unit - -- These units are the ones which we need to load as home packages but failed to do for some reason, - -- it's a bug in the tool invoking GHC. - bad_unit_ids = Set.difference res home_id_set - in if Set.null bad_unit_ids - then [] - else [singleMessage $ mkPlainErrorMsgEnvelope rootLoc $ DriverHomePackagesNotClosed (Set.toList bad_unit_ids)] - +checkHomeUnitsClosed :: UnitEnv -> Set.Set UnitId -> [DriverMessages] +checkHomeUnitsClosed ue home_id_set + | Set.null bad_unit_ids = [] + | otherwise = [singleMessage $ mkPlainErrorMsgEnvelope rootLoc $ DriverHomePackagesNotClosed (Set.toList bad_unit_ids)] where + bad_unit_ids = upwards_closure Set.\\ home_id_set rootLoc = mkGeneralSrcSpan (fsLit "") - -- TODO: This could repeat quite a bit of work but I struggled to write this function. - -- Which units transitively depend on a home unit - loop :: (UnitId, UnitId) -> Set.Set UnitId -- The units which transitively depend on a home unit - loop (from_uid, uid) = - let us = ue_findHomeUnitEnv from_uid ue in - let um = unitInfoMap (homeUnitEnv_units us) in - case lookupUniqMap um uid of - Nothing -> pprPanic "uid not found" (ppr uid) - Just ui -> - let depends = unitDepends ui - home_depends = Set.fromList depends `Set.intersection` home_id_set - other_depends = Set.fromList depends `Set.difference` home_id_set - in - -- Case 1: The unit directly depends on a home_id - if not (null home_depends) - then - let res = foldMap (loop . (from_uid,)) other_depends - in Set.insert uid res - -- Case 2: Check the rest of the dependencies, and then see if any of them depended on - else - let res = foldMap (loop . (from_uid,)) other_depends - in - if not (Set.null res) - then Set.insert uid res - else res + + graph :: Graph (Node UnitId UnitId) + graph = graphFromEdgedVerticesUniq graphNodes + + -- downwards closure of graph + downwards_closure + = graphFromEdgedVerticesUniq [ DigraphNode uid uid (Set.toList deps) + | (uid, deps) <- M.toList (allReachable graph node_key)] + + inverse_closure = transposeG downwards_closure + + upwards_closure = Set.fromList $ map node_key $ reachablesG inverse_closure [DigraphNode uid uid [] | uid <- Set.toList home_id_set] + + all_unit_direct_deps :: UniqMap UnitId (Set.Set UnitId) + all_unit_direct_deps + = unitEnv_foldWithKey go emptyUniqMap $ ue_home_unit_graph ue + where + go rest this this_uis = + plusUniqMap_C Set.union + (addToUniqMap_C Set.union external_depends this (Set.fromList $ this_deps)) + rest + where + external_depends = mapUniqMap (Set.fromList . unitDepends) (unitInfoMap this_units) + this_units = homeUnitEnv_units this_uis + this_deps = [ toUnitId unit | (unit,Just _) <- explicitUnits this_units] + + graphNodes :: [Node UnitId UnitId] + graphNodes = go Set.empty home_id_set + where + go done todo + = case Set.minView todo of + Nothing -> [] + Just (uid, todo') + | Set.member uid done -> go done todo' + | otherwise -> case lookupUniqMap all_unit_direct_deps uid of + Nothing -> pprPanic "uid not found" (ppr (uid, all_unit_direct_deps)) + Just depends -> + let todo'' = (depends Set.\\ done) `Set.union` todo' + in DigraphNode uid uid (Set.toList depends) : go (Set.insert uid done) todo'' -- | Update the every ModSummary that is depended on -- by a module that needs template haskell. We enable codegen to View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ce768e98395dfe3f29d1dfee25e386e1b1a0d399 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ce768e98395dfe3f29d1dfee25e386e1b1a0d399 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 16:29:25 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Fri, 01 Mar 2024 11:29:25 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/global-package-db Message-ID: <65e20265df421_1e05a17e62c90507bc@gitlab.mail> Matthew Pickering pushed new branch wip/global-package-db at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/global-package-db You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 16:30:59 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Fri, 01 Mar 2024 11:30:59 -0500 Subject: [Git][ghc/ghc][wip/global-package-db] Read global package database from settings file Message-ID: <65e202c3e6eec_1e05a180cab5452531@gitlab.mail> Matthew Pickering pushed to branch wip/global-package-db at Glasgow Haskell Compiler / GHC Commits: 187b4a53 by Matthew Pickering at 2024-03-01T16:30:43+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage2 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage2 package database. * Stage 2 cross compilers need to use stage3 libraries, so likewise, we should set to stage * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. - - - - - 4 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.hs - hadrian/bindist/Makefile - hadrian/src/Rules/Generate.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3607,7 +3607,8 @@ compilerInfo dflags ("GHC Profiled", showBool hostIsProfiled), ("Debug on", showBool debugIsOn), ("LibDir", topDir dflags), - -- The path of the global package database used by GHC + -- This is always an absolute path, unlike "Raw Global Package DB" which is + -- in the settings file. ("Global Package DB", globalPackageDatabasePath dflags) ] where ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -112,8 +112,14 @@ initSettings top_dir = do ldIsGnuLd <- getBooleanSetting "ld is GNU ld" arSupportsDashL <- getBooleanSetting "ar supports -L" - let globalpkgdb_path = installed "package.conf.d" - ghc_usage_msg_path = installed "ghc-usage.txt" + + -- The package database is either a relative path to the location of the settings file + -- OR an absolute path. + -- In case the path is absolute then top_dir abs_path == abs_path + -- the path is relative then top_dir rel_path == top_dir rel_path + globalpkgdb_path <- installed <$> getSetting "Raw Global Package DB" + + let ghc_usage_msg_path = installed "ghc-usage.txt" ghci_usage_msg_path = installed "ghci-usage.txt" -- For all systems, unlit, split, mangle are GHC utilities ===================================== hadrian/bindist/Makefile ===================================== @@ -141,6 +141,7 @@ lib/settings : config.mk @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Use LibFFI", "$(UseLibffiForAdjustors)")' >> $@ @echo ',("RTS expects libdw", "$(GhcRtsWithLibdw)")' >> $@ + @echo ',("Raw Global Package DB", "package.conf.d")' >> $@ @echo "]" >> $@ # We need to install binaries relative to libraries. ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -421,6 +421,7 @@ generateSettings = do , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("Raw Global Package DB", return "package.conf.d" ) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" pure $ case settings of View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/187b4a5310600331c4c54177143b4c46df9d641f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/187b4a5310600331c4c54177143b4c46df9d641f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 16:40:17 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 01 Mar 2024 11:40:17 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/improve-Word32ToInteger-on-64bit Message-ID: <65e204f1bd02f_1e05a185fdd105318e@gitlab.mail> Matthew Craven pushed new branch wip/improve-Word32ToInteger-on-64bit at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/improve-Word32ToInteger-on-64bit You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 16:51:54 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 01 Mar 2024 11:51:54 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 10 commits: hadrian: Improve parallelism in binary-dist-dir rule Message-ID: <65e207aa1d22c_1e05a18c16134570ba@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - 4b1bc181 by Torsten Schmits at 2024-03-01T11:51:32-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - c9e3fc6d by Sylvain Henry at 2024-03-01T11:51:32-05:00 JS linker: filter unboxed tuples - - - - - d42fea6e by Arnaud Spiwack at 2024-03-01T11:51:44-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - fefb63f1 by Arnaud Spiwack at 2024-03-01T11:51:44-05:00 Adjust documentation of linear lets according to committee decision - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Gen/Bind.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/Instance/Typeable.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4cb5e8c9f4a446c147f4c3d316852b135edae0cb...fefb63f1fad3c66f8984636bbaad541de6c28137 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4cb5e8c9f4a446c147f4c3d316852b135edae0cb...fefb63f1fad3c66f8984636bbaad541de6c28137 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 16:54:11 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Fri, 01 Mar 2024 11:54:11 -0500 Subject: [Git][ghc/ghc][wip/T24466] Restore preinlineUnconditinoally Message-ID: <65e20833779ab_1e05a18cf3ca06294a@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24466 at Glasgow Haskell Compiler / GHC Commits: 70ed9a0c by Simon Peyton Jones at 2024-03-01T16:53:13+00:00 Restore preinlineUnconditinoally See ghc log for 1 March and wheel-sieve1 - - - - - 2 changed files: - compiler/GHC/Core/Opt/FloatIn.hs - compiler/GHC/Core/Opt/Pipeline.hs Changes: ===================================== compiler/GHC/Core/Opt/FloatIn.hs ===================================== @@ -25,14 +25,14 @@ import GHC.Core import GHC.Core.Unfold( ExprSize(..), sizeExpr, UnfoldingOpts(..), defaultUnfoldingOpts ) import GHC.Core.Opt.Arity( isOneShotBndr ) -import GHC.Core.Opt.Simplify.Inline( smallEnoughToInline ) +-- import GHC.Core.Opt.Simplify.Inline( smallEnoughToInline ) import GHC.Core.Make hiding ( wrapFloats ) import GHC.Core.Utils import GHC.Core.FVs import GHC.Core.Type import GHC.Types.Basic ( RecFlag(..), isRec ) -import GHC.Types.Id ( idType, isJoinId, idJoinPointHood, idUnfolding ) +import GHC.Types.Id ( idType, isJoinId, idJoinPointHood ) import GHC.Types.Tickish import GHC.Types.Var import GHC.Types.Var.Set @@ -792,7 +792,7 @@ sepBindsByDropPoint platform is_case floaters here_fvs fork_fvs | otherwise = go floaters (initDropBox here_fvs) (map initDropBox fork_fvs) where - n_alts = length fork_fvs +-- n_alts = length fork_fvs go :: RevFloatInBinds -> DropBox -> [DropBox] -> (RevFloatInBinds, [RevFloatInBinds]) @@ -831,9 +831,9 @@ sepBindsByDropPoint platform is_case floaters here_fvs fork_fvs -- See Note [Duplicating floats into case alternatives] dont_float_into_alts - = (n_used_alts == n_alts) + = -- (n_used_alts == n_alts) || -- Don't float in if used in all alternatives - || (n_used_alts > 1 && not (floatIsDupable platform bind)) + (n_used_alts > 1 && not (floatIsDupable platform bind)) -- Nor if used in multiple alts and not small new_fork_boxes = zipWithEqual "FloatIn.sepBinds" insert_maybe @@ -874,17 +874,22 @@ wrapFloats (FB _ _ fl : bs) e = wrapFloats bs (wrapFloat fl e) floatIsDupable :: Platform -> FloatBind -> Bool floatIsDupable _ (FloatCase scrut _ _ _) = small_enough_e scrut -floatIsDupable _ (FloatLet (Rec prs)) = all small_enough_b prs -floatIsDupable _ (FloatLet (NonRec b r)) = small_enough_b (b,r) +floatIsDupable _ (FloatLet bind) = bindIsDupable bind + +bindIsDupable :: CoreBind -> Bool +bindIsDupable bind + | isJoinBind bind = False -- No point in duplicating join points +bindIsDupable (Rec prs) = all small_enough_b prs +bindIsDupable (NonRec b r) = small_enough_b (b,r) small_enough_b :: (Id,CoreExpr) -> Bool -small_enough_b (b,_) = smallEnoughToInline defaultUnfoldingOpts (idUnfolding b) +small_enough_b (_,rhs) = small_enough_e rhs small_enough_e :: CoreExpr -> Bool small_enough_e e - = case sizeExpr opts (unfoldingCreationThreshold opts) [] e of - TooBig -> False - SizeIs n _ _ -> n < unfoldingUseThreshold opts + = case sizeExpr opts (unfoldingUseThreshold opts) [] e of + TooBig -> False + SizeIs {} -> True where opts = defaultUnfoldingOpts ===================================== compiler/GHC/Core/Opt/Pipeline.hs ===================================== @@ -324,8 +324,12 @@ getCoreToDo dflags hpt_rule_base extra_vars -- off one layer of a recursive function (concretely, I saw this -- in wheel-sieve1), and I'm guessing that SpecConstr can too -- And CSE is a very cheap pass. So it seems worth doing here. - runWhen ((liberate_case || spec_constr) && cse) $ CoreDoPasses - [ CoreCSE, simplify "post-final-cse" ], + runWhen cse $ CoreCSE, + + -- New opportunities for float-in + runWhen do_float_in CoreDoFloatInwards, + + simplify "post-O2", --------- End of -O2 passes -------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70ed9a0ccbed39a58121f60e16afb403cab52ff6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70ed9a0ccbed39a58121f60e16afb403cab52ff6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 17:43:17 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Fri, 01 Mar 2024 12:43:17 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T24471 Message-ID: <65e213b5c30a_325b45186381863778@gitlab.mail> Simon Peyton Jones pushed new branch wip/T24471 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24471 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 18:54:42 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Fri, 01 Mar 2024 13:54:42 -0500 Subject: [Git][ghc/ghc][wip/home-unit-closure-fast] driver: Make `checkHomeUnitsClosed` faster Message-ID: <65e22472c9877_325b453908eb076265@gitlab.mail> Zubin pushed to branch wip/home-unit-closure-fast at Glasgow Haskell Compiler / GHC Commits: 1ec70543 by Zubin Duggal at 2024-03-02T00:24:32+05:30 driver: Make `checkHomeUnitsClosed` faster The implementation of `checkHomeUnitsClosed` was traversing every single path in the unit dependency graph - this grows exponentially and quickly grows to be infeasible on larger unit dependency graphs. Instead we replace this with a faster implementation which follows from the specificiation of the closure property - there is a closure error if there are units which are both are both (transitively) depended upon by home units and (transitively) depend on home units, but are not themselves home units. To compute the set of units required for closure, we first compute the closure of the unit dependency graph, then the transpose of this closure, and find all units that are reachable from the home units in the transpose of the closure. - - - - - 1 changed file: - compiler/GHC/Driver/Make.hs Changes: ===================================== compiler/GHC/Driver/Make.hs ===================================== @@ -1565,8 +1565,8 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots (root_errs, rootSummariesOk) <- partitionWithM getRootSummary roots -- #17549 let root_map = mkRootMap rootSummariesOk checkDuplicates root_map - (deps, pkg_deps, map0) <- loopSummaries rootSummariesOk (M.empty, Set.empty, root_map) - let closure_errs = checkHomeUnitsClosed (hsc_unit_env hsc_env) (hsc_all_home_unit_ids hsc_env) (Set.toList pkg_deps) + (deps, map0) <- loopSummaries rootSummariesOk (M.empty, root_map) + let closure_errs = checkHomeUnitsClosed (hsc_unit_env hsc_env) (hsc_all_home_unit_ids hsc_env) let unit_env = hsc_unit_env hsc_env let tmpfs = hsc_tmpfs hsc_env @@ -1660,19 +1660,19 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- This loops over all the mod summaries in the dependency graph, accumulates the actual dependencies for each module/unit loopSummaries :: [ModSummary] - -> (M.Map NodeKey ModuleGraphNode, Set.Set (UnitId, UnitId), + -> (M.Map NodeKey ModuleGraphNode, DownsweepCache) - -> IO ((M.Map NodeKey ModuleGraphNode), Set.Set (UnitId, UnitId), DownsweepCache) + -> IO ((M.Map NodeKey ModuleGraphNode), DownsweepCache) loopSummaries [] done = return done - loopSummaries (ms:next) (done, pkgs, summarised) + loopSummaries (ms:next) (done, summarised) | Just {} <- M.lookup k done - = loopSummaries next (done, pkgs, summarised) + = loopSummaries next (done, summarised) -- Didn't work out what the imports mean yet, now do that. | otherwise = do - (final_deps, pkgs1, done', summarised') <- loopImports (calcDeps ms) done summarised + (final_deps, done', summarised') <- loopImports (calcDeps ms) done summarised -- This has the effect of finding a .hs file if we are looking at the .hs-boot file. - (_, _, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised' - loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', pkgs1 `Set.union` pkgs, summarised'') + (_, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised' + loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', summarised'') where k = NodeKey_Module (msKey ms) @@ -1692,18 +1692,17 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- Visited set; the range is a list because -- the roots can have the same module names -- if allow_dup_roots is True - -> IO ([NodeKey], Set.Set (UnitId, UnitId), - + -> IO ([NodeKey], M.Map NodeKey ModuleGraphNode, DownsweepCache) -- The result is the completed NodeMap - loopImports [] done summarised = return ([], Set.empty, done, summarised) + loopImports [] done summarised = return ([], done, summarised) loopImports ((home_uid,mb_pkg, gwib) : ss) done summarised | Just summs <- M.lookup cache_key summarised = case summs of [Right ms] -> do let nk = NodeKey_Module (msKey ms) - (rest, pkgs, summarised', done') <- loopImports ss done summarised - return (nk: rest, pkgs, summarised', done') + (rest, summarised', done') <- loopImports ss done summarised + return (nk: rest, summarised', done') [Left _err] -> loopImports ss done summarised _errs -> do @@ -1715,20 +1714,20 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots Nothing excl_mods case mb_s of NotThere -> loopImports ss done summarised - External uid -> do - (other_deps, pkgs, done', summarised') <- loopImports ss done summarised - return (other_deps, Set.insert (homeUnitId home_unit, uid) pkgs, done', summarised') + External _ -> do + (other_deps, done', summarised') <- loopImports ss done summarised + return (other_deps, done', summarised') FoundInstantiation iud -> do - (other_deps, pkgs, done', summarised') <- loopImports ss done summarised - return (NodeKey_Unit iud : other_deps, pkgs, done', summarised') + (other_deps, done', summarised') <- loopImports ss done summarised + return (NodeKey_Unit iud : other_deps, done', summarised') FoundHomeWithError (_uid, e) -> loopImports ss done (Map.insert cache_key [(Left e)] summarised) FoundHome s -> do - (done', pkgs1, summarised') <- - loopSummaries [s] (done, Set.empty, Map.insert cache_key [Right s] summarised) - (other_deps, pkgs2, final_done, final_summarised) <- loopImports ss done' summarised' + (done', summarised') <- + loopSummaries [s] (done, Map.insert cache_key [Right s] summarised) + (other_deps, final_done, final_summarised) <- loopImports ss done' summarised' -- MP: This assumes that we can only instantiate non home units, which is probably fair enough for now. - return (NodeKey_Module (msKey s) : other_deps, pkgs1 `Set.union` pkgs2, final_done, final_summarised) + return (NodeKey_Module (msKey s) : other_deps, final_done, final_summarised) where cache_key = (home_uid, mb_pkg, unLoc <$> gwib) home_unit = ue_unitHomeUnit home_uid (hsc_unit_env hsc_env) @@ -1737,47 +1736,52 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots -- This function checks then important property that if both p and q are home units -- then any dependency of p, which transitively depends on q is also a home unit. -checkHomeUnitsClosed :: UnitEnv -> Set.Set UnitId -> [(UnitId, UnitId)] -> [DriverMessages] --- Fast path, trivially closed. -checkHomeUnitsClosed ue home_id_set home_imp_ids - | Set.size home_id_set == 1 = [] - | otherwise = - let res = foldMap loop home_imp_ids - -- Now check whether everything which transitively depends on a home_unit is actually a home_unit - -- These units are the ones which we need to load as home packages but failed to do for some reason, - -- it's a bug in the tool invoking GHC. - bad_unit_ids = Set.difference res home_id_set - in if Set.null bad_unit_ids - then [] - else [singleMessage $ mkPlainErrorMsgEnvelope rootLoc $ DriverHomePackagesNotClosed (Set.toList bad_unit_ids)] - +checkHomeUnitsClosed :: UnitEnv -> Set.Set UnitId -> [DriverMessages] +checkHomeUnitsClosed ue home_id_set + | Set.null bad_unit_ids = [] + | otherwise = [singleMessage $ mkPlainErrorMsgEnvelope rootLoc $ DriverHomePackagesNotClosed (Set.toList bad_unit_ids)] where + bad_unit_ids = upwards_closure Set.\\ home_id_set rootLoc = mkGeneralSrcSpan (fsLit "") - -- TODO: This could repeat quite a bit of work but I struggled to write this function. - -- Which units transitively depend on a home unit - loop :: (UnitId, UnitId) -> Set.Set UnitId -- The units which transitively depend on a home unit - loop (from_uid, uid) = - let us = ue_findHomeUnitEnv from_uid ue in - let um = unitInfoMap (homeUnitEnv_units us) in - case lookupUniqMap um uid of - Nothing -> pprPanic "uid not found" (ppr uid) - Just ui -> - let depends = unitDepends ui - home_depends = Set.fromList depends `Set.intersection` home_id_set - other_depends = Set.fromList depends `Set.difference` home_id_set - in - -- Case 1: The unit directly depends on a home_id - if not (null home_depends) - then - let res = foldMap (loop . (from_uid,)) other_depends - in Set.insert uid res - -- Case 2: Check the rest of the dependencies, and then see if any of them depended on - else - let res = foldMap (loop . (from_uid,)) other_depends - in - if not (Set.null res) - then Set.insert uid res - else res + + graph :: Graph (Node UnitId UnitId) + graph = graphFromEdgedVerticesUniq graphNodes + + -- downwards closure of graph + downwards_closure + = graphFromEdgedVerticesUniq [ DigraphNode uid uid (Set.toList deps) + | (uid, deps) <- M.toList (allReachable graph node_key)] + + inverse_closure = transposeG downwards_closure + + upwards_closure = Set.fromList $ map node_key $ reachablesG inverse_closure [DigraphNode uid uid [] | uid <- Set.toList home_id_set] + + all_unit_direct_deps :: UniqMap UnitId (Set.Set UnitId) + all_unit_direct_deps + = unitEnv_foldWithKey go emptyUniqMap $ ue_home_unit_graph ue + where + go rest this this_uis = + plusUniqMap_C Set.union + (addToUniqMap_C Set.union external_depends this (Set.fromList $ this_deps)) + rest + where + external_depends = mapUniqMap (Set.fromList . unitDepends) (unitInfoMap this_units) + this_units = homeUnitEnv_units this_uis + this_deps = [ toUnitId unit | (unit,Just _) <- explicitUnits this_units] + + graphNodes :: [Node UnitId UnitId] + graphNodes = go Set.empty home_id_set + where + go done todo + = case Set.minView todo of + Nothing -> [] + Just (uid, todo') + | Set.member uid done -> go done todo' + | otherwise -> case lookupUniqMap all_unit_direct_deps uid of + Nothing -> pprPanic "uid not found" (ppr (uid, all_unit_direct_deps)) + Just depends -> + let todo'' = (depends Set.\\ done) `Set.union` todo' + in DigraphNode uid uid (Set.toList depends) : go (Set.insert uid done) todo'' -- | Update the every ModSummary that is depended on -- by a module that needs template haskell. We enable codegen to View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1ec70543a6001afb34b33f67036d4492a1cd78b7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1ec70543a6001afb34b33f67036d4492a1cd78b7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 19:00:42 2024 From: gitlab at gitlab.haskell.org (Bodigrim (@Bodigrim)) Date: Fri, 01 Mar 2024 14:00:42 -0500 Subject: [Git][ghc/ghc][wip/data-list-nonempty-unzip] Data.List.NonEmpty.unzip: use WARNING with category insted of DEPRECATED Message-ID: <65e225dad1c5_325b453a4ac74779e8@gitlab.mail> Bodigrim pushed to branch wip/data-list-nonempty-unzip at Glasgow Haskell Compiler / GHC Commits: 08060313 by Andrew Lelechenko at 2024-03-01T20:00:34+01:00 Data.List.NonEmpty.unzip: use WARNING with category insted of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 4 changed files: - compiler/GHC/Data/Bag.hs - compiler/GHC/HsToCore/Match/Constructor.hs - libraries/base/changelog.md - libraries/base/src/Data/List/NonEmpty.hs Changes: ===================================== compiler/GHC/Data/Bag.hs ===================================== @@ -7,7 +7,7 @@ Bag: an unordered collection with duplicates -} {-# LANGUAGE ScopedTypeVariables, DeriveTraversable, TypeFamilies #-} -{-# OPTIONS_GHC -Wno-deprecations #-} +{-# OPTIONS_GHC -Wno-unrecognised-warning-flags -Wno-x-data-list-nonempty-unzip #-} module GHC.Data.Bag ( Bag, -- abstract type ===================================== compiler/GHC/HsToCore/Match/Constructor.hs ===================================== @@ -2,7 +2,7 @@ {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -{-# OPTIONS_GHC -Wno-deprecations #-} +{-# OPTIONS_GHC -Wno-unrecognised-warning-flags -Wno-x-data-list-nonempty-unzip #-} {- (c) The University of Glasgow 2006 ===================================== libraries/base/changelog.md ===================================== @@ -17,7 +17,10 @@ * Always use `safe` call to `read` for regular files and block devices on unix if the RTS is multi-threaded, regardless of `O_NONBLOCK`. ([CLC proposal #166](https://github.com/haskell/core-libraries-committee/issues/166)) * Export List from Data.List ([CLC proposal #182](https://github.com/haskell/core-libraries-committee/issues/182)). - * Deprecate `Data.List.NonEmpty.unzip` ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86)) + * Add `{-# WARNING in "x-data-list-nonempty-unzip" #-}` to `Data.List.NonEmpty.unzip`. + Use `{-# OPTIONS_GHC -Wno-x-data-list-nonempty-unzip #-}` to disable it. + ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86) + and [CLC proposal #258](https://github.com/haskell/core-libraries-committee/issues/258)) * Add `System.Mem.performMajorGC` ([CLC proposal #230](https://github.com/haskell/core-libraries-committee/issues/230)) * Fix exponent overflow/underflow bugs in the `Read` instances for `Float` and `Double` ([CLC proposal #192](https://github.com/haskell/core-libraries-committee/issues/192)) * Implement `many` and `some` methods of `instance Alternative (Compose f g)` explicitly. ([CLC proposal #181](https://github.com/haskell/core-libraries-committee/issues/181)) ===================================== libraries/base/src/Data/List/NonEmpty.hs ===================================== @@ -534,7 +534,7 @@ zipWith f ~(x :| xs) ~(y :| ys) = f x y :| List.zipWith f xs ys -- | The 'unzip' function is the inverse of the 'zip' function. unzip :: Functor f => f (a,b) -> (f a, f b) unzip xs = (fst <$> xs, snd <$> xs) -{-# DEPRECATED unzip "This function will be made monomorphic in base-4.22, consider switching to GHC.Internal.Data.Functor.unzip" #-} +{-# WARNING in "x-data-list-nonempty-unzip" unzip "This function will be made monomorphic in base-4.22, consider switching to Data.Functor.unzip" #-} -- | The 'nub' function removes duplicate elements from a list. In -- particular, it keeps only the first occurrence of each element. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/08060313be00f3e5d3fdc9d01c58520b5d640c14 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/08060313be00f3e5d3fdc9d01c58520b5d640c14 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 20:02:19 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 01 Mar 2024 15:02:19 -0500 Subject: [Git][ghc/ghc][master] 2 commits: Introduce ListTuplePuns extension Message-ID: <65e2344b6a096_325b455641284838a3@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Instance/Typeable.hs - compiler/GHC/Tc/Validity.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Name.hs - compiler/GHC/Types/Name/Cache.hs - compiler/GHC/Types/Name/Ppr.hs - compiler/GHC/Unit/Types.hs - compiler/GHC/Utils/Outputable.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/exts/data_kinds.rst The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/39583c399193b3dedc399f4dccbd222640581956...bbdb6286854dca442ab2b6aeebc734cfb7e0bd9a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/39583c399193b3dedc399f4dccbd222640581956...bbdb6286854dca442ab2b6aeebc734cfb7e0bd9a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 20:02:56 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 01 Mar 2024 15:02:56 -0500 Subject: [Git][ghc/ghc][master] 2 commits: Improve error messages coming from non-linear patterns Message-ID: <65e23470be0d9_325b4557e39988722f@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 13 changed files: - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Gen/Bind.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/Types/Origin.hs - docs/users_guide/exts/linear_types.rst - testsuite/tests/linear/should_fail/Linear9.stderr - testsuite/tests/linear/should_fail/LinearAsPat.stderr - testsuite/tests/linear/should_fail/LinearLazyPat.stderr - testsuite/tests/linear/should_fail/LinearLet6.stderr - testsuite/tests/linear/should_fail/LinearLet7.stderr - testsuite/tests/linear/should_fail/LinearPatSyn.stderr - testsuite/tests/linear/should_fail/LinearViewPattern.stderr - testsuite/tests/linear/should_fail/T20083.stderr Changes: ===================================== compiler/GHC/Tc/Errors.hs ===================================== @@ -1175,7 +1175,7 @@ reportGroup mk_err ctxt items -- See Note [No deferring for multiplicity errors] nonDeferrableOrigin :: CtOrigin -> Bool -nonDeferrableOrigin NonLinearPatternOrigin = True +nonDeferrableOrigin (NonLinearPatternOrigin {}) = True nonDeferrableOrigin (UsageEnvironmentOf {}) = True nonDeferrableOrigin (FRROrigin {}) = True nonDeferrableOrigin _ = False ===================================== compiler/GHC/Tc/Gen/Bind.hs ===================================== @@ -804,7 +804,7 @@ tcPolyInfer rec_tc prag_fn tc_sig_fn bind_list manyIfPat bind@(L _ (PatBind{pat_lhs=(L _ (VarPat{}))})) = return bind manyIfPat (L loc pat@(PatBind {pat_mult=mult_ann, pat_lhs=lhs, pat_ext =(pat_ty,_)})) - = do { mult_co_wrap <- tcSubMult NonLinearPatternOrigin ManyTy (getTcMultAnn mult_ann) + = do { mult_co_wrap <- tcSubMult (NonLinearPatternOrigin GeneralisedPatternReason nlWildPatName) ManyTy (getTcMultAnn mult_ann) -- The wrapper checks for correct multiplicities. -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. ; let lhs' = mkLHsWrapPat mult_co_wrap lhs pat_ty ===================================== compiler/GHC/Tc/Gen/Pat.hs ===================================== @@ -114,14 +114,14 @@ tcLetPat sig_fn no_gen pat pat_ty thing_inside | xopt LangExt.Strict dflags = xstrict lpat | otherwise = not_xstrict lpat where - xstrict (L _ (LazyPat _ _)) = checkManyPattern pat_ty + xstrict p@(L _ (LazyPat _ _)) = checkManyPattern LazyPatternReason p pat_ty xstrict (L _ (ParPat _ p)) = xstrict p xstrict _ = return WpHole not_xstrict (L _ (BangPat _ _)) = return WpHole not_xstrict (L _ (VarPat _ _)) = return WpHole not_xstrict (L _ (ParPat _ p)) = not_xstrict p - not_xstrict _ = checkManyPattern pat_ty + not_xstrict p = checkManyPattern LazyPatternReason p pat_ty ----------------- tcMatchPats :: forall a. @@ -467,8 +467,8 @@ tc_lpats tys penv pats -------------------- -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. -checkManyPattern :: Scaled a -> TcM HsWrapper -checkManyPattern pat_ty = tcSubMult NonLinearPatternOrigin ManyTy (scaledMult pat_ty) +checkManyPattern :: NonLinearPatternReason -> LPat GhcRn -> Scaled a -> TcM HsWrapper +checkManyPattern reason pat pat_ty = tcSubMult (NonLinearPatternOrigin reason pat) ManyTy (scaledMult pat_ty) tc_forall_lpat :: TcTyVar -> Checker (LPat GhcRn) (LPat GhcTc) @@ -582,7 +582,7 @@ tc_pat pat_ty penv ps_pat thing_inside = case ps_pat of ; return (BangPat x pat', res) } LazyPat x pat -> do - { mult_wrap <- checkManyPattern pat_ty + { mult_wrap <- checkManyPattern LazyPatternReason (noLocA ps_pat) pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. ; (pat', (res, pat_ct)) <- tc_lpat pat_ty (makeLazy penv) pat $ @@ -600,14 +600,14 @@ tc_pat pat_ty penv ps_pat thing_inside = case ps_pat of ; return (mkHsWrapPat mult_wrap (LazyPat x pat') pat_ty, res) } WildPat _ -> do - { mult_wrap <- checkManyPattern pat_ty + { mult_wrap <- checkManyPattern OtherPatternReason (noLocA ps_pat) pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. ; res <- thing_inside ; pat_ty <- expTypeToType (scaledThing pat_ty) ; return (mkHsWrapPat mult_wrap (WildPat pat_ty) pat_ty, res) } AsPat x (L nm_loc name) pat -> do - { mult_wrap <- checkManyPattern pat_ty + { mult_wrap <- checkManyPattern OtherPatternReason (noLocA ps_pat) pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. ; (wrap, bndr_id) <- setSrcSpanA nm_loc (tcPatBndr penv name pat_ty) ; (pat', res) <- tcExtendIdEnv1 name bndr_id $ @@ -624,7 +624,7 @@ tc_pat pat_ty penv ps_pat thing_inside = case ps_pat of ; return (mkHsWrapPat (wrap <.> mult_wrap) (AsPat x (L nm_loc bndr_id) pat') pat_ty, res) } ViewPat _ expr pat -> do - { mult_wrap <- checkManyPattern pat_ty + { mult_wrap <- checkManyPattern ViewPatternReason (noLocA ps_pat) pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. -- -- It should be possible to have view patterns at linear (or otherwise @@ -790,7 +790,7 @@ Fortunately that's what matchActualFunTy returns anyway. -- -- When there is no negation, neg_lit_ty and lit_ty are the same NPat _ (L l over_lit) mb_neg eq -> do - { mult_wrap <- checkManyPattern pat_ty + { mult_wrap <- checkManyPattern OtherPatternReason (noLocA ps_pat) pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. -- -- It may be possible to refine linear pattern so that they work in @@ -843,7 +843,7 @@ AST is used for the subtraction operation. -- See Note [NPlusK patterns] NPlusKPat _ (L nm_loc name) (L loc lit) _ ge minus -> do - { mult_wrap <- checkManyPattern pat_ty + { mult_wrap <- checkManyPattern OtherPatternReason (noLocA ps_pat) pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. ; let pat_exp_ty = scaledThing pat_ty orig = LiteralOrigin lit @@ -1225,7 +1225,7 @@ tcPatSynPat (L con_span con_name) pat_syn pat_ty penv arg_pats thing_inside ; when (any isEqPred prov_theta) warnMonoLocalBinds - ; mult_wrap <- checkManyPattern pat_ty + ; mult_wrap <- checkManyPattern PatternSynonymReason nlWildPatName pat_ty -- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify. ; (univ_ty_args, ex_ty_args) <- splitConTyArgs con_like arg_pats ===================================== compiler/GHC/Tc/Types/Origin.hs ===================================== @@ -22,7 +22,7 @@ module GHC.Tc.Types.Origin ( isVisibleOrigin, toInvisibleOrigin, pprCtOrigin, isGivenOrigin, isWantedWantedFunDepOrigin, isWantedSuperclassOrigin, - ClsInstOrQC(..), NakedScFlag(..), + ClsInstOrQC(..), NakedScFlag(..), NonLinearPatternReason(..), TypedThing(..), TyVarBndrs(..), @@ -621,7 +621,7 @@ data CtOrigin Module -- ^ Module in which the instance was declared ClsInst -- ^ The declared typeclass instance - | NonLinearPatternOrigin + | NonLinearPatternOrigin NonLinearPatternReason (LPat GhcRn) | UsageEnvironmentOf Name | CycleBreakerOrigin @@ -642,6 +642,12 @@ data CtOrigin Type -- the instantiated type of the method | AmbiguityCheckOrigin UserTypeCtxt +data NonLinearPatternReason + = LazyPatternReason + | GeneralisedPatternReason + | PatternSynonymReason + | ViewPatternReason + | OtherPatternReason -- | The number of superclass selections needed to get this Given. -- If @d :: C ty@ has @ScDepth=2@, then the evidence @d@ will look @@ -881,6 +887,10 @@ pprCtOrigin (ScOrigin (IsQC orig) nkd) , whenPprDebug (braces (text "sc-origin:" <> ppr nkd)) , pprCtOrigin orig ] +pprCtOrigin (NonLinearPatternOrigin reason pat) + = hang (ctoHerald <+> text "a non-linear pattern" <+> quotes (ppr pat)) + 2 (pprNonLinearPatternReason reason) + pprCtOrigin simple_origin = ctoHerald <+> pprCtO simple_origin @@ -921,7 +931,6 @@ pprCtO PatCheckOrigin = text "a pattern-match completeness check" pprCtO ListOrigin = text "an overloaded list" pprCtO IfThenElseOrigin = text "an if-then-else expression" pprCtO StaticOrigin = text "a static form" -pprCtO NonLinearPatternOrigin = text "a non-linear pattern" pprCtO (UsageEnvironmentOf x) = hsep [text "multiplicity of", quotes (ppr x)] pprCtO BracketOrigin = text "a quotation bracket" @@ -949,7 +958,14 @@ pprCtO (WantedSuperclassOrigin {}) = text "a superclass constraint" pprCtO (InstanceSigOrigin {}) = text "a type signature in an instance" pprCtO (AmbiguityCheckOrigin {}) = text "a type ambiguity check" pprCtO (ImpedanceMatching {}) = text "combining required constraints" - +pprCtO (NonLinearPatternOrigin _ pat) = hsep [text "a non-linear pattern" <+> quotes (ppr pat)] + +pprNonLinearPatternReason :: HasCallStack => NonLinearPatternReason -> SDoc +pprNonLinearPatternReason LazyPatternReason = parens (text "non-variable lazy pattern aren't linear") +pprNonLinearPatternReason GeneralisedPatternReason = parens (text "non-variable pattern bindings that have been generalised aren't linear") +pprNonLinearPatternReason PatternSynonymReason = parens (text "pattern synonyms aren't linear") +pprNonLinearPatternReason ViewPatternReason = parens (text "view patterns aren't linear") +pprNonLinearPatternReason OtherPatternReason = empty {- ********************************************************************* * * ===================================== docs/users_guide/exts/linear_types.rst ===================================== @@ -119,7 +119,7 @@ multiplicity if: - The binding is a pattern binding (including a simple variable) ``p=e`` (you can't write ``let %1 f x = u``, instead write ``let %1 f = \x -> u``) -- Either ``p`` is of the form ``!p'`` or ``p`` is a variable. In +- Either ``p`` is strict (see infra) or ``p`` is a variable. In particular neither ``x at y`` nor ``(x)`` are covered by “is a variable” @@ -136,13 +136,79 @@ as follows: - In all other cases, including function bindings ``let f x1...xn = rhs``, the multiplicity is inferred from the term. -When ``-XMonoLocalBinds`` is on, the following also holds: +When ``-XMonoLocalBinds`` is off, the following also holds: - Multiplicity-annotated non-variable pattern-bindings (such as ``let %1 !(x,y) = rhs``) are never generalised. - Non-variable pattern bindings which are inferred as polymorphic or qualified are inferred as having multiplicity ``Many``. +Strict patterns +~~~~~~~~~~~~~~~ + +GHC considers that non-variable lazy patterns consume the scrutinee +with multiplicity ``Many``. In practice, a pattern is strict (hence +can be linear) if (otherwise the pattern is lazy): + +- The pattern is a case alternative and isn't annotated with a ``~`` +- The pattern is a let-binding, and is annotated with a ``!`` +- The pattern is a let-binding, :extension:`Strict` is on, and isn't + annotated with a ``~`` +- The pattern is nested inside a strict pattern + +Here are some examples of the impact on linear typing: + +Without ``-XStrict``:: + + -- good + let %1 x = u in … + + -- good + let %1 !x = u in … + + -- bad + let %1 (x, y) = u in … + + -- good + let %Many (x, y) = u in … + + -- good + let %1 !(x, y) = u in … + + -- good + let %1 (!(x, y)) = u in … + + -- inferred unrestricted + let (x, y) = u in … + + -- can be inferred linear + case u of (x, y) -> … + + -- inferred unrestricted + case u of ~(x, y) -> … + +With ``-XStrict``:: + -- good + let %1 x = u in … + + -- good + let %1 !x = u in … + + -- good + let %1 (x, y) = u in … + + -- bad + let %1 ~(x, y) = u in … + + -- good + let %Many ~(x, y) = u in … + + -- can be inferred linear + let (x, y) = u in … + + -- inferred unrestricted + let ~(x, y) = u in … + Data types ---------- By default, all fields in algebraic data types are linear (even if ===================================== testsuite/tests/linear/should_fail/Linear9.stderr ===================================== @@ -1,7 +1,7 @@ Linear9.hs:9:17: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ • In the pattern: _ In the pattern: (a, _) In an equation for ‘incorrectFst’: incorrectFst (a, _) = a @@ -21,14 +21,14 @@ Linear9.hs:15:20: error: [GHC-18872] Linear9.hs:18:21: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ • In the pattern: _ In the pattern: (a, _) In the pattern: ((a, _), _) Linear9.hs:18:24: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ • In the pattern: _ In the pattern: ((a, _), _) In an equation for ‘incorrectFstFst’: @@ -36,7 +36,7 @@ Linear9.hs:18:24: error: [GHC-18872] Linear9.hs:25:25: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ • In the pattern: _ In the pattern: Foo a _ In an equation for ‘incorrectTestFst’: ===================================== testsuite/tests/linear/should_fail/LinearAsPat.stderr ===================================== @@ -1,5 +1,5 @@ LinearAsPat.hs:6:12: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘x at True’ • In an equation for ‘shouldFail’: shouldFail x at True = x ===================================== testsuite/tests/linear/should_fail/LinearLazyPat.stderr ===================================== @@ -1,6 +1,7 @@ LinearLazyPat.hs:5:3: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘~(x, y)’ + (non-variable lazy pattern aren't linear) • In the pattern: ~(x, y) In an equation for ‘f’: f ~(x, y) = (y, x) ===================================== testsuite/tests/linear/should_fail/LinearLet6.stderr ===================================== @@ -15,7 +15,8 @@ LinearLet6.hs:10:3: error: [GHC-18872] LinearLet6.hs:15:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘Just y’ + (non-variable lazy pattern aren't linear) • In a pattern binding: (Just y) = x In the expression: let %1 (Just y) = x in y In an equation for ‘h’: h x = let %1 (Just y) = x in y ===================================== testsuite/tests/linear/should_fail/LinearLet7.stderr ===================================== @@ -8,6 +8,7 @@ LinearLet7.hs:6:14: error: [GHC-18872] LinearLet7.hs:6:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ + (non-variable pattern bindings that have been generalised aren't linear) • In the expression: let %1 g = \ y -> ... in g x In an equation for ‘f’: f x = let %1 g = ... in g x ===================================== testsuite/tests/linear/should_fail/LinearPatSyn.stderr ===================================== @@ -1,6 +1,7 @@ LinearPatSyn.hs:13:4: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ + (pattern synonyms aren't linear) • In the pattern: P y x In an equation for ‘s’: s (P y x) = (y, x) ===================================== testsuite/tests/linear/should_fail/LinearViewPattern.stderr ===================================== @@ -1,6 +1,7 @@ LinearViewPattern.hs:11:4: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘not -> True’ + (view patterns aren't linear) • In the pattern: not -> True In an equation for ‘f’: f (not -> True) = True ===================================== testsuite/tests/linear/should_fail/T20083.stderr ===================================== @@ -13,6 +13,6 @@ T20083.hs:6:6: error: [GHC-25897] T20083.hs:9:5: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern + arising from a non-linear pattern ‘_’ • In the pattern: _ In an equation for ‘ap2’: ap2 _ = () View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bbdb6286854dca442ab2b6aeebc734cfb7e0bd9a...6612388e0e360bd4f6eaddee3f632deed8616a5e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bbdb6286854dca442ab2b6aeebc734cfb7e0bd9a...6612388e0e360bd4f6eaddee3f632deed8616a5e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 22:06:04 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 01 Mar 2024 17:06:04 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/weird-sign-extends Message-ID: <65e2514cc8670_3cfa0d35198b8369e1@gitlab.mail> Matthew Craven pushed new branch wip/weird-sign-extends at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/weird-sign-extends You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 1 22:33:26 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Fri, 01 Mar 2024 17:33:26 -0500 Subject: [Git][ghc/ghc][wip/T24471] 13 commits: testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e257b69d9ac_3cfa0d4130ca040428@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - e85fa5a8 by Simon Peyton Jones at 2024-03-01T22:33:18+00:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 3.5%, and much more in artificial cases. Metric Decrease: CoOpt_Read - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Iface/Ext/Utils.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f4e4ecd37911431b15349d39ea4bd948ca6fd386...e85fa5a8daedafa2304290ef803bdfa5edf53d9c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f4e4ecd37911431b15349d39ea4bd948ca6fd386...e85fa5a8daedafa2304290ef803bdfa5edf53d9c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 02:21:40 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 01 Mar 2024 21:21:40 -0500 Subject: [Git][ghc/ghc][wip/weird-sign-extends] Work around untracked dependencies Message-ID: <65e28d3450255_3cfa0da1d58e4577a6@gitlab.mail> Matthew Craven pushed to branch wip/weird-sign-extends at Glasgow Haskell Compiler / GHC Commits: afec6c32 by Matthew Craven at 2024-03-01T21:21:17-05:00 Work around untracked dependencies This is a temporary hack, until ghc properly reports the implicit dependency of every module outside of ghc-bignum or ghc-prim on GHC.Num.BigNat. Otherwise we see CI failures. See also #23942. - - - - - 3 changed files: - compiler/GHC/Utils/Containers/Internal/StrictPair.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs Changes: ===================================== compiler/GHC/Utils/Containers/Internal/StrictPair.hs ===================================== @@ -4,6 +4,10 @@ module GHC.Utils.Containers.Internal.StrictPair (StrictPair(..), toPair) where +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () + + -- | The same as a regular Haskell pair, but -- -- @ ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -81,3 +81,6 @@ module Data.Sum.Experimental ( ) where import GHC.Types + +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,6 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes + +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/afec6c32dca543203068ff5029d453ae52db1ccf -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/afec6c32dca543203068ff5029d453ae52db1ccf You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 03:31:44 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 01 Mar 2024 22:31:44 -0500 Subject: [Git][ghc/ghc][wip/weird-sign-extends] Work around untracked dependencies Message-ID: <65e29da05d804_3cfa0dc29032c580ed@gitlab.mail> Matthew Craven pushed to branch wip/weird-sign-extends at Glasgow Haskell Compiler / GHC Commits: b3069ef5 by Matthew Craven at 2024-03-01T22:31:18-05:00 Work around untracked dependencies This is a temporary hack, until ghc properly reports the implicit dependency of every module outside of ghc-bignum or ghc-prim on GHC.Num.BigNat. Otherwise we see CI failures. See also #23942. - - - - - 4 changed files: - compiler/GHC/Utils/Containers/Internal/StrictPair.hs - libraries/base/src/GHC/IO/Encoding/Iconv.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs Changes: ===================================== compiler/GHC/Utils/Containers/Internal/StrictPair.hs ===================================== @@ -4,6 +4,10 @@ module GHC.Utils.Containers.Internal.StrictPair (StrictPair(..), toPair) where +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () + + -- | The same as a regular Haskell pair, but -- -- @ ===================================== libraries/base/src/GHC/IO/Encoding/Iconv.hs ===================================== @@ -27,4 +27,7 @@ import GHC.Internal.IO.Encoding.Iconv #else ( ) where +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () + #endif ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -81,3 +81,6 @@ module Data.Sum.Experimental ( ) where import GHC.Types + +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,6 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes + +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3069ef5d89a8d6d2a36f2166b327fd8d0582064 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3069ef5d89a8d6d2a36f2166b327fd8d0582064 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 04:34:22 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 01 Mar 2024 23:34:22 -0500 Subject: [Git][ghc/ghc][wip/weird-sign-extends] Work around untracked dependencies Message-ID: <65e2ac4e11a51_3cfa0dddc1560585f@gitlab.mail> Matthew Craven pushed to branch wip/weird-sign-extends at Glasgow Haskell Compiler / GHC Commits: 0bb5001f by Matthew Craven at 2024-03-01T23:33:20-05:00 Work around untracked dependencies This is a temporary hack, until ghc properly reports the implicit dependency of every module outside of ghc-bignum or ghc-prim on GHC.Num.BigNat. Otherwise we see CI failures. See also #23942. - - - - - 4 changed files: - compiler/GHC/Utils/Containers/Internal/StrictPair.hs - libraries/base/src/GHC/IO/Encoding/Iconv.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs Changes: ===================================== compiler/GHC/Utils/Containers/Internal/StrictPair.hs ===================================== @@ -4,6 +4,10 @@ module GHC.Utils.Containers.Internal.StrictPair (StrictPair(..), toPair) where +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () + + -- | The same as a regular Haskell pair, but -- -- @ ===================================== libraries/base/src/GHC/IO/Encoding/Iconv.hs ===================================== @@ -27,4 +27,7 @@ import GHC.Internal.IO.Encoding.Iconv #else ( ) where +-- stupid build-order workaround until #23942 is properly fixed +import Prelude () + #endif ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -81,3 +81,6 @@ module Data.Sum.Experimental ( ) where import GHC.Types + +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,6 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes + +-- stupid build-order workaround until #23942 is properly fixed +import GHC.Base () View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0bb5001f5263b9b986877ccd0da9b21a8ac1f91b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0bb5001f5263b9b986877ccd0da9b21a8ac1f91b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 10:01:32 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sat, 02 Mar 2024 05:01:32 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Ensure __clzdi2 builtin is around Message-ID: <65e2f8fcc1b2b_245adb7211694966c4@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: a528db71 by Sven Tennie at 2024-03-02T11:00:57+01:00 Ensure __clzdi2 builtin is around - - - - - 1 changed file: - rts/RtsSymbols.c Changes: ===================================== rts/RtsSymbols.c ===================================== @@ -971,6 +971,13 @@ extern char **environ; #define RTS_LIBGCC_SYMBOLS #endif +#if defined(riscv64_HOST_ARCH) +#define RTS_ARCH_LIBGCC_SYMBOLS \ + SymI_NeedsProto(__clzdi2) +#else +#define RTS_ARCH_LIBGCC_SYMBOLS +#endif + // Symbols defined by libgcc/compiler-rt for AArch64's outline atomics. #if defined(HAVE_ARM_OUTLINE_ATOMICS) #include "ARMOutlineAtomicsSymbols.h" @@ -1023,6 +1030,7 @@ RTS_DARWIN_ONLY_SYMBOLS RTS_OPENBSD_ONLY_SYMBOLS RTS_LIBC_SYMBOLS RTS_LIBGCC_SYMBOLS +RTS_ARCH_LIBGCC_SYMBOLS RTS_FINI_ARRAY_SYMBOLS RTS_LIBFFI_SYMBOLS RTS_ARM_OUTLINE_ATOMIC_SYMBOLS @@ -1065,6 +1073,7 @@ RtsSymbolVal rtsSyms[] = { RTS_DARWIN_ONLY_SYMBOLS RTS_OPENBSD_ONLY_SYMBOLS RTS_LIBGCC_SYMBOLS + RTS_ARCH_LIBGCC_SYMBOLS RTS_FINI_ARRAY_SYMBOLS RTS_LIBFFI_SYMBOLS RTS_ARM_OUTLINE_ATOMIC_SYMBOLS View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a528db715df4e8ecb7062ed05780da031e6c92ce -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a528db715df4e8ecb7062ed05780da031e6c92ce You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 16:42:08 2024 From: gitlab at gitlab.haskell.org (sheaf (@sheaf)) Date: Sat, 02 Mar 2024 11:42:08 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] Add .stdout for T24496 test Message-ID: <65e356dfe63b0_16b1d16134cb8967ef@gitlab.mail> sheaf pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: b3e9e352 by sheaf at 2024-03-02T17:37:05+01:00 Add .stdout for T24496 test - - - - - 1 changed file: - + testsuite/tests/primops/should_run/T24496.stdout Changes: ===================================== testsuite/tests/primops/should_run/T24496.stdout ===================================== @@ -0,0 +1,2 @@ +(6.0,0.0) +(6.0,0.0) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3e9e3520c83481fc426e54d9ead53f8510e603c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3e9e3520c83481fc426e54d9ead53f8510e603c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 16:54:32 2024 From: gitlab at gitlab.haskell.org (Bodigrim (@Bodigrim)) Date: Sat, 02 Mar 2024 11:54:32 -0500 Subject: [Git][ghc/ghc][wip/data-list-nonempty-unzip] 13 commits: testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e359c8dffd1_16b1d1686cf5810081a@gitlab.mail> Bodigrim pushed to branch wip/data-list-nonempty-unzip at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - e4c9fc80 by Andrew Lelechenko at 2024-03-02T17:54:22+01:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Iface/Ext/Utils.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Gen/Bind.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/08060313be00f3e5d3fdc9d01c58520b5d640c14...e4c9fc80011e54fc1f9bb1c117c138c2fd484644 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/08060313be00f3e5d3fdc9d01c58520b5d640c14...e4c9fc80011e54fc1f9bb1c117c138c2fd484644 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 19:11:16 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 02 Mar 2024 14:11:16 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: Introduce ListTuplePuns extension Message-ID: <65e379d4ae6eb_16b1d1a4e27e411005e@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 338b923b by Cheng Shao at 2024-03-02T14:11:12-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - df863128 by Andrew Lelechenko at 2024-03-02T14:11:13-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Gen/Bind.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/Instance/Typeable.hs - compiler/GHC/Tc/Types/Origin.hs - compiler/GHC/Tc/Validity.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fefb63f1fad3c66f8984636bbaad541de6c28137...df8631287d4fa20ca2f19619c289c630e3e1c040 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fefb63f1fad3c66f8984636bbaad541de6c28137...df8631287d4fa20ca2f19619c289c630e3e1c040 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 20:00:24 2024 From: gitlab at gitlab.haskell.org (Jade (@Jade)) Date: Sat, 02 Mar 2024 15:00:24 -0500 Subject: [Git][ghc/ghc][wip/T17879] 21 commits: Fix formatting in whereFrom docstring Message-ID: <65e385586422c_16b1d1bad1640116914@gitlab.mail> Jade pushed to branch wip/T17879 at Glasgow Haskell Compiler / GHC Commits: 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 33606b27 by Jade at 2024-03-02T21:04:30+01:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - 30 changed files: - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs - compiler/GHC/Cmm/Dataflow/Graph.hs - compiler/GHC/Cmm/Dataflow/Label.hs - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Cmm/Info.hs - compiler/GHC/Cmm/Info/Build.hs - compiler/GHC/Cmm/LayoutStack.hs - compiler/GHC/Cmm/Lint.hs - compiler/GHC/Cmm/Liveness.hs - compiler/GHC/Cmm/Node.hs - compiler/GHC/Cmm/Pipeline.hs - compiler/GHC/Cmm/ProcPoint.hs - compiler/GHC/Cmm/Reducibility.hs - compiler/GHC/Cmm/Sink.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f5bc9caf745aacf77beabb93490c7c3f2e2ba99...33606b27ece6ace0eb314b195b04d63232efc5cb -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f5bc9caf745aacf77beabb93490c7c3f2e2ba99...33606b27ece6ace0eb314b195b04d63232efc5cb You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 21:26:20 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sat, 02 Mar 2024 16:26:20 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Add symbol prototype for __ctzdi2 Message-ID: <65e3997cb0a93_16b1d1dc8530412371c@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: a4742d26 by Sven Tennie at 2024-03-02T22:25:45+01:00 Add symbol prototype for __ctzdi2 - - - - - 1 changed file: - rts/RtsSymbols.c Changes: ===================================== rts/RtsSymbols.c ===================================== @@ -972,8 +972,11 @@ extern char **environ; #endif #if defined(riscv64_HOST_ARCH) +// See https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html +// as reference for the following built-ins. #define RTS_ARCH_LIBGCC_SYMBOLS \ - SymI_NeedsProto(__clzdi2) + SymI_NeedsProto(__clzdi2) \ + SymI_NeedsProto(__ctzdi2) #else #define RTS_ARCH_LIBGCC_SYMBOLS #endif View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a4742d26bceb2f76e01b94238c2b5c0dc4695656 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a4742d26bceb2f76e01b94238c2b5c0dc4695656 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 22:11:41 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 02 Mar 2024 17:11:41 -0500 Subject: [Git][ghc/ghc][master] compiler: start deprecating cmmToRawCmmHook Message-ID: <65e3a41dc1f24_16b1d1f7533981306f6@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 2 changed files: - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs Changes: ===================================== compiler/GHC/Driver/Hooks.hs ===================================== @@ -154,6 +154,8 @@ data Hooks = Hooks -> IO (Stream IO RawCmmGroup a))) } +{-# DEPRECATED cmmToRawCmmHook "cmmToRawCmmHook is being deprecated. If you do use it in your project, please raise a GHC issue!" #-} + class HasHooks m where getHooks :: m Hooks ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -6,6 +6,9 @@ {-# OPTIONS_GHC -fprof-auto-top #-} +-- Remove this after cmmToRawCmmHook removal +{-# OPTIONS_GHC -Wno-deprecations #-} + ------------------------------------------------------------------------------- -- -- | Main API for compiling plain Haskell source code. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1c064ef1f3e1aa2afc996e962ad53effa99ec5f4 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1c064ef1f3e1aa2afc996e962ad53effa99ec5f4 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 2 22:12:22 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 02 Mar 2024 17:12:22 -0500 Subject: [Git][ghc/ghc][master] Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED Message-ID: <65e3a446a7ba6_16b1d1f8e2164133560@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 4 changed files: - compiler/GHC/Data/Bag.hs - compiler/GHC/HsToCore/Match/Constructor.hs - libraries/base/changelog.md - libraries/base/src/Data/List/NonEmpty.hs Changes: ===================================== compiler/GHC/Data/Bag.hs ===================================== @@ -7,7 +7,7 @@ Bag: an unordered collection with duplicates -} {-# LANGUAGE ScopedTypeVariables, DeriveTraversable, TypeFamilies #-} -{-# OPTIONS_GHC -Wno-deprecations #-} +{-# OPTIONS_GHC -Wno-unrecognised-warning-flags -Wno-x-data-list-nonempty-unzip #-} module GHC.Data.Bag ( Bag, -- abstract type ===================================== compiler/GHC/HsToCore/Match/Constructor.hs ===================================== @@ -2,7 +2,7 @@ {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -{-# OPTIONS_GHC -Wno-deprecations #-} +{-# OPTIONS_GHC -Wno-unrecognised-warning-flags -Wno-x-data-list-nonempty-unzip #-} {- (c) The University of Glasgow 2006 ===================================== libraries/base/changelog.md ===================================== @@ -17,7 +17,10 @@ * Always use `safe` call to `read` for regular files and block devices on unix if the RTS is multi-threaded, regardless of `O_NONBLOCK`. ([CLC proposal #166](https://github.com/haskell/core-libraries-committee/issues/166)) * Export List from Data.List ([CLC proposal #182](https://github.com/haskell/core-libraries-committee/issues/182)). - * Deprecate `Data.List.NonEmpty.unzip` ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86)) + * Add `{-# WARNING in "x-data-list-nonempty-unzip" #-}` to `Data.List.NonEmpty.unzip`. + Use `{-# OPTIONS_GHC -Wno-x-data-list-nonempty-unzip #-}` to disable it. + ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86) + and [CLC proposal #258](https://github.com/haskell/core-libraries-committee/issues/258)) * Add `System.Mem.performMajorGC` ([CLC proposal #230](https://github.com/haskell/core-libraries-committee/issues/230)) * Fix exponent overflow/underflow bugs in the `Read` instances for `Float` and `Double` ([CLC proposal #192](https://github.com/haskell/core-libraries-committee/issues/192)) * Implement `many` and `some` methods of `instance Alternative (Compose f g)` explicitly. ([CLC proposal #181](https://github.com/haskell/core-libraries-committee/issues/181)) ===================================== libraries/base/src/Data/List/NonEmpty.hs ===================================== @@ -534,7 +534,7 @@ zipWith f ~(x :| xs) ~(y :| ys) = f x y :| List.zipWith f xs ys -- | The 'unzip' function is the inverse of the 'zip' function. unzip :: Functor f => f (a,b) -> (f a, f b) unzip xs = (fst <$> xs, snd <$> xs) -{-# DEPRECATED unzip "This function will be made monomorphic in base-4.22, consider switching to GHC.Internal.Data.Functor.unzip" #-} +{-# WARNING in "x-data-list-nonempty-unzip" unzip "This function will be made monomorphic in base-4.22, consider switching to Data.Functor.unzip" #-} -- | The 'nub' function removes duplicate elements from a list. In -- particular, it keeps only the first occurrence of each element. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b74845f740785744ea5a22e2b0677d1bab2a92c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b74845f740785744ea5a22e2b0677d1bab2a92c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 3 01:22:21 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sat, 02 Mar 2024 20:22:21 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] 3 commits: Add comment Message-ID: <65e3d0cd7eadc_16b1d114eff5c41465e3@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: bd2e505d by Sven Tennie at 2024-03-03T02:05:50+01:00 Add comment - - - - - 4df27780 by Sven Tennie at 2024-03-03T02:07:01+01:00 Only trace message on flag - - - - - 05121e86 by Sven Tennie at 2024-03-03T02:20:01+01:00 Check int size on 32 bit width We're handing around 32bit integers. - - - - - 2 changed files: - rts/RtsSymbols.c - rts/linker/elf_reloc_riscv64.c Changes: ===================================== rts/RtsSymbols.c ===================================== @@ -972,8 +972,9 @@ extern char **environ; #endif #if defined(riscv64_HOST_ARCH) -// See https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html -// as reference for the following built-ins. +// See https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html as +// reference for the following built-ins. __clzdi2 and __ctzdi2 probably relate +// to __builtin-s in libraries/ghc-prim/cbits/ctz.c. #define RTS_ARCH_LIBGCC_SYMBOLS \ SymI_NeedsProto(__clzdi2) \ SymI_NeedsProto(__ctzdi2) ===================================== rts/linker/elf_reloc_riscv64.c ===================================== @@ -90,22 +90,24 @@ int32_t decodeAddendRISCV64(Section *section STG_UNUSED, abort(/* we don't support Rel locations yet. */); } -// Sign-extend the number in the bottom B bits of X to a 64-bit integer. -// Requires 0 < B <= 64. -int64_t SignExtend64(uint64_t X, unsigned B) { +// Sign-extend the number in the bottom B bits of X to a 32-bit integer. +// Requires 0 < B <= 32. (32 bit is sufficient as we can only encode 20 + 12 = +// 32 bit in a relocation pair.) +int32_t SignExtend32(uint32_t X, unsigned B) { assert(B > 0 && "Bit width can't be 0."); - assert(B <= 64 && "Bit width out of range."); - return (int64_t)(X << (64 - B)) >> (64 - B); + assert(B <= 32 && "Bit width out of range."); + return (int32_t)(X << (32 - B)) >> (32 - B); } // Make sure that V can be represented as an N bit signed integer. -void checkInt(inst_t *loc, int64_t v, int n) { - if (v != SignExtend64(v, n)) { - debugBelch("Relocation at 0x%x is out of range. value: 0x%lx (%ld), " - "sign-extended value: 0x%lx (%ld), max bits 0x%x (%d)\n", - *loc, v, v, SignExtend64(v, n), SignExtend64(v, n), n, n); +void checkInt(inst_t *loc, int32_t v, int n) { + if (v != SignExtend32(v, n)) { + debugBelch("Relocation at 0x%x is out of range. value: 0x%x (%d), " + "sign-extended value: 0x%x (%d), max bits 0x%x (%d)\n", + *loc, v, v, SignExtend32(v, n), SignExtend32(v, n), n, n); } } + // RISCV is little-endian by definition. void write8le(uint8_t *p, uint8_t v) { *p = v; } @@ -149,8 +151,8 @@ uint32_t setLO12_S(uint32_t insn, uint32_t imm) { void setUType(inst_t *loc, int32_t val) { const unsigned bits = 32; uint32_t hi = val + 0x800; - checkInt(loc, SignExtend64(hi, bits) >> 12, 20); - debugBelch("setUType: hi 0x%x val 0x%x\n", hi, val); + checkInt(loc, SignExtend32(hi, bits) >> 12, 20); + IF_DEBUG(linker, debugBelch("setUType: hi 0x%x val 0x%x\n", hi, val)); write32le(loc, (read32le(loc) & 0xFFF) | (hi & 0xFFFFF000)); } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a4742d26bceb2f76e01b94238c2b5c0dc4695656...05121e86e727168ef4ed5d9188e482e271d1d5d9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a4742d26bceb2f76e01b94238c2b5c0dc4695656...05121e86e727168ef4ed5d9188e482e271d1d5d9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 3 18:34:00 2024 From: gitlab at gitlab.haskell.org (Alan Zimmerman (@alanz)) Date: Sun, 03 Mar 2024 13:34:00 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/az/fix-showastdata Message-ID: <65e4c2986b665_2b6de341c803c84383@gitlab.mail> Alan Zimmerman pushed new branch wip/az/fix-showastdata at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/az/fix-showastdata You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 3 20:21:52 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sun, 03 Mar 2024 15:21:52 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/supersven/aarch64-NEED_SYMBOL_EXTRAS Message-ID: <65e4dbe0db069_2b6de36d50a60845c1@gitlab.mail> Sven Tennie pushed new branch wip/supersven/aarch64-NEED_SYMBOL_EXTRAS at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/supersven/aarch64-NEED_SYMBOL_EXTRAS You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 04:07:07 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Sun, 03 Mar 2024 23:07:07 -0500 Subject: [Git][ghc/ghc][wip/fprof-overloaded] add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e548ebecde7_2b6de313190768932b9@gitlab.mail> Finley McIlwaine pushed to branch wip/fprof-overloaded at Glasgow Haskell Compiler / GHC Commits: 7da9a1c3 by Finley McIlwaine at 2024-03-03T20:06:03-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods - - - - - 26 changed files: - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout Changes: ===================================== compiler/GHC/Core/LateCC.hs ===================================== @@ -1,164 +1,90 @@ -{-# LANGUAGE DerivingStrategies #-} -{-# LANGUAGE TupleSections #-} +{-# LANGUAGE RecordWildCards #-} --- | Adds cost-centers after the core piple has run. +-- | Adds cost-centers after the core pipline has run. module GHC.Core.LateCC - ( addLateCostCentresMG - , addLateCostCentresPgm - , addLateCostCentres -- Might be useful for API users - , Env(..) + ( -- * Inserting cost centres + addLateCostCenters ) where -import Control.Applicative -import Control.Monad -import qualified Data.Set as S - import GHC.Prelude -import GHC.Types.CostCentre -import GHC.Types.CostCentre.State -import GHC.Types.Name hiding (varName) -import GHC.Types.Tickish -import GHC.Unit.Module.ModGuts -import GHC.Types.Var -import GHC.Unit.Types -import GHC.Data.FastString -import GHC.Core -import GHC.Core.Opt.Monad -import GHC.Core.Utils (mkTick) -import GHC.Types.Id -import GHC.Driver.DynFlags +import GHC.Core +import GHC.Core.LateCC.OverloadedCalls +import GHC.Core.LateCC.TopLevelBinds +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Seq +import qualified GHC.Data.Strict as Strict +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.SrcLoc +import GHC.Utils.Error import GHC.Utils.Logger import GHC.Utils.Outputable -import GHC.Utils.Misc -import GHC.Utils.Error (withTiming) -import GHC.Utils.Monad.State.Strict - - -{- Note [Collecting late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Usually cost centres defined by a module are collected -during tidy by collectCostCentres. However with `-fprof-late` -we insert cost centres after inlining. So we keep a list of -all the cost centres we inserted and combine that with the list -of cost centres found during tidy. - -To avoid overhead when using -fprof-inline there is a flag to stop -us from collecting them here when we run this pass before tidy. - -Note [Adding late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The basic idea is very simple. For every top level binder -`f = rhs` we compile it as if the user had written -`f = {-# SCC f #-} rhs`. - -If we do this after unfoldings for `f` have been created this -doesn't impact core-level optimizations at all. If we do it -before the cost centre will be included in the unfolding and -might inhibit optimizations at the call site. For this reason -we provide flags for both approaches as they have different -tradeoffs. - -We also don't add a cost centre for any binder that is a constructor -worker or wrapper. These will never meaningfully enrich the resulting -profile so we improve efficiency by omitting those. - --} - -addLateCostCentresMG :: ModGuts -> CoreM ModGuts -addLateCostCentresMG guts = do - dflags <- getDynFlags - let env :: Env - env = Env - { thisModule = mg_module guts - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = False -- See Note [Collecting late cost centres] - } - let guts' = guts { mg_binds = fstOf3 (addLateCostCentres env (mg_binds guts)) - } - return guts' - -addLateCostCentresPgm :: DynFlags -> Logger -> Module -> CoreProgram -> IO (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentresPgm dflags logger mod binds = - withTiming logger - (text "LateCC"<+>brackets (ppr mod)) - (\(a,b,c) -> a `seqList` (b `seq` (c `seq` ()))) $ do - let env = Env - { thisModule = mod - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = True -- See Note [Collecting late cost centres] - } - (binds', ccs, cc_state) = addLateCostCentres env binds - when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ - putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr binds')) - return (binds', ccs, cc_state) -addLateCostCentres :: Env -> CoreProgram -> (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentres env binds = - let (binds', state) = runState (mapM (doBind env) binds) initLateCCState - in (binds', lcs_ccs state, lcs_state state) - - -doBind :: Env -> CoreBind -> M CoreBind -doBind env (NonRec b rhs) = NonRec b <$> doBndr env b rhs -doBind env (Rec bs) = Rec <$> mapM doPair bs +-- | Late cost center insertion logic used by the driver +addLateCostCenters :: + Logger + -- ^ Logger + -> LateCCConfig + -- ^ Late cost center configuration + -> CoreProgram + -- ^ The program + -> IO (CoreProgram, LateCCState (Strict.Maybe SrcSpan)) +addLateCostCenters logger LateCCConfig{..} core_binds = do + + -- If top-level late CCs are enabled via either -fprof-late or + -- -fprof-late-overloaded, add them + (top_level_cc_binds, top_level_late_cc_state) <- + case lateCCConfig_whichBinds of + LateCCNone -> + return (core_binds, initLateCCState ()) + _ -> + withTiming + logger + (text "LateTopLevelCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateTopLevelCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (initLateCCState ()) + (topLevelBindsCC top_level_cc_pred) + core_binds + + -- If overloaded call CCs are enabled via -fprof-late-overloaded-calls, add + -- them + (late_cc_binds, late_cc_state) <- + if lateCCConfig_overloadedCalls then + withTiming + logger + (text "LateOverloadedCallsCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateoverloadedCallsCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (top_level_late_cc_state { lateCCState_extra = Strict.Nothing }) + overloadedCallsCC + top_level_cc_binds + else + return + ( top_level_cc_binds + , top_level_late_cc_state { lateCCState_extra = Strict.Nothing } + ) + + return (late_cc_binds, late_cc_state) where - doPair :: ((Id, CoreExpr) -> M (Id, CoreExpr)) - doPair (b,rhs) = (b,) <$> doBndr env b rhs - -doBndr :: Env -> Id -> CoreExpr -> M CoreExpr -doBndr env bndr rhs - -- Cost centres on constructor workers are pretty much useless - -- so we don't emit them if we are looking at the rhs of a constructor - -- binding. - | Just _ <- isDataConId_maybe bndr = pure rhs - | otherwise = doBndr' env bndr rhs - - --- We want to put the cost centre below the lambda as we only care about executions of the RHS. -doBndr' :: Env -> Id -> CoreExpr -> State LateCCState CoreExpr -doBndr' env bndr (Lam b rhs) = Lam b <$> doBndr' env bndr rhs -doBndr' env bndr rhs = do - let name = idName bndr - name_loc = nameSrcSpan name - cc_name = getOccFS name - count = countEntries env - cc_flavour <- getCCFlavour cc_name - let cc_mod = thisModule env - bndrCC = NormalCC cc_flavour cc_name cc_mod name_loc - note = ProfNote bndrCC count True - addCC env bndrCC - return $ mkTick note rhs - -data LateCCState = LateCCState - { lcs_state :: !CostCentreState - , lcs_ccs :: S.Set CostCentre - } -type M = State LateCCState - -initLateCCState :: LateCCState -initLateCCState = LateCCState newCostCentreState mempty - -getCCFlavour :: FastString -> M CCFlavour -getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name - -getCCIndex' :: FastString -> M CostCentreIndex -getCCIndex' name = do - state <- get - let (index,cc_state') = getCCIndex name (lcs_state state) - put (state { lcs_state = cc_state'}) - return index - -addCC :: Env -> CostCentre -> M () -addCC !env cc = do - state <- get - when (collectCCs env) $ do - let ccs' = S.insert cc (lcs_ccs state) - put (state { lcs_ccs = ccs'}) - -data Env = Env - { thisModule :: !Module - , countEntries:: !Bool - , collectCCs :: !Bool - } - + top_level_cc_pred :: CoreExpr -> Bool + top_level_cc_pred = + case lateCCConfig_whichBinds of + LateCCAllBinds -> + const True + LateCCOverloadedBinds -> + isOverloadedTy . exprType + LateCCNone -> + -- This is here for completeness, we won't actually use this + -- predicate in this case since we'll shortcut. + const False + + this_mod = lateCCEnv_module lateCCConfig_env ===================================== compiler/GHC/Core/LateCC/OverloadedCalls.hs ===================================== @@ -0,0 +1,204 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TupleSections #-} + +module GHC.Core.LateCC.OverloadedCalls + ( overloadedCallsCC + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified GHC.Data.Strict as Strict + +import GHC.Data.FastString +import GHC.Core +import GHC.Core.LateCC.Utils +import GHC.Core.LateCC.Types +import GHC.Core.Make +import GHC.Core.Predicate +import GHC.Core.Type +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.Id +import GHC.Types.Name +import GHC.Types.SrcLoc +import GHC.Types.Tickish +import GHC.Types.Var +import GHC.Utils.Outputable + +type OverloadedCallsCCState = Strict.Maybe SrcSpan + +-- | Insert cost centres on function applications with dictionary arguments. The +-- source locations attached to the cost centres is approximated based on the +-- "closest" source note encountered in the traversal. +overloadedCallsCC :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind +overloadedCallsCC = + processBind + where + processBind :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind + processBind core_bind = + case core_bind of + NonRec b e -> + NonRec b <$> wrap_if_join b (processExpr e) + Rec es -> + Rec <$> mapM (\(b,e) -> (b,) <$> wrap_if_join b (processExpr e)) es + where + -- If an overloaded function is turned into a join point, we won't add + -- SCCs directly to calls since it makes them non-tail calls. Instead, + -- we look for join points here and add an SCC to their RHS if they are + -- overloaded. + wrap_if_join :: + CoreBndr + -> LateCCM OverloadedCallsCCState CoreExpr + -> LateCCM OverloadedCallsCCState CoreExpr + wrap_if_join b pexpr = do + expr <- pexpr + if isJoinId b && isOverloadedTy (exprType expr) then do + let + cc_name :: FastString + cc_name = fsLit "join-rhs-" `appendFS` getOccFS b + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan expr + else + return expr + + + processExpr :: CoreExpr -> LateCCM OverloadedCallsCCState CoreExpr + processExpr expr = + case expr of + -- The case we care about: Application + app at App{} -> do + -- Here we have some application like `f v1 ... vN`, where v1 ... vN + -- should be the function's type arguments followed by the value + -- arguments. To determine if the `f` is an overloaded function, we + -- check if any of the arguments v1 ... vN are dictionaries. + let + (f, xs) = collectArgs app + resultTy = applyTypeToArgs empty (exprType f) xs + + -- Recursively process the arguments first for no particular reason + args <- mapM processExpr xs + let app' = mkCoreApps f args + + if + -- Check if any of the arguments are dictionaries + any isDictExpr args + + -- Avoid instrumenting dictionary functions, which may be + -- overloaded if there are superclasses, by checking if the result + -- type of the function is a dictionary type. + && not (isDictTy resultTy) + + -- Avoid instrumenting constraint selectors like eq_sel + && (typeTypeOrConstraint resultTy /= ConstraintLike) + + -- Avoid instrumenting join points. + -- (See comment in processBind above) + && not (isJoinVarExpr f) + then do + -- Extract a name and source location from the function being + -- applied + let + cc_name :: FastString + cc_name = + fsLit $ maybe "" getOccString (exprName app) + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan app' + else + return app' + + -- For recursive constructors of Expr, we traverse the nested Exprs + Lam b e -> + mkCoreLams [b] <$> processExpr e + Let b e -> + mkCoreLet <$> processBind b <*> processExpr e + Case e b t alts -> + Case + <$> processExpr e + <*> pure b + <*> pure t + <*> mapM processAlt alts + Cast e co -> + mkCast <$> processExpr e <*> pure co + Tick t e -> do + trackSourceNote t $ + mkTick t <$> processExpr e + + -- For non-recursive constructors of Expr, we do nothing + x -> return x + + processAlt :: CoreAlt -> LateCCM OverloadedCallsCCState CoreAlt + processAlt (Alt c bs e) = Alt c bs <$> processExpr e + + trackSourceNote :: CoreTickish -> LateCCM OverloadedCallsCCState a -> LateCCM OverloadedCallsCCState a + trackSourceNote tick act = + case tick of + SourceNote rss _ -> do + -- Prefer source notes from the current file + in_current_file <- + maybe False ((== EQ) . lexicalCompareFS (srcSpanFile rss)) <$> + asks lateCCEnv_file + if not in_current_file then + act + else do + loc <- lift $ gets lateCCState_extra + lift . modify $ \s -> + s { lateCCState_extra = + Strict.Just $ RealSrcSpan rss mempty + } + x <- act + lift . modify $ \s -> + s { lateCCState_extra = loc + } + return x + _ -> + act + + -- Utility functions + + -- Extract a Name from an expression. If it is an application, attempt to + -- extract a name from the applied function. If it is a variable, return the + -- Name of the variable. If it is a tick/cast, attempt to extract a Name + -- from the expression held in the tick/cast. Otherwise return Nothing. + exprName :: CoreExpr -> Maybe Name + exprName = + \case + App f _ -> + exprName f + Var f -> + Just (idName f) + Tick _ e -> + exprName e + Cast e _ -> + exprName e + _ -> + Nothing + + -- Determine whether an expression is a dictionary + isDictExpr :: CoreExpr -> Bool + isDictExpr = + maybe False isDictTy . exprType' + where + exprType' :: CoreExpr -> Maybe Type + exprType' = \case + Type{} -> Nothing + expr -> Just $ exprType expr + + -- Determine whether an expression is a join variable + isJoinVarExpr :: CoreExpr -> Bool + isJoinVarExpr = + \case + Var var -> isJoinId var + Tick _ e -> isJoinVarExpr e + Cast e _ -> isJoinVarExpr e + _ -> False ===================================== compiler/GHC/Core/LateCC/TopLevelBinds.hs ===================================== @@ -0,0 +1,106 @@ +{-# LANGUAGE TupleSections #-} +module GHC.Core.LateCC.TopLevelBinds where + +import GHC.Prelude + +import GHC.Core +-- import GHC.Core.LateCC +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Opt.Monad +import GHC.Driver.DynFlags +import GHC.Types.Id +import GHC.Types.Name +import GHC.Unit.Module.ModGuts + +{- Note [Collecting late cost centres] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Usually cost centres defined by a module are collected +during tidy by collectCostCentres. However with `-fprof-late` +we insert cost centres after inlining. So we keep a list of +all the cost centres we inserted and combine that with the list +of cost centres found during tidy. + +To avoid overhead when using -fprof-inline there is a flag to stop +us from collecting them here when we run this pass before tidy. + +Note [Adding late cost centres to top level bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The basic idea is very simple. For every top level binder +`f = rhs` we compile it as if the user had written +`f = {-# SCC f #-} rhs`. + +If we do this after unfoldings for `f` have been created this +doesn't impact core-level optimizations at all. If we do it +before the cost centre will be included in the unfolding and +might inhibit optimizations at the call site. For this reason +we provide flags for both approaches as they have different +tradeoffs. + +We also don't add a cost centre for any binder that is a constructor +worker or wrapper. These will never meaningfully enrich the resulting +profile so we improve efficiency by omitting those. + +-} + +-- | Add late cost centres directly to the 'ModGuts'. This is used inside the +-- core pipeline with the -fprof-late-inline flag. It should not be used after +-- tidy, since it does not manually track inserted cost centers. See +-- Note [Collecting late cost centres]. +topLevelBindsCCMG :: ModGuts -> CoreM ModGuts +topLevelBindsCCMG guts = do + dflags <- getDynFlags + let + env = + LateCCEnv + { lateCCEnv_module = mg_module guts + + -- We don't use this for topLevelBindsCC, so Nothing is okay + , lateCCEnv_file = Nothing + + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = False + } + guts' = + guts + { mg_binds = + fst + ( doLateCostCenters + env + (initLateCCState ()) + (topLevelBindsCC (const True)) + (mg_binds guts) + ) + } + return guts' + +-- | Insert cost centres on top-level bindings in the module, depending on +-- whether or not they satisfy the given predicate. +topLevelBindsCC :: (CoreExpr -> Bool) -> CoreBind -> LateCCM s CoreBind +topLevelBindsCC pred core_bind = + case core_bind of + NonRec b rhs -> + NonRec b <$> doBndr b rhs + Rec bs -> + Rec <$> mapM doPair bs + where + doPair :: ((Id, CoreExpr) -> LateCCM s (Id, CoreExpr)) + doPair (b,rhs) = (b,) <$> doBndr b rhs + + doBndr :: Id -> CoreExpr -> LateCCM s CoreExpr + doBndr bndr rhs + -- Cost centres on constructor workers are pretty much useless + -- so we don't emit them if we are looking at the rhs of a constructor + -- binding. + | Just _ <- isDataConId_maybe bndr = pure rhs + | otherwise = if pred rhs then addCC bndr rhs else pure rhs + + -- We want to put the cost centre below the lambda as we only care about + -- executions of the RHS. + addCC :: Id -> CoreExpr -> LateCCM s CoreExpr + addCC bndr (Lam b rhs) = Lam b <$> addCC bndr rhs + addCC bndr rhs = do + let name = idName bndr + cc_loc = nameSrcSpan name + cc_name = getOccFS name + insertCC cc_name cc_loc rhs \ No newline at end of file ===================================== compiler/GHC/Core/LateCC/Types.hs ===================================== @@ -0,0 +1,74 @@ +-- | Types related to late cost center insertion +module GHC.Core.LateCC.Types + ( LateCCConfig(..) + , LateCCBindSpec(..) + , LateCCEnv(..) + , LateCCState(..) + , initLateCCState + , LateCCM + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Unit.Types + +-- | Late cost center insertion configuration. +-- +-- Specifies whether cost centers are added to overloaded function call sites +-- and/or top-level bindings, and which top-level bindings they are added to. +-- Also holds the cost center insertion environment. +data LateCCConfig = + LateCCConfig + { lateCCConfig_whichBinds :: !LateCCBindSpec + , lateCCConfig_overloadedCalls :: !Bool + , lateCCConfig_env :: !LateCCEnv + } + +-- | The types of top-level bindings we support adding cost centers to. +data LateCCBindSpec = + LateCCNone + | LateCCAllBinds + | LateCCOverloadedBinds + +-- | Late cost centre insertion environment +data LateCCEnv = LateCCEnv + { lateCCEnv_module :: !Module + -- ^ Current module + , lateCCEnv_file :: Maybe FastString + -- ^ Current file, if we have one + , lateCCEnv_countEntries:: !Bool + -- ^ Whether the inserted cost centers should count entries + , lateCCEnv_collectCCs :: !Bool + -- ^ Whether to collect the cost centres we insert. See + -- Note [Collecting late cost centres] + + } + +-- | Late cost centre insertion state, indexed by some extra state type that an +-- insertion method may require. +data LateCCState s = LateCCState + { lateCCState_ccs :: !(S.Set CostCentre) + -- ^ Cost centres that have been inserted + , lateCCState_ccState :: !CostCentreState + -- ^ Per-module state tracking for cost centre indices + , lateCCState_extra :: !s + } + +-- | The empty late cost centre insertion state +initLateCCState :: s -> LateCCState s +initLateCCState s = + LateCCState + { lateCCState_ccState = newCostCentreState + , lateCCState_ccs = mempty + , lateCCState_extra = s + } + +-- | Late cost centre insertion monad +type LateCCM s = ReaderT LateCCEnv (State (LateCCState s)) ===================================== compiler/GHC/Core/LateCC/Utils.hs ===================================== @@ -0,0 +1,80 @@ +module GHC.Core.LateCC.Utils + ( -- * Inserting cost centres + doLateCostCenters -- Might be useful for API users + + -- ** Helpers for defining insertion methods + , getCCFlavour + , insertCC + ) where + +import GHC.Prelude + +import Control.Monad +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Core +import GHC.Core.LateCC.Types +import GHC.Core.Utils +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Types.SrcLoc +import GHC.Types.Tickish + +-- | Insert cost centres into the 'CoreProgram' using the provided environment, +-- initial state, and insertion method. +doLateCostCenters + :: LateCCEnv + -- ^ Environment to run the insertion in + -> LateCCState s + -- ^ Initial state to run the insertion with + -> (CoreBind -> LateCCM s CoreBind) + -- ^ Insertion method + -> CoreProgram + -- ^ Bindings to consider + -> (CoreProgram, LateCCState s) +doLateCostCenters env state method binds = + runLateCC env state $ mapM method binds + +-- | Evaluate late cost centre insertion +runLateCC :: LateCCEnv -> LateCCState s -> LateCCM s a -> (a, LateCCState s) +runLateCC env state = (`runState` state) . (`runReaderT` env) + +-- | Given the name of a cost centre, get its flavour +getCCFlavour :: FastString -> LateCCM s CCFlavour +getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name + where + getCCIndex' :: FastString -> LateCCM s CostCentreIndex + getCCIndex' name = do + cc_state <- lift $ gets lateCCState_ccState + let (index, cc_state') = getCCIndex name cc_state + lift . modify $ \s -> s { lateCCState_ccState = cc_state'} + return index + +-- | Insert a cost centre with the specified name and source span on the given +-- expression. The inserted cost centre will be appropriately tracked in the +-- late cost centre state. +insertCC + :: FastString + -- ^ Name of the cost centre to insert + -> SrcSpan + -- ^ Source location to associate with the cost centre + -> CoreExpr + -- ^ Expression to wrap in the cost centre + -> LateCCM s CoreExpr +insertCC cc_name cc_loc expr = do + cc_flavour <- getCCFlavour cc_name + env <- ask + let + cc_mod = lateCCEnv_module env + cc = NormalCC cc_flavour cc_name cc_mod cc_loc + note = ProfNote cc (lateCCEnv_countEntries env) True + when (lateCCEnv_collectCCs env) $ do + lift . modify $ \s -> + s { lateCCState_ccs = S.insert cc (lateCCState_ccs s) + } + return $ mkTick note expr + ===================================== compiler/GHC/Core/Opt/Pipeline.hs ===================================== @@ -43,7 +43,7 @@ import GHC.Core.Opt.CallArity ( callArityAnalProgram ) import GHC.Core.Opt.Exitify ( exitifyProgram ) import GHC.Core.Opt.WorkWrap ( wwTopBinds ) import GHC.Core.Opt.CallerCC ( addCallerCostCentres ) -import GHC.Core.LateCC (addLateCostCentresMG) +import GHC.Core.LateCC.TopLevelBinds (topLevelBindsCCMG) import GHC.Core.Seq (seqBinds) import GHC.Core.FamInstEnv @@ -520,7 +520,7 @@ doCorePass pass guts = do addCallerCostCentres guts CoreAddLateCcs -> {-# SCC "AddLateCcs" #-} - addLateCostCentresMG guts + topLevelBindsCCMG guts CoreDoPrintCore -> {-# SCC "PrintCore" #-} liftIO $ printCore logger (mg_binds guts) >> return guts ===================================== compiler/GHC/Driver/Flags.hs ===================================== @@ -341,6 +341,8 @@ data GeneralFlag | Opt_ProfCountEntries | Opt_ProfLateInlineCcs | Opt_ProfLateCcs + | Opt_ProfLateOverloadedCcs + | Opt_ProfLateoverloadedCallsCCs | Opt_ProfManualCcs -- ^ Ignore manual SCC annotations -- misc opts ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -172,7 +172,6 @@ import GHC.Iface.Ext.Debug ( diffFile, validateScopes ) import GHC.Core import GHC.Core.Lint.Interactive ( interactiveInScope ) import GHC.Core.Tidy ( tidyExpr ) -import GHC.Core.Type ( Type, Kind ) import GHC.Core.Utils ( exprType ) import GHC.Core.ConLike import GHC.Core.Opt.Pipeline @@ -182,7 +181,8 @@ import GHC.Core.InstEnv import GHC.Core.FamInstEnv import GHC.Core.Rules import GHC.Core.Stats -import GHC.Core.LateCC (addLateCostCentresPgm) +import GHC.Core.LateCC +import GHC.Core.LateCC.Types import GHC.CoreToStg.Prep @@ -194,6 +194,7 @@ import GHC.Parser.Lexer as Lexer import GHC.Tc.Module import GHC.Tc.Utils.Monad +import GHC.Tc.Utils.TcType import GHC.Tc.Zonk.Env ( ZonkFlexi (DefaultFlexi) ) import GHC.Stg.Syntax @@ -294,7 +295,6 @@ import GHC.StgToCmm.Utils (IPEStats) import GHC.Types.Unique.FM import GHC.Types.Unique.DFM import GHC.Cmm.Config (CmmConfig) -import GHC.Types.CostCentre.State (newCostCentreState) {- ********************************************************************** @@ -1788,22 +1788,41 @@ hscGenHardCode hsc_env cgguts location output_filename = do ------------------- - -- Insert late cost centres if enabled. + -- Insert late cost centres on top level bindings if enabled. -- If `-fprof-late-inline` is enabled we can skip this, as it will have added -- a superset of cost centres we would add here already. - (late_cc_binds, late_local_ccs, cc_state) <- - if gopt Opt_ProfLateCcs dflags && not (gopt Opt_ProfLateInlineCcs dflags) - then - withTiming - logger - (text "LateCCs"<+>brackets (ppr this_mod)) - (const ()) - $ {-# SCC lateCC #-} do - (binds, late_ccs, cc_state) <- addLateCostCentresPgm dflags logger this_mod core_binds - return ( binds, (S.toList late_ccs `mappend` local_ccs ), cc_state) + -- If `-fprof-late-overloaded` is enabled, only add CCs to bindings for + -- overloaded functions. + let + late_cc_config :: LateCCConfig + late_cc_config = + LateCCConfig + { lateCCConfig_whichBinds = + if gopt Opt_ProfLateInlineCcs dflags then + LateCCNone + else if gopt Opt_ProfLateCcs dflags then + LateCCAllBinds + else if gopt Opt_ProfLateOverloadedCcs dflags then + LateCCOverloadedBinds else - return (core_binds, local_ccs, newCostCentreState) + LateCCNone + , lateCCConfig_overloadedCalls = + gopt Opt_ProfLateoverloadedCallsCCs dflags + , lateCCConfig_env = + LateCCEnv + { lateCCEnv_module = this_mod + , lateCCEnv_file = fsLit <$> ml_hs_file location + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = True + } + } + + (late_cc_binds, late_cc_state) <- + addLateCostCenters logger late_cc_config core_binds + + when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ + putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr late_cc_binds)) ------------------- -- Run late plugins @@ -1817,7 +1836,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do cg_hpc_info = hpc_info, cg_spt_entries = spt_entries, cg_binds = late_binds, - cg_ccs = late_local_ccs' + cg_ccs = late_local_ccs } , _ ) <- @@ -1830,9 +1849,9 @@ hscGenHardCode hsc_env cgguts location output_filename = do (($ hsc_env) . latePlugin) ( cgguts { cg_binds = late_cc_binds - , cg_ccs = late_local_ccs + , cg_ccs = S.toList (lateCCState_ccs late_cc_state) ++ local_ccs } - , cc_state + , lateCCState_ccState late_cc_state ) let @@ -1873,7 +1892,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do let (stg_binds,_stg_deps) = unzip stg_binds_with_deps let cost_centre_info = - (late_local_ccs' ++ caf_ccs, caf_cc_stacks) + (late_local_ccs ++ caf_ccs, caf_cc_stacks) platform = targetPlatform dflags prof_init | sccProfilingEnabled dflags = profilingInitCode platform this_mod cost_centre_info ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -2444,6 +2444,8 @@ fFlagsDeps = [ flagSpec "prof-cafs" Opt_AutoSccsOnIndividualCafs, flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "prof-late" Opt_ProfLateCcs, + flagSpec "prof-late-overloaded" Opt_ProfLateOverloadedCcs, + flagSpec "prof-late-overloaded-calls" Opt_ProfLateoverloadedCallsCCs, flagSpec "prof-manual" Opt_ProfManualCcs, flagSpec "prof-late-inline" Opt_ProfLateInlineCcs, flagSpec "regs-graph" Opt_RegsGraph, @@ -3762,6 +3764,10 @@ needSourceNotes :: DynFlags -> Bool needSourceNotes dflags = debugLevel dflags > 0 || gopt Opt_InfoTableMap dflags + -- Source ticks are used to approximate the location of + -- overloaded call cost centers + || gopt Opt_ProfLateoverloadedCallsCCs dflags + -- ----------------------------------------------------------------------------- -- Linker/compiler information ===================================== compiler/GHC/Tc/Utils/TcType.hs ===================================== @@ -1907,7 +1907,7 @@ isRhoExpTy (Infer {}) = True isOverloadedTy :: Type -> Bool -- Yes for a type of a function that might require evidence-passing --- Used only by bindLocalMethods +-- Used by bindLocalMethods and for -fprof-late-overloaded isOverloadedTy ty | Just ty' <- coreView ty = isOverloadedTy ty' isOverloadedTy (ForAllTy _ ty) = isOverloadedTy ty isOverloadedTy (FunTy { ft_af = af }) = isInvisibleFunArg af ===================================== compiler/ghc.cabal.in ===================================== @@ -336,6 +336,10 @@ Library GHC.Core.Lint GHC.Core.Lint.Interactive GHC.Core.LateCC + GHC.Core.LateCC.Types + GHC.Core.LateCC.TopLevelBinds + GHC.Core.LateCC.Utils + GHC.Core.LateCC.OverloadedCalls GHC.Core.Make GHC.Core.Map.Expr GHC.Core.Map.Type ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -174,6 +174,15 @@ Compiler This means that if you are using ``-fllvm`` you now need ``llc``, ``opt`` and ``clang`` available. +- The :ghc-flag:`-fprof-late-overloaded` flag has been introduced. It causes + cost centres to be added to *overloaded* top level bindings, unlike + :ghc-flag:`-fprof-late` which adds cost centres to all top level bindings. + +- The :ghc-flag:`-fprof-late-overloaded-calls` flag has been introduced. It + causes cost centres to be inserted at call sites including instance dictionary + arguments. This may be preferred over :ghc-flag:`-fprof-late-overloaded` since + it may reveal whether imported functions are called overloaded. + JavaScript backend ~~~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/profiling.rst ===================================== @@ -518,6 +518,49 @@ of your profiled program will be different to that of the unprofiled one. You can try this mode if :ghc-flag:`-fprof-late` results in a profile that's too hard to interpret. +.. ghc-flag:: -fprof-late-overloaded + :shortdesc: Auto-add ``SCC``\\ s to all top level overloaded bindings *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all *overloaded* top level bindings + late in the compilation pipeline after the optimizer has run and unfoldings + have been created. This means these cost centres will not interfere with + core-level optimizations and the resulting profile will be closer to the + performance profile of an optimized non-profiled executable. + + This flag can help determine which top level bindings encountered during a + program's execution are still overloaded after inlining and specialization. + +.. ghc-flag:: -fprof-late-overloaded-calls + :shortdesc: Auto-add ``SCC``\\ s to all call sites that include dictionary arguments *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded-calls + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all call sites that include + dictionary arguments late in the compilation pipeline after the optimizer + has run and unfoldings have been created. This means these cost centres will + not interfere with core-level optimizations and the resulting profile will + be closer to the performance profile of an optimized non-profiled + executable. + + This flag is potentially more useful than :ghc-flag:`-fprof-late-overloaded` + since it will also add ``SCC`` annotations to call sites of imported + overloaded functions. + + Some overloaded calls may not be annotated, specifically in cases where the + optimizer turns an overloaded function into a join point. Calls to such + functions will not be wrapped in ``SCC`` annotations, since it would make + them non-tail calls, which is a requirement for join points. Instead, + ``SCC`` annotations are added around the body of overloaded join variables + and given distinct names (``join-rhs-``) to avoid confusion. + .. ghc-flag:: -fprof-cafs :shortdesc: Auto-add ``SCC``\\ s to all CAFs :type: dynamic ===================================== testsuite/tests/profiling/should_run/all.T ===================================== @@ -195,3 +195,30 @@ test('ignore_scc', [], compile_and_run, ['-fno-prof-manual']) test('T21446', [], makefile_test, ['T21446']) + + +test('scc-prof-overloaded001', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded002', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls001', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fno-full-laziness -fprof-late-overloaded-calls'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls002', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fprof-late-overloaded-calls'] +) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample ===================================== @@ -0,0 +1,26 @@ + Thu Jan 4 11:49 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,320 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded-calls001.hs:24:1-31 256 1 0.0 0.3 0.0 0.8 + f Main scc-prof-overloaded-calls001.hs:18:1-18 257 1 0.0 0.6 0.0 0.6 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample ===================================== @@ -0,0 +1,31 @@ + Fri Jan 5 11:06 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls002 +RTS -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 59,152 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 34.8 +CAF GHC.IO.Handle.FD 0.0 58.7 +CAF GHC.IO.Encoding 0.0 4.1 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 34.8 0.0 100.0 + CAF Main 255 0 0.0 0.6 0.0 0.9 + f Main scc-prof-overloaded-calls002.hs:52:1-25 262 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:48:1-25 261 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:44:1-25 260 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:40:1-25 259 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:36:1-25 258 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:32:1-25 257 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:28:1-25 256 1 0.0 0.0 0.0 0.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.1 0.0 4.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.3 0.0 0.3 + CAF GHC.IO.Handle.FD 208 0 0.0 58.7 0.0 58.7 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample ===================================== @@ -0,0 +1,25 @@ + Thu Jan 4 11:26 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,304 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded001.hs:18:1-6 256 1 0.0 0.8 0.0 0.8 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample ===================================== @@ -0,0 +1,23 @@ + Thu Jan 4 11:55 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded002 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 56,472 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 32.7 +CAF GHC.IO.Handle.FD 0.0 61.5 +CAF GHC.IO.Encoding 0.0 4.3 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 32.7 0.0 100.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.3 0.0 4.3 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 61.5 0.0 61.5 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7da9a1c3b403f1b9aa4e581ffbd4339b088f758d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7da9a1c3b403f1b9aa4e581ffbd4339b088f758d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 09:13:46 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Mon, 04 Mar 2024 04:13:46 -0500 Subject: [Git][ghc/ghc][wip/T24471] 3 commits: compiler: start deprecating cmmToRawCmmHook Message-ID: <65e590ca10ebd_381c1f771c42c696fe@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - fd5073c6 by Simon Peyton Jones at 2024-03-04T09:13:33+00:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 3.5%, and much more in artificial cases. Metric Decrease: CoOpt_Read - - - - - 9 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/HsToCore/Match/Constructor.hs - libraries/base/changelog.md - libraries/base/src/Data/List/NonEmpty.hs Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== compiler/GHC/Data/Bag.hs ===================================== @@ -7,7 +7,7 @@ Bag: an unordered collection with duplicates -} {-# LANGUAGE ScopedTypeVariables, DeriveTraversable, TypeFamilies #-} -{-# OPTIONS_GHC -Wno-deprecations #-} +{-# OPTIONS_GHC -Wno-unrecognised-warning-flags -Wno-x-data-list-nonempty-unzip #-} module GHC.Data.Bag ( Bag, -- abstract type ===================================== compiler/GHC/Driver/Hooks.hs ===================================== @@ -154,6 +154,8 @@ data Hooks = Hooks -> IO (Stream IO RawCmmGroup a))) } +{-# DEPRECATED cmmToRawCmmHook "cmmToRawCmmHook is being deprecated. If you do use it in your project, please raise a GHC issue!" #-} + class HasHooks m where getHooks :: m Hooks ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -6,6 +6,9 @@ {-# OPTIONS_GHC -fprof-auto-top #-} +-- Remove this after cmmToRawCmmHook removal +{-# OPTIONS_GHC -Wno-deprecations #-} + ------------------------------------------------------------------------------- -- -- | Main API for compiling plain Haskell source code. ===================================== compiler/GHC/HsToCore/Match/Constructor.hs ===================================== @@ -2,7 +2,7 @@ {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -{-# OPTIONS_GHC -Wno-deprecations #-} +{-# OPTIONS_GHC -Wno-unrecognised-warning-flags -Wno-x-data-list-nonempty-unzip #-} {- (c) The University of Glasgow 2006 ===================================== libraries/base/changelog.md ===================================== @@ -17,7 +17,10 @@ * Always use `safe` call to `read` for regular files and block devices on unix if the RTS is multi-threaded, regardless of `O_NONBLOCK`. ([CLC proposal #166](https://github.com/haskell/core-libraries-committee/issues/166)) * Export List from Data.List ([CLC proposal #182](https://github.com/haskell/core-libraries-committee/issues/182)). - * Deprecate `Data.List.NonEmpty.unzip` ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86)) + * Add `{-# WARNING in "x-data-list-nonempty-unzip" #-}` to `Data.List.NonEmpty.unzip`. + Use `{-# OPTIONS_GHC -Wno-x-data-list-nonempty-unzip #-}` to disable it. + ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86) + and [CLC proposal #258](https://github.com/haskell/core-libraries-committee/issues/258)) * Add `System.Mem.performMajorGC` ([CLC proposal #230](https://github.com/haskell/core-libraries-committee/issues/230)) * Fix exponent overflow/underflow bugs in the `Read` instances for `Float` and `Double` ([CLC proposal #192](https://github.com/haskell/core-libraries-committee/issues/192)) * Implement `many` and `some` methods of `instance Alternative (Compose f g)` explicitly. ([CLC proposal #181](https://github.com/haskell/core-libraries-committee/issues/181)) ===================================== libraries/base/src/Data/List/NonEmpty.hs ===================================== @@ -534,7 +534,7 @@ zipWith f ~(x :| xs) ~(y :| ys) = f x y :| List.zipWith f xs ys -- | The 'unzip' function is the inverse of the 'zip' function. unzip :: Functor f => f (a,b) -> (f a, f b) unzip xs = (fst <$> xs, snd <$> xs) -{-# DEPRECATED unzip "This function will be made monomorphic in base-4.22, consider switching to GHC.Internal.Data.Functor.unzip" #-} +{-# WARNING in "x-data-list-nonempty-unzip" unzip "This function will be made monomorphic in base-4.22, consider switching to Data.Functor.unzip" #-} -- | The 'nub' function removes duplicate elements from a list. In -- particular, it keeps only the first occurrence of each element. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e85fa5a8daedafa2304290ef803bdfa5edf53d9c...fd5073c699a3b4d2583437094683ac13f9f088da -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e85fa5a8daedafa2304290ef803bdfa5edf53d9c...fd5073c699a3b4d2583437094683ac13f9f088da You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 10:39:01 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Mon, 04 Mar 2024 05:39:01 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Linker: Use SymbolExtras for GOT relative relocations to local symbols Message-ID: <65e5a4c5c76ba_381c1f9d945788873c@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: c482cd0f by Sven Tennie at 2024-03-04T11:37:16+01:00 Linker: Use SymbolExtras for GOT relative relocations to local symbols This is (hopefully!) faster than emitting real GOT entries for all local labels (which was implemented before.) - - - - - 5 changed files: - rts/LinkerInternals.h - rts/linker/SymbolExtras.c - rts/linker/SymbolExtras.h - rts/linker/elf_got.c - rts/linker/elf_reloc_riscv64.c Changes: ===================================== rts/LinkerInternals.h ===================================== @@ -208,7 +208,7 @@ typedef struct _Segment { int n_sections; } Segment; -#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH) +#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH) || defined(riscv64_HOST_ARCH) #define NEED_SYMBOL_EXTRAS 1 #endif @@ -237,6 +237,8 @@ typedef struct { uint8_t jumpIsland[8]; #elif defined(arm_HOST_ARCH) uint8_t jumpIsland[16]; +#elif defined(riscv64_HOST_ARCH) + uint64_t addr; #endif } SymbolExtra; ===================================== rts/linker/SymbolExtras.c ===================================== @@ -153,7 +153,7 @@ void ocProtectExtras(ObjectCode* oc) } -#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) +#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(riscv64_HOST_ARCH) SymbolExtra* makeSymbolExtra( ObjectCode const* oc, unsigned long symbolNumber, unsigned long target ) @@ -189,9 +189,12 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc, extra->addr = target; memcpy(extra->jumpIsland, jmp, 8); #endif /* x86_64_HOST_ARCH */ - +#if defined(riscv64_HOST_ARCH) + // Fake GOT entry (used like GOT, but located in symbol extras) + extra->addr = target; +#endif return extra; } -#endif /* powerpc_HOST_ARCH || x86_64_HOST_ARCH */ +#endif /* powerpc_HOST_ARCH || x86_64_HOST_ARCH || riscv64_HOST_ARCH */ #endif /* !x86_64_HOST_ARCH) || !mingw32_HOST_OS */ #endif // NEED_SYMBOL_EXTRAS ===================================== rts/linker/SymbolExtras.h ===================================== @@ -16,7 +16,7 @@ SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc, unsigned long target, bool fromThumb, bool toThumb ); -#elif defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) +#elif defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(riscv64_HOST_ARCH) SymbolExtra* makeSymbolExtra( ObjectCode const* oc, unsigned long symbolNumber, unsigned long target ); ===================================== rts/linker/elf_got.c ===================================== @@ -22,22 +22,7 @@ bool needGotSlot(Elf_Sym *symbol) { ELF_ST_BIND(symbol->st_info) == STB_WEAK // Section symbols exist primarily for relocation // and as such may need a GOT slot. - || ELF_ST_TYPE(symbol->st_info) == STT_SECTION -#if defined(riscv64_HOST_ARCH) - // RISCV relies much on relocations and relaxations, leaving most of - // the addressing mode heavy lifting to the linker. We're using LA to - // load local label addresses (e.g. to access `*_closure`.) This - // implies (in the medany memory model) relocation via the GOT unless - // the instruction gets relaxed to e.g. direct or PC-relative - // addressing. So, for now, we've got the special case to add GOT - // symbols for all local labels here. This could be optimized by e.g. - // adding symbols to GOT on demand: I.e. if we spot a symbol related - // relocation which cannot be relaxed to direct or PC-relative - // addressing, then add it to GOT (otherwise not.) - || (ELF_ST_BIND(symbol->st_info) == STB_LOCAL && - ELF_ST_TYPE(symbol->st_info) == STT_NOTYPE && symbol->st_name != 0) -#endif - ; + || ELF_ST_TYPE(symbol->st_info) == STT_SECTION; } bool ===================================== rts/linker/elf_reloc_riscv64.c ===================================== @@ -1,6 +1,8 @@ #include "elf_reloc_riscv64.h" +#include "LinkerInternals.h" #include "Rts.h" #include "Stg.h" +#include "SymbolExtras.h" #include "elf.h" #include "elf_plt.h" #include "elf_util.h" @@ -442,8 +444,8 @@ int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, symbol_prime->addr, symbol_prime->name)); int32_t result = computeAddend(targetSection, (Elf_Rel *)rel_prime, symbol_prime, addend_prime, oc); - IF_DEBUG(linker, - debugBelch("Result of computeAddend: 0x%x (%d)\n", result, result)); + IF_DEBUG(linker, debugBelch("Result of computeAddend: 0x%x (%d)\n", + result, result)); return result; } } @@ -509,9 +511,28 @@ int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, case R_RISCV_32_PCREL: return S + A - P; case R_RISCV_GOT_HI20: { - // Ensure that the GOT entry is set up. - CHECK(0x0 != GOT_S); - return GOT_S + A - P; + // TODO: Allocating extra memory for every symbol just to play this trick + // seems to be a bit obscene. (GOT relocations hitting local symbols + // happens, but not very often.) It would be better to allocate only what we + // really need. + + // There are two cases here: 1. The symbol is public and has an entry in the + // GOT. 2. It's local and has no corresponding GOT entry. The first case is + // easy: We simply calculate the addend with the GOT address. In the second + // case we create a symbol extra entry and pretend it's the GOT. + if (GOT_S != 0) { + // 1. Public symbol with GOT entry. + return GOT_S + A - P; + } else { + // 2. Fake GOT entry with symbol extra entry. + SymbolExtra *symbolExtra = makeSymbolExtra(oc, ELF_R_SYM(rel->r_info), S); + addr_t* FAKE_GOT_S = &symbolExtra->addr; + addr_t res = (addr_t) FAKE_GOT_S + A - P; + IF_DEBUG(linker, debugBelch("R_RISCV_GOT_HI20 w/ SymbolExtra = %p , " + "entry = 0x%lx , reloc-addend = 0x%lu ", + symbolExtra, FAKE_GOT_S, res)); + return res; + } } default: debugBelch("Unimplemented relocation: 0x%lx\n (%lu)", View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c482cd0f92ab04287357673d5e4253fc6795ec08 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c482cd0f92ab04287357673d5e4253fc6795ec08 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 10:56:47 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Mon, 04 Mar 2024 05:56:47 -0500 Subject: [Git][ghc/ghc][wip/T24466] Wibbles to pipeline Message-ID: <65e5a8efc4289_381c1fa64c8a0906c5@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24466 at Glasgow Haskell Compiler / GHC Commits: 2663025f by Simon Peyton Jones at 2024-03-04T10:56:12+00:00 Wibbles to pipeline Accidentlly added an unnecessary pass - - - - - 1 changed file: - compiler/GHC/Core/Opt/Pipeline.hs Changes: ===================================== compiler/GHC/Core/Opt/Pipeline.hs ===================================== @@ -324,12 +324,11 @@ getCoreToDo dflags hpt_rule_base extra_vars -- off one layer of a recursive function (concretely, I saw this -- in wheel-sieve1), and I'm guessing that SpecConstr can too -- And CSE is a very cheap pass. So it seems worth doing here. - runWhen cse $ CoreCSE, - - -- New opportunities for float-in - runWhen do_float_in CoreDoFloatInwards, - - simplify "post-O2", + -- Also SpecConstr yields new FloatIn possibilities + runWhen (liberate_case || spec_constr) $ CoreDoPasses + [ runWhen cse CoreCSE + , runWhen do_float_in CoreDoFloatInwards + , runWhen (cse || do_float_in) $ simplify "post-O2" ], --------- End of -O2 passes -------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2663025f91cfbeb563a5865ea7f4f1e3ea965568 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2663025f91cfbeb563a5865ea7f4f1e3ea965568 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 13:07:05 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 08:07:05 -0500 Subject: [Git][ghc/ghc][wip/global-package-db] 8 commits: Introduce ListTuplePuns extension Message-ID: <65e5c7792522_a5db038dbce465969@gitlab.mail> Matthew Pickering pushed to branch wip/global-package-db at Glasgow Haskell Compiler / GHC Commits: d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 9fffd397 by Matthew Pickering at 2024-03-04T12:43:58+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage2 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage2 package database. * Stage 2 cross compilers need to use stage3 libraries, so likewise, we should set to stage * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. - - - - - 6a9a06de by Matthew Pickering at 2024-03-04T13:06:47+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/Settings/IO.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Gen/Bind.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/Instance/Typeable.hs - compiler/GHC/Tc/Types/Origin.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/187b4a5310600331c4c54177143b4c46df9d641f...6a9a06debfc3acf933734c0b0e681e92e928e899 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/187b4a5310600331c4c54177143b4c46df9d641f...6a9a06debfc3acf933734c0b0e681e92e928e899 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 13:29:50 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 08:29:50 -0500 Subject: [Git][ghc/ghc][wip/hadrian-cross-stage2] 12 commits: Read global package database from settings file Message-ID: <65e5ccceaab67_a5db03fa07006872d@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC Commits: 7a249c93 by Matthew Pickering at 2024-03-04T13:08:51+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage2 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage2 package database. * Stage 2 cross compilers need to use stage3 libraries, so likewise, we should set to stage * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. - - - - - 546d3e40 by Matthew Pickering at 2024-03-04T13:08:51+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 2bbfd538 by Matthew Pickering at 2024-03-04T13:08:51+00:00 Add missing req_interp modifier to T18441fail3 and T18441fail19 These tests require the interpreter but they were failing in a different way with the javascript backend because the interpreter was disabled and stderr is ignored by the test. - - - - - 06f05d06 by Matthew Pickering at 2024-03-04T13:08:51+00:00 Use explicit syntax rather than pure - - - - - dce68982 by Matthew Pickering at 2024-03-04T13:08:51+00:00 ci: Fail when bindist configure fails when installing bindist It is better to fail earlier if the configure step fails rather than carrying on for a more obscure error message. - - - - - c2f17b41 by Matthew Pickering at 2024-03-04T13:08:52+00:00 packaging: correctly propagate build/host/target to bindist configure script At the moment the host and target which we will produce a compiler for is fixed at the initial configure time. Therefore we need to persist the choice made at this time into the installation bindist as well so we look for the right tools, with the right prefixes at install time. In the future, we want to provide a bit more control about what kind of bindist we produce so the logic about what the host/target will have to be written by hadrian rather than persisted by the configure script. In particular with cross compilers we want to either build a normal stage 2 cross bindist or a stage 3 bindist, which creates a bindist which has a native compiler for the target platform. Fixes #21970 - - - - - f08041d3 by Matthew Pickering at 2024-03-04T13:08:52+00:00 hadrian: Fill in more of the default.host toolchain file When you are building a cross compiler this file will be used to build stage1 and it's libraries, so we need enough information here to work accurately. There is still more work to be done (see for example, word size is still fixed). - - - - - 06f6d626 by Matthew Pickering at 2024-03-04T13:08:52+00:00 hadrian: Disable docs when cross compiling Before there were a variety of ad-hoc places where doc building was disabled when cross compiling. * Some CI jobs sets --docs=none in gen_ci.hs * Some CI jobs set --docs=none in .gitlab/ci.sh * There was some logic in hadrian to not need the ["docs"] target when making a bindist. Now the situation is simple: * If you are cross compiling then defaultDocsTargets is empty by default. In theory, there is no reason why we can't build documentation for cross compiler bindists, but this is left to future work to generalise the documentation building rules to allow this (#24289) - - - - - 6867f0b0 by Matthew Pickering at 2024-03-04T13:24:21+00:00 hadrian: Build stage 2 cross compilers * Most of hadrian is abstracted over the stage in order to remove the assumption that the target of all stages is the same platform. This allows the RTS to be built for two different targets for example. * Abstracts the bindist creation logic to allow building either normal or cross bindists. Normal bindists use stage 1 libraries and a stage 2 compiler. Cross bindists use stage 2 libararies and a stage 2 compiler. * hadrian: Make binary-dist-dir the default build target. This allows us to have the logic in one place about which libraries/stages to build with cross compilers. Fixes #24192 New hadrian target: * `binary-dist-dir-cross`: Build a cross compiler bindist (compiler = stage 1, libraries = stage 2) ------------------------- Metric Decrease: T10421a T10858 T11195 T11276 T11374 T11822 T15630 T17096 T18478 T20261 Metric Increase: parsing001 ------------------------- - - - - - 31665224 by Matthew Pickering at 2024-03-04T13:24:21+00:00 ci: Test cross bindists We remove the special logic for testing in-tree cross compilers and instead test cross compiler bindists, like we do for all other platforms. - - - - - 717c2760 by Matthew Pickering at 2024-03-04T13:24:21+00:00 ci: Javascript don't set CROSS_EMULATOR There is no CROSS_EMULATOR needed to run javascript binaries, so we don't set the CROSS_EMULATOR to some dummy value. - - - - - db2e4a50 by Matthew Pickering at 2024-03-04T13:24:21+00:00 ci: Introduce CROSS_STAGE variable In preparation for building and testing stage3 bindists we introduce the CROSS_STAGE variable which is used by a CI job to determine what kind of bindist the CI job should produce. At the moment we are only using CROSS_STAGE=2 but in the future we will have some jobs which set CROSS_STAGE=3 to produce native bindists for a target, but produced by a cross compiler, which can be tested on by another CI job on the native platform. CROSS_STAGE=2: Build a normal cross compiler bindist CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target - - - - - 30 changed files: - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.hs - configure.ac - distrib/configure.ac.in - hadrian/bindist/Makefile - hadrian/bindist/config.mk.in - hadrian/cfg/default.host.target.in - hadrian/hadrian.cabal - + hadrian/src/BindistConfig.hs - hadrian/src/Builder.hs - hadrian/src/Context.hs - hadrian/src/Expression.hs - hadrian/src/Flavour.hs - hadrian/src/Flavour/Type.hs - hadrian/src/Hadrian/Expression.hs - hadrian/src/Hadrian/Haskell/Hash.hs - hadrian/src/Hadrian/Oracles/TextFile.hs - hadrian/src/Oracles/Flag.hs - hadrian/src/Oracles/Flavour.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Packages.hs - hadrian/src/Rules.hs - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/CabalReinstall.hs - hadrian/src/Rules/Compile.hs - hadrian/src/Rules/Documentation.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e514613a07b2e0e5ccea943a140db7a31595008b...db2e4a5093908219578157fde598ac6a6beff746 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e514613a07b2e0e5ccea943a140db7a31595008b...db2e4a5093908219578157fde598ac6a6beff746 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 13:40:14 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 08:40:14 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/cross-stage2-rebased Message-ID: <65e5cf3edb8ed_a5db0481dd9c71871@gitlab.mail> Matthew Pickering pushed new branch wip/cross-stage2-rebased at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/cross-stage2-rebased You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 13:44:46 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 08:44:46 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/hadrian-ghci-multi Message-ID: <65e5d04ec2608_a5db049be28c72040@gitlab.mail> Matthew Pickering pushed new branch wip/hadrian-ghci-multi at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/hadrian-ghci-multi You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 13:45:01 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 08:45:01 -0500 Subject: [Git][ghc/ghc][wip/hadrian-ghci-multi] ci: Try using multi repl in ghc-in-ghci test Message-ID: <65e5d05d877fb_a5db049f69fc72283@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-ghci-multi at Glasgow Haskell Compiler / GHC Commits: e196f1f0 by Matthew Pickering at 2024-03-04T13:44:54+00:00 ci: Try using multi repl in ghc-in-ghci test This should be quite a bit faster than the ./hadrian/ghci command as it doesn't properly build all the dependencies. - - - - - 1 changed file: - .gitlab-ci.yml Changes: ===================================== .gitlab-ci.yml ===================================== @@ -401,7 +401,7 @@ hadrian-ghc-in-ghci: - "echo ' ghc-options: -Werror' >> hadrian/cabal.project.local" # Load ghc-in-ghci then immediately exit and check the modules loaded - export CORES="$(mk/detect-cpu-count.sh)" - - echo ":q" | HADRIAN_ARGS=-j$CORES hadrian/ghci -j$CORES | tail -n2 | grep "Ok," + - echo ":q" | HADRIAN_ARGS=-j$CORES hadrian/ghci-multi -j$CORES -Wno-error=deprecations | tail -n2 | grep "Ok," after_script: - .gitlab/ci.sh save_cache - cat ci-timings View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e196f1f02163d055db784048a5727dbf01c68f0f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e196f1f02163d055db784048a5727dbf01c68f0f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 14:03:52 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 09:03:52 -0500 Subject: [Git][ghc/ghc][wip/cross-stage2-rebased] Fix genapply Message-ID: <65e5d4c8747e8_a5db051e10407506a@gitlab.mail> Matthew Pickering pushed to branch wip/cross-stage2-rebased at Glasgow Haskell Compiler / GHC Commits: e32aa927 by Matthew Pickering at 2024-03-04T14:03:45+00:00 Fix genapply - - - - - 1 changed file: - hadrian/src/Builder.hs Changes: ===================================== hadrian/src/Builder.hs ===================================== @@ -205,7 +205,7 @@ instance NFData Builder builderProvenance :: Builder -> Maybe Context builderProvenance = \case DeriveConstants -> context stage0Boot deriveConstants - GenApply -> context stage0Boot genapply + GenApply -> context stage0InTree genapply GenPrimopCode -> context stage0Boot genprimopcode Ghc _ (Stage0 {})-> Nothing Ghc _ stage -> context (predStage stage) ghc View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e32aa9272229dfa7fa2b4bcb0cc5b361fc75060e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e32aa9272229dfa7fa2b4bcb0cc5b361fc75060e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 14:06:39 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 09:06:39 -0500 Subject: [Git][ghc/ghc][wip/cross-stage2-rebased] Remove unused Message-ID: <65e5d56f46ba2_a5db05441060752e1@gitlab.mail> Matthew Pickering pushed to branch wip/cross-stage2-rebased at Glasgow Haskell Compiler / GHC Commits: 3d13d08c by Matthew Pickering at 2024-03-04T14:06:33+00:00 Remove unused - - - - - 1 changed file: - hadrian/src/Oracles/TestSettings.hs Changes: ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -15,7 +15,6 @@ import Packages import Settings.Program (programContext) import Hadrian.Oracles.Path import System.Directory (makeAbsolute) -import Oracles.Flag testConfigFile :: Action FilePath testConfigFile = buildRoot <&> (-/- "test/ghcconfig") View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3d13d08c00296275d396d9ddf2caedade28e6f16 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3d13d08c00296275d396d9ddf2caedade28e6f16 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 14:30:44 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Mon, 04 Mar 2024 09:30:44 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T23160-teo Message-ID: <65e5db142e680_a5db05f0210c7606a@gitlab.mail> Teo Camarasu pushed new branch wip/T23160-teo at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T23160-teo You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 15:17:21 2024 From: gitlab at gitlab.haskell.org (sheaf (@sheaf)) Date: Mon, 04 Mar 2024 10:17:21 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] x86-ncg: Fix fma codegen when arguments are globals. Message-ID: <65e5e6017015f_a5db0763c9bc80898@gitlab.mail> sheaf pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: ad0ecb8d by Andreas Klebinger at 2024-03-04T16:17:12+01:00 x86-ncg: Fix fma codegen when arguments are globals. Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 4 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3424,6 +3424,7 @@ genFMA3Code :: Width -> FMASign -> CmmExpr -> CmmExpr -> CmmExpr -> NatM Register genFMA3Code w signs x y z = do + -- platform <- getPlatform -- For the FMA instruction, we want to compute x * y + z -- @@ -3445,17 +3446,46 @@ genFMA3Code w signs x y z = do -- -- Currently we follow neither of these optimisations, -- opting to always use fmadd213 for simplicity. + -- + -- We would like to compute the result directly into the requested register. + -- To do so we must first compute `x` into the destination register. This is + -- only possible if the other arguments don't use the destination register. + -- We check for this and if there is a conflict we move the result only after + -- the computation. See #24496 how this went wrong in the past. let rep = floatFormat w (y_reg, y_code) <- getNonClobberedReg y - (z_reg, z_code) <- getNonClobberedReg z + (z_op, z_code) <- getNonClobberedOperand z x_code <- getAnyReg x + x_tmp <- getNewRegNat rep let fma213 = FMA3 rep signs FMA213 - code dst - = y_code `appOL` + + code, code_direct, code_mov :: Reg -> InstrBlock + -- Ideal: Compute the result directly into dst + code_direct dst = x_code dst `snocOL` + fma213 z_op y_reg dst + -- Fallback: Compute the result into a tmp reg and then move it. + code_mov dst = x_code x_tmp `snocOL` + fma213 z_op y_reg x_tmp `snocOL` + MOV rep (OpReg x_tmp) (OpReg dst) + + code dst = + y_code `appOL` z_code `appOL` - x_code dst `snocOL` - fma213 (OpReg z_reg) y_reg dst + ( if arg_regs_conflict then code_mov dst else code_direct dst ) + + where + + arg_regs_conflict = + y_reg == dst || + case z_op of + OpReg z_reg -> z_reg == dst + OpAddr amode -> dst `elem` addrModeRegs amode + OpImm {} -> False + + + -- NB: Computing the result into a desired register using Any can be tricky. + -- So for now keep it simple. (See #24496). return (Any rep code) ----------- ===================================== testsuite/tests/primops/should_run/T24496.hs ===================================== @@ -0,0 +1,18 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +import GHC.Exts + +twoProductFloat# :: Float# -> Float# -> (# Float#, Float# #) +twoProductFloat# x y = let !r = x `timesFloat#` y + in (# r, fmsubFloat# x y r #) +{-# NOINLINE twoProductFloat# #-} + +twoProductDouble# :: Double# -> Double# -> (# Double#, Double# #) +twoProductDouble# x y = let !r = x *## y + in (# r, fmsubDouble# x y r #) +{-# NOINLINE twoProductDouble# #-} + +main :: IO () +main = do + print $ case twoProductFloat# 2.0# 3.0# of (# r, s #) -> (F# r, F# s) + print $ case twoProductDouble# 2.0## 3.0## of (# r, s #) -> (D# r, D# s) ===================================== testsuite/tests/primops/should_run/T24496.stdout ===================================== @@ -0,0 +1,2 @@ +(6.0,0.0) +(6.0,0.0) ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,3 +77,10 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) +test('T24496' + , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) + , js_skip # JS backend doesn't have an FMA implementation + , when(arch('wasm32'), skip) + , when(have_llvm(), extra_ways(["optllvm"])) + ] + , compile_and_run, ['-O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ad0ecb8d48764e1fec76b4231355c4492cd219ba -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ad0ecb8d48764e1fec76b4231355c4492cd219ba You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 15:17:41 2024 From: gitlab at gitlab.haskell.org (sheaf (@sheaf)) Date: Mon, 04 Mar 2024 10:17:41 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] 15 commits: testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e5e615e66ff_a5db077072d4824b4@gitlab.mail> sheaf pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - c16b3df4 by Andreas Klebinger at 2024-03-04T15:17:37+00:00 x86-ncg: Fix fma codegen when arguments are globals. Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Iface/Ext/Utils.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ad0ecb8d48764e1fec76b4231355c4492cd219ba...c16b3df468de6a021da12fce4fa359776fec75ce -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ad0ecb8d48764e1fec76b4231355c4492cd219ba...c16b3df468de6a021da12fce4fa359776fec75ce You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 15:19:54 2024 From: gitlab at gitlab.haskell.org (sheaf (@sheaf)) Date: Mon, 04 Mar 2024 10:19:54 -0500 Subject: [Git][ghc/ghc][wip/andreask/fma_globals] x86-ncg: Fix fma codegen when arguments are globals Message-ID: <65e5e69ac36cd_a5db077aff4c82891@gitlab.mail> sheaf pushed to branch wip/andreask/fma_globals at Glasgow Haskell Compiler / GHC Commits: 4af8ca2b by Andreas Klebinger at 2024-03-04T16:19:33+01:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 4 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3424,7 +3424,6 @@ genFMA3Code :: Width -> FMASign -> CmmExpr -> CmmExpr -> CmmExpr -> NatM Register genFMA3Code w signs x y z = do - -- For the FMA instruction, we want to compute x * y + z -- -- There are three possible instructions we could emit: @@ -3445,17 +3444,45 @@ genFMA3Code w signs x y z = do -- -- Currently we follow neither of these optimisations, -- opting to always use fmadd213 for simplicity. + -- + -- We would like to compute the result directly into the requested register. + -- To do so we must first compute `x` into the destination register. This is + -- only possible if the other arguments don't use the destination register. + -- We check for this and if there is a conflict we move the result only after + -- the computation. See #24496 how this went wrong in the past. let rep = floatFormat w (y_reg, y_code) <- getNonClobberedReg y - (z_reg, z_code) <- getNonClobberedReg z + (z_op, z_code) <- getNonClobberedOperand z x_code <- getAnyReg x + x_tmp <- getNewRegNat rep let fma213 = FMA3 rep signs FMA213 - code dst - = y_code `appOL` + + code, code_direct, code_mov :: Reg -> InstrBlock + -- Ideal: Compute the result directly into dst + code_direct dst = x_code dst `snocOL` + fma213 z_op y_reg dst + -- Fallback: Compute the result into a tmp reg and then move it. + code_mov dst = x_code x_tmp `snocOL` + fma213 z_op y_reg x_tmp `snocOL` + MOV rep (OpReg x_tmp) (OpReg dst) + + code dst = + y_code `appOL` z_code `appOL` - x_code dst `snocOL` - fma213 (OpReg z_reg) y_reg dst + ( if arg_regs_conflict then code_mov dst else code_direct dst ) + + where + + arg_regs_conflict = + y_reg == dst || + case z_op of + OpReg z_reg -> z_reg == dst + OpAddr amode -> dst `elem` addrModeRegs amode + OpImm {} -> False + + -- NB: Computing the result into a desired register using Any can be tricky. + -- So for now, we keep it simple. (See #24496). return (Any rep code) ----------- ===================================== testsuite/tests/primops/should_run/T24496.hs ===================================== @@ -0,0 +1,18 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +import GHC.Exts + +twoProductFloat# :: Float# -> Float# -> (# Float#, Float# #) +twoProductFloat# x y = let !r = x `timesFloat#` y + in (# r, fmsubFloat# x y r #) +{-# NOINLINE twoProductFloat# #-} + +twoProductDouble# :: Double# -> Double# -> (# Double#, Double# #) +twoProductDouble# x y = let !r = x *## y + in (# r, fmsubDouble# x y r #) +{-# NOINLINE twoProductDouble# #-} + +main :: IO () +main = do + print $ case twoProductFloat# 2.0# 3.0# of (# r, s #) -> (F# r, F# s) + print $ case twoProductDouble# 2.0## 3.0## of (# r, s #) -> (D# r, D# s) ===================================== testsuite/tests/primops/should_run/T24496.stdout ===================================== @@ -0,0 +1,2 @@ +(6.0,0.0) +(6.0,0.0) ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,3 +77,10 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) +test('T24496' + , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) + , js_skip # JS backend doesn't have an FMA implementation + , when(arch('wasm32'), skip) + , when(have_llvm(), extra_ways(["optllvm"])) + ] + , compile_and_run, ['-O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4af8ca2bd52f2949c8fefa7b45fafddaee86d609 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4af8ca2bd52f2949c8fefa7b45fafddaee86d609 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 15:52:24 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 10:52:24 -0500 Subject: [Git][ghc/ghc][wip/cross-stage2-rebased] 4 commits: hadrian: Build stage 2 cross compilers Message-ID: <65e5ee38437a8_a5db0868dc30865c2@gitlab.mail> Matthew Pickering pushed to branch wip/cross-stage2-rebased at Glasgow Haskell Compiler / GHC Commits: 3c992958 by Matthew Pickering at 2024-03-04T15:52:14+00:00 hadrian: Build stage 2 cross compilers * Most of hadrian is abstracted over the stage in order to remove the assumption that the target of all stages is the same platform. This allows the RTS to be built for two different targets for example. * Abstracts the bindist creation logic to allow building either normal or cross bindists. Normal bindists use stage 1 libraries and a stage 2 compiler. Cross bindists use stage 2 libararies and a stage 2 compiler. * hadrian: Make binary-dist-dir the default build target. This allows us to have the logic in one place about which libraries/stages to build with cross compilers. Fixes #24192 New hadrian target: * `binary-dist-dir-cross`: Build a cross compiler bindist (compiler = stage 1, libraries = stage 2) ------------------------- Metric Decrease: T10421a T10858 T11195 T11276 T11374 T11822 T15630 T17096 T18478 T20261 Metric Increase: parsing001 ------------------------- - - - - - 5bf8fc3d by Matthew Pickering at 2024-03-04T15:52:14+00:00 ci: Test cross bindists We remove the special logic for testing in-tree cross compilers and instead test cross compiler bindists, like we do for all other platforms. - - - - - c4d6c385 by Matthew Pickering at 2024-03-04T15:52:14+00:00 ci: Javascript don't set CROSS_EMULATOR There is no CROSS_EMULATOR needed to run javascript binaries, so we don't set the CROSS_EMULATOR to some dummy value. - - - - - 1ab5a430 by Matthew Pickering at 2024-03-04T15:52:14+00:00 ci: Introduce CROSS_STAGE variable In preparation for building and testing stage3 bindists we introduce the CROSS_STAGE variable which is used by a CI job to determine what kind of bindist the CI job should produce. At the moment we are only using CROSS_STAGE=2 but in the future we will have some jobs which set CROSS_STAGE=3 to produce native bindists for a target, but produced by a cross compiler, which can be tested on by another CI job on the native platform. CROSS_STAGE=2: Build a normal cross compiler bindist CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target - - - - - 30 changed files: - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - distrib/configure.ac.in - hadrian/bindist/config.mk.in - hadrian/hadrian.cabal - + hadrian/src/BindistConfig.hs - hadrian/src/Builder.hs - hadrian/src/Context.hs - hadrian/src/Expression.hs - hadrian/src/Flavour.hs - hadrian/src/Flavour/Type.hs - hadrian/src/Hadrian/Expression.hs - hadrian/src/Hadrian/Haskell/Hash.hs - hadrian/src/Hadrian/Oracles/TextFile.hs - hadrian/src/Oracles/Flag.hs - hadrian/src/Oracles/Flavour.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Packages.hs - hadrian/src/Rules.hs - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/CabalReinstall.hs - hadrian/src/Rules/Compile.hs - hadrian/src/Rules/Documentation.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Gmp.hs - hadrian/src/Rules/Libffi.hs - hadrian/src/Rules/Library.hs - hadrian/src/Rules/Program.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3d13d08c00296275d396d9ddf2caedade28e6f16...1ab5a43080caeda93f969a61971a7aaeadb18098 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3d13d08c00296275d396d9ddf2caedade28e6f16...1ab5a43080caeda93f969a61971a7aaeadb18098 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 16:36:41 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Mon, 04 Mar 2024 11:36:41 -0500 Subject: [Git][ghc/ghc][wip/fprof-overloaded] 17 commits: rts: avoid checking bdescr of value outside of Haskell heap Message-ID: <65e5f899edc85_a5db0989534c87968@gitlab.mail> Finley McIlwaine pushed to branch wip/fprof-overloaded at Glasgow Haskell Compiler / GHC Commits: 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 5d7c7bb5 by Finley McIlwaine at 2024-03-04T08:36:31-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Iface/Ext/Utils.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7da9a1c3b403f1b9aa4e581ffbd4339b088f758d...5d7c7bb5667e52a2e154e25c1eb13f1de010dd3b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7da9a1c3b403f1b9aa4e581ffbd4339b088f758d...5d7c7bb5667e52a2e154e25c1eb13f1de010dd3b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 16:46:55 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Mon, 04 Mar 2024 11:46:55 -0500 Subject: [Git][ghc/ghc][wip/fprof-overloaded] add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e5faffac158_a5db0a1ea9889131a@gitlab.mail> Finley McIlwaine pushed to branch wip/fprof-overloaded at Glasgow Haskell Compiler / GHC Commits: c3dac715 by Finley McIlwaine at 2024-03-04T08:46:19-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods - - - - - 26 changed files: - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout Changes: ===================================== compiler/GHC/Core/LateCC.hs ===================================== @@ -1,164 +1,90 @@ -{-# LANGUAGE DerivingStrategies #-} -{-# LANGUAGE TupleSections #-} +{-# LANGUAGE RecordWildCards #-} --- | Adds cost-centers after the core piple has run. +-- | Adds cost-centers after the core pipline has run. module GHC.Core.LateCC - ( addLateCostCentresMG - , addLateCostCentresPgm - , addLateCostCentres -- Might be useful for API users - , Env(..) + ( -- * Inserting cost centres + addLateCostCenters ) where -import Control.Applicative -import Control.Monad -import qualified Data.Set as S - import GHC.Prelude -import GHC.Types.CostCentre -import GHC.Types.CostCentre.State -import GHC.Types.Name hiding (varName) -import GHC.Types.Tickish -import GHC.Unit.Module.ModGuts -import GHC.Types.Var -import GHC.Unit.Types -import GHC.Data.FastString -import GHC.Core -import GHC.Core.Opt.Monad -import GHC.Core.Utils (mkTick) -import GHC.Types.Id -import GHC.Driver.DynFlags +import GHC.Core +import GHC.Core.LateCC.OverloadedCalls +import GHC.Core.LateCC.TopLevelBinds +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Seq +import qualified GHC.Data.Strict as Strict +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.SrcLoc +import GHC.Utils.Error import GHC.Utils.Logger import GHC.Utils.Outputable -import GHC.Utils.Misc -import GHC.Utils.Error (withTiming) -import GHC.Utils.Monad.State.Strict - - -{- Note [Collecting late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Usually cost centres defined by a module are collected -during tidy by collectCostCentres. However with `-fprof-late` -we insert cost centres after inlining. So we keep a list of -all the cost centres we inserted and combine that with the list -of cost centres found during tidy. - -To avoid overhead when using -fprof-inline there is a flag to stop -us from collecting them here when we run this pass before tidy. - -Note [Adding late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The basic idea is very simple. For every top level binder -`f = rhs` we compile it as if the user had written -`f = {-# SCC f #-} rhs`. - -If we do this after unfoldings for `f` have been created this -doesn't impact core-level optimizations at all. If we do it -before the cost centre will be included in the unfolding and -might inhibit optimizations at the call site. For this reason -we provide flags for both approaches as they have different -tradeoffs. - -We also don't add a cost centre for any binder that is a constructor -worker or wrapper. These will never meaningfully enrich the resulting -profile so we improve efficiency by omitting those. - --} - -addLateCostCentresMG :: ModGuts -> CoreM ModGuts -addLateCostCentresMG guts = do - dflags <- getDynFlags - let env :: Env - env = Env - { thisModule = mg_module guts - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = False -- See Note [Collecting late cost centres] - } - let guts' = guts { mg_binds = fstOf3 (addLateCostCentres env (mg_binds guts)) - } - return guts' - -addLateCostCentresPgm :: DynFlags -> Logger -> Module -> CoreProgram -> IO (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentresPgm dflags logger mod binds = - withTiming logger - (text "LateCC"<+>brackets (ppr mod)) - (\(a,b,c) -> a `seqList` (b `seq` (c `seq` ()))) $ do - let env = Env - { thisModule = mod - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = True -- See Note [Collecting late cost centres] - } - (binds', ccs, cc_state) = addLateCostCentres env binds - when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ - putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr binds')) - return (binds', ccs, cc_state) -addLateCostCentres :: Env -> CoreProgram -> (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentres env binds = - let (binds', state) = runState (mapM (doBind env) binds) initLateCCState - in (binds', lcs_ccs state, lcs_state state) - - -doBind :: Env -> CoreBind -> M CoreBind -doBind env (NonRec b rhs) = NonRec b <$> doBndr env b rhs -doBind env (Rec bs) = Rec <$> mapM doPair bs +-- | Late cost center insertion logic used by the driver +addLateCostCenters :: + Logger + -- ^ Logger + -> LateCCConfig + -- ^ Late cost center configuration + -> CoreProgram + -- ^ The program + -> IO (CoreProgram, LateCCState (Strict.Maybe SrcSpan)) +addLateCostCenters logger LateCCConfig{..} core_binds = do + + -- If top-level late CCs are enabled via either -fprof-late or + -- -fprof-late-overloaded, add them + (top_level_cc_binds, top_level_late_cc_state) <- + case lateCCConfig_whichBinds of + LateCCNone -> + return (core_binds, initLateCCState ()) + _ -> + withTiming + logger + (text "LateTopLevelCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateTopLevelCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (initLateCCState ()) + (topLevelBindsCC top_level_cc_pred) + core_binds + + -- If overloaded call CCs are enabled via -fprof-late-overloaded-calls, add + -- them + (late_cc_binds, late_cc_state) <- + if lateCCConfig_overloadedCalls then + withTiming + logger + (text "LateOverloadedCallsCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateoverloadedCallsCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (top_level_late_cc_state { lateCCState_extra = Strict.Nothing }) + overloadedCallsCC + top_level_cc_binds + else + return + ( top_level_cc_binds + , top_level_late_cc_state { lateCCState_extra = Strict.Nothing } + ) + + return (late_cc_binds, late_cc_state) where - doPair :: ((Id, CoreExpr) -> M (Id, CoreExpr)) - doPair (b,rhs) = (b,) <$> doBndr env b rhs - -doBndr :: Env -> Id -> CoreExpr -> M CoreExpr -doBndr env bndr rhs - -- Cost centres on constructor workers are pretty much useless - -- so we don't emit them if we are looking at the rhs of a constructor - -- binding. - | Just _ <- isDataConId_maybe bndr = pure rhs - | otherwise = doBndr' env bndr rhs - - --- We want to put the cost centre below the lambda as we only care about executions of the RHS. -doBndr' :: Env -> Id -> CoreExpr -> State LateCCState CoreExpr -doBndr' env bndr (Lam b rhs) = Lam b <$> doBndr' env bndr rhs -doBndr' env bndr rhs = do - let name = idName bndr - name_loc = nameSrcSpan name - cc_name = getOccFS name - count = countEntries env - cc_flavour <- getCCFlavour cc_name - let cc_mod = thisModule env - bndrCC = NormalCC cc_flavour cc_name cc_mod name_loc - note = ProfNote bndrCC count True - addCC env bndrCC - return $ mkTick note rhs - -data LateCCState = LateCCState - { lcs_state :: !CostCentreState - , lcs_ccs :: S.Set CostCentre - } -type M = State LateCCState - -initLateCCState :: LateCCState -initLateCCState = LateCCState newCostCentreState mempty - -getCCFlavour :: FastString -> M CCFlavour -getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name - -getCCIndex' :: FastString -> M CostCentreIndex -getCCIndex' name = do - state <- get - let (index,cc_state') = getCCIndex name (lcs_state state) - put (state { lcs_state = cc_state'}) - return index - -addCC :: Env -> CostCentre -> M () -addCC !env cc = do - state <- get - when (collectCCs env) $ do - let ccs' = S.insert cc (lcs_ccs state) - put (state { lcs_ccs = ccs'}) - -data Env = Env - { thisModule :: !Module - , countEntries:: !Bool - , collectCCs :: !Bool - } - + top_level_cc_pred :: CoreExpr -> Bool + top_level_cc_pred = + case lateCCConfig_whichBinds of + LateCCAllBinds -> + const True + LateCCOverloadedBinds -> + isOverloadedTy . exprType + LateCCNone -> + -- This is here for completeness, we won't actually use this + -- predicate in this case since we'll shortcut. + const False + + this_mod = lateCCEnv_module lateCCConfig_env ===================================== compiler/GHC/Core/LateCC/OverloadedCalls.hs ===================================== @@ -0,0 +1,204 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TupleSections #-} + +module GHC.Core.LateCC.OverloadedCalls + ( overloadedCallsCC + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified GHC.Data.Strict as Strict + +import GHC.Data.FastString +import GHC.Core +import GHC.Core.LateCC.Utils +import GHC.Core.LateCC.Types +import GHC.Core.Make +import GHC.Core.Predicate +import GHC.Core.Type +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.Id +import GHC.Types.Name +import GHC.Types.SrcLoc +import GHC.Types.Tickish +import GHC.Types.Var +import GHC.Utils.Outputable + +type OverloadedCallsCCState = Strict.Maybe SrcSpan + +-- | Insert cost centres on function applications with dictionary arguments. The +-- source locations attached to the cost centres is approximated based on the +-- "closest" source note encountered in the traversal. +overloadedCallsCC :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind +overloadedCallsCC = + processBind + where + processBind :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind + processBind core_bind = + case core_bind of + NonRec b e -> + NonRec b <$> wrap_if_join b (processExpr e) + Rec es -> + Rec <$> mapM (\(b,e) -> (b,) <$> wrap_if_join b (processExpr e)) es + where + -- If an overloaded function is turned into a join point, we won't add + -- SCCs directly to calls since it makes them non-tail calls. Instead, + -- we look for join points here and add an SCC to their RHS if they are + -- overloaded. + wrap_if_join :: + CoreBndr + -> LateCCM OverloadedCallsCCState CoreExpr + -> LateCCM OverloadedCallsCCState CoreExpr + wrap_if_join b pexpr = do + expr <- pexpr + if isJoinId b && isOverloadedTy (exprType expr) then do + let + cc_name :: FastString + cc_name = fsLit "join-rhs-" `appendFS` getOccFS b + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan expr + else + return expr + + + processExpr :: CoreExpr -> LateCCM OverloadedCallsCCState CoreExpr + processExpr expr = + case expr of + -- The case we care about: Application + app at App{} -> do + -- Here we have some application like `f v1 ... vN`, where v1 ... vN + -- should be the function's type arguments followed by the value + -- arguments. To determine if the `f` is an overloaded function, we + -- check if any of the arguments v1 ... vN are dictionaries. + let + (f, xs) = collectArgs app + resultTy = applyTypeToArgs empty (exprType f) xs + + -- Recursively process the arguments first for no particular reason + args <- mapM processExpr xs + let app' = mkCoreApps f args + + if + -- Check if any of the arguments are dictionaries + any isDictExpr args + + -- Avoid instrumenting dictionary functions, which may be + -- overloaded if there are superclasses, by checking if the result + -- type of the function is a dictionary type. + && not (isDictTy resultTy) + + -- Avoid instrumenting constraint selectors like eq_sel + && (typeTypeOrConstraint resultTy /= ConstraintLike) + + -- Avoid instrumenting join points. + -- (See comment in processBind above) + && not (isJoinVarExpr f) + then do + -- Extract a name and source location from the function being + -- applied + let + cc_name :: FastString + cc_name = + fsLit $ maybe "" getOccString (exprName app) + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan app' + else + return app' + + -- For recursive constructors of Expr, we traverse the nested Exprs + Lam b e -> + mkCoreLams [b] <$> processExpr e + Let b e -> + mkCoreLet <$> processBind b <*> processExpr e + Case e b t alts -> + Case + <$> processExpr e + <*> pure b + <*> pure t + <*> mapM processAlt alts + Cast e co -> + mkCast <$> processExpr e <*> pure co + Tick t e -> do + trackSourceNote t $ + mkTick t <$> processExpr e + + -- For non-recursive constructors of Expr, we do nothing + x -> return x + + processAlt :: CoreAlt -> LateCCM OverloadedCallsCCState CoreAlt + processAlt (Alt c bs e) = Alt c bs <$> processExpr e + + trackSourceNote :: CoreTickish -> LateCCM OverloadedCallsCCState a -> LateCCM OverloadedCallsCCState a + trackSourceNote tick act = + case tick of + SourceNote rss _ -> do + -- Prefer source notes from the current file + in_current_file <- + maybe False ((== EQ) . lexicalCompareFS (srcSpanFile rss)) <$> + asks lateCCEnv_file + if not in_current_file then + act + else do + loc <- lift $ gets lateCCState_extra + lift . modify $ \s -> + s { lateCCState_extra = + Strict.Just $ RealSrcSpan rss mempty + } + x <- act + lift . modify $ \s -> + s { lateCCState_extra = loc + } + return x + _ -> + act + + -- Utility functions + + -- Extract a Name from an expression. If it is an application, attempt to + -- extract a name from the applied function. If it is a variable, return the + -- Name of the variable. If it is a tick/cast, attempt to extract a Name + -- from the expression held in the tick/cast. Otherwise return Nothing. + exprName :: CoreExpr -> Maybe Name + exprName = + \case + App f _ -> + exprName f + Var f -> + Just (idName f) + Tick _ e -> + exprName e + Cast e _ -> + exprName e + _ -> + Nothing + + -- Determine whether an expression is a dictionary + isDictExpr :: CoreExpr -> Bool + isDictExpr = + maybe False isDictTy . exprType' + where + exprType' :: CoreExpr -> Maybe Type + exprType' = \case + Type{} -> Nothing + expr -> Just $ exprType expr + + -- Determine whether an expression is a join variable + isJoinVarExpr :: CoreExpr -> Bool + isJoinVarExpr = + \case + Var var -> isJoinId var + Tick _ e -> isJoinVarExpr e + Cast e _ -> isJoinVarExpr e + _ -> False ===================================== compiler/GHC/Core/LateCC/TopLevelBinds.hs ===================================== @@ -0,0 +1,106 @@ +{-# LANGUAGE TupleSections #-} +module GHC.Core.LateCC.TopLevelBinds where + +import GHC.Prelude + +import GHC.Core +-- import GHC.Core.LateCC +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Opt.Monad +import GHC.Driver.DynFlags +import GHC.Types.Id +import GHC.Types.Name +import GHC.Unit.Module.ModGuts + +{- Note [Collecting late cost centres] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Usually cost centres defined by a module are collected +during tidy by collectCostCentres. However with `-fprof-late` +we insert cost centres after inlining. So we keep a list of +all the cost centres we inserted and combine that with the list +of cost centres found during tidy. + +To avoid overhead when using -fprof-inline there is a flag to stop +us from collecting them here when we run this pass before tidy. + +Note [Adding late cost centres to top level bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The basic idea is very simple. For every top level binder +`f = rhs` we compile it as if the user had written +`f = {-# SCC f #-} rhs`. + +If we do this after unfoldings for `f` have been created this +doesn't impact core-level optimizations at all. If we do it +before the cost centre will be included in the unfolding and +might inhibit optimizations at the call site. For this reason +we provide flags for both approaches as they have different +tradeoffs. + +We also don't add a cost centre for any binder that is a constructor +worker or wrapper. These will never meaningfully enrich the resulting +profile so we improve efficiency by omitting those. + +-} + +-- | Add late cost centres directly to the 'ModGuts'. This is used inside the +-- core pipeline with the -fprof-late-inline flag. It should not be used after +-- tidy, since it does not manually track inserted cost centers. See +-- Note [Collecting late cost centres]. +topLevelBindsCCMG :: ModGuts -> CoreM ModGuts +topLevelBindsCCMG guts = do + dflags <- getDynFlags + let + env = + LateCCEnv + { lateCCEnv_module = mg_module guts + + -- We don't use this for topLevelBindsCC, so Nothing is okay + , lateCCEnv_file = Nothing + + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = False + } + guts' = + guts + { mg_binds = + fst + ( doLateCostCenters + env + (initLateCCState ()) + (topLevelBindsCC (const True)) + (mg_binds guts) + ) + } + return guts' + +-- | Insert cost centres on top-level bindings in the module, depending on +-- whether or not they satisfy the given predicate. +topLevelBindsCC :: (CoreExpr -> Bool) -> CoreBind -> LateCCM s CoreBind +topLevelBindsCC pred core_bind = + case core_bind of + NonRec b rhs -> + NonRec b <$> doBndr b rhs + Rec bs -> + Rec <$> mapM doPair bs + where + doPair :: ((Id, CoreExpr) -> LateCCM s (Id, CoreExpr)) + doPair (b,rhs) = (b,) <$> doBndr b rhs + + doBndr :: Id -> CoreExpr -> LateCCM s CoreExpr + doBndr bndr rhs + -- Cost centres on constructor workers are pretty much useless + -- so we don't emit them if we are looking at the rhs of a constructor + -- binding. + | Just _ <- isDataConId_maybe bndr = pure rhs + | otherwise = if pred rhs then addCC bndr rhs else pure rhs + + -- We want to put the cost centre below the lambda as we only care about + -- executions of the RHS. + addCC :: Id -> CoreExpr -> LateCCM s CoreExpr + addCC bndr (Lam b rhs) = Lam b <$> addCC bndr rhs + addCC bndr rhs = do + let name = idName bndr + cc_loc = nameSrcSpan name + cc_name = getOccFS name + insertCC cc_name cc_loc rhs \ No newline at end of file ===================================== compiler/GHC/Core/LateCC/Types.hs ===================================== @@ -0,0 +1,74 @@ +-- | Types related to late cost center insertion +module GHC.Core.LateCC.Types + ( LateCCConfig(..) + , LateCCBindSpec(..) + , LateCCEnv(..) + , LateCCState(..) + , initLateCCState + , LateCCM + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Unit.Types + +-- | Late cost center insertion configuration. +-- +-- Specifies whether cost centers are added to overloaded function call sites +-- and/or top-level bindings, and which top-level bindings they are added to. +-- Also holds the cost center insertion environment. +data LateCCConfig = + LateCCConfig + { lateCCConfig_whichBinds :: !LateCCBindSpec + , lateCCConfig_overloadedCalls :: !Bool + , lateCCConfig_env :: !LateCCEnv + } + +-- | The types of top-level bindings we support adding cost centers to. +data LateCCBindSpec = + LateCCNone + | LateCCAllBinds + | LateCCOverloadedBinds + +-- | Late cost centre insertion environment +data LateCCEnv = LateCCEnv + { lateCCEnv_module :: !Module + -- ^ Current module + , lateCCEnv_file :: Maybe FastString + -- ^ Current file, if we have one + , lateCCEnv_countEntries:: !Bool + -- ^ Whether the inserted cost centers should count entries + , lateCCEnv_collectCCs :: !Bool + -- ^ Whether to collect the cost centres we insert. See + -- Note [Collecting late cost centres] + + } + +-- | Late cost centre insertion state, indexed by some extra state type that an +-- insertion method may require. +data LateCCState s = LateCCState + { lateCCState_ccs :: !(S.Set CostCentre) + -- ^ Cost centres that have been inserted + , lateCCState_ccState :: !CostCentreState + -- ^ Per-module state tracking for cost centre indices + , lateCCState_extra :: !s + } + +-- | The empty late cost centre insertion state +initLateCCState :: s -> LateCCState s +initLateCCState s = + LateCCState + { lateCCState_ccState = newCostCentreState + , lateCCState_ccs = mempty + , lateCCState_extra = s + } + +-- | Late cost centre insertion monad +type LateCCM s = ReaderT LateCCEnv (State (LateCCState s)) ===================================== compiler/GHC/Core/LateCC/Utils.hs ===================================== @@ -0,0 +1,80 @@ +module GHC.Core.LateCC.Utils + ( -- * Inserting cost centres + doLateCostCenters -- Might be useful for API users + + -- ** Helpers for defining insertion methods + , getCCFlavour + , insertCC + ) where + +import GHC.Prelude + +import Control.Monad +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Core +import GHC.Core.LateCC.Types +import GHC.Core.Utils +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Types.SrcLoc +import GHC.Types.Tickish + +-- | Insert cost centres into the 'CoreProgram' using the provided environment, +-- initial state, and insertion method. +doLateCostCenters + :: LateCCEnv + -- ^ Environment to run the insertion in + -> LateCCState s + -- ^ Initial state to run the insertion with + -> (CoreBind -> LateCCM s CoreBind) + -- ^ Insertion method + -> CoreProgram + -- ^ Bindings to consider + -> (CoreProgram, LateCCState s) +doLateCostCenters env state method binds = + runLateCC env state $ mapM method binds + +-- | Evaluate late cost centre insertion +runLateCC :: LateCCEnv -> LateCCState s -> LateCCM s a -> (a, LateCCState s) +runLateCC env state = (`runState` state) . (`runReaderT` env) + +-- | Given the name of a cost centre, get its flavour +getCCFlavour :: FastString -> LateCCM s CCFlavour +getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name + where + getCCIndex' :: FastString -> LateCCM s CostCentreIndex + getCCIndex' name = do + cc_state <- lift $ gets lateCCState_ccState + let (index, cc_state') = getCCIndex name cc_state + lift . modify $ \s -> s { lateCCState_ccState = cc_state'} + return index + +-- | Insert a cost centre with the specified name and source span on the given +-- expression. The inserted cost centre will be appropriately tracked in the +-- late cost centre state. +insertCC + :: FastString + -- ^ Name of the cost centre to insert + -> SrcSpan + -- ^ Source location to associate with the cost centre + -> CoreExpr + -- ^ Expression to wrap in the cost centre + -> LateCCM s CoreExpr +insertCC cc_name cc_loc expr = do + cc_flavour <- getCCFlavour cc_name + env <- ask + let + cc_mod = lateCCEnv_module env + cc = NormalCC cc_flavour cc_name cc_mod cc_loc + note = ProfNote cc (lateCCEnv_countEntries env) True + when (lateCCEnv_collectCCs env) $ do + lift . modify $ \s -> + s { lateCCState_ccs = S.insert cc (lateCCState_ccs s) + } + return $ mkTick note expr + ===================================== compiler/GHC/Core/Opt/Pipeline.hs ===================================== @@ -43,7 +43,7 @@ import GHC.Core.Opt.CallArity ( callArityAnalProgram ) import GHC.Core.Opt.Exitify ( exitifyProgram ) import GHC.Core.Opt.WorkWrap ( wwTopBinds ) import GHC.Core.Opt.CallerCC ( addCallerCostCentres ) -import GHC.Core.LateCC (addLateCostCentresMG) +import GHC.Core.LateCC.TopLevelBinds (topLevelBindsCCMG) import GHC.Core.Seq (seqBinds) import GHC.Core.FamInstEnv @@ -520,7 +520,7 @@ doCorePass pass guts = do addCallerCostCentres guts CoreAddLateCcs -> {-# SCC "AddLateCcs" #-} - addLateCostCentresMG guts + topLevelBindsCCMG guts CoreDoPrintCore -> {-# SCC "PrintCore" #-} liftIO $ printCore logger (mg_binds guts) >> return guts ===================================== compiler/GHC/Driver/Flags.hs ===================================== @@ -341,6 +341,8 @@ data GeneralFlag | Opt_ProfCountEntries | Opt_ProfLateInlineCcs | Opt_ProfLateCcs + | Opt_ProfLateOverloadedCcs + | Opt_ProfLateoverloadedCallsCCs | Opt_ProfManualCcs -- ^ Ignore manual SCC annotations -- misc opts ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -175,7 +175,6 @@ import GHC.Iface.Ext.Debug ( diffFile, validateScopes ) import GHC.Core import GHC.Core.Lint.Interactive ( interactiveInScope ) import GHC.Core.Tidy ( tidyExpr ) -import GHC.Core.Type ( Type, Kind ) import GHC.Core.Utils ( exprType ) import GHC.Core.ConLike import GHC.Core.Opt.Pipeline @@ -185,7 +184,8 @@ import GHC.Core.InstEnv import GHC.Core.FamInstEnv import GHC.Core.Rules import GHC.Core.Stats -import GHC.Core.LateCC (addLateCostCentresPgm) +import GHC.Core.LateCC +import GHC.Core.LateCC.Types import GHC.CoreToStg.Prep @@ -197,6 +197,7 @@ import GHC.Parser.Lexer as Lexer import GHC.Tc.Module import GHC.Tc.Utils.Monad +import GHC.Tc.Utils.TcType import GHC.Tc.Zonk.Env ( ZonkFlexi (DefaultFlexi) ) import GHC.Stg.Syntax @@ -297,7 +298,6 @@ import GHC.StgToCmm.Utils (IPEStats) import GHC.Types.Unique.FM import GHC.Types.Unique.DFM import GHC.Cmm.Config (CmmConfig) -import GHC.Types.CostCentre.State (newCostCentreState) {- ********************************************************************** @@ -1791,22 +1791,41 @@ hscGenHardCode hsc_env cgguts location output_filename = do ------------------- - -- Insert late cost centres if enabled. - -- If `-fprof-late-inline` is enabled we can skip this, as it will have added - -- a superset of cost centres we would add here already. - - (late_cc_binds, late_local_ccs, cc_state) <- - if gopt Opt_ProfLateCcs dflags && not (gopt Opt_ProfLateInlineCcs dflags) - then - withTiming - logger - (text "LateCCs"<+>brackets (ppr this_mod)) - (const ()) - $ {-# SCC lateCC #-} do - (binds, late_ccs, cc_state) <- addLateCostCentresPgm dflags logger this_mod core_binds - return ( binds, (S.toList late_ccs `mappend` local_ccs ), cc_state) + -- Insert late cost centres based on the provided flags. + -- + -- If -fprof-late-inline is enabled, we will skip adding CCs on any + -- top-level bindings here (via shortcut in `addLateCostCenters`), + -- since it will have already added a superset of the CCs we would add + -- here. + let + late_cc_config :: LateCCConfig + late_cc_config = + LateCCConfig + { lateCCConfig_whichBinds = + if gopt Opt_ProfLateInlineCcs dflags then + LateCCNone + else if gopt Opt_ProfLateCcs dflags then + LateCCAllBinds + else if gopt Opt_ProfLateOverloadedCcs dflags then + LateCCOverloadedBinds else - return (core_binds, local_ccs, newCostCentreState) + LateCCNone + , lateCCConfig_overloadedCalls = + gopt Opt_ProfLateoverloadedCallsCCs dflags + , lateCCConfig_env = + LateCCEnv + { lateCCEnv_module = this_mod + , lateCCEnv_file = fsLit <$> ml_hs_file location + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = True + } + } + + (late_cc_binds, late_cc_state) <- + addLateCostCenters logger late_cc_config core_binds + + when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ + putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr late_cc_binds)) ------------------- -- Run late plugins @@ -1820,7 +1839,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do cg_hpc_info = hpc_info, cg_spt_entries = spt_entries, cg_binds = late_binds, - cg_ccs = late_local_ccs' + cg_ccs = late_local_ccs } , _ ) <- @@ -1833,9 +1852,9 @@ hscGenHardCode hsc_env cgguts location output_filename = do (($ hsc_env) . latePlugin) ( cgguts { cg_binds = late_cc_binds - , cg_ccs = late_local_ccs + , cg_ccs = S.toList (lateCCState_ccs late_cc_state) ++ local_ccs } - , cc_state + , lateCCState_ccState late_cc_state ) let @@ -1876,7 +1895,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do let (stg_binds,_stg_deps) = unzip stg_binds_with_deps let cost_centre_info = - (late_local_ccs' ++ caf_ccs, caf_cc_stacks) + (late_local_ccs ++ caf_ccs, caf_cc_stacks) platform = targetPlatform dflags prof_init | sccProfilingEnabled dflags = profilingInitCode platform this_mod cost_centre_info ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -2444,6 +2444,8 @@ fFlagsDeps = [ flagSpec "prof-cafs" Opt_AutoSccsOnIndividualCafs, flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "prof-late" Opt_ProfLateCcs, + flagSpec "prof-late-overloaded" Opt_ProfLateOverloadedCcs, + flagSpec "prof-late-overloaded-calls" Opt_ProfLateoverloadedCallsCCs, flagSpec "prof-manual" Opt_ProfManualCcs, flagSpec "prof-late-inline" Opt_ProfLateInlineCcs, flagSpec "regs-graph" Opt_RegsGraph, @@ -3763,6 +3765,10 @@ needSourceNotes :: DynFlags -> Bool needSourceNotes dflags = debugLevel dflags > 0 || gopt Opt_InfoTableMap dflags + -- Source ticks are used to approximate the location of + -- overloaded call cost centers + || gopt Opt_ProfLateoverloadedCallsCCs dflags + -- ----------------------------------------------------------------------------- -- Linker/compiler information ===================================== compiler/GHC/Tc/Utils/TcType.hs ===================================== @@ -1907,7 +1907,7 @@ isRhoExpTy (Infer {}) = True isOverloadedTy :: Type -> Bool -- Yes for a type of a function that might require evidence-passing --- Used only by bindLocalMethods +-- Used by bindLocalMethods and for -fprof-late-overloaded isOverloadedTy ty | Just ty' <- coreView ty = isOverloadedTy ty' isOverloadedTy (ForAllTy _ ty) = isOverloadedTy ty isOverloadedTy (FunTy { ft_af = af }) = isInvisibleFunArg af ===================================== compiler/ghc.cabal.in ===================================== @@ -336,6 +336,10 @@ Library GHC.Core.Lint GHC.Core.Lint.Interactive GHC.Core.LateCC + GHC.Core.LateCC.Types + GHC.Core.LateCC.TopLevelBinds + GHC.Core.LateCC.Utils + GHC.Core.LateCC.OverloadedCalls GHC.Core.Make GHC.Core.Map.Expr GHC.Core.Map.Type ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -186,6 +186,15 @@ Compiler This means that if you are using ``-fllvm`` you now need ``llc``, ``opt`` and ``clang`` available. +- The :ghc-flag:`-fprof-late-overloaded` flag has been introduced. It causes + cost centres to be added to *overloaded* top level bindings, unlike + :ghc-flag:`-fprof-late` which adds cost centres to all top level bindings. + +- The :ghc-flag:`-fprof-late-overloaded-calls` flag has been introduced. It + causes cost centres to be inserted at call sites including instance dictionary + arguments. This may be preferred over :ghc-flag:`-fprof-late-overloaded` since + it may reveal whether imported functions are called overloaded. + JavaScript backend ~~~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/profiling.rst ===================================== @@ -518,6 +518,49 @@ of your profiled program will be different to that of the unprofiled one. You can try this mode if :ghc-flag:`-fprof-late` results in a profile that's too hard to interpret. +.. ghc-flag:: -fprof-late-overloaded + :shortdesc: Auto-add ``SCC``\\ s to all top level overloaded bindings *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all *overloaded* top level bindings + late in the compilation pipeline after the optimizer has run and unfoldings + have been created. This means these cost centres will not interfere with + core-level optimizations and the resulting profile will be closer to the + performance profile of an optimized non-profiled executable. + + This flag can help determine which top level bindings encountered during a + program's execution are still overloaded after inlining and specialization. + +.. ghc-flag:: -fprof-late-overloaded-calls + :shortdesc: Auto-add ``SCC``\\ s to all call sites that include dictionary arguments *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded-calls + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all call sites that include + dictionary arguments late in the compilation pipeline after the optimizer + has run and unfoldings have been created. This means these cost centres will + not interfere with core-level optimizations and the resulting profile will + be closer to the performance profile of an optimized non-profiled + executable. + + This flag is potentially more useful than :ghc-flag:`-fprof-late-overloaded` + since it will also add ``SCC`` annotations to call sites of imported + overloaded functions. + + Some overloaded calls may not be annotated, specifically in cases where the + optimizer turns an overloaded function into a join point. Calls to such + functions will not be wrapped in ``SCC`` annotations, since it would make + them non-tail calls, which is a requirement for join points. Instead, + ``SCC`` annotations are added around the body of overloaded join variables + and given distinct names (``join-rhs-``) to avoid confusion. + .. ghc-flag:: -fprof-cafs :shortdesc: Auto-add ``SCC``\\ s to all CAFs :type: dynamic ===================================== testsuite/tests/profiling/should_run/all.T ===================================== @@ -195,3 +195,30 @@ test('ignore_scc', [], compile_and_run, ['-fno-prof-manual']) test('T21446', [], makefile_test, ['T21446']) + + +test('scc-prof-overloaded001', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded002', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls001', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fno-full-laziness -fprof-late-overloaded-calls'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls002', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fprof-late-overloaded-calls'] +) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample ===================================== @@ -0,0 +1,26 @@ + Thu Jan 4 11:49 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,320 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded-calls001.hs:24:1-31 256 1 0.0 0.3 0.0 0.8 + f Main scc-prof-overloaded-calls001.hs:18:1-18 257 1 0.0 0.6 0.0 0.6 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample ===================================== @@ -0,0 +1,31 @@ + Fri Jan 5 11:06 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls002 +RTS -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 59,152 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 34.8 +CAF GHC.IO.Handle.FD 0.0 58.7 +CAF GHC.IO.Encoding 0.0 4.1 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 34.8 0.0 100.0 + CAF Main 255 0 0.0 0.6 0.0 0.9 + f Main scc-prof-overloaded-calls002.hs:52:1-25 262 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:48:1-25 261 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:44:1-25 260 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:40:1-25 259 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:36:1-25 258 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:32:1-25 257 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:28:1-25 256 1 0.0 0.0 0.0 0.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.1 0.0 4.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.3 0.0 0.3 + CAF GHC.IO.Handle.FD 208 0 0.0 58.7 0.0 58.7 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample ===================================== @@ -0,0 +1,25 @@ + Thu Jan 4 11:26 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,304 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded001.hs:18:1-6 256 1 0.0 0.8 0.0 0.8 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample ===================================== @@ -0,0 +1,23 @@ + Thu Jan 4 11:55 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded002 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 56,472 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 32.7 +CAF GHC.IO.Handle.FD 0.0 61.5 +CAF GHC.IO.Encoding 0.0 4.3 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 32.7 0.0 100.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.3 0.0 4.3 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 61.5 0.0 61.5 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c3dac715b6b689772c739da695933148a2018896 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c3dac715b6b689772c739da695933148a2018896 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 16:59:32 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 11:59:32 -0500 Subject: [Git][ghc/ghc][wip/cross-stage2-rebased] Fix genapply Message-ID: <65e5fdf480050_a5db0a44490493723@gitlab.mail> Matthew Pickering pushed to branch wip/cross-stage2-rebased at Glasgow Haskell Compiler / GHC Commits: 8d15c356 by Matthew Pickering at 2024-03-04T16:59:24+00:00 Fix genapply - - - - - 1 changed file: - hadrian/src/Settings/Default.hs Changes: ===================================== hadrian/src/Settings/Default.hs ===================================== @@ -73,6 +73,7 @@ stageBootPackages = return , deriveConstants , genprimopcode , unlit + , genapply ] -- | Packages built in 'Stage0' by default. You can change this in "UserSettings". @@ -112,7 +113,6 @@ stage0Packages = do , transformers , unlit , hp2ps - , genapply , if windowsHost then win32 else unix ] ++ [ terminfo | not windowsHost, not cross ] @@ -132,7 +132,6 @@ stage1Packages = do libraries0 <- filter good_stage0_package <$> stage0Packages cross <- flag CrossCompiling winTarget <- isWinTarget Stage1 - jsTarget <- isJsTarget Stage2 let when c xs = if c then xs else mempty @@ -164,8 +163,6 @@ stage1Packages = do , hpcBin , if winTarget then win32 else unix ] ++ - [ genapply | not jsTarget ] - ++ [ iserv , runGhc , ghcToolchainBin View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8d15c356d39773c1257dfc89dfb4e72ba4f4ce29 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8d15c356d39773c1257dfc89dfb4e72ba4f4ce29 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 17:02:53 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Mon, 04 Mar 2024 12:02:53 -0500 Subject: [Git][ghc/ghc][wip/fprof-overloaded] add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e5febdbb745_a5db0a70eea095710@gitlab.mail> Finley McIlwaine pushed to branch wip/fprof-overloaded at Glasgow Haskell Compiler / GHC Commits: 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 26 changed files: - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout Changes: ===================================== compiler/GHC/Core/LateCC.hs ===================================== @@ -1,164 +1,90 @@ -{-# LANGUAGE DerivingStrategies #-} -{-# LANGUAGE TupleSections #-} +{-# LANGUAGE RecordWildCards #-} --- | Adds cost-centers after the core piple has run. +-- | Adds cost-centers after the core pipline has run. module GHC.Core.LateCC - ( addLateCostCentresMG - , addLateCostCentresPgm - , addLateCostCentres -- Might be useful for API users - , Env(..) + ( -- * Inserting cost centres + addLateCostCenters ) where -import Control.Applicative -import Control.Monad -import qualified Data.Set as S - import GHC.Prelude -import GHC.Types.CostCentre -import GHC.Types.CostCentre.State -import GHC.Types.Name hiding (varName) -import GHC.Types.Tickish -import GHC.Unit.Module.ModGuts -import GHC.Types.Var -import GHC.Unit.Types -import GHC.Data.FastString -import GHC.Core -import GHC.Core.Opt.Monad -import GHC.Core.Utils (mkTick) -import GHC.Types.Id -import GHC.Driver.DynFlags +import GHC.Core +import GHC.Core.LateCC.OverloadedCalls +import GHC.Core.LateCC.TopLevelBinds +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Seq +import qualified GHC.Data.Strict as Strict +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.SrcLoc +import GHC.Utils.Error import GHC.Utils.Logger import GHC.Utils.Outputable -import GHC.Utils.Misc -import GHC.Utils.Error (withTiming) -import GHC.Utils.Monad.State.Strict - - -{- Note [Collecting late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Usually cost centres defined by a module are collected -during tidy by collectCostCentres. However with `-fprof-late` -we insert cost centres after inlining. So we keep a list of -all the cost centres we inserted and combine that with the list -of cost centres found during tidy. - -To avoid overhead when using -fprof-inline there is a flag to stop -us from collecting them here when we run this pass before tidy. - -Note [Adding late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The basic idea is very simple. For every top level binder -`f = rhs` we compile it as if the user had written -`f = {-# SCC f #-} rhs`. - -If we do this after unfoldings for `f` have been created this -doesn't impact core-level optimizations at all. If we do it -before the cost centre will be included in the unfolding and -might inhibit optimizations at the call site. For this reason -we provide flags for both approaches as they have different -tradeoffs. - -We also don't add a cost centre for any binder that is a constructor -worker or wrapper. These will never meaningfully enrich the resulting -profile so we improve efficiency by omitting those. - --} - -addLateCostCentresMG :: ModGuts -> CoreM ModGuts -addLateCostCentresMG guts = do - dflags <- getDynFlags - let env :: Env - env = Env - { thisModule = mg_module guts - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = False -- See Note [Collecting late cost centres] - } - let guts' = guts { mg_binds = fstOf3 (addLateCostCentres env (mg_binds guts)) - } - return guts' - -addLateCostCentresPgm :: DynFlags -> Logger -> Module -> CoreProgram -> IO (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentresPgm dflags logger mod binds = - withTiming logger - (text "LateCC"<+>brackets (ppr mod)) - (\(a,b,c) -> a `seqList` (b `seq` (c `seq` ()))) $ do - let env = Env - { thisModule = mod - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = True -- See Note [Collecting late cost centres] - } - (binds', ccs, cc_state) = addLateCostCentres env binds - when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ - putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr binds')) - return (binds', ccs, cc_state) -addLateCostCentres :: Env -> CoreProgram -> (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentres env binds = - let (binds', state) = runState (mapM (doBind env) binds) initLateCCState - in (binds', lcs_ccs state, lcs_state state) - - -doBind :: Env -> CoreBind -> M CoreBind -doBind env (NonRec b rhs) = NonRec b <$> doBndr env b rhs -doBind env (Rec bs) = Rec <$> mapM doPair bs +-- | Late cost center insertion logic used by the driver +addLateCostCenters :: + Logger + -- ^ Logger + -> LateCCConfig + -- ^ Late cost center configuration + -> CoreProgram + -- ^ The program + -> IO (CoreProgram, LateCCState (Strict.Maybe SrcSpan)) +addLateCostCenters logger LateCCConfig{..} core_binds = do + + -- If top-level late CCs are enabled via either -fprof-late or + -- -fprof-late-overloaded, add them + (top_level_cc_binds, top_level_late_cc_state) <- + case lateCCConfig_whichBinds of + LateCCNone -> + return (core_binds, initLateCCState ()) + _ -> + withTiming + logger + (text "LateTopLevelCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateTopLevelCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (initLateCCState ()) + (topLevelBindsCC top_level_cc_pred) + core_binds + + -- If overloaded call CCs are enabled via -fprof-late-overloaded-calls, add + -- them + (late_cc_binds, late_cc_state) <- + if lateCCConfig_overloadedCalls then + withTiming + logger + (text "LateOverloadedCallsCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateoverloadedCallsCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (top_level_late_cc_state { lateCCState_extra = Strict.Nothing }) + overloadedCallsCC + top_level_cc_binds + else + return + ( top_level_cc_binds + , top_level_late_cc_state { lateCCState_extra = Strict.Nothing } + ) + + return (late_cc_binds, late_cc_state) where - doPair :: ((Id, CoreExpr) -> M (Id, CoreExpr)) - doPair (b,rhs) = (b,) <$> doBndr env b rhs - -doBndr :: Env -> Id -> CoreExpr -> M CoreExpr -doBndr env bndr rhs - -- Cost centres on constructor workers are pretty much useless - -- so we don't emit them if we are looking at the rhs of a constructor - -- binding. - | Just _ <- isDataConId_maybe bndr = pure rhs - | otherwise = doBndr' env bndr rhs - - --- We want to put the cost centre below the lambda as we only care about executions of the RHS. -doBndr' :: Env -> Id -> CoreExpr -> State LateCCState CoreExpr -doBndr' env bndr (Lam b rhs) = Lam b <$> doBndr' env bndr rhs -doBndr' env bndr rhs = do - let name = idName bndr - name_loc = nameSrcSpan name - cc_name = getOccFS name - count = countEntries env - cc_flavour <- getCCFlavour cc_name - let cc_mod = thisModule env - bndrCC = NormalCC cc_flavour cc_name cc_mod name_loc - note = ProfNote bndrCC count True - addCC env bndrCC - return $ mkTick note rhs - -data LateCCState = LateCCState - { lcs_state :: !CostCentreState - , lcs_ccs :: S.Set CostCentre - } -type M = State LateCCState - -initLateCCState :: LateCCState -initLateCCState = LateCCState newCostCentreState mempty - -getCCFlavour :: FastString -> M CCFlavour -getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name - -getCCIndex' :: FastString -> M CostCentreIndex -getCCIndex' name = do - state <- get - let (index,cc_state') = getCCIndex name (lcs_state state) - put (state { lcs_state = cc_state'}) - return index - -addCC :: Env -> CostCentre -> M () -addCC !env cc = do - state <- get - when (collectCCs env) $ do - let ccs' = S.insert cc (lcs_ccs state) - put (state { lcs_ccs = ccs'}) - -data Env = Env - { thisModule :: !Module - , countEntries:: !Bool - , collectCCs :: !Bool - } - + top_level_cc_pred :: CoreExpr -> Bool + top_level_cc_pred = + case lateCCConfig_whichBinds of + LateCCAllBinds -> + const True + LateCCOverloadedBinds -> + isOverloadedTy . exprType + LateCCNone -> + -- This is here for completeness, we won't actually use this + -- predicate in this case since we'll shortcut. + const False + + this_mod = lateCCEnv_module lateCCConfig_env ===================================== compiler/GHC/Core/LateCC/OverloadedCalls.hs ===================================== @@ -0,0 +1,204 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TupleSections #-} + +module GHC.Core.LateCC.OverloadedCalls + ( overloadedCallsCC + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified GHC.Data.Strict as Strict + +import GHC.Data.FastString +import GHC.Core +import GHC.Core.LateCC.Utils +import GHC.Core.LateCC.Types +import GHC.Core.Make +import GHC.Core.Predicate +import GHC.Core.Type +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.Id +import GHC.Types.Name +import GHC.Types.SrcLoc +import GHC.Types.Tickish +import GHC.Types.Var +import GHC.Utils.Outputable + +type OverloadedCallsCCState = Strict.Maybe SrcSpan + +-- | Insert cost centres on function applications with dictionary arguments. The +-- source locations attached to the cost centres is approximated based on the +-- "closest" source note encountered in the traversal. +overloadedCallsCC :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind +overloadedCallsCC = + processBind + where + processBind :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind + processBind core_bind = + case core_bind of + NonRec b e -> + NonRec b <$> wrap_if_join b (processExpr e) + Rec es -> + Rec <$> mapM (\(b,e) -> (b,) <$> wrap_if_join b (processExpr e)) es + where + -- If an overloaded function is turned into a join point, we won't add + -- SCCs directly to calls since it makes them non-tail calls. Instead, + -- we look for join points here and add an SCC to their RHS if they are + -- overloaded. + wrap_if_join :: + CoreBndr + -> LateCCM OverloadedCallsCCState CoreExpr + -> LateCCM OverloadedCallsCCState CoreExpr + wrap_if_join b pexpr = do + expr <- pexpr + if isJoinId b && isOverloadedTy (exprType expr) then do + let + cc_name :: FastString + cc_name = fsLit "join-rhs-" `appendFS` getOccFS b + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan expr + else + return expr + + + processExpr :: CoreExpr -> LateCCM OverloadedCallsCCState CoreExpr + processExpr expr = + case expr of + -- The case we care about: Application + app at App{} -> do + -- Here we have some application like `f v1 ... vN`, where v1 ... vN + -- should be the function's type arguments followed by the value + -- arguments. To determine if the `f` is an overloaded function, we + -- check if any of the arguments v1 ... vN are dictionaries. + let + (f, xs) = collectArgs app + resultTy = applyTypeToArgs empty (exprType f) xs + + -- Recursively process the arguments first for no particular reason + args <- mapM processExpr xs + let app' = mkCoreApps f args + + if + -- Check if any of the arguments are dictionaries + any isDictExpr args + + -- Avoid instrumenting dictionary functions, which may be + -- overloaded if there are superclasses, by checking if the result + -- type of the function is a dictionary type. + && not (isDictTy resultTy) + + -- Avoid instrumenting constraint selectors like eq_sel + && (typeTypeOrConstraint resultTy /= ConstraintLike) + + -- Avoid instrumenting join points. + -- (See comment in processBind above) + && not (isJoinVarExpr f) + then do + -- Extract a name and source location from the function being + -- applied + let + cc_name :: FastString + cc_name = + fsLit $ maybe "" getOccString (exprName app) + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan app' + else + return app' + + -- For recursive constructors of Expr, we traverse the nested Exprs + Lam b e -> + mkCoreLams [b] <$> processExpr e + Let b e -> + mkCoreLet <$> processBind b <*> processExpr e + Case e b t alts -> + Case + <$> processExpr e + <*> pure b + <*> pure t + <*> mapM processAlt alts + Cast e co -> + mkCast <$> processExpr e <*> pure co + Tick t e -> do + trackSourceNote t $ + mkTick t <$> processExpr e + + -- For non-recursive constructors of Expr, we do nothing + x -> return x + + processAlt :: CoreAlt -> LateCCM OverloadedCallsCCState CoreAlt + processAlt (Alt c bs e) = Alt c bs <$> processExpr e + + trackSourceNote :: CoreTickish -> LateCCM OverloadedCallsCCState a -> LateCCM OverloadedCallsCCState a + trackSourceNote tick act = + case tick of + SourceNote rss _ -> do + -- Prefer source notes from the current file + in_current_file <- + maybe False ((== EQ) . lexicalCompareFS (srcSpanFile rss)) <$> + asks lateCCEnv_file + if not in_current_file then + act + else do + loc <- lift $ gets lateCCState_extra + lift . modify $ \s -> + s { lateCCState_extra = + Strict.Just $ RealSrcSpan rss mempty + } + x <- act + lift . modify $ \s -> + s { lateCCState_extra = loc + } + return x + _ -> + act + + -- Utility functions + + -- Extract a Name from an expression. If it is an application, attempt to + -- extract a name from the applied function. If it is a variable, return the + -- Name of the variable. If it is a tick/cast, attempt to extract a Name + -- from the expression held in the tick/cast. Otherwise return Nothing. + exprName :: CoreExpr -> Maybe Name + exprName = + \case + App f _ -> + exprName f + Var f -> + Just (idName f) + Tick _ e -> + exprName e + Cast e _ -> + exprName e + _ -> + Nothing + + -- Determine whether an expression is a dictionary + isDictExpr :: CoreExpr -> Bool + isDictExpr = + maybe False isDictTy . exprType' + where + exprType' :: CoreExpr -> Maybe Type + exprType' = \case + Type{} -> Nothing + expr -> Just $ exprType expr + + -- Determine whether an expression is a join variable + isJoinVarExpr :: CoreExpr -> Bool + isJoinVarExpr = + \case + Var var -> isJoinId var + Tick _ e -> isJoinVarExpr e + Cast e _ -> isJoinVarExpr e + _ -> False ===================================== compiler/GHC/Core/LateCC/TopLevelBinds.hs ===================================== @@ -0,0 +1,106 @@ +{-# LANGUAGE TupleSections #-} +module GHC.Core.LateCC.TopLevelBinds where + +import GHC.Prelude + +import GHC.Core +-- import GHC.Core.LateCC +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Opt.Monad +import GHC.Driver.DynFlags +import GHC.Types.Id +import GHC.Types.Name +import GHC.Unit.Module.ModGuts + +{- Note [Collecting late cost centres] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Usually cost centres defined by a module are collected +during tidy by collectCostCentres. However with `-fprof-late` +we insert cost centres after inlining. So we keep a list of +all the cost centres we inserted and combine that with the list +of cost centres found during tidy. + +To avoid overhead when using -fprof-inline there is a flag to stop +us from collecting them here when we run this pass before tidy. + +Note [Adding late cost centres to top level bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The basic idea is very simple. For every top level binder +`f = rhs` we compile it as if the user had written +`f = {-# SCC f #-} rhs`. + +If we do this after unfoldings for `f` have been created this +doesn't impact core-level optimizations at all. If we do it +before the cost centre will be included in the unfolding and +might inhibit optimizations at the call site. For this reason +we provide flags for both approaches as they have different +tradeoffs. + +We also don't add a cost centre for any binder that is a constructor +worker or wrapper. These will never meaningfully enrich the resulting +profile so we improve efficiency by omitting those. + +-} + +-- | Add late cost centres directly to the 'ModGuts'. This is used inside the +-- core pipeline with the -fprof-late-inline flag. It should not be used after +-- tidy, since it does not manually track inserted cost centers. See +-- Note [Collecting late cost centres]. +topLevelBindsCCMG :: ModGuts -> CoreM ModGuts +topLevelBindsCCMG guts = do + dflags <- getDynFlags + let + env = + LateCCEnv + { lateCCEnv_module = mg_module guts + + -- We don't use this for topLevelBindsCC, so Nothing is okay + , lateCCEnv_file = Nothing + + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = False + } + guts' = + guts + { mg_binds = + fst + ( doLateCostCenters + env + (initLateCCState ()) + (topLevelBindsCC (const True)) + (mg_binds guts) + ) + } + return guts' + +-- | Insert cost centres on top-level bindings in the module, depending on +-- whether or not they satisfy the given predicate. +topLevelBindsCC :: (CoreExpr -> Bool) -> CoreBind -> LateCCM s CoreBind +topLevelBindsCC pred core_bind = + case core_bind of + NonRec b rhs -> + NonRec b <$> doBndr b rhs + Rec bs -> + Rec <$> mapM doPair bs + where + doPair :: ((Id, CoreExpr) -> LateCCM s (Id, CoreExpr)) + doPair (b,rhs) = (b,) <$> doBndr b rhs + + doBndr :: Id -> CoreExpr -> LateCCM s CoreExpr + doBndr bndr rhs + -- Cost centres on constructor workers are pretty much useless + -- so we don't emit them if we are looking at the rhs of a constructor + -- binding. + | Just _ <- isDataConId_maybe bndr = pure rhs + | otherwise = if pred rhs then addCC bndr rhs else pure rhs + + -- We want to put the cost centre below the lambda as we only care about + -- executions of the RHS. + addCC :: Id -> CoreExpr -> LateCCM s CoreExpr + addCC bndr (Lam b rhs) = Lam b <$> addCC bndr rhs + addCC bndr rhs = do + let name = idName bndr + cc_loc = nameSrcSpan name + cc_name = getOccFS name + insertCC cc_name cc_loc rhs \ No newline at end of file ===================================== compiler/GHC/Core/LateCC/Types.hs ===================================== @@ -0,0 +1,74 @@ +-- | Types related to late cost center insertion +module GHC.Core.LateCC.Types + ( LateCCConfig(..) + , LateCCBindSpec(..) + , LateCCEnv(..) + , LateCCState(..) + , initLateCCState + , LateCCM + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Unit.Types + +-- | Late cost center insertion configuration. +-- +-- Specifies whether cost centers are added to overloaded function call sites +-- and/or top-level bindings, and which top-level bindings they are added to. +-- Also holds the cost center insertion environment. +data LateCCConfig = + LateCCConfig + { lateCCConfig_whichBinds :: !LateCCBindSpec + , lateCCConfig_overloadedCalls :: !Bool + , lateCCConfig_env :: !LateCCEnv + } + +-- | The types of top-level bindings we support adding cost centers to. +data LateCCBindSpec = + LateCCNone + | LateCCAllBinds + | LateCCOverloadedBinds + +-- | Late cost centre insertion environment +data LateCCEnv = LateCCEnv + { lateCCEnv_module :: !Module + -- ^ Current module + , lateCCEnv_file :: Maybe FastString + -- ^ Current file, if we have one + , lateCCEnv_countEntries:: !Bool + -- ^ Whether the inserted cost centers should count entries + , lateCCEnv_collectCCs :: !Bool + -- ^ Whether to collect the cost centres we insert. See + -- Note [Collecting late cost centres] + + } + +-- | Late cost centre insertion state, indexed by some extra state type that an +-- insertion method may require. +data LateCCState s = LateCCState + { lateCCState_ccs :: !(S.Set CostCentre) + -- ^ Cost centres that have been inserted + , lateCCState_ccState :: !CostCentreState + -- ^ Per-module state tracking for cost centre indices + , lateCCState_extra :: !s + } + +-- | The empty late cost centre insertion state +initLateCCState :: s -> LateCCState s +initLateCCState s = + LateCCState + { lateCCState_ccState = newCostCentreState + , lateCCState_ccs = mempty + , lateCCState_extra = s + } + +-- | Late cost centre insertion monad +type LateCCM s = ReaderT LateCCEnv (State (LateCCState s)) ===================================== compiler/GHC/Core/LateCC/Utils.hs ===================================== @@ -0,0 +1,80 @@ +module GHC.Core.LateCC.Utils + ( -- * Inserting cost centres + doLateCostCenters -- Might be useful for API users + + -- ** Helpers for defining insertion methods + , getCCFlavour + , insertCC + ) where + +import GHC.Prelude + +import Control.Monad +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Core +import GHC.Core.LateCC.Types +import GHC.Core.Utils +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Types.SrcLoc +import GHC.Types.Tickish + +-- | Insert cost centres into the 'CoreProgram' using the provided environment, +-- initial state, and insertion method. +doLateCostCenters + :: LateCCEnv + -- ^ Environment to run the insertion in + -> LateCCState s + -- ^ Initial state to run the insertion with + -> (CoreBind -> LateCCM s CoreBind) + -- ^ Insertion method + -> CoreProgram + -- ^ Bindings to consider + -> (CoreProgram, LateCCState s) +doLateCostCenters env state method binds = + runLateCC env state $ mapM method binds + +-- | Evaluate late cost centre insertion +runLateCC :: LateCCEnv -> LateCCState s -> LateCCM s a -> (a, LateCCState s) +runLateCC env state = (`runState` state) . (`runReaderT` env) + +-- | Given the name of a cost centre, get its flavour +getCCFlavour :: FastString -> LateCCM s CCFlavour +getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name + where + getCCIndex' :: FastString -> LateCCM s CostCentreIndex + getCCIndex' name = do + cc_state <- lift $ gets lateCCState_ccState + let (index, cc_state') = getCCIndex name cc_state + lift . modify $ \s -> s { lateCCState_ccState = cc_state'} + return index + +-- | Insert a cost centre with the specified name and source span on the given +-- expression. The inserted cost centre will be appropriately tracked in the +-- late cost centre state. +insertCC + :: FastString + -- ^ Name of the cost centre to insert + -> SrcSpan + -- ^ Source location to associate with the cost centre + -> CoreExpr + -- ^ Expression to wrap in the cost centre + -> LateCCM s CoreExpr +insertCC cc_name cc_loc expr = do + cc_flavour <- getCCFlavour cc_name + env <- ask + let + cc_mod = lateCCEnv_module env + cc = NormalCC cc_flavour cc_name cc_mod cc_loc + note = ProfNote cc (lateCCEnv_countEntries env) True + when (lateCCEnv_collectCCs env) $ do + lift . modify $ \s -> + s { lateCCState_ccs = S.insert cc (lateCCState_ccs s) + } + return $ mkTick note expr + ===================================== compiler/GHC/Core/Opt/Pipeline.hs ===================================== @@ -43,7 +43,7 @@ import GHC.Core.Opt.CallArity ( callArityAnalProgram ) import GHC.Core.Opt.Exitify ( exitifyProgram ) import GHC.Core.Opt.WorkWrap ( wwTopBinds ) import GHC.Core.Opt.CallerCC ( addCallerCostCentres ) -import GHC.Core.LateCC (addLateCostCentresMG) +import GHC.Core.LateCC.TopLevelBinds (topLevelBindsCCMG) import GHC.Core.Seq (seqBinds) import GHC.Core.FamInstEnv @@ -520,7 +520,7 @@ doCorePass pass guts = do addCallerCostCentres guts CoreAddLateCcs -> {-# SCC "AddLateCcs" #-} - addLateCostCentresMG guts + topLevelBindsCCMG guts CoreDoPrintCore -> {-# SCC "PrintCore" #-} liftIO $ printCore logger (mg_binds guts) >> return guts ===================================== compiler/GHC/Driver/Flags.hs ===================================== @@ -341,6 +341,8 @@ data GeneralFlag | Opt_ProfCountEntries | Opt_ProfLateInlineCcs | Opt_ProfLateCcs + | Opt_ProfLateOverloadedCcs + | Opt_ProfLateoverloadedCallsCCs | Opt_ProfManualCcs -- ^ Ignore manual SCC annotations -- misc opts ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -175,7 +175,6 @@ import GHC.Iface.Ext.Debug ( diffFile, validateScopes ) import GHC.Core import GHC.Core.Lint.Interactive ( interactiveInScope ) import GHC.Core.Tidy ( tidyExpr ) -import GHC.Core.Type ( Type, Kind ) import GHC.Core.Utils ( exprType ) import GHC.Core.ConLike import GHC.Core.Opt.Pipeline @@ -185,7 +184,8 @@ import GHC.Core.InstEnv import GHC.Core.FamInstEnv import GHC.Core.Rules import GHC.Core.Stats -import GHC.Core.LateCC (addLateCostCentresPgm) +import GHC.Core.LateCC +import GHC.Core.LateCC.Types import GHC.CoreToStg.Prep @@ -197,6 +197,7 @@ import GHC.Parser.Lexer as Lexer import GHC.Tc.Module import GHC.Tc.Utils.Monad +import GHC.Tc.Utils.TcType import GHC.Tc.Zonk.Env ( ZonkFlexi (DefaultFlexi) ) import GHC.Stg.Syntax @@ -297,7 +298,6 @@ import GHC.StgToCmm.Utils (IPEStats) import GHC.Types.Unique.FM import GHC.Types.Unique.DFM import GHC.Cmm.Config (CmmConfig) -import GHC.Types.CostCentre.State (newCostCentreState) {- ********************************************************************** @@ -1791,22 +1791,41 @@ hscGenHardCode hsc_env cgguts location output_filename = do ------------------- - -- Insert late cost centres if enabled. - -- If `-fprof-late-inline` is enabled we can skip this, as it will have added - -- a superset of cost centres we would add here already. - - (late_cc_binds, late_local_ccs, cc_state) <- - if gopt Opt_ProfLateCcs dflags && not (gopt Opt_ProfLateInlineCcs dflags) - then - withTiming - logger - (text "LateCCs"<+>brackets (ppr this_mod)) - (const ()) - $ {-# SCC lateCC #-} do - (binds, late_ccs, cc_state) <- addLateCostCentresPgm dflags logger this_mod core_binds - return ( binds, (S.toList late_ccs `mappend` local_ccs ), cc_state) + -- Insert late cost centres based on the provided flags. + -- + -- If -fprof-late-inline is enabled, we will skip adding CCs on any + -- top-level bindings here (via shortcut in `addLateCostCenters`), + -- since it will have already added a superset of the CCs we would add + -- here. + let + late_cc_config :: LateCCConfig + late_cc_config = + LateCCConfig + { lateCCConfig_whichBinds = + if gopt Opt_ProfLateInlineCcs dflags then + LateCCNone + else if gopt Opt_ProfLateCcs dflags then + LateCCAllBinds + else if gopt Opt_ProfLateOverloadedCcs dflags then + LateCCOverloadedBinds else - return (core_binds, local_ccs, newCostCentreState) + LateCCNone + , lateCCConfig_overloadedCalls = + gopt Opt_ProfLateoverloadedCallsCCs dflags + , lateCCConfig_env = + LateCCEnv + { lateCCEnv_module = this_mod + , lateCCEnv_file = fsLit <$> ml_hs_file location + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = True + } + } + + (late_cc_binds, late_cc_state) <- + addLateCostCenters logger late_cc_config core_binds + + when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ + putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr late_cc_binds)) ------------------- -- Run late plugins @@ -1820,7 +1839,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do cg_hpc_info = hpc_info, cg_spt_entries = spt_entries, cg_binds = late_binds, - cg_ccs = late_local_ccs' + cg_ccs = late_local_ccs } , _ ) <- @@ -1833,9 +1852,9 @@ hscGenHardCode hsc_env cgguts location output_filename = do (($ hsc_env) . latePlugin) ( cgguts { cg_binds = late_cc_binds - , cg_ccs = late_local_ccs + , cg_ccs = S.toList (lateCCState_ccs late_cc_state) ++ local_ccs } - , cc_state + , lateCCState_ccState late_cc_state ) let @@ -1876,7 +1895,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do let (stg_binds,_stg_deps) = unzip stg_binds_with_deps let cost_centre_info = - (late_local_ccs' ++ caf_ccs, caf_cc_stacks) + (late_local_ccs ++ caf_ccs, caf_cc_stacks) platform = targetPlatform dflags prof_init | sccProfilingEnabled dflags = profilingInitCode platform this_mod cost_centre_info ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -2444,6 +2444,8 @@ fFlagsDeps = [ flagSpec "prof-cafs" Opt_AutoSccsOnIndividualCafs, flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "prof-late" Opt_ProfLateCcs, + flagSpec "prof-late-overloaded" Opt_ProfLateOverloadedCcs, + flagSpec "prof-late-overloaded-calls" Opt_ProfLateoverloadedCallsCCs, flagSpec "prof-manual" Opt_ProfManualCcs, flagSpec "prof-late-inline" Opt_ProfLateInlineCcs, flagSpec "regs-graph" Opt_RegsGraph, @@ -3763,6 +3765,10 @@ needSourceNotes :: DynFlags -> Bool needSourceNotes dflags = debugLevel dflags > 0 || gopt Opt_InfoTableMap dflags + -- Source ticks are used to approximate the location of + -- overloaded call cost centers + || gopt Opt_ProfLateoverloadedCallsCCs dflags + -- ----------------------------------------------------------------------------- -- Linker/compiler information ===================================== compiler/GHC/Tc/Utils/TcType.hs ===================================== @@ -1907,7 +1907,7 @@ isRhoExpTy (Infer {}) = True isOverloadedTy :: Type -> Bool -- Yes for a type of a function that might require evidence-passing --- Used only by bindLocalMethods +-- Used by bindLocalMethods and for -fprof-late-overloaded isOverloadedTy ty | Just ty' <- coreView ty = isOverloadedTy ty' isOverloadedTy (ForAllTy _ ty) = isOverloadedTy ty isOverloadedTy (FunTy { ft_af = af }) = isInvisibleFunArg af ===================================== compiler/ghc.cabal.in ===================================== @@ -336,6 +336,10 @@ Library GHC.Core.Lint GHC.Core.Lint.Interactive GHC.Core.LateCC + GHC.Core.LateCC.Types + GHC.Core.LateCC.TopLevelBinds + GHC.Core.LateCC.Utils + GHC.Core.LateCC.OverloadedCalls GHC.Core.Make GHC.Core.Map.Expr GHC.Core.Map.Type ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -186,6 +186,15 @@ Compiler This means that if you are using ``-fllvm`` you now need ``llc``, ``opt`` and ``clang`` available. +- The :ghc-flag:`-fprof-late-overloaded` flag has been introduced. It causes + cost centres to be added to *overloaded* top level bindings, unlike + :ghc-flag:`-fprof-late` which adds cost centres to all top level bindings. + +- The :ghc-flag:`-fprof-late-overloaded-calls` flag has been introduced. It + causes cost centres to be inserted at call sites including instance dictionary + arguments. This may be preferred over :ghc-flag:`-fprof-late-overloaded` since + it may reveal whether imported functions are called overloaded. + JavaScript backend ~~~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/profiling.rst ===================================== @@ -518,6 +518,49 @@ of your profiled program will be different to that of the unprofiled one. You can try this mode if :ghc-flag:`-fprof-late` results in a profile that's too hard to interpret. +.. ghc-flag:: -fprof-late-overloaded + :shortdesc: Auto-add ``SCC``\\ s to all top level overloaded bindings *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all *overloaded* top level bindings + late in the compilation pipeline after the optimizer has run and unfoldings + have been created. This means these cost centres will not interfere with + core-level optimizations and the resulting profile will be closer to the + performance profile of an optimized non-profiled executable. + + This flag can help determine which top level bindings encountered during a + program's execution are still overloaded after inlining and specialization. + +.. ghc-flag:: -fprof-late-overloaded-calls + :shortdesc: Auto-add ``SCC``\\ s to all call sites that include dictionary arguments *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded-calls + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all call sites that include + dictionary arguments late in the compilation pipeline after the optimizer + has run and unfoldings have been created. This means these cost centres will + not interfere with core-level optimizations and the resulting profile will + be closer to the performance profile of an optimized non-profiled + executable. + + This flag is potentially more useful than :ghc-flag:`-fprof-late-overloaded` + since it will also add ``SCC`` annotations to call sites of imported + overloaded functions. + + Some overloaded calls may not be annotated, specifically in cases where the + optimizer turns an overloaded function into a join point. Calls to such + functions will not be wrapped in ``SCC`` annotations, since it would make + them non-tail calls, which is a requirement for join points. Instead, + ``SCC`` annotations are added around the body of overloaded join variables + and given distinct names (``join-rhs-``) to avoid confusion. + .. ghc-flag:: -fprof-cafs :shortdesc: Auto-add ``SCC``\\ s to all CAFs :type: dynamic ===================================== testsuite/tests/profiling/should_run/all.T ===================================== @@ -195,3 +195,30 @@ test('ignore_scc', [], compile_and_run, ['-fno-prof-manual']) test('T21446', [], makefile_test, ['T21446']) + + +test('scc-prof-overloaded001', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded002', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls001', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fno-full-laziness -fprof-late-overloaded-calls'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls002', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fprof-late-overloaded-calls'] +) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample ===================================== @@ -0,0 +1,26 @@ + Thu Jan 4 11:49 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,320 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded-calls001.hs:24:1-31 256 1 0.0 0.3 0.0 0.8 + f Main scc-prof-overloaded-calls001.hs:18:1-18 257 1 0.0 0.6 0.0 0.6 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample ===================================== @@ -0,0 +1,31 @@ + Fri Jan 5 11:06 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls002 +RTS -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 59,152 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 34.8 +CAF GHC.IO.Handle.FD 0.0 58.7 +CAF GHC.IO.Encoding 0.0 4.1 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 34.8 0.0 100.0 + CAF Main 255 0 0.0 0.6 0.0 0.9 + f Main scc-prof-overloaded-calls002.hs:52:1-25 262 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:48:1-25 261 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:44:1-25 260 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:40:1-25 259 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:36:1-25 258 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:32:1-25 257 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:28:1-25 256 1 0.0 0.0 0.0 0.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.1 0.0 4.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.3 0.0 0.3 + CAF GHC.IO.Handle.FD 208 0 0.0 58.7 0.0 58.7 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample ===================================== @@ -0,0 +1,25 @@ + Thu Jan 4 11:26 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,304 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded001.hs:18:1-6 256 1 0.0 0.8 0.0 0.8 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample ===================================== @@ -0,0 +1,23 @@ + Thu Jan 4 11:55 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded002 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 56,472 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 32.7 +CAF GHC.IO.Handle.FD 0.0 61.5 +CAF GHC.IO.Encoding 0.0 4.3 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 32.7 0.0 100.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.3 0.0 4.3 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 61.5 0.0 61.5 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/61bb5ff68630c203eaae4baba554640246df5a63 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/61bb5ff68630c203eaae4baba554640246df5a63 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 17:51:54 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Mon, 04 Mar 2024 12:51:54 -0500 Subject: [Git][ghc/ghc][wip/T24466] Don't push non-thunks into all branches Message-ID: <65e60a3a3bad9_a5db0c0631d010377a@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24466 at Glasgow Haskell Compiler / GHC Commits: fe53f132 by Simon Peyton Jones at 2024-03-04T17:51:23+00:00 Don't push non-thunks into all branches - - - - - 1 changed file: - compiler/GHC/Core/Opt/FloatIn.hs Changes: ===================================== compiler/GHC/Core/Opt/FloatIn.hs ===================================== @@ -792,7 +792,7 @@ sepBindsByDropPoint platform is_case floaters here_fvs fork_fvs | otherwise = go floaters (initDropBox here_fvs) (map initDropBox fork_fvs) where --- n_alts = length fork_fvs + n_alts = length fork_fvs go :: RevFloatInBinds -> DropBox -> [DropBox] -> (RevFloatInBinds, [RevFloatInBinds]) @@ -819,6 +819,11 @@ sepBindsByDropPoint platform is_case floaters here_fvs fork_fvs n_used_alts = count id used_in_flags -- returns number of Trues in list. + not_thunky = case bind of + FloatCase{} -> True + FloatLet (NonRec _ r) -> exprIsHNF r + FloatLet (Rec prs) -> all (exprIsHNF . snd) prs + cant_push | is_case = -- The alternatives of a case expresison @@ -831,8 +836,8 @@ sepBindsByDropPoint platform is_case floaters here_fvs fork_fvs -- See Note [Duplicating floats into case alternatives] dont_float_into_alts - = -- (n_used_alts == n_alts) || - -- Don't float in if used in all alternatives + = (n_used_alts == n_alts && not_thunky) || + -- Don't float in if used in all alternatives and not a thunk (n_used_alts > 1 && not (floatIsDupable platform bind)) -- Nor if used in multiple alts and not small View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe53f1321c6d200c49dae5bc2d20bf2cc1c73841 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe53f1321c6d200c49dae5bc2d20bf2cc1c73841 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 19:19:21 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Mon, 04 Mar 2024 14:19:21 -0500 Subject: [Git][ghc/ghc][wip/t24277] 276 commits: Late plugins Message-ID: <65e61eb983075_a5db0e7cdeb4123823@gitlab.mail> Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC Commits: 1c79526a by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Late plugins - - - - - 000c3302 by Finley McIlwaine at 2023-12-15T12:24:40-08:00 withTiming on LateCCs and late plugins - - - - - be4551ac by Finley McIlwaine at 2023-12-15T12:24:40-08:00 add test for late plugins - - - - - 7c29da9f by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Document late plugins - - - - - 9a52ae46 by Ben Gamari at 2023-12-20T07:07:26-05:00 Fix thunk update ordering Previously we attempted to ensure soundness of concurrent thunk update by synchronizing on the access of the thunk's info table pointer field. This was believed to be sufficient since the indirectee (which may expose a closure allocated by another core) would not be examined until the info table pointer update is complete. However, it turns out that this can result in data races in the presence of multiple threads racing a update a single thunk. For instance, consider this interleaving under the old scheme: Thread A Thread B --------- --------- t=0 Enter t 1 Push update frame 2 Begin evaluation 4 Pause thread 5 t.indirectee=tso 6 Release t.info=BLACKHOLE 7 ... (e.g. GC) 8 Resume thread 9 Finish evaluation 10 Relaxed t.indirectee=x 11 Load t.info 12 Acquire fence 13 Inspect t.indirectee 14 Release t.info=BLACKHOLE Here Thread A enters thunk `t` but is soon paused, resulting in `t` being lazily blackholed at t=6. Then, at t=10 Thread A finishes evaluation and updates `t.indirectee` with a relaxed store. Meanwhile, Thread B enters the blackhole. Under the old scheme this would introduce an acquire-fence but this would only synchronize with Thread A at t=6. Consequently, the result of the evaluation, `x`, is not visible to Thread B, introducing a data race. We fix this by treating the `indirectee` field as we do all other mutable fields. This means we must always access this field with acquire-loads and release-stores. See #23185. - - - - - f4b53538 by Vladislav Zavialov at 2023-12-20T07:08:02-05:00 docs: Fix link to 051-ghc-base-libraries.rst The proposal is no longer available at the previous URL. - - - - - f7e21fab by Matthew Pickering at 2023-12-21T14:57:40+00:00 hadrian: Build all executables in bin/ folder In the end the bindist creation logic copies them all into the bin folder. There is no benefit to building a specific few binaries in the lib/bin folder anymore. This also removes the ad-hoc logic to copy the touchy and unlit executables from stage0 into stage1. It takes <1s to build so we might as well just build it. - - - - - 0038d052 by Zubin Duggal at 2023-12-22T23:28:00-05:00 testsuite: mark jspace as fragile on i386. This test has been flaky for some time and has been failing consistently on i386-linux since 8e0446df landed. See #24261 - - - - - dfd670a0 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 609e6225 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 865513b2 by Ömer Sinan Ağacan at 2023-12-24T10:11:13-05:00 Fix BNF in user manual 6.6.8.2: formal syntax for instance declarations - - - - - c247b6be by Zubin Duggal at 2023-12-25T16:01:23-05:00 docs: document permissibility of -XOverloadedLabels (#24249) Document the permissibility introduced by https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst - - - - - e5b7eb59 by Ömer Sinan Ağacan at 2023-12-25T16:02:03-05:00 Fix a code block syntax in user manual sec. 6.8.8.6 - - - - - 2db11c08 by Ben Gamari at 2023-12-29T15:35:48-05:00 genSym: Reimplement via CAS on 32-bit platforms Previously the remaining use of the C implementation on 32-bit platforms resulted in a subtle bug, #24261. This was due to the C object (which used the RTS's `atomic_inc64` macro) being compiled without `-threaded` yet later being used in a threaded compiler. Side-step this issue by using the pure Haskell `genSym` implementation on all platforms. This required implementing `fetchAddWord64Addr#` in terms of CAS on 64-bit platforms. - - - - - 19328a8c by Xiaoyan Ren at 2023-12-29T15:36:30-05:00 Do not color the diagnostic code in error messages (#24172) - - - - - 685b467c by Krzysztof Gogolewski at 2023-12-29T15:37:06-05:00 Enforce that bindings of implicit parameters are lifted Fixes #24298 - - - - - bc4d67b7 by Matthew Craven at 2023-12-31T06:15:42-05:00 StgToCmm: Detect some no-op case-continuations ...and generate no code for them. Fixes #24264. - - - - - 5b603139 by Krzysztof Gogolewski at 2023-12-31T06:16:18-05:00 Revert "testsuite: mark jspace as fragile on i386." This reverts commit 0038d052c8c80b4b430bb2aa1c66d5280be1aa95. The atomicity bug should be fixed by !11802. - - - - - d55216ad by Krzysztof Gogolewski at 2024-01-01T12:05:49-05:00 Refactor: store [[PrimRep]] rather than [Type] in STG StgConApp stored a list of types. This list was used exclusively during unarisation of unboxed sums (mkUbxSum). However, this is at a wrong level of abstraction: STG shouldn't be concerned with Haskell types, only PrimReps. Update the code to store a [[PrimRep]]. Also, there's no point in storing this list when we're not dealing with an unboxed sum. - - - - - 8b340bc7 by Ömer Sinan Ağacan at 2024-01-01T12:06:29-05:00 Kind signatures docs: mention that they're allowed in newtypes - - - - - 989bf8e5 by Zubin Duggal at 2024-01-03T20:08:47-05:00 ci: Ensure we use the correct bindist name for the test artifact when generating release ghcup metadata Fixes #24268 - - - - - 89299a89 by Krzysztof Gogolewski at 2024-01-03T20:09:23-05:00 Refactor: remove calls to typePrimRepArgs The function typePrimRepArgs is just a thin wrapper around typePrimRep, adding a VoidRep if the list is empty. However, in StgToByteCode, we were discarding that VoidRep anyway, so there's no point in calling it. - - - - - c7be0c68 by mmzk1526 at 2024-01-03T20:10:07-05:00 Use "-V" for alex version check for better backward compatibility Fixes #24302. In recent versions of alex, "-v" is used for "--verbose" instead of "-version". - - - - - 67dbcc0a by Krzysztof Gogolewski at 2024-01-05T02:07:18-05:00 Fix VoidRep handling in ghci debugger 'go' inside extractSubTerms was giving a bad result given a VoidRep, attempting to round towards the next multiple of 0. I don't understand much about the debugger but the code should be better than it was. Fixes #24306 - - - - - 90ea574e by Krzysztof Gogolewski at 2024-01-05T02:07:54-05:00 VoidRep-related refactor * In GHC.StgToByteCode, replace bcIdPrimId with idPrimRep, bcIdArgRep with idArgRep, atomPrimRep with stgArgRep1. All of them were duplicates. * In GHC.Stg.Unarise, we were converting a PrimRep to a Type and back to PrimRep. Remove the calls to primRepToType and typePrimRep1 which cancel out. * In GHC.STG.Lint, GHC.StgToCmm, GHC.Types.RepType we were filtering out VoidRep from the result of typePrimRep. But typePrimRep never returns VoidRep - remove the filtering. - - - - - eaf72479 by brian at 2024-01-06T23:03:09-05:00 Add unaligned Addr# primops Implements CLC proposal #154: https://github.com/haskell/core-libraries-committee/issues/154 * add unaligned addr primops * add tests * accept tests * add documentation * fix js primops * uncomment in access ops * use Word64 in tests * apply suggestions * remove extra file * move docs * remove random options * use setByteArray# primop * better naming * update base-exports test * add base-exports for other architectures - - - - - d471d445 by Krzysztof Gogolewski at 2024-01-06T23:03:47-05:00 Remove VoidRep from PrimRep, introduce PrimOrVoidRep This introduces data PrimOrVoidRep = VoidRep | NVRep PrimRep changes typePrimRep1 to return PrimOrVoidRep, and adds a new function typePrimRepU to be used when the argument is definitely non-void. Details in Note [VoidRep] in GHC.Types.RepType. Fixes #19520 - - - - - 48720a07 by Matthew Craven at 2024-01-08T18:57:36-05:00 Apply Note [Sensitivity to unique increment] to LargeRecord - - - - - 9e2e180f by Sebastian Graf at 2024-01-08T18:58:13-05:00 Debugging: Add diffUFM for convenient diffing between UniqFMs - - - - - 948f3e35 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Rename Opt_D_dump_stranal to Opt_D_dump_dmdanal ... and Opt_D_dump_str_signatures to Opt_D_dump_dmd_signatures - - - - - 4e217e3e by Sebastian Graf at 2024-01-08T18:58:13-05:00 Deprecate -ddump-stranal and -ddump-str-signatures ... and suggest -ddump-dmdanal and -ddump-dmd-signatures instead - - - - - 6c613c90 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Move testsuite/tests/stranal to testsuite/tests/dmdanal A separate commit so that the rename is obvious to Git(Lab) - - - - - c929f02b by Sebastian Graf at 2024-01-08T18:58:13-05:00 CoreSubst: Stricten `substBndr` and `cloneBndr` Doing so reduced allocations of `cloneBndr` by about 25%. ``` T9233(normal) ghc/alloc 672,488,656 663,083,216 -1.4% GOOD T9675(optasm) ghc/alloc 423,029,256 415,812,200 -1.7% geo. mean -0.1% minimum -1.7% maximum +0.1% ``` Metric Decrease: T9233 - - - - - e3ca78f3 by Krzysztof Gogolewski at 2024-01-10T17:35:59-05:00 Deprecate -Wsemigroup This warning was used to prepare for Semigroup becoming a superclass of Monoid, and for (<>) being exported from Prelude. This happened in GHC 8.4 in 8ae263ceb3566 and feac0a3bc69fd3. The leftover logic for (<>) has been removed in GHC 9.8, 4d29ecdfcc79. Now the warning does nothing at all and can be deprecated. - - - - - 08d14925 by amesgen at 2024-01-10T17:36:42-05:00 WASM metadata: use correct GHC version - - - - - 7a808419 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Allow SCC declarations in TH (#24081) - - - - - 28827c51 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Fix prettyprinting of SCC pragmas - - - - - ae9cc1a8 by Matthew Craven at 2024-01-10T17:38:01-05:00 Fix loopification in the presence of void arguments This also removes Note [Void arguments in self-recursive tail calls], which was just misleading. It's important to count void args both in the function's arity and at the call site. Fixes #24295. - - - - - b718b145 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: Teach testsuite driver about c++ sources - - - - - 09cb57ad by Zubin Duggal at 2024-01-10T17:38:36-05:00 driver: Set -DPROFILING when compiling C++ sources with profiling Earlier, we used to pass all preprocessor flags to the c++ compiler. This meant that -DPROFILING was passed to the c++ compiler because it was a part of C++ flags However, this was incorrect and the behaviour was changed in 8ff3134ed4aa323b0199ad683f72165e51a59ab6. See #21291. But that commit exposed this bug where -DPROFILING was no longer being passed when compiling c++ sources. The fix is to explicitly include -DPROFILING in `opt_cxx` when profiling is enabled to ensure we pass the correct options for the way to both C and C++ compilers Fixes #24286 - - - - - 2cf9dd96 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: rename objcpp -> objcxx To avoid confusion with C Pre Processsor - - - - - af6932d6 by Simon Peyton Jones at 2024-01-10T17:39:12-05:00 Make TYPE and CONSTRAINT not-apart Issue #24279 showed up a bug in the logic in GHC.Core.Unify.unify_ty which is supposed to make TYPE and CONSTRAINT be not-apart. Easily fixed. - - - - - 4a39b5ff by Zubin Duggal at 2024-01-10T17:39:48-05:00 ci: Fix typo in mk_ghcup_metadata.py There was a missing colon in the fix to #24268 in 989bf8e53c08eb22de716901b914b3607bc8dd08 - - - - - 13503451 by Zubin Duggal at 2024-01-10T17:40:24-05:00 release-ci: remove release-x86_64-linux-deb11-release+boot_nonmoving_gc job There is no reason to have this release build or distribute this variation. This configuration is for testing purposes only. - - - - - afca46a4 by Sebastian Graf at 2024-01-10T17:41:00-05:00 Parser: Add a Note detailing why we need happy's `error` to implement layout - - - - - eaf8a06d by Krzysztof Gogolewski at 2024-01-11T00:43:17+01:00 Turn -Wtype-equality-out-of-scope on by default Also remove -Wnoncanonical-{monoid,monad}-instances from -Wcompat, since they are enabled by default. Refresh wcompat-warnings/ test with new -Wcompat warnings. Part of #24267 Co-authored-by: sheaf <sam.derbyshire at gmail.com> - - - - - 42bee5aa by Sebastian Graf at 2024-01-12T21:16:21-05:00 Arity: Require called *exactly once* for eta exp with -fpedantic-bottoms (#24296) In #24296, we had a program in which we eta expanded away an error despite the presence of `-fpedantic-bottoms`. This was caused by turning called *at least once* lambdas into one-shot lambdas, while with `-fpedantic-bottoms` it is only sound to eta expand over lambdas that are called *exactly* once. An example can be found in `Note [Combining arity type with demand info]`. Fixes #24296. - - - - - 7e95f738 by Andreas Klebinger at 2024-01-12T21:16:57-05:00 Aarch64: Enable -mfma by default. Fixes #24311 - - - - - e43788d0 by Jason Shipman at 2024-01-14T12:47:38-05:00 Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat CLC proposal #226 https://github.com/haskell/core-libraries-committee/issues/226 - - - - - ae6d8cd2 by Sebastian Graf at 2024-01-14T12:48:15-05:00 Pmc: COMPLETE pragmas associated with Family TyCons should apply to representation TyCons as well (#24326) Fixes #24326. - - - - - c5fc7304 by sheaf at 2024-01-15T14:15:29-05:00 Use lookupOccRn_maybe in TH.lookupName When looking up a value, we want to be able to find both variables and record fields. So we should not use the lookupSameOccRn_maybe function, as we can't know ahead of time which record field namespace a record field with the given textual name will belong to. Fixes #24293 - - - - - da908790 by Krzysztof Gogolewski at 2024-01-15T14:16:05-05:00 Make the build more strict on documentation errors * Detect undefined labels. This can be tested by adding :ref:`nonexistent` to a documentation rst file; attempting to build docs will fail. Fixed the undefined label in `9.8.1-notes.rst`. * Detect errors. While we have plenty of warnings, we can at least enforce that Sphinx does not report errors. Fixed the error in `required_type_arguments.rst`. Unrelated change: I have documented that the `-dlint` enables `-fcatch-nonexhaustive-cases`, as can be verified by checking `enableDLint`. - - - - - 5077416e by Javier Sagredo at 2024-01-16T15:40:06-05:00 Profiling: Adds an option to not start time profiling at startup Using the functionality provided by d89deeba47ce04a5198a71fa4cbc203fe2c90794, this patch creates a new rts flag `--no-automatic-time-samples` which disables the time profiling when starting a program. It is then expected that the user starts it whenever it is needed. Fixes #24337 - - - - - 5776008c by Matthew Pickering at 2024-01-16T15:40:42-05:00 eventlog: Fix off-by-one error in postIPE We were missing the extra_comma from the calculation of the size of the payload of postIPE. This was causing assertion failures when the event would overflow the buffer by one byte, as ensureRoomForVariable event would report there was enough space for `n` bytes but then we would write `n + 1` bytes into the buffer. Fixes #24287 - - - - - 66dc09b1 by Simon Peyton Jones at 2024-01-16T15:41:18-05:00 Improve SpecConstr (esp nofib/spectral/ansi) This MR makes three improvements to SpecConstr: see #24282 * It fixes an outright (and recently-introduced) bug in `betterPat`, which was wrongly forgetting to compare the lengths of the argument lists. * It enhances ConVal to inclue a boolean for work-free-ness, so that the envt can contain non-work-free constructor applications, so that we can do more: see Note [ConVal work-free-ness] * It rejigs `subsumePats` so that it doesn't reverse the list. This can make a difference because, when patterns overlap, we arbitrarily pick the first. There is no "right" way, but this retains the old pre-subsumePats behaviour, thereby "fixing" the regression in #24282. Nofib results +======================================== | spectral/ansi -21.14% | spectral/hartel/comp_lab_zift -0.12% | spectral/hartel/parstof +0.09% | spectral/last-piece -2.32% | spectral/multiplier +6.03% | spectral/para +0.60% | spectral/simple -0.26% +======================================== | geom mean -0.18% +---------------------------------------- The regression in `multiplier` is sad, but it simply replicates GHC's previous behaviour (e.g. GHC 9.6). - - - - - 65da79b3 by Matthew Pickering at 2024-01-16T15:41:54-05:00 hadrian: Reduce Cabal verbosity The comment claims that `simpleUserHooks` decrease verbosity, and it does, but only for the `postConf` phase. The other phases are too verbose with `-V`. At the moment > 5000 lines of the build log are devoted to output from `cabal copy`. So I take the simple approach and just decrease the verbosity level again. If the output of `postConf` is essential then it would be better to implement our own `UserHooks` which doesn't decrease the verbosity for `postConf`. Fixes #24338 - - - - - 16414d7d by Matthew Pickering at 2024-01-17T10:54:59-05:00 Stop retaining old ModGuts throughout subsequent simplifier phases Each phase of the simplifier typically rewrites the majority of ModGuts, so we want to be able to release the old ModGuts as soon as possible. `name_ppr_ctxt` lives throught the whole optimiser phase and it was retaining a reference to `ModGuts`, so we were failing to release the old `ModGuts` until the end of the phase (potentially doubling peak memory usage for that particular phase). This was discovered using eras profiling (#24332) Fixes #24328 - - - - - 7f0879e1 by Matthew Pickering at 2024-01-17T10:55:35-05:00 Update nofib submodule - - - - - 320454d3 by Cheng Shao at 2024-01-17T23:02:40+00:00 ci: bump ci-images for updated wasm image - - - - - 2eca52b4 by Cheng Shao at 2024-01-17T23:06:44+00:00 base: treat all FDs as "nonblocking" on wasm On posix platforms, when performing read/write on FDs, we check the nonblocking flag first. For FDs without this flag (e.g. stdout), we call fdReady() first, which in turn calls poll() to wait for I/O to be available on that FD. This is problematic for wasm32-wasi: although select()/poll() is supported via the poll_oneoff() wasi syscall, that syscall is rather heavyweight and runtime behavior differs in different wasi implementations. The issue is even worse when targeting browsers, given there's no satisfactory way to implement async I/O as a synchronous syscall, so existing JS polyfills for wasi often give up and simply return ENOSYS. Before we have a proper I/O manager that avoids poll_oneoff() for async I/O on wasm, this patch improves the status quo a lot by merely pretending all FDs are "nonblocking". Read/write on FDs will directly invoke read()/write(), which are much more reliably handled in existing wasi implementations, especially those in browsers. Fixes #23275 and the following test cases: T7773 isEOF001 openFile009 T4808 cgrun025 Approved by CLC proposal #234: https://github.com/haskell/core-libraries-committee/issues/234 - - - - - 83c6c710 by Andrew Lelechenko at 2024-01-18T05:21:49-05:00 base: clarify how to disable warnings about partiality of Data.List.{head,tail} - - - - - c4078f2f by Simon Peyton Jones at 2024-01-18T05:22:25-05:00 Fix four bug in handling of (forall cv. body_ty) These bugs are all described in #24335 It's not easy to provoke the bug, hence no test case. - - - - - 119586ea by Alexis King at 2024-01-19T00:08:00-05:00 Always refresh profiling CCSes after running pending initializers Fixes #24171. - - - - - 9718d970 by Oleg Grenrus at 2024-01-19T00:08:36-05:00 Set default-language: GHC2021 in ghc library Go through compiler/ sources, and remove all BangPatterns (and other GHC2021 enabled extensions in these files). - - - - - 3ef71669 by Matthew Pickering at 2024-01-19T21:55:16-05:00 testsuite: Remove unused have_library function Also remove the hence unused testsuite option `--test-package-db`. Fixes #24342 - - - - - 5b7fa20c by Jade at 2024-01-19T21:55:53-05:00 Fix Spelling in the compiler Tracking: #16591 - - - - - 09875f48 by Matthew Pickering at 2024-01-20T12:20:44-05:00 testsuite: Implement `isInTreeCompiler` in a more robust way Just a small refactoring to avoid redundantly specifying the same strings in two different places. - - - - - 0d12b987 by Jade at 2024-01-20T12:21:20-05:00 Change maintainer email from cvs-ghc at haskell.org to ghc-devs at haskell.org. Fixes #22142 - - - - - 1fa1c00c by Jade at 2024-01-23T19:17:03-05:00 Enhance Documentation of functions exported by Data.Function This patch aims to improve the documentation of functions exported in Data.Function Tracking: #17929 Fixes: #10065 - - - - - ab47a43d by Jade at 2024-01-23T19:17:39-05:00 Improve documentation of hGetLine. - Add explanation for whether a newline is returned - Add examples Fixes #14804 - - - - - dd4af0e5 by Cheng Shao at 2024-01-23T19:18:17-05:00 Fix genapply for cross-compilation by nuking fragile CPP logic This commit fixes incorrectly built genapply when cross compiling (#24347) by nuking all fragile CPP logic in it from the orbit. All target-specific info are now read from DerivedConstants.h at runtime, see added note for details. Also removes a legacy Makefile and adds haskell language server support for genapply. - - - - - 0cda2b8b by Cheng Shao at 2024-01-23T19:18:17-05:00 rts: enable wasm32 register mapping The wasm backend didn't properly make use of all Cmm global registers due to #24347. Now that it is fixed, this patch re-enables full register mapping for wasm32, and we can now generate smaller & faster wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152. - - - - - 0325a6e5 by Greg Steuck at 2024-01-24T01:29:44-05:00 Avoid utf8 in primops.txt.pp comments They don't make it through readFile' without explicitly setting the encoding. See https://gitlab.haskell.org/ghc/ghc/-/issues/17755 - - - - - 1aaf0bd8 by David Binder at 2024-01-24T01:30:20-05:00 Bump hpc and hpc-bin submodule Bump hpc to 0.7.0.1 Bump hpc-bin to commit d1780eb2 - - - - - e693a4e8 by Ben Gamari at 2024-01-24T01:30:56-05:00 testsuite: Ignore stderr in T8089 Otherwise spurious "Killed: 9" messages to stderr may cause the test to fail. Fixes #24361. - - - - - a40f4ab2 by sheaf at 2024-01-24T14:04:33-05:00 Fix FMA instruction on LLVM We were emitting the wrong instructions for fused multiply-add operations on LLVM: - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd" - LLVM does not support other instructions such as "fmsub"; instead we implement these by flipping signs of some arguments - the instruction is an LLVM intrinsic, which requires handling it like a normal function call instead of a machine instruction Fixes #24223 - - - - - 69abc786 by Andrei Borzenkov at 2024-01-24T14:05:09-05:00 Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291) - - - - - 0ac8f385 by Cheng Shao at 2024-01-25T00:27:48-05:00 compiler: remove unused GHC.Linker module The GHC.Linker module is empty and unused, other than as a hack for the make build system. We can remove it now that make is long gone; the note is moved to GHC.Linker.Loader instead. - - - - - 699da01b by Hécate Moonlight at 2024-01-25T00:28:27-05:00 Clarification for newtype constructors when using `coerce` - - - - - b2d8cd85 by Matt Walker at 2024-01-26T09:50:08-05:00 Fix #24308 Add tests for semicolon separated where clauses - - - - - 0da490a1 by Ben Gamari at 2024-01-26T17:34:41-05:00 hsc2hs: Bump submodule - - - - - 3f442fd2 by Ben Gamari at 2024-01-26T17:34:41-05:00 Bump containers submodule to 0.7 - - - - - 82a1c656 by Sebastian Nagel at 2024-01-29T02:32:40-05:00 base: with{Binary}File{Blocking} only annotates own exceptions Fixes #20886 This ensures that inner, unrelated exceptions are not misleadingly annotated with the opened file. - - - - - 9294a086 by Andreas Klebinger at 2024-01-29T02:33:15-05:00 Fix fma warning when using llvm on aarch64. On aarch64 fma is always on so the +fma flag doesn't exist for that target. Hence no need to try and pass +fma to llvm. Fixes #24379 - - - - - ced2e731 by sheaf at 2024-01-29T17:27:12-05:00 No shadowing warnings for NoFieldSelector fields This commit ensures we don't emit shadowing warnings when a user shadows a field defined with NoFieldSelectors. Fixes #24381 - - - - - 8eeadfad by Patrick at 2024-01-29T17:27:51-05:00 Fix bug wrong span of nested_doc_comment #24378 close #24378 1. Update the start position of span in `nested_doc_comment` correctly. and hence the spans of identifiers of haddoc can be computed correctly. 2. add test `HaddockSpanIssueT24378`. - - - - - a557580f by Alexey Radkov at 2024-01-30T19:41:52-05:00 Fix irrelevant dodgy-foreign-imports warning on import f-pointers by value A test *сс018* is attached (not sure about the naming convention though). Note that without the fix, the test fails with the *dodgy-foreign-imports* warning passed to stderr. The warning disappears after the fix. GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as ```haskell foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ()) ``` where ```c void (*f)(int); ``` See a related real-world use-case [here](https://gitlab.com/daniel-casanueva/pcre-light/-/merge_requests/17). There, GHC warns on import of C function pointer `pcre_free`. - - - - - ca99efaf by Alexey Radkov at 2024-01-30T19:41:53-05:00 Rename test cc018 -> T24034 - - - - - 88c38dd5 by Ben Gamari at 2024-01-30T19:42:28-05:00 rts/TraverseHeap.c: Ensure that PosixSource.h is included first - - - - - ca2e919e by Simon Peyton Jones at 2024-01-31T09:29:45+00:00 Make decomposeRuleLhs a bit more clever This fixes #24370 by making decomposeRuleLhs undertand dictionary /functions/ as well as plain /dictionaries/ - - - - - 94ce031d by Teo Camarasu at 2024-02-01T05:49:49-05:00 doc: Add -Dn flag to user guide Resolves #24394 - - - - - 31553b11 by Ben Gamari at 2024-02-01T12:21:29-05:00 cmm: Introduce MO_RelaxedRead In hand-written Cmm it can sometimes be necessary to atomically load from memory deep within an expression (e.g. see the `CHECK_GC` macro). This MachOp provides a convenient way to do so without breaking the expression into multiple statements. - - - - - 0785cf81 by Ben Gamari at 2024-02-01T12:21:29-05:00 codeGen: Use relaxed accesses in ticky bumping - - - - - be423dda by Ben Gamari at 2024-02-01T12:21:29-05:00 base: use atomic write when updating timer manager - - - - - 8a310e35 by Ben Gamari at 2024-02-01T12:21:29-05:00 Use relaxed atomics to manipulate TSO status fields - - - - - d6809ee4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Add necessary barriers when manipulating TSO owner - - - - - 39e3ac5d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Use `switch` to branch on why_blocked This is a semantics-preserving refactoring. - - - - - 515eb33d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix synchronization on thread blocking state We now use a release barrier whenever we update a thread's blocking state. This required widening StgTSO.why_blocked as AArch64 does not support atomic writes on 16-bit values. - - - - - eb38812e by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadPaused This only affects an assertion in the debug RTS and only needs relaxed ordering. - - - - - 26c48dd6 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadStatus# - - - - - 6af43ab4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in Interpreter's preemption check - - - - - 9502ad3c by Ben Gamari at 2024-02-01T12:21:29-05:00 rts/Messages: Fix data race - - - - - 60802db5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts/Prof: Fix data race - - - - - ef8ccef5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use relaxed ordering on dirty/clean info tables updates When changing the dirty/clean state of a mutable object we needn't have any particular ordering. - - - - - 76fe2b75 by Ben Gamari at 2024-02-01T12:21:30-05:00 codeGen: Use relaxed-read in closureInfoPtr - - - - - a6316eb4 by Ben Gamari at 2024-02-01T12:21:30-05:00 STM: Use acquire loads when possible Full sequential consistency is not needed here. - - - - - 6bddfd3d by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use fence rather than redundant load Previously we would use an atomic load to ensure acquire ordering. However, we now have `ACQUIRE_FENCE_ON`, which allows us to express this more directly. - - - - - 55c65dbc by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Fix data races in profiling timer - - - - - 856b5e75 by Ben Gamari at 2024-02-01T12:21:30-05:00 Add Note [C11 memory model] - - - - - 6534da24 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: move generic cmm optimization logic in NCG to a standalone module This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. - - - - - 87e34888 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. - - - - - c6ce242e by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: enable generic cmm optimizations in wasm backend NCG This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. - - - - - 151dda4e by Andrei Borzenkov at 2024-02-01T12:22:43-05:00 Namespacing for WARNING/DEPRECATED pragmas (#24396) New syntax for WARNING and DEPRECATED pragmas was added, namely namespace specifierss: namespace_spec ::= 'type' | 'data' | {- empty -} warning ::= warning_category namespace_spec namelist strings deprecation ::= namespace_spec namelist strings A new data type was introduced to represent these namespace specifiers: data NamespaceSpecifier = NoSpecifier | TypeNamespaceSpecifier (EpToken "type") | DataNamespaceSpecifier (EpToken "data") Extension field XWarning now contains this NamespaceSpecifier. lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier and checks that the namespace of the found names matches the passed flag. With this change {-# WARNING data D "..." #-} pragma will only affect value namespace and {-# WARNING type D "..." #-} will only affect type namespace. The same logic is applicable to DEPRECATED pragmas. Finding duplicated warnings inside rnSrcWarnDecls now takes into consideration NamespaceSpecifier flag to allow warnings with the same names that refer to different namespaces. - - - - - 38c3afb6 by Bryan Richter at 2024-02-01T12:23:19-05:00 CI: Disable the test-cabal-reinstall job Fixes #24363 - - - - - 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 91bc61af by Finley McIlwaine at 2024-03-04T11:17:24-08:00 base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Add functions for gettings the IDs of cost centres to the interface of `GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids, `CostCentreId`, with appropriate instances. Implements CLC proposal 235 - - - - - 16 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py - .gitmodules - CODEOWNERS - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/PrimOps.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e8d17957031278affc5a155970ba8f8bf5281891...91bc61afdb39965b83f707cc1bed536f853f4a06 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e8d17957031278affc5a155970ba8f8bf5281891...91bc61afdb39965b83f707cc1bed536f853f4a06 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 19:19:49 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Mon, 04 Mar 2024 14:19:49 -0500 Subject: [Git][ghc/ghc][wip/t24277] base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Message-ID: <65e61ed5bdb52_a5db0e92ab7c124125@gitlab.mail> Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC Commits: f8217742 by Finley McIlwaine at 2024-03-04T11:19:20-08:00 base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Add functions for gettings the IDs of cost centres to the interface of `GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids, `CostCentreId`, with appropriate instances. Implements CLC proposal 235. Resolves #24277 - - - - - 9 changed files: - libraries/base/src/GHC/Exts.hs - libraries/base/src/GHC/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -84,6 +84,7 @@ module GHC.Exts traceEvent, -- ** The call stack currentCallStack, + currentCallStackIds, -- * Ids with special behaviour inline, noinline, ===================================== libraries/base/src/GHC/Stack.hs ===================================== @@ -18,6 +18,7 @@ module GHC.Stack (errorWithStackTrace, -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks CallStack, @@ -37,16 +38,19 @@ module GHC.Stack -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where -import GHC.Internal.Stack \ No newline at end of file +import GHC.Internal.Stack ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -103,6 +103,8 @@ module GHC.Internal.Exts -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, lazy, oneShot, considerAccessible, ===================================== libraries/ghc-internal/src/GHC/Internal/Stack.hs ===================================== @@ -2,6 +2,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- @@ -24,6 +25,7 @@ module GHC.Internal.Stack ( -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks @@ -38,14 +40,17 @@ module GHC.Internal.Stack ( -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc ===================================== @@ -16,14 +16,17 @@ ----------------------------------------------------------------------------- {-# LANGUAGE UnboxedTuples, MagicHash, NoImplicitPrelude #-} +{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving #-} module GHC.Internal.Stack.CCS ( -- * Call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, @@ -31,7 +34,9 @@ module GHC.Internal.Stack.CCS ( ccsParent, ccLabel, ccModule, + ccId, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack, ) where @@ -44,6 +49,12 @@ import GHC.Internal.Base import GHC.Internal.Ptr import GHC.Internal.IO.Encoding import GHC.Internal.List ( concatMap, reverse ) +import GHC.Internal.Word ( Word32 ) +import GHC.Internal.Show +import GHC.Internal.Read +import GHC.Internal.Enum +import GHC.Internal.Real +import GHC.Internal.Num #define PROFILING #include "Rts.h" @@ -54,6 +65,13 @@ data CostCentreStack -- | A cost-centre from GHC's cost-center profiler. data CostCentre +-- | Cost centre identifier +-- +-- @since 4.20.0.0 +newtype CostCentreId = CostCentreId Word32 + deriving (Show, Read) + deriving newtype (Eq, Ord, Bounded, Enum, Integral, Num, Real) + -- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current -- program was not compiled with profiling support). Takes a dummy argument -- which can be used to avoid the call to @getCurrentCCS@ being floated out by @@ -83,6 +101,12 @@ ccsCC p = peekByteOff p 4 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = peekByteOff p 8 +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO Word32 +ccId p = fmap CostCentreId $ peekByteOff p 0 + ccLabel :: Ptr CostCentre -> IO CString ccLabel p = peekByteOff p 4 @@ -99,6 +123,12 @@ ccsCC p = (# peek CostCentreStack, cc) p ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = (# peek CostCentreStack, prevStack) p +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO CostCentreId +ccId p = fmap CostCentreId $ (# peek CostCentre, ccID) p + -- | Get the label of a 'CostCentre'. ccLabel :: Ptr CostCentre -> IO CString ccLabel p = (# peek CostCentre, label) p @@ -125,6 +155,19 @@ ccSrcSpan p = (# peek CostCentre, srcloc) p currentCallStack :: IO [String] currentCallStack = ccsToStrings =<< getCurrentCCS () +-- | Returns a @[CostCentreId]@ representing the current call stack. This +-- can be useful for debugging. +-- +-- The implementation uses the call-stack simulation maintained by the +-- profiler, so it only works if the program was compiled with @-prof@ +-- and contains suitable SCC annotations (e.g. by using @-fprof-late@). +-- Otherwise, the list returned is likely to be empty or +-- uninformative. +-- +-- @since 4.20.0.0 +currentCallStackIds :: IO [CostCentreId] +currentCallStackIds = ccsToIds =<< getCurrentCCS () + -- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] @@ -141,6 +184,24 @@ ccsToStrings ccs0 = go ccs0 [] then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) +-- | Format a 'CostCentreStack' as a list of cost centre IDs. +-- +-- @since 4.20.0.0 +ccsToIds :: Ptr CostCentreStack -> IO [CostCentreId] +ccsToIds ccs0 = go ccs0 [] + where + go ccs acc + | ccs == nullPtr = return acc + | otherwise = do + cc <- ccsCC ccs + cc_id <- ccId cc + lbl <- GHC.peekCString utf8 =<< ccLabel cc + mdl <- GHC.peekCString utf8 =<< ccModule cc + parent <- ccsParent ccs + if (mdl == "MAIN" && lbl == "MAIN") + then return acc + else go parent (cc_id : acc) + -- | Get the stack trace attached to an object. -- -- @since base-4.5.0.0 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Internal.Stack.CCS.CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9303,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9312,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11557,6 +11563,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11639,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12022,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12134,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12208,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12255,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12432,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12633,6 +12646,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12811,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -5727,6 +5727,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -12351,14 +12352,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -12380,14 +12384,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -5907,6 +5907,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9533,14 +9534,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9562,14 +9566,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9309,14 +9310,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9338,14 +9342,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f82177424b1cae2da4d5acd797ad15f83fab5145 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f82177424b1cae2da4d5acd797ad15f83fab5145 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 20:58:36 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 04 Mar 2024 15:58:36 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: compiler: start deprecating cmmToRawCmmHook Message-ID: <65e635fc9b592_a5db0114905dc130544@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 31be53b2 by Andreas Klebinger at 2024-03-04T15:58:32-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 30 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - libraries/base/changelog.md - libraries/base/src/Data/List/NonEmpty.hs - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/df8631287d4fa20ca2f19619c289c630e3e1c040...31be53b2c08f1fe1d53917aeb227a3b8c49bbcf4 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/df8631287d4fa20ca2f19619c289c630e3e1c040...31be53b2c08f1fe1d53917aeb227a3b8c49bbcf4 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 20:59:42 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 04 Mar 2024 15:59:42 -0500 Subject: [Git][ghc/ghc][wip/hadrian-cross-stage2] 229 commits: ci: bump ci-images for updated wasm image Message-ID: <65e6363e1e863_a5db0115e802413555d@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC Commits: 320454d3 by Cheng Shao at 2024-01-17T23:02:40+00:00 ci: bump ci-images for updated wasm image - - - - - 2eca52b4 by Cheng Shao at 2024-01-17T23:06:44+00:00 base: treat all FDs as "nonblocking" on wasm On posix platforms, when performing read/write on FDs, we check the nonblocking flag first. For FDs without this flag (e.g. stdout), we call fdReady() first, which in turn calls poll() to wait for I/O to be available on that FD. This is problematic for wasm32-wasi: although select()/poll() is supported via the poll_oneoff() wasi syscall, that syscall is rather heavyweight and runtime behavior differs in different wasi implementations. The issue is even worse when targeting browsers, given there's no satisfactory way to implement async I/O as a synchronous syscall, so existing JS polyfills for wasi often give up and simply return ENOSYS. Before we have a proper I/O manager that avoids poll_oneoff() for async I/O on wasm, this patch improves the status quo a lot by merely pretending all FDs are "nonblocking". Read/write on FDs will directly invoke read()/write(), which are much more reliably handled in existing wasi implementations, especially those in browsers. Fixes #23275 and the following test cases: T7773 isEOF001 openFile009 T4808 cgrun025 Approved by CLC proposal #234: https://github.com/haskell/core-libraries-committee/issues/234 - - - - - 83c6c710 by Andrew Lelechenko at 2024-01-18T05:21:49-05:00 base: clarify how to disable warnings about partiality of Data.List.{head,tail} - - - - - c4078f2f by Simon Peyton Jones at 2024-01-18T05:22:25-05:00 Fix four bug in handling of (forall cv. body_ty) These bugs are all described in #24335 It's not easy to provoke the bug, hence no test case. - - - - - 119586ea by Alexis King at 2024-01-19T00:08:00-05:00 Always refresh profiling CCSes after running pending initializers Fixes #24171. - - - - - 9718d970 by Oleg Grenrus at 2024-01-19T00:08:36-05:00 Set default-language: GHC2021 in ghc library Go through compiler/ sources, and remove all BangPatterns (and other GHC2021 enabled extensions in these files). - - - - - 3ef71669 by Matthew Pickering at 2024-01-19T21:55:16-05:00 testsuite: Remove unused have_library function Also remove the hence unused testsuite option `--test-package-db`. Fixes #24342 - - - - - 5b7fa20c by Jade at 2024-01-19T21:55:53-05:00 Fix Spelling in the compiler Tracking: #16591 - - - - - 09875f48 by Matthew Pickering at 2024-01-20T12:20:44-05:00 testsuite: Implement `isInTreeCompiler` in a more robust way Just a small refactoring to avoid redundantly specifying the same strings in two different places. - - - - - 0d12b987 by Jade at 2024-01-20T12:21:20-05:00 Change maintainer email from cvs-ghc at haskell.org to ghc-devs at haskell.org. Fixes #22142 - - - - - 1fa1c00c by Jade at 2024-01-23T19:17:03-05:00 Enhance Documentation of functions exported by Data.Function This patch aims to improve the documentation of functions exported in Data.Function Tracking: #17929 Fixes: #10065 - - - - - ab47a43d by Jade at 2024-01-23T19:17:39-05:00 Improve documentation of hGetLine. - Add explanation for whether a newline is returned - Add examples Fixes #14804 - - - - - dd4af0e5 by Cheng Shao at 2024-01-23T19:18:17-05:00 Fix genapply for cross-compilation by nuking fragile CPP logic This commit fixes incorrectly built genapply when cross compiling (#24347) by nuking all fragile CPP logic in it from the orbit. All target-specific info are now read from DerivedConstants.h at runtime, see added note for details. Also removes a legacy Makefile and adds haskell language server support for genapply. - - - - - 0cda2b8b by Cheng Shao at 2024-01-23T19:18:17-05:00 rts: enable wasm32 register mapping The wasm backend didn't properly make use of all Cmm global registers due to #24347. Now that it is fixed, this patch re-enables full register mapping for wasm32, and we can now generate smaller & faster wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152. - - - - - 0325a6e5 by Greg Steuck at 2024-01-24T01:29:44-05:00 Avoid utf8 in primops.txt.pp comments They don't make it through readFile' without explicitly setting the encoding. See https://gitlab.haskell.org/ghc/ghc/-/issues/17755 - - - - - 1aaf0bd8 by David Binder at 2024-01-24T01:30:20-05:00 Bump hpc and hpc-bin submodule Bump hpc to 0.7.0.1 Bump hpc-bin to commit d1780eb2 - - - - - e693a4e8 by Ben Gamari at 2024-01-24T01:30:56-05:00 testsuite: Ignore stderr in T8089 Otherwise spurious "Killed: 9" messages to stderr may cause the test to fail. Fixes #24361. - - - - - a40f4ab2 by sheaf at 2024-01-24T14:04:33-05:00 Fix FMA instruction on LLVM We were emitting the wrong instructions for fused multiply-add operations on LLVM: - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd" - LLVM does not support other instructions such as "fmsub"; instead we implement these by flipping signs of some arguments - the instruction is an LLVM intrinsic, which requires handling it like a normal function call instead of a machine instruction Fixes #24223 - - - - - 69abc786 by Andrei Borzenkov at 2024-01-24T14:05:09-05:00 Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291) - - - - - 0ac8f385 by Cheng Shao at 2024-01-25T00:27:48-05:00 compiler: remove unused GHC.Linker module The GHC.Linker module is empty and unused, other than as a hack for the make build system. We can remove it now that make is long gone; the note is moved to GHC.Linker.Loader instead. - - - - - 699da01b by Hécate Moonlight at 2024-01-25T00:28:27-05:00 Clarification for newtype constructors when using `coerce` - - - - - b2d8cd85 by Matt Walker at 2024-01-26T09:50:08-05:00 Fix #24308 Add tests for semicolon separated where clauses - - - - - 0da490a1 by Ben Gamari at 2024-01-26T17:34:41-05:00 hsc2hs: Bump submodule - - - - - 3f442fd2 by Ben Gamari at 2024-01-26T17:34:41-05:00 Bump containers submodule to 0.7 - - - - - 82a1c656 by Sebastian Nagel at 2024-01-29T02:32:40-05:00 base: with{Binary}File{Blocking} only annotates own exceptions Fixes #20886 This ensures that inner, unrelated exceptions are not misleadingly annotated with the opened file. - - - - - 9294a086 by Andreas Klebinger at 2024-01-29T02:33:15-05:00 Fix fma warning when using llvm on aarch64. On aarch64 fma is always on so the +fma flag doesn't exist for that target. Hence no need to try and pass +fma to llvm. Fixes #24379 - - - - - ced2e731 by sheaf at 2024-01-29T17:27:12-05:00 No shadowing warnings for NoFieldSelector fields This commit ensures we don't emit shadowing warnings when a user shadows a field defined with NoFieldSelectors. Fixes #24381 - - - - - 8eeadfad by Patrick at 2024-01-29T17:27:51-05:00 Fix bug wrong span of nested_doc_comment #24378 close #24378 1. Update the start position of span in `nested_doc_comment` correctly. and hence the spans of identifiers of haddoc can be computed correctly. 2. add test `HaddockSpanIssueT24378`. - - - - - a557580f by Alexey Radkov at 2024-01-30T19:41:52-05:00 Fix irrelevant dodgy-foreign-imports warning on import f-pointers by value A test *сс018* is attached (not sure about the naming convention though). Note that without the fix, the test fails with the *dodgy-foreign-imports* warning passed to stderr. The warning disappears after the fix. GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as ```haskell foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ()) ``` where ```c void (*f)(int); ``` See a related real-world use-case [here](https://gitlab.com/daniel-casanueva/pcre-light/-/merge_requests/17). There, GHC warns on import of C function pointer `pcre_free`. - - - - - ca99efaf by Alexey Radkov at 2024-01-30T19:41:53-05:00 Rename test cc018 -> T24034 - - - - - 88c38dd5 by Ben Gamari at 2024-01-30T19:42:28-05:00 rts/TraverseHeap.c: Ensure that PosixSource.h is included first - - - - - ca2e919e by Simon Peyton Jones at 2024-01-31T09:29:45+00:00 Make decomposeRuleLhs a bit more clever This fixes #24370 by making decomposeRuleLhs undertand dictionary /functions/ as well as plain /dictionaries/ - - - - - 94ce031d by Teo Camarasu at 2024-02-01T05:49:49-05:00 doc: Add -Dn flag to user guide Resolves #24394 - - - - - 31553b11 by Ben Gamari at 2024-02-01T12:21:29-05:00 cmm: Introduce MO_RelaxedRead In hand-written Cmm it can sometimes be necessary to atomically load from memory deep within an expression (e.g. see the `CHECK_GC` macro). This MachOp provides a convenient way to do so without breaking the expression into multiple statements. - - - - - 0785cf81 by Ben Gamari at 2024-02-01T12:21:29-05:00 codeGen: Use relaxed accesses in ticky bumping - - - - - be423dda by Ben Gamari at 2024-02-01T12:21:29-05:00 base: use atomic write when updating timer manager - - - - - 8a310e35 by Ben Gamari at 2024-02-01T12:21:29-05:00 Use relaxed atomics to manipulate TSO status fields - - - - - d6809ee4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Add necessary barriers when manipulating TSO owner - - - - - 39e3ac5d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Use `switch` to branch on why_blocked This is a semantics-preserving refactoring. - - - - - 515eb33d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix synchronization on thread blocking state We now use a release barrier whenever we update a thread's blocking state. This required widening StgTSO.why_blocked as AArch64 does not support atomic writes on 16-bit values. - - - - - eb38812e by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadPaused This only affects an assertion in the debug RTS and only needs relaxed ordering. - - - - - 26c48dd6 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadStatus# - - - - - 6af43ab4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in Interpreter's preemption check - - - - - 9502ad3c by Ben Gamari at 2024-02-01T12:21:29-05:00 rts/Messages: Fix data race - - - - - 60802db5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts/Prof: Fix data race - - - - - ef8ccef5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use relaxed ordering on dirty/clean info tables updates When changing the dirty/clean state of a mutable object we needn't have any particular ordering. - - - - - 76fe2b75 by Ben Gamari at 2024-02-01T12:21:30-05:00 codeGen: Use relaxed-read in closureInfoPtr - - - - - a6316eb4 by Ben Gamari at 2024-02-01T12:21:30-05:00 STM: Use acquire loads when possible Full sequential consistency is not needed here. - - - - - 6bddfd3d by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use fence rather than redundant load Previously we would use an atomic load to ensure acquire ordering. However, we now have `ACQUIRE_FENCE_ON`, which allows us to express this more directly. - - - - - 55c65dbc by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Fix data races in profiling timer - - - - - 856b5e75 by Ben Gamari at 2024-02-01T12:21:30-05:00 Add Note [C11 memory model] - - - - - 6534da24 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: move generic cmm optimization logic in NCG to a standalone module This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. - - - - - 87e34888 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. - - - - - c6ce242e by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: enable generic cmm optimizations in wasm backend NCG This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. - - - - - 151dda4e by Andrei Borzenkov at 2024-02-01T12:22:43-05:00 Namespacing for WARNING/DEPRECATED pragmas (#24396) New syntax for WARNING and DEPRECATED pragmas was added, namely namespace specifierss: namespace_spec ::= 'type' | 'data' | {- empty -} warning ::= warning_category namespace_spec namelist strings deprecation ::= namespace_spec namelist strings A new data type was introduced to represent these namespace specifiers: data NamespaceSpecifier = NoSpecifier | TypeNamespaceSpecifier (EpToken "type") | DataNamespaceSpecifier (EpToken "data") Extension field XWarning now contains this NamespaceSpecifier. lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier and checks that the namespace of the found names matches the passed flag. With this change {-# WARNING data D "..." #-} pragma will only affect value namespace and {-# WARNING type D "..." #-} will only affect type namespace. The same logic is applicable to DEPRECATED pragmas. Finding duplicated warnings inside rnSrcWarnDecls now takes into consideration NamespaceSpecifier flag to allow warnings with the same names that refer to different namespaces. - - - - - 38c3afb6 by Bryan Richter at 2024-02-01T12:23:19-05:00 CI: Disable the test-cabal-reinstall job Fixes #24363 - - - - - 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - d60b478e by Matthew Pickering at 2024-03-04T13:29:51+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage2 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage2 package database. * Stage 2 cross compilers need to use stage3 libraries, so likewise, we should set to stage * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. - - - - - 09460671 by Matthew Pickering at 2024-03-04T13:29:52+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 7adcb7f8 by Matthew Pickering at 2024-03-04T13:29:52+00:00 Add missing req_interp modifier to T18441fail3 and T18441fail19 These tests require the interpreter but they were failing in a different way with the javascript backend because the interpreter was disabled and stderr is ignored by the test. - - - - - 2158f919 by Matthew Pickering at 2024-03-04T13:29:52+00:00 Use explicit syntax rather than pure - - - - - 63e1ac91 by Matthew Pickering at 2024-03-04T13:29:52+00:00 ci: Fail when bindist configure fails when installing bindist It is better to fail earlier if the configure step fails rather than carrying on for a more obscure error message. - - - - - dfb541e9 by Matthew Pickering at 2024-03-04T13:29:52+00:00 packaging: correctly propagate build/host/target to bindist configure script At the moment the host and target which we will produce a compiler for is fixed at the initial configure time. Therefore we need to persist the choice made at this time into the installation bindist as well so we look for the right tools, with the right prefixes at install time. In the future, we want to provide a bit more control about what kind of bindist we produce so the logic about what the host/target will have to be written by hadrian rather than persisted by the configure script. In particular with cross compilers we want to either build a normal stage 2 cross bindist or a stage 3 bindist, which creates a bindist which has a native compiler for the target platform. Fixes #21970 - - - - - 955f4b56 by Matthew Pickering at 2024-03-04T13:29:52+00:00 hadrian: Fill in more of the default.host toolchain file When you are building a cross compiler this file will be used to build stage1 and it's libraries, so we need enough information here to work accurately. There is still more work to be done (see for example, word size is still fixed). - - - - - e3d8d1ca by Matthew Pickering at 2024-03-04T13:32:38+00:00 hadrian: Disable docs when cross compiling Before there were a variety of ad-hoc places where doc building was disabled when cross compiling. * Some CI jobs sets --docs=none in gen_ci.hs * Some CI jobs set --docs=none in .gitlab/ci.sh * There was some logic in hadrian to not need the ["docs"] target when making a bindist. Now the situation is simple: * If you are cross compiling then defaultDocsTargets is empty by default. In theory, there is no reason why we can't build documentation for cross compiler bindists, but this is left to future work to generalise the documentation building rules to allow this (#24289) - - - - - f4244482 by Matthew Pickering at 2024-03-04T20:59:26+00:00 hadrian: Build stage 2 cross compilers * Most of hadrian is abstracted over the stage in order to remove the assumption that the target of all stages is the same platform. This allows the RTS to be built for two different targets for example. * Abstracts the bindist creation logic to allow building either normal or cross bindists. Normal bindists use stage 1 libraries and a stage 2 compiler. Cross bindists use stage 2 libararies and a stage 2 compiler. * hadrian: Make binary-dist-dir the default build target. This allows us to have the logic in one place about which libraries/stages to build with cross compilers. Fixes #24192 New hadrian target: * `binary-dist-dir-cross`: Build a cross compiler bindist (compiler = stage 1, libraries = stage 2) ------------------------- Metric Decrease: T10421a T10858 T11195 T11276 T11374 T11822 T15630 T17096 T18478 T20261 Metric Increase: parsing001 ------------------------- - - - - - 30dbe813 by Matthew Pickering at 2024-03-04T20:59:26+00:00 ci: Test cross bindists We remove the special logic for testing in-tree cross compilers and instead test cross compiler bindists, like we do for all other platforms. - - - - - e61efae1 by Matthew Pickering at 2024-03-04T20:59:26+00:00 ci: Javascript don't set CROSS_EMULATOR There is no CROSS_EMULATOR needed to run javascript binaries, so we don't set the CROSS_EMULATOR to some dummy value. - - - - - 78f3bbdc by Matthew Pickering at 2024-03-04T20:59:26+00:00 ci: Introduce CROSS_STAGE variable In preparation for building and testing stage3 bindists we introduce the CROSS_STAGE variable which is used by a CI job to determine what kind of bindist the CI job should produce. At the moment we are only using CROSS_STAGE=2 but in the future we will have some jobs which set CROSS_STAGE=3 to produce native bindists for a target, but produced by a cross compiler, which can be tested on by another CI job on the native platform. CROSS_STAGE=2: Build a normal cross compiler bindist CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target - - - - - 16 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitmodules - CODEOWNERS - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/db2e4a5093908219578157fde598ac6a6beff746...78f3bbdc0b305fc29aff6dc6ee77359f50603ae5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/db2e4a5093908219578157fde598ac6a6beff746...78f3bbdc0b305fc29aff6dc6ee77359f50603ae5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 21:48:06 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Mon, 04 Mar 2024 16:48:06 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Linker: Optimize lookup of dependent relocation Message-ID: <65e64196db9d9_a5db01280eb901364f0@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: 9b73cf29 by Sven Tennie at 2024-03-04T22:45:17+01:00 Linker: Optimize lookup of dependent relocation Always iteration over everything was a real performance issue. Now, start with the second relocation and go back to the first one. Expect it in the same section. - - - - - 1 changed file: - rts/linker/elf_reloc_riscv64.c Changes: ===================================== rts/linker/elf_reloc_riscv64.c ===================================== @@ -356,8 +356,9 @@ bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int32_t addend) { * @param addend The existing addend. Either explicit or implicit. * @return The new computed addend. */ -int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, +int32_t computeAddend(ElfRelocationATable * relaTab, unsigned relNo, Elf_Rel *rel, ElfSymbol *symbol, int64_t addend, ObjectCode *oc) { + Section * section = &oc->sections[relaTab->targetSectionIndex]; /* Position where something is relocated */ addr_t P = (addr_t)((uint8_t *)section->start + rel->r_offset); @@ -372,9 +373,9 @@ int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, int64_t A = addend; - IF_DEBUG(linker, debugBelch("%s: P 0x%lx S 0x%lx %s GOT_S 0x%lx A 0x%lx\n", + IF_DEBUG(linker, debugBelch("%s: P 0x%lx S 0x%lx %s GOT_S 0x%lx A 0x%lx relNo %u\n", relocationTypeToString(rel->r_info), P, S, - symbol->name, GOT_S, A)); + symbol->name, GOT_S, A, relNo)); switch (ELF64_R_TYPE(rel->r_info)) { case R_RISCV_32: return S + A; @@ -400,20 +401,11 @@ int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, // relocations aren't pure, but this is how LLVM does it. And, calculating // the lower 12 bit without any relation ship to the GOT entry's address // makes no sense either. - for (ElfRelocationATable *relaTab = oc->info->relaTable; relaTab != NULL; - relaTab = relaTab->next) { - /* only relocate interesting sections */ - if (SECTIONKIND_OTHER == oc->sections[relaTab->targetSectionIndex].kind) - continue; - - Section *targetSection = &oc->sections[relaTab->targetSectionIndex]; - - for (unsigned i = 0; i < relaTab->n_relocations; i++) { - + for (unsigned i = relNo; i >= 0 ; i--) { Elf_Rela *rel_prime = &relaTab->relocations[i]; addr_t P_prime = - (addr_t)((uint8_t *)targetSection->start + rel_prime->r_offset); + (addr_t)((uint8_t *)section->start + rel_prime->r_offset); if (P_prime != S) { // S points to the P of the corresponding *_HI20 relocation. @@ -438,17 +430,16 @@ int32_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol, IF_DEBUG(linker, debugBelch( "Found matching relocation: %s (P: 0x%lx, S: 0x%lx, " - "sym-name: %s) -> %s (P: 0x%lx, S: 0x%lx, sym-name: %s)", + "sym-name: %s) -> %s (P: 0x%lx, S: 0x%lx, sym-name: %s, relNo: %u)", relocationTypeToString(rel->r_info), P, S, symbol->name, relocationTypeToString(rel_prime->r_info), P_prime, - symbol_prime->addr, symbol_prime->name)); - int32_t result = computeAddend(targetSection, (Elf_Rel *)rel_prime, + symbol_prime->addr, symbol_prime->name, i)); + int32_t result = computeAddend(relaTab, i, (Elf_Rel *)rel_prime, symbol_prime, addend_prime, oc); IF_DEBUG(linker, debugBelch("Result of computeAddend: 0x%x (%d)\n", result, result)); return result; } - } } debugBelch("Missing HI relocation for %s: P 0x%lx S 0x%lx %s\n", relocationTypeToString(rel->r_info), P, S, symbol->name); @@ -566,7 +557,7 @@ bool relocateObjectCodeRISCV64(ObjectCode *oc) { /* decode implicit addend */ int64_t addend = decodeAddendRISCV64(targetSection, rel); - addend = computeAddend(targetSection, rel, symbol, addend, oc); + addend = computeAddend((ElfRelocationATable*) relTab, i, rel, symbol, addend, oc); encodeAddendRISCV64(targetSection, rel, addend); } } @@ -590,7 +581,7 @@ bool relocateObjectCodeRISCV64(ObjectCode *oc) { /* take explicit addend */ int64_t addend = rel->r_addend; - addend = computeAddend(targetSection, (Elf_Rel *)rel, symbol, addend, oc); + addend = computeAddend(relaTab, i, (Elf_Rel *)rel, symbol, addend, oc); encodeAddendRISCV64(targetSection, (Elf_Rel *)rel, addend); } } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b73cf299516bd383b1f14baf073df100d1369dd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b73cf299516bd383b1f14baf073df100d1369dd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 22:31:32 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 04 Mar 2024 17:31:32 -0500 Subject: [Git][ghc/ghc][wip/submodule-bumps] 1699 commits: Propagate failure if unable to push notes Message-ID: <65e64bc449b88_4bf9063c1f86043@gitlab.mail> Ben Gamari pushed to branch wip/submodule-bumps at Glasgow Haskell Compiler / GHC Commits: fb60339f by Bryan Richter at 2023-02-23T14:45:17+02:00 Propagate failure if unable to push notes - - - - - 8e170f86 by Alexis King at 2023-02-23T16:59:22-05:00 rts: Fix `prompt#` when profiling is enabled This commit also adds a new -Dk RTS option to the debug RTS to assist debugging continuation captures. Currently, the printed information is quite minimal, but more can be added in the future if it proves to be useful when debugging future issues. fixes #23001 - - - - - e9e7a00d by sheaf at 2023-02-23T17:00:01-05:00 Explicit migration timeline for loopy SC solving This patch updates the warning message introduced in commit 9fb4ca89bff9873e5f6a6849fa22a349c94deaae to specify an explicit migration timeline: GHC will no longer support this constraint solving mechanism starting from GHC 9.10. Fixes #22912 - - - - - 4eb9c234 by Sylvain Henry at 2023-02-24T17:27:45-05:00 JS: make some arithmetic primops faster (#22835) Don't use BigInt for wordAdd2, mulWord32, and timesInt32. Co-authored-by: Matthew Craven <5086-clyring at users.noreply.gitlab.haskell.org> - - - - - 92e76483 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump terminfo submodule to 0.4.1.6 - - - - - f229db14 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump unix submodule to 2.8.1.0 - - - - - 47bd48c1 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump deepseq submodule to 1.4.8.1 - - - - - d2012594 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump directory submodule to 1.3.8.1 - - - - - df6f70d1 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump process submodule to v1.6.17.0 - - - - - 4c869e48 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump hsc2hs submodule to 0.68.8 - - - - - 81d96642 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump array submodule to 0.5.4.0 - - - - - 6361f771 by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump Cabal submodule to 3.9 pre-release - - - - - 4085fb6c by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump filepath submodule to 1.4.100.1 - - - - - 2bfad50f by Ben Gamari at 2023-02-24T17:28:20-05:00 Bump haskeline submodule to 0.8.2.1 - - - - - fdc89a8d by Ben Gamari at 2023-02-24T21:29:32-05:00 gitlab-ci: Run nix-build with -v0 This significantly cuts down on the amount of noise in the job log. Addresses #22861. - - - - - 69fb0b13 by Aaron Allen at 2023-02-24T21:30:10-05:00 Fix ParallelListComp out of scope suggestion This patch makes it so vars from one block of a parallel list comprehension are not in scope in a subsequent block during type checking. This was causing GHC to emit a faulty suggestion when an out of scope variable shared the occ name of a var from a different block. Fixes #22940 - - - - - ece092d0 by Simon Peyton Jones at 2023-02-24T21:30:45-05:00 Fix shadowing bug in prepareAlts As #23012 showed, GHC.Core.Opt.Simplify.Utils.prepareAlts was using an OutType to construct an InAlt. When shadowing is in play, this is outright wrong. See Note [Shadowing in prepareAlts]. - - - - - 7825fef9 by Sylvain Henry at 2023-02-24T21:31:25-05:00 JS: Store CI perf results (fix #22923) - - - - - b56025f4 by Gergő Érdi at 2023-02-27T13:34:22+00:00 Don't specialise incoherent instance applications Using incoherent instances, there can be situations where two occurrences of the same overloaded function at the same type use two different instances (see #22448). For incoherently resolved instances, we must mark them with `nospec` to avoid the specialiser rewriting one to the other. This marking is done during the desugaring of the `WpEvApp` wrapper. Fixes #22448 Metric Increase: T15304 - - - - - d0c7bbed by Tom Ellis at 2023-02-27T20:04:07-05:00 Fix SCC grouping example - - - - - f84a8cd4 by Bryan Richter at 2023-02-28T05:58:37-05:00 Mark setnumcapabilities001 fragile - - - - - 29a04d6e by Bryan Richter at 2023-02-28T05:58:37-05:00 Allow nightly-x86_64-linux-deb10-validate+thread_sanitizer to fail See #22520 - - - - - 9fa54572 by Cheng Shao at 2023-02-28T05:59:15-05:00 ghc-prim: fix hs_cmpxchg64 function prototype hs_cmpxchg64 must return a StgWord64, otherwise incorrect runtime results of 64-bit MO_Cmpxchg will appear in 32-bit unregisterised builds, which go unnoticed at compile-time due to C implicit casting in .hc files. - - - - - 0c200ab7 by Simon Peyton Jones at 2023-02-28T11:10:31-05:00 Account for local rules in specImports As #23024 showed, in GHC.Core.Opt.Specialise.specImports, we were generating specialisations (a locally-define function) for imported functions; and then generating specialisations for those locally-defined functions. The RULE for the latter should be attached to the local Id, not put in the rules-for-imported-ids set. Fix is easy; similar to what happens in GHC.HsToCore.addExportFlagsAndRules - - - - - 8b77f9bf by Sylvain Henry at 2023-02-28T11:11:21-05:00 JS: fix for overlap with copyMutableByteArray# (#23033) The code wasn't taking into account some kind of overlap. cgrun070 has been extended to test the missing case. - - - - - 239202a2 by Sylvain Henry at 2023-02-28T11:12:03-05:00 Testsuite: replace some js_skip with req_cmm req_cmm is more informative than js_skip - - - - - 7192ef91 by Simon Peyton Jones at 2023-02-28T18:54:59-05:00 Take more care with unlifted bindings in the specialiser As #22998 showed, we were floating an unlifted binding to top level, which breaks a Core invariant. The fix is easy, albeit a little bit conservative. See Note [Care with unlifted bindings] in GHC.Core.Opt.Specialise - - - - - bb500e2a by Simon Peyton Jones at 2023-02-28T18:55:35-05:00 Account for TYPE vs CONSTRAINT in mkSelCo As #23018 showed, in mkRuntimeRepCo we need to account for coercions between TYPE and COERCION. See Note [mkRuntimeRepCo] in GHC.Core.Coercion. - - - - - 79ffa170 by Ben Gamari at 2023-03-01T04:17:20-05:00 hadrian: Add dependency from lib/settings to mk/config.mk In 81975ef375de07a0ea5a69596b2077d7f5959182 we attempted to fix #20253 by adding logic to the bindist Makefile to regenerate the `settings` file from information gleaned by the bindist `configure` script. However, this fix had no effect as `lib/settings` is shipped in the binary distribution (to allow in-place use of the binary distribution). As `lib/settings` already existed and its rule declared no dependencies, `make` would fail to use the added rule to regenerate it. Fix this by explicitly declaring a dependency from `lib/settings` on `mk/config.mk`. Fixes #22982. - - - - - a2a1a1c0 by Sebastian Graf at 2023-03-01T04:17:56-05:00 Revert the main payload of "Make `drop` and `dropWhile` fuse (#18964)" This reverts the bits affecting fusion of `drop` and `dropWhile` of commit 0f7588b5df1fc7a58d8202761bf1501447e48914 and keeps just the small refactoring unifying `flipSeqTake` and `flipSeqScanl'` into `flipSeq`. It also adds a new test for #23021 (which was the reason for reverting) as well as adds a clarifying comment to T18964. Fixes #23021, unfixes #18964. Metric Increase: T18964 Metric Decrease: T18964 - - - - - cf118e2f by Simon Peyton Jones at 2023-03-01T04:18:33-05:00 Refine the test for naughty record selectors The test for naughtiness in record selectors is surprisingly subtle. See the revised Note [Naughty record selectors] in GHC.Tc.TyCl.Utils. Fixes #23038. - - - - - 86f240ca by romes at 2023-03-01T04:19:10-05:00 fix: Consider strictness annotation in rep_bind Fixes #23036 - - - - - 1ed573a5 by Richard Eisenberg at 2023-03-02T22:42:06-05:00 Don't suppress *all* Wanteds Code in GHC.Tc.Errors.reportWanteds suppresses a Wanted if its rewriters have unfilled coercion holes; see Note [Wanteds rewrite Wanteds] in GHC.Tc.Types.Constraint. But if we thereby suppress *all* errors that's really confusing, and as #22707 shows, GHC goes on without even realising that the program is broken. Disaster. This MR arranges to un-suppress them all if they all get suppressed. Close #22707 - - - - - 8919f341 by Luite Stegeman at 2023-03-02T22:42:45-05:00 Check for platform support for JavaScript foreign imports GHC was accepting `foreign import javascript` declarations on non-JavaScript platforms. This adds a check so that these are only supported on an platform that supports the JavaScript calling convention. Fixes #22774 - - - - - db83f8bb by Ben Gamari at 2023-03-02T22:43:22-05:00 rts: Statically assert alignment of Capability In #22965 we noticed that changes in the size of `Capability` can result in unsound behavior due to the `align` pragma claiming an alignment which we don't in practice observe. Avoid this by statically asserting that the size is a multiple of the alignment. - - - - - 5f7a4a6d by Ben Gamari at 2023-03-02T22:43:22-05:00 rts: Introduce stgMallocAlignedBytes - - - - - 8a6f745d by Ben Gamari at 2023-03-02T22:43:22-05:00 rts: Correctly align Capability allocations Previously we failed to tell the C allocator that `Capability`s needed to be aligned, resulting in #22965. Fixes #22965. Fixes #22975. - - - - - 5464c73f by Ben Gamari at 2023-03-02T22:43:22-05:00 rts: Drop no-alignment special case for Windows For reasons that aren't clear, we were previously not giving Capability the same favorable alignment on Windows that we provided on other platforms. Fix this. - - - - - a86aae8b by Matthew Pickering at 2023-03-02T22:43:59-05:00 constant folding: Correct type of decodeDouble_Int64 rule The first argument is Int64# unconditionally, so we better produce something of that type. This fixes a core lint error found in the ad package. Fixes #23019 - - - - - 68dd64ff by Zubin Duggal at 2023-03-02T22:44:35-05:00 ncg/aarch64: Handle MULTILINE_COMMENT identically as COMMENTs Commit 7566fd9de38c67360c090f828923d41587af519c with the fix for #22798 was incomplete as it failed to handle MULTILINE_COMMENT pseudo-instructions, and didn't completly fix the compiler panics when compiling with `-fregs-graph`. Fixes #23002 - - - - - 2f97c861 by Simon Peyton Jones at 2023-03-02T22:45:11-05:00 Get the right in-scope set in etaBodyForJoinPoint Fixes #23026 - - - - - 45af8482 by David Feuer at 2023-03-03T11:40:47-05:00 Export getSolo from Data.Tuple Proposed in [CLC proposal #113](https://github.com/haskell/core-libraries-committee/issues/113) and [approved by the CLC](https://github.com/haskell/core-libraries-committee/issues/113#issuecomment-1452452191) - - - - - 0c694895 by David Feuer at 2023-03-03T11:40:47-05:00 Document getSolo - - - - - bd0536af by Simon Peyton Jones at 2023-03-03T11:41:23-05:00 More fixes for `type data` declarations This MR fixes #23022 and #23023. Specifically * Beef up Note [Type data declarations] in GHC.Rename.Module, to make invariant (I1) explicit, and to name the several wrinkles. And add references to these specific wrinkles. * Add a Lint check for invariant (I1) above. See GHC.Core.Lint.checkTypeDataConOcc * Disable the `caseRules` for dataToTag# for `type data` values. See Wrinkle (W2c) in the Note above. Fixes #23023. * Refine the assertion in dataConRepArgTys, so that it does not complain about the absence of a wrapper for a `type data` constructor Fixes #23022. Acked-by: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - 858f34d5 by Oleg Grenrus at 2023-03-04T01:13:55+02:00 Add decideSymbol, decideChar, decideNat, decTypeRep, decT and hdecT These all type-level equality decision procedures. Implementes a CLC proposal https://github.com/haskell/core-libraries-committee/issues/98 - - - - - bf43ba92 by Simon Peyton Jones at 2023-03-04T01:18:23-05:00 Add test for T22793 - - - - - c6e1f3cd by Chris Wendt at 2023-03-04T03:35:18-07:00 Fix typo in docs referring to threadLabel - - - - - 232cfc24 by Simon Peyton Jones at 2023-03-05T19:57:30-05:00 Add regression test for #22328 - - - - - 5ed77deb by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Enable response files for linker if supported - - - - - 1e0f6c89 by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Synchronize `configure.ac` and `distrib/configure.ac.in` - - - - - 70560952 by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Fix `hadrian/bindist/config.mk.in` … as suggested by @bgamari - - - - - b042b125 by sheaf at 2023-03-06T17:06:50-05:00 Apply 1 suggestion(s) to 1 file(s) - - - - - 674b6b81 by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Try to create somewhat portable `ld` command I cannot figure out a good way to generate an `ld` command that works on both Linux and macOS. Normally you'd use something like `AC_LINK_IFELSE` for this purpose (I think), but that won't let us test response file support. - - - - - 83b0177e by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Quote variables … as suggested by @bgamari - - - - - 845f404d by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Fix configure failure on alpine linux - - - - - c56a3ae6 by Gabriella Gonzalez at 2023-03-06T17:06:50-05:00 Small fixes to configure script - - - - - cad5c576 by Andrei Borzenkov at 2023-03-06T17:07:33-05:00 Convert diagnostics in GHC.Rename.Module to proper TcRnMessage (#20115) I've turned almost all occurrences of TcRnUnknownMessage in GHC.Rename.Module module into a proper TcRnMessage. Instead, these TcRnMessage messages were introduced: TcRnIllegalInstanceHeadDecl TcRnUnexpectedStandaloneDerivingDecl TcRnUnusedVariableInRuleDecl TcRnUnexpectedStandaloneKindSig TcRnIllegalRuleLhs TcRnBadAssocRhs TcRnDuplicateRoleAnnot TcRnDuplicateKindSig TcRnIllegalDerivStrategy TcRnIllegalMultipleDerivClauses TcRnNoDerivStratSpecified TcRnStupidThetaInGadt TcRnBadImplicitSplice TcRnShadowedTyVarNameInFamResult TcRnIncorrectTyVarOnLhsOfInjCond TcRnUnknownTyVarsOnRhsOfInjCond Was introduced one helper type: RuleLhsErrReason - - - - - c6432eac by Apoorv Ingle at 2023-03-06T23:26:12+00:00 Constraint simplification loop now depends on `ExpansionFuel` instead of a boolean flag for `CDictCan.cc_pend_sc`. Pending givens get a fuel of 3 while Wanted and quantified constraints get a fuel of 1. This helps pending given constraints to keep up with pending wanted constraints in case of `UndecidableSuperClasses` and superclass expansions while simplifying the infered type. Adds 3 dynamic flags for controlling the fuels for each type of constraints `-fgivens-expansion-fuel` for givens `-fwanteds-expansion-fuel` for wanteds and `-fqcs-expansion-fuel` for quantified constraints Fixes #21909 Added Tests T21909, T21909b Added Note [Expanding Recursive Superclasses and ExpansionFuel] - - - - - a5afc8ab by Andrew Lelechenko at 2023-03-06T22:51:01-05:00 Documentation: describe laziness of several function from Data.List - - - - - fa559c28 by Ollie Charles at 2023-03-07T20:56:21+00:00 Add `Data.Functor.unzip` This function is currently present in `Data.List.NonEmpty`, but `Data.Functor` is a better home for it. This change was discussed and approved by the CLC at https://github.com/haskell/core-libraries-committee/issues/88. - - - - - 2aa07708 by MorrowM at 2023-03-07T21:22:22-05:00 Fix documentation for traceWith and friends - - - - - f3ff7cb1 by David Binder at 2023-03-08T01:24:17-05:00 Remove utils/hpc subdirectory and its contents - - - - - cf98e286 by David Binder at 2023-03-08T01:24:17-05:00 Add git submodule for utils/hpc - - - - - 605fbbb2 by David Binder at 2023-03-08T01:24:18-05:00 Update commit for utils/hpc git submodule - - - - - 606793d4 by David Binder at 2023-03-08T01:24:18-05:00 Update commit for utils/hpc git submodule - - - - - 4158722a by Sylvain Henry at 2023-03-08T01:24:58-05:00 linker: fix linking with aligned sections (#23066) Take section alignment into account instead of assuming 16 bytes (which is wrong when the section requires 32 bytes, cf #23066). - - - - - 1e0d8fdb by Greg Steuck at 2023-03-08T08:59:05-05:00 Change hostSupportsRPaths to report False on OpenBSD OpenBSD does support -rpath but ghc build process relies on some related features that don't work there. See ghc/ghc#23011 - - - - - bed3a292 by Alexis King at 2023-03-08T08:59:53-05:00 bytecode: Fix bitmaps for BCOs used to tag tuples and prim call args fixes #23068 - - - - - 321d46d9 by Ben Gamari at 2023-03-08T15:02:30-05:00 rts: Drop redundant prototype - - - - - abb6070f by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Fix style - - - - - be278901 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Deduplicate assertion - - - - - b9034639 by Ben Gamari at 2023-03-08T15:02:30-05:00 rts: Fix type issues in Sparks.h Adds explicit casts to satisfy a C++ compiler. - - - - - da7b2b94 by Ben Gamari at 2023-03-08T15:02:30-05:00 rts: Use release ordering when storing thread labels Since this makes the ByteArray# visible from other cores. - - - - - 5b7f6576 by Ben Gamari at 2023-03-08T15:02:30-05:00 rts/BlockAlloc: Allow disabling of internal assertions These can be quite expensive and it is sometimes useful to compile a DEBUG RTS without them. - - - - - 6283144f by Ben Gamari at 2023-03-08T15:02:30-05:00 rts/Sanity: Mark pinned_object_blocks - - - - - 9b528404 by Ben Gamari at 2023-03-08T15:02:30-05:00 rts/Sanity: Look at nonmoving saved_filled lists - - - - - 0edc5438 by Ben Gamari at 2023-03-08T15:02:30-05:00 Evac: Squash data race in eval_selector_chain - - - - - 7eab831a by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Clarify implementation This makes the intent of this implementation a bit clearer. - - - - - 532262b9 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Clarify comment - - - - - bd9cd84b by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Add missing no-op in busy-wait loop - - - - - c4e6bfc8 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Don't push empty arrays to update remembered set Previously the write barrier of resizeSmallArray# incorrectly handled resizing of zero-sized arrays, pushing an invalid pointer to the update remembered set. Fixes #22931. - - - - - 92227b60 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Fix handling of weak pointers This fixes an interaction between aging and weak pointer handling which prevented the finalization of some weak pointers. In particular, weak pointers could have their keys incorrectly marked by the preparatory collector, preventing their finalization by the subsequent concurrent collection. While in the area, we also significantly improve the assertions regarding weak pointers. Fixes #22327. - - - - - ba7e7972 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Sanity check nonmoving large objects and compacts - - - - - 71b038a1 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Sanity check mutable list Assert that entries in the nonmoving generation's generational remembered set (a.k.a. mutable list) live in nonmoving generation. - - - - - 99d144d5 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Don't show occupancy if we didn't collect live words - - - - - 81d6cc55 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Fix tracking of FILLED_SWEEPING segments Previously we only updated the state of the segment at the head of each allocator's filled list. - - - - - 58e53bc4 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Assert state of swept segments - - - - - 2db92e01 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Handle new closures in nonmovingIsNowAlive We must conservatively assume that new closures are reachable since we are not guaranteed to mark such blocks. - - - - - e4c3249f by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Don't clobber update rem sets of old capabilities Previously `storageAddCapabilities` (called by `setNumCapabilities`) would clobber the update remembered sets of existing capabilities when increasing the capability count. Fix this by only initializing the update remembered sets of the newly-created capabilities. Fixes #22927. - - - - - 1b069671 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Add missing write barriers in selector optimisation This fixes the selector optimisation, adding a few write barriers which are necessary for soundness. See the inline comments for details. Fixes #22930. - - - - - d4032690 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Post-sweep sanity checking - - - - - 0baa8752 by Ben Gamari at 2023-03-08T15:02:30-05:00 nonmoving: Avoid n_caps race - - - - - 5d3232ba by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Don't push if nonmoving collector isn't enabled - - - - - 0a7eb0aa by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Be more paranoid in segment tracking Previously we left various segment link pointers dangling. None of this wrong per se, but it did make it harder than necessary to debug. - - - - - 7c817c0a by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Sync-phase mark budgeting Here we significantly improve the bound on sync phase pause times by imposing a limit on the amount of work that we can perform during the sync. If we find that we have exceeded our marking budget then we allow the mutators to resume, return to concurrent marking, and try synchronizing again later. Fixes #22929. - - - - - ce22a3e2 by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Allow pinned gen0 objects to be WEAK keys - - - - - 78746906 by Ben Gamari at 2023-03-08T15:02:31-05:00 rts: Reenable assertion - - - - - b500867a by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Move current segment array into Capability The current segments are conceptually owned by the mutator, not the collector. Consequently, it was quite tricky to prove that the mutator would not race with the collect due to this shared state. It turns out that such races are possible: when resizing the current segment array we may concurrently try to take a heap census. This will attempt to walk the current segment array, causing a data race. Fix this by moving the current segment array into `Capability`, where it belongs. Fixes #22926. - - - - - 56e669c1 by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Fix Note references Some references to Note [Deadlock detection under the non-moving collector] were missing an article. - - - - - 4a7650d7 by Ben Gamari at 2023-03-08T15:02:31-05:00 rts/Sanity: Fix block count assertion with non-moving collector The nonmoving collector does not use `oldest_gen->blocks` to track its block list. However, it nevertheless updates `oldest_gen->n_blocks` to ensure that its size is accounted for by the storage manager. Consequently, we must not attempt to assert consistency between the two. - - - - - 96a5aaed by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Don't call prepareUnloadCheck When the nonmoving GC is in use we do not call `checkUnload` (since we don't unload code) and therefore should not call `prepareUnloadCheck`, lest we run into assertions. - - - - - 6c6674ca by Ben Gamari at 2023-03-08T15:02:31-05:00 rts: Encapsulate block allocator spinlock This makes it a bit easier to add instrumentation on this spinlock while debugging. - - - - - e84f7167 by Ben Gamari at 2023-03-08T15:02:31-05:00 testsuite: Skip some tests when sanity checking is enabled - - - - - 3ae0f368 by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Fix unregisterised build - - - - - 4eb9d06b by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Ensure that sanity checker accounts for saved_filled segments - - - - - f0cf384d by Ben Gamari at 2023-03-08T15:02:31-05:00 hadrian: Add +boot_nonmoving_gc flavour transformer For using GHC bootstrapping to validate the non-moving GC. - - - - - 581e58ac by Ben Gamari at 2023-03-08T15:02:31-05:00 gitlab-ci: Add job bootstrapping with nonmoving GC - - - - - 487a8b58 by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Move allocator into new source file - - - - - 8f374139 by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Split out nonmovingAllocateGC - - - - - 662b6166 by Ben Gamari at 2023-03-08T15:02:31-05:00 testsuite: Only run T22795* in the normal way It doesn't make sense to run these in multiple ways as they merely test whether `-threaded`/`-single-threaded` flags. - - - - - 0af21dfa by Ben Gamari at 2023-03-08T15:02:31-05:00 rts: Rename clear_segment(_free_blocks)? To reflect the fact that these are to do with the nonmoving collector, now since they are exposed no longer static. - - - - - 7bcb192b by Ben Gamari at 2023-03-08T15:02:31-05:00 rts: Fix incorrect STATIC_INLINE This should be INLINE_HEADER lest we get unused declaration warnings. - - - - - f1fd3ffb by Ben Gamari at 2023-03-08T15:02:31-05:00 testsuite: Mark ffi023 as broken due to #23089 - - - - - a57f12b3 by Ben Gamari at 2023-03-08T15:02:31-05:00 testsuite: Skip T7160 in the nonmoving way Finalization order is different under the nonmoving collector. - - - - - f6f12a36 by Ben Gamari at 2023-03-08T15:02:31-05:00 rts: Capture GC configuration in a struct The number of distinct arguments passed to GarbageCollect was getting a bit out of hand. - - - - - ba73a807 by Ben Gamari at 2023-03-08T15:02:31-05:00 nonmoving: Non-concurrent collection - - - - - 7c813d06 by Alexis King at 2023-03-08T15:03:10-05:00 hadrian: Fix flavour compiler stage options off-by-one error !9193 pointed out that ghcDebugAssertions was supposed to be a predicate on the stage of the built compiler, but in practice it was a predicate on the stage of the compiler used to build. Unfortunately, while it fixed that issue for ghcDebugAssertions, it documented every other similar option as behaving the same way when in fact they all used the old behavior. The new behavior of ghcDebugAssertions seems more intuitive, so this commit changes the interpretation of every other option to match. It also improves the enableProfiledGhc and debugGhc flavour transformers by making them more selective about which stages in which they build additional library/RTS ways. - - - - - f97c7f6d by Luite Stegeman at 2023-03-09T09:52:09-05:00 Delete created temporary subdirectories at end of session. This patch adds temporary subdirectories to the list of paths do clean up at the end of the GHC session. This fixes warnings about non-empty temporary directories. Fixes #22952 - - - - - 9ea719f2 by Apoorv Ingle at 2023-03-09T09:52:45-05:00 Fixes #19627. Previously the solver failed with an unhelpful "solver reached too may iterations" error. With the fix for #21909 in place we no longer have the possibility of generating such an error if we have `-fconstraint-solver-iteration` > `-fgivens-fuel > `-fwanteds-fuel`. This is true by default, and the said fix also gives programmers a knob to control how hard the solver should try before giving up. This commit adds: * Reference to ticket #19627 in the Note [Expanding Recursive Superclasses and ExpansionFuel] * Test `typecheck/should_fail/T19627.hs` for regression purposes - - - - - ec2d93eb by Sebastian Graf at 2023-03-10T10:18:54-05:00 DmdAnal: Fix a panic on OPAQUE and trivial/PAP RHS (#22997) We should not panic in `add_demands` (now `set_lam_dmds`), because that code path is legimitely taken for OPAQUE PAP bindings, as in T22997. Fixes #22997. - - - - - 5b4628ae by Sylvain Henry at 2023-03-10T10:19:34-05:00 JS: remove dead code for old integer-gmp - - - - - bab23279 by Josh Meredith at 2023-03-10T23:24:49-05:00 JS: Fix implementation of MK_JSVAL - - - - - ec263a59 by Sebastian Graf at 2023-03-10T23:25:25-05:00 Simplify: Move `wantEtaExpansion` before expensive `do_eta_expand` check There is no need to run arity analysis and what not if we are not in a Simplifier phase that eta-expands or if we don't want to eta-expand the expression in the first place. Purely a refactoring with the goal of improving compiler perf. - - - - - 047e9d4f by Josh Meredith at 2023-03-13T03:56:03+00:00 JS: fix implementation of forceBool to use JS backend syntax - - - - - 559a4804 by Sebastian Graf at 2023-03-13T07:31:23-04:00 Simplifier: `countValArgs` should not count Type args (#23102) I observed miscompilations while working on !10088 caused by this. Fixes #23102. Metric Decrease: T10421 - - - - - 536d1f90 by Matthew Pickering at 2023-03-13T14:04:49+00:00 Bump Win32 to 2.13.4.0 Updates Win32 submodule - - - - - ee17001e by Ben Gamari at 2023-03-13T21:18:24-04:00 ghc-bignum: Drop redundant include-dirs field - - - - - c9c26cd6 by Teo Camarasu at 2023-03-16T12:17:50-04:00 Fix BCO creation setting caps when -j > -N * Remove calls to 'setNumCapabilities' in 'createBCOs' These calls exist to ensure that 'createBCOs' can benefit from parallelism. But this is not the right place to call `setNumCapabilities`. Furthermore the logic differs from that in the driver causing the capability count to be raised and lowered at each TH call if -j > -N. * Remove 'BCOOpts' No longer needed as it was only used to thread the job count down to `createBCOs` Resolves #23049 - - - - - 5ddbf5ed by Teo Camarasu at 2023-03-16T12:17:50-04:00 Add changelog entry for #23049 - - - - - 6e3ce9a4 by Ben Gamari at 2023-03-16T12:18:26-04:00 configure: Fix FIND_CXX_STD_LIB test on Darwin Annoyingly, Darwin's <cstddef> includes <version> and APFS is case-insensitive. Consequently, it will end up #including the `VERSION` file generated by the `configure` script on the second and subsequent runs of the `configure` script. See #23116. - - - - - 19d6d039 by sheaf at 2023-03-16T21:31:22+01:00 ghci: only keep the GlobalRdrEnv in ModInfo The datatype GHC.UI.Info.ModInfo used to store a ModuleInfo, which includes a TypeEnv. This can easily cause space leaks as we have no way of forcing everything in a type environment. In GHC, we only use the GlobalRdrEnv, which we can force completely. So we only store that instead of a fully-fledged ModuleInfo. - - - - - 73d07c6e by Torsten Schmits at 2023-03-17T14:36:49-04:00 Add structured error messages for GHC.Tc.Utils.Backpack Tracking ticket: #20119 MR: !10127 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. One occurrence, when handing a nested error from the interface loading machinery, was omitted. It will be handled by a subsequent changeset that addresses interface errors. - - - - - a13affce by Andrei Borzenkov at 2023-03-21T11:17:17-04:00 Rename () into Unit, (,,...,,) into Tuple<n> (#21294) This patch implements a part of GHC Proposal #475. The key change is in GHC.Tuple.Prim: - data () = () - data (a,b) = (a,b) - data (a,b,c) = (a,b,c) ... + data Unit = () + data Tuple2 a b = (a,b) + data Tuple3 a b c = (a,b,c) ... And the rest of the patch makes sure that Unit and Tuple<n> are pretty-printed as () and (,,...,,) in various contexts. Updates the haddock submodule. Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - 23642bf6 by Adam Sandberg Ericsson at 2023-03-21T11:17:53-04:00 docs: fix some wrongs in the eventlog format documentation - - - - - 90159773 by Adam Sandberg Ericsson at 2023-03-21T11:17:53-04:00 docs: explain the BLOCK_MARKER event - - - - - ab1c25e8 by Adam Sandberg Ericsson at 2023-03-21T11:17:53-04:00 docs: add BlockedOnMVarRead thread status in eventlog encodings - - - - - 898afaef by Adam Sandberg Ericsson at 2023-03-21T11:17:53-04:00 docs: add TASK_DELETE event in eventlog encodings - - - - - bb05b4cc by Adam Sandberg Ericsson at 2023-03-21T11:17:53-04:00 docs: add WALL_CLOCK_TIME event in eventlog encodings - - - - - eeea0343 by Torsten Schmits at 2023-03-21T11:18:34-04:00 Add structured error messages for GHC.Tc.Utils.Env Tracking ticket: #20119 MR: !10129 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - be1d4be8 by Andrew Lelechenko at 2023-03-21T11:19:13-04:00 Document pdep / pext primops - - - - - e8b4aac4 by Alex Mason at 2023-03-21T18:11:04-04:00 Allow LLVM backend to use HDoc for faster file generation. Also remove the MetaStmt constructor from LlvmStatement and places the annotations into the Store statement. Includes “Implement a workaround for -no-asm-shortcutting bug“ (https://gitlab.haskell.org/ghc/ghc/-/commit/2fda9e0df886cc551e2cd6b9c2a384192bdc3045) - - - - - ea24360d by Luite Stegeman at 2023-03-21T18:11:44-04:00 Compute LambdaFormInfo when using JavaScript backend. CmmCgInfos is needed to write interface files, but the JavaScript backend does not generate it, causing "Name without LFInfo" warnings. This patch adds a conservative but always correct CmmCgInfos when the JavaScript backend is used. Fixes #23053 - - - - - 926ad6de by Simon Peyton Jones at 2023-03-22T01:03:08-04:00 Be more careful about quantification This MR is driven by #23051. It does several things: * It is guided by the generalisation plan described in #20686. But it is still far from a complete implementation of that plan. * Add Note [Inferred type with escaping kind] to GHC.Tc.Gen.Bind. This explains that we don't (yet, pending #20686) directly prevent generalising over escaping kinds. * In `GHC.Tc.Utils.TcMType.defaultTyVar` we default RuntimeRep and Multiplicity variables, beause we don't want to quantify over them. We want to do the same for a Concrete tyvar, but there is nothing sensible to default it to (unless it has kind RuntimeRep, in which case it'll be caught by an earlier case). So we promote instead. * Pure refactoring in GHC.Tc.Solver: * Rename decideMonoTyVars to decidePromotedTyVars, since that's what it does. * Move the actual promotion of the tyvars-to-promote from `defaultTyVarsAndSimplify` to `decidePromotedTyVars`. This is a no-op; just tidies up the code. E.g then we don't need to return the promoted tyvars from `decidePromotedTyVars`. * A little refactoring in `defaultTyVarsAndSimplify`, but no change in behaviour. * When making a TauTv unification variable into a ConcreteTv (in GHC.Tc.Utils.Concrete.makeTypeConcrete), preserve the occ-name of the type variable. This just improves error messages. * Kill off dead code: GHC.Tc.Utils.TcMType.newConcreteHole - - - - - 0ab0cc11 by Sylvain Henry at 2023-03-22T01:03:48-04:00 Testsuite: use appropriate predicate for ManyUbxSums test (#22576) - - - - - 048c881e by romes at 2023-03-22T01:04:24-04:00 fix: Incorrect @since annotations in GHC.TypeError Fixes #23128 - - - - - a1528b68 by Sylvain Henry at 2023-03-22T01:05:04-04:00 Testsuite: use req_interp predicate for T16318 (#22370) - - - - - ad765b6f by Sylvain Henry at 2023-03-22T01:05:04-04:00 Testsuite: use req_interp predicate for T20214 - - - - - e0b8eaf3 by Simon Peyton Jones at 2023-03-22T09:50:13+00:00 Refactor the constraint solver pipeline The big change is to put the entire type-equality solver into GHC.Tc.Solver.Equality, rather than scattering it over Canonical and Interact. Other changes * EqCt becomes its own data type, a bit like QCInst. This is great because EqualCtList is then just [EqCt] * New module GHC.Tc.Solver.Dict has come of the class-contraint solver. In due course it will be all. One step at a time. This MR is intended to have zero change in behaviour: it is a pure refactor. It opens the way to subsequent tidying up, we believe. - - - - - cedf9a3b by Torsten Schmits at 2023-03-22T15:31:18-04:00 Add structured error messages for GHC.Tc.Utils.TcMType Tracking ticket: #20119 MR: !10138 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - 30d45e97 by Sylvain Henry at 2023-03-22T15:32:01-04:00 Testsuite: use js_skip for T2615 (#22374) - - - - - 8c98deba by Armando Ramirez at 2023-03-23T09:19:32-04:00 Optimized Foldable methods for Data.Functor.Compose Explicitly define length, elem, etc. in Foldable instance for Data.Functor.Compose Implementation of https://github.com/haskell/core-libraries-committee/issues/57 - - - - - bc066108 by Armando Ramirez at 2023-03-23T09:19:32-04:00 Additional optimized versions - - - - - 80fce576 by Andrew Lelechenko at 2023-03-23T09:19:32-04:00 Simplify minimum/maximum in instance Foldable (Compose f g) - - - - - 8cb88a5a by Andrew Lelechenko at 2023-03-23T09:19:32-04:00 Update changelog to mention changes to instance Foldable (Compose f g) - - - - - e1c8c41d by Torsten Schmits at 2023-03-23T09:20:13-04:00 Add structured error messages for GHC.Tc.TyCl.PatSyn Tracking ticket: #20117 MR: !10158 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - f932c589 by Adam Gundry at 2023-03-24T02:36:09-04:00 Allow WARNING pragmas to be controlled with custom categories Closes #17209. This implements GHC Proposal 541, allowing a WARNING pragma to be annotated with a category like so: {-# WARNING in "x-partial" head "This function is undefined on empty lists." #-} The user can then enable, disable and set the severity of such warnings using command-line flags `-Wx-partial`, `-Werror=x-partial` and so on. There is a new warning group `-Wextended-warnings` containing all these warnings. Warnings without a category are treated as if the category was `deprecations`, and are (still) controlled by the flags `-Wdeprecations` and `-Wwarnings-deprecations`. Updates Haddock submodule. - - - - - 0426515b by Adam Gundry at 2023-03-24T02:36:09-04:00 Move mention of warning groups change to 9.8.1 release notes - - - - - b8d783d2 by Ben Gamari at 2023-03-24T02:36:45-04:00 nativeGen/AArch64: Fix bitmask immediate predicate Previously the predicate for determining whether a logical instruction operand could be encoded as a bitmask immediate was far too conservative. This meant that, e.g., pointer untagged required five instructions whereas it should only require one. Fixes #23030. - - - - - 46120bb6 by Joachim Breitner at 2023-03-24T13:09:43-04:00 User's guide: Improve docs for -Wall previously it would list the warnings _not_ enabled by -Wall. That’s unnecessary round-about and was out of date. So let's just name the relevant warnings (based on `compiler/GHC/Driver/Flags.hs`). - - - - - 509d1f11 by Ben Gamari at 2023-03-24T13:10:20-04:00 codeGen/tsan: Disable instrumentation of unaligned stores There is some disagreement regarding the prototype of `__tsan_unaligned_write` (specifically whether it takes just the written address, or the address and the value as an argument). Moreover, I have observed crashes which appear to be due to it. Disable instrumentation of unaligned stores as a temporary mitigation. Fixes #23096. - - - - - 6a73655f by Li-yao Xia at 2023-03-25T00:02:44-04:00 base: Document GHC versions associated with past base versions in the changelog - - - - - 43bd7694 by Teo Camarasu at 2023-03-25T00:03:24-04:00 Add regression test for #17574 This test currently fails in the nonmoving way - - - - - f2d56bf7 by Teo Camarasu at 2023-03-25T00:03:24-04:00 fix: account for large and compact object stats with nonmoving gc Make sure that we keep track of the size of large and compact objects that have been moved onto the nonmoving heap. We keep track of their size and add it to the amount of live bytes in nonmoving segments to get the total size of the live nonmoving heap. Resolves #17574 - - - - - 7131b705 by David Feuer at 2023-03-25T00:04:04-04:00 Modify ThreadId documentation and comments For a long time, `GHC.Conc.Sync` has said ```haskell -- ToDo: data ThreadId = ThreadId (Weak ThreadId#) -- But since ThreadId# is unlifted, the Weak type must use open -- type variables. ``` We are now actually capable of using `Weak# ThreadId#`, but the world has moved on. To support the `Show` and `Ord` instances, we'd need to store the thread ID number in the `ThreadId`. And it seems very difficult to continue to support `threadStatus` in that regime, since it needs to be able to explain how threads died. In addition, garbage collection of weak references can be quite expensive, and it would be hard to evaluate the cost over he whole ecosystem. As discussed in [this CLC issue](https://github.com/haskell/core-libraries-committee/issues/125), it doesn't seem very likely that we'll actually switch to weak references here. - - - - - c421bbbb by Ben Gamari at 2023-03-25T00:04:41-04:00 rts: Fix barriers of IND and IND_STATIC Previously IND and IND_STATIC lacked the acquire barriers enjoyed by BLACKHOLE. As noted in the (now updated) Note [Heap memory barriers], this barrier is critical to ensure that the indirectee is visible to the entering core. Fixes #22872. - - - - - 62fa7faa by Andrew Lelechenko at 2023-03-25T00:05:22-04:00 Improve documentation of atomicModifyMutVar2# - - - - - b2d14d0b by Cheng Shao at 2023-03-25T03:46:43-04:00 rts: use performBlockingMajorGC in hs_perform_gc and fix ffi023 This patch does a few things: - Add the missing RtsSymbols.c entry of performBlockingMajorGC - Make hs_perform_gc call performBlockingMajorGC, which restores previous behavior - Use hs_perform_gc in ffi023 - Remove rts_clearMemory() call in ffi023, it now works again in some test ways previously marked as broken. Fixes #23089 - - - - - d9ae24ad by Cheng Shao at 2023-03-25T03:46:44-04:00 testsuite: add the rts_clearMemory test case This patch adds a standalone test case for rts_clearMemory that mimics how it's typically used by wasm backend users and ensures this RTS API isn't broken by future RTS refactorings. Fixes #23901. - - - - - 80729d96 by Andrew Lelechenko at 2023-03-25T03:47:22-04:00 Improve documentation for resizing of byte arrays - - - - - c6ec4cd1 by Ben Gamari at 2023-03-25T20:23:47-04:00 rts: Don't rely on EXTERN_INLINE for slop-zeroing logic Previously we relied on calling EXTERN_INLINE functions defined in ClosureMacros.h from Cmm to zero slop. However, as far as I can tell, this is no longer safe to do in C99 as EXTERN_INLINE definitions may be emitted in each compilation unit. Fix this by explicitly declaring a new set of non-inline functions in ZeroSlop.c which can be called from Cmm and marking the ClosureMacros.h definitions as INLINE_HEADER. In the future we should try to eliminate EXTERN_INLINE. - - - - - c32abd4b by Ben Gamari at 2023-03-25T20:23:48-04:00 rts: Fix capability-count check in zeroSlop Previously `zeroSlop` examined `RtsFlags` to determine whether the program was single-threaded. This is wrong; a program may be started with `+RTS -N1` yet the process may later increase the capability count with `setNumCapabilities`. This lead to quite subtle and rare crashes. Fixes #23088. - - - - - 656d4cb3 by Ryan Scott at 2023-03-25T20:24:23-04:00 Add Eq/Ord instances for SSymbol, SChar, and SNat This implements [CLC proposal #148](https://github.com/haskell/core-libraries-committee/issues/148). - - - - - 4f93de88 by David Feuer at 2023-03-26T15:33:02-04:00 Update and expand atomic modification Haddocks * The documentation for `atomicModifyIORef` and `atomicModifyIORef'` were incomplete, and the documentation for `atomicModifyIORef` was out of date. Update and expand. * Remove a useless lazy pattern match in the definition of `atomicModifyIORef`. The pair it claims to match lazily was already forced by `atomicModifyIORef2`. - - - - - e1fb56b2 by David Feuer at 2023-03-26T15:33:41-04:00 Document the constructor name for lists Derived `Data` instances use raw infix constructor names when applicable. The `Data.Data [a]` instance, if derived, would have a constructor name of `":"`. However, it actually uses constructor name `"(:)"`. Document this peculiarity. See https://github.com/haskell/core-libraries-committee/issues/147 - - - - - c1f755c4 by Simon Peyton Jones at 2023-03-27T22:09:41+01:00 Make exprIsConApp_maybe a bit cleverer Addresses #23159. See Note Note [Exploit occ-info in exprIsConApp_maybe] in GHC.Core.SimpleOpt. Compile times go down very slightly, but always go down, never up. Good! Metrics: compile_time/bytes allocated ------------------------------------------------ CoOpt_Singletons(normal) -1.8% T15703(normal) -1.2% GOOD geo. mean -0.1% minimum -1.8% maximum +0.0% Metric Decrease: CoOpt_Singletons T15703 - - - - - 76bb4c58 by Ryan Scott at 2023-03-28T08:12:08-04:00 Add COMPLETE pragmas to TypeRep, SSymbol, SChar, and SNat This implements [CLC proposal #149](https://github.com/haskell/core-libraries-committee/issues/149). - - - - - 3f374399 by sheaf at 2023-03-29T13:57:33+02:00 Handle records in the renamer This patch moves the field-based logic for disambiguating record updates to the renamer. The type-directed logic, scheduled for removal, remains in the typechecker. To do this properly (and fix the myriad of bugs surrounding the treatment of duplicate record fields), we took the following main steps: 1. Create GREInfo, a renamer-level equivalent to TyThing which stores information pertinent to the renamer. This allows us to uniformly treat imported and local Names in the renamer, as described in Note [GREInfo]. 2. Remove GreName. Instead of a GlobalRdrElt storing GreNames, which distinguished between normal names and field names, we now store simple Names in GlobalRdrElt, along with the new GREInfo information which allows us to recover the FieldLabel for record fields. 3. Add namespacing for record fields, within the OccNames themselves. This allows us to remove the mangling of duplicate field selectors. This change ensures we don't print mangled names to the user in error messages, and allows us to handle duplicate record fields in Template Haskell. 4. Move record disambiguation to the renamer, and operate on the level of data constructors instead, to handle #21443. The error message text for ambiguous record updates has also been changed to reflect that type-directed disambiguation is on the way out. (3) means that OccEnv is now a bit more complex: we first key on the textual name, which gives an inner map keyed on NameSpace: OccEnv a ~ FastStringEnv (UniqFM NameSpace a) Note that this change, along with (2), both increase the memory residency of GlobalRdrEnv = OccEnv [GlobalRdrElt], which causes a few tests to regress somewhat in compile-time allocation. Even though (3) simplified a lot of code (in particular the treatment of field selectors within Template Haskell and in error messages), it came with one important wrinkle: in the situation of -- M.hs-boot module M where { data A; foo :: A -> Int } -- M.hs module M where { data A = MkA { foo :: Int } } we have that M.hs-boot exports a variable foo, which is supposed to match with the record field foo that M exports. To solve this issue, we add a new impedance-matching binding to M foo{var} = foo{fld} This mimics the logic that existed already for impedance-binding DFunIds, but getting it right was a bit tricky. See Note [Record field impedance matching] in GHC.Tc.Module. We also needed to be careful to avoid introducing space leaks in GHCi. So we dehydrate the GlobalRdrEnv before storing it anywhere, e.g. in ModIface. This means stubbing out all the GREInfo fields, with the function forceGlobalRdrEnv. When we read it back in, we rehydrate with rehydrateGlobalRdrEnv. This robustly avoids any space leaks caused by retaining old type environments. Fixes #13352 #14848 #17381 #17551 #19664 #21443 #21444 #21720 #21898 #21946 #21959 #22125 #22160 #23010 #23062 #23063 Updates haddock submodule ------------------------- Metric Increase: MultiComponentModules MultiLayerModules MultiLayerModulesDefsGhci MultiLayerModulesNoCode T13701 T14697 hard_hole_fits ------------------------- - - - - - 4f1940f0 by sheaf at 2023-03-29T13:57:33+02:00 Avoid repeatedly shadowing in shadowNames This commit refactors GHC.Type.Name.Reader.shadowNames to first accumulate all the shadowing arising from the introduction of a new set of GREs, and then applies all the shadowing to the old GlobalRdrEnv in one go. - - - - - d246049c by sheaf at 2023-03-29T13:57:34+02:00 igre_prompt_env: discard "only-qualified" names We were unnecessarily carrying around names only available qualified in igre_prompt_env, violating the icReaderEnv invariant. We now get rid of these, as they aren't needed for the shadowing computation that igre_prompt_env exists for. Fixes #23177 ------------------------- Metric Decrease: T14052 T14052Type ------------------------- - - - - - 41a572f6 by Matthew Pickering at 2023-03-29T16:17:21-04:00 hadrian: Fix path to HpcParser.y The source for this project has been moved into a src/ folder so we also need to update this path. Fixes #23187 - - - - - b159e0e9 by doyougnu at 2023-03-30T01:40:08-04:00 js: split JMacro into JS eDSL and JS syntax This commit: Splits JExpr and JStat into two nearly identical DSLs: - GHC.JS.Syntax is the JMacro based DSL without unsaturation, i.e., a value cannot be unsaturated, or, a value of this DSL is a witness that a value of GHC.JS.Unsat has been saturated - GHC.JS.Unsat is the JMacro DSL from GHCJS with Unsaturation. Then all binary and outputable instances are changed to use GHC.JS.Syntax. This moves us closer to closing out #22736 and #22352. See #22736 for roadmap. ------------------------- Metric Increase: CoOpt_Read LargeRecord ManyAlternatives PmSeriesS PmSeriesT PmSeriesV T10421 T10858 T11195 T11374 T11822 T12227 T12707 T13035 T13253 T13253-spj T13379 T14683 T15164 T15703 T16577 T17096 T17516 T17836 T18140 T18282 T18304 T18478 T18698a T18698b T18923 T1969 T19695 T20049 T21839c T3064 T4801 T5321FD T5321Fun T5631 T5642 T783 T9198 T9233 T9630 TcPlugin_RewritePerf WWRec ------------------------- - - - - - f4f1f14f by Sylvain Henry at 2023-03-30T01:40:49-04:00 ghc-heap: remove wrong Addr# coercion (#23181) Conversion from Addr# to I# isn't correct with the JS backend. Also used the opportunity to reenable 64-bit Word/Int tests - - - - - a5360490 by Ben Gamari at 2023-03-30T01:41:25-04:00 testsuite: Fix racing prints in T21465 As noted in #23155, we previously failed to add flushes necessary to ensure predictable output. Fixes #23155. - - - - - 98b5cf67 by Matthew Pickering at 2023-03-30T09:58:40+01:00 Revert "ghc-heap: remove wrong Addr# coercion (#23181)" This reverts commit f4f1f14f8009c3c120b8b963ec130cbbc774ec02. This fails to build with GHC-9.2 as a boot compiler. See #23195 for tracking this issue. - - - - - 61a2dfaa by Andrew Lelechenko at 2023-03-30T14:35:57-04:00 Add {-# WARNING #-} to Data.List.{head,tail} - - - - - 8f15c47c by Andrew Lelechenko at 2023-03-30T14:35:57-04:00 Fixes to accomodate Data.List.{head,tail} with {-# WARNING #-} - - - - - 7c7dbade by Andrew Lelechenko at 2023-03-30T14:35:57-04:00 Bump submodules - - - - - d2d8251b by Andrew Lelechenko at 2023-03-30T14:35:57-04:00 Fix tests - - - - - 3d38dcb6 by sheaf at 2023-03-30T14:35:57-04:00 Proxies for head and tail: review suggestions - - - - - 930edcfd by sheaf at 2023-03-30T14:36:33-04:00 docs: move RecordUpd changelog entry to 9.8 This was accidentally included in the 9.6 changelog instead of the 9.6 changelog. - - - - - 6f885e65 by sheaf at 2023-03-30T14:37:09-04:00 Add LANGUAGE GADTs to GHC.Rename.Env We need to enable this extension for the file to compile with ghc 9.2, as we are pattern matching on a GADT and this required the GADT extension to be enabled until 9.4. - - - - - 6d6a37a8 by Cheng Shao at 2023-03-30T18:42:56+00:00 ci: make lint-ci-config job fast again We don't pin our nixpkgs revision and tracks the default nixpkgs-unstable channel anyway. Instead of using haskell.packages.ghc924, we should be using haskell.packages.ghc92 to maximize the binary cache hit rate and make lint-ci-config job fast again. Also bumps the nix docker image to the latest revision. - - - - - ef1548c4 by Cheng Shao at 2023-03-30T18:42:56+00:00 ci: ensure that all non-i386 pipelines do parallel xz compression We can safely enable parallel xz compression for non-i386 pipelines. However, previously we didn't export XZ_OPT, so the xz process won't see it if XZ_OPT hasn't already been set in the current job. - - - - - 20432d16 by Cheng Shao at 2023-03-30T18:42:56+00:00 ci: unset CROSS_EMULATOR for js job - - - - - 4a24dbbe by Cheng Shao at 2023-03-30T18:42:56+00:00 ci: fix lint-testsuite job The list_broken make target will transitively depend on the calibrate.out target, which used STAGE1_GHC instead of TEST_HC. It really should be TEST_HC since that's what get passed in the gitlab CI config. - - - - - cea56ccc by Cheng Shao at 2023-03-30T18:42:56+00:00 ci: use alpine3_17-wasm image for wasm jobs Bump the ci-images dependency and use the new alpine3_17-wasm docker image for wasm jobs. - - - - - 79d0cb32 by Ben Gamari at 2023-03-30T18:43:53+00:00 testsuite/driver: Add basic support for testing cross-compilers - - - - - e7392b4e by Ben Gamari at 2023-03-30T18:43:53+00:00 testsuite/driver: Normalize away differences in ghc executable name - - - - - ee160d06 by Ben Gamari at 2023-03-30T18:43:53+00:00 hadrian: Pass CROSS_EMULATOR to runtests.py - - - - - 30c84511 by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: don't add optllvm way for wasm32 - - - - - f1beee36 by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: normalize the .wasm extension - - - - - a984a103 by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: strip the cross ghc prefix in output and error message - - - - - f7478d95 by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: handle target executable extension - - - - - 8fe8b653 by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: mypy typing error fixes This patch fixes some mypy typing errors which weren't caught in previous linting jobs. - - - - - 0149f32f by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: use context variable instead of thread-local variable This patch changes a thread-local variable to context variable instead, which works as intended when the testsuite transitions to use asyncio & coroutines instead of multi-threading to concurrently run test cases. Note that this also raises the minimum Python version to 3.7. - - - - - ea853ff0 by Cheng Shao at 2023-03-30T18:43:53+00:00 testsuite: asyncify the testsuite driver This patch refactors the testsuite driver, gets rid of multi-threading logic for running test cases concurrently, and uses asyncio & coroutines instead. This is not yak shaving for its own sake; the previous multi-threading logic is prone to livelock/deadlock conditions for some reason, even if the total number of threads is bounded to a thread pool's capacity. The asyncify change is an internal implementation detail of the testsuite driver and does not impact most GHC maintainers out there. The patch does not touch the .T files, test cases can be added/modified the exact same way as before. - - - - - 0077cb22 by Matthew Pickering at 2023-03-31T21:28:28-04:00 Add test for T23184 There was an outright bug, which Simon fixed in July 2021, as a little side-fix on a complicated patch: ``` commit 6656f0165a30fc2a22208532ba384fc8e2f11b46 Author: Simon Peyton Jones <simonpj at microsoft.com> Date: Fri Jul 23 23:57:01 2021 +0100 A bunch of changes related to eta reduction This is a large collection of changes all relating to eta reduction, originally triggered by #18993, but there followed a long saga. Specifics: ...lots of lines omitted... Other incidental changes * Fix a fairly long-standing outright bug in the ApplyToVal case of GHC.Core.Opt.Simplify.mkDupableContWithDmds. I was failing to take the tail of 'dmds' in the recursive call, which meant the demands were All Wrong. I have no idea why this has not caused problems before now. ``` Note this "Fix a fairly longstanding outright bug". This is the specific fix ``` @@ -3552,8 +3556,8 @@ mkDupableContWithDmds env dmds -- let a = ...arg... -- in [...hole...] a -- NB: sc_dup /= OkToDup; that is caught earlier by contIsDupable - do { let (dmd:_) = dmds -- Never fails - ; (floats1, cont') <- mkDupableContWithDmds env dmds cont + do { let (dmd:cont_dmds) = dmds -- Never fails + ; (floats1, cont') <- mkDupableContWithDmds env cont_dmds cont ; let env' = env `setInScopeFromF` floats1 ; (_, se', arg') <- simplArg env' dup se arg ; (let_floats2, arg'') <- makeTrivial env NotTopLevel dmd (fsLit "karg") arg' ``` Ticket #23184 is a report of the bug that this diff fixes. - - - - - 62d25071 by mangoiv at 2023-04-01T04:20:01-04:00 [feat] make ($) representation polymorphic - this change was approved by the CLC in [1] following a CLC proposal [2] - make ($) representation polymorphic (adjust the type signature) - change ($) implementation to allow additional polymorphism - adjust the haddock of ($) to reflect these changes - add additional documentation to document these changes - add changelog entry - adjust tests (move now succeeding tests and adjust stdout of some tests) [1] https://github.com/haskell/core-libraries-committee/issues/132#issuecomment-1487456854 [2] https://github.com/haskell/core-libraries-committee/issues/132 - - - - - 77c33fb9 by Artem Pelenitsyn at 2023-04-01T04:20:41-04:00 User Guide: update copyright year: 2020->2023 - - - - - 3b5be05a by doyougnu at 2023-04-01T09:42:31-04:00 driver: Unit State Data.Map -> GHC.Unique.UniqMap In pursuit of #22426. The driver and unit state are major contributors. This commit also bumps the haddock submodule to reflect the API changes in UniqMap. ------------------------- Metric Decrease: MultiComponentModules MultiComponentModulesRecomp T10421 T10547 T12150 T12234 T12425 T13035 T16875 T18140 T18304 T18698a T18698b T18923 T20049 T5837 T6048 T9198 ------------------------- - - - - - a84fba6e by Torsten Schmits at 2023-04-01T09:43:12-04:00 Add structured error messages for GHC.Tc.TyCl Tracking ticket: #20117 MR: !10183 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - 6e2eb275 by doyougnu at 2023-04-01T18:27:56-04:00 JS: Linker: use saturated JExpr Follow on to MR!10142 in pursuit of #22736 - - - - - 3da69346 by sheaf at 2023-04-01T18:28:37-04:00 Improve haddocks of template-haskell Con datatype This adds a bit more information, in particular about the lists of constructors in the GadtC and RecGadtC cases. - - - - - 3b7bbb39 by sheaf at 2023-04-01T18:28:37-04:00 TH: revert changes to GadtC & RecGadtC Commit 3f374399 included a breaking-change to the template-haskell library when it made the GadtC and RecGadtC constructors take non-empty lists of names. As this has the potential to break many users' packages, we decided to revert these changes for now. - - - - - f60f6110 by Andrew Lelechenko at 2023-04-02T18:59:30-04:00 Rework documentation for data Char - - - - - 43ebd5dc by Andrew Lelechenko at 2023-04-02T19:00:09-04:00 cmm: implement parsing of MO_AtomicRMW from hand-written CMM files Fixes #23206 - - - - - ab9cd52d by Sylvain Henry at 2023-04-03T08:15:21-04:00 ghc-heap: remove wrong Addr# coercion (#23181) Conversion from Addr# to I# isn't correct with the JS backend. - - - - - 2b2afff3 by Matthew Pickering at 2023-04-03T08:15:58-04:00 hadrian: Update bootstrap plans for 9.2.6, 9.2.7, 9.4.4, 9.4.5, 9.6.1 Also fixes the ./generate_bootstrap_plans script which was recently broken We can hopefully drop the 9.2 plans soon but they still work so kept them around for now. - - - - - c2605e25 by Matthew Pickering at 2023-04-03T08:15:58-04:00 ci: Add job to test 9.6 bootstrapping - - - - - 53e4d513 by Krzysztof Gogolewski at 2023-04-03T08:16:35-04:00 hadrian: Improve option parsing Several options in Hadrian had their argument marked as optional (`OptArg`), but if the argument wasn't there they were just giving an error. It's more idiomatic to mark the argument as required instead; the code uses less Maybes, the parser can enforce that the argument is present, --help gives better output. - - - - - a8e36892 by Sylvain Henry at 2023-04-03T08:17:16-04:00 JS: fix issues with FD api support - Add missing implementations for fcntl_read/write/lock - Fix fdGetMode These were found while implementing TH in !9779. These functions must be used somehow by the external interpreter code. - - - - - 8b092910 by Haskell-mouse at 2023-04-03T19:31:26-04:00 Convert diagnostics in GHC.Rename.HsType to proper TcRnMessage I've turned all occurrences of TcRnUnknownMessage in GHC.Rename.HsType module into a proper TcRnMessage. Instead, these TcRnMessage messages were introduced: TcRnDataKindsError TcRnUnusedQuantifiedTypeVar TcRnIllegalKindSignature TcRnUnexpectedPatSigType TcRnSectionPrecedenceError TcRnPrecedenceParsingError TcRnIllegalKind TcRnNegativeNumTypeLiteral TcRnUnexpectedKindVar TcRnBindMultipleVariables TcRnBindVarAlreadyInScope - - - - - 220a7a48 by Krzysztof Gogolewski at 2023-04-03T19:32:02-04:00 Fixes around unsafeCoerce# 1. `unsafeCoerce#` was documented in `GHC.Prim`. But since the overhaul in 74ad75e87317, `unsafeCoerce#` is no longer defined there. I've combined the documentation in `GHC.Prim` with the `Unsafe.Coerce` module. 2. The documentation of `unsafeCoerce#` stated that you should not cast a function to an algebraic type, even if you later cast it back before applying it. But ghci was doing that type of cast, as can be seen with 'ghci -ddump-ds' and typing 'x = not'. I've changed it to use Any following the documentation. - - - - - 9095e297 by Matthew Craven at 2023-04-04T01:04:10-04:00 Add a few more memcpy-ish primops * copyMutableByteArrayNonOverlapping# * copyAddrToAddr# * copyAddrToAddrNonOverlapping# * setAddrRange# The implementations of copyBytes, moveBytes, and fillBytes in base:Foreign.Marshal.Utils now use these new primops, which can cause us to work a bit harder generating code for them, resulting in the metric increase in T21839c observed by CI on some architectures. But in exchange, we get better code! Metric Increase: T21839c - - - - - f7da530c by Matthew Craven at 2023-04-04T01:04:10-04:00 StgToCmm: Upgrade -fcheck-prim-bounds behavior Fixes #21054. Additionally, we can now check for range overlap when generating Cmm for primops that use memcpy internally. - - - - - cd00e321 by sheaf at 2023-04-04T01:04:50-04:00 Relax assertion in varToRecFieldOcc When using Template Haskell, it is possible to re-parent a field OccName belonging to one data constructor to another data constructor. The lsp-types package did this in order to "extend" a data constructor with additional fields. This ran into an assertion in 'varToRecFieldOcc'. This assertion can simply be relaxed, as the resulting splices are perfectly sound. Fixes #23220 - - - - - eed0d930 by Sylvain Henry at 2023-04-04T11:09:15-04:00 GHCi.RemoteTypes: fix doc and avoid unsafeCoerce (#23201) - - - - - 071139c3 by Ryan Scott at 2023-04-04T11:09:51-04:00 Make INLINE pragmas for pattern synonyms work with TH Previously, the code for converting `INLINE <name>` pragmas from TH splices used `vNameN`, which assumed that `<name>` must live in the variable namespace. Pattern synonyms, on the other hand, live in the constructor namespace. I've fixed the issue by switching to `vcNameN` instead, which works for both the variable and constructor namespaces. Fixes #23203. - - - - - 7c16f3be by Krzysztof Gogolewski at 2023-04-04T17:13:00-04:00 Fix unification with oversaturated type families unify_ty was incorrectly saying that F x y ~ T x are surely apart, where F x y is an oversaturated type family and T x is a tyconapp. As a result, the simplifier dropped a live case alternative (#23134). - - - - - c165f079 by sheaf at 2023-04-04T17:13:40-04:00 Add testcase for #23192 This issue around solving of constraints arising from superclass expansion using other constraints also borned from superclass expansion was the topic of commit aed1974e. That commit made sure we don't emit a "redundant constraint" warning in a situation in which removing the constraint would cause errors. Fixes #23192 - - - - - d1bb16ed by Ben Gamari at 2023-04-06T03:40:45-04:00 nonmoving: Disable slop-zeroing As noted in #23170, the nonmoving GC can race with a mutator zeroing the slop of an updated thunk (in much the same way that two mutators would race). Consequently, we must disable slop-zeroing when the nonmoving GC is in use. Closes #23170 - - - - - 04b80850 by Brandon Chinn at 2023-04-06T03:41:21-04:00 Fix reverse flag for -Wunsupported-llvm-version - - - - - 0c990e13 by Pierre Le Marre at 2023-04-06T10:16:29+00:00 Add release note for GHC.Unicode refactor in base-4.18. Also merge CLC proposal 130 in base-4.19 with CLC proposal 59 in base-4.18 and add proper release date. - - - - - cbbfb283 by Alex Dixon at 2023-04-07T18:27:45-04:00 Improve documentation for ($) (#22963) - - - - - 5193c2b0 by Alex Dixon at 2023-04-07T18:27:45-04:00 Remove trailing whitespace from ($) commentary - - - - - b384523b by Sebastian Graf at 2023-04-07T18:27:45-04:00 Adjust wording wrt representation polymorphism of ($) - - - - - 6a788f0a by Torsten Schmits at 2023-04-07T22:29:28-04:00 Add structured error messages for GHC.Tc.TyCl.Utils Tracking ticket: #20117 MR: !10251 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - 3ba77b36 by sheaf at 2023-04-07T22:30:07-04:00 Renamer: don't call addUsedGRE on an exact Name When looking up a record field in GHC.Rename.Env.lookupRecFieldOcc, we could end up calling addUsedGRE on an exact Name, which would then lead to a panic in the bestImport function: it would be incapable of processing a GRE which is not local but also not brought into scope by any imports (as it is referred to by its unique instead). Fixes #23240 - - - - - bc4795d2 by Krzysztof Gogolewski at 2023-04-11T19:24:54-04:00 Add support for -debug in the testsuite Confusingly, GhcDebugged referred to GhcDebugAssertions. - - - - - b7474b57 by Krzysztof Gogolewski at 2023-04-11T19:24:54-04:00 Add missing cases in -Di prettyprinter Fixes #23142 - - - - - 6c392616 by Cheng Shao at 2023-04-11T19:25:31-04:00 compiler: make WasmCodeGenM an instance of MonadUnique - - - - - 05d26a65 by Cheng Shao at 2023-04-11T19:25:31-04:00 compiler: apply cmm node-splitting for wasm backend This patch applies cmm node-splitting for wasm32 NCG, which is required when handling irreducible CFGs. Fixes #23237. - - - - - f1892cc0 by Andrew Lelechenko at 2023-04-11T19:26:09-04:00 Set base 'maintainer' field to CLC - - - - - ecf22da3 by Simon Peyton Jones at 2023-04-11T19:26:45-04:00 Clarify a couple of Notes about 'nospec' - - - - - ebd8918b by Oleg Grenrus at 2023-04-12T12:32:57-04:00 Allow generation of TTH syntax with TH In other words allow generation of typed splices and brackets with Untyped Template Haskell. That is useful in cases where a library is build with TTH in mind, but we still want to generate some auxiliary declarations, where TTH cannot help us, but untyped TH can. Such example is e.g. `staged-sop` which works with TTH, but we would like to derive `Generic` declarations with TH. An alternative approach is to use `unsafeCodeCoerce`, but then the derived `Generic` instances would be type-checked only at use sites, i.e. much later. Also `-ddump-splices` output is quite ugly: user-written instances would use TTH brackets, not `unsafeCodeCoerce`. This commit doesn't allow generating of untyped template splices and brackets with untyped TH, as I don't know why one would want to do that (instead of merging the splices, e.g.) - - - - - 690d0225 by Rodrigo Mesquita at 2023-04-12T12:33:33-04:00 Add regression test for #23229 - - - - - 59321879 by Sylvain Henry at 2023-04-13T08:50:33-04:00 Add quotRem rules (#22152) case quotRemInt# x y of (# q, _ #) -> body ====> case quotInt# x y of q -> body case quotRemInt# x y of (# _, r #) -> body ====> case remInt# x y of r -> body - - - - - 4dd02122 by Sylvain Henry at 2023-04-13T08:50:33-04:00 Add quot folding rule (#22152) (x / l1) / l2 l1 and l2 /= 0 l1*l2 doesn't overflow ==> x / (l1 * l2) - - - - - 1148ac72 by Sylvain Henry at 2023-04-13T08:50:33-04:00 Make Int64/Word64 division ok for speculation too. Only when the divisor is definitely non-zero. - - - - - 8af401cc by Sylvain Henry at 2023-04-13T08:50:33-04:00 Make WordQuotRem2Op ok-for-speculation too - - - - - 27d2978e by Josh Meredith at 2023-04-13T08:51:09-04:00 Base/JS: GHC.JS.Foreign.Callback module (issue 23126) * Add the Callback module for "exporting" Haskell functions to be available to plain JavaScript code * Fix some primitives defined in GHC.JS.Prim * Add a JavaScript section to the user guide with instructions on how to use the JavaScript FFI, building up to using Callbacks to interact with the browser * Add tests for the JavaScript FFI and Callbacks - - - - - a34aa8da by Adam Sandberg Ericsson at 2023-04-14T04:17:52-04:00 rts: improve memory ordering and add some comments in the StablePtr implementation - - - - - d7a768a4 by Matthew Pickering at 2023-04-14T04:18:28-04:00 docs: Generate docs/index.html with version number * Generate docs/index.html to include the version of the ghc library * This also fixes the packageVersions interpolations which were - Missing an interpolation for `LIBRARY_ghc_VERSION` - Double quoting the version so that "9.7" was being inserted. Fixes #23121 - - - - - d48fbfea by Simon Peyton Jones at 2023-04-14T04:19:05-04:00 Stop if type constructors have kind errors Otherwise we get knock-on errors, such as #23252. This makes GHC fail a bit sooner, and I have not attempted to add recovery code, to add a fake TyCon place of the erroneous one, in an attempt to get more type errors in one pass. We could do that (perhaps) if there was a call for it. - - - - - 2371d6b2 by Simon Peyton Jones at 2023-04-14T20:01:02+02:00 Major refactor in the handling of equality constraints This MR substantially refactors the way in which the constraint solver deals with equality constraints. The big thing is: * Intead of a pipeline in which we /first/ canonicalise and /then/ interact (the latter including performing unification) the two steps are more closely integreated into one. That avoids the current rather indirect communication between the two steps. The proximate cause for this refactoring is fixing #22194, which involve solving [W] alpha[2] ~ Maybe (F beta[4]) by doing this: alpha[2] := Maybe delta[2] [W] delta[2] ~ F beta[4] That is, we don't promote beta[4]! This is very like introducing a cycle breaker, and was very awkward to do before, but now it is all nice. See GHC.Tc.Utils.Unify Note [Promotion and level-checking] and Note [Family applications in canonical constraints]. The big change is this: * Several canonicalisation checks (occurs-check, cycle-breaking, checking for concreteness) are combined into one new function: GHC.Tc.Utils.Unify.checkTyEqRhs This function is controlled by `TyEqFlags`, which says what to do for foralls, type families etc. * `canEqCanLHSFinish` now sees if unification is possible, and if so, actually does it: see `canEqCanLHSFinish_try_unification`. There are loads of smaller changes: * The on-the-fly unifier `GHC.Tc.Utils.Unify.unifyType` has a cheap-and-cheerful version of `checkTyEqRhs`, called `simpleUnifyCheck`. If `simpleUnifyCheck` succeeds, it can unify, otherwise it defers by emitting a constraint. This is simpler than before. * I simplified the swapping code in `GHC.Tc.Solver.Equality.canEqCanLHS`. Especially the nasty stuff involving `swap_for_occurs` and `canEqTyVarFunEq`. Much nicer now. See Note [Orienting TyVarLHS/TyFamLHS] Note [Orienting TyFamLHS/TyFamLHS] * Added `cteSkolemOccurs`, `cteConcrete`, and `cteCoercionHole` to the problems that can be discovered by `checkTyEqRhs`. * I fixed #23199 `pickQuantifiablePreds`, which actually allows GHC to to accept both cases in #22194 rather than rejecting both. Yet smaller: * Added a `synIsConcrete` flag to `SynonymTyCon` (alongside `synIsFamFree`) to reduce the need for synonym expansion when checking concreteness. Use it in `isConcreteType`. * Renamed `isConcrete` to `isConcreteType` * Defined `GHC.Core.TyCo.FVs.isInjectiveInType` as a more efficient way to find if a particular type variable is used injectively than finding all the injective variables. It is called in `GHC.Tc.Utils.Unify.definitely_poly`, which in turn is used quite a lot. * Moved `rewriterView` to `GHC.Core.Type`, so we can use it from the constraint solver. Fixes #22194, #23199 Compile times decrease by an average of 0.1%; but there is a 7.4% drop in compiler allocation on T15703. Metric Decrease: T15703 - - - - - 99b2734b by Simon Peyton Jones at 2023-04-14T20:01:02+02:00 Add some documentation about redundant constraints - - - - - 3f2d0eb8 by Simon Peyton Jones at 2023-04-14T20:01:02+02:00 Improve partial signatures This MR fixes #23223. The changes are in two places: * GHC.Tc.Bind.checkMonomorphismRestriction See the new `Note [When the MR applies]` We now no longer stupidly attempt to apply the MR when the user specifies a context, e.g. f :: Eq a => _ -> _ * GHC.Tc.Solver.decideQuantification See rewritten `Note [Constraints in partial type signatures]` Fixing this bug apparently breaks three tests: * partial-sigs/should_compile/T11192 * partial-sigs/should_fail/Defaulting1MROff * partial-sigs/should_fail/T11122 However they are all symptoms of #23232, so I'm marking them as expect_broken(23232). I feel happy about this MR. Nice. - - - - - 23e2a8a0 by Simon Peyton Jones at 2023-04-14T20:01:02+02:00 Make approximateWC a bit cleverer This MR fixes #23224: making approximateWC more clever See the long `Note [ApproximateWC]` in GHC.Tc.Solver All this is delicate and ad-hoc -- but it /has/ to be: we are talking about inferring a type for a binding in the presence of GADTs, type families and whatnot: known difficult territory. We just try as hard as we can. - - - - - 2c040246 by Matthew Pickering at 2023-04-15T00:57:14-04:00 docs: Update template-haskell docs to use Code Q a rather than Q (TExp a) Since GHC Proposal #195, the type of [|| ... ||] has been Code Q a rather than Q (TExp a). The documentation in the `template-haskell` library wasn't updated to reflect this change. Fixes #23148 - - - - - 0da18eb7 by Krzysztof Gogolewski at 2023-04-15T14:35:53+02:00 Show an error when we cannot default a concrete tyvar Fixes #23153 - - - - - bad2f8b8 by sheaf at 2023-04-15T15:14:36+02:00 Handle ConcreteTvs in inferResultToType inferResultToType was discarding the ir_frr information, which meant some metavariables ended up being MetaTvs instead of ConcreteTvs. This function now creates new ConcreteTvs as necessary, instead of always creating MetaTvs. Fixes #23154 - - - - - 3b0ea480 by Simon Peyton Jones at 2023-04-16T18:12:20-04:00 Transfer DFunId_ness onto specialised bindings Whether a binding is a DFunId or not has consequences for the `-fdicts-strict` flag, essentially if we are doing demand analysis for a DFunId then `-fdicts-strict` does not apply because the constraint solver can create recursive groups of dictionaries. In #22549 this was fixed for the "normal" case, see Note [Do not strictify the argument dictionaries of a dfun]. However the loop still existed if the DFunId was being specialised. The problem was that the specialiser would specialise a DFunId and turn it into a VanillaId and so the demand analyser didn't know to apply special treatment to the binding anymore and the whole recursive group was optimised to bottom. The solution is to transfer over the DFunId-ness of the binding in the specialiser so that the demand analyser knows not to apply the `-fstrict-dicts`. Fixes #22549 - - - - - a1371ebb by Oleg Grenrus at 2023-04-16T18:12:59-04:00 Add import lists to few GHC.Driver.Session imports Related to https://gitlab.haskell.org/ghc/ghc/-/issues/23261. There are a lot of GHC.Driver.Session which only use DynFlags, but not the parsing code. - - - - - 51479ceb by Matthew Pickering at 2023-04-17T08:08:48-04:00 Account for special GHC.Prim import in warnUnusedPackages The GHC.Prim import is treated quite specially primarily because there isn't an interface file for GHC.Prim. Therefore we record separately in the ModSummary if it's imported or not so we don't go looking for it. This logic hasn't made it's way to `-Wunused-packages` so if you imported GHC.Prim then the warning would complain you didn't use `-package ghc-prim`. Fixes #23212 - - - - - 1532a8b2 by Simon Peyton Jones at 2023-04-17T08:09:24-04:00 Add regression test for #23199 - - - - - 0158c5f1 by Ryan Scott at 2023-04-17T18:43:27-04:00 validDerivPred: Reject exotic constraints in IrredPreds This brings the `IrredPred` case in sync with the treatment of `ClassPred`s as described in `Note [Valid 'deriving' predicate]` in `GHC.Tc.Validity`. Namely, we should reject `IrredPred`s that are inferred from `deriving` clauses whose arguments contain other type constructors, as described in `(VD2) Reject exotic constraints` of that Note. This has the nice property that `deriving` clauses whose inferred instance context mention `TypeError` will now emit the type error in the resulting error message, which better matches existing intuitions about how `TypeError` should work. While I was in town, I noticed that much of `Note [Valid 'deriving' predicate]` was duplicated in a separate `Note [Exotic derived instance contexts]` in `GHC.Tc.Deriv.Infer`. I decided to fold the latter Note into the former so that there is a single authority on describing the conditions under which an inferred `deriving` constraint can be considered valid. This changes the behavior of `deriving` in a way that existing code might break, so I have made a mention of this in the GHC User's Guide. It seems very, very unlikely that much code is relying on this strange behavior, however, and even if there is, there is a clear, backwards-compatible migration path using `StandaloneDeriving`. Fixes #22696. - - - - - 10364818 by Krzysztof Gogolewski at 2023-04-17T18:44:03-04:00 Misc cleanup - Use dedicated list functions - Make cloneBndrs and cloneRecIdBndrs monadic - Fix invalid haddock comments in libraries/base - - - - - 5e1d33d7 by Matthew Pickering at 2023-04-18T10:31:02-04:00 Convert interface file loading errors into proper diagnostics This patch converts all the errors to do with loading interface files into proper structured diagnostics. * DriverMessage: Sometimes in the driver we attempt to load an interface file so we embed the IfaceMessage into the DriverMessage. * TcRnMessage: Most the time we are loading interface files during typechecking, so we embed the IfaceMessage This patch also removes the TcRnInterfaceLookupError constructor which is superceded by the IfaceMessage, which is now structured compared to just storing an SDoc before. - - - - - df1a5811 by sheaf at 2023-04-18T10:31:43-04:00 Don't panic in ltPatersonSize The function GHC.Tc.Utils.TcType.ltPatersonSize would panic when it encountered a type family on the RHS, as usually these are not allowed (type families are not allowed on the RHS of class instances or of quantified constraints). However, it is possible to still encounter type families on the RHS after doing a bit of constraint solving, as seen in test case T23171. This could trigger the panic in the call to ltPatersonSize in GHC.Tc.Solver.Canonical.mk_strict_superclasses, which is involved in avoiding loopy superclass constraints. This patch simply changes ltPatersonSize to return "I don't know, because there's a type family involved" in these cases. Fixes #23171 - - - - - d442ac05 by Sylvain Henry at 2023-04-19T20:04:35-04:00 JS: fix thread-related primops - - - - - 7a96f90b by Bryan Richter at 2023-04-19T20:05:11-04:00 CI: Disable abi-test-nightly See #23269 - - - - - ab6c1d29 by Sylvain Henry at 2023-04-19T20:05:50-04:00 Testsuite: don't use obsolescent egrep (#22351) Recent egrep displays the following message, breaking golden tests: egrep: warning: egrep is obsolescent; using grep -E Switch to using "grep -E" instead - - - - - f15b0ce5 by Matthew Pickering at 2023-04-20T11:01:06-04:00 hadrian: Pass haddock file arguments in a response file In !10119 CI was failing on windows because the command line was too long. We can mitigate this by passing the file arguments to haddock in a response file. We can't easily pass all the arguments in a response file because the `+RTS` arguments can't be placed in the response file. Fixes #23273 - - - - - 7012ec2f by tocic at 2023-04-20T11:01:42-04:00 Fix doc typo in GHC.Read.readList - - - - - 5c873124 by sheaf at 2023-04-20T18:33:34-04:00 Implement -jsem: parallelism controlled by semaphores See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a complete description for the motivation for this feature. The `-jsem` option allows a build tool to pass a semaphore to GHC which GHC can use in order to control how much parallelism it requests. GHC itself acts as a client in the GHC jobserver protocol. ``` GHC Jobserver Protocol ~~~~~~~~~~~~~~~~~~~~~~ This proposal introduces the GHC Jobserver Protocol. This protocol allows a server to dynamically invoke many instances of a client process, while restricting all of those instances to use no more than <n> capabilities. This is achieved by coordination over a system semaphore (either a POSIX semaphore [6]_ in the case of Linux and Darwin, or a Win32 semaphore [7]_ in the case of Windows platforms). There are two kinds of participants in the GHC Jobserver protocol: - The *jobserver* creates a system semaphore with a certain number of available tokens. Each time the jobserver wants to spawn a new jobclient subprocess, it **must** first acquire a single token from the semaphore, before spawning the subprocess. This token **must** be released once the subprocess terminates. Once work is finished, the jobserver **must** destroy the semaphore it created. - A *jobclient* is a subprocess spawned by the jobserver or another jobclient. Each jobclient starts with one available token (its *implicit token*, which was acquired by the parent which spawned it), and can request more tokens through the Jobserver Protocol by waiting on the semaphore. Each time a jobclient wants to spawn a new jobclient subprocess, it **must** pass on a single token to the child jobclient. This token can either be the jobclient's implicit token, or another token which the jobclient acquired from the semaphore. Each jobclient **must** release exactly as many tokens as it has acquired from the semaphore (this does not include the implicit tokens). ``` Build tools such as cabal act as jobservers in the protocol and are responsibile for correctly creating, cleaning up and managing the semaphore. Adds a new submodule (semaphore-compat) for managing and interacting with semaphores in a cross-platform way. Fixes #19349 - - - - - 52d3e9b4 by Ben Gamari at 2023-04-20T18:34:11-04:00 rts: Initialize Array# header in listThreads# Previously the implementation of listThreads# failed to initialize the header of the created array, leading to various nastiness. Fixes #23071 - - - - - 1db30fe1 by Ben Gamari at 2023-04-20T18:34:11-04:00 testsuite: Add test for #23071 - - - - - dae514f9 by tocic at 2023-04-21T13:31:21-04:00 Fix doc typos in libraries/base/GHC - - - - - 113e21d7 by Sylvain Henry at 2023-04-21T13:32:01-04:00 Testsuite: replace some js_broken/js_skip predicates with req_c Using req_c is more precise. - - - - - 038bb031 by Krzysztof Gogolewski at 2023-04-21T18:03:04-04:00 Minor doc fixes - Add docs/index.html to .gitignore. It is created by ./hadrian/build docs, and it was the only file in Hadrian's templateRules not present in .gitignore. - Mention that MultiWayIf supports non-boolean guards - Remove documentation of optdll - removed in 2007, 763daed95 - Fix markdown syntax - - - - - e826cdb2 by amesgen at 2023-04-21T18:03:44-04:00 User's guide: DeepSubsumption is implied by Haskell{98,2010} - - - - - 499a1c20 by PHO at 2023-04-23T13:39:32-04:00 Implement executablePath for Solaris and make getBaseDir less platform-dependent Use base-4.17 executablePath when possible, and fall back on getExecutablePath when it's not available. The sole reason why getBaseDir had #ifdef's was apparently that getExecutablePath wasn't reliable, and we could reduce the number of CPP conditionals by making use of executablePath instead. Also export executablePath on js_HOST_ARCH. - - - - - 97a6f7bc by tocic at 2023-04-23T13:40:08-04:00 Fix doc typos in libraries/base - - - - - 787c6e8c by Ben Gamari at 2023-04-24T12:19:06-04:00 testsuite/T20137: Avoid impl.-defined behavior Previously we would cast pointers to uint64_t. However, implementations are allowed to either zero- or sign-extend such casts. Instead cast to uintptr_t to avoid this. Fixes #23247. - - - - - 87095f6a by Cheng Shao at 2023-04-24T12:19:44-04:00 rts: always build 64-bit atomic ops This patch does a few things: - Always build 64-bit atomic ops in rts/ghc-prim, even on 32-bit platforms - Remove legacy "64bit" cabal flag of rts package - Fix hs_xchg64 function prototype for 32-bit platforms - Fix AtomicFetch test for wasm32 - - - - - 2685a12d by Cheng Shao at 2023-04-24T12:20:21-04:00 compiler: don't install signal handlers when the host platform doesn't have signals Previously, large parts of GHC API will transitively invoke withSignalHandlers, which doesn't work on host platforms without signal functionality at all (e.g. wasm32-wasi). By making withSignalHandlers a no-op on those platforms, we can make more parts of GHC API work out of the box when signals aren't supported. - - - - - 1338b7a3 by Cheng Shao at 2023-04-24T16:21:30-04:00 hadrian: fix non-ghc program paths passed to testsuite driver when testing cross GHC - - - - - 1a10f556 by Andrew Lelechenko at 2023-04-24T16:22:09-04:00 Add since pragma to Data.Functor.unzip - - - - - 0da9e882 by Soham Chowdhury at 2023-04-25T00:15:22-04:00 More informative errors for bad imports (#21826) - - - - - ebd5b078 by Josh Meredith at 2023-04-25T00:15:58-04:00 JS/base: provide implementation for mkdir (issue 22374) - - - - - 8f656188 by Josh Meredith at 2023-04-25T18:12:38-04:00 JS: Fix h$base_access implementation (issue 22576) - - - - - 74c55712 by Andrei Borzenkov at 2023-04-25T18:13:19-04:00 Give more guarntees about ImplicitParams (#23289) - Added new section in the GHC user's guide that legends behavior of nested implicit parameter bindings in these two cases: let ?f = 1 in let ?f = 2 in ?f and data T where MkT :: (?f :: Int) => T f :: T -> T -> Int f MkT MkT = ?f - Added new test case to examine this behavior. - - - - - c30ac25f by Sebastian Graf at 2023-04-26T14:50:51-04:00 DmdAnal: Unleash demand signatures of free RULE and unfolding binders (#23208) In #23208 we observed that the demand signature of a binder occuring in a RULE wasn't unleashed, leading to a transitively used binder being discarded as absent. The solution was to use the same code path that we already use for handling exported bindings. See the changes to `Note [Absence analysis for stable unfoldings and RULES]` for more details. I took the chance to factor out the old notion of a `PlusDmdArg` (a pair of a `VarEnv Demand` and a `Divergence`) into `DmdEnv`, which fits nicely into our existing framework. As a result, I had to touch quite a few places in the code. This refactoring exposed a few small bugs around correct handling of bottoming demand environments. As a result, some strictness signatures now mention uniques that weren't there before which caused test output changes to T13143, T19969 and T22112. But these tests compared whole -ddump-simpl listings which is a very fragile thing to begin with. I changed what exactly they test for based on the symptoms in the corresponding issues. There is a single regression in T18894 because we are more conservative around stable unfoldings now. Unfortunately it is not easily fixed; let's wait until there is a concrete motivation before invest more time. Fixes #23208. - - - - - 77f506b8 by Josh Meredith at 2023-04-26T14:51:28-04:00 Refactor GenStgRhs to include the Type in both constructors (#23280, #22576, #22364) Carry the actual type of an expression through the PreStgRhs and into GenStgRhs for use in later stages. Currently this is used in the JavaScript backend to fix some tests from the above mentioned issues: EtaExpandLevPoly, RepPolyWrappedVar2, T13822, T14749. - - - - - 052e2bb6 by Alan Zimmerman at 2023-04-26T14:52:05-04:00 EPA: Use ExplicitBraces only in HsModule !9018 brought in exact print annotations in LayoutInfo for open and close braces at the top level. But it retained them in the HsModule annotations too. Remove the originals, so exact printing uses LayoutInfo - - - - - d5c4629b by Cheng Shao at 2023-04-27T16:00:35-04:00 ci: update ci.sh to actually run the entire testsuite for wasm backend For the time being, we still need to use in-tree mode and can't test the bindist yet. - - - - - 533d075e by Cheng Shao at 2023-04-27T16:00:35-04:00 ci: additional wasm32 manual jobs in validate pipelines This patch enables bignum native & unregisterised wasm32 jobs as manual jobs in validate pipelines, which can be useful to prevent breakage when working on wasm32 related patches. - - - - - b5f00811 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: fix cross prefix stripping This patch fixes cross prefix stripping in the testsuite driver. The normalization logic used to only handle prefixes of the triple form <arch>-<vendor>-<os>, now it's relaxed to allow any number of tokens in the prefix tuple, so the cross prefix stripping logic would work when ghc is configured with something like --target=wasm32-wasi. - - - - - 6f511c36 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: include target exe extension in heap profile filenames This patch fixes hp2ps related framework failures when testing the wasm backend by including target exe extension in heap profile filenames. - - - - - e6416b10 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: exclude ghci ways if no rts linker is present This patch implements logic to automatically exclude ghci ways when there is no rts linker. It's way better than having to annotate individual test cases. - - - - - 791cce64 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: fix permission bits in copy_files When the testsuite driver copy files instead of symlinking them, it should also copy the permission bits, otherwise there'll be permission denied errors. Also, enforce file copying when testing wasm32, since wasmtime doesn't handle host symlinks quite well (https://github.com/bytecodealliance/wasmtime/issues/6227). - - - - - aa6afe8a by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: add the req_ghc_with_threaded_rts predicate This patch adds the req_ghc_with_threaded_rts predicate to the testsuite to assert the platform has threaded RTS, and mark some tests as req_ghc_with_threaded_rts. Also makes ghc_with_threaded_rts a config field instead of a global variable. - - - - - ce580426 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: add the req_process predicate This patch adds the req_process predicate to the testsuite to assert the platform has a process model, also marking tests that involve spawning processes as req_process. Also bumps hpc & process submodule. - - - - - cb933665 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: add the req_host_target_ghc predicate This patch adds the req_host_target_ghc predicate to the testsuite to assert the ghc compiler being tested can compile both host/target code. When testing cross GHCs this is not supported yet, but it may change in the future. - - - - - b174a110 by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: add missing annotations for some tests This patch adds missing annotations (req_th, req_dynamic_lib_support, req_rts_linker) to some tests. They were discovered when testing wasm32, though it's better to be explicit about what features they require, rather than simply adding when(arch('wasm32'), skip). - - - - - bd2bfdec by Cheng Shao at 2023-04-27T16:00:35-04:00 testsuite: wasm32-specific fixes This patch includes all wasm32-specific testsuite fixes. - - - - - 4eaf2c2a by Josh Meredith at 2023-04-27T16:01:11-04:00 JS: change GHC.JS.Transform.identsS/E/V to take a saturated IR (#23304) - - - - - 57277662 by sheaf at 2023-04-29T20:23:06+02:00 Add the Unsatisfiable class This commit implements GHC proposal #433, adding the Unsatisfiable class to the GHC.TypeError module. This provides an alternative to TypeError for which error reporting is more predictable: we report it when we are reporting unsolved Wanted constraints. Fixes #14983 #16249 #16906 #18310 #20835 - - - - - 00a8a5ff by Torsten Schmits at 2023-04-30T03:45:09-04:00 Add structured error messages for GHC.Rename.Names Tracking ticket: #20115 MR: !10336 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - 931c8d82 by Ben Orchard at 2023-05-03T20:16:18-04:00 Add sized primitive literal syntax Adds a new LANGUAGE pragma ExtendedLiterals, which enables defining unboxed numeric literals such as `0xFF#Word8 :: Word8#`. Implements GHC proposal 0451: https://github.com/ghc-proposals/ghc-proposals/blob/b384a538b34f79d18a0201455b7b3c473bc8c936/proposals/0451-sized-literals.rst Fixes #21422. Bumps haddock submodule. Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski at tweag.io> - - - - - f3460845 by Andrew Lelechenko at 2023-05-03T20:16:57-04:00 Document instances of Double - - - - - 1e9caa1a by Sylvain Henry at 2023-05-03T20:17:37-04:00 Bump Cabal submodule (#22356) - - - - - 4eafb52a by sheaf at 2023-05-03T20:18:16-04:00 Don't forget to check the parent in an export list Commit 3f374399 introduced a bug which caused us to forget to include the parent of an export item of the form T(..) (that is, IEThingAll) when checking for duplicate exports. Fixes #23318 - - - - - 8fde4ac8 by amesgen at 2023-05-03T20:18:57-04:00 Fix unlit path in cross bindists - - - - - 8cc9a534 by Matthew Pickering at 2023-05-04T14:58:14-04:00 hadrian: Flavour: Change args -> extraArgs Previously in a flavour definition you could override all the flags which were passed to GHC. This causes issues when needed to compute a package hash because we need to know what these extra arguments are going to be before computing the hash. The solution is to modify flavour so that the arguments you pass here are just extra ones rather than all the arguments that you need to compile something. This makes things work more like how cabal.project files work when you give extra arguments to a package and also means that flavour transformers correctly affect the hash. - - - - - 3fdb18f8 by romes at 2023-05-04T14:58:14-04:00 Hardwire a better unit-id for ghc Previously, the unit-id of ghc-the-library was fixed as `ghc`. This was done primarily because the compiler must know the unit-id of some packages (including ghc) a-priori to define wired-in names. However, as seen in #20742, a reinstallable `ghc` whose unit-id is fixed to `ghc` might result in subtle bugs when different ghc's interact. A good example of this is having GHC_A load a plugin compiled by GHC_B, where GHC_A and GHC_B are linked to ghc-libraries that are ABI incompatible. Without a distinction between the unit-id of the ghc library GHC_A is linked against and the ghc library the plugin it is loading was compiled against, we can't check compatibility. This patch gives a slightly better unit-id to ghc (ghc-version) by (1) Not setting -this-unit-id to ghc, but rather to the new unit-id (modulo stage0) (2) Adding a definition to `GHC.Settings.Config` whose value is the new unit-id. (2.1) `GHC.Settings.Config` is generated by Hadrian (2.2) and also by cabal through `compiler/Setup.hs` This unit-id definition is imported by `GHC.Unit.Types` and used to set the wired-in unit-id of "ghc", which was previously fixed to "ghc" The commits following this one will improve the unit-id with a cabal-style package hash and check compatibility when loading plugins. Note that we also ensure that ghc's unit key matches unit id both when hadrian or cabal builds ghc, and in this way we no longer need to add `ghc` to the WiringMap. - - - - - 6689c9c6 by romes at 2023-05-04T14:58:14-04:00 Validate compatibility of ghcs when loading plugins Ensure, when loading plugins, that the ghc the plugin depends on is the ghc loading the plugin -- otherwise fail to load the plugin. Progress towards #20742. - - - - - db4be339 by romes at 2023-05-04T14:58:14-04:00 Add hashes to unit-ids created by hadrian This commit adds support for computing an inputs hash for packages compiled by hadrian. The result is that ABI incompatible packages should be given different hashes and therefore be distinct in a cabal store. Hashing is enabled by the `--flag`, and is off by default as the hash contains a hash of the source files. We enable it when we produce release builds so that the artifacts we distribute have the right unit ids. - - - - - 944a9b94 by Matthew Pickering at 2023-05-04T14:58:14-04:00 Use hash-unit-ids in release jobs Includes fix upload_ghc_libs glob - - - - - 116d7312 by Josh Meredith at 2023-05-04T14:58:51-04:00 JS: fix bounds checking (Issue 23123) * For ByteArray-based bounds-checking, the JavaScript backend must use the `len` field, instead of the inbuild JavaScript `length` field. * Range-based operations must also check both the start and end of the range for bounds * All indicies are valid for ranges of size zero, since they are essentially no-ops * For cases of ByteArray accesses (e.g. read as Int), the end index is (i * sizeof(type) + sizeof(type) - 1), while the previous implementation uses (i + sizeof(type) - 1). In the Int32 example, this is (i * 4 + 3) * IndexByteArrayOp_Word8As* primitives use byte array indicies (unlike the previous point), but now check both start and end indicies * Byte array copies now check if the arrays are the same by identity and then if the ranges overlap. - - - - - 2d5c1dde by Sylvain Henry at 2023-05-04T14:58:51-04:00 Fix remaining issues with bound checking (#23123) While fixing these I've also changed the way we store addresses into ByteArray#. Addr# are composed of two parts: a JavaScript array and an offset (32-bit number). Suppose we want to store an Addr# in a ByteArray# foo at offset i. Before this patch, we were storing both fields as a tuple in the "arr" array field: foo.arr[i] = [addr_arr, addr_offset]; Now we only store the array part in the "arr" field and the offset directly in the array: foo.dv.setInt32(i, addr_offset): foo.arr[i] = addr_arr; It avoids wasting space for the tuple. - - - - - 98c5ee45 by Luite Stegeman at 2023-05-04T14:59:31-04:00 JavaScript: Correct arguments to h$appendToHsStringA fixes #23278 - - - - - ca611447 by Josh Meredith at 2023-05-04T15:00:07-04:00 base/encoding: add an allocations performance test (#22946) - - - - - e3ddf58d by Krzysztof Gogolewski at 2023-05-04T15:00:44-04:00 linear types: Don't add external names to the usage env This has no observable effect, but avoids storing useless data. - - - - - b3226616 by Andrei Borzenkov at 2023-05-04T15:01:25-04:00 Improved documentation for the Data.OldList.nub function There was recomentation to use map head . group . sort instead of nub function, but containers library has more suitable and efficient analogue - - - - - e8b72ff6 by Ryan Scott at 2023-05-04T15:02:02-04:00 Fix type variable substitution in gen_Newtype_fam_insts Previously, `gen_Newtype_fam_insts` was substituting the type variable binders of a type family instance using `substTyVars`, which failed to take type variable dependencies into account. There is similar code in `GHC.Tc.TyCl.Class.tcATDefault` that _does_ perform this substitution properly, so this patch: 1. Factors out this code into a top-level `substATBndrs` function, and 2. Uses `substATBndrs` in `gen_Newtype_fam_insts`. Fixes #23329. - - - - - 275836d2 by Torsten Schmits at 2023-05-05T08:43:02+00:00 Add structured error messages for GHC.Rename.Utils Tracking ticket: #20115 MR: !10350 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - 983ce558 by Oleg Grenrus at 2023-05-05T13:11:29-04:00 Use TemplateHaskellQuotes in TH.Syntax to construct Names - - - - - a5174a59 by Matthew Pickering at 2023-05-05T18:42:31-04:00 driver: Use hooks from plugin_hsc_env This fixes a bug in oneshot mode where hooks modified in a plugin wouldn't be used in oneshot mode because we neglected to use the right hsc_env. This was observed by @csabahruska. - - - - - 18a7d03d by Aaron Allen at 2023-05-05T18:42:31-04:00 Rework plugin initialisation points In general this patch pushes plugin initialisation points to earlier in the pipeline. As plugins can modify the `HscEnv`, it's imperative that the plugins are initialised as soon as possible and used thereafter. For example, there are some new tests which modify hsc_logger and other hooks which failed to fire before (and now do) One consequence of this change is that the error for specifying the usage of a HPT plugin from the command line has changed, because it's now attempted to be loaded at initialisation rather than causing a cyclic module import. Closes #21279 Co-authored-by: Matthew Pickering <matthewtpickering at gmail.com> - - - - - 6e776ed3 by Matthew Pickering at 2023-05-05T18:42:31-04:00 docs: Add Note [Timing of plugin initialization] - - - - - e1df8511 by Matthew Pickering at 2023-05-05T18:43:07-04:00 Incrementally update ghcup metadata in ghc/ghcup-metadata This job paves the way for distributing nightly builds * A new repo https://gitlab.haskell.org/ghc/ghcup-metadata stores the metadata on the "updates" branch. * Each night this metadata is downloaded and the nightly builds are appended to the end of the metadata. * The update job only runs on the scheduled nightly pipeline, not just when NIGHTLY=1. Things which are not done yet * Modify the retention policy for nightly jobs * Think about building release flavour compilers to distribute nightly. Fixes #23334 - - - - - 8f303d27 by Rodrigo Mesquita at 2023-05-05T22:04:31-04:00 docs: Remove mentions of ArrayArray# from unlifted FFI section Fixes #23277 - - - - - 994bda56 by Torsten Schmits at 2023-05-05T22:05:12-04:00 Add structured error messages for GHC.Rename.Module Tracking ticket: #20115 MR: !10361 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. Only addresses the single warning missing from the previous MR. - - - - - 3e3a6be4 by Ben Gamari at 2023-05-08T12:15:19+00:00 rts: Fix data-race in hs_init_ghc As noticed by @Terrorjack, `hs_init_ghc` previously used non-atomic increment/decrement on the RTS's initialization count. This may go wrong in a multithreaded program which initializes the runtime multiple times. Closes #22756. - - - - - 78c8dc50 by Torsten Schmits at 2023-05-08T21:41:51-04:00 Add structured error messages for GHC.IfaceToCore Tracking ticket: #20114 MR: !10390 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. - - - - - 0e2df4c9 by Bryan Richter at 2023-05-09T12:03:35+03:00 Fix up rules for ghcup-metadata-nightly-push - - - - - b970e64f by Ben Gamari at 2023-05-09T08:41:33-04:00 testsuite: Add test for atomicSwapIORef - - - - - 81cfefd2 by Ben Gamari at 2023-05-09T08:41:53-04:00 compiler: Implement atomicSwapIORef with xchg As requested by @treeowl in CLC#139. - - - - - 6b29154d by Ben Gamari at 2023-05-09T08:41:53-04:00 Make atomicSwapMutVar# an inline primop - - - - - 64064cfe by doyougnu at 2023-05-09T18:40:01-04:00 JS: add GHC.JS.Optimizer, remove RTS.Printer, add Linker.Opt This MR changes some simple optimizations and is a first step in re-architecting the JS backend pipeline to add the optimizer. In particular it: - removes simple peep hole optimizations from `GHC.StgToJS.Printer` and removes that module - adds module `GHC.JS.Optimizer` - defines the same peep hole opts that were removed only now they are `Syntax -> Syntax` transformations rather than `Syntax -> JS code` optimizations - hooks the optimizer into code gen - adds FuncStat and ForStat constructors to the backend. Working Ticket: - #22736 Related MRs: - MR !10142 - MR !10000 ------------------------- Metric Decrease: CoOpt_Read ManyAlternatives PmSeriesS PmSeriesT PmSeriesV T10421 T12707 T13253 T13253-spj T15164 T17516 T18140 T18282 T18698a T18698b T18923 T1969 T19695 T20049 T3064 T5321FD T5321Fun T783 T9198 T9233 T9630 ------------------------- - - - - - 6738c01d by Krzysztof Gogolewski at 2023-05-09T18:40:38-04:00 Add a regression test for #21050 - - - - - b2cdb7da by Ben Gamari at 2023-05-09T18:41:14-04:00 nonmoving: Account for mutator allocations in bytes_allocated Previously we failed to account direct mutator allocations into the nonmoving heap against the mutator's allocation limit and `cap->total_allocated`. This only manifests during CAF evaluation (since we allocate the CAF's blackhole directly into the nonmoving heap). Fixes #23312. - - - - - 0657b482 by Sven Tennie at 2023-05-09T22:22:42-04:00 Adjust AArch64 stackFrameHeaderSize The prologue of each stack frame are the saved LR and FP registers, 8 byte each. I.e. the size of the stack frame header is 2 * 8 byte. - - - - - 7788c09c by konsumlamm at 2023-05-09T22:23:23-04:00 Make `(&)` representation polymorphic in the return type - - - - - b3195922 by Ben Gamari at 2023-05-10T05:06:45-04:00 ghc-prim: Generalize keepAlive#/touch# in state token type Closes #23163. - - - - - 1e6861dd by Cheng Shao at 2023-05-10T05:07:25-04:00 Bump hsc2hs submodule Fixes #22981. - - - - - 0a513952 by Ben Gamari at 2023-05-11T04:10:17-04:00 base: Export GHC.Conc.Sync.fromThreadId Closes #22706. - - - - - 29be39ba by Matthew Pickering at 2023-05-11T04:10:54-04:00 Build vanilla alpine bindists We currently attempt to build and distribute fully static alpine bindists (ones which could be used on any linux platform) but most people who use the alpine bindists want to use alpine to build their own static applications (for which a fully static bindist is not necessary). We should build and distribute these bindists for these users whilst the fully-static bindist is still unusable. Fixes #23349 - - - - - 40c7daed by Simon Peyton Jones at 2023-05-11T04:11:30-04:00 Look both ways when looking for quantified equalities When looking up (t1 ~# t2) in the quantified constraints, check both orientations. Forgetting this led to #23333. - - - - - c17bb82f by Rodrigo Mesquita at 2023-05-11T04:12:07-04:00 Move "target has RTS linker" out of settings We move the "target has RTS linker" information out of configure into a predicate in GHC, and remove this option from the settings file where it is unnecessary -- it's information statically known from the platform. Note that previously we would consider `powerpc`s and `s390x`s other than `powerpc-ibm-aix*` and `s390x-ibm-linux` to have an RTS linker, but the RTS linker supports neither platform. Closes #23361 - - - - - bd0b056e by Krzysztof Gogolewski at 2023-05-11T04:12:44-04:00 Add a test for #17284 Since !10123 we now reject this program. - - - - - 630b1fea by Andrew Lelechenko at 2023-05-11T04:13:24-04:00 Document unlawfulness of instance Num Fixed Fixes #22712 - - - - - 87eebf98 by sheaf at 2023-05-11T11:55:22-04:00 Add fused multiply-add instructions This patch adds eight new primops that fuse a multiplication and an addition or subtraction: - `{fmadd,fmsub,fnmadd,fnmsub}{Float,Double}#` fmadd x y z is x * y + z, computed with a single rounding step. This patch implements code generation for these primops in the following backends: - X86, AArch64 and PowerPC NCG, - LLVM - C WASM uses the C implementation. The primops are unsupported in the JavaScript backend. The following constant folding rules are also provided: - compute a * b + c when a, b, c are all literals, - x * y + 0 ==> x * y, - ±1 * y + z ==> z ± y and x * ±1 + z ==> z ± x. NB: the constant folding rules incorrectly handle signed zero. This is a known limitation with GHC's floating-point constant folding rules (#21227), which we hope to resolve in the future. - - - - - ad16a066 by Krzysztof Gogolewski at 2023-05-11T11:55:59-04:00 Add a test for #21278 - - - - - 05cea68c by Matthew Pickering at 2023-05-11T11:56:36-04:00 rts: Refine memory retention behaviour to account for pinned/compacted objects When using the copying collector there is still a lot of data which isn't copied (such as pinned, compacted, large objects etc). The logic to decide how much memory to retain didn't take into account that these wouldn't be copied. Therefore we pessimistically retained 2* the amount of memory for these blocks even though they wouldn't be copied by the collector. The solution is to split up the heap into two parts, the parts which will be copied and the parts which won't be copied. Then the appropiate factor is applied to each part individually (2 * for copying and 1.2 * for not copying). The T23221 test demonstrates this improvement with a program which first allocates many unpinned ByteArray# followed by many pinned ByteArray# and observes the difference in the ultimate memory baseline between the two. There are some charts on #23221. Fixes #23221 - - - - - 1bb24432 by Cheng Shao at 2023-05-11T11:57:15-04:00 hadrian: fix no_dynamic_libs flavour transformer This patch fixes the no_dynamic_libs flavour transformer and make fully_static reuse it. Previously building with no_dynamic_libs fails since ghc program is still dynamic and transitively brings in dyn ways of rts which are produced by no rules. - - - - - 0ed493a3 by Josh Meredith at 2023-05-11T23:08:27-04:00 JS: refactor jsSaturate to return a saturated JStat (#23328) - - - - - a856d98e by Pierre Le Marre at 2023-05-11T23:09:08-04:00 Doc: Fix out-of-sync using-optimisation page - Make explicit that default flag values correspond to their -O0 value. - Fix -fignore-interface-pragmas, -fstg-cse, -fdo-eta-reduction, -fcross-module-specialise, -fsolve-constant-dicts, -fworker-wrapper. - - - - - c176ad18 by sheaf at 2023-05-12T06:10:57-04:00 Don't panic in mkNewTyConRhs This function could come across invalid newtype constructors, as we only perform validity checking of newtypes once we are outside the knot-tied typechecking loop. This patch changes this function to fake up a stub type in the case of an invalid newtype, instead of panicking. This patch also changes "checkNewDataCon" so that it reports as many errors as possible at once. Fixes #23308 - - - - - ab63daac by Krzysztof Gogolewski at 2023-05-12T06:11:38-04:00 Allow Core optimizations when interpreting bytecode Tracking ticket: #23056 MR: !10399 This adds the flag `-funoptimized-core-for-interpreter`, permitting use of the `-O` flag to enable optimizations when compiling with the interpreter backend, like in ghci. - - - - - c6cf9433 by Ben Gamari at 2023-05-12T06:12:14-04:00 hadrian: Fix mention of non-existent removeFiles function Previously Hadrian's bindist Makefile referred to a `removeFiles` function that was previously defined by the `make` build system. Since the `make` build system is no longer around, this function is now undefined. Naturally, make being make, this appears to be silently ignored instead of producing an error. Fix this by rewriting it to `rm -f`. Closes #23373. - - - - - eb60ec18 by Andrew Lelechenko at 2023-05-12T06:12:54-04:00 Mention new implementation of GHC.IORef.atomicSwapIORef in the changelog - - - - - aa84cff4 by Teo Camarasu at 2023-05-12T19:27:23-04:00 rts: Ensure non-moving gc is not running when pausing - - - - - 5ad776ab by Teo Camarasu at 2023-05-12T19:27:23-04:00 rts: Teach listAllBlocks about nonmoving heap List all blocks on the non-moving heap. Resolves #22627 - - - - - d683b2e5 by Krzysztof Gogolewski at 2023-05-12T19:28:00-04:00 Fix coercion optimisation for SelCo (#23362) setNominalRole_maybe is supposed to output a nominal coercion. In the SelCo case, it was not updating the stored role to Nominal, causing #23362. - - - - - 59aa4676 by Alexis King at 2023-05-12T19:28:47-04:00 hadrian: Fix linker script flag for MergeObjects builder This fixes what appears to have been a typo in !9530. The `-t` flag just enables tracing on all versions of `ld` I’ve looked at, while `-T` is used to specify a linker script. It seems that this worked anyway for some reason on some `ld` implementations (perhaps because they automatically detect linker scripts), but the missing `-T` argument causes `gold` to complain. - - - - - 4bf9fa0f by Adam Gundry at 2023-05-12T23:49:49-04:00 Less coercion optimization for non-newtype axioms See Note [Push transitivity inside newtype axioms only] for an explanation of the change here. This change substantially improves the performance of coercion optimization for programs involving transitive type family reductions. ------------------------- Metric Decrease: CoOpt_Singletons LargeRecord T12227 T12545 T13386 T15703 T5030 T8095 ------------------------- - - - - - dc0c9574 by Adam Gundry at 2023-05-12T23:49:49-04:00 Move checkAxInstCo to GHC.Core.Lint A consequence of the previous change is that checkAxInstCo is no longer called during coercion optimization, so it can be moved back where it belongs. Also includes some edits to Note [Conflict checking with AxiomInstCo] as suggested by @simonpj. - - - - - 8b9b7dbc by Simon Peyton Jones at 2023-05-12T23:50:25-04:00 Use the eager unifier in the constraint solver This patch continues the refactoring of the constraint solver described in #23070. The Big Deal in this patch is to call the regular, eager unifier from the constraint solver, when we want to create new equalities. This replaces the existing, unifyWanted which amounted to yet-another-unifier, so it reduces duplication of a rather subtle piece of technology. See * Note [The eager unifier] in GHC.Tc.Utils.Unify * GHC.Tc.Solver.Monad.wrapUnifierTcS I did lots of other refactoring along the way * I simplified the treatment of right hand sides that contain CoercionHoles. Now, a constraint that contains a hetero-kind CoercionHole is non-canonical, and cannot be used for rewriting or unification alike. This required me to add the ch_hertero_kind flag to CoercionHole, with consequent knock-on effects. See wrinkle (2) of `Note [Equalities with incompatible kinds]` in GHC.Tc.Solver.Equality. * I refactored the StopOrContinue type to add StartAgain, so that after a fundep improvement (for example) we can simply start the pipeline again. * I got rid of the unpleasant (and inefficient) rewriterSetFromType/Co functions. With Richard I concluded that they are never needed. * I discovered Wrinkle (W1) in Note [Wanteds rewrite Wanteds] in GHC.Tc.Types.Constraint, and therefore now prioritise non-rewritten equalities. Quite a few error messages change, I think always for the better. Compiler runtime stays about the same, with one outlier: a 17% improvement in T17836 Metric Decrease: T17836 T18223 - - - - - 5cad28e7 by Bartłomiej Cieślar at 2023-05-12T23:51:06-04:00 Cleanup of dynflags override in export renaming The deprecation warnings are normally emitted whenever the name's GRE is being looked up, which calls the GHC.Rename.Env.addUsedGRE function. We do not want those warnings to be emitted when renaming export lists, so they are artificially turned off by removing all warning categories from DynFlags at the beginning of GHC.Tc.Gen.Export.rnExports. This commit removes that dependency by unifying the function used for GRE lookup in lookup_ie to lookupGreAvailRn and disabling the call to addUsedGRE in said function (the warnings are also disabled in a call to lookupSubBndrOcc_helper in lookupChildrenExport), as per #17957. This commit also changes the setting for whether to warn about deprecated names in addUsedGREs to be an explicit enum instead of a boolean. - - - - - d85ed900 by Alexis King at 2023-05-13T08:45:18-04:00 Use a uniform return convention in bytecode for unary results fixes #22958 - - - - - 8a0d45f7 by Andrew Lelechenko at 2023-05-13T08:45:58-04:00 Add more instances for Compose: Enum, Bounded, Num, Real, Integral See https://github.com/haskell/core-libraries-committee/issues/160 for discussion - - - - - 902f0730 by Simon Peyton Jones at 2023-05-13T14:58:34-04:00 Make GHC.Types.Id.Make.shouldUnpackTy a bit more clever As #23307, GHC.Types.Id.Make.shouldUnpackTy was leaving money on the table, failing to unpack arguments that are perfectly unpackable. The fix is pretty easy; see Note [Recursive unboxing] - - - - - a5451438 by sheaf at 2023-05-13T14:59:13-04:00 Fix bad multiplicity role in tyConAppFunCo_maybe The function tyConAppFunCo_maybe produces a multiplicity coercion for the multiplicity argument of the function arrow, except that it could be at the wrong role if asked to produce a representational coercion. We fix this by using the 'funRole' function, which computes the right roles for arguments to the function arrow TyCon. Fixes #23386 - - - - - 5b9e9300 by sheaf at 2023-05-15T11:26:59-04:00 Turn "ambiguous import" error into a panic This error should never occur, as a lookup of a type or data constructor should never be ambiguous. This is because a single module cannot export multiple Names with the same OccName, as per item (1) of Note [Exporting duplicate declarations] in GHC.Tc.Gen.Export. This code path was intended to handle duplicate record fields, but the rest of the code had since been refactored to handle those in a different way. We also remove the AmbiguousImport constructor of IELookupError, as it is no longer used. Fixes #23302 - - - - - e305e60c by M Farkas-Dyck at 2023-05-15T11:27:41-04:00 Unbreak some tests with latest GNU grep, which now warns about stray '\'. Confusingly, the testsuite mangled the error to say "stray /". We also migrate some tests from grep to grep -E, as it seems the author actually wanted an "POSIX extended" (a.k.a. sane) regex. Background: POSIX specifies 2 "regex" syntaxen: "basic" and "extended". Of these, only "extended" syntax is actually a regular expression. Furthermore, "basic" syntax is inconsistent in its use of the '\' character — sometimes it escapes a regex metacharacter, but sometimes it unescapes it, i.e. it makes an otherwise normal character become a metacharacter. This baffles me and it seems also the authors of these tests. Also, the regex(7) man page (at least on Linux) says "basic" syntax is obsolete. Nearly all modern tools and libraries are consistent in this use of the '\' character (of which many use "extended" syntax by default). - - - - - 5ae81842 by sheaf at 2023-05-15T14:49:17-04:00 Improve "ambiguous occurrence" error messages This error was sometimes a bit confusing, especially when data families were involved. This commit improves the general presentation of the "ambiguous occurrence" error, and adds a bit of extra context in the case of data families. Fixes #23301 - - - - - 2f571afe by Sylvain Henry at 2023-05-15T14:50:07-04:00 Fix GHCJS OS platform (fix #23346) - - - - - 86aae570 by Oleg Grenrus at 2023-05-15T14:50:43-04:00 Split DynFlags structure into own module This will allow to make command line parsing to depend on diagnostic system (which depends on dynflags) - - - - - fbe3fe00 by Josh Meredith at 2023-05-15T18:01:43-04:00 Replace the implementation of CodeBuffers with unboxed types - - - - - 21f3aae7 by Josh Meredith at 2023-05-15T18:01:43-04:00 Use unboxed codebuffers in base Metric Decrease: encodingAllocations - - - - - 18ea2295 by Ben Gamari at 2023-05-15T18:02:20-04:00 rts: Weak pointer cleanups Various stylistic cleanups. No functional changes. - - - - - c343112f by Ben Gamari at 2023-05-15T18:02:20-04:00 rts: Don't force debug output to stderr Previously `+RTS -Dw -l` would emit debug output to the eventlog while `+RTS -l -Dw` would emit it to stderr. This was because the parser for `-D` would unconditionally override the debug output target. Now we instead only do so if no it is currently `TRACE_NONE`. - - - - - a5f5f067 by Ben Gamari at 2023-05-15T18:02:20-04:00 rts: Forcibly flush eventlog on barf Previously we would attempt to flush via `endEventLogging` which can easily deadlock, e.g., if `barf` fails during GC. Using `flushEventLog` directly may result in slightly less consistent eventlog output (since we don't take all capabilities before flushing) but avoids deadlocking. - - - - - 73b1e87c by Ben Gamari at 2023-05-15T18:02:20-04:00 rts: Assert that pointers aren't cleared by -DZ This turns many segmentation faults into much easier-to-debug assertion failures by ensuring that LOOKS_LIKE_*_PTR checks recognize bit-patterns produced by `+RTS -DZ` clearing as invalid pointers. This is a bit ad-hoc but this is the debug runtime. - - - - - 37fb61d8 by Ben Gamari at 2023-05-15T18:02:20-04:00 rts: Introduce printGlobalThreads - - - - - 451d65a6 by Ben Gamari at 2023-05-15T18:02:20-04:00 rts: Don't sanity-check StgTSO.global_link See Note [Avoid dangling global_link pointers]. Fixes #19146. - - - - - d69cbd78 by sheaf at 2023-05-15T18:03:00-04:00 Split up tyThingToIfaceDecl from GHC.Iface.Make This commit moves tyThingToIfaceDecl and coAxiomToIfaceDecl from GHC.Iface.Make into GHC.Iface.Decl. This avoids GHC.Types.TyThing.Ppr, which needs tyThingToIfaceDecl, transitively depending on e.g. GHC.Iface.Load and GHC.Tc.Utils.Monad. - - - - - 4d29ecdf by sheaf at 2023-05-15T18:03:00-04:00 Migrate errors to diagnostics in GHC.Tc.Module This commit migrates the errors in GHC.Tc.Module to use the new diagnostic infrastructure. It required a significant overhaul of the compatibility checks between an hs-boot or signature module and its implementation; we now use a Writer monad to accumulate errors; see the BootMismatch datatype in GHC.Tc.Errors.Types, with its panoply of subtypes. For the sake of readability, several local functions inside the 'checkBootTyCon' function were split off into top-level functions. We split off GHC.Types.HscSource into a "boot or sig" vs "normal hs file" datatype, as this mirrors the logic in several other places where we want to treat hs-boot and hsig files in a similar fashion. This commit also refactors the Backpack checks for type synonyms implementing abstract data, to correctly reject implementations that contain qualified or quantified types (this fixes #23342 and #23344). - - - - - d986c98e by Rodrigo Mesquita at 2023-05-16T00:14:04-04:00 configure: Drop unused AC_PROG_CPP In configure, we were calling `AC_PROG_CPP` but never making use of the $CPP variable it sets or reads. The issue is $CPP will show up in the --help output of configure, falsely advertising a configuration option that does nothing. The reason we don't use the $CPP variable is because HS_CPP_CMD is expected to be a single command (without flags), but AC_PROG_CPP, when CPP is unset, will set said variable to something like `/usr/bin/gcc -E`. Instead, we configure HS_CPP_CMD through $CC. - - - - - a8f0435f by Cheng Shao at 2023-05-16T00:14:42-04:00 rts: fix --disable-large-address-space This patch moves ACQUIRE_ALLOC_BLOCK_SPIN_LOCK/RELEASE_ALLOC_BLOCK_SPIN_LOCK from Storage.h to HeapAlloc.h. When --disable-large-address-space is passed to configure, the code in HeapAlloc.h makes use of these two macros. Fixes #23385. - - - - - bdb93cd2 by Oleg Grenrus at 2023-05-16T07:59:21+03:00 Add -Wmissing-role-annotations Implements #22702 - - - - - 41ecfc34 by Ben Gamari at 2023-05-16T07:28:15-04:00 base: Export {get,set}ExceptionFinalizer from System.Mem.Weak As proposed in CLC Proposal #126 [1]. [1]: https://github.com/haskell/core-libraries-committee/issues/126 - - - - - 67330303 by Ben Gamari at 2023-05-16T07:28:16-04:00 base: Introduce printToHandleFinalizerExceptionHandler - - - - - 5e3f9bb5 by Josh Meredith at 2023-05-16T13:59:22-04:00 JS: Implement h$clock_gettime in the JavaScript RTS (#23360) - - - - - 90e69d5d by Zubin Duggal at 2023-05-16T14:00:00-04:00 compiler: Use compact representation for SourceText SourceText is serialized along with INLINE pragmas into interface files. Many of these SourceTexts are identical, for example "{-# INLINE#". When deserialized, each such SourceText was previously expanded out into a [Char], which is highly wasteful of memory, and each such instance of the text would allocate an independent list with its contents as deserializing breaks any sharing that might have existed. Instead, we use a `FastString` to represent these, so that each instance unique text will be interned and stored in a memory efficient manner. - - - - - b70bc690 by Zubin Duggal at 2023-05-16T14:00:00-04:00 compiler: Use compact representation/FastStrings for `SourceNote`s `SourceNote`s should not be stored as [Char] as this is highly wasteful and in certain scenarios can be highly duplicated. Metric Decrease: hard_hole_fits - - - - - 6231a126 by Zubin Duggal at 2023-05-16T14:00:00-04:00 compiler: Use compact representation for UsageFile (#22744) Use FastString to store filepaths in interface files, as this data is highly redundant so we want to share all instances of filepaths in the compiler session. - - - - - 47a58150 by Zubin Duggal at 2023-05-16T14:00:00-04:00 testsuite: add test for T22744 This test checks for #22744 by compiling 100 modules which each have a dependency on 1000 distinct external files. Previously, when loading these interfaces from disk, each individual instance of a filepath in the interface will would be allocated as an individual object on the heap, meaning we have heap objects for 100*1000 files, when there are only 1000 distinct files we care about. This test checks this by first compiling the module normally, then measuring the peak memory usage in a no-op recompile, as the recompilation checking will force the allocation of all these filepaths. - - - - - 0451bdc9 by Ben Gamari at 2023-05-16T21:31:40-04:00 users guide: Add glossary Currently this merely explains the meaning of "technology preview" in the context of released features. - - - - - 0ba52e4e by Ben Gamari at 2023-05-16T21:31:40-04:00 Update glossary.rst - - - - - 3d23060c by Ben Gamari at 2023-05-16T21:31:40-04:00 Use glossary directive - - - - - 2972fd66 by Sylvain Henry at 2023-05-16T21:32:20-04:00 JS: fix getpid (fix #23399) - - - - - 5fe1d3e6 by Matthew Pickering at 2023-05-17T21:42:00-04:00 Use setSrcSpan rather than setLclEnv in solveForAll In subsequent MRs (#23409) we want to remove the TcLclEnv argument from a CtLoc. This MR prepares us for that by removing the one place where the entire TcLclEnv is used, by using it more precisely to just set the contexts source location. Fixes #23390 - - - - - 385edb65 by Torsten Schmits at 2023-05-17T21:42:40-04:00 Update the users guide paragraph on -O in GHCi In relation to #23056 - - - - - 87626ef0 by Ben Gamari at 2023-05-18T15:18:53-04:00 base: Add test for #13660 - - - - - 9eef53b1 by Ben Gamari at 2023-05-18T15:18:53-04:00 base: Move implementation of GHC.Foreign to GHC.Internal - - - - - 174ea2fa by Ben Gamari at 2023-05-18T15:18:53-04:00 base: Introduce {new,with}CStringLen0 These are useful helpers for implementing the internal-NUL code unit check needed to fix #13660. - - - - - a46ced16 by Ben Gamari at 2023-05-18T15:18:53-04:00 base: Clean up documentation - - - - - b98d99cc by Ben Gamari at 2023-05-18T15:18:53-04:00 base: Ensure that FilePaths don't contain NULs POSIX filepaths may not contain the NUL octet but previously we did not reject such paths. This could be exploited by untrusted input to cause discrepancies between various `FilePath` queries and the opened filename. For instance, `readFile "hello.so\x00.txt"` would open the file `"hello.so"` yet `takeFileExtension` would return `".txt"`. The same argument applies to Windows FilePaths Fixes #13660. - - - - - 7ae45459 by Simon Peyton Jones at 2023-05-18T15:19:29-04:00 Allow the demand analyser to unpack tuple and equality dictionaries Addresses #23398. The demand analyser usually does not unpack class dictionaries: see Note [Do not unbox class dictionaries] in GHC.Core.Opt.DmdAnal. This patch makes an exception for tuple dictionaries and equality dictionaries, for reasons explained in wrinkles (DNB1) and (DNB2) of the above Note. Compile times fall by 0.1% for some reason (max 0.7% on T18698b). - - - - - b53a9086 by Greg Steuck at 2023-05-18T15:20:08-04:00 Use a simpler and more portable construct in ld.ldd check printf '%q\n' is a bash extension which led to incorrectly failing an ld.lld test on OpenBSD which uses pdksh as /bin/sh - - - - - dd5710af by Torsten Schmits at 2023-05-18T15:20:50-04:00 Update the warning about interpreter optimizations to reflect that they're not incompatible anymore, but guarded by a flag - - - - - 4f6dd999 by Matthew Pickering at 2023-05-18T15:21:26-04:00 Remove stray dump flags in GHC.Rename.Names - - - - - 4bca0486 by Oleg Grenrus at 2023-05-19T11:51:33+03:00 Make Warn = Located DriverMessage This change makes command line argument parsing use diagnostic framework for producing warnings. - - - - - 525ed554 by Simon Peyton Jones at 2023-05-19T10:09:15-04:00 Type inference for data family newtype instances This patch addresses #23408, a tricky case with data family newtype instances. Consider type family TF a where TF Char = Bool data family DF a newtype instance DF Bool = MkDF Int and [W] Int ~R# DF (TF a), with a Given (a ~# Char). We must fully rewrite the Wanted so the tpye family can fire; that wasn't happening. - - - - - c6fb6690 by Peter Trommler at 2023-05-20T03:16:08-04:00 testsuite: fix predicate on rdynamic test Test rdynamic requires dynamic linking support, which is orthogonal to RTS linker support. Change the predicate accordingly. Fixes #23316 - - - - - 735d504e by Matthew Pickering at 2023-05-20T03:16:44-04:00 docs: Use ghc-ticket directive where appropiate in users guide Using the directive automatically formats and links the ticket appropiately. - - - - - b56d7379 by Sylvain Henry at 2023-05-22T14:21:22-04:00 NCG: remove useless .align directive (#20758) - - - - - 15b93d2f by Simon Peyton Jones at 2023-05-22T14:21:58-04:00 Add test for #23156 This program had exponential typechecking time in GHC 9.4 and 9.6 - - - - - 2b53f206 by Greg Steuck at 2023-05-22T20:23:11-04:00 Revert "Change hostSupportsRPaths to report False on OpenBSD" This reverts commit 1e0d8fdb55a38ece34fa6cf214e1d2d46f5f5bf2. - - - - - 882e43b7 by Greg Steuck at 2023-05-22T20:23:11-04:00 Disable T17414 on OpenBSD Like on other systems it's not guaranteed that there's sufficient space in /tmp to write 2G out. - - - - - 9d531f9a by Greg Steuck at 2023-05-22T20:23:11-04:00 Bring back getExecutablePath to getBaseDir on OpenBSD Fix #18173 - - - - - 9db0eadd by Krzysztof Gogolewski at 2023-05-22T20:23:47-04:00 Add an error origin for impedance matching (#23427) - - - - - 33cf4659 by Ben Gamari at 2023-05-23T03:46:20-04:00 testsuite: Add tests for #23146 Both lifted and unlifted variants. - - - - - 76727617 by Ben Gamari at 2023-05-23T03:46:21-04:00 codeGen: Fix some Haddocks - - - - - 33a8c348 by Ben Gamari at 2023-05-23T03:46:21-04:00 codeGen: Give proper LFInfo to datacon wrappers As noted in `Note [Conveying CAF-info and LFInfo between modules]`, when importing a binding from another module we must ensure that it gets the appropriate `LambdaFormInfo` if it is in WHNF to ensure that references to it are tagged correctly. However, the implementation responsible for doing this, `GHC.StgToCmm.Closure.mkLFImported`, only dealt with datacon workers and not wrappers. This lead to the crash of this program in #23146: module B where type NP :: [UnliftedType] -> UnliftedType data NP xs where UNil :: NP '[] module A where import B fieldsSam :: NP xs -> NP xs -> Bool fieldsSam UNil UNil = True x = fieldsSam UNil UNil Due to its GADT nature, `UNil` produces a trivial wrapper $WUNil :: NP '[] $WUNil = UNil @'[] @~(<co:1>) which is referenced in the RHS of `A.x`. Due to the above-mentioned bug in `mkLFImported`, the references to `$WUNil` passed to `fieldsSam` were not tagged. This is problematic as `fieldsSam` expected its arguments to be tagged as they are unlifted. The fix is straightforward: extend the logic in `mkLFImported` to cover (nullary) datacon wrappers as well as workers. This is safe because we know that the wrapper of a nullary datacon will be in WHNF, even if it includes equalities evidence (since such equalities are not runtime relevant). Thanks to @MangoIV for the great ticket and @alt-romes for his minimization and help debugging. Fixes #23146. - - - - - 2fc18e9e by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00 codeGen: Fix LFInfo of imported datacon wrappers As noted in #23231 and in the previous commit, we were failing to give a an LFInfo of LFCon to a nullary datacon wrapper from another module, failing to properly tag pointers which ultimately led to the segmentation fault in #23146. On top of the previous commit which now considers wrappers where we previously only considered workers, we change the order of the guards so that we check for the arity of the binding before we check whether it is a constructor. This allows us to (1) Correctly assign `LFReEntrant` to imported wrappers whose worker was nullary, which we previously would fail to do (2) Remove the `isNullaryRepDataCon` predicate: (a) which was previously wrong, since it considered wrappers whose workers had zero-width arguments to be non-nullary and would fail to give `LFCon` to them (b) is now unnecessary, since arity == 0 guarantees - that the worker takes no arguments at all - and the wrapper takes no arguments and its RHS must be an application of the worker to zero-width-args only. - we lint these two items with an assertion that the datacon `hasNoNonZeroWidthArgs` We also update `isTagged` to use the new logic in determining the LFInfos of imported Ids. The creation of LFInfos for imported Ids and this detail are explained in Note [The LFInfo of Imported Ids]. Note that before the patch to those issues we would already consider these nullary wrappers to have `LFCon` lambda form info; but failed to re-construct that information in `mkLFImported` Closes #23231, #23146 (I've additionally batched some fixes to documentation I found while investigating this issue) - - - - - 0598f7f0 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00 Make LFInfos for DataCons on construction As a result of the discussion in !10165, we decided to amend the previous commit which fixed the logic of `mkLFImported` with regard to datacon workers and wrappers. Instead of having the logic for the LFInfo of datacons be in `mkLFImported`, we now construct an LFInfo for all data constructors on GHC.Types.Id.Make and store it in the `lfInfo` field. See the new Note [LFInfo of DataCon workers and wrappers] and ammendments to Note [The LFInfo of Imported Ids] - - - - - 12294b22 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00 Update Note [Core letrec invariant] Authored by @simonpj - - - - - e93ab972 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00 Rename mkLFImported to importedIdLFInfo The `mkLFImported` sounded too much like a constructor of sorts, when really it got the `LFInfo` of an imported Id from its `lf_info` field when this existed, and otherwise returned a conservative estimate of that imported Id's LFInfo. This in contrast to functions such as `mkLFReEntrant` which really are about constructing an `LFInfo`. - - - - - e54d9259 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00 Enforce invariant on typePrimRepArgs in the types As part of the documentation effort in !10165 I came across this invariant on 'typePrimRepArgs' which is easily expressed at the type-level through a NonEmpty list. It allowed us to remove one panic. - - - - - b8fe6a0c by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00 Merge outdated Note [Data con representation] into Note [Data constructor representation] Introduce new Note [Constructor applications in STG] to better support the merge, and reference it from the relevant bits in the STG syntax. - - - - - e1590ddc by Simon Peyton Jones at 2023-05-23T03:46:57-04:00 Add the SolverStage monad This refactoring makes a substantial improvement in the structure of the type-checker's constraint solver: #23070. Specifically: * Introduced the SolverStage monad. See GHC.Tc.Solver.Monad Note [The SolverStage monad] * Make each solver pipeline (equalities, dictionaries, irreds etc) deal with updating the inert set, as a separate SolverStage. There is sometimes special stuff to do, and it means that each full pipeline can have type SolverStage Void, indicating that they never return anything. * Made GHC.Tc.Solver.Equality.zonkEqTypes into a SolverStage. Much nicer. * Combined the remnants of GHC.Tc.Solver.Canonical and GHC.Tc.Solver.Interact into a new module GHC.Tc.Solver.Solve. (Interact and Canonical are removed.) * Gave the same treatment to dictionary and irred constraints as I have already done for equality constraints: * New types (akin to EqCt): IrredCt and DictCt * Ct is now just a simple sum type data Ct = CDictCan DictCt | CIrredCan IrredCt | CEqCan EqCt | CQuantCan QCInst | CNonCanonical CtEvidence * inert_dicts can now have the better type DictMap DictCt, instead of DictMap Ct; and similarly inert_irreds. * Significantly simplified the treatment of implicit parameters. Previously we had a number of special cases * interactGivenIP, an entire function * special case in maybeKickOut * special case in findDict, when looking up dictionaries But actually it's simpler than that. When adding a new Given, implicit parameter constraint to the InertSet, we just need to kick out any existing inert constraints that mention that implicit parameter. The main work is done in GHC.Tc.Solver.InertSet.delIPDict, along with its auxiliary GHC.Core.Predicate.mentionsIP. See Note [Shadowing of implicit parameters] in GHC.Tc.Solver.Dict. * Add a new fast-path in GHC.Tc.Errors.Hole.tcCheckHoleFit. See Note [Fast path for tcCheckHoleFit]. This is a big win in some cases: test hard_hole_fits gets nearly 40% faster (at compile time). * Add a new fast-path for solving /boxed/ equality constraints (t1 ~ t2). See Note [Solving equality classes] in GHC.Tc.Solver.Dict. This makes a big difference too: test T17836 compiles 40% faster. * Implement the PermissivePlan of #23413, which concerns what happens with insoluble Givens. Our previous treatment was wildly inconsistent as that ticket pointed out. A part of this, I simplified GHC.Tc.Validity.checkAmbiguity: now we simply don't run the ambiguity check at all if -XAllowAmbiguousTypes is on. Smaller points: * In `GHC.Tc.Errors.misMatchOrCND` instead of having a special case for insoluble /occurs/ checks, broaden in to all insouluble constraints. Just generally better. See Note [Insoluble mis-match] in that module. As noted above, compile time perf gets better. Here are the changes over 0.5% on Fedora. (The figures are slightly larger on Windows for some reason.) Metrics: compile_time/bytes allocated ------------------------------------- LargeRecord(normal) -0.9% MultiLayerModulesTH_OneShot(normal) +0.5% T11822(normal) -0.6% T12227(normal) -1.8% GOOD T12545(normal) -0.5% T13035(normal) -0.6% T15703(normal) -1.4% GOOD T16875(normal) -0.5% T17836(normal) -40.7% GOOD T17836b(normal) -12.3% GOOD T17977b(normal) -0.5% T5837(normal) -1.1% T8095(normal) -2.7% GOOD T9020(optasm) -1.1% hard_hole_fits(normal) -37.0% GOOD geo. mean -1.3% minimum -40.7% maximum +0.5% Metric Decrease: T12227 T15703 T17836 T17836b T8095 hard_hole_fits LargeRecord T9198 T13035 - - - - - 6abf3648 by Simon Peyton Jones at 2023-05-23T03:46:57-04:00 Avoid an assertion failure in abstractFloats The function GHC.Core.Opt.Simplify.Utils.abstractFloats was carelessly calling lookupIdSubst_maybe on a CoVar; but a precondition of the latter is being given an Id. In fact it's harmless to call it on a CoVar, but still, the precondition on lookupIdSubst_maybe makes sense, so I added a test for CoVars. This avoids a crash in a DEBUG compiler, but otherwise has no effect. Fixes #23426. - - - - - 838aaf4b by hainq at 2023-05-24T12:41:19-04:00 Migrate errors in GHC.Tc.Validity This patch migrates the error messages in GHC.Tc.Validity to use the new diagnostic infrastructure. It adds the constructors: - TcRnSimplifiableConstraint - TcRnArityMismatch - TcRnIllegalInstanceDecl, with sub-datatypes for HasField errors and fundep coverage condition errors. - - - - - 8539764b by Krzysztof Gogolewski at 2023-05-24T12:41:56-04:00 linear lint: Add missing processing of DEFAULT In this correct program f :: a %1 -> a f x = case x of x { _DEFAULT -> x } after checking the alternative we weren't popping the case binder 'x' from the usage environment, which meant that the lambda-bound 'x' was counted twice: in the scrutinee and (incorrectly) in the alternative. In fact, we weren't checking the usage of 'x' at all. Now the code for handling _DEFAULT is similar to the one handling data constructors. Fixes #23025. - - - - - ae683454 by Matthew Pickering at 2023-05-24T12:42:32-04:00 Remove outdated "Don't check hs-boot type family instances too early" note This note was introduced in 25b70a29f623 which delayed performing some consistency checks for type families. However, the change was reverted later in 6998772043a7f0b0360116eb5ffcbaa5630b21fb but the note was not removed. I found it confusing when reading to code to try and work out what special behaviour there was for hs-boot files (when in-fact there isn't any). - - - - - 44af57de by Matthew Pickering at 2023-05-24T12:43:08-04:00 rts: Define ticky macro stubs These macros have long been undefined which has meant we were missing reporting these allocations in ticky profiles. The most critical missing definition was TICK_ALLOC_HEAP_NOCTR which was missing all the RTS calls to allocate, this leads to a the overall ALLOC_RTS_tot number to be severaly underreported. Of particular interest though is the ALLOC_STACK_ctr and ALLOC_STACK_tot counters which are useful to tracking stack allocations. Fixes #23421 - - - - - b2dabe3a by Matthew Pickering at 2023-05-24T12:43:08-04:00 rts: ticky: Rename TICK_ALLOC_HEAP_NOCTR to TICK_ALLOC_RTS This macro increments the ALLOC_HEAP_tot and ALLOC_HEAP_ctr so it makes more sense to name it after that rather than the suffix NOCTR, whose meaning has been lost to the mists of time. - - - - - eac4420a by Ben Gamari at 2023-05-24T12:43:45-04:00 users guide: A few small mark-up fixes - - - - - a320ca76 by Rodrigo Mesquita at 2023-05-24T12:44:20-04:00 configure: Fix support check for response files. In failing to escape the '-o' in '-o\nconftest\nconftest.o\n' argument to printf, the writing of the arguments response file always failed. The fix is to pass the arguments after `--` so that they are treated positional arguments rather than flags to printf. Closes #23435 - - - - - f21ce0e4 by mangoiv at 2023-05-24T12:45:00-04:00 [feat] add .direnv to the .gitignore file - - - - - 36d5944d by Andrew Lelechenko at 2023-05-24T20:58:34-04:00 Add Data.List.unsnoc See https://github.com/haskell/core-libraries-committee/issues/165 for discussion - - - - - c0f2f9e3 by Bartłomiej Cieślar at 2023-05-24T20:59:14-04:00 Fix crash in backpack signature merging with -ddump-rn-trace In some cases, backpack signature merging could crash in addUsedGRE when -ddump-rn-trace was enabled, as pretty-printing the GREInfo would cause unavailable interfaces to be loaded. This commit fixes that issue by not pretty-printing the GREInfo in addUsedGRE when -ddump-rn-trace is enabled. Fixes #23424 Signed-off-by: Bartłomiej Cieślar <bcieslar2001 at gmail.com> - - - - - 5a07d94a by Krzysztof Gogolewski at 2023-05-25T03:30:20-04:00 Add a regression test for #13981 The panic was fixed by 6998772043a7f0b. Fixes #13981. - - - - - 182df90e by Krzysztof Gogolewski at 2023-05-25T03:30:57-04:00 Add a test for #23355 It was fixed by !10061, so I'm adding it in the same group. - - - - - 1b31b039 by uhbif19 at 2023-05-25T12:08:28+02:00 Migrate errors in GHC.Rename.Splice GHC.Rename.Pat This commit migrates the errors in GHC.Rename.Splice and GHC.Rename.Pat to use the new diagnostic infrastructure. - - - - - 56abe494 by sheaf at 2023-05-25T12:09:55+02:00 Common up Template Haskell errors in TcRnMessage This commit commons up the various Template Haskell errors into a single constructor, TcRnTHError, of TcRnMessage. - - - - - a487ba9e by Krzysztof Gogolewski at 2023-05-25T14:35:56-04:00 Enable ghci tests for unboxed tuples The tests were originally skipped because ghci used not to support unboxed tuples/sums. - - - - - dc3422d4 by Matthew Pickering at 2023-05-25T18:57:19-04:00 rts: Build ticky GHC with single-threaded RTS The threaded RTS allows you to use ticky profiling but only for the counters in the generated code. The counters used in the C portion of the RTS are disabled. Updating the counters is also racy using the threaded RTS which can lead to misleading or incorrect ticky results. Therefore we change the hadrian flavour to build using the single-threaded RTS (mainly in order to get accurate C code counter increments) Fixes #23430 - - - - - fbc8e04e by sheaf at 2023-05-25T18:58:00-04:00 Propagate long-distance info in generated code When desugaring generated pattern matches, we skip pattern match checks. However, this ended up also discarding long-distance information, which might be needed for user-written sub-expressions. Example: ```haskell okay (GADT di) cd = let sr_field :: () sr_field = case getFooBar di of { Foo -> () } in case cd of { SomeRec _ -> SomeRec sr_field } ``` With sr_field a generated FunBind, we still want to propagate the outer long-distance information from the GADT pattern match into the checks for the user-written RHS of sr_field. Fixes #23445 - - - - - f8ced241 by Matthew Pickering at 2023-05-26T15:26:21-04:00 Introduce GHCiMessage to wrap GhcMessage By introducing a wrapped message type we can control how certain messages are printed in GHCi (to add extra information for example) - - - - - 58e554c1 by Matthew Pickering at 2023-05-26T15:26:22-04:00 Generalise UnknownDiagnostic to allow embedded diagnostics to access parent diagnostic options. * Split default diagnostic options from Diagnostic class into HasDefaultDiagnosticOpts class. * Generalise UnknownDiagnostic to allow embedded diagnostics to access options. The principle idea here is that when wrapping an error message (such as GHCMessage to make GHCiMessage) then we need to also be able to lift the configuration when overriding how messages are printed (see load' for an example). - - - - - b112546a by Matthew Pickering at 2023-05-26T15:26:22-04:00 Allow API users to wrap error messages created during 'load' This allows API users to configure how messages are rendered when they are emitted from the load function. For an example see how 'loadWithCache' is used in GHCi. - - - - - 2e4cf0ee by Matthew Pickering at 2023-05-26T15:26:22-04:00 Abstract cantFindError and turn Opt_BuildingCabal into a print-time option * cantFindError is abstracted so that the parts which mention specific things about ghc/ghci are parameters. The intention being that GHC/GHCi can specify the right values to put here but otherwise display the same error message. * The BuildingCabalPackage argument from GenericMissing is removed and turned into a print-time option. The reason for the error is not dependent on whether `-fbuilding-cabal-package` is passed, so we don't want to store that in the error message. - - - - - 34b44f7d by Matthew Pickering at 2023-05-26T15:26:22-04:00 error messages: Don't display ghci specific hints for missing packages Tickets like #22884 suggest that it is confusing that GHC used on the command line can suggest options which only work in GHCi. This ticket uses the error message infrastructure to override certain error messages which displayed GHCi specific information so that this information is only showed when using GHCi. The main annoyance is that we mostly want to display errors in the same way as before, but with some additional information. This means that the error rendering code has to be exported from the Iface/Errors/Ppr.hs module. I am unsure about whether the approach taken here is the best or most maintainable solution. Fixes #22884 - - - - - 05a1b626 by Matthew Pickering at 2023-05-26T15:26:58-04:00 ghcup-metadata: Don't override existing metadata if version already exists. If a nightly pipeline runs twice for some reason for the same version then we really don't want to override an existing entry with new bindists. This could cause ABI compatability issues for users or break ghcup's caching logic. - - - - - fcbcb3cc by Matthew Pickering at 2023-05-26T15:26:58-04:00 ghcup-metadata: Use proper API url for bindist download Previously we were using links from the web interface, but it's more robust and future-proof to use the documented links to the artifacts. https://docs.gitlab.com/ee/api/job_artifacts.html - - - - - 5b59c8fe by Matthew Pickering at 2023-05-26T15:26:58-04:00 ghcup-metadata: Set Nightly and LatestNightly tags The latest nightly release needs the LatestNightly tag, and all other nightly releases need the Nightly tag. Therefore when the metadata is updated we need to replace all LatestNightly with Nightly.` - - - - - 914e1468 by Matthew Pickering at 2023-05-26T15:26:58-04:00 ghcup-metadata: Download nightly metadata for correct date The metadata now lives in https://gitlab.haskell.org/ghc/ghcup-metadata with one metadata file per year. When we update the metadata we download and update the right file for the current year. - - - - - 16cf7d2e by Matthew Pickering at 2023-05-26T15:26:58-04:00 ghcup-metadata: Download metadata and update for correct year something about pipeline date - - - - - 14792c4b by Matthew Pickering at 2023-05-26T15:26:58-04:00 ghcup-metadata: Don't skip CI On a push we now have a CI job which updates gitlab pages with the metadata files. - - - - - 1121bdd8 by Matthew Pickering at 2023-05-26T15:26:59-04:00 ghcup-metadata: Add --date flag to specify the release date The ghcup-metadata now has a viReleaseDay field which needs to be populated with the day of the release. - - - - - bc478bee by Matthew Pickering at 2023-05-26T15:26:59-04:00 ghcup-metadata: Add dlOutput field ghcup now requires us to add this field which specifies where it should download the bindist to. See https://gitlab.haskell.org/ghc/ghcup-metadata/-/issues/1 for some more discussion. - - - - - 2bdbd9da by Josh Meredith at 2023-05-26T15:27:35-04:00 JS: Convert rendering to use HLine instead of SDoc (#22455) - - - - - abd9e37c by Norman Ramsey at 2023-05-26T15:28:12-04:00 testsuite: add WasmControlFlow test This patch adds the WasmControlFlow test to test the wasm backend's relooper component. - - - - - 07f858eb by Sylvain Henry at 2023-05-26T15:28:53-04:00 Factorize getLinkDeps Prepare reuse of getLinkDeps for TH implementation in the JS backend (cf #22261 and review of !9779). - - - - - fad9d092 by Oleg Grenrus at 2023-05-27T13:38:08-04:00 Change GHC.Driver.Session import to .DynFlags Also move targetPlatform selector Plenty of GHC needs just DynFlags. Even more can be made to use .DynFlags if more selectors is migrated. This is a low hanging fruit. - - - - - 69fdbece by Alan Zimmerman at 2023-05-27T13:38:45-04:00 EPA: Better fix for #22919 The original fix for #22919 simply removed the ability to match up prior comments with the first declaration in the file. Restore it, but add a check that the comment is on a single line, by ensuring that it comes immediately prior to the next thing (comment or start of declaration), and that the token preceding it is not on the same line. closes #22919 - - - - - 0350b186 by Josh Meredith at 2023-05-29T12:46:27+00:00 Remove JavaScriptFFI from --supported-extensions for non-JS targets (#11214) - - - - - b4816919 by Matthew Pickering at 2023-05-30T17:07:43-04:00 testsuite: Pass -kb16k -kc128k for performance tests Setting a larger stack chunk size gives a greater protection from stack thrashing (where the repeated overflow/underflow allocates a lot of stack chunks which sigificantly impact allocations). This stabilises some tests against differences cause by more things being pushed onto the stack. The performance tests are generally testing work done by the compiler, using allocation as a proxy, so removing/stabilising the allocations due to the stack gives us more stable tests which are also more sensitive to actual changes in compiler performance. The tests which increase are ones where we compile a lot of modules, and for each module we spawn a thread to compile the module in. Therefore increasing these numbers has a multiplying effect on these tests because there are many more stacks which we can increase in size. The most significant improvements though are cases such as T8095 which reduce significantly in allocations (30%). This isn't a performance improvement really but just helps stabilise the test against this threshold set by the defaults. Fixes #23439 ------------------------- Metric Decrease: InstanceMatching T14683 T8095 T9872b_defer T9872d T9961 hie002 T19695 T3064 Metric Increase: MultiLayerModules T13701 T14697 ------------------------- - - - - - 6629f1c5 by Ben Gamari at 2023-05-30T17:08:20-04:00 Move via-C flags into GHC These were previously hardcoded in configure (with no option for overriding them) and simply passed onto ghc through the settings file. Since configure already guarantees gcc supports those flags, we simply move them into GHC. - - - - - 981e5e11 by Arnaud Spiwack at 2023-05-31T08:34:33-04:00 Allow CPR on unrestricted constructors Per the new `Note [Linting linearity]`, we want optimisations over trying to preserve linearity. This will allow CPR to handle `Ur`, in particular. - - - - - bf9344d2 by Arnaud Spiwack at 2023-05-31T08:34:33-04:00 Push coercions across multiplicity boundaries Per the new `Note [Linting linearity]`, we want optimisations over trying to preserve linearity. This will avoid preventing inlinings and reductions and make linear programs more efficient. - - - - - d56dd695 by sheaf at 2023-05-31T11:37:12-04:00 Data.Bag: add INLINEABLE to polymorphic functions This commit allows polymorphic methods in GHC.Data.Bag to be specialised, avoiding having to pass explicit dictionaries when they are instantiated with e.g. a known monad. - - - - - 5366cd35 by sheaf at 2023-05-31T11:37:12-04:00 Split off TcBinderStack into its own module This commit splits off TcBinderStack into its own module, to avoid module cycles: we might want to refer to it without also pulling in the TcM monad. - - - - - 09d4d307 by sheaf at 2023-05-31T11:37:12-04:00 Split off TcRef into its own module This helps avoid pull in the full TcM monad when we just want access to mutable references in the typechecker. This facilitates later patches which introduce a slimmed down TcM monad for zonking. - - - - - 88cc19b3 by sheaf at 2023-05-31T11:37:12-04:00 Introduce Codensity monad The Codensity monad is useful to write state-passing computations in continuation-passing style, e.g. to implement a State monad as continuation-passing style over a Reader monad. - - - - - f62d8195 by sheaf at 2023-05-31T11:37:12-04:00 Restructure the zonker This commit splits up the zonker into a few separate components, described in Note [The structure of the zonker] in `GHC.Tc.Zonk.Type`. 1. `GHC.Tc.Zonk.Monad` introduces a pared-down `TcM` monad, `ZonkM`, which has enough information for zonking types. This allows us to refactor `ErrCtxt` to use `ZonkM` instead of `TcM`, which guarantees we don't throw an error while reporting an error. 2. `GHC.Tc.Zonk.Env` is the new home of `ZonkEnv`, and also defines two zonking monad transformers, `ZonkT` and `ZonkBndrT`. `ZonkT` is a reader monad transformer over `ZonkEnv`. `ZonkBndrT m` is the codensity monad over `ZonkT m`. `ZonkBndrT` is used for computations that accumulate binders in the `ZonkEnv`. 3. `GHC.Tc.Zonk.TcType` contains the code for zonking types, for use in the typechecker. It uses the `ZonkM` monad. 4. `GHC.Tc.Zonk.Type` contains the code for final zonking to `Type`, which has been refactored to use `ZonkTcM = ZonkT TcM` and `ZonkBndrTcM = ZonkBndrT TcM`. Allocations slightly decrease on the whole due to using continuation-passing style instead of manual state passing of ZonkEnv in the final zonking to Type. ------------------------- Metric Decrease: T4029 T8095 T14766 T15304 hard_hole_fits RecordUpdPerf Metric Increase: T10421 ------------------------- - - - - - 70526f5b by mimi.vx at 2023-05-31T11:37:53-04:00 Update rdt-theme to latest upstream version Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/23444 - - - - - f3556d6c by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Restructure IPE buffer layout Reference ticket #21766 This commit restructures IPE buffer list entries to not contain references to their corresponding info tables. IPE buffer list nodes now point to two lists of equal length, one holding the list of info table pointers and one holding the corresponding entries for each info table. This will allow the entry data to be compressed without losing the references to the info tables. - - - - - 5d1f2411 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Add IPE compression to configure Reference ticket #21766 Adds an `--enable-ipe-data-compreesion` flag to the configure script which will check for libzstd and set the appropriate flags to allow for IPE data compression in the compiler - - - - - b7a640ac by Finley McIlwaine at 2023-06-01T04:53:12-04:00 IPE data compression Reference ticket #21766 When IPE data compression is enabled, compress the emitted IPE buffer entries and decompress them in the RTS. - - - - - 5aef5658 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Fix libzstd detection in configure and RTS Ensure that `HAVE_LIBZSTD` gets defined to either 0 or 1 in all cases and properly check that before IPE data decompression in the RTS. See ticket #21766. - - - - - 69563c97 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Add note describing IPE data compression See ticket #21766 - - - - - 7872e2b6 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Fix byte order of IPE data, fix IPE tests Make sure byte order of written IPE buffer entries matches target. Make sure the IPE-related tests properly access the fields of IPE buffer entry nodes with the new IPE layout. This commit also introduces checks to avoid importing modules if IPE compression is not enabled. See ticket #21766. - - - - - 0e85099b by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Fix IPE data decompression buffer allocation Capacity of buffers allocated for decompressed IPE data was incorrect due to a misuse of the `ZSTD_findFrameCompressedSize` function. Fix by always storing decompressed size of IPE data in IPE buffer list nodes and using `ZSTD_findFrameCompressedSize` to determine the size of the compressed data. See ticket #21766 - - - - - a0048866 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Add optional dependencies to ./configure output Changes the configure script to indicate whether libnuma, libzstd, or libdw are being used as dependencies due to their optional features being enabled. - - - - - 09d93bd0 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Add IPE-enabled builds to CI - Adds an IPE job to the CI pipeline which is triggered by the ~IPE label - Introduces CI logic to enable IPE data compression - Enables uncompressed IPE data on debug CI job - Regenerates jobs.yaml MR https://gitlab.haskell.org/ghc/ci-images/-/merge_requests/112 on the images repository is meant to ensure that the proper images have libzstd-dev installed. - - - - - 3ded9a1c by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Update user's guide and release notes, small fixes Add mention of IPE data compression to user's guide and the release notes for 9.8.1. Also note the impact compression has on binary size in both places. Change IpeBufferListNode compression check so only the value `1` indicates compression. See ticket #21766 - - - - - 41b41577 by Finley McIlwaine at 2023-06-01T04:53:12-04:00 Remove IPE enabled builds from CI We don't need to explicitly specify the +ipe transformer to test IPE data since there are tests which manually enable IPE information. This commit does leave zstd IPE data compression enabled on the debian CI jobs. - - - - - 982bef3a by Krzysztof Gogolewski at 2023-06-01T04:53:49-04:00 Fix build with 9.2 GHC.Tc.Zonk.Type uses an equality constraint. ghc.nix currently provides 9.2. - - - - - 1c96bc3d by Krzysztof Gogolewski at 2023-06-01T10:56:11-04:00 Output Lint errors to stderr instead of stdout This is a continuation of 7b095b99, which fixed warnings but not errors. Refs #13342 - - - - - 8e81f140 by sheaf at 2023-06-01T10:56:51-04:00 Refactor lookupExactOrOrig & friends This refactors the panoply of renamer lookup functions relating to lookupExactOrOrig to more graciously handle Exact and Orig names. In particular, we avoid the situation in which we would add Exact/Orig GREs to the tcg_used_gres field, which could cause a panic in bestImport like in #23240. Fixes #23428 - - - - - 5d415bfd by Krzysztof Gogolewski at 2023-06-01T10:57:31-04:00 Use the one-shot trick for UM and RewriteM functors As described in Note [The one-shot state monad trick], we shouldn't use derived Functor instances for monads using one-shot. This was done for most of them, but UM and RewriteM were missed. - - - - - 2c38551e by Krzysztof Gogolewski at 2023-06-01T10:58:08-04:00 Fix testsuite skipping Lint setTestOpts() is used to modify the test options for an entire .T file, rather than a single test. If there was a test using collect_compiler_stats, all of the tests in the same file had lint disabled. Fixes #21247 - - - - - 00a1e50b by Krzysztof Gogolewski at 2023-06-01T10:58:44-04:00 Add testcases for already fixed #16432 They were fixed by 40c7daed0. Fixes #16432 - - - - - f6e060cc by Krzysztof Gogolewski at 2023-06-02T09:07:25-04:00 cleanup: Remove unused field from SelfBoot It is no longer needed since Note [Extra dependencies from .hs-boot files] was deleted in 6998772043. I've also added tildes to Note headers, otherwise they're not detected by the linter. - - - - - 82eacab6 by sheaf at 2023-06-02T09:08:01-04:00 Delete GHC.Tc.Utils.Zonk This module was split up into GHC.Tc.Zonk.Type and GHC.Tc.Zonk.TcType in commit f62d8195, but I forgot to delete the original module - - - - - 4a4eb761 by Ben Gamari at 2023-06-02T23:53:21-04:00 base: Add build-order import of GHC.Types in GHC.IO.Handle.Types For reasons similar to those described in Note [Depend on GHC.Num.Integer]. Fixes #23411. - - - - - f53ac0ae by Sylvain Henry at 2023-06-02T23:54:01-04:00 JS: fix and enhance non-minimized code generation (#22455) Flag -ddisable-js-minimizer was producing invalid code. Fix that and also a few other things to generate nicer JS code for debugging. The added test checks that we don't regress when using the flag. - - - - - f7744e8e by Andrey Mokhov at 2023-06-03T16:49:44-04:00 [hadrian] Fix multiline synopsis rendering - - - - - b2c745db by Andrew Lelechenko at 2023-06-03T16:50:23-04:00 Elaborate on performance properties of Data.List.++ - - - - - 7cd8a61e by Matthew Pickering at 2023-06-05T11:46:23+01:00 Big TcLclEnv and CtLoc refactoring The overall goal of this refactoring is to reduce the dependency footprint of the parser and syntax tree. Good reasons include: - Better module graph parallelisability - Make it easier to migrate error messages without introducing module loops - Philosophically, there's not reason for the AST to depend on half the compiler. One of the key edges which added this dependency was > GHC.Hs.Expr -> GHC.Tc.Types (TcLclEnv) As this in turn depending on TcM which depends on HscEnv and so on. Therefore the goal of this patch is to move `TcLclEnv` out of `GHC.Tc.Types` so that `GHC.Hs.Expr` can import TcLclEnv without incurring a huge dependency chain. The changes in this patch are: * Move TcLclEnv from GHC.Tc.Types to GHC.Tc.Types.LclEnv * Create new smaller modules for the types used in TcLclEnv New Modules: - GHC.Tc.Types.ErrCtxt - GHC.Tc.Types.BasicTypes - GHC.Tc.Types.TH - GHC.Tc.Types.LclEnv - GHC.Tc.Types.CtLocEnv - GHC.Tc.Errors.Types.PromotionErr Removed Boot File: - {-# SOURCE #-} GHC.Tc.Types * Introduce TcLclCtxt, the part of the TcLclEnv which doesn't participate in restoreLclEnv. * Replace TcLclEnv in CtLoc with specific CtLocEnv which is defined in GHC.Tc.Types.CtLocEnv. Use CtLocEnv in Implic and CtLoc to record the location of the implication and constraint. By splitting up TcLclEnv from GHC.Tc.Types we allow GHC.Hs.Expr to no longer depend on the TcM monad and all that entails. Fixes #23389 #23409 - - - - - 3d8d39d1 by Matthew Pickering at 2023-06-05T11:46:23+01:00 Remove dependency of GHC.Tc.Utils.TcType on GHC.Driver.Session This removes the usage of DynFlags from Tc.Utils.TcType so that it no longer depends on GHC.Driver.Session. In general we don't want anything which is a dependency of Language.Haskell.Syntax to depend on GHC.Driver.Session and removing this edge gets us closer to that goal. - - - - - 18db5ada by Matthew Pickering at 2023-06-05T11:46:23+01:00 Move isIrrefutableHsPat to GHC.Rename.Utils and rename to isIrrefutableHsPatRn This removes edge from GHC.Hs.Pat to GHC.Driver.Session, which makes Language.Haskell.Syntax end up depending on GHC.Driver.Session. - - - - - 12919dd5 by Matthew Pickering at 2023-06-05T11:46:23+01:00 Remove dependency of GHC.Tc.Types.Constraint on GHC.Driver.Session - - - - - eb852371 by Matthew Pickering at 2023-06-05T11:46:24+01:00 hole fit plugins: Split definition into own module The hole fit plugins are defined in terms of TcM, a type we want to avoid depending on from `GHC.Tc.Errors.Types`. By moving it into its own module we can remove this dependency. It also simplifies the necessary boot file. - - - - - 9e5246d7 by Matthew Pickering at 2023-06-05T11:46:24+01:00 Move GHC.Core.Opt.CallerCC Types into separate module This allows `GHC.Driver.DynFlags` to depend on these types without depending on CoreM and hence the entire simplifier pipeline. We can also remove a hs-boot file with this change. - - - - - 52d6a7d7 by Matthew Pickering at 2023-06-05T11:46:24+01:00 Remove unecessary SOURCE import - - - - - 698d160c by Matthew Pickering at 2023-06-05T11:46:24+01:00 testsuite: Accept new output for CountDepsAst and CountDepsParser tests These are in a separate commit as the improvement to these tests is the cumulative effect of the previous set of patches rather than just the responsibility of the last one in the patchset. - - - - - 58ccf02e by sheaf at 2023-06-05T16:00:47-04:00 TTG: only allow VarBind at GhcTc The VarBind constructor of HsBind is only used at the GhcTc stage. This commit makes that explicit by setting the extension field of VarBind to be DataConCantHappen at all other stages. This allows us to delete a dead code path in GHC.HsToCore.Quote.rep_bind, and remove some panics. - - - - - 54b83253 by Matthew Craven at 2023-06-06T12:59:25-04:00 Generate Addr# access ops programmatically The existing utils/genprimopcode/gen_bytearray_ops.py was relocated and extended for this purpose. Additionally, hadrian now knows about this script and uses it when generating primops.txt - - - - - ecadbc7e by Matthew Pickering at 2023-06-06T13:00:01-04:00 ghcup-metadata: Only add Nightly tag when replacing LatestNightly Previously we were always adding the Nightly tag, but this led to all the previous builds getting an increasing number of nightly tags over time. Now we just add it once, when we remove the LatestNightly tag. - - - - - 4aea0a72 by Vladislav Zavialov at 2023-06-07T12:06:46+02:00 Invisible binders in type declarations (#22560) This patch implements @k-binders introduced in GHC Proposal #425 and guarded behind the TypeAbstractions extension: type D :: forall k j. k -> j -> Type data D @k @j a b = ... ^^ ^^ To represent the new syntax, we modify LHsQTyVars as follows: - hsq_explicit :: [LHsTyVarBndr () pass] + hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass] HsBndrVis is a new data type that records the distinction between type variable binders written with and without the @ sign: data HsBndrVis pass = HsBndrRequired | HsBndrInvisible (LHsToken "@" pass) The rest of the patch updates GHC, template-haskell, and haddock to handle the new syntax. Parser: The PsErrUnexpectedTypeAppInDecl error message is removed. The syntax it used to reject is now permitted. Renamer: The @ sign does not affect the scope of a binder, so the changes to the renamer are minimal. See rnLHsTyVarBndrVisFlag. Type checker: There are three code paths that were updated to deal with the newly introduced invisible type variable binders: 1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl 2. checking CUSK: see kcCheckDeclHeader_cusk 3. inference: see kcInferDeclHeader, rejectInvisibleBinders Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv are generalized to work with HsBndrVis. Updates the haddock submodule. Metric Increase: MultiLayerModulesTH_OneShot Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - b7600997 by Josh Meredith at 2023-06-07T13:10:21-04:00 JS: clean up FFI 'fat arrow' calls in base:System.Posix.Internals (#23481) - - - - - e5d3940d by Sebastian Graf at 2023-06-07T18:01:28-04:00 Update CODEOWNERS - - - - - 960ef111 by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Remove IPE enabled builds from CI" This reverts commit 41b41577c8a28c236fa37e8f73aa1c6dc368d951. - - - - - bad1c8cc by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Update user's guide and release notes, small fixes" This reverts commit 3ded9a1cd22f9083f31bc2f37ee1b37f9d25dab7. - - - - - 12726d90 by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Add IPE-enabled builds to CI" This reverts commit 09d93bd0305b0f73422ce7edb67168c71d32c15f. - - - - - dbdd989d by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Add optional dependencies to ./configure output" This reverts commit a00488665cd890a26a5564a64ba23ff12c9bec58. - - - - - 240483af by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Fix IPE data decompression buffer allocation" This reverts commit 0e85099b9316ee24565084d5586bb7290669b43a. - - - - - 9b8c7dd8 by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Fix byte order of IPE data, fix IPE tests" This reverts commit 7872e2b6f08ea40d19a251c4822a384d0b397327. - - - - - 3364379b by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Add note describing IPE data compression" This reverts commit 69563c97396b8fde91678fae7d2feafb7ab9a8b0. - - - - - fda30670 by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Fix libzstd detection in configure and RTS" This reverts commit 5aef5658ad5fb96bac7719710e0ea008bf7b62e0. - - - - - 1cbcda9a by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "IPE data compression" This reverts commit b7a640acf7adc2880e5600d69bcf2918fee85553. - - - - - fb5e99aa by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Add IPE compression to configure" This reverts commit 5d1f2411f4becea8650d12d168e989241edee186. - - - - - 2cdcb3a5 by Matthew Pickering at 2023-06-07T18:02:04-04:00 Revert "Restructure IPE buffer layout" This reverts commit f3556d6cefd3d923b36bfcda0c8185abb1d11a91. - - - - - 2b0c9f5e by Simon Peyton Jones at 2023-06-08T07:52:34+00:00 Don't report redundant Givens from quantified constraints This fixes #23323 See (RC4) in Note [Tracking redundant constraints] - - - - - 567b32e1 by David Binder at 2023-06-08T18:41:29-04:00 Update the outdated instructions in HACKING.md on how to compile GHC - - - - - 2b1a4abe by Ryan Scott at 2023-06-09T07:56:58-04:00 Restore mingwex dependency on Windows This partially reverts some of the changes in !9475 to make `base` and `ghc-prim` depend on the `mingwex` library on Windows. It also restores the RTS's stubs for `mingwex`-specific symbols such as `_lock_file`. This is done because the C runtime provides `libmingwex` nowadays, and moreoever, not linking against `mingwex` requires downstream users to link against it explicitly in difficult-to-predict circumstances. Better to always link against `mingwex` and prevent users from having to do the guesswork themselves. See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10360#note_495873 for the discussion that led to this. - - - - - 28954758 by Ryan Scott at 2023-06-09T07:56:58-04:00 RtsSymbols.c: Remove mingwex symbol stubs As of !9475, the RTS now links against `ucrt` instead of `msvcrt` on Windows, which means that the RTS no longer needs to declare stubs for the `__mingw_*` family of symbols. Let's remove these stubs to avoid confusion. Fixes #23309. - - - - - 3ab0155b by Ryan Scott at 2023-06-09T07:57:35-04:00 Consistently use validity checks for TH conversion of data constructors We were checking that TH-spliced data declarations do not look like this: ```hs data D :: Type = MkD Int ``` But we were only doing so for `data` declarations' data constructors, not for `newtype`s, `data instance`s, or `newtype instance`s. This patch factors out the necessary validity checks into its own `cvtDataDefnCons` function and uses it in all of the places where it needs to be. Fixes #22559. - - - - - a24b83dd by Matthew Pickering at 2023-06-09T15:19:00-04:00 Fix behaviour of -keep-tmp-files when used in OPTIONS_GHC pragma This fixes the behaviour of -keep-tmp-files when used in an OPTIONS_GHC pragma for files with module level scope. Instead of simple not deleting the files, we also need to remove them from the TmpFs so they are not deleted later on when all the other files are deleted. There are additional complications because you also need to remove the directory where these files live from the TmpFs so we don't try to delete those later either. I added two tests. 1. Tests simply that -keep-tmp-files works at all with a single module and --make mode. 2. The other tests that temporary files are deleted for other modules which don't enable -keep-tmp-files. Fixes #23339 - - - - - dcf32882 by Matthew Pickering at 2023-06-09T15:19:00-04:00 withDeferredDiagnostics: When debugIsOn, write landmine into IORef to catch use-after-free. Ticket #23305 reports an error where we were attempting to use the logger which was created by withDeferredDiagnostics after its scope had ended. This problem would have been caught by this patch and a validate build: ``` +*** Exception: Use after free +CallStack (from HasCallStack): + error, called at compiler/GHC/Driver/Make.hs:<line>:<column> in <package-id>:GHC.Driver.Make ``` This general issue is tracked by #20981 - - - - - 432c736c by Matthew Pickering at 2023-06-09T15:19:00-04:00 Don't return complete HscEnv from upsweep By returning a complete HscEnv from upsweep the logger (as introduced by withDeferredDiagnostics) was escaping the scope of withDeferredDiagnostics and hence we were losing error messages. This is reminiscent of #20981, which also talks about writing errors into messages after their scope has ended. See #23305 for details. - - - - - 26013cdc by Alexander McKenna at 2023-06-09T15:19:41-04:00 Dump `SpecConstr` specialisations separately Introduce a `-ddump-spec-constr` flag which debugs specialisations from `SpecConstr`. These are no longer shown when you use `-ddump-spec`. - - - - - 4639100b by Matthew Pickering at 2023-06-09T18:50:43-04:00 Add role annotations to SNat, SSymbol and SChar Ticket #23454 explained it was possible to implement unsafeCoerce because SNat was lacking a role annotation. As these are supposed to be singleton types but backed by an efficient representation the correct annotation is nominal to ensure these kinds of coerces are forbidden. These annotations were missed from https://github.com/haskell/core-libraries-committee/issues/85 which was implemented in 532de36870ed9e880d5f146a478453701e9db25d. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/170 Fixes #23454 - - - - - 9c0dcff7 by Matthew Pickering at 2023-06-09T18:51:19-04:00 Remove non-existant bytearray-ops.txt.pp file from ghc.cabal.in This broke the sdist generation. Fixes #23489 - - - - - 273ff0c7 by David Binder at 2023-06-09T18:52:00-04:00 Regression test T13438 is no longer marked as "expect_broken" in the testsuite driver. - - - - - b84a2900 by Andrei Borzenkov at 2023-06-10T08:27:28-04:00 Fix -Wterm-variable-capture scope (#23434) -Wterm-variable-capture wasn't accordant with type variable scoping in associated types, in type classes. For example, this code produced the warning: k = 12 class C k a where type AT a :: k -> Type I solved this issue by reusing machinery of newTyVarNameRn function that is accordand with associated types: it does lookup for each free type variable when we are in the type class context. And in this patch I use result of this work to make sure that -Wterm-variable-capture warns only on implicitly quantified type variables. - - - - - 9d1a8d87 by Jorge Mendes at 2023-06-10T08:28:10-04:00 Remove redundant case statement in rts/js/mem.js. - - - - - a1f350e2 by Oleg Grenrus at 2023-06-13T09:42:16-04:00 Change WarningWithFlag to plural WarningWithFlags Resolves #22825 Now each diagnostic can name multiple different warning flags for its reason. There is currently one use case: missing signatures. Currently we need to check which warning flags are enabled when generating the diagnostic, which is against the declarative nature of the diagnostic framework. This patch allows a warning diagnostic to have multiple warning flags, which makes setup more declarative. The WarningWithFlag pattern synonym is added for backwards compatibility The 'msgEnvReason' field is added to MsgEnvelope to store the `ResolvedDiagnosticReason`, which accounts for the enabled flags, and then that is used for pretty printing the diagnostic. - - - - - ec01f0ec by Matthew Pickering at 2023-06-13T09:42:59-04:00 Add a test Way for running ghci with Core optimizations Tracking ticket: #23059 This runs compile_and_run tests with optimised code with bytecode interpreter Changed submodules: hpc, process Co-authored-by: Torsten Schmits <git at tryp.io> - - - - - c6741e72 by Rodrigo Mesquita at 2023-06-13T09:43:38-04:00 Configure -Qunused-arguments instead of hardcoding it When GHC invokes clang, it currently passes -Qunused-arguments to discard warnings resulting from GHC using multiple options that aren't used. In this commit, we configure -Qunused-arguments into the Cc options instead of checking if the compiler is clang at runtime and hardcoding the flag into GHC. This is part of the effort to centralise toolchain information in toolchain target files at configure time with the end goal of a runtime retargetable GHC. This also means we don't need to call getCompilerInfo ever, which improves performance considerably (see !10589). Metric Decrease: PmSeriesG T10421 T11303b T12150 T12227 T12234 T12425 T13035 T13253-spj T13386 T15703 T16875 T17836b T17977 T17977b T18140 T18282 T18304 T18698a T18698b T18923 T20049 T21839c T3064 T5030 T5321FD T5321Fun T5837 T6048 T9020 T9198 T9872d T9961 - - - - - 0128db87 by Victor Cacciari Miraldo at 2023-06-13T09:44:18-04:00 Improve docs for Data.Fixed; adds 'realToFrac' as an option for conversion between different precisions. - - - - - 95b69cfb by Ryan Scott at 2023-06-13T09:44:55-04:00 Add regression test for #23143 !10541, the fix for #23323, also fixes #23143. Let's add a regression test to ensure that it stays fixed. Fixes #23143. - - - - - ed2dbdca by Emily Martins at 2023-06-13T09:45:37-04:00 delete GHCi.UI.Tags module and remove remaining references Co-authored-by: Tilde Rose <t1lde at protonmail.com> - - - - - c90d96e4 by Victor Cacciari Miraldo at 2023-06-13T09:46:26-04:00 Add regression test for 17328 - - - - - de58080c by Victor Cacciari Miraldo at 2023-06-13T09:46:26-04:00 Skip checking whether constructors are in scope when deriving newtype instances. Fixes #17328 - - - - - 5e3c2b05 by Philip Hazelden at 2023-06-13T09:47:07-04:00 Don't suggest `DeriveAnyClass` when instance can't be derived. Fixes #19692. Prototypical cases: class C1 a where x1 :: a -> Int data G1 = G1 deriving C1 class C2 a where x2 :: a -> Int x2 _ = 0 data G2 = G2 deriving C2 Both of these used to give this suggestion, but for C1 the suggestion would have failed (generated code with undefined methods, which compiles but warns). Now C2 still gives the suggestion but C1 doesn't. - - - - - 80a0b099 by David Binder at 2023-06-13T09:47:49-04:00 Add testcase for error GHC-00711 to testsuite - - - - - e4b33a1d by Oleg Grenrus at 2023-06-14T07:01:21-04:00 Add -Wmissing-poly-kind-signatures Implements #22826 This is a restricted version of -Wmissing-kind-signatures shown only for polykinded types. - - - - - f8395b94 by doyougnu at 2023-06-14T07:02:01-04:00 ci: special case in req_host_target_ghc for JS - - - - - b852a5b6 by Gergő Érdi at 2023-06-14T07:02:42-04:00 When forcing a `ModIface`, force the `MINIMAL` pragmas in class definitions Fixes #23486 - - - - - c29b45ee by Krzysztof Gogolewski at 2023-06-14T07:03:19-04:00 Add a testcase for #20076 Remove 'recursive' in the error message, since the error can arise without recursion. - - - - - b80ef202 by Krzysztof Gogolewski at 2023-06-14T07:03:56-04:00 Use tcInferFRR to prevent bad generalisation Fixes #23176 - - - - - bd8ef37d by Matthew Pickering at 2023-06-14T07:04:31-04:00 ci: Add dependenices on necessary aarch64 jobs for head.hackage ci These need to be added since we started testing aarch64 on head.hackage CI. The jobs will sometimes fail because they will start before the relevant aarch64 job has finished. Fixes #23511 - - - - - a0c27cee by Vladislav Zavialov at 2023-06-14T07:05:08-04:00 Add standalone kind signatures for Code and TExp CodeQ and TExpQ already had standalone kind signatures even before this change: type TExpQ :: TYPE r -> Kind.Type type CodeQ :: TYPE r -> Kind.Type Now Code and TExp have signatures too: type TExp :: TYPE r -> Kind.Type type Code :: (Kind.Type -> Kind.Type) -> TYPE r -> Kind.Type This is a stylistic change. - - - - - e70c1245 by Tom Ellis at 2023-06-14T07:05:48-04:00 Warn that GHC.TypeLits.Internal should not be used - - - - - 100650e3 by Tom Ellis at 2023-06-14T07:05:48-04:00 Warn that GHC.TypeNats.Internal should not be used - - - - - 078250ef by Jacco Krijnen at 2023-06-14T17:17:53-04:00 Add more flags for dumping core passes (#23491) - - - - - 1b7604af by Jacco Krijnen at 2023-06-14T17:17:53-04:00 Add tests for dumping flags (#23491) - - - - - 42000000 by Sebastian Graf at 2023-06-14T17:18:29-04:00 Provide a demand signature for atomicModifyMutVar.# (#23047) Fixes #23047 - - - - - 8f27023b by Ben Gamari at 2023-06-15T03:10:24-04:00 compiler: Cross-reference Note [StgToJS design] In particular, the numeric representations are quite useful context in a few places. - - - - - a71b60e9 by Andrei Borzenkov at 2023-06-15T03:11:00-04:00 Implement the -Wimplicit-rhs-quantification warning (#23510) GHC Proposal #425 "Invisible binders in type declarations" forbids implicit quantification of type variables that occur free on the right-hand side of a type synonym but are not mentioned on the left-hand side. The users are expected to rewrite this using invisible binders: type T1 :: forall a . Maybe a type T1 = 'Nothing :: Maybe a -- old type T1 @a = 'Nothing :: Maybe a -- new Since the @k-binders are a new feature, we need to wait for three releases before we require the use of the new syntax. In the meantime, we ought to provide users with a new warning, -Wimplicit-rhs-quantification, that would detect when such implicit quantification takes place, and include it in -Wcompat. - - - - - 0078dd00 by Sven Tennie at 2023-06-15T03:11:36-04:00 Minor refactorings to mkSpillInstr and mkLoadInstr Better error messages. And, use the existing `off` constant to reduce duplication. - - - - - 1792b57a by doyougnu at 2023-06-15T03:12:17-04:00 JS: merge util modules Merge Core and StgUtil modules for StgToJS pass. Closes: #23473 - - - - - 469ff08b by Vladislav Zavialov at 2023-06-15T03:12:57-04:00 Check visibility of nested foralls in can_eq_nc (#18863) Prior to this change, `can_eq_nc` checked the visibility of the outermost layer of foralls: forall a. forall b. forall c. phi1 forall x. forall y. forall z. phi2 ^^ up to here Then it delegated the rest of the work to `can_eq_nc_forall`, which split off all foralls: forall a. forall b. forall c. phi1 forall x. forall y. forall z. phi2 ^^ up to here This meant that some visibility flags were completely ignored. We fix this oversight by moving the check to `can_eq_nc_forall`. - - - - - 59c9065b by Luite Stegeman at 2023-06-15T03:13:37-04:00 JS: use regular mask for blocking IO Blocking IO used uninterruptibleMask which should make any thread blocked on IO unreachable by async exceptions (such as those from timeout). This changes it to a regular mask. It's important to note that the nodejs runtime does not actually interrupt the blocking IO when the Haskell thread receives an async exception, and that file positions may be updated and buffers may be written after the Haskell thread has already resumed. Any file descriptor affected by an async exception interruption should therefore be used with caution. - - - - - 907c06c3 by Luite Stegeman at 2023-06-15T03:13:37-04:00 JS: nodejs: do not set 'readable' handler on stdin at startup The Haskell runtime used to install a 'readable' handler on stdin at startup in nodejs. This would cause the nodejs system to start buffering the stream, causing data loss if the stdin file descriptor is passed to another process. This change delays installation of the 'readable' handler until the first read of stdin by Haskell code. - - - - - a54b40a9 by Luite Stegeman at 2023-06-15T03:13:37-04:00 JS: reserve one more virtual (negative) file descriptor This is needed for upcoming support of the process package - - - - - 78cd1132 by Andrei Borzenkov at 2023-06-15T11:16:11+04:00 Report scoped kind variables at the type-checking phase (#16635) This patch modifies the renamer to respect ScopedTypeVariables in kind signatures. This means that kind variables bound by the outermost `forall` now scope over the type: type F = '[Right @a @() () :: forall a. Either a ()] -- ^^^^^^^^^^^^^^^ ^^^ -- in scope here bound here However, any use of such variables is a type error, because we don't have type-level lambdas to bind them in Core. This is described in the new Note [Type variable scoping errors during type check] in GHC.Tc.Types. - - - - - 4a41ba75 by Sylvain Henry at 2023-06-15T18:09:15-04:00 JS: testsuite: use correct ticket number Replace #22356 with #22349 for these tests because #22356 has been fixed but now these tests fail because of #22349. - - - - - 15f150c8 by Sylvain Henry at 2023-06-15T18:09:16-04:00 JS: testsuite: update ticket numbers - - - - - 08d8e9ef by Sylvain Henry at 2023-06-15T18:09:16-04:00 JS: more triage - - - - - e8752e12 by Krzysztof Gogolewski at 2023-06-15T18:09:52-04:00 Fix test T18522-deb-ppr Fixes #23509 - - - - - 62c56416 by Ben Price at 2023-06-16T05:52:39-04:00 Lint: more details on "Occurrence is GlobalId, but binding is LocalId" This is helpful when debugging a pass which accidentally shadowed a binder. - - - - - d4c10238 by Ryan Hendrickson at 2023-06-16T05:53:22-04:00 Clean a stray bit of text in user guide - - - - - 93647b5c by Vladislav Zavialov at 2023-06-16T05:54:02-04:00 testsuite: Add forall visibility test cases The added tests ensure that the type checker does not confuse visible and invisible foralls. VisFlag1: kind-checking type applications and inferred type variable instantiations VisFlag1_ql: kind-checking Quick Look instantiations VisFlag2: kind-checking type family instances VisFlag3: checking kind annotations on type parameters of associated type families VisFlag4: checking kind annotations on type parameters in type declarations with SAKS VisFlag5: checking the result kind annotation of data family instances - - - - - a5f0c00e by Sylvain Henry at 2023-06-16T12:25:40-04:00 JS: factorize SaneDouble into its own module Follow-up of b159e0e9 whose ticket is #22736 - - - - - 0baf9e7c by Krzysztof Gogolewski at 2023-06-16T12:26:17-04:00 Add tests for #21973 - - - - - 640ea90e by Diego Diverio at 2023-06-16T23:07:55-04:00 Update documentation for `<**>` - - - - - 2469a813 by Diego Diverio at 2023-06-16T23:07:55-04:00 Update text - - - - - 1f515bbb by Diego Diverio at 2023-06-16T23:07:55-04:00 Update examples - - - - - 7af99a0d by Diego Diverio at 2023-06-16T23:07:55-04:00 Update documentation to actually display code correctly - - - - - 800aad7e by Andrei Borzenkov at 2023-06-16T23:08:32-04:00 Type/data instances: require that variables on the RHS are mentioned on the LHS (#23512) GHC Proposal #425 "Invisible binders in type declarations" restricts the scope of type and data family instances as follows: In type family and data family instances, require that every variable mentioned on the RHS must also occur on the LHS. For example, here are three equivalent type instance definitions accepted before this patch: type family F1 a :: k type instance F1 Int = Any :: j -> j type family F2 a :: k type instance F2 @(j -> j) Int = Any :: j -> j type family F3 a :: k type instance forall j. F3 Int = Any :: j -> j - In F1, j is implicitly quantified and it occurs only on the RHS; - In F2, j is implicitly quantified and it occurs both on the LHS and the RHS; - In F3, j is explicitly quantified. Now F1 is rejected with an out-of-scope error, while F2 and F3 continue to be accepted. - - - - - 9132d529 by Sylvain Henry at 2023-06-18T02:50:34-04:00 JS: testsuite: use correct ticket numbers - - - - - c3a1274c by Sylvain Henry at 2023-06-18T02:50:34-04:00 JS: don't dump eventlog to stderr by default Fix T16707 Bump stm submodule - - - - - 89bb8ad8 by Ryan Hendrickson at 2023-06-18T02:51:14-04:00 Fix TH name lookup for symbolic tycons (#23525) - - - - - cb9e1ce4 by Finley McIlwaine at 2023-06-18T21:16:45-06:00 IPE data compression IPE data resulting from the `-finfo-table-map` flag may now be compressed by configuring the GHC build with the `--enable-ipe-data-compression` flag. This results in about a 20% reduction in the size of IPE-enabled build results. The compression library, zstd, may optionally be statically linked by configuring with the `--enabled-static-libzstd` flag (on non-darwin platforms) libzstd version 1.4.0 or greater is required. - - - - - 0cbc3ae0 by Gergő Érdi at 2023-06-19T09:11:38-04:00 Add `IfaceWarnings` to represent the `ModIface`-storable parts of a `Warnings GhcRn`. Fixes #23516 - - - - - 3e80c2b4 by Arnaud Spiwack at 2023-06-20T03:19:41-04:00 Avoid desugaring non-recursive lets into recursive lets This prepares for having linear let expressions in the frontend. When desugaring lets, SPECIALISE statements create more copies of a let binding. Because of the rewrite rules attached to the bindings, there are dependencies between the generated binds. Before this commit, we simply wrapped all these in a mutually recursive let block, and left it to the simplified to sort it out. With this commit: we are careful to generate the bindings in dependency order, so that we can wrap them in consecutive lets (if the source is non-recursive). - - - - - 9fad49e0 by Ben Gamari at 2023-06-20T03:20:19-04:00 rts: Do not call exit() from SIGINT handler Previously `shutdown_handler` would call `stg_exit` if the scheduler was Oalready found to be in `SCHED_INTERRUPTING` state (or higher). However, `stg_exit` is not signal-safe as it calls `exit` (which calls `atexit` handlers). The only safe thing to do in this situation is to call `_exit`, which terminates with minimal cleanup. Fixes #23417. - - - - - 7485f848 by Andrew Lelechenko at 2023-06-20T03:20:57-04:00 Bump Cabal submodule This requires changing the recomp007 test because now cabal passes `this-unit-id` to executable components, and that unit-id contains a hash which includes the ABI of the dependencies. Therefore changing the dependencies means that -this-unit-id changes and recompilation is triggered. The spririt of the test is to test GHC's recompilation logic assuming that `-this-unit-id` is constant, so we explicitly pass `-ipid` to `./configure` rather than letting `Cabal` work it out. - - - - - 1464a2a8 by mangoiv at 2023-06-20T03:21:34-04:00 [feat] add a hint to `HasField` error message - add a hint that indicates that the record that the record dot is used on might just be missing a field - as the intention of the programmer is not entirely clear, it is only shown if the type is known - This addresses in part issue #22382 - - - - - b65e78dd by Ben Gamari at 2023-06-20T16:56:43-04:00 rts/ipe: Fix unused lock warning - - - - - 6086effd by Ben Gamari at 2023-06-20T16:56:44-04:00 rts/ProfilerReportJson: Fix memory leak - - - - - 1e48c434 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Various warnings fixes - - - - - 471486b9 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Fix printf format mismatch - - - - - 80603fb3 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Fix incorrect #include <sys/poll.h> According to Alpine's warnings and poll(2), <poll.h> should be preferred. - - - - - ff18e6fd by Ben Gamari at 2023-06-20T16:56:44-04:00 nonmoving: Fix unused definition warrnings - - - - - 6e7fe8ee by Ben Gamari at 2023-06-20T16:56:44-04:00 Disable futimens on Darwin. See #22938 - - - - - b7706508 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Fix incorrect CPP guard - - - - - 94f00e9b by Ben Gamari at 2023-06-20T16:56:44-04:00 hadrian: Ensure that -Werror is passed when compiling the RTS. Previously the `+werror` transformer would only pass `-Werror` to GHC, which does not ensure that the same is passed to the C compiler when building the RTS. Arguably this is itself a bug but for now we will just work around this by passing `-optc-Werror` to GHC. I tried to enable `-Werror` in all C compilations but the boot libraries are something of a portability nightmare. - - - - - 5fb54bf8 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Disable `#pragma GCC`s on clang compilers Otherwise the build fails due to warnings. See #23530. - - - - - cf87f380 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Fix capitalization of prototype - - - - - 17f250d7 by Ben Gamari at 2023-06-20T16:56:44-04:00 rts: Fix incorrect format specifier - - - - - 0ff1c501 by Josh Meredith at 2023-06-20T16:57:20-04:00 JS: remove js_broken(22576) in favour of the pre-existing wordsize(32) condition (#22576) - - - - - 3d1d42b7 by Finley McIlwaine at 2023-06-21T12:04:58-04:00 Memory usage fixes for Haddock - Do not include `mi_globals` in the `NoBackend` backend. It was only included for Haddock, but Haddock does not actually need it. This causes a 200MB reduction in max residency when generating haddocks on the Agda codebase (roughly 1GB to 800MB). - Make haddock_{parser,renamer}_perf tests more accurate by forcing docs to be written to interface files using `-fwrite-interface` Bumps haddock submodule. Metric Decrease: haddock.base - - - - - 8185b1c2 by Finley McIlwaine at 2023-06-21T12:04:58-04:00 Fix associated data family doc structure items Associated data families were being given their own export DocStructureItems, which resulted in them being documented separately from their classes in haddocks. This commit fixes it. - - - - - 4d356ea3 by Sylvain Henry at 2023-06-21T12:04:59-04:00 JS: implement TH support - Add ghc-interp.js bootstrap script for the JS interpreter - Interactively link and execute iserv code from the ghci package - Incrementally load and run JS code for splices into the running iserv Co-authored-by: Luite Stegeman <stegeman at gmail.com> - - - - - 3249cf12 by Sylvain Henry at 2023-06-21T12:04:59-04:00 Don't use getKey - - - - - f84ff161 by Sylvain Henry at 2023-06-21T12:04:59-04:00 Stg: return imported FVs This is used to determine what to link when using the interpreter. For now it's only used by the JS interpreter but it could easily be used by the native interpreter too (instead of extracting names from compiled BCOs). - - - - - fab2ad23 by Sylvain Henry at 2023-06-21T12:04:59-04:00 Fix some recompilation avoidance tests - - - - - a897dc13 by Sylvain Henry at 2023-06-21T12:04:59-04:00 TH_import_loop is now broken as expected - - - - - dbb4ad51 by Sylvain Henry at 2023-06-21T12:04:59-04:00 JS: always recompile when TH is enabled (cf #23013) - - - - - 711b1d24 by Bartłomiej Cieślar at 2023-06-21T12:59:27-04:00 Add support for deprecating exported items (proposal #134) This is an implementation of the deprecated exports proposal #134. The proposal introduces an ability to introduce warnings to exports. This allows for deprecating a name only when it is exported from a specific module, rather than always depreacting its usage. In this example: module A ({-# DEPRECATED "do not use" #-} x) where x = undefined --- module B where import A(x) `x` will emit a warning when it is explicitly imported. Like the declaration warnings, export warnings are first accumulated within the `Warnings` struct, then passed into the ModIface, from which they are then looked up and warned about in the importing module in the `lookup_ie` helpers of the `filterImports` function (for the explicitly imported names) and in the `addUsedGRE(s)` functions where they warn about regular usages of the imported name. In terms of the AST information, the custom warning is stored in the extension field of the variants of the `IE` type (see Trees that Grow for more information). The commit includes a bump to the haddock submodule added in MR #28 Signed-off-by: Bartłomiej Cieślar <bcieslar2001 at gmail.com> - - - - - c1865854 by Ben Gamari at 2023-06-21T12:59:30-04:00 configure: Bump version to 9.8 Bumps Haddock submodule - - - - - 4e1de71c by Ben Gamari at 2023-06-21T21:07:48-04:00 configure: Bump version to 9.9 Bumps haddock submodule. - - - - - 5b6612bc by Ben Gamari at 2023-06-23T03:56:49-04:00 rts: Work around missing prototypes errors Darwin's toolchain inexpliciably claims that `write_barrier` and friends have declarations without prototypes, despite the fact that (a) they are definitions, and (b) the prototypes appear only a few lines above. Work around this by making the definitions proper prototypes. - - - - - 43b66a13 by Matthew Pickering at 2023-06-23T03:57:26-04:00 ghcup-metadata: Fix date modifier (M = minutes, m = month) Fixes #23552 - - - - - 564164ef by Luite Stegeman at 2023-06-24T10:27:29+09:00 Support large stack frames/offsets in GHCi bytecode interpreter Bytecode instructions like PUSH_L (push a local variable) contain an operand that refers to the stack slot. Before this patch, the operand type was SmallOp (Word16), limiting the maximum stack offset to 65535 words. This could cause compiler panics in some cases (See #22888). This patch changes the operand type for stack offsets from SmallOp to Op, removing the stack offset limit. Fixes #22888 - - - - - 8d6574bc by Sylvain Henry at 2023-06-26T13:15:06-04:00 JS: support levity-polymorphic datatypes (#22360,#22291) - thread knowledge about levity into PrimRep instead of panicking - JS: remove assumption that unlifted heap objects are rts objects (TVar#, etc.) Doing this also fixes #22291 (test added). There is a small performance hit (~1% more allocations). Metric Increase: T18698a T18698b - - - - - 5578bbad by Matthew Pickering at 2023-06-26T13:15:43-04:00 MR Review Template: Mention "Blocked on Review" label In order to improve our MR review processes we now have the label "Blocked on Review" which allows people to signal that a MR is waiting on a review to happen. See: https://mail.haskell.org/pipermail/ghc-devs/2023-June/021255.html - - - - - 4427e9cf by Matthew Pickering at 2023-06-26T13:15:43-04:00 Move MR template to Default.md This makes it more obvious what you have to modify to affect the default template rather than looking in the project settings. - - - - - 522bd584 by Arnaud Spiwack at 2023-06-26T13:16:33-04:00 Revert "Avoid desugaring non-recursive lets into recursive lets" This (temporary) reverts commit 3e80c2b40213bebe302b1bd239af48b33f1b30ef. Fixes #23550 - - - - - c59fbb0b by Torsten Schmits at 2023-06-26T19:34:20+02:00 Propagate breakpoint information when inlining across modules Tracking ticket: #23394 MR: !10448 * Add constructor `IfaceBreakpoint` to `IfaceTickish` * Store breakpoint data in interface files * Store `BreakArray` for the breakpoint's module, not the current module, in BCOs * Store module name in BCOs instead of `Unique`, since the `Unique` from an `Iface` doesn't match the modules in GHCi's state * Allocate module name in `ModBreaks`, like `BreakArray` * Lookup breakpoint by module name in GHCi * Skip creating breakpoint instructions when no `ModBreaks` are available, rather than injecting `ModBreaks` in the linker when breakpoints are enabled, and panicking when `ModBreaks` is missing - - - - - 6f904808 by Greg Steuck at 2023-06-27T16:53:07-04:00 Remove undefined FP_PROG_LD_BUILD_ID from configure.ac's - - - - - e89aa072 by Andrei Borzenkov at 2023-06-27T16:53:44-04:00 Remove arity inference in type declarations (#23514) Arity inference in type declarations was introduced as a workaround for the lack of @k-binders. They were added in 4aea0a72040, so I simplified all of this by simply removing arity inference altogether. This is part of GHC Proposal #425 "Invisible binders in type declarations". - - - - - 459dee1b by Torsten Schmits at 2023-06-27T16:54:20-04:00 Relax defaulting of RuntimeRep/Levity when printing Fixes #16468 MR: !10702 Only default RuntimeRep to LiftedRep when variables are bound by the toplevel forall - - - - - 151f8f18 by Torsten Schmits at 2023-06-27T16:54:57-04:00 Remove duplicate link label in linear types docs - - - - - ecdc4353 by Rodrigo Mesquita at 2023-06-28T12:24:57-04:00 Stop configuring unused Ld command in `settings` GHC has no direct dependence on the linker. Rather, we depend upon the C compiler for linking and an object-merging program (which is typically `ld`) for production of GHCi objects and merging of C stubs into final object files. Despite this, for historical reasons we still recorded information about the linker into `settings`. Remove these entries from `settings`, `hadrian/cfg/system.config`, as well as the `configure` logic responsible for this information. Closes #23566. - - - - - bf9ec3e4 by Bryan Richter at 2023-06-28T12:25:33-04:00 Remove extraneous debug output - - - - - 7eb68dd6 by Bryan Richter at 2023-06-28T12:25:33-04:00 Work with unset vars in -e mode - - - - - 49c27936 by Bryan Richter at 2023-06-28T12:25:33-04:00 Pass positional arguments in their positions By quoting $cmd, the default "bash -i" is a single argument to run, and no file named "bash -i" actually exists to be run. - - - - - 887dc4fc by Bryan Richter at 2023-06-28T12:25:33-04:00 Handle unset value in -e context - - - - - 5ffc7d7b by Rodrigo Mesquita at 2023-06-28T21:07:36-04:00 Configure CPP into settings There is a distinction to be made between the Haskell Preprocessor and the C preprocessor. The former is used to preprocess Haskell files, while the latter is used in C preprocessing such as Cmm files. In practice, they are both the same program (usually the C compiler) but invoked with different flags. Previously we would, at configure time, configure the haskell preprocessor and save the configuration in the settings file, but, instead of doing the same for CPP, we had hardcoded in GHC that the CPP program was either `cc -E` or `cpp`. This commit fixes that asymmetry by also configuring CPP at configure time, and tries to make more explicit the difference between HsCpp and Cpp (see Note [Preprocessing invocations]). Note that we don't use the standard CPP and CPPFLAGS to configure Cpp, but instead use the non-standard --with-cpp and --with-cpp-flags. The reason is that autoconf sets CPP to "$CC -E", whereas we expect the CPP command to be configured as a standalone executable rather than a command. These are symmetrical with --with-hs-cpp and --with-hs-cpp-flags. Cleanup: Hadrian no longer needs to pass the CPP configuration for CPP to be C99 compatible through -optP, since we now configure that into settings. Closes #23422 - - - - - 5efa9ca5 by Ben Gamari at 2023-06-28T21:08:13-04:00 hadrian: Always canonicalize topDirectory Hadrian's `topDirectory` is intended to provide an absolute path to the root of the GHC tree. However, if the tree is reached via a symlink this One question here is whether the `canonicalizePath` call is expensive enough to warrant caching. In a quick microbenchmark I observed that `canonicalizePath "."` takes around 10us per call; this seems sufficiently low not to worry. Alternatively, another approach here would have been to rather move the canonicalization into `m4/fp_find_root.m4`. This would have avoided repeated canonicalization but sadly path canonicalization is a hard problem in POSIX shell. Addresses #22451. - - - - - b3e1436f by aadaa_fgtaa at 2023-06-28T21:08:53-04:00 Optimise ELF linker (#23464) - cache last elements of `relTable`, `relaTable` and `symbolTables` in `ocInit_ELF` - cache shndx table in ObjectCode - run `checkProddableBlock` only with debug rts - - - - - 30525b00 by Ben Gamari at 2023-06-28T21:09:30-04:00 compiler: Introduce MO_{ACQUIRE,RELEASE}_FENCE - - - - - b787e259 by Ben Gamari at 2023-06-28T21:09:30-04:00 compiler: Drop MO_WriteBarrier rts: Drop write_barrier - - - - - 7550b4a5 by Ben Gamari at 2023-06-28T21:09:30-04:00 rts: Drop load_store_barrier() This is no longer used. - - - - - d5f2875e by Ben Gamari at 2023-06-28T21:09:31-04:00 rts: Drop last instances of prim_{write,read}_barrier - - - - - 965ac2ba by Ben Gamari at 2023-06-28T21:09:31-04:00 rts: Eliminate remaining uses of load_load_barrier - - - - - 0fc5cb97 by Sven Tennie at 2023-06-28T21:09:31-04:00 compiler: Drop MO_ReadBarrier - - - - - 7a7d326c by Ben Gamari at 2023-06-28T21:09:31-04:00 rts: Drop load_load_barrier This is no longer used. - - - - - 9f63da66 by Sven Tennie at 2023-06-28T21:09:31-04:00 Delete write_barrier function - - - - - bb0ed354 by Ben Gamari at 2023-06-28T21:09:31-04:00 rts: Make collectFreshWeakPtrs definition a prototype x86-64/Darwin's toolchain inexplicably warns that collectFreshWeakPtrs needs to be a prototype. - - - - - ef81a1eb by Sven Tennie at 2023-06-28T21:10:08-04:00 Fix number of free double regs D1..D4 are defined for aarch64 and thus not free. - - - - - c335fb7c by Ryan Scott at 2023-06-28T21:10:44-04:00 Fix typechecking of promoted empty lists The `'[]` case in `tc_infer_hs_type` is smart enough to handle arity-0 uses of `'[]` (see the newly added `T23543` test case for an example), but the `'[]` case in `tc_hs_type` was not. We fix this by changing the `tc_hs_type` case to invoke `tc_infer_hs_type`, as prescribed in `Note [Future-proofing the type checker]`. There are some benign changes to test cases' expected output due to the new code path using `forall a. [a]` as the kind of `'[]` rather than `[k]`. Fixes #23543. - - - - - fcf310e7 by Rodrigo Mesquita at 2023-06-28T21:11:21-04:00 Configure MergeObjs supports response files rather than Ld The previous configuration script to test whether Ld supported response files was * Incorrect (see #23542) * Used, in practice, to check if the *merge objects tool* supported response files. This commit modifies the macro to run the merge objects tool (rather than Ld), using a response file, and checking the result with $NM Fixes #23542 - - - - - 78b2f3cc by Sylvain Henry at 2023-06-28T21:12:02-04:00 JS: fix JS stack printing (#23565) - - - - - 9f01d14b by Matthew Pickering at 2023-06-29T04:13:41-04:00 Add -fpolymorphic-specialisation flag (off by default at all optimisation levels) Polymorphic specialisation has led to a number of hard to diagnose incorrect runtime result bugs (see #23469, #23109, #21229, #23445) so this commit introduces a flag `-fpolymorhphic-specialisation` which allows users to turn on this experimental optimisation if they are willing to buy into things going very wrong. Ticket #23469 - - - - - b1e611d5 by Ben Gamari at 2023-06-29T04:14:17-04:00 Rip out runtime linker/compiler checks We used to choose flags to pass to the toolchain at runtime based on the platform running GHC, and in this commit we drop all of those runtime linker checks Ultimately, this represents a change in policy: We no longer adapt at runtime to the toolchain being used, but rather make final decisions about the toolchain used at /configure time/ (we have deleted Note [Run-time linker info] altogether!). This works towards the goal of having all toolchain configuration logic living in the same place, which facilities the work towards a runtime-retargetable GHC (see #19877). As of this commit, the runtime linker/compiler logic was moved to autoconf, but soon it, and the rest of the existing toolchain configuration logic, will live in the standalone ghc-toolchain program (see !9263) In particular, what used to be done at runtime is now as follows: * The flags -Wl,--no-as-needed for needed shared libs are configured into settings * The flag -fstack-check is configured into settings * The check for broken tables-next-to-code was outdated * We use the configured c compiler by default as the assembler program * We drop `asmOpts` because we already configure -Qunused-arguments flag into settings (see !10589) Fixes #23562 Co-author: Rodrigo Mesquita (@alt-romes) - - - - - 8b35e8ca by Ben Gamari at 2023-06-29T18:46:12-04:00 Define FFI_GO_CLOSURES The libffi shipped with Apple's XCode toolchain does not contain a definition of the FFI_GO_CLOSURES macro, despite containing references to said macro. Work around this by defining the macro, following the model of a similar workaround in OpenJDK [1]. [1] https://github.com/openjdk/jdk17u-dev/pull/741/files - - - - - d7ef1704 by Ben Gamari at 2023-06-29T18:46:12-04:00 base: Fix incorrect CPP guard This was guarded on `darwin_HOST_OS` instead of `defined(darwin_HOST_OS)`. - - - - - 7c7d1f66 by Ben Gamari at 2023-06-29T18:46:48-04:00 rts/Trace: Ensure that debugTrace arguments are used As debugTrace is a macro we must take care to ensure that the fact is clear to the compiler lest we see warnings. - - - - - cb92051e by Ben Gamari at 2023-06-29T18:46:48-04:00 rts: Various warnings fixes - - - - - dec81dd1 by Ben Gamari at 2023-06-29T18:46:48-04:00 hadrian: Ignore warnings in unix and semaphore-compat - - - - - d7f6448a by Matthew Pickering at 2023-06-30T12:38:43-04:00 hadrian: Fix dependencies of docs:* rule For the docs:* rule we need to actually build the package rather than just the haddocks for the dependent packages. Therefore we depend on the .conf files of the packages we are trying to build documentation for as well as the .haddock files. Fixes #23472 - - - - - cec90389 by sheaf at 2023-06-30T12:39:27-04:00 Add tests for #22106 Fixes #22106 - - - - - 083794b1 by Torsten Schmits at 2023-07-03T03:27:27-04:00 Add -fbreak-points to control breakpoint insertion Rather than statically enabling breakpoints only for the interpreter, this adds a new flag. Tracking ticket: #23057 MR: !10466 - - - - - fd8c5769 by Ben Gamari at 2023-07-03T03:28:04-04:00 rts: Ensure that pinned allocations respect block size Previously, it was possible for pinned, aligned allocation requests to allocate beyond the end of the pinned accumulator block. Specifically, we failed to account for the padding needed to achieve the requested alignment in the "large object" check. With large alignment requests, this can result in the allocator using the capability's pinned object accumulator block to service a request which is larger than `PINNED_EMPTY_SIZE`. To fix this we reorganize `allocatePinned` to consistently account for the alignment padding in all large object checks. This is a bit subtle as we must handle the case of a small allocation request filling the accumulator block, as well as large requests. Fixes #23400. - - - - - 98185d52 by Ben Gamari at 2023-07-03T03:28:05-04:00 testsuite: Add test for #23400 - - - - - 4aac0540 by Ben Gamari at 2023-07-03T03:28:42-04:00 ghc-heap: Support for BLOCKING_QUEUE closures - - - - - 03f941f4 by Ben Bellick at 2023-07-03T03:29:29-04:00 Add some structured diagnostics in Tc/Validity.hs This addresses the work of ticket #20118 Created the following constructors for TcRnMessage - TcRnInaccessibleCoAxBranch - TcRnPatersonCondFailure - - - - - 6074cc3c by Moisés Ackerman at 2023-07-03T03:30:13-04:00 Add failing test case for #23492 - - - - - 356a2692 by Moisés Ackerman at 2023-07-03T03:30:13-04:00 Use generated src span for catch-all case of record selector functions This fixes #23492. The problem was that we used the real source span of the field declaration for the generated catch-all case in the selector function, in particular in the generated call to `recSelError`, which meant it was included in the HIE output. Using `generatedSrcSpan` instead means that it is not included. - - - - - 3efe7f39 by Moisés Ackerman at 2023-07-03T03:30:13-04:00 Introduce genLHsApp and genLHsLit helpers in GHC.Rename.Utils - - - - - dd782343 by Moisés Ackerman at 2023-07-03T03:30:13-04:00 Construct catch-all default case using helpers GHC.Rename.Utils concrete helpers instead of wrapGenSpan + HS AST constructors - - - - - 0e09c38e by Ryan Hendrickson at 2023-07-03T03:30:56-04:00 Add regression test for #23549 - - - - - 32741743 by Alexis King at 2023-07-03T03:31:36-04:00 perf tests: Increase default stack size for MultiLayerModules An unhelpfully small stack size appears to have been the real culprit behind the metric fluctuations in #19293. Debugging metric decreases triggered by !10729 helped to finally identify the problem. Metric Decrease: MultiLayerModules MultiLayerModulesTH_Make T13701 T14697 - - - - - 82ac6bf1 by Bryan Richter at 2023-07-03T03:32:15-04:00 Add missing void prototypes to rts functions See #23561. - - - - - 6078b429 by Ben Gamari at 2023-07-03T03:32:51-04:00 gitlab-ci: Refactor compilation of gen_ci Flakify and document it, making it far less sensitive to the build environment. - - - - - aa2db0ae by Ben Gamari at 2023-07-03T03:33:29-04:00 testsuite: Update documentation - - - - - 924a2362 by Gregory Gerasev at 2023-07-03T03:34:10-04:00 Better error for data deriving of type synonym/family. Closes #23522 - - - - - 4457da2a by Dave Barton at 2023-07-03T03:34:51-04:00 Fix some broken links and typos - - - - - de5830d0 by Ben Gamari at 2023-07-04T22:03:59-04:00 configure: Rip out Solaris dyld check Solaris 11 was released over a decade ago and, moreover, I doubt we have any Solaris users - - - - - 59c5fe1d by doyougnu at 2023-07-04T22:04:56-04:00 CI: add JS release and debug builds, regen CI jobs - - - - - 679bbc97 by Vladislav Zavialov at 2023-07-04T22:05:32-04:00 testsuite: Do not require CUSKs Numerous tests make use of CUSKs (complete user-supplied kinds), a legacy feature scheduled for deprecation. In order to proceed with the said deprecation, the tests have been updated to use SAKS instead (standalone kind signatures). This also allows us to remove the Haskell2010 language pragmas that were added in 115cd3c85a8 to work around the lack of CUSKs in GHC2021. - - - - - 945d3599 by Ben Gamari at 2023-07-04T22:06:08-04:00 gitlab: Drop backport-for-8.8 MR template Its usefulness has long passed. - - - - - 66c721d3 by Alan Zimmerman at 2023-07-04T22:06:44-04:00 EPA: Simplify GHC/Parser.y comb2 Use the HasLoc instance from Ast.hs to allow comb2 to work with anything with a SrcSpan This gets rid of the custom comb2A, comb2Al, comb2N functions, and removes various reLoc calls. - - - - - 2be99b7e by Matthew Pickering at 2023-07-04T22:07:21-04:00 Fix deprecation warning when deprecated identifier is from another module A stray 'Just' was being printed in the deprecation message. Fixes #23573 - - - - - 46c9bcd6 by Ben Gamari at 2023-07-04T22:07:58-04:00 rts: Don't rely on initializers for sigaction_t As noted in #23577, CentOS's ancient toolchain throws spurious missing-field-initializer warnings. - - - - - ec55035f by Ben Gamari at 2023-07-04T22:07:58-04:00 hadrian: Don't treat -Winline warnings as fatal Such warnings are highly dependent upon the toolchain, platform, and build configuration. It's simply too fragile to rely on these. - - - - - 3a09b789 by Ben Gamari at 2023-07-04T22:07:58-04:00 hadrian: Only pass -Wno-nonportable-include-path on Darwin This flag, which was introduced due to #17798, is only understood by Clang and consequently throws warnings on platforms using gcc. Sadly, there is no good way to treat such warnings as non-fatal with `-Werror` so for now we simply make this flag specific to platforms known to use Clang and case-insensitive filesystems (Darwin and Windows). See #23577. - - - - - 4af7eac2 by Mario Blažević at 2023-07-04T22:08:38-04:00 Fixed ticket #23571, TH.Ppr.pprLit hanging on large numeric literals - - - - - 2304c697 by Ben Gamari at 2023-07-04T22:09:15-04:00 compiler: Make OccSet opaque - - - - - cf735db8 by Andrei Borzenkov at 2023-07-04T22:09:51-04:00 Add Note about why we need forall in Code to be on the right - - - - - fb140f82 by Hécate Moonlight at 2023-07-04T22:10:34-04:00 Relax the constraint about the foreign function's calling convention of FinalizerPtr to capi as well as ccall. - - - - - 9ce44336 by meooow25 at 2023-07-05T11:42:37-04:00 Improve the situation with the stimes cycle Currently the Semigroup stimes cycle is resolved in GHC.Base by importing stimes implementations from a hs-boot file. Resolve the cycle using hs-boot files for required classes (Num, Integral) instead. Now stimes can be defined directly in GHC.Base, making inlining and specialization possible. This leads to some new boot files for `GHC.Num` and `GHC.Real`, the methods for those are only used to implement `stimes` so it doesn't appear that these boot files will introduce any new performance traps. Metric Decrease: T13386 T8095 Metric Increase: T13253 T13386 T18698a T18698b T19695 T8095 - - - - - 9edcb1fb by Jaro Reinders at 2023-07-05T11:43:24-04:00 Refactor Unique to be represented by Word64 In #22010 we established that Int was not always sufficient to store all the uniques we generate during compilation on 32-bit platforms. This commit addresses that problem by using Word64 instead of Int for uniques. The core of the change is in GHC.Core.Types.Unique and GHC.Core.Types.Unique.Supply. However, the representation of uniques is used in many other places, so those needed changes too. Additionally, the RTS has been extended with an atomic_inc64 operation. One major change from this commit is the introduction of the Word64Set and Word64Map data types. These are adapted versions of IntSet and IntMap from the containers package. These are planned to be upstreamed in the future. As a natural consequence of these changes, the compiler will be a bit slower and take more space on 32-bit platforms. Our CI tests indicate around a 5% residency increase. Metric Increase: CoOpt_Read CoOpt_Singletons LargeRecord ManyAlternatives ManyConstructors MultiComponentModules MultiComponentModulesRecomp MultiLayerModulesTH_OneShot RecordUpdPerf T10421 T10547 T12150 T12227 T12234 T12425 T12707 T13035 T13056 T13253 T13253-spj T13379 T13386 T13719 T14683 T14697 T14766 T15164 T15703 T16577 T16875 T17516 T18140 T18223 T18282 T18304 T18698a T18698b T18923 T1969 T19695 T20049 T21839c T3064 T3294 T4801 T5030 T5321FD T5321Fun T5631 T5642 T5837 T6048 T783 T8095 T9020 T9198 T9233 T9630 T9675 T9872a T9872b T9872b_defer T9872c T9872d T9961 TcPlugin_RewritePerf UniqLoop WWRec hard_hole_fits - - - - - 6b9db7d4 by Brandon Chinn at 2023-07-05T11:44:03-04:00 Fix docs for __GLASGOW_HASKELL_FULL_VERSION__ macro - - - - - 40f4ef7c by Torsten Schmits at 2023-07-05T18:06:19-04:00 Substitute free variables captured by breakpoints in SpecConstr Fixes #23267 - - - - - 2b55cb5f by sheaf at 2023-07-05T18:07:07-04:00 Reinstate untouchable variable error messages This extra bit of information was accidentally being discarded after a refactoring of the way we reported problems when unifying a type variable with another type. This patch rectifies that. - - - - - 53ed21c5 by Rodrigo Mesquita at 2023-07-05T18:07:47-04:00 configure: Drop Clang command from settings Due to 01542cb7227614a93508b97ecad5b16dddeb6486 we no longer use the `runClang` function, and no longer need to configure into settings the Clang command. We used to determine options at runtime to pass clang when it was used as an assembler, but now that we configure at configure time we no longer need to. - - - - - 6fdcf969 by Torsten Schmits at 2023-07-06T12:12:09-04:00 Filter out nontrivial substituted expressions in substTickish Fixes #23272 - - - - - 41968fd6 by Sylvain Henry at 2023-07-06T12:13:02-04:00 JS: testsuite: use req_c predicate instead of js_broken - - - - - 74a4dd2e by Sylvain Henry at 2023-07-06T12:13:02-04:00 JS: implement some file primitives (lstat,rmdir) (#22374) - Implement lstat and rmdir. - Implement base_c_s_is* functions (testing a file type) - Enable passing tests - - - - - 7e759914 by Sylvain Henry at 2023-07-07T02:39:38-04:00 JS: cleanup utils (#23314) - Removed unused code - Don't export unused functions - Move toTypeList to Closure module - - - - - f617655c by Sylvain Henry at 2023-07-07T02:39:38-04:00 JS: rename VarType/Vt into JSRep - - - - - 19216ca5 by Sylvain Henry at 2023-07-07T02:39:38-04:00 JS: remove custom PrimRep conversion (#23314) We use the usual conversion to PrimRep and then we convert these PrimReps to JSReps. - - - - - d3de8668 by Sylvain Henry at 2023-07-07T02:39:38-04:00 JS: don't use isRuntimeRepKindedTy in JS FFI - - - - - 8d1b75cb by Matthew Pickering at 2023-07-07T02:40:15-04:00 ghcup-metadata: Also updates ghcup-nightlies-0.0.7.yaml file Fixes #23600 - - - - - e524fa7f by Matthew Pickering at 2023-07-07T02:40:15-04:00 ghcup-metadata: Use dynamically linked alpine bindists In theory these will work much better on alpine to allow people to build statically linked applications there. We don't need to distribute a statically linked application ourselves in order to allow that. Fixes #23602 - - - - - b9e7beb9 by Ben Gamari at 2023-07-07T11:32:22-04:00 Drop circle-ci-job.sh - - - - - 9955eead by Ben Gamari at 2023-07-07T11:32:22-04:00 testsuite: Allow preservation of unexpected output Here we introduce a new flag to the testsuite driver, --unexpected-output-dir=<dir>, which allows the user to ask the driver to preserve unexpected output from tests. The intent is for this to be used in CI to allow users to more easily fix unexpected platform-dependent output. - - - - - 48f80968 by Ben Gamari at 2023-07-07T11:32:22-04:00 gitlab-ci: Preserve unexpected output Here we enable use of the testsuite driver's `--unexpected-output-dir` flag by CI, preserving the result as an artifact for use by users. - - - - - 76983a0d by Matthew Pickering at 2023-07-07T11:32:58-04:00 driver: Fix -S with .cmm files There was an oversight in the driver which assumed that you would always produce a `.o` file when compiling a .cmm file. Fixes #23610 - - - - - 6df15e93 by Mike Pilgrem at 2023-07-07T11:33:40-04:00 Update Hadrian's stack.yaml - - - - - 1dff43cf by Ben Gamari at 2023-07-08T05:05:37-04:00 compiler: Rework ShowSome Previously the field used to filter the sub-declarations to show was rather ad-hoc and was only able to show at most one sub-declaration. - - - - - 8165404b by Ben Gamari at 2023-07-08T05:05:37-04:00 testsuite: Add test to catch changes in core libraries This adds testing infrastructure to ensure that changes in core libraries (e.g. `base` and `ghc-prim`) are caught in CI. - - - - - ec1c32e2 by Melanie Phoenix at 2023-07-08T05:06:14-04:00 Deprecate Data.List.NonEmpty.unzip - - - - - 5d2442b8 by Ben Gamari at 2023-07-08T05:06:51-04:00 Drop latent mentions of -split-objs Closes #21134. - - - - - a9bc20cb by Oleg Grenrus at 2023-07-08T05:07:31-04:00 Add warn_and_run test kind This is a compile_and_run variant which also captures the GHC's stderr. The warn_and_run name is best I can come up with, as compile_and_run is taken. This is useful specifically for testing warnings. We want to test that when warning triggers, and it's not a false positive, i.e. that the runtime behaviour is indeed "incorrect". As an example a single test is altered to use warn_and_run - - - - - c7026962 by Ben Gamari at 2023-07-08T05:08:11-04:00 configure: Don't use ld.gold on i386 ld.gold appears to produce invalid static constructor tables on i386. While ideally we would add an autoconf check to check for this brokenness, sadly such a check isn't easy to compose. Instead to summarily reject such linkers on i386. Somewhat hackily closes #23579. - - - - - 054261dd by Andrew Lelechenko at 2023-07-08T19:32:47-04:00 Add since annotations for Data.Foldable1 - - - - - 550af505 by Sylvain Henry at 2023-07-08T19:33:28-04:00 JS: support -this-unit-id for programs in the linker (#23613) - - - - - d284470a by Andrew Lelechenko at 2023-07-08T19:34:08-04:00 Bump text submodule - - - - - 8e11630e by jade at 2023-07-10T16:58:40-04:00 Add a hint to enable ExplicitNamespaces for type operator imports (Fixes/Enhances #20007) As suggested in #20007 and implemented in !8895, trying to import type operators will suggest a fix to use the 'type' keyword, without considering whether ExplicitNamespaces is enabled. This patch will query whether ExplicitNamespaces is enabled and add a hint to suggest enabling ExplicitNamespaces if it isn't enabled, alongside the suggestion of adding the 'type' keyword. - - - - - 61b1932e by sheaf at 2023-07-10T16:59:26-04:00 tyThingLocalGREs: include all DataCons for RecFlds The GREInfo for a record field should include the collection of all the data constructors of the parent TyCon that have this record field. This information was being incorrectly computed in the tyThingLocalGREs function for a DataCon, as we were not taking into account other DataCons with the same parent TyCon. Fixes #23546 - - - - - e6627cbd by Alan Zimmerman at 2023-07-10T17:00:05-04:00 EPA: Simplify GHC/Parser.y comb3 A follow up to !10743 - - - - - ee20da34 by Andrew Lelechenko at 2023-07-10T17:01:01-04:00 Document that compareByteArrays# is available since ghc-prim-0.5.2.0 - - - - - 4926af7b by Matthew Pickering at 2023-07-10T17:01:38-04:00 Revert "Bump text submodule" This reverts commit d284470a77042e6bc17bdb0ab0d740011196958a. This commit requires that we bootstrap with ghc-9.4, which we do not require until #23195 has been completed. Subsequently this has broken nighty jobs such as the rocky8 job which in turn has broken nightly releases. - - - - - d1c92bf3 by Ben Gamari at 2023-07-11T08:07:02-04:00 compiler: Fingerprint more code generation flags Previously our recompilation check was quite inconsistent in its coverage of non-optimisation code generation flags. Specifically, we failed to account for most flags that would affect the behavior of generated code in ways that might affect the result of a program's execution (e.g. `-feager-blackholing`, `-fstrict-dicts`) Closes #23369. - - - - - eb623149 by Ben Gamari at 2023-07-11T08:07:02-04:00 compiler: Record original thunk info tables on stack Here we introduce a new code generation option, `-forig-thunk-info`, which ensures that an `stg_orig_thunk_info` frame is pushed before every update frame. This can be invaluable when debugging thunk cycles and similar. See Note [Original thunk info table frames] for details. Closes #23255. - - - - - 4731f44e by Jaro Reinders at 2023-07-11T08:07:40-04:00 Fix wrong MIN_VERSION_GLASGOW_HASKELL macros I forgot to change these after rebasing. - - - - - dd38aca9 by Andreas Schwab at 2023-07-11T13:55:56+00:00 Hadrian: enable GHCi support on riscv64 - - - - - 09a5c6cc by Josh Meredith at 2023-07-12T11:25:13-04:00 JavaScript: support unicode code points > 2^16 in toJSString using String.fromCodePoint (#23628) - - - - - 29fbbd4e by Matthew Pickering at 2023-07-12T11:25:49-04:00 Remove references to make build system in mk/build.mk Fixes #23636 - - - - - 630e3026 by sheaf at 2023-07-12T11:26:43-04:00 Valid hole fits: don't panic on a Given The function GHC.Tc.Errors.validHoleFits would end up panicking when encountering a Given constraint. To fix this, it suffices to filter out the Givens before continuing. Fixes #22684 - - - - - c39f279b by Matthew Pickering at 2023-07-12T23:18:38-04:00 Use deb10 for i386 bindists deb9 is now EOL so it's time to upgrade the i386 bindist to use deb10 Fixes #23585 - - - - - bf9b9de0 by Krzysztof Gogolewski at 2023-07-12T23:19:15-04:00 Fix #23567, a specializer bug Found by Simon in https://gitlab.haskell.org/ghc/ghc/-/issues/23567#note_507834 The testcase isn't ideal because it doesn't detect the bug in master, unless doNotUnbox is removed as in https://gitlab.haskell.org/ghc/ghc/-/issues/23567#note_507692. But I have confirmed that with that modification, it fails before and passes afterwards. - - - - - 84c1a4a2 by Bartłomiej Cieślar at 2023-07-12T23:20:08-04:00 Comments - - - - - b2846cb5 by Bartłomiej Cieślar at 2023-07-12T23:20:08-04:00 updates to comments - - - - - 2af23f0e by Bartłomiej Cieślar at 2023-07-12T23:20:08-04:00 changes - - - - - 6143838a by sheaf at 2023-07-13T08:02:17-04:00 Fix deprecation of record fields Commit 3f374399 inadvertently broke the deprecation/warning mechanism for record fields due to its introduction of record field namespaces. This patch ensures that, when a top-level deprecation is applied to an identifier, it applies to all the record fields as well. This is achieved by refactoring GHC.Rename.Env.lookupLocalTcNames, and GHC.Rename.Env.lookupBindGroupOcc, to not look up a fixed number of NameSpaces but to look up all NameSpaces and filter out the irrelevant ones. - - - - - 6fd8f566 by sheaf at 2023-07-13T08:02:17-04:00 Introduce greInfo, greParent These are simple helper functions that wrap the internal field names gre_info, gre_par. - - - - - 7f0a86ed by sheaf at 2023-07-13T08:02:17-04:00 Refactor lookupGRE_... functions This commit consolidates all the logic for looking up something in the Global Reader Environment into the single function lookupGRE. This allows us to declaratively specify all the different modes of looking up in the GlobalRdrEnv, and avoids manually passing around filtering functions as was the case in e.g. the function GHC.Rename.Env.lookupSubBndrOcc_helper. ------------------------- Metric Decrease: T8095 ------------------------- ------------------------- Metric Increase: T8095 ------------------------- - - - - - 5e951395 by Rodrigo Mesquita at 2023-07-13T08:02:54-04:00 configure: Drop DllWrap command We used to configure into settings a DllWrap command for windows builds and distributions, however, we no longer do, and dllwrap is effectively unused. This simplification is motivated in part by the larger toolchain-selection project (#19877, !9263) - - - - - e10556b6 by Teo Camarasu at 2023-07-14T16:28:46-04:00 base: fix haddock syntax in GHC.Profiling - - - - - 0f3fda81 by Matthew Pickering at 2023-07-14T16:29:23-04:00 Revert "CI: add JS release and debug builds, regen CI jobs" This reverts commit 59c5fe1d4b624423b1c37891710f2757bb58d6af. This commit added two duplicate jobs on all validate pipelines, so we are reverting for now whilst we work out what the best way forward is. Ticket #23618 - - - - - 54bca324 by Alan Zimmerman at 2023-07-15T03:23:26-04:00 EPA: Simplify GHC/Parser.y sLL Follow up to !10743 - - - - - c8863828 by sheaf at 2023-07-15T03:24:06-04:00 Configure: canonicalise PythonCmd on Windows This change makes PythonCmd resolve to a canonical absolute path on Windows, which prevents HLS getting confused (now that we have a build-time dependency on python). fixes #23652 - - - - - ca1e636a by Rodrigo Mesquita at 2023-07-15T03:24:42-04:00 Improve Note [Binder-swap during float-out] - - - - - cf86f3ec by Matthew Craven at 2023-07-16T01:42:09+02:00 Equality of forall-types is visibility aware This patch finally (I hope) nails the question of whether (forall a. ty) and (forall a -> ty) are `eqType`: they aren't! There is a long discussion in #22762, plus useful Notes: * Note [ForAllTy and type equality] in GHC.Core.TyCo.Compare * Note [Comparing visiblities] in GHC.Core.TyCo.Compare * Note [ForAllCo] in GHC.Core.TyCo.Rep It also establishes a helpful new invariant for ForAllCo, and ForAllTy, when the bound variable is a CoVar:in that case the visibility must be coreTyLamForAllTyFlag. All this is well documented in revised Notes. - - - - - 7f13acbf by Vladislav Zavialov at 2023-07-16T01:56:27-04:00 List and Tuple<n>: update documentation Add the missing changelog.md entries and @since-annotations. - - - - - 2afbddb0 by Andrei Borzenkov at 2023-07-16T10:21:24+04:00 Type patterns (#22478, #18986) Improved name resolution and type checking of type patterns in constructors: 1. HsTyPat: a new dedicated data type that represents type patterns in HsConPatDetails instead of reusing HsPatSigType 2. rnHsTyPat: a new function that renames a type pattern and collects its binders into three groups: - explicitly bound type variables, excluding locally bound variables - implicitly bound type variables from kind signatures (only if ScopedTypeVariables are enabled) - named wildcards (only from kind signatures) 2a. rnHsPatSigTypeBindingVars: removed in favour of rnHsTyPat 2b. rnImplcitTvBndrs: removed because no longer needed 3. collect_pat: updated to collect type variable binders from type patterns (this means that types and terms use the same infrastructure to detect conflicting bindings, unused variables and name shadowing) 3a. CollVarTyVarBinders: a new CollectFlag constructor that enables collection of type variables 4. tcHsTyPat: a new function that typechecks type patterns, capable of handling polymorphic kinds. See Note [Type patterns: binders and unifiers] Examples of code that is now accepted: f = \(P @a) -> \(P @a) -> ... -- triggers -Wname-shadowing g :: forall a. Proxy a -> ... g (P @a) = ... -- also triggers -Wname-shadowing h (P @($(TH.varT (TH.mkName "t")))) = ... -- t is bound at splice time j (P @(a :: (x,x))) = ... -- (x,x) is no longer rejected data T where MkT :: forall (f :: forall k. k -> Type). f Int -> f Maybe -> T k :: T -> () k (MkT @f (x :: f Int) (y :: f Maybe)) = () -- f :: forall k. k -> Type Examples of code that is rejected with better error messages: f (Left @a @a _) = ... -- new message: -- • Conflicting definitions for ‘a’ -- Bound at: Test.hs:1:11 -- Test.hs:1:14 Examples of code that is now rejected: {-# OPTIONS_GHC -Werror=unused-matches #-} f (P @a) = () -- Defined but not used: type variable ‘a’ - - - - - eb1a6ab1 by sheaf at 2023-07-16T09:20:45-04:00 Don't use substTyUnchecked in newMetaTyVar There were some comments that explained that we needed to use an unchecked substitution function because of issue #12931, but that has since been fixed, so we should be able to use substTy instead now. - - - - - c7bbad9a by sheaf at 2023-07-17T02:48:19-04:00 rnImports: var shouldn't import NoFldSelectors In an import declaration such as import M ( var ) the import of the variable "var" should **not** bring into scope record fields named "var" which are defined with NoFieldSelectors. Doing so can cause spurious "unused import" warnings, as reported in ticket #23557. Fixes #23557 - - - - - 1af2e773 by sheaf at 2023-07-17T02:48:19-04:00 Suggest similar names in imports This commit adds similar name suggestions when importing. For example module A where { spelling = 'o' } module B where { import B ( speling ) } will give rise to the error message: Module ‘A’ does not export ‘speling’. Suggested fix: Perhaps use ‘spelling’ This also provides hints when users try to import record fields defined with NoFieldSelectors. - - - - - 654fdb98 by Alan Zimmerman at 2023-07-17T02:48:55-04:00 EPA: Store leading AnnSemi for decllist in al_rest This simplifies the markAnnListA implementation in ExactPrint - - - - - 22565506 by sheaf at 2023-07-17T21:12:59-04:00 base: add COMPLETE pragma to BufferCodec PatSyn This implements CLC proposal #178, rectifying an oversight in the implementation of CLC proposal #134 which could lead to spurious pattern match warnings. https://github.com/haskell/core-libraries-committee/issues/178 https://github.com/haskell/core-libraries-committee/issues/134 - - - - - 860f6269 by sheaf at 2023-07-17T21:13:00-04:00 exactprint: silence incomplete record update warnings - - - - - df706de3 by sheaf at 2023-07-17T21:13:00-04:00 Re-instate -Wincomplete-record-updates Commit e74fc066 refactored the handling of record updates to use the HsExpanded mechanism. This meant that the pattern matching inherent to a record update was considered to be "generated code", and thus we stopped emitting "incomplete record update" warnings entirely. This commit changes the "data Origin = Source | Generated" datatype, adding a field to the Generated constructor to indicate whether we still want to perform pattern-match checking. We also have to do a bit of plumbing with HsCase, to record that the HsCase arose from an HsExpansion of a RecUpd, so that the error message continues to mention record updates as opposed to a generic "incomplete pattern matches in case" error. Finally, this patch also changes the way we handle inaccessible code warnings. Commit e74fc066 was also a regression in this regard, as we were emitting "inaccessible code" warnings for case statements spuriously generated when desugaring a record update (remember: the desugaring mechanism happens before typechecking; it thus can't take into account e.g. GADT information in order to decide which constructors to include in the RHS of the desugaring of the record update). We fix this by changing the mechanism through which we disable inaccessible code warnings: we now check whether we are in generated code in GHC.Tc.Utils.TcMType.newImplication in order to determine whether to emit inaccessible code warnings. Fixes #23520 Updates haddock submodule, to avoid incomplete record update warnings - - - - - 1d05971e by sheaf at 2023-07-17T21:13:00-04:00 Propagate long-distance information in do-notation The preceding commit re-enabled pattern-match checking inside record updates. This revealed that #21360 was in fact NOT fixed by e74fc066. This commit makes sure we correctly propagate long-distance information in do blocks, e.g. in ```haskell data T = A { fld :: Int } | B f :: T -> Maybe T f r = do a at A{} <- Just r Just $ case a of { A _ -> A 9 } ``` we need to propagate the fact that "a" is headed by the constructor "A" to see that the case expression "case a of { A _ -> A 9 }" cannot fail. Fixes #21360 - - - - - bea0e323 by sheaf at 2023-07-17T21:13:00-04:00 Skip PMC for boring patterns Some patterns introduce no new information to the pattern-match checker (such as plain variable or wildcard patterns). We can thus skip doing any pattern-match checking on them when the sole purpose for doing so was introducing new long-distance information. See Note [Boring patterns] in GHC.Hs.Pat. Doing this avoids regressing in performance now that we do additional pattern-match checking inside do notation. - - - - - ddcdd88c by Rodrigo Mesquita at 2023-07-17T21:13:36-04:00 Split GHC.Platform.ArchOS from ghc-boot into ghc-platform Split off the `GHC.Platform.ArchOS` module from the `ghc-boot` package into this reinstallable standalone package which abides by the PVP, in part motivated by the ongoing work on `ghc-toolchain` towards runtime retargetability. - - - - - b55a8ea7 by Sylvain Henry at 2023-07-17T21:14:27-04:00 JS: better implementation for plusWord64 (#23597) - - - - - 889c2bbb by sheaf at 2023-07-18T06:37:32-04:00 Do primop rep-poly checks when instantiating This patch changes how we perform representation-polymorphism checking for primops (and other wired-in Ids such as coerce). When instantiating the primop, we check whether each type variable is required to instantiated to a concrete type, and if so we create a new concrete metavariable (a ConcreteTv) instead of a simple MetaTv. (A little subtlety is the need to apply the substitution obtained from instantiating to the ConcreteTvOrigins, see Note [substConcreteTvOrigin] in GHC.Tc.Utils.TcMType.) This allows us to prevent representation-polymorphism in non-argument position, as that is required for some of these primops. We can also remove the logic in tcRemainingValArgs, except for the part concerning representation-polymorphic unlifted newtypes. The function has been renamed rejectRepPolyNewtypes; all it does now is reject unsaturated occurrences of representation-polymorphic newtype constructors when the representation of its argument isn't a concrete RuntimeRep (i.e. still a PHASE 1 FixedRuntimeRep check). The Note [Eta-expanding rep-poly unlifted newtypes] in GHC.Tc.Gen.Head gives more explanation about a possible path to PHASE 2, which would be in line with the treatment for primops taken in this patch. We also update the Core Lint check to handle this new framework. This means Core Lint now checks representation-polymorphism in continuation position like needed for catch#. Fixes #21906 ------------------------- Metric Increase: LargeRecord ------------------------- - - - - - 00648e5d by Krzysztof Gogolewski at 2023-07-18T06:38:10-04:00 Core Lint: distinguish let and letrec in locations Lint messages were saying "in the body of letrec" even for non-recursive let. I've also renamed BodyOfLetRec to BodyOfLet in stg, since there's no separate letrec. - - - - - 787bae96 by Krzysztof Gogolewski at 2023-07-18T06:38:50-04:00 Use extended literals when deriving Show This implements GHC proposal https://github.com/ghc-proposals/ghc-proposals/pull/596 Also add support for Int64# and Word64#; see testcase ShowPrim. - - - - - 257f1567 by Jaro Reinders at 2023-07-18T06:39:29-04:00 Add StgFromCore and StgCodeGen linting - - - - - 34d08a20 by Ben Gamari at 2023-07-19T03:33:22-04:00 Reg.Liveness: Strictness - - - - - c5deaa27 by Ben Gamari at 2023-07-19T03:33:22-04:00 Reg.Liveness: Don't repeatedly construct UniqSets - - - - - b947250b by Ben Gamari at 2023-07-19T03:33:22-04:00 compiler/Types: Ensure that fromList-type operations can fuse In #20740 I noticed that mkUniqSet does not fuse. In practice, allowing it to do so makes a considerable difference in allocations due to the backend. Metric Decrease: T12707 T13379 T3294 T4801 T5321FD T5321Fun T783 - - - - - 6c88c2ba by Sven Tennie at 2023-07-19T03:33:59-04:00 x86 Codegen: Implement MO_S_MulMayOflo for W16 - - - - - 5f1154e0 by Sven Tennie at 2023-07-19T03:33:59-04:00 x86 CodeGen: MO_S_MulMayOflo better error message for rep > W64 It's useful to see which value made the pattern match fail. (If it ever occurs.) - - - - - e8c9a95f by Sven Tennie at 2023-07-19T03:33:59-04:00 x86 CodeGen: Implement MO_S_MulMayOflo for W8 This case wasn't handled before. But, the test-primops test suite showed that it actually might appear. - - - - - a36f9dc9 by Sven Tennie at 2023-07-19T03:33:59-04:00 Add test for %mulmayoflo primop The test expects a perfect implementation with no false positives. - - - - - 38a36248 by Matthew Pickering at 2023-07-19T03:34:36-04:00 lint-ci-config: Generate jobs-metadata.json We also now save the jobs-metadata.json and jobs.yaml file as artifacts as: * It might be useful for someone who is modifying CI to copy jobs.yaml if they are having trouble regenerating locally. * jobs-metadata.json is very useful for downstream pipelines to work out the right job to download. Fixes #23654 - - - - - 1535a671 by Vladislav Zavialov at 2023-07-19T03:35:12-04:00 Initialize 9.10.1-notes.rst Create new release notes for the next GHC release (GHC 9.10) - - - - - 3bd4d5b5 by sheaf at 2023-07-19T03:35:53-04:00 Prioritise Parent when looking up class sub-binder When we look up children GlobalRdrElts of a given Parent, we sometimes would rather prioritise those GlobalRdrElts which have the right Parent, and sometimes prioritise those that have the right NameSpace: - in export lists, we should prioritise NameSpace - for class/instance binders, we should prioritise Parent See Note [childGREPriority] in GHC.Types.Name.Reader. fixes #23664 - - - - - 9c8fdda3 by Alan Zimmerman at 2023-07-19T03:36:29-04:00 EPA: Improve annotation management in getMonoBind Ensure the LHsDecl for a FunBind has the correct leading comments and trailing annotations. See the added note for details. - - - - - ff884b77 by Matthew Pickering at 2023-07-19T11:42:02+01:00 Remove unused files in .gitlab These were left over after 6078b429 - - - - - 29ef590c by Matthew Pickering at 2023-07-19T11:42:52+01:00 gen_ci: Add hie.yaml file This allows you to load `gen_ci.hs` into HLS, and now it is a huge module, that is quite useful. - - - - - 808b55cf by Matthew Pickering at 2023-07-19T12:24:41+01:00 ci: Make "fast-ci" the default validate configuration We are trying out a lighter weight validation pipeline where by default we just test on 5 platforms: * x86_64-deb10-slow-validate * windows * x86_64-fedora33-release * aarch64-darwin * aarch64-linux-deb10 In order to enable the "full" validation pipeline you can apply the `full-ci` label which will enable all the validation pipelines. All the validation jobs are still run on a marge batch. The goal is to reduce the overall CI capacity so that pipelines start faster for MRs and marge bot batches are faster. Fixes #23694 - - - - - 0b23db03 by Alan Zimmerman at 2023-07-20T05:28:47-04:00 EPA: Simplify GHC/Parser.y sL1 This is the next patch in a series simplifying location management in GHC/Parser.y This one simplifies sL1, to use the HasLoc instances introduced in !10743 (closed) - - - - - 3ece9856 by Ben Gamari at 2023-07-21T07:30:45-04:00 nativeGen: Explicitly set flags of text sections on Windows The binutils documentation (for COFF) claims, > If no flags are specified, the default flags depend upon the section > name. If the section name is not recognized, the default will be for the > section to be loaded and writable. We previously assumed that this would do the right thing for split sections (e.g. a section named `.text$foo` would be correctly inferred to be a text section). However, we have observed that this is not the case (at least under the clang toolchain used on Windows): when split-sections is enabled, text sections are treated by the assembler as data (matching the "default" behavior specified by the documentation). Avoid this by setting section flags explicitly. This should fix split sections on Windows. Fixes #22834. - - - - - db7f7240 by Ben Gamari at 2023-07-21T07:30:45-04:00 nativeGen: Set explicit section types on all platforms - - - - - b444c16f by Finley McIlwaine at 2023-07-21T07:31:28-04:00 Insert documentation into parsed signature modules Causes haddock comments in signature modules to be properly inserted into the AST (just as they are for regular modules) if the `-haddock` flag is given. Also adds a test that compares `-ddump-parsed-ast` output for a signature module to prevent further regressions. Fixes #23315 - - - - - c30cea53 by Ben Gamari at 2023-07-21T23:23:49-04:00 primops: Introduce unsafeThawByteArray# This addresses an odd asymmetry in the ByteArray# primops, which previously provided unsafeFreezeByteArray# but no corresponding thaw operation. Closes #22710 - - - - - 87f9bd47 by Ben Gamari at 2023-07-21T23:23:49-04:00 testsuite: Elaborate in interface stability README This discussion didn't make it into the original MR. - - - - - e4350b41 by Matthew Pickering at 2023-07-21T23:24:25-04:00 Allow users to override non-essential haddock options in a Flavour We now supply the non-essential options to haddock using the `extraArgs` field, which can be specified in a Flavour so that if an advanced user wants to change how documentation is generated then they can use something other than the `defaultHaddockExtraArgs`. This does have the potential to regress some packaging if a user has overridden `extraArgs` themselves, because now they also need to add the haddock options to extraArgs. This can easily be done by appending `defaultHaddockExtraArgs` to their extraArgs invocation but someone might not notice this behaviour has changed. In any case, I think passing the non-essential options in this manner is the right thing to do and matches what we do for the "ghc" builder, which by default doesn't pass any optmisation levels, and would likewise be very bad if someone didn't pass suitable `-O` levels for builds. Fixes #23625 - - - - - fc186b0c by Ilias Tsitsimpis at 2023-07-21T23:25:03-04:00 ghc-prim: Link against libatomic Commit b4d39adbb58 made 'hs_cmpxchg64()' available to all architectures. Unfortunately this made GHC to fail to build on armel, since armel needs libatomic to support atomic operations on 64-bit word sizes. Configure libraries/ghc-prim/ghc-prim.cabal to link against libatomic, the same way as we do in rts/rts.cabal. - - - - - 4f5538a8 by Matthew Pickering at 2023-07-21T23:25:39-04:00 simplifier: Correct InScopeSet in rule matching The in-scope set passedto the `exprIsLambda_maybe` call lacked all the in-scope binders. @simonpj suggests this fix where we augment the in-scope set with the free variables of expression which fixes this failure mode in quite a direct way. Fixes #23630 - - - - - 5ad8d597 by Krzysztof Gogolewski at 2023-07-21T23:26:17-04:00 Add a test for #23413 It was fixed by commit e1590ddc661d6: Add the SolverStage monad. - - - - - 7e05f6df by sheaf at 2023-07-21T23:26:56-04:00 Finish migration of diagnostics in GHC.Tc.Validity This patch finishes migrating the error messages in GHC.Tc.Validity to use the new diagnostic infrastructure. It also refactors the error message datatypes for class and family instances, to common them up under a single datatype as much as possible. - - - - - 4876fddc by Matthew Pickering at 2023-07-21T23:27:33-04:00 ci: Enable some more jobs to run in a marge batch In !10907 I made the majority of jobs not run on a validate pipeline but then forgot to renable a select few jobs on the marge batch MR. - - - - - 026991d7 by Jens Petersen at 2023-07-21T23:28:13-04:00 user_guide/flags.py: python-3.12 no longer includes distutils packaging.version seems able to handle this fine - - - - - b91bbc2b by Matthew Pickering at 2023-07-21T23:28:50-04:00 ci: Mention ~full-ci label in MR template We mention that if you need a full validation pipeline then you can apply the ~full-ci label to your MR in order to test against the full validation pipeline (like we do for marge). - - - - - 42b05e9b by sheaf at 2023-07-22T12:36:00-04:00 RTS: declare setKeepCAFs symbol Commit 08ba8720 failed to declare the dependency of keepCAFsForGHCi on the symbol setKeepCAFs in the RTS, which led to undefined symbol errors on Windows, as exhibited by the testcase frontend001. Thanks to Moritz Angermann and Ryan Scott for the diagnosis and fix. Fixes #22961 - - - - - a72015d6 by sheaf at 2023-07-22T12:36:01-04:00 Mark plugins-external as broken on Windows This test is broken on Windows, so we explicitly mark it as such now that we stop skipping plugin tests on Windows. - - - - - cb9c93d7 by sheaf at 2023-07-22T12:36:01-04:00 Stop marking plugin tests as fragile on Windows Now that b2bb3e62 has landed we are in a better situation with regards to plugins on Windows, allowing us to unmark many plugin tests as fragile. Fixes #16405 - - - - - a7349217 by Krzysztof Gogolewski at 2023-07-22T12:36:37-04:00 Misc cleanup - Remove unused RDR names - Fix typos in comments - Deriving: simplify boxConTbl and remove unused litConTbl - chmod -x GHC/Exts.hs, this seems accidental - - - - - 33b6850a by Vladislav Zavialov at 2023-07-23T10:27:37-04:00 Visible forall in types of terms: Part 1 (#22326) This patch implements part 1 of GHC Proposal #281, introducing explicit `type` patterns and `type` arguments. Summary of the changes: 1. New extension flag: RequiredTypeArguments 2. New user-facing syntax: `type p` patterns (represented by EmbTyPat) `type e` expressions (represented by HsEmbTy) 3. Functions with required type arguments (visible forall) can now be defined and applied: idv :: forall a -> a -> a -- signature (relevant change: checkVdqOK in GHC/Tc/Validity.hs) idv (type a) (x :: a) = x -- definition (relevant change: tcPats in GHC/Tc/Gen/Pat.hs) x = idv (type Int) 42 -- usage (relevant change: tcInstFun in GHC/Tc/Gen/App.hs) 4. template-haskell support: TH.TypeE corresponds to HsEmbTy TH.TypeP corresponds to EmbTyPat 5. Test cases and a new User's Guide section Changes *not* included here are the t2t (term-to-type) transformation and term variable capture; those belong to part 2. - - - - - 73b5c7ce by sheaf at 2023-07-23T10:28:18-04:00 Add test for #22424 This is a simple Template Haskell test in which we refer to record selectors by their exact Names, in two different ways. Fixes #22424 - - - - - 83cbc672 by Ben Gamari at 2023-07-24T07:40:49+00:00 ghc-toolchain: Initial commit - - - - - 31dcd26c by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00 ghc-toolchain: Toolchain Selection This commit integrates ghc-toolchain, the brand new way of configuring toolchains for GHC, with the Hadrian build system, with configure, and extends and improves the first iteration of ghc-toolchain. The general overview is * We introduce a program invoked `ghc-toolchain --triple=...` which, when run, produces a file with a `Target`. A `GHC.Toolchain.Target.Target` describes the properties of a target and the toolchain (executables and configured flags) to produce code for that target * Hadrian was modified to read Target files, and will both * Invoke the toolchain configured in the Target file as needed * Produce a `settings` file for GHC based on the Target file for that stage * `./configure` will invoke ghc-toolchain to generate target files, but it will also generate target files based on the flags configure itself configured (through `.in` files that are substituted) * By default, the Targets generated by configure are still (for now) the ones used by Hadrian * But we additionally validate the Target files generated by ghc-toolchain against the ones generated by configure, to get a head start on catching configuration bugs before we transition completely. * When we make that transition, we will want to drop a lot of the toolchain configuration logic from configure, but keep it otherwise. * For each compiler stage we should have 1 target file (up to a stage compiler we can't run in our machine) * We just have a HOST target file, which we use as the target for stage0 * And a TARGET target file, which we use for stage1 (and later stages, if not cross compiling) * Note there is no BUILD target file, because we only support cross compilation where BUILD=HOST * (for more details on cross-compilation see discussion on !9263) See also * Note [How we configure the bundled windows toolchain] * Note [ghc-toolchain consistency checking] * Note [ghc-toolchain overview] Ticket: #19877 MR: !9263 - - - - - a732b6d3 by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00 Add flag to enable/disable ghc-toolchain based configurations This flag is disabled by default, and we'll use the configure-generated-toolchains by default until we remove the toolchain configuration logic from configure. - - - - - 61eea240 by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00 Split ghc-toolchain executable to new packge In light of #23690, we split the ghc-toolchain executable out of the library package to be able to ship it in the bindist using Hadrian. Ideally, we eventually revert this commit. - - - - - 38e795ff by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00 Ship ghc-toolchain in the bindist Add the ghc-toolchain binary to the binary distribution we ship to users, and teach the bindist configure to use the existing ghc-toolchain. - - - - - 32cae784 by Matthew Craven at 2023-07-24T16:48:24-04:00 Kill off gen_bytearray_addr_access_ops.py The relevant primop descriptions are now generated directly by genprimopcode. This makes progress toward fixing #23490, but it is not a complete fix since there is more than one way in which cabal-reinstall (hadrian/build build-cabal) is broken. - - - - - 02e6a6ce by Matthew Pickering at 2023-07-24T16:49:00-04:00 compiler: Remove unused `containers.h` include Fixes #23712 - - - - - 822ef66b by Matthew Pickering at 2023-07-25T08:44:50-04:00 Fix pretty printing of WARNING pragmas There is still something quite unsavoury going on with WARNING pragma printing because the printing relies on the fact that for decl deprecations the SourceText of WarningTxt is empty. However, I let that lion sleep and just fixed things directly. Fixes #23465 - - - - - e7b38ede by Matthew Pickering at 2023-07-25T08:45:28-04:00 ci-images: Bump to commit which has 9.6 image The test-bootstrap job has been failing for 9.6 because we accidentally used a non-master commit. - - - - - bb408936 by Matthew Pickering at 2023-07-25T08:45:28-04:00 Update bootstrap plans for 9.6.2 and 9.4.5 - - - - - 355e1792 by Alan Zimmerman at 2023-07-26T10:17:32-04:00 EPA: Simplify GHC/Parser.y comb4/comb5 Use the HasLoc instance from Ast.hs to allow comb4/comb5 to work with anything with a SrcSpan Also get rid of some more now unnecessary reLoc calls. - - - - - 9393df83 by Gavin Zhao at 2023-07-26T10:18:16-04:00 compiler: make -ddump-asm work with wasm backend NCG Fixes #23503. Now the `-ddump-asm` flag is respected in the wasm backend NCG, so developers can directly view the generated ASM instead of needing to pass `-S` or `-keep-tmp-files` and manually find & open the assembly file. Ideally, we should be able to output the assembly files in smaller chunks like in other NCG backends. This would also make dumping assembly stats easier. However, this would require a large refactoring, so for short-term debugging purposes I think the current approach works fine. Signed-off-by: Gavin Zhao <git at gzgz.dev> - - - - - 79463036 by Krzysztof Gogolewski at 2023-07-26T10:18:54-04:00 llvm: Restore accidentally deleted code in 0fc5cb97 Fixes #23711 - - - - - 20db7e26 by Rodrigo Mesquita at 2023-07-26T10:19:33-04:00 configure: Default missing options to False when preparing ghc-toolchain Targets This commit fixes building ghc with 9.2 as the boostrap compiler. The ghc-toolchain patch assumed all _STAGE0 options were available, and forgot to account for this missing information in 9.2. Ghc 9.2 does not have in settings whether ar supports -l, hence can't report it with --info (unliked 9.4 upwards). The fix is to default the missing information (we default "ar supports -l" and other missing options to False) - - - - - fac9e84e by Naïm Favier at 2023-07-26T10:20:16-04:00 docs: Fix typo - - - - - 503fd647 by Bartłomiej Cieślar at 2023-07-26T17:23:10-04:00 This MR is an implementation of the proposal #516. It adds a warning -Wincomplete-record-selectors for usages of a record field access function (either a record selector or getField @"rec"), while trying to silence the warning whenever it can be sure that a constructor without the record field would not be invoked (which would otherwise cause the program to fail). For example: data T = T1 | T2 {x :: Bool} f a = x a -- this would throw an error g T1 = True g a = x a -- this would not throw an error h :: HasField "x" r Bool => r -> Bool h = getField @"x" j :: T -> Bool j = h -- this would throw an error because of the `HasField` -- constraint being solved See the tests DsIncompleteRecSel* and TcIncompleteRecSel for more examples of the warning. See Note [Detecting incomplete record selectors] in GHC.HsToCore.Expr for implementation details - - - - - af6fdf42 by Arnaud Spiwack at 2023-07-26T17:23:52-04:00 Fix user-facing label in MR template - - - - - 5d45b92a by Matthew Pickering at 2023-07-27T05:46:46-04:00 ci: Test bootstrapping configurations with full-ci and on marge batches There have been two incidents recently where bootstrapping has been broken by removing support for building with 9.2.*. The process for bumping the minimum required version starts with bumping the configure version and then other CI jobs such as the bootstrap jobs have to be updated. We must not silently bump the minimum required version. Now we are running a slimmed down validate pipeline it seems worthwile to test these bootstrap configurations in the full-ci pipeline. - - - - - 25d4fee7 by Matthew Pickering at 2023-07-27T05:46:46-04:00 bootstrap: Remove ghc-9_2_* plans We are anticipating shortly making it necessary to use ghc-9.4 to boot the compiler. - - - - - 2f66da16 by Matthew Pickering at 2023-07-27T05:46:46-04:00 Update bootstrap plans for ghc-platform and ghc-toolchain dependencies Fixes #23735 - - - - - c8c6eab1 by Matthew Pickering at 2023-07-27T05:46:46-04:00 bootstrap: Disable -selftest flag from bootstrap plans This saves on building one dependency (QuickCheck) which is unecessary for bootstrapping. - - - - - a80ca086 by Andrew Lelechenko at 2023-07-27T05:47:26-04:00 Link reference paper and package from System.Mem.{StableName,Weak} - - - - - a5319358 by David Knothe at 2023-07-28T13:13:10-04:00 Update Match Datatype EquationInfo currently contains a list of the equation's patterns together with a CoreExpr that is to be evaluated after a successful match on this equation. All the match-functions only operate on the first pattern of an equation - after successfully matching it, match is called recursively on the tail of the pattern list. We can express this more clearly and make the code a little more elegant by updating the datatype of EquationInfo as follows: data EquationInfo = EqnMatch { eqn_pat = Pat GhcTc, eqn_rest = EquationInfo } | EqnDone { eqn_rhs = MatchResult CoreExpr } An EquationInfo now explicitly exposes its first pattern which most functions operate on, and exposes the equation that remains after processing the first pattern. An EqnDone signifies an empty equation where the CoreExpr can now be evaluated. - - - - - 86ad1af9 by David Binder at 2023-07-28T13:13:53-04:00 Improve documentation for Data.Fixed - - - - - f8fa1d08 by Ben Gamari at 2023-07-28T13:14:31-04:00 ghc-prim: Use C11 atomics Previously `ghc-prim`'s atomic wrappers used the legacy `__sync_*` family of C builtins. Here we refactor these to rather use the appropriate C11 atomic equivalents, allowing us to be more explicit about the expected ordering semantics. - - - - - 0bfc8908 by Finley McIlwaine at 2023-07-28T18:46:26-04:00 Include -haddock in DynFlags fingerprint The -haddock flag determines whether or not the resulting .hi files contain haddock documentation strings. If the existing .hi files do not contain haddock documentation strings and the user requests them, we should recompile. - - - - - 40425c50 by Andreas Klebinger at 2023-07-28T18:47:02-04:00 Aarch64 NCG: Use encoded immediates for literals. Try to generate instr x2, <imm> instead of mov x1, lit instr x2, x1 When possible. This get's rid if quite a few redundant mov instructions. I believe this causes a metric decrease for LargeRecords as we reduce register pressure. ------------------------- Metric Decrease: LargeRecord ------------------------- - - - - - e9a0fa3f by Andrew Lelechenko at 2023-07-28T18:47:42-04:00 Bump filepath submodule to 1.4.100.4 Resolves #23741 Metric Decrease: MultiComponentModules MultiComponentModulesRecomp MultiLayerModules MultiLayerModulesRecomp T10421 T12234 T12425 T13035 T13701 T13719 T16875 T18304 T18698a T18698b T21839c T9198 TcPlugin_RewritePerf hard_hole_fits Metric decrease on Windows can be probably attributed to https://github.com/haskell/filepath/pull/183 - - - - - ee93edfd by Andrew Lelechenko at 2023-07-28T18:48:21-04:00 Add since pragmas to GHC.IO.Handle.FD - - - - - d0369802 by Simon Peyton Jones at 2023-07-30T09:24:48+01:00 Make the occurrence analyser smarter about join points This MR addresses #22404. There is a big Note Note [Occurrence analysis for join points] that explains it all. Significant changes * New field occ_join_points in OccEnv * The NonRec case of occAnalBind splits into two cases: one for existing join points (which does the special magic for Note [Occurrence analysis for join points], and one for other bindings. * mkOneOcc adds in info from occ_join_points. * All "bring into scope" activity is centralised in the new function `addInScope`. * I made a local data type LocalOcc for use inside the occurrence analyser It is like OccInfo, but lacks IAmDead and IAmALoopBreaker, which in turn makes computationns over it simpler and more efficient. * I found quite a bit of allocation in GHC.Core.Rules.getRules so I optimised it a bit. More minor changes * I found I was using (Maybe Arity) a lot, so I defined a new data type JoinPointHood and used it everwhere. This touches a lot of non-occ-anal files, but it makes everything more perspicuous. * Renamed data constructor WithUsageDetails to WUD, and WithTailUsageDetails to WTUD This also fixes #21128, on the way. --------- Compiler perf ----------- I spent quite a time on performance tuning, so even though it does more than before, the occurrence analyser runs slightly faster on average. Here are the compile-time allocation changes over 0.5% CoOpt_Read(normal) ghc/alloc 766,025,520 754,561,992 -1.5% CoOpt_Singletons(normal) ghc/alloc 759,436,840 762,925,512 +0.5% LargeRecord(normal) ghc/alloc 1,814,482,440 1,799,530,456 -0.8% PmSeriesT(normal) ghc/alloc 68,159,272 67,519,720 -0.9% T10858(normal) ghc/alloc 120,805,224 118,746,968 -1.7% T11374(normal) ghc/alloc 164,901,104 164,070,624 -0.5% T11545(normal) ghc/alloc 79,851,808 78,964,704 -1.1% T12150(optasm) ghc/alloc 73,903,664 71,237,544 -3.6% GOOD T12227(normal) ghc/alloc 333,663,200 331,625,864 -0.6% T12234(optasm) ghc/alloc 52,583,224 52,340,344 -0.5% T12425(optasm) ghc/alloc 81,943,216 81,566,720 -0.5% T13056(optasm) ghc/alloc 294,517,928 289,642,512 -1.7% T13253-spj(normal) ghc/alloc 118,271,264 59,859,040 -49.4% GOOD T15164(normal) ghc/alloc 1,102,630,352 1,091,841,296 -1.0% T15304(normal) ghc/alloc 1,196,084,000 1,166,733,000 -2.5% T15630(normal) ghc/alloc 148,729,632 147,261,064 -1.0% T15703(normal) ghc/alloc 379,366,664 377,600,008 -0.5% T16875(normal) ghc/alloc 32,907,120 32,670,976 -0.7% T17516(normal) ghc/alloc 1,658,001,888 1,627,863,848 -1.8% T17836(normal) ghc/alloc 395,329,400 393,080,248 -0.6% T18140(normal) ghc/alloc 71,968,824 73,243,040 +1.8% T18223(normal) ghc/alloc 456,852,568 453,059,088 -0.8% T18282(normal) ghc/alloc 129,105,576 131,397,064 +1.8% T18304(normal) ghc/alloc 71,311,712 70,722,720 -0.8% T18698a(normal) ghc/alloc 208,795,112 210,102,904 +0.6% T18698b(normal) ghc/alloc 230,320,736 232,697,976 +1.0% BAD T19695(normal) ghc/alloc 1,483,648,128 1,504,702,976 +1.4% T20049(normal) ghc/alloc 85,612,024 85,114,376 -0.6% T21839c(normal) ghc/alloc 415,080,992 410,906,216 -1.0% GOOD T4801(normal) ghc/alloc 247,590,920 250,726,272 +1.3% T6048(optasm) ghc/alloc 95,699,416 95,080,680 -0.6% T783(normal) ghc/alloc 335,323,384 332,988,120 -0.7% T9233(normal) ghc/alloc 709,641,224 685,947,008 -3.3% GOOD T9630(normal) ghc/alloc 965,635,712 948,356,120 -1.8% T9675(optasm) ghc/alloc 444,604,152 428,987,216 -3.5% GOOD T9961(normal) ghc/alloc 303,064,592 308,798,800 +1.9% BAD WWRec(normal) ghc/alloc 503,728,832 498,102,272 -1.1% geo. mean -1.0% minimum -49.4% maximum +1.9% In fact these figures seem to vary between platforms; generally worse on i386 for some reason. The Windows numbers vary by 1% espec in benchmarks where the total allocation is low. But the geom mean stays solidly negative, which is good. The "increase/decrease" list below covers all platforms. The big win on T13253-spj comes because it has a big nest of join points, each occurring twice in the next one. The new occ-anal takes only one iteration of the simplifier to do the inlining; the old one took four. Moreover, we get much smaller code with the new one: New: Result size of Tidy Core = {terms: 429, types: 84, coercions: 0, joins: 14/14} Old: Result size of Tidy Core = {terms: 2,437, types: 304, coercions: 0, joins: 10/10} --------- Runtime perf ----------- No significant changes in nofib results, except a 1% reduction in compiler allocation. Metric Decrease: CoOpt_Read T13253-spj T9233 T9630 T9675 T12150 T21839c LargeRecord MultiComponentModulesRecomp T10421 T13701 T10421 T13701 T12425 Metric Increase: T18140 T9961 T18282 T18698a T18698b T19695 - - - - - 42aa7fbd by Julian Ospald at 2023-07-30T17:22:01-04:00 Improve documentation around IOException and ioe_filename See: * https://github.com/haskell/core-libraries-committee/issues/189 * https://github.com/haskell/unix/pull/279 * https://github.com/haskell/unix/pull/289 - - - - - 33598ecb by Sylvain Henry at 2023-08-01T14:45:54-04:00 JS: implement getMonotonicTime (fix #23687) - - - - - d2bedffd by Bartłomiej Cieślar at 2023-08-01T14:46:40-04:00 Implementation of the Deprecated Instances proposal #575 This commit implements the ability to deprecate certain instances, which causes the compiler to emit the desired deprecation message whenever they are instantiated. For example: module A where class C t where instance {-# DEPRECATED "dont use" #-} C Int where module B where import A f :: C t => t f = undefined g :: Int g = f -- "dont use" emitted here The implementation is as follows: - In the parser, we parse deprecations/warnings attached to instances: instance {-# DEPRECATED "msg" #-} Show X deriving instance {-# WARNING "msg2" #-} Eq Y (Note that non-standalone deriving instance declarations do not support this mechanism.) - We store the resulting warning message in `ClsInstDecl` (respectively, `DerivDecl`). In `GHC.Tc.TyCl.Instance.tcClsInstDecl` (respectively, `GHC.Tc.Deriv.Utils.newDerivClsInst`), we pass on that information to `ClsInst` (and eventually store it in `IfaceClsInst` too). - Finally, when we solve a constraint using such an instance, in `GHC.Tc.Instance.Class.matchInstEnv`, we emit the appropriate warning that was stored in `ClsInst`. Note that we only emit a warning when the instance is used in a different module than it is defined, which keeps the behaviour in line with the deprecation of top-level identifiers. Signed-off-by: Bartłomiej Cieślar <bcieslar2001 at gmail.com> - - - - - d5a65af6 by Ben Gamari at 2023-08-01T14:47:18-04:00 compiler: Style fixes - - - - - 7218c80a by Ben Gamari at 2023-08-01T14:47:19-04:00 rts: Fix implicit cast This ensures that Task.h can be built with a C++ compiler. - - - - - d6d5aafc by Ben Gamari at 2023-08-01T14:47:19-04:00 testsuite: Fix warning in hs_try_putmvar001 - - - - - d9eddf7a by Ben Gamari at 2023-08-01T14:47:19-04:00 testsuite: Add AtomicModifyIORef test - - - - - f9eea4ba by Ben Gamari at 2023-08-01T14:47:19-04:00 rts: Introduce NO_WARN macro This allows fine-grained ignoring of warnings. - - - - - 497b24ec by Ben Gamari at 2023-08-01T14:47:19-04:00 rts: Simplify atomicModifyMutVar2# implementation Previously we would perform a redundant load in the non-threaded RTS in atomicModifyMutVar2# implementation for the benefit of the non-moving GC's write barrier. Eliminate this. - - - - - 52ee082b by Ben Gamari at 2023-08-01T14:47:19-04:00 rts: Introduce more principled fence operations - - - - - cd3c0377 by Ben Gamari at 2023-08-01T14:47:19-04:00 rts: Introduce SET_INFO_RELAXED - - - - - 6df2352a by Ben Gamari at 2023-08-01T14:47:19-04:00 rts: Style fixes - - - - - 4ef6f319 by Ben Gamari at 2023-08-01T14:47:19-04:00 codeGen/tsan: Rework handling of spilling - - - - - f9ca7e27 by Ben Gamari at 2023-08-01T14:47:19-04:00 hadrian: More debug information - - - - - df4153ac by Ben Gamari at 2023-08-01T14:47:19-04:00 Improve TSAN documentation - - - - - fecae988 by Ben Gamari at 2023-08-01T14:47:19-04:00 hadrian: More selective TSAN instrumentation - - - - - 465a9a0b by Alan Zimmerman at 2023-08-01T14:47:56-04:00 EPA: Provide correct annotation span for ImportDecl Use the whole declaration, rather than just the span of the 'import' keyword. Metric Decrease: T9961 T5205 Metric Increase: T13035 - - - - - ae63d0fa by Bartłomiej Cieślar at 2023-08-01T14:48:40-04:00 Add cases to T23279: HasField for deprecated record fields This commit adds additional tests from ticket #23279 to ensure that we don't regress on reporting deprecated record fields in conjunction with HasField, either when using overloaded record dot syntax or directly through `getField`. Fixes #23279 - - - - - 00fb6e6b by Andreas Klebinger at 2023-08-01T14:49:17-04:00 AArch NCG: Pure refactor Combine some alternatives. Add some line breaks for overly long lines - - - - - 8f3b3b78 by Andreas Klebinger at 2023-08-01T14:49:54-04:00 Aarch ncg: Optimize immediate use for address calculations When the offset doesn't fit into the immediate we now just reuse the general getRegister' code path which is well optimized to compute the offset into a register instead of a special case for CmmRegOff. This means we generate a lot less code under certain conditions which is why performance metrics for these improve. ------------------------- Metric Decrease: T4801 T5321FD T5321Fun ------------------------- - - - - - 74a882dc by MorrowM at 2023-08-02T06:00:03-04:00 Add a RULE to make lookup fuse See https://github.com/haskell/core-libraries-committee/issues/175 Metric Increase: T18282 - - - - - cca74dab by Ben Gamari at 2023-08-02T06:00:39-04:00 hadrian: Ensure that way-flags are passed to CC Previously the way-specific compilation flags (e.g. `-DDEBUG`, `-DTHREADED_RTS`) would not be passed to the CC invocations. This meant that C dependency files would not correctly reflect dependencies predicated on the way, resulting in the rather painful #23554. Closes #23554. - - - - - 622b483c by Jaro Reinders at 2023-08-02T06:01:20-04:00 Native 32-bit Enum Int64/Word64 instances This commits adds more performant Enum Int64 and Enum Word64 instances for 32-bit platforms, replacing the Integer-based implementation. These instances are a copy of the Enum Int and Enum Word instances with minimal changes to manipulate Int64 and Word64 instead. On i386 this yields a 1.5x performance increase and for the JavaScript back end it even yields a 5.6x speedup. Metric Decrease: T18964 - - - - - c8bd7fa4 by Sylvain Henry at 2023-08-02T06:02:03-04:00 JS: fix typos in constants (#23650) - - - - - b9d5bfe9 by Josh Meredith at 2023-08-02T06:02:40-04:00 JavaScript: update MK_TUP macros to use current tuple constructors (#23659) - - - - - 28211215 by Matthew Pickering at 2023-08-02T06:03:19-04:00 ci: Pass -Werror when building hadrian in hadrian-ghc-in-ghci job Warnings when building Hadrian can end up cluttering the output of HLS, and we've had bug reports in the past about these warnings when building Hadrian. It would be nice to turn on -Werror on at least one build of Hadrian in CI to avoid a patch introducing warnings when building Hadrian. Fixes #23638 - - - - - aca20a5d by Ben Gamari at 2023-08-02T06:03:55-04:00 codeGen: Ensure that TSAN is aware of writeArray# write barriers By using a proper release store instead of a fence. - - - - - 453c0531 by Ben Gamari at 2023-08-02T06:03:55-04:00 codeGen: Ensure that array reads have necessary barriers This was the cause of #23541. - - - - - 93a0d089 by Arnaud Spiwack at 2023-08-02T06:04:37-04:00 Add test for #23550 - - - - - 6a2f4a20 by Arnaud Spiwack at 2023-08-02T06:04:37-04:00 Desugar non-recursive lets to non-recursive lets (take 2) This reverts commit 522bd584f71ddeda21efdf0917606ce3d81ec6cc. And takes care of the case that I missed in my previous attempt. Namely the case of an AbsBinds with no type variables and no dictionary variable. Ironically, the comment explaining why non-recursive lets were desugared to recursive lets were pointing specifically at this case as the reason. I just failed to understand that it was until Simon PJ pointed it out to me. See #23550 for more discussion. - - - - - ff81d53f by jade at 2023-08-02T06:05:20-04:00 Expand documentation of List & Data.List This commit aims to improve the documentation and examples of symbols exported from Data.List - - - - - fa4e5913 by Jade at 2023-08-02T06:06:03-04:00 Improve documentation of Semigroup & Monoid This commit aims to improve the documentation of various symbols exported from Data.Semigroup and Data.Monoid - - - - - e2c91bff by Gergő Érdi at 2023-08-03T02:55:46+01:00 Desugar bindings in the context of their evidence Closes #23172 - - - - - 481f4a46 by Gergő Érdi at 2023-08-03T07:48:43+01:00 Add flag to `-f{no-}specialise-incoherents` to enable/disable specialisation of incoherent instances Fixes #23287 - - - - - d751c583 by Profpatsch at 2023-08-04T12:24:26-04:00 base: Improve String & IsString documentation - - - - - 01db1117 by Ben Gamari at 2023-08-04T12:25:02-04:00 rts/win32: Ensure reliability of IO manager shutdown When the Win32 threaded IO manager shuts down, `ioManagerDie` sends an `IO_MANAGER_DIE` event to the IO manager thread using the `io_manager_event` event object. Finally, it will closes the event object, and invalidate `io_manager_event`. Previously, `readIOManagerEvent` would see that `io_manager_event` is invalid and return `0`, suggesting that everything is right with the world. This meant that if `ioManagerDie` invalidated the handle before the event manager was blocked on the event we would end up in a situation where the event manager would never realize it was asked to shut down. Fix this by ensuring that `readIOManagerEvent` instead returns `IO_MANAGER_DIE` when we detect that the event object has been invalidated by `ioManagerDie`. Fixes #23691. - - - - - fdef003a by Ryan Scott at 2023-08-04T12:25:39-04:00 Look through TH splices in splitHsApps This modifies `splitHsApps` (a key function used in typechecking function applications) to look through untyped TH splices and quasiquotes. Not doing so was the cause of #21077. This builds on !7821 by making `splitHsApps` match on `HsUntypedSpliceTop`, which contains the `ThModFinalizers` that must be run as part of invoking the TH splice. See the new `Note [Looking through Template Haskell splices in splitHsApps]` in `GHC.Tc.Gen.Head`. Along the way, I needed to make the type of `splitHsApps.set` slightly more general to accommodate the fact that the location attached to a quasiquote is a `SrcAnn NoEpAnns` rather than a `SrcSpanAnnA`. Fixes #21077. - - - - - e77a0b41 by Ben Gamari at 2023-08-04T12:26:15-04:00 Bump deepseq submodule to 1.5. And bump bounds (cherry picked from commit 1228d3a4a08d30eaf0138a52d1be25b38339ef0b) - - - - - cebb5819 by Ben Gamari at 2023-08-04T12:26:15-04:00 configure: Bump minimal boot GHC version to 9.4 (cherry picked from commit d3ffdaf9137705894d15ccc3feff569d64163e8e) - - - - - 83766dbf by Ben Gamari at 2023-08-04T12:26:15-04:00 template-haskell: Bump version to 2.21.0.0 Bumps exceptions submodule. (cherry picked from commit bf57fc9aea1196f97f5adb72c8b56434ca4b87cb) - - - - - 1211112a by Ben Gamari at 2023-08-04T12:26:15-04:00 base: Bump version to 4.19 Updates all boot library submodules. (cherry picked from commit 433d99a3c24a55b14ec09099395e9b9641430143) - - - - - 3ab5efd9 by Ben Gamari at 2023-08-04T12:26:15-04:00 testsuite: Normalise versions more aggressively In backpack hashes can contain `+` characters. (cherry picked from commit 024861af51aee807d800e01e122897166a65ea93) - - - - - d52be957 by Ben Gamari at 2023-08-04T12:26:15-04:00 testsuite: Declare bkpcabal08 as fragile Due to spurious output changes described in #23648. (cherry picked from commit c046a2382420f2be2c4a657c56f8d95f914ea47b) - - - - - e75a58d1 by Ben Gamari at 2023-08-04T12:26:15-04:00 gitlab-ci: Only mark linker_unload_native as broken in static jobs This test passes on dynamically-linked Alpine. (cherry picked from commit f356a7e8ec8ec3d6b2b30fd175598b9b80065d87) - - - - - 8b176514 by Ben Gamari at 2023-08-04T12:26:15-04:00 testsuite: Update base-exports - - - - - 4b647936 by Ben Gamari at 2023-08-04T12:26:15-04:00 testsuite/interface-stability: normalise versions This eliminates spurious changes from version bumps. - - - - - 0eb54c05 by Ben Gamari at 2023-08-04T12:26:51-04:00 linker/PEi386: Don't sign-extend symbol section number Previously we incorrectly interpreted PE section numbers as signed values. However, this isn't the case; rather, it's an unsigned 16-bit number with a few special bit-patterns (0xffff and 0xfffe). This resulted in #22941 as the linker would conclude that the sections were invalid. Fixing this required quite a bit of refactoring. Closes #22941. - - - - - fd7ce39c by Ben Gamari at 2023-08-04T12:27:28-04:00 testsuite: Mark MulMayOflo_full as broken rather than skipping To ensure that we don't accidentally fix it. See #23742. - - - - - 824092f2 by Ben Gamari at 2023-08-04T12:27:28-04:00 nativeGen/AArch64: Fix sign extension in MulMayOflo Previously the 32-bit implementations of MulMayOflo would use the a non-sensical sign-extension mode. Rewrite these to reflect what gcc 11 produces. Also similarly rework the 16- and 8-bit cases. This now passes the MulMayOflo tests in ghc/test-primops> in all four widths, including the precision tests. Fixes #23721. - - - - - 1b15dbc4 by Jan Hrček at 2023-08-04T12:28:08-04:00 Fix haddock markup in code example for coerce - - - - - 46fd8ced by Vladislav Zavialov at 2023-08-04T12:28:44-04:00 Fix (~) and (@) infix operators in TH splices (#23748) 8168b42a "Whitespace-sensitive bang patterns" allows GHC to accept the following infix operators: a ~ b = () a @ b = () But not if TH is used to generate those declarations: $([d| a ~ b = () a @ b = () |]) -- Test.hs:5:2: error: [GHC-55017] -- Illegal variable name: ‘~’ -- When splicing a TH declaration: (~_0) a_1 b_2 = GHC.Tuple.Prim.() This is easily fixed by modifying `reservedOps` in GHC.Utils.Lexeme - - - - - a1899d8f by Aaron Allen at 2023-08-04T12:29:24-04:00 [#23663] Show Flag Suggestions in GHCi Makes suggestions when using `:set` in GHCi with a misspelled flag. This mirrors how invalid flags are handled when passed to GHC directly. Logic for producing flag suggestions was moved to GHC.Driver.Sesssion so it can be shared. resolves #23663 - - - - - 03f2debd by Rodrigo Mesquita at 2023-08-04T12:30:00-04:00 Improve ghc-toolchain validation configure warning Fixes the layout of the ghc-toolchain validation warning produced by configure. - - - - - de25487d by Alan Zimmerman at 2023-08-04T12:30:36-04:00 EPA make getLocA a synonym for getHasLoc This is basically a no-op change, but allows us to make future changes that can rely on the HasLoc instances And I presume this means we can use more precise functions based on class resolution, so the Windows CI build reports Metric Decrease: T12234 T13035 - - - - - 3ac423b9 by Ben Gamari at 2023-08-04T12:31:13-04:00 ghc-platform: Add upper bound on base Hackage upload requires this. - - - - - 8ba20b21 by Matthew Craven at 2023-08-04T17:22:59-04:00 Adjust and clarify handling of primop effects Fixes #17900; fixes #20195. The existing "can_fail" and "has_side_effects" primop attributes that previously governed this were used in inconsistent and confusingly-documented ways, especially with regard to raising exceptions. This patch replaces them with a single "effect" attribute, which has four possible values: NoEffect, CanFail, ThrowsException, and ReadWriteEffect. These are described in Note [Classifying primop effects]. A substantial amount of related documentation has been re-drafted for clarity and accuracy. In the process of making this attribute format change for literally every primop, several existing mis-classifications were detected and corrected. One of these mis-classifications was tagToEnum#, which is now considered CanFail; this particular fix is known to cause a regression in performance for derived Enum instances. (See #23782.) Fixing this is left as future work. New primop attributes "cheap" and "work_free" were also added, and used in the corresponding parts of GHC.Core.Utils. In view of their actual meaning and uses, `primOpOkForSideEffects` and `exprOkForSideEffects` have been renamed to `primOpOkToDiscard` and `exprOkToDiscard`, respectively. Metric Increase: T21839c - - - - - 41bf2c09 by sheaf at 2023-08-04T17:23:42-04:00 Update inert_solved_dicts for ImplicitParams When adding an implicit parameter dictionary to the inert set, we must make sure that it replaces any previous implicit parameter dictionaries that overlap, in order to get the appropriate shadowing behaviour, as in let ?x = 1 in let ?x = 2 in ?x We were already doing this for inert_cans, but we weren't doing the same thing for inert_solved_dicts, which lead to the bug reported in #23761. The fix is thus to make sure that, when handling an implicit parameter dictionary in updInertDicts, we update **both** inert_cans and inert_solved_dicts to ensure a new implicit parameter dictionary correctly shadows old ones. Fixes #23761 - - - - - 43578d60 by Matthew Craven at 2023-08-05T01:05:36-04:00 Bump bytestring submodule to 0.11.5.1 - - - - - 91353622 by Ben Gamari at 2023-08-05T01:06:13-04:00 Initial commit of Note [Thunks, blackholes, and indirections] This Note attempts to summarize the treatment of thunks, thunk update, and indirections. This fell out of work on #23185. - - - - - 8d686854 by sheaf at 2023-08-05T01:06:54-04:00 Remove zonk in tcVTA This removes the zonk in GHC.Tc.Gen.App.tc_inst_forall_arg and its accompanying Note [Visible type application zonk]. Indeed, this zonk is no longer necessary, as we no longer maintain the invariant that types are well-kinded without zonking; only that typeKind does not crash; see Note [The Purely Kinded Type Invariant (PKTI)]. This commit removes this zonking step (as well as a secondary zonk), and replaces the aforementioned Note with the explanatory Note [Type application substitution], which justifies why the substitution performed in tc_inst_forall_arg remains valid without this zonking step. Fixes #23661 - - - - - 19dea673 by Ben Gamari at 2023-08-05T01:07:30-04:00 Bump nofib submodule Ensuring that nofib can be build using the same range of bootstrap compilers as GHC itself. - - - - - aa07402e by Luite Stegeman at 2023-08-05T23:15:55+09:00 JS: Improve compatibility with recent emsdk The JavaScript code in libraries/base/jsbits/base.js had some hardcoded offsets for fields in structs, because we expected the layout of the data structures to remain unchanged. Emsdk 3.1.42 changed the layout of the stat struct, breaking this assumption, and causing code in .hsc files accessing the stat struct to fail. This patch improves compatibility with recent emsdk by removing the assumption that data layouts stay unchanged: 1. offsets of fields in structs used by JavaScript code are now computed by the configure script, so both the .js and .hsc files will automatically use the new layout if anything changes. 2. the distrib/configure script checks that the emsdk version on a user's system is the same version that a bindist was booted with, to avoid data layout inconsistencies See #23641 - - - - - b938950d by Luite Stegeman at 2023-08-07T06:27:51-04:00 JS: Fix missing local variable declarations This fixes some missing local variable declarations that were found by running the testsuite in strict mode. Fixes #23775 - - - - - 6c0e2247 by sheaf at 2023-08-07T13:31:21-04:00 Update Haddock submodule to fix #23368 This submodule update adds the following three commits: bbf1c8ae - Check for puns 0550694e - Remove fake exports for (~), List, and Tuple<n> 5877bceb - Fix pretty-printing of Solo and MkSolo These commits fix the issues with Haddock HTML rendering reported in ticket #23368. Fixes #23368 - - - - - 5b5be3ea by Matthew Pickering at 2023-08-07T13:32:00-04:00 Revert "Bump bytestring submodule to 0.11.5.1" This reverts commit 43578d60bfc478e7277dcd892463cec305400025. Fixes #23789 - - - - - 01961be3 by Ben Gamari at 2023-08-08T02:47:14-04:00 configure: Derive library version from ghc-prim.cabal.in Since ghc-prim.cabal is now generated by Hadrian, we cannot depend upon it. Closes #23726. - - - - - 3b373838 by Ryan Scott at 2023-08-08T02:47:49-04:00 tcExpr: Push expected types for untyped TH splices inwards In !10911, I deleted a `tcExpr` case for `HsUntypedSplice` in favor of a much simpler case that simply delegates to `tcApp`. Although this passed the test suite at the time, this was actually an error, as the previous `tcExpr` case was critically pushing the expected type inwards. This actually matters for programs like the one in #23796, which GHC would not accept with type inference alone—we need full-blown type _checking_ to accept these. I have added back the previous `tcExpr` case for `HsUntypedSplice` and now explain why we have two different `HsUntypedSplice` cases (one in `tcExpr` and another in `splitHsApps`) in `Note [Looking through Template Haskell splices in splitHsApps]` in `GHC.Tc.Gen.Head`. Fixes #23796. - - - - - 0ef1d8ae by sheaf at 2023-08-08T21:26:51-04:00 Compute all emitted diagnostic codes This commit introduces in GHC.Types.Error.Codes the function constructorCodes :: forall diag. (...) => Map DiagnosticCode String which computes a collection of all the diagnostic codes that correspond to a particular type. In particular, we can compute the collection of all diagnostic codes emitted by GHC using the invocation constructorCodes @GhcMessage We then make use of this functionality in the new "codes" test which checks consistency and coverage of GHC diagnostic codes. It performs three checks: - check 1: all non-outdated GhcDiagnosticCode equations are statically used. - check 2: all outdated GhcDiagnosticCode equations are statically unused. - check 3: all statically used diagnostic codes are covered by the testsuite (modulo accepted exceptions). - - - - - 4bc7b1e5 by Fraser Tweedale at 2023-08-08T21:27:32-04:00 numberToRangedRational: fix edge cases for exp ≈ (maxBound :: Int) Currently a negative exponent less than `minBound :: Int` results in Infinity, which is very surprising and obviously wrong. ``` λ> read "1e-9223372036854775808" :: Double 0.0 λ> read "1e-9223372036854775809" :: Double Infinity ``` There is a further edge case where the exponent can overflow when increased by the number of tens places in the integer part, or underflow when decreased by the number of leading zeros in the fractional part if the integer part is zero: ``` λ> read "10e9223372036854775807" :: Double 0.0 λ> read "0.01e-9223372036854775808" :: Double Infinity ``` To resolve both of these issues, perform all arithmetic and comparisons involving the exponent in type `Integer`. This approach also eliminates the need to explicitly check the exponent against `maxBound :: Int` and `minBound :: Int`, because the allowed range of the exponent (i.e. the result of `floatRange` for the target floating point type) is certainly within those bounds. This change implements CLC proposal 192: https://github.com/haskell/core-libraries-committee/issues/192 - - - - - 6eab07b2 by Alan Zimmerman at 2023-08-08T21:28:10-04:00 EPA: Remove Location from WarningTxt source This is not needed. - - - - - 1a98d673 by Sebastian Graf at 2023-08-09T16:24:29-04:00 Cleanup a TODO introduced in 1f94e0f7 The change must have slipped through review of !4412 - - - - - 2274abc8 by Sebastian Graf at 2023-08-09T16:24:29-04:00 More explicit strictness in GHC.Real - - - - - ce8aa54c by Sebastian Graf at 2023-08-09T16:24:30-04:00 exprIsTrivial: Factor out shared implementation The duplication between `exprIsTrivial` and `getIdFromTrivialExpr_maybe` has been bugging me for a long time. This patch introduces an inlinable worker function `trivial_expr_fold` acting as the single, shared decision procedure of triviality. It "returns" a Church-encoded `Maybe (Maybe Id)`, so when it is inlined, it fuses to similar code as before. (Better code, even, in the case of `getIdFromTrivialExpr` which presently allocates a `Just` constructor that cancels away after this patch.) - - - - - d004a36d by Sebastian Graf at 2023-08-09T16:24:30-04:00 Simplify: Simplification of arguments in a single function The Simplifier had a function `simplArg` that wasn't called in `rebuildCall`, which seems to be the main way to simplify args. Hence I consolidated the code path to call `simplArg`, too, renaming to `simplLazyArg`. - - - - - 8c73505e by Sebastian Graf at 2023-08-09T16:24:30-04:00 Core.Ppr: Omit case binder for empty case alternatives A minor improvement to pretty-printing - - - - - d8d993f1 by Sebastian Graf at 2023-08-09T16:24:30-04:00 Disable tests RepPolyWrappedVar2 and RepPolyUnsafeCoerce1 in JS backend ... because those coerce between incompatible/unknown PrimReps. - - - - - f06e87e4 by Sebastian Graf at 2023-08-09T16:24:30-04:00 Inlining literals into boring contexts is OK - - - - - 4a6b7c87 by Sebastian Graf at 2023-08-09T16:24:30-04:00 Clarify floating of unsafeEqualityProofs (#23754) - - - - - b0f4752e by Sebastian Graf at 2023-08-09T16:24:30-04:00 Kill SetLevel.notWorthFloating.is_triv (#23270) We have had it since b84ba676034, when it operated on annotated expressions. Nowadays it operates on vanilla `CoreExpr` though, so we should just call `exprIsTrivial`; thus handling empty cases and string literals correctly. - - - - - 7e0c8b3b by Sebastian Graf at 2023-08-09T16:24:30-04:00 ANFise string literal arguments (#23270) This instates the invariant that a trivial CoreExpr translates to an atomic StgExpr. Nice. Annoyingly, in -O0 we sometimes generate ``` foo = case "blah"# of sat { __DEFAULT -> unpackCString# sat } ``` which makes it a bit harder to spot that we can emit a standard `stg_unpack_cstring` thunk. Fixes #23270. - - - - - 357f2738 by Sebastian Graf at 2023-08-09T16:24:30-04:00 Deactivate -fcatch-nonexhaustive-cases in ghc-bignum (#23345) - - - - - 59202c80 by Sebastian Graf at 2023-08-09T16:24:30-04:00 CorePrep: Eliminate EmptyCase and unsafeEqualityProof in CoreToStg instead We eliminate EmptyCase by way of `coreToStg (Case e _ _ []) = coreToStg e` now. The main reason is that it plays far better in conjunction with eta expansion (as we aim to do for arguments in CorePrep, #23083), because we can discard any arguments, `(case e of {}) eta == case e of {}`, whereas in `(e |> co) eta` it's impossible to discard the argument. We do also give the same treatment to unsafeCoerce proofs and treat them as trivial iff their RHS is trivial. It is also both much simpler to describe than the previous mechanism of emitting an unsafe coercion and simpler to implement, removing quite a bit of commentary and `CorePrepProv`. In the ghc/alloc perf test `LargeRecord`, we introduce an additional Simplifier iteration due to #17910. E.g., FloatOut produces a binding ``` lvl_s6uK [Occ=Once1] :: GHC.Types.Int [LclId] lvl_s6uK = GHC.Types.I# 2# lvl_s6uL [Occ=Once1] :: GHC.Types.Any [LclId] lvl_s6uL = case Unsafe.Coerce.unsafeEqualityProof ... of { Unsafe.Coerce.UnsafeRefl v2_i6tr -> lvl_s6uK `cast` (... v2_i6tr ...) } ``` That occurs once and hence is pre-inlined unconditionally in the next Simplifier pass. It's non-trivial to find a way around that, but not really harmful otherwise. Hence we accept a 1.2% increase on some architectures. Metric Increase: LargeRecord - - - - - 00d31188 by Sebastian Graf at 2023-08-09T16:24:30-04:00 CorePrep: Eta expand arguments (#23083) Previously, we'd only eta expand let bindings and lambdas, now we'll also eta expand arguments such as in T23083: ```hs g f h = f (h `seq` (h $)) ``` Unless `-fpedantic-bottoms` is set, we'll now transform to ```hs g f h = f (\eta -> h eta) ``` in CorePrep. See the new `Note [Eta expansion of arguments in CorePrep]` for the details. We only do this optimisation with -O2 because we saw 2-3% ghc/alloc regressions in T4801 and T5321FD. Fixes #23083. - - - - - bf885d7a by Matthew Craven at 2023-08-09T16:25:07-04:00 Bump bytestring submodule to 0.11.5, again Fixes #23789. The bytestring commit used here is unreleased; a release can be made when necessary. - - - - - 7acbf0fd by Sven Tennie at 2023-08-10T19:17:11-04:00 Serialize CmmRetInfo in .rodata The handling of case was missing. - - - - - 0c3136f2 by Sven Tennie at 2023-08-10T19:17:11-04:00 Reference StgRetFun payload by its struct field address This is easier to grasp than relative pointer offsets. - - - - - f68ff313 by Sven Tennie at 2023-08-10T19:17:11-04:00 Better variable name: u -> frame The 'u' was likely introduced by copy'n'paste. - - - - - 0131bb7f by Sven Tennie at 2023-08-10T19:17:11-04:00 Make checkSTACK() public Such that it can also be used in tests. - - - - - 7b6e1e53 by Sven Tennie at 2023-08-10T19:17:11-04:00 Publish stack related fields in DerivedConstants.h These will be used in ghc-heap to decode these parts of the stack. - - - - - 907ed054 by Sven Tennie at 2023-08-10T19:17:11-04:00 ghc-heap: Decode StgStack and its stack frames Previously, ghc-heap could only decode heap closures. The approach is explained in detail in note [Decoding the stack]. - - - - - 6beb6ac2 by Sven Tennie at 2023-08-10T19:17:11-04:00 Remove RetFunType from RetFun stack frame representation It's a technical detail. The single usage is replaced by a predicate. - - - - - 006bb4f3 by Sven Tennie at 2023-08-10T19:17:11-04:00 Better parameter name The call-site uses the term "offset", too. - - - - - d4c2c1af by Sven Tennie at 2023-08-10T19:17:11-04:00 Make closure boxing pure There seems to be no need to do something complicated. However, the strictness of the closure pointer matters, otherwise a thunk gets decoded. - - - - - 8d8426c9 by Sven Tennie at 2023-08-10T19:17:11-04:00 Document entertainGC in test It wasn't obvious why it's there and what its role is. Also, increase the "entertainment level" a bit. I checked in STG and Cmm dumps that this really generates closures (and is not e.g. constant folded away.) - - - - - cc52c358 by Finley McIlwaine at 2023-08-10T19:17:47-04:00 Add -dipe-stats flag This is useful for seeing which info tables have information. - - - - - 261c4acb by Finley McIlwaine at 2023-08-10T19:17:47-04:00 Add -finfo-table-map-with-fallback -finfo-table-map-with-stack The -fno-info-table-map-with-stack flag omits STACK info tables from the info table map, and the -fno-info-table-map-with-fallback flag omits info tables with defaulted source locations from the map. In a test on the Agda codebase the build results were about 7% smaller when both of those types of tables were omitted. Adds a test that verifies that passing each combination of these flags results in the correct output for -dipe-stats, which is disabled for the js backend since profiling is not implemented. This commit also refactors a lot of the logic around extracting info tables from the Cmm results and building the info table map. This commit also fixes some issues in the users guide rst source to fix warnings that were noticed while debugging the documentation for these flags. Fixes #23702 - - - - - d7047e0d by Jaro Reinders at 2023-08-14T04:41:42-04:00 Add changelog entry for specialised Enum Int64/Word64 instances - - - - - 52f5e8fb by cydparser at 2023-08-14T04:42:20-04:00 Fix -ddump-to-file and -ddump-timings interaction (#20316) - - - - - 1274c5d6 by cydparser at 2023-08-14T04:42:20-04:00 Update release notes (#20316) - - - - - 8e699b23 by Matthew Pickering at 2023-08-14T10:44:47-04:00 base: Add changelog entry for CLC #188 This proposal modified the implementations of copyBytes, moveBytes and fillBytes (as detailed in the proposal) https://github.com/haskell/core-libraries-committee/issues/188 - - - - - 026f040a by Matthew Pickering at 2023-08-14T10:45:23-04:00 packaging: Build manpage in separate directory to other documentation We were installing two copies of the manpage: * One useless one in the `share/doc` folder, because we copy the doc/ folder into share/ * The one we deliberately installed into `share/man` etc The solution is to build the manpage into the `manpage` directory when building the bindist, and then just install it separately. Fixes #23707 - - - - - 524c60c8 by Bartłomiej Cieślar at 2023-08-14T13:46:33-04:00 Report deprecated fields bound by record wildcards when used This commit ensures that we emit the appropriate warnings when a deprecated record field bound by a record wildcard is used. For example: module A where data Foo = Foo {x :: Int, y :: Bool, z :: Char} {-# DEPRECATED x "Don't use x" #-} {-# WARNING y "Don't use y" #-} module B where import A foo (Foo {..}) = x This will cause us to emit a "Don't use x" warning, with location the location of the record wildcard. Note that we don't warn about `y`, because it is unused in the RHS of `foo`. Fixes #23382 - - - - - d6130065 by Matthew Pickering at 2023-08-14T13:47:11-04:00 Add zstd suffix to jobs which rely on zstd This was causing some confusion as the job was named simply "x86_64-linux-deb10-validate", which implies a standard configuration rather than any dependency on libzstd. - - - - - e24e44fc by Matthew Pickering at 2023-08-14T13:47:11-04:00 ci: Always run project-version job This is needed for the downstream test-primops pipeline to workout what the version of a bindist produced by a pipeline is. - - - - - f17b9d62 by Matthew Pickering at 2023-08-14T13:47:11-04:00 gen_ci: Rework how jobs-metadata.json is generated * We now represent a job group a triple of Maybes, which makes it easier to work out when jobs are enabled/disabled on certain pipelines. ``` data JobGroup a = StandardTriple { v :: Maybe (NamedJob a) , n :: Maybe (NamedJob a) , r :: Maybe (NamedJob a) } ``` * `jobs-metadata.json` generation is reworked using the following algorithm. - For each pipeline type, find all the platforms we are doing builds for. - Select one build per platform - Zip together the results This way we can choose different pipelines for validate/nightly/release which makes the metadata also useful for validate pipelines. This feature is used by the test-primops downstream CI in order to select the right bindist for testing validate pipelines. This makes it easier to inspect which jobs are going to be enabled on a particular pipeline. - - - - - f9a5563d by Matthew Pickering at 2023-08-14T13:47:11-04:00 gen_ci: Rules rework In particular we now distinguish between whether we are dealing with a Nightly/Release pipeline (which labels don't matter for) and a validate pipeline where labels do matter. The overall goal here is to allow a disjunction of labels for validate pipelines, for example, > Run a job if we have the full-ci label or test-primops label Therefore the "ValidateOnly" rules are treated as a set of disjunctions rather than conjunctions like before. What this means in particular is that if we want to ONLY run a job if a label is set, for example, "FreeBSD" label then we have to override the whole label set. Fixes #23772 - - - - - d54b0c1d by Matthew Pickering at 2023-08-14T13:47:11-04:00 ci: set -e for lint-ci-config scripts - - - - - 994a9b35 by Matthew Pickering at 2023-08-14T13:47:11-04:00 ci: Fix job metadata generation - - - - - e194ed2b by Ben Gamari at 2023-08-15T00:58:09-04:00 users-guide: Note that GHC2021 doesn't include ExplicitNamespaces As noted in #23801. - - - - - d814bda9 by Ben Gamari at 2023-08-15T05:43:53-04:00 users-guide: Support both distutils and packaging As noted in #23818, some old distributions (e.g. Debian 9) only include `distutils` while newer distributions only include `packaging`. Fixes #23818. - - - - - 1726db3f by Ben Gamari at 2023-08-15T05:43:53-04:00 users-guide: Ensure extlinks is compatible with Sphinx <4 The semantics of the `extlinks` attribute annoyingly changed in Sphinx 4. Reflect this in our configuration. See #22690. Fixes #23807. - - - - - 173338cf by Matthew Pickering at 2023-08-15T22:00:24-04:00 ci: Run full-ci on master and release branches Fixes #23737 - - - - - bdab6898 by Andrew Lelechenko at 2023-08-15T22:01:03-04:00 Add @since pragmas for Data.Ord.clamp and GHC.Float.clamp - - - - - 662d351b by Matthew Pickering at 2023-08-16T09:35:04-04:00 ghc-toolchain: Match CPP args with configure script At the moment we need ghc-toolchain to precisely match the output as provided by the normal configure script. The normal configure script (FP_HSCPP_CMD_WITH_ARGS) branches on whether we are using clang or gcc so we match that logic exactly in ghc-toolchain. The old implementation (which checks if certain flags are supported) is better but for now we have to match to catch any potential errors in the configuration. Ticket: #23720 - - - - - 09c6759e by Matthew Pickering at 2023-08-16T09:35:04-04:00 configure: Fix `-Wl,--no-as-needed` check The check was failing because the args supplied by $$1 were quoted which failed because then the C compiler thought they were an input file. Fixes #23720 - - - - - 2129678b by Matthew Pickering at 2023-08-16T09:35:04-04:00 configure: Add flag which turns ghc-toolchain check into error We want to catch these errors in CI, but first we need to a flag which turns this check into an error. - - - - - 6e2aa8e0 by Matthew Pickering at 2023-08-16T09:35:04-04:00 ci: Enable --enable-strict-ghc-toolchain-check for all CI jobs This will cause any CI job to fail if we have a mismatch between what ghc-toolchain reports and what ./configure natively reports. Fixing these kinds of issues is highest priority for 9.10 release. - - - - - 12d39e24 by Rodrigo Mesquita at 2023-08-16T09:35:04-04:00 Pass user-specified options to ghc-toolchain The current user interface to configuring target toolchains is `./configure`. In !9263 we added a new tool to configure target toolchains called `ghc-toolchain`, but the blessed way of creating these toolchains is still through configure. However, we were not passing the user-specified options given with the `./configure` invocation to the ghc-toolchain tool. This commit remedies that by storing the user options and environment variables in USER_* variables, which then get passed to GHC-toolchain. The exception to the rule is the windows bundled toolchain, which overrides the USER_* variables with whatever flags the windows bundled toolchain requires to work. We consider the bundled toolchain to be effectively the user specifying options, since the actual user delegated that configuration work. Closes #23678 - - - - - f7b3c3a0 by Rodrigo Mesquita at 2023-08-16T09:35:04-04:00 ghc-toolchain: Parse javascript and ghcjs as a Arch and OS - - - - - 8a0ae4ee by Rodrigo Mesquita at 2023-08-16T09:35:04-04:00 ghc-toolchain: Fix ranlib option - - - - - 31e9ec96 by Rodrigo Mesquita at 2023-08-16T09:35:04-04:00 Check Link Works with -Werror - - - - - bc1998b3 by Matthew Pickering at 2023-08-16T09:35:04-04:00 Only check for no_compact_unwind support on darwin While writing ghc-toolchain we noticed that the FP_PROG_LD_NO_COMPACT_UNWIND check is subtly wrong. Specifically, we pass -Wl,-no_compact_unwind to cc. However, ld.gold interprets this as -n o_compact_unwind, which is a valid argument. Fixes #23676 - - - - - 0283f36e by Matthew Pickering at 2023-08-16T09:35:04-04:00 Add some javascript special cases to ghc-toolchain On javascript there isn't a choice of toolchain but some of the configure checks were not accurately providing the correct answer. 1. The linker was reported as gnu LD because the --version output mentioned gnu LD. 2. The --target flag makes no sense on javascript but it was just ignored by the linker, so we add a special case to stop ghc-toolchain thinking that emcc supports --target when used as a linker. - - - - - a48ec5f8 by Matthew Pickering at 2023-08-16T09:35:04-04:00 check for emcc in gnu_LD check - - - - - 50df2e69 by Matthew Pickering at 2023-08-16T09:35:04-04:00 Add ldOverrideWhitelist to only default to ldOverride on windows/linux On some platforms - ie darwin, javascript etc we really do not want to allow the user to use any linker other than the default one as this leads to all kinds of bugs. Therefore it is a bit more prudant to add a whitelist which specifies on which platforms it might be possible to use a different linker. - - - - - a669a39c by Matthew Pickering at 2023-08-16T09:35:04-04:00 Fix plaform glob in FPTOOLS_SET_C_LD_FLAGS A normal triple may look like x86_64-unknown-linux but when cross-compiling you get $target set to a quad such as.. aarch64-unknown-linux-gnu Which should also match this check. - - - - - c52b6769 by Matthew Pickering at 2023-08-16T09:35:04-04:00 ghc-toolchain: Pass ld-override onto ghc-toolchain - - - - - 039b484f by Matthew Pickering at 2023-08-16T09:35:04-04:00 ld override: Make whitelist override user given option - - - - - d2b63cbc by Matthew Pickering at 2023-08-16T09:35:05-04:00 ghc-toolchain: Add format mode to normalise differences before diffing. The "format" mode takes an "--input" and "--ouput" target file and formats it. This is intended to be useful on windows where the configure/ghc-toolchain target files can't be diffed very easily because the path separators are different. - - - - - f2b39e4a by Matthew Pickering at 2023-08-16T09:35:05-04:00 ghc-toolchain: Bump ci-images commit to get new ghc-wasm-meta We needed to remove -Wno-unused-command-line-argument from the arguments passed in order for the configure check to report correctly. See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10976#note_516335 - - - - - 92103830 by Matthew Pickering at 2023-08-16T09:35:05-04:00 configure: MergeObjsCmd - distinguish between empty string and unset variable If `MergeObjsCmd` is explicitly set to the empty string then we should assume that MergeObjs is just not supported. This is especially important for windows where we set MergeObjsCmd to "" in m4/fp_setup_windows_toolchain.m4. - - - - - 3500bb2c by Matthew Pickering at 2023-08-16T09:35:05-04:00 configure: Add proper check to see if object merging works - - - - - 08c9a014 by Matthew Pickering at 2023-08-16T09:35:05-04:00 ghc-toolchain: If MergeObjsCmd is not set, replace setting with Nothing If the user explicitly chooses to not set a MergeObjsCmd then it is correct to use Nothing for tgtMergeObjs field in the Target file. - - - - - c9071d94 by Matthew Pickering at 2023-08-16T09:35:05-04:00 HsCppArgs: Augment the HsCppOptions This is important when we pass -I when setting up the windows toolchain. - - - - - 294a6d80 by Matthew Pickering at 2023-08-16T09:35:05-04:00 Set USER_CPP_ARGS when setting up windows toolchain - - - - - bde4b5d4 by Rodrigo Mesquita at 2023-08-16T09:35:05-04:00 Improve handling of Cc as a fallback - - - - - f4c1c3a3 by Rodrigo Mesquita at 2023-08-16T09:35:05-04:00 ghc-toolchain: Configure Cpp and HsCpp correctly when user specifies flags In ghc-toolchain, we were only /not/ configuring required flags when the user specified any flags at all for the of the HsCpp and Cpp tools. Otherwise, the linker takes into consideration the user specified flags to determine whether to search for a better linker implementation, but already configured the remaining GHC and platform-specific flags regardless of the user options. Other Tools consider the user options as a baseline for further configuration (see `findProgram`), so #23689 is not applicable. Closes #23689 - - - - - bfe4ffac by Matthew Pickering at 2023-08-16T09:35:05-04:00 CPP_ARGS: Put new options after user specified options This matches up with the behaviour of ghc-toolchain, so that the output of both matches. - - - - - a6828173 by Gergő Érdi at 2023-08-16T09:35:41-04:00 If a defaulting plugin made progress, re-zonk wanteds before built-in defaulting Fixes #23821. - - - - - e2b38115 by Sylvain Henry at 2023-08-17T07:54:06-04:00 JS: implement openat(AT_FDCWD...) (#23697) Use `openSync` to implement `openat(AT_FDCWD...)`. - - - - - a975c663 by sheaf at 2023-08-17T07:54:47-04:00 Use unsatisfiable for missing methods w/ defaults When a class instance has an Unsatisfiable constraint in its context and the user has not explicitly provided an implementation of a method, we now always provide a RHS of the form `unsatisfiable @msg`, even if the method has a default definition available. This ensures that, when deferring type errors, users get the appropriate error message instead of a possible runtime loop, if class default methods were defined recursively. Fixes #23816 - - - - - 45ca51e5 by Ben Gamari at 2023-08-17T15:16:41-04:00 ghc-internal: Initial commit of the skeleton - - - - - 88bbf8c5 by Ben Gamari at 2023-08-17T15:16:41-04:00 ghc-experimental: Initial commit - - - - - 664468c0 by Ben Gamari at 2023-08-17T15:17:17-04:00 testsuite/cloneStackLib: Fix incorrect format specifiers - - - - - eaa835bb by Ben Gamari at 2023-08-17T15:17:17-04:00 rts/ipe: Fix const-correctness of IpeBufferListNode Both info tables and the string table should be `const` - - - - - 78f6f6fd by Ben Gamari at 2023-08-17T15:17:17-04:00 nonmoving: Drop dead debugging utilities These are largely superceded by support in the ghc-utils GDB extension. - - - - - 3f6e8f42 by Ben Gamari at 2023-08-17T15:17:17-04:00 nonmoving: Refactor management of mark thread Here we refactor that treatment of the worker thread used by the nonmoving GC for concurrent marking, avoiding creating a new thread with every major GC cycle. As well, the new scheme is considerably easier to reason about, consolidating all state in one place, accessed via a small set of accessors with clear semantics. - - - - - 88c32b7d by Ben Gamari at 2023-08-17T15:17:17-04:00 testsuite: Skip T23221 in nonmoving GC ways This test is very dependent upon GC behavior. - - - - - 381cfaed by Ben Gamari at 2023-08-17T15:17:17-04:00 ghc-heap: Don't expose stack dirty and marking fields These are GC metadata and are not relevant to the end-user. Moreover, they are unstable which makes ghc-heap harder to test than necessary. - - - - - 16828ca5 by Luite Stegeman at 2023-08-21T18:42:53-04:00 bump process submodule to include macOS fix and JS support - - - - - b4d5f6ed by Matthew Pickering at 2023-08-21T18:43:29-04:00 ci: Add support for triggering test-primops pipelines This commit adds 4 ways to trigger testing with test-primops. 1. Applying the ~test-primops label to a validate pipeline. 2. A manually triggered job on a validate pipeline 3. A nightly pipeline job 4. A release pipeline job Fixes #23695 - - - - - 32c50daa by Matthew Pickering at 2023-08-21T18:43:29-04:00 Add test-primops label support The test-primops CI job requires some additional builds in the validation pipeline, so we make sure to enable these jobs when test-primops label is set. - - - - - 73ca8340 by Matthew Pickering at 2023-08-21T18:43:29-04:00 Revert "Aarch ncg: Optimize immediate use for address calculations" This reverts commit 8f3b3b78a8cce3bd463ed175ee933c2aabffc631. See #23793 - - - - - 5546ad9e by Matthew Pickering at 2023-08-21T18:43:29-04:00 Revert "AArch NCG: Pure refactor" This reverts commit 00fb6e6b06598752414a0b9a92840fb6ca61338d. See #23793 - - - - - 02dfcdc2 by Matthew Pickering at 2023-08-21T18:43:29-04:00 Revert "Aarch64 NCG: Use encoded immediates for literals." This reverts commit 40425c5021a9d8eb5e1c1046e2d5fa0a2918f96c. See #23793 ------------------------- Metric Increase: T4801 T5321FD T5321Fun ------------------------- - - - - - 7be4a272 by Matthew Pickering at 2023-08-22T08:55:20+01:00 ci: Remove manually triggered test-ci job This doesn't work on slimmed down pipelines as the needed jobs don't exist. If you want to run test-primops then apply the label. - - - - - 76a4d11b by Jaro Reinders at 2023-08-22T08:08:13-04:00 Remove Ptr example from roles docs - - - - - 069729d3 by Bryan Richter at 2023-08-22T08:08:49-04:00 Guard against duplicate pipelines in forks - - - - - f861423b by Rune K. Svendsen at 2023-08-22T08:09:35-04:00 dump-decls: fix "Ambiguous module name"-error Fixes errors of the following kind, which happen when dump-decls is run on a package that contains a module name that clashes with that of another package. ``` dump-decls: <no location info>: error: Ambiguous module name `System.Console.ANSI.Types': it was found in multiple packages: ansi-terminal-0.11.4 ansi-terminal-types-0.11.5 ``` - - - - - edd8bc43 by Krzysztof Gogolewski at 2023-08-22T12:31:20-04:00 Fix MultiWayIf linearity checking (#23814) Co-authored-by: Thomas BAGREL <thomas.bagrel at tweag.io> - - - - - 4ba088d1 by konsumlamm at 2023-08-22T12:32:02-04:00 Update `Control.Concurrent.*` documentation - - - - - 015886ec by ARATA Mizuki at 2023-08-22T15:13:13-04:00 Support 128-bit SIMD on AArch64 via LLVM backend - - - - - 52a6d868 by Krzysztof Gogolewski at 2023-08-22T15:13:51-04:00 Testsuite cleanup - Remove misleading help text in perf_notes, ways are not metrics - Remove no_print_summary - this was used for Phabricator - In linters tests, run 'git ls-files' just once. Previously, it was called on each has_ls_files() - Add ghc-prim.cabal to gitignore, noticed in #23726 - Remove ghc-prim.cabal, it was accidentally committed in 524c60c8cd - - - - - ab40aa52 by Alan Zimmerman at 2023-08-22T15:14:28-04:00 EPA: Use Introduce [DeclTag] in AnnSortKey The AnnSortKey is used to keep track of the order of declarations for printing when the container has split them apart. This applies to HsValBinds and ClassDecl, ClsInstDecl. When making modifications to the list of declarations, the new order must be captured for when it must be printed. For each list of declarations (binds and sigs for a HsValBind) we can just store the list in order. To recreate the list when printing, we must merge them, and this is what the AnnSortKey records. It used to be indexed by SrcSpan, we now simply index by a marker as to which list to take the next item from. - - - - - e7db36c1 by sheaf at 2023-08-23T08:41:28-04:00 Don't attempt pattern synonym error recovery This commit gets rid of the pattern synonym error recovery mechanism (recoverPSB). The rationale is that the fake pattern synonym binding that the recovery mechanism introduced could lead to undesirable knock-on errors, and it isn't really feasible to conjure up a satisfactory binding as pattern synonyms can be used both in expressions and patterns. See Note [Pattern synonym error recovery] in GHC.Tc.TyCl.PatSyn. It isn't such a big deal to eagerly fail compilation on a pattern synonym that doesn't typecheck anyway. Fixes #23467 - - - - - 6ccd9d65 by Ben Gamari at 2023-08-23T08:42:05-04:00 base: Don't use Data.ByteString.Internals.memcpy This function is now deprecated from `bytestring`. Use `Foreign.Marshal.Utils.copyBytes` instead. Fixes #23880. - - - - - 0bfa0031 by Matthew Pickering at 2023-08-23T13:43:48-04:00 hadrian: Uniformly pass buildOptions to all builders in runBuilder In Builder.hs, runBuilderWith mostly ignores the buildOptions in BuildInfo. This leads to hard to diagnose bugs as any build options you pass with runBuilderWithCmdOptions are ignored for many builders. Solution: Uniformly pass buildOptions to the invocation of cmd. Fixes #23845 - - - - - 9cac8f11 by Matthew Pickering at 2023-08-23T13:43:48-04:00 Abstract windows toolchain setup This commit splits up the windows toolchain setup logic into two functions. * FP_INSTALL_WINDOWS_TOOLCHAIN - deals with downloading the toolchain if it isn't already downloaded * FP_SETUP_WINDOWS_TOOLCHAIN - sets the environment variables to point to the correct place FP_SETUP_WINDOWS_TOOLCHAIN is abstracted from the location of the mingw toolchain and also the eventual location where we will install the toolchain in the installed bindist. This is the first step towards #23608 - - - - - 6c043187 by Matthew Pickering at 2023-08-23T13:43:48-04:00 Generate build.mk for bindists The config.mk.in script was relying on some variables which were supposed to be set by build.mk but therefore never were when used to install a bindist. Specifically * BUILD_PROF_LIBS to determine whether we had profiled libraries or not * DYNAMIC_GHC_PROGRAMS to determine whether we had shared libraries or not Not only were these never set but also not really accurate because you could have shared libaries but still statically linked ghc executable. In addition variables like GhcLibWays were just never used, so those have been deleted from the script. Now instead we generate a build.mk file which just directly specifies which RtsWays we have supplied in the bindist and whether we have DYNAMIC_GHC_PROGRAMS. - - - - - fe23629b by Matthew Pickering at 2023-08-23T13:43:48-04:00 hadrian: Add reloc-binary-dist-* targets This adds a command line option to build a "relocatable" bindist. The bindist is created by first creating a normal bindist and then installing it using the `RelocatableBuild=YES` option. This creates a bindist without any wrapper scripts pointing to the libdir. The motivation for this feature is that we want to ship relocatable bindists on windows and this method is more uniform than the ad-hoc method which lead to bugs such as #23608 and #23476 The relocatable bindist can be built with the "reloc-binary-dist" target and supports the same suffixes as the normal "binary-dist" command to specify the compression style. - - - - - 41cbaf44 by Matthew Pickering at 2023-08-23T13:43:48-04:00 packaging: Fix installation scripts on windows/RelocatableBuild case This includes quite a lot of small fixes which fix the installation makefile to work on windows properly. This also required fixing the RelocatableBuild variable which seemed to have been broken for a long while. Sam helped me a lot writing this patch by providing a windows machine to test the changes. Without him it would have taken ages to tweak everything. Co-authored-by: sheaf <sam.derbyshire at gmail.com> - - - - - 03474456 by Matthew Pickering at 2023-08-23T13:43:48-04:00 ci: Build relocatable bindist on windows We now build the relocatable bindist target on windows, which means we test and distribute the new method of creating a relocatable bindist. - - - - - d0b48113 by Matthew Pickering at 2023-08-23T13:43:48-04:00 hadrian: Add error when trying to build binary-dist target on windows The binary dist produced by `binary-dist` target doesn't work on windows because of the wrapper script the makefile installs. In order to not surprise any packagers we just give an error if someone tries to build the old binary-dist target rather than the reloc-binary-dist target. - - - - - 7cbf9361 by Matthew Pickering at 2023-08-23T13:43:48-04:00 hadrian: Remove query' logic to use tooldir - - - - - 03fad42e by Matthew Pickering at 2023-08-23T13:43:48-04:00 configure: Set WindresCmd directly and removed unused variables For some reason there was an indirection via the Windres variable before setting WindresCmd. That indirection led to #23855. I then also noticed that these other variables were just not used anywhere when trying to work out what the correct condition was for this bit of the configure script. - - - - - c82770f5 by sheaf at 2023-08-23T13:43:48-04:00 Apply shellcheck suggestion to SUBST_TOOLDIR - - - - - 896e35e5 by sheaf at 2023-08-23T13:44:34-04:00 Compute hints from TcSolverReportMsg This commit changes how hints are handled in conjunction with constraint solver report messages. Instead of storing `[GhcHint]` in the TcRnSolverReport error constructor, we compute the hints depending on the underlying TcSolverReportMsg. This disentangles the logic and makes it easier to add new hints for certain errors. - - - - - a05cdaf0 by Alexander Esgen at 2023-08-23T13:45:16-04:00 users-guide: remove note about fatal Haddock parse failures - - - - - 4908d798 by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Introduce Data.Enum - - - - - f59707c7 by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Add export list to GHC.Num.Integer - - - - - b1054053 by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Add export list to GHC.Num - - - - - 6baa481d by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Add export list to GHC.Num.Natural - - - - - 2ac15233 by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Add export list to GHC.Float - - - - - f3c489de by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Add export list to GHC.Real - - - - - 94f59eaa by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Eliminate module reexport in GHC.Exception The metric increase here isn't strictly due to this commit but it's a rather small, incidental change. Metric Increase: T8095 T13386 Metric Decrease: T8095 T13386 T18304 - - - - - be1fc7df by Ben Gamari at 2023-08-23T17:36:41-04:00 base: Add disclaimers in internal modules To warn users that these modules are internal and their interfaces may change with little warning. As proposed in Core Libraries Committee #146 [CLC146]. [CLC146]: https://github.com/haskell/core-libraries-committee/issues/146 - - - - - 0326f3f4 by sheaf at 2023-08-23T17:37:29-04:00 Bump Cabal submodule We need to bump the Cabal submodule to include commit ec75950 which fixes an issue with a dodgy import Rep(..) which relied on GHC bug #23570 - - - - - 0504cd08 by Facundo Domínguez at 2023-08-23T17:38:11-04:00 Fix typos in the documentation of Data.OldList.permutations - - - - - 1420b8cb by Antoine Leblanc at 2023-08-24T16:18:17-04:00 Be more eager in TyCon boot validity checking This commit performs boot-file consistency checking for TyCons into checkValidTyCl. This ensures that we eagerly catch any mismatches, which prevents the compiler from seeing these inconsistencies and panicking as a result. See Note [TyCon boot consistency checking] in GHC.Tc.TyCl. Fixes #16127 - - - - - d99c816f by Finley McIlwaine at 2023-08-24T16:18:55-04:00 Refactor estimation of stack info table provenance This commit greatly refactors the way we compute estimated provenance for stack info tables. Previously, this process was done using an entirely separate traversal of the whole Cmm code stream to build the map from info tables to source locations. The separate traversal is now fused with the Cmm code generation pipeline in GHC.Driver.Main. This results in very significant code generation speed ups when -finfo-table-map is enabled. In testing, this patch reduces code generation times by almost 30% with -finfo-table-map and -O0, and 60% with -finfo-table-map and -O1 or -O2 . Fixes #23103 - - - - - d3e0124c by Finley McIlwaine at 2023-08-24T16:18:55-04:00 Add a test checking overhead of -finfo-table-map We want to make sure we don't end up with poor codegen performance resulting from -finfo-table-map again as in #23103. This test adds a performance test tracking total allocations while compiling ExactPrint with -finfo-table-map. - - - - - fcfc1777 by Ben Gamari at 2023-08-25T10:58:16-04:00 llvmGen: Add export list to GHC.Llvm.MetaData - - - - - 5880fff6 by Ben Gamari at 2023-08-25T10:58:16-04:00 llvmGen: Allow LlvmLits in MetaExprs This omission appears to be an oversight. - - - - - 86ce92a2 by Ben Gamari at 2023-08-25T10:58:16-04:00 compiler: Move platform feature predicates to GHC.Driver.DynFlags These are useful in `GHC.Driver.Config.*`. - - - - - a6a38742 by Ben Gamari at 2023-08-25T10:58:16-04:00 llvmGen: Introduce infrastructure for module flag metadata - - - - - e9af2cf3 by Ben Gamari at 2023-08-25T10:58:16-04:00 llvmGen: Don't pass stack alignment via command line As of https://reviews.llvm.org/D103048 LLVM no longer supports the `-stack-alignment=...` flag. Instead this information is passed via a module flag metadata node. This requires dropping support for LLVM 11 and 12. Fixes #23870 - - - - - a936f244 by Alan Zimmerman at 2023-08-25T10:58:56-04:00 EPA: Keep track of "in" token for WarningTxt category A warning can now be written with a category, e.g. {-# WARNInG in "x-c" e "d" #-} Keep track of the location of the 'in' keyword and string, as well as the original SourceText of the label, in case it uses character escapes. - - - - - 3df8a653 by Matthew Pickering at 2023-08-25T17:42:18-04:00 Remove redundant import in InfoTableProv The copyBytes function is provided by the import of Foreign. Fixes #23889 - - - - - d6f807ec by Ben Gamari at 2023-08-25T17:42:54-04:00 gitlab/issue-template: Mention report-a-bug - - - - - 50b9f75d by Artin Ghasivand at 2023-08-26T20:02:50+03:30 Added StandaloneKindSignature examples to replace CUSKs ones - - - - - 2f6309a4 by Vladislav Zavialov at 2023-08-27T03:47:37-04:00 Remove outdated CPP in compiler/* and template-haskell/* The boot compiler was bumped to 9.4 in cebb5819b43. There is no point supporting older GHC versions with CPP. - - - - - 5248fdf7 by Zubin Duggal at 2023-08-28T15:01:09+05:30 testsuite: Add regression test for #23861 Simon says this was fixed by commit 8d68685468d0b6e922332a3ee8c7541efbe46137 Author: sheaf <sam.derbyshire at gmail.com> Date: Fri Aug 4 15:28:45 2023 +0200 Remove zonk in tcVTA - - - - - b6903f4d by Zubin Duggal at 2023-08-28T12:33:58-04:00 testsuite: Add regression test for #23864 Simon says this was fixed by commit 59202c800f2c97c16906120ab2561f6e1556e4af Author: Sebastian Graf <sebastian.graf at kit.edu> Date: Fri Mar 31 17:35:22 2023 +0200 CorePrep: Eliminate EmptyCase and unsafeEqualityProof in CoreToStg instead We eliminate EmptyCase by way of `coreToStg (Case e _ _ []) = coreToStg e` now. The main reason is that it plays far better in conjunction with eta expansion (as we aim to do for arguments in CorePrep, #23083), because we can discard any arguments, `(case e of {}) eta == case e of {}`, whereas in `(e |> co) eta` it's impossible to discard the argument. - - - - - 9eecdf33 by sheaf at 2023-08-28T18:54:06+00:00 Remove ScopedTypeVariables => TypeAbstractions This commit implements [amendment 604](https://github.com/ghc-proposals/ghc-proposals/pull/604/) to [GHC proposal 448](https://github.com/ghc-proposals/ghc-proposals/pull/448) by removing the implication of language extensions ScopedTypeVariables => TypeAbstractions To limit breakage, we now allow type arguments in constructor patterns when both ScopedTypeVariables and TypeApplications are enabled, but we emit a warning notifying the user that this is deprecated behaviour that will go away starting in GHC 9.12. Fixes #23776 - - - - - fadd5b4d by sheaf at 2023-08-28T18:54:06+00:00 .stderr: ScopedTypeVariables =/> TypeAbstractions This commit accepts testsuite changes for the changes in the previous commit, which mean that TypeAbstractions is no longer implied by ScopedTypeVariables. - - - - - 4f5fb500 by Greg Steuck at 2023-08-29T07:55:13-04:00 Repair `codes` test on OpenBSD by explicitly requesting extended RE - - - - - 6bbde581 by Vasily Sterekhov at 2023-08-29T12:06:58-04:00 Add test for #23540 `T23540.hs` makes use of `explainEv` from `HieQueries.hs`, so `explainEv` has been moved to `TestUtils.hs`. - - - - - 257bb3bd by Vasily Sterekhov at 2023-08-29T12:06:58-04:00 Add test for #23120 - - - - - 4f192947 by Vasily Sterekhov at 2023-08-29T12:06:58-04:00 Make some evidence uses reachable by toHie Resolves #23540, #23120 This adds spans to certain expressions in the typechecker and renamer, and lets 'toHie' make use of those spans. Therefore the relevant evidence uses for the following syntax will now show up under the expected nodes in 'HieAst's: - Overloaded literals ('IsString', 'Num', 'Fractional') - Natural patterns and N+k patterns ('Eq', 'Ord', and instances from the overloaded literals being matched on) - Arithmetic sequences ('Enum') - Monadic bind statements ('Monad') - Monadic body statements ('Monad', 'Alternative') - ApplicativeDo ('Applicative', 'Functor') - Overloaded lists ('IsList') Also see Note [Source locations for implicit function calls] In the process of handling overloaded lists I added an extra 'SrcSpan' field to 'VAExpansion' - this allows us to more accurately reconstruct the locations from the renamer in 'rebuildHsApps'. This also happens to fix #23120. See the additions to Note [Looking through HsExpanded] - - - - - fe9fcf9d by Sylvain Henry at 2023-08-29T12:07:50-04:00 ghc-heap: rename C file (fix #23898) - - - - - b60d6576 by Krzysztof Gogolewski at 2023-08-29T12:08:29-04:00 Misc cleanup - Builtin.PrimOps: ReturnsAlg was used only for unboxed tuples. Rename to ReturnsTuple. - Builtin.Utils: use SDoc for a panic message. The comment about <<details unavailable>> was obsoleted by e8d356773b56. - TagCheck: fix wrong logic. It was zipping a list 'args' with its version 'args_cmm' after filtering. - Core.Type: remove an outdated 1999 comment about unlifted polymorphic types - hadrian: remove leftover debugging print - - - - - 3054fd6d by Krzysztof Gogolewski at 2023-08-29T12:09:08-04:00 Add a regression test for #23903 The bug has been fixed by commit bad2f8b8aa8424. - - - - - 21584b12 by Ben Gamari at 2023-08-29T19:52:02-04:00 README: Refer to ghc-hq repository for contributor and governance information - - - - - e542d590 by sheaf at 2023-08-29T19:52:40-04:00 Export setInertSet from GHC.Tc.Solver.Monad We used to export getTcSInerts and setTcSInerts from GHC.Tc.Solver.Monad. These got renamed to getInertSet/setInertSet in e1590ddc. That commit also removed the export of setInertSet, but that function is useful for the GHC API. - - - - - 694ec5b1 by sheaf at 2023-08-30T10:18:32-04:00 Don't bundle children for non-parent Avails We used to bundle all children of the parent Avail with things that aren't the parent, e.g. with class C a where type T a meth :: .. we would bundle the whole Avail (C, T, meth) with all of C, T and meth, instead of only with C. Avoiding this fixes #23570 - - - - - d926380d by Krzysztof Gogolewski at 2023-08-30T10:19:08-04:00 Fix typos - - - - - d07080d2 by Josh Meredith at 2023-08-30T19:42:32-04:00 JS: Implement missing C functions `rename`, `realpath`, and `getcwd` (#23806) - - - - - e2940272 by David Binder at 2023-08-30T19:43:08-04:00 Bump submodules of hpc and hpc-bin to version 0.7.0.0 hpc 0.7.0.0 dropped SafeHaskell safety guarantees in order to simplify compatibility with newer versions of the directory package which dropped all SafeHaskell guarantees. - - - - - 5d56d05c by David Binder at 2023-08-30T19:43:08-04:00 Bump hpc bound in ghc.cabal.in - - - - - 99fff496 by Dominik Schrempf at 2023-08-31T00:04:46-04:00 ghc classes documentation: rm redundant comment - - - - - fe021bab by Dominik Schrempf at 2023-08-31T00:04:46-04:00 prelude documentation: various nits - - - - - 48c84547 by Dominik Schrempf at 2023-08-31T00:04:46-04:00 integer documentation: minor corrections - - - - - 20cd12f4 by Dominik Schrempf at 2023-08-31T00:04:46-04:00 real documentation: nits - - - - - dd39bdc0 by sheaf at 2023-08-31T00:05:27-04:00 Add a test for #21765 This issue (of reporting a constraint as being redundant even though removing it causes typechecking to fail) was fixed in aed1974e. This commit simply adds a regression test. Fixes #21765 - - - - - f1ec3628 by Andrew Lelechenko at 2023-08-31T23:53:30-04:00 Export foldl' from Prelude and bump submodules See https://github.com/haskell/core-libraries-committee/issues/167 for discussion Metric Decrease: T8095 T13386 Metric Increase: T13386 T8095 T8095 ghc/alloc decreased on x86_64, but increased on aarch64. T13386 ghc/alloc decreased on x86_64-windows, but increased on other platforms. Neither has anything to do with `foldl'`, so I conclude that both are flaky. - - - - - 3181b97d by Gergő Érdi at 2023-08-31T23:54:06-04:00 Allow cross-tyvar defaulting proposals from plugins Fixes #23832. - - - - - e4af506e by Sebastian Graf at 2023-09-01T14:29:12-04:00 Clarify Note [GlobalId/LocalId] after CorePrep (#23797) Fixes #23797. - - - - - ac29787c by Sylvain Henry at 2023-09-01T14:30:02-04:00 Fix warning with UNPACK on sum type (#23921) - - - - - 9765ac7b by Zubin Duggal at 2023-09-05T00:37:45-04:00 hadrian: track python dependencies in doc rules - - - - - 1578215f by sheaf at 2023-09-05T00:38:26-04:00 Bump Haddock to fix #23616 This commit updates the Haddock submodule to include the fix to #23616. Fixes #23616 - - - - - 5a2fe35a by David Binder at 2023-09-05T00:39:07-04:00 Fix example in GHC user guide in SafeHaskell section The example given in the SafeHaskell section uses an implementation of Monad which no longer works. This MR removes the non-canonical return instance and adds the necessary instances of Functor and Applicative. - - - - - 291d81ae by Matthew Pickering at 2023-09-05T14:03:10-04:00 driver: Check transitive closure of haskell package dependencies when deciding whether to relink We were previously just checking whether direct package dependencies had been modified. This caused issues when compiling without optimisations as we wouldn't relink the direct dependency if one of its dependenices changed. Fixes #23724 - - - - - 35da0775 by Krzysztof Gogolewski at 2023-09-05T14:03:47-04:00 Re-export GHC.Utils.Panic.Plain from GHC.Utils.Panic Fixes #23930 - - - - - 3930d793 by Jaro Reinders at 2023-09-06T18:42:55-04:00 Make STG rewriter produce updatable closures - - - - - 0104221a by Krzysztof Gogolewski at 2023-09-06T18:43:32-04:00 configure: update message to use hadrian (#22616) - - - - - b34f8586 by Alan Zimmerman at 2023-09-07T10:58:38-04:00 EPA: Incorrect locations for UserTyVar with '@' In T13343.hs, the location for the @ is not within the span of the surrounding UserTyVar. type Bad @v = (forall (v1 :: RuntimeRep) (a1 :: TYPE v). a1) :: TYPE v Widen it so it is captured. Closes #23887 - - - - - 8046f020 by Finley McIlwaine at 2023-09-07T10:59:15-04:00 Bump haddock submodule to fix #23920 Removes the fake export of `FUN` from Prelude. Fixes #23920. Bumps haddock submodule. - - - - - e0aa8c6e by Krzysztof Gogolewski at 2023-09-07T11:00:03-04:00 Fix wrong role in mkSelCo_maybe In the Lint failure in #23938, we start with a coercion Refl :: T a ~R T a, and call mkSelCo (SelTyCon 1 nominal) Refl. The function incorrectly returned Refl :: a ~R a. The returned role should be nominal, according to the SelCo rule: co : (T s1..sn) ~r0 (T t1..tn) r = tyConRole tc r0 i ---------------------------------- SelCo (SelTyCon i r) : si ~r ti In this test case, r is nominal while r0 is representational. - - - - - 1d92f2df by Gergő Érdi at 2023-09-08T04:04:30-04:00 If we have multiple defaulting plugins, then we should zonk in between them after any defaulting has taken place, to avoid a defaulting plugin seeing a metavariable that has already been filled. Fixes #23821. - - - - - eaee4d29 by Gergő Érdi at 2023-09-08T04:04:30-04:00 Improvements to the documentation of defaulting plugins Based on @simonpj's draft and comments in !11117 - - - - - ede3df27 by Alan Zimmerman at 2023-09-08T04:05:06-04:00 EPA: Incorrect span for LWarnDec GhcPs The code (from T23465.hs) {-# WARNInG in "x-c" e "d" #-} e = e gives an incorrect span for the LWarnDecl GhcPs Closes #23892 It also fixes the Test23465/Test23464 mixup - - - - - a0ccef7a by Krzysztof Gogolewski at 2023-09-08T04:05:42-04:00 Valid hole fits: don't suggest unsafeCoerce (#17940) - - - - - 88b942c4 by Oleg Grenrus at 2023-09-08T19:58:42-04:00 Add warning for badly staged types. Resolves #23829. The stage violation results in out-of-bound names in splices. Technically this is an error, but someone might rely on this!? Internal changes: - we now track stages for TyVars. - thLevel (RunSplice _) = 0, instead of panic, as reifyInstances does in fact rename its argument type, and it can contain variables. - - - - - 9861f787 by Ben Gamari at 2023-09-08T19:59:19-04:00 rts: Fix invalid symbol type I suspect this code is dead since we haven't observed this failing despite the obviously incorrect macro name. - - - - - 03ed6a9a by Ben Gamari at 2023-09-08T19:59:19-04:00 testsuite: Add simple test exercising C11 atomics in GHCi See #22012. - - - - - 1aa5733a by Ben Gamari at 2023-09-08T19:59:19-04:00 rts/RtsSymbols: Add AArch64 outline atomic operations Fixes #22012 by adding the symbols described in https://github.com/llvm/llvm-project/blob/main/llvm/docs/Atomics.rst#libcalls-atomic. Ultimately this would be better addressed by #22011, but this is a first step in the right direction and fixes the immediate symptom. Note that we dropped the `__arch64_cas16` operations as these provided by all platforms's compilers. Also, we don't link directly against the libgcc/compiler-rt definitions but rather provide our own wrappers to work around broken toolchains (e.g. https://bugs.gentoo.org/868018). Generated via https://gitlab.haskell.org/ghc/ghc/-/snippets/5733. - - - - - 8f7d3041 by Matthew Pickering at 2023-09-08T19:59:55-04:00 ci: Build debian12 and fedora38 bindists This adds builds for the latest releases for fedora and debian We build these bindists in nightly and release pipelines. - - - - - a1f0d55c by Felix Leitz at 2023-09-08T20:00:37-04:00 Fix documentation around extension implication for MultiParamTypeClasses/ConstrainedClassMethods. - - - - - 98166389 by Teo Camarasu at 2023-09-12T04:30:54-04:00 docs: move -xn flag beside --nonmoving-gc It makes sense to have these beside each other as they are aliases. - - - - - f367835c by Teo Camarasu at 2023-09-12T04:30:55-04:00 nonmoving: introduce a family of dense allocators Supplement the existing power 2 sized nonmoving allocators with a family of dense allocators up to a configurable threshold. This should reduce waste from rounding up block sizes while keeping the amount of allocator sizes manageable. This patch: - Adds a new configuration option `--nonmoving-dense-allocator-count` to control the amount of these new dense allocators. - Adds some constants to `NonmovingAllocator` in order to keep marking fast with the new allocators. Resolves #23340 - - - - - 2b07bf2e by Teo Camarasu at 2023-09-12T04:30:55-04:00 Add changelog entry for #23340 - - - - - f96fe681 by sheaf at 2023-09-12T04:31:44-04:00 Use printGhciException in run{Stmt, Decls} When evaluating statements in GHCi, we need to use printGhciException instead of the printException function that GHC provides in order to get the appropriate error messages that are customised for ghci use. - - - - - d09b932b by psilospore at 2023-09-12T04:31:44-04:00 T23686: Suggest how to enable Language Extension when in ghci Fixes #23686 - - - - - da30f0be by Matthew Craven at 2023-09-12T04:32:24-04:00 Unarise: Split Rubbish literals in function args Fixes #23914. Also adds a check to STG lint that these args are properly unary or nullary after unarisation - - - - - 261b6747 by Matthew Pickering at 2023-09-12T04:33:04-04:00 darwin: Bump MAXOSX_DEPLOYMENT_TARGET to 10.13 This bumps the minumum supported version to 10.13 (High Sierra) which is 6 years old at this point. Fixes #22938 - - - - - f418f919 by Mario Blažević at 2023-09-12T04:33:45-04:00 Fix TH pretty-printing of nested GADTs, issue #23937 This commit fixes `Language.Haskell.TH.Ppr.pprint` so that it correctly pretty-prints GADTs declarations contained within data family instances. Fixes #23937 - - - - - d7a64753 by John Ericson at 2023-09-12T04:34:20-04:00 Put hadrian non-bootstrap plans through `jq` This makes it possible to review changes with conventional diffing tools. This is picking up where ad8cfed4195b1bbfc15b841f010e75e71f63157d left off. - - - - - ff0a709a by Sylvain Henry at 2023-09-12T08:46:28-04:00 JS: fix some tests - Tests using Setup programs need to pass --with-hc-pkg - Several other fixes See https://gitlab.haskell.org/ghc/ghc/-/wikis/javascript-backend/bug_triage for the current status - - - - - fc86f0e7 by Krzysztof Gogolewski at 2023-09-12T08:47:04-04:00 Fix in-scope set assertion failure (#23918) Patch by Simon - - - - - 21a906c2 by Matthew Pickering at 2023-09-12T17:21:04+02:00 Add -Winconsistent-flags warning The warning fires when inconsistent command line flags are passed. For example: * -dynamic-too and -dynamic * -dynamic-too on windows * -O and --interactive * etc This is on by default and allows users to control whether the warning is displayed and whether it should be an error or not. Fixes #22572 - - - - - dfc4f426 by Krzysztof Gogolewski at 2023-09-12T20:31:35-04:00 Avoid serializing BCOs with the internal interpreter Refs #23919 - - - - - 9217950b by Finley McIlwaine at 2023-09-13T08:06:03-04:00 Fix numa auto configure - - - - - 98e7c1cf by Simon Peyton Jones at 2023-09-13T08:06:40-04:00 Add -fno-cse to T15426 and T18964 This -fno-cse change is to avoid these performance tests depending on flukey CSE stuff. Each contains several independent tests, and we don't want them to interact. See #23925. By killing CSE we expect a 400% increase in T15426, and 100% in T18964. Metric Increase: T15426 T18964 - - - - - 236a134e by Simon Peyton Jones at 2023-09-13T08:06:40-04:00 Tiny refactor canEtaReduceToArity was only called internally, and always with two arguments equal to zero. This patch just specialises the function, and renames it to cantEtaReduceFun. No change in behaviour. - - - - - 56b403c9 by Ben Gamari at 2023-09-13T19:21:36-04:00 spec-constr: Lift argument limit for SPEC-marked functions When the user adds a SPEC argument to a function, they are informing us that they expect the function to be specialised. However, previously this instruction could be preempted by the specialised-argument limit (sc_max_args). Fix this. This fixes #14003. - - - - - 6840012e by Simon Peyton Jones at 2023-09-13T19:22:13-04:00 Fix eta reduction Issue #23922 showed that GHC was bogusly eta-reducing a join point. We should never eta-reduce (\x -> j x) to j, if j is a join point. It is extremly difficult to trigger this bug. It took me 45 mins of trying to make a small tests case, here immortalised as T23922a. - - - - - e5c00092 by Andreas Klebinger at 2023-09-14T08:57:43-04:00 Profiling: Properly escape characters when using `-pj`. There are some ways in which unusual characters like quotes or others can make it into cost centre names. So properly escape these. Fixes #23924 - - - - - ec490578 by Ellie Hermaszewska at 2023-09-14T08:58:24-04:00 Use clearer example variable names for bool eliminator - - - - - 5126a2fe by Sylvain Henry at 2023-09-15T11:18:02-04:00 Add missing int64/word64-to-double/float rules (#23907) CLC proposal: https://github.com/haskell/core-libraries-committee/issues/203 - - - - - 566ef411 by Mario Blažević at 2023-09-15T11:18:43-04:00 Fix and test TH pretty-printing of type operator role declarations This commit fixes and tests `Language.Haskell.TH.Ppr.pprint` so that it correctly pretty-prints `type role` declarations for operator names. Fixes #23954 - - - - - 8e05c54a by Simon Peyton Jones at 2023-09-16T01:42:33-04:00 Use correct FunTyFlag in adjustJoinPointType As the Lint error in #23952 showed, the function adjustJoinPointType was failing to adjust the FunTyFlag when adjusting the type. I don't think this caused the seg-fault reported in the ticket, but it is definitely. This patch fixes it. It is tricky to come up a small test case; Krzysztof came up with this one, but it only triggers a failure in GHC 9.6. - - - - - 778c84b6 by Pierre Le Marre at 2023-09-16T01:43:15-04:00 Update to Unicode 15.1.0 See: https://www.unicode.org/versions/Unicode15.1.0/ - - - - - f9d79a6c by Alan Zimmerman at 2023-09-18T00:00:14-04:00 EPA: track unicode version for unrestrictedFunTyCon Closes #23885 Updates haddock submodule - - - - - 9374f116 by Andrew Lelechenko at 2023-09-18T00:00:54-04:00 Bump parsec submodule to allow text-2.1 and bytestring-0.12 - - - - - 7ca0240e by Ben Gamari at 2023-09-18T15:16:48-04:00 base: Advertise linear time of readFloat As noted in #23538, `readFloat` has runtime that scales nonlinearly in the size of its input. Consequently, its use on untrusted input can be exploited as a denial-of-service vector. Point this out and suggest use of `read` instead. See #23538. - - - - - f3f58f13 by Simon Peyton Jones at 2023-09-18T15:17:24-04:00 Remove dead code GHC.CoreToStg.Prep.canFloat This function never fires, so we can delete it: #23965. - - - - - ccab5b15 by Ben Gamari at 2023-09-18T15:18:02-04:00 base/changelog: Move fix for #23907 to 9.8.1 section Since the fix was backported to 9.8.1 - - - - - 51b57d65 by Matthew Pickering at 2023-09-19T08:44:31-04:00 Add aarch64 alpine bindist This is dynamically linked and makes creating statically linked executables more straightforward. Fixes #23482 - - - - - 02c87213 by Matthew Pickering at 2023-09-19T08:44:31-04:00 Add aarch64-deb11 bindist This adds a debian 11 release job for aarch64. Fixes #22005 - - - - - 8b61dfd6 by Alexis King at 2023-09-19T08:45:13-04:00 Don’t store the async exception masking state in CATCH frames - - - - - 86d2971e by doyougnu at 2023-09-19T19:08:19-04:00 compiler,ghci: error codes link to HF error index closes: #23259 - adds -fprint-error-index-links={auto|always|never} flag - - - - - 5f826c18 by sheaf at 2023-09-19T19:09:03-04:00 Pass quantified tyvars in tcDefaultAssocDecl This commit passes the correct set of quantified type variables written by the user in associated type default declarations for validity checking. This ensures that validity checking of associated type defaults mirrors that of standalone type family instances. Fixes #23768 (see testcase T23734 in subsequent commit) - - - - - aba18424 by sheaf at 2023-09-19T19:09:03-04:00 Avoid panic in mkGADTVars This commit avoids panicking in mkGADTVars when we encounter a type variable as in #23784 that is bound by a user-written forall but not actually used. Fixes #23784 - - - - - a525a92a by sheaf at 2023-09-19T19:09:03-04:00 Adjust reporting of unused tyvars in data FamInsts This commit adjusts the validity checking of data family instances to improve the reporting of unused type variables. See Note [Out of scope tvs in data family instances] in GHC.Tc.Validity. The problem was that, in a situation such as data family D :: Type data instance forall (d :: Type). D = MkD the RHS passed to 'checkFamPatBinders' would be the TyCon app R:D d which mentions the type variable 'd' quantified in the user-written forall. Thus, when computing the set of unused type variables in the RHS of the data family instance, we would find that 'd' is used, and report a strange error message that would say that 'd' is not bound on the LHS. To fix this, we special-case the data-family instance case, manually extracting all the type variables that appear in the arguments of all the data constructores of the data family instance. Fixes #23778 - - - - - 28dd52ee by sheaf at 2023-09-19T19:09:03-04:00 Unused tyvars in FamInst: only report user tyvars This commit changes how we perform some validity checking for coercion axioms to mirror how we handle default declarations for associated type families. This allows us to keep track of whether type variables in type and data family instances were user-written or not, in order to only report the user-written ones in "unused type variable" error messages. Consider for example: {-# LANGUAGE PolyKinds #-} type family F type instance forall a. F = () In this case, we get two quantified type variables, (k :: Type) and (a :: k); the second being user-written, but the first is introduced by the typechecker. We should only report 'a' as being unused, as the user has no idea what 'k' is. Fixes #23734 - - - - - 1eed645c by sheaf at 2023-09-19T19:09:03-04:00 Validity: refactor treatment of data families This commit refactors the reporting of unused type variables in type and data family instances to be more principled. This avoids ad-hoc logic in the treatment of data family instances. - - - - - 35bc506b by John Ericson at 2023-09-19T19:09:40-04:00 Remove `ghc-cabal` It is dead code since the Make build system was removed. I tried to go over every match of `git grep -i ghc-cabal` to find other stray bits. Some of those might be workarounds that can be further removed. - - - - - 665ca116 by John Paul Adrian Glaubitz at 2023-09-19T19:10:39-04:00 Re-add unregisterised build support for sparc and sparc64 Closes #23959 - - - - - 142f8740 by Matthew Pickering at 2023-09-19T19:11:16-04:00 Bump ci-images to use updated version of Alex Fixes #23977 - - - - - fa977034 by John Ericson at 2023-09-21T12:55:25-04:00 Use Cabal 3.10 for Hadrian We need the newer version for `CABAL_FLAG_*` env vars for #17191. - - - - - a5d22cab by John Ericson at 2023-09-21T12:55:25-04:00 hadrian: `need` any `configure` script we will call When the script is changed, we should reconfigure. - - - - - db882b57 by John Ericson at 2023-09-21T12:55:25-04:00 hadrian: Make it easier to debug Cabal configure Right now, output is squashed. This make per-package configure scripts extremely hard to maintain, because we get vague "library is missing" errors when the actually probably is usually completely unrelated except for also involving the C/C++ toolchain. (I can always pass `-VVV` to Hadrian locally, but these errors are subtle and I often cannot reproduce them locally!) `--disable-option-checking` was added back in 75c6e0684dda585c37b4ac254cd7a13537a59a91 but seems to be a bit overkill; if other flags are passed that are not recognized behind the two from Cabal mentioned in the former comment, we *do* want to know about it. - - - - - 7ed65f5a by John Ericson at 2023-09-21T12:55:25-04:00 hadrian: Increase verbosity of certain cabal commands This is a hack to get around the cabal function we're calling *decreasing* the verbosity it passes to another function, which is the stuff we often actually care about. Sigh. Keeping this a separate commit so if this makes things too verbose it is easy to revert. - - - - - a4fde569 by John Ericson at 2023-09-21T12:55:25-04:00 rts: Move most external symbols logic to the configure script This is much more terse because we are programmatically handling the leading underscore. `findPtr` however is still handled in the Cabal file because we need a newer Cabal to pass flags to the configure script automatically. Co-Authored-By: Ben Gamari <ben at well-typed.com> - - - - - 56cc85fb by Andrew Lelechenko at 2023-09-21T12:56:21-04:00 Bump Cabal submodule to allow text-2.1 and bytestring-0.12 - - - - - 0cd6148c by Matthew Pickering at 2023-09-21T12:56:21-04:00 hadrian: Generate Distribution/Fields/Lexer.x before creating a source-dist - - - - - b10ba6a3 by Andrew Lelechenko at 2023-09-21T12:56:21-04:00 Bump hadrian's index-state to upgrade alex at least to 3.2.7.3 - - - - - 11ecc37b by Luite Stegeman at 2023-09-21T12:57:03-04:00 JS: correct file size and times Programs produced by the JavaScript backend were returning incorrect file sizes and modification times, causing cabal related tests to fail. This fixes the problem and adds an additional test that verifies basic file information operations. fixes #23980 - - - - - b35fd2cd by Ben Gamari at 2023-09-21T12:57:39-04:00 gitlab-ci: Drop libiserv from upload_ghc_libs libiserv has been merged into the ghci package. - - - - - 37ad04e8 by Ben Gamari at 2023-09-21T12:58:15-04:00 testsuite: Fix Windows line endings - - - - - 5795b365 by Ben Gamari at 2023-09-21T12:58:15-04:00 testsuite: Use makefile_test - - - - - 15118740 by Ben Gamari at 2023-09-21T12:58:55-04:00 system-cxx-std-lib: Add license and description - - - - - 0208f1d5 by Ben Gamari at 2023-09-21T12:59:33-04:00 gitlab/issue-templates: Rename bug.md -> default.md So that it is visible by default. - - - - - 23cc3f21 by Andrew Lelechenko at 2023-09-21T20:18:11+01:00 Bump submodule text to 2.1 - - - - - b8e4fe23 by Andrew Lelechenko at 2023-09-22T20:05:05-04:00 Bump submodule unix to 2.8.2.1 - - - - - 54b2016e by John Ericson at 2023-09-23T11:40:41-04:00 Move lib{numa,dw} defines to RTS configure Clean up the m4 to handle the auto case always and be more consistent. Also simplify the CPP --- we should always have both headers if we are using libnuma. "side effects" (AC_DEFINE, and AC_SUBST) are removed from the macros to better separate searching from actions taken based on search results. This might seem overkill now, but will make shuffling logic between configure scripts easier later. The macro comments are converted from `dnl` to `#` following the recomendation in https://www.gnu.org/software/autoconf/manual/autoconf-2.71/html_node/Macro-Definitions.html - - - - - d51b601b by John Ericson at 2023-09-23T11:40:50-04:00 Shuffle libzstd configuring between scripts Like the prior commit for libdw and libnuma, `AC_DEFINE` to RTS configure, `AC_SUBST` goes to the top-level configure script, and the documentation of the m4 macro is improved. - - - - - d1425af0 by John Ericson at 2023-09-23T11:41:03-04:00 Move `FP_ARM_OUTLINE_ATOMICS` to RTS configure It is just `AC_DEFINE` it belongs there instead. - - - - - 18de37e4 by John Ericson at 2023-09-23T11:41:03-04:00 Move mmap in the runtime linker check to the RTS configure `AC_DEFINE` should go there instead. - - - - - 74132c2b by Andrew Lelechenko at 2023-09-25T21:56:54-04:00 Elaborate comment on GHC_NO_UNICODE - - - - - de142aa2 by Ben Gamari at 2023-09-26T15:25:03-04:00 gitlab-ci: Mark T22012 as broken on CentOS 7 Due to #23979. - - - - - 6a896ce8 by Teo Camarasu at 2023-09-26T15:25:39-04:00 hadrian: better error for failing to find file's dependencies Resolves #24004 - - - - - d697a6c2 by Stefan Holdermans at 2023-09-26T20:58:37+00:00 Refactor uses of `partitionEithers . map` This patch changes occurences of the idiom `partitionEithers (map f xs)` by the simpler form `partitionWith f xs` where `partitionWith` is the utility function defined in `GHC.Utils.Misc`. Resolves: #23953 - - - - - 8a2968b7 by Stefan Holdermans at 2023-09-26T20:58:37+00:00 Refactor uses of `partitionEithers <$> mapM f xs` This patch changes occurences of the idiom `partitionEithers <$> mapM f xs` by the simpler form `partitionWithM f xs` where `partitionWithM` is a utility function newly added to `GHC.Utils.Misc`. - - - - - 6a27eb97 by Stefan Holdermans at 2023-09-26T20:58:37+00:00 Mark `GHC.Utils.Misc.partitionWithM` as inlineable This patch adds an `INLINEABLE` pragma for `partitionWithM` to ensure that the right-hand side of the definition of this function remains available for specialisation at call sites. - - - - - f1e5245a by David Binder at 2023-09-27T01:19:00-04:00 Add RTS option to supress tix file - - - - - 1f43124f by David Binder at 2023-09-27T01:19:00-04:00 Add expected output to testsuite in test interface-stability/base-exports - - - - - b9d2c354 by David Binder at 2023-09-27T01:19:00-04:00 Expose HpcFlags and getHpcFlags from GHC.RTS.Flags - - - - - 345675c6 by David Binder at 2023-09-27T01:19:00-04:00 Fix expected output of interface-stability test - - - - - 146e1c39 by David Binder at 2023-09-27T01:19:00-04:00 Implement getHpcFlags - - - - - 61ba8e20 by David Binder at 2023-09-27T01:19:00-04:00 Add section in user guide - - - - - ea05f890 by David Binder at 2023-09-27T01:19:01-04:00 Rename --emit-tix-file to --write-tix-file - - - - - cabce2ce by David Binder at 2023-09-27T01:19:01-04:00 Update the golden files for interface stability - - - - - 1dbdb9d0 by Krzysztof Gogolewski at 2023-09-27T01:19:37-04:00 Refactor: introduce stgArgRep The function 'stgArgType' returns the type in STG. But this violates the abstraction: in STG we're supposed to operate on PrimReps. This introduces stgArgRep ty = typePrimRep (stgArgType ty) stgArgRep1 ty = typePrimRep1 (stgArgType ty) stgArgRep_maybe ty = typePrimRep_maybe (stgArgType ty) stgArgType is still directly used for unboxed tuples (should be fixable), FFI and in ticky. - - - - - b02f8042 by Mario Blažević at 2023-09-27T17:33:28-04:00 Fix TH pretty-printer's parenthesization This PR Fixes `Language.Haskell.TH.Ppr.pprint` so it correctly emits parentheses where needed. Fixes #23962, #23968, #23971, and #23986 - - - - - 79104334 by Krzysztof Gogolewski at 2023-09-27T17:34:04-04:00 Add a testcase for #17564 The code in the ticket relied on the behaviour of Derived constraints. Derived constraints were removed in GHC 9.4 and now the code works as expected. - - - - - d7a80143 by sheaf at 2023-09-28T03:25:53-04:00 lint-codes: add new modes of operation This commit adds two new modes of operation to the lint-codes utility: list - list all statically used diagnostic codes outdated - list all outdated diagnostic codes The previous behaviour is now: test - test consistency and coverage of diagnostic codes - - - - - 477d223c by sheaf at 2023-09-28T03:25:53-04:00 lint codes: avoid using git-grep We manually traverse through the filesystem to find the diagnostic codes embedded in .stdout and .stderr files, to avoid any issues with old versions of grep. Fixes #23843 - - - - - a38ae69a by sheaf at 2023-09-28T03:25:53-04:00 lint-codes: add Hadrian targets This commit adds new Hadrian targets: codes, codes:used - list all used diagnostic codes codes:outdated - list outdated diagnostic codes This allows users to easily query GHC for used and outdated diagnostic codes, e.g. hadrian/build -j --flavour=<..> codes will list all used diagnostic codes in the command line by running the lint-codes utility in the "list codes" mode of operation. The diagnostic code consistency and coverage test is still run as usual, through the testsuite: hadrian/build test --only="codes" - - - - - 9cdd629b by Ben Gamari at 2023-09-28T03:26:29-04:00 hadrian: Install LICENSE files in bindists Fixes #23548. - - - - - b8ebf876 by Matthew Craven at 2023-09-28T03:27:05-04:00 Fix visibility when eta-reducing a type lambda Fixes #24014. - - - - - d3874407 by Torsten Schmits at 2023-09-30T16:08:10-04:00 Fix several mistakes around free variables in iface breakpoints Fixes #23612 , #23607, #23998 and #23666. MR: !11026 The fingerprinting logic in `Iface.Recomp` failed lookups when processing decls containing breakpoints for two reasons: * IfaceBreakpoint created binders for free variables instead of expressions * When collecting free names for the dependency analysis for fingerprinting, breakpoint FVs were skipped - - - - - ef5342cd by Simon Peyton Jones at 2023-09-30T16:08:48-04:00 Refactor to combine HsLam and HsLamCase This MR is pure refactoring (#23916): * Combine `HsLam` and `HsLamCase` * Combine `HsCmdLam` and `HsCmdLamCase` This just arranges to treat uniformly \x -> e \case pi -> ei \cases pis -> ie In the exising code base the first is treated differently to the latter two. No change in behaviour. More specifics: * Combine `HsLam` and `HsLamCase` (constructors of `Language.Haskell.Syntax.Expr.HsExpr`) into one data construtor covering * Lambda * `\case` * `\cases` * The new `HsLam` has an argument of type `HsLamVariant` to distinguish the three cases. * Similarly, combine `HsCmdLam` and `HsCmdLamCase` (constructors of `Language.Haskell.Syntax.Expr.HsCmd` ) into one. * Similarly, combine `mkHsLamPV` and `mkHsLamCasePV` (methods of class `DisambECP`) into one. (Thank you Alan Zimmerman.) * Similarly, combine `LambdaExpr` and `LamCaseAlt` (constructors of `Language.Haskell.Syntax.Expr.HsMatchContext`) into one: `LamAlt` with a `HsLamVariant` argument. * Similarly, combine `KappaExpr` and `ArrowLamCaseAlt` (constructors of `Language.Haskell.Syntax.Expr.HsArrowMatchContext`) into one: `ArrowLamAlt` with a `HsLamVariant` argument. * Similarly, combine `PsErrLambdaInPat` and `PsErrLambdaCaseInPat` (constructors of `GHC.Parser.Errors.Ppr.PsError`) into one. * Similarly, combine `PsErrLambdaInPat` and `PsErrLambdaCaseInPat` (constructors of `GHC.Parser.Errors.Ppr.PsError`) into one. * In the same `PsError` data type, combine `PsErrLambdaCmdInFunAppCmd` and `PsErrLambdaCaseCmdInFunAppCmd` into one. * In the same `PsError` data tpye, combine `PsErrLambdaInFunAppExpr` and `PsErrLambdaCaseInFunAppExpr` into one. p* Smilarly combine `ExpectedFunTyLam` and `ExpectedFunTyLamCase` (constructors of `GHC.Tc.Types.Origin.ExpectedFunTyOrigin`) into one. Phew! - - - - - b048bea0 by Andreas Klebinger at 2023-09-30T16:09:24-04:00 Arm: Make ppr methods easier to use by not requiring NCGConfig - - - - - 2adc0508 by Andreas Klebinger at 2023-09-30T16:09:24-04:00 AArch64: Fix broken conditional jumps for offsets >= 1MB Rewrite conditional jump instructions with offsets >= 1MB to use unconditional jumps to avoid overflowing the immediate. Fixes #23746 - - - - - 1424f790 by Alan Zimmerman at 2023-09-30T16:10:00-04:00 EPA: Replace Monoid with NoAnn We currently use the Monoid class as a constraint on Exact Print Annotation functions, so we can use mempty. But this leads to requiring Semigroup instances too, which do not always make sense. Instead, introduce a class NoAnn, with a function noAnn analogous to mempty. Closes #20372 Updates haddock submodule - - - - - c1a3ecde by Ben Gamari at 2023-09-30T16:10:36-04:00 users-guide: Refactor handling of :base-ref: et al. - - - - - bc204783 by Richard Eisenberg at 2023-10-02T14:50:52+02:00 Simplify and correct nasty case in coercion opt This fixes #21062. No test case, because triggering this code seems challenging. - - - - - 9c9ca67e by Andrew Lelechenko at 2023-10-04T05:42:28-04:00 Bump bytestring submodule to 0.12.0.2 - - - - - 4e46dc2b by Andrew Lelechenko at 2023-10-04T05:42:28-04:00 Inline bucket_match - - - - - f6b2751f by Ben Gamari at 2023-10-04T05:43:05-04:00 configure: Fix #21712 again This is a bit of a shot in the dark to fix #24033, which appears to be another instance of #21712. For some reason the ld-override logic *still* appears to be active on Darwin targets (or at least one). Consequently, on misconfigured systems we may choose a non-`ld64` linker. It's a bit unclear exactly what happened in #24033 but ultimately the check added for #21712 was not quite right, checking for the `ghc_host_os` (the value of which depends upon the bootstrap compiler) instead of the target platform. Fix this. Fixes #24033. - - - - - 2f0a101d by Krzysztof Gogolewski at 2023-10-04T05:43:42-04:00 Add a regression test for #24029 - - - - - 8cee3fd7 by sheaf at 2023-10-04T05:44:22-04:00 Fix non-symbolic children lookup of fixity decl The fix for #23664 did not correctly account for non-symbolic names when looking up children of a given parent. This one-line fix changes that. Fixes #24037 - - - - - a4785b33 by Cheng Shao at 2023-10-04T05:44:59-04:00 rts: fix incorrect ticket reference - - - - - e037f459 by Ben Gamari at 2023-10-04T05:45:35-04:00 users-guide: Fix discussion of -Wpartial-fields * fix a few typos * add a new example showing when the warning fires * clarify the existing example * point out -Wincomplete-record-selects Fixes #24049. - - - - - 8ff3134e by Matthew Pickering at 2023-10-05T05:34:58-04:00 Revert "Pass preprocessor options to C compiler when building foreign C files (#16737)" This reverts commit 1c18d3b41f897f34a93669edaebe6069f319f9e2. `-optP` should pass options to the preprocessor, that might be a very different program to the C compiler, so passing the options to the C compiler is likely to result in `-optP` being useless. Fixes #17185 and #21291 - - - - - 8f6010b9 by Ben Gamari at 2023-10-05T05:35:36-04:00 rts/nonmoving: Fix on LLP64 platforms Previously `NONMOVING_SEGMENT_MASK` and friends were defined with the `UL` size suffix. However, this is wrong on LLP64 platforms like Windows, where `long` is 32-bits. Fixes #23003. Fixes #24042. - - - - - f20d02f8 by Andreas Klebinger at 2023-10-05T05:36:14-04:00 Fix isAArch64Bitmask for 32bit immediates. Fixes #23802 - - - - - 63afb701 by Bryan Richter at 2023-10-05T05:36:49-04:00 Work around perf note fetch failure Addresses #24055. - - - - - 242102f4 by Krzysztof Gogolewski at 2023-10-05T05:37:26-04:00 Add a test for #21348 - - - - - 7d390bce by Rewbert at 2023-10-05T05:38:08-04:00 Fixes #24046 - - - - - 69abb171 by Finley McIlwaine at 2023-10-06T14:06:28-07:00 Ensure unconstrained instance dictionaries get IPE info In the `StgRhsCon` case of `GHC.Stg.Debug.collectStgRhs`, we were not coming up with an initial source span based on the span of the binder, which was causing instance dictionaries without dynamic superclass constraints to not have source locations in their IPE info. Now they do. Resolves #24005 - - - - - 390443b7 by Andreas Klebinger at 2023-10-07T10:00:20-04:00 rts: Split up rts/include/stg/MachRegs.h by arch - - - - - 3685942f by Bryan Richter at 2023-10-07T10:00:56-04:00 Actually set hackage index state Or at least, use a version of the cabal command that *claims* to set the index state. Time will tell. - - - - - 46a0e5be by Bryan Richter at 2023-10-07T10:00:56-04:00 Update hackage index state - - - - - d4b037de by Bryan Richter at 2023-10-07T10:00:56-04:00 Ensure hadrian uses CI's hackage index state - - - - - e206be64 by Andrew Lelechenko at 2023-10-08T15:06:14-04:00 Do not use O_NONBLOCK on regular files or block devices CLC proposal https://github.com/haskell/core-libraries-committee/issues/166 - - - - - a06197c4 by David Binder at 2023-10-08T15:06:55-04:00 Update hpc-bin submodule to 0.69 - - - - - ed6785b6 by David Binder at 2023-10-08T15:06:55-04:00 Update Hadrian with correct path to happy file for hpc-bin - - - - - 94066d58 by Alan Zimmerman at 2023-10-09T21:35:53-04:00 EPA: Introduce HasAnnotation class The class is defined as class HasAnnotation e where noAnnSrcSpan :: SrcSpan -> e This generalises noAnnSrcSpan, and allows noLocA :: (HasAnnotation e) => a -> GenLocated e a noLocA = L (noAnnSrcSpan noSrcSpan) - - - - - 8792a1bc by Ben Gamari at 2023-10-09T21:36:29-04:00 Bump unix submodule to v2.8.3.0 - - - - - e96c51cb by Andreas Klebinger at 2023-10-10T16:44:27+01:00 Add a flag -fkeep-auto-rules to optionally keep auto-generated rules around. The motivation for the flag is given in #21917. - - - - - 3ed58cef by Matthew Pickering at 2023-10-10T19:01:22-04:00 hadrian: Add ghcToolchain to tool args list This allows you to load ghc-toolchain and ghc-toolchain-bin into HLS. - - - - - 476c02d4 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Normalise triple via config.sub We were not normalising the target triple anymore like we did with the old make build system. Fixes #23856 - - - - - 303dd237 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Add missing vendor normalisation This is copied from m4/ghc_convert_vendor.m4 Towards #23868 - - - - - 838026c9 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Add loongarch64 to parseArch Towards #23868 - - - - - 1a5bc0b5 by Matthew Pickering at 2023-10-10T19:01:22-04:00 Add same LD hack to ghc-toolchain In the ./configure script, if you pass the `LD` variable then this has the effect of stopping use searching for a linker and hence passing `-fuse-ld=...`. We want to emulate this logic in ghc-toolchain, if a use explicilty specifies `LD` variable then don't add `-fuse-ld=..` with the goal of making ./configure and ghc-toolchain agree on which flags to use when using the C compiler as a linker. This is quite unsavoury as we don't bake the choice of LD into the configuration anywhere but what's important for now is making ghc-toolchain and ./configure agree as much as possible. See #23857 for more discussion - - - - - 42d50b5a by Ben Gamari at 2023-10-10T19:01:22-04:00 ghc-toolchain: Check for C99 support with -std=c99 Previously we failed to try enabling C99 support with `-std=c99`, as `autoconf` attempts. This broke on older compilers (e.g. CentOS 7) which don't enable C99 by default. Fixes #23879. - - - - - da2961af by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Add endianess check using __BYTE_ORDER__ macro In very old toolchains the BYTE_ORDER macro is not set but thankfully the __BYTE_ORDER__ macro can be used instead. - - - - - d8da73cd by Matthew Pickering at 2023-10-10T19:01:22-04:00 configure: AC_PATH_TARGET_TOOL for LD We want to make sure that LD is set to an absolute path in order to be consistent with the `LD=$(command -v ld)` call. The AC_PATH_TARGET_TOOL macro uses the absolute path rather than AC_CHECK_TARGET_TOOL which might use a relative path. - - - - - 171f93cc by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Check whether we need -std=gnu99 for CPP as well In ./configure the C99 flag is passed to the C compiler when used as a C preprocessor. So we also check the same thing in ghc-toolchain. - - - - - 89a0918d by Matthew Pickering at 2023-10-10T19:01:22-04:00 Check for --target linker flag separately to C compiler There are situations where the C compiler doesn't accept `--target` but when used as a linker it does (but doesn't do anything most likely) In particular with old gcc toolchains, the C compiler doesn't support --target but when used as a linker it does. - - - - - 37218329 by Matthew Pickering at 2023-10-10T19:01:22-04:00 Use Cc to compile test file in nopie check We were attempting to use the C compiler, as a linker, to compile a file in the nopie check, but that won't work in general as the flags we pass to the linker might not be compatible with the ones we pass when using the C compiler. - - - - - 9b2dfd21 by Matthew Pickering at 2023-10-10T19:01:22-04:00 configure: Error when ghc-toolchain fails to compile This is a small QOL change as if you are working on ghc-toolchain and it fails to compile then configure will continue and can give you outdated results. - - - - - 1f0de49a by Matthew Pickering at 2023-10-10T19:01:22-04:00 configure: Check whether -no-pie works when the C compiler is used as a linker `-no-pie` is a flag we pass when using the C compiler as a linker (see pieCCLDOpts in GHC.Driver.Session) so we should test whether the C compiler used as a linker supports the flag, rather than just the C compiler. - - - - - 62cd2579 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Remove javascript special case for --target detection emcc when used as a linker seems to ignore the --target flag, and for consistency with configure which now tests for --target, we remove this special case. - - - - - 0720fde7 by Ben Gamari at 2023-10-10T19:01:22-04:00 toolchain: Don't pass --target to emscripten toolchain As noted in `Note [Don't pass --target to emscripten toolchain]`, emscripten's `emcc` is rather inconsistent with respect to its treatment of the `--target` flag. Avoid this by special-casing this toolchain in the `configure` script and `ghc-toolchain`. Fixes on aspect of #23744. - - - - - 6354e1da by Matthew Pickering at 2023-10-10T19:01:22-04:00 hadrian: Don't pass `--gcc-options` as a --configure-arg to cabal configure Stop passing -gcc-options which mixed together linker flags and non-linker flags. There's no guarantee the C compiler will accept both of these in each mode. - - - - - c00a4bd6 by Ben Gamari at 2023-10-10T19:01:22-04:00 configure: Probe stage0 link flags For consistency with later stages and CC. - - - - - 1f11e7c4 by Sebastian Graf at 2023-10-10T19:01:58-04:00 Stricter Binary.get in GHC.Types.Unit (#23964) I noticed some thunking while looking at Core. This change has very modest, but throughout positive ghc/alloc effect: ``` hard_hole_fits(normal) ghc/alloc 283,057,664 281,620,872 -0.5% geo. mean -0.1% minimum -0.5% maximum +0.0% ``` Fixes #23964. - - - - - a4f1a181 by Bryan Richter at 2023-10-10T19:02:37-04:00 rel_eng/upload.sh cleanups - - - - - 80705335 by doyougnu at 2023-10-10T19:03:18-04:00 ci: add javascript label rule This adds a rule which triggers the javascript job when the "javascript" label is assigned to an MR. - - - - - a2c0fff6 by Matthew Craven at 2023-10-10T19:03:54-04:00 Make 'wWarningFlagsDeps' include every WarningFlag Fixes #24071. - - - - - d055f099 by Jan Hrček at 2023-10-10T19:04:33-04:00 Fix pretty printing of overlap pragmas in TH splices (fixes #24074) - - - - - 0746b868 by Andreas Klebinger at 2023-10-10T19:05:09-04:00 Aarch64 NCG: Use encoded immediates for literals. Try to generate instr x2, <imm> instead of mov x1, lit instr x2, x1 When possible. This get's rid if quite a few redundant mov instructions. I believe this causes a metric decrease for LargeRecords as we reduce register pressure. ------------------------- Metric Decrease: LargeRecord ------------------------- - - - - - 739f4e6f by Andreas Klebinger at 2023-10-10T19:05:09-04:00 AArch NCG: Refactor getRegister' Remove some special cases which can be handled just as well by the generic case. This increases code re-use while also fixing #23749. Since some of the special case wasn't upholding Note [Signed arithmetic on AArch64]. - - - - - 1b213d33 by Andreas Klebinger at 2023-10-10T19:05:09-04:00 Aarch ncg: Optimize immediate use for address calculations When the offset doesn't fit into the immediate we now just reuse the general getRegister' code path which is well optimized to compute the offset into a register instead of a special case for CmmRegOff. This means we generate a lot less code under certain conditions which is why performance metrics for these improve. ------------------------- Metric Decrease: T4801 T5321FD T5321Fun ------------------------- - - - - - b7df0732 by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over mem management checks These are for heap allocation, a strictly RTS concern. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. The RTS configure one has a new ``` AC_CHECK_SIZEOF([void *]) ``` that the top-level configure version didn't have, so that `ac_cv_sizeof_void_p` is defined. Once more code is moved over in latter commits, that can go away. Progress towards #17191 - - - - - 41130a65 by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over `__thread` check This used by (@bgamari thinks) the `GCThread` abstraction in the RTS. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - cc5ec2bd by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over misc function checks These are for general use in the RTS. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - 809e7c2d by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over `eventfd` check This check is for the RTS part of the event manager and has a corresponding part in `base`. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - 58f3babf by John Ericson at 2023-10-11T16:02:48-04:00 Split `FP_CHECK_PTHREADS` and move part to RTS configure `NEED_PTHREAD_LIB` is unused since 3609340743c1b25fdfd0e18b1670dac54c8d8623 (part of the make build system), and so is no longer defined. Progress towards #17191 - - - - - e99cf237 by Moritz Angermann at 2023-10-11T16:03:24-04:00 nativeGen: section flags for .text$foo only Commit 3ece9856d157c85511d59f9f862ab351bbd9b38b, was supposed to fix #22834 in !9810. It does however add "xr" indiscriminatly to .text sections even if splitSections is disabled. This leads to the assembler saying: ghc_1.s:7849:0: error: Warning: Ignoring changed section attributes for .text | 7849 | .section .text,"xr" | ^ - - - - - f383a242 by Sylvain Henry at 2023-10-11T16:04:04-04:00 Modularity: pass TempDir instead of DynFlags (#17957) - - - - - 34fc28b0 by John Ericson at 2023-10-12T06:48:28-04:00 Test that functions from `mingwex` are available Ryan wrote these two minimizations, but they never got added to the test suite. See #23309, #23378 Co-Authored-By: Ben Gamari <bgamari.foss at gmail.com> Co-Authored-By: Ryan Scott <ryan.gl.scott at gmail.com> - - - - - bdb54a0e by John Ericson at 2023-10-12T06:48:28-04:00 Do not check for the `mingwex` library in `/configure` See the recent discussion in !10360 --- Cabal will itself check for the library for the packages that need it, and while the autoconf check additionally does some other things like define a `HAS_LIBMINGWEX` C Preprocessor macro, those other things are also unused and unneeded. Progress towards #17191, which aims to get rid of `/configure` entirely. - - - - - 43e814e1 by Ben Gamari at 2023-10-12T06:49:40-04:00 base: Introduce move modules into src The only non-move changes here are whitespace changes to pass the `whitespace` test and a few testsuite adaptations. - - - - - df81536f by Moritz Angermann at 2023-10-12T06:50:16-04:00 [PEi386 linker] Bounds check and null-deref guard We should resonably be able to expect that we won't exceed the number of sections if we assume to be dealing with legal object files. We can however not guarantee that we get some negative values, and while we try to special case most, we should exclude negative indexing into the sections array. We also need to ensure that we do not try to derefences targetSection, if it is NULL, due to the switch statement. - - - - - c74c4f00 by John Ericson at 2023-10-12T10:31:13-04:00 Move apple compat check to RTS configure - - - - - c80778ea by John Ericson at 2023-10-12T10:31:13-04:00 Move clock/timer fun checks to RTS configure Actual library check (which will set the Cabal flag) is left in the top-level configure for now. Progress towards #17191 - - - - - 7f9f2686 by John Ericson at 2023-10-12T10:31:13-04:00 Move visibility and "musttail" annotation checks to the RTS configure All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - ffb3efe6 by John Ericson at 2023-10-12T10:31:13-04:00 Move leading underscore checks to RTS configure `CabalLeadingUnderscore` is done via Hadrian already, so we can stop `AC_SUBST`ing it completely. - - - - - 25fa4b02 by John Ericson at 2023-10-12T10:31:13-04:00 Move alloca, fork, const, and big endian checks to RTS configure All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. - - - - - 5170f42a by John Ericson at 2023-10-12T10:31:13-04:00 Move libdl check to RTS configure - - - - - ea7a1447 by John Ericson at 2023-10-12T10:31:13-04:00 Adjust `FP_FIND_LIBFFI` Just set vars, and `AC_SUBST` in top-level configure. Don't define `HAVE_SYSTEM_LIBFFI` because nothing is using it. It hasn't be in used since 3609340743c1b25fdfd0e18b1670dac54c8d8623 (part of the make build system). - - - - - f399812c by John Ericson at 2023-10-12T10:31:13-04:00 Split BFD support to RTS configure The flag is still in the top-level configure, but the other checks (which define various macros --- important) are in the RTS configure. - - - - - f64f44e9 by John Ericson at 2023-10-12T10:31:13-04:00 Split libm check between top level and RTS - - - - - dafc4709 by Moritz Angermann at 2023-10-12T10:31:49-04:00 CgUtils.fixStgRegStmt respect register width This change ensure that the reg + offset computation is always of the same size. Before this we could end up with a 64bit register, and then add a 32bit offset (on 32bit platforms). This not only would fail type sanity checking, but also incorrectly truncate 64bit values into 32bit values silently on 32bit architectures. - - - - - 9e6ef7ba by Matthew Pickering at 2023-10-12T20:35:00-04:00 hadrian: Decrease verbosity of cabal commands In Normal, most tools do not produce output to stdout unless there are error conditions. Reverts 7ed65f5a1bc8e040e318ccff395f53a9bbfd8217 - - - - - 08fc27af by John Ericson at 2023-10-12T20:35:36-04:00 Do not substitute `@...@` for stage-specific values in cabal files `rts` and `ghc-prim` now no longer have a `*.cabal.in` to set Cabal flag defaults; instead manual choices are passed to configure in the usual way. The old way was fundamentally broken, because it meant we were baking these Cabal files for a specific stage. Now we only do stage-agnostic @...@ substitution in cabal files (the GHC version), and so all stage-specific configuration is properly confined to `_build` and the right stage dir. Also `include-ghc-prim` is a flag that no longer exists for `ghc-prim` (it was removed in 835d8ddbbfb11796ea8a03d1806b7cee38ba17a6) so I got rid of it. Co-Authored-By: Matthew Pickering <matthewtpickering at gmail.com> - - - - - a0ac8785 by Sebastian Graf at 2023-10-14T19:17:12-04:00 Fix restarts in .ghcid Using the whole of `hadrian/` restarted in a loop for me. - - - - - fea9ecdb by Sebastian Graf at 2023-10-14T19:17:12-04:00 CorePrep: Refactor FloatingBind (#23442) A drastically improved architecture for local floating in CorePrep that decouples the decision of whether a float is going to be let- or case-bound from how far it can float (out of strict contexts, out of lazy contexts, to top-level). There are a couple of new Notes describing the effort: * `Note [Floating in CorePrep]` for the overview * `Note [BindInfo and FloatInfo]` for the new classification of floats * `Note [Floats and FloatDecision]` for how FloatInfo is used to inform floating decisions This is necessary ground work for proper treatment of Strict fields and unlifted values at top-level. Fixes #23442. NoFib results (omitted = 0.0%): ``` -------------------------------------------------------------------------------- Program Allocs Instrs -------------------------------------------------------------------------------- pretty 0.0% -1.6% scc 0.0% -1.7% -------------------------------------------------------------------------------- Min 0.0% -1.7% Max 0.0% -0.0% Geometric Mean -0.0% -0.0% ``` - - - - - 32523713 by Matthew Pickering at 2023-10-14T19:17:49-04:00 hadrian: Move ghcBinDeps into ghcLibDeps This completes a5227080b57cb51ac34d4c9de1accdf6360b818b, the `ghc-usage.txt` and `ghci-usage.txt` file are also used by the `ghc` library so need to make sure they are present in the libdir even if we are not going to build `ghc-bin`. This also fixes things for cross compilers because the stage2 cross-compiler requires the ghc-usage.txt file, but we are using the stage2 lib folder but not building stage3:exe:ghc-bin so ghc-usage.txt was not being generated. - - - - - ec3c4488 by sheaf at 2023-10-14T19:18:29-04:00 Combine GREs when combining in mkImportOccEnv In `GHC.Rename.Names.mkImportOccEnv`, we sometimes discard one import item in favour of another, as explained in Note [Dealing with imports] in `GHC.Rename.Names`. However, this can cause us to lose track of important parent information. Consider for example #24084: module M1 where { class C a where { type T a } } module M2 ( module M1 ) where { import M1 } module M3 where { import M2 ( C, T ); instance C () where T () = () } When processing the import list of `M3`, we start off (for reasons that are not relevant right now) with two `Avail`s attached to `T`, namely `C(C, T)` and `T(T)`. We combine them in the `combine` function of `mkImportOccEnv`; as described in Note [Dealing with imports] we discard `C(C, T)` in favour of `T(T)`. However, in doing so, we **must not** discard the information want that `C` is the parent of `T`. Indeed, losing track of this information can cause errors when importing, as we could get an error of the form ‘T’ is not a (visible) associated type of class ‘C’ We fix this by combining the two GREs for `T` using `plusGRE`. Fixes #24084 - - - - - 257c2807 by Ilias Tsitsimpis at 2023-10-14T19:19:07-04:00 hadrian: Pass -DNOSMP to C compiler when needed Hadrian passes the -DNOSMP flag to GHC when the target doesn't support SMP, but doesn't pass it to CC as well, leading to the following compilation error on mips64el: | Run Cc (FindCDependencies CDep) Stage1: rts/sm/NonMovingScav.c => _build/stage1/rts/build/c/sm/NonMovingScav.o.d Command line: /usr/bin/mips64el-linux-gnuabi64-gcc -E -MM -MG -MF _build/stage1/rts/build/c/hooks/FlagDefaults.thr_debug_p_o.d -MT _build/stage1/rts/build/c/hooks/FlagDefaults.o -Irts/include -I_build/stage1/rts/build -I_build/stage1/rts/build/include -Irts/include -x c rts/hooks/FlagDefaults.c -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline -Wpointer-arith -Wmissing-noreturn -Wnested-externs -Wredundant-decls -Wundef -fno-strict-aliasing -DTHREADED_RTS -DDEBUG -fomit-frame-pointer -O2 -g -Irts -I_build/stage1/rts/build -DDEBUG -fno-omit-frame-pointer -g3 -O0 ===> Command failed with error code: 1 In file included from rts/include/Stg.h:348, from rts/include/Rts.h:38, from rts/hooks/FlagDefaults.c:8: rts/include/stg/SMP.h:416:2: error: #error memory barriers unimplemented on this architecture 416 | #error memory barriers unimplemented on this architecture | ^~~~~ rts/include/stg/SMP.h:440:2: error: #error memory barriers unimplemented on this architecture 440 | #error memory barriers unimplemented on this architecture | ^~~~~ rts/include/stg/SMP.h:464:2: error: #error memory barriers unimplemented on this architecture 464 | #error memory barriers unimplemented on this architecture | ^~~~~ The old make system correctly passed this flag to both GHC and CC [1]. Fix this error by passing -DNOSMP to CC as well. [1] https://gitlab.haskell.org/ghc/ghc/-/blob/00920f176b0235d5bb52a8e054d89a664f8938fe/rts/ghc.mk#L407 Closes #24082 - - - - - 13d3c613 by John Ericson at 2023-10-14T19:19:42-04:00 Users Guide: Drop dead code for Haddock refs to `parallel` I noticed while working on !11451 that `@LIBRARY_parallel_UNIT_ID@` was not substituted. It is dead code -- there is no `parallel-ref` usages and it doesn't look like there ever was (going back to 3e5d0f188d6c8633e55e9ba6c8941c07e459fa4b), so let's delete it. - - - - - fe067577 by Sylvain Henry at 2023-10-18T19:40:25-04:00 Avoid out-of-bound array access in bigNatIsPowerOf2 (fix #24066) bigNatIndex# in the `where` clause wasn't guarded by "bigNatIsZero a". - - - - - cc1625b1 by Sylvain Henry at 2023-10-18T19:40:25-04:00 Bignum: fix right shift of negative BigNat with native backend - - - - - cbe4400d by Sylvain Henry at 2023-10-18T19:40:25-04:00 Rts: expose rtsOutOfBoundsAccess symbol - - - - - 72c7380c by Sylvain Henry at 2023-10-18T19:40:25-04:00 Hadrian: enable `-fcheck-prim-bounds` in validate flavour This allows T24066 to fail when the bug is present. Otherwise the out-of-bound access isn't detected as it happens in ghc-bignum which wasn't compiled with the bounds check. - - - - - f9436990 by John Ericson at 2023-10-18T19:41:01-04:00 Make Hadrian solely responsible for substituting `docs/users_guide/ghc_config.py.in` Fixes #24091 Progress on #23966 Issue #24091 reports that `@ProjectVersion@` is no longer being substituted in the GHC user's guide. I assume this is a recent issue, but I am not sure how it's worked since c1a3ecde720b3bddc2c8616daaa06ee324e602ab; it looks like both Hadrian and configure are trying to substitute the same `.in` file! Now only Hadrian does. That is better anyways; already something that issue #23966 requested. It seems like we were missing some dependencies in Hadrian. (I really, really hate that this is possible!) Hopefully it is fixed now. - - - - - b12df0bb by John Ericson at 2023-10-18T19:41:37-04:00 `ghcversion.h`: No need to cope with undefined `ProjectPatchLevel*` Since 4e6c80197f1cc46dfdef0300de46847c7cfbdcb0, these are guaranteed to be defined. (Guaranteed including a test in the testsuite.) - - - - - 0295375a by John Ericson at 2023-10-18T19:41:37-04:00 Generate `ghcversion.h` from a `.in` file Now that there are no conditional sections (see the previous commit), we can just a do simple substitution rather than pasting it together line by line. Progress on #23966 - - - - - 740a1b85 by Krzysztof Gogolewski at 2023-10-19T11:37:20-04:00 Add a regression test for #24064 - - - - - 921fbf2f by Hécate Moonlight at 2023-10-19T11:37:59-04:00 CLC Proposal #182: Export List from Data.List Proposal link: https://github.com/haskell/core-libraries-committee/issues/182 - - - - - 4f02d3c1 by Sylvain Henry at 2023-10-20T04:01:32-04:00 rts: fix small argument passing on big-endian arch (fix #23387) - - - - - b86243b4 by Sylvain Henry at 2023-10-20T04:02:13-04:00 Interpreter: fix literal alignment on big-endian architectures (fix #19261) Literals weren't correctly aligned on big-endian, despite what the comment said. - - - - - a4b2ec47 by Sylvain Henry at 2023-10-20T04:02:54-04:00 Testsuite: recomp011 and recomp015 are fixed on powerpc These tests have been fixed but not tested and re-enabled on big-endian powerpc (see comments in #11260 and #11323) - - - - - fded7dd4 by Sebastian Graf at 2023-10-20T04:03:30-04:00 CorePrep: Allow floating dictionary applications in -O0 into a Rec (#24102) - - - - - 02efc181 by John Ericson at 2023-10-22T02:48:55-04:00 Move function checks to RTS configure Some of these functions are used in `base` too, but we can copy the checks over to its configure if that's an issue. - - - - - 5f4bccab by John Ericson at 2023-10-22T02:48:55-04:00 Move over a number of C-style checks to RTS configure - - - - - 5cf04f58 by John Ericson at 2023-10-22T02:48:55-04:00 Move/Copy more `AC_DEFINE` to RTS config Only exception is the LLVM version macros, which are used for GHC itself. - - - - - b8ce5dfe by John Ericson at 2023-10-22T02:48:55-04:00 Define `TABLES_NEXT_TO_CODE` in the RTS configure We create a new cabal flag to facilitate this. - - - - - 4a40271e by John Ericson at 2023-10-22T02:48:55-04:00 Configure scripts: `checkOS`: Make a bit more robust `mingw64` and `mingw32` are now both accepted for `OSMinGW32`. This allows us to cope with configs/triples that we haven't normalized extra being what GNU `config.sub` does. - - - - - 16bec0a0 by John Ericson at 2023-10-22T02:48:55-04:00 Generate `ghcplatform.h` from RTS configure We create a new cabal flag to facilitate this. - - - - - 7dfcab2f by John Ericson at 2023-10-22T02:48:55-04:00 Get rid of all mention of `mk/config.h` The RTS configure script is now solely responsible for managing its headers; the top level configure script does not help. - - - - - c1e3719c by Cheng Shao at 2023-10-22T02:49:33-04:00 rts: drop stale mentions of MIN_UPD_SIZE We used to have MIN_UPD_SIZE macro that describes the minimum reserved size for thunks, so that the thunk can be overwritten in place as indirections or blackholes. However, this macro has not been actually defined or used anywhere since a long time ago; StgThunkHeader already reserves a padding word for this purpose. Hence this patch which drops stale mentions of MIN_UPD_SIZE. - - - - - d24b0d85 by Andrew Lelechenko at 2023-10-22T02:50:11-04:00 base changelog: move non-backported entries from 4.19 section to 4.20 Neither !10933 (check https://hackage.haskell.org/package/base-4.19.0.0/docs/src/Text.Read.Lex.html#numberToRangedRational) nor !10189 (check https://hackage.haskell.org/package/base-4.19.0.0/docs/src/Data.List.NonEmpty.html#unzip) were backported to `base-4.19.0.0`. Moving them to `base-4.20.0.0` section. Also minor stylistic changes to other entries, bringing them to a uniform form. - - - - - de78b32a by Alan Zimmerman at 2023-10-23T09:09:41-04:00 EPA Some tweaks to annotations - Fix span for GRHS - Move TrailingAnns from last match to FunBind - Fix GADT 'where' clause span - Capture full range for a CaseAlt Match - - - - - d5a8780d by Simon Hengel at 2023-10-23T09:10:23-04:00 Update primitives.rst - - - - - 4d075924 by Josh Meredith at 2023-10-24T23:04:12+11:00 JS/userguide: add explanation of writing jsbits - - - - - 07ab5cc1 by Cheng Shao at 2023-10-24T15:40:32-04:00 testsuite: increase timeout of ghc-api tests for wasm32 ghc-api tests for wasm32 are more likely to timeout due to the large wasm module sizes, especially when testing with wasm native tail calls, given wasmtime's handling of tail call opcodes are suboptimal at the moment. It makes sense to increase timeout specifically for these tests on wasm32. This doesn't affect other targets, and for wasm32 we don't increase timeout for all tests, so not to risk letting major performance regressions slip through the testsuite. - - - - - 0d6acca5 by Greg Steuck at 2023-10-26T08:44:23-04:00 Explicitly require RLIMIT_AS before use in OSMem.c This is done elsewhere in the source tree. It also suddenly is required on OpenBSD. - - - - - 9408b086 by Sylvain Henry at 2023-10-26T08:45:03-04:00 Modularity: modularize external linker Decouple runLink from DynFlags to allow calling runLink more easily. This is preliminary work for calling Emscripten's linker (emcc) from our JavaScript linker. - - - - - e0f35030 by doyougnu at 2023-10-27T08:41:12-04:00 js: add JStg IR, remove unsaturated constructor - Major step towards #22736 and adding the optimizer in #22261 - - - - - 35587eba by Simon Peyton Jones at 2023-10-27T08:41:48-04:00 Fix a bug in tail calls with ticks See #24078 for the diagnosis. The change affects only the Tick case of occurrence analysis. It's a bit hard to test, so no regression test (yet anyway). - - - - - 9bc5cb92 by Matthew Craven at 2023-10-28T07:06:17-04:00 Teach tag-inference about SeqOp/seq# Fixes the STG/tag-inference analogue of #15226. Co-Authored-By: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - 34f06334 by Moritz Angermann at 2023-10-28T07:06:53-04:00 [PEi386] Mask SYM_TYPE_DUP_DISCARD in makeSymbolExtra 48e391952c17ff7eab10b0b1456e3f2a2af28a9b introduced `SYM_TYPE_DUP_DISCARD` to the bitfield. The linker however, failed to mask the `SYM_TYPE_DUP_DISCARD` value. Thus `== SYM_TYPE_CODE` comparisons easily failed. This lead to us relocating DATA lookups (GOT) into E8 (call) and E9 (jump) instructions. - - - - - 5b51b2a2 by Mario Blažević at 2023-10-28T07:07:33-04:00 Fix and test for issue #24111, TH.Ppr output of pattern synonyms - - - - - 723bc352 by Alan Zimmerman at 2023-10-30T20:36:41-04:00 EPA: print doc comments as normal comments And ignore the ones allocated in haddock processing. It does not guarantee that every original haddock-like comment appears in the output, as it discards ones that have no legal attachment point. closes #23459 - - - - - 21b76843 by Simon Peyton Jones at 2023-10-30T20:37:17-04:00 Fix non-termination bug in equality solver constraint left-to-right then right to left, forever. Easily fixed. - - - - - 270867ac by Sebastian Graf at 2023-10-30T20:37:52-04:00 ghc-toolchain: build with `-package-env=-` (#24131) Otherwise globally installed libraries (via `cabal install --lib`) break the build. Fixes #24131. - - - - - 7a90020f by Krzysztof Gogolewski at 2023-10-31T20:03:37-04:00 docs: fix ScopedTypeVariables example (#24101) The previous example didn't compile. Furthermore, it wasn't demonstrating the point properly. I have changed it to an example which shows that 'a' in the signature must be the same 'a' as in the instance head. - - - - - 49f69f50 by Krzysztof Gogolewski at 2023-10-31T20:04:13-04:00 Fix pretty-printing of type family dependencies "where" should be after the injectivity annotation. - - - - - 73c191c0 by Ben Gamari at 2023-10-31T20:04:49-04:00 gitlab-ci: Bump LLVM bootstrap jobs to Debian 12 As the Debian 10 images have too old an LLVM. Addresses #24056. - - - - - 5b0392e0 by Matthew Pickering at 2023-10-31T20:04:49-04:00 ci: Run aarch64 llvm backend job with "LLVM backend" label This brings it into line with the x86 LLVM backend job. - - - - - 9f9c9227 by Ryan Scott at 2023-11-01T09:19:12-04:00 More robust checking for DataKinds As observed in #22141, GHC was not doing its due diligence in catching code that should require `DataKinds` in order to use. Most notably, it was allowing the use of arbitrary data types in kind contexts without `DataKinds`, e.g., ```hs data Vector :: Nat -> Type -> Type where ``` This patch revamps how GHC tracks `DataKinds`. The full specification is written out in the `DataKinds` section of the GHC User's Guide, and the implementation thereof is described in `Note [Checking for DataKinds]` in `GHC.Tc.Validity`. In brief: * We catch _type_-level `DataKinds` violations in the renamer. See `checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in `GHC.Rename.Pat`. * We catch _kind_-level `DataKinds` violations in the typechecker, as this allows us to catch things that appear beneath type synonyms. (We do *not* want to do this in type-level contexts, as it is perfectly fine for a type synonym to mention something that requires DataKinds while still using the type synonym in a module that doesn't enable DataKinds.) See `checkValidType` in `GHC.Tc.Validity`. * There is now a single `TcRnDataKindsError` that classifies all manner of `DataKinds` violations, both in the renamer and the typechecker. The `NoDataKindsDC` error has been removed, as it has been subsumed by `TcRnDataKindsError`. * I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit uses of data types at the kind level without `DataKinds`. Previously, `isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`. Moreover, it thwarted the implementation of the `DataKinds` check in `checkValidType`, since we would expand `Constraint` (which was OK without `DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and reject it. Now both are allowed. * I have added a flurry of additional test cases that test various corners of `DataKinds` checking. Fixes #22141. - - - - - 575d7690 by Sylvain Henry at 2023-11-01T09:19:53-04:00 JS: fix FFI "wrapper" and "dynamic" Fix codegen and helper functions for "wrapper" and "dynamic" foreign imports. Fix tests: - ffi006 - ffi011 - T2469 - T4038 Related to #22363 - - - - - 81fb8885 by Alan Zimmerman at 2023-11-01T22:23:56-04:00 EPA: Use full range for Anchor This change requires a series of related changes, which must all land at the same time, otherwise all the EPA tests break. * Use the current Anchor end as prior end Use the original anchor location end as the source of truth for calculating print deltas. This allows original spacing to apply in most cases, only changed AST items need initial delta positions. * Add DArrow to TrailingAnn * EPA Introduce HasTrailing in ExactPrint Use [TrailingAnn] in enterAnn and remove it from ExactPrint (LocatedN RdrName) * In HsDo, put TrailingAnns at top of LastStmt * EPA: do not convert comments to deltas when balancing. * EPA: deal with fallout from getMonoBind * EPA fix captureLineSpacing * EPA print any comments in the span before exiting it * EPA: Add comments to AnchorOperation * EPA: remove AnnEofComment, it is no longer used Updates Haddock submodule - - - - - 03e82511 by Rodrigo Mesquita at 2023-11-01T22:24:32-04:00 Fix in docs regarding SSymbol, SNat, SChar (#24119) - - - - - 362cc693 by Matthew Pickering at 2023-11-01T22:25:08-04:00 hadrian: Update bootstrap plans (9.4.6, 9.4.7, 9.6.2, 9.6.3, 9.8.1) Updating the bootstrap plans with more recent GHC versions. - - - - - 00b9b8d3 by Matthew Pickering at 2023-11-01T22:25:08-04:00 ci: Add 9.8.1 bootstrap testing job - - - - - ef3d20f8 by Matthew Pickering at 2023-11-01T22:25:08-04:00 Compatibility with 9.8.1 as boot compiler This fixes several compatability issues when using 9.8.1 as the boot compiler. * An incorrect version guard on the stack decoding logic in ghc-heap * Some ghc-prim bounds need relaxing * ghc is no longer wired in, so we have to remove the -this-unit-id ghc call. Fixes #24077 - - - - - 6755d833 by Jaro Reinders at 2023-11-03T10:54:42+01:00 Add NCG support for common 64bit operations to the x86 backend. These used to be implemented via C calls which was obviously quite bad for performance for operations like simple addition. Co-authored-by: Andreas Klebinger - - - - - 0dfb1fa7 by Vladislav Zavialov at 2023-11-03T14:08:41-04:00 T2T in Expressions (#23738) This patch implements the T2T (term-to-type) transformation in expressions. Given a function with a required type argument vfun :: forall a -> ... the user can now call it as vfun (Maybe Int) instead of vfun (type (Maybe Int)) The Maybe Int argument is parsed and renamed as a term (HsExpr), but then undergoes a conversion to a type (HsType). See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs and Note [RequiredTypeArguments and the T2T mapping] Left as future work: checking for puns. - - - - - cc1c7c54 by Duncan Coutts at 2023-11-05T00:23:44-04:00 Add a test for I/O managers It tries to cover the cases of multiple threads waiting on the same fd for reading and multiple threads waiting for writing, including wait cancellation by async exceptions. It should work for any I/O manager, in-RTS or in-Haskell. Unfortunately it will not currently work for Windows because it relies on anonymous unix sockets. It could in principle be ported to use Windows named pipes. - - - - - 2e448f98 by Cheng Shao at 2023-11-05T00:23:44-04:00 Skip the IOManager test on wasm32 arch. The test relies on the sockets API which are not (yet) available. - - - - - fe50eb35 by Cheng Shao at 2023-11-05T00:24:20-04:00 compiler: fix eager blackhole symbol in wasm32 NCG - - - - - af771148 by Cheng Shao at 2023-11-05T00:24:20-04:00 testsuite: fix optasm tests for wasm32 - - - - - 1b90735c by Matthew Pickering at 2023-11-05T00:24:20-04:00 testsuite: Add wasm32 to testsuite arches with NCG The compiler --info reports that wasm32 compilers have a NCG, so we should agree with that here. - - - - - db9a6496 by Alan Zimmerman at 2023-11-05T00:24:55-04:00 EPA: make locA a function, not a field name And use it to generalise reLoc The following for the windows pipeline one. 5.5% Metric Increase: T5205 - - - - - 833e250c by Simon Peyton Jones at 2023-11-05T00:25:31-04:00 Update the unification count in wrapUnifierX Omitting this caused type inference to fail in #24146. This was an accidental omision in my refactoring of the equality solver. - - - - - e451139f by Andreas Klebinger at 2023-11-05T00:26:07-04:00 Remove an accidental git conflict marker from a comment. - - - - - 30baac7a by Tobias Haslop at 2023-11-06T10:50:32+00:00 Add laws relating between Foldable/Traversable with their Bi- superclasses See https://github.com/haskell/core-libraries-committee/issues/205 for discussion. This commit also documents that the tuple instances only satisfy the laws up to lazyness, similar to the documentation added in !9512. - - - - - df626f00 by Tobias Haslop at 2023-11-07T02:20:37-05:00 Elaborate on the quantified superclass of Bifunctor This was requested in the comment https://github.com/haskell/core-libraries-committee/issues/93#issuecomment-1597271700 for when Traversable becomes a superclass of Bitraversable, but similarly applies to Functor/Bifunctor, which already are in a superclass relationship. - - - - - 8217acb8 by Alan Zimmerman at 2023-11-07T02:21:12-05:00 EPA: get rid of l2l and friends Replace them with l2l to convert the location la2la to convert a GenLocated thing Updates haddock submodule - - - - - dd88a260 by Luite Stegeman at 2023-11-07T02:21:53-05:00 JS: remove broken newIdents from JStg Monad GHC.JS.JStg.Monad.newIdents was broken, resulting in duplicate identifiers being generated in h$c1, h$c2, ... . This change removes the broken newIdents. - - - - - 455524a2 by Matthew Craven at 2023-11-09T08:41:59-05:00 Create specially-solved DataToTag class Closes #20532. This implements CLC proposal 104: https://github.com/haskell/core-libraries-committee/issues/104 The design is explained in Note [DataToTag overview] in GHC.Tc.Instance.Class. This replaces the existing `dataToTag#` primop. These metric changes are not "real"; they represent Unique-related flukes triggering on a different set of jobs than they did previously. See also #19414. Metric Decrease: T13386 T8095 Metric Increase: T13386 T8095 Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - a05f4554 by Alan Zimmerman at 2023-11-09T08:42:35-05:00 EPA: get rid of glRR and friends in GHC/Parser.y With the HasLoc and HasAnnotation classes, we can replace a number of type-specific helper functions in the parser with polymorphic ones instead Metric Decrease: MultiLayerModulesTH_Make - - - - - 18498538 by Cheng Shao at 2023-11-09T16:58:12+00:00 ci: bump ci-images for wasi-sdk upgrade - - - - - 52c0fc69 by PHO at 2023-11-09T19:16:22-05:00 Don't assume the current locale is *.UTF-8, set the encoding explicitly primops.txt contains Unicode characters: > LC_ALL=C ./genprimopcode --data-decl < ./primops.txt > genprimopcode: <stdin>: hGetContents: invalid argument (cannot decode byte sequence starting from 226) Hadrian must also avoid using readFile' to read primops.txt because it tries to decode the file with a locale-specific encoding. - - - - - 7233b3b1 by PHO at 2023-11-09T19:17:01-05:00 Use '[' instead of '[[' because the latter is a Bash-ism It doesn't work on platforms where /bin/sh is something other than Bash. - - - - - 6dbab180 by Simon Peyton Jones at 2023-11-09T19:17:36-05:00 Add an extra check in kcCheckDeclHeader_sig Fix #24083 by checking for a implicitly-scoped type variable that is not actually bound. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType For some reason, on aarch64-darwin we saw a 2.8% decrease in compiler allocations for MultiLayerModulesTH_Make; but 0.0% on other architectures. Metric Decrease: MultiLayerModulesTH_Make - - - - - 22551364 by Sven Tennie at 2023-11-11T06:35:22-05:00 AArch64: Delete unused LDATA pseudo-instruction Though there were consuming functions for LDATA, there were no producers. Thus, the removed code was "dead". - - - - - 2a0ec8eb by Alan Zimmerman at 2023-11-11T06:35:59-05:00 EPA: harmonise acsa and acsA in GHC/Parser.y With the HasLoc class, we can remove the acsa helper function, using acsA instead. - - - - - 7ae517a0 by Teo Camarasu at 2023-11-12T08:04:12-05:00 nofib: bump submodule This includes changes that: - fix building a benchmark with HEAD - remove a Makefile-ism that causes errors in bash scripts Resolves #24178 - - - - - 3f0036ec by Alan Zimmerman at 2023-11-12T08:04:47-05:00 EPA: Replace Anchor with EpaLocation An Anchor has a location and an operation, which is either that it is unchanged or that it has moved with a DeltaPos data Anchor = Anchor { anchor :: RealSrcSpan , anchor_op :: AnchorOperation } An EpaLocation also has either a location or a DeltaPos data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan) | EpaDelta !DeltaPos ![LEpaComment] Now that we do not care about always having a location in the anchor, we remove Anchor and replace it with EpaLocation We do this with a type alias initially, to ease the transition. The alias will be removed in time. We also have helpers to reconstruct the AnchorOperation from an EpaLocation. This is also temporary. Updates Haddock submodule - - - - - a7492048 by Alan Zimmerman at 2023-11-12T13:43:07+00:00 EPA: get rid of AnchorOperation Now that the Anchor type is an alias for EpaLocation, remove AnchorOperation. Updates haddock submodule - - - - - 0745c34d by Andrew Lelechenko at 2023-11-13T16:25:07-05:00 Add since annotation for showHFloat - - - - - e98051a5 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 Suppress duplicate librares linker warning of new macOS linker Fixes #24167 XCode 15 introduced a new linker which warns on duplicate libraries being linked. To disable this warning, we pass -Wl,-no_warn_duplicate_libraries as suggested by Brad King in CMake issue #25297. This flag isn't necessarily available to other linkers on darwin, so we must only configure it into the CC linker arguments if valid. - - - - - c411c431 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Encoding test witnesses recent iconv bug is fragile A regression in the new iconv() distributed with XCode 15 and MacOS Sonoma causes the test 'encoding004' to fail in the CP936 roundrip. We mark this test as fragile until this is fixed upstream (rather than broken, since previous versions of iconv pass the test) See #24161 - - - - - ce7fe5a9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Update to LC_ALL=C no longer being ignored in darwin MacOS seems to have fixed an issue where it used to ignore the variable `LC_ALL` in program invocations and default to using Unicode. Since the behaviour seems to be fixed to account for the locale variable, we mark tests that were previously broken in spite of it as fragile (since they now pass in recent macOS distributions) See #24161 - - - - - e6c803f7 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 darwin: Fix single_module is obsolete warning In XCode 15's linker, -single_module is the default and otherwise passing it as a flag results in a warning being raised: ld: warning: -single_module is obsolete This patch fixes this warning by, at configure time, determining whether the linker supports -single_module (which is likely false for all non-darwin linkers, and true for darwin linkers in previous versions of macOS), and using that information at runtime to decide to pass or not the flag in the invocation. Fixes #24168 - - - - - 929ba2f9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Skip MultiLayerModulesTH_Make on darwin The recent toolchain upgrade on darwin machines resulted in the MultiLayerModulesTH_Make test metrics varying too much from the baseline, ultimately blocking the CI pipelines. This commit skips the test on darwin to temporarily avoid failures due to the environment change in the runners. However, the metrics divergence is being investigated still (tracked in #24177) - - - - - af261ccd by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 configure: check target (not build) understands -no_compact_unwind Previously, we were branching on whether the build system was darwin to shortcut this check, but we really want to branch on whether the target system (which is what we are configuring ld_prog for) is darwin. - - - - - 2125c176 by Luite Stegeman at 2023-11-15T13:19:38-05:00 JS: Fix missing variable declarations The JStg IR update was missing some local variable declarations that were present earlier, causing global variables to be used implicitly (or an error in JavaScript strict mode). This adds the local variable declarations again. - - - - - 99ced73b by Krzysztof Gogolewski at 2023-11-15T13:20:14-05:00 Remove loopy superclass solve mechanism Programs with a -Wloopy-superclass-solve warning will now fail with an error. Fixes #23017 - - - - - 2aff2361 by Zubin Duggal at 2023-11-15T13:20:50-05:00 users-guide: Fix links to libraries from the users-guide. The unit-ids generated in c1a3ecde720b3bddc2c8616daaa06ee324e602ab include the package name, so we don't need to explicitly add it to the links. Fixes #24151 - - - - - 27981fac by Alan Zimmerman at 2023-11-15T13:21:25-05:00 EPA: splitLHsForAllTyInvis does not return ann We did not use the annotations returned from splitLHsForAllTyInvis, so do not return them. - - - - - a6467834 by Krzysztof Gogolewski at 2023-11-15T22:22:59-05:00 Document defaulting of RuntimeReps Fixes #24099 - - - - - 2776920e by Simon Peyton Jones at 2023-11-15T22:23:35-05:00 Second fix to #24083 My earlier fix turns out to be too aggressive for data/type families See wrinkle (DTV1) in Note [Disconnected type variables] - - - - - cee81370 by Sylvain Henry at 2023-11-16T09:57:46-05:00 Fix unusable units and module reexport interaction (#21097) This commit fixes an issue with ModUnusable introduced in df0f148feae. In mkUnusableModuleNameProvidersMap we traverse the list of unusable units and generate ModUnusable origin for all the modules they contain: exposed modules, hidden modules, and also re-exported modules. To do this we have a two-level map: ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin So for each module name "M" in broken unit "u" we have: "M" -> u:M -> ModUnusable reason However in the case of module reexports we were using the *target* module as a key. E.g. if "u:M" is a reexport for "X" from unit "o": "M" -> o:X -> ModUnusable reason Case 1: suppose a reexport without module renaming (u:M -> o:M) from unusable unit u: "M" -> o:M -> ModUnusable reason Here it's claiming that the import of M is unusable because a reexport from u is unusable. But if unit o isn't unusable we could also have in the map: "M" -> o:M -> ModOrigin ... Issue: the Semigroup instance of ModuleOrigin doesn't handle the case (ModUnusable <> ModOrigin) Case 2: similarly we could have 2 unusable units reexporting the same module without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v unusable. It gives: "M" -> o:M -> ModUnusable ... (for u) "M" -> o:M -> ModUnusable ... (for v) Issue: the Semigroup instance of ModuleOrigin doesn't handle the case (ModUnusable <> ModUnusable). This led to #21097, #16996, #11050. To fix this, in this commit we make ModUnusable track whether the module used as key is a reexport or not (for better error messages) and we use the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u is unusable, we now record: "M" -> u:M -> ModUnusable reason reexported=True So now, we have two cases for a reexport u:M -> o:X: - u unusable: "M" -> u:M -> ModUnusable ... reexported=True - u usable: "M" -> o:X -> ModOrigin ... reexportedFrom=u:M The second case is indexed with o:X because in this case the Semigroup instance of ModOrigin is used to combine valid expositions of a module (directly or via reexports). Note that module lookup functions select usable modules first (those who have a ModOrigin value), so it doesn't matter if we add new ModUnusable entries in the map like this: "M" -> { u:M -> ModUnusable ... reexported=True o:M -> ModOrigin ... } The ModOrigin one will be used. Only if there is no ModOrigin or ModHidden entry will the ModUnusable error be printed. See T21097 for an example printing several reasons why an import is unusable. - - - - - 3e606230 by Krzysztof Gogolewski at 2023-11-16T09:58:22-05:00 Fix IPE test A helper function was defined in a different module than used. To reproduce: ./hadrian/build test --test-root-dirs=testsuite/tests/rts/ipe - - - - - 49f5264b by Andreas Klebinger at 2023-11-16T20:52:11-05:00 Properly compute unpacked sizes for -funpack-small-strict-fields. Use rep size rather than rep count to compute the size. Fixes #22309 - - - - - b4f84e4b by James Henri Haydon at 2023-11-16T20:52:53-05:00 Explicit methods for Alternative Compose Explicitly define some and many in Alternative instance for Data.Functor.Compose Implementation of https://github.com/haskell/core-libraries-committee/issues/181 - - - - - 9bc0dd1f by Ignat Insarov at 2023-11-16T20:53:34-05:00 Add permutations for non-empty lists. Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837 - - - - - 5643ecf9 by Andrew Lelechenko at 2023-11-16T20:53:34-05:00 Update changelog and since annotations for Data.List.NonEmpty.permutations Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837 - - - - - 94ff2134 by Oleg Alexander at 2023-11-16T20:54:15-05:00 Update doc string for traceShow Updated doc string for traceShow. - - - - - faff671a by Luite Stegeman at 2023-11-17T14:12:51+01:00 JS: clean up some foreign imports - - - - - 856e0a4e by Sven Tennie at 2023-11-18T06:54:11-05:00 AArch64: Remove unused instructions As these aren't ever emitted, we don't even know if they work or will ever be used. If one of them is needed in future, we may easily re-add it. Deleted instructions are: - CMN - ANDS - BIC - BICS - EON - ORN - ROR - TST - STP - LDP - DMBSY - - - - - 615441ef by Alan Zimmerman at 2023-11-18T06:54:46-05:00 EPA: Replace Monoid with NoAnn Remove the final Monoid instances in the exact print infrastructure. For Windows CI Metric Decrease: T5205 - - - - - 5a6c49d4 by David Feuer at 2023-11-20T18:53:18-05:00 Speed up stimes in instance Semigroup Endo As discussed at https://github.com/haskell/core-libraries-committee/issues/4 - - - - - cf9da4b3 by Andrew Lelechenko at 2023-11-20T18:53:18-05:00 base: reflect latest changes in the changelog - - - - - 48bf364e by Alan Zimmerman at 2023-11-20T18:53:54-05:00 EPA: Use SrcSpan in EpaSpan This is more natural, since we already need to deal with invalid RealSrcSpans, and that is exactly what SrcSpan.UnhelpfulSpan is for. Updates haddock submodule. - - - - - 97ec37cc by Sebastian Graf at 2023-11-20T18:54:31-05:00 Add regression test for #6070 Fixes #6070. - - - - - e9d5ae41 by Owen Shepherd at 2023-11-21T18:32:23-05:00 chore: Correct typo in the gitlab MR template [skip ci] - - - - - f158a8d0 by Rodrigo Mesquita at 2023-11-21T18:32:59-05:00 Improve error message when reading invalid `.target` files A `.target` file generated by ghc-toolchain or by configure can become invalid if the target representation (`Toolchain.Target`) is changed while the files are not re-generated by calling `./configure` or `ghc-toolchain` again. There is also the issue of hadrian caching the dependencies on `.target` files, which makes parsing fail when reading reading the cached value if the representation has been updated. This patch provides a better error message in both situations, moving away from a terrible `Prelude.read: no parse` error that you would get otherwise. Fixes #24199 - - - - - 955520c6 by Ben Gamari at 2023-11-21T18:33:34-05:00 users guide: Note that QuantifiedConstraints implies ExplicitForAll Fixes #24025. - - - - - 17ec3e97 by Owen Shepherd at 2023-11-22T09:37:28+01:00 fix: Change type signatures in NonEmpty export comments to reflect reality This fixes several typos in the comments of Data.List.NonEmpty export list items. - - - - - 2fd78f9f by Samuel Thibault at 2023-11-22T11:49:13-05:00 Fix the platform string for GNU/Hurd As commited in Cargo https://github.com/haskell/cabal/pull/9434 there is confusion between "gnu" and "hurd". This got fixed in Cargo, we need the converse in Hadrian. Fixes #24180 - - - - - a79960fe by Alan Zimmerman at 2023-11-22T11:49:48-05:00 EPA: Tuple Present no longer has annotation The Present constructor for a Tuple argument will never have an exact print annotation. So make this impossible. - - - - - 121c9ab7 by David Binder at 2023-11-22T21:12:29-05:00 Unify the hpc testsuites The hpc testsuite was split between testsuite/tests/hpc and the submodule libraries/hpc/test. This commit unifies the two testsuites in the GHC repository in the directory testsuite/tests/hpc. - - - - - d2733a05 by Alan Zimmerman at 2023-11-22T21:13:05-05:00 EPA: empty tup_tail has noAnn In Parser.y, the tup_tail rule had the following option | {- empty -} %shift { return [Left noAnn] } Once this works through PostProcess.hs, it means we add an extra Missing constructor if the last item was a comma. Change the annotation type to a Bool to indicate this, and use the EpAnn Anchor for the print location for the others. - - - - - fa576eb8 by Andreas Klebinger at 2023-11-24T08:29:13-05:00 Fix FMA primops generating broken assembly on x86. `genFMA3Code` assumed that we had to take extra precations to avoid overwriting the result of `getNonClobberedReg`. One of these special cases caused a bug resulting in broken assembly. I believe we don't need to hadle these cases specially at all, which means this MR simply deletes the special cases to fix the bug. Fixes #24160 - - - - - 34d86315 by Alan Zimmerman at 2023-11-24T08:29:49-05:00 EPA: Remove parenthesizeHsType This is called from PostProcess.hs, and adds spurious parens. With the looser version of exact printing we had before we could tolerate this, as they would be swallowed by the original at the same place. But with the next change (remove EpAnnNotUsed) they result in duplicates in the output. For Darwin build: Metric Increase: MultiLayerModulesTH_OneShot - - - - - 3ede659d by Vladislav Zavialov at 2023-11-26T06:43:32-05:00 Add name for -Wdeprecated-type-abstractions (#24154) This warning had no name or flag and was triggered unconditionally. Now it is part of -Wcompat. - - - - - 7902ebf8 by Alan Zimmerman at 2023-11-26T06:44:08-05:00 EPA: Remove EpAnnNotUsed We no longer need the EpAnnNotUsed constructor for EpAnn, as we can represent an unused annotation with an anchor having a EpaDelta of zero, and empty comments and annotations. This simplifies code handling annotations considerably. Updates haddock submodule Metric Increase: parsing001 - - - - - 471b2672 by Mario Blažević at 2023-11-26T06:44:48-05:00 Bumped the upper bound of text to <2.2 - - - - - d1bf25c7 by Vladislav Zavialov at 2023-11-26T11:45:49-05:00 Term variable capture (#23740) This patch changes type variable lookup rules (lookupTypeOccRn) and implicit quantification rules (filterInScope) so that variables bound in the term namespace can be captured at the type level {-# LANGUAGE RequiredTypeArguments #-} f1 x = g1 @x -- `x` used in a type application f2 x = g2 (undefined :: x) -- `x` used in a type annotation f3 x = g3 (type x) -- `x` used in an embedded type f4 x = ... where g4 :: x -> x -- `x` used in a type signature g4 = ... This change alone does not allow us to accept examples shown above, but at least it gets them past the renamer. - - - - - da863d15 by Vladislav Zavialov at 2023-11-26T11:46:26-05:00 Update Note [hsScopedTvs and visible foralls] The Note was written before GHC gained support for visible forall in types of terms. Rewrite a few sentences and use a better example. - - - - - b5213542 by Matthew Pickering at 2023-11-27T12:53:59-05:00 testsuite: Add mechanism to collect generic metrics * Generalise the metric logic by adding an additional field which allows you to specify how to query for the actual value. Previously the method of querying the baseline value was abstracted (but always set to the same thing). * This requires rejigging how the stat collection works slightly but now it's more uniform and hopefully simpler. * Introduce some new "generic" helper functions for writing generic stats tests. - collect_size ( deviation, path ) Record the size of the file as a metric - stat_from_file ( metric, deviation, path ) Read a value from the given path, and store that as a metric - collect_generic_stat ( metric, deviation, get_stat) Provide your own `get_stat` function, `lambda way: <Int>`, which can be used to establish the current value of the metric. - collect_generic_stats ( metric_info ): Like collect_generic_stat but provide the whole dictionary of metric definitions. { metric: { deviation: <Int> current: lambda way: <Int> } } * Introduce two new "size" metrics for keeping track of build products. - `size_hello_obj` - The size of `hello.o` from compiling hello.hs - `libdir` - The total size of the `libdir` folder. * Track the number of modules in the AST tests - CountDepsAst - CountDepsParser This lays the infrastructure for #24191 #22256 #17129 - - - - - 7d9a2e44 by ARATA Mizuki at 2023-11-27T12:54:39-05:00 x86: Don't require -mavx2 when using 256-bit floating-point SIMD primitives Fixes #24222 - - - - - 4e5ff6a4 by Alan Zimmerman at 2023-11-27T12:55:15-05:00 EPA: Remove SrcSpanAnn Now that we only have a single constructor for EpAnn, And it uses a SrcSpan for its location, we can do away with SrcSpanAnn completely. It only existed to wrap the original SrcSpan in a location, and provide a place for the exact print annotation. For darwin only: Metric Increase: MultiLayerModulesTH_OneShot Updates haddock submodule - - - - - e05bca39 by Krzysztof Gogolewski at 2023-11-28T08:00:55-05:00 testsuite: don't initialize testdir to '.' The test directory is removed during cleanup, if there's an interrupt that could remove the entire repository. Fixes #24219 - - - - - af881674 by Alan Zimmerman at 2023-11-28T08:01:30-05:00 EPA: Clean up mkScope in Ast.hs Now that we have HasLoc we can get rid of all the custom variants of mkScope For deb10-numa Metric Increase: libdir - - - - - 292983c8 by Ben Gamari at 2023-11-28T22:44:28-05:00 distrib: Rediscover otool and install_name_tool on Darwin In the bindist configure script we must rediscover the `otool` and `install_name_tool`s since they may be different from the build environment. Fixes #24211. - - - - - dfe1c354 by Stefan Schulze Frielinghaus at 2023-11-28T22:45:04-05:00 llvmGen: Align objects in the data section Objects in the data section may be referenced via tagged pointers. Thus, align those objects to a 4- or 8-byte boundary for 32- or 64-bit platforms, respectively. Note, this may need to be reconsidered if objects with a greater natural alignment requirement are emitted as e.g. 128-bit atomics. Fixes #24163. - - - - - f6c486c3 by Matthew Pickering at 2023-11-29T11:08:13-05:00 metrics: Widen libdir and size_hello_obj acceptance window af8816740d9b8759be1a22af8adcb5f13edeb61d shows that the libdir size can fluctuate quite significantly even when the change is quite small. Therefore we widen the acceptance window to 10%. - - - - - 99a6a49c by Alan Zimmerman at 2023-11-29T11:08:49-05:00 EPA: Clean up TC Monad Utils We no longer need the alternative variant of addLocM (addLocMA) nor wrapLocAM, wrapLocSndMA. aarch64-darwin Metric Increase: MultiLayerModulesTH_OneShot deb10-numa-slow Metric Decrease: libdir - - - - - cbc03fa0 by Sebastian Graf at 2023-11-30T12:37:21-05:00 perf tests: Move comments into new `Note [Sensitivity to unique increment]` (#19414) And additionally to T12545, link from T8095, T13386 to this new Note. - - - - - c7623b22 by Alan Zimmerman at 2023-11-30T12:37:56-05:00 EPA: EpaDelta for comment has no comments EpaLocation is used to position things. It has two constructors, EpaSpan holding a SrcSpan, and EpaDelta with a delta position and a possible list of comments. The comment list is needed because the location in EpaDelta has no absolute information to decide which comments should be emitted before them when printing. But it is also used for specifying the position of a comment. To prevent the absurdity of a comment position having a list of comments in it, we make EpaLocation parameterisable, using comments for the normal case and a constant for within comments. Updates haddock submodule. aarch64-darwin Metric Decrease: MultiLayerModulesTH_OneShot - - - - - bd8acc0c by Krzysztof Gogolewski at 2023-11-30T12:38:32-05:00 Kind-check body of a required forall We now require that in 'forall a -> ty', ty has kind TYPE r for some r. Fixes #24176 - - - - - 010fb784 by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Remove incorrect haddock link quotes in code block - - - - - cda9c12d by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Remove cycle from group haddock example - - - - - 495265b9 by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Use repl haddock syntax in group docs - - - - - d134d1de by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Use list [] notation in group haddock - - - - - dfcf629c by Owen Shepherd at 2023-12-03T00:10:10-05:00 docs(NonEmpty/group): Specify final property of group function in haddock - - - - - cad3b734 by Owen Shepherd at 2023-12-03T00:10:10-05:00 fix: Add missing property of List.group - - - - - bad37656 by Matthew Pickering at 2023-12-03T00:10:46-05:00 testsuite: Fix T21097b test with make 4.1 (deb9) cee81370cd6ef256f66035e3116878d4cb82e28b recently added a test which failed on deb9 because the version of make was emitting the recipe failure to stdout rather than stderr. One way to fix this is to be more precise in the test about which part of the output we care about inspecting. - - - - - 5efdf421 by Matthew Pickering at 2023-12-03T00:11:21-05:00 testsuite: Track size of libdir in bytes For consistency it's better if we track all size metrics in bytes. Metric Increase: libdir - - - - - f5eb0f29 by Matthew Pickering at 2023-12-03T00:11:22-05:00 testsuite: Remove rogue trace in testsuite I accidentally left a trace in the generics metric patch. - - - - - d5610737 by Claudio Bley at 2023-12-06T16:13:33-05:00 Only exit ghci in -e mode when :add command fails Previously, when running `ghci -e ':add Sample.hs'` the process would exit with exit code 1 if the file exists and could be loaded. Fixes #24115 - - - - - 0f0c53a5 by Vladislav Zavialov at 2023-12-06T16:14:09-05:00 T2T in Patterns (#23739) This patch implements the T2T (term-to-type) transformation in patterns. Patterns that are checked against a visible forall can now be written without the `type` keyword: \(type t) (x :: t) -> ... -- old \t (x :: t) -> ... -- new The `t` binder is parsed and renamed as a term pattern (Pat), but then undergoes a conversion to a type pattern (HsTyPat). See the new function pat_to_type_pat in compiler/GHC/Tc/Gen/Pat.hs - - - - - 10a1a6c6 by Sebastian Graf at 2023-12-06T16:14:45-05:00 Pmc: Fix SrcLoc and warning for incomplete irrefutable pats (#24234) Before, the source location would point at the surrounding function definition, causing the confusion in #24234. I also took the opportunity to introduce a new `LazyPatCtx :: HsMatchContext _` to make the warning message say "irrefutable pattern" instead of "pattern binding". - - - - - 36b9a38c by Matthew Pickering at 2023-12-06T16:15:21-05:00 libraries: Bump filepath to 1.4.200.1 and unix to 2.8.4.0 Updates filepath submodule Updates unix submodule Fixes #24240 - - - - - 91ff0971 by Matthew Pickering at 2023-12-06T16:15:21-05:00 Submodule linter: Allow references to tags We modify the submodule linter so that if the bumped commit is a specific tag then the commit is accepted. Fixes #24241 - - - - - 86f652dc by Zubin Duggal at 2023-12-06T16:15:21-05:00 hadrian: set -Wno-deprecations for directory and Win32 The filepath bump to 1.4.200.1 introduces a deprecation warning. See https://gitlab.haskell.org/ghc/ghc/-/issues/24240 https://github.com/haskell/filepath/pull/206 - - - - - 7ac6006e by Sylvain Henry at 2023-12-06T16:16:02-05:00 Zap OccInfo on case binders during StgCse #14895 #24233 StgCse can revive dead binders: case foo of dead { Foo x y -> Foo x y; ... } ===> case foo of dead { Foo x y -> dead; ... } -- dead is no longer dead So we must zap occurrence information on case binders. Fix #14895 and #24233 - - - - - 57c391c4 by Sebastian Graf at 2023-12-06T16:16:37-05:00 Cpr: Turn an assertion into a check to deal with some dead code (#23862) See the new `Note [Dead code may contain type confusions]`. Fixes #23862. - - - - - c1c8abf8 by Zubin Duggal at 2023-12-08T02:25:07-05:00 testsuite: add test for #23944 - - - - - 6329d308 by Zubin Duggal at 2023-12-08T02:25:07-05:00 driver: Only run a dynamic-too pipeline if object files are going to be generated Otherwise we run into a panic in hscMaybeWriteIface: "Unexpected DT_Dyn state when writing simple interface" when dynamic-too is enabled We could remove the panic and just write the interface even if the state is `DT_Dyn`, but it seems pointless to run the pipeline twice when `hscMaybeWriteIface` is already designed to write both `hi` and `dyn_hi` files if dynamic-too is enabled. Fixes #23944. - - - - - 28811f88 by Simon Peyton Jones at 2023-12-08T05:47:18-05:00 Improve duplicate elimination in SpecConstr This partially fixes #24229. See the new Note [Pattern duplicate elimination] in SpecConstr - - - - - fec7894f by Simon Peyton Jones at 2023-12-08T05:47:18-05:00 Make SpecConstr deal with casts better This patch does two things, to fix #23209: * It improves SpecConstr so that it no longer quantifies over coercion variables. See Note [SpecConstr and casts] * It improves the rule matcher to deal nicely with the case where the rule does not quantify over coercion variables, but the the template has a cast in it. See Note [Casts in the template] - - - - - 8db8d2fd by Zubin Duggal at 2023-12-08T05:47:54-05:00 driver: Don't lose track of nodes when we fail to resolve cycles The nodes that take part in a cycle should include both hs-boot and hs files, but when we fail to resolve a cycle, we were only counting the nodes from the graph without boot files. Fixes #24196 - - - - - c5b4efd3 by Zubin Duggal at 2023-12-08T05:48:30-05:00 testsuite: Skip MultiLayerModulesTH_OneShot on darwin See #24177 - - - - - fae472a9 by Wendao Lee at 2023-12-08T05:49:12-05:00 docs(Data.Char):Add more detailed descriptions for some functions Related changed function's docs: -GHC.Unicode.isAlpha -GHC.Unicode.isPrint -GHC.Unicode.isAlphaNum Add more details for what the function will return. Co-authored-by: Bodigrim <andrew.lelechenko at gmail.com> - - - - - ca7510e4 by Malik Ammar Faisal at 2023-12-08T05:49:55-05:00 Fix float parsing in GHC Cmm Lexer Add test case for bug #24224 - - - - - d8baa1bd by Simon Peyton Jones at 2023-12-08T15:40:37+00:00 Take care when simplifying unfoldings This MR fixes a very subtle bug exposed by #24242. See Note [Environment for simplLetUnfolding]. I also updated a bunch of Notes on shadowing - - - - - 03ca551d by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Comments only in FloatIn Relevant to #3458 - - - - - 50c78779 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Comments only in SpecConstr - - - - - 9431e195 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Add test for #22238 - - - - - d9e4c597 by Vladislav Zavialov at 2023-12-11T04:19:34-05:00 Make forall a keyword (#23719) Before this change, GHC used to accept `forall` as a term-level identifier: -- from constraints-0.13 forall :: forall p. (forall a. Dict (p a)) -> Dict (Forall p) forall d = ... Now it is a parse error. The -Wforall-identifier warning has served its purpose and is now a deprecated no-op. - - - - - 58d56644 by Zubin Duggal at 2023-12-11T04:20:10-05:00 driver: Ensure we actually clear the interactive context before reloading Previously we called discardIC, but immediately after set the session back to an old HscEnv that still contained the IC Partially addresses #24107 Fixes #23405 - - - - - 8e5745a0 by Zubin Duggal at 2023-12-11T04:20:10-05:00 driver: Ensure we force the lookup of old build artifacts before returning the build plan This prevents us from retaining all previous build artifacts in memory until a recompile finishes, instead only retaining the exact artifacts we need. Fixes #24118 - - - - - 105c370c by Zubin Duggal at 2023-12-11T04:20:10-05:00 testsuite: add test for #24118 and #24107 MultiLayerModulesDefsGhci was not able to catch the leak because it uses :l which discards the previous environment. Using :r catches both of these leaks - - - - - e822ff88 by Zubin Duggal at 2023-12-11T04:20:10-05:00 compiler: Add some strictness annotations to ImportSpec and related constructors This prevents us from retaining entire HscEnvs. Force these ImportSpecs when forcing the GlobalRdrEltX Adds an NFData instance for Bag Fixes #24107 - - - - - 522c12a4 by Zubin Duggal at 2023-12-11T04:20:10-05:00 compiler: Force IfGlobalRdrEnv in NFData instance. - - - - - 188b280d by Arnaud Spiwack at 2023-12-11T15:33:31+01:00 LinearTypes => MonoLocalBinds - - - - - 8e0446df by Arnaud Spiwack at 2023-12-11T15:44:28+01:00 Linear let and where bindings For expediency, the initial implementation of linear types in GHC made it so that let and where binders would always be considered unrestricted. This was rather unpleasant, and probably a big obstacle to adoption. At any rate, this was not how the proposal was designed. This patch fixes this infelicity. It was surprisingly difficult to build, which explains, in part, why it took so long to materialise. As of this patch, let or where bindings marked with %1 will be linear (respectively %p for an arbitrary multiplicity p). Unmarked let will infer their multiplicity. Here is a prototypical example of program that used to be rejected and is accepted with this patch: ```haskell f :: A %1 -> B g :: B %1 -> C h :: A %1 -> C h x = g y where y = f x ``` Exceptions: - Recursive let are unrestricted, as there isn't a clear semantics of what a linear recursive binding would be. - Destructive lets with lazy bindings are unrestricted, as their desugaring isn't linear (see also #23461). - (Strict) destructive lets with inferred polymorphic type are unrestricted. Because the desugaring isn't linear (See #18461 down-thread). Closes #18461 and #18739 Co-authored-by: @jackohughes - - - - - effa7e2d by Matthew Craven at 2023-12-12T04:37:20-05:00 Introduce `dataToTagSmall#` primop (closes #21710) ...and use it to generate slightly better code when dataToTag# is used at a "small data type" where there is no need to mess with "is_too_big_tag" or potentially look at an info table. Metric Decrease: T18304 - - - - - 35c7aef6 by Matthew Craven at 2023-12-12T04:37:20-05:00 Fix formatting of Note [alg-alt heap check] - - - - - 7397c784 by Oleg Grenrus at 2023-12-12T04:37:56-05:00 Allow untyped brackets in typed splices and vice versa. Resolves #24190 Apparently the check was essentially always (as far as I can trace back: d0d47ba76f8f0501cf3c4966bc83966ab38cac27), and while it does catch some mismatches, the type-checker will catch them too. OTOH, it prevents writing completely reasonable programs. - - - - - a3ee3b99 by Moritz Angermann at 2023-12-12T19:50:58-05:00 Drop hard Xcode dependency XCODE_VERSION calls out to `xcodebuild`, which is only available when having `Xcode` installed. The CommandLineTools are not sufficient. To install Xcode, you must have an apple id to download the Xcode.xip from apple. We do not use xcodebuild anywhere in our build explicilty. At best it appears to be a proxy for checking the linker or the compiler. These should rather be done with ``` xcrun ld -version ``` or similar, and not by proxy through Xcode. The CLR should be sufficient for building software on macOS. - - - - - 1c9496e0 by Vladislav Zavialov at 2023-12-12T19:51:34-05:00 docs: update information on RequiredTypeArguments Update the User's Guide and Release Notes to account for the recent progress in the implementation of RequiredTypeArguments. - - - - - d0b17576 by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Fix off-by-one in assertion Previously we failed to account for the NULL terminator `postString` asserted that there is enough room in the buffer for the string. - - - - - a10f9b9b by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Honor result of ensureRoomForVariableEvent is Previously we would keep plugging along, even if isn't enough room for the event. - - - - - 0e0f41c0 by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Avoid truncating event sizes Previously ensureRoomForVariableEvent would truncate the desired size to 16-bits, resulting in #24197. Fixes #24197. - - - - - 64e724c8 by Artin Ghasivand at 2023-12-13T06:34:20-05:00 Remove the "Derived Constraint" argument of TcPluginSolver, docs - - - - - fe6d97dd by Vladislav Zavialov at 2023-12-13T06:34:56-05:00 EPA: Move tokens into GhcPs extension fields (#23447) Summary of changes * Remove Language.Haskell.Syntax.Concrete * Move all tokens into GhcPs extension fields (LHsToken -> EpToken) * Create new TTG extension fields as needed * Drop the MultAnn wrapper Updates the haddock submodule. Co-authored-by: Alan Zimmerman <alan.zimm at gmail.com> - - - - - 8106e695 by Zubin Duggal at 2023-12-13T06:35:34-05:00 testsuite: use copy_files in T23405 This prevents the tree from being dirtied when the file is modified. - - - - - ed0e4099 by Bryan Richter at 2023-12-14T04:30:53-05:00 Document ghc package's PVP-noncompliance This changes nothing, it just makes the status quo explicit. - - - - - 8bef8d9f by Luite Stegeman at 2023-12-14T04:31:33-05:00 JS: Mark spurious CI failures js_fragile(24259) This marks the spurious test failures on the JS platform as js_fragile(24259), so we don't hold up merge requests while fixing the underlying issues. See #24259 - - - - - 1c79526a by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Late plugins - - - - - 000c3302 by Finley McIlwaine at 2023-12-15T12:24:40-08:00 withTiming on LateCCs and late plugins - - - - - be4551ac by Finley McIlwaine at 2023-12-15T12:24:40-08:00 add test for late plugins - - - - - 7c29da9f by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Document late plugins - - - - - 9a52ae46 by Ben Gamari at 2023-12-20T07:07:26-05:00 Fix thunk update ordering Previously we attempted to ensure soundness of concurrent thunk update by synchronizing on the access of the thunk's info table pointer field. This was believed to be sufficient since the indirectee (which may expose a closure allocated by another core) would not be examined until the info table pointer update is complete. However, it turns out that this can result in data races in the presence of multiple threads racing a update a single thunk. For instance, consider this interleaving under the old scheme: Thread A Thread B --------- --------- t=0 Enter t 1 Push update frame 2 Begin evaluation 4 Pause thread 5 t.indirectee=tso 6 Release t.info=BLACKHOLE 7 ... (e.g. GC) 8 Resume thread 9 Finish evaluation 10 Relaxed t.indirectee=x 11 Load t.info 12 Acquire fence 13 Inspect t.indirectee 14 Release t.info=BLACKHOLE Here Thread A enters thunk `t` but is soon paused, resulting in `t` being lazily blackholed at t=6. Then, at t=10 Thread A finishes evaluation and updates `t.indirectee` with a relaxed store. Meanwhile, Thread B enters the blackhole. Under the old scheme this would introduce an acquire-fence but this would only synchronize with Thread A at t=6. Consequently, the result of the evaluation, `x`, is not visible to Thread B, introducing a data race. We fix this by treating the `indirectee` field as we do all other mutable fields. This means we must always access this field with acquire-loads and release-stores. See #23185. - - - - - f4b53538 by Vladislav Zavialov at 2023-12-20T07:08:02-05:00 docs: Fix link to 051-ghc-base-libraries.rst The proposal is no longer available at the previous URL. - - - - - f7e21fab by Matthew Pickering at 2023-12-21T14:57:40+00:00 hadrian: Build all executables in bin/ folder In the end the bindist creation logic copies them all into the bin folder. There is no benefit to building a specific few binaries in the lib/bin folder anymore. This also removes the ad-hoc logic to copy the touchy and unlit executables from stage0 into stage1. It takes <1s to build so we might as well just build it. - - - - - 0038d052 by Zubin Duggal at 2023-12-22T23:28:00-05:00 testsuite: mark jspace as fragile on i386. This test has been flaky for some time and has been failing consistently on i386-linux since 8e0446df landed. See #24261 - - - - - dfd670a0 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 609e6225 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 865513b2 by Ömer Sinan Ağacan at 2023-12-24T10:11:13-05:00 Fix BNF in user manual 6.6.8.2: formal syntax for instance declarations - - - - - c247b6be by Zubin Duggal at 2023-12-25T16:01:23-05:00 docs: document permissibility of -XOverloadedLabels (#24249) Document the permissibility introduced by https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst - - - - - e5b7eb59 by Ömer Sinan Ağacan at 2023-12-25T16:02:03-05:00 Fix a code block syntax in user manual sec. 6.8.8.6 - - - - - 2db11c08 by Ben Gamari at 2023-12-29T15:35:48-05:00 genSym: Reimplement via CAS on 32-bit platforms Previously the remaining use of the C implementation on 32-bit platforms resulted in a subtle bug, #24261. This was due to the C object (which used the RTS's `atomic_inc64` macro) being compiled without `-threaded` yet later being used in a threaded compiler. Side-step this issue by using the pure Haskell `genSym` implementation on all platforms. This required implementing `fetchAddWord64Addr#` in terms of CAS on 64-bit platforms. - - - - - 19328a8c by Xiaoyan Ren at 2023-12-29T15:36:30-05:00 Do not color the diagnostic code in error messages (#24172) - - - - - 685b467c by Krzysztof Gogolewski at 2023-12-29T15:37:06-05:00 Enforce that bindings of implicit parameters are lifted Fixes #24298 - - - - - bc4d67b7 by Matthew Craven at 2023-12-31T06:15:42-05:00 StgToCmm: Detect some no-op case-continuations ...and generate no code for them. Fixes #24264. - - - - - 5b603139 by Krzysztof Gogolewski at 2023-12-31T06:16:18-05:00 Revert "testsuite: mark jspace as fragile on i386." This reverts commit 0038d052c8c80b4b430bb2aa1c66d5280be1aa95. The atomicity bug should be fixed by !11802. - - - - - d55216ad by Krzysztof Gogolewski at 2024-01-01T12:05:49-05:00 Refactor: store [[PrimRep]] rather than [Type] in STG StgConApp stored a list of types. This list was used exclusively during unarisation of unboxed sums (mkUbxSum). However, this is at a wrong level of abstraction: STG shouldn't be concerned with Haskell types, only PrimReps. Update the code to store a [[PrimRep]]. Also, there's no point in storing this list when we're not dealing with an unboxed sum. - - - - - 8b340bc7 by Ömer Sinan Ağacan at 2024-01-01T12:06:29-05:00 Kind signatures docs: mention that they're allowed in newtypes - - - - - 989bf8e5 by Zubin Duggal at 2024-01-03T20:08:47-05:00 ci: Ensure we use the correct bindist name for the test artifact when generating release ghcup metadata Fixes #24268 - - - - - 89299a89 by Krzysztof Gogolewski at 2024-01-03T20:09:23-05:00 Refactor: remove calls to typePrimRepArgs The function typePrimRepArgs is just a thin wrapper around typePrimRep, adding a VoidRep if the list is empty. However, in StgToByteCode, we were discarding that VoidRep anyway, so there's no point in calling it. - - - - - c7be0c68 by mmzk1526 at 2024-01-03T20:10:07-05:00 Use "-V" for alex version check for better backward compatibility Fixes #24302. In recent versions of alex, "-v" is used for "--verbose" instead of "-version". - - - - - 67dbcc0a by Krzysztof Gogolewski at 2024-01-05T02:07:18-05:00 Fix VoidRep handling in ghci debugger 'go' inside extractSubTerms was giving a bad result given a VoidRep, attempting to round towards the next multiple of 0. I don't understand much about the debugger but the code should be better than it was. Fixes #24306 - - - - - 90ea574e by Krzysztof Gogolewski at 2024-01-05T02:07:54-05:00 VoidRep-related refactor * In GHC.StgToByteCode, replace bcIdPrimId with idPrimRep, bcIdArgRep with idArgRep, atomPrimRep with stgArgRep1. All of them were duplicates. * In GHC.Stg.Unarise, we were converting a PrimRep to a Type and back to PrimRep. Remove the calls to primRepToType and typePrimRep1 which cancel out. * In GHC.STG.Lint, GHC.StgToCmm, GHC.Types.RepType we were filtering out VoidRep from the result of typePrimRep. But typePrimRep never returns VoidRep - remove the filtering. - - - - - eaf72479 by brian at 2024-01-06T23:03:09-05:00 Add unaligned Addr# primops Implements CLC proposal #154: https://github.com/haskell/core-libraries-committee/issues/154 * add unaligned addr primops * add tests * accept tests * add documentation * fix js primops * uncomment in access ops * use Word64 in tests * apply suggestions * remove extra file * move docs * remove random options * use setByteArray# primop * better naming * update base-exports test * add base-exports for other architectures - - - - - d471d445 by Krzysztof Gogolewski at 2024-01-06T23:03:47-05:00 Remove VoidRep from PrimRep, introduce PrimOrVoidRep This introduces data PrimOrVoidRep = VoidRep | NVRep PrimRep changes typePrimRep1 to return PrimOrVoidRep, and adds a new function typePrimRepU to be used when the argument is definitely non-void. Details in Note [VoidRep] in GHC.Types.RepType. Fixes #19520 - - - - - 48720a07 by Matthew Craven at 2024-01-08T18:57:36-05:00 Apply Note [Sensitivity to unique increment] to LargeRecord - - - - - 9e2e180f by Sebastian Graf at 2024-01-08T18:58:13-05:00 Debugging: Add diffUFM for convenient diffing between UniqFMs - - - - - 948f3e35 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Rename Opt_D_dump_stranal to Opt_D_dump_dmdanal ... and Opt_D_dump_str_signatures to Opt_D_dump_dmd_signatures - - - - - 4e217e3e by Sebastian Graf at 2024-01-08T18:58:13-05:00 Deprecate -ddump-stranal and -ddump-str-signatures ... and suggest -ddump-dmdanal and -ddump-dmd-signatures instead - - - - - 6c613c90 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Move testsuite/tests/stranal to testsuite/tests/dmdanal A separate commit so that the rename is obvious to Git(Lab) - - - - - c929f02b by Sebastian Graf at 2024-01-08T18:58:13-05:00 CoreSubst: Stricten `substBndr` and `cloneBndr` Doing so reduced allocations of `cloneBndr` by about 25%. ``` T9233(normal) ghc/alloc 672,488,656 663,083,216 -1.4% GOOD T9675(optasm) ghc/alloc 423,029,256 415,812,200 -1.7% geo. mean -0.1% minimum -1.7% maximum +0.1% ``` Metric Decrease: T9233 - - - - - e3ca78f3 by Krzysztof Gogolewski at 2024-01-10T17:35:59-05:00 Deprecate -Wsemigroup This warning was used to prepare for Semigroup becoming a superclass of Monoid, and for (<>) being exported from Prelude. This happened in GHC 8.4 in 8ae263ceb3566 and feac0a3bc69fd3. The leftover logic for (<>) has been removed in GHC 9.8, 4d29ecdfcc79. Now the warning does nothing at all and can be deprecated. - - - - - 08d14925 by amesgen at 2024-01-10T17:36:42-05:00 WASM metadata: use correct GHC version - - - - - 7a808419 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Allow SCC declarations in TH (#24081) - - - - - 28827c51 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Fix prettyprinting of SCC pragmas - - - - - ae9cc1a8 by Matthew Craven at 2024-01-10T17:38:01-05:00 Fix loopification in the presence of void arguments This also removes Note [Void arguments in self-recursive tail calls], which was just misleading. It's important to count void args both in the function's arity and at the call site. Fixes #24295. - - - - - b718b145 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: Teach testsuite driver about c++ sources - - - - - 09cb57ad by Zubin Duggal at 2024-01-10T17:38:36-05:00 driver: Set -DPROFILING when compiling C++ sources with profiling Earlier, we used to pass all preprocessor flags to the c++ compiler. This meant that -DPROFILING was passed to the c++ compiler because it was a part of C++ flags However, this was incorrect and the behaviour was changed in 8ff3134ed4aa323b0199ad683f72165e51a59ab6. See #21291. But that commit exposed this bug where -DPROFILING was no longer being passed when compiling c++ sources. The fix is to explicitly include -DPROFILING in `opt_cxx` when profiling is enabled to ensure we pass the correct options for the way to both C and C++ compilers Fixes #24286 - - - - - 2cf9dd96 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: rename objcpp -> objcxx To avoid confusion with C Pre Processsor - - - - - af6932d6 by Simon Peyton Jones at 2024-01-10T17:39:12-05:00 Make TYPE and CONSTRAINT not-apart Issue #24279 showed up a bug in the logic in GHC.Core.Unify.unify_ty which is supposed to make TYPE and CONSTRAINT be not-apart. Easily fixed. - - - - - 4a39b5ff by Zubin Duggal at 2024-01-10T17:39:48-05:00 ci: Fix typo in mk_ghcup_metadata.py There was a missing colon in the fix to #24268 in 989bf8e53c08eb22de716901b914b3607bc8dd08 - - - - - 13503451 by Zubin Duggal at 2024-01-10T17:40:24-05:00 release-ci: remove release-x86_64-linux-deb11-release+boot_nonmoving_gc job There is no reason to have this release build or distribute this variation. This configuration is for testing purposes only. - - - - - afca46a4 by Sebastian Graf at 2024-01-10T17:41:00-05:00 Parser: Add a Note detailing why we need happy's `error` to implement layout - - - - - eaf8a06d by Krzysztof Gogolewski at 2024-01-11T00:43:17+01:00 Turn -Wtype-equality-out-of-scope on by default Also remove -Wnoncanonical-{monoid,monad}-instances from -Wcompat, since they are enabled by default. Refresh wcompat-warnings/ test with new -Wcompat warnings. Part of #24267 Co-authored-by: sheaf <sam.derbyshire at gmail.com> - - - - - 42bee5aa by Sebastian Graf at 2024-01-12T21:16:21-05:00 Arity: Require called *exactly once* for eta exp with -fpedantic-bottoms (#24296) In #24296, we had a program in which we eta expanded away an error despite the presence of `-fpedantic-bottoms`. This was caused by turning called *at least once* lambdas into one-shot lambdas, while with `-fpedantic-bottoms` it is only sound to eta expand over lambdas that are called *exactly* once. An example can be found in `Note [Combining arity type with demand info]`. Fixes #24296. - - - - - 7e95f738 by Andreas Klebinger at 2024-01-12T21:16:57-05:00 Aarch64: Enable -mfma by default. Fixes #24311 - - - - - e43788d0 by Jason Shipman at 2024-01-14T12:47:38-05:00 Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat CLC proposal #226 https://github.com/haskell/core-libraries-committee/issues/226 - - - - - ae6d8cd2 by Sebastian Graf at 2024-01-14T12:48:15-05:00 Pmc: COMPLETE pragmas associated with Family TyCons should apply to representation TyCons as well (#24326) Fixes #24326. - - - - - c5fc7304 by sheaf at 2024-01-15T14:15:29-05:00 Use lookupOccRn_maybe in TH.lookupName When looking up a value, we want to be able to find both variables and record fields. So we should not use the lookupSameOccRn_maybe function, as we can't know ahead of time which record field namespace a record field with the given textual name will belong to. Fixes #24293 - - - - - da908790 by Krzysztof Gogolewski at 2024-01-15T14:16:05-05:00 Make the build more strict on documentation errors * Detect undefined labels. This can be tested by adding :ref:`nonexistent` to a documentation rst file; attempting to build docs will fail. Fixed the undefined label in `9.8.1-notes.rst`. * Detect errors. While we have plenty of warnings, we can at least enforce that Sphinx does not report errors. Fixed the error in `required_type_arguments.rst`. Unrelated change: I have documented that the `-dlint` enables `-fcatch-nonexhaustive-cases`, as can be verified by checking `enableDLint`. - - - - - 5077416e by Javier Sagredo at 2024-01-16T15:40:06-05:00 Profiling: Adds an option to not start time profiling at startup Using the functionality provided by d89deeba47ce04a5198a71fa4cbc203fe2c90794, this patch creates a new rts flag `--no-automatic-time-samples` which disables the time profiling when starting a program. It is then expected that the user starts it whenever it is needed. Fixes #24337 - - - - - 5776008c by Matthew Pickering at 2024-01-16T15:40:42-05:00 eventlog: Fix off-by-one error in postIPE We were missing the extra_comma from the calculation of the size of the payload of postIPE. This was causing assertion failures when the event would overflow the buffer by one byte, as ensureRoomForVariable event would report there was enough space for `n` bytes but then we would write `n + 1` bytes into the buffer. Fixes #24287 - - - - - 66dc09b1 by Simon Peyton Jones at 2024-01-16T15:41:18-05:00 Improve SpecConstr (esp nofib/spectral/ansi) This MR makes three improvements to SpecConstr: see #24282 * It fixes an outright (and recently-introduced) bug in `betterPat`, which was wrongly forgetting to compare the lengths of the argument lists. * It enhances ConVal to inclue a boolean for work-free-ness, so that the envt can contain non-work-free constructor applications, so that we can do more: see Note [ConVal work-free-ness] * It rejigs `subsumePats` so that it doesn't reverse the list. This can make a difference because, when patterns overlap, we arbitrarily pick the first. There is no "right" way, but this retains the old pre-subsumePats behaviour, thereby "fixing" the regression in #24282. Nofib results +======================================== | spectral/ansi -21.14% | spectral/hartel/comp_lab_zift -0.12% | spectral/hartel/parstof +0.09% | spectral/last-piece -2.32% | spectral/multiplier +6.03% | spectral/para +0.60% | spectral/simple -0.26% +======================================== | geom mean -0.18% +---------------------------------------- The regression in `multiplier` is sad, but it simply replicates GHC's previous behaviour (e.g. GHC 9.6). - - - - - 65da79b3 by Matthew Pickering at 2024-01-16T15:41:54-05:00 hadrian: Reduce Cabal verbosity The comment claims that `simpleUserHooks` decrease verbosity, and it does, but only for the `postConf` phase. The other phases are too verbose with `-V`. At the moment > 5000 lines of the build log are devoted to output from `cabal copy`. So I take the simple approach and just decrease the verbosity level again. If the output of `postConf` is essential then it would be better to implement our own `UserHooks` which doesn't decrease the verbosity for `postConf`. Fixes #24338 - - - - - 16414d7d by Matthew Pickering at 2024-01-17T10:54:59-05:00 Stop retaining old ModGuts throughout subsequent simplifier phases Each phase of the simplifier typically rewrites the majority of ModGuts, so we want to be able to release the old ModGuts as soon as possible. `name_ppr_ctxt` lives throught the whole optimiser phase and it was retaining a reference to `ModGuts`, so we were failing to release the old `ModGuts` until the end of the phase (potentially doubling peak memory usage for that particular phase). This was discovered using eras profiling (#24332) Fixes #24328 - - - - - 7f0879e1 by Matthew Pickering at 2024-01-17T10:55:35-05:00 Update nofib submodule - - - - - 320454d3 by Cheng Shao at 2024-01-17T23:02:40+00:00 ci: bump ci-images for updated wasm image - - - - - 2eca52b4 by Cheng Shao at 2024-01-17T23:06:44+00:00 base: treat all FDs as "nonblocking" on wasm On posix platforms, when performing read/write on FDs, we check the nonblocking flag first. For FDs without this flag (e.g. stdout), we call fdReady() first, which in turn calls poll() to wait for I/O to be available on that FD. This is problematic for wasm32-wasi: although select()/poll() is supported via the poll_oneoff() wasi syscall, that syscall is rather heavyweight and runtime behavior differs in different wasi implementations. The issue is even worse when targeting browsers, given there's no satisfactory way to implement async I/O as a synchronous syscall, so existing JS polyfills for wasi often give up and simply return ENOSYS. Before we have a proper I/O manager that avoids poll_oneoff() for async I/O on wasm, this patch improves the status quo a lot by merely pretending all FDs are "nonblocking". Read/write on FDs will directly invoke read()/write(), which are much more reliably handled in existing wasi implementations, especially those in browsers. Fixes #23275 and the following test cases: T7773 isEOF001 openFile009 T4808 cgrun025 Approved by CLC proposal #234: https://github.com/haskell/core-libraries-committee/issues/234 - - - - - 83c6c710 by Andrew Lelechenko at 2024-01-18T05:21:49-05:00 base: clarify how to disable warnings about partiality of Data.List.{head,tail} - - - - - c4078f2f by Simon Peyton Jones at 2024-01-18T05:22:25-05:00 Fix four bug in handling of (forall cv. body_ty) These bugs are all described in #24335 It's not easy to provoke the bug, hence no test case. - - - - - 119586ea by Alexis King at 2024-01-19T00:08:00-05:00 Always refresh profiling CCSes after running pending initializers Fixes #24171. - - - - - 9718d970 by Oleg Grenrus at 2024-01-19T00:08:36-05:00 Set default-language: GHC2021 in ghc library Go through compiler/ sources, and remove all BangPatterns (and other GHC2021 enabled extensions in these files). - - - - - 3ef71669 by Matthew Pickering at 2024-01-19T21:55:16-05:00 testsuite: Remove unused have_library function Also remove the hence unused testsuite option `--test-package-db`. Fixes #24342 - - - - - 5b7fa20c by Jade at 2024-01-19T21:55:53-05:00 Fix Spelling in the compiler Tracking: #16591 - - - - - 09875f48 by Matthew Pickering at 2024-01-20T12:20:44-05:00 testsuite: Implement `isInTreeCompiler` in a more robust way Just a small refactoring to avoid redundantly specifying the same strings in two different places. - - - - - 0d12b987 by Jade at 2024-01-20T12:21:20-05:00 Change maintainer email from cvs-ghc at haskell.org to ghc-devs at haskell.org. Fixes #22142 - - - - - 1fa1c00c by Jade at 2024-01-23T19:17:03-05:00 Enhance Documentation of functions exported by Data.Function This patch aims to improve the documentation of functions exported in Data.Function Tracking: #17929 Fixes: #10065 - - - - - ab47a43d by Jade at 2024-01-23T19:17:39-05:00 Improve documentation of hGetLine. - Add explanation for whether a newline is returned - Add examples Fixes #14804 - - - - - dd4af0e5 by Cheng Shao at 2024-01-23T19:18:17-05:00 Fix genapply for cross-compilation by nuking fragile CPP logic This commit fixes incorrectly built genapply when cross compiling (#24347) by nuking all fragile CPP logic in it from the orbit. All target-specific info are now read from DerivedConstants.h at runtime, see added note for details. Also removes a legacy Makefile and adds haskell language server support for genapply. - - - - - 0cda2b8b by Cheng Shao at 2024-01-23T19:18:17-05:00 rts: enable wasm32 register mapping The wasm backend didn't properly make use of all Cmm global registers due to #24347. Now that it is fixed, this patch re-enables full register mapping for wasm32, and we can now generate smaller & faster wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152. - - - - - 0325a6e5 by Greg Steuck at 2024-01-24T01:29:44-05:00 Avoid utf8 in primops.txt.pp comments They don't make it through readFile' without explicitly setting the encoding. See https://gitlab.haskell.org/ghc/ghc/-/issues/17755 - - - - - 1aaf0bd8 by David Binder at 2024-01-24T01:30:20-05:00 Bump hpc and hpc-bin submodule Bump hpc to 0.7.0.1 Bump hpc-bin to commit d1780eb2 - - - - - e693a4e8 by Ben Gamari at 2024-01-24T01:30:56-05:00 testsuite: Ignore stderr in T8089 Otherwise spurious "Killed: 9" messages to stderr may cause the test to fail. Fixes #24361. - - - - - a40f4ab2 by sheaf at 2024-01-24T14:04:33-05:00 Fix FMA instruction on LLVM We were emitting the wrong instructions for fused multiply-add operations on LLVM: - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd" - LLVM does not support other instructions such as "fmsub"; instead we implement these by flipping signs of some arguments - the instruction is an LLVM intrinsic, which requires handling it like a normal function call instead of a machine instruction Fixes #24223 - - - - - 69abc786 by Andrei Borzenkov at 2024-01-24T14:05:09-05:00 Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291) - - - - - 0ac8f385 by Cheng Shao at 2024-01-25T00:27:48-05:00 compiler: remove unused GHC.Linker module The GHC.Linker module is empty and unused, other than as a hack for the make build system. We can remove it now that make is long gone; the note is moved to GHC.Linker.Loader instead. - - - - - 699da01b by Hécate Moonlight at 2024-01-25T00:28:27-05:00 Clarification for newtype constructors when using `coerce` - - - - - b2d8cd85 by Matt Walker at 2024-01-26T09:50:08-05:00 Fix #24308 Add tests for semicolon separated where clauses - - - - - 0da490a1 by Ben Gamari at 2024-01-26T17:34:41-05:00 hsc2hs: Bump submodule - - - - - 3f442fd2 by Ben Gamari at 2024-01-26T17:34:41-05:00 Bump containers submodule to 0.7 - - - - - 82a1c656 by Sebastian Nagel at 2024-01-29T02:32:40-05:00 base: with{Binary}File{Blocking} only annotates own exceptions Fixes #20886 This ensures that inner, unrelated exceptions are not misleadingly annotated with the opened file. - - - - - 9294a086 by Andreas Klebinger at 2024-01-29T02:33:15-05:00 Fix fma warning when using llvm on aarch64. On aarch64 fma is always on so the +fma flag doesn't exist for that target. Hence no need to try and pass +fma to llvm. Fixes #24379 - - - - - ced2e731 by sheaf at 2024-01-29T17:27:12-05:00 No shadowing warnings for NoFieldSelector fields This commit ensures we don't emit shadowing warnings when a user shadows a field defined with NoFieldSelectors. Fixes #24381 - - - - - 8eeadfad by Patrick at 2024-01-29T17:27:51-05:00 Fix bug wrong span of nested_doc_comment #24378 close #24378 1. Update the start position of span in `nested_doc_comment` correctly. and hence the spans of identifiers of haddoc can be computed correctly. 2. add test `HaddockSpanIssueT24378`. - - - - - a557580f by Alexey Radkov at 2024-01-30T19:41:52-05:00 Fix irrelevant dodgy-foreign-imports warning on import f-pointers by value A test *сс018* is attached (not sure about the naming convention though). Note that without the fix, the test fails with the *dodgy-foreign-imports* warning passed to stderr. The warning disappears after the fix. GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as ```haskell foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ()) ``` where ```c void (*f)(int); ``` See a related real-world use-case [here](https://gitlab.com/daniel-casanueva/pcre-light/-/merge_requests/17). There, GHC warns on import of C function pointer `pcre_free`. - - - - - ca99efaf by Alexey Radkov at 2024-01-30T19:41:53-05:00 Rename test cc018 -> T24034 - - - - - 88c38dd5 by Ben Gamari at 2024-01-30T19:42:28-05:00 rts/TraverseHeap.c: Ensure that PosixSource.h is included first - - - - - ca2e919e by Simon Peyton Jones at 2024-01-31T09:29:45+00:00 Make decomposeRuleLhs a bit more clever This fixes #24370 by making decomposeRuleLhs undertand dictionary /functions/ as well as plain /dictionaries/ - - - - - 94ce031d by Teo Camarasu at 2024-02-01T05:49:49-05:00 doc: Add -Dn flag to user guide Resolves #24394 - - - - - 31553b11 by Ben Gamari at 2024-02-01T12:21:29-05:00 cmm: Introduce MO_RelaxedRead In hand-written Cmm it can sometimes be necessary to atomically load from memory deep within an expression (e.g. see the `CHECK_GC` macro). This MachOp provides a convenient way to do so without breaking the expression into multiple statements. - - - - - 0785cf81 by Ben Gamari at 2024-02-01T12:21:29-05:00 codeGen: Use relaxed accesses in ticky bumping - - - - - be423dda by Ben Gamari at 2024-02-01T12:21:29-05:00 base: use atomic write when updating timer manager - - - - - 8a310e35 by Ben Gamari at 2024-02-01T12:21:29-05:00 Use relaxed atomics to manipulate TSO status fields - - - - - d6809ee4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Add necessary barriers when manipulating TSO owner - - - - - 39e3ac5d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Use `switch` to branch on why_blocked This is a semantics-preserving refactoring. - - - - - 515eb33d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix synchronization on thread blocking state We now use a release barrier whenever we update a thread's blocking state. This required widening StgTSO.why_blocked as AArch64 does not support atomic writes on 16-bit values. - - - - - eb38812e by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadPaused This only affects an assertion in the debug RTS and only needs relaxed ordering. - - - - - 26c48dd6 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadStatus# - - - - - 6af43ab4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in Interpreter's preemption check - - - - - 9502ad3c by Ben Gamari at 2024-02-01T12:21:29-05:00 rts/Messages: Fix data race - - - - - 60802db5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts/Prof: Fix data race - - - - - ef8ccef5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use relaxed ordering on dirty/clean info tables updates When changing the dirty/clean state of a mutable object we needn't have any particular ordering. - - - - - 76fe2b75 by Ben Gamari at 2024-02-01T12:21:30-05:00 codeGen: Use relaxed-read in closureInfoPtr - - - - - a6316eb4 by Ben Gamari at 2024-02-01T12:21:30-05:00 STM: Use acquire loads when possible Full sequential consistency is not needed here. - - - - - 6bddfd3d by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use fence rather than redundant load Previously we would use an atomic load to ensure acquire ordering. However, we now have `ACQUIRE_FENCE_ON`, which allows us to express this more directly. - - - - - 55c65dbc by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Fix data races in profiling timer - - - - - 856b5e75 by Ben Gamari at 2024-02-01T12:21:30-05:00 Add Note [C11 memory model] - - - - - 6534da24 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: move generic cmm optimization logic in NCG to a standalone module This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. - - - - - 87e34888 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. - - - - - c6ce242e by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: enable generic cmm optimizations in wasm backend NCG This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. - - - - - 151dda4e by Andrei Borzenkov at 2024-02-01T12:22:43-05:00 Namespacing for WARNING/DEPRECATED pragmas (#24396) New syntax for WARNING and DEPRECATED pragmas was added, namely namespace specifierss: namespace_spec ::= 'type' | 'data' | {- empty -} warning ::= warning_category namespace_spec namelist strings deprecation ::= namespace_spec namelist strings A new data type was introduced to represent these namespace specifiers: data NamespaceSpecifier = NoSpecifier | TypeNamespaceSpecifier (EpToken "type") | DataNamespaceSpecifier (EpToken "data") Extension field XWarning now contains this NamespaceSpecifier. lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier and checks that the namespace of the found names matches the passed flag. With this change {-# WARNING data D "..." #-} pragma will only affect value namespace and {-# WARNING type D "..." #-} will only affect type namespace. The same logic is applicable to DEPRECATED pragmas. Finding duplicated warnings inside rnSrcWarnDecls now takes into consideration NamespaceSpecifier flag to allow warnings with the same names that refer to different namespaces. - - - - - 38c3afb6 by Bryan Richter at 2024-02-01T12:23:19-05:00 CI: Disable the test-cabal-reinstall job Fixes #24363 - - - - - 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - c2803b76 by Ben Gamari at 2024-03-04T22:29:56+00:00 filepath: Bump submodule to 1.5.2.0 - - - - - 6799904f by Ben Gamari at 2024-03-04T22:30:51+00:00 os-string: Bump submodule to 2.0.2 - - - - - 20 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - − .gitlab/circle-ci-job.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - − .gitlab/gen-ci.cabal - + .gitlab/generate-ci/LICENSE - + .gitlab/generate-ci/README.mkd - + .gitlab/generate-ci/flake.lock - + .gitlab/generate-ci/flake.nix - .gitlab/gen_ci.hs → .gitlab/generate-ci/gen_ci.hs - + .gitlab/generate-ci/generate-ci.cabal - + .gitlab/generate-ci/generate-job-metadata - + .gitlab/generate-ci/generate-jobs - .gitlab/hie.yaml → .gitlab/generate-ci/hie.yaml - − .gitlab/generate_job_metadata - − .gitlab/generate_jobs - .gitlab/issue_templates/bug.md → .gitlab/issue_templates/default.md The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/081dd4d535f0bbb73171ad2eb345fcaea21279d6...6799904fb12272f2cd9a047f4c821ae0bc931ce7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/081dd4d535f0bbb73171ad2eb345fcaea21279d6...6799904fb12272f2cd9a047f4c821ae0bc931ce7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 22:53:25 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 04 Mar 2024 17:53:25 -0500 Subject: [Git][ghc/ghc][wip/exception-context] 21 commits: testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e650e514ac3_4bf90e25680160f3@gitlab.mail> Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1d50acb0 by Ben Gamari at 2024-03-02T15:57:31-05:00 Bump array submodule - - - - - 47f147a8 by Ben Gamari at 2024-03-02T15:57:31-05:00 Bump stm submodule - - - - - ea099b75 by Ben Gamari at 2024-03-04T17:46:09-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 1e6c267d by Ben Gamari at 2024-03-04T17:53:11-05:00 testsuite/interface-stability: Update documentation - - - - - 368e1d7c by Ben Gamari at 2024-03-04T17:53:11-05:00 ghc-internal: comment formatting - - - - - 8c4f7b40 by Ben Gamari at 2024-03-04T17:53:11-05:00 compiler: Default and warn ExceptionContext constraints - - - - - bc9163db by Ben Gamari at 2024-03-04T17:53:11-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated mechinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 9573d836 by Ben Gamari at 2024-03-04T17:53:11-05:00 users guide: Release notes for exception backtrace work - - - - - 167ee1f8 by Ben Gamari at 2024-03-04T17:53:11-05:00 ghc-experimental: Add dummy dependencies to work around #24436 This is a temporary measure to improve CI reliability until a proper solution is developed. - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Iface/Ext/Utils.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Linker/Utils.hs - compiler/GHC/StgToJS/Utils.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Bind.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/168cb5028e8b15b32889aee2680421b4330584fc...167ee1f8282bd4e5863cc8a8732f7c32a98d4386 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/168cb5028e8b15b32889aee2680421b4330584fc...167ee1f8282bd4e5863cc8a8732f7c32a98d4386 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 22:55:42 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 04 Mar 2024 17:55:42 -0500 Subject: [Git][ghc/ghc][wip/exception-context] 7 commits: Introduce exception context Message-ID: <65e6516e15d68_4bf90113e9e818236@gitlab.mail> Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC Commits: 9440575f by Ben Gamari at 2024-03-04T17:55:25-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 54084c37 by Ben Gamari at 2024-03-04T17:55:27-05:00 testsuite/interface-stability: Update documentation - - - - - 4c52e827 by Ben Gamari at 2024-03-04T17:55:27-05:00 ghc-internal: comment formatting - - - - - 404a69cc by Ben Gamari at 2024-03-04T17:55:27-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 1843a15d by Ben Gamari at 2024-03-04T17:55:32-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 5c5c2dbf by Ben Gamari at 2024-03-04T17:55:36-05:00 users guide: Release notes for exception backtrace work - - - - - 953f0e50 by Ben Gamari at 2024-03-04T17:55:36-05:00 ghc-experimental: Add dummy dependencies to work around #24436 This is a temporary measure to improve CI reliability until a proper solution is developed. - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Types/Error/Codes.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr - libraries/base/tests/IO/openFile002.stderr - libraries/base/tests/IO/openFile002.stderr-mingw32 - libraries/base/tests/IO/withBinaryFile001.stderr - libraries/base/tests/IO/withBinaryFile002.stderr - libraries/base/tests/IO/withFile001.stderr - libraries/base/tests/IO/withFile002.stderr - libraries/base/tests/IO/withFileBlocking001.stderr - libraries/base/tests/IO/withFileBlocking002.stderr - libraries/base/tests/T15349.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/167ee1f8282bd4e5863cc8a8732f7c32a98d4386...953f0e509f9c7a96adce285bb70c45c8357a51d0 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/167ee1f8282bd4e5863cc8a8732f7c32a98d4386...953f0e509f9c7a96adce285bb70c45c8357a51d0 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 4 23:40:07 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Mon, 04 Mar 2024 18:40:07 -0500 Subject: [Git][ghc/ghc][wip/t24277] base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Message-ID: <65e65bd79145_4bf90242a8a4210dd@gitlab.mail> Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC Commits: 082a054c by Finley McIlwaine at 2024-03-04T15:34:32-08:00 base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Add functions for gettings the IDs of cost centres to the interface of `GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids, `CostCentreId`, with appropriate instances. Implements CLC proposal 235. Resolves #24277 - - - - - 9 changed files: - libraries/base/src/GHC/Exts.hs - libraries/base/src/GHC/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -84,6 +84,8 @@ module GHC.Exts traceEvent, -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, ===================================== libraries/base/src/GHC/Stack.hs ===================================== @@ -18,6 +18,7 @@ module GHC.Stack (errorWithStackTrace, -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks CallStack, @@ -37,16 +38,19 @@ module GHC.Stack -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where -import GHC.Internal.Stack \ No newline at end of file +import GHC.Internal.Stack ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -103,6 +103,8 @@ module GHC.Internal.Exts -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, lazy, oneShot, considerAccessible, ===================================== libraries/ghc-internal/src/GHC/Internal/Stack.hs ===================================== @@ -2,6 +2,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- @@ -24,6 +25,7 @@ module GHC.Internal.Stack ( -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks @@ -38,14 +40,17 @@ module GHC.Internal.Stack ( -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc ===================================== @@ -16,14 +16,17 @@ ----------------------------------------------------------------------------- {-# LANGUAGE UnboxedTuples, MagicHash, NoImplicitPrelude #-} +{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving #-} module GHC.Internal.Stack.CCS ( -- * Call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, @@ -31,7 +34,9 @@ module GHC.Internal.Stack.CCS ( ccsParent, ccLabel, ccModule, + ccId, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack, ) where @@ -44,6 +49,12 @@ import GHC.Internal.Base import GHC.Internal.Ptr import GHC.Internal.IO.Encoding import GHC.Internal.List ( concatMap, reverse ) +import GHC.Internal.Word ( Word32 ) +import GHC.Internal.Show +import GHC.Internal.Read +import GHC.Internal.Enum +import GHC.Internal.Real +import GHC.Internal.Num #define PROFILING #include "Rts.h" @@ -54,6 +65,13 @@ data CostCentreStack -- | A cost-centre from GHC's cost-center profiler. data CostCentre +-- | Cost centre identifier +-- +-- @since 4.20.0.0 +newtype CostCentreId = CostCentreId Word32 + deriving (Show, Read) + deriving newtype (Eq, Ord, Bounded, Enum, Integral, Num, Real) + -- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current -- program was not compiled with profiling support). Takes a dummy argument -- which can be used to avoid the call to @getCurrentCCS@ being floated out by @@ -83,6 +101,12 @@ ccsCC p = peekByteOff p 4 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = peekByteOff p 8 +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO Word32 +ccId p = fmap CostCentreId $ peekByteOff p 0 + ccLabel :: Ptr CostCentre -> IO CString ccLabel p = peekByteOff p 4 @@ -99,6 +123,12 @@ ccsCC p = (# peek CostCentreStack, cc) p ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = (# peek CostCentreStack, prevStack) p +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO CostCentreId +ccId p = fmap CostCentreId $ (# peek CostCentre, ccID) p + -- | Get the label of a 'CostCentre'. ccLabel :: Ptr CostCentre -> IO CString ccLabel p = (# peek CostCentre, label) p @@ -125,6 +155,19 @@ ccSrcSpan p = (# peek CostCentre, srcloc) p currentCallStack :: IO [String] currentCallStack = ccsToStrings =<< getCurrentCCS () +-- | Returns a @[CostCentreId]@ representing the current call stack. This +-- can be useful for debugging. +-- +-- The implementation uses the call-stack simulation maintained by the +-- profiler, so it only works if the program was compiled with @-prof@ +-- and contains suitable SCC annotations (e.g. by using @-fprof-late@). +-- Otherwise, the list returned is likely to be empty or +-- uninformative. +-- +-- @since 4.20.0.0 +currentCallStackIds :: IO [CostCentreId] +currentCallStackIds = ccsToIds =<< getCurrentCCS () + -- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] @@ -141,6 +184,24 @@ ccsToStrings ccs0 = go ccs0 [] then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) +-- | Format a 'CostCentreStack' as a list of cost centre IDs. +-- +-- @since 4.20.0.0 +ccsToIds :: Ptr CostCentreStack -> IO [CostCentreId] +ccsToIds ccs0 = go ccs0 [] + where + go ccs acc + | ccs == nullPtr = return acc + | otherwise = do + cc <- ccsCC ccs + cc_id <- ccId cc + lbl <- GHC.peekCString utf8 =<< ccLabel cc + mdl <- GHC.peekCString utf8 =<< ccModule cc + parent <- ccsParent ccs + if (mdl == "MAIN" && lbl == "MAIN") + then return acc + else go parent (cc_id : acc) + -- | Get the stack trace attached to an object. -- -- @since base-4.5.0.0 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Internal.Stack.CCS.CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9303,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9312,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11557,6 +11563,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11639,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12022,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12134,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12208,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12255,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12432,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12633,6 +12646,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12811,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -5727,6 +5727,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -12351,14 +12352,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -12380,14 +12384,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -5907,6 +5907,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9533,14 +9534,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9562,14 +9566,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9309,14 +9310,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9338,14 +9342,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/082a054c59e7fad06fcc2736fe81e7eb17d9c3cf -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/082a054c59e7fad06fcc2736fe81e7eb17d9c3cf You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 00:59:18 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 04 Mar 2024 19:59:18 -0500 Subject: [Git][ghc/ghc][master] add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e66e668328f_4bf9047ed19c3253e@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 26 changed files: - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout Changes: ===================================== compiler/GHC/Core/LateCC.hs ===================================== @@ -1,164 +1,90 @@ -{-# LANGUAGE DerivingStrategies #-} -{-# LANGUAGE TupleSections #-} +{-# LANGUAGE RecordWildCards #-} --- | Adds cost-centers after the core piple has run. +-- | Adds cost-centers after the core pipline has run. module GHC.Core.LateCC - ( addLateCostCentresMG - , addLateCostCentresPgm - , addLateCostCentres -- Might be useful for API users - , Env(..) + ( -- * Inserting cost centres + addLateCostCenters ) where -import Control.Applicative -import Control.Monad -import qualified Data.Set as S - import GHC.Prelude -import GHC.Types.CostCentre -import GHC.Types.CostCentre.State -import GHC.Types.Name hiding (varName) -import GHC.Types.Tickish -import GHC.Unit.Module.ModGuts -import GHC.Types.Var -import GHC.Unit.Types -import GHC.Data.FastString -import GHC.Core -import GHC.Core.Opt.Monad -import GHC.Core.Utils (mkTick) -import GHC.Types.Id -import GHC.Driver.DynFlags +import GHC.Core +import GHC.Core.LateCC.OverloadedCalls +import GHC.Core.LateCC.TopLevelBinds +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Seq +import qualified GHC.Data.Strict as Strict +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.SrcLoc +import GHC.Utils.Error import GHC.Utils.Logger import GHC.Utils.Outputable -import GHC.Utils.Misc -import GHC.Utils.Error (withTiming) -import GHC.Utils.Monad.State.Strict - - -{- Note [Collecting late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Usually cost centres defined by a module are collected -during tidy by collectCostCentres. However with `-fprof-late` -we insert cost centres after inlining. So we keep a list of -all the cost centres we inserted and combine that with the list -of cost centres found during tidy. - -To avoid overhead when using -fprof-inline there is a flag to stop -us from collecting them here when we run this pass before tidy. - -Note [Adding late cost centres] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The basic idea is very simple. For every top level binder -`f = rhs` we compile it as if the user had written -`f = {-# SCC f #-} rhs`. - -If we do this after unfoldings for `f` have been created this -doesn't impact core-level optimizations at all. If we do it -before the cost centre will be included in the unfolding and -might inhibit optimizations at the call site. For this reason -we provide flags for both approaches as they have different -tradeoffs. - -We also don't add a cost centre for any binder that is a constructor -worker or wrapper. These will never meaningfully enrich the resulting -profile so we improve efficiency by omitting those. - --} - -addLateCostCentresMG :: ModGuts -> CoreM ModGuts -addLateCostCentresMG guts = do - dflags <- getDynFlags - let env :: Env - env = Env - { thisModule = mg_module guts - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = False -- See Note [Collecting late cost centres] - } - let guts' = guts { mg_binds = fstOf3 (addLateCostCentres env (mg_binds guts)) - } - return guts' - -addLateCostCentresPgm :: DynFlags -> Logger -> Module -> CoreProgram -> IO (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentresPgm dflags logger mod binds = - withTiming logger - (text "LateCC"<+>brackets (ppr mod)) - (\(a,b,c) -> a `seqList` (b `seq` (c `seq` ()))) $ do - let env = Env - { thisModule = mod - , countEntries = gopt Opt_ProfCountEntries dflags - , collectCCs = True -- See Note [Collecting late cost centres] - } - (binds', ccs, cc_state) = addLateCostCentres env binds - when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ - putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr binds')) - return (binds', ccs, cc_state) -addLateCostCentres :: Env -> CoreProgram -> (CoreProgram, S.Set CostCentre, CostCentreState) -addLateCostCentres env binds = - let (binds', state) = runState (mapM (doBind env) binds) initLateCCState - in (binds', lcs_ccs state, lcs_state state) - - -doBind :: Env -> CoreBind -> M CoreBind -doBind env (NonRec b rhs) = NonRec b <$> doBndr env b rhs -doBind env (Rec bs) = Rec <$> mapM doPair bs +-- | Late cost center insertion logic used by the driver +addLateCostCenters :: + Logger + -- ^ Logger + -> LateCCConfig + -- ^ Late cost center configuration + -> CoreProgram + -- ^ The program + -> IO (CoreProgram, LateCCState (Strict.Maybe SrcSpan)) +addLateCostCenters logger LateCCConfig{..} core_binds = do + + -- If top-level late CCs are enabled via either -fprof-late or + -- -fprof-late-overloaded, add them + (top_level_cc_binds, top_level_late_cc_state) <- + case lateCCConfig_whichBinds of + LateCCNone -> + return (core_binds, initLateCCState ()) + _ -> + withTiming + logger + (text "LateTopLevelCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateTopLevelCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (initLateCCState ()) + (topLevelBindsCC top_level_cc_pred) + core_binds + + -- If overloaded call CCs are enabled via -fprof-late-overloaded-calls, add + -- them + (late_cc_binds, late_cc_state) <- + if lateCCConfig_overloadedCalls then + withTiming + logger + (text "LateOverloadedCallsCCs" <+> brackets (ppr this_mod)) + (\(binds, late_cc_state) -> seqBinds binds `seq` late_cc_state `seq` ()) + $ {-# SCC lateoverloadedCallsCCs #-} do + pure $ + doLateCostCenters + lateCCConfig_env + (top_level_late_cc_state { lateCCState_extra = Strict.Nothing }) + overloadedCallsCC + top_level_cc_binds + else + return + ( top_level_cc_binds + , top_level_late_cc_state { lateCCState_extra = Strict.Nothing } + ) + + return (late_cc_binds, late_cc_state) where - doPair :: ((Id, CoreExpr) -> M (Id, CoreExpr)) - doPair (b,rhs) = (b,) <$> doBndr env b rhs - -doBndr :: Env -> Id -> CoreExpr -> M CoreExpr -doBndr env bndr rhs - -- Cost centres on constructor workers are pretty much useless - -- so we don't emit them if we are looking at the rhs of a constructor - -- binding. - | Just _ <- isDataConId_maybe bndr = pure rhs - | otherwise = doBndr' env bndr rhs - - --- We want to put the cost centre below the lambda as we only care about executions of the RHS. -doBndr' :: Env -> Id -> CoreExpr -> State LateCCState CoreExpr -doBndr' env bndr (Lam b rhs) = Lam b <$> doBndr' env bndr rhs -doBndr' env bndr rhs = do - let name = idName bndr - name_loc = nameSrcSpan name - cc_name = getOccFS name - count = countEntries env - cc_flavour <- getCCFlavour cc_name - let cc_mod = thisModule env - bndrCC = NormalCC cc_flavour cc_name cc_mod name_loc - note = ProfNote bndrCC count True - addCC env bndrCC - return $ mkTick note rhs - -data LateCCState = LateCCState - { lcs_state :: !CostCentreState - , lcs_ccs :: S.Set CostCentre - } -type M = State LateCCState - -initLateCCState :: LateCCState -initLateCCState = LateCCState newCostCentreState mempty - -getCCFlavour :: FastString -> M CCFlavour -getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name - -getCCIndex' :: FastString -> M CostCentreIndex -getCCIndex' name = do - state <- get - let (index,cc_state') = getCCIndex name (lcs_state state) - put (state { lcs_state = cc_state'}) - return index - -addCC :: Env -> CostCentre -> M () -addCC !env cc = do - state <- get - when (collectCCs env) $ do - let ccs' = S.insert cc (lcs_ccs state) - put (state { lcs_ccs = ccs'}) - -data Env = Env - { thisModule :: !Module - , countEntries:: !Bool - , collectCCs :: !Bool - } - + top_level_cc_pred :: CoreExpr -> Bool + top_level_cc_pred = + case lateCCConfig_whichBinds of + LateCCAllBinds -> + const True + LateCCOverloadedBinds -> + isOverloadedTy . exprType + LateCCNone -> + -- This is here for completeness, we won't actually use this + -- predicate in this case since we'll shortcut. + const False + + this_mod = lateCCEnv_module lateCCConfig_env ===================================== compiler/GHC/Core/LateCC/OverloadedCalls.hs ===================================== @@ -0,0 +1,204 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TupleSections #-} + +module GHC.Core.LateCC.OverloadedCalls + ( overloadedCallsCC + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified GHC.Data.Strict as Strict + +import GHC.Data.FastString +import GHC.Core +import GHC.Core.LateCC.Utils +import GHC.Core.LateCC.Types +import GHC.Core.Make +import GHC.Core.Predicate +import GHC.Core.Type +import GHC.Core.Utils +import GHC.Tc.Utils.TcType +import GHC.Types.Id +import GHC.Types.Name +import GHC.Types.SrcLoc +import GHC.Types.Tickish +import GHC.Types.Var +import GHC.Utils.Outputable + +type OverloadedCallsCCState = Strict.Maybe SrcSpan + +-- | Insert cost centres on function applications with dictionary arguments. The +-- source locations attached to the cost centres is approximated based on the +-- "closest" source note encountered in the traversal. +overloadedCallsCC :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind +overloadedCallsCC = + processBind + where + processBind :: CoreBind -> LateCCM OverloadedCallsCCState CoreBind + processBind core_bind = + case core_bind of + NonRec b e -> + NonRec b <$> wrap_if_join b (processExpr e) + Rec es -> + Rec <$> mapM (\(b,e) -> (b,) <$> wrap_if_join b (processExpr e)) es + where + -- If an overloaded function is turned into a join point, we won't add + -- SCCs directly to calls since it makes them non-tail calls. Instead, + -- we look for join points here and add an SCC to their RHS if they are + -- overloaded. + wrap_if_join :: + CoreBndr + -> LateCCM OverloadedCallsCCState CoreExpr + -> LateCCM OverloadedCallsCCState CoreExpr + wrap_if_join b pexpr = do + expr <- pexpr + if isJoinId b && isOverloadedTy (exprType expr) then do + let + cc_name :: FastString + cc_name = fsLit "join-rhs-" `appendFS` getOccFS b + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan expr + else + return expr + + + processExpr :: CoreExpr -> LateCCM OverloadedCallsCCState CoreExpr + processExpr expr = + case expr of + -- The case we care about: Application + app at App{} -> do + -- Here we have some application like `f v1 ... vN`, where v1 ... vN + -- should be the function's type arguments followed by the value + -- arguments. To determine if the `f` is an overloaded function, we + -- check if any of the arguments v1 ... vN are dictionaries. + let + (f, xs) = collectArgs app + resultTy = applyTypeToArgs empty (exprType f) xs + + -- Recursively process the arguments first for no particular reason + args <- mapM processExpr xs + let app' = mkCoreApps f args + + if + -- Check if any of the arguments are dictionaries + any isDictExpr args + + -- Avoid instrumenting dictionary functions, which may be + -- overloaded if there are superclasses, by checking if the result + -- type of the function is a dictionary type. + && not (isDictTy resultTy) + + -- Avoid instrumenting constraint selectors like eq_sel + && (typeTypeOrConstraint resultTy /= ConstraintLike) + + -- Avoid instrumenting join points. + -- (See comment in processBind above) + && not (isJoinVarExpr f) + then do + -- Extract a name and source location from the function being + -- applied + let + cc_name :: FastString + cc_name = + fsLit $ maybe "" getOccString (exprName app) + + cc_srcspan <- + fmap (Strict.fromMaybe (UnhelpfulSpan UnhelpfulNoLocationInfo)) $ + lift $ gets lateCCState_extra + + insertCC cc_name cc_srcspan app' + else + return app' + + -- For recursive constructors of Expr, we traverse the nested Exprs + Lam b e -> + mkCoreLams [b] <$> processExpr e + Let b e -> + mkCoreLet <$> processBind b <*> processExpr e + Case e b t alts -> + Case + <$> processExpr e + <*> pure b + <*> pure t + <*> mapM processAlt alts + Cast e co -> + mkCast <$> processExpr e <*> pure co + Tick t e -> do + trackSourceNote t $ + mkTick t <$> processExpr e + + -- For non-recursive constructors of Expr, we do nothing + x -> return x + + processAlt :: CoreAlt -> LateCCM OverloadedCallsCCState CoreAlt + processAlt (Alt c bs e) = Alt c bs <$> processExpr e + + trackSourceNote :: CoreTickish -> LateCCM OverloadedCallsCCState a -> LateCCM OverloadedCallsCCState a + trackSourceNote tick act = + case tick of + SourceNote rss _ -> do + -- Prefer source notes from the current file + in_current_file <- + maybe False ((== EQ) . lexicalCompareFS (srcSpanFile rss)) <$> + asks lateCCEnv_file + if not in_current_file then + act + else do + loc <- lift $ gets lateCCState_extra + lift . modify $ \s -> + s { lateCCState_extra = + Strict.Just $ RealSrcSpan rss mempty + } + x <- act + lift . modify $ \s -> + s { lateCCState_extra = loc + } + return x + _ -> + act + + -- Utility functions + + -- Extract a Name from an expression. If it is an application, attempt to + -- extract a name from the applied function. If it is a variable, return the + -- Name of the variable. If it is a tick/cast, attempt to extract a Name + -- from the expression held in the tick/cast. Otherwise return Nothing. + exprName :: CoreExpr -> Maybe Name + exprName = + \case + App f _ -> + exprName f + Var f -> + Just (idName f) + Tick _ e -> + exprName e + Cast e _ -> + exprName e + _ -> + Nothing + + -- Determine whether an expression is a dictionary + isDictExpr :: CoreExpr -> Bool + isDictExpr = + maybe False isDictTy . exprType' + where + exprType' :: CoreExpr -> Maybe Type + exprType' = \case + Type{} -> Nothing + expr -> Just $ exprType expr + + -- Determine whether an expression is a join variable + isJoinVarExpr :: CoreExpr -> Bool + isJoinVarExpr = + \case + Var var -> isJoinId var + Tick _ e -> isJoinVarExpr e + Cast e _ -> isJoinVarExpr e + _ -> False ===================================== compiler/GHC/Core/LateCC/TopLevelBinds.hs ===================================== @@ -0,0 +1,106 @@ +{-# LANGUAGE TupleSections #-} +module GHC.Core.LateCC.TopLevelBinds where + +import GHC.Prelude + +import GHC.Core +-- import GHC.Core.LateCC +import GHC.Core.LateCC.Types +import GHC.Core.LateCC.Utils +import GHC.Core.Opt.Monad +import GHC.Driver.DynFlags +import GHC.Types.Id +import GHC.Types.Name +import GHC.Unit.Module.ModGuts + +{- Note [Collecting late cost centres] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Usually cost centres defined by a module are collected +during tidy by collectCostCentres. However with `-fprof-late` +we insert cost centres after inlining. So we keep a list of +all the cost centres we inserted and combine that with the list +of cost centres found during tidy. + +To avoid overhead when using -fprof-inline there is a flag to stop +us from collecting them here when we run this pass before tidy. + +Note [Adding late cost centres to top level bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The basic idea is very simple. For every top level binder +`f = rhs` we compile it as if the user had written +`f = {-# SCC f #-} rhs`. + +If we do this after unfoldings for `f` have been created this +doesn't impact core-level optimizations at all. If we do it +before the cost centre will be included in the unfolding and +might inhibit optimizations at the call site. For this reason +we provide flags for both approaches as they have different +tradeoffs. + +We also don't add a cost centre for any binder that is a constructor +worker or wrapper. These will never meaningfully enrich the resulting +profile so we improve efficiency by omitting those. + +-} + +-- | Add late cost centres directly to the 'ModGuts'. This is used inside the +-- core pipeline with the -fprof-late-inline flag. It should not be used after +-- tidy, since it does not manually track inserted cost centers. See +-- Note [Collecting late cost centres]. +topLevelBindsCCMG :: ModGuts -> CoreM ModGuts +topLevelBindsCCMG guts = do + dflags <- getDynFlags + let + env = + LateCCEnv + { lateCCEnv_module = mg_module guts + + -- We don't use this for topLevelBindsCC, so Nothing is okay + , lateCCEnv_file = Nothing + + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = False + } + guts' = + guts + { mg_binds = + fst + ( doLateCostCenters + env + (initLateCCState ()) + (topLevelBindsCC (const True)) + (mg_binds guts) + ) + } + return guts' + +-- | Insert cost centres on top-level bindings in the module, depending on +-- whether or not they satisfy the given predicate. +topLevelBindsCC :: (CoreExpr -> Bool) -> CoreBind -> LateCCM s CoreBind +topLevelBindsCC pred core_bind = + case core_bind of + NonRec b rhs -> + NonRec b <$> doBndr b rhs + Rec bs -> + Rec <$> mapM doPair bs + where + doPair :: ((Id, CoreExpr) -> LateCCM s (Id, CoreExpr)) + doPair (b,rhs) = (b,) <$> doBndr b rhs + + doBndr :: Id -> CoreExpr -> LateCCM s CoreExpr + doBndr bndr rhs + -- Cost centres on constructor workers are pretty much useless + -- so we don't emit them if we are looking at the rhs of a constructor + -- binding. + | Just _ <- isDataConId_maybe bndr = pure rhs + | otherwise = if pred rhs then addCC bndr rhs else pure rhs + + -- We want to put the cost centre below the lambda as we only care about + -- executions of the RHS. + addCC :: Id -> CoreExpr -> LateCCM s CoreExpr + addCC bndr (Lam b rhs) = Lam b <$> addCC bndr rhs + addCC bndr rhs = do + let name = idName bndr + cc_loc = nameSrcSpan name + cc_name = getOccFS name + insertCC cc_name cc_loc rhs \ No newline at end of file ===================================== compiler/GHC/Core/LateCC/Types.hs ===================================== @@ -0,0 +1,74 @@ +-- | Types related to late cost center insertion +module GHC.Core.LateCC.Types + ( LateCCConfig(..) + , LateCCBindSpec(..) + , LateCCEnv(..) + , LateCCState(..) + , initLateCCState + , LateCCM + ) where + +import GHC.Prelude + +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Unit.Types + +-- | Late cost center insertion configuration. +-- +-- Specifies whether cost centers are added to overloaded function call sites +-- and/or top-level bindings, and which top-level bindings they are added to. +-- Also holds the cost center insertion environment. +data LateCCConfig = + LateCCConfig + { lateCCConfig_whichBinds :: !LateCCBindSpec + , lateCCConfig_overloadedCalls :: !Bool + , lateCCConfig_env :: !LateCCEnv + } + +-- | The types of top-level bindings we support adding cost centers to. +data LateCCBindSpec = + LateCCNone + | LateCCAllBinds + | LateCCOverloadedBinds + +-- | Late cost centre insertion environment +data LateCCEnv = LateCCEnv + { lateCCEnv_module :: !Module + -- ^ Current module + , lateCCEnv_file :: Maybe FastString + -- ^ Current file, if we have one + , lateCCEnv_countEntries:: !Bool + -- ^ Whether the inserted cost centers should count entries + , lateCCEnv_collectCCs :: !Bool + -- ^ Whether to collect the cost centres we insert. See + -- Note [Collecting late cost centres] + + } + +-- | Late cost centre insertion state, indexed by some extra state type that an +-- insertion method may require. +data LateCCState s = LateCCState + { lateCCState_ccs :: !(S.Set CostCentre) + -- ^ Cost centres that have been inserted + , lateCCState_ccState :: !CostCentreState + -- ^ Per-module state tracking for cost centre indices + , lateCCState_extra :: !s + } + +-- | The empty late cost centre insertion state +initLateCCState :: s -> LateCCState s +initLateCCState s = + LateCCState + { lateCCState_ccState = newCostCentreState + , lateCCState_ccs = mempty + , lateCCState_extra = s + } + +-- | Late cost centre insertion monad +type LateCCM s = ReaderT LateCCEnv (State (LateCCState s)) ===================================== compiler/GHC/Core/LateCC/Utils.hs ===================================== @@ -0,0 +1,80 @@ +module GHC.Core.LateCC.Utils + ( -- * Inserting cost centres + doLateCostCenters -- Might be useful for API users + + -- ** Helpers for defining insertion methods + , getCCFlavour + , insertCC + ) where + +import GHC.Prelude + +import Control.Monad +import Control.Monad.Trans.Class +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State.Strict +import qualified Data.Set as S + +import GHC.Core +import GHC.Core.LateCC.Types +import GHC.Core.Utils +import GHC.Data.FastString +import GHC.Types.CostCentre +import GHC.Types.CostCentre.State +import GHC.Types.SrcLoc +import GHC.Types.Tickish + +-- | Insert cost centres into the 'CoreProgram' using the provided environment, +-- initial state, and insertion method. +doLateCostCenters + :: LateCCEnv + -- ^ Environment to run the insertion in + -> LateCCState s + -- ^ Initial state to run the insertion with + -> (CoreBind -> LateCCM s CoreBind) + -- ^ Insertion method + -> CoreProgram + -- ^ Bindings to consider + -> (CoreProgram, LateCCState s) +doLateCostCenters env state method binds = + runLateCC env state $ mapM method binds + +-- | Evaluate late cost centre insertion +runLateCC :: LateCCEnv -> LateCCState s -> LateCCM s a -> (a, LateCCState s) +runLateCC env state = (`runState` state) . (`runReaderT` env) + +-- | Given the name of a cost centre, get its flavour +getCCFlavour :: FastString -> LateCCM s CCFlavour +getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name + where + getCCIndex' :: FastString -> LateCCM s CostCentreIndex + getCCIndex' name = do + cc_state <- lift $ gets lateCCState_ccState + let (index, cc_state') = getCCIndex name cc_state + lift . modify $ \s -> s { lateCCState_ccState = cc_state'} + return index + +-- | Insert a cost centre with the specified name and source span on the given +-- expression. The inserted cost centre will be appropriately tracked in the +-- late cost centre state. +insertCC + :: FastString + -- ^ Name of the cost centre to insert + -> SrcSpan + -- ^ Source location to associate with the cost centre + -> CoreExpr + -- ^ Expression to wrap in the cost centre + -> LateCCM s CoreExpr +insertCC cc_name cc_loc expr = do + cc_flavour <- getCCFlavour cc_name + env <- ask + let + cc_mod = lateCCEnv_module env + cc = NormalCC cc_flavour cc_name cc_mod cc_loc + note = ProfNote cc (lateCCEnv_countEntries env) True + when (lateCCEnv_collectCCs env) $ do + lift . modify $ \s -> + s { lateCCState_ccs = S.insert cc (lateCCState_ccs s) + } + return $ mkTick note expr + ===================================== compiler/GHC/Core/Opt/Pipeline.hs ===================================== @@ -43,7 +43,7 @@ import GHC.Core.Opt.CallArity ( callArityAnalProgram ) import GHC.Core.Opt.Exitify ( exitifyProgram ) import GHC.Core.Opt.WorkWrap ( wwTopBinds ) import GHC.Core.Opt.CallerCC ( addCallerCostCentres ) -import GHC.Core.LateCC (addLateCostCentresMG) +import GHC.Core.LateCC.TopLevelBinds (topLevelBindsCCMG) import GHC.Core.Seq (seqBinds) import GHC.Core.FamInstEnv @@ -520,7 +520,7 @@ doCorePass pass guts = do addCallerCostCentres guts CoreAddLateCcs -> {-# SCC "AddLateCcs" #-} - addLateCostCentresMG guts + topLevelBindsCCMG guts CoreDoPrintCore -> {-# SCC "PrintCore" #-} liftIO $ printCore logger (mg_binds guts) >> return guts ===================================== compiler/GHC/Driver/Flags.hs ===================================== @@ -341,6 +341,8 @@ data GeneralFlag | Opt_ProfCountEntries | Opt_ProfLateInlineCcs | Opt_ProfLateCcs + | Opt_ProfLateOverloadedCcs + | Opt_ProfLateoverloadedCallsCCs | Opt_ProfManualCcs -- ^ Ignore manual SCC annotations -- misc opts ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -175,7 +175,6 @@ import GHC.Iface.Ext.Debug ( diffFile, validateScopes ) import GHC.Core import GHC.Core.Lint.Interactive ( interactiveInScope ) import GHC.Core.Tidy ( tidyExpr ) -import GHC.Core.Type ( Type, Kind ) import GHC.Core.Utils ( exprType ) import GHC.Core.ConLike import GHC.Core.Opt.Pipeline @@ -185,7 +184,8 @@ import GHC.Core.InstEnv import GHC.Core.FamInstEnv import GHC.Core.Rules import GHC.Core.Stats -import GHC.Core.LateCC (addLateCostCentresPgm) +import GHC.Core.LateCC +import GHC.Core.LateCC.Types import GHC.CoreToStg.Prep @@ -197,6 +197,7 @@ import GHC.Parser.Lexer as Lexer import GHC.Tc.Module import GHC.Tc.Utils.Monad +import GHC.Tc.Utils.TcType import GHC.Tc.Zonk.Env ( ZonkFlexi (DefaultFlexi) ) import GHC.Stg.Syntax @@ -297,7 +298,6 @@ import GHC.StgToCmm.Utils (IPEStats) import GHC.Types.Unique.FM import GHC.Types.Unique.DFM import GHC.Cmm.Config (CmmConfig) -import GHC.Types.CostCentre.State (newCostCentreState) {- ********************************************************************** @@ -1791,22 +1791,41 @@ hscGenHardCode hsc_env cgguts location output_filename = do ------------------- - -- Insert late cost centres if enabled. - -- If `-fprof-late-inline` is enabled we can skip this, as it will have added - -- a superset of cost centres we would add here already. - - (late_cc_binds, late_local_ccs, cc_state) <- - if gopt Opt_ProfLateCcs dflags && not (gopt Opt_ProfLateInlineCcs dflags) - then - withTiming - logger - (text "LateCCs"<+>brackets (ppr this_mod)) - (const ()) - $ {-# SCC lateCC #-} do - (binds, late_ccs, cc_state) <- addLateCostCentresPgm dflags logger this_mod core_binds - return ( binds, (S.toList late_ccs `mappend` local_ccs ), cc_state) + -- Insert late cost centres based on the provided flags. + -- + -- If -fprof-late-inline is enabled, we will skip adding CCs on any + -- top-level bindings here (via shortcut in `addLateCostCenters`), + -- since it will have already added a superset of the CCs we would add + -- here. + let + late_cc_config :: LateCCConfig + late_cc_config = + LateCCConfig + { lateCCConfig_whichBinds = + if gopt Opt_ProfLateInlineCcs dflags then + LateCCNone + else if gopt Opt_ProfLateCcs dflags then + LateCCAllBinds + else if gopt Opt_ProfLateOverloadedCcs dflags then + LateCCOverloadedBinds else - return (core_binds, local_ccs, newCostCentreState) + LateCCNone + , lateCCConfig_overloadedCalls = + gopt Opt_ProfLateoverloadedCallsCCs dflags + , lateCCConfig_env = + LateCCEnv + { lateCCEnv_module = this_mod + , lateCCEnv_file = fsLit <$> ml_hs_file location + , lateCCEnv_countEntries= gopt Opt_ProfCountEntries dflags + , lateCCEnv_collectCCs = True + } + } + + (late_cc_binds, late_cc_state) <- + addLateCostCenters logger late_cc_config core_binds + + when (dopt Opt_D_dump_late_cc dflags || dopt Opt_D_verbose_core2core dflags) $ + putDumpFileMaybe logger Opt_D_dump_late_cc "LateCC" FormatCore (vcat (map ppr late_cc_binds)) ------------------- -- Run late plugins @@ -1820,7 +1839,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do cg_hpc_info = hpc_info, cg_spt_entries = spt_entries, cg_binds = late_binds, - cg_ccs = late_local_ccs' + cg_ccs = late_local_ccs } , _ ) <- @@ -1833,9 +1852,9 @@ hscGenHardCode hsc_env cgguts location output_filename = do (($ hsc_env) . latePlugin) ( cgguts { cg_binds = late_cc_binds - , cg_ccs = late_local_ccs + , cg_ccs = S.toList (lateCCState_ccs late_cc_state) ++ local_ccs } - , cc_state + , lateCCState_ccState late_cc_state ) let @@ -1876,7 +1895,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do let (stg_binds,_stg_deps) = unzip stg_binds_with_deps let cost_centre_info = - (late_local_ccs' ++ caf_ccs, caf_cc_stacks) + (late_local_ccs ++ caf_ccs, caf_cc_stacks) platform = targetPlatform dflags prof_init | sccProfilingEnabled dflags = profilingInitCode platform this_mod cost_centre_info ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -2444,6 +2444,8 @@ fFlagsDeps = [ flagSpec "prof-cafs" Opt_AutoSccsOnIndividualCafs, flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "prof-late" Opt_ProfLateCcs, + flagSpec "prof-late-overloaded" Opt_ProfLateOverloadedCcs, + flagSpec "prof-late-overloaded-calls" Opt_ProfLateoverloadedCallsCCs, flagSpec "prof-manual" Opt_ProfManualCcs, flagSpec "prof-late-inline" Opt_ProfLateInlineCcs, flagSpec "regs-graph" Opt_RegsGraph, @@ -3763,6 +3765,10 @@ needSourceNotes :: DynFlags -> Bool needSourceNotes dflags = debugLevel dflags > 0 || gopt Opt_InfoTableMap dflags + -- Source ticks are used to approximate the location of + -- overloaded call cost centers + || gopt Opt_ProfLateoverloadedCallsCCs dflags + -- ----------------------------------------------------------------------------- -- Linker/compiler information ===================================== compiler/GHC/Tc/Utils/TcType.hs ===================================== @@ -1907,7 +1907,7 @@ isRhoExpTy (Infer {}) = True isOverloadedTy :: Type -> Bool -- Yes for a type of a function that might require evidence-passing --- Used only by bindLocalMethods +-- Used by bindLocalMethods and for -fprof-late-overloaded isOverloadedTy ty | Just ty' <- coreView ty = isOverloadedTy ty' isOverloadedTy (ForAllTy _ ty) = isOverloadedTy ty isOverloadedTy (FunTy { ft_af = af }) = isInvisibleFunArg af ===================================== compiler/ghc.cabal.in ===================================== @@ -336,6 +336,10 @@ Library GHC.Core.Lint GHC.Core.Lint.Interactive GHC.Core.LateCC + GHC.Core.LateCC.Types + GHC.Core.LateCC.TopLevelBinds + GHC.Core.LateCC.Utils + GHC.Core.LateCC.OverloadedCalls GHC.Core.Make GHC.Core.Map.Expr GHC.Core.Map.Type ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -186,6 +186,15 @@ Compiler This means that if you are using ``-fllvm`` you now need ``llc``, ``opt`` and ``clang`` available. +- The :ghc-flag:`-fprof-late-overloaded` flag has been introduced. It causes + cost centres to be added to *overloaded* top level bindings, unlike + :ghc-flag:`-fprof-late` which adds cost centres to all top level bindings. + +- The :ghc-flag:`-fprof-late-overloaded-calls` flag has been introduced. It + causes cost centres to be inserted at call sites including instance dictionary + arguments. This may be preferred over :ghc-flag:`-fprof-late-overloaded` since + it may reveal whether imported functions are called overloaded. + JavaScript backend ~~~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/profiling.rst ===================================== @@ -518,6 +518,49 @@ of your profiled program will be different to that of the unprofiled one. You can try this mode if :ghc-flag:`-fprof-late` results in a profile that's too hard to interpret. +.. ghc-flag:: -fprof-late-overloaded + :shortdesc: Auto-add ``SCC``\\ s to all top level overloaded bindings *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all *overloaded* top level bindings + late in the compilation pipeline after the optimizer has run and unfoldings + have been created. This means these cost centres will not interfere with + core-level optimizations and the resulting profile will be closer to the + performance profile of an optimized non-profiled executable. + + This flag can help determine which top level bindings encountered during a + program's execution are still overloaded after inlining and specialization. + +.. ghc-flag:: -fprof-late-overloaded-calls + :shortdesc: Auto-add ``SCC``\\ s to all call sites that include dictionary arguments *after* the core pipeline has run. + :type: dynamic + :reverse: -fno-prof-late-overloaded-calls + :category: + + :since: 9.10.1 + + Adds an automatic ``SCC`` annotation to all call sites that include + dictionary arguments late in the compilation pipeline after the optimizer + has run and unfoldings have been created. This means these cost centres will + not interfere with core-level optimizations and the resulting profile will + be closer to the performance profile of an optimized non-profiled + executable. + + This flag is potentially more useful than :ghc-flag:`-fprof-late-overloaded` + since it will also add ``SCC`` annotations to call sites of imported + overloaded functions. + + Some overloaded calls may not be annotated, specifically in cases where the + optimizer turns an overloaded function into a join point. Calls to such + functions will not be wrapped in ``SCC`` annotations, since it would make + them non-tail calls, which is a requirement for join points. Instead, + ``SCC`` annotations are added around the body of overloaded join variables + and given distinct names (``join-rhs-``) to avoid confusion. + .. ghc-flag:: -fprof-cafs :shortdesc: Auto-add ``SCC``\\ s to all CAFs :type: dynamic ===================================== testsuite/tests/profiling/should_run/all.T ===================================== @@ -195,3 +195,30 @@ test('ignore_scc', [], compile_and_run, ['-fno-prof-manual']) test('T21446', [], makefile_test, ['T21446']) + + +test('scc-prof-overloaded001', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded002', + [], + compile_and_run, + ['-fno-prof-auto -fno-full-laziness -fprof-late-overloaded'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls001', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fno-full-laziness -fprof-late-overloaded-calls'] # See Note [consistent stacks] +) + +test('scc-prof-overloaded-calls002', + [], + compile_and_run, + # Need optimizations to get rid of unwanted overloaded calls + ['-O -fno-prof-auto -fprof-late-overloaded-calls'] +) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample ===================================== @@ -0,0 +1,26 @@ + Thu Jan 4 11:49 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,320 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded-calls001.hs:24:1-31 256 1 0.0 0.3 0.0 0.8 + f Main scc-prof-overloaded-calls001.hs:18:1-18 257 1 0.0 0.6 0.0 0.6 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample ===================================== @@ -0,0 +1,31 @@ + Fri Jan 5 11:06 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded-calls002 +RTS -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 59,152 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 34.8 +CAF GHC.IO.Handle.FD 0.0 58.7 +CAF GHC.IO.Encoding 0.0 4.1 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 34.8 0.0 100.0 + CAF Main 255 0 0.0 0.6 0.0 0.9 + f Main scc-prof-overloaded-calls002.hs:52:1-25 262 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:48:1-25 261 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:44:1-25 260 1 0.0 0.1 0.0 0.1 + f Main scc-prof-overloaded-calls002.hs:40:1-25 259 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:36:1-25 258 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:32:1-25 257 1 0.0 0.0 0.0 0.0 + f Main scc-prof-overloaded-calls002.hs:28:1-25 256 1 0.0 0.0 0.0 0.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.1 0.0 4.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.3 0.0 0.3 + CAF GHC.IO.Handle.FD 208 0 0.0 58.7 0.0 58.7 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs ===================================== @@ -0,0 +1,24 @@ +-- Running this program should result in two calls to overloaded functions: One +-- with the $fShowX dictionary, the next with the $fShowList dictionary +-- constructor for X. +-- +-- Note that although the `$fShowList` dictionary constructor is itself +-- overloaded, it should not get an SCC since we avoid instrumenting overloaded +-- calls that result in dictionaries. +-- +-- With just -fprof-late-overloaded, only `invoke` should get an SCC, since it +-- is the only overloaded top level binding. With +-- `-fprof-late-overloaded-calls`, the calls to both `invoke` and `f` (in the +-- body of invoke) should get SCCs. + +module Main where + +{-# NOINLINE invoke #-} +invoke :: Show a => (Show [a] => [a] -> String) -> a -> String +invoke f x = f [x] + +data X = X + deriving Show + +main :: IO () +main = putStrLn (invoke show X) ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.prof.sample ===================================== @@ -0,0 +1,25 @@ + Thu Jan 4 11:26 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded001 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 48,304 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 20.5 +CAF GHC.IO.Handle.FD 0.0 71.9 +CAF GHC.IO.Encoding 0.0 5.1 +CAF GHC.Conc.Signal 0.0 1.3 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 20.5 0.0 100.0 + CAF Main 255 0 0.0 0.0 0.0 0.8 + invoke Main scc-prof-overloaded001.hs:18:1-6 256 1 0.0 0.8 0.0 0.8 + CAF GHC.Conc.Signal 238 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 219 0 0.0 5.1 0.0 5.1 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 71.9 0.0 71.9 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded001.stdout ===================================== @@ -0,0 +1 @@ +[X] ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.hs ===================================== @@ -0,0 +1,65 @@ +-- Running this program should result in seven calls to overloaded functions +-- with increasing numbers of dictionary arguments. +-- +-- With just -fprof-late-overloaded, no SCCs should be added, since none of the +-- overloaded functions are top level. With `-fprof-late-overloaded-calls`, all +-- seven calls should get *distinct* SCCs with separate source locations even +-- though the overloaded functions share an OccName (`f`). + +module Main where + +data X = X + +instance Show X where +instance Num X where +instance Eq X where +instance Enum X where +instance Ord X where +instance Real X where +instance Integral X where + +-- No overloaded call +{-# NOINLINE invoke0 #-} +invoke0 :: (forall a. a -> a -> String) -> X -> String +invoke0 f val = f val val + +{-# NOINLINE invoke1 #-} +invoke1 :: (forall a. Show a => a -> a -> String) -> X -> String +invoke1 f val = f val val + +{-# NOINLINE invoke2 #-} +invoke2 :: (forall a. (Show a, Num a) => a -> a -> String) -> X -> String +invoke2 f val = f val val + +{-# NOINLINE invoke3 #-} +invoke3 :: (forall a. (Show a, Num a, Eq a) => a -> a -> String) -> X -> String +invoke3 f val = f val val + +{-# NOINLINE invoke4 #-} +invoke4 :: (forall a. (Show a, Num a, Eq a, Enum a) => a -> a -> String) -> X -> String +invoke4 f val = f val val + +{-# NOINLINE invoke5 #-} +invoke5 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a) => a -> a -> String) -> X -> String +invoke5 f val = f val val + +{-# NOINLINE invoke6 #-} +invoke6 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a) => a -> a -> String) -> X -> String +invoke6 f val = f val val + +{-# NOINLINE invoke7 #-} +invoke7 :: (forall a. (Show a, Num a, Eq a, Enum a, Ord a, Real a, Integral a) => a -> a -> String) -> X -> String +invoke7 f val = f val val + +main :: IO () +main = do + putStrLn $ invoke0 (\_ _ -> s) X + putStrLn $ invoke1 (\_ _ -> s) X + putStrLn $ invoke2 (\_ _ -> s) X + putStrLn $ invoke3 (\_ _ -> s) X + putStrLn $ invoke4 (\_ _ -> s) X + putStrLn $ invoke5 (\_ _ -> s) X + putStrLn $ invoke6 (\_ _ -> s) X + putStrLn $ invoke7 (\_ _ -> s) X + where + s = "wibbly" ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.prof.sample ===================================== @@ -0,0 +1,23 @@ + Thu Jan 4 11:55 2024 Time and Allocation Profiling Report (Final) + + scc-prof-overloaded002 +RTS -hc -p -RTS + + total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) + total alloc = 56,472 bytes (excludes profiling overheads) + +COST CENTRE MODULE SRC %time %alloc + +MAIN MAIN 0.0 32.7 +CAF GHC.IO.Handle.FD 0.0 61.5 +CAF GHC.IO.Encoding 0.0 4.3 +CAF GHC.Conc.Signal 0.0 1.1 + + + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + +MAIN MAIN 128 0 0.0 32.7 0.0 100.0 + CAF GHC.Conc.Signal 238 0 0.0 1.1 0.0 1.1 + CAF GHC.IO.Encoding 219 0 0.0 4.3 0.0 4.3 + CAF GHC.IO.Encoding.Iconv 217 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 208 0 0.0 61.5 0.0 61.5 ===================================== testsuite/tests/profiling/should_run/scc-prof-overloaded002.stdout ===================================== @@ -0,0 +1,8 @@ +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly +wibbly View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/61bb5ff68630c203eaae4baba554640246df5a63 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/61bb5ff68630c203eaae4baba554640246df5a63 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 01:00:05 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 04 Mar 2024 20:00:05 -0500 Subject: [Git][ghc/ghc][master] x86-ncg: Fix fma codegen when arguments are globals Message-ID: <65e66e95ee021_4bf904b6261037199@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 4 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3424,7 +3424,6 @@ genFMA3Code :: Width -> FMASign -> CmmExpr -> CmmExpr -> CmmExpr -> NatM Register genFMA3Code w signs x y z = do - -- For the FMA instruction, we want to compute x * y + z -- -- There are three possible instructions we could emit: @@ -3445,17 +3444,45 @@ genFMA3Code w signs x y z = do -- -- Currently we follow neither of these optimisations, -- opting to always use fmadd213 for simplicity. + -- + -- We would like to compute the result directly into the requested register. + -- To do so we must first compute `x` into the destination register. This is + -- only possible if the other arguments don't use the destination register. + -- We check for this and if there is a conflict we move the result only after + -- the computation. See #24496 how this went wrong in the past. let rep = floatFormat w (y_reg, y_code) <- getNonClobberedReg y - (z_reg, z_code) <- getNonClobberedReg z + (z_op, z_code) <- getNonClobberedOperand z x_code <- getAnyReg x + x_tmp <- getNewRegNat rep let fma213 = FMA3 rep signs FMA213 - code dst - = y_code `appOL` + + code, code_direct, code_mov :: Reg -> InstrBlock + -- Ideal: Compute the result directly into dst + code_direct dst = x_code dst `snocOL` + fma213 z_op y_reg dst + -- Fallback: Compute the result into a tmp reg and then move it. + code_mov dst = x_code x_tmp `snocOL` + fma213 z_op y_reg x_tmp `snocOL` + MOV rep (OpReg x_tmp) (OpReg dst) + + code dst = + y_code `appOL` z_code `appOL` - x_code dst `snocOL` - fma213 (OpReg z_reg) y_reg dst + ( if arg_regs_conflict then code_mov dst else code_direct dst ) + + where + + arg_regs_conflict = + y_reg == dst || + case z_op of + OpReg z_reg -> z_reg == dst + OpAddr amode -> dst `elem` addrModeRegs amode + OpImm {} -> False + + -- NB: Computing the result into a desired register using Any can be tricky. + -- So for now, we keep it simple. (See #24496). return (Any rep code) ----------- ===================================== testsuite/tests/primops/should_run/T24496.hs ===================================== @@ -0,0 +1,18 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +import GHC.Exts + +twoProductFloat# :: Float# -> Float# -> (# Float#, Float# #) +twoProductFloat# x y = let !r = x `timesFloat#` y + in (# r, fmsubFloat# x y r #) +{-# NOINLINE twoProductFloat# #-} + +twoProductDouble# :: Double# -> Double# -> (# Double#, Double# #) +twoProductDouble# x y = let !r = x *## y + in (# r, fmsubDouble# x y r #) +{-# NOINLINE twoProductDouble# #-} + +main :: IO () +main = do + print $ case twoProductFloat# 2.0# 3.0# of (# r, s #) -> (F# r, F# s) + print $ case twoProductDouble# 2.0## 3.0## of (# r, s #) -> (D# r, D# s) ===================================== testsuite/tests/primops/should_run/T24496.stdout ===================================== @@ -0,0 +1,2 @@ +(6.0,0.0) +(6.0,0.0) ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,3 +77,10 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) +test('T24496' + , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) + , js_skip # JS backend doesn't have an FMA implementation + , when(arch('wasm32'), skip) + , when(have_llvm(), extra_ways(["optllvm"])) + ] + , compile_and_run, ['-O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/82ccb8012ba532f0fa06dc6ff96d33217560088a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/82ccb8012ba532f0fa06dc6ff96d33217560088a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 02:53:31 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 04 Mar 2024 21:53:31 -0500 Subject: [Git][ghc/ghc][wip/exception-context] compiler: Don't show ExceptionContext of GhcExceptions Message-ID: <65e6892be80d4_4bf907ecdc70421ce@gitlab.mail> Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC Commits: 5dcc5481 by Ben Gamari at 2024-03-04T21:52:13-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - 1 changed file: - compiler/GHC/Utils/Panic.hs Changes: ===================================== compiler/GHC/Utils/Panic.hs ===================================== @@ -127,6 +127,10 @@ instance Exception GhcException where PlainProgramError str -> ProgramError str | otherwise = Nothing + -- Explicitly omit ExceptionContext since we generally don't + -- want backtraces and other context in GHC's user errors. + displayException = ghcGhcExceptionUnsafe + instance Show GhcException where showsPrec _ e = showGhcExceptionUnsafe e View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5dcc5481a48f55d95ed12114e8eb31b405ec8039 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5dcc5481a48f55d95ed12114e8eb31b405ec8039 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 03:31:29 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 04 Mar 2024 22:31:29 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: x86-ncg: Fix fma codegen when arguments are globals Message-ID: <65e69211a4511_4bf9090d3b90486e4@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 4a1b0eb0 by Cheng Shao at 2024-03-04T22:31:07-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 2d218101 by Ben Gamari at 2024-03-04T22:31:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - fc22d8dc by Ben Gamari at 2024-03-04T22:31:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 12 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - libraries/filepath - libraries/os-string - rts/RtsFlags.c - rts/include/rts/Flags.h - rts/sm/MBlock.c - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T - testsuite/tests/rts/all.T Changes: ===================================== compiler/GHC/CmmToAsm/X86/CodeGen.hs ===================================== @@ -3424,7 +3424,6 @@ genFMA3Code :: Width -> FMASign -> CmmExpr -> CmmExpr -> CmmExpr -> NatM Register genFMA3Code w signs x y z = do - -- For the FMA instruction, we want to compute x * y + z -- -- There are three possible instructions we could emit: @@ -3445,17 +3444,45 @@ genFMA3Code w signs x y z = do -- -- Currently we follow neither of these optimisations, -- opting to always use fmadd213 for simplicity. + -- + -- We would like to compute the result directly into the requested register. + -- To do so we must first compute `x` into the destination register. This is + -- only possible if the other arguments don't use the destination register. + -- We check for this and if there is a conflict we move the result only after + -- the computation. See #24496 how this went wrong in the past. let rep = floatFormat w (y_reg, y_code) <- getNonClobberedReg y - (z_reg, z_code) <- getNonClobberedReg z + (z_op, z_code) <- getNonClobberedOperand z x_code <- getAnyReg x + x_tmp <- getNewRegNat rep let fma213 = FMA3 rep signs FMA213 - code dst - = y_code `appOL` + + code, code_direct, code_mov :: Reg -> InstrBlock + -- Ideal: Compute the result directly into dst + code_direct dst = x_code dst `snocOL` + fma213 z_op y_reg dst + -- Fallback: Compute the result into a tmp reg and then move it. + code_mov dst = x_code x_tmp `snocOL` + fma213 z_op y_reg x_tmp `snocOL` + MOV rep (OpReg x_tmp) (OpReg dst) + + code dst = + y_code `appOL` z_code `appOL` - x_code dst `snocOL` - fma213 (OpReg z_reg) y_reg dst + ( if arg_regs_conflict then code_mov dst else code_direct dst ) + + where + + arg_regs_conflict = + y_reg == dst || + case z_op of + OpReg z_reg -> z_reg == dst + OpAddr amode -> dst `elem` addrModeRegs amode + OpImm {} -> False + + -- NB: Computing the result into a desired register using Any can be tricky. + -- So for now, we keep it simple. (See #24496). return (Any rep code) ----------- ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -232,6 +232,10 @@ Runtime system - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``. +- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual + memory address space reserved by the two step allocator on a 64-bit + platform. See :ghc-ticket:`24498`. + ``base`` library ~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -368,6 +368,18 @@ Miscellaneous RTS options thread can execute its exception handlers. The ``-xq`` controls the size of this additional quota. +.. rts-flag:: -xr ⟨size⟩ + + :default: 0.25T on aarch64, 1T otherwise + + This option controls the size of virtual memory address space + reserved by the two step allocator on a 64-bit platform. It can be + useful in scenarios where even reserving a large address range + without committing can be expensive (e.g. WSL1), or when you + actually have enough physical memory and want to support a Haskell + heap larger than 1T. ``-xr`` is a no-op if GHC is configured with + ``--disable-large-address-space`` or if the platform is 32-bit. + .. _rts-options-gc: RTS options to control the garbage collector ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 ===================================== rts/RtsFlags.c ===================================== @@ -186,6 +186,14 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.ringBell = false; RtsFlags.GcFlags.longGCSync = 0; /* detection turned off */ +#if defined(aarch64_HOST_ARCH) + // 1/4 TBytes, see 38c98e4f for rationale + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 38; +#else + // 1 TBytes + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 40; +#endif + RtsFlags.DebugFlags.scheduler = false; RtsFlags.DebugFlags.interpreter = false; RtsFlags.DebugFlags.weak = false; @@ -552,6 +560,11 @@ usage_text[] = { " -xq The allocation limit given to a thread after it receives", " an AllocationLimitExceeded exception. (default: 100k)", "", +#if defined(USE_LARGE_ADDRESS_SPACE) +" -xr The size of virtual memory address space reserved by the", +" two step allocator (default: 0.25T on aarch64, 1T otherwise)", +"", +#endif " -Mgrace=", " The amount of allocation after the program receives a", " HeapOverflow exception before the exception is thrown again, if", @@ -1820,6 +1833,12 @@ error = true; / BLOCK_SIZE; break; + case 'r': + OPTION_UNSAFE; + RtsFlags.GcFlags.addressSpaceSize + = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_INT_MAX); + break; + default: OPTION_SAFE; errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -2118,7 +2137,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max) m = atof(s); c = s[strlen(s)-1]; - if (c == 'g' || c == 'G') + if (c == 't' || c == 'T') + m *= (StgWord64)1024*1024*1024*1024; + else if (c == 'g' || c == 'G') m *= 1024*1024*1024; else if (c == 'm' || c == 'M') m *= 1024*1024; @@ -2737,4 +2758,3 @@ doingErasProfiling( void ) || RtsFlags.ProfFlags.eraSelector != 0); } #endif /* PROFILING */ - ===================================== rts/include/rts/Flags.h ===================================== @@ -89,6 +89,8 @@ typedef struct _GC_FLAGS { bool numa; /* Use NUMA */ StgWord numaMask; + + StgWord64 addressSpaceSize; /* large address space size in bytes */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== rts/sm/MBlock.c ===================================== @@ -659,20 +659,14 @@ initMBlocks(void) #if defined(USE_LARGE_ADDRESS_SPACE) { - W_ size; -#if defined(aarch64_HOST_ARCH) - size = (W_)1 << 38; // 1/4 TByte -#else - size = (W_)1 << 40; // 1 TByte -#endif void *startAddress = NULL; if (RtsFlags.GcFlags.heapBase) { startAddress = (void*) RtsFlags.GcFlags.heapBase; } - void *addr = osReserveHeapMemory(startAddress, &size); + void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize); mblock_address_space.begin = (W_)addr; - mblock_address_space.end = (W_)addr + size; + mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize; mblock_high_watermark = (W_)addr; } #elif SIZEOF_VOID_P == 8 ===================================== testsuite/tests/primops/should_run/T24496.hs ===================================== @@ -0,0 +1,18 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +import GHC.Exts + +twoProductFloat# :: Float# -> Float# -> (# Float#, Float# #) +twoProductFloat# x y = let !r = x `timesFloat#` y + in (# r, fmsubFloat# x y r #) +{-# NOINLINE twoProductFloat# #-} + +twoProductDouble# :: Double# -> Double# -> (# Double#, Double# #) +twoProductDouble# x y = let !r = x *## y + in (# r, fmsubDouble# x y r #) +{-# NOINLINE twoProductDouble# #-} + +main :: IO () +main = do + print $ case twoProductFloat# 2.0# 3.0# of (# r, s #) -> (F# r, F# s) + print $ case twoProductDouble# 2.0## 3.0## of (# r, s #) -> (D# r, D# s) ===================================== testsuite/tests/primops/should_run/T24496.stdout ===================================== @@ -0,0 +1,2 @@ +(6.0,0.0) +(6.0,0.0) ===================================== testsuite/tests/primops/should_run/all.T ===================================== @@ -77,3 +77,10 @@ test('FMA_ConstantFold' test('T21624', normal, compile_and_run, ['']) test('T23071', ignore_stdout, compile_and_run, ['']) test('T22710', normal, compile_and_run, ['']) +test('T24496' + , [ when(have_cpu_feature('fma'), extra_hc_opts('-mfma')) + , js_skip # JS backend doesn't have an FMA implementation + , when(arch('wasm32'), skip) + , when(have_llvm(), extra_ways(["optllvm"])) + ] + , compile_and_run, ['-O']) ===================================== testsuite/tests/rts/all.T ===================================== @@ -3,7 +3,7 @@ test('testblockalloc', compile_and_run, ['']) test('testmblockalloc', - [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'), + [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'), when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts compile_and_run, ['']) # -I0 is important: the idle GC will run the memory leak detector, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/31be53b2c08f1fe1d53917aeb227a3b8c49bbcf4...fc22d8dcf40f4a4eb8d020d8c2d7b8c6eca23449 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/31be53b2c08f1fe1d53917aeb227a3b8c49bbcf4...fc22d8dcf40f4a4eb8d020d8c2d7b8c6eca23449 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 03:58:13 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Mon, 04 Mar 2024 22:58:13 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T23942 Message-ID: <65e69855778e_4bf909d06e3050434@gitlab.mail> Matthew Craven pushed new branch wip/T23942 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T23942 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 05:55:23 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Tue, 05 Mar 2024 00:55:23 -0500 Subject: [Git][ghc/ghc][wip/t24277] base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Message-ID: <65e6b3cbec212_4bf90d0a1dbc57012@gitlab.mail> Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC Commits: ea65619c by Finley McIlwaine at 2024-03-04T21:54:57-08:00 base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Add functions for gettings the IDs of cost centres to the interface of `GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids, `CostCentreId`, with appropriate instances. Implements CLC proposal 235. Resolves #24277 - - - - - 11 changed files: - docs/users_guide/9.10.1-notes.rst - libraries/base/changelog.md - libraries/base/src/GHC/Exts.hs - libraries/base/src/GHC/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -244,6 +244,12 @@ Runtime system constructors in scope and the levity of ``t`` is statically known, then the constraint ``DataToTag t`` can always be solved. +- The ``CostCentreId`` type and ``currentCallStackIds :: IO [CostCentreId]`` + function for getting the IDs of the cost centers on the current stack are now + exported from ``GHC.Exts``. In addition to those, the ``ccId`` and + ``ccsToIds`` functions for getting ``CostCentreId``s are also exported from + ``GHC.Stack`. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Export `CostCentreId` from `GHC.Exts` and `GHC.Stack` + * Export `currentCallStackIds` from `GHC.Exts` and `GHC.Stack` + * Export `ccId` and `ccsToIds` from `GHC.Stack` + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -84,6 +84,8 @@ module GHC.Exts traceEvent, -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, ===================================== libraries/base/src/GHC/Stack.hs ===================================== @@ -18,6 +18,7 @@ module GHC.Stack (errorWithStackTrace, -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks CallStack, @@ -37,16 +38,19 @@ module GHC.Stack -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where -import GHC.Internal.Stack \ No newline at end of file +import GHC.Internal.Stack ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -103,6 +103,8 @@ module GHC.Internal.Exts -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, lazy, oneShot, considerAccessible, ===================================== libraries/ghc-internal/src/GHC/Internal/Stack.hs ===================================== @@ -2,6 +2,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- @@ -24,6 +25,7 @@ module GHC.Internal.Stack ( -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks @@ -38,14 +40,17 @@ module GHC.Internal.Stack ( -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc ===================================== @@ -16,14 +16,17 @@ ----------------------------------------------------------------------------- {-# LANGUAGE UnboxedTuples, MagicHash, NoImplicitPrelude #-} +{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving #-} module GHC.Internal.Stack.CCS ( -- * Call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, @@ -31,7 +34,9 @@ module GHC.Internal.Stack.CCS ( ccsParent, ccLabel, ccModule, + ccId, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack, ) where @@ -44,6 +49,12 @@ import GHC.Internal.Base import GHC.Internal.Ptr import GHC.Internal.IO.Encoding import GHC.Internal.List ( concatMap, reverse ) +import GHC.Internal.Word ( Word32 ) +import GHC.Internal.Show +import GHC.Internal.Read +import GHC.Internal.Enum +import GHC.Internal.Real +import GHC.Internal.Num #define PROFILING #include "Rts.h" @@ -54,6 +65,13 @@ data CostCentreStack -- | A cost-centre from GHC's cost-center profiler. data CostCentre +-- | Cost centre identifier +-- +-- @since 4.20.0.0 +newtype CostCentreId = CostCentreId Word32 + deriving (Show, Read) + deriving newtype (Eq, Ord, Bounded, Enum, Integral, Num, Real) + -- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current -- program was not compiled with profiling support). Takes a dummy argument -- which can be used to avoid the call to @getCurrentCCS@ being floated out by @@ -83,6 +101,12 @@ ccsCC p = peekByteOff p 4 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = peekByteOff p 8 +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO Word32 +ccId p = fmap CostCentreId $ peekByteOff p 0 + ccLabel :: Ptr CostCentre -> IO CString ccLabel p = peekByteOff p 4 @@ -99,6 +123,12 @@ ccsCC p = (# peek CostCentreStack, cc) p ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = (# peek CostCentreStack, prevStack) p +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO CostCentreId +ccId p = fmap CostCentreId $ (# peek CostCentre, ccID) p + -- | Get the label of a 'CostCentre'. ccLabel :: Ptr CostCentre -> IO CString ccLabel p = (# peek CostCentre, label) p @@ -125,6 +155,19 @@ ccSrcSpan p = (# peek CostCentre, srcloc) p currentCallStack :: IO [String] currentCallStack = ccsToStrings =<< getCurrentCCS () +-- | Returns a @[CostCentreId]@ representing the current call stack. This +-- can be useful for debugging. +-- +-- The implementation uses the call-stack simulation maintained by the +-- profiler, so it only works if the program was compiled with @-prof@ +-- and contains suitable SCC annotations (e.g. by using @-fprof-late@). +-- Otherwise, the list returned is likely to be empty or +-- uninformative. +-- +-- @since 4.20.0.0 +currentCallStackIds :: IO [CostCentreId] +currentCallStackIds = ccsToIds =<< getCurrentCCS () + -- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] @@ -141,6 +184,24 @@ ccsToStrings ccs0 = go ccs0 [] then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) +-- | Format a 'CostCentreStack' as a list of cost centre IDs. +-- +-- @since 4.20.0.0 +ccsToIds :: Ptr CostCentreStack -> IO [CostCentreId] +ccsToIds ccs0 = go ccs0 [] + where + go ccs acc + | ccs == nullPtr = return acc + | otherwise = do + cc <- ccsCC ccs + cc_id <- ccId cc + lbl <- GHC.peekCString utf8 =<< ccLabel cc + mdl <- GHC.peekCString utf8 =<< ccModule cc + parent <- ccsParent ccs + if (mdl == "MAIN" && lbl == "MAIN") + then return acc + else go parent (cc_id : acc) + -- | Get the stack trace attached to an object. -- -- @since base-4.5.0.0 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -5373,6 +5373,8 @@ module GHC.Exts where data Compact# type Constraint :: * type Constraint = CONSTRAINT LiftedRep + type CostCentreId :: * + newtype CostCentreId = ... type DataToTag :: forall {lev :: Levity}. TYPE (BoxedRep lev) -> Constraint class DataToTag a where dataToTag# :: a -> Int# @@ -5758,6 +5760,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9305,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9314,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11557,6 +11565,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11641,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12024,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12136,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12210,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12257,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12434,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12632,6 +12647,7 @@ instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12813,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -5727,6 +5727,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -12344,6 +12345,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -12351,14 +12354,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -12380,14 +12386,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String @@ -14592,6 +14601,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -14667,6 +14677,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -15051,6 +15062,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -15162,6 +15174,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -15235,6 +15248,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -15281,6 +15295,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -15659,6 +15674,7 @@ instance GHC.Classes.Eq GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.In instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -15824,6 +15840,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -5519,6 +5519,8 @@ module GHC.Exts where data Compact# type Constraint :: * type Constraint = CONSTRAINT LiftedRep + type CostCentreId :: * + newtype CostCentreId = ... type DataToTag :: forall {lev :: Levity}. TYPE (BoxedRep lev) -> Constraint class DataToTag a where dataToTag# :: a -> Int# @@ -5907,6 +5909,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9526,6 +9529,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9533,14 +9538,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11821,6 +11829,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11897,6 +11906,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Internal.Enum.Enum GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12291,6 +12301,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12403,6 +12414,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Internal.Read.Read GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12476,6 +12488,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12522,6 +12535,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12695,6 +12709,7 @@ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.ConsoleEvent.ConsoleE instance forall a. GHC.Internal.Show.Show a => GHC.Internal.Show.Show (GHC.Internal.Event.Windows.CbResult a) -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.HandleKey -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12907,6 +12922,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq GHC.Internal.Event.Windows.HandleKey -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Classes.Eq GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -13075,6 +13091,7 @@ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.I instance GHC.Classes.Ord GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Ord GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9303,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9312,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9338,14 +9344,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String @@ -11557,6 +11566,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11642,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12025,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12137,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12211,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12258,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12435,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12633,6 +12649,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12814,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ea65619cfd34e30885c69dac1a4f83888ac0ab5d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ea65619cfd34e30885c69dac1a4f83888ac0ab5d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 07:11:55 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 02:11:55 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: rts: add -xr option to control two step allocator reserved space size Message-ID: <65e6c5bbf164_4bf90f136c6c63749@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 5bed33cb by Cheng Shao at 2024-03-05T02:11:46-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 7850f462 by Ben Gamari at 2024-03-05T02:11:47-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 996ec365 by Ben Gamari at 2024-03-05T02:11:47-05:00 os-string: Bump submodule to 2.0.2 - - - - - 8 changed files: - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - libraries/filepath - libraries/os-string - rts/RtsFlags.c - rts/include/rts/Flags.h - rts/sm/MBlock.c - testsuite/tests/rts/all.T Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -232,6 +232,10 @@ Runtime system - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``. +- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual + memory address space reserved by the two step allocator on a 64-bit + platform. See :ghc-ticket:`24498`. + ``base`` library ~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -368,6 +368,18 @@ Miscellaneous RTS options thread can execute its exception handlers. The ``-xq`` controls the size of this additional quota. +.. rts-flag:: -xr ⟨size⟩ + + :default: 0.25T on aarch64, 1T otherwise + + This option controls the size of virtual memory address space + reserved by the two step allocator on a 64-bit platform. It can be + useful in scenarios where even reserving a large address range + without committing can be expensive (e.g. WSL1), or when you + actually have enough physical memory and want to support a Haskell + heap larger than 1T. ``-xr`` is a no-op if GHC is configured with + ``--disable-large-address-space`` or if the platform is 32-bit. + .. _rts-options-gc: RTS options to control the garbage collector ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 ===================================== rts/RtsFlags.c ===================================== @@ -186,6 +186,14 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.ringBell = false; RtsFlags.GcFlags.longGCSync = 0; /* detection turned off */ +#if defined(aarch64_HOST_ARCH) + // 1/4 TBytes, see 38c98e4f for rationale + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 38; +#else + // 1 TBytes + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 40; +#endif + RtsFlags.DebugFlags.scheduler = false; RtsFlags.DebugFlags.interpreter = false; RtsFlags.DebugFlags.weak = false; @@ -552,6 +560,11 @@ usage_text[] = { " -xq The allocation limit given to a thread after it receives", " an AllocationLimitExceeded exception. (default: 100k)", "", +#if defined(USE_LARGE_ADDRESS_SPACE) +" -xr The size of virtual memory address space reserved by the", +" two step allocator (default: 0.25T on aarch64, 1T otherwise)", +"", +#endif " -Mgrace=", " The amount of allocation after the program receives a", " HeapOverflow exception before the exception is thrown again, if", @@ -1820,6 +1833,12 @@ error = true; / BLOCK_SIZE; break; + case 'r': + OPTION_UNSAFE; + RtsFlags.GcFlags.addressSpaceSize + = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_INT_MAX); + break; + default: OPTION_SAFE; errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -2118,7 +2137,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max) m = atof(s); c = s[strlen(s)-1]; - if (c == 'g' || c == 'G') + if (c == 't' || c == 'T') + m *= (StgWord64)1024*1024*1024*1024; + else if (c == 'g' || c == 'G') m *= 1024*1024*1024; else if (c == 'm' || c == 'M') m *= 1024*1024; @@ -2737,4 +2758,3 @@ doingErasProfiling( void ) || RtsFlags.ProfFlags.eraSelector != 0); } #endif /* PROFILING */ - ===================================== rts/include/rts/Flags.h ===================================== @@ -89,6 +89,8 @@ typedef struct _GC_FLAGS { bool numa; /* Use NUMA */ StgWord numaMask; + + StgWord64 addressSpaceSize; /* large address space size in bytes */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== rts/sm/MBlock.c ===================================== @@ -659,20 +659,14 @@ initMBlocks(void) #if defined(USE_LARGE_ADDRESS_SPACE) { - W_ size; -#if defined(aarch64_HOST_ARCH) - size = (W_)1 << 38; // 1/4 TByte -#else - size = (W_)1 << 40; // 1 TByte -#endif void *startAddress = NULL; if (RtsFlags.GcFlags.heapBase) { startAddress = (void*) RtsFlags.GcFlags.heapBase; } - void *addr = osReserveHeapMemory(startAddress, &size); + void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize); mblock_address_space.begin = (W_)addr; - mblock_address_space.end = (W_)addr + size; + mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize; mblock_high_watermark = (W_)addr; } #elif SIZEOF_VOID_P == 8 ===================================== testsuite/tests/rts/all.T ===================================== @@ -3,7 +3,7 @@ test('testblockalloc', compile_and_run, ['']) test('testmblockalloc', - [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'), + [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'), when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts compile_and_run, ['']) # -I0 is important: the idle GC will run the memory leak detector, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fc22d8dcf40f4a4eb8d020d8c2d7b8c6eca23449...996ec36554fd7b6fd5cbf74a96541e9f0cae10ca -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fc22d8dcf40f4a4eb8d020d8c2d7b8c6eca23449...996ec36554fd7b6fd5cbf74a96541e9f0cae10ca You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 09:39:55 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 04:39:55 -0500 Subject: [Git][ghc/ghc][wip/eras-profiling-with-base] 89 commits: JS: add simple optimizer Message-ID: <65e6e86b9a2eb_3f00d94ec44c8419@gitlab.mail> Matthew Pickering pushed to branch wip/eras-profiling-with-base at Glasgow Haskell Compiler / GHC Commits: 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - cd24db4f by Matthew Pickering at 2024-03-05T09:39:23+00:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - 21 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b73832d82bb8baac79e4c58284526911f8c6773a...cd24db4fdc95a506aa0639422aec4e7c65145d79 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b73832d82bb8baac79e4c58284526911f8c6773a...cd24db4fdc95a506aa0639422aec4e7c65145d79 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 09:42:10 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 04:42:10 -0500 Subject: [Git][ghc/ghc][wip/eras-profiling-with-base] base: Reflect new era profiling RTS flags in GHC.RTS.Flags Message-ID: <65e6e8f29bdf4_3f00d95d7244875e6@gitlab.mail> Matthew Pickering pushed to branch wip/eras-profiling-with-base at Glasgow Haskell Compiler / GHC Commits: 7ec4ac34 by Matthew Pickering at 2024-03-05T09:42:00+00:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - 5 changed files: - libraries/base/changelog.md - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 Changes: ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to + reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`. + ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254)) + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc ===================================== @@ -274,6 +274,7 @@ data DoHeapProfile | HeapByLDV | HeapByClosureType | HeapByInfoTable + | HeapByEra -- ^ @since base-4.20.0.0 deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -289,6 +290,7 @@ instance Enum DoHeapProfile where fromEnum HeapByLDV = #{const HEAP_BY_LDV} fromEnum HeapByClosureType = #{const HEAP_BY_CLOSURE_TYPE} fromEnum HeapByInfoTable = #{const HEAP_BY_INFO_TABLE} + fromEnum HeapByEra = #{const HEAP_BY_ERA} toEnum #{const NO_HEAP_PROFILING} = NoHeapProfiling toEnum #{const HEAP_BY_CCS} = HeapByCCS @@ -299,6 +301,7 @@ instance Enum DoHeapProfile where toEnum #{const HEAP_BY_LDV} = HeapByLDV toEnum #{const HEAP_BY_CLOSURE_TYPE} = HeapByClosureType toEnum #{const HEAP_BY_INFO_TABLE} = HeapByInfoTable + toEnum #{const HEAP_BY_ERA} = HeapByEra toEnum e = errorWithoutStackTrace ("invalid enum for DoHeapProfile: " ++ show e) -- | Parameters of the cost-center profiler @@ -311,6 +314,7 @@ data ProfFlags = ProfFlags , startHeapProfileAtStartup :: Bool , startTimeProfileAtStartup :: Bool -- ^ @since base-4.20.0.0 , showCCSOnException :: Bool + , automaticEraIncrement :: Bool -- ^ @since 4.20.0.0 , maxRetainerSetSize :: Word , ccsLength :: Word , modSelector :: Maybe String @@ -320,6 +324,7 @@ data ProfFlags = ProfFlags , ccsSelector :: Maybe String , retainerSelector :: Maybe String , bioSelector :: Maybe String + , eraSelector :: Word -- ^ @since base-4.20.0.0 } deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -633,6 +638,8 @@ getProfFlags = do (#{peek PROFILING_FLAGS, startTimeProfileAtStartup} ptr :: IO CBool)) <*> (toBool <$> (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool)) + <*> (toBool <$> + (#{peek PROFILING_FLAGS, incrementUserEra} ptr :: IO CBool)) <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr <*> #{peek PROFILING_FLAGS, ccsLength} ptr <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr) @@ -642,6 +649,7 @@ getProfFlags = do <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, ccsSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, retainerSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, bioSelector} ptr) + <*> #{peek PROFILING_FLAGS, eraSelector} ptr getTraceFlags :: IO TraceFlags getTraceFlags = do ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9088,7 +9088,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -12071,7 +12071,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -12130,7 +12130,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -9253,7 +9253,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9312,7 +9312,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ec4ac341f1ee271a9f27666b6608326cb765c74 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ec4ac341f1ee271a9f27666b6608326cb765c74 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 10:12:27 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 05:12:27 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: rts: add -xr option to control two step allocator reserved space size Message-ID: <65e6f00b9e0c7_3f00d9142f42c99124@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 1bc4e7ab by Cheng Shao at 2024-03-05T05:12:05-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 48325bf7 by Ben Gamari at 2024-03-05T05:12:06-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 2254cd78 by Ben Gamari at 2024-03-05T05:12:06-05:00 os-string: Bump submodule to 2.0.2 - - - - - 8 changed files: - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - libraries/filepath - libraries/os-string - rts/RtsFlags.c - rts/include/rts/Flags.h - rts/sm/MBlock.c - testsuite/tests/rts/all.T Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -232,6 +232,10 @@ Runtime system - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``. +- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual + memory address space reserved by the two step allocator on a 64-bit + platform. See :ghc-ticket:`24498`. + ``base`` library ~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -368,6 +368,18 @@ Miscellaneous RTS options thread can execute its exception handlers. The ``-xq`` controls the size of this additional quota. +.. rts-flag:: -xr ⟨size⟩ + + :default: 0.25T on aarch64, 1T otherwise + + This option controls the size of virtual memory address space + reserved by the two step allocator on a 64-bit platform. It can be + useful in scenarios where even reserving a large address range + without committing can be expensive (e.g. WSL1), or when you + actually have enough physical memory and want to support a Haskell + heap larger than 1T. ``-xr`` is a no-op if GHC is configured with + ``--disable-large-address-space`` or if the platform is 32-bit. + .. _rts-options-gc: RTS options to control the garbage collector ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 ===================================== rts/RtsFlags.c ===================================== @@ -186,6 +186,14 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.ringBell = false; RtsFlags.GcFlags.longGCSync = 0; /* detection turned off */ +#if defined(aarch64_HOST_ARCH) + // 1/4 TBytes, see 38c98e4f for rationale + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 38; +#else + // 1 TBytes + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 40; +#endif + RtsFlags.DebugFlags.scheduler = false; RtsFlags.DebugFlags.interpreter = false; RtsFlags.DebugFlags.weak = false; @@ -552,6 +560,11 @@ usage_text[] = { " -xq The allocation limit given to a thread after it receives", " an AllocationLimitExceeded exception. (default: 100k)", "", +#if defined(USE_LARGE_ADDRESS_SPACE) +" -xr The size of virtual memory address space reserved by the", +" two step allocator (default: 0.25T on aarch64, 1T otherwise)", +"", +#endif " -Mgrace=", " The amount of allocation after the program receives a", " HeapOverflow exception before the exception is thrown again, if", @@ -1820,6 +1833,12 @@ error = true; / BLOCK_SIZE; break; + case 'r': + OPTION_UNSAFE; + RtsFlags.GcFlags.addressSpaceSize + = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_INT_MAX); + break; + default: OPTION_SAFE; errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -2118,7 +2137,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max) m = atof(s); c = s[strlen(s)-1]; - if (c == 'g' || c == 'G') + if (c == 't' || c == 'T') + m *= (StgWord64)1024*1024*1024*1024; + else if (c == 'g' || c == 'G') m *= 1024*1024*1024; else if (c == 'm' || c == 'M') m *= 1024*1024; @@ -2737,4 +2758,3 @@ doingErasProfiling( void ) || RtsFlags.ProfFlags.eraSelector != 0); } #endif /* PROFILING */ - ===================================== rts/include/rts/Flags.h ===================================== @@ -89,6 +89,8 @@ typedef struct _GC_FLAGS { bool numa; /* Use NUMA */ StgWord numaMask; + + StgWord64 addressSpaceSize; /* large address space size in bytes */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== rts/sm/MBlock.c ===================================== @@ -659,20 +659,14 @@ initMBlocks(void) #if defined(USE_LARGE_ADDRESS_SPACE) { - W_ size; -#if defined(aarch64_HOST_ARCH) - size = (W_)1 << 38; // 1/4 TByte -#else - size = (W_)1 << 40; // 1 TByte -#endif void *startAddress = NULL; if (RtsFlags.GcFlags.heapBase) { startAddress = (void*) RtsFlags.GcFlags.heapBase; } - void *addr = osReserveHeapMemory(startAddress, &size); + void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize); mblock_address_space.begin = (W_)addr; - mblock_address_space.end = (W_)addr + size; + mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize; mblock_high_watermark = (W_)addr; } #elif SIZEOF_VOID_P == 8 ===================================== testsuite/tests/rts/all.T ===================================== @@ -3,7 +3,7 @@ test('testblockalloc', compile_and_run, ['']) test('testmblockalloc', - [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'), + [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'), when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts compile_and_run, ['']) # -I0 is important: the idle GC will run the memory leak detector, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/996ec36554fd7b6fd5cbf74a96541e9f0cae10ca...2254cd78e793065c4eb8490321d6904bf7f1be2f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/996ec36554fd7b6fd5cbf74a96541e9f0cae10ca...2254cd78e793065c4eb8490321d6904bf7f1be2f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 10:35:30 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 05:35:30 -0500 Subject: [Git][ghc/ghc][wip/hadrian-cross-stage2] 14 commits: add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e6f5726078f_3f00d921e4a2c110951@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC Commits: 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - ecc35ffc by Matthew Pickering at 2024-03-05T10:20:49+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage2 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage2 package database. * Stage 2 cross compilers need to use stage3 libraries, so likewise, we should set to stage * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. - - - - - 2de8f171 by Matthew Pickering at 2024-03-05T10:20:49+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 0ab114b6 by Matthew Pickering at 2024-03-05T10:20:49+00:00 Add missing req_interp modifier to T18441fail3 and T18441fail19 These tests require the interpreter but they were failing in a different way with the javascript backend because the interpreter was disabled and stderr is ignored by the test. - - - - - 0efa8c8b by Matthew Pickering at 2024-03-05T10:20:49+00:00 Use explicit syntax rather than pure - - - - - fcd3f900 by Matthew Pickering at 2024-03-05T10:20:49+00:00 ci: Fail when bindist configure fails when installing bindist It is better to fail earlier if the configure step fails rather than carrying on for a more obscure error message. - - - - - bc787bb0 by Matthew Pickering at 2024-03-05T10:20:49+00:00 packaging: correctly propagate build/host/target to bindist configure script At the moment the host and target which we will produce a compiler for is fixed at the initial configure time. Therefore we need to persist the choice made at this time into the installation bindist as well so we look for the right tools, with the right prefixes at install time. In the future, we want to provide a bit more control about what kind of bindist we produce so the logic about what the host/target will have to be written by hadrian rather than persisted by the configure script. In particular with cross compilers we want to either build a normal stage 2 cross bindist or a stage 3 bindist, which creates a bindist which has a native compiler for the target platform. Fixes #21970 - - - - - ded9f536 by Matthew Pickering at 2024-03-05T10:20:49+00:00 hadrian: Fill in more of the default.host toolchain file When you are building a cross compiler this file will be used to build stage1 and it's libraries, so we need enough information here to work accurately. There is still more work to be done (see for example, word size is still fixed). - - - - - 42d26a43 by Matthew Pickering at 2024-03-05T10:20:49+00:00 hadrian: Disable docs when cross compiling Before there were a variety of ad-hoc places where doc building was disabled when cross compiling. * Some CI jobs sets --docs=none in gen_ci.hs * Some CI jobs set --docs=none in .gitlab/ci.sh * There was some logic in hadrian to not need the ["docs"] target when making a bindist. Now the situation is simple: * If you are cross compiling then defaultDocsTargets is empty by default. In theory, there is no reason why we can't build documentation for cross compiler bindists, but this is left to future work to generalise the documentation building rules to allow this (#24289) - - - - - 236d1a2f by Matthew Pickering at 2024-03-05T10:24:40+00:00 hadrian: Build stage 2 cross compilers * Most of hadrian is abstracted over the stage in order to remove the assumption that the target of all stages is the same platform. This allows the RTS to be built for two different targets for example. * Abstracts the bindist creation logic to allow building either normal or cross bindists. Normal bindists use stage 1 libraries and a stage 2 compiler. Cross bindists use stage 2 libararies and a stage 2 compiler. * hadrian: Make binary-dist-dir the default build target. This allows us to have the logic in one place about which libraries/stages to build with cross compilers. Fixes #24192 New hadrian target: * `binary-dist-dir-cross`: Build a cross compiler bindist (compiler = stage 1, libraries = stage 2) ------------------------- Metric Decrease: T10421a T10858 T11195 T11276 T11374 T11822 T15630 T17096 T18478 T20261 Metric Increase: parsing001 ------------------------- - - - - - 29759eef by Matthew Pickering at 2024-03-05T10:24:40+00:00 ci: Test cross bindists We remove the special logic for testing in-tree cross compilers and instead test cross compiler bindists, like we do for all other platforms. - - - - - 5449f5b0 by Matthew Pickering at 2024-03-05T10:24:40+00:00 ci: Javascript don't set CROSS_EMULATOR There is no CROSS_EMULATOR needed to run javascript binaries, so we don't set the CROSS_EMULATOR to some dummy value. - - - - - 69d8b51b by Matthew Pickering at 2024-03-05T10:24:40+00:00 ci: Introduce CROSS_STAGE variable In preparation for building and testing stage3 bindists we introduce the CROSS_STAGE variable which is used by a CI job to determine what kind of bindist the CI job should produce. At the moment we are only using CROSS_STAGE=2 but in the future we will have some jobs which set CROSS_STAGE=3 to produce native bindists for a target, but produced by a cross compiler, which can be tested on by another CI job on the native platform. CROSS_STAGE=2: Build a normal cross compiler bindist CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target - - - - - 30 changed files: - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - configure.ac - distrib/configure.ac.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - hadrian/bindist/Makefile - hadrian/bindist/config.mk.in - hadrian/cfg/default.host.target.in - hadrian/hadrian.cabal - + hadrian/src/BindistConfig.hs - hadrian/src/Builder.hs - hadrian/src/Context.hs - hadrian/src/Expression.hs - hadrian/src/Flavour.hs - hadrian/src/Flavour/Type.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/78f3bbdc0b305fc29aff6dc6ee77359f50603ae5...69d8b51b500b8b879413feb552c1b7bd9125e120 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/78f3bbdc0b305fc29aff6dc6ee77359f50603ae5...69d8b51b500b8b879413feb552c1b7bd9125e120 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 10:43:42 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 05:43:42 -0500 Subject: [Git][ghc/ghc][wip/is-cross] 216 commits: Always refresh profiling CCSes after running pending initializers Message-ID: <65e6f75edff41_3f00d9231683c11494f@gitlab.mail> Matthew Pickering pushed to branch wip/is-cross at Glasgow Haskell Compiler / GHC Commits: 119586ea by Alexis King at 2024-01-19T00:08:00-05:00 Always refresh profiling CCSes after running pending initializers Fixes #24171. - - - - - 9718d970 by Oleg Grenrus at 2024-01-19T00:08:36-05:00 Set default-language: GHC2021 in ghc library Go through compiler/ sources, and remove all BangPatterns (and other GHC2021 enabled extensions in these files). - - - - - 3ef71669 by Matthew Pickering at 2024-01-19T21:55:16-05:00 testsuite: Remove unused have_library function Also remove the hence unused testsuite option `--test-package-db`. Fixes #24342 - - - - - 5b7fa20c by Jade at 2024-01-19T21:55:53-05:00 Fix Spelling in the compiler Tracking: #16591 - - - - - 09875f48 by Matthew Pickering at 2024-01-20T12:20:44-05:00 testsuite: Implement `isInTreeCompiler` in a more robust way Just a small refactoring to avoid redundantly specifying the same strings in two different places. - - - - - 0d12b987 by Jade at 2024-01-20T12:21:20-05:00 Change maintainer email from cvs-ghc at haskell.org to ghc-devs at haskell.org. Fixes #22142 - - - - - 1fa1c00c by Jade at 2024-01-23T19:17:03-05:00 Enhance Documentation of functions exported by Data.Function This patch aims to improve the documentation of functions exported in Data.Function Tracking: #17929 Fixes: #10065 - - - - - ab47a43d by Jade at 2024-01-23T19:17:39-05:00 Improve documentation of hGetLine. - Add explanation for whether a newline is returned - Add examples Fixes #14804 - - - - - dd4af0e5 by Cheng Shao at 2024-01-23T19:18:17-05:00 Fix genapply for cross-compilation by nuking fragile CPP logic This commit fixes incorrectly built genapply when cross compiling (#24347) by nuking all fragile CPP logic in it from the orbit. All target-specific info are now read from DerivedConstants.h at runtime, see added note for details. Also removes a legacy Makefile and adds haskell language server support for genapply. - - - - - 0cda2b8b by Cheng Shao at 2024-01-23T19:18:17-05:00 rts: enable wasm32 register mapping The wasm backend didn't properly make use of all Cmm global registers due to #24347. Now that it is fixed, this patch re-enables full register mapping for wasm32, and we can now generate smaller & faster wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152. - - - - - 0325a6e5 by Greg Steuck at 2024-01-24T01:29:44-05:00 Avoid utf8 in primops.txt.pp comments They don't make it through readFile' without explicitly setting the encoding. See https://gitlab.haskell.org/ghc/ghc/-/issues/17755 - - - - - 1aaf0bd8 by David Binder at 2024-01-24T01:30:20-05:00 Bump hpc and hpc-bin submodule Bump hpc to 0.7.0.1 Bump hpc-bin to commit d1780eb2 - - - - - e693a4e8 by Ben Gamari at 2024-01-24T01:30:56-05:00 testsuite: Ignore stderr in T8089 Otherwise spurious "Killed: 9" messages to stderr may cause the test to fail. Fixes #24361. - - - - - a40f4ab2 by sheaf at 2024-01-24T14:04:33-05:00 Fix FMA instruction on LLVM We were emitting the wrong instructions for fused multiply-add operations on LLVM: - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd" - LLVM does not support other instructions such as "fmsub"; instead we implement these by flipping signs of some arguments - the instruction is an LLVM intrinsic, which requires handling it like a normal function call instead of a machine instruction Fixes #24223 - - - - - 69abc786 by Andrei Borzenkov at 2024-01-24T14:05:09-05:00 Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291) - - - - - 0ac8f385 by Cheng Shao at 2024-01-25T00:27:48-05:00 compiler: remove unused GHC.Linker module The GHC.Linker module is empty and unused, other than as a hack for the make build system. We can remove it now that make is long gone; the note is moved to GHC.Linker.Loader instead. - - - - - 699da01b by Hécate Moonlight at 2024-01-25T00:28:27-05:00 Clarification for newtype constructors when using `coerce` - - - - - b2d8cd85 by Matt Walker at 2024-01-26T09:50:08-05:00 Fix #24308 Add tests for semicolon separated where clauses - - - - - 0da490a1 by Ben Gamari at 2024-01-26T17:34:41-05:00 hsc2hs: Bump submodule - - - - - 3f442fd2 by Ben Gamari at 2024-01-26T17:34:41-05:00 Bump containers submodule to 0.7 - - - - - 82a1c656 by Sebastian Nagel at 2024-01-29T02:32:40-05:00 base: with{Binary}File{Blocking} only annotates own exceptions Fixes #20886 This ensures that inner, unrelated exceptions are not misleadingly annotated with the opened file. - - - - - 9294a086 by Andreas Klebinger at 2024-01-29T02:33:15-05:00 Fix fma warning when using llvm on aarch64. On aarch64 fma is always on so the +fma flag doesn't exist for that target. Hence no need to try and pass +fma to llvm. Fixes #24379 - - - - - ced2e731 by sheaf at 2024-01-29T17:27:12-05:00 No shadowing warnings for NoFieldSelector fields This commit ensures we don't emit shadowing warnings when a user shadows a field defined with NoFieldSelectors. Fixes #24381 - - - - - 8eeadfad by Patrick at 2024-01-29T17:27:51-05:00 Fix bug wrong span of nested_doc_comment #24378 close #24378 1. Update the start position of span in `nested_doc_comment` correctly. and hence the spans of identifiers of haddoc can be computed correctly. 2. add test `HaddockSpanIssueT24378`. - - - - - a557580f by Alexey Radkov at 2024-01-30T19:41:52-05:00 Fix irrelevant dodgy-foreign-imports warning on import f-pointers by value A test *сс018* is attached (not sure about the naming convention though). Note that without the fix, the test fails with the *dodgy-foreign-imports* warning passed to stderr. The warning disappears after the fix. GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as ```haskell foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ()) ``` where ```c void (*f)(int); ``` See a related real-world use-case [here](https://gitlab.com/daniel-casanueva/pcre-light/-/merge_requests/17). There, GHC warns on import of C function pointer `pcre_free`. - - - - - ca99efaf by Alexey Radkov at 2024-01-30T19:41:53-05:00 Rename test cc018 -> T24034 - - - - - 88c38dd5 by Ben Gamari at 2024-01-30T19:42:28-05:00 rts/TraverseHeap.c: Ensure that PosixSource.h is included first - - - - - ca2e919e by Simon Peyton Jones at 2024-01-31T09:29:45+00:00 Make decomposeRuleLhs a bit more clever This fixes #24370 by making decomposeRuleLhs undertand dictionary /functions/ as well as plain /dictionaries/ - - - - - 94ce031d by Teo Camarasu at 2024-02-01T05:49:49-05:00 doc: Add -Dn flag to user guide Resolves #24394 - - - - - 31553b11 by Ben Gamari at 2024-02-01T12:21:29-05:00 cmm: Introduce MO_RelaxedRead In hand-written Cmm it can sometimes be necessary to atomically load from memory deep within an expression (e.g. see the `CHECK_GC` macro). This MachOp provides a convenient way to do so without breaking the expression into multiple statements. - - - - - 0785cf81 by Ben Gamari at 2024-02-01T12:21:29-05:00 codeGen: Use relaxed accesses in ticky bumping - - - - - be423dda by Ben Gamari at 2024-02-01T12:21:29-05:00 base: use atomic write when updating timer manager - - - - - 8a310e35 by Ben Gamari at 2024-02-01T12:21:29-05:00 Use relaxed atomics to manipulate TSO status fields - - - - - d6809ee4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Add necessary barriers when manipulating TSO owner - - - - - 39e3ac5d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Use `switch` to branch on why_blocked This is a semantics-preserving refactoring. - - - - - 515eb33d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix synchronization on thread blocking state We now use a release barrier whenever we update a thread's blocking state. This required widening StgTSO.why_blocked as AArch64 does not support atomic writes on 16-bit values. - - - - - eb38812e by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadPaused This only affects an assertion in the debug RTS and only needs relaxed ordering. - - - - - 26c48dd6 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadStatus# - - - - - 6af43ab4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in Interpreter's preemption check - - - - - 9502ad3c by Ben Gamari at 2024-02-01T12:21:29-05:00 rts/Messages: Fix data race - - - - - 60802db5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts/Prof: Fix data race - - - - - ef8ccef5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use relaxed ordering on dirty/clean info tables updates When changing the dirty/clean state of a mutable object we needn't have any particular ordering. - - - - - 76fe2b75 by Ben Gamari at 2024-02-01T12:21:30-05:00 codeGen: Use relaxed-read in closureInfoPtr - - - - - a6316eb4 by Ben Gamari at 2024-02-01T12:21:30-05:00 STM: Use acquire loads when possible Full sequential consistency is not needed here. - - - - - 6bddfd3d by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use fence rather than redundant load Previously we would use an atomic load to ensure acquire ordering. However, we now have `ACQUIRE_FENCE_ON`, which allows us to express this more directly. - - - - - 55c65dbc by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Fix data races in profiling timer - - - - - 856b5e75 by Ben Gamari at 2024-02-01T12:21:30-05:00 Add Note [C11 memory model] - - - - - 6534da24 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: move generic cmm optimization logic in NCG to a standalone module This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. - - - - - 87e34888 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. - - - - - c6ce242e by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: enable generic cmm optimizations in wasm backend NCG This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. - - - - - 151dda4e by Andrei Borzenkov at 2024-02-01T12:22:43-05:00 Namespacing for WARNING/DEPRECATED pragmas (#24396) New syntax for WARNING and DEPRECATED pragmas was added, namely namespace specifierss: namespace_spec ::= 'type' | 'data' | {- empty -} warning ::= warning_category namespace_spec namelist strings deprecation ::= namespace_spec namelist strings A new data type was introduced to represent these namespace specifiers: data NamespaceSpecifier = NoSpecifier | TypeNamespaceSpecifier (EpToken "type") | DataNamespaceSpecifier (EpToken "data") Extension field XWarning now contains this NamespaceSpecifier. lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier and checks that the namespace of the found names matches the passed flag. With this change {-# WARNING data D "..." #-} pragma will only affect value namespace and {-# WARNING type D "..." #-} will only affect type namespace. The same logic is applicable to DEPRECATED pragmas. Finding duplicated warnings inside rnSrcWarnDecls now takes into consideration NamespaceSpecifier flag to allow warnings with the same names that refer to different namespaces. - - - - - 38c3afb6 by Bryan Richter at 2024-02-01T12:23:19-05:00 CI: Disable the test-cabal-reinstall job Fixes #24363 - - - - - 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - ef58d767 by Matthew Pickering at 2024-03-05T10:43:17+00:00 testsuite: Rename isCross() predicate to needsTargetWrapper() isCross() was a misnamed because it assumed that all cross targets would provide a target wrapper, but the two most common cross targets (javascript, wasm) don't need a target wrapper. Therefore we rename this predicate to `needsTargetWrapper()` so situations in the testsuite where we can check whether running executables requires a target wrapper or not. - - - - - 18 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitmodules - CODEOWNERS - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e68e2c2908eec11f0403d6dfd1de459d4a0bdbf5...ef58d767728ef98e060771d32ee69cdfd71b0f39 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e68e2c2908eec11f0403d6dfd1de459d4a0bdbf5...ef58d767728ef98e060771d32ee69cdfd71b0f39 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 10:44:42 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 05:44:42 -0500 Subject: [Git][ghc/ghc][wip/is-cross] testsuite: Rename isCross() predicate to needsTargetWrapper() Message-ID: <65e6f79a8e85f_3f00d9242b6dc115487@gitlab.mail> Matthew Pickering pushed to branch wip/is-cross at Glasgow Haskell Compiler / GHC Commits: f20a6dfa by Matthew Pickering at 2024-03-05T10:44:30+00:00 testsuite: Rename isCross() predicate to needsTargetWrapper() isCross() was a misnamed because it assumed that all cross targets would provide a target wrapper, but the two most common cross targets (javascript, wasm) don't need a target wrapper. Therefore we rename this predicate to `needsTargetWrapper()` so situations in the testsuite where we can check whether running executables requires a target wrapper or not. - - - - - 2 changed files: - testsuite/driver/testglobals.py - testsuite/driver/testlib.py Changes: ===================================== testsuite/driver/testglobals.py ===================================== @@ -182,8 +182,6 @@ class TestConfig: self.threads = 1 # An optional executable used to wrap target code execution - # When set tests which aren't marked with TestConfig.cross_okay - # are skipped. self.target_wrapper = None # tests which should be considered to be broken during this testsuite @@ -460,12 +458,6 @@ class TestOptions: # Should we copy the files of symlink the files for the test? self.copy_files = False - # Should the test be run in a cross-compiled tree? - # None: infer from test function - # True: run when --target-wrapper is set - # False: do not run in cross-compiled trees - self.cross_okay = None # type: Optional[bool] - # The extra hadrian dependencies we need for this particular test self.hadrian_deps = set(["test:ghc"]) # type: Set[str] ===================================== testsuite/driver/testlib.py ===================================== @@ -91,8 +91,8 @@ def setLocalTestOpts(opts: TestOptions) -> None: global testopts_ctx_var testopts_ctx_var.set(opts) -def isCross() -> bool: - """ Are we testing a cross-compiler? """ +def needsTargetWrapper() -> bool: + """ Do we need to use a target wrapper? """ return config.target_wrapper is not None def isCompilerStatsTest() -> bool: @@ -240,7 +240,7 @@ def req_dynamic_hs( name, opts ): opts.expect = 'fail' def req_interp( name, opts ): - if not config.have_interp or isCross(): + if not config.have_interp or needsTargetWrapper(): opts.expect = 'fail' # skip on wasm32, otherwise they show up as unexpected passes if arch('wasm32'): @@ -346,11 +346,10 @@ def req_host_target_ghc( name, opts ): """ When testing a cross GHC, some test cases require a host GHC as well (e.g. for compiling custom Setup.hs). This is not supported yet (#23236), so for - the time being we skip them when testing cross GHCs. However, this is not - the case for the JS backend. The JS backend is a cross-compiler that - produces code that the host can run. + the time being we skip them when testing cross GHCs. However, for cross targets + which don't need a target wrapper (e.g. javascript), we can still run these testcases. """ - if isCross() and not js_arch(): + if hasTargetWrapper(): opts.skip = True has_ls_files = None @@ -1290,21 +1289,18 @@ async def test_common_work(name: TestName, opts, all_ways = [WayName('ghci'), WayName('ghci-opt')] else: all_ways = [] - if isCross(): - opts.cross_okay = False + if needsTargetWrapper(): + opts.skip = True elif func in [makefile_test, run_command]: # makefile tests aren't necessarily runtime or compile-time # specific. Assume we can run them in all ways. See #16042 for what # happened previously. all_ways = config.compile_ways + config.run_ways - if isCross(): - opts.cross_okay = False + if needsTargetWrapper(): + opts.skip = True else: all_ways = [WayName('normal')] - if isCross() and opts.cross_okay is False: - opts.skip = True - # A test itself can request extra ways by setting opts.extra_ways all_ways = list(OrderedDict.fromkeys(all_ways + [way for way in opts.extra_ways if way not in all_ways])) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f20a6dfaf0afab5647916ff0c242121ac5321609 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f20a6dfaf0afab5647916ff0c242121ac5321609 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 10:59:58 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 05:59:58 -0500 Subject: [Git][ghc/ghc][wip/global-package-db] 4 commits: add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e6fb2ec4512_3f00d930527301222bb@gitlab.mail> Matthew Pickering pushed to branch wip/global-package-db at Glasgow Haskell Compiler / GHC Commits: 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 5d441f0a by Matthew Pickering at 2024-03-05T10:57:55+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - 8e3cb48c by Matthew Pickering at 2024-03-05T10:58:29+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 30 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - hadrian/bindist/Makefile - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Test.hs - libraries/ghc-boot/GHC/Settings/Utils.hs - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6a9a06debfc3acf933734c0b0e681e92e928e899...8e3cb48ce42cfd6ea83528ae70df486e011bb017 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6a9a06debfc3acf933734c0b0e681e92e928e899...8e3cb48ce42cfd6ea83528ae70df486e011bb017 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 11:02:31 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 06:02:31 -0500 Subject: [Git][ghc/ghc][wip/is-cross] testsuite: Rename isCross() predicate to needsTargetWrapper() Message-ID: <65e6fbc7233a1_3f00d932f1a7c128272@gitlab.mail> Matthew Pickering pushed to branch wip/is-cross at Glasgow Haskell Compiler / GHC Commits: 66e5e45a by Matthew Pickering at 2024-03-05T11:02:19+00:00 testsuite: Rename isCross() predicate to needsTargetWrapper() isCross() was a misnamed because it assumed that all cross targets would provide a target wrapper, but the two most common cross targets (javascript, wasm) don't need a target wrapper. Therefore we rename this predicate to `needsTargetWrapper()` so situations in the testsuite where we can check whether running executables requires a target wrapper or not. - - - - - 2 changed files: - testsuite/driver/testglobals.py - testsuite/driver/testlib.py Changes: ===================================== testsuite/driver/testglobals.py ===================================== @@ -182,8 +182,6 @@ class TestConfig: self.threads = 1 # An optional executable used to wrap target code execution - # When set tests which aren't marked with TestConfig.cross_okay - # are skipped. self.target_wrapper = None # tests which should be considered to be broken during this testsuite @@ -460,12 +458,6 @@ class TestOptions: # Should we copy the files of symlink the files for the test? self.copy_files = False - # Should the test be run in a cross-compiled tree? - # None: infer from test function - # True: run when --target-wrapper is set - # False: do not run in cross-compiled trees - self.cross_okay = None # type: Optional[bool] - # The extra hadrian dependencies we need for this particular test self.hadrian_deps = set(["test:ghc"]) # type: Set[str] ===================================== testsuite/driver/testlib.py ===================================== @@ -91,8 +91,8 @@ def setLocalTestOpts(opts: TestOptions) -> None: global testopts_ctx_var testopts_ctx_var.set(opts) -def isCross() -> bool: - """ Are we testing a cross-compiler? """ +def needsTargetWrapper() -> bool: + """ Do we need to use a target wrapper? """ return config.target_wrapper is not None def isCompilerStatsTest() -> bool: @@ -240,7 +240,7 @@ def req_dynamic_hs( name, opts ): opts.expect = 'fail' def req_interp( name, opts ): - if not config.have_interp or isCross(): + if not config.have_interp or needsTargetWrapper(): opts.expect = 'fail' # skip on wasm32, otherwise they show up as unexpected passes if arch('wasm32'): @@ -346,11 +346,10 @@ def req_host_target_ghc( name, opts ): """ When testing a cross GHC, some test cases require a host GHC as well (e.g. for compiling custom Setup.hs). This is not supported yet (#23236), so for - the time being we skip them when testing cross GHCs. However, this is not - the case for the JS backend. The JS backend is a cross-compiler that - produces code that the host can run. + the time being we skip them when testing cross GHCs. However, for cross targets + which don't need a target wrapper (e.g. javascript), we can still run these testcases. """ - if isCross() and not js_arch(): + if needsTargetWrapper(): opts.skip = True has_ls_files = None @@ -1290,21 +1289,18 @@ async def test_common_work(name: TestName, opts, all_ways = [WayName('ghci'), WayName('ghci-opt')] else: all_ways = [] - if isCross(): - opts.cross_okay = False + if needsTargetWrapper(): + opts.skip = True elif func in [makefile_test, run_command]: # makefile tests aren't necessarily runtime or compile-time # specific. Assume we can run them in all ways. See #16042 for what # happened previously. all_ways = config.compile_ways + config.run_ways - if isCross(): - opts.cross_okay = False + if needsTargetWrapper(): + opts.skip = True else: all_ways = [WayName('normal')] - if isCross() and opts.cross_okay is False: - opts.skip = True - # A test itself can request extra ways by setting opts.extra_ways all_ways = list(OrderedDict.fromkeys(all_ways + [way for way in opts.extra_ways if way not in all_ways])) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e5e45a745695ebf5b3fa01bad26dc467d33857 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e5e45a745695ebf5b3fa01bad26dc467d33857 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 12:27:10 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 07:27:10 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/bump-alpine-aarch64 Message-ID: <65e70f9e2208_3f00d957470701503a7@gitlab.mail> Matthew Pickering pushed new branch wip/bump-alpine-aarch64 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/bump-alpine-aarch64 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 13:16:48 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Tue, 05 Mar 2024 08:16:48 -0500 Subject: [Git][ghc/ghc][wip/exception-context] 14 commits: compiler: start deprecating cmmToRawCmmHook Message-ID: <65e71b408040c_3f00d96dca9b41696c6@gitlab.mail> Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC Commits: 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - e1468888 by Ben Gamari at 2024-03-05T08:16:41-05:00 Bump array submodule - - - - - ccb842af by Ben Gamari at 2024-03-05T08:16:41-05:00 Bump stm submodule - - - - - cc5cfe7e by Ben Gamari at 2024-03-05T08:16:41-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 868368d8 by Ben Gamari at 2024-03-05T08:16:41-05:00 testsuite/interface-stability: Update documentation - - - - - 6a74cfb5 by Ben Gamari at 2024-03-05T08:16:41-05:00 ghc-internal: comment formatting - - - - - 6879d943 by Ben Gamari at 2024-03-05T08:16:41-05:00 compiler: Default and warn ExceptionContext constraints - - - - - a75706f6 by Ben Gamari at 2024-03-05T08:16:41-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 1772a3f2 by Ben Gamari at 2024-03-05T08:16:41-05:00 users guide: Release notes for exception backtrace work - - - - - 1d6ce21d by Ben Gamari at 2024-03-05T08:16:42-05:00 ghc-experimental: Add dummy dependencies to work around #24436 This is a temporary measure to improve CI reliability until a proper solution is developed. - - - - - 6049c291 by Ben Gamari at 2024-03-05T08:16:42-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Data/Bag.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Hooks.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/HsToCore/Match/Constructor.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/profiling.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5dcc5481a48f55d95ed12114e8eb31b405ec8039...6049c29119e98fe7155e70d3384f48ed7c8104ca -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5dcc5481a48f55d95ed12114e8eb31b405ec8039...6049c29119e98fe7155e70d3384f48ed7c8104ca You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 13:24:05 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Tue, 05 Mar 2024 08:24:05 -0500 Subject: [Git][ghc/ghc][wip/T24471] 4 commits: add -fprof-late-overloaded and -fprof-late-overloaded-calls Message-ID: <65e71cf5b8517_3f00d96f704f81722ee@gitlab.mail> Ben Gamari pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - afb90d4c by Ben Gamari at 2024-03-05T08:22:58-05:00 ghc-experimental: Add dummy dependencies to work around #24436 This is a temporary measure to improve CI reliability until a proper solution is developed. - - - - - 427a7d2e by Simon Peyton Jones at 2024-03-05T08:23:23-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 3.5%, and much more in artificial cases. Metric Decrease: CoOpt_Read T12425 - - - - - 30 changed files: - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/ghc.cabal.in - docs/users_guide/9.10.1-notes.rst - docs/users_guide/profiling.rst - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - + testsuite/tests/primops/should_run/T24496.hs - + testsuite/tests/primops/should_run/T24496.stdout - testsuite/tests/primops/should_run/all.T - testsuite/tests/profiling/should_run/all.T - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls001.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.hs - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.prof.sample - + testsuite/tests/profiling/should_run/scc-prof-overloaded-calls002.stdout - + testsuite/tests/profiling/should_run/scc-prof-overloaded001.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fd5073c699a3b4d2583437094683ac13f9f088da...427a7d2e6175b972773ad9a43580a98e0c9e95de -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fd5073c699a3b4d2583437094683ac13f9f088da...427a7d2e6175b972773ad9a43580a98e0c9e95de You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 14:12:32 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 09:12:32 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e7285025a9d_3f00d98bb62c018893e@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 11ccf8d4 by Matthew Pickering at 2024-03-05T09:12:24-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - 9f8b4ddf by Matthew Pickering at 2024-03-05T09:12:24-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 841aad2e by Matthew Pickering at 2024-03-05T09:12:24-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 7c2fe093 by Matthew Pickering at 2024-03-05T09:12:24-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2ec4d32e by Ben Gamari at 2024-03-05T09:12:24-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 5472fdf1 by Ben Gamari at 2024-03-05T09:12:24-05:00 os-string: Bump submodule to 2.0.2 - - - - - 10 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/filepath - libraries/ghc-experimental/src/GHC/Profiling/Eras.hs - libraries/ghc-internal/ghc-internal.cabal - libraries/os-string Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -1031,7 +1031,7 @@ job_groups = -- (see Note [Object unloading]). fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native") - hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url") + hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage") tsan_jobs = modifyJobs ===================================== .gitlab/jobs.yaml ===================================== @@ -2330,7 +2330,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url", + "HADRIAN_ARGS": "--haddock-for-hackage", "LLC": "/bin/false", "OPT": "/bin/false", "RUNTEST_ARGS": "", @@ -4007,7 +4007,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids", + "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "LLC": "/bin/false", "OPT": "/bin/false", ===================================== .gitlab/rel_eng/upload_ghc_libs.py ===================================== @@ -49,6 +49,10 @@ def prep_base(): shutil.copy('config.guess', 'libraries/base') shutil.copy('config.sub', 'libraries/base') +def prep_ghc_internal(): + shutil.copy('config.guess', 'libraries/ghc-internal') + shutil.copy('config.sub', 'libraries/ghc-internal') + def build_copy_file(pkg: Package, f: Path): target = Path('_build') / 'stage1' / pkg.path / 'build' / f dest = pkg.path / f @@ -93,6 +97,8 @@ PACKAGES = { pkg.name: pkg for pkg in [ Package('base', Path("libraries/base"), prep_base), + Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal), + Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep), Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim), Package('integer-gmp', Path("libraries/integer-gmp"), no_prep), Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum), ===================================== hadrian/README.md ===================================== @@ -306,9 +306,9 @@ all of the documentation targets: You can pass several `--docs=...` flags, Hadrian will combine their effects. -To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag, -by default this will choose a url suitable for uploading to hackage but you might also want to pass something like -`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server. +To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag, +This will generate URLs which are appropiate for either uploading to a local hackage +server or the global hackage server. #### Source distribution ===================================== hadrian/src/CommandLine.hs ===================================== @@ -17,7 +17,6 @@ import System.Environment import qualified System.Directory as Directory import qualified Data.Set as Set -import Data.Maybe data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq) @@ -114,7 +113,7 @@ data DocArgs = DocArgs } deriving (Eq, Show) defaultDocArgs :: DocArgs -defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" } +defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" } readConfigure :: Either String (CommandLineArgs -> CommandLineArgs) readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually" @@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } } -readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) -readHaddockBaseUrl base_url = Right $ \flags -> - flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } } +readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs) +readHaddockBaseUrl = Right $ \flags -> + flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } } - where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url + where base_url = "/package/%pkg%/docs" readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) @@ -320,8 +319,8 @@ optDescrs = "Destination path for the bindist 'install' rule" , Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING") "Setting key to autocomplete, for the 'autocomplete' target." - , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL") - "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)." + , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl) + "Generate documentation suitable for upload to a hackage server." ] -- | A type-indexed map containing Hadrian command line arguments to be passed ===================================== hadrian/src/Settings/Builders/Haddock.hs ===================================== @@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat version <- expr $ pkgVersion pkg synopsis <- expr $ pkgSynopsis pkg haddocks <- expr $ haddockDependencies context - haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks] + haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks] hVersion <- expr $ pkgVersion haddock statsDir <- expr $ haddockStatsFilesDir baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs) - let baseUrl p = substituteTemplate baseUrlTemplate p + -- The path to where the docs for a package are + let docpath p = substituteTemplate baseUrlTemplate p + -- The path to where the src folder is for a package (typically docs ++ "/src/") + let srcpath p = docpath p ++ "/src/" ghcOpts <- haddockGhcArgs -- These are the options which are necessary to perform the build. Additional -- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are @@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat , arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion) , map ("--hide=" ++) <$> getContextData otherModules - , pure [ "--read-interface=../" ++ p - ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME}," - ++ haddock | (p, haddock) <- haddocks_with_versions ] + , pure [ "--read-interface=" ++ docpath (p, pid) + ++ "," ++ srcpath (p, pid) ++ "," + ++ haddock | (p, pid, haddock) <- haddocks_with_versions ] , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ] , arg "+RTS" , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t") , arg "--machine-readable" , arg "-RTS" ] ] -substituteTemplate :: String -> String -> String -substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate +substituteTemplate :: String -> (String, String) -> String +substituteTemplate baseTemplate (pkg, pkgId) = + T.unpack + . T.replace "%pkg%" (T.pack pkg) + . T.replace "%pkgid%" (T.pack pkgId) + . T.pack $ baseTemplate ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/ghc-experimental/src/GHC/Profiling/Eras.hs ===================================== @@ -1,7 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} --- | TODO move this module into ghc-internals module GHC.Profiling.Eras ( setUserEra , getUserEra , incrementUserEra ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -17,7 +17,7 @@ description: extra-tmp-files: autom4te.cache - base.buildinfo + ghc-internal.buildinfo config.log config.status include/EventConfig.h @@ -25,8 +25,8 @@ extra-tmp-files: extra-source-files: aclocal.m4 - base.buildinfo.in - changelog.md + ghc-internal.buildinfo.in + CHANGELOG.md configure configure.ac include/CTypes.h ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2254cd78e793065c4eb8490321d6904bf7f1be2f...5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2254cd78e793065c4eb8490321d6904bf7f1be2f...5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 14:20:49 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Tue, 05 Mar 2024 09:20:49 -0500 Subject: [Git][ghc/ghc][wip/t24277] base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Message-ID: <65e72a416fc3e_3f00d98d0cc7819588c@gitlab.mail> Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC Commits: 91c6bb55 by Finley McIlwaine at 2024-03-05T06:20:30-08:00 base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Add functions for gettings the IDs of cost centres to the interface of `GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids, `CostCentreId`, with appropriate instances. Implements CLC proposal 235. Resolves #24277 - - - - - 11 changed files: - docs/users_guide/9.10.1-notes.rst - libraries/base/changelog.md - libraries/base/src/GHC/Exts.hs - libraries/base/src/GHC/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -244,6 +244,12 @@ Runtime system constructors in scope and the levity of ``t`` is statically known, then the constraint ``DataToTag t`` can always be solved. +- The ``CostCentreId`` type and ``currentCallStackIds :: IO [CostCentreId]`` + function for getting the IDs of the cost centers on the current stack are now + exported from ``GHC.Exts``. In addition to those, the ``ccId`` and + ``ccsToIds`` functions for getting ``CostCentreId``\s are also exported from + ``GHC.Stack`. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Export `CostCentreId` from `GHC.Exts` and `GHC.Stack` + * Export `currentCallStackIds` from `GHC.Exts` and `GHC.Stack` + * Export `ccId` and `ccsToIds` from `GHC.Stack` + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -84,6 +84,8 @@ module GHC.Exts traceEvent, -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, ===================================== libraries/base/src/GHC/Stack.hs ===================================== @@ -18,6 +18,7 @@ module GHC.Stack (errorWithStackTrace, -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks CallStack, @@ -37,16 +38,19 @@ module GHC.Stack -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where -import GHC.Internal.Stack \ No newline at end of file +import GHC.Internal.Stack ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -103,6 +103,8 @@ module GHC.Internal.Exts -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, lazy, oneShot, considerAccessible, ===================================== libraries/ghc-internal/src/GHC/Internal/Stack.hs ===================================== @@ -2,6 +2,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- @@ -24,6 +25,7 @@ module GHC.Internal.Stack ( -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks @@ -38,14 +40,17 @@ module GHC.Internal.Stack ( -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc ===================================== @@ -16,14 +16,17 @@ ----------------------------------------------------------------------------- {-# LANGUAGE UnboxedTuples, MagicHash, NoImplicitPrelude #-} +{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving #-} module GHC.Internal.Stack.CCS ( -- * Call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, @@ -31,7 +34,9 @@ module GHC.Internal.Stack.CCS ( ccsParent, ccLabel, ccModule, + ccId, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack, ) where @@ -44,6 +49,12 @@ import GHC.Internal.Base import GHC.Internal.Ptr import GHC.Internal.IO.Encoding import GHC.Internal.List ( concatMap, reverse ) +import GHC.Internal.Word ( Word32 ) +import GHC.Internal.Show +import GHC.Internal.Read +import GHC.Internal.Enum +import GHC.Internal.Real +import GHC.Internal.Num #define PROFILING #include "Rts.h" @@ -54,6 +65,13 @@ data CostCentreStack -- | A cost-centre from GHC's cost-center profiler. data CostCentre +-- | Cost centre identifier +-- +-- @since 4.20.0.0 +newtype CostCentreId = CostCentreId Word32 + deriving (Show, Read) + deriving newtype (Eq, Ord, Bounded, Enum, Integral, Num, Real) + -- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current -- program was not compiled with profiling support). Takes a dummy argument -- which can be used to avoid the call to @getCurrentCCS@ being floated out by @@ -83,6 +101,12 @@ ccsCC p = peekByteOff p 4 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = peekByteOff p 8 +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO Word32 +ccId p = fmap CostCentreId $ peekByteOff p 0 + ccLabel :: Ptr CostCentre -> IO CString ccLabel p = peekByteOff p 4 @@ -99,6 +123,12 @@ ccsCC p = (# peek CostCentreStack, cc) p ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = (# peek CostCentreStack, prevStack) p +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO CostCentreId +ccId p = fmap CostCentreId $ (# peek CostCentre, ccID) p + -- | Get the label of a 'CostCentre'. ccLabel :: Ptr CostCentre -> IO CString ccLabel p = (# peek CostCentre, label) p @@ -125,6 +155,19 @@ ccSrcSpan p = (# peek CostCentre, srcloc) p currentCallStack :: IO [String] currentCallStack = ccsToStrings =<< getCurrentCCS () +-- | Returns a @[CostCentreId]@ representing the current call stack. This +-- can be useful for debugging. +-- +-- The implementation uses the call-stack simulation maintained by the +-- profiler, so it only works if the program was compiled with @-prof@ +-- and contains suitable SCC annotations (e.g. by using @-fprof-late@). +-- Otherwise, the list returned is likely to be empty or +-- uninformative. +-- +-- @since 4.20.0.0 +currentCallStackIds :: IO [CostCentreId] +currentCallStackIds = ccsToIds =<< getCurrentCCS () + -- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] @@ -141,6 +184,24 @@ ccsToStrings ccs0 = go ccs0 [] then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) +-- | Format a 'CostCentreStack' as a list of cost centre IDs. +-- +-- @since 4.20.0.0 +ccsToIds :: Ptr CostCentreStack -> IO [CostCentreId] +ccsToIds ccs0 = go ccs0 [] + where + go ccs acc + | ccs == nullPtr = return acc + | otherwise = do + cc <- ccsCC ccs + cc_id <- ccId cc + lbl <- GHC.peekCString utf8 =<< ccLabel cc + mdl <- GHC.peekCString utf8 =<< ccModule cc + parent <- ccsParent ccs + if (mdl == "MAIN" && lbl == "MAIN") + then return acc + else go parent (cc_id : acc) + -- | Get the stack trace attached to an object. -- -- @since base-4.5.0.0 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -5373,6 +5373,8 @@ module GHC.Exts where data Compact# type Constraint :: * type Constraint = CONSTRAINT LiftedRep + type CostCentreId :: * + newtype CostCentreId = ... type DataToTag :: forall {lev :: Levity}. TYPE (BoxedRep lev) -> Constraint class DataToTag a where dataToTag# :: a -> Int# @@ -5758,6 +5760,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9305,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9314,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11557,6 +11565,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11641,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12024,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12136,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12210,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12257,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12434,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12632,6 +12647,7 @@ instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12813,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -5727,6 +5727,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -12344,6 +12345,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -12351,14 +12354,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -12380,14 +12386,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String @@ -14592,6 +14601,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -14667,6 +14677,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -15051,6 +15062,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -15162,6 +15174,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -15235,6 +15248,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -15281,6 +15295,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -15659,6 +15674,7 @@ instance GHC.Classes.Eq GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.In instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -15824,6 +15840,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -5519,6 +5519,8 @@ module GHC.Exts where data Compact# type Constraint :: * type Constraint = CONSTRAINT LiftedRep + type CostCentreId :: * + newtype CostCentreId = ... type DataToTag :: forall {lev :: Levity}. TYPE (BoxedRep lev) -> Constraint class DataToTag a where dataToTag# :: a -> Int# @@ -5907,6 +5909,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9526,6 +9529,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9533,14 +9538,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11821,6 +11829,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11897,6 +11906,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Internal.Enum.Enum GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12291,6 +12301,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12403,6 +12414,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Internal.Read.Read GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12476,6 +12488,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12522,6 +12535,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12695,6 +12709,7 @@ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.ConsoleEvent.ConsoleE instance forall a. GHC.Internal.Show.Show a => GHC.Internal.Show.Show (GHC.Internal.Event.Windows.CbResult a) -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.HandleKey -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12907,6 +12922,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq GHC.Internal.Event.Windows.HandleKey -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Classes.Eq GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -13075,6 +13091,7 @@ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.I instance GHC.Classes.Ord GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Ord GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9303,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9312,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9338,14 +9344,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String @@ -11557,6 +11566,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11642,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12025,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12137,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12211,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12258,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12435,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12633,6 +12649,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12814,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/91c6bb55a937d97bf9647e0d89f80c93464b5123 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/91c6bb55a937d97bf9647e0d89f80c93464b5123 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 14:32:18 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Tue, 05 Mar 2024 09:32:18 -0500 Subject: [Git][ghc/ghc][wip/T24471] Three compile perf improvements with deep nesting Message-ID: <65e72cf299a8f_28e20e4275d428665@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 557ac3d9 by Simon Peyton Jones at 2024-03-05T14:32:01+00:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 3.5%, and much more in artificial cases. Metric Decrease: CoOpt_Read T12425 - - - - - 6 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [ collect_compiler_stats('all', 5) ], + multimod_compile, ['T24471', '-v0 -O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/557ac3d9646c37baf627e784cf078bf9cb866f6f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/557ac3d9646c37baf627e784cf078bf9cb866f6f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 17:18:29 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Tue, 05 Mar 2024 12:18:29 -0500 Subject: [Git][ghc/ghc][wip/eras-profiling-with-base] base: Reflect new era profiling RTS flags in GHC.RTS.Flags Message-ID: <65e753e518221_28e20e508258c930fd@gitlab.mail> Matthew Pickering pushed to branch wip/eras-profiling-with-base at Glasgow Haskell Compiler / GHC Commits: 6c76be87 by Matthew Pickering at 2024-03-05T17:18:20+00:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - 6 changed files: - libraries/base/changelog.md - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to + reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`. + ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254)) + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc ===================================== @@ -274,6 +274,7 @@ data DoHeapProfile | HeapByLDV | HeapByClosureType | HeapByInfoTable + | HeapByEra -- ^ @since base-4.20.0.0 deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -289,6 +290,7 @@ instance Enum DoHeapProfile where fromEnum HeapByLDV = #{const HEAP_BY_LDV} fromEnum HeapByClosureType = #{const HEAP_BY_CLOSURE_TYPE} fromEnum HeapByInfoTable = #{const HEAP_BY_INFO_TABLE} + fromEnum HeapByEra = #{const HEAP_BY_ERA} toEnum #{const NO_HEAP_PROFILING} = NoHeapProfiling toEnum #{const HEAP_BY_CCS} = HeapByCCS @@ -299,6 +301,7 @@ instance Enum DoHeapProfile where toEnum #{const HEAP_BY_LDV} = HeapByLDV toEnum #{const HEAP_BY_CLOSURE_TYPE} = HeapByClosureType toEnum #{const HEAP_BY_INFO_TABLE} = HeapByInfoTable + toEnum #{const HEAP_BY_ERA} = HeapByEra toEnum e = errorWithoutStackTrace ("invalid enum for DoHeapProfile: " ++ show e) -- | Parameters of the cost-center profiler @@ -311,6 +314,7 @@ data ProfFlags = ProfFlags , startHeapProfileAtStartup :: Bool , startTimeProfileAtStartup :: Bool -- ^ @since base-4.20.0.0 , showCCSOnException :: Bool + , automaticEraIncrement :: Bool -- ^ @since 4.20.0.0 , maxRetainerSetSize :: Word , ccsLength :: Word , modSelector :: Maybe String @@ -320,6 +324,7 @@ data ProfFlags = ProfFlags , ccsSelector :: Maybe String , retainerSelector :: Maybe String , bioSelector :: Maybe String + , eraSelector :: Word -- ^ @since base-4.20.0.0 } deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -633,6 +638,8 @@ getProfFlags = do (#{peek PROFILING_FLAGS, startTimeProfileAtStartup} ptr :: IO CBool)) <*> (toBool <$> (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool)) + <*> (toBool <$> + (#{peek PROFILING_FLAGS, incrementUserEra} ptr :: IO CBool)) <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr <*> #{peek PROFILING_FLAGS, ccsLength} ptr <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr) @@ -642,6 +649,7 @@ getProfFlags = do <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, ccsSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, retainerSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, bioSelector} ptr) + <*> #{peek PROFILING_FLAGS, eraSelector} ptr getTraceFlags :: IO TraceFlags getTraceFlags = do ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -12071,7 +12071,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -12122,6 +12122,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -12130,7 +12131,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -9253,7 +9253,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9304,6 +9304,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9312,7 +9313,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c76be87d8e1d50dcb6905a3837c7518f10b3920 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c76be87d8e1d50dcb6905a3837c7518f10b3920 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 17:31:45 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Tue, 05 Mar 2024 12:31:45 -0500 Subject: [Git][ghc/ghc][wip/T23942] 2 commits: testsuite changes from implicit GHC.Num.BigNat deps Message-ID: <65e7570197410_28e20e5296170969cf@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 088b0243 by Matthew Craven at 2024-03-05T07:30:56-05:00 testsuite changes from implicit GHC.Num.BigNat deps - - - - - 023bf72c by Matthew Craven at 2024-03-05T12:30:27-05:00 Attempt to properly track more implicit dependencies See the new Note [Tracking implicit dependencies]. - - - - - 16 changed files: - compiler/GHC/Driver/MakeFile.hs - compiler/GHC/Iface/Type.hs-boot - libraries/ghc-bignum/src/GHC/Num/Primitives.hs - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Data/Tuple.hs - libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs-boot - libraries/ghc-internal/src/GHC/Internal/IO/Handle/Types.hs-boot - libraries/ghc-internal/src/GHC/Internal/Maybe.hs - libraries/ghc-internal/src/GHC/Internal/Stack/Types.hs - libraries/ghc-internal/src/GHC/Internal/TypeError.hs - libraries/ghc-prim/GHC/Classes.hs - libraries/ghc-prim/GHC/Tuple.hs - testsuite/tests/plugins/plugins09.stdout - testsuite/tests/plugins/plugins10.stdout - testsuite/tests/plugins/plugins11.stdout - testsuite/tests/plugins/static-plugins.stdout Changes: ===================================== compiler/GHC/Driver/MakeFile.hs ===================================== @@ -19,6 +19,7 @@ import qualified GHC import GHC.Driver.Monad import GHC.Driver.DynFlags import GHC.Driver.Ppr +import GHC.Driver.Config.Finder import GHC.Utils.Misc import GHC.Driver.Env import GHC.Driver.Errors.Types @@ -34,20 +35,26 @@ import GHC.Utils.TmpFs import GHC.Iface.Load (cannotFindModule) +import GHC.Builtin.Names + import GHC.Unit.Module import GHC.Unit.Module.ModSummary import GHC.Unit.Module.Graph import GHC.Unit.Finder +import GHC.Unit.Home +import GHC.Unit.Env import GHC.Utils.Exception import GHC.Utils.Error import GHC.Utils.Logger +import GHC.LanguageExtensions + import System.Directory import System.FilePath import System.IO import System.IO.Error ( isEOFError ) -import Control.Monad ( when, forM_ ) +import Control.Monad import Data.Maybe ( isJust ) import Data.IORef import qualified Data.Set as Set @@ -229,19 +236,22 @@ processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC (ModuleNode _ node)) obj_file = msObjFilePath node obj_files = insertSuffixes obj_file extra_suffixes - do_imp loc is_boot pkg_qual imp_mod + handle_hi_file hi_file = do + { let hi_files = insertSuffixes hi_file extra_suffixes + write_dep (obj,hi) = writeDependency root hdl [obj] hi + + -- Add one dependency for each suffix; + -- e.g. A.o : B.hi + -- A.x_o : B.x_hi + ; mapM_ write_dep (obj_files `zip` hi_files) } + + do_import loc is_boot pkg_qual imp_mod = do { mb_hi <- findDependency hsc_env loc pkg_qual imp_mod is_boot include_pkg_deps ; case mb_hi of { Nothing -> return () ; - Just hi_file -> do - { let hi_files = insertSuffixes hi_file extra_suffixes - write_dep (obj,hi) = writeDependency root hdl [obj] hi - - -- Add one dependency for each suffix; - -- e.g. A.o : B.hi - -- A.x_o : B.x_hi - ; mapM_ write_dep (obj_files `zip` hi_files) }}} + Just hi_file -> handle_hi_file hi_file + }} -- Emit std dependency of the object(s) on the source file @@ -272,15 +282,91 @@ processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC (ModuleNode _ node)) -- Emit a dependency for each import - ; let do_imps is_boot idecls = sequence_ - [ do_imp loc is_boot mb_pkg mod + ; let do_imports is_boot idecls = sequence_ + [ do_import loc is_boot mb_pkg mod | (mb_pkg, L loc mod) <- idecls, mod `notElem` excl_mods ] - ; do_imps IsBoot (ms_srcimps node) - ; do_imps NotBoot (ms_imps node) + ; do_imports IsBoot (ms_srcimps node) + ; do_imports NotBoot (ms_imps node) + + -- Handle implicit built-in stuff: + -- see Note [Tracking implicit dependencies] + ; let + do_implicit_import :: Module -> IO () + do_implicit_import mod = when include_pkg_deps $ do + -- hard part: get a ModuleLoc from a Module and the env + -- This is mostly copied from GHC.Iface.LoadfindAndReadIface. + -- Surely there is a better way to do this? + let im = fst (getModuleInstantiation mod) + fc = hsc_FC hsc_env + fopts = initFinderOpts (hsc_dflags hsc_env) + other_fopts = initFinderOpts . homeUnitEnv_dflags <$> (hsc_HUG hsc_env) + unit_state = hsc_units hsc_env + mhome_unit = hsc_home_unit_maybe hsc_env + mb_found <- findExactModule fc fopts other_fopts unit_state mhome_unit im + case mb_found of + InstalledFound ml _ -> handle_hi_file (ml_hi_file ml) + InstalledNoPackage _ -> panic "processDeps.do_implicit_import" + InstalledNotFound _ _ -> panic "processDeps.do_implicit_import" + + -- every module implicitly depends on GHC.Types + ; unless (ms_mod node == gHC_TYPES) $ + do_implicit_import gHC_TYPES + + -- A module may implicitly depend on GHC.Tuple if ListTuplePuns is set + ; when (xopt ListTuplePuns dflags) $ + -- see Note [Tracking implicit dependencies], wrinkle TID2 + unless (isHomeUnitInstanceOf (hsc_home_unit hsc_env) primUnitId) $ + do_implicit_import gHC_INTERNAL_TUPLE } +{- +Note [Tracking implicit dependencies] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +There are several wired-in things that ghc will read interface +files to look up even if they are not imported. They include + + * Monad-related stuff in GHC.Internal.Base, if `do` notation is used + * Tuple-related stuff in GHC.Tuple, if the built-in tuple syntax is used + * TypeRep-related stuff in GHC.Types, unless `-dno-typeable-binds` is set + * deriving-related stuff mostly elsewhere in ghc-prim + +In order for GHC's build system to work reliably, we have to track the +implicit dependencies introduced by GHC's habit of reading these +interfaces. So we include them in our -M output if -include-pkg-deps +is set, with the following wrinkles: + +(TID1) We don't actually bother adding implicit dependencies for + Monad, Arrow, etc. because the program will presumably fail to + typecheck unless these are reachable via explicit imports anyway. + +(TID2) Users can opt out of implicitly depending on GHC.Tuple with the + NoListTuplePuns languge extension. Ideally we would just turn off + ListTuplePuns in the bits of ghc-prim that GHC.Tuple depends on, but + when I tried, I got stupid errors like this: + + libraries/ghc-prim/GHC/Types.hs:371:15: error: [GHC-46574] + Cannot parse data constructor in a data/newtype declaration: [] + | + 371 | data List a = [] | a : List a + | ^^ + + So for now we don't emit this dependency in the `ghc-prim` package, + which must explicitly import GHC.Tuple for build-order reasons. + Yuck! But this doesn't make things in `ghc-prim` much worse, because + +(TID3) We don't even try to track dependencies involving `deriving`. + We try to prevent this from causing problems by ensuring that any + machinery `deriving` needs to reference related to a typeclass is + imported from the defining module for that class. For example, the + class Eq is defined in GHC.Classes, and derived Eq instances can + reference GHC.Magic.dataToTag#. So we make sure that GHC.Magic is + imported in GHC.Classes. + + Failing to do this for the Lift class caused #22229, which is sadly + still open as of March 2024. +-} findDependency :: HscEnv -> SrcSpan ===================================== compiler/GHC/Iface/Type.hs-boot ===================================== @@ -5,10 +5,6 @@ module GHC.Iface.Type ) where --- Empty import to influence the compilation ordering. --- See Note [Depend on GHC.Num.Integer] in GHC.Base -import GHC.Base () - data IfaceAppArgs data IfaceType ===================================== libraries/ghc-bignum/src/GHC/Num/Primitives.hs ===================================== @@ -97,7 +97,6 @@ import GHC.Prim.Exception import GHC.Prim import GHC.Types -import GHC.Tuple () -- See Note [Depend on GHC.Tuple] in GHC.Base default () ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -326,8 +326,7 @@ import GHC.Internal.Err import GHC.Internal.Maybe import {-# SOURCE #-} GHC.Internal.IO (mkUserError, mplusIO) -import GHC.Tuple (Solo (MkSolo)) -- Note [Depend on GHC.Tuple] -import GHC.Num.Integer () -- Note [Depend on GHC.Num.Integer] +import GHC.Tuple (Solo (MkSolo)) -- See Note [Semigroup stimes cycle] import {-# SOURCE #-} GHC.Internal.Num (Num (..)) @@ -348,38 +347,6 @@ infixl 4 <*>, <*, *>, <**> default () -- Double isn't available yet {- -Note [Depend on GHC.Num.Integer] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The Integer type is special because GHC.CoreToStg.Prep.mkConvertNumLiteral -lookups names in ghc-bignum interfaces to construct Integer literal values. -Currently it reads the interface file whether or not the current module *has* -any Integer literals, so it's important that GHC.Num.Integer is compiled before -any other module. - -The danger is that if the build system doesn't know about the implicit -dependency on Integer, it'll compile some base module before GHC.Num.Integer, -resulting in: - Failed to load interface for ‘GHC.Num.Integer’ - There are files missing in the ‘ghc-bignum’ package, - -To ensure that GHC.Num.Integer is there, we must ensure that there is a visible -dependency on GHC.Num.Integer from every module in base. We make GHC.Internal.Base -depend on GHC.Num.Integer; and everything else either depends on GHC.Base, -directly on GHC.Num.Integer, or does not have NoImplicitPrelude (and hence -depends on Prelude). - -The lookup is only disabled for packages ghc-prim and ghc-bignum, which aren't -allowed to contain any Integer literal. - - -Note [Depend on GHC.Tuple] -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Similarly, tuple syntax (or ()) creates an implicit dependency on -GHC.Tuple, so we use the same rule as for Integer --- see Note [Depend on -GHC.Num.Integer] --- to explain this to the build system. We make GHC.Internal.Base -depend on GHC.Tuple, and everything else depends on GHC.Internal.Base or Prelude. - - Note [Semigroup stimes cycle] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Semigroup is defined in this module, GHC.Base, with the method ===================================== libraries/ghc-internal/src/GHC/Internal/Data/Tuple.hs ===================================== @@ -25,7 +25,6 @@ module GHC.Internal.Data.Tuple , swap ) where -import GHC.Internal.Base () -- Note [Depend on GHC.Tuple] import GHC.Tuple (Solo (..), getSolo) default () -- Double isn't available yet ===================================== libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs-boot ===================================== @@ -9,8 +9,6 @@ module GHC.Internal.Exception.Type , underflowException ) where -import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Internal.Base - data SomeException divZeroException, overflowException, ratioZeroDenomException, underflowException :: SomeException ===================================== libraries/ghc-internal/src/GHC/Internal/IO/Handle/Types.hs-boot ===================================== @@ -2,7 +2,4 @@ module GHC.Internal.IO.Handle.Types ( Handle ) where --- See Note [Depend on GHC.Num.Integer] in GHC.Internal.Base -import GHC.Types () - data Handle ===================================== libraries/ghc-internal/src/GHC/Internal/Maybe.hs ===================================== @@ -7,7 +7,6 @@ module GHC.Internal.Maybe ) where -import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Internal.Base import GHC.Classes default () ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/Types.hs ===================================== @@ -54,10 +54,6 @@ import cycle, import GHC.Classes (Eq) import GHC.Types (Char, Int) --- Make implicit dependency known to build system -import GHC.Tuple () -- See Note [Depend on GHC.Tuple] in GHC.Internal.Base -import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Internal.Base - -- $setup -- >>> import Prelude -- >>> import GHC.Internal.Stack (prettyCallStack, callStack) ===================================== libraries/ghc-internal/src/GHC/Internal/TypeError.hs ===================================== @@ -32,7 +32,6 @@ module GHC.Internal.TypeError ) where import GHC.Internal.Data.Bool -import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Internal.Base import GHC.Types (TYPE, Constraint, Symbol) {- Note [Custom type errors] ===================================== libraries/ghc-prim/GHC/Classes.hs ===================================== @@ -137,7 +137,10 @@ module GHC.Classes( ) where -- GHC.Magic is used in some derived instances +-- See Note [Tracking implicit dependencies] +-- in compiler/GHC/Driver/MakeFile.hs, wrinkle TID3 import GHC.Magic () + import GHC.Prim import GHC.Tuple import GHC.CString (unpackCString#) ===================================== libraries/ghc-prim/GHC/Tuple.hs ===================================== @@ -29,10 +29,6 @@ module GHC.Tuple ( Tuple60(..), Tuple61(..), Tuple62(..), Tuple63(..), Tuple64(..), ) where -import GHC.CString () -- Make sure we do it first, so that the - -- implicit Typeable stuff can see GHC.Types.TyCon - -- and unpackCString# etc - default () -- Double and Integer aren't available yet -- | The unit datatype @Unit@ has one non-undefined member, the nullary ===================================== testsuite/tests/plugins/plugins09.stdout ===================================== @@ -5,4 +5,3 @@ interfacePlugin: GHC.Internal.Float interfacePlugin: GHC.Prim.Ext typeCheckPlugin (rn) typeCheckPlugin (tc) -interfacePlugin: GHC.Num.BigNat ===================================== testsuite/tests/plugins/plugins10.stdout ===================================== @@ -8,7 +8,6 @@ interfacePlugin: GHC.Prim.Ext interfacePlugin: Language.Haskell.TH.Syntax typeCheckPlugin (rn) typeCheckPlugin (tc) -interfacePlugin: GHC.Num.BigNat parsePlugin(a) typeCheckPlugin (rn) interfacePlugin: Language.Haskell.TH.Lib.Internal ===================================== testsuite/tests/plugins/plugins11.stdout ===================================== @@ -5,4 +5,3 @@ interfacePlugin: GHC.Internal.Float interfacePlugin: GHC.Prim.Ext typeCheckPlugin (rn) typeCheckPlugin (tc) -interfacePlugin: GHC.Num.BigNat ===================================== testsuite/tests/plugins/static-plugins.stdout ===================================== @@ -12,7 +12,6 @@ interfacePlugin: GHC.Internal.TopHandler typeCheckPlugin (tc) interfacePlugin: GHC.CString interfacePlugin: GHC.Prim -interfacePlugin: GHC.Num.BigNat ==pure.1 ==fp0.0 parsePlugin() View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0a83c4255167dbdbc02dccaffda96d60f2ab7ee0...023bf72cf6cf394e6739faa3f51830cd2fc182d0 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0a83c4255167dbdbc02dccaffda96d60f2ab7ee0...023bf72cf6cf394e6739faa3f51830cd2fc182d0 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 18:02:57 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Tue, 05 Mar 2024 13:02:57 -0500 Subject: [Git][ghc/ghc][wip/T23942] implicit dependencies for string literals Message-ID: <65e75e5166059_28e20e61fd9d8103513@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 5f386def by Matthew Craven at 2024-03-05T13:02:12-05:00 implicit dependencies for string literals - - - - - 1 changed file: - compiler/GHC/Driver/MakeFile.hs Changes: ===================================== compiler/GHC/Driver/MakeFile.hs ===================================== @@ -315,10 +315,13 @@ processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC (ModuleNode _ node)) do_implicit_import gHC_TYPES -- A module may implicitly depend on GHC.Tuple if ListTuplePuns is set - ; when (xopt ListTuplePuns dflags) $ - -- see Note [Tracking implicit dependencies], wrinkle TID2 - unless (isHomeUnitInstanceOf (hsc_home_unit hsc_env) primUnitId) $ + ; unless (isHomeUnitInstanceOf (hsc_home_unit hsc_env) primUnitId) $ do + { -- see Note [Tracking implicit dependencies], wrinkle TID2 + when (xopt ListTuplePuns dflags) $ do_implicit_import gHC_INTERNAL_TUPLE + -- see Note [Tracking implicit dependencies], wrinkle TID4 + ; do_implicit_import gHC_CSTRING + } } {- @@ -331,6 +334,7 @@ files to look up even if they are not imported. They include * Tuple-related stuff in GHC.Tuple, if the built-in tuple syntax is used * TypeRep-related stuff in GHC.Types, unless `-dno-typeable-binds` is set * deriving-related stuff mostly elsewhere in ghc-prim + * GHC.CString.unpackCString# et al, if string literals are used In order for GHC's build system to work reliably, we have to track the implicit dependencies introduced by GHC's habit of reading these @@ -366,6 +370,10 @@ is set, with the following wrinkles: Failing to do this for the Lift class caused #22229, which is sadly still open as of March 2024. + +(TID4) Likewise, since we don't have a flag to disable string + literals, we always add an implicit dependency on GHC.CString for + any modules outside of `ghc-prim`. -} findDependency :: HscEnv View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f386def642896cfa0f302fafbc18931d696c344 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f386def642896cfa0f302fafbc18931d696c344 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 18:23:27 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Tue, 05 Mar 2024 13:23:27 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] Try inlining checkTyCoVarInScope Message-ID: <65e7631f30399_28e20e703bb1c104078@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: 07de4242 by Mikolaj Konarski at 2024-03-05T19:22:42+01:00 Try inlining checkTyCoVarInScope - - - - - 1 changed file: - compiler/GHC/Core/Lint.hs Changes: ===================================== compiler/GHC/Core/Lint.hs ===================================== @@ -1933,6 +1933,7 @@ checkTyCon tc ------------------- checkTyCoVarInScope :: Subst -> TyCoVar -> LintM () +{-# INLINE checkTyCoVarInScope rev #-} checkTyCoVarInScope subst tcv = checkL (tcv `isInScope` subst) $ hang (text "The type or coercion variable" <+> pprBndr LetBind tcv) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/07de42425ac7832b9d21f915cf7b14576a4f6748 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/07de42425ac7832b9d21f915cf7b14576a4f6748 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 18:47:17 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Tue, 05 Mar 2024 13:47:17 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] Try inlining checkTyCoVarInScope Message-ID: <65e768b592c30_28e20e7baa264106496@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: 26b42422 by Mikolaj Konarski at 2024-03-05T19:47:05+01:00 Try inlining checkTyCoVarInScope - - - - - 1 changed file: - compiler/GHC/Core/Lint.hs Changes: ===================================== compiler/GHC/Core/Lint.hs ===================================== @@ -1933,6 +1933,7 @@ checkTyCon tc ------------------- checkTyCoVarInScope :: Subst -> TyCoVar -> LintM () +{-# INLINE checkTyCoVarInScope #-} checkTyCoVarInScope subst tcv = checkL (tcv `isInScope` subst) $ hang (text "The type or coercion variable" <+> pprBndr LetBind tcv) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26b4242298fcf60ecee17b36617436b30df916b1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26b4242298fcf60ecee17b36617436b30df916b1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 19:22:58 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 14:22:58 -0500 Subject: [Git][ghc/ghc][master] 4 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e77112b064b_28e20e8cee82c115423@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 8 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/ghc-experimental/src/GHC/Profiling/Eras.hs - libraries/ghc-internal/ghc-internal.cabal Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -1031,7 +1031,7 @@ job_groups = -- (see Note [Object unloading]). fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native") - hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url") + hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage") tsan_jobs = modifyJobs ===================================== .gitlab/jobs.yaml ===================================== @@ -2330,7 +2330,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url", + "HADRIAN_ARGS": "--haddock-for-hackage", "LLC": "/bin/false", "OPT": "/bin/false", "RUNTEST_ARGS": "", @@ -4007,7 +4007,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids", + "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "LLC": "/bin/false", "OPT": "/bin/false", ===================================== .gitlab/rel_eng/upload_ghc_libs.py ===================================== @@ -49,6 +49,10 @@ def prep_base(): shutil.copy('config.guess', 'libraries/base') shutil.copy('config.sub', 'libraries/base') +def prep_ghc_internal(): + shutil.copy('config.guess', 'libraries/ghc-internal') + shutil.copy('config.sub', 'libraries/ghc-internal') + def build_copy_file(pkg: Package, f: Path): target = Path('_build') / 'stage1' / pkg.path / 'build' / f dest = pkg.path / f @@ -93,6 +97,8 @@ PACKAGES = { pkg.name: pkg for pkg in [ Package('base', Path("libraries/base"), prep_base), + Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal), + Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep), Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim), Package('integer-gmp', Path("libraries/integer-gmp"), no_prep), Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum), ===================================== hadrian/README.md ===================================== @@ -306,9 +306,9 @@ all of the documentation targets: You can pass several `--docs=...` flags, Hadrian will combine their effects. -To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag, -by default this will choose a url suitable for uploading to hackage but you might also want to pass something like -`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server. +To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag, +This will generate URLs which are appropiate for either uploading to a local hackage +server or the global hackage server. #### Source distribution ===================================== hadrian/src/CommandLine.hs ===================================== @@ -17,7 +17,6 @@ import System.Environment import qualified System.Directory as Directory import qualified Data.Set as Set -import Data.Maybe data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq) @@ -114,7 +113,7 @@ data DocArgs = DocArgs } deriving (Eq, Show) defaultDocArgs :: DocArgs -defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" } +defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" } readConfigure :: Either String (CommandLineArgs -> CommandLineArgs) readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually" @@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } } -readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) -readHaddockBaseUrl base_url = Right $ \flags -> - flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } } +readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs) +readHaddockBaseUrl = Right $ \flags -> + flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } } - where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url + where base_url = "/package/%pkg%/docs" readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) @@ -320,8 +319,8 @@ optDescrs = "Destination path for the bindist 'install' rule" , Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING") "Setting key to autocomplete, for the 'autocomplete' target." - , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL") - "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)." + , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl) + "Generate documentation suitable for upload to a hackage server." ] -- | A type-indexed map containing Hadrian command line arguments to be passed ===================================== hadrian/src/Settings/Builders/Haddock.hs ===================================== @@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat version <- expr $ pkgVersion pkg synopsis <- expr $ pkgSynopsis pkg haddocks <- expr $ haddockDependencies context - haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks] + haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks] hVersion <- expr $ pkgVersion haddock statsDir <- expr $ haddockStatsFilesDir baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs) - let baseUrl p = substituteTemplate baseUrlTemplate p + -- The path to where the docs for a package are + let docpath p = substituteTemplate baseUrlTemplate p + -- The path to where the src folder is for a package (typically docs ++ "/src/") + let srcpath p = docpath p ++ "/src/" ghcOpts <- haddockGhcArgs -- These are the options which are necessary to perform the build. Additional -- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are @@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat , arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion) , map ("--hide=" ++) <$> getContextData otherModules - , pure [ "--read-interface=../" ++ p - ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME}," - ++ haddock | (p, haddock) <- haddocks_with_versions ] + , pure [ "--read-interface=" ++ docpath (p, pid) + ++ "," ++ srcpath (p, pid) ++ "," + ++ haddock | (p, pid, haddock) <- haddocks_with_versions ] , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ] , arg "+RTS" , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t") , arg "--machine-readable" , arg "-RTS" ] ] -substituteTemplate :: String -> String -> String -substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate +substituteTemplate :: String -> (String, String) -> String +substituteTemplate baseTemplate (pkg, pkgId) = + T.unpack + . T.replace "%pkg%" (T.pack pkg) + . T.replace "%pkgid%" (T.pack pkgId) + . T.pack $ baseTemplate ===================================== libraries/ghc-experimental/src/GHC/Profiling/Eras.hs ===================================== @@ -1,7 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} --- | TODO move this module into ghc-internals module GHC.Profiling.Eras ( setUserEra , getUserEra , incrementUserEra ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -17,7 +17,7 @@ description: extra-tmp-files: autom4te.cache - base.buildinfo + ghc-internal.buildinfo config.log config.status include/EventConfig.h @@ -25,8 +25,8 @@ extra-tmp-files: extra-source-files: aclocal.m4 - base.buildinfo.in - changelog.md + ghc-internal.buildinfo.in + CHANGELOG.md configure configure.ac include/CTypes.h View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82ccb8012ba532f0fa06dc6ff96d33217560088a...23f2a478b7dc6b61cab86cf7d0db7fec8a6d9a1f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82ccb8012ba532f0fa06dc6ff96d33217560088a...23f2a478b7dc6b61cab86cf7d0db7fec8a6d9a1f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 19:23:31 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 14:23:31 -0500 Subject: [Git][ghc/ghc][master] 2 commits: filepath: Bump submodule to 1.5.2.0 Message-ID: <65e771331bd54_28e20e8e65160118398@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 2 changed files: - libraries/filepath - libraries/os-string Changes: ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/23f2a478b7dc6b61cab86cf7d0db7fec8a6d9a1f...312179442f5a1f0f3e83db6ebd4da20f5b731fa1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/23f2a478b7dc6b61cab86cf7d0db7fec8a6d9a1f...312179442f5a1f0f3e83db6ebd4da20f5b731fa1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 19:54:40 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 14:54:40 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 9 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e77880131ca_28e20ea1151e8125146@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - aed47084 by Matthew Pickering at 2024-03-05T14:54:13-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - ac6745cc by Sylvain Henry at 2024-03-05T14:54:24-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - efcce4aa by Cheng Shao at 2024-03-05T14:54:26-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 23 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/base/changelog.md - libraries/filepath - libraries/ghc-experimental/src/GHC/Profiling/Eras.hs - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - libraries/os-string - rts/RtsFlags.c - rts/include/rts/Flags.h - rts/js/arith.js - rts/sm/MBlock.c - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - testsuite/tests/rts/all.T Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -1031,7 +1031,7 @@ job_groups = -- (see Note [Object unloading]). fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native") - hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url") + hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage") tsan_jobs = modifyJobs ===================================== .gitlab/jobs.yaml ===================================== @@ -2330,7 +2330,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url", + "HADRIAN_ARGS": "--haddock-for-hackage", "LLC": "/bin/false", "OPT": "/bin/false", "RUNTEST_ARGS": "", @@ -4007,7 +4007,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids", + "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "LLC": "/bin/false", "OPT": "/bin/false", ===================================== .gitlab/rel_eng/upload_ghc_libs.py ===================================== @@ -49,6 +49,10 @@ def prep_base(): shutil.copy('config.guess', 'libraries/base') shutil.copy('config.sub', 'libraries/base') +def prep_ghc_internal(): + shutil.copy('config.guess', 'libraries/ghc-internal') + shutil.copy('config.sub', 'libraries/ghc-internal') + def build_copy_file(pkg: Package, f: Path): target = Path('_build') / 'stage1' / pkg.path / 'build' / f dest = pkg.path / f @@ -93,6 +97,8 @@ PACKAGES = { pkg.name: pkg for pkg in [ Package('base', Path("libraries/base"), prep_base), + Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal), + Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep), Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim), Package('integer-gmp', Path("libraries/integer-gmp"), no_prep), Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum), ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -232,6 +232,11 @@ Runtime system - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``. +- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual + memory address space reserved by the two step allocator on a 64-bit + platform. The default size is now 1T on aarch64 as well. See + :ghc-ticket:`24498`. + ``base`` library ~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -368,6 +368,18 @@ Miscellaneous RTS options thread can execute its exception handlers. The ``-xq`` controls the size of this additional quota. +.. rts-flag:: -xr ⟨size⟩ + + :default: 1T + + This option controls the size of virtual memory address space + reserved by the two step allocator on a 64-bit platform. It can be + useful in scenarios where even reserving a large address range + without committing can be expensive (e.g. WSL1), or when you + actually have enough physical memory and want to support a Haskell + heap larger than 1T. ``-xr`` is a no-op if GHC is configured with + ``--disable-large-address-space`` or if the platform is 32-bit. + .. _rts-options-gc: RTS options to control the garbage collector ===================================== hadrian/README.md ===================================== @@ -306,9 +306,9 @@ all of the documentation targets: You can pass several `--docs=...` flags, Hadrian will combine their effects. -To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag, -by default this will choose a url suitable for uploading to hackage but you might also want to pass something like -`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server. +To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag, +This will generate URLs which are appropiate for either uploading to a local hackage +server or the global hackage server. #### Source distribution ===================================== hadrian/src/CommandLine.hs ===================================== @@ -17,7 +17,6 @@ import System.Environment import qualified System.Directory as Directory import qualified Data.Set as Set -import Data.Maybe data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq) @@ -114,7 +113,7 @@ data DocArgs = DocArgs } deriving (Eq, Show) defaultDocArgs :: DocArgs -defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" } +defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" } readConfigure :: Either String (CommandLineArgs -> CommandLineArgs) readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually" @@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } } -readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) -readHaddockBaseUrl base_url = Right $ \flags -> - flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } } +readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs) +readHaddockBaseUrl = Right $ \flags -> + flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } } - where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url + where base_url = "/package/%pkg%/docs" readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) @@ -320,8 +319,8 @@ optDescrs = "Destination path for the bindist 'install' rule" , Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING") "Setting key to autocomplete, for the 'autocomplete' target." - , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL") - "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)." + , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl) + "Generate documentation suitable for upload to a hackage server." ] -- | A type-indexed map containing Hadrian command line arguments to be passed ===================================== hadrian/src/Settings/Builders/Haddock.hs ===================================== @@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat version <- expr $ pkgVersion pkg synopsis <- expr $ pkgSynopsis pkg haddocks <- expr $ haddockDependencies context - haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks] + haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks] hVersion <- expr $ pkgVersion haddock statsDir <- expr $ haddockStatsFilesDir baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs) - let baseUrl p = substituteTemplate baseUrlTemplate p + -- The path to where the docs for a package are + let docpath p = substituteTemplate baseUrlTemplate p + -- The path to where the src folder is for a package (typically docs ++ "/src/") + let srcpath p = docpath p ++ "/src/" ghcOpts <- haddockGhcArgs -- These are the options which are necessary to perform the build. Additional -- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are @@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat , arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion) , map ("--hide=" ++) <$> getContextData otherModules - , pure [ "--read-interface=../" ++ p - ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME}," - ++ haddock | (p, haddock) <- haddocks_with_versions ] + , pure [ "--read-interface=" ++ docpath (p, pid) + ++ "," ++ srcpath (p, pid) ++ "," + ++ haddock | (p, pid, haddock) <- haddocks_with_versions ] , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ] , arg "+RTS" , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t") , arg "--machine-readable" , arg "-RTS" ] ] -substituteTemplate :: String -> String -> String -substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate +substituteTemplate :: String -> (String, String) -> String +substituteTemplate baseTemplate (pkg, pkgId) = + T.unpack + . T.replace "%pkg%" (T.pack pkg) + . T.replace "%pkgid%" (T.pack pkgId) + . T.pack $ baseTemplate ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to + reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`. + ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254)) + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/ghc-experimental/src/GHC/Profiling/Eras.hs ===================================== @@ -1,7 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} --- | TODO move this module into ghc-internals module GHC.Profiling.Eras ( setUserEra , getUserEra , incrementUserEra ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -17,7 +17,7 @@ description: extra-tmp-files: autom4te.cache - base.buildinfo + ghc-internal.buildinfo config.log config.status include/EventConfig.h @@ -25,8 +25,8 @@ extra-tmp-files: extra-source-files: aclocal.m4 - base.buildinfo.in - changelog.md + ghc-internal.buildinfo.in + CHANGELOG.md configure configure.ac include/CTypes.h ===================================== libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc ===================================== @@ -274,6 +274,7 @@ data DoHeapProfile | HeapByLDV | HeapByClosureType | HeapByInfoTable + | HeapByEra -- ^ @since base-4.20.0.0 deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -289,6 +290,7 @@ instance Enum DoHeapProfile where fromEnum HeapByLDV = #{const HEAP_BY_LDV} fromEnum HeapByClosureType = #{const HEAP_BY_CLOSURE_TYPE} fromEnum HeapByInfoTable = #{const HEAP_BY_INFO_TABLE} + fromEnum HeapByEra = #{const HEAP_BY_ERA} toEnum #{const NO_HEAP_PROFILING} = NoHeapProfiling toEnum #{const HEAP_BY_CCS} = HeapByCCS @@ -299,6 +301,7 @@ instance Enum DoHeapProfile where toEnum #{const HEAP_BY_LDV} = HeapByLDV toEnum #{const HEAP_BY_CLOSURE_TYPE} = HeapByClosureType toEnum #{const HEAP_BY_INFO_TABLE} = HeapByInfoTable + toEnum #{const HEAP_BY_ERA} = HeapByEra toEnum e = errorWithoutStackTrace ("invalid enum for DoHeapProfile: " ++ show e) -- | Parameters of the cost-center profiler @@ -311,6 +314,7 @@ data ProfFlags = ProfFlags , startHeapProfileAtStartup :: Bool , startTimeProfileAtStartup :: Bool -- ^ @since base-4.20.0.0 , showCCSOnException :: Bool + , automaticEraIncrement :: Bool -- ^ @since 4.20.0.0 , maxRetainerSetSize :: Word , ccsLength :: Word , modSelector :: Maybe String @@ -320,6 +324,7 @@ data ProfFlags = ProfFlags , ccsSelector :: Maybe String , retainerSelector :: Maybe String , bioSelector :: Maybe String + , eraSelector :: Word -- ^ @since base-4.20.0.0 } deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -633,6 +638,8 @@ getProfFlags = do (#{peek PROFILING_FLAGS, startTimeProfileAtStartup} ptr :: IO CBool)) <*> (toBool <$> (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool)) + <*> (toBool <$> + (#{peek PROFILING_FLAGS, incrementUserEra} ptr :: IO CBool)) <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr <*> #{peek PROFILING_FLAGS, ccsLength} ptr <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr) @@ -642,6 +649,7 @@ getProfFlags = do <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, ccsSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, retainerSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, bioSelector} ptr) + <*> #{peek PROFILING_FLAGS, eraSelector} ptr getTraceFlags :: IO TraceFlags getTraceFlags = do ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 ===================================== rts/RtsFlags.c ===================================== @@ -186,6 +186,9 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.ringBell = false; RtsFlags.GcFlags.longGCSync = 0; /* detection turned off */ + // 1 TBytes + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 40; + RtsFlags.DebugFlags.scheduler = false; RtsFlags.DebugFlags.interpreter = false; RtsFlags.DebugFlags.weak = false; @@ -552,6 +555,11 @@ usage_text[] = { " -xq The allocation limit given to a thread after it receives", " an AllocationLimitExceeded exception. (default: 100k)", "", +#if defined(USE_LARGE_ADDRESS_SPACE) +" -xr The size of virtual memory address space reserved by the", +" two step allocator (default: 1T)", +"", +#endif " -Mgrace=", " The amount of allocation after the program receives a", " HeapOverflow exception before the exception is thrown again, if", @@ -1820,6 +1828,12 @@ error = true; / BLOCK_SIZE; break; + case 'r': + OPTION_UNSAFE; + RtsFlags.GcFlags.addressSpaceSize + = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_WORD64_MAX); + break; + default: OPTION_SAFE; errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -2118,7 +2132,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max) m = atof(s); c = s[strlen(s)-1]; - if (c == 'g' || c == 'G') + if (c == 't' || c == 'T') + m *= (StgWord64)1024*1024*1024*1024; + else if (c == 'g' || c == 'G') m *= 1024*1024*1024; else if (c == 'm' || c == 'M') m *= 1024*1024; @@ -2737,4 +2753,3 @@ doingErasProfiling( void ) || RtsFlags.ProfFlags.eraSelector != 0); } #endif /* PROFILING */ - ===================================== rts/include/rts/Flags.h ===================================== @@ -89,6 +89,8 @@ typedef struct _GC_FLAGS { bool numa; /* Use NUMA */ StgWord numaMask; + + StgWord64 addressSpaceSize; /* large address space size in bytes */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== rts/js/arith.js ===================================== @@ -44,19 +44,23 @@ function h$hs_remWord64(h1,l1,h2,l2) { } function h$hs_timesWord64(h1,l1,h2,l2) { - var a = W64(h1,l1); - var b = W64(h2,l2); - var r = BigInt.asUintN(64, a * b); - TRACE_ARITH("Word64: " + a + " * " + b + " ==> " + r) - RETURN_W64(r); + var rh = h$mul2Word32(l1,l2); + var rl = h$ret1; + + rh += Math.imul(l1,h2)>>>0; + rh += Math.imul(l2,h1)>>>0; + rh >>>= 0; + + TRACE_ARITH("Word64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_minusWord64(h1,l1,h2,l2) { - var a = (BigInt(h1) << BigInt(32)) | BigInt(l1>>>0); - var b = (BigInt(h2) << BigInt(32)) | BigInt(l2>>>0); - var r = BigInt.asUintN(64, a - b); - TRACE_ARITH("Word64: " + a + " - " + b + " ==> " + r) - RETURN_W64(r); + var l = l1-l2; + var rl = l>>>0; + var rh = (h1-h2-(l!=rl?1:0))>>>0; + TRACE_ARITH("Word64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_plusWord64(h1,l1,h2,l2) { @@ -68,11 +72,15 @@ function h$hs_plusWord64(h1,l1,h2,l2) { } function h$hs_timesInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a * b); - TRACE_ARITH("Int64: " + a + " * " + b + " ==> " + r) - RETURN_I64(r); + var rh = h$mul2Word32(l1,l2); + var rl = h$ret1; + + rh += Math.imul(l1,h2)|0; + rh += Math.imul(l2,h1)|0; + rh |= 0; + + TRACE_ARITH("Int64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_quotInt64(h1,l1,h2,l2) { @@ -92,19 +100,19 @@ function h$hs_remInt64(h1,l1,h2,l2) { } function h$hs_plusInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a + b); - TRACE_ARITH("Int64: " + a + " + " + b + " ==> " + r) - RETURN_I64(r); + var l = l1+l2; + var rl = l>>>0; + var rh = (h1+h2+(l!=rl?1:0))|0; + TRACE_ARITH("Int64: " + (h1,l1) + " + " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_minusInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a - b); - TRACE_ARITH("Int64: " + a + " - " + b + " ==> " + r) - RETURN_I64(r); + var l = l1-l2; + var rl = l>>>0; + var rh = (h1-h2-(l!=rl?1:0))|0; + TRACE_ARITH("Int64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_uncheckedShiftLWord64(h,l,n) { ===================================== rts/sm/MBlock.c ===================================== @@ -659,20 +659,14 @@ initMBlocks(void) #if defined(USE_LARGE_ADDRESS_SPACE) { - W_ size; -#if defined(aarch64_HOST_ARCH) - size = (W_)1 << 38; // 1/4 TByte -#else - size = (W_)1 << 40; // 1 TByte -#endif void *startAddress = NULL; if (RtsFlags.GcFlags.heapBase) { startAddress = (void*) RtsFlags.GcFlags.heapBase; } - void *addr = osReserveHeapMemory(startAddress, &size); + void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize); mblock_address_space.begin = (W_)addr; - mblock_address_space.end = (W_)addr + size; + mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize; mblock_high_watermark = (W_)addr; } #elif SIZEOF_VOID_P == 8 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -12071,7 +12071,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -12122,6 +12122,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -12130,7 +12131,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -9253,7 +9253,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9304,6 +9304,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9312,7 +9313,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/rts/all.T ===================================== @@ -3,7 +3,7 @@ test('testblockalloc', compile_and_run, ['']) test('testmblockalloc', - [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'), + [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'), when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts compile_and_run, ['']) # -I0 is important: the idle GC will run the memory leak detector, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc...efcce4aab88b2d85ec3aa8670680217f78b6b341 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc...efcce4aab88b2d85ec3aa8670680217f78b6b341 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 20:00:39 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Tue, 05 Mar 2024 15:00:39 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] 12 commits: Beauify allMachRegNos Message-ID: <65e779e744d17_28e20ea2f3668131363@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: 9a8af3a2 by Sven Tennie at 2024-03-05T12:48:43+01:00 Beauify allMachRegNos - - - - - a6af09dc by Sven Tennie at 2024-03-05T13:10:03+01:00 Delete unused function strImmLit - - - - - 569330e5 by Sven Tennie at 2024-03-05T14:48:36+01:00 Introduce constant firstFpRegNo Makes usages more readable. - - - - - a5908d00 by Sven Tennie at 2024-03-05T15:24:53+01:00 Add TODOs - - - - - 1c707282 by Sven Tennie at 2024-03-05T18:30:06+01:00 Cleanup register constants - - - - - 952c4ab0 by Sven Tennie at 2024-03-05T19:19:50+01:00 Make reg numbers less magic - - - - - d5e9df2c by Sven Tennie at 2024-03-05T19:32:56+01:00 More on RegNo - - - - - 84e5bb2a by Sven Tennie at 2024-03-05T19:38:03+01:00 Improve comment - - - - - 73ab87ca by Sven Tennie at 2024-03-05T20:08:34+01:00 Remove unused / non-existent addressing mode - - - - - 1ad87d41 by Sven Tennie at 2024-03-05T20:10:02+01:00 Reformat / cleanup - - - - - 9805cb59 by Sven Tennie at 2024-03-05T20:11:35+01:00 Add TODOs - - - - - da053cea by Sven Tennie at 2024-03-05T20:57:54+01:00 More on RegNos - - - - - 4 changed files: - compiler/GHC/CmmToAsm/RV64/CodeGen.hs - compiler/GHC/CmmToAsm/RV64/Instr.hs - compiler/GHC/CmmToAsm/RV64/Ppr.hs - compiler/GHC/CmmToAsm/RV64/Regs.hs Changes: ===================================== compiler/GHC/CmmToAsm/RV64/CodeGen.hs ===================================== @@ -502,7 +502,7 @@ getRegister' config plat expr = CmmLit lit -> case lit of - CmmInt 0 w -> pure $ Fixed (intFormat w) zero_reg nilOL + CmmInt 0 w -> pure $ Fixed (intFormat w) zeroReg nilOL CmmInt i w -> -- narrowU is important: Negative immediates may be -- sign-extended on load! @@ -1762,8 +1762,8 @@ genCCall target dest_regs arg_regs bid = do if hint == SignedHint then code_r - `appOL` signExtend w W64 r ip_reg - `snocOL` ann (text "Pass signed argument (size " <> ppr w <> text ") on the stack: " <> ppr ip_reg) str + `appOL` signExtend w W64 r ipReg + `snocOL` ann (text "Pass signed argument (size " <> ppr w <> text ") on the stack: " <> ppr ipReg) str else code_r `snocOL` ann (text "Pass unsigned argument (size " <> ppr w <> text ") on the stack: " <> ppr r) str ===================================== compiler/GHC/CmmToAsm/RV64/Instr.hs ===================================== @@ -161,7 +161,6 @@ regUsageOfInstr platform instr = case instr of (filter (interesting platform) dst) regAddr :: AddrMode -> [Reg] - regAddr (AddrRegReg r1 r2) = [r1, r2] regAddr (AddrRegImm r1 _) = [r1] regAddr (AddrReg r1) = [r1] regOp :: Operand -> [Reg] @@ -205,12 +204,12 @@ regUsageOfInstr platform instr = case instr of -- ZR: Zero, RA: Return Address, SP: Stack Pointer, GP: Global Pointer, TP: Thread Pointer, FP: Frame Pointer -- BR: Base, SL: SpLim callerSavedRegisters :: [Reg] -callerSavedRegisters - = map regSingle [5..7] - ++ map regSingle [10..17] - ++ map regSingle [28..31] - ++ map regSingle [32..39] - ++ map regSingle [42..49] +callerSavedRegisters = + map regSingle [t0RegNo .. t2RegNo] + ++ map regSingle [a0RegNo .. a7RegNo] + ++ map regSingle [t3RegNo .. t6RegNo] + ++ map regSingle [ft0RegNo .. ft7RegNo] + ++ map regSingle [fa0RegNo .. fa7RegNo] -- | Apply a given mapping to all the register references in this -- instruction. @@ -302,7 +301,6 @@ patchRegsOfInstr instr env = case instr of patchTarget (TReg r) = TReg (env r) patchTarget t = t patchAddr :: AddrMode -> AddrMode - patchAddr (AddrRegReg r1 r2) = AddrRegReg (env r1) (env r2) patchAddr (AddrRegImm r1 i) = AddrRegImm (env r1) i patchAddr (AddrReg r) = AddrReg (env r) -------------------------------------------------------------------------------- @@ -388,12 +386,12 @@ mkSpillInstr config reg delta slot = ] where fmt = case reg of - RegReal (RealRegSingle n) | n < 32 -> II64 + RegReal (RealRegSingle n) | n < d0RegNo -> II64 _ -> FF64 - mkStrSpImm imm = ANN (text "Spill@" <> int (off - delta)) $ STR fmt (OpReg W64 reg) (OpAddr (AddrRegImm sp_reg (ImmInt imm))) + mkStrSpImm imm = ANN (text "Spill@" <> int (off - delta)) $ STR fmt (OpReg W64 reg) (OpAddr (AddrRegImm spMachReg (ImmInt imm))) movImmToIp imm = ANN (text "Spill: IP <- " <> int imm) $ MOV ip (OpImm (ImmInt imm)) addSpToIp = ANN (text "Spill: IP <- SP + IP ") $ ADD ip ip sp - mkStrIp = ANN (text "Spill@" <> int (off - delta)) $ STR fmt (OpReg W64 reg) (OpAddr (AddrReg ip_reg)) + mkStrIp = ANN (text "Spill@" <> int (off - delta)) $ STR fmt (OpReg W64 reg) (OpAddr (AddrReg ipReg)) off = spillSlotToOffset slot @@ -414,12 +412,12 @@ mkLoadInstr _config reg delta slot = ] where fmt = case reg of - RegReal (RealRegSingle n) | n < 32 -> II64 + RegReal (RealRegSingle n) | n < d0RegNo -> II64 _ -> FF64 - mkLdrSpImm imm = ANN (text "Reload@" <> int (off - delta)) $ LDR fmt (OpReg W64 reg) (OpAddr (AddrRegImm sp_reg (ImmInt imm))) + mkLdrSpImm imm = ANN (text "Reload@" <> int (off - delta)) $ LDR fmt (OpReg W64 reg) (OpAddr (AddrRegImm spMachReg (ImmInt imm))) movImmToIp imm = ANN (text "Reload: IP <- " <> int imm) $ MOV ip (OpImm (ImmInt imm)) addSpToIp = ANN (text "Reload: IP <- SP + IP ") $ ADD ip ip sp - mkLdrIp = ANN (text "Reload@" <> int (off - delta)) $ LDR fmt (OpReg W64 reg) (OpAddr (AddrReg ip_reg)) + mkLdrIp = ANN (text "Reload@" <> int (off - delta)) $ LDR fmt (OpReg W64 reg) (OpAddr (AddrReg ipReg)) off = spillSlotToOffset slot @@ -795,10 +793,6 @@ data Operand | OpAddr AddrMode -- memory reference deriving (Eq, Show) --- Smart constructors -opReg :: Width -> Reg -> Operand -opReg = OpReg - -- Note [The made-up RISCV64 IP register] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- @@ -817,98 +811,101 @@ opReg = OpReg -- X31 is a caller-saved register. I.e. there are no guarantees about what the -- callee does with it. That's exactly what we want here. -zero_reg, ra_reg, sp_reg, ip_reg :: Reg -zero_reg = RegReal (RealRegSingle 0) -ra_reg = RegReal (RealRegSingle 1) -sp_reg = RegReal (RealRegSingle 2) -ip_reg = RegReal (RealRegSingle 31) +zeroReg, raReg, spMachReg, ipReg :: Reg +zeroReg = regSingle 0 +raReg = regSingle 1 +-- | Not to be confused with the `CmmReg` `spReg` +spMachReg = regSingle 2 +ipReg = regSingle 31 + +operandFromReg :: Reg -> Operand +operandFromReg = OpReg W64 + +operandFromRegNo :: RegNo -> Operand +operandFromRegNo = operandFromReg . regSingle zero, ra, sp, gp, tp, fp, ip :: Operand -zero = OpReg W64 zero_reg -ra = OpReg W64 ra_reg -sp = OpReg W64 sp_reg -gp = OpReg W64 (RegReal (RealRegSingle 3)) -tp = OpReg W64 (RegReal (RealRegSingle 4)) -fp = OpReg W64 (RegReal (RealRegSingle 8)) -ip = OpReg W64 ip_reg - -_x :: Int -> Operand -_x i = OpReg W64 (RegReal (RealRegSingle i)) +zero = operandFromReg zeroReg +ra = operandFromReg raReg +sp = operandFromReg spMachReg +gp = operandFromRegNo 3 +tp = operandFromRegNo 4 +fp = operandFromRegNo 8 +ip = operandFromReg ipReg + x0, x1, x2, x3, x4, x5, x6, x7 :: Operand x8, x9, x10, x11, x12, x13, x14, x15 :: Operand x16, x17, x18, x19, x20, x21, x22, x23 :: Operand x24, x25, x26, x27, x28, x29, x30, x31 :: Operand -x0 = OpReg W64 (RegReal (RealRegSingle 0)) -x1 = OpReg W64 (RegReal (RealRegSingle 1)) -x2 = OpReg W64 (RegReal (RealRegSingle 2)) -x3 = OpReg W64 (RegReal (RealRegSingle 3)) -x4 = OpReg W64 (RegReal (RealRegSingle 4)) -x5 = OpReg W64 (RegReal (RealRegSingle 5)) -x6 = OpReg W64 (RegReal (RealRegSingle 6)) -x7 = OpReg W64 (RegReal (RealRegSingle 7)) -x8 = OpReg W64 (RegReal (RealRegSingle 8)) -x9 = OpReg W64 (RegReal (RealRegSingle 9)) -x10 = OpReg W64 (RegReal (RealRegSingle 10)) -x11 = OpReg W64 (RegReal (RealRegSingle 11)) -x12 = OpReg W64 (RegReal (RealRegSingle 12)) -x13 = OpReg W64 (RegReal (RealRegSingle 13)) -x14 = OpReg W64 (RegReal (RealRegSingle 14)) -x15 = OpReg W64 (RegReal (RealRegSingle 15)) -x16 = OpReg W64 (RegReal (RealRegSingle 16)) -x17 = OpReg W64 (RegReal (RealRegSingle 17)) -x18 = OpReg W64 (RegReal (RealRegSingle 18)) -x19 = OpReg W64 (RegReal (RealRegSingle 19)) -x20 = OpReg W64 (RegReal (RealRegSingle 20)) -x21 = OpReg W64 (RegReal (RealRegSingle 21)) -x22 = OpReg W64 (RegReal (RealRegSingle 22)) -x23 = OpReg W64 (RegReal (RealRegSingle 23)) -x24 = OpReg W64 (RegReal (RealRegSingle 24)) -x25 = OpReg W64 (RegReal (RealRegSingle 25)) -x26 = OpReg W64 (RegReal (RealRegSingle 26)) -x27 = OpReg W64 (RegReal (RealRegSingle 27)) -x28 = OpReg W64 (RegReal (RealRegSingle 28)) -x29 = OpReg W64 (RegReal (RealRegSingle 29)) -x30 = OpReg W64 (RegReal (RealRegSingle 30)) -x31 = OpReg W64 (RegReal (RealRegSingle 31)) - -_d :: Int -> Operand -_d = OpReg W64 . RegReal . RealRegSingle +x0 = operandFromRegNo x0RegNo +x1 = operandFromRegNo 1 +x2 = operandFromRegNo 2 +x3 = operandFromRegNo 3 +x4 = operandFromRegNo 4 +x5 = operandFromRegNo x5RegNo +x6 = operandFromRegNo 6 +x7 = operandFromRegNo x7RegNo +x8 = operandFromRegNo 8 +x9 = operandFromRegNo 9 +x10 = operandFromRegNo x10RegNo +x11 = operandFromRegNo 11 +x12 = operandFromRegNo 12 +x13 = operandFromRegNo 13 +x14 = operandFromRegNo 14 +x15 = operandFromRegNo 15 +x16 = operandFromRegNo 16 +x17 = operandFromRegNo x17RegNo +x18 = operandFromRegNo 18 +x19 = operandFromRegNo 19 +x20 = operandFromRegNo 20 +x21 = operandFromRegNo 21 +x22 = operandFromRegNo 22 +x23 = operandFromRegNo 23 +x24 = operandFromRegNo 24 +x25 = operandFromRegNo 25 +x26 = operandFromRegNo 26 +x27 = operandFromRegNo 27 +x28 = operandFromRegNo x28RegNo +x29 = operandFromRegNo 29 +x30 = operandFromRegNo 30 +x31 = operandFromRegNo x31RegNo + d0, d1, d2, d3, d4, d5, d6, d7 :: Operand d8, d9, d10, d11, d12, d13, d14, d15 :: Operand d16, d17, d18, d19, d20, d21, d22, d23 :: Operand d24, d25, d26, d27, d28, d29, d30, d31 :: Operand -d0 = OpReg W64 (RegReal (RealRegSingle 32)) -d1 = OpReg W64 (RegReal (RealRegSingle 33)) -d2 = OpReg W64 (RegReal (RealRegSingle 34)) -d3 = OpReg W64 (RegReal (RealRegSingle 35)) -d4 = OpReg W64 (RegReal (RealRegSingle 36)) -d5 = OpReg W64 (RegReal (RealRegSingle 37)) -d6 = OpReg W64 (RegReal (RealRegSingle 38)) -d7 = OpReg W64 (RegReal (RealRegSingle 39)) -d8 = OpReg W64 (RegReal (RealRegSingle 40)) -d9 = OpReg W64 (RegReal (RealRegSingle 41)) -d10 = OpReg W64 (RegReal (RealRegSingle 42)) -d11 = OpReg W64 (RegReal (RealRegSingle 43)) -d12 = OpReg W64 (RegReal (RealRegSingle 44)) -d13 = OpReg W64 (RegReal (RealRegSingle 45)) -d14 = OpReg W64 (RegReal (RealRegSingle 46)) -d15 = OpReg W64 (RegReal (RealRegSingle 47)) -d16 = OpReg W64 (RegReal (RealRegSingle 48)) -d17 = OpReg W64 (RegReal (RealRegSingle 49)) -d18 = OpReg W64 (RegReal (RealRegSingle 50)) -d19 = OpReg W64 (RegReal (RealRegSingle 51)) -d20 = OpReg W64 (RegReal (RealRegSingle 52)) -d21 = OpReg W64 (RegReal (RealRegSingle 53)) -d22 = OpReg W64 (RegReal (RealRegSingle 54)) -d23 = OpReg W64 (RegReal (RealRegSingle 55)) -d24 = OpReg W64 (RegReal (RealRegSingle 56)) -d25 = OpReg W64 (RegReal (RealRegSingle 57)) -d26 = OpReg W64 (RegReal (RealRegSingle 58)) -d27 = OpReg W64 (RegReal (RealRegSingle 59)) -d28 = OpReg W64 (RegReal (RealRegSingle 60)) -d29 = OpReg W64 (RegReal (RealRegSingle 61)) -d30 = OpReg W64 (RegReal (RealRegSingle 62)) -d31 = OpReg W64 (RegReal (RealRegSingle 63)) +d0 = operandFromRegNo d0RegNo +d1 = operandFromRegNo 33 +d2 = operandFromRegNo 34 +d3 = operandFromRegNo 35 +d4 = operandFromRegNo 36 +d5 = operandFromRegNo 37 +d6 = operandFromRegNo 38 +d7 = operandFromRegNo d7RegNo +d8 = operandFromRegNo 40 +d9 = operandFromRegNo 41 +d10 = operandFromRegNo d10RegNo +d11 = operandFromRegNo 43 +d12 = operandFromRegNo 44 +d13 = operandFromRegNo 45 +d14 = operandFromRegNo 46 +d15 = operandFromRegNo 47 +d16 = operandFromRegNo 48 +d17 = operandFromRegNo d17RegNo +d18 = operandFromRegNo 50 +d19 = operandFromRegNo 51 +d20 = operandFromRegNo 52 +d21 = operandFromRegNo 53 +d22 = operandFromRegNo 54 +d23 = operandFromRegNo 55 +d24 = operandFromRegNo 56 +d25 = operandFromRegNo 57 +d26 = operandFromRegNo 58 +d27 = operandFromRegNo 59 +d28 = operandFromRegNo 60 +d29 = operandFromRegNo 61 +d30 = operandFromRegNo 62 +d31 = operandFromRegNo d31RegNo opRegSExt :: Width -> Reg -> Operand opRegSExt W64 r = OpRegExt W64 r ESXTX 0 @@ -981,7 +978,8 @@ makeFarBranches info_env blocks -- 262144 (2^20 / 4) instructions are allowed; let's keep some distance, as -- we have pseudo-insns that are pretty-printed as multiple instructions, - -- and it's just not worth the effort to calculate things exactly. The + -- and it's just not worth the effort to calculate things exactly as linker + -- relaxations are applied later (optimizing away our flaws.) The -- conservative guess here is that every instruction does not emit more than -- two in the mean. nearLimit = 131072 - mapSize info_env * maxRetInfoTableSizeW ===================================== compiler/GHC/CmmToAsm/RV64/Ppr.hs ===================================== @@ -304,6 +304,7 @@ negOp (OpImm (ImmInt i)) = OpImm (ImmInt (negate i)) negOp (OpImm (ImmInteger i)) = OpImm (ImmInteger (negate i)) negOp op = pprPanic "RV64.negOp" (text $ show op) +-- TODO: Is this used in RISCV?! pprExt :: IsLine doc => ExtMode -> doc pprExt EUXTB = text "uxtb" pprExt EUXTH = text "uxth" @@ -314,6 +315,7 @@ pprExt ESXTH = text "sxth" pprExt ESXTW = text "sxtw" pprExt ESXTX = text "sxtx" +-- TODO: Is this used in RISCV?! pprShift :: IsLine doc => ShiftMode -> doc pprShift SLSL = text "lsl" pprShift SLSR = text "lsr" @@ -328,8 +330,6 @@ pprOp plat op = case op of OpRegShift w r s i -> pprReg w r <> comma <+> pprShift s <+> char '#' <> int i OpImm im -> pprIm plat im OpImmShift im s i -> pprIm plat im <> comma <+> pprShift s <+> char '#' <> int i - -- TODO: Address computation always use registers as 64bit -- is this correct? - OpAddr (AddrRegReg r1 r2) -> pprPanic "No Reg-Reg addressing mode in Riscv" (text $ show op) -- char '[' <+> pprReg W64 r1 <> comma <+> pprReg W64 r2 <+> char ']' OpAddr (AddrRegImm r1 im) -> pprImm plat im <> char '(' <> pprReg W64 r1 <> char ')' OpAddr (AddrReg r1) -> text "0(" <+> pprReg W64 r1 <+> char ')' ===================================== compiler/GHC/CmmToAsm/RV64/Regs.hs ===================================== @@ -16,42 +16,87 @@ import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Platform +-- | First integer register number. @zero@ register. +x0RegNo :: RegNo +x0RegNo = 0 + +x5RegNo, t0RegNo :: RegNo +x5RegNo = 5 +t0RegNo = x5RegNo + +x7RegNo, t2RegNo :: RegNo +x7RegNo = 7 +t2RegNo = x7RegNo + +x28RegNo, t3RegNo :: RegNo +x28RegNo = 28 +t3RegNo = x28RegNo + +-- | Last integer register number. Used as IP register. +x31RegNo, t6RegNo, ipRegNo :: RegNo +x31RegNo = 31 +t6RegNo = x31RegNo +ipRegNo = x31RegNo + +-- | First floating point register. +d0RegNo, ft0RegNo :: RegNo +d0RegNo = 32 +ft0RegNo = d0RegNo + +d7RegNo, ft7RegNo :: RegNo +d7RegNo = 39 +ft7RegNo = d7RegNo + +-- | Last floating point register. +d31RegNo :: RegNo +d31RegNo = 63 + +a0RegNo, x10RegNo :: RegNo +x10RegNo = 10 +a0RegNo = x10RegNo + +a7RegNo, x17RegNo :: RegNo +x17RegNo = 17 +a7RegNo = x17RegNo + +fa0RegNo, d10RegNo :: RegNo +d10RegNo = 42 +fa0RegNo = d10RegNo + +fa7RegNo, d17RegNo :: RegNo +d17RegNo = 49 +fa7RegNo = d17RegNo + +-- | All machine register numbers. allMachRegNos :: [RegNo] -allMachRegNos = [0 .. 31] ++ [32 .. 63] +allMachRegNos = intRegs ++ fpRegs + where + intRegs = [x0RegNo .. x31RegNo] + fpRegs = [d0RegNo .. d31RegNo] --- allocatableRegs is allMachRegNos with the fixed-use regs removed. --- i.e., these are the regs for which we are prepared to allow the --- register allocator to attempt to map VRegs to. +-- | Registers available to the register allocator. +-- +-- These are all registers minus those with a fixed role in RISCV ABI (zero, lr, +-- sp, gp, tp, fp, ip) and GHC RTS (Base, Sp, Hp, HpLim, R1..R8, F1..F6, +-- D1..D6.) allocatableRegs :: Platform -> [RealReg] -allocatableRegs platform - = let isFree = freeReg platform - in map RealRegSingle $ filter isFree allMachRegNos +allocatableRegs platform = + let isFree = freeReg platform + in map RealRegSingle $ filter isFree allMachRegNos --- argRegs is the set of regs which are read for an n-argument call to C. +-- | Integer argument registers according to the calling convention allGpArgRegs :: [Reg] -allGpArgRegs = map regSingle [10..17] -allFpArgRegs :: [Reg] -allFpArgRegs = map regSingle [42..49] - --- STG: --- 19: Base --- 20: Sp --- 21: Hp --- 22-27: R1-R6 --- 28: SpLim - --- This is the STG Sp reg. --- sp :: Reg --- sp = regSingle 20 +allGpArgRegs = map regSingle [a0RegNo .. a7RegNo] --- addressing modes ------------------------------------------------------------ +-- | Floating point argument registers according to the calling convention +allFpArgRegs :: [Reg] +allFpArgRegs = map regSingle [fa0RegNo .. fa7RegNo] --- TODO: AddrRegReg constructor is never used. Remove it? +-- | Addressing modes data AddrMode - = AddrRegReg Reg Reg - | AddrRegImm Reg Imm - | AddrReg Reg - deriving (Eq, Show) + = AddrRegImm Reg Imm + | AddrReg Reg + deriving (Eq, Show) -- ----------------------------------------------------------------------------- -- Immediates @@ -68,25 +113,20 @@ data Imm | ImmConstantDiff Imm Imm deriving (Eq, Show) -strImmLit :: FastString -> Imm -strImmLit s = ImmLit s - - litToImm :: CmmLit -> Imm -litToImm (CmmInt i w) = ImmInteger (narrowS w i) - -- narrow to the width: a CmmInt might be out of - -- range, but we assume that ImmInteger only contains - -- in-range values. A signed value should be fine here. -litToImm (CmmFloat f W32) = ImmFloat f -litToImm (CmmFloat f W64) = ImmDouble f -litToImm (CmmLabel l) = ImmCLbl l +litToImm (CmmInt i w) = ImmInteger (narrowS w i) +-- narrow to the width: a CmmInt might be out of +-- range, but we assume that ImmInteger only contains +-- in-range values. A signed value should be fine here. +litToImm (CmmFloat f W32) = ImmFloat f +litToImm (CmmFloat f W64) = ImmDouble f +litToImm (CmmLabel l) = ImmCLbl l litToImm (CmmLabelOff l off) = ImmIndex l off -litToImm (CmmLabelDiffOff l1 l2 off _) - = ImmConstantSum - (ImmConstantDiff (ImmCLbl l1) (ImmCLbl l2)) - (ImmInt off) -litToImm _ = panic "RV64.Regs.litToImm: no match" - +litToImm (CmmLabelDiffOff l1 l2 off _) = + ImmConstantSum + (ImmConstantDiff (ImmCLbl l1) (ImmCLbl l2)) + (ImmInt off) +litToImm l = panic $ "RV64.Regs.litToImm: no match for " ++ show l -- == To satisfy GHC.CmmToAsm.Reg.Target ======================================= @@ -116,21 +156,19 @@ virtualRegSqueeze cls vr {-# INLINE realRegSqueeze #-} realRegSqueeze :: RegClass -> RealReg -> Int -realRegSqueeze cls rr - = case cls of - RcInteger - -> case rr of - RealRegSingle regNo - | regNo < 32 -> 1 -- first fp reg is 32 - | otherwise -> 0 - - RcDouble - -> case rr of - RealRegSingle regNo - | regNo < 32 -> 0 - | otherwise -> 1 - - _other -> 0 +realRegSqueeze cls rr = + case cls of + RcInteger -> + case rr of + RealRegSingle regNo + | regNo < d0RegNo -> 1 + | otherwise -> 0 + RcDouble -> + case rr of + RealRegSingle regNo + | regNo < d0RegNo -> 0 + | otherwise -> 1 + _other -> 0 mkVirtualReg :: Unique -> Format -> VirtualReg mkVirtualReg u format @@ -141,11 +179,11 @@ mkVirtualReg u format FF64 -> VirtualRegD u _ -> panic "RV64.mkVirtualReg" -{-# INLINE classOfRealReg #-} +{-# INLINE classOfRealReg #-} classOfRealReg :: RealReg -> RegClass classOfRealReg (RealRegSingle i) - | i < 32 = RcInteger - | otherwise = RcDouble + | i < d0RegNo = RcInteger + | otherwise = RcDouble regDotColor :: RealReg -> SDoc regDotColor reg View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9b73cf299516bd383b1f14baf073df100d1369dd...da053cea8d36f62887083575202a01da261dd492 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9b73cf299516bd383b1f14baf073df100d1369dd...da053cea8d36f62887083575202a01da261dd492 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 20:17:33 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Tue, 05 Mar 2024 15:17:33 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] Try sequence LintM actions strictly Message-ID: <65e77dddbfe7a_28e20eaab81b41332fe@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: dc77120b by Mikolaj Konarski at 2024-03-05T21:17:12+01:00 Try sequence LintM actions strictly - - - - - 1 changed file: - compiler/GHC/Core/Lint.hs Changes: ===================================== compiler/GHC/Core/Lint.hs ===================================== @@ -1950,14 +1950,15 @@ lintType (TyVarTy tv) | otherwise = do { subst <- getSubst - ; case lookupTyVar subst tv of - Just linted_ty -> return linted_ty - - -- In GHCi we may lint an expression with a free - -- type variable. Then it won't be in the - -- substitution, but it should be in scope - Nothing -> do { checkTyCoVarInScope subst tv - ; return (TyVarTy tv) } + ; let !f = unLintM $ case lookupTyVar subst tv of + Just linted_ty -> return linted_ty + + -- In GHCi we may lint an expression with a free + -- type variable. Then it won't be in the + -- substitution, but it should be in scope + Nothing -> do { checkTyCoVarInScope subst tv + ; return (TyVarTy tv) } + ; LintM f } lintType ty@(AppTy t1 t2) @@ -2327,10 +2328,11 @@ lintCoercion (CoVarCo cv) | otherwise = do { subst <- getSubst - ; case lookupCoVar subst cv of - Just linted_co -> return linted_co ; - Nothing -> do { checkTyCoVarInScope subst cv - ; return (CoVarCo cv) } + ; let !f = unLintM $ case lookupCoVar subst cv of + Just linted_co -> return linted_co ; + Nothing -> do { checkTyCoVarInScope subst cv + ; return (CoVarCo cv) } + ; LintM f } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dc77120b0d214626e6dbaab64904ddc96793108b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dc77120b0d214626e6dbaab64904ddc96793108b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 21:49:19 2024 From: gitlab at gitlab.haskell.org (Finley McIlwaine (@FinleyMcIlwaine)) Date: Tue, 05 Mar 2024 16:49:19 -0500 Subject: [Git][ghc/ghc][wip/t24277] base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Message-ID: <65e7935fb18c8_28e20ed0a84b41338d5@gitlab.mail> Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC Commits: f0f9cb82 by Finley McIlwaine at 2024-03-05T13:49:06-08:00 base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId Add functions for gettings the IDs of cost centres to the interface of `GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids, `CostCentreId`, with appropriate instances. Implements CLC proposal 235. Resolves #24277 - - - - - 11 changed files: - docs/users_guide/9.10.1-notes.rst - libraries/base/changelog.md - libraries/base/src/GHC/Exts.hs - libraries/base/src/GHC/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Stack.hs - libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -244,6 +244,12 @@ Runtime system constructors in scope and the levity of ``t`` is statically known, then the constraint ``DataToTag t`` can always be solved. +- The ``CostCentreId`` type and ``currentCallStackIds :: IO [CostCentreId]`` + function for getting the IDs of the cost centers on the current stack are now + exported from ``GHC.Exts``. In addition to those, the ``ccId`` and + ``ccsToIds`` functions for getting ``CostCentreId``\s are also exported from + ``GHC.Stack``. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Export `CostCentreId` from `GHC.Exts` and `GHC.Stack` + * Export `currentCallStackIds` from `GHC.Exts` and `GHC.Stack` + * Export `ccId` and `ccsToIds` from `GHC.Stack` + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -84,6 +84,8 @@ module GHC.Exts traceEvent, -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, ===================================== libraries/base/src/GHC/Stack.hs ===================================== @@ -18,6 +18,7 @@ module GHC.Stack (errorWithStackTrace, -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks CallStack, @@ -37,16 +38,19 @@ module GHC.Stack -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where -import GHC.Internal.Stack \ No newline at end of file +import GHC.Internal.Stack ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -103,6 +103,8 @@ module GHC.Internal.Exts -- ** The call stack currentCallStack, + currentCallStackIds, + CostCentreId, -- * Ids with special behaviour inline, noinline, lazy, oneShot, considerAccessible, ===================================== libraries/ghc-internal/src/GHC/Internal/Stack.hs ===================================== @@ -2,6 +2,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- @@ -24,6 +25,7 @@ module GHC.Internal.Stack ( -- * Profiling call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * HasCallStack call stacks @@ -38,14 +40,17 @@ module GHC.Internal.Stack ( -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, ccsCC, ccsParent, + ccId, ccLabel, ccModule, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack ) where ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc ===================================== @@ -16,14 +16,17 @@ ----------------------------------------------------------------------------- {-# LANGUAGE UnboxedTuples, MagicHash, NoImplicitPrelude #-} +{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving #-} module GHC.Internal.Stack.CCS ( -- * Call stacks currentCallStack, + currentCallStackIds, whoCreated, -- * Internals CostCentreStack, CostCentre, + CostCentreId, getCurrentCCS, getCCSOf, clearCCS, @@ -31,7 +34,9 @@ module GHC.Internal.Stack.CCS ( ccsParent, ccLabel, ccModule, + ccId, ccSrcSpan, + ccsToIds, ccsToStrings, renderStack, ) where @@ -44,6 +49,12 @@ import GHC.Internal.Base import GHC.Internal.Ptr import GHC.Internal.IO.Encoding import GHC.Internal.List ( concatMap, reverse ) +import GHC.Internal.Word ( Word32 ) +import GHC.Internal.Show +import GHC.Internal.Read +import GHC.Internal.Enum +import GHC.Internal.Real +import GHC.Internal.Num #define PROFILING #include "Rts.h" @@ -54,6 +65,13 @@ data CostCentreStack -- | A cost-centre from GHC's cost-center profiler. data CostCentre +-- | Cost centre identifier +-- +-- @since 4.20.0.0 +newtype CostCentreId = CostCentreId Word32 + deriving (Show, Read) + deriving newtype (Eq, Ord, Bounded, Enum, Integral, Num, Real) + -- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current -- program was not compiled with profiling support). Takes a dummy argument -- which can be used to avoid the call to @getCurrentCCS@ being floated out by @@ -83,6 +101,12 @@ ccsCC p = peekByteOff p 4 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = peekByteOff p 8 +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO CostCentreId +ccId p = fmap CostCentreId $ peekByteOff p 0 + ccLabel :: Ptr CostCentre -> IO CString ccLabel p = peekByteOff p 4 @@ -99,6 +123,12 @@ ccsCC p = (# peek CostCentreStack, cc) p ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = (# peek CostCentreStack, prevStack) p +-- | Get the 'CostCentreId' of a 'CostCentre'. +-- +-- @since 4.20.0.0 +ccId :: Ptr CostCentre -> IO CostCentreId +ccId p = fmap CostCentreId $ (# peek CostCentre, ccID) p + -- | Get the label of a 'CostCentre'. ccLabel :: Ptr CostCentre -> IO CString ccLabel p = (# peek CostCentre, label) p @@ -125,6 +155,19 @@ ccSrcSpan p = (# peek CostCentre, srcloc) p currentCallStack :: IO [String] currentCallStack = ccsToStrings =<< getCurrentCCS () +-- | Returns a @[CostCentreId]@ representing the current call stack. This +-- can be useful for debugging. +-- +-- The implementation uses the call-stack simulation maintained by the +-- profiler, so it only works if the program was compiled with @-prof@ +-- and contains suitable SCC annotations (e.g. by using @-fprof-late@). +-- Otherwise, the list returned is likely to be empty or +-- uninformative. +-- +-- @since 4.20.0.0 +currentCallStackIds :: IO [CostCentreId] +currentCallStackIds = ccsToIds =<< getCurrentCCS () + -- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] @@ -141,6 +184,24 @@ ccsToStrings ccs0 = go ccs0 [] then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) +-- | Format a 'CostCentreStack' as a list of cost centre IDs. +-- +-- @since 4.20.0.0 +ccsToIds :: Ptr CostCentreStack -> IO [CostCentreId] +ccsToIds ccs0 = go ccs0 [] + where + go ccs acc + | ccs == nullPtr = return acc + | otherwise = do + cc <- ccsCC ccs + cc_id <- ccId cc + lbl <- GHC.peekCString utf8 =<< ccLabel cc + mdl <- GHC.peekCString utf8 =<< ccModule cc + parent <- ccsParent ccs + if (mdl == "MAIN" && lbl == "MAIN") + then return acc + else go parent (cc_id : acc) + -- | Get the stack trace attached to an object. -- -- @since base-4.5.0.0 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -5373,6 +5373,8 @@ module GHC.Exts where data Compact# type Constraint :: * type Constraint = CONSTRAINT LiftedRep + type CostCentreId :: * + newtype CostCentreId = ... type DataToTag :: forall {lev :: Levity}. TYPE (BoxedRep lev) -> Constraint class DataToTag a where dataToTag# :: a -> Int# @@ -5758,6 +5760,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9305,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9314,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11557,6 +11565,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11641,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12024,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12136,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12210,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12257,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12434,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12632,6 +12647,7 @@ instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12813,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -5727,6 +5727,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -12344,6 +12345,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -12351,14 +12354,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -12380,14 +12386,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String @@ -14592,6 +14601,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -14667,6 +14677,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -15051,6 +15062,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -15162,6 +15174,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -15235,6 +15248,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -15281,6 +15295,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -15659,6 +15674,7 @@ instance GHC.Classes.Eq GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.In instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -15824,6 +15840,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -5519,6 +5519,8 @@ module GHC.Exts where data Compact# type Constraint :: * type Constraint = CONSTRAINT LiftedRep + type CostCentreId :: * + newtype CostCentreId = ... type DataToTag :: forall {lev :: Levity}. TYPE (BoxedRep lev) -> Constraint class DataToTag a where dataToTag# :: a -> Int# @@ -5907,6 +5909,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9526,6 +9529,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9533,14 +9538,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [CostCentreId] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -11821,6 +11829,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11897,6 +11906,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Internal.Enum.Enum GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12291,6 +12301,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12403,6 +12414,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Internal.Read.Read GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12476,6 +12488,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12522,6 +12535,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12695,6 +12709,7 @@ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.ConsoleEvent.ConsoleE instance forall a. GHC.Internal.Show.Show a => GHC.Internal.Show.Show (GHC.Internal.Event.Windows.CbResult a) -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.HandleKey -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Internal.Show.Show GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12907,6 +12922,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq GHC.Internal.Event.Windows.HandleKey -- Defined in ‘GHC.Internal.Event.Windows’ instance GHC.Classes.Eq GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -13075,6 +13091,7 @@ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.I instance GHC.Classes.Ord GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ instance GHC.Classes.Ord GHC.Internal.Event.Windows.FFI.IOCP -- Defined in ‘GHC.Internal.Event.Windows.FFI’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -5758,6 +5758,7 @@ module GHC.Exts where ctz64# :: Word64# -> Word# ctz8# :: Word# -> Word# currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #) deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #) decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #) @@ -9302,6 +9303,8 @@ module GHC.Stack where data CallStack = ... type CostCentre :: * data CostCentre + type CostCentreId :: * + newtype CostCentreId = ... type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint @@ -9309,14 +9312,17 @@ module GHC.Stack where type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] emptyCallStack :: CallStack errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a freezeCallStack :: CallStack -> CallStack @@ -9338,14 +9344,17 @@ module GHC.Stack.CCS where data CostCentre type CostCentreStack :: * data CostCentreStack + ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32 ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre) ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) + ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32] ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String] clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String] + currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32] getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack) renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String @@ -11557,6 +11566,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’ instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’ @@ -11632,6 +11642,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’ @@ -12014,6 +12025,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’ @@ -12125,6 +12137,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ +instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12198,6 +12211,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’ instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’ @@ -12244,6 +12258,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’ +instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’ @@ -12420,6 +12435,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ +instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’ instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’ @@ -12633,6 +12649,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’ instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’ instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’ +instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ @@ -12797,6 +12814,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a) instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’ instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’ instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’ +instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’ instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’ instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f0f9cb82b786a7007604a6abcc3b603f56458393 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f0f9cb82b786a7007604a6abcc3b603f56458393 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 22:00:36 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Tue, 05 Mar 2024 17:00:36 -0500 Subject: [Git][ghc/ghc][wip/T24471] 8 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e7960488095_28e20ed92baa013414e@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 7841fb71 by Ben Gamari at 2024-03-05T22:00:21+00:00 ghc-experimental: Add dummy dependencies to work around #24436 This is a temporary measure to improve CI reliability until a proper solution is developed. - - - - - 5c227bca by Simon Peyton Jones at 2024-03-05T22:00:21+00:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 18 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/filepath - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - libraries/ghc-experimental/src/GHC/Profiling/Eras.hs - libraries/ghc-internal/ghc-internal.cabal - libraries/os-string - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -1031,7 +1031,7 @@ job_groups = -- (see Note [Object unloading]). fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native") - hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url") + hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage") tsan_jobs = modifyJobs ===================================== .gitlab/jobs.yaml ===================================== @@ -2330,7 +2330,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url", + "HADRIAN_ARGS": "--haddock-for-hackage", "LLC": "/bin/false", "OPT": "/bin/false", "RUNTEST_ARGS": "", @@ -4007,7 +4007,7 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release", "BUILD_FLAVOUR": "release", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids", + "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids", "IGNORE_PERF_FAILURES": "all", "LLC": "/bin/false", "OPT": "/bin/false", ===================================== .gitlab/rel_eng/upload_ghc_libs.py ===================================== @@ -49,6 +49,10 @@ def prep_base(): shutil.copy('config.guess', 'libraries/base') shutil.copy('config.sub', 'libraries/base') +def prep_ghc_internal(): + shutil.copy('config.guess', 'libraries/ghc-internal') + shutil.copy('config.sub', 'libraries/ghc-internal') + def build_copy_file(pkg: Package, f: Path): target = Path('_build') / 'stage1' / pkg.path / 'build' / f dest = pkg.path / f @@ -93,6 +97,8 @@ PACKAGES = { pkg.name: pkg for pkg in [ Package('base', Path("libraries/base"), prep_base), + Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal), + Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep), Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim), Package('integer-gmp', Path("libraries/integer-gmp"), no_prep), Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum), ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== hadrian/README.md ===================================== @@ -306,9 +306,9 @@ all of the documentation targets: You can pass several `--docs=...` flags, Hadrian will combine their effects. -To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag, -by default this will choose a url suitable for uploading to hackage but you might also want to pass something like -`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server. +To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag, +This will generate URLs which are appropiate for either uploading to a local hackage +server or the global hackage server. #### Source distribution ===================================== hadrian/src/CommandLine.hs ===================================== @@ -17,7 +17,6 @@ import System.Environment import qualified System.Directory as Directory import qualified Data.Set as Set -import Data.Maybe data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq) @@ -114,7 +113,7 @@ data DocArgs = DocArgs } deriving (Eq, Show) defaultDocArgs :: DocArgs -defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" } +defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" } readConfigure :: Either String (CommandLineArgs -> CommandLineArgs) readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually" @@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } } -readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) -readHaddockBaseUrl base_url = Right $ \flags -> - flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } } +readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs) +readHaddockBaseUrl = Right $ \flags -> + flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } } - where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url + where base_url = "/package/%pkg%/docs" readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) @@ -320,8 +319,8 @@ optDescrs = "Destination path for the bindist 'install' rule" , Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING") "Setting key to autocomplete, for the 'autocomplete' target." - , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL") - "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)." + , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl) + "Generate documentation suitable for upload to a hackage server." ] -- | A type-indexed map containing Hadrian command line arguments to be passed ===================================== hadrian/src/Settings/Builders/Haddock.hs ===================================== @@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat version <- expr $ pkgVersion pkg synopsis <- expr $ pkgSynopsis pkg haddocks <- expr $ haddockDependencies context - haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks] + haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks] hVersion <- expr $ pkgVersion haddock statsDir <- expr $ haddockStatsFilesDir baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs) - let baseUrl p = substituteTemplate baseUrlTemplate p + -- The path to where the docs for a package are + let docpath p = substituteTemplate baseUrlTemplate p + -- The path to where the src folder is for a package (typically docs ++ "/src/") + let srcpath p = docpath p ++ "/src/" ghcOpts <- haddockGhcArgs -- These are the options which are necessary to perform the build. Additional -- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are @@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat , arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion) , map ("--hide=" ++) <$> getContextData otherModules - , pure [ "--read-interface=../" ++ p - ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME}," - ++ haddock | (p, haddock) <- haddocks_with_versions ] + , pure [ "--read-interface=" ++ docpath (p, pid) + ++ "," ++ srcpath (p, pid) ++ "," + ++ haddock | (p, pid, haddock) <- haddocks_with_versions ] , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ] , arg "+RTS" , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t") , arg "--machine-readable" , arg "-RTS" ] ] -substituteTemplate :: String -> String -> String -substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate +substituteTemplate :: String -> (String, String) -> String +substituteTemplate baseTemplate (pkg, pkgId) = + T.unpack + . T.replace "%pkg%" (T.pack pkg) + . T.replace "%pkgid%" (T.pack pkgId) + . T.pack $ baseTemplate ===================================== libraries/filepath ===================================== @@ -1 +1 @@ -Subproject commit b55465e3d174ccd63914e7146079435503204187 +Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -80,4 +80,5 @@ module Data.Sum.Experimental ( Sum63#, ) where +import GHC.Num.BigNat () -- for build ordering import GHC.Types ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,4 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes +import GHC.Num.BigNat () -- for build ordering ===================================== libraries/ghc-experimental/src/GHC/Profiling/Eras.hs ===================================== @@ -1,7 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} --- | TODO move this module into ghc-internals module GHC.Profiling.Eras ( setUserEra , getUserEra , incrementUserEra ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -17,7 +17,7 @@ description: extra-tmp-files: autom4te.cache - base.buildinfo + ghc-internal.buildinfo config.log config.status include/EventConfig.h @@ -25,8 +25,8 @@ extra-tmp-files: extra-source-files: aclocal.m4 - base.buildinfo.in - changelog.md + ghc-internal.buildinfo.in + CHANGELOG.md configure configure.ac include/CTypes.h ===================================== libraries/os-string ===================================== @@ -1 +1 @@ -Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216 +Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8 ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [ collect_compiler_stats('all', 5) ], + multimod_compile, ['T24471', '-v0 -O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/557ac3d9646c37baf627e784cf078bf9cb866f6f...5c227bca89edb27b4328b9ed8b28c393d4cc312a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/557ac3d9646c37baf627e784cf078bf9cb866f6f...5c227bca89edb27b4328b9ed8b28c393d4cc312a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 5 22:50:47 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Tue, 05 Mar 2024 17:50:47 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] Make sure the foldl' accumulators are strict Message-ID: <65e7a1c7511d1_28e20eec8815c1388ed@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: f6f06963 by Mikolaj Konarski at 2024-03-05T23:50:20+01:00 Make sure the foldl' accumulators are strict - - - - - 2 changed files: - compiler/GHC/Core/TyCo/Rep.hs - compiler/GHC/Types/Unique/DSet.hs Changes: ===================================== compiler/GHC/Core/TyCo/Rep.hs ===================================== @@ -1905,7 +1905,7 @@ foldTyCo (TyCoFolder { tcf_view = view go_prov env (ProofIrrelProv co) = go_co env co go_prov _ (PluginProv _ cvs) = go_cvs env cvs - go_cvs env cvs = foldl' (\acc cv -> acc `mappend` covar env cv) mempty (dVarSetElems cvs) + go_cvs env cvs = foldl' (\ !acc cv -> acc `mappend` covar env cv) mempty (dVarSetElems cvs) -- | A view function that looks through nothing. noView :: Type -> Maybe Type ===================================== compiler/GHC/Types/Unique/DSet.hs ===================================== @@ -132,7 +132,7 @@ mapUniqDSet f (UniqDSet m) = UniqDSet $ unsafeCastUDFMKey $ mapUDFM f m -- mapping from DFM. strictFoldUniqDSet :: (a -> r -> r) -> r -> UniqDSet a -> r -strictFoldUniqDSet k r s = foldl' (\r e -> k e r) r $ +strictFoldUniqDSet k r s = foldl' (\ !r e -> k e r) r $ uniqDSetToList s -- Two 'UniqDSet's are considered equal if they contain the same View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6f06963c8e6dc0b027323dfcfb3cc5637ee5d3b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6f06963c8e6dc0b027323dfcfb3cc5637ee5d3b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 00:47:03 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Tue, 05 Mar 2024 19:47:03 -0500 Subject: [Git][ghc/ghc][wip/T24471] 2 commits: ghc-experimental: Add dummy dependencies to work around #23942 Message-ID: <65e7bd076b230_28e20e11efeadc1538e3@gitlab.mail> Ben Gamari pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 3e892fe5 by Ben Gamari at 2024-03-05T19:45:07-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 8d1384b1 by Simon Peyton Jones at 2024-03-05T19:45:53-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 8 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -80,4 +80,5 @@ module Data.Sum.Experimental ( Sum63#, ) where +import GHC.Num.BigNat () -- for build ordering import GHC.Types ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,4 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes +import GHC.Num.BigNat () -- for build ordering ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [ collect_compiler_stats('all', 5) ], + multimod_compile, ['T24471', '-v0 -O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5c227bca89edb27b4328b9ed8b28c393d4cc312a...8d1384b1156be380b3d64eefbba4de756cd3f366 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5c227bca89edb27b4328b9ed8b28c393d4cc312a...8d1384b1156be380b3d64eefbba4de756cd3f366 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 00:51:00 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Tue, 05 Mar 2024 19:51:00 -0500 Subject: [Git][ghc/ghc][wip/T23942] Keep explicit imports for built-in deps in ghc-prim Message-ID: <65e7bdf4b0f7c_28e20e121e6bb41629f7@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 7ed41803 by Matthew Craven at 2024-03-05T19:49:06-05:00 Keep explicit imports for built-in deps in ghc-prim It's very sad to have to do so, but see wrinkle TID3. Hopefully this changes soon. - - - - - 2 changed files: - compiler/GHC/Driver/MakeFile.hs - libraries/ghc-prim/GHC/Tuple.hs Changes: ===================================== compiler/GHC/Driver/MakeFile.hs ===================================== @@ -306,7 +306,7 @@ processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC (ModuleNode _ node)) mhome_unit = hsc_home_unit_maybe hsc_env mb_found <- findExactModule fc fopts other_fopts unit_state mhome_unit im case mb_found of - InstalledFound ml _ -> handle_hi_file (ml_hi_file ml) + InstalledFound modLoc _ -> handle_hi_file (ml_hi_file modLoc) InstalledNoPackage _ -> panic "processDeps.do_implicit_import" InstalledNotFound _ _ -> panic "processDeps.do_implicit_import" @@ -314,12 +314,16 @@ processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC (ModuleNode _ node)) ; unless (ms_mod node == gHC_TYPES) $ do_implicit_import gHC_TYPES - -- A module may implicitly depend on GHC.Tuple if ListTuplePuns is set ; unless (isHomeUnitInstanceOf (hsc_home_unit hsc_env) primUnitId) $ do - { -- see Note [Tracking implicit dependencies], wrinkle TID2 - when (xopt ListTuplePuns dflags) $ - do_implicit_import gHC_INTERNAL_TUPLE - -- see Note [Tracking implicit dependencies], wrinkle TID4 + { -- A module may implicitly depend on GHC.Tuple and GHC.Classes + -- if ListTuplePuns is set, but see wrinkle TID2. + when (xopt ListTuplePuns dflags) $ do + { do_implicit_import gHC_INTERNAL_TUPLE + ; do_implicit_import gHC_CLASSES + } + + -- Any module containing a string literal implicitly + -- depends on GHC.CString, but see wrinkle TID4. ; do_implicit_import gHC_CSTRING } } @@ -332,6 +336,7 @@ files to look up even if they are not imported. They include * Monad-related stuff in GHC.Internal.Base, if `do` notation is used * Tuple-related stuff in GHC.Tuple, if the built-in tuple syntax is used + * Constraint tuples in GHC.Classes, if the built-in tuple syntax is used * TypeRep-related stuff in GHC.Types, unless `-dno-typeable-binds` is set * deriving-related stuff mostly elsewhere in ghc-prim * GHC.CString.unpackCString# et al, if string literals are used @@ -342,13 +347,13 @@ interfaces. So we include them in our -M output if -include-pkg-deps is set, with the following wrinkles: (TID1) We don't actually bother adding implicit dependencies for - Monad, Arrow, etc. because the program will presumably fail to - typecheck unless these are reachable via explicit imports anyway. + Monad, Arrow, etc. because the program will fail to typecheck anyway + unless these are reachable via explicit imports. -(TID2) Users can opt out of implicitly depending on GHC.Tuple with the - NoListTuplePuns languge extension. Ideally we would just turn off - ListTuplePuns in the bits of ghc-prim that GHC.Tuple depends on, but - when I tried, I got stupid errors like this: +(TID2) Users can opt out of implicitly depending on GHC.Tuple and + GHC.Classes with the NoListTuplePuns languge extension. Ideally we + would just turn off ListTuplePuns in the bits of ghc-prim that these + modules depend on, but when I tried, I got stupid errors like this: libraries/ghc-prim/GHC/Types.hs:371:15: error: [GHC-46574] Cannot parse data constructor in a data/newtype declaration: [] @@ -358,22 +363,41 @@ is set, with the following wrinkles: So for now we don't emit this dependency in the `ghc-prim` package, which must explicitly import GHC.Tuple for build-order reasons. - Yuck! But this doesn't make things in `ghc-prim` much worse, because - -(TID3) We don't even try to track dependencies involving `deriving`. - We try to prevent this from causing problems by ensuring that any - machinery `deriving` needs to reference related to a typeclass is - imported from the defining module for that class. For example, the - class Eq is defined in GHC.Classes, and derived Eq instances can - reference GHC.Magic.dataToTag#. So we make sure that GHC.Magic is - imported in GHC.Classes. + Yuck! But this doesn't make things in `ghc-prim` much worse, because... + +(TID3) Although we emit these extra dependencies with -M, this happens + via special handling in this file and GHC's downsweep does not + report these dependencies properly. Doing so would require a + breaking change to ModSummary to create a place to store these + built-in implicit dependencies in the output of downsweep, and is + left as future work. + + But for now this causes problems with documentation generation for + ghc-prim unless its internal dependencies are indicated by actual + import statements. Since ghc-prim is fairly small and generally + plays by its own rules anyway, this situation is deemed acceptable + for now. + +(TID4) Since we don't have a flag to disable string literals, any + module could potentially contain one and thus reference GHC.CString. + To avoid cyclic dependency problems, we don't emit this potential + implicit dependency on GHC.CString for any modules in `ghc-prim`. + + If there were any string literals in ghc-prim, their containing + modules would need to explicitly import GHC.CString. (But as of + March 2024 there are none anyway.) + +(TID5) We only indirectly track dependencies introduced by `deriving`. + Instead, we ensure that any machinery that might be referenced in a + derived instance for a class is imported in the module that defines + that class. For example, the class Eq is defined in GHC.Classes, + and derived Eq instances can reference GHC.Magic.dataToTag#. So we + make sure that GHC.Magic is imported in GHC.Classes. Then, since + any module containing a derived Eq instance must import Eq, such a + module automatically transitively depends on GHC.Magic. Failing to do this for the Lift class caused #22229, which is sadly still open as of March 2024. - -(TID4) Likewise, since we don't have a flag to disable string - literals, we always add an implicit dependency on GHC.CString for - any modules outside of `ghc-prim`. -} findDependency :: HscEnv ===================================== libraries/ghc-prim/GHC/Tuple.hs ===================================== @@ -29,6 +29,8 @@ module GHC.Tuple ( Tuple60(..), Tuple61(..), Tuple62(..), Tuple63(..), Tuple64(..), ) where +import GHC.Types () -- This import is for build ordering. (wrinkle TID3) + default () -- Double and Integer aren't available yet -- | The unit datatype @Unit@ has one non-undefined member, the nullary View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ed418039b26d7cc6ca442e41273caf589523c8a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ed418039b26d7cc6ca442e41273caf589523c8a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 02:44:57 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 21:44:57 -0500 Subject: [Git][ghc/ghc][master] base: Reflect new era profiling RTS flags in GHC.RTS.Flags Message-ID: <65e7d8a93a8ce_33764fb3e2086e9@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - 6 changed files: - libraries/base/changelog.md - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to + reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`. + ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254)) + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc ===================================== @@ -274,6 +274,7 @@ data DoHeapProfile | HeapByLDV | HeapByClosureType | HeapByInfoTable + | HeapByEra -- ^ @since base-4.20.0.0 deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -289,6 +290,7 @@ instance Enum DoHeapProfile where fromEnum HeapByLDV = #{const HEAP_BY_LDV} fromEnum HeapByClosureType = #{const HEAP_BY_CLOSURE_TYPE} fromEnum HeapByInfoTable = #{const HEAP_BY_INFO_TABLE} + fromEnum HeapByEra = #{const HEAP_BY_ERA} toEnum #{const NO_HEAP_PROFILING} = NoHeapProfiling toEnum #{const HEAP_BY_CCS} = HeapByCCS @@ -299,6 +301,7 @@ instance Enum DoHeapProfile where toEnum #{const HEAP_BY_LDV} = HeapByLDV toEnum #{const HEAP_BY_CLOSURE_TYPE} = HeapByClosureType toEnum #{const HEAP_BY_INFO_TABLE} = HeapByInfoTable + toEnum #{const HEAP_BY_ERA} = HeapByEra toEnum e = errorWithoutStackTrace ("invalid enum for DoHeapProfile: " ++ show e) -- | Parameters of the cost-center profiler @@ -311,6 +314,7 @@ data ProfFlags = ProfFlags , startHeapProfileAtStartup :: Bool , startTimeProfileAtStartup :: Bool -- ^ @since base-4.20.0.0 , showCCSOnException :: Bool + , automaticEraIncrement :: Bool -- ^ @since 4.20.0.0 , maxRetainerSetSize :: Word , ccsLength :: Word , modSelector :: Maybe String @@ -320,6 +324,7 @@ data ProfFlags = ProfFlags , ccsSelector :: Maybe String , retainerSelector :: Maybe String , bioSelector :: Maybe String + , eraSelector :: Word -- ^ @since base-4.20.0.0 } deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -633,6 +638,8 @@ getProfFlags = do (#{peek PROFILING_FLAGS, startTimeProfileAtStartup} ptr :: IO CBool)) <*> (toBool <$> (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool)) + <*> (toBool <$> + (#{peek PROFILING_FLAGS, incrementUserEra} ptr :: IO CBool)) <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr <*> #{peek PROFILING_FLAGS, ccsLength} ptr <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr) @@ -642,6 +649,7 @@ getProfFlags = do <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, ccsSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, retainerSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, bioSelector} ptr) + <*> #{peek PROFILING_FLAGS, eraSelector} ptr getTraceFlags :: IO TraceFlags getTraceFlags = do ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -12071,7 +12071,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -12122,6 +12122,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -12130,7 +12131,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -9253,7 +9253,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9304,6 +9304,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9312,7 +9313,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4074a3f2007a118f7ee0c953559c4ba7bc61d6dd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4074a3f2007a118f7ee0c953559c4ba7bc61d6dd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 02:45:37 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 21:45:37 -0500 Subject: [Git][ghc/ghc][master] JS: faster implementation for some numeric primitives (#23597) Message-ID: <65e7d8d1c7814_3376411530a0115e7@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 1 changed file: - rts/js/arith.js Changes: ===================================== rts/js/arith.js ===================================== @@ -44,19 +44,23 @@ function h$hs_remWord64(h1,l1,h2,l2) { } function h$hs_timesWord64(h1,l1,h2,l2) { - var a = W64(h1,l1); - var b = W64(h2,l2); - var r = BigInt.asUintN(64, a * b); - TRACE_ARITH("Word64: " + a + " * " + b + " ==> " + r) - RETURN_W64(r); + var rh = h$mul2Word32(l1,l2); + var rl = h$ret1; + + rh += Math.imul(l1,h2)>>>0; + rh += Math.imul(l2,h1)>>>0; + rh >>>= 0; + + TRACE_ARITH("Word64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_minusWord64(h1,l1,h2,l2) { - var a = (BigInt(h1) << BigInt(32)) | BigInt(l1>>>0); - var b = (BigInt(h2) << BigInt(32)) | BigInt(l2>>>0); - var r = BigInt.asUintN(64, a - b); - TRACE_ARITH("Word64: " + a + " - " + b + " ==> " + r) - RETURN_W64(r); + var l = l1-l2; + var rl = l>>>0; + var rh = (h1-h2-(l!=rl?1:0))>>>0; + TRACE_ARITH("Word64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_plusWord64(h1,l1,h2,l2) { @@ -68,11 +72,15 @@ function h$hs_plusWord64(h1,l1,h2,l2) { } function h$hs_timesInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a * b); - TRACE_ARITH("Int64: " + a + " * " + b + " ==> " + r) - RETURN_I64(r); + var rh = h$mul2Word32(l1,l2); + var rl = h$ret1; + + rh += Math.imul(l1,h2)|0; + rh += Math.imul(l2,h1)|0; + rh |= 0; + + TRACE_ARITH("Int64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_quotInt64(h1,l1,h2,l2) { @@ -92,19 +100,19 @@ function h$hs_remInt64(h1,l1,h2,l2) { } function h$hs_plusInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a + b); - TRACE_ARITH("Int64: " + a + " + " + b + " ==> " + r) - RETURN_I64(r); + var l = l1+l2; + var rl = l>>>0; + var rh = (h1+h2+(l!=rl?1:0))|0; + TRACE_ARITH("Int64: " + (h1,l1) + " + " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_minusInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a - b); - TRACE_ARITH("Int64: " + a + " - " + b + " ==> " + r) - RETURN_I64(r); + var l = l1-l2; + var rl = l>>>0; + var rh = (h1-h2-(l!=rl?1:0))|0; + TRACE_ARITH("Int64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_uncheckedShiftLWord64(h,l,n) { View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8c0e31b203a912484e9faf9d903ab5b141d82f3 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8c0e31b203a912484e9faf9d903ab5b141d82f3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 02:46:22 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 21:46:22 -0500 Subject: [Git][ghc/ghc][master] rts: add -xr option to control two step allocator reserved space size Message-ID: <65e7d8fed4461_33764136a9741665c@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 6 changed files: - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - rts/RtsFlags.c - rts/include/rts/Flags.h - rts/sm/MBlock.c - testsuite/tests/rts/all.T Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -232,6 +232,11 @@ Runtime system - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``. +- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual + memory address space reserved by the two step allocator on a 64-bit + platform. The default size is now 1T on aarch64 as well. See + :ghc-ticket:`24498`. + ``base`` library ~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -368,6 +368,18 @@ Miscellaneous RTS options thread can execute its exception handlers. The ``-xq`` controls the size of this additional quota. +.. rts-flag:: -xr ⟨size⟩ + + :default: 1T + + This option controls the size of virtual memory address space + reserved by the two step allocator on a 64-bit platform. It can be + useful in scenarios where even reserving a large address range + without committing can be expensive (e.g. WSL1), or when you + actually have enough physical memory and want to support a Haskell + heap larger than 1T. ``-xr`` is a no-op if GHC is configured with + ``--disable-large-address-space`` or if the platform is 32-bit. + .. _rts-options-gc: RTS options to control the garbage collector ===================================== rts/RtsFlags.c ===================================== @@ -186,6 +186,9 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.ringBell = false; RtsFlags.GcFlags.longGCSync = 0; /* detection turned off */ + // 1 TBytes + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 40; + RtsFlags.DebugFlags.scheduler = false; RtsFlags.DebugFlags.interpreter = false; RtsFlags.DebugFlags.weak = false; @@ -552,6 +555,11 @@ usage_text[] = { " -xq The allocation limit given to a thread after it receives", " an AllocationLimitExceeded exception. (default: 100k)", "", +#if defined(USE_LARGE_ADDRESS_SPACE) +" -xr The size of virtual memory address space reserved by the", +" two step allocator (default: 1T)", +"", +#endif " -Mgrace=", " The amount of allocation after the program receives a", " HeapOverflow exception before the exception is thrown again, if", @@ -1820,6 +1828,12 @@ error = true; / BLOCK_SIZE; break; + case 'r': + OPTION_UNSAFE; + RtsFlags.GcFlags.addressSpaceSize + = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_WORD64_MAX); + break; + default: OPTION_SAFE; errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -2118,7 +2132,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max) m = atof(s); c = s[strlen(s)-1]; - if (c == 'g' || c == 'G') + if (c == 't' || c == 'T') + m *= (StgWord64)1024*1024*1024*1024; + else if (c == 'g' || c == 'G') m *= 1024*1024*1024; else if (c == 'm' || c == 'M') m *= 1024*1024; @@ -2737,4 +2753,3 @@ doingErasProfiling( void ) || RtsFlags.ProfFlags.eraSelector != 0); } #endif /* PROFILING */ - ===================================== rts/include/rts/Flags.h ===================================== @@ -89,6 +89,8 @@ typedef struct _GC_FLAGS { bool numa; /* Use NUMA */ StgWord numaMask; + + StgWord64 addressSpaceSize; /* large address space size in bytes */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== rts/sm/MBlock.c ===================================== @@ -659,20 +659,14 @@ initMBlocks(void) #if defined(USE_LARGE_ADDRESS_SPACE) { - W_ size; -#if defined(aarch64_HOST_ARCH) - size = (W_)1 << 38; // 1/4 TByte -#else - size = (W_)1 << 40; // 1 TByte -#endif void *startAddress = NULL; if (RtsFlags.GcFlags.heapBase) { startAddress = (void*) RtsFlags.GcFlags.heapBase; } - void *addr = osReserveHeapMemory(startAddress, &size); + void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize); mblock_address_space.begin = (W_)addr; - mblock_address_space.end = (W_)addr + size; + mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize; mblock_high_watermark = (W_)addr; } #elif SIZEOF_VOID_P == 8 ===================================== testsuite/tests/rts/all.T ===================================== @@ -3,7 +3,7 @@ test('testblockalloc', compile_and_run, ['']) test('testmblockalloc', - [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'), + [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'), when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts compile_and_run, ['']) # -I0 is important: the idle GC will run the memory leak detector, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/21e3f3250e88640087a1a60bee2cc113bf04509f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/21e3f3250e88640087a1a60bee2cc113bf04509f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 03:47:03 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 05 Mar 2024 22:47:03 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: base: Reflect new era profiling RTS flags in GHC.RTS.Flags Message-ID: <65e7e736f2c98_33764334cbc020041@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - abb7e60b by Cheng Shao at 2024-03-05T22:46:52-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - fa2b8f22 by Cheng Shao at 2024-03-05T22:46:52-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - af81b7f2 by Ben Gamari at 2024-03-05T22:46:52-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - d0083779 by Simon Peyton Jones at 2024-03-05T22:46:52-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 30 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - libraries/base/changelog.md - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - rts/RtsFlags.c - rts/Sparks.c - rts/include/rts/Flags.h - rts/include/rts/storage/Block.h - rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h - rts/js/arith.js - rts/posix/OSMem.c - rts/rts.cabal - rts/sm/CNF.c - rts/sm/GC.h - rts/sm/MBlock.c - rts/sm/NonMoving.h - rts/sm/NonMovingMark.c - rts/sm/Sanity.c - rts/wasm/OSMem.c - rts/win32/OSMem.c - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - + testsuite/tests/perf/compiler/T24471.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/efcce4aab88b2d85ec3aa8670680217f78b6b341...d008377958d1790e4de54535dd2028685e2f2ecd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/efcce4aab88b2d85ec3aa8670680217f78b6b341...d008377958d1790e4de54535dd2028685e2f2ecd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 06:14:23 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Wed, 06 Mar 2024 01:14:23 -0500 Subject: [Git][ghc/ghc][wip/T24471] 5 commits: base: Reflect new era profiling RTS flags in GHC.RTS.Flags Message-ID: <65e809bfbb2cb_33764733d748320e5@gitlab.mail> Cheng Shao pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 74cb79b1 by Ben Gamari at 2024-03-06T06:12:17+00:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - d8161acc by Simon Peyton Jones at 2024-03-06T06:13:48+00:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 21 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - libraries/base/changelog.md - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - rts/RtsFlags.c - rts/include/rts/Flags.h - rts/js/arith.js - rts/sm/MBlock.c - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T - testsuite/tests/rts/all.T Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -232,6 +232,11 @@ Runtime system - Add a :rts-flag:`--no-automatic-time-samples` flag which stops time profiling samples being automatically started on startup. Time profiling can be controlled manually using functions in ``GHC.Profiling``. +- Add a :rts-flag:`-xr ⟨size⟩` which controls the size of virtual + memory address space reserved by the two step allocator on a 64-bit + platform. The default size is now 1T on aarch64 as well. See + :ghc-ticket:`24498`. + ``base`` library ~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -368,6 +368,18 @@ Miscellaneous RTS options thread can execute its exception handlers. The ``-xq`` controls the size of this additional quota. +.. rts-flag:: -xr ⟨size⟩ + + :default: 1T + + This option controls the size of virtual memory address space + reserved by the two step allocator on a 64-bit platform. It can be + useful in scenarios where even reserving a large address range + without committing can be expensive (e.g. WSL1), or when you + actually have enough physical memory and want to support a Haskell + heap larger than 1T. ``-xr`` is a no-op if GHC is configured with + ``--disable-large-address-space`` or if the platform is 32-bit. + .. _rts-options-gc: RTS options to control the garbage collector ===================================== libraries/base/changelog.md ===================================== @@ -50,6 +50,10 @@ * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234)) + * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to + reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`. + ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254)) + ## 4.19.0.0 *October 2023* * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -80,4 +80,5 @@ module Data.Sum.Experimental ( Sum63#, ) where +import GHC.Num.BigNat () -- for build ordering import GHC.Types ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,4 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes +import GHC.Num.BigNat () -- for build ordering ===================================== libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc ===================================== @@ -274,6 +274,7 @@ data DoHeapProfile | HeapByLDV | HeapByClosureType | HeapByInfoTable + | HeapByEra -- ^ @since base-4.20.0.0 deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -289,6 +290,7 @@ instance Enum DoHeapProfile where fromEnum HeapByLDV = #{const HEAP_BY_LDV} fromEnum HeapByClosureType = #{const HEAP_BY_CLOSURE_TYPE} fromEnum HeapByInfoTable = #{const HEAP_BY_INFO_TABLE} + fromEnum HeapByEra = #{const HEAP_BY_ERA} toEnum #{const NO_HEAP_PROFILING} = NoHeapProfiling toEnum #{const HEAP_BY_CCS} = HeapByCCS @@ -299,6 +301,7 @@ instance Enum DoHeapProfile where toEnum #{const HEAP_BY_LDV} = HeapByLDV toEnum #{const HEAP_BY_CLOSURE_TYPE} = HeapByClosureType toEnum #{const HEAP_BY_INFO_TABLE} = HeapByInfoTable + toEnum #{const HEAP_BY_ERA} = HeapByEra toEnum e = errorWithoutStackTrace ("invalid enum for DoHeapProfile: " ++ show e) -- | Parameters of the cost-center profiler @@ -311,6 +314,7 @@ data ProfFlags = ProfFlags , startHeapProfileAtStartup :: Bool , startTimeProfileAtStartup :: Bool -- ^ @since base-4.20.0.0 , showCCSOnException :: Bool + , automaticEraIncrement :: Bool -- ^ @since 4.20.0.0 , maxRetainerSetSize :: Word , ccsLength :: Word , modSelector :: Maybe String @@ -320,6 +324,7 @@ data ProfFlags = ProfFlags , ccsSelector :: Maybe String , retainerSelector :: Maybe String , bioSelector :: Maybe String + , eraSelector :: Word -- ^ @since base-4.20.0.0 } deriving ( Show -- ^ @since base-4.8.0.0 , Generic -- ^ @since base-4.15.0.0 ) @@ -633,6 +638,8 @@ getProfFlags = do (#{peek PROFILING_FLAGS, startTimeProfileAtStartup} ptr :: IO CBool)) <*> (toBool <$> (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool)) + <*> (toBool <$> + (#{peek PROFILING_FLAGS, incrementUserEra} ptr :: IO CBool)) <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr <*> #{peek PROFILING_FLAGS, ccsLength} ptr <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr) @@ -642,6 +649,7 @@ getProfFlags = do <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, ccsSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, retainerSelector} ptr) <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, bioSelector} ptr) + <*> #{peek PROFILING_FLAGS, eraSelector} ptr getTraceFlags :: IO TraceFlags getTraceFlags = do ===================================== rts/RtsFlags.c ===================================== @@ -186,6 +186,9 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.ringBell = false; RtsFlags.GcFlags.longGCSync = 0; /* detection turned off */ + // 1 TBytes + RtsFlags.GcFlags.addressSpaceSize = (StgWord64)1 << 40; + RtsFlags.DebugFlags.scheduler = false; RtsFlags.DebugFlags.interpreter = false; RtsFlags.DebugFlags.weak = false; @@ -552,6 +555,11 @@ usage_text[] = { " -xq The allocation limit given to a thread after it receives", " an AllocationLimitExceeded exception. (default: 100k)", "", +#if defined(USE_LARGE_ADDRESS_SPACE) +" -xr The size of virtual memory address space reserved by the", +" two step allocator (default: 1T)", +"", +#endif " -Mgrace=", " The amount of allocation after the program receives a", " HeapOverflow exception before the exception is thrown again, if", @@ -1820,6 +1828,12 @@ error = true; / BLOCK_SIZE; break; + case 'r': + OPTION_UNSAFE; + RtsFlags.GcFlags.addressSpaceSize + = decodeSize(rts_argv[arg], 3, MBLOCK_SIZE, HS_WORD64_MAX); + break; + default: OPTION_SAFE; errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -2118,7 +2132,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max) m = atof(s); c = s[strlen(s)-1]; - if (c == 'g' || c == 'G') + if (c == 't' || c == 'T') + m *= (StgWord64)1024*1024*1024*1024; + else if (c == 'g' || c == 'G') m *= 1024*1024*1024; else if (c == 'm' || c == 'M') m *= 1024*1024; @@ -2737,4 +2753,3 @@ doingErasProfiling( void ) || RtsFlags.ProfFlags.eraSelector != 0); } #endif /* PROFILING */ - ===================================== rts/include/rts/Flags.h ===================================== @@ -89,6 +89,8 @@ typedef struct _GC_FLAGS { bool numa; /* Use NUMA */ StgWord numaMask; + + StgWord64 addressSpaceSize; /* large address space size in bytes */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== rts/js/arith.js ===================================== @@ -44,19 +44,23 @@ function h$hs_remWord64(h1,l1,h2,l2) { } function h$hs_timesWord64(h1,l1,h2,l2) { - var a = W64(h1,l1); - var b = W64(h2,l2); - var r = BigInt.asUintN(64, a * b); - TRACE_ARITH("Word64: " + a + " * " + b + " ==> " + r) - RETURN_W64(r); + var rh = h$mul2Word32(l1,l2); + var rl = h$ret1; + + rh += Math.imul(l1,h2)>>>0; + rh += Math.imul(l2,h1)>>>0; + rh >>>= 0; + + TRACE_ARITH("Word64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_minusWord64(h1,l1,h2,l2) { - var a = (BigInt(h1) << BigInt(32)) | BigInt(l1>>>0); - var b = (BigInt(h2) << BigInt(32)) | BigInt(l2>>>0); - var r = BigInt.asUintN(64, a - b); - TRACE_ARITH("Word64: " + a + " - " + b + " ==> " + r) - RETURN_W64(r); + var l = l1-l2; + var rl = l>>>0; + var rh = (h1-h2-(l!=rl?1:0))>>>0; + TRACE_ARITH("Word64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_plusWord64(h1,l1,h2,l2) { @@ -68,11 +72,15 @@ function h$hs_plusWord64(h1,l1,h2,l2) { } function h$hs_timesInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a * b); - TRACE_ARITH("Int64: " + a + " * " + b + " ==> " + r) - RETURN_I64(r); + var rh = h$mul2Word32(l1,l2); + var rl = h$ret1; + + rh += Math.imul(l1,h2)|0; + rh += Math.imul(l2,h1)|0; + rh |= 0; + + TRACE_ARITH("Int64: " + (h1,l1) + " * " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_quotInt64(h1,l1,h2,l2) { @@ -92,19 +100,19 @@ function h$hs_remInt64(h1,l1,h2,l2) { } function h$hs_plusInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a + b); - TRACE_ARITH("Int64: " + a + " + " + b + " ==> " + r) - RETURN_I64(r); + var l = l1+l2; + var rl = l>>>0; + var rh = (h1+h2+(l!=rl?1:0))|0; + TRACE_ARITH("Int64: " + (h1,l1) + " + " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_minusInt64(h1,l1,h2,l2) { - var a = I64(h1,l1); - var b = I64(h2,l2); - var r = BigInt.asIntN(64, a - b); - TRACE_ARITH("Int64: " + a + " - " + b + " ==> " + r) - RETURN_I64(r); + var l = l1-l2; + var rl = l>>>0; + var rh = (h1-h2-(l!=rl?1:0))|0; + TRACE_ARITH("Int64: " + (h1,l1) + " - " + (h2,l2) + " ==> " + (rh,rl)) + RETURN_UBX_TUP2(rh,rl); } function h$hs_uncheckedShiftLWord64(h,l,n) { ===================================== rts/sm/MBlock.c ===================================== @@ -659,20 +659,14 @@ initMBlocks(void) #if defined(USE_LARGE_ADDRESS_SPACE) { - W_ size; -#if defined(aarch64_HOST_ARCH) - size = (W_)1 << 38; // 1/4 TByte -#else - size = (W_)1 << 40; // 1 TByte -#endif void *startAddress = NULL; if (RtsFlags.GcFlags.heapBase) { startAddress = (void*) RtsFlags.GcFlags.heapBase; } - void *addr = osReserveHeapMemory(startAddress, &size); + void *addr = osReserveHeapMemory(startAddress, &RtsFlags.GcFlags.addressSpaceSize); mblock_address_space.begin = (W_)addr; - mblock_address_space.end = (W_)addr + size; + mblock_address_space.end = (W_)addr + RtsFlags.GcFlags.addressSpaceSize; mblock_high_watermark = (W_)addr; } #elif SIZEOF_VOID_P == 8 ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -12071,7 +12071,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -12122,6 +12122,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -12130,7 +12131,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -9253,7 +9253,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9304,6 +9304,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9312,7 +9313,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -9029,7 +9029,7 @@ module GHC.RTS.Flags where type DoCostCentres :: * data DoCostCentres = CostCentresNone | CostCentresSummary | CostCentresVerbose | CostCentresAll | CostCentresJSON type DoHeapProfile :: * - data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable + data DoHeapProfile = NoHeapProfiling | HeapByCCS | HeapByMod | HeapByDescr | HeapByType | HeapByRetainer | HeapByLDV | HeapByClosureType | HeapByInfoTable | HeapByEra type DoTrace :: * data DoTrace = TraceNone | TraceEventLog | TraceStderr type GCFlags :: * @@ -9080,6 +9080,7 @@ module GHC.RTS.Flags where startHeapProfileAtStartup :: GHC.Types.Bool, startTimeProfileAtStartup :: GHC.Types.Bool, showCCSOnException :: GHC.Types.Bool, + automaticEraIncrement :: GHC.Types.Bool, maxRetainerSetSize :: GHC.Types.Word, ccsLength :: GHC.Types.Word, modSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, @@ -9088,7 +9089,8 @@ module GHC.RTS.Flags where ccSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, ccsSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, retainerSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, - bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String} + bioSelector :: GHC.Internal.Maybe.Maybe GHC.Internal.Base.String, + eraSelector :: GHC.Types.Word} type RTSFlags :: * data RTSFlags = RTSFlags {gcFlags :: GCFlags, concurrentFlags :: ConcFlags, miscFlags :: MiscFlags, debugFlags :: DebugFlags, costCentreFlags :: CCFlags, profilingFlags :: ProfFlags, traceFlags :: TraceFlags, tickyFlags :: TickyFlags, parFlags :: ParFlags, hpcFlags :: HpcFlags} type RtsTime :: * ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [ req_th, collect_compiler_stats('all', 5) ], + multimod_compile, ['T24471', '-v0 -O']) ===================================== testsuite/tests/rts/all.T ===================================== @@ -3,7 +3,7 @@ test('testblockalloc', compile_and_run, ['']) test('testmblockalloc', - [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0'), + [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0 -xr0.125T'), when(arch('wasm32'), skip)], # MBlocks can't be freed on wasm32, see Note [Megablock allocator on wasm] in rts compile_and_run, ['']) # -I0 is important: the idle GC will run the memory leak detector, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8d1384b1156be380b3d64eefbba4de756cd3f366...d8161acc13d72330d54c9176bb22ff6336ee9ee1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8d1384b1156be380b3d64eefbba4de756cd3f366...d8161acc13d72330d54c9176bb22ff6336ee9ee1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 06:15:47 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Wed, 06 Mar 2024 01:15:47 -0500 Subject: [Git][ghc/ghc][wip/T24471] Three compile perf improvements with deep nesting Message-ID: <65e80a13c82db_337647428c843286f@gitlab.mail> Cheng Shao pushed to branch wip/T24471 at Glasgow Haskell Compiler / GHC Commits: b85111d1 by Simon Peyton Jones at 2024-03-06T06:15:30+00:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 6 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [req_th, collect_compiler_stats('all', 5)], + multimod_compile, ['T24471', '-v0 -O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b85111d1219f99068f0435e3289ce265e9ac58c7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b85111d1219f99068f0435e3289ce265e9ac58c7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 09:18:41 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Wed, 06 Mar 2024 04:18:41 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: rts: expose HeapAlloc.h as public header Message-ID: <65e834f199afe_33764c1bd21056262@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 6add6433 by Cheng Shao at 2024-03-06T04:18:29-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - ae72bf3f by Cheng Shao at 2024-03-06T04:18:29-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 044493e5 by Ben Gamari at 2024-03-06T04:18:30-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 99474b0a by Simon Peyton Jones at 2024-03-06T04:18:30-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 20 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - rts/Sparks.c - rts/include/rts/storage/Block.h - rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h - rts/posix/OSMem.c - rts/rts.cabal - rts/sm/CNF.c - rts/sm/GC.h - rts/sm/NonMoving.h - rts/sm/NonMovingMark.c - rts/sm/Sanity.c - rts/wasm/OSMem.c - rts/win32/OSMem.c - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -80,4 +80,5 @@ module Data.Sum.Experimental ( Sum63#, ) where +import GHC.Num.BigNat () -- for build ordering import GHC.Types ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,4 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes +import GHC.Num.BigNat () -- for build ordering ===================================== rts/Sparks.c ===================================== @@ -16,7 +16,7 @@ #include "Sparks.h" #include "ThreadLabels.h" #include "sm/NonMovingMark.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #if defined(THREADED_RTS) ===================================== rts/include/rts/storage/Block.h ===================================== @@ -10,6 +10,10 @@ #include "ghcconfig.h" +#if !defined(CMINUSMINUS) +#include "rts/storage/HeapAlloc.h" +#endif + /* The actual block and megablock-size constants are defined in * rts/include/Constants.h, all constants here are derived from these. */ @@ -190,6 +194,7 @@ typedef struct bdescr_ { EXTERN_INLINE bdescr *Bdescr(StgPtr p); EXTERN_INLINE bdescr *Bdescr(StgPtr p) { + ASSERT(HEAP_ALLOCED_GC(p)); return (bdescr *) ((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT)) | ((W_)p & ~MBLOCK_MASK) ===================================== rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h ===================================== @@ -8,8 +8,6 @@ #pragma once -#include "BeginPrivate.h" - #if defined(THREADED_RTS) // needed for HEAP_ALLOCED below extern SpinLock gc_alloc_block_sync; @@ -227,5 +225,3 @@ StgBool HEAP_ALLOCED_GC(const void *p) #else # error HEAP_ALLOCED not defined #endif - -#include "EndPrivate.h" ===================================== rts/posix/OSMem.c ===================================== @@ -13,7 +13,7 @@ #include "RtsUtils.h" #include "sm/OSMem.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #if defined(HAVE_UNISTD_H) #include ===================================== rts/rts.cabal ===================================== @@ -303,6 +303,7 @@ library rts/storage/Closures.h rts/storage/FunTypes.h rts/storage/Heap.h + rts/storage/HeapAlloc.h rts/storage/GC.h rts/storage/InfoTables.h rts/storage/MBlock.h ===================================== rts/sm/CNF.c ===================================== @@ -20,7 +20,7 @@ #include "Storage.h" #include "CNF.h" #include "Hash.h" -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "BlockAlloc.h" #include "Trace.h" #include "sm/ShouldCompact.h" ===================================== rts/sm/GC.h ===================================== @@ -13,7 +13,7 @@ #pragma once -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "BeginPrivate.h" ===================================== rts/sm/NonMoving.h ===================================== @@ -11,7 +11,7 @@ #if !defined(CMINUSMINUS) #include -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "NonMovingMark.h" #include "BeginPrivate.h" ===================================== rts/sm/NonMovingMark.c ===================================== @@ -14,7 +14,7 @@ #include "NonMovingShortcut.h" #include "NonMoving.h" #include "BlockAlloc.h" /* for countBlocks */ -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "Task.h" #include "Trace.h" #include "HeapUtils.h" ===================================== rts/sm/Sanity.c ===================================== @@ -32,7 +32,7 @@ #include "sm/NonMoving.h" #include "sm/NonMovingMark.h" #include "Profiling.h" // prof_arena -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" /* ----------------------------------------------------------------------------- Forward decls. ===================================== rts/wasm/OSMem.c ===================================== @@ -52,7 +52,7 @@ #include "RtsUtils.h" #include "sm/OSMem.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include <__macro_PAGESIZE.h> ===================================== rts/win32/OSMem.c ===================================== @@ -8,7 +8,7 @@ #include "Rts.h" #include "sm/OSMem.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "RtsUtils.h" #include ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [req_th, collect_compiler_stats('all', 5)], + multimod_compile, ['T24471', '-v0 -O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d008377958d1790e4de54535dd2028685e2f2ecd...99474b0aed8a30d4a3a024f4f88a94abbd1a6e01 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d008377958d1790e4de54535dd2028685e2f2ecd...99474b0aed8a30d4a3a024f4f88a94abbd1a6e01 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 10:02:05 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Wed, 06 Mar 2024 05:02:05 -0500 Subject: [Git][ghc/ghc][wip/no-mi-globals] Don't store a GlobalRdrEnv in `mi_globals` for GHCi. Message-ID: <65e83f1cf1656_33764d4a8d0c71013@gitlab.mail> Zubin pushed to branch wip/no-mi-globals at Glasgow Haskell Compiler / GHC Commits: 918daaef by Zubin Duggal at 2024-03-06T15:31:42+05:30 Don't store a GlobalRdrEnv in `mi_globals` for GHCi. GHCi only needs the `mi_globals` field for modules imported with :module +*SomeModule. It uses this field to make the top level environment in `SomeModule` available to the repl. By default, only the first target in the command line parameters is "star" loaded into GHCi. Other modules have to be manually "star" loaded into the repl. Storing the top level GlobalRdrEnv for each module is very wasteful, especially given that we will most likely never need most of these environments. Instead we store only the information needed to reconstruct the top level environment in a module, which is the `IfaceTopEnv` data structure, consisting of all import statements as well as all top level symbols defined in the module (not taking export lists into account) When a particular module is "star-loaded" into GHCi (as the first commandline target, or via an explicit `:module +*SomeModule`, we reconstruct the top level environment on demand using the `IfaceTopEnv`. - - - - - 24 changed files: - compiler/GHC.hs - compiler/GHC/Driver/Backend.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Iface/Make.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/IfaceToCore.hs - compiler/GHC/Rename/Env.hs - compiler/GHC/Rename/Names.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/Runtime/Loader.hs - compiler/GHC/Tc/Gen/Export.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Name/Reader.hs - compiler/GHC/Types/PkgQual.hs - compiler/GHC/Types/Unique/Set.hs - compiler/GHC/Unit/Module/ModIface.hs - compiler/Language/Haskell/Syntax/ImpExp.hs - ghc/GHCi/UI.hs - ghc/GHCi/UI/Info.hs - ghc/GHCi/UI/Monad.hs - utils/dump-decls/Main.hs Changes: ===================================== compiler/GHC.hs ===================================== @@ -86,14 +86,12 @@ module GHC ( ModuleInfo, getModuleInfo, modInfoTyThings, - modInfoTopLevelScope, modInfoExports, modInfoExportsWithSelectors, modInfoInstances, modInfoIsExportedName, modInfoLookupName, modInfoIface, - modInfoRdrEnv, modInfoSafe, lookupGlobalName, findGlobalAnns, @@ -1223,9 +1221,6 @@ typecheckModule pmod = do details <- makeSimpleDetails lcl_logger tc_gbl_env safe <- finalSafeMode lcl_dflags tc_gbl_env - let !rdr_env = forceGlobalRdrEnv $ tcg_rdr_env tc_gbl_env - -- See Note [Forcing GREInfo] in GHC.Types.GREInfo. - return $ TypecheckedModule { tm_internals_ = (tc_gbl_env, details), @@ -1236,7 +1231,6 @@ typecheckModule pmod = do ModuleInfo { minf_type_env = md_types details, minf_exports = md_exports details, - minf_rdr_env = Just rdr_env, minf_instances = fixSafeInstances safe $ instEnvElts $ md_insts details, minf_iface = Nothing, minf_safe = safe, @@ -1389,7 +1383,6 @@ getNamePprCtx = withSession $ \hsc_env -> do data ModuleInfo = ModuleInfo { minf_type_env :: TypeEnv, minf_exports :: [AvailInfo], - minf_rdr_env :: Maybe IfGlobalRdrEnv, -- Nothing for a compiled/package mod minf_instances :: [ClsInst], minf_iface :: Maybe ModIface, minf_safe :: SafeHaskellMode, @@ -1416,13 +1409,9 @@ getPackageModuleInfo hsc_env mdl tys = [ ty | name <- concatMap availNames avails, Just ty <- [lookupTypeEnv pte name] ] - let !rdr_env = availsToGlobalRdrEnv hsc_env mdl avails - -- See Note [Forcing GREInfo] in GHC.Types.GREInfo. - return (Just (ModuleInfo { minf_type_env = mkTypeEnv tys, minf_exports = avails, - minf_rdr_env = Just rdr_env, minf_instances = error "getModuleInfo: instances for package module unimplemented", minf_iface = Just iface, minf_safe = getSafeMode $ mi_trust iface, @@ -1439,7 +1428,7 @@ availsToGlobalRdrEnv hsc_env mod avails -- all the specified modules into the global interactive module imp_spec = ImpSpec { is_decl = decl, is_item = ImpAll} decl = ImpDeclSpec { is_mod = mod, is_as = moduleName mod, - is_qual = False, + is_qual = False, is_isboot = NotBoot, is_pkg_qual = NoPkgQual, is_dloc = srcLocSpan interactiveSrcLoc } getHomeModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo) @@ -1452,7 +1441,6 @@ getHomeModuleInfo hsc_env mdl = return (Just (ModuleInfo { minf_type_env = md_types details, minf_exports = md_exports details, - minf_rdr_env = mi_globals $ hm_iface hmi, -- NB: already forced. See Note [Forcing GREInfo] in GHC.Types.GREInfo. minf_instances = instEnvElts $ md_insts details, minf_iface = Just iface, @@ -1464,12 +1452,6 @@ getHomeModuleInfo hsc_env mdl = modInfoTyThings :: ModuleInfo -> [TyThing] modInfoTyThings minf = typeEnvElts (minf_type_env minf) -modInfoTopLevelScope :: ModuleInfo -> Maybe [Name] -modInfoTopLevelScope minf - = fmap (map greName . globalRdrEnvElts) (minf_rdr_env minf) - -- NB: no need to force this again. - -- See Note [Forcing GREInfo] in GHC.Types.GREInfo. - modInfoExports :: ModuleInfo -> [Name] modInfoExports minf = concatMap availNames $! minf_exports minf @@ -1486,12 +1468,13 @@ modInfoIsExportedName minf name = elemNameSet name (availsToNameSet (minf_export mkNamePprCtxForModule :: GhcMonad m => + Module -> ModuleInfo -> - m (Maybe NamePprCtx) -- XXX: returns a Maybe X -mkNamePprCtxForModule minf = withSession $ \hsc_env -> do - let mk_name_ppr_ctx = mkNamePprCtx ptc (hsc_unit_env hsc_env) + m NamePprCtx +mkNamePprCtxForModule mod minf = withSession $ \hsc_env -> do + let name_ppr_ctx = mkNamePprCtx ptc (hsc_unit_env hsc_env) (availsToGlobalRdrEnv hsc_env mod (minf_exports minf)) ptc = initPromotionTickContext (hsc_dflags hsc_env) - return (fmap mk_name_ppr_ctx (minf_rdr_env minf)) + return name_ppr_ctx modInfoLookupName :: GhcMonad m => ModuleInfo -> Name @@ -1504,9 +1487,6 @@ modInfoLookupName minf name = withSession $ \hsc_env -> do modInfoIface :: ModuleInfo -> Maybe ModIface modInfoIface = minf_iface -modInfoRdrEnv :: ModuleInfo -> Maybe IfGlobalRdrEnv -modInfoRdrEnv = minf_rdr_env - -- | Retrieve module safe haskell mode modInfoSafe :: ModuleInfo -> SafeHaskellMode modInfoSafe = minf_safe ===================================== compiler/GHC/Driver/Backend.hs ===================================== @@ -511,7 +511,7 @@ backendRespectsSpecialise (Named JavaScript) = True backendRespectsSpecialise (Named Interpreter) = False backendRespectsSpecialise (Named NoBackend) = False --- | This back end wants the `mi_globals` field of a +-- | This back end wants the `mi_top_env` field of a -- `ModIface` to be populated (with the top-level bindings -- of the original source). Only true for the interpreter. backendWantsGlobalBindings :: Backend -> Bool ===================================== compiler/GHC/Driver/Main.hs ===================================== @@ -1100,7 +1100,7 @@ hscDesugarAndSimplify summary (FrontendTypecheck tc_result) tc_warnings mb_old_h {-# SCC "GHC.Driver.Main.mkPartialIface" #-} -- This `force` saves 2M residency in test T10370 -- See Note [Avoiding space leaks in toIface*] for details. - force (mkPartialIface hsc_env (cg_binds cg_guts) details summary simplified_guts) + force (mkPartialIface hsc_env (cg_binds cg_guts) details summary (tcg_import_decls tc_result) simplified_guts) return HscRecomp { hscs_guts = cg_guts, hscs_mod_location = ms_location summary, ===================================== compiler/GHC/Iface/Make.hs ===================================== @@ -27,6 +27,7 @@ import GHC.StgToCmm.Types (CmmCgInfos (..)) import GHC.Tc.Utils.TcType import GHC.Tc.Utils.Monad +import GHC.Tc.Gen.Export import GHC.Iface.Decl import GHC.Iface.Syntax @@ -106,9 +107,10 @@ mkPartialIface :: HscEnv -> CoreProgram -> ModDetails -> ModSummary + -> [ImportUserSpec] -> ModGuts -> PartialModIface -mkPartialIface hsc_env core_prog mod_details mod_summary +mkPartialIface hsc_env core_prog mod_details mod_summary import_decls ModGuts{ mg_module = this_mod , mg_hsc_src = hsc_src , mg_usages = usages @@ -122,7 +124,7 @@ mkPartialIface hsc_env core_prog mod_details mod_summary , mg_trust_pkg = self_trust , mg_docs = docs } - = mkIface_ hsc_env this_mod core_prog hsc_src used_th deps rdr_env fix_env warns hpc_info self_trust + = mkIface_ hsc_env this_mod core_prog hsc_src used_th deps rdr_env import_decls fix_env warns hpc_info self_trust safe_mode usages docs mod_summary mod_details -- | Fully instantiate an interface. Adds fingerprints and potentially code @@ -194,6 +196,7 @@ mkIfaceTc hsc_env safe_mode mod_details mod_summary mb_program tc_result at TcGblEnv{ tcg_mod = this_mod, tcg_src = hsc_src, tcg_imports = imports, + tcg_import_decls = import_decls, tcg_rdr_env = rdr_env, tcg_fix_env = fix_env, tcg_merged = merged, @@ -232,7 +235,7 @@ mkIfaceTc hsc_env safe_mode mod_details mod_summary mb_program let partial_iface = mkIface_ hsc_env this_mod (fromMaybe [] mb_program) hsc_src - used_th deps rdr_env + used_th deps rdr_env import_decls fix_env warns hpc_info (imp_trust_own_pkg imports) safe_mode usages docs mod_summary @@ -241,7 +244,7 @@ mkIfaceTc hsc_env safe_mode mod_details mod_summary mb_program mkFullIface hsc_env partial_iface Nothing Nothing mkIface_ :: HscEnv -> Module -> CoreProgram -> HscSource - -> Bool -> Dependencies -> GlobalRdrEnv + -> Bool -> Dependencies -> GlobalRdrEnv -> [ImportUserSpec] -> NameEnv FixItem -> Warnings GhcRn -> HpcInfo -> Bool -> SafeHaskellMode @@ -251,7 +254,7 @@ mkIface_ :: HscEnv -> Module -> CoreProgram -> HscSource -> ModDetails -> PartialModIface mkIface_ hsc_env - this_mod core_prog hsc_src used_th deps rdr_env fix_env src_warns + this_mod core_prog hsc_src used_th deps rdr_env import_decls fix_env src_warns hpc_info pkg_trust_req safe_mode usages docs mod_summary ModDetails{ md_insts = insts, @@ -323,7 +326,7 @@ mkIface_ hsc_env mi_fixities = fixities, mi_warns = warns, mi_anns = annotations, - mi_globals = rdrs, + mi_top_env = rdrs, mi_used_th = used_th, mi_decls = decls, mi_extra_decls = extra_decls, @@ -345,16 +348,18 @@ mkIface_ hsc_env dflags = hsc_dflags hsc_env - -- We only fill in mi_globals if the module was compiled to byte + -- We only fill in mi_top_env if the module was compiled to byte -- code. Otherwise, the compiler may not have retained all the -- top-level bindings and they won't be in the TypeEnv (see - -- Desugar.addExportFlagsAndRules). The mi_globals field is used + -- Desugar.addExportFlagsAndRules). The mi_top_env field is used -- by GHCi to decide whether the module has its full top-level -- scope available. (#5534) - maybeGlobalRdrEnv :: GlobalRdrEnv -> Maybe IfGlobalRdrEnv + maybeGlobalRdrEnv :: GlobalRdrEnv -> Maybe IfaceTopEnv maybeGlobalRdrEnv rdr_env | backendWantsGlobalBindings (backend dflags) - = Just $! forceGlobalRdrEnv rdr_env + = Just $! let !exports = mkIfaceExports $ all_rdr_exports rdr_env + !imports = mkIfaceImports import_decls + in IfaceTopEnv exports imports -- See Note [Forcing GREInfo] in GHC.Types.GREInfo. | otherwise = Nothing @@ -472,6 +477,13 @@ mkIfaceAnnotation (Annotation { ann_target = target, ann_value = payload }) ifAnnotatedValue = payload } +mkIfaceImports :: [ImportUserSpec] -> [IfaceImport] +mkIfaceImports = map go + where + go (ImpUserSpec decl ImpUserAll) = IfaceImport decl ImpIfaceAll + go (ImpUserSpec decl (ImpUserExplicit env)) = IfaceImport decl (ImpIfaceExplicit (forceGlobalRdrEnv env)) + go (ImpUserSpec decl (ImpUserEverythingBut ns)) = IfaceImport decl (ImpIfaceEverythingBut ns) + mkIfaceExports :: [AvailInfo] -> [IfaceExport] -- Sort to make canonical mkIfaceExports exports = sortBy stableAvailCmp (map sort_subs exports) ===================================== compiler/GHC/Iface/Syntax.hs ===================================== @@ -25,6 +25,8 @@ module GHC.Iface.Syntax ( IfaceTyConParent(..), IfaceCompleteMatch(..), IfaceLFInfo(..), IfaceTopBndrInfo(..), + IfaceImport(..), + ImpIfaceList(..), -- * Binding names IfaceTopBndr, @@ -63,6 +65,7 @@ import GHC.Types.FieldLabel import GHC.Types.Name.Set import GHC.Core.Coercion.Axiom ( BranchIndex ) import GHC.Types.Name +import GHC.Types.Name.Reader import GHC.Types.CostCentre import GHC.Types.Literal import GHC.Types.ForeignCall @@ -105,6 +108,13 @@ infixl 3 &&& ************************************************************************ -} +data IfaceImport = IfaceImport ImpDeclSpec ImpIfaceList + +data ImpIfaceList + = ImpIfaceAll -- ^ no user import list + | ImpIfaceExplicit !IfGlobalRdrEnv + | ImpIfaceEverythingBut !NameSet + -- | A binding top-level 'Name' in an interface file (e.g. the name of an -- 'IfaceDecl'). type IfaceTopBndr = Name @@ -128,7 +138,6 @@ putIfaceTopBndr bh name = --pprTrace "putIfaceTopBndr" (ppr name) $ put_binding_name bh name - data IfaceDecl = IfaceId { ifName :: IfaceTopBndr, ifType :: IfaceType, @@ -2725,6 +2734,14 @@ instance Binary IfaceCompleteMatch where ************************************************************************ -} +instance NFData IfaceImport where + rnf (IfaceImport a b) = rnf a `seq` rnf b + +instance NFData ImpIfaceList where + rnf ImpIfaceAll = () + rnf (ImpIfaceEverythingBut ns) = rnf ns + rnf (ImpIfaceExplicit gre) = rnf gre + instance NFData IfaceDecl where rnf = \case IfaceId f1 f2 f3 f4 -> ===================================== compiler/GHC/IfaceToCore.hs ===================================== @@ -28,6 +28,7 @@ module GHC.IfaceToCore ( tcIfaceExpr, -- Desired by HERMIT (#7683) tcIfaceGlobal, tcIfaceOneShot, tcTopIfaceBindings, + tcIfaceImport, hydrateCgBreakInfo ) where @@ -54,6 +55,7 @@ import GHC.Tc.Errors.Types import GHC.Tc.TyCl.Build import GHC.Tc.Utils.Monad import GHC.Tc.Utils.TcType +import GHC.Tc.Utils.Env import GHC.Core.Type import GHC.Core.Coercion @@ -111,6 +113,7 @@ import GHC.Types.Literal import GHC.Types.Var as Var import GHC.Types.Var.Set import GHC.Types.Name +import GHC.Types.Name.Reader import GHC.Types.Name.Env import GHC.Types.Id import GHC.Types.Id.Make @@ -2176,3 +2179,12 @@ hydrateCgBreakInfo CgBreakInfo{..} = do result_ty <- tcIfaceType cgb_resty mbVars <- mapM (traverse (\(if_gbl, offset) -> (,offset) <$> bindIfaceId if_gbl return)) cgb_vars return (mbVars, result_ty) + +-- | This function is only used to construct the environment for GHCi, +-- so we make up fake locations +tcIfaceImport :: HscEnv -> IfaceImport -> ImportUserSpec +tcIfaceImport _ (IfaceImport spec ImpIfaceAll) = ImpUserSpec spec ImpUserAll +tcIfaceImport _ (IfaceImport spec (ImpIfaceEverythingBut ns)) = ImpUserSpec spec (ImpUserEverythingBut ns) +tcIfaceImport hsc_env (IfaceImport spec (ImpIfaceExplicit gre)) = ImpUserSpec spec (ImpUserExplicit (hydrateGlobalRdrEnv get_GRE_info gre)) + where + get_GRE_info nm = tyThingGREInfo <$> lookupGlobal hsc_env nm ===================================== compiler/GHC/Rename/Env.hs ===================================== @@ -1958,7 +1958,7 @@ lookupQualifiedNameGHCi fos rdr_name , gre_info = info } where info = lookupGREInfo hsc_env nm - spec = ImpDeclSpec { is_mod = mod, is_as = moduleName mod, is_qual = True, is_dloc = noSrcSpan } + spec = ImpDeclSpec { is_mod = mod, is_as = moduleName mod, is_pkg_qual = NoPkgQual, is_qual = True, is_isboot = NotBoot, is_dloc = noSrcSpan } is = ImpSpec { is_decl = spec, is_item = ImpAll } -- | Look up the 'GREInfo' associated with the given 'Name' ===================================== compiler/GHC/Rename/Names.hs ===================================== @@ -14,6 +14,8 @@ Extracting imported and top-level names in scope module GHC.Rename.Names ( rnImports, getLocalNonValBinders, newRecordFieldLabel, + importsFromIface, + ImportUserSpec(..), extendGlobalRdrEnvRn, gresFromAvails, calculateAvails, @@ -48,7 +50,8 @@ import GHC.Tc.Types.LclEnv import GHC.Tc.Zonk.TcType ( tcInitTidyEnv ) import GHC.Hs -import GHC.Iface.Load ( loadSrcInterface ) +import GHC.Iface.Load ( loadSrcInterface, cannotFindModule ) +import GHC.Iface.Errors.Types import GHC.Iface.Syntax ( fromIfaceWarnings ) import GHC.Builtin.Names import GHC.Parser.PostProcess ( setRdrNameSpace ) @@ -107,6 +110,7 @@ import qualified Data.Set as S import System.FilePath (()) import System.IO +import GHC.Unit.Finder {- ************************************************************************ @@ -200,7 +204,7 @@ with yes we have gone with no for now. -- Note: Do the non SOURCE ones first, so that we get a helpful warning -- for SOURCE ones that are unnecessary rnImports :: [(LImportDecl GhcPs, SDoc)] - -> RnM ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, AnyHpcUsage) + -> RnM ([LImportDecl GhcRn], [ImportUserSpec], GlobalRdrEnv, ImportAvails, AnyHpcUsage) rnImports imports = do tcg_env <- getGblEnv -- NB: want an identity module here, because it's OK for a signature @@ -211,14 +215,14 @@ rnImports imports = do stuff1 <- mapAndReportM (rnImportDecl this_mod) ordinary stuff2 <- mapAndReportM (rnImportDecl this_mod) source -- Safe Haskell: See Note [Tracking Trust Transitively] - let (decls, rdr_env, imp_avails, hpc_usage) = combine (stuff1 ++ stuff2) + let (decls, imp_user_spec, rdr_env, imp_avails, hpc_usage) = combine (stuff1 ++ stuff2) -- Update imp_boot_mods if imp_direct_mods mentions any of them let merged_import_avail = clobberSourceImports imp_avails dflags <- getDynFlags let final_import_avail = merged_import_avail { imp_dep_direct_pkgs = S.fromList (implicitPackageDeps dflags) `S.union` imp_dep_direct_pkgs merged_import_avail} - return (decls, rdr_env, final_import_avail, hpc_usage) + return (decls, imp_user_spec, rdr_env, final_import_avail, hpc_usage) where clobberSourceImports imp_avails = @@ -231,19 +235,20 @@ rnImports imports = do combJ (GWIB _ IsBoot) x = Just x combJ r _ = Just r -- See Note [Combining ImportAvails] - combine :: [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, AnyHpcUsage)] - -> ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, AnyHpcUsage) + combine :: [(LImportDecl GhcRn, ImportUserSpec, GlobalRdrEnv, ImportAvails, AnyHpcUsage)] + -> ([LImportDecl GhcRn], [ImportUserSpec], GlobalRdrEnv, ImportAvails, AnyHpcUsage) combine ss = - let (decls, rdr_env, imp_avails, hpc_usage, finsts) = foldr + let (decls, imp_user_spec, rdr_env, imp_avails, hpc_usage, finsts) = foldr plus - ([], emptyGlobalRdrEnv, emptyImportAvails, False, emptyModuleSet) + ([], [], emptyGlobalRdrEnv, emptyImportAvails, False, emptyModuleSet) ss - in (decls, rdr_env, imp_avails { imp_finsts = moduleSetElts finsts }, + in (decls, imp_user_spec, rdr_env, imp_avails { imp_finsts = moduleSetElts finsts }, hpc_usage) - plus (decl, gbl_env1, imp_avails1, hpc_usage1) - (decls, gbl_env2, imp_avails2, hpc_usage2, finsts_set) + plus (decl, us, gbl_env1, imp_avails1, hpc_usage1) + (decls, uss, gbl_env2, imp_avails2, hpc_usage2, finsts_set) = ( decl:decls, + us:uss, gbl_env1 `plusGlobalRdrEnv` gbl_env2, imp_avails1' `plusImportAvails` imp_avails2, hpc_usage1 || hpc_usage2, @@ -295,6 +300,26 @@ Running generateModules from #14693 with DEPTH=16, WIDTH=30 finishes in -} +importSpec :: LImportDecl GhcPs -> RnM (ImpDeclSpec, Maybe (ImportListInterpretation, LocatedL [LIE GhcPs])) +importSpec (L loc (ImportDecl { ideclName = loc_imp_mod_name + , ideclPkgQual = raw_pkg_qual + , ideclSource = want_boot + , ideclQualified = qual_style + , ideclAs = as_mod, ideclImportList = imp_details })) + = do hsc_env <- getTopEnv + let unit_env = hsc_unit_env hsc_env + let imp_mod_name = unLoc loc_imp_mod_name + let pkg_qual = renameRawPkgQual unit_env imp_mod_name raw_pkg_qual + res <- liftIO $ findImportedModule hsc_env imp_mod_name pkg_qual + imp_mod <- case res of + Found _ mod -> pure mod + err -> failWithTc $ TcRnInterfaceError $ Can'tFindInterface (cannotFindModule hsc_env imp_mod_name err) $ LookingForModule imp_mod_name want_boot + let qual_only = isImportDeclQualified qual_style + qual_mod_name = fmap unLoc as_mod `orElse` imp_mod_name + imp_spec = ImpDeclSpec { is_mod = imp_mod, is_qual = qual_only, is_pkg_qual = pkg_qual, + is_dloc = locA loc, is_as = qual_mod_name, is_isboot = want_boot } + pure (imp_spec, imp_details) + -- | Given a located import declaration @decl@ from @this_mod@, -- calculate the following pieces of information: @@ -312,32 +337,31 @@ Running generateModules from #14693 with DEPTH=16, WIDTH=30 finishes in -- 4. A boolean 'AnyHpcUsage' which is true if the imported module -- used HPC. rnImportDecl :: Module -> (LImportDecl GhcPs, SDoc) - -> RnM (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, AnyHpcUsage) + -> RnM (LImportDecl GhcRn, ImportUserSpec , GlobalRdrEnv, ImportAvails, AnyHpcUsage) rnImportDecl this_mod - (L loc decl@(ImportDecl { ideclName = loc_imp_mod_name - , ideclPkgQual = raw_pkg_qual - , ideclSource = want_boot, ideclSafe = mod_safe - , ideclQualified = qual_style - , ideclExt = XImportDeclPass { ideclImplicit = implicit } - , ideclAs = as_mod, ideclImportList = imp_details }), import_reason) + ( ldecl@(L loc decl@(ImportDecl { ideclSafe = mod_safe + , ideclExt = XImportDeclPass { ideclImplicit = implicit }})) + , import_reason) = setSrcSpanA loc $ do - case raw_pkg_qual of - NoRawPkgQual -> pure () - RawPkgQual _ -> do + (imp_spec,imp_details) <- importSpec ldecl + + let pkg_qual = is_pkg_qual imp_spec + want_boot = is_isboot imp_spec + case pkg_qual of + NoPkgQual -> pure () + _ -> do pkg_imports <- xoptM LangExt.PackageImports when (not pkg_imports) $ addErr TcRnPackageImportsDisabled - let qual_only = isImportDeclQualified qual_style + let qual_only = is_qual imp_spec -- If there's an error in loadInterface, (e.g. interface -- file not found) we get lots of spurious errors from 'filterImports' - let imp_mod_name = unLoc loc_imp_mod_name + let imp_mod_name = moduleName $ is_mod imp_spec doc = ppr imp_mod_name <+> import_reason hsc_env <- getTopEnv - unit_env <- hsc_unit_env <$> getTopEnv - let pkg_qual = renameRawPkgQual unit_env imp_mod_name raw_pkg_qual -- Check for self-import, which confuses the typechecker (#9032) -- ghc --make rejects self-import cycles already, but batch-mode may not @@ -390,21 +414,14 @@ rnImportDecl this_mod when (mod_safe && not (safeImportsOn dflags)) $ addErr (TcRnSafeImportsDisabled imp_mod_name) - let imp_mod = mi_module iface - qual_mod_name = fmap unLoc as_mod `orElse` imp_mod_name - imp_spec = ImpDeclSpec { is_mod = imp_mod, is_qual = qual_only, - is_dloc = locA loc, is_as = qual_mod_name } - -- filter the imports according to the import declaration - (new_imp_details, gres) <- filterImports hsc_env iface imp_spec imp_details + (new_imp_details, imp_user_list, gbl_env) <- filterImports hsc_env iface imp_spec imp_details -- for certain error messages, we’d like to know what could be imported -- here, if everything were imported - potential_gres <- mkGlobalRdrEnv . snd <$> filterImports hsc_env iface imp_spec Nothing + potential_gres <- (\(_,_,x) -> x) <$> filterImports hsc_env iface imp_spec Nothing - let gbl_env = mkGlobalRdrEnv gres - - is_hiding | Just (EverythingBut,_) <- imp_details = True + let is_hiding | Just (EverythingBut,_) <- imp_details = True | otherwise = False -- should the import be safe? @@ -416,7 +433,7 @@ rnImportDecl this_mod let home_unit = hsc_home_unit hsc_env other_home_units = hsc_all_home_unit_ids hsc_env imv = ImportedModsVal - { imv_name = qual_mod_name + { imv_name = is_as imp_spec , imv_span = locA loc , imv_is_safe = mod_safe' , imv_is_hiding = is_hiding @@ -444,7 +461,7 @@ rnImportDecl this_mod , ideclImportList = new_imp_details } - return (L loc new_imp_decl, gbl_env, imports, mi_hpc iface) + return (L loc new_imp_decl, ImpUserSpec imp_spec imp_user_list, gbl_env, imports, mi_hpc iface) -- | Rename raw package imports @@ -1188,6 +1205,14 @@ gresFromAvail hsc_env prov avail = gresFromAvails :: HscEnv -> Maybe ImportSpec -> [AvailInfo] -> [GlobalRdrElt] gresFromAvails hsc_env prov = concatMap (gresFromAvail hsc_env prov) +importsFromIface :: HscEnv -> ModIface -> ImpDeclSpec -> Maybe NameSet -> GlobalRdrEnv +importsFromIface hsc_env iface decl_spec hidden = mkGlobalRdrEnv $ case hidden of + Nothing -> all_gres + Just hidden_names -> filter (not . (`elemNameSet` hidden_names) . greName) all_gres + where + all_gres = gresFromAvails hsc_env (Just imp_spec) (mi_exports iface) + imp_spec = ImpSpec { is_decl = decl_spec, is_item = ImpAll } + filterImports :: HasDebugCallStack => HscEnv @@ -1197,13 +1222,10 @@ filterImports -> Maybe (ImportListInterpretation, LocatedL [LIE GhcPs]) -- ^ Whether this is a "hiding" import list -> RnM (Maybe (ImportListInterpretation, LocatedL [LIE GhcRn]), -- Import spec w/ Names - [GlobalRdrElt]) -- Same again, but in GRE form + ImpUserList, -- same, but designed for storage in interfaces + GlobalRdrEnv) -- Same again, but in GRE form filterImports hsc_env iface decl_spec Nothing - = return (Nothing, gresFromAvails hsc_env (Just imp_spec) all_avails) - where - all_avails = mi_exports iface - imp_spec = ImpSpec { is_decl = decl_spec, is_item = ImpAll } - + = return (Nothing, ImpUserAll, importsFromIface hsc_env iface decl_spec Nothing) filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items)) = do -- check for errors, convert RdrNames to Names items1 <- mapM lookup_lie import_items @@ -1213,20 +1235,18 @@ filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items)) -- NB we may have duplicates, and several items -- for the same parent; e.g N(x) and N(y) - gres = case want_hiding of + (gres, imp_user_list) = case want_hiding of Exactly -> - concatMap (gresFromIE decl_spec) items2 + let gre_env = mkGlobalRdrEnv $ concatMap (gresFromIE decl_spec) items2 + in (gre_env, ImpUserExplicit gre_env) EverythingBut -> let hidden_names = mkNameSet $ concatMap (map greName . snd) items2 - keep n = not (n `elemNameSet` hidden_names) - all_gres = gresFromAvails hsc_env (Just hiding_spec) all_avails - in filter (keep . greName) all_gres + in (importsFromIface hsc_env iface decl_spec (Just hidden_names), ImpUserEverythingBut hidden_names) - return (Just (want_hiding, L l (map fst items2)), gres) + return (Just (want_hiding, L l (map fst items2)), imp_user_list, gres) where import_mod = mi_module iface all_avails = mi_exports iface - hiding_spec = ImpSpec { is_decl = decl_spec, is_item = ImpAll } imp_occ_env = mkImportOccEnv hsc_env decl_spec all_avails -- Look up a parent (type constructor, class or data constructor) ===================================== compiler/GHC/Runtime/Eval.hs ===================================== @@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} @@ -24,6 +25,7 @@ module GHC.Runtime.Eval ( setupBreakpoint, back, forward, setContext, getContext, + mkTopLevEnv, getNamesInScope, getRdrNamesInScope, moduleIsInterpreted, @@ -53,6 +55,8 @@ import GHC.Driver.DynFlags import GHC.Driver.Ppr import GHC.Driver.Config +import GHC.Rename.Names (gresFromAvails, importsFromIface) + import GHC.Runtime.Eval.Types import GHC.Runtime.Interpreter as GHCi import GHC.Runtime.Heap.Inspect @@ -75,6 +79,7 @@ import GHC.Core.Type hiding( typeKind ) import qualified GHC.Core.Type as Type import GHC.Iface.Env ( newInteractiveBinder ) +import GHC.Iface.Load ( loadSrcInterface ) import GHC.Tc.Utils.TcType import GHC.Tc.Types.Constraint import GHC.Tc.Types.Origin @@ -117,7 +122,7 @@ import GHC.Unit.Home.ModInfo import GHC.Tc.Module ( runTcInteractive, tcRnType, loadUnqualIfaces ) import GHC.Tc.Solver (simplifyWantedsTcM) -import GHC.Tc.Utils.Env (tcGetInstEnvs, lookupGlobal) +import GHC.Tc.Utils.Env (tcGetInstEnvs) import GHC.Tc.Utils.Instantiate (instDFunType) import GHC.Tc.Utils.Monad import GHC.Tc.Zonk.Env ( ZonkFlexi (SkolemiseFlexi) ) @@ -806,14 +811,9 @@ findGlobalRdrEnv :: HscEnv -> [InteractiveImport] findGlobalRdrEnv hsc_env imports = do { idecls_env <- hscRnImportDecls hsc_env idecls -- This call also loads any orphan modules - ; return $ case partitionWith mkEnv imods of - (err : _, _) -> Left err - ([], imods_env0) -> - -- Need to rehydrate the 'GlobalRdrEnv' to recover the 'GREInfo's. - -- This is done in order to avoid space leaks. - -- See Note [Forcing GREInfo] in GHC.Types.GREInfo. - let imods_env = map (hydrateGlobalRdrEnv get_GRE_info) imods_env0 - in Right (foldr plusGlobalRdrEnv idecls_env imods_env) + ; partitionWithM mkEnv imods >>= \case + (err : _, _) -> return $ Left err + ([], imods_env) -> return $ Right (foldr plusGlobalRdrEnv idecls_env imods_env) } where idecls :: [LImportDecl GhcPs] @@ -822,23 +822,33 @@ findGlobalRdrEnv hsc_env imports imods :: [ModuleName] imods = [m | IIModule m <- imports] - mkEnv mod = case mkTopLevEnv (hsc_HPT hsc_env) mod of - Left err -> Left (mod, err) - Right env -> Right env - - get_GRE_info nm = tyThingGREInfo <$> lookupGlobal hsc_env nm + mkEnv mod = mkTopLevEnv hsc_env mod >>= \case + Left err -> pure $ Left (mod, err) + Right env -> pure $ Right env -mkTopLevEnv :: HomePackageTable -> ModuleName -> Either String IfGlobalRdrEnv -mkTopLevEnv hpt modl +mkTopLevEnv :: HscEnv -> ModuleName -> IO (Either String GlobalRdrEnv) +mkTopLevEnv hsc_env modl = case lookupHpt hpt modl of - Nothing -> Left "not a home module" + Nothing -> pure $ Left "not a home module" Just details -> - case mi_globals (hm_iface details) of - Nothing -> Left "not interpreted" - Just env -> Right env - -- It's OK to be lazy here; we force the GlobalRdrEnv before storing it - -- in ModInfo; see GHCi.UI.Info. - -- See Note [Forcing GREInfo] in GHC.Types.GREInfo. + case mi_top_env (hm_iface details) of + Nothing -> pure $ Left "not interpreted" + Just (IfaceTopEnv exports imports) -> do + imports_env <- + runInteractiveHsc hsc_env + $ ioMsgMaybe $ hoistTcRnMessage $ runTcInteractive hsc_env + $ fmap (foldr plusGlobalRdrEnv emptyGlobalRdrEnv) + $ forM imports $ \iface_import -> do + let ImpUserSpec spec details = tcIfaceImport hsc_env iface_import + iface <- loadSrcInterface (text "imported by GHCi") (moduleName $ is_mod spec) (is_isboot spec) (is_pkg_qual spec) + pure $ case details of + ImpUserAll -> importsFromIface hsc_env iface spec Nothing + ImpUserEverythingBut ns -> importsFromIface hsc_env iface spec (Just ns) + ImpUserExplicit x -> x + let exports_env = mkGlobalRdrEnv $ gresFromAvails hsc_env Nothing exports + pure $ Right $ plusGlobalRdrEnv imports_env exports_env + where + hpt = hsc_HPT hsc_env -- | Get the interactive evaluation context, consisting of a pair of the -- set of modules from which we take the full top-level scope, and the set @@ -854,7 +864,7 @@ moduleIsInterpreted modl = withSession $ \h -> if notHomeModule (hsc_home_unit h) modl then return False else case lookupHpt (hsc_HPT h) (moduleName modl) of - Just details -> return (isJust (mi_globals (hm_iface details))) + Just details -> return (isJust (mi_top_env (hm_iface details))) _not_a_home_module -> return False -- | Looks up an identifier in the current interactive context (for :info) ===================================== compiler/GHC/Runtime/Loader.hs ===================================== @@ -49,6 +49,7 @@ import GHC.Core.TyCon ( TyCon(tyConName) ) import GHC.Types.SrcLoc ( noSrcSpan ) import GHC.Types.Name ( Name, nameModule, nameModule_maybe ) import GHC.Types.Id ( idType ) +import GHC.Types.PkgQual import GHC.Types.TyThing import GHC.Types.Name.Occurrence ( OccName, mkVarOccFS ) import GHC.Types.Name.Reader @@ -57,7 +58,7 @@ import GHC.Types.Unique.DFM import GHC.Unit.Finder ( findPluginModule, FindResult(..) ) import GHC.Driver.Config.Finder ( initFinderOpts ) import GHC.Driver.Config.Diagnostic ( initIfaceMessageOpts ) -import GHC.Unit.Module ( Module, ModuleName, thisGhcUnit, GenModule(moduleUnit) ) +import GHC.Unit.Module ( Module, ModuleName, thisGhcUnit, GenModule(moduleUnit), IsBootInterface(NotBoot) ) import GHC.Unit.Module.ModIface import GHC.Unit.Env @@ -357,8 +358,8 @@ lookupRdrNameInModuleForPlugins hsc_env mod_name rdr_name = do case mb_iface of Just iface -> do -- Try and find the required name in the exports - let decl_spec = ImpDeclSpec { is_mod = mod, is_as = mod_name - , is_qual = False, is_dloc = noSrcSpan } + let decl_spec = ImpDeclSpec { is_mod = mod, is_as = mod_name, is_pkg_qual = NoPkgQual + , is_qual = False, is_dloc = noSrcSpan, is_isboot = NotBoot } imp_spec = ImpSpec decl_spec ImpAll env = mkGlobalRdrEnv $ gresFromAvails hsc_env (Just imp_spec) (mi_exports iface) ===================================== compiler/GHC/Tc/Gen/Export.hs ===================================== @@ -4,7 +4,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TupleSections #-} -module GHC.Tc.Gen.Export (rnExports, exports_from_avail, classifyGREs) where +module GHC.Tc.Gen.Export (rnExports, exports_from_avail, classifyGREs, all_rdr_exports) where import GHC.Prelude @@ -243,6 +243,21 @@ type ExportWarnSpanNames = [(Name, WarningTxt GhcRn, SrcSpan)] -- the spans of export list items that are missing those warnings type DontWarnExportNames = NameEnv (NE.NonEmpty SrcSpan) +all_rdr_exports :: GlobalRdrEnv -> Avails +all_rdr_exports rdr_env = map fix_faminst . gresToAvailInfo . filter isLocalGRE . globalRdrEnvElts $ rdr_env + where + -- #11164: when we define a data instance + -- but not data family, re-export the family + -- Even though we don't check whether this is actually a data family + -- only data families can locally define subordinate things (`ns` here) + -- without locally defining (and instead importing) the parent (`n`) + fix_faminst avail@(AvailTC n ns) + | availExportsDecl avail + = avail + | otherwise + = AvailTC n (n:ns) + fix_faminst avail = avail + exports_from_avail :: Maybe (LocatedL [LIE GhcPs]) -- ^ 'Nothing' means no explicit export list -> GlobalRdrEnv @@ -264,23 +279,8 @@ exports_from_avail Nothing rdr_env _imports _this_mod = do { ; addDiagnostic (TcRnMissingExportList $ moduleName _this_mod) - ; let avails = - map fix_faminst . gresToAvailInfo - . filter isLocalGRE . globalRdrEnvElts $ rdr_env + ; let avails = all_rdr_exports rdr_env ; return (Nothing, avails, []) } - where - -- #11164: when we define a data instance - -- but not data family, re-export the family - -- Even though we don't check whether this is actually a data family - -- only data families can locally define subordinate things (`ns` here) - -- without locally defining (and instead importing) the parent (`n`) - fix_faminst avail@(AvailTC n ns) - | availExportsDecl avail - = avail - | otherwise - = AvailTC n (n:ns) - fix_faminst avail = avail - exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod = do (ie_avails, export_warn_spans, dont_warn_export) ===================================== compiler/GHC/Tc/Module.hs ===================================== @@ -373,7 +373,7 @@ tcRnModuleTcRnM hsc_env mod_sum tcRnImports :: HscEnv -> [(LImportDecl GhcPs, SDoc)] -> TcM TcGblEnv tcRnImports hsc_env import_decls - = do { (rn_imports, rdr_env, imports, hpc_info) <- rnImports import_decls ; + = do { (rn_imports, imp_user_spec, rdr_env, imports, hpc_info) <- rnImports import_decls ; ; this_mod <- getModule ; gbl_env <- getGblEnv @@ -402,6 +402,7 @@ tcRnImports hsc_env import_decls gbl { tcg_rdr_env = tcg_rdr_env gbl `plusGlobalRdrEnv` rdr_env, tcg_imports = tcg_imports gbl `plusImportAvails` imports, + tcg_import_decls = imp_user_spec, tcg_rn_imports = rn_imports, tcg_inst_env = tcg_inst_env gbl `unionInstEnv` home_insts, tcg_fam_inst_env = extendFamInstEnvList (tcg_fam_inst_env gbl) ===================================== compiler/GHC/Tc/Types.hs ===================================== @@ -43,6 +43,8 @@ module GHC.Tc.Types( -- Renamer types ErrCtxt, ImportAvails(..), emptyImportAvails, plusImportAvails, + ImportUserSpec(..), + ImpUserList(..), mkModDeps, -- Typechecker types @@ -179,6 +181,30 @@ import Data.Map ( Map ) import Data.Typeable ( TypeRep ) import Data.Maybe ( mapMaybe ) +-- | The import specification as written by the user, including +-- the list of explicitly imported names. Used in 'ModIface' to +-- allow GHCi to reconstruct the top level environment on demand. +-- +-- This is distinct from 'ImportSpec' because we don't want to store +-- the list of explicitly imported names along with each 'GRE' +-- +-- We don't want to store the entire GlobalRdrEnv for modules that +-- are imported without explicit export lists, as these may grow +-- to be very large. However, GlobalRdrEnvs which are the result +-- of explicit import lists are typically quite small. +-- +-- Why do we not store something like (Maybe (ImportListInterpretation, [IE GhcPs]) in such a case? +-- Because we don't want to store source syntax including annotations in +-- interface files. +data ImportUserSpec + = ImpUserSpec { ius_decl :: !ImpDeclSpec + , ius_imports :: !ImpUserList + } + +data ImpUserList + = ImpUserAll -- ^ no user import list + | ImpUserExplicit !GlobalRdrEnv + | ImpUserEverythingBut !NameSet -- | A 'NameShape' is a substitution on 'Name's that can be used -- to refine the identities of a hole while we are renaming interfaces @@ -507,6 +533,7 @@ data TcGblEnv -- These three fields track unused bindings and imports -- See Note [Tracking unused binding and imports] + tcg_import_decls :: ![ImportUserSpec], tcg_dus :: DefUses, tcg_used_gres :: TcRef [GlobalRdrElt], -- ^ INVARIANT: all these GREs were imported; that is, ===================================== compiler/GHC/Tc/Utils/Backpack.hs ===================================== @@ -635,10 +635,12 @@ mergeSignatures -- because we need module -- LocalSig (from the local -- export list) to match it! - is_mod = mi_module ireq_iface, - is_as = mod_name, - is_qual = False, - is_dloc = locA loc + is_mod = mi_module ireq_iface, + is_as = mod_name, + is_pkg_qual = NoPkgQual, + is_qual = False, + is_isboot = NotBoot, + is_dloc = locA loc } ImpAll rdr_env = mkGlobalRdrEnv $ gresFromAvails hsc_env (Just ispec) as1 setGblEnv tcg_env { ===================================== compiler/GHC/Tc/Utils/Monad.hs ===================================== @@ -318,6 +318,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this tcg_th_needed_deps = th_needed_deps_var, tcg_exports = [], tcg_imports = emptyImportAvails, + tcg_import_decls = [], tcg_used_gres = used_gre_var, tcg_dus = emptyDUs, ===================================== compiler/GHC/Types/Name/Reader.hs ===================================== @@ -121,6 +121,7 @@ import GHC.Types.Name import GHC.Types.Name.Env ( NameEnv, nonDetNameEnvElts, emptyNameEnv, extendNameEnv_Acc ) import GHC.Types.Name.Set +import GHC.Types.PkgQual import GHC.Types.SrcLoc as SrcLoc import GHC.Types.Unique import GHC.Types.Unique.FM @@ -1780,7 +1781,9 @@ shadowNames drop_only_qualified env new_gres = minusOccEnv_C_Ns do_shadowing env old_mod_name = moduleName old_mod id_spec = ImpDeclSpec { is_mod = old_mod , is_as = old_mod_name + , is_pkg_qual = NoPkgQual , is_qual = True + , is_isboot = NotBoot , is_dloc = greDefinitionSrcSpan old_gre } set_qual :: ImportSpec -> ImportSpec @@ -1939,10 +1942,15 @@ data ImpDeclSpec -- TODO: either should be Module, or there -- should be a Maybe UnitId here too. is_as :: !ModuleName, -- ^ Import alias, e.g. from @as M@ (or @Muggle@ if there is no @as@ clause) + is_pkg_qual :: !PkgQual, -- ^ Was this a package import? is_qual :: !Bool, -- ^ Was this import qualified? - is_dloc :: !SrcSpan -- ^ The location of the entire import declaration + is_dloc :: !SrcSpan, -- ^ The location of the entire import declaration + is_isboot :: !IsBootInterface -- ^ Was this a SOURCE import? } deriving (Eq, Data) +instance NFData ImpDeclSpec where + rnf = rwhnf -- Already strict in all fields + -- | Import Item Specification -- -- Describes import info a particular Name ===================================== compiler/GHC/Types/PkgQual.hs ===================================== @@ -22,8 +22,8 @@ data RawPkgQual -- package qualifier. data PkgQual = NoPkgQual -- ^ No package qualifier - | ThisPkg UnitId -- ^ Import from home-unit - | OtherPkg UnitId -- ^ Import from another unit + | ThisPkg !UnitId -- ^ Import from home-unit + | OtherPkg !UnitId -- ^ Import from another unit deriving (Data, Ord, Eq) instance Outputable RawPkgQual where ===================================== compiler/GHC/Types/Unique/Set.hs ===================================== @@ -55,6 +55,7 @@ import Data.Coerce import GHC.Utils.Outputable import Data.Data import qualified Data.Semigroup as Semi +import Control.DeepSeq -- Note [UniqSet invariant] -- ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -66,6 +67,9 @@ import qualified Data.Semigroup as Semi newtype UniqSet a = UniqSet {getUniqSet' :: UniqFM a a} deriving (Data, Semi.Semigroup, Monoid) +instance NFData a => NFData (UniqSet a) where + rnf = forceUniqSet rnf + emptyUniqSet :: UniqSet a emptyUniqSet = UniqSet emptyUFM @@ -200,3 +204,7 @@ pprUniqSet :: (a -> SDoc) -> UniqSet a -> SDoc -- It's OK to use nonDetUFMToList here because we only use it for -- pretty-printing. pprUniqSet f = braces . pprWithCommas f . nonDetEltsUniqSet + + +forceUniqSet :: (a -> ()) -> UniqSet a -> () +forceUniqSet f (UniqSet fm) = seqEltsUFM f fm ===================================== compiler/GHC/Unit/Module/ModIface.hs ===================================== @@ -15,6 +15,8 @@ module GHC.Unit.Module.ModIface , IfaceExport , WhetherHasOrphans , WhetherHasFamInst + , IfaceTopEnv (..) + , IfaceImport(..) , mi_boot , mi_fix , mi_semantic_module @@ -45,7 +47,6 @@ import GHC.Types.Fixity import GHC.Types.Fixity.Env import GHC.Types.HpcInfo import GHC.Types.Name -import GHC.Types.Name.Reader import GHC.Types.SafeHaskell import GHC.Types.SourceFile import GHC.Types.Unique.DSet @@ -208,8 +209,8 @@ data ModIface_ (phase :: ModIfacePhase) -- combined with mi_decls allows us to restart code generation. -- See Note [Interface Files with Core Definitions] and Note [Interface File with Core: Sharing RHSs] - mi_globals :: !(Maybe IfGlobalRdrEnv), - -- ^ Binds all the things defined at the top level in + mi_top_env :: !(Maybe IfaceTopEnv), + -- ^ Just enough information to reconstruct the top level environment in -- the /original source/ code for this module. which -- is NOT the same as mi_exports, nor mi_decls (which -- may contains declarations for things not actually @@ -266,6 +267,16 @@ data ModIface_ (phase :: ModIfacePhase) -- ^ Hash of the .hs source, used for recompilation checking. } +-- Enough information to reconstruct the top level environment for a module +data IfaceTopEnv + = IfaceTopEnv + { ifaceTopExports :: ![IfaceExport] -- ^ all top level things in this module, including unexported stuff + , ifaceImports :: ![IfaceImport] -- ^ all the imports in this module + } + +instance NFData IfaceTopEnv where + rnf (IfaceTopEnv a b) = rnf a `seq` rnf b + {- Note [Strictness in ModIface] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -458,7 +469,7 @@ instance Binary ModIface where mi_warns = warns, mi_decls = decls, mi_extra_decls = extra_decls, - mi_globals = Nothing, + mi_top_env = Nothing, mi_insts = insts, mi_fam_insts = fam_insts, mi_rules = rules, @@ -508,7 +519,7 @@ emptyPartialModIface mod mi_rules = [], mi_decls = [], mi_extra_decls = Nothing, - mi_globals = Nothing, + mi_top_env = Nothing, mi_hpc = False, mi_trust = noIfaceTrustInfo, mi_trust_pkg = False, @@ -559,7 +570,7 @@ instance ( NFData (IfaceBackendExts (phase :: ModIfacePhase)) ) => NFData (ModIface_ phase) where rnf (ModIface{ mi_module, mi_sig_of, mi_hsc_src, mi_deps, mi_usages , mi_exports, mi_used_th, mi_fixities, mi_warns, mi_anns - , mi_decls, mi_extra_decls, mi_globals, mi_insts + , mi_decls, mi_extra_decls, mi_top_env, mi_insts , mi_fam_insts, mi_rules, mi_hpc, mi_trust, mi_trust_pkg , mi_complete_matches, mi_docs, mi_final_exts , mi_ext_fields, mi_src_hash }) @@ -575,7 +586,7 @@ instance ( NFData (IfaceBackendExts (phase :: ModIfacePhase)) `seq` rnf mi_anns `seq` rnf mi_decls `seq` rnf mi_extra_decls - `seq` rnf mi_globals + `seq` rnf mi_top_env `seq` rnf mi_insts `seq` rnf mi_fam_insts `seq` rnf mi_rules ===================================== compiler/Language/Haskell/Syntax/ImpExp.hs ===================================== @@ -14,6 +14,8 @@ import Data.Maybe (Maybe) import Data.String (String) import Data.Int (Int) +import Control.DeepSeq + import GHC.Hs.Doc -- ROMES:TODO Discuss in #21592 whether this is parsed AST or base AST {- @@ -48,6 +50,9 @@ data ImportDeclQualifiedStyle data IsBootInterface = NotBoot | IsBoot deriving (Eq, Ord, Show, Data) +instance NFData IsBootInterface where + rnf = rwhnf + -- | Import Declaration -- -- A single Haskell @import@ declaration. @@ -86,6 +91,9 @@ data ImportDecl pass data ImportListInterpretation = Exactly | EverythingBut deriving (Eq, Data) +instance NFData ImportListInterpretation where + rnf = rwhnf + -- | Located Import or Export type LIE pass = XRec pass (IE pass) -- ^ When in a list this may have ===================================== ghc/GHCi/UI.hs ===================================== @@ -36,6 +36,7 @@ import GHCi.UI.Monad hiding ( args, runStmt ) import GHCi.UI.Info import GHCi.UI.Exception import GHC.Runtime.Debugger +import GHC.Runtime.Eval (mkTopLevEnv) -- The GHC interface import GHC.Runtime.Interpreter @@ -75,7 +76,7 @@ import GHC.Types.Var ( varType ) import GHC.Iface.Syntax ( showToHeader ) import GHC.Builtin.Names import GHC.Builtin.Types( stringTyCon_RDR ) -import GHC.Types.Name.Reader as RdrName ( getGRE_NameQualifier_maybes, getRdrName ) +import GHC.Types.Name.Reader as RdrName ( getGRE_NameQualifier_maybes, getRdrName, greName, globalRdrEnvElts) import GHC.Types.SrcLoc as SrcLoc import qualified GHC.Parser.Lexer as Lexer import GHC.Parser.Header ( toArgs ) @@ -98,7 +99,7 @@ import GHC.Data.Graph.Directed import GHC.Utils.Encoding import GHC.Data.FastString import qualified GHC.Linker.Loader as Loader -import GHC.Data.Maybe ( orElse, expectJust ) +import GHC.Data.Maybe ( expectJust ) import GHC.Types.Name.Set import GHC.Utils.Panic hiding ( showException, try ) import GHC.Utils.Misc @@ -206,7 +207,6 @@ ghciCommands = map mkCmd [ ("browse", keepGoing' (browseCmd False), completeModule), ("browse!", keepGoing' (browseCmd True), completeModule), ("cd", keepGoingMulti' changeDirectory, completeFilename), - ("check", keepGoing' checkModule, completeHomeModule), ("continue", keepGoing continueCmd, noCompletion), ("cmd", keepGoing cmdCmd, completeExpression), ("def", keepGoing (defineMacro False), completeExpression), @@ -1892,28 +1892,6 @@ getGhciStepIO = do nlHsFunTy ghciM ioM return $ noLocA $ ExprWithTySig noAnn body tySig ------------------------------------------------------------------------------ --- :check - -checkModule :: GhciMonad m => String -> m () -checkModule m = do - let modl = GHC.mkModuleName m - ok <- handleSourceError (\e -> printErrAndMaybeExit e >> return False) $ do - r <- GHC.typecheckModule =<< GHC.parseModule =<< GHC.getModSummary modl - dflags <- getDynFlags - liftIO $ putStrLn $ showSDoc dflags $ - case GHC.moduleInfo r of - cm | Just scope <- GHC.modInfoTopLevelScope cm -> - let - (loc, glob) = assert (all isExternalName scope) $ - partition ((== modl) . GHC.moduleName . GHC.nameModule) scope - in - (text "global names: " <+> ppr glob) $$ - (text "local names: " <+> ppr loc) - _ -> empty - return True - afterLoad (successIf ok) False - ----------------------------------------------------------------------------- -- :doc @@ -2355,9 +2333,7 @@ typeAtCmd str = runExceptGhciMonad $ do (span',sample) <- exceptT $ parseSpanArg str infos <- lift $ mod_infos <$> getGHCiState (info, ty) <- findType infos span' sample - let mb_rdr_env = case modinfoRdrEnv info of - Strict.Just rdrs -> Just rdrs - Strict.Nothing -> Nothing + let mb_rdr_env = Just (modinfoRdrEnv info) lift $ printForUserGlobalRdrEnv mb_rdr_env (sep [text sample,nest 2 (dcolon <+> ppr ty)]) @@ -2643,10 +2619,16 @@ browseModule bang modl exports_only = do Nothing -> throwGhcException (CmdLineError ("unknown module: " ++ GHC.moduleNameString (GHC.moduleName modl))) Just mod_info -> do - let names - | exports_only = GHC.modInfoExports mod_info - | otherwise = GHC.modInfoTopLevelScope mod_info - `orElse` [] + names <- + if exports_only + then pure $ GHC.modInfoExports mod_info + else do + hsc_env <- GHC.getSession + mmod_env <- liftIO $ mkTopLevEnv hsc_env (moduleName modl) + case mmod_env of + Left err -> throwGhcException (CmdLineError (GHC.moduleNameString (GHC.moduleName modl) ++ " " ++ err)) + Right mod_env -> pure $ map greName . globalRdrEnvElts $ mod_env + let -- sort alphabetically name, but putting locally-defined -- identifiers first. We would like to improve this; see #1799. @@ -3558,7 +3540,7 @@ completeCmd argLine0 = case parseLine argLine0 of completeGhciCommand, completeMacro, completeIdentifier, completeModule, completeSetModule, completeSeti, completeShowiOptions, - completeHomeModule, completeSetOptions, completeShowOptions, + completeSetOptions, completeShowOptions, completeHomeModuleOrFile, completeExpression, completeBreakpoint :: GhciMonad m => CompletionFunc m @@ -3707,8 +3689,6 @@ completeSetModule = wrapIdentCompleterWithModifier "+-" $ \m w -> do return $ loaded_mods ++ pkg_mods return $ filter (w `isPrefixOf`) $ map (showPpr (hsc_dflags hsc_env)) modules -completeHomeModule = wrapIdentCompleterMod listHomeModules - listHomeModules :: GHC.GhcMonad m => String -> m [String] listHomeModules w = do g <- GHC.getModuleGraph ===================================== ghc/GHCi/UI/Info.hs ===================================== @@ -42,6 +42,7 @@ import GHC.Driver.Monad import GHC.Driver.Env import GHC.Driver.Ppr import GHC.Types.Name +import GHC.Tc.Types import GHC.Types.Name.Reader import GHC.Types.Name.Set import GHC.Utils.Outputable @@ -59,7 +60,7 @@ data ModInfo = ModInfo -- ^ Generated set of information about all spans in the -- module that correspond to some kind of identifier for -- which there will be type info and/or location info. - , modinfoRdrEnv :: !(Strict.Maybe IfGlobalRdrEnv) + , modinfoRdrEnv :: !IfGlobalRdrEnv -- ^ What's in scope in the module. , modinfoLastUpdate :: !UTCTime -- ^ The timestamp of the file used to generate this record. @@ -313,27 +314,19 @@ getModInfo name = do p <- parseModule m typechecked <- typecheckModule p let allTypes = processAllTypeCheckedModule typechecked - module_info = tm_checked_module_info typechecked - !rdr_env = case modInfoRdrEnv module_info of - Just rdrs -> Strict.Just rdrs - -- NB: this has already been deeply forced; no need to do that again. - -- See test case T15369 and Note [Forcing GREInfo] in GHC.Types.GREInfo. - Nothing -> Strict.Nothing + let !rdr_env = tcg_rdr_env (fst $ tm_internals_ typechecked) ts <- liftIO $ getModificationTime $ srcFilePath m return $ ModInfo { modinfoSummary = m , modinfoSpans = allTypes - , modinfoRdrEnv = rdr_env + , modinfoRdrEnv = forceGlobalRdrEnv rdr_env , modinfoLastUpdate = ts } -- | Get the 'Name's from the 'GlobalRdrEnv' of the 'ModInfo', if any. modInfo_rdrs :: ModInfo -> [Name] -modInfo_rdrs mi = - case modinfoRdrEnv mi of - Strict.Nothing -> [] - Strict.Just env -> map greName $ globalRdrEnvElts env +modInfo_rdrs mi = map greName $ globalRdrEnvElts $ modinfoRdrEnv mi -- | Get ALL source spans in the module. processAllTypeCheckedModule :: TypecheckedModule -> [SpanInfo] ===================================== ghc/GHCi/UI/Monad.hs ===================================== @@ -25,7 +25,7 @@ module GHCi.UI.Monad ( ActionStats(..), runAndPrintStats, runWithStats, printStats, printForUserNeverQualify, - printForUserModInfo, printForUserGlobalRdrEnv, + printForUserGlobalRdrEnv, printForUser, printForUserPartWay, prettyLocations, compileGHCiExpr, @@ -365,9 +365,6 @@ printForUserNeverQualify doc = do dflags <- GHC.getInteractiveDynFlags liftIO $ Ppr.printForUser dflags stdout neverQualify AllTheWay doc -printForUserModInfo :: GhcMonad m => GHC.ModuleInfo -> SDoc -> m () -printForUserModInfo info = printForUserGlobalRdrEnv (GHC.modInfoRdrEnv info) - printForUserGlobalRdrEnv :: (GhcMonad m, Outputable info) => Maybe (GlobalRdrEnvX info) -> SDoc -> m () printForUserGlobalRdrEnv mb_rdr_env doc = do ===================================== utils/dump-decls/Main.hs ===================================== @@ -177,7 +177,7 @@ reportModuleDecls unit_id modl_nm Nothing -> fail "Failed to find module" Just mod_info -> return mod_info - Just name_ppr_ctx <- mkNamePprCtxForModule mod_info + name_ppr_ctx <- mkNamePprCtxForModule modl mod_info let names = GHC.modInfoExports mod_info sorted_names = sortBy (compare `on` nameOccName) names View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/918daaef1ff86268b35a801294b71d44bb509f6f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/918daaef1ff86268b35a801294b71d44bb509f6f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 10:03:29 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Wed, 06 Mar 2024 05:03:29 -0500 Subject: [Git][ghc/ghc][wip/no-mi-globals] 106 commits: EPA: Move EpAnn out of extension points Message-ID: <65e83f71e7e8a_33764d58abe47206e@gitlab.mail> Zubin pushed to branch wip/no-mi-globals at Glasgow Haskell Compiler / GHC Commits: 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 921cacbb by Zubin Duggal at 2024-03-06T15:33:16+05:30 Don't store a GlobalRdrEnv in `mi_globals` for GHCi. GHCi only needs the `mi_globals` field for modules imported with :module +*SomeModule. It uses this field to make the top level environment in `SomeModule` available to the repl. By default, only the first target in the command line parameters is "star" loaded into GHCi. Other modules have to be manually "star" loaded into the repl. Storing the top level GlobalRdrEnv for each module is very wasteful, especially given that we will most likely never need most of these environments. Instead we store only the information needed to reconstruct the top level environment in a module, which is the `IfaceTopEnv` data structure, consisting of all import statements as well as all top level symbols defined in the module (not taking export lists into account) When a particular module is "star-loaded" into GHCi (as the first commandline target, or via an explicit `:module +*SomeModule`, we reconstruct the top level environment on demand using the `IfaceTopEnv`. - - - - - 22 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/918daaef1ff86268b35a801294b71d44bb509f6f...921cacbb3111f4ef2b4c571837cef1d04fc6d30f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/918daaef1ff86268b35a801294b71d44bb509f6f...921cacbb3111f4ef2b4c571837cef1d04fc6d30f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 11:12:41 2024 From: gitlab at gitlab.haskell.org (Sylvain Henry (@hsyl20)) Date: Wed, 06 Mar 2024 06:12:41 -0500 Subject: [Git][ghc/ghc][wip/exception-context] Disable T9930fail for the JS target (cf #19174) Message-ID: <65e84fa9ea4bf_38980e2f594029ed@gitlab.mail> Sylvain Henry pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC Commits: 8d4786dd by Sylvain Henry at 2024-03-06T12:12:16+01:00 Disable T9930fail for the JS target (cf #19174) - - - - - 1 changed file: - testsuite/tests/ghc-e/should_fail/all.T Changes: ===================================== testsuite/tests/ghc-e/should_fail/all.T ===================================== @@ -12,7 +12,12 @@ test('ghc-e-fail2', req_interp, makefile_test, ['ghc-e-fail2']) # Don't run on Windows, as executable is written to T9930.exe # and no failure is induced. -test('T9930fail', [extra_files(['T9930']), when(opsys('mingw32'), skip)], +test('T9930fail', + [extra_files(['T9930']), + when(opsys('mingw32'), skip), + # broken for JS until cross-compilers become stage2 compilers (#19174) + # or until we bootstrap with a 9.10 compiler + js_broken(19174)], makefile_test, ['T9930fail']) test('T18441fail0', req_interp, makefile_test, ['T18441fail0']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8d4786ddd608f72127f4fe8f7bf69746d1f38fd1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8d4786ddd608f72127f4fe8f7bf69746d1f38fd1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 11:24:17 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Wed, 06 Mar 2024 06:24:17 -0500 Subject: [Git][ghc/ghc][wip/T22423] 510 commits: Add a flag -fkeep-auto-rules to optionally keep auto-generated rules around. Message-ID: <65e852613bafa_38980ec9a2c05875@gitlab.mail> Simon Peyton Jones pushed to branch wip/T22423 at Glasgow Haskell Compiler / GHC Commits: e96c51cb by Andreas Klebinger at 2023-10-10T16:44:27+01:00 Add a flag -fkeep-auto-rules to optionally keep auto-generated rules around. The motivation for the flag is given in #21917. - - - - - 3ed58cef by Matthew Pickering at 2023-10-10T19:01:22-04:00 hadrian: Add ghcToolchain to tool args list This allows you to load ghc-toolchain and ghc-toolchain-bin into HLS. - - - - - 476c02d4 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Normalise triple via config.sub We were not normalising the target triple anymore like we did with the old make build system. Fixes #23856 - - - - - 303dd237 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Add missing vendor normalisation This is copied from m4/ghc_convert_vendor.m4 Towards #23868 - - - - - 838026c9 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Add loongarch64 to parseArch Towards #23868 - - - - - 1a5bc0b5 by Matthew Pickering at 2023-10-10T19:01:22-04:00 Add same LD hack to ghc-toolchain In the ./configure script, if you pass the `LD` variable then this has the effect of stopping use searching for a linker and hence passing `-fuse-ld=...`. We want to emulate this logic in ghc-toolchain, if a use explicilty specifies `LD` variable then don't add `-fuse-ld=..` with the goal of making ./configure and ghc-toolchain agree on which flags to use when using the C compiler as a linker. This is quite unsavoury as we don't bake the choice of LD into the configuration anywhere but what's important for now is making ghc-toolchain and ./configure agree as much as possible. See #23857 for more discussion - - - - - 42d50b5a by Ben Gamari at 2023-10-10T19:01:22-04:00 ghc-toolchain: Check for C99 support with -std=c99 Previously we failed to try enabling C99 support with `-std=c99`, as `autoconf` attempts. This broke on older compilers (e.g. CentOS 7) which don't enable C99 by default. Fixes #23879. - - - - - da2961af by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Add endianess check using __BYTE_ORDER__ macro In very old toolchains the BYTE_ORDER macro is not set but thankfully the __BYTE_ORDER__ macro can be used instead. - - - - - d8da73cd by Matthew Pickering at 2023-10-10T19:01:22-04:00 configure: AC_PATH_TARGET_TOOL for LD We want to make sure that LD is set to an absolute path in order to be consistent with the `LD=$(command -v ld)` call. The AC_PATH_TARGET_TOOL macro uses the absolute path rather than AC_CHECK_TARGET_TOOL which might use a relative path. - - - - - 171f93cc by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Check whether we need -std=gnu99 for CPP as well In ./configure the C99 flag is passed to the C compiler when used as a C preprocessor. So we also check the same thing in ghc-toolchain. - - - - - 89a0918d by Matthew Pickering at 2023-10-10T19:01:22-04:00 Check for --target linker flag separately to C compiler There are situations where the C compiler doesn't accept `--target` but when used as a linker it does (but doesn't do anything most likely) In particular with old gcc toolchains, the C compiler doesn't support --target but when used as a linker it does. - - - - - 37218329 by Matthew Pickering at 2023-10-10T19:01:22-04:00 Use Cc to compile test file in nopie check We were attempting to use the C compiler, as a linker, to compile a file in the nopie check, but that won't work in general as the flags we pass to the linker might not be compatible with the ones we pass when using the C compiler. - - - - - 9b2dfd21 by Matthew Pickering at 2023-10-10T19:01:22-04:00 configure: Error when ghc-toolchain fails to compile This is a small QOL change as if you are working on ghc-toolchain and it fails to compile then configure will continue and can give you outdated results. - - - - - 1f0de49a by Matthew Pickering at 2023-10-10T19:01:22-04:00 configure: Check whether -no-pie works when the C compiler is used as a linker `-no-pie` is a flag we pass when using the C compiler as a linker (see pieCCLDOpts in GHC.Driver.Session) so we should test whether the C compiler used as a linker supports the flag, rather than just the C compiler. - - - - - 62cd2579 by Matthew Pickering at 2023-10-10T19:01:22-04:00 ghc-toolchain: Remove javascript special case for --target detection emcc when used as a linker seems to ignore the --target flag, and for consistency with configure which now tests for --target, we remove this special case. - - - - - 0720fde7 by Ben Gamari at 2023-10-10T19:01:22-04:00 toolchain: Don't pass --target to emscripten toolchain As noted in `Note [Don't pass --target to emscripten toolchain]`, emscripten's `emcc` is rather inconsistent with respect to its treatment of the `--target` flag. Avoid this by special-casing this toolchain in the `configure` script and `ghc-toolchain`. Fixes on aspect of #23744. - - - - - 6354e1da by Matthew Pickering at 2023-10-10T19:01:22-04:00 hadrian: Don't pass `--gcc-options` as a --configure-arg to cabal configure Stop passing -gcc-options which mixed together linker flags and non-linker flags. There's no guarantee the C compiler will accept both of these in each mode. - - - - - c00a4bd6 by Ben Gamari at 2023-10-10T19:01:22-04:00 configure: Probe stage0 link flags For consistency with later stages and CC. - - - - - 1f11e7c4 by Sebastian Graf at 2023-10-10T19:01:58-04:00 Stricter Binary.get in GHC.Types.Unit (#23964) I noticed some thunking while looking at Core. This change has very modest, but throughout positive ghc/alloc effect: ``` hard_hole_fits(normal) ghc/alloc 283,057,664 281,620,872 -0.5% geo. mean -0.1% minimum -0.5% maximum +0.0% ``` Fixes #23964. - - - - - a4f1a181 by Bryan Richter at 2023-10-10T19:02:37-04:00 rel_eng/upload.sh cleanups - - - - - 80705335 by doyougnu at 2023-10-10T19:03:18-04:00 ci: add javascript label rule This adds a rule which triggers the javascript job when the "javascript" label is assigned to an MR. - - - - - a2c0fff6 by Matthew Craven at 2023-10-10T19:03:54-04:00 Make 'wWarningFlagsDeps' include every WarningFlag Fixes #24071. - - - - - d055f099 by Jan Hrček at 2023-10-10T19:04:33-04:00 Fix pretty printing of overlap pragmas in TH splices (fixes #24074) - - - - - 0746b868 by Andreas Klebinger at 2023-10-10T19:05:09-04:00 Aarch64 NCG: Use encoded immediates for literals. Try to generate instr x2, <imm> instead of mov x1, lit instr x2, x1 When possible. This get's rid if quite a few redundant mov instructions. I believe this causes a metric decrease for LargeRecords as we reduce register pressure. ------------------------- Metric Decrease: LargeRecord ------------------------- - - - - - 739f4e6f by Andreas Klebinger at 2023-10-10T19:05:09-04:00 AArch NCG: Refactor getRegister' Remove some special cases which can be handled just as well by the generic case. This increases code re-use while also fixing #23749. Since some of the special case wasn't upholding Note [Signed arithmetic on AArch64]. - - - - - 1b213d33 by Andreas Klebinger at 2023-10-10T19:05:09-04:00 Aarch ncg: Optimize immediate use for address calculations When the offset doesn't fit into the immediate we now just reuse the general getRegister' code path which is well optimized to compute the offset into a register instead of a special case for CmmRegOff. This means we generate a lot less code under certain conditions which is why performance metrics for these improve. ------------------------- Metric Decrease: T4801 T5321FD T5321Fun ------------------------- - - - - - b7df0732 by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over mem management checks These are for heap allocation, a strictly RTS concern. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. The RTS configure one has a new ``` AC_CHECK_SIZEOF([void *]) ``` that the top-level configure version didn't have, so that `ac_cv_sizeof_void_p` is defined. Once more code is moved over in latter commits, that can go away. Progress towards #17191 - - - - - 41130a65 by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over `__thread` check This used by (@bgamari thinks) the `GCThread` abstraction in the RTS. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - cc5ec2bd by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over misc function checks These are for general use in the RTS. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - 809e7c2d by John Ericson at 2023-10-11T16:02:11-04:00 RTS configure: Move over `eventfd` check This check is for the RTS part of the event manager and has a corresponding part in `base`. All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - 58f3babf by John Ericson at 2023-10-11T16:02:48-04:00 Split `FP_CHECK_PTHREADS` and move part to RTS configure `NEED_PTHREAD_LIB` is unused since 3609340743c1b25fdfd0e18b1670dac54c8d8623 (part of the make build system), and so is no longer defined. Progress towards #17191 - - - - - e99cf237 by Moritz Angermann at 2023-10-11T16:03:24-04:00 nativeGen: section flags for .text$foo only Commit 3ece9856d157c85511d59f9f862ab351bbd9b38b, was supposed to fix #22834 in !9810. It does however add "xr" indiscriminatly to .text sections even if splitSections is disabled. This leads to the assembler saying: ghc_1.s:7849:0: error: Warning: Ignoring changed section attributes for .text | 7849 | .section .text,"xr" | ^ - - - - - f383a242 by Sylvain Henry at 2023-10-11T16:04:04-04:00 Modularity: pass TempDir instead of DynFlags (#17957) - - - - - 34fc28b0 by John Ericson at 2023-10-12T06:48:28-04:00 Test that functions from `mingwex` are available Ryan wrote these two minimizations, but they never got added to the test suite. See #23309, #23378 Co-Authored-By: Ben Gamari <bgamari.foss at gmail.com> Co-Authored-By: Ryan Scott <ryan.gl.scott at gmail.com> - - - - - bdb54a0e by John Ericson at 2023-10-12T06:48:28-04:00 Do not check for the `mingwex` library in `/configure` See the recent discussion in !10360 --- Cabal will itself check for the library for the packages that need it, and while the autoconf check additionally does some other things like define a `HAS_LIBMINGWEX` C Preprocessor macro, those other things are also unused and unneeded. Progress towards #17191, which aims to get rid of `/configure` entirely. - - - - - 43e814e1 by Ben Gamari at 2023-10-12T06:49:40-04:00 base: Introduce move modules into src The only non-move changes here are whitespace changes to pass the `whitespace` test and a few testsuite adaptations. - - - - - df81536f by Moritz Angermann at 2023-10-12T06:50:16-04:00 [PEi386 linker] Bounds check and null-deref guard We should resonably be able to expect that we won't exceed the number of sections if we assume to be dealing with legal object files. We can however not guarantee that we get some negative values, and while we try to special case most, we should exclude negative indexing into the sections array. We also need to ensure that we do not try to derefences targetSection, if it is NULL, due to the switch statement. - - - - - c74c4f00 by John Ericson at 2023-10-12T10:31:13-04:00 Move apple compat check to RTS configure - - - - - c80778ea by John Ericson at 2023-10-12T10:31:13-04:00 Move clock/timer fun checks to RTS configure Actual library check (which will set the Cabal flag) is left in the top-level configure for now. Progress towards #17191 - - - - - 7f9f2686 by John Ericson at 2023-10-12T10:31:13-04:00 Move visibility and "musttail" annotation checks to the RTS configure All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. Progress towards #17191 - - - - - ffb3efe6 by John Ericson at 2023-10-12T10:31:13-04:00 Move leading underscore checks to RTS configure `CabalLeadingUnderscore` is done via Hadrian already, so we can stop `AC_SUBST`ing it completely. - - - - - 25fa4b02 by John Ericson at 2023-10-12T10:31:13-04:00 Move alloca, fork, const, and big endian checks to RTS configure All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it belongs in the RTS configure and should be safe to move without modification. - - - - - 5170f42a by John Ericson at 2023-10-12T10:31:13-04:00 Move libdl check to RTS configure - - - - - ea7a1447 by John Ericson at 2023-10-12T10:31:13-04:00 Adjust `FP_FIND_LIBFFI` Just set vars, and `AC_SUBST` in top-level configure. Don't define `HAVE_SYSTEM_LIBFFI` because nothing is using it. It hasn't be in used since 3609340743c1b25fdfd0e18b1670dac54c8d8623 (part of the make build system). - - - - - f399812c by John Ericson at 2023-10-12T10:31:13-04:00 Split BFD support to RTS configure The flag is still in the top-level configure, but the other checks (which define various macros --- important) are in the RTS configure. - - - - - f64f44e9 by John Ericson at 2023-10-12T10:31:13-04:00 Split libm check between top level and RTS - - - - - dafc4709 by Moritz Angermann at 2023-10-12T10:31:49-04:00 CgUtils.fixStgRegStmt respect register width This change ensure that the reg + offset computation is always of the same size. Before this we could end up with a 64bit register, and then add a 32bit offset (on 32bit platforms). This not only would fail type sanity checking, but also incorrectly truncate 64bit values into 32bit values silently on 32bit architectures. - - - - - 9e6ef7ba by Matthew Pickering at 2023-10-12T20:35:00-04:00 hadrian: Decrease verbosity of cabal commands In Normal, most tools do not produce output to stdout unless there are error conditions. Reverts 7ed65f5a1bc8e040e318ccff395f53a9bbfd8217 - - - - - 08fc27af by John Ericson at 2023-10-12T20:35:36-04:00 Do not substitute `@...@` for stage-specific values in cabal files `rts` and `ghc-prim` now no longer have a `*.cabal.in` to set Cabal flag defaults; instead manual choices are passed to configure in the usual way. The old way was fundamentally broken, because it meant we were baking these Cabal files for a specific stage. Now we only do stage-agnostic @...@ substitution in cabal files (the GHC version), and so all stage-specific configuration is properly confined to `_build` and the right stage dir. Also `include-ghc-prim` is a flag that no longer exists for `ghc-prim` (it was removed in 835d8ddbbfb11796ea8a03d1806b7cee38ba17a6) so I got rid of it. Co-Authored-By: Matthew Pickering <matthewtpickering at gmail.com> - - - - - a0ac8785 by Sebastian Graf at 2023-10-14T19:17:12-04:00 Fix restarts in .ghcid Using the whole of `hadrian/` restarted in a loop for me. - - - - - fea9ecdb by Sebastian Graf at 2023-10-14T19:17:12-04:00 CorePrep: Refactor FloatingBind (#23442) A drastically improved architecture for local floating in CorePrep that decouples the decision of whether a float is going to be let- or case-bound from how far it can float (out of strict contexts, out of lazy contexts, to top-level). There are a couple of new Notes describing the effort: * `Note [Floating in CorePrep]` for the overview * `Note [BindInfo and FloatInfo]` for the new classification of floats * `Note [Floats and FloatDecision]` for how FloatInfo is used to inform floating decisions This is necessary ground work for proper treatment of Strict fields and unlifted values at top-level. Fixes #23442. NoFib results (omitted = 0.0%): ``` -------------------------------------------------------------------------------- Program Allocs Instrs -------------------------------------------------------------------------------- pretty 0.0% -1.6% scc 0.0% -1.7% -------------------------------------------------------------------------------- Min 0.0% -1.7% Max 0.0% -0.0% Geometric Mean -0.0% -0.0% ``` - - - - - 32523713 by Matthew Pickering at 2023-10-14T19:17:49-04:00 hadrian: Move ghcBinDeps into ghcLibDeps This completes a5227080b57cb51ac34d4c9de1accdf6360b818b, the `ghc-usage.txt` and `ghci-usage.txt` file are also used by the `ghc` library so need to make sure they are present in the libdir even if we are not going to build `ghc-bin`. This also fixes things for cross compilers because the stage2 cross-compiler requires the ghc-usage.txt file, but we are using the stage2 lib folder but not building stage3:exe:ghc-bin so ghc-usage.txt was not being generated. - - - - - ec3c4488 by sheaf at 2023-10-14T19:18:29-04:00 Combine GREs when combining in mkImportOccEnv In `GHC.Rename.Names.mkImportOccEnv`, we sometimes discard one import item in favour of another, as explained in Note [Dealing with imports] in `GHC.Rename.Names`. However, this can cause us to lose track of important parent information. Consider for example #24084: module M1 where { class C a where { type T a } } module M2 ( module M1 ) where { import M1 } module M3 where { import M2 ( C, T ); instance C () where T () = () } When processing the import list of `M3`, we start off (for reasons that are not relevant right now) with two `Avail`s attached to `T`, namely `C(C, T)` and `T(T)`. We combine them in the `combine` function of `mkImportOccEnv`; as described in Note [Dealing with imports] we discard `C(C, T)` in favour of `T(T)`. However, in doing so, we **must not** discard the information want that `C` is the parent of `T`. Indeed, losing track of this information can cause errors when importing, as we could get an error of the form ‘T’ is not a (visible) associated type of class ‘C’ We fix this by combining the two GREs for `T` using `plusGRE`. Fixes #24084 - - - - - 257c2807 by Ilias Tsitsimpis at 2023-10-14T19:19:07-04:00 hadrian: Pass -DNOSMP to C compiler when needed Hadrian passes the -DNOSMP flag to GHC when the target doesn't support SMP, but doesn't pass it to CC as well, leading to the following compilation error on mips64el: | Run Cc (FindCDependencies CDep) Stage1: rts/sm/NonMovingScav.c => _build/stage1/rts/build/c/sm/NonMovingScav.o.d Command line: /usr/bin/mips64el-linux-gnuabi64-gcc -E -MM -MG -MF _build/stage1/rts/build/c/hooks/FlagDefaults.thr_debug_p_o.d -MT _build/stage1/rts/build/c/hooks/FlagDefaults.o -Irts/include -I_build/stage1/rts/build -I_build/stage1/rts/build/include -Irts/include -x c rts/hooks/FlagDefaults.c -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline -Wpointer-arith -Wmissing-noreturn -Wnested-externs -Wredundant-decls -Wundef -fno-strict-aliasing -DTHREADED_RTS -DDEBUG -fomit-frame-pointer -O2 -g -Irts -I_build/stage1/rts/build -DDEBUG -fno-omit-frame-pointer -g3 -O0 ===> Command failed with error code: 1 In file included from rts/include/Stg.h:348, from rts/include/Rts.h:38, from rts/hooks/FlagDefaults.c:8: rts/include/stg/SMP.h:416:2: error: #error memory barriers unimplemented on this architecture 416 | #error memory barriers unimplemented on this architecture | ^~~~~ rts/include/stg/SMP.h:440:2: error: #error memory barriers unimplemented on this architecture 440 | #error memory barriers unimplemented on this architecture | ^~~~~ rts/include/stg/SMP.h:464:2: error: #error memory barriers unimplemented on this architecture 464 | #error memory barriers unimplemented on this architecture | ^~~~~ The old make system correctly passed this flag to both GHC and CC [1]. Fix this error by passing -DNOSMP to CC as well. [1] https://gitlab.haskell.org/ghc/ghc/-/blob/00920f176b0235d5bb52a8e054d89a664f8938fe/rts/ghc.mk#L407 Closes #24082 - - - - - 13d3c613 by John Ericson at 2023-10-14T19:19:42-04:00 Users Guide: Drop dead code for Haddock refs to `parallel` I noticed while working on !11451 that `@LIBRARY_parallel_UNIT_ID@` was not substituted. It is dead code -- there is no `parallel-ref` usages and it doesn't look like there ever was (going back to 3e5d0f188d6c8633e55e9ba6c8941c07e459fa4b), so let's delete it. - - - - - fe067577 by Sylvain Henry at 2023-10-18T19:40:25-04:00 Avoid out-of-bound array access in bigNatIsPowerOf2 (fix #24066) bigNatIndex# in the `where` clause wasn't guarded by "bigNatIsZero a". - - - - - cc1625b1 by Sylvain Henry at 2023-10-18T19:40:25-04:00 Bignum: fix right shift of negative BigNat with native backend - - - - - cbe4400d by Sylvain Henry at 2023-10-18T19:40:25-04:00 Rts: expose rtsOutOfBoundsAccess symbol - - - - - 72c7380c by Sylvain Henry at 2023-10-18T19:40:25-04:00 Hadrian: enable `-fcheck-prim-bounds` in validate flavour This allows T24066 to fail when the bug is present. Otherwise the out-of-bound access isn't detected as it happens in ghc-bignum which wasn't compiled with the bounds check. - - - - - f9436990 by John Ericson at 2023-10-18T19:41:01-04:00 Make Hadrian solely responsible for substituting `docs/users_guide/ghc_config.py.in` Fixes #24091 Progress on #23966 Issue #24091 reports that `@ProjectVersion@` is no longer being substituted in the GHC user's guide. I assume this is a recent issue, but I am not sure how it's worked since c1a3ecde720b3bddc2c8616daaa06ee324e602ab; it looks like both Hadrian and configure are trying to substitute the same `.in` file! Now only Hadrian does. That is better anyways; already something that issue #23966 requested. It seems like we were missing some dependencies in Hadrian. (I really, really hate that this is possible!) Hopefully it is fixed now. - - - - - b12df0bb by John Ericson at 2023-10-18T19:41:37-04:00 `ghcversion.h`: No need to cope with undefined `ProjectPatchLevel*` Since 4e6c80197f1cc46dfdef0300de46847c7cfbdcb0, these are guaranteed to be defined. (Guaranteed including a test in the testsuite.) - - - - - 0295375a by John Ericson at 2023-10-18T19:41:37-04:00 Generate `ghcversion.h` from a `.in` file Now that there are no conditional sections (see the previous commit), we can just a do simple substitution rather than pasting it together line by line. Progress on #23966 - - - - - 740a1b85 by Krzysztof Gogolewski at 2023-10-19T11:37:20-04:00 Add a regression test for #24064 - - - - - 921fbf2f by Hécate Moonlight at 2023-10-19T11:37:59-04:00 CLC Proposal #182: Export List from Data.List Proposal link: https://github.com/haskell/core-libraries-committee/issues/182 - - - - - 4f02d3c1 by Sylvain Henry at 2023-10-20T04:01:32-04:00 rts: fix small argument passing on big-endian arch (fix #23387) - - - - - b86243b4 by Sylvain Henry at 2023-10-20T04:02:13-04:00 Interpreter: fix literal alignment on big-endian architectures (fix #19261) Literals weren't correctly aligned on big-endian, despite what the comment said. - - - - - a4b2ec47 by Sylvain Henry at 2023-10-20T04:02:54-04:00 Testsuite: recomp011 and recomp015 are fixed on powerpc These tests have been fixed but not tested and re-enabled on big-endian powerpc (see comments in #11260 and #11323) - - - - - fded7dd4 by Sebastian Graf at 2023-10-20T04:03:30-04:00 CorePrep: Allow floating dictionary applications in -O0 into a Rec (#24102) - - - - - 02efc181 by John Ericson at 2023-10-22T02:48:55-04:00 Move function checks to RTS configure Some of these functions are used in `base` too, but we can copy the checks over to its configure if that's an issue. - - - - - 5f4bccab by John Ericson at 2023-10-22T02:48:55-04:00 Move over a number of C-style checks to RTS configure - - - - - 5cf04f58 by John Ericson at 2023-10-22T02:48:55-04:00 Move/Copy more `AC_DEFINE` to RTS config Only exception is the LLVM version macros, which are used for GHC itself. - - - - - b8ce5dfe by John Ericson at 2023-10-22T02:48:55-04:00 Define `TABLES_NEXT_TO_CODE` in the RTS configure We create a new cabal flag to facilitate this. - - - - - 4a40271e by John Ericson at 2023-10-22T02:48:55-04:00 Configure scripts: `checkOS`: Make a bit more robust `mingw64` and `mingw32` are now both accepted for `OSMinGW32`. This allows us to cope with configs/triples that we haven't normalized extra being what GNU `config.sub` does. - - - - - 16bec0a0 by John Ericson at 2023-10-22T02:48:55-04:00 Generate `ghcplatform.h` from RTS configure We create a new cabal flag to facilitate this. - - - - - 7dfcab2f by John Ericson at 2023-10-22T02:48:55-04:00 Get rid of all mention of `mk/config.h` The RTS configure script is now solely responsible for managing its headers; the top level configure script does not help. - - - - - c1e3719c by Cheng Shao at 2023-10-22T02:49:33-04:00 rts: drop stale mentions of MIN_UPD_SIZE We used to have MIN_UPD_SIZE macro that describes the minimum reserved size for thunks, so that the thunk can be overwritten in place as indirections or blackholes. However, this macro has not been actually defined or used anywhere since a long time ago; StgThunkHeader already reserves a padding word for this purpose. Hence this patch which drops stale mentions of MIN_UPD_SIZE. - - - - - d24b0d85 by Andrew Lelechenko at 2023-10-22T02:50:11-04:00 base changelog: move non-backported entries from 4.19 section to 4.20 Neither !10933 (check https://hackage.haskell.org/package/base-4.19.0.0/docs/src/Text.Read.Lex.html#numberToRangedRational) nor !10189 (check https://hackage.haskell.org/package/base-4.19.0.0/docs/src/Data.List.NonEmpty.html#unzip) were backported to `base-4.19.0.0`. Moving them to `base-4.20.0.0` section. Also minor stylistic changes to other entries, bringing them to a uniform form. - - - - - de78b32a by Alan Zimmerman at 2023-10-23T09:09:41-04:00 EPA Some tweaks to annotations - Fix span for GRHS - Move TrailingAnns from last match to FunBind - Fix GADT 'where' clause span - Capture full range for a CaseAlt Match - - - - - d5a8780d by Simon Hengel at 2023-10-23T09:10:23-04:00 Update primitives.rst - - - - - 4d075924 by Josh Meredith at 2023-10-24T23:04:12+11:00 JS/userguide: add explanation of writing jsbits - - - - - 07ab5cc1 by Cheng Shao at 2023-10-24T15:40:32-04:00 testsuite: increase timeout of ghc-api tests for wasm32 ghc-api tests for wasm32 are more likely to timeout due to the large wasm module sizes, especially when testing with wasm native tail calls, given wasmtime's handling of tail call opcodes are suboptimal at the moment. It makes sense to increase timeout specifically for these tests on wasm32. This doesn't affect other targets, and for wasm32 we don't increase timeout for all tests, so not to risk letting major performance regressions slip through the testsuite. - - - - - 0d6acca5 by Greg Steuck at 2023-10-26T08:44:23-04:00 Explicitly require RLIMIT_AS before use in OSMem.c This is done elsewhere in the source tree. It also suddenly is required on OpenBSD. - - - - - 9408b086 by Sylvain Henry at 2023-10-26T08:45:03-04:00 Modularity: modularize external linker Decouple runLink from DynFlags to allow calling runLink more easily. This is preliminary work for calling Emscripten's linker (emcc) from our JavaScript linker. - - - - - e0f35030 by doyougnu at 2023-10-27T08:41:12-04:00 js: add JStg IR, remove unsaturated constructor - Major step towards #22736 and adding the optimizer in #22261 - - - - - 35587eba by Simon Peyton Jones at 2023-10-27T08:41:48-04:00 Fix a bug in tail calls with ticks See #24078 for the diagnosis. The change affects only the Tick case of occurrence analysis. It's a bit hard to test, so no regression test (yet anyway). - - - - - 9bc5cb92 by Matthew Craven at 2023-10-28T07:06:17-04:00 Teach tag-inference about SeqOp/seq# Fixes the STG/tag-inference analogue of #15226. Co-Authored-By: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - 34f06334 by Moritz Angermann at 2023-10-28T07:06:53-04:00 [PEi386] Mask SYM_TYPE_DUP_DISCARD in makeSymbolExtra 48e391952c17ff7eab10b0b1456e3f2a2af28a9b introduced `SYM_TYPE_DUP_DISCARD` to the bitfield. The linker however, failed to mask the `SYM_TYPE_DUP_DISCARD` value. Thus `== SYM_TYPE_CODE` comparisons easily failed. This lead to us relocating DATA lookups (GOT) into E8 (call) and E9 (jump) instructions. - - - - - 5b51b2a2 by Mario Blažević at 2023-10-28T07:07:33-04:00 Fix and test for issue #24111, TH.Ppr output of pattern synonyms - - - - - 723bc352 by Alan Zimmerman at 2023-10-30T20:36:41-04:00 EPA: print doc comments as normal comments And ignore the ones allocated in haddock processing. It does not guarantee that every original haddock-like comment appears in the output, as it discards ones that have no legal attachment point. closes #23459 - - - - - 21b76843 by Simon Peyton Jones at 2023-10-30T20:37:17-04:00 Fix non-termination bug in equality solver constraint left-to-right then right to left, forever. Easily fixed. - - - - - 270867ac by Sebastian Graf at 2023-10-30T20:37:52-04:00 ghc-toolchain: build with `-package-env=-` (#24131) Otherwise globally installed libraries (via `cabal install --lib`) break the build. Fixes #24131. - - - - - 7a90020f by Krzysztof Gogolewski at 2023-10-31T20:03:37-04:00 docs: fix ScopedTypeVariables example (#24101) The previous example didn't compile. Furthermore, it wasn't demonstrating the point properly. I have changed it to an example which shows that 'a' in the signature must be the same 'a' as in the instance head. - - - - - 49f69f50 by Krzysztof Gogolewski at 2023-10-31T20:04:13-04:00 Fix pretty-printing of type family dependencies "where" should be after the injectivity annotation. - - - - - 73c191c0 by Ben Gamari at 2023-10-31T20:04:49-04:00 gitlab-ci: Bump LLVM bootstrap jobs to Debian 12 As the Debian 10 images have too old an LLVM. Addresses #24056. - - - - - 5b0392e0 by Matthew Pickering at 2023-10-31T20:04:49-04:00 ci: Run aarch64 llvm backend job with "LLVM backend" label This brings it into line with the x86 LLVM backend job. - - - - - 9f9c9227 by Ryan Scott at 2023-11-01T09:19:12-04:00 More robust checking for DataKinds As observed in #22141, GHC was not doing its due diligence in catching code that should require `DataKinds` in order to use. Most notably, it was allowing the use of arbitrary data types in kind contexts without `DataKinds`, e.g., ```hs data Vector :: Nat -> Type -> Type where ``` This patch revamps how GHC tracks `DataKinds`. The full specification is written out in the `DataKinds` section of the GHC User's Guide, and the implementation thereof is described in `Note [Checking for DataKinds]` in `GHC.Tc.Validity`. In brief: * We catch _type_-level `DataKinds` violations in the renamer. See `checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in `GHC.Rename.Pat`. * We catch _kind_-level `DataKinds` violations in the typechecker, as this allows us to catch things that appear beneath type synonyms. (We do *not* want to do this in type-level contexts, as it is perfectly fine for a type synonym to mention something that requires DataKinds while still using the type synonym in a module that doesn't enable DataKinds.) See `checkValidType` in `GHC.Tc.Validity`. * There is now a single `TcRnDataKindsError` that classifies all manner of `DataKinds` violations, both in the renamer and the typechecker. The `NoDataKindsDC` error has been removed, as it has been subsumed by `TcRnDataKindsError`. * I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit uses of data types at the kind level without `DataKinds`. Previously, `isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`. Moreover, it thwarted the implementation of the `DataKinds` check in `checkValidType`, since we would expand `Constraint` (which was OK without `DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and reject it. Now both are allowed. * I have added a flurry of additional test cases that test various corners of `DataKinds` checking. Fixes #22141. - - - - - 575d7690 by Sylvain Henry at 2023-11-01T09:19:53-04:00 JS: fix FFI "wrapper" and "dynamic" Fix codegen and helper functions for "wrapper" and "dynamic" foreign imports. Fix tests: - ffi006 - ffi011 - T2469 - T4038 Related to #22363 - - - - - 81fb8885 by Alan Zimmerman at 2023-11-01T22:23:56-04:00 EPA: Use full range for Anchor This change requires a series of related changes, which must all land at the same time, otherwise all the EPA tests break. * Use the current Anchor end as prior end Use the original anchor location end as the source of truth for calculating print deltas. This allows original spacing to apply in most cases, only changed AST items need initial delta positions. * Add DArrow to TrailingAnn * EPA Introduce HasTrailing in ExactPrint Use [TrailingAnn] in enterAnn and remove it from ExactPrint (LocatedN RdrName) * In HsDo, put TrailingAnns at top of LastStmt * EPA: do not convert comments to deltas when balancing. * EPA: deal with fallout from getMonoBind * EPA fix captureLineSpacing * EPA print any comments in the span before exiting it * EPA: Add comments to AnchorOperation * EPA: remove AnnEofComment, it is no longer used Updates Haddock submodule - - - - - 03e82511 by Rodrigo Mesquita at 2023-11-01T22:24:32-04:00 Fix in docs regarding SSymbol, SNat, SChar (#24119) - - - - - 362cc693 by Matthew Pickering at 2023-11-01T22:25:08-04:00 hadrian: Update bootstrap plans (9.4.6, 9.4.7, 9.6.2, 9.6.3, 9.8.1) Updating the bootstrap plans with more recent GHC versions. - - - - - 00b9b8d3 by Matthew Pickering at 2023-11-01T22:25:08-04:00 ci: Add 9.8.1 bootstrap testing job - - - - - ef3d20f8 by Matthew Pickering at 2023-11-01T22:25:08-04:00 Compatibility with 9.8.1 as boot compiler This fixes several compatability issues when using 9.8.1 as the boot compiler. * An incorrect version guard on the stack decoding logic in ghc-heap * Some ghc-prim bounds need relaxing * ghc is no longer wired in, so we have to remove the -this-unit-id ghc call. Fixes #24077 - - - - - 6755d833 by Jaro Reinders at 2023-11-03T10:54:42+01:00 Add NCG support for common 64bit operations to the x86 backend. These used to be implemented via C calls which was obviously quite bad for performance for operations like simple addition. Co-authored-by: Andreas Klebinger - - - - - 0dfb1fa7 by Vladislav Zavialov at 2023-11-03T14:08:41-04:00 T2T in Expressions (#23738) This patch implements the T2T (term-to-type) transformation in expressions. Given a function with a required type argument vfun :: forall a -> ... the user can now call it as vfun (Maybe Int) instead of vfun (type (Maybe Int)) The Maybe Int argument is parsed and renamed as a term (HsExpr), but then undergoes a conversion to a type (HsType). See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs and Note [RequiredTypeArguments and the T2T mapping] Left as future work: checking for puns. - - - - - cc1c7c54 by Duncan Coutts at 2023-11-05T00:23:44-04:00 Add a test for I/O managers It tries to cover the cases of multiple threads waiting on the same fd for reading and multiple threads waiting for writing, including wait cancellation by async exceptions. It should work for any I/O manager, in-RTS or in-Haskell. Unfortunately it will not currently work for Windows because it relies on anonymous unix sockets. It could in principle be ported to use Windows named pipes. - - - - - 2e448f98 by Cheng Shao at 2023-11-05T00:23:44-04:00 Skip the IOManager test on wasm32 arch. The test relies on the sockets API which are not (yet) available. - - - - - fe50eb35 by Cheng Shao at 2023-11-05T00:24:20-04:00 compiler: fix eager blackhole symbol in wasm32 NCG - - - - - af771148 by Cheng Shao at 2023-11-05T00:24:20-04:00 testsuite: fix optasm tests for wasm32 - - - - - 1b90735c by Matthew Pickering at 2023-11-05T00:24:20-04:00 testsuite: Add wasm32 to testsuite arches with NCG The compiler --info reports that wasm32 compilers have a NCG, so we should agree with that here. - - - - - db9a6496 by Alan Zimmerman at 2023-11-05T00:24:55-04:00 EPA: make locA a function, not a field name And use it to generalise reLoc The following for the windows pipeline one. 5.5% Metric Increase: T5205 - - - - - 833e250c by Simon Peyton Jones at 2023-11-05T00:25:31-04:00 Update the unification count in wrapUnifierX Omitting this caused type inference to fail in #24146. This was an accidental omision in my refactoring of the equality solver. - - - - - e451139f by Andreas Klebinger at 2023-11-05T00:26:07-04:00 Remove an accidental git conflict marker from a comment. - - - - - 30baac7a by Tobias Haslop at 2023-11-06T10:50:32+00:00 Add laws relating between Foldable/Traversable with their Bi- superclasses See https://github.com/haskell/core-libraries-committee/issues/205 for discussion. This commit also documents that the tuple instances only satisfy the laws up to lazyness, similar to the documentation added in !9512. - - - - - df626f00 by Tobias Haslop at 2023-11-07T02:20:37-05:00 Elaborate on the quantified superclass of Bifunctor This was requested in the comment https://github.com/haskell/core-libraries-committee/issues/93#issuecomment-1597271700 for when Traversable becomes a superclass of Bitraversable, but similarly applies to Functor/Bifunctor, which already are in a superclass relationship. - - - - - 8217acb8 by Alan Zimmerman at 2023-11-07T02:21:12-05:00 EPA: get rid of l2l and friends Replace them with l2l to convert the location la2la to convert a GenLocated thing Updates haddock submodule - - - - - dd88a260 by Luite Stegeman at 2023-11-07T02:21:53-05:00 JS: remove broken newIdents from JStg Monad GHC.JS.JStg.Monad.newIdents was broken, resulting in duplicate identifiers being generated in h$c1, h$c2, ... . This change removes the broken newIdents. - - - - - 455524a2 by Matthew Craven at 2023-11-09T08:41:59-05:00 Create specially-solved DataToTag class Closes #20532. This implements CLC proposal 104: https://github.com/haskell/core-libraries-committee/issues/104 The design is explained in Note [DataToTag overview] in GHC.Tc.Instance.Class. This replaces the existing `dataToTag#` primop. These metric changes are not "real"; they represent Unique-related flukes triggering on a different set of jobs than they did previously. See also #19414. Metric Decrease: T13386 T8095 Metric Increase: T13386 T8095 Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - a05f4554 by Alan Zimmerman at 2023-11-09T08:42:35-05:00 EPA: get rid of glRR and friends in GHC/Parser.y With the HasLoc and HasAnnotation classes, we can replace a number of type-specific helper functions in the parser with polymorphic ones instead Metric Decrease: MultiLayerModulesTH_Make - - - - - 18498538 by Cheng Shao at 2023-11-09T16:58:12+00:00 ci: bump ci-images for wasi-sdk upgrade - - - - - 52c0fc69 by PHO at 2023-11-09T19:16:22-05:00 Don't assume the current locale is *.UTF-8, set the encoding explicitly primops.txt contains Unicode characters: > LC_ALL=C ./genprimopcode --data-decl < ./primops.txt > genprimopcode: <stdin>: hGetContents: invalid argument (cannot decode byte sequence starting from 226) Hadrian must also avoid using readFile' to read primops.txt because it tries to decode the file with a locale-specific encoding. - - - - - 7233b3b1 by PHO at 2023-11-09T19:17:01-05:00 Use '[' instead of '[[' because the latter is a Bash-ism It doesn't work on platforms where /bin/sh is something other than Bash. - - - - - 6dbab180 by Simon Peyton Jones at 2023-11-09T19:17:36-05:00 Add an extra check in kcCheckDeclHeader_sig Fix #24083 by checking for a implicitly-scoped type variable that is not actually bound. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType For some reason, on aarch64-darwin we saw a 2.8% decrease in compiler allocations for MultiLayerModulesTH_Make; but 0.0% on other architectures. Metric Decrease: MultiLayerModulesTH_Make - - - - - 22551364 by Sven Tennie at 2023-11-11T06:35:22-05:00 AArch64: Delete unused LDATA pseudo-instruction Though there were consuming functions for LDATA, there were no producers. Thus, the removed code was "dead". - - - - - 2a0ec8eb by Alan Zimmerman at 2023-11-11T06:35:59-05:00 EPA: harmonise acsa and acsA in GHC/Parser.y With the HasLoc class, we can remove the acsa helper function, using acsA instead. - - - - - 7ae517a0 by Teo Camarasu at 2023-11-12T08:04:12-05:00 nofib: bump submodule This includes changes that: - fix building a benchmark with HEAD - remove a Makefile-ism that causes errors in bash scripts Resolves #24178 - - - - - 3f0036ec by Alan Zimmerman at 2023-11-12T08:04:47-05:00 EPA: Replace Anchor with EpaLocation An Anchor has a location and an operation, which is either that it is unchanged or that it has moved with a DeltaPos data Anchor = Anchor { anchor :: RealSrcSpan , anchor_op :: AnchorOperation } An EpaLocation also has either a location or a DeltaPos data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan) | EpaDelta !DeltaPos ![LEpaComment] Now that we do not care about always having a location in the anchor, we remove Anchor and replace it with EpaLocation We do this with a type alias initially, to ease the transition. The alias will be removed in time. We also have helpers to reconstruct the AnchorOperation from an EpaLocation. This is also temporary. Updates Haddock submodule - - - - - a7492048 by Alan Zimmerman at 2023-11-12T13:43:07+00:00 EPA: get rid of AnchorOperation Now that the Anchor type is an alias for EpaLocation, remove AnchorOperation. Updates haddock submodule - - - - - 0745c34d by Andrew Lelechenko at 2023-11-13T16:25:07-05:00 Add since annotation for showHFloat - - - - - e98051a5 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 Suppress duplicate librares linker warning of new macOS linker Fixes #24167 XCode 15 introduced a new linker which warns on duplicate libraries being linked. To disable this warning, we pass -Wl,-no_warn_duplicate_libraries as suggested by Brad King in CMake issue #25297. This flag isn't necessarily available to other linkers on darwin, so we must only configure it into the CC linker arguments if valid. - - - - - c411c431 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Encoding test witnesses recent iconv bug is fragile A regression in the new iconv() distributed with XCode 15 and MacOS Sonoma causes the test 'encoding004' to fail in the CP936 roundrip. We mark this test as fragile until this is fixed upstream (rather than broken, since previous versions of iconv pass the test) See #24161 - - - - - ce7fe5a9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Update to LC_ALL=C no longer being ignored in darwin MacOS seems to have fixed an issue where it used to ignore the variable `LC_ALL` in program invocations and default to using Unicode. Since the behaviour seems to be fixed to account for the locale variable, we mark tests that were previously broken in spite of it as fragile (since they now pass in recent macOS distributions) See #24161 - - - - - e6c803f7 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 darwin: Fix single_module is obsolete warning In XCode 15's linker, -single_module is the default and otherwise passing it as a flag results in a warning being raised: ld: warning: -single_module is obsolete This patch fixes this warning by, at configure time, determining whether the linker supports -single_module (which is likely false for all non-darwin linkers, and true for darwin linkers in previous versions of macOS), and using that information at runtime to decide to pass or not the flag in the invocation. Fixes #24168 - - - - - 929ba2f9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Skip MultiLayerModulesTH_Make on darwin The recent toolchain upgrade on darwin machines resulted in the MultiLayerModulesTH_Make test metrics varying too much from the baseline, ultimately blocking the CI pipelines. This commit skips the test on darwin to temporarily avoid failures due to the environment change in the runners. However, the metrics divergence is being investigated still (tracked in #24177) - - - - - af261ccd by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 configure: check target (not build) understands -no_compact_unwind Previously, we were branching on whether the build system was darwin to shortcut this check, but we really want to branch on whether the target system (which is what we are configuring ld_prog for) is darwin. - - - - - 2125c176 by Luite Stegeman at 2023-11-15T13:19:38-05:00 JS: Fix missing variable declarations The JStg IR update was missing some local variable declarations that were present earlier, causing global variables to be used implicitly (or an error in JavaScript strict mode). This adds the local variable declarations again. - - - - - 99ced73b by Krzysztof Gogolewski at 2023-11-15T13:20:14-05:00 Remove loopy superclass solve mechanism Programs with a -Wloopy-superclass-solve warning will now fail with an error. Fixes #23017 - - - - - 2aff2361 by Zubin Duggal at 2023-11-15T13:20:50-05:00 users-guide: Fix links to libraries from the users-guide. The unit-ids generated in c1a3ecde720b3bddc2c8616daaa06ee324e602ab include the package name, so we don't need to explicitly add it to the links. Fixes #24151 - - - - - 27981fac by Alan Zimmerman at 2023-11-15T13:21:25-05:00 EPA: splitLHsForAllTyInvis does not return ann We did not use the annotations returned from splitLHsForAllTyInvis, so do not return them. - - - - - a6467834 by Krzysztof Gogolewski at 2023-11-15T22:22:59-05:00 Document defaulting of RuntimeReps Fixes #24099 - - - - - 2776920e by Simon Peyton Jones at 2023-11-15T22:23:35-05:00 Second fix to #24083 My earlier fix turns out to be too aggressive for data/type families See wrinkle (DTV1) in Note [Disconnected type variables] - - - - - cee81370 by Sylvain Henry at 2023-11-16T09:57:46-05:00 Fix unusable units and module reexport interaction (#21097) This commit fixes an issue with ModUnusable introduced in df0f148feae. In mkUnusableModuleNameProvidersMap we traverse the list of unusable units and generate ModUnusable origin for all the modules they contain: exposed modules, hidden modules, and also re-exported modules. To do this we have a two-level map: ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin So for each module name "M" in broken unit "u" we have: "M" -> u:M -> ModUnusable reason However in the case of module reexports we were using the *target* module as a key. E.g. if "u:M" is a reexport for "X" from unit "o": "M" -> o:X -> ModUnusable reason Case 1: suppose a reexport without module renaming (u:M -> o:M) from unusable unit u: "M" -> o:M -> ModUnusable reason Here it's claiming that the import of M is unusable because a reexport from u is unusable. But if unit o isn't unusable we could also have in the map: "M" -> o:M -> ModOrigin ... Issue: the Semigroup instance of ModuleOrigin doesn't handle the case (ModUnusable <> ModOrigin) Case 2: similarly we could have 2 unusable units reexporting the same module without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v unusable. It gives: "M" -> o:M -> ModUnusable ... (for u) "M" -> o:M -> ModUnusable ... (for v) Issue: the Semigroup instance of ModuleOrigin doesn't handle the case (ModUnusable <> ModUnusable). This led to #21097, #16996, #11050. To fix this, in this commit we make ModUnusable track whether the module used as key is a reexport or not (for better error messages) and we use the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u is unusable, we now record: "M" -> u:M -> ModUnusable reason reexported=True So now, we have two cases for a reexport u:M -> o:X: - u unusable: "M" -> u:M -> ModUnusable ... reexported=True - u usable: "M" -> o:X -> ModOrigin ... reexportedFrom=u:M The second case is indexed with o:X because in this case the Semigroup instance of ModOrigin is used to combine valid expositions of a module (directly or via reexports). Note that module lookup functions select usable modules first (those who have a ModOrigin value), so it doesn't matter if we add new ModUnusable entries in the map like this: "M" -> { u:M -> ModUnusable ... reexported=True o:M -> ModOrigin ... } The ModOrigin one will be used. Only if there is no ModOrigin or ModHidden entry will the ModUnusable error be printed. See T21097 for an example printing several reasons why an import is unusable. - - - - - 3e606230 by Krzysztof Gogolewski at 2023-11-16T09:58:22-05:00 Fix IPE test A helper function was defined in a different module than used. To reproduce: ./hadrian/build test --test-root-dirs=testsuite/tests/rts/ipe - - - - - 49f5264b by Andreas Klebinger at 2023-11-16T20:52:11-05:00 Properly compute unpacked sizes for -funpack-small-strict-fields. Use rep size rather than rep count to compute the size. Fixes #22309 - - - - - b4f84e4b by James Henri Haydon at 2023-11-16T20:52:53-05:00 Explicit methods for Alternative Compose Explicitly define some and many in Alternative instance for Data.Functor.Compose Implementation of https://github.com/haskell/core-libraries-committee/issues/181 - - - - - 9bc0dd1f by Ignat Insarov at 2023-11-16T20:53:34-05:00 Add permutations for non-empty lists. Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837 - - - - - 5643ecf9 by Andrew Lelechenko at 2023-11-16T20:53:34-05:00 Update changelog and since annotations for Data.List.NonEmpty.permutations Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837 - - - - - 94ff2134 by Oleg Alexander at 2023-11-16T20:54:15-05:00 Update doc string for traceShow Updated doc string for traceShow. - - - - - faff671a by Luite Stegeman at 2023-11-17T14:12:51+01:00 JS: clean up some foreign imports - - - - - 856e0a4e by Sven Tennie at 2023-11-18T06:54:11-05:00 AArch64: Remove unused instructions As these aren't ever emitted, we don't even know if they work or will ever be used. If one of them is needed in future, we may easily re-add it. Deleted instructions are: - CMN - ANDS - BIC - BICS - EON - ORN - ROR - TST - STP - LDP - DMBSY - - - - - 615441ef by Alan Zimmerman at 2023-11-18T06:54:46-05:00 EPA: Replace Monoid with NoAnn Remove the final Monoid instances in the exact print infrastructure. For Windows CI Metric Decrease: T5205 - - - - - 5a6c49d4 by David Feuer at 2023-11-20T18:53:18-05:00 Speed up stimes in instance Semigroup Endo As discussed at https://github.com/haskell/core-libraries-committee/issues/4 - - - - - cf9da4b3 by Andrew Lelechenko at 2023-11-20T18:53:18-05:00 base: reflect latest changes in the changelog - - - - - 48bf364e by Alan Zimmerman at 2023-11-20T18:53:54-05:00 EPA: Use SrcSpan in EpaSpan This is more natural, since we already need to deal with invalid RealSrcSpans, and that is exactly what SrcSpan.UnhelpfulSpan is for. Updates haddock submodule. - - - - - 97ec37cc by Sebastian Graf at 2023-11-20T18:54:31-05:00 Add regression test for #6070 Fixes #6070. - - - - - e9d5ae41 by Owen Shepherd at 2023-11-21T18:32:23-05:00 chore: Correct typo in the gitlab MR template [skip ci] - - - - - f158a8d0 by Rodrigo Mesquita at 2023-11-21T18:32:59-05:00 Improve error message when reading invalid `.target` files A `.target` file generated by ghc-toolchain or by configure can become invalid if the target representation (`Toolchain.Target`) is changed while the files are not re-generated by calling `./configure` or `ghc-toolchain` again. There is also the issue of hadrian caching the dependencies on `.target` files, which makes parsing fail when reading reading the cached value if the representation has been updated. This patch provides a better error message in both situations, moving away from a terrible `Prelude.read: no parse` error that you would get otherwise. Fixes #24199 - - - - - 955520c6 by Ben Gamari at 2023-11-21T18:33:34-05:00 users guide: Note that QuantifiedConstraints implies ExplicitForAll Fixes #24025. - - - - - 17ec3e97 by Owen Shepherd at 2023-11-22T09:37:28+01:00 fix: Change type signatures in NonEmpty export comments to reflect reality This fixes several typos in the comments of Data.List.NonEmpty export list items. - - - - - 2fd78f9f by Samuel Thibault at 2023-11-22T11:49:13-05:00 Fix the platform string for GNU/Hurd As commited in Cargo https://github.com/haskell/cabal/pull/9434 there is confusion between "gnu" and "hurd". This got fixed in Cargo, we need the converse in Hadrian. Fixes #24180 - - - - - a79960fe by Alan Zimmerman at 2023-11-22T11:49:48-05:00 EPA: Tuple Present no longer has annotation The Present constructor for a Tuple argument will never have an exact print annotation. So make this impossible. - - - - - 121c9ab7 by David Binder at 2023-11-22T21:12:29-05:00 Unify the hpc testsuites The hpc testsuite was split between testsuite/tests/hpc and the submodule libraries/hpc/test. This commit unifies the two testsuites in the GHC repository in the directory testsuite/tests/hpc. - - - - - d2733a05 by Alan Zimmerman at 2023-11-22T21:13:05-05:00 EPA: empty tup_tail has noAnn In Parser.y, the tup_tail rule had the following option | {- empty -} %shift { return [Left noAnn] } Once this works through PostProcess.hs, it means we add an extra Missing constructor if the last item was a comma. Change the annotation type to a Bool to indicate this, and use the EpAnn Anchor for the print location for the others. - - - - - fa576eb8 by Andreas Klebinger at 2023-11-24T08:29:13-05:00 Fix FMA primops generating broken assembly on x86. `genFMA3Code` assumed that we had to take extra precations to avoid overwriting the result of `getNonClobberedReg`. One of these special cases caused a bug resulting in broken assembly. I believe we don't need to hadle these cases specially at all, which means this MR simply deletes the special cases to fix the bug. Fixes #24160 - - - - - 34d86315 by Alan Zimmerman at 2023-11-24T08:29:49-05:00 EPA: Remove parenthesizeHsType This is called from PostProcess.hs, and adds spurious parens. With the looser version of exact printing we had before we could tolerate this, as they would be swallowed by the original at the same place. But with the next change (remove EpAnnNotUsed) they result in duplicates in the output. For Darwin build: Metric Increase: MultiLayerModulesTH_OneShot - - - - - 3ede659d by Vladislav Zavialov at 2023-11-26T06:43:32-05:00 Add name for -Wdeprecated-type-abstractions (#24154) This warning had no name or flag and was triggered unconditionally. Now it is part of -Wcompat. - - - - - 7902ebf8 by Alan Zimmerman at 2023-11-26T06:44:08-05:00 EPA: Remove EpAnnNotUsed We no longer need the EpAnnNotUsed constructor for EpAnn, as we can represent an unused annotation with an anchor having a EpaDelta of zero, and empty comments and annotations. This simplifies code handling annotations considerably. Updates haddock submodule Metric Increase: parsing001 - - - - - 471b2672 by Mario Blažević at 2023-11-26T06:44:48-05:00 Bumped the upper bound of text to <2.2 - - - - - d1bf25c7 by Vladislav Zavialov at 2023-11-26T11:45:49-05:00 Term variable capture (#23740) This patch changes type variable lookup rules (lookupTypeOccRn) and implicit quantification rules (filterInScope) so that variables bound in the term namespace can be captured at the type level {-# LANGUAGE RequiredTypeArguments #-} f1 x = g1 @x -- `x` used in a type application f2 x = g2 (undefined :: x) -- `x` used in a type annotation f3 x = g3 (type x) -- `x` used in an embedded type f4 x = ... where g4 :: x -> x -- `x` used in a type signature g4 = ... This change alone does not allow us to accept examples shown above, but at least it gets them past the renamer. - - - - - da863d15 by Vladislav Zavialov at 2023-11-26T11:46:26-05:00 Update Note [hsScopedTvs and visible foralls] The Note was written before GHC gained support for visible forall in types of terms. Rewrite a few sentences and use a better example. - - - - - b5213542 by Matthew Pickering at 2023-11-27T12:53:59-05:00 testsuite: Add mechanism to collect generic metrics * Generalise the metric logic by adding an additional field which allows you to specify how to query for the actual value. Previously the method of querying the baseline value was abstracted (but always set to the same thing). * This requires rejigging how the stat collection works slightly but now it's more uniform and hopefully simpler. * Introduce some new "generic" helper functions for writing generic stats tests. - collect_size ( deviation, path ) Record the size of the file as a metric - stat_from_file ( metric, deviation, path ) Read a value from the given path, and store that as a metric - collect_generic_stat ( metric, deviation, get_stat) Provide your own `get_stat` function, `lambda way: <Int>`, which can be used to establish the current value of the metric. - collect_generic_stats ( metric_info ): Like collect_generic_stat but provide the whole dictionary of metric definitions. { metric: { deviation: <Int> current: lambda way: <Int> } } * Introduce two new "size" metrics for keeping track of build products. - `size_hello_obj` - The size of `hello.o` from compiling hello.hs - `libdir` - The total size of the `libdir` folder. * Track the number of modules in the AST tests - CountDepsAst - CountDepsParser This lays the infrastructure for #24191 #22256 #17129 - - - - - 7d9a2e44 by ARATA Mizuki at 2023-11-27T12:54:39-05:00 x86: Don't require -mavx2 when using 256-bit floating-point SIMD primitives Fixes #24222 - - - - - 4e5ff6a4 by Alan Zimmerman at 2023-11-27T12:55:15-05:00 EPA: Remove SrcSpanAnn Now that we only have a single constructor for EpAnn, And it uses a SrcSpan for its location, we can do away with SrcSpanAnn completely. It only existed to wrap the original SrcSpan in a location, and provide a place for the exact print annotation. For darwin only: Metric Increase: MultiLayerModulesTH_OneShot Updates haddock submodule - - - - - e05bca39 by Krzysztof Gogolewski at 2023-11-28T08:00:55-05:00 testsuite: don't initialize testdir to '.' The test directory is removed during cleanup, if there's an interrupt that could remove the entire repository. Fixes #24219 - - - - - af881674 by Alan Zimmerman at 2023-11-28T08:01:30-05:00 EPA: Clean up mkScope in Ast.hs Now that we have HasLoc we can get rid of all the custom variants of mkScope For deb10-numa Metric Increase: libdir - - - - - 292983c8 by Ben Gamari at 2023-11-28T22:44:28-05:00 distrib: Rediscover otool and install_name_tool on Darwin In the bindist configure script we must rediscover the `otool` and `install_name_tool`s since they may be different from the build environment. Fixes #24211. - - - - - dfe1c354 by Stefan Schulze Frielinghaus at 2023-11-28T22:45:04-05:00 llvmGen: Align objects in the data section Objects in the data section may be referenced via tagged pointers. Thus, align those objects to a 4- or 8-byte boundary for 32- or 64-bit platforms, respectively. Note, this may need to be reconsidered if objects with a greater natural alignment requirement are emitted as e.g. 128-bit atomics. Fixes #24163. - - - - - f6c486c3 by Matthew Pickering at 2023-11-29T11:08:13-05:00 metrics: Widen libdir and size_hello_obj acceptance window af8816740d9b8759be1a22af8adcb5f13edeb61d shows that the libdir size can fluctuate quite significantly even when the change is quite small. Therefore we widen the acceptance window to 10%. - - - - - 99a6a49c by Alan Zimmerman at 2023-11-29T11:08:49-05:00 EPA: Clean up TC Monad Utils We no longer need the alternative variant of addLocM (addLocMA) nor wrapLocAM, wrapLocSndMA. aarch64-darwin Metric Increase: MultiLayerModulesTH_OneShot deb10-numa-slow Metric Decrease: libdir - - - - - cbc03fa0 by Sebastian Graf at 2023-11-30T12:37:21-05:00 perf tests: Move comments into new `Note [Sensitivity to unique increment]` (#19414) And additionally to T12545, link from T8095, T13386 to this new Note. - - - - - c7623b22 by Alan Zimmerman at 2023-11-30T12:37:56-05:00 EPA: EpaDelta for comment has no comments EpaLocation is used to position things. It has two constructors, EpaSpan holding a SrcSpan, and EpaDelta with a delta position and a possible list of comments. The comment list is needed because the location in EpaDelta has no absolute information to decide which comments should be emitted before them when printing. But it is also used for specifying the position of a comment. To prevent the absurdity of a comment position having a list of comments in it, we make EpaLocation parameterisable, using comments for the normal case and a constant for within comments. Updates haddock submodule. aarch64-darwin Metric Decrease: MultiLayerModulesTH_OneShot - - - - - bd8acc0c by Krzysztof Gogolewski at 2023-11-30T12:38:32-05:00 Kind-check body of a required forall We now require that in 'forall a -> ty', ty has kind TYPE r for some r. Fixes #24176 - - - - - 010fb784 by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Remove incorrect haddock link quotes in code block - - - - - cda9c12d by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Remove cycle from group haddock example - - - - - 495265b9 by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Use repl haddock syntax in group docs - - - - - d134d1de by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Use list [] notation in group haddock - - - - - dfcf629c by Owen Shepherd at 2023-12-03T00:10:10-05:00 docs(NonEmpty/group): Specify final property of group function in haddock - - - - - cad3b734 by Owen Shepherd at 2023-12-03T00:10:10-05:00 fix: Add missing property of List.group - - - - - bad37656 by Matthew Pickering at 2023-12-03T00:10:46-05:00 testsuite: Fix T21097b test with make 4.1 (deb9) cee81370cd6ef256f66035e3116878d4cb82e28b recently added a test which failed on deb9 because the version of make was emitting the recipe failure to stdout rather than stderr. One way to fix this is to be more precise in the test about which part of the output we care about inspecting. - - - - - 5efdf421 by Matthew Pickering at 2023-12-03T00:11:21-05:00 testsuite: Track size of libdir in bytes For consistency it's better if we track all size metrics in bytes. Metric Increase: libdir - - - - - f5eb0f29 by Matthew Pickering at 2023-12-03T00:11:22-05:00 testsuite: Remove rogue trace in testsuite I accidentally left a trace in the generics metric patch. - - - - - d5610737 by Claudio Bley at 2023-12-06T16:13:33-05:00 Only exit ghci in -e mode when :add command fails Previously, when running `ghci -e ':add Sample.hs'` the process would exit with exit code 1 if the file exists and could be loaded. Fixes #24115 - - - - - 0f0c53a5 by Vladislav Zavialov at 2023-12-06T16:14:09-05:00 T2T in Patterns (#23739) This patch implements the T2T (term-to-type) transformation in patterns. Patterns that are checked against a visible forall can now be written without the `type` keyword: \(type t) (x :: t) -> ... -- old \t (x :: t) -> ... -- new The `t` binder is parsed and renamed as a term pattern (Pat), but then undergoes a conversion to a type pattern (HsTyPat). See the new function pat_to_type_pat in compiler/GHC/Tc/Gen/Pat.hs - - - - - 10a1a6c6 by Sebastian Graf at 2023-12-06T16:14:45-05:00 Pmc: Fix SrcLoc and warning for incomplete irrefutable pats (#24234) Before, the source location would point at the surrounding function definition, causing the confusion in #24234. I also took the opportunity to introduce a new `LazyPatCtx :: HsMatchContext _` to make the warning message say "irrefutable pattern" instead of "pattern binding". - - - - - 36b9a38c by Matthew Pickering at 2023-12-06T16:15:21-05:00 libraries: Bump filepath to 1.4.200.1 and unix to 2.8.4.0 Updates filepath submodule Updates unix submodule Fixes #24240 - - - - - 91ff0971 by Matthew Pickering at 2023-12-06T16:15:21-05:00 Submodule linter: Allow references to tags We modify the submodule linter so that if the bumped commit is a specific tag then the commit is accepted. Fixes #24241 - - - - - 86f652dc by Zubin Duggal at 2023-12-06T16:15:21-05:00 hadrian: set -Wno-deprecations for directory and Win32 The filepath bump to 1.4.200.1 introduces a deprecation warning. See https://gitlab.haskell.org/ghc/ghc/-/issues/24240 https://github.com/haskell/filepath/pull/206 - - - - - 7ac6006e by Sylvain Henry at 2023-12-06T16:16:02-05:00 Zap OccInfo on case binders during StgCse #14895 #24233 StgCse can revive dead binders: case foo of dead { Foo x y -> Foo x y; ... } ===> case foo of dead { Foo x y -> dead; ... } -- dead is no longer dead So we must zap occurrence information on case binders. Fix #14895 and #24233 - - - - - 57c391c4 by Sebastian Graf at 2023-12-06T16:16:37-05:00 Cpr: Turn an assertion into a check to deal with some dead code (#23862) See the new `Note [Dead code may contain type confusions]`. Fixes #23862. - - - - - c1c8abf8 by Zubin Duggal at 2023-12-08T02:25:07-05:00 testsuite: add test for #23944 - - - - - 6329d308 by Zubin Duggal at 2023-12-08T02:25:07-05:00 driver: Only run a dynamic-too pipeline if object files are going to be generated Otherwise we run into a panic in hscMaybeWriteIface: "Unexpected DT_Dyn state when writing simple interface" when dynamic-too is enabled We could remove the panic and just write the interface even if the state is `DT_Dyn`, but it seems pointless to run the pipeline twice when `hscMaybeWriteIface` is already designed to write both `hi` and `dyn_hi` files if dynamic-too is enabled. Fixes #23944. - - - - - 28811f88 by Simon Peyton Jones at 2023-12-08T05:47:18-05:00 Improve duplicate elimination in SpecConstr This partially fixes #24229. See the new Note [Pattern duplicate elimination] in SpecConstr - - - - - fec7894f by Simon Peyton Jones at 2023-12-08T05:47:18-05:00 Make SpecConstr deal with casts better This patch does two things, to fix #23209: * It improves SpecConstr so that it no longer quantifies over coercion variables. See Note [SpecConstr and casts] * It improves the rule matcher to deal nicely with the case where the rule does not quantify over coercion variables, but the the template has a cast in it. See Note [Casts in the template] - - - - - 8db8d2fd by Zubin Duggal at 2023-12-08T05:47:54-05:00 driver: Don't lose track of nodes when we fail to resolve cycles The nodes that take part in a cycle should include both hs-boot and hs files, but when we fail to resolve a cycle, we were only counting the nodes from the graph without boot files. Fixes #24196 - - - - - c5b4efd3 by Zubin Duggal at 2023-12-08T05:48:30-05:00 testsuite: Skip MultiLayerModulesTH_OneShot on darwin See #24177 - - - - - fae472a9 by Wendao Lee at 2023-12-08T05:49:12-05:00 docs(Data.Char):Add more detailed descriptions for some functions Related changed function's docs: -GHC.Unicode.isAlpha -GHC.Unicode.isPrint -GHC.Unicode.isAlphaNum Add more details for what the function will return. Co-authored-by: Bodigrim <andrew.lelechenko at gmail.com> - - - - - ca7510e4 by Malik Ammar Faisal at 2023-12-08T05:49:55-05:00 Fix float parsing in GHC Cmm Lexer Add test case for bug #24224 - - - - - d8baa1bd by Simon Peyton Jones at 2023-12-08T15:40:37+00:00 Take care when simplifying unfoldings This MR fixes a very subtle bug exposed by #24242. See Note [Environment for simplLetUnfolding]. I also updated a bunch of Notes on shadowing - - - - - 03ca551d by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Comments only in FloatIn Relevant to #3458 - - - - - 50c78779 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Comments only in SpecConstr - - - - - 9431e195 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Add test for #22238 - - - - - d9e4c597 by Vladislav Zavialov at 2023-12-11T04:19:34-05:00 Make forall a keyword (#23719) Before this change, GHC used to accept `forall` as a term-level identifier: -- from constraints-0.13 forall :: forall p. (forall a. Dict (p a)) -> Dict (Forall p) forall d = ... Now it is a parse error. The -Wforall-identifier warning has served its purpose and is now a deprecated no-op. - - - - - 58d56644 by Zubin Duggal at 2023-12-11T04:20:10-05:00 driver: Ensure we actually clear the interactive context before reloading Previously we called discardIC, but immediately after set the session back to an old HscEnv that still contained the IC Partially addresses #24107 Fixes #23405 - - - - - 8e5745a0 by Zubin Duggal at 2023-12-11T04:20:10-05:00 driver: Ensure we force the lookup of old build artifacts before returning the build plan This prevents us from retaining all previous build artifacts in memory until a recompile finishes, instead only retaining the exact artifacts we need. Fixes #24118 - - - - - 105c370c by Zubin Duggal at 2023-12-11T04:20:10-05:00 testsuite: add test for #24118 and #24107 MultiLayerModulesDefsGhci was not able to catch the leak because it uses :l which discards the previous environment. Using :r catches both of these leaks - - - - - e822ff88 by Zubin Duggal at 2023-12-11T04:20:10-05:00 compiler: Add some strictness annotations to ImportSpec and related constructors This prevents us from retaining entire HscEnvs. Force these ImportSpecs when forcing the GlobalRdrEltX Adds an NFData instance for Bag Fixes #24107 - - - - - 522c12a4 by Zubin Duggal at 2023-12-11T04:20:10-05:00 compiler: Force IfGlobalRdrEnv in NFData instance. - - - - - 188b280d by Arnaud Spiwack at 2023-12-11T15:33:31+01:00 LinearTypes => MonoLocalBinds - - - - - 8e0446df by Arnaud Spiwack at 2023-12-11T15:44:28+01:00 Linear let and where bindings For expediency, the initial implementation of linear types in GHC made it so that let and where binders would always be considered unrestricted. This was rather unpleasant, and probably a big obstacle to adoption. At any rate, this was not how the proposal was designed. This patch fixes this infelicity. It was surprisingly difficult to build, which explains, in part, why it took so long to materialise. As of this patch, let or where bindings marked with %1 will be linear (respectively %p for an arbitrary multiplicity p). Unmarked let will infer their multiplicity. Here is a prototypical example of program that used to be rejected and is accepted with this patch: ```haskell f :: A %1 -> B g :: B %1 -> C h :: A %1 -> C h x = g y where y = f x ``` Exceptions: - Recursive let are unrestricted, as there isn't a clear semantics of what a linear recursive binding would be. - Destructive lets with lazy bindings are unrestricted, as their desugaring isn't linear (see also #23461). - (Strict) destructive lets with inferred polymorphic type are unrestricted. Because the desugaring isn't linear (See #18461 down-thread). Closes #18461 and #18739 Co-authored-by: @jackohughes - - - - - effa7e2d by Matthew Craven at 2023-12-12T04:37:20-05:00 Introduce `dataToTagSmall#` primop (closes #21710) ...and use it to generate slightly better code when dataToTag# is used at a "small data type" where there is no need to mess with "is_too_big_tag" or potentially look at an info table. Metric Decrease: T18304 - - - - - 35c7aef6 by Matthew Craven at 2023-12-12T04:37:20-05:00 Fix formatting of Note [alg-alt heap check] - - - - - 7397c784 by Oleg Grenrus at 2023-12-12T04:37:56-05:00 Allow untyped brackets in typed splices and vice versa. Resolves #24190 Apparently the check was essentially always (as far as I can trace back: d0d47ba76f8f0501cf3c4966bc83966ab38cac27), and while it does catch some mismatches, the type-checker will catch them too. OTOH, it prevents writing completely reasonable programs. - - - - - a3ee3b99 by Moritz Angermann at 2023-12-12T19:50:58-05:00 Drop hard Xcode dependency XCODE_VERSION calls out to `xcodebuild`, which is only available when having `Xcode` installed. The CommandLineTools are not sufficient. To install Xcode, you must have an apple id to download the Xcode.xip from apple. We do not use xcodebuild anywhere in our build explicilty. At best it appears to be a proxy for checking the linker or the compiler. These should rather be done with ``` xcrun ld -version ``` or similar, and not by proxy through Xcode. The CLR should be sufficient for building software on macOS. - - - - - 1c9496e0 by Vladislav Zavialov at 2023-12-12T19:51:34-05:00 docs: update information on RequiredTypeArguments Update the User's Guide and Release Notes to account for the recent progress in the implementation of RequiredTypeArguments. - - - - - d0b17576 by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Fix off-by-one in assertion Previously we failed to account for the NULL terminator `postString` asserted that there is enough room in the buffer for the string. - - - - - a10f9b9b by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Honor result of ensureRoomForVariableEvent is Previously we would keep plugging along, even if isn't enough room for the event. - - - - - 0e0f41c0 by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Avoid truncating event sizes Previously ensureRoomForVariableEvent would truncate the desired size to 16-bits, resulting in #24197. Fixes #24197. - - - - - 64e724c8 by Artin Ghasivand at 2023-12-13T06:34:20-05:00 Remove the "Derived Constraint" argument of TcPluginSolver, docs - - - - - fe6d97dd by Vladislav Zavialov at 2023-12-13T06:34:56-05:00 EPA: Move tokens into GhcPs extension fields (#23447) Summary of changes * Remove Language.Haskell.Syntax.Concrete * Move all tokens into GhcPs extension fields (LHsToken -> EpToken) * Create new TTG extension fields as needed * Drop the MultAnn wrapper Updates the haddock submodule. Co-authored-by: Alan Zimmerman <alan.zimm at gmail.com> - - - - - 8106e695 by Zubin Duggal at 2023-12-13T06:35:34-05:00 testsuite: use copy_files in T23405 This prevents the tree from being dirtied when the file is modified. - - - - - ed0e4099 by Bryan Richter at 2023-12-14T04:30:53-05:00 Document ghc package's PVP-noncompliance This changes nothing, it just makes the status quo explicit. - - - - - 8bef8d9f by Luite Stegeman at 2023-12-14T04:31:33-05:00 JS: Mark spurious CI failures js_fragile(24259) This marks the spurious test failures on the JS platform as js_fragile(24259), so we don't hold up merge requests while fixing the underlying issues. See #24259 - - - - - 1c79526a by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Late plugins - - - - - 000c3302 by Finley McIlwaine at 2023-12-15T12:24:40-08:00 withTiming on LateCCs and late plugins - - - - - be4551ac by Finley McIlwaine at 2023-12-15T12:24:40-08:00 add test for late plugins - - - - - 7c29da9f by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Document late plugins - - - - - 9a52ae46 by Ben Gamari at 2023-12-20T07:07:26-05:00 Fix thunk update ordering Previously we attempted to ensure soundness of concurrent thunk update by synchronizing on the access of the thunk's info table pointer field. This was believed to be sufficient since the indirectee (which may expose a closure allocated by another core) would not be examined until the info table pointer update is complete. However, it turns out that this can result in data races in the presence of multiple threads racing a update a single thunk. For instance, consider this interleaving under the old scheme: Thread A Thread B --------- --------- t=0 Enter t 1 Push update frame 2 Begin evaluation 4 Pause thread 5 t.indirectee=tso 6 Release t.info=BLACKHOLE 7 ... (e.g. GC) 8 Resume thread 9 Finish evaluation 10 Relaxed t.indirectee=x 11 Load t.info 12 Acquire fence 13 Inspect t.indirectee 14 Release t.info=BLACKHOLE Here Thread A enters thunk `t` but is soon paused, resulting in `t` being lazily blackholed at t=6. Then, at t=10 Thread A finishes evaluation and updates `t.indirectee` with a relaxed store. Meanwhile, Thread B enters the blackhole. Under the old scheme this would introduce an acquire-fence but this would only synchronize with Thread A at t=6. Consequently, the result of the evaluation, `x`, is not visible to Thread B, introducing a data race. We fix this by treating the `indirectee` field as we do all other mutable fields. This means we must always access this field with acquire-loads and release-stores. See #23185. - - - - - f4b53538 by Vladislav Zavialov at 2023-12-20T07:08:02-05:00 docs: Fix link to 051-ghc-base-libraries.rst The proposal is no longer available at the previous URL. - - - - - f7e21fab by Matthew Pickering at 2023-12-21T14:57:40+00:00 hadrian: Build all executables in bin/ folder In the end the bindist creation logic copies them all into the bin folder. There is no benefit to building a specific few binaries in the lib/bin folder anymore. This also removes the ad-hoc logic to copy the touchy and unlit executables from stage0 into stage1. It takes <1s to build so we might as well just build it. - - - - - 0038d052 by Zubin Duggal at 2023-12-22T23:28:00-05:00 testsuite: mark jspace as fragile on i386. This test has been flaky for some time and has been failing consistently on i386-linux since 8e0446df landed. See #24261 - - - - - dfd670a0 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 609e6225 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 865513b2 by Ömer Sinan Ağacan at 2023-12-24T10:11:13-05:00 Fix BNF in user manual 6.6.8.2: formal syntax for instance declarations - - - - - c247b6be by Zubin Duggal at 2023-12-25T16:01:23-05:00 docs: document permissibility of -XOverloadedLabels (#24249) Document the permissibility introduced by https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst - - - - - e5b7eb59 by Ömer Sinan Ağacan at 2023-12-25T16:02:03-05:00 Fix a code block syntax in user manual sec. 6.8.8.6 - - - - - 2db11c08 by Ben Gamari at 2023-12-29T15:35:48-05:00 genSym: Reimplement via CAS on 32-bit platforms Previously the remaining use of the C implementation on 32-bit platforms resulted in a subtle bug, #24261. This was due to the C object (which used the RTS's `atomic_inc64` macro) being compiled without `-threaded` yet later being used in a threaded compiler. Side-step this issue by using the pure Haskell `genSym` implementation on all platforms. This required implementing `fetchAddWord64Addr#` in terms of CAS on 64-bit platforms. - - - - - 19328a8c by Xiaoyan Ren at 2023-12-29T15:36:30-05:00 Do not color the diagnostic code in error messages (#24172) - - - - - 685b467c by Krzysztof Gogolewski at 2023-12-29T15:37:06-05:00 Enforce that bindings of implicit parameters are lifted Fixes #24298 - - - - - bc4d67b7 by Matthew Craven at 2023-12-31T06:15:42-05:00 StgToCmm: Detect some no-op case-continuations ...and generate no code for them. Fixes #24264. - - - - - 5b603139 by Krzysztof Gogolewski at 2023-12-31T06:16:18-05:00 Revert "testsuite: mark jspace as fragile on i386." This reverts commit 0038d052c8c80b4b430bb2aa1c66d5280be1aa95. The atomicity bug should be fixed by !11802. - - - - - d55216ad by Krzysztof Gogolewski at 2024-01-01T12:05:49-05:00 Refactor: store [[PrimRep]] rather than [Type] in STG StgConApp stored a list of types. This list was used exclusively during unarisation of unboxed sums (mkUbxSum). However, this is at a wrong level of abstraction: STG shouldn't be concerned with Haskell types, only PrimReps. Update the code to store a [[PrimRep]]. Also, there's no point in storing this list when we're not dealing with an unboxed sum. - - - - - 8b340bc7 by Ömer Sinan Ağacan at 2024-01-01T12:06:29-05:00 Kind signatures docs: mention that they're allowed in newtypes - - - - - 989bf8e5 by Zubin Duggal at 2024-01-03T20:08:47-05:00 ci: Ensure we use the correct bindist name for the test artifact when generating release ghcup metadata Fixes #24268 - - - - - 89299a89 by Krzysztof Gogolewski at 2024-01-03T20:09:23-05:00 Refactor: remove calls to typePrimRepArgs The function typePrimRepArgs is just a thin wrapper around typePrimRep, adding a VoidRep if the list is empty. However, in StgToByteCode, we were discarding that VoidRep anyway, so there's no point in calling it. - - - - - c7be0c68 by mmzk1526 at 2024-01-03T20:10:07-05:00 Use "-V" for alex version check for better backward compatibility Fixes #24302. In recent versions of alex, "-v" is used for "--verbose" instead of "-version". - - - - - 67dbcc0a by Krzysztof Gogolewski at 2024-01-05T02:07:18-05:00 Fix VoidRep handling in ghci debugger 'go' inside extractSubTerms was giving a bad result given a VoidRep, attempting to round towards the next multiple of 0. I don't understand much about the debugger but the code should be better than it was. Fixes #24306 - - - - - 90ea574e by Krzysztof Gogolewski at 2024-01-05T02:07:54-05:00 VoidRep-related refactor * In GHC.StgToByteCode, replace bcIdPrimId with idPrimRep, bcIdArgRep with idArgRep, atomPrimRep with stgArgRep1. All of them were duplicates. * In GHC.Stg.Unarise, we were converting a PrimRep to a Type and back to PrimRep. Remove the calls to primRepToType and typePrimRep1 which cancel out. * In GHC.STG.Lint, GHC.StgToCmm, GHC.Types.RepType we were filtering out VoidRep from the result of typePrimRep. But typePrimRep never returns VoidRep - remove the filtering. - - - - - eaf72479 by brian at 2024-01-06T23:03:09-05:00 Add unaligned Addr# primops Implements CLC proposal #154: https://github.com/haskell/core-libraries-committee/issues/154 * add unaligned addr primops * add tests * accept tests * add documentation * fix js primops * uncomment in access ops * use Word64 in tests * apply suggestions * remove extra file * move docs * remove random options * use setByteArray# primop * better naming * update base-exports test * add base-exports for other architectures - - - - - d471d445 by Krzysztof Gogolewski at 2024-01-06T23:03:47-05:00 Remove VoidRep from PrimRep, introduce PrimOrVoidRep This introduces data PrimOrVoidRep = VoidRep | NVRep PrimRep changes typePrimRep1 to return PrimOrVoidRep, and adds a new function typePrimRepU to be used when the argument is definitely non-void. Details in Note [VoidRep] in GHC.Types.RepType. Fixes #19520 - - - - - 48720a07 by Matthew Craven at 2024-01-08T18:57:36-05:00 Apply Note [Sensitivity to unique increment] to LargeRecord - - - - - 9e2e180f by Sebastian Graf at 2024-01-08T18:58:13-05:00 Debugging: Add diffUFM for convenient diffing between UniqFMs - - - - - 948f3e35 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Rename Opt_D_dump_stranal to Opt_D_dump_dmdanal ... and Opt_D_dump_str_signatures to Opt_D_dump_dmd_signatures - - - - - 4e217e3e by Sebastian Graf at 2024-01-08T18:58:13-05:00 Deprecate -ddump-stranal and -ddump-str-signatures ... and suggest -ddump-dmdanal and -ddump-dmd-signatures instead - - - - - 6c613c90 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Move testsuite/tests/stranal to testsuite/tests/dmdanal A separate commit so that the rename is obvious to Git(Lab) - - - - - c929f02b by Sebastian Graf at 2024-01-08T18:58:13-05:00 CoreSubst: Stricten `substBndr` and `cloneBndr` Doing so reduced allocations of `cloneBndr` by about 25%. ``` T9233(normal) ghc/alloc 672,488,656 663,083,216 -1.4% GOOD T9675(optasm) ghc/alloc 423,029,256 415,812,200 -1.7% geo. mean -0.1% minimum -1.7% maximum +0.1% ``` Metric Decrease: T9233 - - - - - e3ca78f3 by Krzysztof Gogolewski at 2024-01-10T17:35:59-05:00 Deprecate -Wsemigroup This warning was used to prepare for Semigroup becoming a superclass of Monoid, and for (<>) being exported from Prelude. This happened in GHC 8.4 in 8ae263ceb3566 and feac0a3bc69fd3. The leftover logic for (<>) has been removed in GHC 9.8, 4d29ecdfcc79. Now the warning does nothing at all and can be deprecated. - - - - - 08d14925 by amesgen at 2024-01-10T17:36:42-05:00 WASM metadata: use correct GHC version - - - - - 7a808419 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Allow SCC declarations in TH (#24081) - - - - - 28827c51 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Fix prettyprinting of SCC pragmas - - - - - ae9cc1a8 by Matthew Craven at 2024-01-10T17:38:01-05:00 Fix loopification in the presence of void arguments This also removes Note [Void arguments in self-recursive tail calls], which was just misleading. It's important to count void args both in the function's arity and at the call site. Fixes #24295. - - - - - b718b145 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: Teach testsuite driver about c++ sources - - - - - 09cb57ad by Zubin Duggal at 2024-01-10T17:38:36-05:00 driver: Set -DPROFILING when compiling C++ sources with profiling Earlier, we used to pass all preprocessor flags to the c++ compiler. This meant that -DPROFILING was passed to the c++ compiler because it was a part of C++ flags However, this was incorrect and the behaviour was changed in 8ff3134ed4aa323b0199ad683f72165e51a59ab6. See #21291. But that commit exposed this bug where -DPROFILING was no longer being passed when compiling c++ sources. The fix is to explicitly include -DPROFILING in `opt_cxx` when profiling is enabled to ensure we pass the correct options for the way to both C and C++ compilers Fixes #24286 - - - - - 2cf9dd96 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: rename objcpp -> objcxx To avoid confusion with C Pre Processsor - - - - - af6932d6 by Simon Peyton Jones at 2024-01-10T17:39:12-05:00 Make TYPE and CONSTRAINT not-apart Issue #24279 showed up a bug in the logic in GHC.Core.Unify.unify_ty which is supposed to make TYPE and CONSTRAINT be not-apart. Easily fixed. - - - - - 4a39b5ff by Zubin Duggal at 2024-01-10T17:39:48-05:00 ci: Fix typo in mk_ghcup_metadata.py There was a missing colon in the fix to #24268 in 989bf8e53c08eb22de716901b914b3607bc8dd08 - - - - - 13503451 by Zubin Duggal at 2024-01-10T17:40:24-05:00 release-ci: remove release-x86_64-linux-deb11-release+boot_nonmoving_gc job There is no reason to have this release build or distribute this variation. This configuration is for testing purposes only. - - - - - afca46a4 by Sebastian Graf at 2024-01-10T17:41:00-05:00 Parser: Add a Note detailing why we need happy's `error` to implement layout - - - - - eaf8a06d by Krzysztof Gogolewski at 2024-01-11T00:43:17+01:00 Turn -Wtype-equality-out-of-scope on by default Also remove -Wnoncanonical-{monoid,monad}-instances from -Wcompat, since they are enabled by default. Refresh wcompat-warnings/ test with new -Wcompat warnings. Part of #24267 Co-authored-by: sheaf <sam.derbyshire at gmail.com> - - - - - 42bee5aa by Sebastian Graf at 2024-01-12T21:16:21-05:00 Arity: Require called *exactly once* for eta exp with -fpedantic-bottoms (#24296) In #24296, we had a program in which we eta expanded away an error despite the presence of `-fpedantic-bottoms`. This was caused by turning called *at least once* lambdas into one-shot lambdas, while with `-fpedantic-bottoms` it is only sound to eta expand over lambdas that are called *exactly* once. An example can be found in `Note [Combining arity type with demand info]`. Fixes #24296. - - - - - 7e95f738 by Andreas Klebinger at 2024-01-12T21:16:57-05:00 Aarch64: Enable -mfma by default. Fixes #24311 - - - - - e43788d0 by Jason Shipman at 2024-01-14T12:47:38-05:00 Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat CLC proposal #226 https://github.com/haskell/core-libraries-committee/issues/226 - - - - - ae6d8cd2 by Sebastian Graf at 2024-01-14T12:48:15-05:00 Pmc: COMPLETE pragmas associated with Family TyCons should apply to representation TyCons as well (#24326) Fixes #24326. - - - - - c5fc7304 by sheaf at 2024-01-15T14:15:29-05:00 Use lookupOccRn_maybe in TH.lookupName When looking up a value, we want to be able to find both variables and record fields. So we should not use the lookupSameOccRn_maybe function, as we can't know ahead of time which record field namespace a record field with the given textual name will belong to. Fixes #24293 - - - - - da908790 by Krzysztof Gogolewski at 2024-01-15T14:16:05-05:00 Make the build more strict on documentation errors * Detect undefined labels. This can be tested by adding :ref:`nonexistent` to a documentation rst file; attempting to build docs will fail. Fixed the undefined label in `9.8.1-notes.rst`. * Detect errors. While we have plenty of warnings, we can at least enforce that Sphinx does not report errors. Fixed the error in `required_type_arguments.rst`. Unrelated change: I have documented that the `-dlint` enables `-fcatch-nonexhaustive-cases`, as can be verified by checking `enableDLint`. - - - - - 5077416e by Javier Sagredo at 2024-01-16T15:40:06-05:00 Profiling: Adds an option to not start time profiling at startup Using the functionality provided by d89deeba47ce04a5198a71fa4cbc203fe2c90794, this patch creates a new rts flag `--no-automatic-time-samples` which disables the time profiling when starting a program. It is then expected that the user starts it whenever it is needed. Fixes #24337 - - - - - 5776008c by Matthew Pickering at 2024-01-16T15:40:42-05:00 eventlog: Fix off-by-one error in postIPE We were missing the extra_comma from the calculation of the size of the payload of postIPE. This was causing assertion failures when the event would overflow the buffer by one byte, as ensureRoomForVariable event would report there was enough space for `n` bytes but then we would write `n + 1` bytes into the buffer. Fixes #24287 - - - - - 66dc09b1 by Simon Peyton Jones at 2024-01-16T15:41:18-05:00 Improve SpecConstr (esp nofib/spectral/ansi) This MR makes three improvements to SpecConstr: see #24282 * It fixes an outright (and recently-introduced) bug in `betterPat`, which was wrongly forgetting to compare the lengths of the argument lists. * It enhances ConVal to inclue a boolean for work-free-ness, so that the envt can contain non-work-free constructor applications, so that we can do more: see Note [ConVal work-free-ness] * It rejigs `subsumePats` so that it doesn't reverse the list. This can make a difference because, when patterns overlap, we arbitrarily pick the first. There is no "right" way, but this retains the old pre-subsumePats behaviour, thereby "fixing" the regression in #24282. Nofib results +======================================== | spectral/ansi -21.14% | spectral/hartel/comp_lab_zift -0.12% | spectral/hartel/parstof +0.09% | spectral/last-piece -2.32% | spectral/multiplier +6.03% | spectral/para +0.60% | spectral/simple -0.26% +======================================== | geom mean -0.18% +---------------------------------------- The regression in `multiplier` is sad, but it simply replicates GHC's previous behaviour (e.g. GHC 9.6). - - - - - 65da79b3 by Matthew Pickering at 2024-01-16T15:41:54-05:00 hadrian: Reduce Cabal verbosity The comment claims that `simpleUserHooks` decrease verbosity, and it does, but only for the `postConf` phase. The other phases are too verbose with `-V`. At the moment > 5000 lines of the build log are devoted to output from `cabal copy`. So I take the simple approach and just decrease the verbosity level again. If the output of `postConf` is essential then it would be better to implement our own `UserHooks` which doesn't decrease the verbosity for `postConf`. Fixes #24338 - - - - - 16414d7d by Matthew Pickering at 2024-01-17T10:54:59-05:00 Stop retaining old ModGuts throughout subsequent simplifier phases Each phase of the simplifier typically rewrites the majority of ModGuts, so we want to be able to release the old ModGuts as soon as possible. `name_ppr_ctxt` lives throught the whole optimiser phase and it was retaining a reference to `ModGuts`, so we were failing to release the old `ModGuts` until the end of the phase (potentially doubling peak memory usage for that particular phase). This was discovered using eras profiling (#24332) Fixes #24328 - - - - - 7f0879e1 by Matthew Pickering at 2024-01-17T10:55:35-05:00 Update nofib submodule - - - - - 320454d3 by Cheng Shao at 2024-01-17T23:02:40+00:00 ci: bump ci-images for updated wasm image - - - - - 2eca52b4 by Cheng Shao at 2024-01-17T23:06:44+00:00 base: treat all FDs as "nonblocking" on wasm On posix platforms, when performing read/write on FDs, we check the nonblocking flag first. For FDs without this flag (e.g. stdout), we call fdReady() first, which in turn calls poll() to wait for I/O to be available on that FD. This is problematic for wasm32-wasi: although select()/poll() is supported via the poll_oneoff() wasi syscall, that syscall is rather heavyweight and runtime behavior differs in different wasi implementations. The issue is even worse when targeting browsers, given there's no satisfactory way to implement async I/O as a synchronous syscall, so existing JS polyfills for wasi often give up and simply return ENOSYS. Before we have a proper I/O manager that avoids poll_oneoff() for async I/O on wasm, this patch improves the status quo a lot by merely pretending all FDs are "nonblocking". Read/write on FDs will directly invoke read()/write(), which are much more reliably handled in existing wasi implementations, especially those in browsers. Fixes #23275 and the following test cases: T7773 isEOF001 openFile009 T4808 cgrun025 Approved by CLC proposal #234: https://github.com/haskell/core-libraries-committee/issues/234 - - - - - 83c6c710 by Andrew Lelechenko at 2024-01-18T05:21:49-05:00 base: clarify how to disable warnings about partiality of Data.List.{head,tail} - - - - - c4078f2f by Simon Peyton Jones at 2024-01-18T05:22:25-05:00 Fix four bug in handling of (forall cv. body_ty) These bugs are all described in #24335 It's not easy to provoke the bug, hence no test case. - - - - - 119586ea by Alexis King at 2024-01-19T00:08:00-05:00 Always refresh profiling CCSes after running pending initializers Fixes #24171. - - - - - 9718d970 by Oleg Grenrus at 2024-01-19T00:08:36-05:00 Set default-language: GHC2021 in ghc library Go through compiler/ sources, and remove all BangPatterns (and other GHC2021 enabled extensions in these files). - - - - - 3ef71669 by Matthew Pickering at 2024-01-19T21:55:16-05:00 testsuite: Remove unused have_library function Also remove the hence unused testsuite option `--test-package-db`. Fixes #24342 - - - - - 5b7fa20c by Jade at 2024-01-19T21:55:53-05:00 Fix Spelling in the compiler Tracking: #16591 - - - - - 09875f48 by Matthew Pickering at 2024-01-20T12:20:44-05:00 testsuite: Implement `isInTreeCompiler` in a more robust way Just a small refactoring to avoid redundantly specifying the same strings in two different places. - - - - - 0d12b987 by Jade at 2024-01-20T12:21:20-05:00 Change maintainer email from cvs-ghc at haskell.org to ghc-devs at haskell.org. Fixes #22142 - - - - - 1fa1c00c by Jade at 2024-01-23T19:17:03-05:00 Enhance Documentation of functions exported by Data.Function This patch aims to improve the documentation of functions exported in Data.Function Tracking: #17929 Fixes: #10065 - - - - - ab47a43d by Jade at 2024-01-23T19:17:39-05:00 Improve documentation of hGetLine. - Add explanation for whether a newline is returned - Add examples Fixes #14804 - - - - - dd4af0e5 by Cheng Shao at 2024-01-23T19:18:17-05:00 Fix genapply for cross-compilation by nuking fragile CPP logic This commit fixes incorrectly built genapply when cross compiling (#24347) by nuking all fragile CPP logic in it from the orbit. All target-specific info are now read from DerivedConstants.h at runtime, see added note for details. Also removes a legacy Makefile and adds haskell language server support for genapply. - - - - - 0cda2b8b by Cheng Shao at 2024-01-23T19:18:17-05:00 rts: enable wasm32 register mapping The wasm backend didn't properly make use of all Cmm global registers due to #24347. Now that it is fixed, this patch re-enables full register mapping for wasm32, and we can now generate smaller & faster wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152. - - - - - 0325a6e5 by Greg Steuck at 2024-01-24T01:29:44-05:00 Avoid utf8 in primops.txt.pp comments They don't make it through readFile' without explicitly setting the encoding. See https://gitlab.haskell.org/ghc/ghc/-/issues/17755 - - - - - 1aaf0bd8 by David Binder at 2024-01-24T01:30:20-05:00 Bump hpc and hpc-bin submodule Bump hpc to 0.7.0.1 Bump hpc-bin to commit d1780eb2 - - - - - e693a4e8 by Ben Gamari at 2024-01-24T01:30:56-05:00 testsuite: Ignore stderr in T8089 Otherwise spurious "Killed: 9" messages to stderr may cause the test to fail. Fixes #24361. - - - - - a40f4ab2 by sheaf at 2024-01-24T14:04:33-05:00 Fix FMA instruction on LLVM We were emitting the wrong instructions for fused multiply-add operations on LLVM: - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd" - LLVM does not support other instructions such as "fmsub"; instead we implement these by flipping signs of some arguments - the instruction is an LLVM intrinsic, which requires handling it like a normal function call instead of a machine instruction Fixes #24223 - - - - - 69abc786 by Andrei Borzenkov at 2024-01-24T14:05:09-05:00 Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291) - - - - - 0ac8f385 by Cheng Shao at 2024-01-25T00:27:48-05:00 compiler: remove unused GHC.Linker module The GHC.Linker module is empty and unused, other than as a hack for the make build system. We can remove it now that make is long gone; the note is moved to GHC.Linker.Loader instead. - - - - - 699da01b by Hécate Moonlight at 2024-01-25T00:28:27-05:00 Clarification for newtype constructors when using `coerce` - - - - - b2d8cd85 by Matt Walker at 2024-01-26T09:50:08-05:00 Fix #24308 Add tests for semicolon separated where clauses - - - - - 0da490a1 by Ben Gamari at 2024-01-26T17:34:41-05:00 hsc2hs: Bump submodule - - - - - 3f442fd2 by Ben Gamari at 2024-01-26T17:34:41-05:00 Bump containers submodule to 0.7 - - - - - 82a1c656 by Sebastian Nagel at 2024-01-29T02:32:40-05:00 base: with{Binary}File{Blocking} only annotates own exceptions Fixes #20886 This ensures that inner, unrelated exceptions are not misleadingly annotated with the opened file. - - - - - 9294a086 by Andreas Klebinger at 2024-01-29T02:33:15-05:00 Fix fma warning when using llvm on aarch64. On aarch64 fma is always on so the +fma flag doesn't exist for that target. Hence no need to try and pass +fma to llvm. Fixes #24379 - - - - - ced2e731 by sheaf at 2024-01-29T17:27:12-05:00 No shadowing warnings for NoFieldSelector fields This commit ensures we don't emit shadowing warnings when a user shadows a field defined with NoFieldSelectors. Fixes #24381 - - - - - 8eeadfad by Patrick at 2024-01-29T17:27:51-05:00 Fix bug wrong span of nested_doc_comment #24378 close #24378 1. Update the start position of span in `nested_doc_comment` correctly. and hence the spans of identifiers of haddoc can be computed correctly. 2. add test `HaddockSpanIssueT24378`. - - - - - a557580f by Alexey Radkov at 2024-01-30T19:41:52-05:00 Fix irrelevant dodgy-foreign-imports warning on import f-pointers by value A test *сс018* is attached (not sure about the naming convention though). Note that without the fix, the test fails with the *dodgy-foreign-imports* warning passed to stderr. The warning disappears after the fix. GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as ```haskell foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ()) ``` where ```c void (*f)(int); ``` See a related real-world use-case [here](https://gitlab.com/daniel-casanueva/pcre-light/-/merge_requests/17). There, GHC warns on import of C function pointer `pcre_free`. - - - - - ca99efaf by Alexey Radkov at 2024-01-30T19:41:53-05:00 Rename test cc018 -> T24034 - - - - - 88c38dd5 by Ben Gamari at 2024-01-30T19:42:28-05:00 rts/TraverseHeap.c: Ensure that PosixSource.h is included first - - - - - ca2e919e by Simon Peyton Jones at 2024-01-31T09:29:45+00:00 Make decomposeRuleLhs a bit more clever This fixes #24370 by making decomposeRuleLhs undertand dictionary /functions/ as well as plain /dictionaries/ - - - - - 94ce031d by Teo Camarasu at 2024-02-01T05:49:49-05:00 doc: Add -Dn flag to user guide Resolves #24394 - - - - - 31553b11 by Ben Gamari at 2024-02-01T12:21:29-05:00 cmm: Introduce MO_RelaxedRead In hand-written Cmm it can sometimes be necessary to atomically load from memory deep within an expression (e.g. see the `CHECK_GC` macro). This MachOp provides a convenient way to do so without breaking the expression into multiple statements. - - - - - 0785cf81 by Ben Gamari at 2024-02-01T12:21:29-05:00 codeGen: Use relaxed accesses in ticky bumping - - - - - be423dda by Ben Gamari at 2024-02-01T12:21:29-05:00 base: use atomic write when updating timer manager - - - - - 8a310e35 by Ben Gamari at 2024-02-01T12:21:29-05:00 Use relaxed atomics to manipulate TSO status fields - - - - - d6809ee4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Add necessary barriers when manipulating TSO owner - - - - - 39e3ac5d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Use `switch` to branch on why_blocked This is a semantics-preserving refactoring. - - - - - 515eb33d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix synchronization on thread blocking state We now use a release barrier whenever we update a thread's blocking state. This required widening StgTSO.why_blocked as AArch64 does not support atomic writes on 16-bit values. - - - - - eb38812e by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadPaused This only affects an assertion in the debug RTS and only needs relaxed ordering. - - - - - 26c48dd6 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadStatus# - - - - - 6af43ab4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in Interpreter's preemption check - - - - - 9502ad3c by Ben Gamari at 2024-02-01T12:21:29-05:00 rts/Messages: Fix data race - - - - - 60802db5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts/Prof: Fix data race - - - - - ef8ccef5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use relaxed ordering on dirty/clean info tables updates When changing the dirty/clean state of a mutable object we needn't have any particular ordering. - - - - - 76fe2b75 by Ben Gamari at 2024-02-01T12:21:30-05:00 codeGen: Use relaxed-read in closureInfoPtr - - - - - a6316eb4 by Ben Gamari at 2024-02-01T12:21:30-05:00 STM: Use acquire loads when possible Full sequential consistency is not needed here. - - - - - 6bddfd3d by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use fence rather than redundant load Previously we would use an atomic load to ensure acquire ordering. However, we now have `ACQUIRE_FENCE_ON`, which allows us to express this more directly. - - - - - 55c65dbc by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Fix data races in profiling timer - - - - - 856b5e75 by Ben Gamari at 2024-02-01T12:21:30-05:00 Add Note [C11 memory model] - - - - - 6534da24 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: move generic cmm optimization logic in NCG to a standalone module This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. - - - - - 87e34888 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. - - - - - c6ce242e by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: enable generic cmm optimizations in wasm backend NCG This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. - - - - - 151dda4e by Andrei Borzenkov at 2024-02-01T12:22:43-05:00 Namespacing for WARNING/DEPRECATED pragmas (#24396) New syntax for WARNING and DEPRECATED pragmas was added, namely namespace specifierss: namespace_spec ::= 'type' | 'data' | {- empty -} warning ::= warning_category namespace_spec namelist strings deprecation ::= namespace_spec namelist strings A new data type was introduced to represent these namespace specifiers: data NamespaceSpecifier = NoSpecifier | TypeNamespaceSpecifier (EpToken "type") | DataNamespaceSpecifier (EpToken "data") Extension field XWarning now contains this NamespaceSpecifier. lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier and checks that the namespace of the found names matches the passed flag. With this change {-# WARNING data D "..." #-} pragma will only affect value namespace and {-# WARNING type D "..." #-} will only affect type namespace. The same logic is applicable to DEPRECATED pragmas. Finding duplicated warnings inside rnSrcWarnDecls now takes into consideration NamespaceSpecifier flag to allow warnings with the same names that refer to different namespaces. - - - - - 38c3afb6 by Bryan Richter at 2024-02-01T12:23:19-05:00 CI: Disable the test-cabal-reinstall job Fixes #24363 - - - - - 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 1d0ad63c by Simon Peyton Jones at 2024-03-05T14:57:34+00:00 Solve #22423 by inlining only values in callSiteInline Needs a proper commit message ... this is just to try it out. - - - - - 85d8099a by Simon Peyton Jones at 2024-03-06T11:23:09+00:00 Refine exprIsWorkFree This makes it a bit less eager to inline multi-branch cases. - - - - - 15 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/merge_request_templates/Default.md - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py - .gitlab/rel_eng/upload.sh - .gitmodules - CODEOWNERS - compiler/GHC.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1c525ee1f08a51a88df75a152c54b2a867f2d99e...85d8099a261e7c890620c1ac7cfd81268f60a723 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1c525ee1f08a51a88df75a152c54b2a867f2d99e...85d8099a261e7c890620c1ac7cfd81268f60a723 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 12:11:56 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Wed, 06 Mar 2024 07:11:56 -0500 Subject: [Git][ghc/ghc][wip/T22423] Wibble Message-ID: <65e85d8cf33b4_38980e1ead7f0165cb@gitlab.mail> Simon Peyton Jones pushed to branch wip/T22423 at Glasgow Haskell Compiler / GHC Commits: dea92489 by Simon Peyton Jones at 2024-03-06T12:11:46+00:00 Wibble - - - - - 1 changed file: - compiler/GHC/Core/Utils.hs Changes: ===================================== compiler/GHC/Core/Utils.hs ===================================== @@ -1350,7 +1350,7 @@ exprIsWorkFree e = ok e go _ (Type {}) = True go _ (Coercion {}) = True go n (Cast e _) = go n e - go n (Case scrut _ _ alts) = ok_alts alts && ok scrut + go _ (Case scrut _ _ alts) = ok_alts alts && ok scrut go n (Tick t e) | tickishCounts t = False | otherwise = go n e go n (Lam x e) | isRuntimeVar x = n==0 || go (n-1) e View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dea9248975c4943e1554dc2f268a3d492bfe32ba -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dea9248975c4943e1554dc2f268a3d492bfe32ba You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 12:58:58 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Wed, 06 Mar 2024 07:58:58 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: rts: expose HeapAlloc.h as public header Message-ID: <65e868923a805_38980e36734fc2409c@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 2f70df21 by Cheng Shao at 2024-03-06T07:58:49-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - 40dd48c9 by Cheng Shao at 2024-03-06T07:58:49-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 23cf680a by Ben Gamari at 2024-03-06T07:58:49-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - e04d3828 by Simon Peyton Jones at 2024-03-06T07:58:49-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 5a1dd7cb by Hécate Moonlight at 2024-03-06T07:58:54-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 30 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs - libraries/base/src/System/IO.hs - libraries/base/src/System/Mem/Weak.hs - libraries/base/src/System/Posix/Internals.hs - libraries/base/src/Text/ParserCombinators/ReadP.hs - libraries/base/src/Text/ParserCombinators/ReadPrec.hs - libraries/base/src/Text/Read.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - rts/Sparks.c - rts/include/rts/storage/Block.h - rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h - rts/posix/OSMem.c - rts/rts.cabal - rts/sm/CNF.c - rts/sm/GC.h - rts/sm/NonMoving.h - rts/sm/NonMovingMark.c - rts/sm/Sanity.c The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/99474b0aed8a30d4a3a024f4f88a94abbd1a6e01...5a1dd7cba418cf0866db91cd81fa45f2445c93ec -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/99474b0aed8a30d4a3a024f4f88a94abbd1a6e01...5a1dd7cba418cf0866db91cd81fa45f2445c93ec You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 13:26:39 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Wed, 06 Mar 2024 08:26:39 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T24031 Message-ID: <65e86f0fc9474_38980e41d9684357c8@gitlab.mail> Teo Camarasu pushed new branch wip/T24031 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24031 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 13:29:09 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Wed, 06 Mar 2024 08:29:09 -0500 Subject: [Git][ghc/ghc][wip/T24031] Deprecate PrimTyConI Message-ID: <65e86fa511f56_38980e443c0d4359eb@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: c6a95112 by Teo Camarasu at 2024-03-06T13:28:57+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 7 changed files: - compiler/GHC/Tc/Gen/Splice.hs - libraries/template-haskell/Language/Haskell/TH/Syntax.hs - libraries/template-haskell/changelog.md - testsuite/tests/th/T16293b.hs - + testsuite/tests/th/T24031.hs - + testsuite/tests/th/T24031.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/Splice.hs ===================================== @@ -2120,15 +2120,6 @@ reifyTyCon tc | Just cls <- tyConClass_maybe tc = reifyClass cls -{- Seems to be just a short cut for the next equation -- omit - | tc `hasKey` fUNTyConKey -- I'm not quite sure what is happening here - = return (TH.PrimTyConI (reifyName tc) 2 False) --} - - | isPrimTyCon tc - = return (TH.PrimTyConI (reifyName tc) (length (tyConVisibleTyVars tc)) - (isUnliftedTypeKind (tyConResKind tc))) - | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc res_kind = tyConResKind tc ===================================== libraries/template-haskell/Language/Haskell/TH/Syntax.hs ===================================== @@ -2068,6 +2068,7 @@ data Info Name Type -- What it is bound to deriving( Show, Eq, Ord, Data, Generic ) +{-# DEPRECATED PrimTyConI "TyConI is now produced instead." #-} -- | Obtained from 'reifyModule' in the 'Q' Monad. data ModuleInfo = ===================================== libraries/template-haskell/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) +## 2.23.0.0 + * Deprecate `PrimTyConI`. `TyConI` will now produced to represent primitive types. + ## 2.22.0.0 * The kind of `Code` was changed from `forall r. (Type -> Type) -> TYPE r -> Type` ===================================== testsuite/tests/th/T16293b.hs ===================================== @@ -7,7 +7,8 @@ import GHC.Exts import Language.Haskell.TH f :: () -f = $(do PrimTyConI _ arity _ <- reify ''Proxy# +f = $(do TyConI (DataD _ _ targs _ _ _) <- reify ''Proxy# + let arity = length targs unless (arity == 1) $ fail $ "Unexpected arity for Proxy#: " ++ show arity [| () |]) ===================================== testsuite/tests/th/T24031.hs ===================================== @@ -0,0 +1,38 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE LinearTypes #-} +-- | This test shows that we can reify a bunch of wired-in types. +-- Additionally it acts as a golden test to ensure that we don't accidentally change +-- our output for these types. +module T24031 where + +import Control.Monad +import Data.Char +import GHC.Exts +import Language.Haskell.TH + +f :: () +f = $(do let types = + [ ''Int# + , ''Word# + , ''Array# + , ''SmallArray# + , ''ByteArray# + , ''MutableByteArray# + , unboxedTupleTypeName 2 + , unboxedSumTypeName 2 + , ''(->) + , ''[] + , tupleTypeName 2 + ] + reified <- mapM reify types + let stripInt [] = [] + stripInt (x:xs) + | isDigit x = stripInt xs + | otherwise = x:xs + -- remove _[0-9]* sequences + let stripUniques ('_':xs) = stripUniques $ stripInt xs + stripUniques (x:xs)= x:stripUniques xs + stripUniques [] = [] + mapM_ (runIO . putStrLn . stripUniques . show) reified + [| () |]) ===================================== testsuite/tests/th/T24031.stderr ===================================== @@ -0,0 +1,11 @@ +TyConI (DataD [] GHC.Prim.Int# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Array# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallArray# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.ByteArray# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableByteArray# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Types.Tuple2# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k0)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k1))] Nothing [NormalC GHC.Types.(#,#) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a),(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) +TyConI (DataD [] GHC.Types.Sum2# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k0)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k1))] Nothing [NormalC GHC.Types.(# | #) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a)],NormalC GHC.Types.(# | #) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) +TyConI (TySynD GHC.Types.-> [] (AppT (ConT GHC.Prim.FUN) (PromotedT GHC.Types.Many))) +TyConI (DataD [] GHC.Types.List [KindedTV a BndrReq StarT] Nothing [NormalC GHC.Types.[] [],InfixC (Bang NoSourceUnpackedness NoSourceStrictness,VarT a) GHC.Types.: (Bang NoSourceUnpackedness NoSourceStrictness,AppT ListT (VarT a))] []) +TyConI (DataD [] GHC.Tuple.Tuple2 [KindedTV a BndrReq StarT,KindedTV b BndrReq StarT] Nothing [NormalC GHC.Tuple.(,) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a),(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24031', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c6a95112495c5da4667900421266263a9ad4b908 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c6a95112495c5da4667900421266263a9ad4b908 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 13:31:07 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Wed, 06 Mar 2024 08:31:07 -0500 Subject: [Git][ghc/ghc][wip/T24031] Deprecate PrimTyConI Message-ID: <65e8701b8093d_38980e46ae0ec3772b@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: bf081986 by Teo Camarasu at 2024-03-06T13:30:58+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 7 changed files: - compiler/GHC/Tc/Gen/Splice.hs - libraries/template-haskell/Language/Haskell/TH/Syntax.hs - libraries/template-haskell/changelog.md - testsuite/tests/th/T16293b.hs - + testsuite/tests/th/T24031.hs - + testsuite/tests/th/T24031.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/Splice.hs ===================================== @@ -2120,15 +2120,6 @@ reifyTyCon tc | Just cls <- tyConClass_maybe tc = reifyClass cls -{- Seems to be just a short cut for the next equation -- omit - | tc `hasKey` fUNTyConKey -- I'm not quite sure what is happening here - = return (TH.PrimTyConI (reifyName tc) 2 False) --} - - | isPrimTyCon tc - = return (TH.PrimTyConI (reifyName tc) (length (tyConVisibleTyVars tc)) - (isUnliftedTypeKind (tyConResKind tc))) - | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc res_kind = tyConResKind tc ===================================== libraries/template-haskell/Language/Haskell/TH/Syntax.hs ===================================== @@ -2068,6 +2068,7 @@ data Info Name Type -- What it is bound to deriving( Show, Eq, Ord, Data, Generic ) +{-# DEPRECATED PrimTyConI "TyConI is now produced instead." #-} -- | Obtained from 'reifyModule' in the 'Q' Monad. data ModuleInfo = ===================================== libraries/template-haskell/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) +## 2.23.0.0 + * Deprecate `PrimTyConI`. `TyConI` will now be produced to represent primitive types. + ## 2.22.0.0 * The kind of `Code` was changed from `forall r. (Type -> Type) -> TYPE r -> Type` ===================================== testsuite/tests/th/T16293b.hs ===================================== @@ -7,7 +7,8 @@ import GHC.Exts import Language.Haskell.TH f :: () -f = $(do PrimTyConI _ arity _ <- reify ''Proxy# +f = $(do TyConI (DataD _ _ targs _ _ _) <- reify ''Proxy# + let arity = length targs unless (arity == 1) $ fail $ "Unexpected arity for Proxy#: " ++ show arity [| () |]) ===================================== testsuite/tests/th/T24031.hs ===================================== @@ -0,0 +1,38 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE LinearTypes #-} +-- | This test shows that we can reify a bunch of wired-in types. +-- Additionally it acts as a golden test to ensure that we don't accidentally change +-- our output for these types. +module T24031 where + +import Control.Monad +import Data.Char +import GHC.Exts +import Language.Haskell.TH + +f :: () +f = $(do let types = + [ ''Int# + , ''Word# + , ''Array# + , ''SmallArray# + , ''ByteArray# + , ''MutableByteArray# + , unboxedTupleTypeName 2 + , unboxedSumTypeName 2 + , ''(->) + , ''[] + , tupleTypeName 2 + ] + reified <- mapM reify types + let stripInt [] = [] + stripInt (x:xs) + | isDigit x = stripInt xs + | otherwise = x:xs + -- remove _[0-9]* sequences + let stripUniques ('_':xs) = stripUniques $ stripInt xs + stripUniques (x:xs)= x:stripUniques xs + stripUniques [] = [] + mapM_ (runIO . putStrLn . stripUniques . show) reified + [| () |]) ===================================== testsuite/tests/th/T24031.stderr ===================================== @@ -0,0 +1,11 @@ +TyConI (DataD [] GHC.Prim.Int# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Array# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallArray# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.ByteArray# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableByteArray# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Types.Tuple2# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k0)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k1))] Nothing [NormalC GHC.Types.(#,#) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a),(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) +TyConI (DataD [] GHC.Types.Sum2# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k0)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k1))] Nothing [NormalC GHC.Types.(# | #) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a)],NormalC GHC.Types.(# | #) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) +TyConI (TySynD GHC.Types.-> [] (AppT (ConT GHC.Prim.FUN) (PromotedT GHC.Types.Many))) +TyConI (DataD [] GHC.Types.List [KindedTV a BndrReq StarT] Nothing [NormalC GHC.Types.[] [],InfixC (Bang NoSourceUnpackedness NoSourceStrictness,VarT a) GHC.Types.: (Bang NoSourceUnpackedness NoSourceStrictness,AppT ListT (VarT a))] []) +TyConI (DataD [] GHC.Tuple.Tuple2 [KindedTV a BndrReq StarT,KindedTV b BndrReq StarT] Nothing [NormalC GHC.Tuple.(,) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a),(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24031', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bf081986c318dd63302ac5f93b9ef591696e7152 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bf081986c318dd63302ac5f93b9ef591696e7152 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 13:37:54 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Wed, 06 Mar 2024 08:37:54 -0500 Subject: [Git][ghc/ghc][wip/T24031] Deprecate PrimTyConI Message-ID: <65e871b27f9ba_38980e49aa19c3829@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: e4238ae8 by Teo Camarasu at 2024-03-06T13:37:46+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 7 changed files: - compiler/GHC/Tc/Gen/Splice.hs - libraries/template-haskell/Language/Haskell/TH/Syntax.hs - libraries/template-haskell/changelog.md - testsuite/tests/th/T16293b.hs - + testsuite/tests/th/T24031.hs - + testsuite/tests/th/T24031.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/Splice.hs ===================================== @@ -2120,15 +2120,6 @@ reifyTyCon tc | Just cls <- tyConClass_maybe tc = reifyClass cls -{- Seems to be just a short cut for the next equation -- omit - | tc `hasKey` fUNTyConKey -- I'm not quite sure what is happening here - = return (TH.PrimTyConI (reifyName tc) 2 False) --} - - | isPrimTyCon tc - = return (TH.PrimTyConI (reifyName tc) (length (tyConVisibleTyVars tc)) - (isUnliftedTypeKind (tyConResKind tc))) - | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc res_kind = tyConResKind tc ===================================== libraries/template-haskell/Language/Haskell/TH/Syntax.hs ===================================== @@ -2068,6 +2068,7 @@ data Info Name Type -- What it is bound to deriving( Show, Eq, Ord, Data, Generic ) +{-# DEPRECATED PrimTyConI "TyConI is now produced instead." #-} -- | Obtained from 'reifyModule' in the 'Q' Monad. data ModuleInfo = ===================================== libraries/template-haskell/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) +## 2.23.0.0 + * `PrimTyConI` has been deprecated. `TyConI` will now be used to represent primitive types. + ## 2.22.0.0 * The kind of `Code` was changed from `forall r. (Type -> Type) -> TYPE r -> Type` ===================================== testsuite/tests/th/T16293b.hs ===================================== @@ -7,7 +7,8 @@ import GHC.Exts import Language.Haskell.TH f :: () -f = $(do PrimTyConI _ arity _ <- reify ''Proxy# +f = $(do TyConI (DataD _ _ targs _ _ _) <- reify ''Proxy# + let arity = length targs unless (arity == 1) $ fail $ "Unexpected arity for Proxy#: " ++ show arity [| () |]) ===================================== testsuite/tests/th/T24031.hs ===================================== @@ -0,0 +1,38 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE LinearTypes #-} +-- | This test shows that we can reify a bunch of wired-in types. +-- Additionally it acts as a golden test to ensure that we don't accidentally change +-- our output for these types. +module T24031 where + +import Control.Monad +import Data.Char +import GHC.Exts +import Language.Haskell.TH + +f :: () +f = $(do let types = + [ ''Int# + , ''Word# + , ''Array# + , ''SmallArray# + , ''ByteArray# + , ''MutableByteArray# + , unboxedTupleTypeName 2 + , unboxedSumTypeName 2 + , ''(->) + , ''[] + , tupleTypeName 2 + ] + reified <- mapM reify types + let stripInt [] = [] + stripInt (x:xs) + | isDigit x = stripInt xs + | otherwise = x:xs + -- remove _[0-9]* sequences + let stripUniques ('_':xs) = stripUniques $ stripInt xs + stripUniques (x:xs)= x:stripUniques xs + stripUniques [] = [] + mapM_ (runIO . putStrLn . stripUniques . show) reified + [| () |]) ===================================== testsuite/tests/th/T24031.stderr ===================================== @@ -0,0 +1,11 @@ +TyConI (DataD [] GHC.Prim.Int# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Array# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallArray# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.ByteArray# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableByteArray# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Types.Tuple2# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k0)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k1))] Nothing [NormalC GHC.Types.(#,#) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a),(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) +TyConI (DataD [] GHC.Types.Sum2# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k0)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT k1))] Nothing [NormalC GHC.Types.(# | #) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a)],NormalC GHC.Types.(# | #) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) +TyConI (TySynD GHC.Types.-> [] (AppT (ConT GHC.Prim.FUN) (PromotedT GHC.Types.Many))) +TyConI (DataD [] GHC.Types.List [KindedTV a BndrReq StarT] Nothing [NormalC GHC.Types.[] [],InfixC (Bang NoSourceUnpackedness NoSourceStrictness,VarT a) GHC.Types.: (Bang NoSourceUnpackedness NoSourceStrictness,AppT ListT (VarT a))] []) +TyConI (DataD [] GHC.Tuple.Tuple2 [KindedTV a BndrReq StarT,KindedTV b BndrReq StarT] Nothing [NormalC GHC.Tuple.(,) [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a),(Bang NoSourceUnpackedness NoSourceStrictness,VarT b)]] []) ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24031', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e4238ae80bcec3fc44e6972bb19f3e0232b7937d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e4238ae80bcec3fc44e6972bb19f3e0232b7937d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 14:09:52 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Wed, 06 Mar 2024 09:09:52 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/supersven/AArch64_takeRegRegMoveInst Message-ID: <65e879308bac7_38980e57bb1c84056c@gitlab.mail> Sven Tennie pushed new branch wip/supersven/AArch64_takeRegRegMoveInst at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/supersven/AArch64_takeRegRegMoveInst You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 14:53:22 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Wed, 06 Mar 2024 09:53:22 -0500 Subject: [Git][ghc/ghc][wip/T24031] Deprecate PrimTyConI Message-ID: <65e8836277893_38980e68bd020513f7@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: 60aa8a74 by Teo Camarasu at 2024-03-06T14:53:09+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 7 changed files: - compiler/GHC/Tc/Gen/Splice.hs - libraries/template-haskell/Language/Haskell/TH/Syntax.hs - libraries/template-haskell/changelog.md - testsuite/tests/th/T16293b.hs - + testsuite/tests/th/T24031.hs - + testsuite/tests/th/T24031.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/Splice.hs ===================================== @@ -26,7 +26,7 @@ module GHC.Tc.Gen.Splice( runMetaE, runMetaP, runMetaT, runMetaD, runQuasi, tcTopSpliceExpr, lookupThName_maybe, defaultRunMeta, runMeta', runRemoteModFinalizers, - finishTH, runTopSplice + finishTH, runTopSplice, reifyName ) where import GHC.Prelude @@ -2120,15 +2120,6 @@ reifyTyCon tc | Just cls <- tyConClass_maybe tc = reifyClass cls -{- Seems to be just a short cut for the next equation -- omit - | tc `hasKey` fUNTyConKey -- I'm not quite sure what is happening here - = return (TH.PrimTyConI (reifyName tc) 2 False) --} - - | isPrimTyCon tc - = return (TH.PrimTyConI (reifyName tc) (length (tyConVisibleTyVars tc)) - (isUnliftedTypeKind (tyConResKind tc))) - | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc res_kind = tyConResKind tc ===================================== libraries/template-haskell/Language/Haskell/TH/Syntax.hs ===================================== @@ -2068,6 +2068,7 @@ data Info Name Type -- What it is bound to deriving( Show, Eq, Ord, Data, Generic ) +{-# DEPRECATED PrimTyConI "TyConI is now produced instead." #-} -- | Obtained from 'reifyModule' in the 'Q' Monad. data ModuleInfo = ===================================== libraries/template-haskell/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) +## 2.23.0.0 + * `PrimTyConI` has been deprecated. `TyConI` will now be used to represent primitive types. + ## 2.22.0.0 * The kind of `Code` was changed from `forall r. (Type -> Type) -> TYPE r -> Type` ===================================== testsuite/tests/th/T16293b.hs ===================================== @@ -7,7 +7,8 @@ import GHC.Exts import Language.Haskell.TH f :: () -f = $(do PrimTyConI _ arity _ <- reify ''Proxy# +f = $(do TyConI (DataD _ _ targs _ _ _) <- reify ''Proxy# + let arity = length targs unless (arity == 1) $ fail $ "Unexpected arity for Proxy#: " ++ show arity [| () |]) ===================================== testsuite/tests/th/T24031.hs ===================================== @@ -0,0 +1,28 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE LinearTypes #-} +-- | This test shows that we can reify a bunch of primitive types. +-- Additionally it acts as a golden test to ensure that we don't +-- accidentally change our output for these types. +module T24031 where + +import Control.Monad +import Data.Char +import GHC.Exts +import Language.Haskell.TH +import GHC.Builtin.Types.Prim +import GHC.Tc.Gen.Splice + +f :: () +f = $(do let types = map reifyName primTyCons + reified <- mapM reify types + let stripInt [] = [] + stripInt (x:xs) + | isDigit x = stripInt xs + | otherwise = x:xs + -- remove _[0-9]* sequences + let stripUniques ('_':xs) = stripUniques $ stripInt xs + stripUniques (x:xs)= x:stripUniques xs + stripUniques [] = [] + mapM_ (runIO . putStrLn . stripUniques . show) reified + [| () |]) ===================================== testsuite/tests/th/T24031.stderr ===================================== @@ -0,0 +1,74 @@ +TyConI (DataD [] GHC.Prim.~# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.~R# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.~P# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.=> [KindedTV a BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.==> [KindedTV a BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.-=> [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Addr# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Array# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.ByteArray# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallArray# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Char# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Double# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Float# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.BCO [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Weak# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableArray# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableByteArray# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallMutableArray# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.IOPort# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.TVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.RealWorld [] Nothing [] []) +TyConI (DataD [] GHC.Prim.StablePtr# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.StableName# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Compact# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.State# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.Proxy# [KindedTV a BndrReq (VarT k)] Nothing [] []) +TyConI (DataD [] GHC.Prim.ThreadId# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.StackSnapshot# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.PromptTag# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.FUN [KindedTV n BndrReq (ConT GHC.Types.Multiplicity),KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.TYPE [KindedTV a BndrReq (ConT GHC.Types.RuntimeRep)] Nothing [] []) +TyConI (DataD [] GHC.Prim.CONSTRAINT [KindedTV a BndrReq (ConT GHC.Types.RuntimeRep)] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX8# [] Nothing [] []) ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24031', normal, compile, ['-package ghc']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/60aa8a7448ce3c528244841457fe19330e0fc8eb -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/60aa8a7448ce3c528244841457fe19330e0fc8eb You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 15:14:04 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Wed, 06 Mar 2024 10:14:04 -0500 Subject: [Git][ghc/ghc][wip/T24031] Deprecate PrimTyConI Message-ID: <65e8883c423bd_38980e74ae50056494@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: a7072520 by Teo Camarasu at 2024-03-06T15:13:55+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 8 changed files: - compiler/GHC/Tc/Gen/Splice.hs - libraries/template-haskell/Language/Haskell/TH/Ppr.hs - libraries/template-haskell/Language/Haskell/TH/Syntax.hs - libraries/template-haskell/changelog.md - testsuite/tests/th/T16293b.hs - + testsuite/tests/th/T24031.hs - + testsuite/tests/th/T24031.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/Splice.hs ===================================== @@ -26,7 +26,7 @@ module GHC.Tc.Gen.Splice( runMetaE, runMetaP, runMetaT, runMetaD, runQuasi, tcTopSpliceExpr, lookupThName_maybe, defaultRunMeta, runMeta', runRemoteModFinalizers, - finishTH, runTopSplice + finishTH, runTopSplice, reifyName ) where import GHC.Prelude @@ -2120,15 +2120,6 @@ reifyTyCon tc | Just cls <- tyConClass_maybe tc = reifyClass cls -{- Seems to be just a short cut for the next equation -- omit - | tc `hasKey` fUNTyConKey -- I'm not quite sure what is happening here - = return (TH.PrimTyConI (reifyName tc) 2 False) --} - - | isPrimTyCon tc - = return (TH.PrimTyConI (reifyName tc) (length (tyConVisibleTyVars tc)) - (isUnliftedTypeKind (tyConResKind tc))) - | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc res_kind = tyConResKind tc ===================================== libraries/template-haskell/Language/Haskell/TH/Ppr.hs ===================================== @@ -1,5 +1,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE LambdaCase #-} +{-# OPTIONS_GHC -Wno-deprecations #-} -- | contains a prettyprinter for the -- Template Haskell datatypes ===================================== libraries/template-haskell/Language/Haskell/TH/Syntax.hs ===================================== @@ -2068,6 +2068,7 @@ data Info Name Type -- What it is bound to deriving( Show, Eq, Ord, Data, Generic ) +{-# DEPRECATED PrimTyConI "TyConI is now produced instead." #-} -- | Obtained from 'reifyModule' in the 'Q' Monad. data ModuleInfo = ===================================== libraries/template-haskell/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) +## 2.23.0.0 + * `PrimTyConI` has been deprecated. `TyConI` will now be used to represent primitive types. + ## 2.22.0.0 * The kind of `Code` was changed from `forall r. (Type -> Type) -> TYPE r -> Type` ===================================== testsuite/tests/th/T16293b.hs ===================================== @@ -7,7 +7,8 @@ import GHC.Exts import Language.Haskell.TH f :: () -f = $(do PrimTyConI _ arity _ <- reify ''Proxy# +f = $(do TyConI (DataD _ _ targs _ _ _) <- reify ''Proxy# + let arity = length targs unless (arity == 1) $ fail $ "Unexpected arity for Proxy#: " ++ show arity [| () |]) ===================================== testsuite/tests/th/T24031.hs ===================================== @@ -0,0 +1,28 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE LinearTypes #-} +-- | This test shows that we can reify a bunch of primitive types. +-- Additionally it acts as a golden test to ensure that we don't +-- accidentally change our output for these types. +module T24031 where + +import Control.Monad +import Data.Char +import GHC.Exts +import Language.Haskell.TH +import GHC.Builtin.Types.Prim +import GHC.Tc.Gen.Splice + +f :: () +f = $(do let types = map reifyName primTyCons + reified <- mapM reify types + let stripInt [] = [] + stripInt (x:xs) + | isDigit x = stripInt xs + | otherwise = x:xs + -- remove _[0-9]* sequences + let stripUniques ('_':xs) = stripUniques $ stripInt xs + stripUniques (x:xs)= x:stripUniques xs + stripUniques [] = [] + mapM_ (runIO . putStrLn . stripUniques . show) reified + [| () |]) ===================================== testsuite/tests/th/T24031.stderr ===================================== @@ -0,0 +1,74 @@ +TyConI (DataD [] GHC.Prim.~# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.~R# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.~P# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.=> [KindedTV a BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.==> [KindedTV a BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.-=> [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Addr# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Array# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.ByteArray# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallArray# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Char# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Double# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Float# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.BCO [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Weak# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableArray# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableByteArray# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallMutableArray# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.IOPort# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.TVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.RealWorld [] Nothing [] []) +TyConI (DataD [] GHC.Prim.StablePtr# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.StableName# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Compact# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.State# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.Proxy# [KindedTV a BndrReq (VarT k)] Nothing [] []) +TyConI (DataD [] GHC.Prim.ThreadId# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.StackSnapshot# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.PromptTag# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.FUN [KindedTV n BndrReq (ConT GHC.Types.Multiplicity),KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.TYPE [KindedTV a BndrReq (ConT GHC.Types.RuntimeRep)] Nothing [] []) +TyConI (DataD [] GHC.Prim.CONSTRAINT [KindedTV a BndrReq (ConT GHC.Types.RuntimeRep)] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX8# [] Nothing [] []) ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24031', normal, compile, ['-package ghc']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a707252053e03bcf89a5ca4a82d2766d2d22b89a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a707252053e03bcf89a5ca4a82d2766d2d22b89a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 16:50:54 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Wed, 06 Mar 2024 11:50:54 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/andreask/stm Message-ID: <65e89eee7724b_38980e9bfee9868512@gitlab.mail> Andreas Klebinger pushed new branch wip/andreask/stm at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/andreask/stm You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 16:53:12 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Wed, 06 Mar 2024 11:53:12 -0500 Subject: [Git][ghc/ghc][wip/andreask/stm] 173 commits: Bump bytestring submodule to something closer to 0.12.1 Message-ID: <65e89f784fba2_38980e9d5c3e470412@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/stm at Glasgow Haskell Compiler / GHC Commits: 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - b64a5949 by Andreas Klebinger at 2024-03-06T17:39:43+01:00 STM: Remove (unused)coarse grained locking. The STM code had a coarse grained locking mode guarded by #defines that was unused. This commit removes the code. - - - - - 18 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - .gitmodules - CODEOWNERS - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/12b442bf9802690fc1efb450e40724bfc0082d2b...b64a59491eab7d12b6a6c50764438ad5c55b5dcb -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/12b442bf9802690fc1efb450e40724bfc0082d2b...b64a59491eab7d12b6a6c50764438ad5c55b5dcb You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 17:26:53 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 12:26:53 -0500 Subject: [Git][ghc/ghc][ghc-9.10] 39 commits: rts: Fix symbol references in Wasm RTS Message-ID: <65e8a75dcf020_38980eae0f3a874128@gitlab.mail> Ben Gamari pushed to branch ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - 30 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs - compiler/GHC/Cmm/Dataflow/Graph.hs - compiler/GHC/Cmm/Dataflow/Label.hs - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Cmm/Info.hs - compiler/GHC/Cmm/Info/Build.hs - compiler/GHC/Cmm/LayoutStack.hs - compiler/GHC/Cmm/Lint.hs - compiler/GHC/Cmm/Liveness.hs - compiler/GHC/Cmm/Node.hs - compiler/GHC/Cmm/Pipeline.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/294c93a580e85e242d90349ae92fa6a7818002bb...21e3f3250e88640087a1a60bee2cc113bf04509f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/294c93a580e85e242d90349ae92fa6a7818002bb...21e3f3250e88640087a1a60bee2cc113bf04509f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 18:18:09 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 13:18:09 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/ghc-9.10 Message-ID: <65e8b361238c0_38980ec798f2c761b8@gitlab.mail> Ben Gamari pushed new branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/ghc-9.10 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 18:39:31 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Wed, 06 Mar 2024 13:39:31 -0500 Subject: [Git][ghc/ghc][master] 2 commits: rts: expose HeapAlloc.h as public header Message-ID: <65e8b863c87ea_38980ed17a73480034@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 12 changed files: - rts/Sparks.c - rts/include/rts/storage/Block.h - rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h - rts/posix/OSMem.c - rts/rts.cabal - rts/sm/CNF.c - rts/sm/GC.h - rts/sm/NonMoving.h - rts/sm/NonMovingMark.c - rts/sm/Sanity.c - rts/wasm/OSMem.c - rts/win32/OSMem.c Changes: ===================================== rts/Sparks.c ===================================== @@ -16,7 +16,7 @@ #include "Sparks.h" #include "ThreadLabels.h" #include "sm/NonMovingMark.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #if defined(THREADED_RTS) ===================================== rts/include/rts/storage/Block.h ===================================== @@ -10,6 +10,10 @@ #include "ghcconfig.h" +#if !defined(CMINUSMINUS) +#include "rts/storage/HeapAlloc.h" +#endif + /* The actual block and megablock-size constants are defined in * rts/include/Constants.h, all constants here are derived from these. */ @@ -190,6 +194,7 @@ typedef struct bdescr_ { EXTERN_INLINE bdescr *Bdescr(StgPtr p); EXTERN_INLINE bdescr *Bdescr(StgPtr p) { + ASSERT(HEAP_ALLOCED_GC(p)); return (bdescr *) ((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT)) | ((W_)p & ~MBLOCK_MASK) ===================================== rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h ===================================== @@ -8,8 +8,6 @@ #pragma once -#include "BeginPrivate.h" - #if defined(THREADED_RTS) // needed for HEAP_ALLOCED below extern SpinLock gc_alloc_block_sync; @@ -227,5 +225,3 @@ StgBool HEAP_ALLOCED_GC(const void *p) #else # error HEAP_ALLOCED not defined #endif - -#include "EndPrivate.h" ===================================== rts/posix/OSMem.c ===================================== @@ -13,7 +13,7 @@ #include "RtsUtils.h" #include "sm/OSMem.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #if defined(HAVE_UNISTD_H) #include ===================================== rts/rts.cabal ===================================== @@ -303,6 +303,7 @@ library rts/storage/Closures.h rts/storage/FunTypes.h rts/storage/Heap.h + rts/storage/HeapAlloc.h rts/storage/GC.h rts/storage/InfoTables.h rts/storage/MBlock.h ===================================== rts/sm/CNF.c ===================================== @@ -20,7 +20,7 @@ #include "Storage.h" #include "CNF.h" #include "Hash.h" -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "BlockAlloc.h" #include "Trace.h" #include "sm/ShouldCompact.h" ===================================== rts/sm/GC.h ===================================== @@ -13,7 +13,7 @@ #pragma once -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "BeginPrivate.h" ===================================== rts/sm/NonMoving.h ===================================== @@ -11,7 +11,7 @@ #if !defined(CMINUSMINUS) #include -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "NonMovingMark.h" #include "BeginPrivate.h" ===================================== rts/sm/NonMovingMark.c ===================================== @@ -14,7 +14,7 @@ #include "NonMovingShortcut.h" #include "NonMoving.h" #include "BlockAlloc.h" /* for countBlocks */ -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "Task.h" #include "Trace.h" #include "HeapUtils.h" ===================================== rts/sm/Sanity.c ===================================== @@ -32,7 +32,7 @@ #include "sm/NonMoving.h" #include "sm/NonMovingMark.h" #include "Profiling.h" // prof_arena -#include "HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" /* ----------------------------------------------------------------------------- Forward decls. ===================================== rts/wasm/OSMem.c ===================================== @@ -52,7 +52,7 @@ #include "RtsUtils.h" #include "sm/OSMem.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include <__macro_PAGESIZE.h> ===================================== rts/win32/OSMem.c ===================================== @@ -8,7 +8,7 @@ #include "Rts.h" #include "sm/OSMem.h" -#include "sm/HeapAlloc.h" +#include "rts/storage/HeapAlloc.h" #include "RtsUtils.h" #include View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/21e3f3250e88640087a1a60bee2cc113bf04509f...d19441d7981778ab9463557d812d9d7cf586f9e7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/21e3f3250e88640087a1a60bee2cc113bf04509f...d19441d7981778ab9463557d812d9d7cf586f9e7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 18:40:21 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Wed, 06 Mar 2024 13:40:21 -0500 Subject: [Git][ghc/ghc][master] 2 commits: ghc-experimental: Add dummy dependencies to work around #23942 Message-ID: <65e8b895294cd_38980ed4281ac836a@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - 8 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - + testsuite/tests/perf/compiler/T24471.hs - + testsuite/tests/perf/compiler/T24471a.hs - testsuite/tests/perf/compiler/all.T Changes: ===================================== compiler/GHC/Core/Opt/Arity.hs ===================================== @@ -1270,8 +1270,14 @@ arityLam id (AT oss div) floatIn :: Cost -> ArityType -> ArityType -- We have something like (let x = E in b), -- where b has the given arity type. -floatIn IsCheap at = at -floatIn IsExpensive at = addWork at +-- NB: be as lazy as possible in the Cost-of-E argument; +-- we can often get away without ever looking at it +-- See Note [Care with nested expressions] +floatIn ch at@(AT lams div) + = case lams of + [] -> at + (IsExpensive,_):_ -> at + (_,os):lams -> AT ((ch,os):lams) div addWork :: ArityType -> ArityType -- Add work to the outermost level of the arity type @@ -1354,6 +1360,25 @@ That gives \1.T (see Note [Combining case branches: andWithTail], first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is what we want. +Note [Care with nested expressions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + arityType (Just ) +We will take + arityType Just = AT [(IsCheap,os)] topDiv +and then do + arityApp (AT [(IsCheap os)] topDiv) (exprCost ) +The result will be AT [] topDiv. It doesn't matter what +is! The same is true of + arityType (let x = in ) +where the cost of doesn't matter unless has a useful +arityType. + +TL;DR in `floatIn`, do not to look at the Cost argument until you have to. + +I found this when looking at #24471, although I don't think it was really +the main culprit. + Note [Combining case branches: andWithTail] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When combining the ArityTypes for two case branches (with andArityType) @@ -1576,7 +1601,7 @@ arityType env (Case scrut bndr _ alts) = alts_type | otherwise -- In the remaining cases we may not push - = addWork alts_type -- evaluation of the scrutinee in + = addWork alts_type -- evaluation of the scrutinee in where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -643,7 +643,8 @@ lvlMFE env strict_ctxt e@(_, AnnCase {}) = lvlExpr env e -- See Note [Case MFEs] lvlMFE env strict_ctxt ann_expr - | floatTopLvlOnly env && not (isTopLvl dest_lvl) + | not float_me + || floatTopLvlOnly env && not (isTopLvl dest_lvl) -- Only floating to the top level is allowed. || hasFreeJoin env fvs -- If there is a free join, don't float -- See Note [Free join points] @@ -652,8 +653,9 @@ lvlMFE env strict_ctxt ann_expr -- how it will be represented at runtime. -- See Note [Representation polymorphism invariants] in GHC.Core || notWorthFloating expr abs_vars - || not float_me - = -- Don't float it out + -- Test notWorhtFloating last; + -- See Note [Large free-variable sets] + = -- Don't float it out lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty @@ -822,6 +824,28 @@ early loses opportunities for RULES which (needless to say) are important in some nofib programs (gcd is an example). [SPJ note: I think this is obsolete; the flag seems always on.] +Note [Large free-variable sets] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In #24471 we had something like + x1 = I# 1 + ... + x1000 = I# 1000 + foo = f x1 (f x2 (f x3 ....)) +So every sub-expression in `foo` has lots and lots of free variables. But +none of these sub-expressions float anywhere; the entire float-out pass is a +no-op. + +In lvlMFE, we want to find out quickly if the MFE is not-floatable; that is +the common case. In #24471 it turned out that we were testing `abs_vars` (a +relatively complicated calculation that takes at least O(n-free-vars) time to +compute) for every sub-expression. + +Better instead to test `float_me` early. That still involves looking at +dest_lvl, which means looking at every free variable, but the constant factor +is a lot better. + +ToDo: find a way to fix the bad asymptotic complexity. + Note [Floating join point bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mostly we only float a join point if it can /stay/ a join point. But ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -1469,8 +1469,7 @@ cpeArg env dmd arg = do { (floats1, arg1) <- cpeRhsE env arg -- arg1 can be a lambda ; let arg_ty = exprType arg1 is_unlifted = isUnliftedType arg_ty - dec = wantFloatLocal NonRecursive dmd is_unlifted - floats1 arg1 + dec = wantFloatLocal NonRecursive dmd is_unlifted floats1 arg1 ; (floats2, arg2) <- executeFloatDecision dec floats1 arg1 -- Else case: arg1 might have lambdas, and we can't -- put them inside a wrapBinds @@ -1482,23 +1481,29 @@ cpeArg env dmd arg then return (floats2, arg2) else do { v <- newVar arg_ty -- See Note [Eta expansion of arguments in CorePrep] - ; let arg3 = cpeEtaExpandArg env arg2 + ; let arity = cpeArgArity env dec arg2 + arg3 = cpeEtaExpand arity arg2 arg_float = mkNonRecFloat env dmd is_unlifted v arg3 ; return (snocFloat floats2 arg_float, varToCoreExpr v) } } -cpeEtaExpandArg :: CorePrepEnv -> CoreArg -> CoreArg +cpeArgArity :: CorePrepEnv -> FloatDecision -> CoreArg -> Arity -- ^ See Note [Eta expansion of arguments in CorePrep] -cpeEtaExpandArg env arg = cpeEtaExpand arity arg - where - arity | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 - , not (has_join_in_tail_context arg) +-- Returning 0 means "no eta-expansion"; see cpeEtaExpand +cpeArgArity env float_decision arg + | FloatNone <- float_decision + = 0 -- Crucial short-cut + -- See wrinkle (EA2) in Note [Eta expansion of arguments in CorePrep] + + | Just ao <- cp_arityOpts (cpe_config env) -- Just <=> -O1 or -O2 + , not (has_join_in_tail_context arg) -- See Wrinkle (EA1) of Note [Eta expansion of arguments in CorePrep] - = case exprEtaExpandArity ao arg of - Nothing -> 0 - Just at -> arityTypeArity at - | otherwise - = exprArity arg -- this is cheap enough for -O0 + = case exprEtaExpandArity ao arg of + Nothing -> 0 + Just at -> arityTypeArity at + + | otherwise + = exprArity arg -- this is cheap enough for -O0 has_join_in_tail_context :: CoreExpr -> Bool -- ^ Identify the cases where we'd generate invalid `CpeApp`s as described in @@ -1510,34 +1515,10 @@ has_join_in_tail_context (Tick _ e) = has_join_in_tail_context e has_join_in_tail_context (Case _ _ _ alts) = any has_join_in_tail_context (rhssOfAlts alts) has_join_in_tail_context _ = False -{- -Note [Eta expansion of arguments with join heads] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See Note [Eta expansion for join points] in GHC.Core.Opt.Arity -Eta expanding the join point would introduce crap that we can't -generate code for - ------------------------------------------------------------------------------- --- Building the saturated syntax --- --------------------------------------------------------------------------- - -Note [Eta expansion of hasNoBinding things in CorePrep] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -maybeSaturate deals with eta expanding to saturate things that can't deal with -unsaturated applications (identified by 'hasNoBinding', currently -foreign calls, unboxed tuple/sum constructors, and representation-polymorphic -primitives such as 'coerce' and 'unsafeCoerce#'). - -Historical Note: Note that eta expansion in CorePrep used to be very fragile -due to the "prediction" of CAFfyness that we used to make during tidying. -We previously saturated primop -applications here as well but due to this fragility (see #16846) we now deal -with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. --} - maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs maybeSaturate fn expr n_args unsat_ticks | hasNoBinding fn -- There's no binding + -- See Note [Eta expansion of hasNoBinding things in CorePrep] = return $ wrapLamBody (\body -> foldr mkTick body unsat_ticks) sat_expr | mark_arity > 0 -- A call-by-value function. See Note [CBV Function Ids] @@ -1567,24 +1548,14 @@ maybeSaturate fn expr n_args unsat_ticks fn_arity = idArity fn excess_arity = (max fn_arity mark_arity) - n_args sat_expr = cpeEtaExpand excess_arity expr - applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) + applied_marks = n_args >= (length . dropWhile (not . isMarkedCbv) . + reverse . expectJust "maybeSaturate" $ (idCbvMarks_maybe fn)) -- For join points we never eta-expand (See Note [Do not eta-expand join points]) - -- so we assert all arguments that need to be passed cbv are visible so that the backend can evalaute them if required.. -{- -************************************************************************ -* * - Simple GHC.Core operations -* * -************************************************************************ --} + -- so we assert all arguments that need to be passed cbv are visible so that the + -- backend can evalaute them if required.. -{- --- ----------------------------------------------------------------------------- --- Eta reduction --- ----------------------------------------------------------------------------- - -Note [Eta expansion] -~~~~~~~~~~~~~~~~~~~~~ +{- Note [Eta expansion] +~~~~~~~~~~~~~~~~~~~~~~~ Eta expand to match the arity claimed by the binder Remember, CorePrep must not change arity @@ -1603,6 +1574,19 @@ NB2: we have to be careful that the result of etaExpand doesn't an SCC note - we're now careful in etaExpand to make sure the SCC is pushed inside any new lambdas that are generated. +Note [Eta expansion of hasNoBinding things in CorePrep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +maybeSaturate deals with eta expanding to saturate things that can't deal +with unsaturated applications (identified by 'hasNoBinding', currently +foreign calls, unboxed tuple/sum constructors, and representation-polymorphic +primitives such as 'coerce' and 'unsafeCoerce#'). + +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. We +previously saturated primop applications here as well but due to this +fragility (see #16846) we now deal with this another way, as described in +Note [Primop wrappers] in GHC.Builtin.PrimOps. + Note [Eta expansion and the CorePrep invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out to be much much easier to do eta expansion @@ -1685,6 +1669,22 @@ There is a nasty Wrinkle: This scenario occurs rarely; hence it's OK to generate sub-optimal code. The alternative would be to fix Note [Eta expansion for join points], but that's quite challenging due to unfoldings of (recursive) join points. + +(EA2) In cpeArgArity, if float_decision = FloatNone) the `arg` will look like + let in rhs + where is non-empty and can't be floated out of a lazy context (see + `wantFloatLocal`). So we can't eta-expand it anyway, so we can return 0 + forthwith. Without this short-cut we will call exprEtaExpandArity on the + `arg`, and might be enormous. exprEtaExpandArity be very expensive + on this: it uses arityType, and may look at . + + On the other hand, if float_decision = FloatAll, there will be no + let-bindings around 'arg'; they will have floated out. So + exprEtaExpandArity is cheap. + + This can make a huge difference on deeply nested expressions like + f (f (f (f (f ...)))) + #24471 is a good example, where Prep took 25% of compile time! -} cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs @@ -1899,7 +1899,7 @@ instance Outputable FloatInfo where -- See Note [Floating in CorePrep] -- and Note [BindInfo and FloatInfo] data FloatingBind - = Float !CoreBind !BindInfo !FloatInfo + = Float !CoreBind !BindInfo !FloatInfo -- Never a join-point binding | UnsafeEqualityCase !CoreExpr !CoreBndr !AltCon ![CoreBndr] | FloatTick CoreTickish @@ -2126,19 +2126,16 @@ data FloatDecision | FloatAll executeFloatDecision :: FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs) -executeFloatDecision dec floats rhs = do - let (float,stay) = case dec of - _ | isEmptyFloats floats -> (emptyFloats,emptyFloats) - FloatNone -> (emptyFloats, floats) - FloatAll -> (floats, emptyFloats) - -- Wrap `stay` around `rhs`. - -- NB: `rhs` might have lambdas, and we can't - -- put them inside a wrapBinds, which expects a `CpeBody`. - if isEmptyFloats stay -- Fast path where we don't need to call `rhsToBody` - then return (float, rhs) - else do - (floats', body) <- rhsToBody rhs - return (float, wrapBinds stay $ wrapBinds floats' body) +executeFloatDecision dec floats rhs + = case dec of + FloatAll -> return (floats, rhs) + FloatNone + | isEmptyFloats floats -> return (emptyFloats, rhs) + | otherwise -> do { (floats', body) <- rhsToBody rhs + ; return (emptyFloats, wrapBinds floats $ + wrapBinds floats' body) } + -- FloatNone case: `rhs` might have lambdas, and we can't + -- put them inside a wrapBinds, which expects a `CpeBody`. wantFloatTop :: Floats -> FloatDecision wantFloatTop fs ===================================== libraries/ghc-experimental/src/Data/Sum/Experimental.hs ===================================== @@ -80,4 +80,5 @@ module Data.Sum.Experimental ( Sum63#, ) where +import GHC.Num.BigNat () -- for build ordering import GHC.Types ===================================== libraries/ghc-experimental/src/Data/Tuple/Experimental.hs ===================================== @@ -161,3 +161,4 @@ module Data.Tuple.Experimental ( import GHC.Tuple import GHC.Types import GHC.Classes +import GHC.Num.BigNat () -- for build ordering ===================================== testsuite/tests/perf/compiler/T24471.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471 where + +import T24471a + +{-# OPAQUE foo #-} +foo :: (List_ Int a -> a) -> a +foo alg = $$(between [|| alg ||] 0 1000) ===================================== testsuite/tests/perf/compiler/T24471a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} +module T24471a where + +data List_ a f = Nil_ | Cons_ a f deriving Functor + +between alg a b + | a == b = [|| $$alg Nil_ ||] + | otherwise = [|| $$alg (Cons_ a $$(between alg (a + 1) b)) ||] ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -712,3 +712,7 @@ test ('LookupFusion', [collect_stats('bytes allocated',2), when(wordsize(32), skip)], compile_and_run, ['-O2 -package base']) + +test('T24471', + [req_th, collect_compiler_stats('all', 5)], + multimod_compile, ['T24471', '-v0 -O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d19441d7981778ab9463557d812d9d7cf586f9e7...1e84b924c40cbfad9e1a0cf5f7d3a40fdc1c88ca -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d19441d7981778ab9463557d812d9d7cf586f9e7...1e84b924c40cbfad9e1a0cf5f7d3a40fdc1c88ca You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 18:41:04 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Wed, 06 Mar 2024 13:41:04 -0500 Subject: [Git][ghc/ghc][master] Use "module" instead of "library" when applicable in base haddocks Message-ID: <65e8b8c026bff_38980ed63a01c867e0@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 15 changed files: - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs - libraries/base/src/System/IO.hs - libraries/base/src/System/Mem/Weak.hs - libraries/base/src/System/Posix/Internals.hs - libraries/base/src/Text/ParserCombinators/ReadP.hs - libraries/base/src/Text/ParserCombinators/ReadPrec.hs - libraries/base/src/Text/Read.hs Changes: ===================================== libraries/base/src/Control/Concurrent.hs ===================================== @@ -147,7 +147,7 @@ by using 'forkOS' instead of 'forkIO'. Haskell threads can communicate via 'MVar's, a kind of synchronised mutable variable (see "Control.Concurrent.MVar"). Several common concurrency abstractions can be built from 'MVar's, and these are -provided by the "Control.Concurrent" library. +provided by the "Control.Concurrent" module. In GHC, threads may also communicate via exceptions. -} @@ -384,7 +384,7 @@ foreign import ccall safe "fdReady" multiple Haskell threads can be involved in external calls simultaneously. - The "System.IO" library manages multiplexing in its own way. On + The "System.IO" module manages multiplexing in its own way. On Windows systems it uses @safe@ foreign calls to ensure that threads doing I\/O operations don't block the whole runtime, whereas on Unix systems all the currently blocked I\/O requests @@ -401,7 +401,7 @@ foreign import ccall safe "fdReady" If you don't use the @-threaded@ option, then the runtime does not make use of multiple OS threads. Foreign calls will block all other running Haskell threads until the call returns. The - "System.IO" library still does multiplexing, so there can be multiple + "System.IO" module still does multiplexing, so there can be multiple threads doing I\/O, and this is handled internally by the runtime using @select at . -} ===================================== libraries/base/src/Control/Monad.hs ===================================== @@ -65,7 +65,7 @@ import GHC.Internal.Control.Monad {- $naming -The functions in this library use the following naming conventions: +The functions in this module use the following naming conventions: * A postfix \'@M@\' always stands for a function in the Kleisli category: The monad type constructor @m@ is added to function results ===================================== libraries/base/src/Control/Monad/ST.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : stable -- Portability : non-portable (requires universal quantification for runST) -- --- This library provides support for /strict/ state threads, as +-- This module provides support for /strict/ state threads, as -- described in the PLDI \'94 paper by John Launchbury and Simon Peyton -- Jones /Lazy Functional State Threads/. -- ===================================== libraries/base/src/Control/Monad/ST/Safe.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : stable -- Portability : non-portable (requires universal quantification for runST) -- --- This library provides support for /strict/ state threads, as +-- This module provides support for /strict/ state threads, as -- described in the PLDI \'94 paper by John Launchbury and Simon Peyton -- Jones /Lazy Functional State Threads/. -- ===================================== libraries/base/src/Control/Monad/ST/Unsafe.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : stable -- Portability : non-portable (requires universal quantification for runST) -- --- This library provides support for /strict/ state threads, as +-- This module provides support for /strict/ state threads, as -- described in the PLDI \'94 paper by John Launchbury and Simon Peyton -- Jones /Lazy Functional State Threads/. -- ===================================== libraries/base/src/Data/Version.hs ===================================== @@ -9,7 +9,7 @@ -- Stability : stable -- Portability : non-portable (local universal quantification in ReadP) -- --- A general library for representation and manipulation of versions. +-- A general API for representation and manipulation of versions. -- -- Versioning schemes are many and varied, so the version -- representation provided by this library is intended to be a ===================================== libraries/base/src/GHC/IO/Encoding/UTF16.hs ===================================== @@ -32,4 +32,4 @@ module GHC.IO.Encoding.UTF16 utf16le_encode ) where -import GHC.Internal.IO.Encoding.UTF16 \ No newline at end of file +import GHC.Internal.IO.Encoding.UTF16 ===================================== libraries/base/src/GHC/TypeNats.hs ===================================== @@ -7,7 +7,7 @@ -- | -- This module is an internal GHC module. It declares the constants used -- in the implementation of type-level natural numbers. The programmer interface --- for working with type-level naturals should be defined in a separate library. +-- for working with type-level naturals should be defined in a separate module. -- -- @since 4.10.0.0 -- ===================================== libraries/base/src/System/Console/GetOpt.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : stable -- Portability : portable -- --- This library provides facilities for parsing the command-line options +-- This module provides facilities for parsing the command-line options -- in a standalone program. It is essentially a Haskell port of the GNU -- @getopt@ library. -- ===================================== libraries/base/src/System/IO.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : stable -- Portability : portable -- --- The standard IO library. +-- The standard IO API. -- module System.IO ===================================== libraries/base/src/System/Mem/Weak.hs ===================================== @@ -32,7 +32,7 @@ -- alive for ever. One way to solve this is to purge the table -- occasionally, by deleting entries whose keys have died. -- --- The weak pointers in this library +-- The weak pointers in this module -- support another approach, called /finalization/. -- When the key referred to by a weak pointer dies, the storage manager -- arranges to run a programmer-specified finalizer. In the case of memo @@ -43,7 +43,7 @@ -- key\/value pair might itself contain a pointer to the key. -- So the memo table keeps the value alive, which keeps the key alive, -- even though there may be no other references to the key so both should --- die. The weak pointers in this library provide a slight +-- die. The weak pointers in this module provide a slight -- generalisation of the basic weak-pointer idea, in which each -- weak pointer actually contains both a key and a value. -- ===================================== libraries/base/src/System/Posix/Internals.hs ===================================== @@ -17,7 +17,7 @@ -- bound, e.g., @base < 4.X@ rather than @base < 5@, because the interface can -- change rapidly without much warning. -- --- This library is built on *every* platform, including Win32. +-- This module is built on *every* platform, including Win32. -- -- Non-POSIX compliant in order to support the following features: -- * S_ISSOCK (no sockets in POSIX) ===================================== libraries/base/src/Text/ParserCombinators/ReadP.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : provisional -- Portability : non-portable (local universal quantification) -- --- This is a library of parser combinators, originally written by Koen Claessen. +-- This is a module of parser combinators, originally written by Koen Claessen. -- It parses all alternatives in parallel, so it never keeps hold of -- the beginning of the input string, a common source of space leaks with -- other parsers. The @('+++')@ choice combinator is genuinely commutative; @@ -60,4 +60,4 @@ module Text.ParserCombinators.ReadP -- $properties ) where -import GHC.Internal.Text.ParserCombinators.ReadP \ No newline at end of file +import GHC.Internal.Text.ParserCombinators.ReadP ===================================== libraries/base/src/Text/ParserCombinators/ReadPrec.hs ===================================== @@ -10,7 +10,7 @@ -- Stability : provisional -- Portability : non-portable (uses Text.ParserCombinators.ReadP) -- --- This library defines parser combinators for precedence parsing. +-- This module defines parser combinators for precedence parsing. module Text.ParserCombinators.ReadPrec (ReadPrec, @@ -37,4 +37,4 @@ module Text.ParserCombinators.ReadPrec readS_to_Prec ) where -import GHC.Internal.Text.ParserCombinators.ReadPrec \ No newline at end of file +import GHC.Internal.Text.ParserCombinators.ReadPrec ===================================== libraries/base/src/Text/Read.hs ===================================== @@ -12,7 +12,7 @@ -- -- Converting strings to values. -- --- The "Text.Read" library is the canonical library to import for +-- The "Text.Read" module is the canonical place to import for -- 'Read'-class facilities. For GHC only, it offers an extended and much -- improved 'Read' class, which constitutes a proposed alternative to the -- Haskell 2010 'Read'. In particular, writing parsers is easier, and View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4b131133e4cee35d2140eedfcf3b4e573a43a8a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4b131133e4cee35d2140eedfcf3b4e573a43a8a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 18:56:36 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Wed, 06 Mar 2024 13:56:36 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] 16 commits: Trim trailing whitespace Message-ID: <65e8bc64b947a_38980ede2c6588862d@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: 625493a4 by Sven Tennie at 2024-03-06T07:02:17+01:00 Trim trailing whitespace - - - - - 30dfe442 by Sven Tennie at 2024-03-06T08:09:57+01:00 No sign extension attribute in RISCV instructions RISCV takes the meaning of reduced instruction set much more serious: One cannot sign extend an operant in the same instruction. Delete this unused code - We're handling sign extension differently. - - - - - 811be0cb by Sven Tennie at 2024-03-06T08:45:23+01:00 There are no shifts in RISCV instructions Remove this unused code. RISCV does everything in small steps... - - - - - c50c232f by Sven Tennie at 2024-03-06T08:56:52+01:00 pprReg: Remove unused parameter - - - - - ae94eadd by Sven Tennie at 2024-03-06T10:21:25+01:00 Cleanup Cond - - - - - 50dc60b3 by Sven Tennie at 2024-03-06T12:29:44+01:00 More cleanup Mostly haddock, formatting, minor refactorings - - - - - 4317a296 by Sven Tennie at 2024-03-06T14:47:23+01:00 Implement takeRegRegMoveInstr - - - - - 6f258fb4 by Sven Tennie at 2024-03-06T15:17:01+01:00 Cleanup mkStackAllocInstr & mkStackDeallocInstr - - - - - f641e4fa by Sven Tennie at 2024-03-06T16:59:18+01:00 Move Reg definitions to Regs module - - - - - 4a3cd3e2 by Sven Tennie at 2024-03-06T17:00:12+01:00 Typo - - - - - 73195089 by Sven Tennie at 2024-03-06T17:00:37+01:00 Circumvent "incomplete pattern match" warning - - - - - d604f115 by Sven Tennie at 2024-03-06T17:01:16+01:00 Delete commented out / dead code - - - - - 970df83d by Sven Tennie at 2024-03-06T17:07:54+01:00 Add TODOs - - - - - f6d1a418 by Sven Tennie at 2024-03-06T18:31:52+01:00 Reduce duplication in stack alloc / free - - - - - 8d077038 by Sven Tennie at 2024-03-06T18:52:04+01:00 Delete unused instructions As they are unused, we don't even know if using them would work at all. - - - - - f6f310ee by Sven Tennie at 2024-03-06T18:54:41+01:00 Lint - - - - - 5 changed files: - compiler/GHC/CmmToAsm/RV64/CodeGen.hs - compiler/GHC/CmmToAsm/RV64/Cond.hs - compiler/GHC/CmmToAsm/RV64/Instr.hs - compiler/GHC/CmmToAsm/RV64/Ppr.hs - compiler/GHC/CmmToAsm/RV64/Regs.hs Changes: ===================================== compiler/GHC/CmmToAsm/RV64/CodeGen.hs ===================================== @@ -911,10 +911,10 @@ getRegister' config plat expr = -- SLT is the same. ULE, and ULT will not return true for NaN. -- This is a bit counter-intuitive. Don't let yourself be fooled by -- the S/U prefix for floats, it's only meaningful for integers. - MO_F_Ge w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y OGE)) - MO_F_Le w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y OLE)) -- x <= y <=> y > x - MO_F_Gt w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y OGT)) - MO_F_Lt w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y OLT)) -- x < y <=> y >= x + MO_F_Ge w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y FGE)) + MO_F_Le w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y FLE)) -- x <= y <=> y > x + MO_F_Gt w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y FGT)) + MO_F_Lt w -> floatCond w (\d x y -> unitOL $ annExpr expr (CSET d x y FLT)) -- x < y <=> y >= x -- Bitwise operations MO_And w -> bitOp w (\d x y -> unitOL $ annExpr expr (AND d x y)) @@ -1278,10 +1278,10 @@ genCondJump bid expr = do MO_F_Eq w -> fbcond w EQ MO_F_Ne w -> fbcond w NE - MO_F_Gt w -> fbcond w OGT - MO_F_Ge w -> fbcond w OGE - MO_F_Lt w -> fbcond w OLT - MO_F_Le w -> fbcond w OLE + MO_F_Gt w -> fbcond w FGT + MO_F_Ge w -> fbcond w FGE + MO_F_Lt w -> fbcond w FLT + MO_F_Le w -> fbcond w FLE MO_Eq w -> sbcond w EQ MO_Ne w -> sbcond w NE ===================================== compiler/GHC/CmmToAsm/RV64/Cond.hs ===================================== @@ -1,93 +1,58 @@ -module GHC.CmmToAsm.RV64.Cond where +module GHC.CmmToAsm.RV64.Cond where import GHC.Prelude hiding (EQ) --- FIXME: These conditions originate from the Aarch64 backend. I'm not even sure --- we use all of them there. For RISCV we need to synthesize some of them, as --- RISCV has a much more reduced (ha!) set of condtionals. - --- TODO: This appears to go a bit overboard? Maybe we should stick with what LLVM --- settled on for fcmp? --- false: always yields false, regardless of operands. --- oeq: yields true if both operands are not a QNAN and op1 is equal to op2. --- ogt: yields true if both operands are not a QNAN and op1 is greater than op2. --- oge: yields true if both operands are not a QNAN and op1 is greater than or equal to op2. --- olt: yields true if both operands are not a QNAN and op1 is less than op2. --- ole: yields true if both operands are not a QNAN and op1 is less than or equal to op2. --- one: yields true if both operands are not a QNAN and op1 is not equal to op2. --- ord: yields true if both operands are not a QNAN. --- ueq: yields true if either operand is a QNAN or op1 is equal to op2. --- ugt: yields true if either operand is a QNAN or op1 is greater than op2. --- uge: yields true if either operand is a QNAN or op1 is greater than or equal to op2. --- ult: yields true if either operand is a QNAN or op1 is less than op2. --- ule: yields true if either operand is a QNAN or op1 is less than or equal to op2. --- une: yields true if either operand is a QNAN or op1 is not equal to op2. --- uno: yields true if either operand is a QNAN. --- true: always yields true, regardless of operands. +-- | Condition codes. -- --- LLVMs icmp knows about: --- eq: yields true if the operands are equal, false otherwise. No sign interpretation is necessary or performed. --- ne: yields true if the operands are unequal, false otherwise. No sign interpretation is necessary or performed. --- ugt: interprets the operands as unsigned values and yields true if op1 is greater than op2. --- uge: interprets the operands as unsigned values and yields true if op1 is greater than or equal to op2. --- ult: interprets the operands as unsigned values and yields true if op1 is less than op2. --- ule: interprets the operands as unsigned values and yields true if op1 is less than or equal to op2. --- sgt: interprets the operands as signed values and yields true if op1 is greater than op2. --- sge: interprets the operands as signed values and yields true if op1 is greater than or equal to op2. --- slt: interprets the operands as signed values and yields true if op1 is less than op2. --- sle: interprets the operands as signed values and yields true if op1 is less than or equal to op2. - +-- Used in conditional branches and bit setters. According to the available +-- instruction set, some conditions are encoded as their negated opposites. I.e. +-- these are logical things that don't necessarily map 1:1 to hardware/ISA. data Cond - = ALWAYS -- b.al - | EQ -- b.eq - | NE -- b.ne - -- signed - | SLT -- b.lt - | SLE -- b.le - | SGE -- b.ge - | SGT -- b.gt - -- unsigned - | ULT -- b.lo - | ULE -- b.ls - | UGE -- b.hs - | UGT -- b.hi - -- ordered - | OLT -- b.mi - | OLE -- b.ls - | OGE -- b.ge - | OGT -- b.gt - -- unordered - | UOLT -- b.lt - | UOLE -- b.le - | UOGE -- b.pl - | UOGT -- b.hi - -- others - | NEVER -- b.nv - | VS -- oVerflow set - | VC -- oVerflow clear - deriving (Eq, Show) + = -- | int and float + EQ + | -- | int and float + NE + | -- | signed less than + SLT + | -- | signed less than or equal + SLE + | -- | signed greater than or equal + SGE + | -- | signed greater than + SGT + | -- | unsigned less than + ULT + | -- | unsigned less than or equal + ULE + | -- | unsigned greater than or equal + UGE + | -- | unsigned greater than + UGT + | -- | floating point instruction @flt@ + FLT + | -- | floating point instruction @fle@ + FLE + | -- | floating point instruction @fge@ + FGE + | -- | floating point instruction @fgt@ + FGT + deriving (Eq, Show) -- | Negate a condition. +-- +-- This is useful to e.g. construct far branches from usual branches. negateCond :: Cond -> Cond -negateCond ALWAYS = NEVER -negateCond NEVER = ALWAYS -negateCond EQ = NE -negateCond NE = EQ -negateCond SLT = SGE -negateCond SLE = SGT -negateCond SGE = SLT -negateCond SGT = SLE -negateCond ULT = UGE -negateCond ULE = UGT -negateCond UGE = ULT -negateCond UGT = ULE -negateCond OLT = OGE -negateCond OLE = OGT -negateCond OGE = OLT -negateCond OGT = OLE -negateCond UOLT = UOGE -negateCond UOLE = UOGT -negateCond UOGE = UOLT -negateCond UOGT = UOLE -negateCond VS = VC -negateCond VC = VS +negateCond EQ = NE +negateCond NE = EQ +negateCond SLT = SGE +negateCond SLE = SGT +negateCond SGE = SLT +negateCond SGT = SLE +negateCond ULT = UGE +negateCond ULE = UGT +negateCond UGE = ULT +negateCond UGT = ULE +negateCond FLT = FGE +negateCond FLE = FGT +negateCond FGE = FLT +negateCond FGT = FLE ===================================== compiler/GHC/CmmToAsm/RV64/Instr.hs ===================================== @@ -28,7 +28,7 @@ import GHC.Types.Unique.Supply import GHC.Utils.Panic -import Data.Maybe (fromMaybe) +import Data.Maybe import GHC.Stack import qualified Data.List.NonEmpty as NE @@ -92,7 +92,6 @@ regUsageOfInstr platform instr = case instr of MUL dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) NEG dst src -> usage (regOp src, regOp dst) SMULH dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) - SMULL dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) DIV dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) REM dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) REMU dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) @@ -113,12 +112,9 @@ regUsageOfInstr platform instr = case instr of LSL dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) LSR dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) MOV dst src -> usage (regOp src, regOp dst) - MOVK dst src -> usage (regOp src, regOp dst) -- ORI's third operand is always an immediate ORI dst src1 _ -> usage (regOp src1, regOp dst) XORI dst src1 _ -> usage (regOp src1, regOp dst) - ROR dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) - TST src1 src2 -> usage (regOp src1 ++ regOp src2, []) -- 4. Branch Instructions ---------------------------------------------------- J t -> usage (regTarget t, []) B t -> usage (regTarget t, []) @@ -130,8 +126,6 @@ regUsageOfInstr platform instr = case instr of -- 5. Atomic Instructions ---------------------------------------------------- -- 6. Conditional Instructions ----------------------------------------------- CSET dst l r _ -> usage (regOp l ++ regOp r, regOp dst) - CBZ src _ -> usage (regOp src, []) - CBNZ src _ -> usage (regOp src, []) -- 7. Load and Store Instructions -------------------------------------------- STR _ src dst -> usage (regOp src ++ regOp dst, []) -- STLR _ src dst L -> usage (regOp src ++ regOp dst, []) @@ -165,11 +159,8 @@ regUsageOfInstr platform instr = case instr of regAddr (AddrReg r1) = [r1] regOp :: Operand -> [Reg] regOp (OpReg _ r1) = [r1] - regOp (OpRegExt _ r1 _ _) = [r1] - regOp (OpRegShift _ r1 _ _) = [r1] regOp (OpAddr a) = regAddr a regOp (OpImm _) = [] - regOp (OpImmShift _ _ _) = [] regTarget :: Target -> [Reg] regTarget (TBlock _) = [] regTarget (TLabel _) = [] @@ -229,7 +220,6 @@ patchRegsOfInstr instr env = case instr of MUL o1 o2 o3 -> MUL (patchOp o1) (patchOp o2) (patchOp o3) NEG o1 o2 -> NEG (patchOp o1) (patchOp o2) SMULH o1 o2 o3 -> SMULH (patchOp o1) (patchOp o2) (patchOp o3) - SMULL o1 o2 o3 -> SMULL (patchOp o1) (patchOp o2) (patchOp o3) DIV o1 o2 o3 -> DIV (patchOp o1) (patchOp o2) (patchOp o3) REM o1 o2 o3 -> REM (patchOp o1) (patchOp o2) (patchOp o3) REMU o1 o2 o3 -> REMU (patchOp o1) (patchOp o2) (patchOp o3) @@ -252,12 +242,9 @@ patchRegsOfInstr instr env = case instr of LSL o1 o2 o3 -> LSL (patchOp o1) (patchOp o2) (patchOp o3) LSR o1 o2 o3 -> LSR (patchOp o1) (patchOp o2) (patchOp o3) MOV o1 o2 -> MOV (patchOp o1) (patchOp o2) - MOVK o1 o2 -> MOVK (patchOp o1) (patchOp o2) -- o3 cannot be a register for ORI (always an immediate) ORI o1 o2 o3 -> ORI (patchOp o1) (patchOp o2) (patchOp o3) XORI o1 o2 o3 -> XORI (patchOp o1) (patchOp o2) (patchOp o3) - ROR o1 o2 o3 -> ROR (patchOp o1) (patchOp o2) (patchOp o3) - TST o1 o2 -> TST (patchOp o1) (patchOp o2) -- 4. Branch Instructions -------------------------------------------------- J t -> J (patchTarget t) @@ -270,8 +257,6 @@ patchRegsOfInstr instr env = case instr of -- 5. Atomic Instructions -------------------------------------------------- -- 6. Conditional Instructions --------------------------------------------- CSET o l r c -> CSET (patchOp o) (patchOp l) (patchOp r) c - CBZ o l -> CBZ (patchOp o) l - CBNZ o l -> CBNZ (patchOp o) l -- 7. Load and Store Instructions ------------------------------------------ STR f o1 o2 -> STR f (patchOp o1) (patchOp o2) -- STLR f o1 o2 -> STLR f (patchOp o1) (patchOp o2) @@ -293,8 +278,6 @@ patchRegsOfInstr instr env = case instr of where patchOp :: Operand -> Operand patchOp (OpReg w r) = OpReg w (env r) - patchOp (OpRegExt w r x s) = OpRegExt w (env r) x s - patchOp (OpRegShift w r m s) = OpRegShift w (env r) m s patchOp (OpAddr a) = OpAddr (patchAddr a) patchOp op = op patchTarget :: Target -> Target @@ -304,53 +287,48 @@ patchRegsOfInstr instr env = case instr of patchAddr (AddrRegImm r1 i) = AddrRegImm (env r1) i patchAddr (AddrReg r) = AddrReg (env r) -------------------------------------------------------------------------------- + -- | Checks whether this instruction is a jump/branch instruction. +-- -- One that can change the flow of control in a way that the -- register allocator needs to worry about. isJumpishInstr :: Instr -> Bool isJumpishInstr instr = case instr of - ANN _ i -> isJumpishInstr i - CBZ{} -> True - CBNZ{} -> True - J{} -> True - B{} -> True - B_FAR{} -> True - BL{} -> True - BCOND{} -> True - BCOND_FAR{} -> True - _ -> False - --- | Checks whether this instruction is a jump/branch instruction. --- One that can change the flow of control in a way that the --- register allocator needs to worry about. + ANN _ i -> isJumpishInstr i + J {} -> True + B {} -> True + B_FAR {} -> True + BL {} -> True + BCOND {} -> True + BCOND_FAR {} -> True + _ -> False + +-- | Get the `BlockId`s of the jump destinations (if any) jumpDestsOfInstr :: Instr -> [BlockId] jumpDestsOfInstr (ANN _ i) = jumpDestsOfInstr i -jumpDestsOfInstr (CBZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (CBNZ _ t) = [ id | TBlock id <- [t]] jumpDestsOfInstr (J t) = [id | TBlock id <- [t]] jumpDestsOfInstr (B t) = [id | TBlock id <- [t]] jumpDestsOfInstr (B_FAR t) = [t] -jumpDestsOfInstr (BL t _ _) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (BCOND _ _ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (BCOND_FAR _ _ _ _ t) = [ id | TBlock id <- [t]] +jumpDestsOfInstr (BL t _ _) = [id | TBlock id <- [t]] +jumpDestsOfInstr (BCOND _ _ _ t) = [id | TBlock id <- [t]] +jumpDestsOfInstr (BCOND_FAR _ _ _ _ t) = [id | TBlock id <- [t]] jumpDestsOfInstr _ = [] --- | Change the destination of this jump instruction. +-- | Change the destination of this (potential) jump instruction. +-- -- Used in the linear allocator when adding fixup blocks for join -- points. patchJumpInstr :: Instr -> (BlockId -> BlockId) -> Instr -patchJumpInstr instr patchF - = case instr of - ANN d i -> ANN d (patchJumpInstr i patchF) - CBZ r (TBlock bid) -> CBZ r (TBlock (patchF bid)) - CBNZ r (TBlock bid) -> CBNZ r (TBlock (patchF bid)) - J (TBlock bid) -> J (TBlock (patchF bid)) - B (TBlock bid) -> B (TBlock (patchF bid)) - B_FAR bid -> B_FAR (patchF bid) - BL (TBlock bid) ps rs -> BL (TBlock (patchF bid)) ps rs - BCOND c o1 o2 (TBlock bid) -> BCOND c o1 o2 (TBlock (patchF bid)) - BCOND_FAR c o1 o2 b (TBlock bid) -> BCOND_FAR c o1 o2 b (TBlock (patchF bid)) - _ -> panic $ "patchJumpInstr: " ++ instrCon instr +patchJumpInstr instr patchF = + case instr of + ANN d i -> ANN d (patchJumpInstr i patchF) + J (TBlock bid) -> J (TBlock (patchF bid)) + B (TBlock bid) -> B (TBlock (patchF bid)) + B_FAR bid -> B_FAR (patchF bid) + BL (TBlock bid) ps rs -> BL (TBlock (patchF bid)) ps rs + BCOND c o1 o2 (TBlock bid) -> BCOND c o1 o2 (TBlock (patchF bid)) + BCOND_FAR c o1 o2 b (TBlock bid) -> BCOND_FAR c o1 o2 b (TBlock (patchF bid)) + _ -> panic $ "patchJumpInstr: " ++ instrCon instr -- ----------------------------------------------------------------------------- -- Note [Spills and Reloads] @@ -372,11 +350,11 @@ patchJumpInstr instr patchF mkSpillInstr :: HasCallStack => NCGConfig -> - Reg -> -- register to spill - Int -> -- current stack delta - Int -> -- spill slot to use + Reg -> -- ^ register to spill + Int -> -- ^ current stack delta + Int -> -- ^ spill slot to use [Instr] -mkSpillInstr config reg delta slot = +mkSpillInstr _config reg delta slot = case off - delta of imm | fitsIn12bitImm imm -> [mkStrSpImm imm] imm -> @@ -397,9 +375,9 @@ mkSpillInstr config reg delta slot = mkLoadInstr :: NCGConfig - -> Reg -- register to load - -> Int -- current stack delta - -> Int -- spill slot to use + -> Reg -- ^ register to load + -> Int -- ^ current stack delta + -> Int -- ^ spill slot to use -> [Instr] mkLoadInstr _config reg delta slot = @@ -421,58 +399,77 @@ mkLoadInstr _config reg delta slot = off = spillSlotToOffset slot - -------------------------------------------------------------------------------- -- | See if this instruction is telling us the current C stack delta takeDeltaInstr :: Instr -> Maybe Int takeDeltaInstr (ANN _ i) = takeDeltaInstr i takeDeltaInstr (DELTA i) = Just i takeDeltaInstr _ = Nothing --- Not real instructions. Just meta data +-- | Not real instructions. Just meta data isMetaInstr :: Instr -> Bool -isMetaInstr instr - = case instr of - ANN _ i -> isMetaInstr i - COMMENT{} -> True - MULTILINE_COMMENT{} -> True - LOCATION{} -> True - LDATA{} -> True - NEWBLOCK{} -> True - DELTA{} -> True +isMetaInstr instr = + case instr of + ANN _ i -> isMetaInstr i + COMMENT {} -> True + MULTILINE_COMMENT {} -> True + LOCATION {} -> True + LDATA {} -> True + NEWBLOCK {} -> True + DELTA {} -> True PUSH_STACK_FRAME -> True POP_STACK_FRAME -> True - _ -> False + _ -> False -- | Copy the value in a register to another one. +-- -- Must work for all register classes. mkRegRegMoveInstr :: Reg -> Reg -> Instr -mkRegRegMoveInstr src dst = ANN (text "Reg->Reg Move: " <> ppr src <> text " -> " <> ppr dst) $ MOV (OpReg W64 dst) (OpReg W64 src) +mkRegRegMoveInstr src dst = ANN desc instr + where + desc = text "Reg->Reg Move: " <> ppr src <> text " -> " <> ppr dst + instr = MOV (operandFromReg dst) (operandFromReg src) --- | Take the source and destination from this reg -> reg move instruction --- or Nothing if it's not one +-- | Take the source and destination from this (potential) reg -> reg move instruction +-- +-- We have to be a bit careful here: A `MOV` can also mean an implicit +-- conversion. This case is filtered out. takeRegRegMoveInstr :: Instr -> Maybe (Reg,Reg) ---takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = Just (src, dst) +takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = pure (src, dst) takeRegRegMoveInstr _ = Nothing -- | Make an unconditional jump instruction. mkJumpInstr :: BlockId -> [Instr] -mkJumpInstr id = [B (TBlock id)] +mkJumpInstr = pure . B . TBlock +-- | Decrement @sp@ to allocate stack space. +-- +-- The stack grows downwards, so we decrement the stack pointer by @n@ (bytes). +-- This is dual to `mkStackDeallocInstr`. @sp@ is the RISCV stack pointer, not +-- to be confused with the STG stack pointer. mkStackAllocInstr :: Platform -> Int -> [Instr] -mkStackAllocInstr platform n - | n == 0 = [] - | n > 0 && fitsIn12bitImm n = [ ANN (text "Alloc More Stack") $ SUB sp sp (OpImm (ImmInt n)) ] - -- TODO: This case may be optimized with the IP register for large n-s - | n > 0 = ANN (text "Alloc More Stack") (SUB sp sp (OpImm (ImmInt intMax12bit))) : mkStackAllocInstr platform (n - intMax12bit) -mkStackAllocInstr _platform n = pprPanic "mkStackAllocInstr" (int n) +mkStackAllocInstr _platform = moveSp . negate +-- | Increment SP to deallocate stack space. +-- +-- The stack grows downwards, so we increment the stack pointer by @n@ (bytes). +-- This is dual to `mkStackAllocInstr`. @sp@ is the RISCV stack pointer, not to +-- be confused with the STG stack pointer. mkStackDeallocInstr :: Platform -> Int -> [Instr] -mkStackDeallocInstr platform n - | n == 0 = [] - | n > 0 && fitsIn12bitImm n = [ ANN (text "Dealloc More Stack") $ ADD sp sp (OpImm (ImmInt n)) ] - -- TODO: This case may be optimized with the IP register for large n-s - | n > 0 = ANN (text "Dealloc More Stack") (ADD sp sp (OpImm (ImmInt intMax12bit))) : mkStackDeallocInstr platform (n - intMax12bit) -mkStackDeallocInstr _platform n = pprPanic "mkStackDeallocInstr" (int n) +mkStackDeallocInstr _platform = moveSp + +moveSp :: Int -> [Instr] +moveSp n + | n == 0 = [] + | n /= 0 && fitsIn12bitImm n = pure . ANN desc $ ADD sp sp (OpImm (ImmInt n)) + | otherwise = + -- This ends up in three effective instructions. We could get away with + -- two for intMax12bit < n < 3 * intMax12bit by recursing once. However, + -- this way is likely less surprising. + [ ANN desc (MOV ip (OpImm (ImmInt n))), + ADD sp sp ip + ] + where + desc = text "Move SP:" <+> int n -- -- See Note [extra spill slots] in X86/Instr.hs @@ -496,7 +493,7 @@ allocMoreStack platform slots proc@(CmmProc info lbl live (ListGraph code)) = do alloc = mkStackAllocInstr platform delta dealloc = mkStackDeallocInstr platform delta - retargetList = (zip entries (map mkBlockId uniqs)) + retargetList = zip entries (map mkBlockId uniqs) new_blockmap :: LabelMap BlockId new_blockmap = mapFromList retargetList @@ -520,8 +517,8 @@ allocMoreStack platform slots proc@(CmmProc info lbl live (ListGraph code)) = do where retarget b = fromMaybe b (mapLookup b new_blockmap) new_code = concatMap insert_stack_insn code - -- in return (CmmProc info lbl live (ListGraph new_code), retargetList) + -- ----------------------------------------------------------------------------- -- Machine's assembly language @@ -623,8 +620,6 @@ data Instr -- TODO: Rename: MULH | SMULH Operand Operand Operand - | SMULL Operand Operand Operand - | DIVU Operand Operand Operand -- rd = rn ÷ rm -- 2. Bit Manipulation Instructions ---------------------------------------- @@ -637,20 +632,16 @@ data Instr -- | AND Operand Operand Operand -- rd = rn & op2 -- | ANDS Operand Operand Operand -- rd = rn & op2 -- | ASR Operand Operand Operand -- rd = rn ≫ rm or rd = rn ≫ #i, i is 6 bits + -- TODO: unused | BIC Operand Operand Operand -- rd = rn & ~op2 + -- TODO: unused | BICS Operand Operand Operand -- rd = rn & ~op2 | XOR Operand Operand Operand -- rd = rn ⊕ op2 -- | LSL Operand Operand Operand -- rd = rn ≪ rm or rd = rn ≪ #i, i is 6 bits -- | LSR Operand Operand Operand -- rd = rn ≫ rm or rd = rn ≫ #i, i is 6 bits | MOV Operand Operand -- rd = rn or rd = #i - | MOVK Operand Operand - -- | MOVN Operand Operand - -- | MOVZ Operand Operand - | ORN Operand Operand Operand -- rd = rn | ~op2 | ORI Operand Operand Operand -- rd = rn | op2 | XORI Operand Operand Operand -- rd = rn `xor` imm - | ROR Operand Operand Operand -- rd = rn ≫ rm or rd = rn ≫ #i, i is 6 bits - | TST Operand Operand -- rn & op2 -- Load and stores. -- TODO STR/LDR might want to change to STP/LDP with XZR for the second register. -- | STR Format Operand Operand -- str Xn, address-mode // Xn -> *addr @@ -664,10 +655,6 @@ data Instr -- This is a synthetic operation. | CSET Operand Operand Operand Cond -- if(o2 cond o3) op <- 1 else op <- 0 - -- TODO: Unused - | CBZ Operand Target -- if op == 0, then branch. - -- TODO: Unused - | CBNZ Operand Target -- if op /= 0, then branch. -- Branching. -- TODO: Unused | J Target -- like B, but only generated from genJump. Used to distinguish genJumps from others. @@ -707,22 +694,18 @@ instrCon i = POP_STACK_FRAME{} -> "POP_STACK_FRAME" ADD{} -> "ADD" OR{} -> "OR" - -- CMN{} -> "CMN" - -- CMP{} -> "CMP" MUL{} -> "MUL" NEG{} -> "NEG" DIV{} -> "DIV" REM{} -> "REM" REMU{} -> "REMU" SMULH{} -> "SMULH" - SMULL{} -> "SMULL" SUB{} -> "SUB" DIVU{} -> "DIVU" SBFM{} -> "SBFM" UBFM{} -> "UBFM" UBFX{} -> "UBFX" AND{} -> "AND" - -- ANDS{} -> "ANDS" ASR{} -> "ASR" BIC{} -> "BIC" BICS{} -> "BICS" @@ -730,22 +713,12 @@ instrCon i = LSL{} -> "LSL" LSR{} -> "LSR" MOV{} -> "MOV" - MOVK{} -> "MOVK" - ORN{} -> "ORN" ORI{} -> "ORI" XORI{} -> "ORI" - ROR{} -> "ROR" - TST{} -> "TST" STR{} -> "STR" - -- STLR{} -> "STLR" LDR{} -> "LDR" LDRU{} -> "LDRU" - -- LDAR{} -> "LDAR" - -- STP{} -> "STP" - -- LDP{} -> "LDP" CSET{} -> "CSET" - CBZ{} -> "CBZ" - CBNZ{} -> "CBNZ" J{} -> "J" B{} -> "B" B_FAR{} -> "B_FAR" @@ -764,60 +737,12 @@ data Target | TLabel CLabel | TReg Reg - --- Extension --- {Unsigned|Signed}XT{Byte|Half|Word|Doube} -data ExtMode - = EUXTB | EUXTH | EUXTW | EUXTX - | ESXTB | ESXTH | ESXTW | ESXTX - deriving (Eq, Show) - -data ShiftMode - = SLSL | SLSR | SASR | SROR - deriving (Eq, Show) - - --- We can also add ExtShift to Extension. --- However at most 3bits. -type ExtShift = Int --- at most 6bits -type RegShift = Int - data Operand = OpReg Width Reg -- register - | OpRegExt Width Reg ExtMode ExtShift -- rm, [, ] - | OpRegShift Width Reg ShiftMode RegShift -- rm, , <0-64> | OpImm Imm -- immediate value - -- TODO: Does OpImmShift exist in RV64? - | OpImmShift Imm ShiftMode RegShift | OpAddr AddrMode -- memory reference deriving (Eq, Show) --- Note [The made-up RISCV64 IP register] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- --- RISCV64 has no inter-procedural register in its ABI. However, we need one to --- make register spills/loads to/from high number slots. I.e. slot numbers that --- do not fit in a 12bit integer which is used as immediate in the arithmetic --- operations. Thus, we're marking one additional register (x31) as permanently --- non-free and call it IP. --- --- IP can be used as temporary register in all operations. Just be aware that it --- may be clobbered as soon as you loose direct control over it (i.e. using IP --- by-passes the register allocation/spilling mechanisms.) It should be fine to --- use it as temporary register in a MachOp translation as long as you don't --- rely on its value beyond this limited scope. --- --- X31 is a caller-saved register. I.e. there are no guarantees about what the --- callee does with it. That's exactly what we want here. - -zeroReg, raReg, spMachReg, ipReg :: Reg -zeroReg = regSingle 0 -raReg = regSingle 1 --- | Not to be confused with the `CmmReg` `spReg` -spMachReg = regSingle 2 -ipReg = regSingle 31 - operandFromReg :: Reg -> Operand operandFromReg = OpReg W64 @@ -907,13 +832,6 @@ d29 = operandFromRegNo 61 d30 = operandFromRegNo 62 d31 = operandFromRegNo d31RegNo -opRegSExt :: Width -> Reg -> Operand -opRegSExt W64 r = OpRegExt W64 r ESXTX 0 -opRegSExt W32 r = OpRegExt W32 r ESXTW 0 -opRegSExt W16 r = OpRegExt W16 r ESXTH 0 -opRegSExt W8 r = OpRegExt W8 r ESXTB 0 -opRegSExt w _r = pprPanic "opRegSExt" (ppr w) - fitsIn12bitImm :: (Num a, Ord a) => a -> Bool fitsIn12bitImm off = off >= intMin12bit && off <= intMax12bit @@ -937,7 +855,7 @@ isEncodeableInWidth = isNbitEncodeable . widthInBits -- Conditional branch instructions can target labels in a range of +/- 4 KiB. -- The assembler can transform this into a J instruction targeting +/- 1MiB. -- There are rare cases where this is not enough (e.g. the Happy-generated --- @Parser.hs at .) We need to manually transfer these into register based jumps +-- @Parser.hs at .) We need to manually transform these into register based jumps -- using @ip@ (register reserved for calculations.) The trick is to invert the -- condition, do a far jump in the fall-through case or a short jump when the -- (inverted) condition is true. @@ -964,7 +882,7 @@ makeFarBranches info_env blocks | otherwise = annotate addr targetAddr orig where - Just targetAddr = lookupUFM blockAddressMap tgtBid + targetAddr = fromJust $ lookupUFM blockAddressMap tgtBid makeFar _bid addr orig@(B (TBlock tgtBid)) | abs (addr - targetAddr) >= nearLimit = annotate addr targetAddr $ @@ -972,16 +890,16 @@ makeFarBranches info_env blocks | otherwise = annotate addr targetAddr orig where - Just targetAddr = lookupUFM blockAddressMap tgtBid + targetAddr = fromJust $ lookupUFM blockAddressMap tgtBid makeFar bid addr (ANN desc other) = ANN desc $ makeFar bid addr other makeFar _bid _ other = other -- 262144 (2^20 / 4) instructions are allowed; let's keep some distance, as -- we have pseudo-insns that are pretty-printed as multiple instructions, -- and it's just not worth the effort to calculate things exactly as linker - -- relaxations are applied later (optimizing away our flaws.) The - -- conservative guess here is that every instruction does not emit more than - -- two in the mean. + -- relaxations are applied later (optimizing away our flaws.) The educated + -- guess here is that every instruction does not emit more than two in the + -- mean. nearLimit = 131072 - mapSize info_env * maxRetInfoTableSizeW blockAddressMap = listToUFM $ zip (map blockId blocks) blockAddressList ===================================== compiler/GHC/CmmToAsm/RV64/Ppr.hs ===================================== @@ -1,6 +1,3 @@ -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-# LANGUAGE CPP #-} - module GHC.CmmToAsm.RV64.Ppr (pprNatCmmDecl, pprInstr) where import GHC.Prelude hiding (EQ) @@ -304,116 +301,93 @@ negOp (OpImm (ImmInt i)) = OpImm (ImmInt (negate i)) negOp (OpImm (ImmInteger i)) = OpImm (ImmInteger (negate i)) negOp op = pprPanic "RV64.negOp" (text $ show op) --- TODO: Is this used in RISCV?! -pprExt :: IsLine doc => ExtMode -> doc -pprExt EUXTB = text "uxtb" -pprExt EUXTH = text "uxth" -pprExt EUXTW = text "uxtw" -pprExt EUXTX = text "uxtx" -pprExt ESXTB = text "sxtb" -pprExt ESXTH = text "sxth" -pprExt ESXTW = text "sxtw" -pprExt ESXTX = text "sxtx" - --- TODO: Is this used in RISCV?! -pprShift :: IsLine doc => ShiftMode -> doc -pprShift SLSL = text "lsl" -pprShift SLSR = text "lsr" -pprShift SASR = text "asr" -pprShift SROR = text "ror" - pprOp :: IsLine doc => Platform -> Operand -> doc pprOp plat op = case op of OpReg w r -> pprReg w r - OpRegExt w r x 0 -> pprReg w r <> comma <+> pprExt x - OpRegExt w r x i -> pprReg w r <> comma <+> pprExt x <> comma <+> char '#' <> int i - OpRegShift w r s i -> pprReg w r <> comma <+> pprShift s <+> char '#' <> int i OpImm im -> pprIm plat im - OpImmShift im s i -> pprIm plat im <> comma <+> pprShift s <+> char '#' <> int i OpAddr (AddrRegImm r1 im) -> pprImm plat im <> char '(' <> pprReg W64 r1 <> char ')' OpAddr (AddrReg r1) -> text "0(" <+> pprReg W64 r1 <+> char ')' pprReg :: forall doc. IsLine doc => Width -> Reg -> doc pprReg w r = case r of - RegReal (RealRegSingle i) -> ppr_reg_no w i + RegReal (RealRegSingle i) -> ppr_reg_no i -- virtual regs should not show up, but this is helpful for debugging. RegVirtual (VirtualRegI u) -> text "%vI_" <> pprUniqueAlways u RegVirtual (VirtualRegF u) -> text "%vF_" <> pprUniqueAlways u RegVirtual (VirtualRegD u) -> text "%vD_" <> pprUniqueAlways u - _ -> pprPanic "RiscV64.pprReg" (text $ show r) + _ -> pprPanic "RiscV64.pprReg" (text (show r) <+> ppr w) where - -- TODO: Width is only used in error messages, so we could just remove it. - ppr_reg_no :: Width -> Int -> doc + ppr_reg_no :: Int -> doc -- General Purpose Registers - ppr_reg_no _ 0 = text "zero" - ppr_reg_no _ 1 = text "ra" - ppr_reg_no _ 2 = text "sp" - ppr_reg_no _ 3 = text "gp" - ppr_reg_no _ 4 = text "tp" - ppr_reg_no _ 5 = text "t0" - ppr_reg_no _ 6 = text "t1" - ppr_reg_no _ 7 = text "t2" - ppr_reg_no _ 8 = text "s0" - ppr_reg_no _ 9 = text "s1" - ppr_reg_no _ 10 = text "a0" - ppr_reg_no _ 11 = text "a1" - ppr_reg_no _ 12 = text "a2" - ppr_reg_no _ 13 = text "a3" - ppr_reg_no _ 14 = text "a4" - ppr_reg_no _ 15 = text "a5" - ppr_reg_no _ 16 = text "a6" - ppr_reg_no _ 17 = text "a7" - ppr_reg_no _ 18 = text "s2" - ppr_reg_no _ 19 = text "s3" - ppr_reg_no _ 20 = text "s4" - ppr_reg_no _ 21 = text "s5" - ppr_reg_no _ 22 = text "s6" - ppr_reg_no _ 23 = text "s7" - ppr_reg_no _ 24 = text "s8" - ppr_reg_no _ 25 = text "s9" - ppr_reg_no _ 26 = text "s10" - ppr_reg_no _ 27 = text "s11" - ppr_reg_no _ 28 = text "t3" - ppr_reg_no _ 29 = text "t4" - ppr_reg_no _ 30 = text "t5" - ppr_reg_no _ 31 = text "t6" + ppr_reg_no 0 = text "zero" + ppr_reg_no 1 = text "ra" + ppr_reg_no 2 = text "sp" + ppr_reg_no 3 = text "gp" + ppr_reg_no 4 = text "tp" + ppr_reg_no 5 = text "t0" + ppr_reg_no 6 = text "t1" + ppr_reg_no 7 = text "t2" + ppr_reg_no 8 = text "s0" + ppr_reg_no 9 = text "s1" + ppr_reg_no 10 = text "a0" + ppr_reg_no 11 = text "a1" + ppr_reg_no 12 = text "a2" + ppr_reg_no 13 = text "a3" + ppr_reg_no 14 = text "a4" + ppr_reg_no 15 = text "a5" + ppr_reg_no 16 = text "a6" + ppr_reg_no 17 = text "a7" + ppr_reg_no 18 = text "s2" + ppr_reg_no 19 = text "s3" + ppr_reg_no 20 = text "s4" + ppr_reg_no 21 = text "s5" + ppr_reg_no 22 = text "s6" + ppr_reg_no 23 = text "s7" + ppr_reg_no 24 = text "s8" + ppr_reg_no 25 = text "s9" + ppr_reg_no 26 = text "s10" + ppr_reg_no 27 = text "s11" + ppr_reg_no 28 = text "t3" + ppr_reg_no 29 = text "t4" + ppr_reg_no 30 = text "t5" + ppr_reg_no 31 = text "t6" -- Floating Point Registers - ppr_reg_no _ 32 = text "ft0" - ppr_reg_no _ 33 = text "ft1" - ppr_reg_no _ 34 = text "ft2" - ppr_reg_no _ 35 = text "ft3" - ppr_reg_no _ 36 = text "ft4" - ppr_reg_no _ 37 = text "ft5" - ppr_reg_no _ 38 = text "ft6" - ppr_reg_no _ 39 = text "ft7" - ppr_reg_no _ 40 = text "fs0" - ppr_reg_no _ 41 = text "fs1" - ppr_reg_no _ 42 = text "fa0" - ppr_reg_no _ 43 = text "fa1" - ppr_reg_no _ 44 = text "fa2" - ppr_reg_no _ 45 = text "fa3" - ppr_reg_no _ 46 = text "fa4" - ppr_reg_no _ 47 = text "fa5" - ppr_reg_no _ 48 = text "fa6" - ppr_reg_no _ 49 = text "fa7" - ppr_reg_no _ 50 = text "fs2" - ppr_reg_no _ 51 = text "fs3" - ppr_reg_no _ 52 = text "fs4" - ppr_reg_no _ 53 = text "fs5" - ppr_reg_no _ 54 = text "fs6" - ppr_reg_no _ 55 = text "fs7" - ppr_reg_no _ 56 = text "fs8" - ppr_reg_no _ 57 = text "fs9" - ppr_reg_no _ 58 = text "fs10" - ppr_reg_no _ 59 = text "fs11" - ppr_reg_no _ 60 = text "ft8" - ppr_reg_no _ 61 = text "ft9" - ppr_reg_no _ 62 = text "ft10" - ppr_reg_no _ 63 = text "ft11" - - ppr_reg_no w i + ppr_reg_no 32 = text "ft0" + ppr_reg_no 33 = text "ft1" + ppr_reg_no 34 = text "ft2" + ppr_reg_no 35 = text "ft3" + ppr_reg_no 36 = text "ft4" + ppr_reg_no 37 = text "ft5" + ppr_reg_no 38 = text "ft6" + ppr_reg_no 39 = text "ft7" + ppr_reg_no 40 = text "fs0" + ppr_reg_no 41 = text "fs1" + ppr_reg_no 42 = text "fa0" + ppr_reg_no 43 = text "fa1" + ppr_reg_no 44 = text "fa2" + ppr_reg_no 45 = text "fa3" + ppr_reg_no 46 = text "fa4" + ppr_reg_no 47 = text "fa5" + ppr_reg_no 48 = text "fa6" + ppr_reg_no 49 = text "fa7" + ppr_reg_no 50 = text "fs2" + ppr_reg_no 51 = text "fs3" + ppr_reg_no 52 = text "fs4" + ppr_reg_no 53 = text "fs5" + ppr_reg_no 54 = text "fs6" + ppr_reg_no 55 = text "fs7" + ppr_reg_no 56 = text "fs8" + ppr_reg_no 57 = text "fs9" + ppr_reg_no 58 = text "fs10" + ppr_reg_no 59 = text "fs11" + ppr_reg_no 60 = text "ft8" + ppr_reg_no 61 = text "ft9" + ppr_reg_no 62 = text "ft10" + ppr_reg_no 63 = text "ft11" + + ppr_reg_no i | i < 0 = pprPanic "Unexpected register number (min is 0)" (ppr w <+> int i) | i > 63 = pprPanic "Unexpected register number (max is 63)" (ppr w <+> int i) -- no support for widths > W64. @@ -446,7 +420,6 @@ isImmZero (OpImm (ImmDouble 0)) = True isImmZero (OpImm (ImmInt 0)) = True isImmZero _ = False - isLabel :: Target -> Bool isLabel (TBlock _) = True isLabel (TLabel _) = True @@ -500,7 +473,6 @@ pprInstr platform instr = case instr of | isFloatOp o1 && isFloatOp o2 && isFloatOp o3 -> op3 (text "\tfmul." <> if isSingleOp o1 then text "s" else text "d") o1 o2 o3 | otherwise -> op3 (text "\tmul") o1 o2 o3 SMULH o1 o2 o3 -> op3 (text "\tmulh") o1 o2 o3 - SMULL o1 o2 o3 -> op3 (text "\tsmull") o1 o2 o3 NEG o1 o2 | isFloatOp o1 && isFloatOp o2 && isSingleOp o2 -> op2 (text "\tfneg.s") o1 o2 NEG o1 o2 | isFloatOp o1 && isFloatOp o2 && isDoubleOp o2 -> op2 (text "\tfneg.d") o1 o2 NEG o1 o2 -> op2 (text "\tneg") o1 o2 @@ -509,7 +481,7 @@ pprInstr platform instr = case instr of -> op3 (text "\tfdiv." <> if isSingleOp o1 then text "s" else text "d") o1 o2 o3 DIV o1 o2 o3 -> op3 (text "\tdiv") o1 o2 o3 REM o1 o2 o3 | isFloatOp o1 && isFloatOp o2 && isFloatOp o3 - -> panic $ "pprInstr - REM not implemented for floats (yet)" + -> panic "pprInstr - REM not implemented for floats (yet)" REM o1 o2 o3 -> op3 (text "\trem") o1 o2 o3 REMU o1 o2 o3 -> op3 (text "\tremu") o1 o2 o3 @@ -563,12 +535,8 @@ pprInstr platform instr = case instr of -- Surrender! Let the assembler figure out the right expressions with pseudo-op LI. -> lines_ [ text "\tli" <+> pprOp platform o1 <> comma <+> pprOp platform o2 ] | otherwise -> op3 (text "\taddi") o1 o2 (OpImm (ImmInt 0)) - MOVK o1 o2 -> op2 (text "\tmovk") o1 o2 - ORN o1 o2 o3 -> op3 (text "\torn") o1 o2 o3 ORI o1 o2 o3 -> op3 (text "\tori") o1 o2 o3 XORI o1 o2 o3 -> op3 (text "\txori") o1 o2 o3 - ROR o1 o2 o3 -> op3 (text "\tror") o1 o2 o3 - TST o1 o2 -> op2 (text "\ttst") o1 o2 -- 4. Branch Instructions ---------------------------------------------------- J t -> pprInstr platform (B t) @@ -593,7 +561,7 @@ pprInstr platform instr = case instr of BCOND_FAR c l r b t | isLabel t -> lines_ [ text "\t" <> pprBcond (negateCond c) <+> pprOp platform l <> comma <+> pprOp platform r <> comma <+> getLabel platform b <> text "_end" , text "\tla" <+> pprOp platform ip <> comma <+> getLabel platform t - , text "\tjalr" <+> text "x0" <> comma <+> pprOp platform ip <> comma <+> text "0" + , text "\tjalr" <+> text "x0" <> comma <+> pprOp platform ip <> comma <+> text "0" ] BCOND_FAR _ _ _ _ (TReg _) -> panic "RV64.ppr: No conditional branching to registers!" @@ -623,10 +591,10 @@ pprInstr platform instr = case instr of UGE -> lines_ [ sltuFor l r <+> pprOp platform o <> comma <+> pprOp platform l <> comma <+> pprOp platform r , text "\txori" <+> pprOp platform o <> comma <+> pprOp platform o <> comma <+> text "1" ] UGT -> lines_ [ sltuFor l r <+> pprOp platform o <> comma <+> pprOp platform r <> comma <+> pprOp platform l ] - OLT | isFloatOp l && isFloatOp r -> line $ binOp ("\tflt." ++ floatOpPrecision platform l r) - OLE | isFloatOp l && isFloatOp r -> line $ binOp ("\tfle." ++ floatOpPrecision platform l r) - OGT | isFloatOp l && isFloatOp r -> line $ binOp ("\tfgt." ++ floatOpPrecision platform l r) - OGE | isFloatOp l && isFloatOp r -> line $ binOp ("\tfge." ++ floatOpPrecision platform l r) + FLT | isFloatOp l && isFloatOp r -> line $ binOp ("\tflt." ++ floatOpPrecision platform l r) + FLE | isFloatOp l && isFloatOp r -> line $ binOp ("\tfle." ++ floatOpPrecision platform l r) + FGT | isFloatOp l && isFloatOp r -> line $ binOp ("\tfgt." ++ floatOpPrecision platform l r) + FGE | isFloatOp l && isFloatOp r -> line $ binOp ("\tfge." ++ floatOpPrecision platform l r) x -> pprPanic "RV64.ppr: unhandled CSET conditional" (text (show x) <+> pprOp platform o <> comma <+> pprOp platform r <> comma <+> pprOp platform l) where subFor l r | (OpImm _) <- r = text "\taddi" <+> pprOp platform o <> comma <+> pprOp platform l <> comma <+> pprOp platform (negOp r) @@ -641,14 +609,6 @@ pprInstr platform instr = case instr of binOp :: (IsLine doc) => String -> doc binOp op = text op <+> pprOp platform o <> comma <+> pprOp platform l <> comma <+> pprOp platform r - CBZ o (TBlock bid) -> line $ text "\tbeq x0, " <+> pprOp platform o <> comma <+> pprAsmLabel platform (mkLocalBlockLabel (getUnique bid)) - CBZ o (TLabel lbl) -> line $ text "\tbeq x0, " <+> pprOp platform o <> comma <+> pprAsmLabel platform lbl - CBZ _ (TReg _) -> panic "AArch64.ppr: No conditional (cbz) branching to registers!" - - CBNZ o (TBlock bid) -> line $ text "\tbne x0, " <+> pprOp platform o <> comma <+> pprAsmLabel platform (mkLocalBlockLabel (getUnique bid)) - CBNZ o (TLabel lbl) -> line $ text "\tbne x0, " <+> pprOp platform o <> comma <+> pprAsmLabel platform lbl - CBNZ _ (TReg _) -> panic "AArch64.ppr: No conditional (cbnz) branching to registers!" - -- 7. Load and Store Instructions -------------------------------------------- -- NOTE: GHC may do whacky things where it only load the lower part of an -- address. Not observing the correct size when loading will lead @@ -662,7 +622,7 @@ pprInstr platform instr = case instr of LDR _f o1 (OpImm (ImmIndex lbl off)) -> lines_ [ text "\tla" <+> pprOp platform o1 <> comma <+> pprAsmLabel platform lbl - , text "\taddi" <+> pprOp platform o1 <> comma <+> pprOp platform o1 <> comma <+> (int off) + , text "\taddi" <+> pprOp platform o1 <> comma <+> pprOp platform o1 <> comma <+> int off ] LDR _f o1 (OpImm (ImmCLbl lbl)) -> @@ -739,19 +699,20 @@ floatOpPrecision _p l r | isFloatOp l && isFloatOp r && isSingleOp l && isSingle floatOpPrecision _p l r | isFloatOp l && isFloatOp r && isDoubleOp l && isDoubleOp r = "d" -- double precision floatOpPrecision p l r = pprPanic "Cannot determine floating point precission" (text "op1" <+> pprOp p l <+> text "op2" <+> pprOp p r) -pprBcond :: IsLine doc => Cond -> doc +pprBcond :: (IsLine doc) => Cond -> doc pprBcond c = text "b" <> pprCond c - -pprCond :: IsLine doc => Cond -> doc -pprCond c = case c of - EQ -> text "eq" - NE -> text "ne" - SLT -> text "lt" - SLE -> text "le" - SGE -> text "ge" - SGT -> text "gt" - ULT -> text "ltu" - ULE -> text "leu" - UGE -> text "geu" - UGT -> text "gtu" - _ -> panic $ "RV64.ppr: unhandled BCOND conditional: " ++ show c + where + pprCond :: (IsLine doc) => Cond -> doc + pprCond c = case c of + EQ -> text "eq" + NE -> text "ne" + SLT -> text "lt" + SLE -> text "le" + SGE -> text "ge" + SGT -> text "gt" + ULT -> text "ltu" + ULE -> text "leu" + UGE -> text "geu" + UGT -> text "gtu" + -- BCOND cannot handle floating point comparisons / registers + _ -> panic $ "RV64.ppr: unhandled BCOND conditional: " ++ show c ===================================== compiler/GHC/CmmToAsm/RV64/Regs.hs ===================================== @@ -16,6 +16,8 @@ import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Platform +-- * Registers + -- | First integer register number. @zero@ register. x0RegNo :: RegNo x0RegNo = 0 @@ -67,6 +69,31 @@ fa7RegNo, d17RegNo :: RegNo d17RegNo = 49 fa7RegNo = d17RegNo +-- Note [The made-up RISCV64 IP register] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- +-- RISCV64 has no inter-procedural register in its ABI. However, we need one to +-- make register spills/loads to/from high number slots. I.e. slot numbers that +-- do not fit in a 12bit integer which is used as immediate in the arithmetic +-- operations. Thus, we're marking one additional register (x31) as permanently +-- non-free and call it IP. +-- +-- IP can be used as temporary register in all operations. Just be aware that it +-- may be clobbered as soon as you loose direct control over it (i.e. using IP +-- by-passes the register allocation/spilling mechanisms.) It should be fine to +-- use it as temporary register in a MachOp translation as long as you don't +-- rely on its value beyond this limited scope. +-- +-- X31 is a caller-saved register. I.e. there are no guarantees about what the +-- callee does with it. That's exactly what we want here. + +zeroReg, raReg, spMachReg, ipReg :: Reg +zeroReg = regSingle x0RegNo +raReg = regSingle 1 +-- | Not to be confused with the `CmmReg` `spReg` +spMachReg = regSingle 2 +ipReg = regSingle ipRegNo + -- | All machine register numbers. allMachRegNos :: [RegNo] allMachRegNos = intRegs ++ fpRegs @@ -92,14 +119,18 @@ allGpArgRegs = map regSingle [a0RegNo .. a7RegNo] allFpArgRegs :: [Reg] allFpArgRegs = map regSingle [fa0RegNo .. fa7RegNo] +-- * Addressing modes + -- | Addressing modes data AddrMode - = AddrRegImm Reg Imm - | AddrReg Reg + = -- | A register plus some integer, e.g. @8(sp)@ or @-16(sp)@. The offset + -- needs to fit into 12bits. + AddrRegImm Reg Imm + | -- | A register + AddrReg Reg deriving (Eq, Show) --- ----------------------------------------------------------------------------- --- Immediates +-- * Immediates data Imm = ImmInt Int View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/da053cea8d36f62887083575202a01da261dd492...f6f310eeebbd8b51ec51bf058517953daa2593e3 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/da053cea8d36f62887083575202a01da261dd492...f6f310eeebbd8b51ec51bf058517953daa2593e3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 20:55:51 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 15:55:51 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/data-kind Message-ID: <65e8d857ca4de_38980e119bdf001091c7@gitlab.mail> Ben Gamari pushed new branch wip/data-kind at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/data-kind You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 21:20:24 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Wed, 06 Mar 2024 16:20:24 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] Try preserving the original laziness Message-ID: <65e8de184ee54_38980e126b881811806c@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: 4806677c by Mikolaj Konarski at 2024-03-06T22:20:07+01:00 Try preserving the original laziness - - - - - 1 changed file: - compiler/GHC/Core/TyCo/Tidy.hs Changes: ===================================== compiler/GHC/Core/TyCo/Tidy.hs ===================================== @@ -235,7 +235,7 @@ tidyCo env@(_, subst) co -- the case above duplicates a bit of work in tidying h and the kind -- of tv. But the alternative is to use coercionKind, which seems worse. go (FunCo r afl afr w co1 co2) = ((FunCo r afl afr $! go w) $! go co1) $! go co2 - go (CoVarCo cv) = CoVarCo $! go_cv cv + go (CoVarCo cv) = CoVarCo $ go_cv cv go (HoleCo h) = HoleCo h go (AxiomInstCo con ind cos) = AxiomInstCo con ind $! strictMap go cos go (UnivCo p r t1 t2) = (((UnivCo $! (go_prov p)) $! r) $! View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4806677c9b8bad999093e94b07ae10f8a3d8e5ff -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4806677c9b8bad999093e94b07ae10f8a3d8e5ff You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 21:50:25 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 16:50:25 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 6 commits: rts: expose HeapAlloc.h as public header Message-ID: <65e8e5212490a_38980e13558bd4118624@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - a6054b42 by Ben Gamari at 2024-03-06T16:49:43-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 30 changed files: - .gitlab-ci.yml - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs - libraries/base/src/System/IO.hs - libraries/base/src/System/Mem/Weak.hs - libraries/base/src/System/Posix/Internals.hs - libraries/base/src/Text/ParserCombinators/ReadP.hs - libraries/base/src/Text/ParserCombinators/ReadPrec.hs - libraries/base/src/Text/Read.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - rts/Sparks.c - rts/include/rts/storage/Block.h - rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h - rts/posix/OSMem.c - rts/rts.cabal - rts/sm/CNF.c - rts/sm/GC.h - rts/sm/NonMoving.h - rts/sm/NonMovingMark.c The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f7ab7dfa05cd545e5f22334b061eb74408751bb...a6054b425e2bde8c246ca9a8d59b3c5bbfc39d23 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f7ab7dfa05cd545e5f22334b061eb74408751bb...a6054b425e2bde8c246ca9a8d59b3c5bbfc39d23 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 22:05:21 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 17:05:21 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T24513 Message-ID: <65e8e8a1d5b91_38980e139caa141194ab@gitlab.mail> Ben Gamari pushed new branch wip/T24513 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24513 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 22:06:23 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 17:06:23 -0500 Subject: [Git][ghc/ghc][wip/T24513] rts: Fix SET_HDR initialization of retainer set Message-ID: <65e8e8df9590b_38980e13a809541228da@gitlab.mail> Ben Gamari pushed to branch wip/T24513 at Glasgow Haskell Compiler / GHC Commits: c4c57631 by Ben Gamari at 2024-03-06T17:06:17-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 1 changed file: - rts/include/rts/storage/ClosureMacros.h Changes: ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4c57631ccf94acd87367831ff2c9e2ede154b39 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4c57631ccf94acd87367831ff2c9e2ede154b39 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 6 23:36:14 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Wed, 06 Mar 2024 18:36:14 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] 32 commits: testsuite: fix T23540 fragility on 32-bit platforms Message-ID: <65e8fdee19fd7_38980e163d66b41319c5@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 70f2d3ee by Mikolaj Konarski at 2024-03-07T00:34:41+01:00 Add DCoVarSet to PluginProv Add the only remaining piece of feedback from git add src/Flavour.hs Help CI check some more of the patch Fix the 3 plugin tests that fail Explain better how shallowCoVarsOfCosDSet is entangled with a hundreds of lines bit-rotten refactoring Fix according to the first round of Simon's instruction Fix according to the second round of Simon's instruction Remove a question-comment that's probably absurd Fix according to the third round of Simon's instruction - - - - - 053fdb81 by Mikolaj Konarski at 2024-03-07T00:34:41+01:00 Make sure the foldl' accumulators are strict - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/Coercion/Opt.hs - compiler/GHC/Core/FVs.hs - compiler/GHC/Core/LateCC.hs - + compiler/GHC/Core/LateCC/OverloadedCalls.hs - + compiler/GHC/Core/LateCC/TopLevelBinds.hs - + compiler/GHC/Core/LateCC/Types.hs - + compiler/GHC/Core/LateCC/Utils.hs - compiler/GHC/Core/Lint.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Core/TyCo/FVs.hs - compiler/GHC/Core/TyCo/Rep.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/Core/TyCo/Tidy.hs - compiler/GHC/Core/Type.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4806677c9b8bad999093e94b07ae10f8a3d8e5ff...053fdb81f509cc6158c5d645ef2402e24ca3c115 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4806677c9b8bad999093e94b07ae10f8a3d8e5ff...053fdb81f509cc6158c5d645ef2402e24ca3c115 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 04:33:11 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 23:33:11 -0500 Subject: [Git][ghc/ghc][wip/T24513] rts: Fix SET_HDR initialization of retainer set Message-ID: <65e94387b9548_3e2dad4d9e9d870bd@gitlab.mail> Ben Gamari pushed to branch wip/T24513 at Glasgow Haskell Compiler / GHC Commits: 4f51757f by Ben Gamari at 2024-03-06T23:33:06-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 1 changed file: - rts/include/rts/storage/ClosureMacros.h Changes: ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.hp.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4f51757ff0c55d97ab8c6765b378b2e97f617d8b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4f51757ff0c55d97ab8c6765b378b2e97f617d8b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 04:44:25 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 23:44:25 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T24515 Message-ID: <65e94629d3384_3e2dad527de54749a@gitlab.mail> Ben Gamari pushed new branch wip/T24515 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24515 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 04:44:37 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 23:44:37 -0500 Subject: [Git][ghc/ghc][wip/T24515] 9 commits: base: Reflect new era profiling RTS flags in GHC.RTS.Flags Message-ID: <65e94635dfd77_3e2dad52d503c763e@gitlab.mail> Ben Gamari pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 82e0d401 by Ben Gamari at 2024-03-06T23:44:33-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. - - - - - 30 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - libraries/base/changelog.md - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs - libraries/base/src/System/IO.hs - libraries/base/src/System/Mem/Weak.hs - libraries/base/src/System/Posix/Internals.hs - libraries/base/src/Text/ParserCombinators/ReadP.hs - libraries/base/src/Text/ParserCombinators/ReadPrec.hs - libraries/base/src/Text/Read.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc - rts/ProfHeap.c - rts/Profiling.c - rts/RtsFlags.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/Sparks.c The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e8fc51acfc7fb78d756e9e92e683ce70305f1466...82e0d401abbd8e0e550daa10a506ff00adbaa001 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e8fc51acfc7fb78d756e9e92e683ce70305f1466...82e0d401abbd8e0e550daa10a506ff00adbaa001 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 04:46:52 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 06 Mar 2024 23:46:52 -0500 Subject: [Git][ghc/ghc][wip/T24515] rts: Drop .wasm suffix from .prof file names Message-ID: <65e946bccde01_3e2dad533622478e6@gitlab.mail> Ben Gamari pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: 56c3cac0 by Ben Gamari at 2024-03-06T23:46:38-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 4 changed files: - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h Changes: ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasi32_HOST_OS) + dropExtension(prog, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasi32_HOST_OS) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/56c3cac08ae0d28e797527487699cbae858985d7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/56c3cac08ae0d28e797527487699cbae858985d7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 08:17:02 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Thu, 07 Mar 2024 03:17:02 -0500 Subject: [Git][ghc/ghc][wip/T24515] 2 commits: rts: Drop .wasm suffix from .prof file names Message-ID: <65e977fedfc05_3e2dadac5e1e421440@gitlab.mail> Cheng Shao pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: 9c9994a2 by Ben Gamari at 2024-03-07T08:16:05+00:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 3d9aed44 by Cheng Shao at 2024-03-07T08:16:30+00:00 Revert "testsuite: include target exe extension in heap profile filenames" This reverts commit 6f511c36f9845a6e3731e658de4992bfd9806a52. - - - - - 5 changed files: - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - testsuite/driver/testlib.py Changes: ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(stem, ".exe"); +#elif defined(wasm32_HOST_ARCH) + dropExtension(stem, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasm32_HOST_ARCH) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" ===================================== testsuite/driver/testlib.py ===================================== @@ -2332,11 +2332,11 @@ async def check_hp_ok(name: TestName) -> bool: actual_name = name + exe_extension() if not opts.ignore_extension else name # do not qualify for hp2ps because we should be in the right directory - hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {actual_name}'.format(**locals()) + hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {name}'.format(**locals()) hp2psResult = await runCmd(hp2psCmd, print_output=True) - actual_ps_path = in_testdir(actual_name, 'ps') + actual_ps_path = in_testdir(name, 'ps') if hp2psResult == 0: if actual_ps_path.exists(): @@ -2345,15 +2345,15 @@ async def check_hp_ok(name: TestName) -> bool: if (gsResult == 0): return True else: - print("hp2ps output for " + actual_name + " is not valid PostScript") + print("hp2ps output for " + name + " is not valid PostScript") return False else: return True # assume postscript is valid without ghostscript else: - print("hp2ps did not generate PostScript for " + actual_name) + print("hp2ps did not generate PostScript for " + name) return False else: - print("hp2ps error when processing heap profile for " + actual_name) + print("hp2ps error when processing heap profile for " + name) return False async def check_prof_ok(name: TestName, way: WayName) -> bool: View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/56c3cac08ae0d28e797527487699cbae858985d7...3d9aed44cf82ce2ebebcdca4d901f7f68913ce34 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/56c3cac08ae0d28e797527487699cbae858985d7...3d9aed44cf82ce2ebebcdca4d901f7f68913ce34 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 08:40:59 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Thu, 07 Mar 2024 03:40:59 -0500 Subject: [Git][ghc/ghc][wip/T24515] testsuite: drop exe extension from .hp & .prof filenames Message-ID: <65e97d9bcd3a9_3e2dadb6984e8218a9@gitlab.mail> Cheng Shao pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: 4184eaba by Cheng Shao at 2024-03-07T08:40:24+00:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 1 changed file: - testsuite/driver/testlib.py Changes: ===================================== testsuite/driver/testlib.py ===================================== @@ -2329,14 +2329,13 @@ def write_file(f: Path, s: str) -> None: async def check_hp_ok(name: TestName) -> bool: opts = getTestOpts() - actual_name = name + exe_extension() if not opts.ignore_extension else name # do not qualify for hp2ps because we should be in the right directory - hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {actual_name}'.format(**locals()) + hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {name}'.format(**locals()) hp2psResult = await runCmd(hp2psCmd, print_output=True) - actual_ps_path = in_testdir(actual_name, 'ps') + actual_ps_path = in_testdir(name, 'ps') if hp2psResult == 0: if actual_ps_path.exists(): @@ -2345,15 +2344,15 @@ async def check_hp_ok(name: TestName) -> bool: if (gsResult == 0): return True else: - print("hp2ps output for " + actual_name + " is not valid PostScript") + print("hp2ps output for " + name + " is not valid PostScript") return False else: return True # assume postscript is valid without ghostscript else: - print("hp2ps did not generate PostScript for " + actual_name) + print("hp2ps did not generate PostScript for " + name) return False else: - print("hp2ps error when processing heap profile for " + actual_name) + print("hp2ps error when processing heap profile for " + name) return False async def check_prof_ok(name: TestName, way: WayName) -> bool: @@ -2365,7 +2364,7 @@ async def check_prof_ok(name: TestName, way: WayName) -> bool: if not expected_prof_path.exists(): return True - actual_prof_file = add_suffix(name + exe_extension(), 'prof') + actual_prof_file = add_suffix(name, 'prof') actual_prof_path = in_testdir(actual_prof_file) if not actual_prof_path.exists(): View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4184eabaded1965f4a4bde4c5053132e67978bc2 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4184eabaded1965f4a4bde4c5053132e67978bc2 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 10:00:00 2024 From: gitlab at gitlab.haskell.org (Vladislav Zavialov (@int-index)) Date: Thu, 07 Mar 2024 05:00:00 -0500 Subject: [Git][ghc/ghc][wip/int-index/visargs-errmsg] 80 commits: Add @since annotation to Data.Data.mkConstrTag Message-ID: <65e99020f1607_3e2dadd86f4e0320c7@gitlab.mail> Vladislav Zavialov pushed to branch wip/int-index/visargs-errmsg at Glasgow Haskell Compiler / GHC Commits: 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 3fa9a654 by Vladislav Zavialov at 2024-03-07T12:59:25+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - 30 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs - compiler/GHC/Cmm/Dataflow/Graph.hs - compiler/GHC/Cmm/Dataflow/Label.hs - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Cmm/Info.hs - compiler/GHC/Cmm/Info/Build.hs - compiler/GHC/Cmm/LayoutStack.hs - compiler/GHC/Cmm/Lint.hs - compiler/GHC/Cmm/Liveness.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f96fd479be53aebc8e2abb1b6a06dace0be1def7...3fa9a654f11e4dfe6529dea66f3cdc0fdff4e07d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f96fd479be53aebc8e2abb1b6a06dace0be1def7...3fa9a654f11e4dfe6529dea66f3cdc0fdff4e07d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 10:02:07 2024 From: gitlab at gitlab.haskell.org (Vladislav Zavialov (@int-index)) Date: Thu, 07 Mar 2024 05:02:07 -0500 Subject: [Git][ghc/ghc][wip/int-index/visargs-errmsg] Rephrase error message to say "visible arguments" (#24318) Message-ID: <65e9909fc0c7e_3e2daddb106543245c@gitlab.mail> Vladislav Zavialov pushed to branch wip/int-index/visargs-errmsg at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - 24 changed files: - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - testsuite/tests/ado/ado002.stderr - testsuite/tests/ghci/scripts/Defer02.stderr - testsuite/tests/indexed-types/should_compile/T10806.stderr - testsuite/tests/indexed-types/should_fail/T8518.stderr - testsuite/tests/rep-poly/T23903.stderr - testsuite/tests/th/T5358.stderr - testsuite/tests/typecheck/should_fail/DoExpansion2.stderr - testsuite/tests/typecheck/should_fail/DoExpansion3.stderr - testsuite/tests/typecheck/should_fail/FD1.stderr - testsuite/tests/typecheck/should_fail/T13902.stderr - testsuite/tests/typecheck/should_fail/T17139.stderr - + testsuite/tests/typecheck/should_fail/T24318.hs - + testsuite/tests/typecheck/should_fail/T24318.stderr - testsuite/tests/typecheck/should_fail/T8603.stderr - testsuite/tests/typecheck/should_fail/T9605.stderr - testsuite/tests/typecheck/should_fail/all.T - testsuite/tests/typecheck/should_fail/tcfail001.stderr - testsuite/tests/typecheck/should_fail/tcfail140.stderr - testsuite/tests/typecheck/should_fail/tcfail175.stderr - testsuite/tests/vdq-rta/should_fail/T22326_fail_n_args.stderr - testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr Changes: ===================================== compiler/GHC/Tc/Gen/Match.hs ===================================== @@ -75,7 +75,7 @@ import GHC.Driver.DynFlags ( getDynFlags ) import GHC.Types.Name import GHC.Types.Id import GHC.Types.SrcLoc -import GHC.Types.Basic( Arity, isDoExpansionGenerated ) +import GHC.Types.Basic( VisArity, isDoExpansionGenerated ) import Control.Monad import Control.Arrow ( second ) @@ -1207,7 +1207,7 @@ the variables they bind into scope, and typecheck the thing_inside. -- The MatchGroup for `f` has arity 2, not 3 checkArgCounts :: AnnoBody body => MatchGroup GhcRn (LocatedA (body GhcRn)) - -> TcM Arity + -> TcM VisArity checkArgCounts (MG { mg_alts = L _ [] }) = return 1 -- See Note [Empty MatchGroups] in GHC.Rename.Bind -- case e of {} or \case {} @@ -1227,6 +1227,6 @@ checkArgCounts (MG { mg_alts = L _ (match1:matches) }) n_args1 = reqd_args_in_match match1 mb_bad_matches = NE.nonEmpty [m | m <- matches, reqd_args_in_match m /= n_args1] - reqd_args_in_match :: LocatedA (Match GhcRn body1) -> Arity + reqd_args_in_match :: LocatedA (Match GhcRn body1) -> VisArity -- Counts the number of /required/ args in the match reqd_args_in_match (L _ (Match { m_pats = pats })) = count (isVisArgPat . unLoc) pats ===================================== compiler/GHC/Tc/Utils/Unify.hs ===================================== @@ -751,7 +751,7 @@ Example: matchExpectedFunTys :: forall a. ExpectedFunTyOrigin -- See Note [Herald for matchExpectedFunTys] -> UserTypeCtxt - -> Arity + -> VisArity -> ExpSigmaType -> ([ExpPatType] -> ExpRhoType -> TcM a) -> TcM (HsWrapper, a) @@ -777,7 +777,7 @@ matchExpectedFunTys herald _ arity (Infer inf_res) thing_inside matchExpectedFunTys herald ctx arity (Check top_ty) thing_inside = check 0 [] top_ty where - check :: Arity -> [ExpPatType] -> TcSigmaType -> TcM (HsWrapper, a) + check :: VisArity -> [ExpPatType] -> TcSigmaType -> TcM (HsWrapper, a) -- `check` is called only in the Check{} case -- It collects rev_pat_tys in reversed order -- n_so_far is the number of /visible/ arguments seen so far: @@ -875,7 +875,7 @@ matchExpectedFunTys herald ctx arity (Check top_ty) thing_inside defer n_so_far rev_pat_tys res_ty ------------ - defer :: Arity -> [ExpPatType] -> TcRhoType -> TcM (HsWrapper, a) + defer :: VisArity -> [ExpPatType] -> TcRhoType -> TcM (HsWrapper, a) defer n_so_far rev_pat_tys fun_ty = do { more_arg_tys <- mapM (new_check_arg_ty herald) [n_so_far + 1 .. arity] ; let all_pats = reverse rev_pat_tys ++ map mkCheckExpFunPatTy more_arg_tys @@ -898,19 +898,15 @@ new_check_arg_ty herald arg_pos -- Position for error messages only ; return (mkScaled mult arg_ty) } mkFunTysMsg :: ExpectedFunTyOrigin - -> (Arity, TcType) + -> (VisArity, TcType) -> TidyEnv -> ZonkM (TidyEnv, SDoc) -- See Note [Reporting application arity errors] -mkFunTysMsg herald (n_val_args_in_call, fun_ty) env +mkFunTysMsg herald (n_vis_args_in_call, fun_ty) env = do { (env', fun_ty) <- zonkTidyTcType env fun_ty ; let (pi_ty_bndrs, _) = splitPiTys fun_ty - - -- `all_arg_tys` contains visible quantifiers only, so their number matches - -- the number of arguments that the user needs to pass to the function. n_fun_args = count isVisiblePiTyBinder pi_ty_bndrs - - msg | n_val_args_in_call <= n_fun_args -- Enough args, in the end + msg | n_vis_args_in_call <= n_fun_args -- Enough args, in the end = text "In the result of a function call" | otherwise = hang (full_herald <> comma) @@ -921,7 +917,8 @@ mkFunTysMsg herald (n_val_args_in_call, fun_ty) env ; return (env', msg) } where full_herald = pprExpectedFunTyHerald herald - <+> speakNOf n_val_args_in_call (text "value argument") + <+> speakNOf n_vis_args_in_call (text "visible argument") + -- What are "visible" arguments? See Note [Visibility and arity] in GHC.Types.Basic {- Note [Reporting application arity errors] @@ -931,8 +928,8 @@ and the call foo = f 3 4 5 We'd like to get an error like: • Couldn't match expected type ‘t0 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to three value arguments, - but its type ‘Int -> Int -> Int’ has only two + • The function ‘f’ is applied to three visible arguments, -- What are "visible" arguments? + but its type ‘Int -> Int -> Int’ has only two -- See Note [Visibility and arity] in GHC.Types.Basic That is what `mkFunTysMsg` tries to do. But what is the "type of the function". Most obviously, we can report its full, polymorphic type; that is simple and @@ -943,7 +940,7 @@ We get this error: • Couldn't match type ‘Int’ with ‘t0 -> t’ Expected: Int -> t0 -> t Actual: Int -> Int - • The function ‘f’ is applied to three value arguments, + • The function ‘f’ is applied to three visible arguments, but its type ‘Bool -> t Int Int’ has only one That's not /quite/ right beause we can instantiate `t` to an arrow and get ===================================== compiler/GHC/Types/Basic.hs ===================================== @@ -28,7 +28,7 @@ module GHC.Types.Basic ( ConTag, ConTagZ, fIRST_TAG, - Arity, RepArity, JoinArity, FullArgCount, + Arity, VisArity, RepArity, JoinArity, FullArgCount, JoinPointHood(..), isJoinPoint, Alignment, mkAlignment, alignmentOf, alignmentBytes, @@ -183,6 +183,10 @@ instance Binary LeftOrRight where -- See also Note [Definition of arity] in "GHC.Core.Opt.Arity" type Arity = Int +-- | Syntactic (visibility) arity, i.e. the number of visible arguments. +-- See Note [Visibility and arity] +type VisArity = Int + -- | Representation Arity -- -- The number of represented arguments that can be applied to a value before it does @@ -203,6 +207,71 @@ type JoinArity = Int -- both type and value arguments! type FullArgCount = Int +{- Note [Visibility and arity] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Arity is the number of arguments that a function expects. In a curried language +like Haskell, there is more than one way to count those arguments. + +* `Arity` is the classic notion of arity, concerned with evalution, so it counts + the number of /value/ arguments that need to be supplied before evaluation can + take place, as described in notes + Note [Definition of arity] in GHC.Core.Opt.Arity + Note [Arity and function types] in GHC.Types.Id.Info + + Examples: + Int has arity == 0 + Int -> Int has arity <= 1 + Int -> Bool -> Int has arity <= 2 + We write (<=) rather than (==) as sometimes evaluation can occur before all + value arguments are supplied, depending on the actual function definition. + + This evaluation-focused notion of arity ignores type arguments, so: + forall a. a has arity == 0 + forall a. a -> a has arity <= 1 + forall a b. a -> b -> a has arity <= 2 + This is true regardless of ForAllTyFlag, so the arity is also unaffected by + (forall {a}. ty) or (forall a -> ty). + + Class dictionaries count towards the arity, as they are passed at runtime + forall a. (Num a) => a has arity <= 1 + forall a. (Num a) => a -> a has arity <= 2 + forall a b. (Num a, Ord b) => a -> b -> a has arity <= 4 + +* `VisArity` is the syntactic notion of arity. It is the number of /visible/ + arguments, i.e. arguments that occur visibly in the source code. + + In a function call `f x y z`, we can confidently say that f's vis-arity >= 3, + simply because we see three arguments [x,y,z]. We write (>=) rather than (==) + as this could be a partial application. + + At definition sites, we can acquire an underapproximation of vis-arity by + counting the patterns on the LHS, e.g. `f a b = rhs` has vis-arity >= 2. + The actual vis-arity can be higher if there is a lambda on the RHS, + e.g. `f a b = \c -> rhs`. + + If we look at the types, we can observe the following + * function arrows (a -> b) add to the vis-arity + * visible foralls (forall a -> b) add to the vis-arity + * constraint arrows (a => b) do not affect the vis-arity + * invisible foralls (forall a. b) do not affect the vis-arity + + This means that ForAllTyFlag matters for VisArity (in contrast to Arity), + while the type/value distinction is unimportant (again in contrast to Arity). + + Examples: + Int -- vis-arity == 0 (no args) + Int -> Int -- vis-arity == 1 (1 funarg) + forall a. a -> a -- vis-arity == 1 (1 funarg) + forall a. Num a => a -> a -- vis-arity == 1 (1 funarg) + forall a -> Num a => a -- vis-arity == 1 (1 req tyarg, 0 funargs) + forall a -> a -> a -- vis-arity == 2 (1 req tyarg, 1 funarg) + Int -> forall a -> Int -- vis-arity == 2 (1 funarg, 1 req tyarg) + + Wrinkle: with TypeApplications and TypeAbstractions, it is possible to visibly + bind and pass invisible arguments, e.g. `f @a x = ...` or `f @Int 42`. Those + @-prefixed arguments are ignored for the purposes of vis-arity. +-} + {- ************************************************************************ * * ===================================== testsuite/tests/ado/ado002.stderr ===================================== @@ -2,7 +2,7 @@ ado002.hs:8:8: error: [GHC-83865] • Couldn't match expected type: Char -> IO b0 with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In a stmt of a 'do' block: y <- getChar 'a' In the expression: @@ -45,7 +45,7 @@ ado002.hs:15:13: error: [GHC-83865] ado002.hs:23:9: error: [GHC-83865] • Couldn't match expected type: Char -> IO a0 with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In a stmt of a 'do' block: x5 <- getChar x4 In the expression: ===================================== testsuite/tests/ghci/scripts/Defer02.stderr ===================================== @@ -26,7 +26,7 @@ Defer01.hs:24:4: warning: [GHC-40564] [-Winaccessible-code (in -Wdefault)] Defer01.hs:30:5: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one value argument, + • The function ‘e’ is applied to one visible argument, but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' @@ -95,7 +95,7 @@ Defer01.hs:49:5: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] (deferred type error) *** Exception: Defer01.hs:30:5: error: [GHC-83865] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one value argument, + • The function ‘e’ is applied to one visible argument, but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' ===================================== testsuite/tests/indexed-types/should_compile/T10806.stderr ===================================== @@ -2,7 +2,7 @@ T10806.hs:11:32: error: [GHC-83865] • Couldn't match expected type: Char -> Bool with actual type: IO () - • The function ‘print’ is applied to two value arguments, + • The function ‘print’ is applied to two visible arguments, but its type ‘Show a => a -> IO ()’ has only one In the expression: print 'x' 'y' In an equation for ‘triggersLoop’: ===================================== testsuite/tests/indexed-types/should_fail/T8518.stderr ===================================== @@ -2,7 +2,7 @@ T8518.hs:14:18: error: [GHC-83865] • Couldn't match expected type: Z c -> B c -> t0 with actual type: F c - • The function ‘rpt’ is applied to four value arguments, + • The function ‘rpt’ is applied to four visible arguments, but its type ‘t1 -> t2 -> F t2’ has only two In the expression: rpt (4 :: Int) c z b In an equation for ‘callCont’: ===================================== testsuite/tests/rep-poly/T23903.stderr ===================================== @@ -6,5 +6,5 @@ T23903.hs:21:1: error: [GHC-55287] t0 :: TYPE cx0 Cannot unify ‘Rep a’ with the type variable ‘cx0’ because the former is not a concrete ‘RuntimeRep’. - • The equation for ‘f’ has one value argument, + • The equation for ‘f’ has one visible argument, but its type ‘a #-> ()’ has none ===================================== testsuite/tests/th/T5358.stderr ===================================== @@ -1,17 +1,17 @@ T5358.hs:7:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t1 -> t1’ - • The equation for ‘t1’ has one value argument, + • The equation for ‘t1’ has one visible argument, but its type ‘Int’ has none T5358.hs:8:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t0 -> t0’ - • The equation for ‘t2’ has one value argument, + • The equation for ‘t2’ has one visible argument, but its type ‘Int’ has none T5358.hs:10:13: error: [GHC-83865] • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t1’ is applied to one value argument, + • The function ‘t1’ is applied to one visible argument, but its type ‘Int’ has none In the first argument of ‘(==)’, namely ‘t1 x’ In the expression: t1 x == t2 x @@ -21,7 +21,7 @@ T5358.hs:10:13: error: [GHC-83865] T5358.hs:10:21: error: [GHC-83865] • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t2’ is applied to one value argument, + • The function ‘t2’ is applied to one visible argument, but its type ‘Int’ has none In the second argument of ‘(==)’, namely ‘t2 x’ In the expression: t1 x == t2 x ===================================== testsuite/tests/typecheck/should_fail/DoExpansion2.stderr ===================================== @@ -55,7 +55,7 @@ DoExpansion2.hs:31:19: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefaul DoExpansion2.hs:34:22: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type: t0 -> IO (Maybe Int) with actual type: IO String - • The function ‘getVal’ is applied to two value arguments, + • The function ‘getVal’ is applied to two visible arguments, but its type ‘Int -> IO String’ has only one In a stmt of a 'do' block: Just x <- getVal 3 4 In the expression: ===================================== testsuite/tests/typecheck/should_fail/DoExpansion3.stderr ===================================== @@ -10,7 +10,7 @@ DoExpansion3.hs:15:20: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefaul DoExpansion3.hs:18:20: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type: t0 -> t with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In the expression: getChar 2 In an equation for ‘y’: y = getChar 2 ===================================== testsuite/tests/typecheck/should_fail/FD1.stderr ===================================== @@ -5,6 +5,6 @@ FD1.hs:16:1: error: [GHC-25897] the type signature for: plus :: forall a. E a (Int -> Int) => Int -> a at FD1.hs:15:1-38 - • The equation for ‘plus’ has two value arguments, + • The equation for ‘plus’ has two visible arguments, but its type ‘Int -> a’ has only one • Relevant bindings include plus :: Int -> a (bound at FD1.hs:16:1) ===================================== testsuite/tests/typecheck/should_fail/T13902.stderr ===================================== @@ -1,7 +1,7 @@ T13902.hs:8:5: error: [GHC-83865] • Couldn't match expected type ‘t0 -> Int’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘a -> a’ has only one In the expression: f @Int 42 5 In an equation for ‘g’: g = f @Int 42 5 ===================================== testsuite/tests/typecheck/should_fail/T17139.stderr ===================================== @@ -7,7 +7,7 @@ T17139.hs:15:16: error: [GHC-88464] lift :: forall a b (f :: * -> *). (a -> b) -> TypeFam f (a -> b) at T17139.hs:14:1-38 • In the expression: _ (f <*> x) - The lambda expression ‘\ x -> ...’ has one value argument, + The lambda expression ‘\ x -> ...’ has one visible argument, but its type ‘TypeFam f (a -> b)’ has none In the expression: \ x -> _ (f <*> x) • Relevant bindings include ===================================== testsuite/tests/typecheck/should_fail/T24318.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE ExplicitNamespaces, RequiredTypeArguments #-} + +module T24318 where + +import Data.Kind + +f :: forall (a :: Type) -> Bool +f (type t) x = True ===================================== testsuite/tests/typecheck/should_fail/T24318.stderr ===================================== @@ -0,0 +1,5 @@ + +T24318.hs:8:1: error: [GHC-83865] + • Couldn't match expected type ‘Bool’ with actual type ‘t0 -> Bool’ + • The equation for ‘f’ has two visible arguments, + but its type ‘forall a -> Bool’ has only one ===================================== testsuite/tests/typecheck/should_fail/T8603.stderr ===================================== @@ -6,7 +6,7 @@ T8603.hs:33:17: error: [GHC-18872] [a2] :: * Expected: [a2] -> StateT s RV a0 Actual: t0 ((->) [a1]) (StateT s RV a0) - • The function ‘lift’ is applied to two value arguments, + • The function ‘lift’ is applied to two visible arguments, but its type ‘(Control.Monad.Trans.Class.MonadTrans t, Monad m) => m a -> t m a’ has only one ===================================== testsuite/tests/typecheck/should_fail/T9605.stderr ===================================== @@ -3,7 +3,7 @@ T9605.hs:7:6: error: [GHC-83865] • Couldn't match type ‘Bool’ with ‘m Bool’ Expected: t0 -> m Bool Actual: t0 -> Bool - • The function ‘f1’ is applied to one value argument, + • The function ‘f1’ is applied to one visible argument, but its type ‘Monad m => m Bool’ has none In the expression: f1 undefined In an equation for ‘f2’: f2 = f1 undefined ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -712,6 +712,7 @@ test('ErrorIndexLinks', normal, compile_fail, ['-fprint-error-index-links=always test('T24064', normal, compile_fail, ['']) test('T24298', normal, compile_fail, ['']) test('T24279', normal, compile_fail, ['']) +test('T24318', normal, compile_fail, ['']) # all the various do expansion fail messages test('DoExpansion1', normal, compile, ['-fdefer-type-errors']) ===================================== testsuite/tests/typecheck/should_fail/tcfail001.stderr ===================================== @@ -2,7 +2,7 @@ tcfail001.hs:9:2: error: [GHC-83865] • Couldn't match expected type: [a] with actual type: [a0] -> [a1] - • The equation for ‘op’ has one value argument, + • The equation for ‘op’ has one visible argument, but its type ‘[a]’ has none In the instance declaration for ‘A [a]’ • Relevant bindings include op :: [a] (bound at tcfail001.hs:9:2) ===================================== testsuite/tests/typecheck/should_fail/tcfail140.stderr ===================================== @@ -1,7 +1,7 @@ tcfail140.hs:11:7: error: [GHC-83865] • Couldn't match expected type ‘t1 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘Int -> Int’ has only one In the expression: f 3 9 In an equation for ‘bar’: bar = f 3 9 @@ -9,7 +9,7 @@ tcfail140.hs:11:7: error: [GHC-83865] tcfail140.hs:13:10: error: [GHC-83865] • Couldn't match expected type ‘t2 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘Int -> Int’ has only one In the expression: 3 `f` 4 In an equation for ‘rot’: rot xs = 3 `f` 4 @@ -28,11 +28,11 @@ tcfail140.hs:15:15: error: [GHC-83865] tcfail140.hs:17:8: error: [GHC-27346] • The data constructor ‘Just’ should have 1 argument, but has been given none • In the pattern: Just - The lambda expression ‘\ Just x -> ...’ has two value arguments, + The lambda expression ‘\ Just x -> ...’ has two visible arguments, but its type ‘Maybe a -> a’ has only one In the expression: ((\ Just x -> x) :: Maybe a -> a) (Just 1) tcfail140.hs:20:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t0 -> Bool’ - • The equation for ‘g’ has two value arguments, + • The equation for ‘g’ has two visible arguments, but its type ‘Int -> Int’ has only one ===================================== testsuite/tests/typecheck/should_fail/tcfail175.stderr ===================================== @@ -6,7 +6,7 @@ tcfail175.hs:11:1: error: [GHC-25897] the type signature for: evalRHS :: forall a. Int -> a at tcfail175.hs:10:1-19 - • The equation for ‘evalRHS’ has three value arguments, + • The equation for ‘evalRHS’ has three visible arguments, but its type ‘Int -> a’ has only one • Relevant bindings include evalRHS :: Int -> a (bound at tcfail175.hs:11:1) ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_n_args.stderr ===================================== @@ -5,5 +5,5 @@ T22326_fail_n_args.hs:6:1: error: [GHC-25897] the type signature for: f :: a -> forall b -> b at T22326_fail_n_args.hs:6:1-26 - • The equation for ‘f’ has three value arguments, + • The equation for ‘f’ has three visible arguments, but its type ‘a -> forall b -> b’ has only two ===================================== testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr ===================================== @@ -37,7 +37,7 @@ CaretDiagnostics1.hs:13:7-11: error: [GHC-83865] CaretDiagnostics1.hs:(13,16)-(14,13): error: [GHC-83865] • Couldn't match expected type ‘Char -> t0’ with actual type ‘()’ - • The function ‘()’ is applied to one value argument, + • The function ‘()’ is applied to one visible argument, but its type ‘()’ has none In the expression: () '0' In a case alternative: "γηξ" -> () '0' View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cd9efb4de3757fd5eaec006739f75cef288e5eb -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cd9efb4de3757fd5eaec006739f75cef288e5eb You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 10:50:54 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Thu, 07 Mar 2024 05:50:54 -0500 Subject: [Git][ghc/ghc][wip/T24031] Deprecate PrimTyConI Message-ID: <65e99c0ee8f86_10117be7d9fc317be@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: 6c8c2363 by Teo Camarasu at 2024-03-07T10:50:41+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 8 changed files: - compiler/GHC/Tc/Gen/Splice.hs - libraries/template-haskell/Language/Haskell/TH/Ppr.hs - libraries/template-haskell/Language/Haskell/TH/Syntax.hs - libraries/template-haskell/changelog.md - testsuite/tests/th/T16293b.hs - + testsuite/tests/th/T24031.hs - + testsuite/tests/th/T24031.stdout - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/Splice.hs ===================================== @@ -26,7 +26,7 @@ module GHC.Tc.Gen.Splice( runMetaE, runMetaP, runMetaT, runMetaD, runQuasi, tcTopSpliceExpr, lookupThName_maybe, defaultRunMeta, runMeta', runRemoteModFinalizers, - finishTH, runTopSplice + finishTH, runTopSplice, reifyName ) where import GHC.Prelude @@ -2120,15 +2120,6 @@ reifyTyCon tc | Just cls <- tyConClass_maybe tc = reifyClass cls -{- Seems to be just a short cut for the next equation -- omit - | tc `hasKey` fUNTyConKey -- I'm not quite sure what is happening here - = return (TH.PrimTyConI (reifyName tc) 2 False) --} - - | isPrimTyCon tc - = return (TH.PrimTyConI (reifyName tc) (length (tyConVisibleTyVars tc)) - (isUnliftedTypeKind (tyConResKind tc))) - | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc res_kind = tyConResKind tc ===================================== libraries/template-haskell/Language/Haskell/TH/Ppr.hs ===================================== @@ -1,5 +1,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE LambdaCase #-} +{-# OPTIONS_GHC -Wno-deprecations #-} -- | contains a prettyprinter for the -- Template Haskell datatypes ===================================== libraries/template-haskell/Language/Haskell/TH/Syntax.hs ===================================== @@ -2068,6 +2068,7 @@ data Info Name Type -- What it is bound to deriving( Show, Eq, Ord, Data, Generic ) +{-# DEPRECATED PrimTyConI "TyConI is now produced instead." #-} -- | Obtained from 'reifyModule' in the 'Q' Monad. data ModuleInfo = ===================================== libraries/template-haskell/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell) +## 2.23.0.0 + * `PrimTyConI` has been deprecated. `TyConI` will now be used to represent primitive types. + ## 2.22.0.0 * The kind of `Code` was changed from `forall r. (Type -> Type) -> TYPE r -> Type` ===================================== testsuite/tests/th/T16293b.hs ===================================== @@ -7,7 +7,8 @@ import GHC.Exts import Language.Haskell.TH f :: () -f = $(do PrimTyConI _ arity _ <- reify ''Proxy# +f = $(do TyConI (DataD _ _ targs _ _ _) <- reify ''Proxy# + let arity = length targs unless (arity == 1) $ fail $ "Unexpected arity for Proxy#: " ++ show arity [| () |]) ===================================== testsuite/tests/th/T24031.hs ===================================== @@ -0,0 +1,28 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE LinearTypes #-} +-- | This test shows that we can reify a bunch of primitive types. +-- Additionally it acts as a golden test to ensure that we don't +-- accidentally change our output for these types. + +import Control.Monad +import Data.Char +import GHC.Exts +import Language.Haskell.TH +import Language.Haskell.TH.Syntax +import GHC.Builtin.Types.Prim (primTyCons) +import GHC.Tc.Gen.Splice (reifyName) + +main :: IO () +main = $(do let types = map reifyName primTyCons + reified <- mapM reify types + let stripInt [] = [] + stripInt (x:xs) + | isDigit x = stripInt xs + | otherwise = x:xs + -- remove _[0-9]* sequences + let stripUniques ('_':xs) = stripUniques $ stripInt xs + stripUniques (x:xs)= x:stripUniques xs + stripUniques [] = [] + let output = lift $ map (stripUniques . show) reified + [| mapM_ putStrLn $output |]) ===================================== testsuite/tests/th/T24031.stdout ===================================== @@ -0,0 +1,74 @@ +TyConI (DataD [] GHC.Prim.~# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.~R# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.~P# [KindedTV a BndrReq (VarT k0),KindedTV b BndrReq (VarT k1)] Nothing [] []) +TyConI (DataD [] GHC.Prim.=> [KindedTV a BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.==> [KindedTV a BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.-=> [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.CONSTRAINT) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Addr# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Array# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.ByteArray# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallArray# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Char# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Double# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Float# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.BCO [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Weak# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableArray# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutableByteArray# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.SmallMutableArray# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.IOPort# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.TVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.MutVar# [KindedTV a BndrReq StarT,KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.RealWorld [] Nothing [] []) +TyConI (DataD [] GHC.Prim.StablePtr# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.StableName# [KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (AppT (PromotedT GHC.Types.BoxedRep) (VarT l)))] Nothing [] []) +TyConI (DataD [] GHC.Prim.Compact# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.State# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.Proxy# [KindedTV a BndrReq (VarT k)] Nothing [] []) +TyConI (DataD [] GHC.Prim.ThreadId# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.StackSnapshot# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.PromptTag# [KindedTV a BndrReq StarT] Nothing [] []) +TyConI (DataD [] GHC.Prim.FUN [KindedTV n BndrReq (ConT GHC.Types.Multiplicity),KindedTV a BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT q)),KindedTV b BndrReq (AppT (ConT GHC.Prim.TYPE) (VarT r))] Nothing [] []) +TyConI (DataD [] GHC.Prim.TYPE [KindedTV a BndrReq (ConT GHC.Types.RuntimeRep)] Nothing [] []) +TyConI (DataD [] GHC.Prim.CONSTRAINT [KindedTV a BndrReq (ConT GHC.Types.RuntimeRep)] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int8X64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int16X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int32X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Int64X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word8X64# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word16X32# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word32X16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.Word64X8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX2# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX8# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX4# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.FloatX16# [] Nothing [] []) +TyConI (DataD [] GHC.Prim.DoubleX8# [] Nothing [] []) ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24031', normal, compile_and_run, ['-package ghc']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c8c236346a1234b7b13b72e1584cd96ecfbcf14 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c8c236346a1234b7b13b72e1584cd96ecfbcf14 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 12:05:22 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Thu, 07 Mar 2024 07:05:22 -0500 Subject: [Git][ghc/ghc][wip/T23942] 15 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e9ad82b336d_10117b2b69b2439798@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - b971bf8f by Matthew Craven at 2024-03-07T01:49:09-05:00 CorePrep: Rework lowering of BigNat# literals Don't use bigNatFromWord#, because that's terrible: * We shouldn't have to traverse a linked list at run-time to build a BigNat# literal. That's just silly! * The static List object we have to create is much larger than the actual BigNat#'s contents, bloating code size. * We have to read the corresponding interface file, which causes un-tracked implicit dependencies. (#23942) Instead, encode them into the appropriate platform-dependent sequence of bytes, and generate code that copies these bytes at run-time from an Addr# literal into a new ByteArray#. A ByteArray# literal would be the correct thing to generate, but these are not yet supported; see also #17747. Since this lowering no longer reads the interface file for GHC.Num.BigNat, the reasoning in Note [Depend on GHC.Num.Integer] is obsoleted. But the story of un-tracked built-in dependencies remains complex, and Note [Tracking dependencies on primitives] now exists to explain this complexity. - - - - - 30 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types/Prim.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Config/CoreToStg/Prep.hs - compiler/GHC/Iface/Type.hs-boot - compiler/GHC/Platform.hs - compiler/GHC/Tc/Errors/Hole/Plugin.hs-boot - compiler/GHC/Tc/Types/LclEnv.hs-boot - compiler/GHC/Tc/Utils/Env.hs - compiler/GHC/Utils/Containers/Internal/StrictPair.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/base/changelog.md - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7ed418039b26d7cc6ca442e41273caf589523c8a...b971bf8f54a6748aff30cee5cf106b92fd941cc5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7ed418039b26d7cc6ca442e41273caf589523c8a...b971bf8f54a6748aff30cee5cf106b92fd941cc5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 12:20:48 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Thu, 07 Mar 2024 07:20:48 -0500 Subject: [Git][ghc/ghc][wip/T24031] 15 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e9b120dc59b_10117b310c720456f7@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 3ead2f38 by Teo Camarasu at 2024-03-07T12:20:46+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 30 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Tc/Gen/Splice.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/runtime_control.rst - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/base/changelog.md - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs - libraries/base/src/System/IO.hs - libraries/base/src/System/Mem/Weak.hs - libraries/base/src/System/Posix/Internals.hs - libraries/base/src/Text/ParserCombinators/ReadP.hs - libraries/base/src/Text/ParserCombinators/ReadPrec.hs - libraries/base/src/Text/Read.hs - libraries/filepath - libraries/ghc-experimental/src/Data/Sum/Experimental.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6c8c236346a1234b7b13b72e1584cd96ecfbcf14...3ead2f38a5f448ea1a669fcbbfa8469004b46f4d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6c8c236346a1234b7b13b72e1584cd96ecfbcf14...3ead2f38a5f448ea1a669fcbbfa8469004b46f4d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 13:21:46 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Thu, 07 Mar 2024 08:21:46 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/sand-witch/fix-tysyn Message-ID: <65e9bf6a627dd_10117b4d43da8602ee@gitlab.mail> Andrei Borzenkov pushed new branch wip/sand-witch/fix-tysyn at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/sand-witch/fix-tysyn You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 13:24:48 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Thu, 07 Mar 2024 08:24:48 -0500 Subject: [Git][ghc/ghc][wip/sand-witch/fix-tysyn] Fix compiler crash caused by implicit RHS quantification in type synonyms (24470) Message-ID: <65e9c020712a9_10117b519b824604fd@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/fix-tysyn at Glasgow Haskell Compiler / GHC Commits: 26fa4a3a by Andrei Borzenkov at 2024-03-07T17:24:28+04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (24470) - - - - - 9 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1911,6 +1911,11 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkSimpleDecorated $ + text "Type variable" <+> quotes (ppr tv_name) <+> + text "in the right-hand side of type synonym" <+> quotes (ppr ts_name) <+> + text "is out of arity" + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2543,6 +2548,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3209,6 +3216,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4263,6 +4265,23 @@ data TcRnMessage where -} TcRnNamespacedFixitySigWithoutFlag :: FixitySig GhcPs -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when an implicitly quantified + type variable on the RHS of a type synonym doesn't match the arity specified + by a user on the LHS of the type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,52 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Type signatures have special rule about scoping of the outmost kind signatures: + + type P = Proxy :: k -> Type + +Here `k` isn't bind anywhere, however GHC performs implicit binding in this +specific case, so the example above becomes equivalent to that declaration: + + type P @k = Proxy :: k -> Type + +Doing so changes arity of type synonym declaration and could be observed e.g. when +we use type synonym in high order position: + + type T :: (forall k. k -> Type) -> Type + + type P = Proxy + + x :: T P -- Expected kind ‘forall k. k -> *’, but ‘P’ has kind ‘k0 -> *’ + +To give user more control under arity of type declaration, we do not perform +airty inference in check mode (i.e. when type synonym has standalone kind signature) +starting from e89aa0721ca commit: + + type T :: (forall k. k -> Type) -> Type + + type P :: forall k. k -> Type + type P = Proxy + + x :: T P -- OK + +However, renamer still adds type variables from outmost kind signature into +scope (see #24470) because it doesn't have infromation about standalone kind +signature in the context: + + type P :: forall j. j -> Type + type P = Proxy :: k -> Type -- `k` is not in scope during type checking, + -- but it passed the renamer + +To handle this case, we add validation into `checkForDisconnectedScopedTyVars` function. +Notice that an implicit binding isn't a problem itself, but becomes a problem when +it's out of specified arity of type synonym, i.e. this code is fine: + + type P :: forall j. j -> Type + type P @j = Proxy :: k -> Type -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -605,6 +605,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -911,3 +911,4 @@ test('T22788', normal, compile, ['']) test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,4 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • Type variable ‘j’ in the right-hand side of type synonym ‘SynBad’ is out of arity + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -721,3 +721,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26fa4a3a8be8f2ab10d606670ba2980dcfd119e8 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26fa4a3a8be8f2ab10d606670ba2980dcfd119e8 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 13:26:23 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Thu, 07 Mar 2024 08:26:23 -0500 Subject: [Git][ghc/ghc][wip/T23942] small fixes and improvements Message-ID: <65e9c07f1fc7f_10117b5435c38622fb@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 438278dd by Matthew Craven at 2024-03-07T08:25:18-05:00 small fixes and improvements - - - - - 5 changed files: - compiler/GHC/CoreToStg/Prep.hs - libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs - libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs - libraries/ghc-bignum/src/GHC/Num/Backend/Native.hs - libraries/ghc-internal/src/GHC/Internal/Base.hs Changes: ===================================== compiler/GHC/CoreToStg/Prep.hs ===================================== @@ -2484,7 +2484,29 @@ cpeBigNatLit env i = assert (i >= 0) $ do -- * A call to `newByteArray#` with the appropriate size -- * A call to `copyAddrToByteArray#` to initialize the `ByteArray#` -- * A call to `unsafeFreezeByteArray#` to make the types match - litAddrId <- newVar addrPrimTy + litAddrId <- mkSysLocalM (fsLit "bigNatGuts") ManyTy addrPrimTy + -- returned from newByteArray#: + deadNewByteArrayTupleId + <- fmap (`setIdOccInfo` IAmDead) . mkSysLocalM (fsLit "tup") ManyTy $ + mkTupleTy Unboxed [ realWorldStatePrimTy + , realWorldMutableByteArrayPrimTy + ] + stateTokenFromNewByteArrayId + <- mkSysLocalM (fsLit "token") ManyTy realWorldStatePrimTy + mutableByteArrayId + <- mkSysLocalM (fsLit "mba") ManyTy realWorldMutableByteArrayPrimTy + -- returned from copyAddrToByteArray#: + stateTokenFromCopyId + <- mkSysLocalM (fsLit "token") ManyTy realWorldStatePrimTy + -- returned from unsafeFreezeByteArray#: + deadFreezeTupleId + <- fmap (`setIdOccInfo` IAmDead) . mkSysLocalM (fsLit "tup") ManyTy $ + mkTupleTy Unboxed [realWorldStatePrimTy, byteArrayPrimTy] + stateTokenFromFreezeId + <- (`setIdOccInfo` IAmDead) <$> + mkSysLocalM (fsLit "token") ManyTy realWorldStatePrimTy + byteArrayId <- mkSysLocalM (fsLit "ba") ManyTy byteArrayPrimTy + let litAddrRhs = Lit (LitString words) -- not "mkLitString"; that does UTF-8 encoding, which we don't want here @@ -2498,13 +2520,6 @@ cpeBigNatLit env i = assert (i >= 0) $ do `App` contentsLength `App` Var realWorldPrimId - -- returned from newByteArray#: - deadNewByteArrayTupleId <- newVar $ - mkTupleTy Unboxed [realWorldStatePrimTy, realWorldMutableByteArrayPrimTy] - stateTokenFromNewByteArrayId <- newVar realWorldStatePrimTy - mutableByteArrayId <- newVar realWorldMutableByteArrayPrimTy - - let copyContentsCall = Var (primOpId CopyAddrToByteArrayOp) `App` Type realWorldTy @@ -2514,23 +2529,12 @@ cpeBigNatLit env i = assert (i >= 0) $ do `App` contentsLength `App` Var stateTokenFromNewByteArrayId - -- returned from copyAddrToByteArray#: - stateTokenFromCopyId <- newVar realWorldStatePrimTy - - let unsafeFreezeCall = Var (primOpId UnsafeFreezeByteArrayOp) `App` Type realWorldTy `App` Var mutableByteArrayId `App` Var stateTokenFromCopyId - -- returned from unsafeFreezeByteArray#: - deadFreezeTupleId <- newVar $ - mkTupleTy Unboxed [realWorldStatePrimTy, byteArrayPrimTy] - stateTokenFromFreezeId <- newVar realWorldStatePrimTy - byteArrayId <- newVar byteArrayPrimTy - - let unboxed2tuple_alt :: AltCon unboxed2tuple_alt = DataAlt (tupleDataCon Unboxed 2) ===================================== libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs ===================================== @@ -24,7 +24,8 @@ import {-# SOURCE #-} GHC.Num.Natural import {-# SOURCE #-} GHC.Num.Integer -- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base --- (we have a string literal) +-- (we use the empty tuple () and string literals) +import GHC.Tuple () import GHC.CString () default () ===================================== libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs ===================================== @@ -31,7 +31,8 @@ import {-# SOURCE #-} GHC.Num.BigNat import {-# SOURCE #-} GHC.Num.Natural -- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base --- (we have a string literal) +-- (we use the empty tuple () and string literals) +import GHC.Tuple () import GHC.CString () default () ===================================== libraries/ghc-bignum/src/GHC/Num/Backend/Native.hs ===================================== @@ -29,7 +29,8 @@ import GHC.Prim import GHC.Types -- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base --- (we have a string literal) +-- (we use the empty tuple () and string literals) +import GHC.Tuple () import GHC.CString () default () ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -366,13 +366,13 @@ been built, otherwise compilation will fail with an error like this one: Use -v to see a list of the files searched for. To prevent such errors, we insist that if any boot library module X -implicitly depending on primitives in module Y, then the transitive +implicitly depends on primitives in module Y, then the transitive imports of X must include Y. Such implicit dependencies can be introduced in at least the following ways: W1: - Awkward dependencies on ghc-prim: + Awkward dependencies: * TypeRep metadata introduces references to GHC.Types in EVERY module. * A String literal introduces a reference to GHC.CString, for either unpackCString# or unpackCStringUtf8# depending on its contents. @@ -432,7 +432,7 @@ W4: as long as the module which defines Eq imports GHC.Magic this cannot cause trouble. - Embarrasingly, we do not follow this plan for the Lift class. + Embarrassingly, we do not follow this plan for the Lift class. Derived Lift instances refer to machinery in Language.Haskell.TH.Lib, which is not imported by the module Language.Haskell.TH.Syntax that defines the Lift class. This is still causing annoyance for boot @@ -471,8 +471,8 @@ This presents a problem. GHC.Internal.Base and GHC.Internal.Num. Enum is a superclass of Integral. We don't use any Enum methods here, but it is relevant (read on). -* Integral is defined in GHC.Real, which imports GHC.Base, GHC.Num, and - GHC.Enum. +* Integral is defined in GHC.Internal.Real, which imports + GHC.Internal.Base, GHC.Internal.Num, and GHC.Internal.Enum. We resolve this web of dependencies with hs-boot files. The rules https://ghc.gitlab.haskell.org/ghc/doc/users_guide/separate_compilation.html#how-to-compile-mutually-recursive-modules View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/438278dd05e17598384b5bd74c930ad1747317a9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/438278dd05e17598384b5bd74c930ad1747317a9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 13:48:32 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 07 Mar 2024 08:48:32 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 8 commits: rts: expose HeapAlloc.h as public header Message-ID: <65e9c5b043a4f_10117b5a90c68705b4@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - 4d2878c5 by Ben Gamari at 2024-03-07T08:48:27-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - bc6d3a0d by Cheng Shao at 2024-03-07T08:48:27-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 30 changed files: - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Monad.hs - libraries/base/src/Control/Monad/ST.hs - libraries/base/src/Control/Monad/ST/Safe.hs - libraries/base/src/Control/Monad/ST/Unsafe.hs - libraries/base/src/Data/Version.hs - libraries/base/src/GHC/IO/Encoding/UTF16.hs - libraries/base/src/GHC/TypeNats.hs - libraries/base/src/System/Console/GetOpt.hs - libraries/base/src/System/IO.hs - libraries/base/src/System/Mem/Weak.hs - libraries/base/src/System/Posix/Internals.hs - libraries/base/src/Text/ParserCombinators/ReadP.hs - libraries/base/src/Text/ParserCombinators/ReadPrec.hs - libraries/base/src/Text/Read.hs - libraries/ghc-experimental/src/Data/Sum/Experimental.hs - libraries/ghc-experimental/src/Data/Tuple/Experimental.hs - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/Sparks.c - rts/include/rts/storage/Block.h - rts/sm/HeapAlloc.h → rts/include/rts/storage/HeapAlloc.h The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5a1dd7cba418cf0866db91cd81fa45f2445c93ec...bc6d3a0de722e1080b0e7aa916fe9ba1ea332e64 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5a1dd7cba418cf0866db91cd81fa45f2445c93ec...bc6d3a0de722e1080b0e7aa916fe9ba1ea332e64 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 13:55:59 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 08:55:59 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 2 commits: rts: Drop .wasm suffix from .prof file names Message-ID: <65e9c76fc072a_10117b5ea1c807904c@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 30ca8bdf by Ben Gamari at 2024-03-06T23:49:36-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 2efba97d by Ben Gamari at 2024-03-06T23:49:54-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 5 changed files: - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/include/rts/storage/ClosureMacros.h Changes: ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasi32_HOST_OS) + dropExtension(prog, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasi32_HOST_OS) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.hp.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a6054b425e2bde8c246ca9a8d59b3c5bbfc39d23...2efba97d84ce32d50dd48a41955bcb2753b0e186 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a6054b425e2bde8c246ca9a8d59b3c5bbfc39d23...2efba97d84ce32d50dd48a41955bcb2753b0e186 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 14:06:35 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 09:06:35 -0500 Subject: [Git][ghc/ghc][wip/data-kind] ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65e9c9ebe3eee_10117b69563d8818e7@gitlab.mail> Ben Gamari pushed to branch wip/data-kind at Glasgow Haskell Compiler / GHC Commits: 30f59e76 by Ben Gamari at 2024-03-07T09:06:24-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 6 changed files: - libraries/base/src/Data/Kind.hs - libraries/ghc-internal/ghc-internal.cabal - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/src/Data/Kind.hs ===================================== @@ -1,4 +1,4 @@ -{-# LANGUAGE Safe #-} +{-# LANGUAGE Trustworthy #-} -- | -- @@ -19,4 +19,6 @@ module Data.Kind FUN ) where -import GHC.Internal.Data.Kind \ No newline at end of file +import GHC.Num.BigNat () -- for build ordering (#23942) +import GHC.Prim (FUN) +import GHC.Types (Type, Constraint) ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -120,7 +120,6 @@ Library GHC.Internal.Data.Functor.Utils GHC.Internal.Data.IORef GHC.Internal.Data.Ix - GHC.Internal.Data.Kind GHC.Internal.Data.List GHC.Internal.Data.Maybe GHC.Internal.Data.Monoid ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1238,7 +1238,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -1238,7 +1238,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -1238,7 +1238,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -1238,7 +1238,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/30f59e76f6864b2ca02ea2ec5deb2fd93de06b0b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/30f59e76f6864b2ca02ea2ec5deb2fd93de06b0b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 14:24:56 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Thu, 07 Mar 2024 09:24:56 -0500 Subject: [Git][ghc/ghc][wip/hadrian-cross-stage2] 13 commits: Read global package database from settings file Message-ID: <65e9ce389bede_10117b6f7482887566@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC Commits: 5d441f0a by Matthew Pickering at 2024-03-05T10:57:55+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - 8e3cb48c by Matthew Pickering at 2024-03-05T10:58:29+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 69a784c5 by Matthew Pickering at 2024-03-05T10:58:30+00:00 Add missing req_interp modifier to T18441fail3 and T18441fail19 These tests require the interpreter but they were failing in a different way with the javascript backend because the interpreter was disabled and stderr is ignored by the test. - - - - - 6f5a6e84 by Matthew Pickering at 2024-03-05T10:58:30+00:00 Use explicit syntax rather than pure - - - - - f41941e2 by Matthew Pickering at 2024-03-05T10:58:30+00:00 ci: Fail when bindist configure fails when installing bindist It is better to fail earlier if the configure step fails rather than carrying on for a more obscure error message. - - - - - 18d982b3 by Matthew Pickering at 2024-03-05T10:58:30+00:00 packaging: correctly propagate build/host/target to bindist configure script At the moment the host and target which we will produce a compiler for is fixed at the initial configure time. Therefore we need to persist the choice made at this time into the installation bindist as well so we look for the right tools, with the right prefixes at install time. In the future, we want to provide a bit more control about what kind of bindist we produce so the logic about what the host/target will have to be written by hadrian rather than persisted by the configure script. In particular with cross compilers we want to either build a normal stage 2 cross bindist or a stage 3 bindist, which creates a bindist which has a native compiler for the target platform. Fixes #21970 - - - - - 5d495163 by Matthew Pickering at 2024-03-05T10:58:31+00:00 hadrian: Fill in more of the default.host toolchain file When you are building a cross compiler this file will be used to build stage1 and it's libraries, so we need enough information here to work accurately. There is still more work to be done (see for example, word size is still fixed). - - - - - a6b154ea by Matthew Pickering at 2024-03-05T10:58:31+00:00 hadrian: Disable docs when cross compiling Before there were a variety of ad-hoc places where doc building was disabled when cross compiling. * Some CI jobs sets --docs=none in gen_ci.hs * Some CI jobs set --docs=none in .gitlab/ci.sh * There was some logic in hadrian to not need the ["docs"] target when making a bindist. Now the situation is simple: * If you are cross compiling then defaultDocsTargets is empty by default. In theory, there is no reason why we can't build documentation for cross compiler bindists, but this is left to future work to generalise the documentation building rules to allow this (#24289) - - - - - af1c68f1 by Matthew Pickering at 2024-03-05T10:58:31+00:00 hadrian: Build stage 2 cross compilers * Most of hadrian is abstracted over the stage in order to remove the assumption that the target of all stages is the same platform. This allows the RTS to be built for two different targets for example. * Abstracts the bindist creation logic to allow building either normal or cross bindists. Normal bindists use stage 1 libraries and a stage 2 compiler. Cross bindists use stage 2 libararies and a stage 2 compiler. * hadrian: Make binary-dist-dir the default build target. This allows us to have the logic in one place about which libraries/stages to build with cross compilers. Fixes #24192 New hadrian target: * `binary-dist-dir-cross`: Build a cross compiler bindist (compiler = stage 1, libraries = stage 2) ------------------------- Metric Decrease: T10421a T10858 T11195 T11276 T11374 T11822 T15630 T17096 T18478 T20261 Metric Increase: parsing001 ------------------------- - - - - - 9061af22 by Matthew Pickering at 2024-03-05T10:58:31+00:00 ci: Test cross bindists We remove the special logic for testing in-tree cross compilers and instead test cross compiler bindists, like we do for all other platforms. - - - - - e0c65d20 by Matthew Pickering at 2024-03-05T10:58:31+00:00 ci: Javascript don't set CROSS_EMULATOR There is no CROSS_EMULATOR needed to run javascript binaries, so we don't set the CROSS_EMULATOR to some dummy value. - - - - - 5788d3d8 by Matthew Pickering at 2024-03-05T10:58:31+00:00 ci: Introduce CROSS_STAGE variable In preparation for building and testing stage3 bindists we introduce the CROSS_STAGE variable which is used by a CI job to determine what kind of bindist the CI job should produce. At the moment we are only using CROSS_STAGE=2 but in the future we will have some jobs which set CROSS_STAGE=3 to produce native bindists for a target, but produced by a cross compiler, which can be tested on by another CI job on the native platform. CROSS_STAGE=2: Build a normal cross compiler bindist CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target - - - - - effc3666 by Matthew Pickering at 2024-03-07T14:17:22+00:00 Split up system.config into host/target config files There were a number of settings which were not applied per-stage, for example if you specified `--ffi-include-dir` then that was applied to both host and target. Now this will just be passed when building the crosscompiler. The solution for now is to separate these two files into host/target and the host file contains very bare-bones . There isn't currently a way to specify with configure anything in the host file, so if you are building a cross-compiler and you need to do that, you have to modify the file yourself. - - - - - 30 changed files: - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.hs - configure.ac - distrib/configure.ac.in - hadrian/bindist/Makefile - hadrian/bindist/config.mk.in - hadrian/cfg/default.host.target.in - hadrian/cfg/system.config.in - hadrian/hadrian.cabal - hadrian/src/Base.hs - + hadrian/src/BindistConfig.hs - hadrian/src/Builder.hs - hadrian/src/Context.hs - hadrian/src/Expression.hs - hadrian/src/Flavour.hs - hadrian/src/Flavour/Type.hs - hadrian/src/Hadrian/Expression.hs - hadrian/src/Hadrian/Haskell/Hash.hs - hadrian/src/Hadrian/Oracles/TextFile.hs - hadrian/src/Oracles/Flag.hs - hadrian/src/Oracles/Flavour.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Packages.hs - hadrian/src/Rules.hs - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/CabalReinstall.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/69d8b51b500b8b879413feb552c1b7bd9125e120...effc3666a001efbf9f8e9c9c0416a7b4573f52ad -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/69d8b51b500b8b879413feb552c1b7bd9125e120...effc3666a001efbf9f8e9c9c0416a7b4573f52ad You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 14:46:07 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Thu, 07 Mar 2024 09:46:07 -0500 Subject: [Git][ghc/ghc][wip/hadrian-cross-stage2] Split up system.config into host/target config files Message-ID: <65e9d32f92dec_10117b7b456ac902b1@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC Commits: 9b09bf12 by Matthew Pickering at 2024-03-07T14:45:52+00:00 Split up system.config into host/target config files There were a number of settings which were not applied per-stage, for example if you specified `--ffi-include-dir` then that was applied to both host and target. Now this will just be passed when building the crosscompiler. The solution for now is to separate these two files into host/target and the host file contains very bare-bones . There isn't currently a way to specify with configure anything in the host file, so if you are building a cross-compiler and you need to do that, you have to modify the file yourself. - - - - - 22 changed files: - configure.ac - + hadrian/cfg/system.config.host.in - hadrian/cfg/system.config.in - + hadrian/cfg/system.config.target.in - hadrian/src/Base.hs - hadrian/src/Builder.hs - hadrian/src/Expression.hs - hadrian/src/Hadrian/Oracles/TextFile.hs - hadrian/src/Oracles/Flag.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Gmp.hs - hadrian/src/Rules/Libffi.hs - hadrian/src/Rules/Rts.hs - hadrian/src/Settings/Builders/Cabal.hs - hadrian/src/Settings/Builders/Common.hs - hadrian/src/Settings/Builders/Ghc.hs - hadrian/src/Settings/Builders/Hsc2Hs.hs - hadrian/src/Settings/Builders/RunTest.hs - hadrian/src/Settings/Packages.hs - hadrian/src/Settings/Warnings.hs Changes: ===================================== configure.ac ===================================== @@ -976,6 +976,8 @@ FIND_GHC_TOOLCHAIN([hadrian/cfg]) AC_CONFIG_FILES( [ mk/project.mk hadrian/cfg/system.config + hadrian/cfg/system.config.host + hadrian/cfg/system.config.target hadrian/ghci-cabal hadrian/ghci-multi-cabal hadrian/ghci-stack ===================================== hadrian/cfg/system.config.host.in ===================================== @@ -0,0 +1,77 @@ +# This file is processed by the configure script. +# See hadrian/src/UserSettings.hs for user-defined settings. +#=========================================================== + +# Paths to builders: +#=================== + +# Information about builders: +#============================ + +cc-llvm-backend = NO + + +# Information about build, host and target systems: +#================================================== + +dynamic-extension = .so + +bootstrap-threaded-rts = YES + +# Settings: +#========== + +# We are in the process of moving the settings file from being entirely +# generated by configure, to generated being by the build system. Many of these +# might become redundant. +# See Note [tooldir: How GHC finds mingw on Windows] + +settings-otool-command = otool +settings-install_name_tool-command = install_name_tool +settings-llc-command = llc +settings-opt-command = opt +settings-llvm-as-command = clang +settings-use-distro-mingw = NO + +target-has-libm = YES + +# Include and library directories: +#================================= + +curses-lib-dir = +curses-include-dir = + +iconv-include-dir = +iconv-lib-dir = + +intree-gmp = NO +gmp-framework-preferred = NO +gmp-include-dir = +gmp-lib-dir = + +use-system-ffi = NO +ffi-include-dir = +ffi-lib-dir = + +libdw-include-dir = +libdw-lib-dir = + +libnuma-include-dir = +libnuma-lib-dir = + +libzstd-include-dir = +libzstd-lib-dir = + +# Optional Dependencies: +#======================= + +use-lib-dw = NO +use-lib-zstd = NO +static-lib-zstd = NO +use-lib-numa = NO +use-lib-m = YES +use-lib-rt = YES +use-lib-dl = YES +use-lib-bfd = NO +use-lib-pthread = NO +need-libatomic = NO ===================================== hadrian/cfg/system.config.in ===================================== @@ -32,8 +32,6 @@ python = @PythonCmd@ # Information about builders: #============================ -cc-llvm-backend = @CcLlvmBackend@ - llvm-min-version = @LlvmMinVersion@ llvm-max-version = @LlvmMaxVersion@ @@ -54,8 +52,6 @@ target-platform-full = @TargetPlatformFull@ cross-compiling = @CrossCompiling@ -dynamic-extension = @soext_target@ - ghc-version = @GhcVersion@ ghc-major-version = @GhcMajVersion@ ghc-minor-version = @GhcMinVersion@ @@ -72,60 +68,3 @@ project-patch-level1 = @ProjectPatchLevel1@ project-patch-level2 = @ProjectPatchLevel2@ project-git-commit-id = @ProjectGitCommitId@ -# Settings: -#========== - -# We are in the process of moving the settings file from being entirely -# generated by configure, to generated being by the build system. Many of these -# might become redundant. -# See Note [tooldir: How GHC finds mingw on Windows] - -settings-otool-command = @SettingsOtoolCommand@ -settings-install_name_tool-command = @SettingsInstallNameToolCommand@ -settings-llc-command = @SettingsLlcCommand@ -settings-opt-command = @SettingsOptCommand@ -settings-llvm-as-command = @SettingsLlvmAsCommand@ -settings-use-distro-mingw = @SettingsUseDistroMINGW@ - -target-has-libm = @TargetHasLibm@ - -# Include and library directories: -#================================= - -curses-lib-dir = @CURSES_LIB_DIRS@ -curses-include-dir = @CURSES_INCLUDE_DIRS@ - -iconv-include-dir = @ICONV_INCLUDE_DIRS@ -iconv-lib-dir = @ICONV_LIB_DIRS@ - -intree-gmp = @GMP_FORCE_INTREE@ -gmp-framework-preferred = @GMP_PREFER_FRAMEWORK@ -gmp-include-dir = @GMP_INCLUDE_DIRS@ -gmp-lib-dir = @GMP_LIB_DIRS@ - -use-system-ffi = @UseSystemLibFFI@ -ffi-include-dir = @FFIIncludeDir@ -ffi-lib-dir = @FFILibDir@ - -libdw-include-dir = @LibdwIncludeDir@ -libdw-lib-dir = @LibdwLibDir@ - -libnuma-include-dir = @LibNumaIncludeDir@ -libnuma-lib-dir = @LibNumaLibDir@ - -libzstd-include-dir = @LibZstdIncludeDir@ -libzstd-lib-dir = @LibZstdLibDir@ - -# Optional Dependencies: -#======================= - -use-lib-dw = @UseLibdw@ -use-lib-zstd = @UseLibZstd@ -static-lib-zstd = @UseStaticLibZstd@ -use-lib-numa = @UseLibNuma@ -use-lib-m = @UseLibm@ -use-lib-rt = @UseLibrt@ -use-lib-dl = @UseLibdl@ -use-lib-bfd = @UseLibbfd@ -use-lib-pthread = @UseLibpthread@ -need-libatomic = @NeedLibatomic@ ===================================== hadrian/cfg/system.config.target.in ===================================== @@ -0,0 +1,83 @@ +# This file is processed by the configure script. +# See hadrian/src/UserSettings.hs for user-defined settings. +#=========================================================== + +# Paths to builders: +#=================== + +# Information about builders: +#============================ + +cc-llvm-backend = @CcLlvmBackend@ + + +# Information about build, host and target systems: +#================================================== + +# Q: Is the *-platform information available in the target? +# A: Yes, it is. We pass @BuildPlatform@ and @HostPlatform@ and @TargetPlatform@ to ghc-toolchain using --target=that +# And we can reconstruct the platform info using targetPlatformTriple +# Q: What is TargetPlatformFull? +target-platform-full = @TargetPlatformFull@ + +dynamic-extension = @soext_target@ + +bootstrap-threaded-rts = @GhcThreadedRts@ + +# Settings: +#========== + +# We are in the process of moving the settings file from being entirely +# generated by configure, to generated being by the build system. Many of these +# might become redundant. +# See Note [tooldir: How GHC finds mingw on Windows] + +settings-otool-command = @SettingsOtoolCommand@ +settings-install_name_tool-command = @SettingsInstallNameToolCommand@ +settings-llc-command = @SettingsLlcCommand@ +settings-opt-command = @SettingsOptCommand@ +settings-llvm-as-command = @SettingsLlvmAsCommand@ +settings-use-distro-mingw = @SettingsUseDistroMINGW@ + +target-has-libm = @TargetHasLibm@ + +# Include and library directories: +#================================= + +curses-lib-dir = @CURSES_LIB_DIRS@ +curses-include-dir = @CURSES_INCLUDE_DIRS@ + +iconv-include-dir = @ICONV_INCLUDE_DIRS@ +iconv-lib-dir = @ICONV_LIB_DIRS@ + +intree-gmp = @GMP_FORCE_INTREE@ +gmp-framework-preferred = @GMP_PREFER_FRAMEWORK@ +gmp-include-dir = @GMP_INCLUDE_DIRS@ +gmp-lib-dir = @GMP_LIB_DIRS@ + +use-system-ffi = @UseSystemLibFFI@ +ffi-include-dir = @FFIIncludeDir@ +ffi-lib-dir = @FFILibDir@ + +libdw-include-dir = @LibdwIncludeDir@ +libdw-lib-dir = @LibdwLibDir@ + +libnuma-include-dir = @LibNumaIncludeDir@ +libnuma-lib-dir = @LibNumaLibDir@ + +libzstd-include-dir = @LibZstdIncludeDir@ +libzstd-lib-dir = @LibZstdLibDir@ + +# Optional Dependencies: +#======================= + +use-lib-dw = @UseLibdw@ +use-lib-zstd = @UseLibZstd@ +static-lib-zstd = @UseStaticLibZstd@ +use-lib-numa = @UseLibNuma@ +use-lib-m = @UseLibm@ +use-lib-rt = @UseLibrt@ +use-lib-dl = @UseLibdl@ +use-lib-bfd = @UseLibbfd@ +use-lib-pthread = @UseLibpthread@ +need-libatomic = @NeedLibatomic@ ===================================== hadrian/src/Base.hs ===================================== @@ -29,7 +29,8 @@ module Base ( module Way, -- * Paths - hadrianPath, configPath, configFile, sourcePath, shakeFilesDir, + hadrianPath, configPath, configFile, buildConfigFileHost, buildConfigFileTarget, + sourcePath, shakeFilesDir, stageBinPath, stageLibPath, templateHscPath, buildTargetFile, hostTargetFile, targetTargetFile, ghcLibDeps, haddockDeps, @@ -80,6 +81,13 @@ configPath = hadrianPath -/- "cfg" configFile :: FilePath configFile = configPath -/- "system.config" +buildConfigFileHost :: FilePath +buildConfigFileHost = configPath -/- "system.config.host" + +buildConfigFileTarget :: FilePath +buildConfigFileTarget = configPath -/- "system.config.target" + + -- | The target configuration file generated by ghc-toolchain for the -- compilation build platform buildTargetFile :: FilePath ===================================== hadrian/src/Builder.hs ===================================== @@ -28,14 +28,13 @@ import Hadrian.Builder.Tar import Hadrian.Oracles.Path import Hadrian.Oracles.TextFile import Hadrian.Utilities -import Oracles.Setting (bashPath, targetStage) import System.Exit import System.IO (stderr) import Base import Context import Oracles.Flag -import Oracles.Setting (setting, Setting(..)) +import Oracles.Setting import Packages import GHC.IO.Encoding (getFileSystemEncoding) ===================================== hadrian/src/Expression.hs ===================================== @@ -146,7 +146,7 @@ buildingCompilerStage' f = f . succStage <$> getStage -- compiler's RTS ways. See Note [Linking ghc-bin against threaded stage0 RTS] -- in Settings.Packages for details. threadedBootstrapper :: Predicate -threadedBootstrapper = expr (flag BootstrapThreadedRts) +threadedBootstrapper = staged (buildFlag BootstrapThreadedRts) -- | Is a certain package /not/ built right now? notPackage :: Package -> Predicate ===================================== hadrian/src/Hadrian/Oracles/TextFile.hs ===================================== @@ -13,7 +13,7 @@ -- to read configuration or package metadata files and cache the parsing. ----------------------------------------------------------------------------- module Hadrian.Oracles.TextFile ( - lookupValue, lookupValueOrEmpty, lookupValueOrError, lookupSystemConfig, lookupValues, + lookupValue, lookupValueOrEmpty, lookupValueOrError, lookupSystemConfig, lookupHostBuildConfig, lookupTargetBuildConfig, lookupValues, lookupValuesOrEmpty, lookupValuesOrError, lookupDependencies, textFileOracle, getBuildTarget, getHostTarget, getTargetTarget, queryBuildTarget, queryHostTarget @@ -52,6 +52,23 @@ lookupSystemConfig = lookupValueOrError (Just configError) configFile where configError = "Perhaps you need to rerun ./configure" +lookupHostBuildConfig :: String -> Action String +lookupHostBuildConfig key = do + cross <- (== "YES") <$> lookupSystemConfig "cross-compiling" + -- If we are not cross compiling, the build the host compiler like the target. + let cfgFile = if cross then buildConfigFileHost else buildConfigFileTarget + lookupValueOrError (Just configError) cfgFile key + where + configError = "Perhaps you need to rerun ./configure" + +lookupTargetBuildConfig :: String -> Action String +lookupTargetBuildConfig key = + lookupValueOrError (Just configError) buildConfigFileTarget key + where + configError = "Perhaps you need to rerun ./configure" + + + -- | Lookup a list of values in a text file, tracking the result. Each line of -- the file is expected to have @key value1 value2 ...@ format. lookupValues :: FilePath -> String -> Action (Maybe [String]) @@ -104,6 +121,7 @@ getHostTarget = do -- MP: If we are not cross compiling then we should use the target file in order to -- build things for the host, in particular we want to use the configured values for the -- target for building the RTS (ie are we using Libffi for adjustors, and the wordsize) + -- TODO: Use "flag CrossCompiling" ht <- getTargetConfig hostTargetFile tt <- getTargetConfig targetTargetFile if (Toolchain.targetPlatformTriple ht) == (Toolchain.targetPlatformTriple tt) ===================================== hadrian/src/Oracles/Flag.hs ===================================== @@ -2,6 +2,7 @@ module Oracles.Flag ( Flag (..), flag, getFlag, + BuildFlag(..), buildFlag, targetSupportsSharedLibs, targetSupportsGhciObjects, targetSupportsThreadedRts, @@ -22,7 +23,8 @@ import qualified GHC.Toolchain as Toolchain import GHC.Platform.ArchOS data Flag = CrossCompiling - | CcLlvmBackend + | UseGhcToolchain +data BuildFlag = CcLlvmBackend | GmpInTree | GmpFrameworkPref | UseSystemFfi @@ -38,7 +40,15 @@ data Flag = CrossCompiling | UseLibbfd | UseLibpthread | NeedLibatomic - | UseGhcToolchain + | TargetHasLibm + +parseFlagResult :: String -> String -> Bool +parseFlagResult key value = + if (value `notElem` ["YES", "NO", ""]) + then error $ "Configuration flag " + ++ quote (key ++ " = " ++ value) ++ " cannot be parsed." + else value == "YES" + -- Note, if a flag is set to empty string we treat it as set to NO. This seems -- fragile, but some flags do behave like this. @@ -46,6 +56,12 @@ flag :: Flag -> Action Bool flag f = do let key = case f of CrossCompiling -> "cross-compiling" + UseGhcToolchain -> "use-ghc-toolchain" + parseFlagResult key <$> lookupSystemConfig key + +buildFlag :: BuildFlag -> Stage -> Action Bool +buildFlag f st = + let key = case f of CcLlvmBackend -> "cc-llvm-backend" GmpInTree -> "intree-gmp" GmpFrameworkPref -> "gmp-framework-preferred" @@ -62,11 +78,13 @@ flag f = do UseLibbfd -> "use-lib-bfd" UseLibpthread -> "use-lib-pthread" NeedLibatomic -> "need-libatomic" - UseGhcToolchain -> "use-ghc-toolchain" - value <- lookupSystemConfig key - when (value `notElem` ["YES", "NO", ""]) . error $ "Configuration flag " - ++ quote (key ++ " = " ++ value) ++ " cannot be parsed." - return $ value == "YES" + TargetHasLibm -> "target-has-libm" + in parseFlagResult key <$> (tgtConfig st key) + where + tgtConfig Stage0 {} = lookupHostBuildConfig + tgtConfig Stage1 = lookupHostBuildConfig + tgtConfig Stage2 = lookupTargetBuildConfig + tgtConfig Stage3 = lookupTargetBuildConfig -- | Get a configuration setting. getFlag :: Flag -> Expr c b Bool ===================================== hadrian/src/Oracles/Setting.hs ===================================== @@ -1,7 +1,8 @@ module Oracles.Setting ( configFile, -- * Settings - Setting (..), setting, getSetting, + ProjectSetting (..), setting, getSetting, + BuildSetting(..), buildSetting, ToolchainSetting (..), settingsFileSetting, -- * Helpers @@ -39,28 +40,14 @@ import GHC.Platform.ArchOS -- tracking the result in the Shake database. -- -- * ROMES:TODO: How to handle target-platform-full? -data Setting = CursesIncludeDir - | CursesLibDir - | DynamicExtension - | FfiIncludeDir - | FfiLibDir - | GhcMajorVersion +data ProjectSetting = + GhcMajorVersion | GhcMinorVersion | GhcPatchLevel | GhcVersion | GhcSourcePath | LlvmMinVersion | LlvmMaxVersion - | GmpIncludeDir - | GmpLibDir - | IconvIncludeDir - | IconvLibDir - | LibdwIncludeDir - | LibdwLibDir - | LibnumaIncludeDir - | LibnumaLibDir - | LibZstdIncludeDir - | LibZstdLibDir | ProjectGitCommitId | ProjectName | ProjectVersion @@ -73,6 +60,25 @@ data Setting = CursesIncludeDir | TargetPlatformFull | BourneShell + +-- Things which configure how a specific stage is built +data BuildSetting = + CursesIncludeDir + | CursesLibDir + | DynamicExtension + | FfiIncludeDir + | FfiLibDir + | GmpIncludeDir + | GmpLibDir + | IconvIncludeDir + | IconvLibDir + | LibdwIncludeDir + | LibdwLibDir + | LibnumaIncludeDir + | LibnumaLibDir + | LibZstdIncludeDir + | LibZstdLibDir + -- TODO compute solely in Hadrian, removing these variables' definitions -- from aclocal.m4 whenever they can be calculated from other variables -- already fed into Hadrian. @@ -93,13 +99,8 @@ data ToolchainSetting -- | Look up the value of a 'Setting' in @cfg/system.config@, tracking the -- result. -setting :: Setting -> Action String +setting :: ProjectSetting -> Action String setting key = lookupSystemConfig $ case key of - CursesIncludeDir -> "curses-include-dir" - CursesLibDir -> "curses-lib-dir" - DynamicExtension -> "dynamic-extension" - FfiIncludeDir -> "ffi-include-dir" - FfiLibDir -> "ffi-lib-dir" GhcMajorVersion -> "ghc-major-version" GhcMinorVersion -> "ghc-minor-version" GhcPatchLevel -> "ghc-patch-level" @@ -107,16 +108,6 @@ setting key = lookupSystemConfig $ case key of GhcSourcePath -> "ghc-source-path" LlvmMinVersion -> "llvm-min-version" LlvmMaxVersion -> "llvm-max-version" - GmpIncludeDir -> "gmp-include-dir" - GmpLibDir -> "gmp-lib-dir" - IconvIncludeDir -> "iconv-include-dir" - IconvLibDir -> "iconv-lib-dir" - LibdwIncludeDir -> "libdw-include-dir" - LibdwLibDir -> "libdw-lib-dir" - LibnumaIncludeDir -> "libnuma-include-dir" - LibnumaLibDir -> "libnuma-lib-dir" - LibZstdIncludeDir -> "libzstd-include-dir" - LibZstdLibDir -> "libzstd-lib-dir" ProjectGitCommitId -> "project-git-commit-id" ProjectName -> "project-name" ProjectVersion -> "project-version" @@ -129,22 +120,51 @@ setting key = lookupSystemConfig $ case key of TargetPlatformFull -> "target-platform-full" BourneShell -> "bourne-shell" +buildSetting :: BuildSetting -> Stage -> Action String +buildSetting key stage = tgtConfig stage $ case key of + CursesIncludeDir -> "curses-include-dir" + CursesLibDir -> "curses-lib-dir" + DynamicExtension -> "dynamic-extension" + FfiIncludeDir -> "ffi-include-dir" + FfiLibDir -> "ffi-lib-dir" + GmpIncludeDir -> "gmp-include-dir" + GmpLibDir -> "gmp-lib-dir" + IconvIncludeDir -> "iconv-include-dir" + IconvLibDir -> "iconv-lib-dir" + LibdwIncludeDir -> "libdw-include-dir" + LibdwLibDir -> "libdw-lib-dir" + LibnumaIncludeDir -> "libnuma-include-dir" + LibnumaLibDir -> "libnuma-lib-dir" + LibZstdIncludeDir -> "libzstd-include-dir" + LibZstdLibDir -> "libzstd-lib-dir" + where + tgtConfig Stage0 {} = lookupHostBuildConfig + tgtConfig Stage1 = lookupHostBuildConfig + tgtConfig Stage2 = lookupTargetBuildConfig + tgtConfig Stage3 = lookupTargetBuildConfig + + -- | Look up the value of a 'SettingList' in @cfg/system.config@, tracking the -- result. -- See Note [tooldir: How GHC finds mingw on Windows] -- ROMES:TODO: This should be queryTargetTargetConfig -settingsFileSetting :: ToolchainSetting -> Action String -settingsFileSetting key = lookupSystemConfig $ case key of +settingsFileSetting :: ToolchainSetting -> Stage -> Action String +settingsFileSetting key stage = tgtConfig stage $ case key of ToolchainSetting_OtoolCommand -> "settings-otool-command" ToolchainSetting_InstallNameToolCommand -> "settings-install_name_tool-command" ToolchainSetting_LlcCommand -> "settings-llc-command" ToolchainSetting_OptCommand -> "settings-opt-command" ToolchainSetting_LlvmAsCommand -> "settings-llvm-as-command" ToolchainSetting_DistroMinGW -> "settings-use-distro-mingw" -- ROMES:TODO: This option doesn't seem to be in ghc-toolchain yet. It corresponds to EnableDistroToolchain + where + tgtConfig Stage0 {} = lookupHostBuildConfig + tgtConfig Stage1 = lookupHostBuildConfig + tgtConfig Stage2 = lookupTargetBuildConfig + tgtConfig Stage3 = lookupTargetBuildConfig -- | An expression that looks up the value of a 'Setting' in @cfg/system.config@, -- tracking the result. -getSetting :: Setting -> Expr c b String +getSetting :: ProjectSetting -> Expr c b String getSetting = expr . setting -- | The path to a Bourne shell interpreter. @@ -247,7 +267,7 @@ libsuf :: Stage -> Way -> Action String libsuf st way | not (wayUnit Dynamic way) = return (waySuffix way ++ ".a") -- e.g., _p.a | otherwise = do - extension <- setting DynamicExtension -- e.g., .dll or .so + extension <- buildSetting DynamicExtension st-- e.g., .dll or .so version <- ghcVersionStage st -- e.g. 8.4.4 or 8.9.xxxx let suffix = waySuffix (removeWayUnit Dynamic way) return (suffix ++ "-ghc" ++ version ++ extension) ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -10,7 +10,7 @@ module Oracles.TestSettings import Base import Hadrian.Oracles.TextFile -import Oracles.Setting (topDirectory, setting, Setting(..), crossStage) +import Oracles.Setting (topDirectory, setting, ProjectSetting(..), crossStage) import Packages import Settings.Program (programContext) import Hadrian.Oracles.Path ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -10,7 +10,6 @@ import qualified Data.Set as Set import Base import qualified Context import Expression -import Hadrian.Oracles.TextFile (lookupSystemConfig) import Oracles.Flag hiding (arSupportsAtFile, arSupportsDashL) import Oracles.ModuleFiles import Oracles.Setting @@ -49,10 +48,9 @@ ghcPrimDependencies = do rtsDependencies :: Expr [FilePath] rtsDependencies = do - stage <- getStage - rtsPath <- expr (rtsBuildPath stage) - jsTarget <- expr (isJsTarget stage) - useSystemFfi <- expr (flag UseSystemFfi) + rtsPath <- staged rtsBuildPath + jsTarget <- staged isJsTarget + useSystemFfi <- staged (buildFlag UseSystemFfi) let -- headers common to native and JS RTS common_headers = @@ -276,7 +274,7 @@ runInterpolations (Interpolations mk_substs) input = do return (subst input) -- | Interpolate the given variable with the value of the given 'Setting'. -interpolateSetting :: String -> Setting -> Interpolations +interpolateSetting :: String -> ProjectSetting -> Interpolations interpolateSetting name settng = interpolateVar name $ setting settng -- | Interpolate the @ProjectVersion@ and @ProjectVersionMunged@ variables. @@ -401,8 +399,8 @@ generateSettings settingsFile = do , ("ar supports at file", queryTarget stage arSupportsAtFile') , ("ar supports -L", queryTarget stage arSupportsDashL') , ("ranlib command", queryTarget stage ranlibPath) - , ("otool command", expr $ settingsFileSetting ToolchainSetting_OtoolCommand) - , ("install_name_tool command", expr $ settingsFileSetting ToolchainSetting_InstallNameToolCommand) + , ("otool command", staged $ settingsFileSetting ToolchainSetting_OtoolCommand) + , ("install_name_tool command", staged $ settingsFileSetting ToolchainSetting_InstallNameToolCommand) , ("windres command", queryTarget stage (maybe "/bin/false" prgPath . tgtWindres)) -- TODO: /bin/false is not available on many distributions by default, but we keep it as it were before the ghc-toolchain patch. Fix-me. , ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit, Context.stage = predStage stage }))) , ("cross compiling", expr $ yesNo <$> crossStage (predStage stage)) @@ -414,13 +412,13 @@ generateSettings settingsFile = do , ("target has GNU nonexec stack", queryTarget stage (yesNo . Toolchain.tgtSupportsGnuNonexecStack)) , ("target has .ident directive", queryTarget stage (yesNo . Toolchain.tgtSupportsIdentDirective)) , ("target has subsections via symbols", queryTarget stage (yesNo . Toolchain.tgtSupportsSubsectionsViaSymbols)) - , ("target has libm", expr $ lookupSystemConfig "target-has-libm") + , ("target has libm", yesNo <$> staged (buildFlag TargetHasLibm)) , ("Unregisterised", queryTarget stage (yesNo . tgtUnregisterised)) , ("LLVM target", queryTarget stage tgtLlvmTarget) - , ("LLVM llc command", expr $ settingsFileSetting ToolchainSetting_LlcCommand) - , ("LLVM opt command", expr $ settingsFileSetting ToolchainSetting_OptCommand) - , ("LLVM llvm-as command", expr $ settingsFileSetting ToolchainSetting_LlvmAsCommand) - , ("Use inplace MinGW toolchain", expr $ settingsFileSetting ToolchainSetting_DistroMinGW) + , ("LLVM llc command", staged $ settingsFileSetting ToolchainSetting_LlcCommand) + , ("LLVM opt command", staged $ settingsFileSetting ToolchainSetting_OptCommand) + , ("LLVM llvm-as command", staged $ settingsFileSetting ToolchainSetting_LlvmAsCommand) + , ("Use inplace MinGW toolchain", staged $ settingsFileSetting ToolchainSetting_DistroMinGW) , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter stage) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP stage) @@ -428,7 +426,7 @@ generateSettings settingsFile = do , ("Tables next to code", queryTarget stage (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget stage (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> targetUseLibffiForAdjustors stage) - , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("RTS expects libdw", yesNo <$> staged (buildFlag UseLibdw)) , ("Relative Global Package DB", pure rel_pkg_db) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" ===================================== hadrian/src/Rules/Gmp.hs ===================================== @@ -17,7 +17,7 @@ import Settings.Builders.Common (cArgs, getStagedCCFlags) -- their paths. gmpObjects :: Stage -> Action [FilePath] gmpObjects s = do - isInTree <- flag GmpInTree + isInTree <- buildFlag GmpInTree s if not isInTree then return [] else do @@ -65,8 +65,9 @@ gmpRules = do packageP = takeDirectory buildP librariesP = takeDirectory packageP stageP = takeDirectory librariesP + stage <- parsePath parseStage "" (takeFileName stageP) - isInTree <- flag GmpInTree + isInTree <- buildFlag GmpInTree stage if isInTree then do ===================================== hadrian/src/Rules/Libffi.hs ===================================== @@ -87,7 +87,7 @@ libffiContext stage = do -- | The name of the library libffiName :: Expr String libffiName = do - useSystemFfi <- expr (flag UseSystemFfi) + useSystemFfi <- staged (buildFlag UseSystemFfi) if useSystemFfi then pure "ffi" else libffiLocalName Nothing @@ -118,8 +118,8 @@ libffiHeaderDir stage = do path <- libffiBuildPath stage return $ path -/- "inst/include" -libffiSystemHeaderDir :: Action FilePath -libffiSystemHeaderDir = setting FfiIncludeDir +libffiSystemHeaderDir :: Stage -> Action FilePath +libffiSystemHeaderDir = buildSetting FfiIncludeDir fixLibffiMakefile :: FilePath -> String -> String fixLibffiMakefile top = ===================================== hadrian/src/Rules/Rts.hs ===================================== @@ -53,9 +53,9 @@ withLibffi stage action = needLibffi stage -- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput. copyLibffiHeader :: Stage -> FilePath -> Action () copyLibffiHeader stage header = do - useSystemFfi <- flag UseSystemFfi + useSystemFfi <- buildFlag UseSystemFfi stage (fromStr, headerDir) <- if useSystemFfi - then ("system",) <$> libffiSystemHeaderDir + then ("system",) <$> libffiSystemHeaderDir stage else needLibffi stage >> ("custom",) <$> libffiHeaderDir stage copyFile @@ -122,7 +122,7 @@ rtsLibffiLibrary stage way = do needRtsLibffiTargets :: Stage -> Action [FilePath] needRtsLibffiTargets stage = do rtsPath <- rtsBuildPath stage - useSystemFfi <- flag UseSystemFfi + useSystemFfi <- buildFlag UseSystemFfi stage jsTarget <- isJsTarget stage -- Header files (in the rts build dir). ===================================== hadrian/src/Settings/Builders/Cabal.hs ===================================== @@ -199,11 +199,11 @@ configureArgs cFlags' ldFlags' = do mconcat [ conf "CFLAGS" cFlags , conf "LDFLAGS" ldFlags - , conf "--with-iconv-includes" $ arg =<< getSetting IconvIncludeDir - , conf "--with-iconv-libraries" $ arg =<< getSetting IconvLibDir - , conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir - , conf "--with-gmp-libraries" $ arg =<< getSetting GmpLibDir - , conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir + , conf "--with-iconv-includes" $ arg =<< staged (buildSetting IconvIncludeDir) + , conf "--with-iconv-libraries" $ arg =<< staged (buildSetting IconvLibDir) + , conf "--with-gmp-includes" $ arg =<< staged (buildSetting GmpIncludeDir) + , conf "--with-gmp-libraries" $ arg =<< staged (buildSetting GmpLibDir) + , conf "--with-curses-libraries" $ arg =<< staged (buildSetting CursesLibDir) , conf "--host" $ arg =<< flip queryTarget targetPlatformTriple . predStage' =<< getStage , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage , ghcVersionH ===================================== hadrian/src/Settings/Builders/Common.hs ===================================== @@ -51,9 +51,9 @@ cppArgs = mempty cWarnings :: Args cWarnings = mconcat [ arg "-Wall" - , flag CcLlvmBackend ? arg "-Wno-unknown-pragmas" - , notM (flag CcLlvmBackend) ? not windowsHost ? arg "-Werror=unused-but-set-variable" - , notM (flag CcLlvmBackend) ? arg "-Wno-error=inline" ] + , staged (buildFlag CcLlvmBackend) ? arg "-Wno-unknown-pragmas" + , notM (staged (buildFlag CcLlvmBackend)) ? not windowsHost ? arg "-Werror=unused-but-set-variable" + , notM (staged (buildFlag CcLlvmBackend)) ? arg "-Wno-error=inline" ] packageDatabaseArgs :: Args packageDatabaseArgs = do ===================================== hadrian/src/Settings/Builders/Ghc.hs ===================================== @@ -103,7 +103,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do st <- getStage distDir <- expr (Context.distDir st) - useSystemFfi <- expr (flag UseSystemFfi) + useSystemFfi <- staged (buildFlag UseSystemFfi) buildPath <- getBuildPath libffiName' <- libffiName debugged <- buildingCompilerStage' . ghcDebugged =<< expr flavour ===================================== hadrian/src/Settings/Builders/Hsc2Hs.hs ===================================== @@ -12,7 +12,7 @@ hsc2hsBuilderArgs :: Args hsc2hsBuilderArgs = builder Hsc2Hs ? do stage <- getStage ccPath <- getBuilderPath $ Cc CompileC stage - gmpDir <- getSetting GmpIncludeDir + gmpDir <- staged (buildSetting GmpIncludeDir) top <- expr topDirectory hArch <- queryHost queryArch hOs <- queryHost queryOS ===================================== hadrian/src/Settings/Builders/RunTest.hs ===================================== @@ -114,7 +114,7 @@ inTreeCompilerArgs stg = do platform <- queryTargetTarget ghcStage targetPlatformTriple wordsize <- show @Int . (*8) <$> queryTargetTarget ghcStage (wordSize2Bytes . tgtWordSize) - llc_cmd <- settingsFileSetting ToolchainSetting_LlcCommand + llc_cmd <- settingsFileSetting ToolchainSetting_LlcCommand ghcStage have_llvm <- liftIO (isJust <$> findExecutable llc_cmd) top <- topDirectory ===================================== hadrian/src/Settings/Packages.hs ===================================== @@ -30,10 +30,10 @@ packageArgs = do compilerStageOption f = buildingCompilerStage' . f =<< expr flavour - cursesIncludeDir <- getSetting CursesIncludeDir - cursesLibraryDir <- getSetting CursesLibDir - ffiIncludeDir <- getSetting FfiIncludeDir - ffiLibraryDir <- getSetting FfiLibDir + cursesIncludeDir <- staged (buildSetting CursesIncludeDir) + cursesLibraryDir <- staged (buildSetting CursesLibDir) + ffiIncludeDir <- staged (buildSetting FfiIncludeDir) + ffiLibraryDir <- staged (buildSetting FfiLibDir) stageVersion <- readVersion <$> (expr $ ghcVersionStage stage) mconcat @@ -80,13 +80,13 @@ packageArgs = do [ andM [expr (ghcWithInterpreter stage), notStage0] `cabalFlag` "internal-interpreter" , notM cross `cabalFlag` "terminfo" , arg "-build-tool-depends" - , flag UseLibzstd `cabalFlag` "with-libzstd" + , staged (buildFlag UseLibzstd) `cabalFlag` "with-libzstd" -- ROMES: While the boot compiler is not updated wrt -this-unit-id -- not being fixed to `ghc`, when building stage0, we must set -- -this-unit-id to `ghc` because the boot compiler expects that. -- We do it through a cabal flag in ghc.cabal , stageVersion < makeVersion [9,8,1] ? arg "+hadrian-stage0" - , flag StaticLibzstd `cabalFlag` "static-libzstd" + , staged (buildFlag StaticLibzstd) `cabalFlag` "static-libzstd" ] , builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ] @@ -116,9 +116,9 @@ packageArgs = do -------------------------------- ghcPrim ------------------------------- , package ghcPrim ? mconcat - [ builder (Cabal Flags) ? flag NeedLibatomic `cabalFlag` "need-atomic" + [ builder (Cabal Flags) ? staged (buildFlag NeedLibatomic) `cabalFlag` "need-atomic" - , builder (Cc CompileC) ? (not <$> flag CcLlvmBackend) ? + , builder (Cc CompileC) ? (not <$> staged (buildFlag CcLlvmBackend)) ? input "**/cbits/atomic.c" ? arg "-Wno-sync-nand" ] --------------------------------- ghci --------------------------------- @@ -229,8 +229,8 @@ packageArgs = do ghcBignumArgs :: Args ghcBignumArgs = package ghcBignum ? do -- These are only used for non-in-tree builds. - librariesGmp <- getSetting GmpLibDir - includesGmp <- getSetting GmpIncludeDir + librariesGmp <- staged (buildSetting GmpLibDir) + includesGmp <- staged (buildSetting GmpIncludeDir) backend <- getBignumBackend check <- getBignumCheck @@ -253,15 +253,15 @@ ghcBignumArgs = package ghcBignum ? do -- enable in-tree support: don't depend on external "gmp" -- library - , flag GmpInTree ? arg "--configure-option=--with-intree-gmp" + , staged (buildFlag GmpInTree) ? arg "--configure-option=--with-intree-gmp" -- prefer framework over library (on Darwin) - , flag GmpFrameworkPref ? + , staged (buildFlag GmpFrameworkPref) ? arg "--configure-option=--with-gmp-framework-preferred" -- Ensure that the ghc-bignum package registration includes -- knowledge of the system gmp's library and include directories. - , notM (flag GmpInTree) ? cabalExtraDirs includesGmp librariesGmp + , notM (staged (buildFlag GmpInTree)) ? cabalExtraDirs includesGmp librariesGmp ] ] _ -> mempty @@ -290,15 +290,15 @@ rtsPackageArgs = package rts ? do way <- getWay path <- getBuildPath top <- expr topDirectory - useSystemFfi <- getFlag UseSystemFfi - ffiIncludeDir <- getSetting FfiIncludeDir - ffiLibraryDir <- getSetting FfiLibDir - libdwIncludeDir <- getSetting LibdwIncludeDir - libdwLibraryDir <- getSetting LibdwLibDir - libnumaIncludeDir <- getSetting LibnumaIncludeDir - libnumaLibraryDir <- getSetting LibnumaLibDir - libzstdIncludeDir <- getSetting LibZstdIncludeDir - libzstdLibraryDir <- getSetting LibZstdLibDir + useSystemFfi <- staged (buildFlag UseSystemFfi) + ffiIncludeDir <- staged (buildSetting FfiIncludeDir) + ffiLibraryDir <- staged (buildSetting FfiLibDir) + libdwIncludeDir <- staged (buildSetting LibdwIncludeDir) + libdwLibraryDir <- staged (buildSetting LibdwLibDir) + libnumaIncludeDir <- staged (buildSetting LibnumaIncludeDir) + libnumaLibraryDir <- staged (buildSetting LibnumaLibDir) + libzstdIncludeDir <- staged (buildSetting LibZstdIncludeDir) + libzstdLibraryDir <- staged (buildSetting LibZstdLibDir) -- Arguments passed to GHC when compiling C and .cmm sources. @@ -392,10 +392,10 @@ rtsPackageArgs = package rts ? do -- any warnings in the module. See: -- https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions#Warnings - , (not <$> flag CcLlvmBackend) ? + , (not <$> staged (buildFlag CcLlvmBackend)) ? inputs ["**/Compact.c"] ? arg "-finline-limit=2500" - , input "**/RetainerProfile.c" ? flag CcLlvmBackend ? + , input "**/RetainerProfile.c" ? staged (buildFlag CcLlvmBackend) ? arg "-Wno-incompatible-pointer-types" ] @@ -405,18 +405,18 @@ rtsPackageArgs = package rts ? do , any (wayUnit Debug) rtsWays `cabalFlag` "debug" , any (wayUnit Dynamic) rtsWays `cabalFlag` "dynamic" , any (wayUnit Threaded) rtsWays `cabalFlag` "threaded" - , flag UseLibm `cabalFlag` "libm" - , flag UseLibrt `cabalFlag` "librt" - , flag UseLibdl `cabalFlag` "libdl" + , staged (buildFlag UseLibm) `cabalFlag` "libm" + , staged (buildFlag UseLibrt) `cabalFlag` "librt" + , staged (buildFlag UseLibdl) `cabalFlag` "libdl" , useSystemFfi `cabalFlag` "use-system-libffi" , targetUseLibffiForAdjustors stage `cabalFlag` "libffi-adjustors" - , flag UseLibpthread `cabalFlag` "need-pthread" - , flag UseLibbfd `cabalFlag` "libbfd" - , flag NeedLibatomic `cabalFlag` "need-atomic" - , flag UseLibdw `cabalFlag` "libdw" - , flag UseLibnuma `cabalFlag` "libnuma" - , flag UseLibzstd `cabalFlag` "libzstd" - , flag StaticLibzstd `cabalFlag` "static-libzstd" + , staged (buildFlag UseLibpthread) `cabalFlag` "need-pthread" + , staged (buildFlag UseLibbfd ) `cabalFlag` "libbfd" + , staged (buildFlag NeedLibatomic) `cabalFlag` "need-atomic" + , staged (buildFlag UseLibdw ) `cabalFlag` "libdw" + , staged (buildFlag UseLibnuma ) `cabalFlag` "libnuma" + , staged (buildFlag UseLibzstd ) `cabalFlag` "libzstd" + , staged (buildFlag StaticLibzstd) `cabalFlag` "static-libzstd" , queryTargetTarget stage tgtSymbolsHaveLeadingUnderscore `cabalFlag` "leading-underscore" , ghcUnreg `cabalFlag` "unregisterised" , ghcEnableTNC `cabalFlag` "tables-next-to-code" @@ -437,7 +437,7 @@ rtsPackageArgs = package rts ? do , builder HsCpp ? pure [ "-DTOP=" ++ show top ] - , builder HsCpp ? flag UseLibdw ? arg "-DUSE_LIBDW" ] + , builder HsCpp ? staged (buildFlag UseLibdw) ? arg "-DUSE_LIBDW" ] -- Compile various performance-critical pieces *without* -fPIC -dynamic -- even when building a shared library. If we don't do this, then the ===================================== hadrian/src/Settings/Warnings.hs ===================================== @@ -10,16 +10,15 @@ import Packages -- | Default Haskell warning-related arguments. defaultGhcWarningsArgs :: Args defaultGhcWarningsArgs = do - stage <- getStage mconcat [ notStage0 ? arg "-Wnoncanonical-monad-instances" - , notM (flag CcLlvmBackend) ? arg "-optc-Wno-error=inline" - , flag CcLlvmBackend ? arg "-optc-Wno-unknown-pragmas" + , notM (staged (buildFlag CcLlvmBackend)) ? arg "-optc-Wno-error=inline" + , staged (buildFlag CcLlvmBackend) ? arg "-optc-Wno-unknown-pragmas" -- Cabal can seemingly produce filepaths with incorrect case on filesystems -- with case-insensitive names. Ignore such issues for now as they seem benign. -- See #17798. - , isOsxTarget stage ? arg "-optP-Wno-nonportable-include-path" - , isWinTarget stage ? arg "-optP-Wno-nonportable-include-path" + , staged isOsxTarget ? arg "-optP-Wno-nonportable-include-path" + , staged isWinTarget ? arg "-optP-Wno-nonportable-include-path" ] -- | Package-specific warnings-related arguments, mostly suppressing various warnings. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b09bf12924ebb65b3374bf0e5a8b6f1aebd8d6a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b09bf12924ebb65b3374bf0e5a8b6f1aebd8d6a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 14:46:40 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 09:46:40 -0500 Subject: [Git][ghc/ghc][wip/exception-context] 24 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65e9d350224d1_10117b7c6d584913aa@gitlab.mail> Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - ad3948f5 by Ben Gamari at 2024-03-07T09:45:44-05:00 Bump array submodule - - - - - 4a0ef7fc by Ben Gamari at 2024-03-07T09:46:03-05:00 Bump stm submodule - - - - - bdf83693 by Ben Gamari at 2024-03-07T09:46:03-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 6840ee63 by Ben Gamari at 2024-03-07T09:46:03-05:00 testsuite/interface-stability: Update documentation - - - - - 38a1f398 by Ben Gamari at 2024-03-07T09:46:03-05:00 ghc-internal: comment formatting - - - - - 0510ac05 by Ben Gamari at 2024-03-07T09:46:03-05:00 compiler: Default and warn ExceptionContext constraints - - - - - ef8e4310 by Ben Gamari at 2024-03-07T09:46:03-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - ad96a777 by Ben Gamari at 2024-03-07T09:46:03-05:00 users guide: Release notes for exception backtrace work - - - - - dc54eaaf by Ben Gamari at 2024-03-07T09:46:03-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - 2ec0f3df by Sylvain Henry at 2024-03-07T09:46:03-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - 30 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/runtime_control.rst - docs/users_guide/using-warnings.rst - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Concurrent.hs - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8d4786ddd608f72127f4fe8f7bf69746d1f38fd1...2ec0f3df90650e0305a1c9d4c629a333bd792b73 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8d4786ddd608f72127f4fe8f7bf69746d1f38fd1...2ec0f3df90650e0305a1c9d4c629a333bd792b73 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 17:02:45 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 12:02:45 -0500 Subject: [Git][ghc/ghc][wip/T24515] rts: Drop .wasm suffix from .prof file names Message-ID: <65e9f33544663_10117bb92c4c01256db@gitlab.mail> Ben Gamari pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: 3c3e02f8 by Ben Gamari at 2024-03-07T12:02:25-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 4 changed files: - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h Changes: ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(stem, ".exe"); +#elif defined(wasi32_HOST_OS) + dropExtension(stem, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasi32_HOST_OS) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3c3e02f83edf7fc92e7514f2f05eb0f5c4e9d582 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3c3e02f83edf7fc92e7514f2f05eb0f5c4e9d582 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 18:07:29 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Thu, 07 Mar 2024 13:07:29 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/andreask/m_warning Message-ID: <65ea02614bc2e_10117bd8f3d1c1399ce@gitlab.mail> Andreas Klebinger pushed new branch wip/andreask/m_warning at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/andreask/m_warning You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 21:29:11 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 07 Mar 2024 16:29:11 -0500 Subject: [Git][ghc/ghc][master] Rephrase error message to say "visible arguments" (#24318) Message-ID: <65ea31a7b876d_17a6f218f3f441006e9@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - 24 changed files: - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - testsuite/tests/ado/ado002.stderr - testsuite/tests/ghci/scripts/Defer02.stderr - testsuite/tests/indexed-types/should_compile/T10806.stderr - testsuite/tests/indexed-types/should_fail/T8518.stderr - testsuite/tests/rep-poly/T23903.stderr - testsuite/tests/th/T5358.stderr - testsuite/tests/typecheck/should_fail/DoExpansion2.stderr - testsuite/tests/typecheck/should_fail/DoExpansion3.stderr - testsuite/tests/typecheck/should_fail/FD1.stderr - testsuite/tests/typecheck/should_fail/T13902.stderr - testsuite/tests/typecheck/should_fail/T17139.stderr - + testsuite/tests/typecheck/should_fail/T24318.hs - + testsuite/tests/typecheck/should_fail/T24318.stderr - testsuite/tests/typecheck/should_fail/T8603.stderr - testsuite/tests/typecheck/should_fail/T9605.stderr - testsuite/tests/typecheck/should_fail/all.T - testsuite/tests/typecheck/should_fail/tcfail001.stderr - testsuite/tests/typecheck/should_fail/tcfail140.stderr - testsuite/tests/typecheck/should_fail/tcfail175.stderr - testsuite/tests/vdq-rta/should_fail/T22326_fail_n_args.stderr - testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr Changes: ===================================== compiler/GHC/Tc/Gen/Match.hs ===================================== @@ -75,7 +75,7 @@ import GHC.Driver.DynFlags ( getDynFlags ) import GHC.Types.Name import GHC.Types.Id import GHC.Types.SrcLoc -import GHC.Types.Basic( Arity, isDoExpansionGenerated ) +import GHC.Types.Basic( VisArity, isDoExpansionGenerated ) import Control.Monad import Control.Arrow ( second ) @@ -1207,7 +1207,7 @@ the variables they bind into scope, and typecheck the thing_inside. -- The MatchGroup for `f` has arity 2, not 3 checkArgCounts :: AnnoBody body => MatchGroup GhcRn (LocatedA (body GhcRn)) - -> TcM Arity + -> TcM VisArity checkArgCounts (MG { mg_alts = L _ [] }) = return 1 -- See Note [Empty MatchGroups] in GHC.Rename.Bind -- case e of {} or \case {} @@ -1227,6 +1227,6 @@ checkArgCounts (MG { mg_alts = L _ (match1:matches) }) n_args1 = reqd_args_in_match match1 mb_bad_matches = NE.nonEmpty [m | m <- matches, reqd_args_in_match m /= n_args1] - reqd_args_in_match :: LocatedA (Match GhcRn body1) -> Arity + reqd_args_in_match :: LocatedA (Match GhcRn body1) -> VisArity -- Counts the number of /required/ args in the match reqd_args_in_match (L _ (Match { m_pats = pats })) = count (isVisArgPat . unLoc) pats ===================================== compiler/GHC/Tc/Utils/Unify.hs ===================================== @@ -751,7 +751,7 @@ Example: matchExpectedFunTys :: forall a. ExpectedFunTyOrigin -- See Note [Herald for matchExpectedFunTys] -> UserTypeCtxt - -> Arity + -> VisArity -> ExpSigmaType -> ([ExpPatType] -> ExpRhoType -> TcM a) -> TcM (HsWrapper, a) @@ -777,7 +777,7 @@ matchExpectedFunTys herald _ arity (Infer inf_res) thing_inside matchExpectedFunTys herald ctx arity (Check top_ty) thing_inside = check 0 [] top_ty where - check :: Arity -> [ExpPatType] -> TcSigmaType -> TcM (HsWrapper, a) + check :: VisArity -> [ExpPatType] -> TcSigmaType -> TcM (HsWrapper, a) -- `check` is called only in the Check{} case -- It collects rev_pat_tys in reversed order -- n_so_far is the number of /visible/ arguments seen so far: @@ -875,7 +875,7 @@ matchExpectedFunTys herald ctx arity (Check top_ty) thing_inside defer n_so_far rev_pat_tys res_ty ------------ - defer :: Arity -> [ExpPatType] -> TcRhoType -> TcM (HsWrapper, a) + defer :: VisArity -> [ExpPatType] -> TcRhoType -> TcM (HsWrapper, a) defer n_so_far rev_pat_tys fun_ty = do { more_arg_tys <- mapM (new_check_arg_ty herald) [n_so_far + 1 .. arity] ; let all_pats = reverse rev_pat_tys ++ map mkCheckExpFunPatTy more_arg_tys @@ -898,19 +898,15 @@ new_check_arg_ty herald arg_pos -- Position for error messages only ; return (mkScaled mult arg_ty) } mkFunTysMsg :: ExpectedFunTyOrigin - -> (Arity, TcType) + -> (VisArity, TcType) -> TidyEnv -> ZonkM (TidyEnv, SDoc) -- See Note [Reporting application arity errors] -mkFunTysMsg herald (n_val_args_in_call, fun_ty) env +mkFunTysMsg herald (n_vis_args_in_call, fun_ty) env = do { (env', fun_ty) <- zonkTidyTcType env fun_ty ; let (pi_ty_bndrs, _) = splitPiTys fun_ty - - -- `all_arg_tys` contains visible quantifiers only, so their number matches - -- the number of arguments that the user needs to pass to the function. n_fun_args = count isVisiblePiTyBinder pi_ty_bndrs - - msg | n_val_args_in_call <= n_fun_args -- Enough args, in the end + msg | n_vis_args_in_call <= n_fun_args -- Enough args, in the end = text "In the result of a function call" | otherwise = hang (full_herald <> comma) @@ -921,7 +917,8 @@ mkFunTysMsg herald (n_val_args_in_call, fun_ty) env ; return (env', msg) } where full_herald = pprExpectedFunTyHerald herald - <+> speakNOf n_val_args_in_call (text "value argument") + <+> speakNOf n_vis_args_in_call (text "visible argument") + -- What are "visible" arguments? See Note [Visibility and arity] in GHC.Types.Basic {- Note [Reporting application arity errors] @@ -931,8 +928,8 @@ and the call foo = f 3 4 5 We'd like to get an error like: • Couldn't match expected type ‘t0 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to three value arguments, - but its type ‘Int -> Int -> Int’ has only two + • The function ‘f’ is applied to three visible arguments, -- What are "visible" arguments? + but its type ‘Int -> Int -> Int’ has only two -- See Note [Visibility and arity] in GHC.Types.Basic That is what `mkFunTysMsg` tries to do. But what is the "type of the function". Most obviously, we can report its full, polymorphic type; that is simple and @@ -943,7 +940,7 @@ We get this error: • Couldn't match type ‘Int’ with ‘t0 -> t’ Expected: Int -> t0 -> t Actual: Int -> Int - • The function ‘f’ is applied to three value arguments, + • The function ‘f’ is applied to three visible arguments, but its type ‘Bool -> t Int Int’ has only one That's not /quite/ right beause we can instantiate `t` to an arrow and get ===================================== compiler/GHC/Types/Basic.hs ===================================== @@ -28,7 +28,7 @@ module GHC.Types.Basic ( ConTag, ConTagZ, fIRST_TAG, - Arity, RepArity, JoinArity, FullArgCount, + Arity, VisArity, RepArity, JoinArity, FullArgCount, JoinPointHood(..), isJoinPoint, Alignment, mkAlignment, alignmentOf, alignmentBytes, @@ -183,6 +183,10 @@ instance Binary LeftOrRight where -- See also Note [Definition of arity] in "GHC.Core.Opt.Arity" type Arity = Int +-- | Syntactic (visibility) arity, i.e. the number of visible arguments. +-- See Note [Visibility and arity] +type VisArity = Int + -- | Representation Arity -- -- The number of represented arguments that can be applied to a value before it does @@ -203,6 +207,71 @@ type JoinArity = Int -- both type and value arguments! type FullArgCount = Int +{- Note [Visibility and arity] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Arity is the number of arguments that a function expects. In a curried language +like Haskell, there is more than one way to count those arguments. + +* `Arity` is the classic notion of arity, concerned with evalution, so it counts + the number of /value/ arguments that need to be supplied before evaluation can + take place, as described in notes + Note [Definition of arity] in GHC.Core.Opt.Arity + Note [Arity and function types] in GHC.Types.Id.Info + + Examples: + Int has arity == 0 + Int -> Int has arity <= 1 + Int -> Bool -> Int has arity <= 2 + We write (<=) rather than (==) as sometimes evaluation can occur before all + value arguments are supplied, depending on the actual function definition. + + This evaluation-focused notion of arity ignores type arguments, so: + forall a. a has arity == 0 + forall a. a -> a has arity <= 1 + forall a b. a -> b -> a has arity <= 2 + This is true regardless of ForAllTyFlag, so the arity is also unaffected by + (forall {a}. ty) or (forall a -> ty). + + Class dictionaries count towards the arity, as they are passed at runtime + forall a. (Num a) => a has arity <= 1 + forall a. (Num a) => a -> a has arity <= 2 + forall a b. (Num a, Ord b) => a -> b -> a has arity <= 4 + +* `VisArity` is the syntactic notion of arity. It is the number of /visible/ + arguments, i.e. arguments that occur visibly in the source code. + + In a function call `f x y z`, we can confidently say that f's vis-arity >= 3, + simply because we see three arguments [x,y,z]. We write (>=) rather than (==) + as this could be a partial application. + + At definition sites, we can acquire an underapproximation of vis-arity by + counting the patterns on the LHS, e.g. `f a b = rhs` has vis-arity >= 2. + The actual vis-arity can be higher if there is a lambda on the RHS, + e.g. `f a b = \c -> rhs`. + + If we look at the types, we can observe the following + * function arrows (a -> b) add to the vis-arity + * visible foralls (forall a -> b) add to the vis-arity + * constraint arrows (a => b) do not affect the vis-arity + * invisible foralls (forall a. b) do not affect the vis-arity + + This means that ForAllTyFlag matters for VisArity (in contrast to Arity), + while the type/value distinction is unimportant (again in contrast to Arity). + + Examples: + Int -- vis-arity == 0 (no args) + Int -> Int -- vis-arity == 1 (1 funarg) + forall a. a -> a -- vis-arity == 1 (1 funarg) + forall a. Num a => a -> a -- vis-arity == 1 (1 funarg) + forall a -> Num a => a -- vis-arity == 1 (1 req tyarg, 0 funargs) + forall a -> a -> a -- vis-arity == 2 (1 req tyarg, 1 funarg) + Int -> forall a -> Int -- vis-arity == 2 (1 funarg, 1 req tyarg) + + Wrinkle: with TypeApplications and TypeAbstractions, it is possible to visibly + bind and pass invisible arguments, e.g. `f @a x = ...` or `f @Int 42`. Those + @-prefixed arguments are ignored for the purposes of vis-arity. +-} + {- ************************************************************************ * * ===================================== testsuite/tests/ado/ado002.stderr ===================================== @@ -2,7 +2,7 @@ ado002.hs:8:8: error: [GHC-83865] • Couldn't match expected type: Char -> IO b0 with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In a stmt of a 'do' block: y <- getChar 'a' In the expression: @@ -45,7 +45,7 @@ ado002.hs:15:13: error: [GHC-83865] ado002.hs:23:9: error: [GHC-83865] • Couldn't match expected type: Char -> IO a0 with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In a stmt of a 'do' block: x5 <- getChar x4 In the expression: ===================================== testsuite/tests/ghci/scripts/Defer02.stderr ===================================== @@ -26,7 +26,7 @@ Defer01.hs:24:4: warning: [GHC-40564] [-Winaccessible-code (in -Wdefault)] Defer01.hs:30:5: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one value argument, + • The function ‘e’ is applied to one visible argument, but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' @@ -95,7 +95,7 @@ Defer01.hs:49:5: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] (deferred type error) *** Exception: Defer01.hs:30:5: error: [GHC-83865] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one value argument, + • The function ‘e’ is applied to one visible argument, but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' ===================================== testsuite/tests/indexed-types/should_compile/T10806.stderr ===================================== @@ -2,7 +2,7 @@ T10806.hs:11:32: error: [GHC-83865] • Couldn't match expected type: Char -> Bool with actual type: IO () - • The function ‘print’ is applied to two value arguments, + • The function ‘print’ is applied to two visible arguments, but its type ‘Show a => a -> IO ()’ has only one In the expression: print 'x' 'y' In an equation for ‘triggersLoop’: ===================================== testsuite/tests/indexed-types/should_fail/T8518.stderr ===================================== @@ -2,7 +2,7 @@ T8518.hs:14:18: error: [GHC-83865] • Couldn't match expected type: Z c -> B c -> t0 with actual type: F c - • The function ‘rpt’ is applied to four value arguments, + • The function ‘rpt’ is applied to four visible arguments, but its type ‘t1 -> t2 -> F t2’ has only two In the expression: rpt (4 :: Int) c z b In an equation for ‘callCont’: ===================================== testsuite/tests/rep-poly/T23903.stderr ===================================== @@ -6,5 +6,5 @@ T23903.hs:21:1: error: [GHC-55287] t0 :: TYPE cx0 Cannot unify ‘Rep a’ with the type variable ‘cx0’ because the former is not a concrete ‘RuntimeRep’. - • The equation for ‘f’ has one value argument, + • The equation for ‘f’ has one visible argument, but its type ‘a #-> ()’ has none ===================================== testsuite/tests/th/T5358.stderr ===================================== @@ -1,17 +1,17 @@ T5358.hs:7:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t1 -> t1’ - • The equation for ‘t1’ has one value argument, + • The equation for ‘t1’ has one visible argument, but its type ‘Int’ has none T5358.hs:8:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t0 -> t0’ - • The equation for ‘t2’ has one value argument, + • The equation for ‘t2’ has one visible argument, but its type ‘Int’ has none T5358.hs:10:13: error: [GHC-83865] • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t1’ is applied to one value argument, + • The function ‘t1’ is applied to one visible argument, but its type ‘Int’ has none In the first argument of ‘(==)’, namely ‘t1 x’ In the expression: t1 x == t2 x @@ -21,7 +21,7 @@ T5358.hs:10:13: error: [GHC-83865] T5358.hs:10:21: error: [GHC-83865] • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t2’ is applied to one value argument, + • The function ‘t2’ is applied to one visible argument, but its type ‘Int’ has none In the second argument of ‘(==)’, namely ‘t2 x’ In the expression: t1 x == t2 x ===================================== testsuite/tests/typecheck/should_fail/DoExpansion2.stderr ===================================== @@ -55,7 +55,7 @@ DoExpansion2.hs:31:19: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefaul DoExpansion2.hs:34:22: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type: t0 -> IO (Maybe Int) with actual type: IO String - • The function ‘getVal’ is applied to two value arguments, + • The function ‘getVal’ is applied to two visible arguments, but its type ‘Int -> IO String’ has only one In a stmt of a 'do' block: Just x <- getVal 3 4 In the expression: ===================================== testsuite/tests/typecheck/should_fail/DoExpansion3.stderr ===================================== @@ -10,7 +10,7 @@ DoExpansion3.hs:15:20: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefaul DoExpansion3.hs:18:20: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type: t0 -> t with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In the expression: getChar 2 In an equation for ‘y’: y = getChar 2 ===================================== testsuite/tests/typecheck/should_fail/FD1.stderr ===================================== @@ -5,6 +5,6 @@ FD1.hs:16:1: error: [GHC-25897] the type signature for: plus :: forall a. E a (Int -> Int) => Int -> a at FD1.hs:15:1-38 - • The equation for ‘plus’ has two value arguments, + • The equation for ‘plus’ has two visible arguments, but its type ‘Int -> a’ has only one • Relevant bindings include plus :: Int -> a (bound at FD1.hs:16:1) ===================================== testsuite/tests/typecheck/should_fail/T13902.stderr ===================================== @@ -1,7 +1,7 @@ T13902.hs:8:5: error: [GHC-83865] • Couldn't match expected type ‘t0 -> Int’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘a -> a’ has only one In the expression: f @Int 42 5 In an equation for ‘g’: g = f @Int 42 5 ===================================== testsuite/tests/typecheck/should_fail/T17139.stderr ===================================== @@ -7,7 +7,7 @@ T17139.hs:15:16: error: [GHC-88464] lift :: forall a b (f :: * -> *). (a -> b) -> TypeFam f (a -> b) at T17139.hs:14:1-38 • In the expression: _ (f <*> x) - The lambda expression ‘\ x -> ...’ has one value argument, + The lambda expression ‘\ x -> ...’ has one visible argument, but its type ‘TypeFam f (a -> b)’ has none In the expression: \ x -> _ (f <*> x) • Relevant bindings include ===================================== testsuite/tests/typecheck/should_fail/T24318.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE ExplicitNamespaces, RequiredTypeArguments #-} + +module T24318 where + +import Data.Kind + +f :: forall (a :: Type) -> Bool +f (type t) x = True ===================================== testsuite/tests/typecheck/should_fail/T24318.stderr ===================================== @@ -0,0 +1,5 @@ + +T24318.hs:8:1: error: [GHC-83865] + • Couldn't match expected type ‘Bool’ with actual type ‘t0 -> Bool’ + • The equation for ‘f’ has two visible arguments, + but its type ‘forall a -> Bool’ has only one ===================================== testsuite/tests/typecheck/should_fail/T8603.stderr ===================================== @@ -6,7 +6,7 @@ T8603.hs:33:17: error: [GHC-18872] [a2] :: * Expected: [a2] -> StateT s RV a0 Actual: t0 ((->) [a1]) (StateT s RV a0) - • The function ‘lift’ is applied to two value arguments, + • The function ‘lift’ is applied to two visible arguments, but its type ‘(Control.Monad.Trans.Class.MonadTrans t, Monad m) => m a -> t m a’ has only one ===================================== testsuite/tests/typecheck/should_fail/T9605.stderr ===================================== @@ -3,7 +3,7 @@ T9605.hs:7:6: error: [GHC-83865] • Couldn't match type ‘Bool’ with ‘m Bool’ Expected: t0 -> m Bool Actual: t0 -> Bool - • The function ‘f1’ is applied to one value argument, + • The function ‘f1’ is applied to one visible argument, but its type ‘Monad m => m Bool’ has none In the expression: f1 undefined In an equation for ‘f2’: f2 = f1 undefined ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -712,6 +712,7 @@ test('ErrorIndexLinks', normal, compile_fail, ['-fprint-error-index-links=always test('T24064', normal, compile_fail, ['']) test('T24298', normal, compile_fail, ['']) test('T24279', normal, compile_fail, ['']) +test('T24318', normal, compile_fail, ['']) # all the various do expansion fail messages test('DoExpansion1', normal, compile, ['-fdefer-type-errors']) ===================================== testsuite/tests/typecheck/should_fail/tcfail001.stderr ===================================== @@ -2,7 +2,7 @@ tcfail001.hs:9:2: error: [GHC-83865] • Couldn't match expected type: [a] with actual type: [a0] -> [a1] - • The equation for ‘op’ has one value argument, + • The equation for ‘op’ has one visible argument, but its type ‘[a]’ has none In the instance declaration for ‘A [a]’ • Relevant bindings include op :: [a] (bound at tcfail001.hs:9:2) ===================================== testsuite/tests/typecheck/should_fail/tcfail140.stderr ===================================== @@ -1,7 +1,7 @@ tcfail140.hs:11:7: error: [GHC-83865] • Couldn't match expected type ‘t1 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘Int -> Int’ has only one In the expression: f 3 9 In an equation for ‘bar’: bar = f 3 9 @@ -9,7 +9,7 @@ tcfail140.hs:11:7: error: [GHC-83865] tcfail140.hs:13:10: error: [GHC-83865] • Couldn't match expected type ‘t2 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘Int -> Int’ has only one In the expression: 3 `f` 4 In an equation for ‘rot’: rot xs = 3 `f` 4 @@ -28,11 +28,11 @@ tcfail140.hs:15:15: error: [GHC-83865] tcfail140.hs:17:8: error: [GHC-27346] • The data constructor ‘Just’ should have 1 argument, but has been given none • In the pattern: Just - The lambda expression ‘\ Just x -> ...’ has two value arguments, + The lambda expression ‘\ Just x -> ...’ has two visible arguments, but its type ‘Maybe a -> a’ has only one In the expression: ((\ Just x -> x) :: Maybe a -> a) (Just 1) tcfail140.hs:20:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t0 -> Bool’ - • The equation for ‘g’ has two value arguments, + • The equation for ‘g’ has two visible arguments, but its type ‘Int -> Int’ has only one ===================================== testsuite/tests/typecheck/should_fail/tcfail175.stderr ===================================== @@ -6,7 +6,7 @@ tcfail175.hs:11:1: error: [GHC-25897] the type signature for: evalRHS :: forall a. Int -> a at tcfail175.hs:10:1-19 - • The equation for ‘evalRHS’ has three value arguments, + • The equation for ‘evalRHS’ has three visible arguments, but its type ‘Int -> a’ has only one • Relevant bindings include evalRHS :: Int -> a (bound at tcfail175.hs:11:1) ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_n_args.stderr ===================================== @@ -5,5 +5,5 @@ T22326_fail_n_args.hs:6:1: error: [GHC-25897] the type signature for: f :: a -> forall b -> b at T22326_fail_n_args.hs:6:1-26 - • The equation for ‘f’ has three value arguments, + • The equation for ‘f’ has three visible arguments, but its type ‘a -> forall b -> b’ has only two ===================================== testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr ===================================== @@ -37,7 +37,7 @@ CaretDiagnostics1.hs:13:7-11: error: [GHC-83865] CaretDiagnostics1.hs:(13,16)-(14,13): error: [GHC-83865] • Couldn't match expected type ‘Char -> t0’ with actual type ‘()’ - • The function ‘()’ is applied to one value argument, + • The function ‘()’ is applied to one visible argument, but its type ‘()’ has none In the expression: () '0' In a case alternative: "γηξ" -> () '0' View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cd9efb4de3757fd5eaec006739f75cef288e5eb -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cd9efb4de3757fd5eaec006739f75cef288e5eb You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 21:30:46 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 07 Mar 2024 16:30:46 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 11 commits: Bump array submodule Message-ID: <65ea32066e597_17a6f21c0c8c01049b@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 39ae4f9e by Ben Gamari at 2024-03-07T16:30:38-05:00 Bump array submodule - - - - - b8e012ed by Ben Gamari at 2024-03-07T16:30:38-05:00 Bump stm submodule - - - - - 08ba9f3b by Ben Gamari at 2024-03-07T16:30:39-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - f3d8702a by Ben Gamari at 2024-03-07T16:30:39-05:00 testsuite/interface-stability: Update documentation - - - - - 440b9397 by Ben Gamari at 2024-03-07T16:30:39-05:00 ghc-internal: comment formatting - - - - - 70f745bc by Ben Gamari at 2024-03-07T16:30:39-05:00 compiler: Default and warn ExceptionContext constraints - - - - - f9a53b3b by Ben Gamari at 2024-03-07T16:30:39-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 540386f3 by Ben Gamari at 2024-03-07T16:30:39-05:00 users guide: Release notes for exception backtrace work - - - - - 901c69f7 by Ben Gamari at 2024-03-07T16:30:39-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - 28adbec7 by Sylvain Henry at 2024-03-07T16:30:39-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - 6e5db80f by Alan Zimmerman at 2024-03-07T16:30:40-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr - libraries/base/tests/IO/openFile002.stderr - libraries/base/tests/IO/openFile002.stderr-mingw32 - libraries/base/tests/IO/withBinaryFile001.stderr - libraries/base/tests/IO/withBinaryFile002.stderr - libraries/base/tests/IO/withFile001.stderr - libraries/base/tests/IO/withFile002.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bc6d3a0de722e1080b0e7aa916fe9ba1ea332e64...6e5db80f6bacd51fbabdaedbb22b0b91aebc4a33 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bc6d3a0de722e1080b0e7aa916fe9ba1ea332e64...6e5db80f6bacd51fbabdaedbb22b0b91aebc4a33 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 21:50:16 2024 From: gitlab at gitlab.haskell.org (Torsten Schmits (@torsten.schmits)) Date: Thu, 07 Mar 2024 16:50:16 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/torsten.schmits/rts-linker-direct-symbol-lookup Message-ID: <65ea3698dc162_17a6f22a605981161a3@gitlab.mail> Torsten Schmits pushed new branch wip/torsten.schmits/rts-linker-direct-symbol-lookup at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/torsten.schmits/rts-linker-direct-symbol-lookup You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 21:55:59 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Thu, 07 Mar 2024 16:55:59 -0500 Subject: [Git][ghc/ghc][wip/andreask/m_warning] RTS: Emit warning when -M < -H Message-ID: <65ea37ef94efb_17a6f22dc87e4116390@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/m_warning at Glasgow Haskell Compiler / GHC Commits: 0c35d34f by Andreas Klebinger at 2024-03-07T22:42:57+01:00 RTS: Emit warning when -M < -H - - - - - 1 changed file: - rts/RtsFlags.c Changes: ===================================== rts/RtsFlags.c ===================================== @@ -1951,6 +1951,9 @@ static void normaliseRtsOpts (void) if (RtsFlags.GcFlags.maxHeapSize != 0 && RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) { + errorBelch("Maximum heap size (-M) is smaller than suggested heap size (-H)\n" + "Setting maximum heap size to suggested heap size ( %" FMT_Word " )", + (StgWord64) RtsFlags.GcFlags.maxHeapSize * (StgWord64) BLOCK_SIZE); RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c35d34f5909066e6725891f5fe12df2812b516c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c35d34f5909066e6725891f5fe12df2812b516c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 22:46:59 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Thu, 07 Mar 2024 17:46:59 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] Deleted 2 commits: Add DCoVarSet to PluginProv Message-ID: <65ea43e37ecae_17a6f240e9d8c122576@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. Deleted commits: 70f2d3ee by Mikolaj Konarski at 2024-03-07T00:34:41+01:00 Add DCoVarSet to PluginProv Add the only remaining piece of feedback from git add src/Flavour.hs Help CI check some more of the patch Fix the 3 plugin tests that fail Explain better how shallowCoVarsOfCosDSet is entangled with a hundreds of lines bit-rotten refactoring Fix according to the first round of Simon's instruction Fix according to the second round of Simon's instruction Remove a question-comment that's probably absurd Fix according to the third round of Simon's instruction - - - - - 053fdb81 by Mikolaj Konarski at 2024-03-07T00:34:41+01:00 Make sure the foldl' accumulators are strict - - - - - 23 changed files: - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/Coercion/Opt.hs - compiler/GHC/Core/FVs.hs - compiler/GHC/Core/Lint.hs - compiler/GHC/Core/TyCo/FVs.hs - compiler/GHC/Core/TyCo/Rep.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/Core/TyCo/Tidy.hs - compiler/GHC/Core/Type.hs - compiler/GHC/CoreToIface.hs - compiler/GHC/Iface/Rename.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/IfaceToCore.hs - compiler/GHC/Tc/TyCl/Utils.hs - compiler/GHC/Tc/Utils/TcMType.hs - compiler/GHC/Types/Unique/DSet.hs - compiler/GHC/Types/Var/Set.hs - compiler/GHC/Utils/FV.hs - docs/users_guide/extending_ghc.rst - testsuite/tests/tcplugins/CtIdPlugin.hs - testsuite/tests/tcplugins/RewritePlugin.hs - testsuite/tests/tcplugins/TyFamPlugin.hs Changes: ===================================== compiler/GHC/Core/Coercion.hs ===================================== @@ -97,7 +97,7 @@ module GHC.Core.Coercion ( emptyLiftingContext, extendLiftingContext, extendLiftingContextAndInScope, liftCoSubstVarBndrUsing, isMappedByLC, extendLiftingContextCvSubst, - mkSubstLiftingContext, zapLiftingContext, + mkSubstLiftingContext, liftingContextSubst, zapLiftingContext, substForAllCoBndrUsingLC, lcLookupCoVar, lcInScopeSet, LiftCoEnv, LiftingContext(..), liftEnvSubstLeft, liftEnvSubstRight, @@ -1397,7 +1397,7 @@ setNominalRole_maybe r co setNominalRole_maybe_helper (UnivCo prov _ co1 co2) | case prov of PhantomProv _ -> False -- should always be phantom ProofIrrelProv _ -> True -- it's always safe - PluginProv _ -> False -- who knows? This choice is conservative. + PluginProv _ _ -> False -- who knows? This choice is conservative. = Just $ UnivCo prov Nominal co1 co2 setNominalRole_maybe_helper _ = Nothing @@ -1522,7 +1522,7 @@ promoteCoercion co = case co of UnivCo (PhantomProv kco) _ _ _ -> kco UnivCo (ProofIrrelProv kco) _ _ _ -> kco - UnivCo (PluginProv _) _ _ _ -> mkKindCo co + UnivCo (PluginProv _ _) _ _ _ -> mkKindCo co SymCo g -> mkSymCo (promoteCoercion g) @@ -1979,6 +1979,9 @@ mkLiftingContext pairs mkSubstLiftingContext :: Subst -> LiftingContext mkSubstLiftingContext subst = LC subst emptyVarEnv +liftingContextSubst :: LiftingContext -> Subst +liftingContextSubst (LC subst _) = subst + -- | Extend a lifting context with a new mapping. extendLiftingContext :: LiftingContext -- ^ original LC -> TyCoVar -- ^ new variable to map... @@ -2354,7 +2357,7 @@ seqCo (AxiomRuleCo _ cs) = seqCos cs seqProv :: UnivCoProvenance -> () seqProv (PhantomProv co) = seqCo co seqProv (ProofIrrelProv co) = seqCo co -seqProv (PluginProv _) = () +seqProv (PluginProv _ cvs) = seqDVarSet cvs seqCos :: [Coercion] -> () seqCos [] = () ===================================== compiler/GHC/Core/Coercion/Opt.hs ===================================== @@ -641,7 +641,7 @@ opt_univ env sym prov role oty1 oty2 where prov' = case prov of ProofIrrelProv kco -> ProofIrrelProv $ opt_co4_wrap env sym False Nominal kco - PluginProv _ -> prov + PluginProv s cvs -> PluginProv s $ substDCoVarSet (liftingContextSubst env) cvs ------------- opt_transList :: HasDebugCallStack => InScopeSet -> [NormalCo] -> [NormalCo] -> [NormalCo] @@ -722,7 +722,8 @@ opt_trans_rule is in_co1@(UnivCo p1 r1 tyl1 _tyr1) = Just $ PhantomProv $ opt_trans is kco1 kco2 opt_trans_prov (ProofIrrelProv kco1) (ProofIrrelProv kco2) = Just $ ProofIrrelProv $ opt_trans is kco1 kco2 - opt_trans_prov (PluginProv str1) (PluginProv str2) | str1 == str2 = Just p1 + opt_trans_prov (PluginProv str1 cvs1) (PluginProv str2 cvs2) + | str1 == str2 = Just (PluginProv str1 (cvs1 `unionDVarSet` cvs2)) opt_trans_prov _ _ = Nothing -- Push transitivity down through matching top-level constructors. ===================================== compiler/GHC/Core/FVs.hs ===================================== @@ -410,7 +410,7 @@ orphNamesOfCo (HoleCo _) = emptyNameSet orphNamesOfProv :: UnivCoProvenance -> NameSet orphNamesOfProv (PhantomProv co) = orphNamesOfCo co orphNamesOfProv (ProofIrrelProv co) = orphNamesOfCo co -orphNamesOfProv (PluginProv _) = emptyNameSet +orphNamesOfProv (PluginProv _ _) = emptyNameSet orphNamesOfCos :: [Coercion] -> NameSet orphNamesOfCos = orphNamesOfThings orphNamesOfCo ===================================== compiler/GHC/Core/Lint.hs ===================================== @@ -1931,6 +1931,13 @@ checkTyCon :: TyCon -> LintM () checkTyCon tc = checkL (not (isTcTyCon tc)) (text "Found TcTyCon:" <+> ppr tc) +------------------- +checkTyCoVarInScope :: Subst -> TyCoVar -> LintM () +checkTyCoVarInScope subst tcv + = checkL (tcv `isInScope` subst) $ + hang (text "The type or coercion variable" <+> pprBndr LetBind tcv) + 2 (text "is out of scope") + ------------------- lintType :: Type -> LintM LintedType @@ -1948,12 +1955,8 @@ lintType (TyVarTy tv) -- In GHCi we may lint an expression with a free -- type variable. Then it won't be in the -- substitution, but it should be in scope - Nothing | tv `isInScope` subst - -> return (TyVarTy tv) - | otherwise - -> failWithL $ - hang (text "The type variable" <+> pprBndr LetBind tv) - 2 (text "is out of scope") + Nothing -> do { checkTyCoVarInScope subst tv + ; return (TyVarTy tv) } } lintType ty@(AppTy t1 t2) @@ -2325,15 +2328,8 @@ lintCoercion (CoVarCo cv) = do { subst <- getSubst ; case lookupCoVar subst cv of Just linted_co -> return linted_co ; - Nothing - | cv `isInScope` subst - -> return (CoVarCo cv) - | otherwise - -> - -- lintCoBndr always extends the substitution - failWithL $ - hang (text "The coercion variable" <+> pprBndr LetBind cv) - 2 (text "is out of scope") + Nothing -> do { checkTyCoVarInScope subst cv + ; return (CoVarCo cv) } } @@ -2532,7 +2528,12 @@ lintCoercion co@(UnivCo prov r ty1 ty2) ; check_kinds kco k1 k2 ; return (ProofIrrelProv kco') } - lint_prov _ _ prov@(PluginProv _) = return prov + lint_prov _ _ (PluginProv s cvs) + = do { subst <- getSubst + ; mapM_ (checkTyCoVarInScope subst) (dVarSetElems cvs) + -- Don't bother to return substituted fvs; + -- they don't matter to Lint + ; return (PluginProv s cvs) } check_kinds kco k1 k2 = do { let Pair k1' k2' = coercionKind kco ===================================== compiler/GHC/Core/TyCo/FVs.hs ===================================== @@ -19,6 +19,7 @@ module GHC.Core.TyCo.FVs tyCoVarsOfCoDSet, tyCoFVsOfCo, tyCoFVsOfCos, tyCoVarsOfCoList, + coVarsOfCosDSet, almostDevoidCoVarOfCo, @@ -446,6 +447,13 @@ deepCoVarFolder = TyCoFolder { tcf_view = noView -- See Note [CoercionHoles and coercion free variables] -- in GHC.Core.TyCo.Rep +------- Same again, but for DCoVarSet ---------- +-- But this time the free vars are shallow + +coVarsOfCosDSet :: [Coercion] -> DCoVarSet +coVarsOfCosDSet cos = fvDVarSetSome isCoVar (tyCoFVsOfCos cos) + + {- ********************************************************************* * * Closing over kinds @@ -660,7 +668,7 @@ tyCoFVsOfCoVar v fv_cand in_scope acc tyCoFVsOfProv :: UnivCoProvenance -> FV tyCoFVsOfProv (PhantomProv co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc tyCoFVsOfProv (ProofIrrelProv co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc -tyCoFVsOfProv (PluginProv _) fv_cand in_scope acc = emptyFV fv_cand in_scope acc +tyCoFVsOfProv (PluginProv _ cvs) fv_cand in_scope acc = mkFVs (dVarSetElems cvs) fv_cand in_scope acc tyCoFVsOfCos :: [Coercion] -> FV tyCoFVsOfCos [] fv_cand in_scope acc = emptyFV fv_cand in_scope acc @@ -730,7 +738,7 @@ almost_devoid_co_var_of_prov (PhantomProv co) cv = almost_devoid_co_var_of_co co cv almost_devoid_co_var_of_prov (ProofIrrelProv co) cv = almost_devoid_co_var_of_co co cv -almost_devoid_co_var_of_prov (PluginProv _) _ = True +almost_devoid_co_var_of_prov (PluginProv _ cvs) cv = not (cv `elemDVarSet` cvs) almost_devoid_co_var_of_type :: Type -> CoVar -> Bool almost_devoid_co_var_of_type (TyVarTy _) _ = True @@ -1129,7 +1137,7 @@ tyConsOfType ty go_prov (PhantomProv co) = go_co co go_prov (ProofIrrelProv co) = go_co co - go_prov (PluginProv _) = emptyUniqSet + go_prov (PluginProv _ _) = emptyUniqSet go_cos cos = foldr (unionUniqSets . go_co) emptyUniqSet cos @@ -1340,4 +1348,4 @@ occCheckExpand vs_to_avoid ty ------------------ go_prov cxt (PhantomProv co) = PhantomProv <$> go_co cxt co go_prov cxt (ProofIrrelProv co) = ProofIrrelProv <$> go_co cxt co - go_prov _ p@(PluginProv _) = return p + go_prov _ p@(PluginProv _ _) = return p ===================================== compiler/GHC/Core/TyCo/Rep.hs ===================================== @@ -1,4 +1,3 @@ - {-# LANGUAGE DeriveDataTypeable #-} {-# OPTIONS_HADDOCK not-home #-} @@ -78,7 +77,7 @@ import {-# SOURCE #-} GHC.Core.Type( chooseFunTyFlag, typeKind, typeTypeOrConstr -- friends: import GHC.Types.Var -import GHC.Types.Var.Set( elemVarSet ) +import GHC.Types.Var.Set( DCoVarSet, dVarSetElems, elemVarSet ) import GHC.Core.TyCon import GHC.Core.Coercion.Axiom @@ -886,7 +885,7 @@ data Coercion | FunCo -- FunCo :: "e" -> N/P -> e -> e -> e -- See Note [FunCo] for fco_afl, fco_afr - { fco_role :: Role + { fco_role :: Role , fco_afl :: FunTyFlag -- Arrow for coercionLKind , fco_afr :: FunTyFlag -- Arrow for coercionRKind , fco_mult :: CoercionN @@ -1527,15 +1526,19 @@ data UnivCoProvenance -- considered equivalent. See Note [ProofIrrelProv]. -- Can be used in Nominal or Representational coercions - | PluginProv String -- ^ From a plugin, which asserts that this coercion - -- is sound. The string is for the use of the plugin. + | PluginProv String !DCoVarSet + -- ^ From a plugin, which asserts that this coercion is sound. + -- The string and the variable set are for the use by the plugin. + -- E.g., the set may contain the in-scope coercion variables + -- that the the proof represented by the coercion makes use of. + -- See Note [The importance of tracking free coercion variables]. deriving Data.Data instance Outputable UnivCoProvenance where - ppr (PhantomProv _) = text "(phantom)" - ppr (ProofIrrelProv _) = text "(proof irrel.)" - ppr (PluginProv str) = parens (text "plugin" <+> brackets (text str)) + ppr (PhantomProv _) = text "(phantom)" + ppr (ProofIrrelProv _) = text "(proof irrel.)" + ppr (PluginProv str cvs) = parens (text "plugin" <+> brackets (text str) <+> ppr cvs) -- | A coercion to be filled in by the type-checker. See Note [Coercion holes] data CoercionHole @@ -1690,6 +1693,50 @@ Here, where co5 :: (a1 ~ Bool) ~ (a2 ~ Bool) co5 = TyConAppCo Nominal (~#) [<*>, <*>, co4, ] + + +Note [The importance of tracking free coercion variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +It is vital that `UnivCo` (a coercion that lacks a proper proof) +tracks its free coercion variables. To see why, consider this program: + + type S :: Nat -> Nat + + data T (a::Nat) where + T1 :: T 0 + T2 :: ... + + f :: T a -> S (a+1) -> S 1 + f = /\a (x:T a) (y:a). + case x of + T1 (gco : a ~# 0) -> y |> wco + +For this to typecheck we need `wco :: S (a+1) ~# S 1`, given that `gco : a ~# 0`. +To prove that we need to know that `a+1 = 1` if `a=0`, which a plugin might know. +So it solves `wco` by providing a `UnivCo (PluginProv "my-plugin" gcvs) (a+1) 1`. + + But the `gcvs` in `PluginProv` must mention `gco`. + +Why? Otherwise we might float the entire expression (y |> wco) out of the +the case alternative for `T1` which brings `gco` into scope. If this +happens then we aren't far from a segmentation fault or much worse. +See #23923 for a real-world example of this happening. + +So it is /crucial/ for the `PluginProv` to mention, in `gcvs`, the coercion +variables used by the plugin to justify the `UnivCo` that it builds. + +Note that we don't need to track +* the coercion's free *type* variables +* coercion variables free in kinds (we only need the "shallow" free covars) + +This means that we may float past type variables which the original +proof had as free variables. While surprising, this doesn't jeopardise +the validity of the coercion, which only depends upon the scoping +relative to the free coercion variables. + +(The free coercion variables are kept as a DCoVarSet in UnivCo, +since these sets are included in interface files.) + -} @@ -1856,7 +1903,9 @@ foldTyCo (TyCoFolder { tcf_view = view go_prov env (PhantomProv co) = go_co env co go_prov env (ProofIrrelProv co) = go_co env co - go_prov _ (PluginProv _) = mempty + go_prov _ (PluginProv _ cvs) = go_cvs env cvs + + go_cvs env cvs = foldl' (\ !acc cv -> acc `mappend` covar env cv) mempty (dVarSetElems cvs) -- | A view function that looks through nothing. noView :: Type -> Maybe Type @@ -1922,7 +1971,7 @@ coercionSize (AxiomRuleCo _ cs) = 1 + sum (map coercionSize cs) provSize :: UnivCoProvenance -> Int provSize (PhantomProv co) = 1 + coercionSize co provSize (ProofIrrelProv co) = 1 + coercionSize co -provSize (PluginProv _) = 1 +provSize (PluginProv _ _) = 1 {- ************************************************************************ ===================================== compiler/GHC/Core/TyCo/Subst.hs ===================================== @@ -41,7 +41,7 @@ module GHC.Core.TyCo.Subst cloneTyVarBndr, cloneTyVarBndrs, substVarBndr, substVarBndrs, substTyVarBndr, substTyVarBndrs, - substCoVarBndr, + substCoVarBndr, substDCoVarSet, substTyVar, substTyVars, substTyVarToTyVar, substTyCoVars, substTyCoBndr, substForAllCoBndr, @@ -910,12 +910,18 @@ subst_co subst co go_prov (PhantomProv kco) = PhantomProv (go kco) go_prov (ProofIrrelProv kco) = ProofIrrelProv (go kco) - go_prov p@(PluginProv _) = p + go_prov (PluginProv s cvs) = PluginProv s $ substDCoVarSet subst cvs -- See Note [Substituting in a coercion hole] go_hole h@(CoercionHole { ch_co_var = cv }) = h { ch_co_var = updateVarType go_ty cv } +-- | Perform a substitution within a 'DVarSet' of free variables, +-- returning the shallow free coercion variables. +substDCoVarSet :: Subst -> DCoVarSet -> DCoVarSet +substDCoVarSet subst cvs = coVarsOfCosDSet $ map (substCoVar subst) $ + dVarSetElems cvs + substForAllCoBndr :: Subst -> TyCoVar -> KindCoercion -> (Subst, TyCoVar, Coercion) substForAllCoBndr subst ===================================== compiler/GHC/Core/TyCo/Tidy.hs ===================================== @@ -20,9 +20,11 @@ import GHC.Data.FastString import GHC.Core.TyCo.Rep import GHC.Core.TyCo.FVs (tyCoVarsOfTypesWellScoped, tyCoVarsOfTypeList) +import GHC.Data.Maybe (orElse) import GHC.Types.Name hiding (varName) import GHC.Types.Var import GHC.Types.Var.Env +import GHC.Types.Var.Set import GHC.Utils.Misc (strictMap) import Data.List (mapAccumL) @@ -233,9 +235,7 @@ tidyCo env@(_, subst) co -- the case above duplicates a bit of work in tidying h and the kind -- of tv. But the alternative is to use coercionKind, which seems worse. go (FunCo r afl afr w co1 co2) = ((FunCo r afl afr $! go w) $! go co1) $! go co2 - go (CoVarCo cv) = case lookupVarEnv subst cv of - Nothing -> CoVarCo cv - Just cv' -> CoVarCo cv' + go (CoVarCo cv) = CoVarCo $! go_cv cv go (HoleCo h) = HoleCo h go (AxiomInstCo con ind cos) = AxiomInstCo con ind $! strictMap go cos go (UnivCo p r t1 t2) = (((UnivCo $! (go_prov p)) $! r) $! @@ -249,9 +249,11 @@ tidyCo env@(_, subst) co go (SubCo co) = SubCo $! go co go (AxiomRuleCo ax cos) = AxiomRuleCo ax $ strictMap go cos + go_cv cv = lookupVarEnv subst cv `orElse` cv + go_prov (PhantomProv co) = PhantomProv $! go co go_prov (ProofIrrelProv co) = ProofIrrelProv $! go co - go_prov p@(PluginProv _) = p + go_prov (PluginProv s cvs) = PluginProv s $ mapDVarSet go_cv cvs tidyCos :: TidyEnv -> [Coercion] -> [Coercion] tidyCos env = strictMap (tidyCo env) ===================================== compiler/GHC/Core/Type.hs ===================================== @@ -580,7 +580,7 @@ expandTypeSynonyms ty go_prov subst (PhantomProv co) = PhantomProv (go_co subst co) go_prov subst (ProofIrrelProv co) = ProofIrrelProv (go_co subst co) - go_prov _ p@(PluginProv _) = p + go_prov _ p@(PluginProv _ _) = p -- the "False" and "const" are to accommodate the type of -- substForAllCoBndrUsing, which is general enough to @@ -912,7 +912,8 @@ mapTyCo mapper -> (go_ty (), go_tys (), go_co (), go_cos ()) {-# INLINE mapTyCoX #-} -- See Note [Specialising mappers] -mapTyCoX :: Monad m => TyCoMapper env m +mapTyCoX :: forall m env. Monad m + => TyCoMapper env m -> ( env -> Type -> m Type , env -> [Type] -> m [Type] , env -> Coercion -> m Coercion @@ -960,6 +961,7 @@ mapTyCoX (TyCoMapper { tcm_tyvar = tyvar go_mco !_ MRefl = return MRefl go_mco !env (MCo co) = MCo <$> (go_co env co) + go_co :: env -> Coercion -> m Coercion go_co !env (Refl ty) = Refl <$> go_ty env ty go_co !env (GRefl r ty mco) = mkGReflCo r <$> go_ty env ty <*> go_mco env mco go_co !env (AppCo c1 c2) = mkAppCo <$> go_co env c1 <*> go_co env c2 @@ -999,7 +1001,14 @@ mapTyCoX (TyCoMapper { tcm_tyvar = tyvar go_prov !env (PhantomProv co) = PhantomProv <$> go_co env co go_prov !env (ProofIrrelProv co) = ProofIrrelProv <$> go_co env co - go_prov !_ p@(PluginProv _) = return p + go_prov !env (PluginProv s cvs) = PluginProv s <$> strictFoldDVarSet (do_cv env) + (return emptyDVarSet) cvs + + do_cv :: env -> CoVar -> m DTyCoVarSet -> m DTyCoVarSet + do_cv env v mfvs = do { fvs <- mfvs + ; co <- covar env v + ; return (tyCoVarsOfCoDSet co `unionDVarSet` fvs) } + {- ********************************************************************* ===================================== compiler/GHC/CoreToIface.hs ===================================== @@ -88,6 +88,7 @@ import GHC.Utils.Panic import GHC.Utils.Misc import Data.Maybe ( isNothing, catMaybes ) +import Data.List ( partition ) {- Note [Avoiding space leaks in toIface*] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -318,9 +319,11 @@ toIfaceCoercionX fr co fr' = fr `delVarSet` tv go_prov :: UnivCoProvenance -> IfaceUnivCoProv - go_prov (PhantomProv co) = IfacePhantomProv (go co) - go_prov (ProofIrrelProv co) = IfaceProofIrrelProv (go co) - go_prov (PluginProv str) = IfacePluginProv str + go_prov (PhantomProv co) = IfacePhantomProv (go co) + go_prov (ProofIrrelProv co) = IfaceProofIrrelProv (go co) + go_prov (PluginProv str cvs) = IfacePluginProv str (map toIfaceCoVar bound_cvs) free_cvs + where + (free_cvs, bound_cvs) = partition (`elemVarSet` fr) (dVarSetElems cvs) toIfaceTcArgs :: TyCon -> [Type] -> IfaceAppArgs toIfaceTcArgs = toIfaceTcArgsX emptyVarSet ===================================== compiler/GHC/Iface/Rename.hs ===================================== @@ -678,6 +678,8 @@ rnIfaceCo (IfaceAxiomInstCo n i cs) = IfaceAxiomInstCo <$> rnIfaceGlobal n <*> pure i <*> mapM rnIfaceCo cs rnIfaceCo (IfaceUnivCo s r t1 t2) = IfaceUnivCo s r <$> rnIfaceType t1 <*> rnIfaceType t2 + -- Renaming affects only type constructors, not coercion variables, + -- so no need to recurs into the provenance. rnIfaceCo (IfaceSymCo c) = IfaceSymCo <$> rnIfaceCo c rnIfaceCo (IfaceTransCo c1 c2) ===================================== compiler/GHC/Iface/Syntax.hs ===================================== @@ -1795,7 +1795,7 @@ freeNamesIfCoercion (IfaceAxiomRuleCo _ax cos) freeNamesIfProv :: IfaceUnivCoProv -> NameSet freeNamesIfProv (IfacePhantomProv co) = freeNamesIfCoercion co freeNamesIfProv (IfaceProofIrrelProv co) = freeNamesIfCoercion co -freeNamesIfProv (IfacePluginProv _) = emptyNameSet +freeNamesIfProv (IfacePluginProv _ _ _) = emptyNameSet freeNamesIfVarBndr :: VarBndr IfaceBndr vis -> NameSet freeNamesIfVarBndr (Bndr bndr _) = freeNamesIfBndr bndr ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -399,7 +399,10 @@ data IfaceCoercion data IfaceUnivCoProv = IfacePhantomProv IfaceCoercion | IfaceProofIrrelProv IfaceCoercion - | IfacePluginProv String + | IfacePluginProv String [IfLclName] [Var] + -- Local covars and open (free) covars resp + -- See Note [Free tyvars in IfaceType] + {- Note [Holes in IfaceCoercion] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -620,7 +623,7 @@ substIfaceType env ty go_prov (IfacePhantomProv co) = IfacePhantomProv (go_co co) go_prov (IfaceProofIrrelProv co) = IfaceProofIrrelProv (go_co co) - go_prov co@(IfacePluginProv _) = co + go_prov co@(IfacePluginProv _ _ _) = co substIfaceAppArgs :: IfaceTySubst -> IfaceAppArgs -> IfaceAppArgs substIfaceAppArgs env args @@ -1954,8 +1957,8 @@ pprIfaceUnivCoProv (IfacePhantomProv co) = text "phantom" <+> pprParendIfaceCoercion co pprIfaceUnivCoProv (IfaceProofIrrelProv co) = text "irrel" <+> pprParendIfaceCoercion co -pprIfaceUnivCoProv (IfacePluginProv s) - = text "plugin" <+> doubleQuotes (text s) +pprIfaceUnivCoProv (IfacePluginProv s cvs fcvs) + = hang (text "plugin") 2 (sep [doubleQuotes (text s), ppr cvs, ppr fcvs]) ------------------- instance Outputable IfaceTyCon where @@ -2324,9 +2327,11 @@ instance Binary IfaceUnivCoProv where put_ bh (IfaceProofIrrelProv a) = do putByte bh 2 put_ bh a - put_ bh (IfacePluginProv a) = do + put_ bh (IfacePluginProv a cvs fcvs) = do putByte bh 3 put_ bh a + assertPpr (null fcvs) (ppr cvs $$ ppr fcvs) $ + put_ bh cvs get bh = do tag <- getByte bh @@ -2336,7 +2341,8 @@ instance Binary IfaceUnivCoProv where 2 -> do a <- get bh return $ IfaceProofIrrelProv a 3 -> do a <- get bh - return $ IfacePluginProv a + cvs <- get bh + return $ IfacePluginProv a cvs [] _ -> panic ("get IfaceUnivCoProv " ++ show tag) ===================================== compiler/GHC/IfaceToCore.hs ===================================== @@ -1491,7 +1491,10 @@ tcIfaceCo = go tcIfaceUnivCoProv :: IfaceUnivCoProv -> IfL UnivCoProvenance tcIfaceUnivCoProv (IfacePhantomProv kco) = PhantomProv <$> tcIfaceCo kco tcIfaceUnivCoProv (IfaceProofIrrelProv kco) = ProofIrrelProv <$> tcIfaceCo kco -tcIfaceUnivCoProv (IfacePluginProv str) = return $ PluginProv str +tcIfaceUnivCoProv (IfacePluginProv str cvs fcvs) = + assertPpr (null fcvs) (ppr fcvs) $ do + cvs' <- mapM tcIfaceLclId cvs + return $ PluginProv str $ mkDVarSet cvs' {- ************************************************************************ ===================================== compiler/GHC/Tc/TyCl/Utils.hs ===================================== @@ -156,7 +156,7 @@ synonymTyConsOfType ty go_prov (PhantomProv co) = go_co co go_prov (ProofIrrelProv co) = go_co co - go_prov (PluginProv _) = emptyNameEnv + go_prov (PluginProv _ _) = emptyNameEnv go_tc tc | isTypeSynonymTyCon tc = unitNameEnv (tyConName tc) tc | otherwise = emptyNameEnv ===================================== compiler/GHC/Tc/Utils/TcMType.hs ===================================== @@ -1592,7 +1592,10 @@ collect_cand_qtvs_co orig_ty cur_lvl bound = go_co go_prov dv (PhantomProv co) = go_co dv co go_prov dv (ProofIrrelProv co) = go_co dv co - go_prov dv (PluginProv _) = return dv + go_prov dv (PluginProv _ cvs) = strictFoldDVarSet zt_cv (return dv) cvs + + zt_cv :: CoVar -> TcM CandidatesQTvs -> TcM CandidatesQTvs + zt_cv cv mdvs = do { dvs <- mdvs; go_cv dvs cv } go_cv :: CandidatesQTvs -> CoVar -> TcM CandidatesQTvs go_cv dv@(DV { dv_cvs = cvs }) cv ===================================== compiler/GHC/Types/Unique/DSet.hs ===================================== @@ -33,7 +33,7 @@ module GHC.Types.Unique.DSet ( lookupUniqDSet, uniqDSetToList, partitionUniqDSet, - mapUniqDSet + mapUniqDSet, strictFoldUniqDSet ) where import GHC.Prelude @@ -125,7 +125,15 @@ partitionUniqDSet p = coerce . partitionUDFM p . getUniqDSet -- See Note [UniqSet invariant] in GHC.Types.Unique.Set mapUniqDSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b -mapUniqDSet f = mkUniqDSet . map f . uniqDSetToList +mapUniqDSet f (UniqDSet m) = UniqDSet $ unsafeCastUDFMKey $ mapUDFM f m +-- Simply apply `f` to each element, retaining all the structure unchanged. +-- The identification of keys and elements prevents a derived Functor +-- instance, but `unsafeCastUDFMKey` makes it possible to apply the strict +-- mapping from DFM. + +strictFoldUniqDSet :: (a -> r -> r) -> r -> UniqDSet a -> r +strictFoldUniqDSet k r s = foldl' (\ !r e -> k e r) r $ + uniqDSetToList s -- Two 'UniqDSet's are considered equal if they contain the same -- uniques. ===================================== compiler/GHC/Types/Var/Set.hs ===================================== @@ -26,7 +26,7 @@ module GHC.Types.Var.Set ( nonDetStrictFoldVarSet, -- * Deterministic Var set types - DVarSet, DIdSet, DTyVarSet, DTyCoVarSet, + DVarSet, DIdSet, DTyVarSet, DCoVarSet, DTyCoVarSet, -- ** Manipulating these sets emptyDVarSet, unitDVarSet, mkDVarSet, @@ -38,7 +38,7 @@ module GHC.Types.Var.Set ( isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, nonDetStrictFoldDVarSet, - filterDVarSet, mapDVarSet, + filterDVarSet, mapDVarSet, strictFoldDVarSet, dVarSetMinusVarSet, anyDVarSet, allDVarSet, transCloDVarSet, sizeDVarSet, seqDVarSet, @@ -232,6 +232,9 @@ type DIdSet = UniqDSet Id -- | Deterministic Type Variable Set type DTyVarSet = UniqDSet TyVar +-- | Deterministic Coercion Variable Set +type DCoVarSet = UniqDSet CoVar + -- | Deterministic Type or Coercion Variable Set type DTyCoVarSet = UniqDSet TyCoVar @@ -308,6 +311,9 @@ allDVarSet p = allUDFM p . getUniqDSet mapDVarSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b mapDVarSet = mapUniqDSet +strictFoldDVarSet :: (a -> r -> r) -> r -> UniqDSet a -> r +strictFoldDVarSet = strictFoldUniqDSet + filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet filterDVarSet = filterUniqDSet ===================================== compiler/GHC/Utils/FV.hs ===================================== @@ -21,6 +21,7 @@ module GHC.Utils.FV ( delFVs, filterFV, mapUnionFV, + fvDVarSetSome, ) where import GHC.Prelude @@ -195,3 +196,7 @@ mkFVs :: [Var] -> FV mkFVs vars fv_cand in_scope acc = mapUnionFV unitFV vars fv_cand in_scope acc {-# INLINE mkFVs #-} + +fvDVarSetSome :: InterestingVarFun -> FV -> DVarSet +fvDVarSetSome interesting_var fv = + mkDVarSet $ fst $ fv interesting_var emptyVarSet ([], emptyVarSet) ===================================== docs/users_guide/extending_ghc.rst ===================================== @@ -760,10 +760,33 @@ This evidence is ignored for Given constraints, which GHC "solves" simply by discarding them; typically this is used when they are uninformative (e.g. reflexive equations). For Wanted constraints, the evidence will form part of the Core term that is generated after -typechecking, and can be checked by ``-dcore-lint``. It is possible for -the plugin to create equality axioms for use in evidence terms, but GHC -does not check their consistency, and inconsistent axiom sets may lead -to segfaults or other runtime misbehaviour. +typechecking, and can be checked by ``-dcore-lint``. + +When solving a Wanted equality constraint (of type ``t1 ~N# t2`` +or ``t1 ~R# t2`` for nominal and representation equalities respectively), +the evidence (of type ``EvTerm``) will take the form ``EvExpr (Coercion co)``, +where the coercion ``co`` has type ``co :: t1 ~N# t2`` or ``co :: t1 ~R# t2`` +respectively. + +It is up to the plugin to construct a suitable coercion ``co``. +However, one possibility is to construct one of form :: + + UnivCo (PluginProv "my-plugin" gcvs) role t1 t2 + +A ``UnivCo`` of this form says "trust me: my-plugin has solved this Wanted +using (only) ``gcvs``". + +Here + +* The ``role`` should be the role of the original equality constraint + (nominal or representational). +* The ``gcvs`` is a set of "given coercion variables"; these are the coercion + variable bound by enclosing Given constraints, which the plugin has used + to justify solving the Wanted. + +For soundness, it is very important to include the ``gcvs``; otherwise +GHC may transform the program into a form that seg-faults. +See #23923 for a long dicussion. Evidence is required also when creating new Given constraints, which are usually implied by old ones. It is not uncommon that the evidence of a new ===================================== testsuite/tests/tcplugins/CtIdPlugin.hs ===================================== @@ -21,6 +21,7 @@ import GHC.Tc.Plugin import GHC.Tc.Types import GHC.Tc.Types.Constraint import GHC.Tc.Types.Evidence +import GHC.Types.Unique.DSet -- common import Common @@ -41,7 +42,7 @@ solver :: [String] -> PluginDefs -> EvBindsVar -> [Ct] -> [Ct] -> TcPluginM TcPluginSolveResult solver _args defs ev givens wanteds = do - let pluginCo = mkUnivCo (PluginProv "CtIdPlugin") Representational + let pluginCo = mkUnivCo (PluginProv "CtIdPlugin" emptyUniqDSet) Representational -- Empty is fine. This plugin does not use "givens". let substEvidence ct ct' = evCast (ctEvExpr $ ctEvidence ct') $ pluginCo (ctPred ct') (ctPred ct) ===================================== testsuite/tests/tcplugins/RewritePlugin.hs ===================================== @@ -45,6 +45,8 @@ import GHC.Tc.Types.Constraint ) import GHC.Tc.Types.Evidence ( EvTerm(EvExpr), Role(Nominal) ) +import GHC.Types.Unique.DSet + ( emptyUniqDSet ) import GHC.Types.Unique.FM ( UniqFM, listToUFM ) @@ -85,5 +87,5 @@ mkTyFamReduction :: TyCon -> [ Type ] -> Type -> Reduction mkTyFamReduction tyCon args res = Reduction co res where co :: Coercion - co = mkUnivCo ( PluginProv "RewritePlugin" ) Nominal + co = mkUnivCo ( PluginProv "RewritePlugin" emptyUniqDSet) Nominal -- Empty is fine. This plugin does not use "givens". ( mkTyConApp tyCon args ) res ===================================== testsuite/tests/tcplugins/TyFamPlugin.hs ===================================== @@ -39,6 +39,8 @@ import GHC.Tc.Types.Constraint ) import GHC.Tc.Types.Evidence ( EvBindsVar, EvTerm(EvExpr), Role(Nominal) ) +import GHC.Types.Unique.DSet + ( emptyUniqDSet ) -- common import Common @@ -78,6 +80,6 @@ solveCt ( PluginDefs {..} ) ct@( classifyPredType . ctPred -> EqPred NomEq lhs r , let evTerm :: EvTerm evTerm = EvExpr . Coercion - $ mkUnivCo ( PluginProv "TyFamPlugin" ) Nominal lhs rhs + $ mkUnivCo ( PluginProv "TyFamPlugin" emptyUniqDSet) Nominal lhs rhs -- Empty is fine. This plugin does not use "givens". = pure $ Just ( evTerm, ct ) solveCt _ ct = pure Nothing View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c4b131133e4cee35d2140eedfcf3b4e573a43a8a...053fdb81f509cc6158c5d645ef2402e24ca3c115 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c4b131133e4cee35d2140eedfcf3b4e573a43a8a...053fdb81f509cc6158c5d645ef2402e24ca3c115 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 22:50:19 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Thu, 07 Mar 2024 17:50:19 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] dummy Message-ID: <65ea44abd59a7_17a6f245a16041227cd@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: d74bc723 by Mikolaj Konarski at 2024-03-07T23:50:08+01:00 dummy - - - - - 1 changed file: - compiler/GHC/Core/TyCo/Rep.hs Changes: ===================================== compiler/GHC/Core/TyCo/Rep.hs ===================================== @@ -1,4 +1,3 @@ - {-# LANGUAGE DeriveDataTypeable #-} {-# OPTIONS_HADDOCK not-home #-} @@ -1817,6 +1816,8 @@ foldTyCo (TyCoFolder { tcf_view = view = let !env' = tycobinder env tv vis -- Avoid building a thunk here in go_ty env (varType tv) `mappend` go_ty env' inner + + -- Explicit recursion because using foldr builds a local -- loop (with env free) and I'm not confident it'll be -- lambda lifted in the end View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d74bc7237300750eec8dc917bd86d1d4e1f2cde9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d74bc7237300750eec8dc917bd86d1d4e1f2cde9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 7 23:36:05 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 18:36:05 -0500 Subject: [Git][ghc/ghc][wip/ipe-sharing] 113 commits: feat: Add sortOn to Data.List.NonEmpty Message-ID: <65ea4f659a592_17a6f259d1f84126539@gitlab.mail> Ben Gamari pushed to branch wip/ipe-sharing at Glasgow Haskell Compiler / GHC Commits: 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 2fe878a9 by Ben Gamari at 2024-03-07T17:44:24-05:00 rts/CloneStack: Bounds check array write - - - - - d432ba8a by Ben Gamari at 2024-03-07T17:44:24-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - c907af77 by Ben Gamari at 2024-03-07T18:33:18-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 44e11eb2 by Ben Gamari at 2024-03-07T18:33:18-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - cb280181 by Ben Gamari at 2024-03-07T18:33:18-05:00 rts/IPE: Don't expose helper in header - - - - - 94a14063 by Ben Gamari at 2024-03-07T18:33:18-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - 64b11438 by Ben Gamari at 2024-03-07T18:33:18-05:00 IPE: Include unit id - - - - - 422a541e by Ben Gamari at 2024-03-07T18:33:18-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - 3c2c7b4e by Ben Gamari at 2024-03-07T18:33:18-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 21 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ab1a832d7632b49b6290f95ae106aa257daacd93...3c2c7b4eff9c53e1fd3581d466efd034632cb176 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ab1a832d7632b49b6290f95ae106aa257daacd93...3c2c7b4eff9c53e1fd3581d466efd034632cb176 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 00:20:33 2024 From: gitlab at gitlab.haskell.org (Mikolaj Konarski (@Mikolaj)) Date: Thu, 07 Mar 2024 19:20:33 -0500 Subject: [Git][ghc/ghc][wip/T23923-mikolaj-take-2] 2 commits: Add DCoVarSet to PluginProv Message-ID: <65ea59d12d68_17a6f26c7c7d81284a0@gitlab.mail> Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC Commits: 70f2d3ee by Mikolaj Konarski at 2024-03-07T00:34:41+01:00 Add DCoVarSet to PluginProv Add the only remaining piece of feedback from git add src/Flavour.hs Help CI check some more of the patch Fix the 3 plugin tests that fail Explain better how shallowCoVarsOfCosDSet is entangled with a hundreds of lines bit-rotten refactoring Fix according to the first round of Simon's instruction Fix according to the second round of Simon's instruction Remove a question-comment that's probably absurd Fix according to the third round of Simon's instruction - - - - - 053fdb81 by Mikolaj Konarski at 2024-03-07T00:34:41+01:00 Make sure the foldl' accumulators are strict - - - - - 23 changed files: - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/Coercion/Opt.hs - compiler/GHC/Core/FVs.hs - compiler/GHC/Core/Lint.hs - compiler/GHC/Core/TyCo/FVs.hs - compiler/GHC/Core/TyCo/Rep.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/Core/TyCo/Tidy.hs - compiler/GHC/Core/Type.hs - compiler/GHC/CoreToIface.hs - compiler/GHC/Iface/Rename.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/IfaceToCore.hs - compiler/GHC/Tc/TyCl/Utils.hs - compiler/GHC/Tc/Utils/TcMType.hs - compiler/GHC/Types/Unique/DSet.hs - compiler/GHC/Types/Var/Set.hs - compiler/GHC/Utils/FV.hs - docs/users_guide/extending_ghc.rst - testsuite/tests/tcplugins/CtIdPlugin.hs - testsuite/tests/tcplugins/RewritePlugin.hs - testsuite/tests/tcplugins/TyFamPlugin.hs Changes: ===================================== compiler/GHC/Core/Coercion.hs ===================================== @@ -97,7 +97,7 @@ module GHC.Core.Coercion ( emptyLiftingContext, extendLiftingContext, extendLiftingContextAndInScope, liftCoSubstVarBndrUsing, isMappedByLC, extendLiftingContextCvSubst, - mkSubstLiftingContext, zapLiftingContext, + mkSubstLiftingContext, liftingContextSubst, zapLiftingContext, substForAllCoBndrUsingLC, lcLookupCoVar, lcInScopeSet, LiftCoEnv, LiftingContext(..), liftEnvSubstLeft, liftEnvSubstRight, @@ -1397,7 +1397,7 @@ setNominalRole_maybe r co setNominalRole_maybe_helper (UnivCo prov _ co1 co2) | case prov of PhantomProv _ -> False -- should always be phantom ProofIrrelProv _ -> True -- it's always safe - PluginProv _ -> False -- who knows? This choice is conservative. + PluginProv _ _ -> False -- who knows? This choice is conservative. = Just $ UnivCo prov Nominal co1 co2 setNominalRole_maybe_helper _ = Nothing @@ -1522,7 +1522,7 @@ promoteCoercion co = case co of UnivCo (PhantomProv kco) _ _ _ -> kco UnivCo (ProofIrrelProv kco) _ _ _ -> kco - UnivCo (PluginProv _) _ _ _ -> mkKindCo co + UnivCo (PluginProv _ _) _ _ _ -> mkKindCo co SymCo g -> mkSymCo (promoteCoercion g) @@ -1979,6 +1979,9 @@ mkLiftingContext pairs mkSubstLiftingContext :: Subst -> LiftingContext mkSubstLiftingContext subst = LC subst emptyVarEnv +liftingContextSubst :: LiftingContext -> Subst +liftingContextSubst (LC subst _) = subst + -- | Extend a lifting context with a new mapping. extendLiftingContext :: LiftingContext -- ^ original LC -> TyCoVar -- ^ new variable to map... @@ -2354,7 +2357,7 @@ seqCo (AxiomRuleCo _ cs) = seqCos cs seqProv :: UnivCoProvenance -> () seqProv (PhantomProv co) = seqCo co seqProv (ProofIrrelProv co) = seqCo co -seqProv (PluginProv _) = () +seqProv (PluginProv _ cvs) = seqDVarSet cvs seqCos :: [Coercion] -> () seqCos [] = () ===================================== compiler/GHC/Core/Coercion/Opt.hs ===================================== @@ -641,7 +641,7 @@ opt_univ env sym prov role oty1 oty2 where prov' = case prov of ProofIrrelProv kco -> ProofIrrelProv $ opt_co4_wrap env sym False Nominal kco - PluginProv _ -> prov + PluginProv s cvs -> PluginProv s $ substDCoVarSet (liftingContextSubst env) cvs ------------- opt_transList :: HasDebugCallStack => InScopeSet -> [NormalCo] -> [NormalCo] -> [NormalCo] @@ -722,7 +722,8 @@ opt_trans_rule is in_co1@(UnivCo p1 r1 tyl1 _tyr1) = Just $ PhantomProv $ opt_trans is kco1 kco2 opt_trans_prov (ProofIrrelProv kco1) (ProofIrrelProv kco2) = Just $ ProofIrrelProv $ opt_trans is kco1 kco2 - opt_trans_prov (PluginProv str1) (PluginProv str2) | str1 == str2 = Just p1 + opt_trans_prov (PluginProv str1 cvs1) (PluginProv str2 cvs2) + | str1 == str2 = Just (PluginProv str1 (cvs1 `unionDVarSet` cvs2)) opt_trans_prov _ _ = Nothing -- Push transitivity down through matching top-level constructors. ===================================== compiler/GHC/Core/FVs.hs ===================================== @@ -410,7 +410,7 @@ orphNamesOfCo (HoleCo _) = emptyNameSet orphNamesOfProv :: UnivCoProvenance -> NameSet orphNamesOfProv (PhantomProv co) = orphNamesOfCo co orphNamesOfProv (ProofIrrelProv co) = orphNamesOfCo co -orphNamesOfProv (PluginProv _) = emptyNameSet +orphNamesOfProv (PluginProv _ _) = emptyNameSet orphNamesOfCos :: [Coercion] -> NameSet orphNamesOfCos = orphNamesOfThings orphNamesOfCo ===================================== compiler/GHC/Core/Lint.hs ===================================== @@ -1931,6 +1931,13 @@ checkTyCon :: TyCon -> LintM () checkTyCon tc = checkL (not (isTcTyCon tc)) (text "Found TcTyCon:" <+> ppr tc) +------------------- +checkTyCoVarInScope :: Subst -> TyCoVar -> LintM () +checkTyCoVarInScope subst tcv + = checkL (tcv `isInScope` subst) $ + hang (text "The type or coercion variable" <+> pprBndr LetBind tcv) + 2 (text "is out of scope") + ------------------- lintType :: Type -> LintM LintedType @@ -1948,12 +1955,8 @@ lintType (TyVarTy tv) -- In GHCi we may lint an expression with a free -- type variable. Then it won't be in the -- substitution, but it should be in scope - Nothing | tv `isInScope` subst - -> return (TyVarTy tv) - | otherwise - -> failWithL $ - hang (text "The type variable" <+> pprBndr LetBind tv) - 2 (text "is out of scope") + Nothing -> do { checkTyCoVarInScope subst tv + ; return (TyVarTy tv) } } lintType ty@(AppTy t1 t2) @@ -2325,15 +2328,8 @@ lintCoercion (CoVarCo cv) = do { subst <- getSubst ; case lookupCoVar subst cv of Just linted_co -> return linted_co ; - Nothing - | cv `isInScope` subst - -> return (CoVarCo cv) - | otherwise - -> - -- lintCoBndr always extends the substitution - failWithL $ - hang (text "The coercion variable" <+> pprBndr LetBind cv) - 2 (text "is out of scope") + Nothing -> do { checkTyCoVarInScope subst cv + ; return (CoVarCo cv) } } @@ -2532,7 +2528,12 @@ lintCoercion co@(UnivCo prov r ty1 ty2) ; check_kinds kco k1 k2 ; return (ProofIrrelProv kco') } - lint_prov _ _ prov@(PluginProv _) = return prov + lint_prov _ _ (PluginProv s cvs) + = do { subst <- getSubst + ; mapM_ (checkTyCoVarInScope subst) (dVarSetElems cvs) + -- Don't bother to return substituted fvs; + -- they don't matter to Lint + ; return (PluginProv s cvs) } check_kinds kco k1 k2 = do { let Pair k1' k2' = coercionKind kco ===================================== compiler/GHC/Core/TyCo/FVs.hs ===================================== @@ -19,6 +19,7 @@ module GHC.Core.TyCo.FVs tyCoVarsOfCoDSet, tyCoFVsOfCo, tyCoFVsOfCos, tyCoVarsOfCoList, + coVarsOfCosDSet, almostDevoidCoVarOfCo, @@ -446,6 +447,13 @@ deepCoVarFolder = TyCoFolder { tcf_view = noView -- See Note [CoercionHoles and coercion free variables] -- in GHC.Core.TyCo.Rep +------- Same again, but for DCoVarSet ---------- +-- But this time the free vars are shallow + +coVarsOfCosDSet :: [Coercion] -> DCoVarSet +coVarsOfCosDSet cos = fvDVarSetSome isCoVar (tyCoFVsOfCos cos) + + {- ********************************************************************* * * Closing over kinds @@ -660,7 +668,7 @@ tyCoFVsOfCoVar v fv_cand in_scope acc tyCoFVsOfProv :: UnivCoProvenance -> FV tyCoFVsOfProv (PhantomProv co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc tyCoFVsOfProv (ProofIrrelProv co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc -tyCoFVsOfProv (PluginProv _) fv_cand in_scope acc = emptyFV fv_cand in_scope acc +tyCoFVsOfProv (PluginProv _ cvs) fv_cand in_scope acc = mkFVs (dVarSetElems cvs) fv_cand in_scope acc tyCoFVsOfCos :: [Coercion] -> FV tyCoFVsOfCos [] fv_cand in_scope acc = emptyFV fv_cand in_scope acc @@ -730,7 +738,7 @@ almost_devoid_co_var_of_prov (PhantomProv co) cv = almost_devoid_co_var_of_co co cv almost_devoid_co_var_of_prov (ProofIrrelProv co) cv = almost_devoid_co_var_of_co co cv -almost_devoid_co_var_of_prov (PluginProv _) _ = True +almost_devoid_co_var_of_prov (PluginProv _ cvs) cv = not (cv `elemDVarSet` cvs) almost_devoid_co_var_of_type :: Type -> CoVar -> Bool almost_devoid_co_var_of_type (TyVarTy _) _ = True @@ -1129,7 +1137,7 @@ tyConsOfType ty go_prov (PhantomProv co) = go_co co go_prov (ProofIrrelProv co) = go_co co - go_prov (PluginProv _) = emptyUniqSet + go_prov (PluginProv _ _) = emptyUniqSet go_cos cos = foldr (unionUniqSets . go_co) emptyUniqSet cos @@ -1340,4 +1348,4 @@ occCheckExpand vs_to_avoid ty ------------------ go_prov cxt (PhantomProv co) = PhantomProv <$> go_co cxt co go_prov cxt (ProofIrrelProv co) = ProofIrrelProv <$> go_co cxt co - go_prov _ p@(PluginProv _) = return p + go_prov _ p@(PluginProv _ _) = return p ===================================== compiler/GHC/Core/TyCo/Rep.hs ===================================== @@ -1,4 +1,3 @@ - {-# LANGUAGE DeriveDataTypeable #-} {-# OPTIONS_HADDOCK not-home #-} @@ -78,7 +77,7 @@ import {-# SOURCE #-} GHC.Core.Type( chooseFunTyFlag, typeKind, typeTypeOrConstr -- friends: import GHC.Types.Var -import GHC.Types.Var.Set( elemVarSet ) +import GHC.Types.Var.Set( DCoVarSet, dVarSetElems, elemVarSet ) import GHC.Core.TyCon import GHC.Core.Coercion.Axiom @@ -886,7 +885,7 @@ data Coercion | FunCo -- FunCo :: "e" -> N/P -> e -> e -> e -- See Note [FunCo] for fco_afl, fco_afr - { fco_role :: Role + { fco_role :: Role , fco_afl :: FunTyFlag -- Arrow for coercionLKind , fco_afr :: FunTyFlag -- Arrow for coercionRKind , fco_mult :: CoercionN @@ -1527,15 +1526,19 @@ data UnivCoProvenance -- considered equivalent. See Note [ProofIrrelProv]. -- Can be used in Nominal or Representational coercions - | PluginProv String -- ^ From a plugin, which asserts that this coercion - -- is sound. The string is for the use of the plugin. + | PluginProv String !DCoVarSet + -- ^ From a plugin, which asserts that this coercion is sound. + -- The string and the variable set are for the use by the plugin. + -- E.g., the set may contain the in-scope coercion variables + -- that the the proof represented by the coercion makes use of. + -- See Note [The importance of tracking free coercion variables]. deriving Data.Data instance Outputable UnivCoProvenance where - ppr (PhantomProv _) = text "(phantom)" - ppr (ProofIrrelProv _) = text "(proof irrel.)" - ppr (PluginProv str) = parens (text "plugin" <+> brackets (text str)) + ppr (PhantomProv _) = text "(phantom)" + ppr (ProofIrrelProv _) = text "(proof irrel.)" + ppr (PluginProv str cvs) = parens (text "plugin" <+> brackets (text str) <+> ppr cvs) -- | A coercion to be filled in by the type-checker. See Note [Coercion holes] data CoercionHole @@ -1690,6 +1693,50 @@ Here, where co5 :: (a1 ~ Bool) ~ (a2 ~ Bool) co5 = TyConAppCo Nominal (~#) [<*>, <*>, co4, ] + + +Note [The importance of tracking free coercion variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +It is vital that `UnivCo` (a coercion that lacks a proper proof) +tracks its free coercion variables. To see why, consider this program: + + type S :: Nat -> Nat + + data T (a::Nat) where + T1 :: T 0 + T2 :: ... + + f :: T a -> S (a+1) -> S 1 + f = /\a (x:T a) (y:a). + case x of + T1 (gco : a ~# 0) -> y |> wco + +For this to typecheck we need `wco :: S (a+1) ~# S 1`, given that `gco : a ~# 0`. +To prove that we need to know that `a+1 = 1` if `a=0`, which a plugin might know. +So it solves `wco` by providing a `UnivCo (PluginProv "my-plugin" gcvs) (a+1) 1`. + + But the `gcvs` in `PluginProv` must mention `gco`. + +Why? Otherwise we might float the entire expression (y |> wco) out of the +the case alternative for `T1` which brings `gco` into scope. If this +happens then we aren't far from a segmentation fault or much worse. +See #23923 for a real-world example of this happening. + +So it is /crucial/ for the `PluginProv` to mention, in `gcvs`, the coercion +variables used by the plugin to justify the `UnivCo` that it builds. + +Note that we don't need to track +* the coercion's free *type* variables +* coercion variables free in kinds (we only need the "shallow" free covars) + +This means that we may float past type variables which the original +proof had as free variables. While surprising, this doesn't jeopardise +the validity of the coercion, which only depends upon the scoping +relative to the free coercion variables. + +(The free coercion variables are kept as a DCoVarSet in UnivCo, +since these sets are included in interface files.) + -} @@ -1856,7 +1903,9 @@ foldTyCo (TyCoFolder { tcf_view = view go_prov env (PhantomProv co) = go_co env co go_prov env (ProofIrrelProv co) = go_co env co - go_prov _ (PluginProv _) = mempty + go_prov _ (PluginProv _ cvs) = go_cvs env cvs + + go_cvs env cvs = foldl' (\ !acc cv -> acc `mappend` covar env cv) mempty (dVarSetElems cvs) -- | A view function that looks through nothing. noView :: Type -> Maybe Type @@ -1922,7 +1971,7 @@ coercionSize (AxiomRuleCo _ cs) = 1 + sum (map coercionSize cs) provSize :: UnivCoProvenance -> Int provSize (PhantomProv co) = 1 + coercionSize co provSize (ProofIrrelProv co) = 1 + coercionSize co -provSize (PluginProv _) = 1 +provSize (PluginProv _ _) = 1 {- ************************************************************************ ===================================== compiler/GHC/Core/TyCo/Subst.hs ===================================== @@ -41,7 +41,7 @@ module GHC.Core.TyCo.Subst cloneTyVarBndr, cloneTyVarBndrs, substVarBndr, substVarBndrs, substTyVarBndr, substTyVarBndrs, - substCoVarBndr, + substCoVarBndr, substDCoVarSet, substTyVar, substTyVars, substTyVarToTyVar, substTyCoVars, substTyCoBndr, substForAllCoBndr, @@ -910,12 +910,18 @@ subst_co subst co go_prov (PhantomProv kco) = PhantomProv (go kco) go_prov (ProofIrrelProv kco) = ProofIrrelProv (go kco) - go_prov p@(PluginProv _) = p + go_prov (PluginProv s cvs) = PluginProv s $ substDCoVarSet subst cvs -- See Note [Substituting in a coercion hole] go_hole h@(CoercionHole { ch_co_var = cv }) = h { ch_co_var = updateVarType go_ty cv } +-- | Perform a substitution within a 'DVarSet' of free variables, +-- returning the shallow free coercion variables. +substDCoVarSet :: Subst -> DCoVarSet -> DCoVarSet +substDCoVarSet subst cvs = coVarsOfCosDSet $ map (substCoVar subst) $ + dVarSetElems cvs + substForAllCoBndr :: Subst -> TyCoVar -> KindCoercion -> (Subst, TyCoVar, Coercion) substForAllCoBndr subst ===================================== compiler/GHC/Core/TyCo/Tidy.hs ===================================== @@ -20,9 +20,11 @@ import GHC.Data.FastString import GHC.Core.TyCo.Rep import GHC.Core.TyCo.FVs (tyCoVarsOfTypesWellScoped, tyCoVarsOfTypeList) +import GHC.Data.Maybe (orElse) import GHC.Types.Name hiding (varName) import GHC.Types.Var import GHC.Types.Var.Env +import GHC.Types.Var.Set import GHC.Utils.Misc (strictMap) import Data.List (mapAccumL) @@ -233,9 +235,7 @@ tidyCo env@(_, subst) co -- the case above duplicates a bit of work in tidying h and the kind -- of tv. But the alternative is to use coercionKind, which seems worse. go (FunCo r afl afr w co1 co2) = ((FunCo r afl afr $! go w) $! go co1) $! go co2 - go (CoVarCo cv) = case lookupVarEnv subst cv of - Nothing -> CoVarCo cv - Just cv' -> CoVarCo cv' + go (CoVarCo cv) = CoVarCo $! go_cv cv go (HoleCo h) = HoleCo h go (AxiomInstCo con ind cos) = AxiomInstCo con ind $! strictMap go cos go (UnivCo p r t1 t2) = (((UnivCo $! (go_prov p)) $! r) $! @@ -249,9 +249,11 @@ tidyCo env@(_, subst) co go (SubCo co) = SubCo $! go co go (AxiomRuleCo ax cos) = AxiomRuleCo ax $ strictMap go cos + go_cv cv = lookupVarEnv subst cv `orElse` cv + go_prov (PhantomProv co) = PhantomProv $! go co go_prov (ProofIrrelProv co) = ProofIrrelProv $! go co - go_prov p@(PluginProv _) = p + go_prov (PluginProv s cvs) = PluginProv s $ mapDVarSet go_cv cvs tidyCos :: TidyEnv -> [Coercion] -> [Coercion] tidyCos env = strictMap (tidyCo env) ===================================== compiler/GHC/Core/Type.hs ===================================== @@ -580,7 +580,7 @@ expandTypeSynonyms ty go_prov subst (PhantomProv co) = PhantomProv (go_co subst co) go_prov subst (ProofIrrelProv co) = ProofIrrelProv (go_co subst co) - go_prov _ p@(PluginProv _) = p + go_prov _ p@(PluginProv _ _) = p -- the "False" and "const" are to accommodate the type of -- substForAllCoBndrUsing, which is general enough to @@ -912,7 +912,8 @@ mapTyCo mapper -> (go_ty (), go_tys (), go_co (), go_cos ()) {-# INLINE mapTyCoX #-} -- See Note [Specialising mappers] -mapTyCoX :: Monad m => TyCoMapper env m +mapTyCoX :: forall m env. Monad m + => TyCoMapper env m -> ( env -> Type -> m Type , env -> [Type] -> m [Type] , env -> Coercion -> m Coercion @@ -960,6 +961,7 @@ mapTyCoX (TyCoMapper { tcm_tyvar = tyvar go_mco !_ MRefl = return MRefl go_mco !env (MCo co) = MCo <$> (go_co env co) + go_co :: env -> Coercion -> m Coercion go_co !env (Refl ty) = Refl <$> go_ty env ty go_co !env (GRefl r ty mco) = mkGReflCo r <$> go_ty env ty <*> go_mco env mco go_co !env (AppCo c1 c2) = mkAppCo <$> go_co env c1 <*> go_co env c2 @@ -999,7 +1001,14 @@ mapTyCoX (TyCoMapper { tcm_tyvar = tyvar go_prov !env (PhantomProv co) = PhantomProv <$> go_co env co go_prov !env (ProofIrrelProv co) = ProofIrrelProv <$> go_co env co - go_prov !_ p@(PluginProv _) = return p + go_prov !env (PluginProv s cvs) = PluginProv s <$> strictFoldDVarSet (do_cv env) + (return emptyDVarSet) cvs + + do_cv :: env -> CoVar -> m DTyCoVarSet -> m DTyCoVarSet + do_cv env v mfvs = do { fvs <- mfvs + ; co <- covar env v + ; return (tyCoVarsOfCoDSet co `unionDVarSet` fvs) } + {- ********************************************************************* ===================================== compiler/GHC/CoreToIface.hs ===================================== @@ -88,6 +88,7 @@ import GHC.Utils.Panic import GHC.Utils.Misc import Data.Maybe ( isNothing, catMaybes ) +import Data.List ( partition ) {- Note [Avoiding space leaks in toIface*] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -318,9 +319,11 @@ toIfaceCoercionX fr co fr' = fr `delVarSet` tv go_prov :: UnivCoProvenance -> IfaceUnivCoProv - go_prov (PhantomProv co) = IfacePhantomProv (go co) - go_prov (ProofIrrelProv co) = IfaceProofIrrelProv (go co) - go_prov (PluginProv str) = IfacePluginProv str + go_prov (PhantomProv co) = IfacePhantomProv (go co) + go_prov (ProofIrrelProv co) = IfaceProofIrrelProv (go co) + go_prov (PluginProv str cvs) = IfacePluginProv str (map toIfaceCoVar bound_cvs) free_cvs + where + (free_cvs, bound_cvs) = partition (`elemVarSet` fr) (dVarSetElems cvs) toIfaceTcArgs :: TyCon -> [Type] -> IfaceAppArgs toIfaceTcArgs = toIfaceTcArgsX emptyVarSet ===================================== compiler/GHC/Iface/Rename.hs ===================================== @@ -678,6 +678,8 @@ rnIfaceCo (IfaceAxiomInstCo n i cs) = IfaceAxiomInstCo <$> rnIfaceGlobal n <*> pure i <*> mapM rnIfaceCo cs rnIfaceCo (IfaceUnivCo s r t1 t2) = IfaceUnivCo s r <$> rnIfaceType t1 <*> rnIfaceType t2 + -- Renaming affects only type constructors, not coercion variables, + -- so no need to recurs into the provenance. rnIfaceCo (IfaceSymCo c) = IfaceSymCo <$> rnIfaceCo c rnIfaceCo (IfaceTransCo c1 c2) ===================================== compiler/GHC/Iface/Syntax.hs ===================================== @@ -1795,7 +1795,7 @@ freeNamesIfCoercion (IfaceAxiomRuleCo _ax cos) freeNamesIfProv :: IfaceUnivCoProv -> NameSet freeNamesIfProv (IfacePhantomProv co) = freeNamesIfCoercion co freeNamesIfProv (IfaceProofIrrelProv co) = freeNamesIfCoercion co -freeNamesIfProv (IfacePluginProv _) = emptyNameSet +freeNamesIfProv (IfacePluginProv _ _ _) = emptyNameSet freeNamesIfVarBndr :: VarBndr IfaceBndr vis -> NameSet freeNamesIfVarBndr (Bndr bndr _) = freeNamesIfBndr bndr ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -399,7 +399,10 @@ data IfaceCoercion data IfaceUnivCoProv = IfacePhantomProv IfaceCoercion | IfaceProofIrrelProv IfaceCoercion - | IfacePluginProv String + | IfacePluginProv String [IfLclName] [Var] + -- Local covars and open (free) covars resp + -- See Note [Free tyvars in IfaceType] + {- Note [Holes in IfaceCoercion] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -620,7 +623,7 @@ substIfaceType env ty go_prov (IfacePhantomProv co) = IfacePhantomProv (go_co co) go_prov (IfaceProofIrrelProv co) = IfaceProofIrrelProv (go_co co) - go_prov co@(IfacePluginProv _) = co + go_prov co@(IfacePluginProv _ _ _) = co substIfaceAppArgs :: IfaceTySubst -> IfaceAppArgs -> IfaceAppArgs substIfaceAppArgs env args @@ -1954,8 +1957,8 @@ pprIfaceUnivCoProv (IfacePhantomProv co) = text "phantom" <+> pprParendIfaceCoercion co pprIfaceUnivCoProv (IfaceProofIrrelProv co) = text "irrel" <+> pprParendIfaceCoercion co -pprIfaceUnivCoProv (IfacePluginProv s) - = text "plugin" <+> doubleQuotes (text s) +pprIfaceUnivCoProv (IfacePluginProv s cvs fcvs) + = hang (text "plugin") 2 (sep [doubleQuotes (text s), ppr cvs, ppr fcvs]) ------------------- instance Outputable IfaceTyCon where @@ -2324,9 +2327,11 @@ instance Binary IfaceUnivCoProv where put_ bh (IfaceProofIrrelProv a) = do putByte bh 2 put_ bh a - put_ bh (IfacePluginProv a) = do + put_ bh (IfacePluginProv a cvs fcvs) = do putByte bh 3 put_ bh a + assertPpr (null fcvs) (ppr cvs $$ ppr fcvs) $ + put_ bh cvs get bh = do tag <- getByte bh @@ -2336,7 +2341,8 @@ instance Binary IfaceUnivCoProv where 2 -> do a <- get bh return $ IfaceProofIrrelProv a 3 -> do a <- get bh - return $ IfacePluginProv a + cvs <- get bh + return $ IfacePluginProv a cvs [] _ -> panic ("get IfaceUnivCoProv " ++ show tag) ===================================== compiler/GHC/IfaceToCore.hs ===================================== @@ -1491,7 +1491,10 @@ tcIfaceCo = go tcIfaceUnivCoProv :: IfaceUnivCoProv -> IfL UnivCoProvenance tcIfaceUnivCoProv (IfacePhantomProv kco) = PhantomProv <$> tcIfaceCo kco tcIfaceUnivCoProv (IfaceProofIrrelProv kco) = ProofIrrelProv <$> tcIfaceCo kco -tcIfaceUnivCoProv (IfacePluginProv str) = return $ PluginProv str +tcIfaceUnivCoProv (IfacePluginProv str cvs fcvs) = + assertPpr (null fcvs) (ppr fcvs) $ do + cvs' <- mapM tcIfaceLclId cvs + return $ PluginProv str $ mkDVarSet cvs' {- ************************************************************************ ===================================== compiler/GHC/Tc/TyCl/Utils.hs ===================================== @@ -156,7 +156,7 @@ synonymTyConsOfType ty go_prov (PhantomProv co) = go_co co go_prov (ProofIrrelProv co) = go_co co - go_prov (PluginProv _) = emptyNameEnv + go_prov (PluginProv _ _) = emptyNameEnv go_tc tc | isTypeSynonymTyCon tc = unitNameEnv (tyConName tc) tc | otherwise = emptyNameEnv ===================================== compiler/GHC/Tc/Utils/TcMType.hs ===================================== @@ -1592,7 +1592,10 @@ collect_cand_qtvs_co orig_ty cur_lvl bound = go_co go_prov dv (PhantomProv co) = go_co dv co go_prov dv (ProofIrrelProv co) = go_co dv co - go_prov dv (PluginProv _) = return dv + go_prov dv (PluginProv _ cvs) = strictFoldDVarSet zt_cv (return dv) cvs + + zt_cv :: CoVar -> TcM CandidatesQTvs -> TcM CandidatesQTvs + zt_cv cv mdvs = do { dvs <- mdvs; go_cv dvs cv } go_cv :: CandidatesQTvs -> CoVar -> TcM CandidatesQTvs go_cv dv@(DV { dv_cvs = cvs }) cv ===================================== compiler/GHC/Types/Unique/DSet.hs ===================================== @@ -33,7 +33,7 @@ module GHC.Types.Unique.DSet ( lookupUniqDSet, uniqDSetToList, partitionUniqDSet, - mapUniqDSet + mapUniqDSet, strictFoldUniqDSet ) where import GHC.Prelude @@ -125,7 +125,15 @@ partitionUniqDSet p = coerce . partitionUDFM p . getUniqDSet -- See Note [UniqSet invariant] in GHC.Types.Unique.Set mapUniqDSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b -mapUniqDSet f = mkUniqDSet . map f . uniqDSetToList +mapUniqDSet f (UniqDSet m) = UniqDSet $ unsafeCastUDFMKey $ mapUDFM f m +-- Simply apply `f` to each element, retaining all the structure unchanged. +-- The identification of keys and elements prevents a derived Functor +-- instance, but `unsafeCastUDFMKey` makes it possible to apply the strict +-- mapping from DFM. + +strictFoldUniqDSet :: (a -> r -> r) -> r -> UniqDSet a -> r +strictFoldUniqDSet k r s = foldl' (\ !r e -> k e r) r $ + uniqDSetToList s -- Two 'UniqDSet's are considered equal if they contain the same -- uniques. ===================================== compiler/GHC/Types/Var/Set.hs ===================================== @@ -26,7 +26,7 @@ module GHC.Types.Var.Set ( nonDetStrictFoldVarSet, -- * Deterministic Var set types - DVarSet, DIdSet, DTyVarSet, DTyCoVarSet, + DVarSet, DIdSet, DTyVarSet, DCoVarSet, DTyCoVarSet, -- ** Manipulating these sets emptyDVarSet, unitDVarSet, mkDVarSet, @@ -38,7 +38,7 @@ module GHC.Types.Var.Set ( isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, nonDetStrictFoldDVarSet, - filterDVarSet, mapDVarSet, + filterDVarSet, mapDVarSet, strictFoldDVarSet, dVarSetMinusVarSet, anyDVarSet, allDVarSet, transCloDVarSet, sizeDVarSet, seqDVarSet, @@ -232,6 +232,9 @@ type DIdSet = UniqDSet Id -- | Deterministic Type Variable Set type DTyVarSet = UniqDSet TyVar +-- | Deterministic Coercion Variable Set +type DCoVarSet = UniqDSet CoVar + -- | Deterministic Type or Coercion Variable Set type DTyCoVarSet = UniqDSet TyCoVar @@ -308,6 +311,9 @@ allDVarSet p = allUDFM p . getUniqDSet mapDVarSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b mapDVarSet = mapUniqDSet +strictFoldDVarSet :: (a -> r -> r) -> r -> UniqDSet a -> r +strictFoldDVarSet = strictFoldUniqDSet + filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet filterDVarSet = filterUniqDSet ===================================== compiler/GHC/Utils/FV.hs ===================================== @@ -21,6 +21,7 @@ module GHC.Utils.FV ( delFVs, filterFV, mapUnionFV, + fvDVarSetSome, ) where import GHC.Prelude @@ -195,3 +196,7 @@ mkFVs :: [Var] -> FV mkFVs vars fv_cand in_scope acc = mapUnionFV unitFV vars fv_cand in_scope acc {-# INLINE mkFVs #-} + +fvDVarSetSome :: InterestingVarFun -> FV -> DVarSet +fvDVarSetSome interesting_var fv = + mkDVarSet $ fst $ fv interesting_var emptyVarSet ([], emptyVarSet) ===================================== docs/users_guide/extending_ghc.rst ===================================== @@ -760,10 +760,33 @@ This evidence is ignored for Given constraints, which GHC "solves" simply by discarding them; typically this is used when they are uninformative (e.g. reflexive equations). For Wanted constraints, the evidence will form part of the Core term that is generated after -typechecking, and can be checked by ``-dcore-lint``. It is possible for -the plugin to create equality axioms for use in evidence terms, but GHC -does not check their consistency, and inconsistent axiom sets may lead -to segfaults or other runtime misbehaviour. +typechecking, and can be checked by ``-dcore-lint``. + +When solving a Wanted equality constraint (of type ``t1 ~N# t2`` +or ``t1 ~R# t2`` for nominal and representation equalities respectively), +the evidence (of type ``EvTerm``) will take the form ``EvExpr (Coercion co)``, +where the coercion ``co`` has type ``co :: t1 ~N# t2`` or ``co :: t1 ~R# t2`` +respectively. + +It is up to the plugin to construct a suitable coercion ``co``. +However, one possibility is to construct one of form :: + + UnivCo (PluginProv "my-plugin" gcvs) role t1 t2 + +A ``UnivCo`` of this form says "trust me: my-plugin has solved this Wanted +using (only) ``gcvs``". + +Here + +* The ``role`` should be the role of the original equality constraint + (nominal or representational). +* The ``gcvs`` is a set of "given coercion variables"; these are the coercion + variable bound by enclosing Given constraints, which the plugin has used + to justify solving the Wanted. + +For soundness, it is very important to include the ``gcvs``; otherwise +GHC may transform the program into a form that seg-faults. +See #23923 for a long dicussion. Evidence is required also when creating new Given constraints, which are usually implied by old ones. It is not uncommon that the evidence of a new ===================================== testsuite/tests/tcplugins/CtIdPlugin.hs ===================================== @@ -21,6 +21,7 @@ import GHC.Tc.Plugin import GHC.Tc.Types import GHC.Tc.Types.Constraint import GHC.Tc.Types.Evidence +import GHC.Types.Unique.DSet -- common import Common @@ -41,7 +42,7 @@ solver :: [String] -> PluginDefs -> EvBindsVar -> [Ct] -> [Ct] -> TcPluginM TcPluginSolveResult solver _args defs ev givens wanteds = do - let pluginCo = mkUnivCo (PluginProv "CtIdPlugin") Representational + let pluginCo = mkUnivCo (PluginProv "CtIdPlugin" emptyUniqDSet) Representational -- Empty is fine. This plugin does not use "givens". let substEvidence ct ct' = evCast (ctEvExpr $ ctEvidence ct') $ pluginCo (ctPred ct') (ctPred ct) ===================================== testsuite/tests/tcplugins/RewritePlugin.hs ===================================== @@ -45,6 +45,8 @@ import GHC.Tc.Types.Constraint ) import GHC.Tc.Types.Evidence ( EvTerm(EvExpr), Role(Nominal) ) +import GHC.Types.Unique.DSet + ( emptyUniqDSet ) import GHC.Types.Unique.FM ( UniqFM, listToUFM ) @@ -85,5 +87,5 @@ mkTyFamReduction :: TyCon -> [ Type ] -> Type -> Reduction mkTyFamReduction tyCon args res = Reduction co res where co :: Coercion - co = mkUnivCo ( PluginProv "RewritePlugin" ) Nominal + co = mkUnivCo ( PluginProv "RewritePlugin" emptyUniqDSet) Nominal -- Empty is fine. This plugin does not use "givens". ( mkTyConApp tyCon args ) res ===================================== testsuite/tests/tcplugins/TyFamPlugin.hs ===================================== @@ -39,6 +39,8 @@ import GHC.Tc.Types.Constraint ) import GHC.Tc.Types.Evidence ( EvBindsVar, EvTerm(EvExpr), Role(Nominal) ) +import GHC.Types.Unique.DSet + ( emptyUniqDSet ) -- common import Common @@ -78,6 +80,6 @@ solveCt ( PluginDefs {..} ) ct@( classifyPredType . ctPred -> EqPred NomEq lhs r , let evTerm :: EvTerm evTerm = EvExpr . Coercion - $ mkUnivCo ( PluginProv "TyFamPlugin" ) Nominal lhs rhs + $ mkUnivCo ( PluginProv "TyFamPlugin" emptyUniqDSet) Nominal lhs rhs -- Empty is fine. This plugin does not use "givens". = pure $ Just ( evTerm, ct ) solveCt _ ct = pure Nothing View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d74bc7237300750eec8dc917bd86d1d4e1f2cde9...053fdb81f509cc6158c5d645ef2402e24ca3c115 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d74bc7237300750eec8dc917bd86d1d4e1f2cde9...053fdb81f509cc6158c5d645ef2402e24ca3c115 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 00:29:57 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 19:29:57 -0500 Subject: [Git][ghc/ghc][wip/T24515] 3 commits: Rephrase error message to say "visible arguments" (#24318) Message-ID: <65ea5c05787e_17a6f27314168129094@gitlab.mail> Ben Gamari pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - 164ffe9b by Ben Gamari at 2024-03-07T19:29:45-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 3731e3a5 by Cheng Shao at 2024-03-07T19:29:45-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 29 changed files: - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - testsuite/driver/testlib.py - testsuite/tests/ado/ado002.stderr - testsuite/tests/ghci/scripts/Defer02.stderr - testsuite/tests/indexed-types/should_compile/T10806.stderr - testsuite/tests/indexed-types/should_fail/T8518.stderr - testsuite/tests/rep-poly/T23903.stderr - testsuite/tests/th/T5358.stderr - testsuite/tests/typecheck/should_fail/DoExpansion2.stderr - testsuite/tests/typecheck/should_fail/DoExpansion3.stderr - testsuite/tests/typecheck/should_fail/FD1.stderr - testsuite/tests/typecheck/should_fail/T13902.stderr - testsuite/tests/typecheck/should_fail/T17139.stderr - + testsuite/tests/typecheck/should_fail/T24318.hs - + testsuite/tests/typecheck/should_fail/T24318.stderr - testsuite/tests/typecheck/should_fail/T8603.stderr - testsuite/tests/typecheck/should_fail/T9605.stderr - testsuite/tests/typecheck/should_fail/all.T - testsuite/tests/typecheck/should_fail/tcfail001.stderr - testsuite/tests/typecheck/should_fail/tcfail140.stderr - testsuite/tests/typecheck/should_fail/tcfail175.stderr - testsuite/tests/vdq-rta/should_fail/T22326_fail_n_args.stderr - testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr Changes: ===================================== compiler/GHC/Tc/Gen/Match.hs ===================================== @@ -75,7 +75,7 @@ import GHC.Driver.DynFlags ( getDynFlags ) import GHC.Types.Name import GHC.Types.Id import GHC.Types.SrcLoc -import GHC.Types.Basic( Arity, isDoExpansionGenerated ) +import GHC.Types.Basic( VisArity, isDoExpansionGenerated ) import Control.Monad import Control.Arrow ( second ) @@ -1207,7 +1207,7 @@ the variables they bind into scope, and typecheck the thing_inside. -- The MatchGroup for `f` has arity 2, not 3 checkArgCounts :: AnnoBody body => MatchGroup GhcRn (LocatedA (body GhcRn)) - -> TcM Arity + -> TcM VisArity checkArgCounts (MG { mg_alts = L _ [] }) = return 1 -- See Note [Empty MatchGroups] in GHC.Rename.Bind -- case e of {} or \case {} @@ -1227,6 +1227,6 @@ checkArgCounts (MG { mg_alts = L _ (match1:matches) }) n_args1 = reqd_args_in_match match1 mb_bad_matches = NE.nonEmpty [m | m <- matches, reqd_args_in_match m /= n_args1] - reqd_args_in_match :: LocatedA (Match GhcRn body1) -> Arity + reqd_args_in_match :: LocatedA (Match GhcRn body1) -> VisArity -- Counts the number of /required/ args in the match reqd_args_in_match (L _ (Match { m_pats = pats })) = count (isVisArgPat . unLoc) pats ===================================== compiler/GHC/Tc/Utils/Unify.hs ===================================== @@ -751,7 +751,7 @@ Example: matchExpectedFunTys :: forall a. ExpectedFunTyOrigin -- See Note [Herald for matchExpectedFunTys] -> UserTypeCtxt - -> Arity + -> VisArity -> ExpSigmaType -> ([ExpPatType] -> ExpRhoType -> TcM a) -> TcM (HsWrapper, a) @@ -777,7 +777,7 @@ matchExpectedFunTys herald _ arity (Infer inf_res) thing_inside matchExpectedFunTys herald ctx arity (Check top_ty) thing_inside = check 0 [] top_ty where - check :: Arity -> [ExpPatType] -> TcSigmaType -> TcM (HsWrapper, a) + check :: VisArity -> [ExpPatType] -> TcSigmaType -> TcM (HsWrapper, a) -- `check` is called only in the Check{} case -- It collects rev_pat_tys in reversed order -- n_so_far is the number of /visible/ arguments seen so far: @@ -875,7 +875,7 @@ matchExpectedFunTys herald ctx arity (Check top_ty) thing_inside defer n_so_far rev_pat_tys res_ty ------------ - defer :: Arity -> [ExpPatType] -> TcRhoType -> TcM (HsWrapper, a) + defer :: VisArity -> [ExpPatType] -> TcRhoType -> TcM (HsWrapper, a) defer n_so_far rev_pat_tys fun_ty = do { more_arg_tys <- mapM (new_check_arg_ty herald) [n_so_far + 1 .. arity] ; let all_pats = reverse rev_pat_tys ++ map mkCheckExpFunPatTy more_arg_tys @@ -898,19 +898,15 @@ new_check_arg_ty herald arg_pos -- Position for error messages only ; return (mkScaled mult arg_ty) } mkFunTysMsg :: ExpectedFunTyOrigin - -> (Arity, TcType) + -> (VisArity, TcType) -> TidyEnv -> ZonkM (TidyEnv, SDoc) -- See Note [Reporting application arity errors] -mkFunTysMsg herald (n_val_args_in_call, fun_ty) env +mkFunTysMsg herald (n_vis_args_in_call, fun_ty) env = do { (env', fun_ty) <- zonkTidyTcType env fun_ty ; let (pi_ty_bndrs, _) = splitPiTys fun_ty - - -- `all_arg_tys` contains visible quantifiers only, so their number matches - -- the number of arguments that the user needs to pass to the function. n_fun_args = count isVisiblePiTyBinder pi_ty_bndrs - - msg | n_val_args_in_call <= n_fun_args -- Enough args, in the end + msg | n_vis_args_in_call <= n_fun_args -- Enough args, in the end = text "In the result of a function call" | otherwise = hang (full_herald <> comma) @@ -921,7 +917,8 @@ mkFunTysMsg herald (n_val_args_in_call, fun_ty) env ; return (env', msg) } where full_herald = pprExpectedFunTyHerald herald - <+> speakNOf n_val_args_in_call (text "value argument") + <+> speakNOf n_vis_args_in_call (text "visible argument") + -- What are "visible" arguments? See Note [Visibility and arity] in GHC.Types.Basic {- Note [Reporting application arity errors] @@ -931,8 +928,8 @@ and the call foo = f 3 4 5 We'd like to get an error like: • Couldn't match expected type ‘t0 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to three value arguments, - but its type ‘Int -> Int -> Int’ has only two + • The function ‘f’ is applied to three visible arguments, -- What are "visible" arguments? + but its type ‘Int -> Int -> Int’ has only two -- See Note [Visibility and arity] in GHC.Types.Basic That is what `mkFunTysMsg` tries to do. But what is the "type of the function". Most obviously, we can report its full, polymorphic type; that is simple and @@ -943,7 +940,7 @@ We get this error: • Couldn't match type ‘Int’ with ‘t0 -> t’ Expected: Int -> t0 -> t Actual: Int -> Int - • The function ‘f’ is applied to three value arguments, + • The function ‘f’ is applied to three visible arguments, but its type ‘Bool -> t Int Int’ has only one That's not /quite/ right beause we can instantiate `t` to an arrow and get ===================================== compiler/GHC/Types/Basic.hs ===================================== @@ -28,7 +28,7 @@ module GHC.Types.Basic ( ConTag, ConTagZ, fIRST_TAG, - Arity, RepArity, JoinArity, FullArgCount, + Arity, VisArity, RepArity, JoinArity, FullArgCount, JoinPointHood(..), isJoinPoint, Alignment, mkAlignment, alignmentOf, alignmentBytes, @@ -183,6 +183,10 @@ instance Binary LeftOrRight where -- See also Note [Definition of arity] in "GHC.Core.Opt.Arity" type Arity = Int +-- | Syntactic (visibility) arity, i.e. the number of visible arguments. +-- See Note [Visibility and arity] +type VisArity = Int + -- | Representation Arity -- -- The number of represented arguments that can be applied to a value before it does @@ -203,6 +207,71 @@ type JoinArity = Int -- both type and value arguments! type FullArgCount = Int +{- Note [Visibility and arity] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Arity is the number of arguments that a function expects. In a curried language +like Haskell, there is more than one way to count those arguments. + +* `Arity` is the classic notion of arity, concerned with evalution, so it counts + the number of /value/ arguments that need to be supplied before evaluation can + take place, as described in notes + Note [Definition of arity] in GHC.Core.Opt.Arity + Note [Arity and function types] in GHC.Types.Id.Info + + Examples: + Int has arity == 0 + Int -> Int has arity <= 1 + Int -> Bool -> Int has arity <= 2 + We write (<=) rather than (==) as sometimes evaluation can occur before all + value arguments are supplied, depending on the actual function definition. + + This evaluation-focused notion of arity ignores type arguments, so: + forall a. a has arity == 0 + forall a. a -> a has arity <= 1 + forall a b. a -> b -> a has arity <= 2 + This is true regardless of ForAllTyFlag, so the arity is also unaffected by + (forall {a}. ty) or (forall a -> ty). + + Class dictionaries count towards the arity, as they are passed at runtime + forall a. (Num a) => a has arity <= 1 + forall a. (Num a) => a -> a has arity <= 2 + forall a b. (Num a, Ord b) => a -> b -> a has arity <= 4 + +* `VisArity` is the syntactic notion of arity. It is the number of /visible/ + arguments, i.e. arguments that occur visibly in the source code. + + In a function call `f x y z`, we can confidently say that f's vis-arity >= 3, + simply because we see three arguments [x,y,z]. We write (>=) rather than (==) + as this could be a partial application. + + At definition sites, we can acquire an underapproximation of vis-arity by + counting the patterns on the LHS, e.g. `f a b = rhs` has vis-arity >= 2. + The actual vis-arity can be higher if there is a lambda on the RHS, + e.g. `f a b = \c -> rhs`. + + If we look at the types, we can observe the following + * function arrows (a -> b) add to the vis-arity + * visible foralls (forall a -> b) add to the vis-arity + * constraint arrows (a => b) do not affect the vis-arity + * invisible foralls (forall a. b) do not affect the vis-arity + + This means that ForAllTyFlag matters for VisArity (in contrast to Arity), + while the type/value distinction is unimportant (again in contrast to Arity). + + Examples: + Int -- vis-arity == 0 (no args) + Int -> Int -- vis-arity == 1 (1 funarg) + forall a. a -> a -- vis-arity == 1 (1 funarg) + forall a. Num a => a -> a -- vis-arity == 1 (1 funarg) + forall a -> Num a => a -- vis-arity == 1 (1 req tyarg, 0 funargs) + forall a -> a -> a -- vis-arity == 2 (1 req tyarg, 1 funarg) + Int -> forall a -> Int -- vis-arity == 2 (1 funarg, 1 req tyarg) + + Wrinkle: with TypeApplications and TypeAbstractions, it is possible to visibly + bind and pass invisible arguments, e.g. `f @a x = ...` or `f @Int 42`. Those + @-prefixed arguments are ignored for the purposes of vis-arity. +-} + {- ************************************************************************ * * ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(stem, ".exe"); +#elif defined(wasm32_HOST_OS) + dropExtension(stem, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasm32_HOST_OS) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" ===================================== testsuite/driver/testlib.py ===================================== @@ -2329,14 +2329,13 @@ def write_file(f: Path, s: str) -> None: async def check_hp_ok(name: TestName) -> bool: opts = getTestOpts() - actual_name = name + exe_extension() if not opts.ignore_extension else name # do not qualify for hp2ps because we should be in the right directory - hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {actual_name}'.format(**locals()) + hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {name}'.format(**locals()) hp2psResult = await runCmd(hp2psCmd, print_output=True) - actual_ps_path = in_testdir(actual_name, 'ps') + actual_ps_path = in_testdir(name, 'ps') if hp2psResult == 0: if actual_ps_path.exists(): @@ -2345,15 +2344,15 @@ async def check_hp_ok(name: TestName) -> bool: if (gsResult == 0): return True else: - print("hp2ps output for " + actual_name + " is not valid PostScript") + print("hp2ps output for " + name + " is not valid PostScript") return False else: return True # assume postscript is valid without ghostscript else: - print("hp2ps did not generate PostScript for " + actual_name) + print("hp2ps did not generate PostScript for " + name) return False else: - print("hp2ps error when processing heap profile for " + actual_name) + print("hp2ps error when processing heap profile for " + name) return False async def check_prof_ok(name: TestName, way: WayName) -> bool: @@ -2365,7 +2364,7 @@ async def check_prof_ok(name: TestName, way: WayName) -> bool: if not expected_prof_path.exists(): return True - actual_prof_file = add_suffix(name + exe_extension(), 'prof') + actual_prof_file = add_suffix(name, 'prof') actual_prof_path = in_testdir(actual_prof_file) if not actual_prof_path.exists(): ===================================== testsuite/tests/ado/ado002.stderr ===================================== @@ -2,7 +2,7 @@ ado002.hs:8:8: error: [GHC-83865] • Couldn't match expected type: Char -> IO b0 with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In a stmt of a 'do' block: y <- getChar 'a' In the expression: @@ -45,7 +45,7 @@ ado002.hs:15:13: error: [GHC-83865] ado002.hs:23:9: error: [GHC-83865] • Couldn't match expected type: Char -> IO a0 with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In a stmt of a 'do' block: x5 <- getChar x4 In the expression: ===================================== testsuite/tests/ghci/scripts/Defer02.stderr ===================================== @@ -26,7 +26,7 @@ Defer01.hs:24:4: warning: [GHC-40564] [-Winaccessible-code (in -Wdefault)] Defer01.hs:30:5: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one value argument, + • The function ‘e’ is applied to one visible argument, but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' @@ -95,7 +95,7 @@ Defer01.hs:49:5: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] (deferred type error) *** Exception: Defer01.hs:30:5: error: [GHC-83865] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one value argument, + • The function ‘e’ is applied to one visible argument, but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' ===================================== testsuite/tests/indexed-types/should_compile/T10806.stderr ===================================== @@ -2,7 +2,7 @@ T10806.hs:11:32: error: [GHC-83865] • Couldn't match expected type: Char -> Bool with actual type: IO () - • The function ‘print’ is applied to two value arguments, + • The function ‘print’ is applied to two visible arguments, but its type ‘Show a => a -> IO ()’ has only one In the expression: print 'x' 'y' In an equation for ‘triggersLoop’: ===================================== testsuite/tests/indexed-types/should_fail/T8518.stderr ===================================== @@ -2,7 +2,7 @@ T8518.hs:14:18: error: [GHC-83865] • Couldn't match expected type: Z c -> B c -> t0 with actual type: F c - • The function ‘rpt’ is applied to four value arguments, + • The function ‘rpt’ is applied to four visible arguments, but its type ‘t1 -> t2 -> F t2’ has only two In the expression: rpt (4 :: Int) c z b In an equation for ‘callCont’: ===================================== testsuite/tests/rep-poly/T23903.stderr ===================================== @@ -6,5 +6,5 @@ T23903.hs:21:1: error: [GHC-55287] t0 :: TYPE cx0 Cannot unify ‘Rep a’ with the type variable ‘cx0’ because the former is not a concrete ‘RuntimeRep’. - • The equation for ‘f’ has one value argument, + • The equation for ‘f’ has one visible argument, but its type ‘a #-> ()’ has none ===================================== testsuite/tests/th/T5358.stderr ===================================== @@ -1,17 +1,17 @@ T5358.hs:7:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t1 -> t1’ - • The equation for ‘t1’ has one value argument, + • The equation for ‘t1’ has one visible argument, but its type ‘Int’ has none T5358.hs:8:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t0 -> t0’ - • The equation for ‘t2’ has one value argument, + • The equation for ‘t2’ has one visible argument, but its type ‘Int’ has none T5358.hs:10:13: error: [GHC-83865] • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t1’ is applied to one value argument, + • The function ‘t1’ is applied to one visible argument, but its type ‘Int’ has none In the first argument of ‘(==)’, namely ‘t1 x’ In the expression: t1 x == t2 x @@ -21,7 +21,7 @@ T5358.hs:10:13: error: [GHC-83865] T5358.hs:10:21: error: [GHC-83865] • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t2’ is applied to one value argument, + • The function ‘t2’ is applied to one visible argument, but its type ‘Int’ has none In the second argument of ‘(==)’, namely ‘t2 x’ In the expression: t1 x == t2 x ===================================== testsuite/tests/typecheck/should_fail/DoExpansion2.stderr ===================================== @@ -55,7 +55,7 @@ DoExpansion2.hs:31:19: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefaul DoExpansion2.hs:34:22: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type: t0 -> IO (Maybe Int) with actual type: IO String - • The function ‘getVal’ is applied to two value arguments, + • The function ‘getVal’ is applied to two visible arguments, but its type ‘Int -> IO String’ has only one In a stmt of a 'do' block: Just x <- getVal 3 4 In the expression: ===================================== testsuite/tests/typecheck/should_fail/DoExpansion3.stderr ===================================== @@ -10,7 +10,7 @@ DoExpansion3.hs:15:20: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefaul DoExpansion3.hs:18:20: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type: t0 -> t with actual type: IO Char - • The function ‘getChar’ is applied to one value argument, + • The function ‘getChar’ is applied to one visible argument, but its type ‘IO Char’ has none In the expression: getChar 2 In an equation for ‘y’: y = getChar 2 ===================================== testsuite/tests/typecheck/should_fail/FD1.stderr ===================================== @@ -5,6 +5,6 @@ FD1.hs:16:1: error: [GHC-25897] the type signature for: plus :: forall a. E a (Int -> Int) => Int -> a at FD1.hs:15:1-38 - • The equation for ‘plus’ has two value arguments, + • The equation for ‘plus’ has two visible arguments, but its type ‘Int -> a’ has only one • Relevant bindings include plus :: Int -> a (bound at FD1.hs:16:1) ===================================== testsuite/tests/typecheck/should_fail/T13902.stderr ===================================== @@ -1,7 +1,7 @@ T13902.hs:8:5: error: [GHC-83865] • Couldn't match expected type ‘t0 -> Int’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘a -> a’ has only one In the expression: f @Int 42 5 In an equation for ‘g’: g = f @Int 42 5 ===================================== testsuite/tests/typecheck/should_fail/T17139.stderr ===================================== @@ -7,7 +7,7 @@ T17139.hs:15:16: error: [GHC-88464] lift :: forall a b (f :: * -> *). (a -> b) -> TypeFam f (a -> b) at T17139.hs:14:1-38 • In the expression: _ (f <*> x) - The lambda expression ‘\ x -> ...’ has one value argument, + The lambda expression ‘\ x -> ...’ has one visible argument, but its type ‘TypeFam f (a -> b)’ has none In the expression: \ x -> _ (f <*> x) • Relevant bindings include ===================================== testsuite/tests/typecheck/should_fail/T24318.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE ExplicitNamespaces, RequiredTypeArguments #-} + +module T24318 where + +import Data.Kind + +f :: forall (a :: Type) -> Bool +f (type t) x = True ===================================== testsuite/tests/typecheck/should_fail/T24318.stderr ===================================== @@ -0,0 +1,5 @@ + +T24318.hs:8:1: error: [GHC-83865] + • Couldn't match expected type ‘Bool’ with actual type ‘t0 -> Bool’ + • The equation for ‘f’ has two visible arguments, + but its type ‘forall a -> Bool’ has only one ===================================== testsuite/tests/typecheck/should_fail/T8603.stderr ===================================== @@ -6,7 +6,7 @@ T8603.hs:33:17: error: [GHC-18872] [a2] :: * Expected: [a2] -> StateT s RV a0 Actual: t0 ((->) [a1]) (StateT s RV a0) - • The function ‘lift’ is applied to two value arguments, + • The function ‘lift’ is applied to two visible arguments, but its type ‘(Control.Monad.Trans.Class.MonadTrans t, Monad m) => m a -> t m a’ has only one ===================================== testsuite/tests/typecheck/should_fail/T9605.stderr ===================================== @@ -3,7 +3,7 @@ T9605.hs:7:6: error: [GHC-83865] • Couldn't match type ‘Bool’ with ‘m Bool’ Expected: t0 -> m Bool Actual: t0 -> Bool - • The function ‘f1’ is applied to one value argument, + • The function ‘f1’ is applied to one visible argument, but its type ‘Monad m => m Bool’ has none In the expression: f1 undefined In an equation for ‘f2’: f2 = f1 undefined ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -712,6 +712,7 @@ test('ErrorIndexLinks', normal, compile_fail, ['-fprint-error-index-links=always test('T24064', normal, compile_fail, ['']) test('T24298', normal, compile_fail, ['']) test('T24279', normal, compile_fail, ['']) +test('T24318', normal, compile_fail, ['']) # all the various do expansion fail messages test('DoExpansion1', normal, compile, ['-fdefer-type-errors']) ===================================== testsuite/tests/typecheck/should_fail/tcfail001.stderr ===================================== @@ -2,7 +2,7 @@ tcfail001.hs:9:2: error: [GHC-83865] • Couldn't match expected type: [a] with actual type: [a0] -> [a1] - • The equation for ‘op’ has one value argument, + • The equation for ‘op’ has one visible argument, but its type ‘[a]’ has none In the instance declaration for ‘A [a]’ • Relevant bindings include op :: [a] (bound at tcfail001.hs:9:2) ===================================== testsuite/tests/typecheck/should_fail/tcfail140.stderr ===================================== @@ -1,7 +1,7 @@ tcfail140.hs:11:7: error: [GHC-83865] • Couldn't match expected type ‘t1 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘Int -> Int’ has only one In the expression: f 3 9 In an equation for ‘bar’: bar = f 3 9 @@ -9,7 +9,7 @@ tcfail140.hs:11:7: error: [GHC-83865] tcfail140.hs:13:10: error: [GHC-83865] • Couldn't match expected type ‘t2 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two value arguments, + • The function ‘f’ is applied to two visible arguments, but its type ‘Int -> Int’ has only one In the expression: 3 `f` 4 In an equation for ‘rot’: rot xs = 3 `f` 4 @@ -28,11 +28,11 @@ tcfail140.hs:15:15: error: [GHC-83865] tcfail140.hs:17:8: error: [GHC-27346] • The data constructor ‘Just’ should have 1 argument, but has been given none • In the pattern: Just - The lambda expression ‘\ Just x -> ...’ has two value arguments, + The lambda expression ‘\ Just x -> ...’ has two visible arguments, but its type ‘Maybe a -> a’ has only one In the expression: ((\ Just x -> x) :: Maybe a -> a) (Just 1) tcfail140.hs:20:1: error: [GHC-83865] • Couldn't match expected type ‘Int’ with actual type ‘t0 -> Bool’ - • The equation for ‘g’ has two value arguments, + • The equation for ‘g’ has two visible arguments, but its type ‘Int -> Int’ has only one ===================================== testsuite/tests/typecheck/should_fail/tcfail175.stderr ===================================== @@ -6,7 +6,7 @@ tcfail175.hs:11:1: error: [GHC-25897] the type signature for: evalRHS :: forall a. Int -> a at tcfail175.hs:10:1-19 - • The equation for ‘evalRHS’ has three value arguments, + • The equation for ‘evalRHS’ has three visible arguments, but its type ‘Int -> a’ has only one • Relevant bindings include evalRHS :: Int -> a (bound at tcfail175.hs:11:1) ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_n_args.stderr ===================================== @@ -5,5 +5,5 @@ T22326_fail_n_args.hs:6:1: error: [GHC-25897] the type signature for: f :: a -> forall b -> b at T22326_fail_n_args.hs:6:1-26 - • The equation for ‘f’ has three value arguments, + • The equation for ‘f’ has three visible arguments, but its type ‘a -> forall b -> b’ has only two ===================================== testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr ===================================== @@ -37,7 +37,7 @@ CaretDiagnostics1.hs:13:7-11: error: [GHC-83865] CaretDiagnostics1.hs:(13,16)-(14,13): error: [GHC-83865] • Couldn't match expected type ‘Char -> t0’ with actual type ‘()’ - • The function ‘()’ is applied to one value argument, + • The function ‘()’ is applied to one visible argument, but its type ‘()’ has none In the expression: () '0' In a case alternative: "γηξ" -> () '0' View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3c3e02f83edf7fc92e7514f2f05eb0f5c4e9d582...3731e3a528143a87927802c7d8c35ba9088f6dfa -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3c3e02f83edf7fc92e7514f2f05eb0f5c4e9d582...3731e3a528143a87927802c7d8c35ba9088f6dfa You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 00:41:12 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 07 Mar 2024 19:41:12 -0500 Subject: [Git][ghc/ghc][master] 10 commits: Bump array submodule Message-ID: <65ea5ea8c0b0f_17a6f279276181331c7@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr - libraries/base/tests/IO/openFile002.stderr - libraries/base/tests/IO/openFile002.stderr-mingw32 - libraries/base/tests/IO/withBinaryFile001.stderr - libraries/base/tests/IO/withBinaryFile002.stderr - libraries/base/tests/IO/withFile001.stderr - libraries/base/tests/IO/withFile002.stderr - libraries/base/tests/IO/withFileBlocking001.stderr - libraries/base/tests/IO/withFileBlocking002.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9cd9efb4de3757fd5eaec006739f75cef288e5eb...dc646e6f8e67add661628f2382fd0b65ed99b4f9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9cd9efb4de3757fd5eaec006739f75cef288e5eb...dc646e6f8e67add661628f2382fd0b65ed99b4f9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 00:42:00 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 07 Mar 2024 19:42:00 -0500 Subject: [Git][ghc/ghc][master] Update showAstData to honour blanking of AnnParen Message-ID: <65ea5ed8c9a3_17a6f27ade25413667@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 12 changed files: - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - testsuite/tests/ghc-api/exactprint/Test20239.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/parser/should_compile/KindSigs.stderr - testsuite/tests/parser/should_compile/T15323.stderr - testsuite/tests/parser/should_compile/T20452.stderr - testsuite/tests/parser/should_compile/T23315/T23315.stderr Changes: ===================================== compiler/GHC/Hs/Dump.hs ===================================== @@ -71,6 +71,7 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 `extQ` annotationEpaLocation `extQ` annotationNoEpAnns `extQ` addEpAnn + `extQ` annParen `extQ` lit `extQ` litr `extQ` litt `extQ` sourceText `extQ` deltaPos @@ -173,27 +174,21 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 srcSpan :: SrcSpan -> SDoc srcSpan ss = case bs of BlankSrcSpan -> text "{ ss }" - NoBlankSrcSpan -> braces $ char ' ' <> - (hang (ppr ss) 1 - -- TODO: show annotations here - (text "")) - BlankSrcSpanFile -> braces $ char ' ' <> - (hang (pprUserSpan False ss) 1 - -- TODO: show annotations here - (text "")) + NoBlankSrcSpan -> braces $ char ' ' <> (ppr ss) <> char ' ' + BlankSrcSpanFile -> braces $ char ' ' <> (pprUserSpan False ss) <> char ' ' realSrcSpan :: RealSrcSpan -> SDoc realSrcSpan ss = case bs of BlankSrcSpan -> text "{ ss }" - NoBlankSrcSpan -> braces $ char ' ' <> - (hang (ppr ss) 1 - -- TODO: show annotations here - (text "")) - BlankSrcSpanFile -> braces $ char ' ' <> - (hang (pprUserRealSpan False ss) 1 - -- TODO: show annotations here - (text "")) + NoBlankSrcSpan -> braces $ char ' ' <> (ppr ss) <> char ' ' + BlankSrcSpanFile -> braces $ char ' ' <> (pprUserRealSpan False ss) <> char ' ' + annParen :: AnnParen -> SDoc + annParen (AnnParen a o c) = case ba of + BlankEpAnnotations -> parens $ text "blanked:" <+> text "AnnParen" + NoBlankEpAnnotations -> + parens $ text "AnnParen" + $$ vcat [ppr a, epaAnchor o, epaAnchor c] addEpAnn :: AddEpAnn -> SDoc addEpAnn (AddEpAnn a s) = case ba of ===================================== compiler/GHC/Parser/Annotation.hs ===================================== @@ -745,7 +745,7 @@ data ParenType = AnnParens -- ^ '(', ')' | AnnParensHash -- ^ '(#', '#)' | AnnParensSquare -- ^ '[', ']' - deriving (Eq, Ord, Data) + deriving (Eq, Ord, Data, Show) -- | Maps the 'ParenType' to the related opening and closing -- AnnKeywordId. Used when actually printing the item. @@ -1452,6 +1452,8 @@ instance (Outputable a, OutputableBndr e) pprInfixOcc = pprInfixOcc . unLoc pprPrefixOcc = pprPrefixOcc . unLoc +instance Outputable ParenType where + ppr t = text (show t) instance Outputable AnnListItem where ppr (AnnListItem ts) = text "AnnListItem" <+> ppr ts ===================================== testsuite/tests/ghc-api/exactprint/Test20239.stderr ===================================== @@ -200,10 +200,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { Test20239.hs:7:50 }) - (EpaSpan { Test20239.hs:7:86 })) + (AnnParen AnnParens (EpaSpan { Test20239.hs:7:50 }) (EpaSpan { Test20239.hs:7:86 })) (L (EpAnn (EpaSpan { Test20239.hs:7:51-85 }) @@ -272,10 +269,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { Test20239.hs:7:68 }) - (EpaSpan { Test20239.hs:7:85 })) + (AnnParen AnnParens (EpaSpan { Test20239.hs:7:68 }) (EpaSpan { Test20239.hs:7:85 })) (L (EpAnn (EpaSpan { Test20239.hs:7:69-84 }) @@ -340,10 +334,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { Test20239.hs:7:83 }) - (EpaSpan { Test20239.hs:7:84 })) + (AnnParen AnnParens (EpaSpan { Test20239.hs:7:83 }) (EpaSpan { Test20239.hs:7:84 })) (HsBoxedOrConstraintTuple) [])))))))))))))]) (Nothing)))]) ===================================== testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr ===================================== @@ -227,10 +227,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { T17544_kw.hs:19:18 }) - (EpaSpan { T17544_kw.hs:19:19 })) + (AnnParen AnnParens (EpaSpan { T17544_kw.hs:19:18 }) (EpaSpan { T17544_kw.hs:19:19 })) (HsBoxedOrConstraintTuple) [])))]) (L ===================================== testsuite/tests/parser/should_compile/DumpParsedAst.stderr ===================================== @@ -228,10 +228,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { DumpParsedAst.hs:9:16 }) - (EpaSpan { DumpParsedAst.hs:9:18 })) + (AnnParen AnnParensSquare (EpaSpan { DumpParsedAst.hs:9:16 }) (EpaSpan { DumpParsedAst.hs:9:18 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:9:17 }) @@ -318,10 +315,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:11:10 }) - (EpaSpan { DumpParsedAst.hs:11:17 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:11:10 }) (EpaSpan { DumpParsedAst.hs:11:17 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:11:11-16 }) @@ -416,10 +410,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:11:26 }) - (EpaSpan { DumpParsedAst.hs:11:36 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:11:26 }) (EpaSpan { DumpParsedAst.hs:11:36 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:11:27-35 }) @@ -564,10 +555,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { DumpParsedAst.hs:10:27 }) - (EpaSpan { DumpParsedAst.hs:10:29 })) + (AnnParen AnnParensSquare (EpaSpan { DumpParsedAst.hs:10:27 }) (EpaSpan { DumpParsedAst.hs:10:29 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:10:28 }) @@ -744,10 +732,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:15:25 }) - (EpaSpan { DumpParsedAst.hs:15:29 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:15:25 }) (EpaSpan { DumpParsedAst.hs:15:29 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:15:26-28 }) @@ -882,10 +867,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:17:17 }) - (EpaSpan { DumpParsedAst.hs:17:27 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:17:17 }) (EpaSpan { DumpParsedAst.hs:17:27 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:17:18-26 }) @@ -1478,10 +1460,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:22:22 }) - (EpaSpan { DumpParsedAst.hs:22:37 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:22:22 }) (EpaSpan { DumpParsedAst.hs:22:37 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:22:23-36 }) @@ -1588,10 +1567,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:22:42 }) - (EpaSpan { DumpParsedAst.hs:22:52 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:22:42 }) (EpaSpan { DumpParsedAst.hs:22:52 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:22:43-51 }) @@ -1712,10 +1688,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { DumpParsedAst.hs:23:10 }) - (EpaSpan { DumpParsedAst.hs:23:34 })) + (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:23:10 }) (EpaSpan { DumpParsedAst.hs:23:34 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:23:11-33 }) ===================================== testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr ===================================== @@ -9,8 +9,7 @@ (EpaSpan { DumpParsedAstComments.hs:1:1 }) (AnnsModule [(AddEpAnn AnnModule (EpaSpan { DumpParsedAstComments.hs:5:1-6 })) - ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAstComments.hs:5:30-34 - }))] + ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAstComments.hs:5:30-34 }))] [] (Just ((,) ===================================== testsuite/tests/parser/should_compile/DumpRenamedAst.stderr ===================================== @@ -273,10 +273,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:13:11-16 }) @@ -367,10 +364,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:13:27-35 }) @@ -507,10 +501,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { DumpRenamedAst.hs:12:27 }) - (EpaSpan { DumpRenamedAst.hs:12:29 })) + (AnnParen AnnParensSquare (EpaSpan { DumpRenamedAst.hs:12:27 }) (EpaSpan { DumpRenamedAst.hs:12:29 })) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:12:28 }) @@ -605,10 +596,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { DumpRenamedAst.hs:11:16 }) - (EpaSpan { DumpRenamedAst.hs:11:18 })) + (AnnParen AnnParensSquare (EpaSpan { DumpRenamedAst.hs:11:16 }) (EpaSpan { DumpRenamedAst.hs:11:18 })) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:11:17 }) @@ -793,10 +781,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:19:23-36 }) @@ -896,10 +881,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:19:43-51 }) @@ -1009,10 +991,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:20:11-33 }) @@ -1347,10 +1326,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:22:26-28 }) @@ -1819,10 +1795,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaDelta (SameLine 0) []) - (EpaDelta (SameLine 0) [])) + (AnnParen AnnParens (EpaDelta (SameLine 0) []) (EpaDelta (SameLine 0) [])) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:24:18-26 }) @@ -2066,10 +2039,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { DumpRenamedAst.hs:31:12 }) - (EpaSpan { DumpRenamedAst.hs:31:14 })) + (AnnParen AnnParensSquare (EpaSpan { DumpRenamedAst.hs:31:12 }) (EpaSpan { DumpRenamedAst.hs:31:14 })) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:31:13 }) @@ -2122,10 +2092,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { DumpRenamedAst.hs:32:10 }) - (EpaSpan { DumpRenamedAst.hs:32:12 })) + (AnnParen AnnParensSquare (EpaSpan { DumpRenamedAst.hs:32:10 }) (EpaSpan { DumpRenamedAst.hs:32:12 })) (L (EpAnn (EpaSpan { DumpRenamedAst.hs:32:11 }) ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,10 +212,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { DumpSemis.hs:9:11 }) - (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -501,10 +498,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { DumpSemis.hs:14:11 }) - (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -753,10 +747,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { DumpSemis.hs:21:11 }) - (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/parser/should_compile/KindSigs.stderr ===================================== @@ -268,10 +268,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { KindSigs.hs:15:14 }) - (EpaSpan { KindSigs.hs:15:51 })) + (AnnParen AnnParens (EpaSpan { KindSigs.hs:15:14 }) (EpaSpan { KindSigs.hs:15:51 })) (HsBoxedOrConstraintTuple) [(L (EpAnn @@ -468,10 +465,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParensHash) - (EpaSpan { KindSigs.hs:16:15-16 }) - (EpaSpan { KindSigs.hs:16:53-54 })) + (AnnParen AnnParensHash (EpaSpan { KindSigs.hs:16:15-16 }) (EpaSpan { KindSigs.hs:16:53-54 })) (HsUnboxedTuple) [(L (EpAnn @@ -649,10 +643,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { KindSigs.hs:19:12 }) - (EpaSpan { KindSigs.hs:19:26 })) + (AnnParen AnnParensSquare (EpaSpan { KindSigs.hs:19:12 }) (EpaSpan { KindSigs.hs:19:26 })) (L (EpAnn (EpaSpan { KindSigs.hs:19:14-24 }) @@ -756,10 +747,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { KindSigs.hs:22:8 }) - (EpaSpan { KindSigs.hs:22:20 })) + (AnnParen AnnParens (EpaSpan { KindSigs.hs:22:8 }) (EpaSpan { KindSigs.hs:22:20 })) (L (EpAnn (EpaSpan { KindSigs.hs:22:9-19 }) @@ -847,10 +835,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { KindSigs.hs:22:33 }) - (EpaSpan { KindSigs.hs:22:44 })) + (AnnParen AnnParens (EpaSpan { KindSigs.hs:22:33 }) (EpaSpan { KindSigs.hs:22:44 })) (L (EpAnn (EpaSpan { KindSigs.hs:22:34-43 }) @@ -868,10 +853,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { KindSigs.hs:22:34 }) - (EpaSpan { KindSigs.hs:22:35 })) + (AnnParen AnnParens (EpaSpan { KindSigs.hs:22:34 }) (EpaSpan { KindSigs.hs:22:35 })) (HsBoxedOrConstraintTuple) [])) (L @@ -1362,10 +1344,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { KindSigs.hs:28:34 }) - (EpaSpan { KindSigs.hs:28:39 })) + (AnnParen AnnParensSquare (EpaSpan { KindSigs.hs:28:34 }) (EpaSpan { KindSigs.hs:28:39 })) (L (EpAnn (EpaSpan { KindSigs.hs:28:35-38 }) @@ -1519,10 +1498,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { KindSigs.hs:34:9 }) - (EpaSpan { KindSigs.hs:34:22 })) + (AnnParen AnnParens (EpaSpan { KindSigs.hs:34:9 }) (EpaSpan { KindSigs.hs:34:22 })) (L (EpAnn (EpaSpan { KindSigs.hs:34:10-21 }) ===================================== testsuite/tests/parser/should_compile/T15323.stderr ===================================== @@ -163,10 +163,7 @@ (EpaComments [])) (HsParTy - (AnnParen - (AnnParens) - (EpaSpan { T15323.hs:6:31 }) - (EpaSpan { T15323.hs:6:36 })) + (AnnParen AnnParens (EpaSpan { T15323.hs:6:31 }) (EpaSpan { T15323.hs:6:36 })) (L (EpAnn (EpaSpan { T15323.hs:6:32-35 }) ===================================== testsuite/tests/parser/should_compile/T20452.stderr ===================================== @@ -376,10 +376,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { T20452.hs:8:57 }) - (EpaSpan { T20452.hs:8:74 })) + (AnnParen AnnParensSquare (EpaSpan { T20452.hs:8:57 }) (EpaSpan { T20452.hs:8:74 })) (L (EpAnn (EpaSpan { T20452.hs:8:58-73 }) @@ -388,10 +385,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { T20452.hs:8:58 }) - (EpaSpan { T20452.hs:8:73 })) + (AnnParen AnnParens (EpaSpan { T20452.hs:8:58 }) (EpaSpan { T20452.hs:8:73 })) (HsBoxedOrConstraintTuple) [(L (EpAnn @@ -591,10 +585,7 @@ (EpaComments [])) (HsListTy - (AnnParen - (AnnParensSquare) - (EpaSpan { T20452.hs:9:57 }) - (EpaSpan { T20452.hs:9:74 })) + (AnnParen AnnParensSquare (EpaSpan { T20452.hs:9:57 }) (EpaSpan { T20452.hs:9:74 })) (L (EpAnn (EpaSpan { T20452.hs:9:58-73 }) @@ -603,10 +594,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { T20452.hs:9:58 }) - (EpaSpan { T20452.hs:9:73 })) + (AnnParen AnnParens (EpaSpan { T20452.hs:9:58 }) (EpaSpan { T20452.hs:9:73 })) (HsBoxedOrConstraintTuple) [(L (EpAnn ===================================== testsuite/tests/parser/should_compile/T23315/T23315.stderr ===================================== @@ -94,10 +94,7 @@ (EpaComments [])) (HsTupleTy - (AnnParen - (AnnParens) - (EpaSpan { T23315.hsig:3:6 }) - (EpaSpan { T23315.hsig:3:7 })) + (AnnParen AnnParens (EpaSpan { T23315.hsig:3:6 }) (EpaSpan { T23315.hsig:3:7 })) (HsBoxedOrConstraintTuple) [])))))))) ,(L View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bfc09760b995b696fee598861ab4de32ec27e516 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bfc09760b995b696fee598861ab4de32ec27e516 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 01:18:24 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 20:18:24 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/linker-got Message-ID: <65ea6760c468e_17a6f28fdc52014109f@gitlab.mail> Ben Gamari pushed new branch wip/linker-got at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/linker-got You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 01:49:51 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 20:49:51 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 15 commits: Rephrase error message to say "visible arguments" (#24318) Message-ID: <65ea6ebf8b65b_17a6f29fb3e30153790@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - b9d7296e by Ben Gamari at 2024-03-07T20:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - c6ac768a by Ben Gamari at 2024-03-07T20:49:26-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - b675a51b by Ben Gamari at 2024-03-07T20:49:37-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 30 changed files: - .gitlab-ci.yml - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr - libraries/base/tests/IO/openFile002.stderr - libraries/base/tests/IO/openFile002.stderr-mingw32 The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2efba97d84ce32d50dd48a41955bcb2753b0e186...b675a51b14225b215ecd60928e05684bc6952ddd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2efba97d84ce32d50dd48a41955bcb2753b0e186...b675a51b14225b215ecd60928e05684bc6952ddd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 01:56:27 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 20:56:27 -0500 Subject: [Git][ghc/ghc][wip/T24344] 92 commits: Add @since annotation to Data.Data.mkConstrTag Message-ID: <65ea704b29278_17a6f2a242dcc1592d3@gitlab.mail> Ben Gamari pushed to branch wip/T24344 at Glasgow Haskell Compiler / GHC Commits: 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 46cacf05 by Ben Gamari at 2024-03-07T20:56:17-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - 30 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs - compiler/GHC/Cmm/Dataflow/Graph.hs - compiler/GHC/Cmm/Dataflow/Label.hs - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Cmm/Info.hs - compiler/GHC/Cmm/Info/Build.hs - compiler/GHC/Cmm/LayoutStack.hs - compiler/GHC/Cmm/Lint.hs - compiler/GHC/Cmm/Liveness.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/125aa4aab15ec66484002763718acbefdeb50ae6...46cacf055788a5b4b267afc4754738a3ded5c070 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/125aa4aab15ec66484002763718acbefdeb50ae6...46cacf055788a5b4b267afc4754738a3ded5c070 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 01:59:01 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 20:59:01 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] testsuite: Mark T24171 as fragile due to #24512 Message-ID: <65ea70e5188e5_17a6f2a5e2ec816141e@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 2739c799 by Ben Gamari at 2024-03-07T20:58:23-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - 1 changed file: - testsuite/tests/rts/linker/T24171/all.T Changes: ===================================== testsuite/tests/rts/linker/T24171/all.T ===================================== @@ -1,6 +1,7 @@ test('T24171', [req_rts_linker, req_profiling, - extra_files(['Lib.hs', 'main.c'])], + extra_files(['Lib.hs', 'main.c']), + fragile(24512)], makefile_test, ['clean_build_and_run']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2739c799d0a9e4534372feed1e6e2e2d5c1ad34d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2739c799d0a9e4534372feed1e6e2e2d5c1ad34d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 02:05:54 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 07 Mar 2024 21:05:54 -0500 Subject: [Git][ghc/ghc][wip/ipe-sharing] 21 commits: Rephrase error message to say "visible arguments" (#24318) Message-ID: <65ea72826be14_17a6f2aaba79816189a@gitlab.mail> Ben Gamari pushed to branch wip/ipe-sharing at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - d20bf797 by Ben Gamari at 2024-03-07T20:29:32-05:00 rts/CloneStack: Bounds check array write - - - - - 860a8d42 by Ben Gamari at 2024-03-07T20:29:32-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - a94e4f91 by Ben Gamari at 2024-03-07T20:31:53-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - a948c384 by Ben Gamari at 2024-03-07T20:31:59-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 443db07f by Ben Gamari at 2024-03-07T20:32:23-05:00 rts/IPE: Don't expose helper in header - - - - - bf00e8f8 by Ben Gamari at 2024-03-07T20:32:23-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - d9bcfdbe by Ben Gamari at 2024-03-07T21:05:48-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6471e038 by Ben Gamari at 2024-03-07T21:05:48-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - 60f7999e by Ben Gamari at 2024-03-07T21:05:48-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/src/GHC/Base.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3c2c7b4eff9c53e1fd3581d466efd034632cb176...60f7999ed6797cc9c84ae51a939129f51897fed3 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3c2c7b4eff9c53e1fd3581d466efd034632cb176...60f7999ed6797cc9c84ae51a939129f51897fed3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 02:12:42 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 07 Mar 2024 21:12:42 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 13 commits: Bump array submodule Message-ID: <65ea741a811d6_17a6f2adec6dc16279b@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 9d93316e by Ben Gamari at 2024-03-07T21:12:33-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - acc39486 by Ben Gamari at 2024-03-07T21:12:33-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/src/Data/Kind.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr - libraries/base/tests/IO/openFile002.stderr - libraries/base/tests/IO/openFile002.stderr-mingw32 - libraries/base/tests/IO/withBinaryFile001.stderr - libraries/base/tests/IO/withBinaryFile002.stderr - libraries/base/tests/IO/withFile001.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6e5db80f6bacd51fbabdaedbb22b0b91aebc4a33...acc39486d1b9b94a7378d08448b7450248131df5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6e5db80f6bacd51fbabdaedbb22b0b91aebc4a33...acc39486d1b9b94a7378d08448b7450248131df5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 08:33:08 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 03:33:08 -0500 Subject: [Git][ghc/ghc][master] ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65eacd444e96a_18ccf22af83701983a@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 6 changed files: - libraries/base/src/Data/Kind.hs - libraries/ghc-internal/ghc-internal.cabal - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/src/Data/Kind.hs ===================================== @@ -1,4 +1,4 @@ -{-# LANGUAGE Safe #-} +{-# LANGUAGE Trustworthy #-} -- | -- @@ -19,4 +19,6 @@ module Data.Kind FUN ) where -import GHC.Internal.Data.Kind \ No newline at end of file +import GHC.Num.BigNat () -- for build ordering (#23942) +import GHC.Prim (FUN) +import GHC.Types (Type, Constraint) ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -120,7 +120,6 @@ Library GHC.Internal.Data.Functor.Utils GHC.Internal.Data.IORef GHC.Internal.Data.Ix - GHC.Internal.Data.Kind GHC.Internal.Data.List GHC.Internal.Data.Maybe GHC.Internal.Data.Monoid ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/50454a299cdef5375ece5fdaf70b36b4a09c3804 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/50454a299cdef5375ece5fdaf70b36b4a09c3804 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 08:33:46 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 03:33:46 -0500 Subject: [Git][ghc/ghc][master] rts: Fix SET_HDR initialization of retainer set Message-ID: <65eacd6a4de92_18ccf22c81c00242af@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 1 changed file: - rts/include/rts/storage/ClosureMacros.h Changes: ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.hp.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/38a4b6ab7bbd5e650f43541d091a52ed2655aff6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/38a4b6ab7bbd5e650f43541d091a52ed2655aff6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 09:20:23 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Fri, 08 Mar 2024 04:20:23 -0500 Subject: [Git][ghc/ghc][wip/andreask/m_warning] RTS: Emit warning when -M < -H Message-ID: <65ead857395d2_18ccf249b32603615f@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/m_warning at Glasgow Haskell Compiler / GHC Commits: a07a8987 by Andreas Klebinger at 2024-03-08T10:06:09+01:00 RTS: Emit warning when -M < -H Fixes #24487 - - - - - 1 changed file: - rts/RtsFlags.c Changes: ===================================== rts/RtsFlags.c ===================================== @@ -1951,6 +1951,9 @@ static void normaliseRtsOpts (void) if (RtsFlags.GcFlags.maxHeapSize != 0 && RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) { + errorBelch("Maximum heap size (-M) is smaller than suggested heap size (-H)\n" + "Setting maximum heap size to suggested heap size ( %" FMT_Word " )", + (StgWord64) RtsFlags.GcFlags.maxHeapSize * (StgWord64) BLOCK_SIZE); RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a07a89877a23136b0cf2cd791931b9646c6c59a9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a07a89877a23136b0cf2cd791931b9646c6c59a9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 09:56:49 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Fri, 08 Mar 2024 04:56:49 -0500 Subject: [Git][ghc/ghc][wip/hadrian-cross-stage2] Split up system.config into host/target config files Message-ID: <65eae0e177486_18ccf25b5f004473c1@gitlab.mail> Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC Commits: 04bc9786 by Matthew Pickering at 2024-03-08T09:56:31+00:00 Split up system.config into host/target config files There were a number of settings which were not applied per-stage, for example if you specified `--ffi-include-dir` then that was applied to both host and target. Now this will just be passed when building the crosscompiler. The solution for now is to separate these two files into host/target and the host file contains very bare-bones . There isn't currently a way to specify with configure anything in the host file, so if you are building a cross-compiler and you need to do that, you have to modify the file yourself. - - - - - 23 changed files: - configure.ac - hadrian/README.md - + hadrian/cfg/system.config.host.in - hadrian/cfg/system.config.in - + hadrian/cfg/system.config.target.in - hadrian/src/Base.hs - hadrian/src/Builder.hs - hadrian/src/Expression.hs - hadrian/src/Hadrian/Oracles/TextFile.hs - hadrian/src/Oracles/Flag.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Gmp.hs - hadrian/src/Rules/Libffi.hs - hadrian/src/Rules/Rts.hs - hadrian/src/Settings/Builders/Cabal.hs - hadrian/src/Settings/Builders/Common.hs - hadrian/src/Settings/Builders/Ghc.hs - hadrian/src/Settings/Builders/Hsc2Hs.hs - hadrian/src/Settings/Builders/RunTest.hs - hadrian/src/Settings/Packages.hs - hadrian/src/Settings/Warnings.hs Changes: ===================================== configure.ac ===================================== @@ -976,6 +976,8 @@ FIND_GHC_TOOLCHAIN([hadrian/cfg]) AC_CONFIG_FILES( [ mk/project.mk hadrian/cfg/system.config + hadrian/cfg/system.config.host + hadrian/cfg/system.config.target hadrian/ghci-cabal hadrian/ghci-multi-cabal hadrian/ghci-stack ===================================== hadrian/README.md ===================================== @@ -327,6 +327,16 @@ workflow, for now. Note: On windows you need to use the `reloc-binary-dist` target. +#### Cross Compiling + +If you are cross compiling then all the settings specified to ./configure are +for the target system. For example, if you specify `--with-ffi-includes` then +this is specifically for the target. + +If your host system needs additional configuration in order to build a stage1 compiler, +then at the moment you need to manually edit the "cfg/system.config.host.in" file to +specify these options in the right place. + #### Relocatable Binary Distribution If you require a relocatable binary distribution (for example on Windows), then you ===================================== hadrian/cfg/system.config.host.in ===================================== @@ -0,0 +1,77 @@ +# This file is processed by the configure script. +# See hadrian/src/UserSettings.hs for user-defined settings. +#=========================================================== + +# Paths to builders: +#=================== + +# Information about builders: +#============================ + +cc-llvm-backend = NO + + +# Information about build, host and target systems: +#================================================== + +dynamic-extension = @soext_host@ + +bootstrap-threaded-rts = YES + +# Settings: +#========== + +# We are in the process of moving the settings file from being entirely +# generated by configure, to generated being by the build system. Many of these +# might become redundant. +# See Note [tooldir: How GHC finds mingw on Windows] + +settings-otool-command = otool +settings-install_name_tool-command = install_name_tool +settings-llc-command = llc +settings-opt-command = opt +settings-llvm-as-command = clang +settings-use-distro-mingw = NO + +target-has-libm = YES + +# Include and library directories: +#================================= + +curses-lib-dir = +curses-include-dir = + +iconv-include-dir = +iconv-lib-dir = + +intree-gmp = NO +gmp-framework-preferred = NO +gmp-include-dir = +gmp-lib-dir = + +use-system-ffi = NO +ffi-include-dir = +ffi-lib-dir = + +libdw-include-dir = +libdw-lib-dir = + +libnuma-include-dir = +libnuma-lib-dir = + +libzstd-include-dir = +libzstd-lib-dir = + +# Optional Dependencies: +#======================= + +use-lib-dw = NO +use-lib-zstd = NO +static-lib-zstd = NO +use-lib-numa = NO +use-lib-m = YES +use-lib-rt = YES +use-lib-dl = YES +use-lib-bfd = NO +use-lib-pthread = NO +need-libatomic = NO ===================================== hadrian/cfg/system.config.in ===================================== @@ -32,8 +32,6 @@ python = @PythonCmd@ # Information about builders: #============================ -cc-llvm-backend = @CcLlvmBackend@ - llvm-min-version = @LlvmMinVersion@ llvm-max-version = @LlvmMaxVersion@ @@ -54,8 +52,6 @@ target-platform-full = @TargetPlatformFull@ cross-compiling = @CrossCompiling@ -dynamic-extension = @soext_target@ - ghc-version = @GhcVersion@ ghc-major-version = @GhcMajVersion@ ghc-minor-version = @GhcMinVersion@ @@ -72,60 +68,3 @@ project-patch-level1 = @ProjectPatchLevel1@ project-patch-level2 = @ProjectPatchLevel2@ project-git-commit-id = @ProjectGitCommitId@ -# Settings: -#========== - -# We are in the process of moving the settings file from being entirely -# generated by configure, to generated being by the build system. Many of these -# might become redundant. -# See Note [tooldir: How GHC finds mingw on Windows] - -settings-otool-command = @SettingsOtoolCommand@ -settings-install_name_tool-command = @SettingsInstallNameToolCommand@ -settings-llc-command = @SettingsLlcCommand@ -settings-opt-command = @SettingsOptCommand@ -settings-llvm-as-command = @SettingsLlvmAsCommand@ -settings-use-distro-mingw = @SettingsUseDistroMINGW@ - -target-has-libm = @TargetHasLibm@ - -# Include and library directories: -#================================= - -curses-lib-dir = @CURSES_LIB_DIRS@ -curses-include-dir = @CURSES_INCLUDE_DIRS@ - -iconv-include-dir = @ICONV_INCLUDE_DIRS@ -iconv-lib-dir = @ICONV_LIB_DIRS@ - -intree-gmp = @GMP_FORCE_INTREE@ -gmp-framework-preferred = @GMP_PREFER_FRAMEWORK@ -gmp-include-dir = @GMP_INCLUDE_DIRS@ -gmp-lib-dir = @GMP_LIB_DIRS@ - -use-system-ffi = @UseSystemLibFFI@ -ffi-include-dir = @FFIIncludeDir@ -ffi-lib-dir = @FFILibDir@ - -libdw-include-dir = @LibdwIncludeDir@ -libdw-lib-dir = @LibdwLibDir@ - -libnuma-include-dir = @LibNumaIncludeDir@ -libnuma-lib-dir = @LibNumaLibDir@ - -libzstd-include-dir = @LibZstdIncludeDir@ -libzstd-lib-dir = @LibZstdLibDir@ - -# Optional Dependencies: -#======================= - -use-lib-dw = @UseLibdw@ -use-lib-zstd = @UseLibZstd@ -static-lib-zstd = @UseStaticLibZstd@ -use-lib-numa = @UseLibNuma@ -use-lib-m = @UseLibm@ -use-lib-rt = @UseLibrt@ -use-lib-dl = @UseLibdl@ -use-lib-bfd = @UseLibbfd@ -use-lib-pthread = @UseLibpthread@ -need-libatomic = @NeedLibatomic@ ===================================== hadrian/cfg/system.config.target.in ===================================== @@ -0,0 +1,83 @@ +# This file is processed by the configure script. +# See hadrian/src/UserSettings.hs for user-defined settings. +#=========================================================== + +# Paths to builders: +#=================== + +# Information about builders: +#============================ + +cc-llvm-backend = @CcLlvmBackend@ + + +# Information about build, host and target systems: +#================================================== + +# Q: Is the *-platform information available in the target? +# A: Yes, it is. We pass @BuildPlatform@ and @HostPlatform@ and @TargetPlatform@ to ghc-toolchain using --target=that +# And we can reconstruct the platform info using targetPlatformTriple +# Q: What is TargetPlatformFull? +target-platform-full = @TargetPlatformFull@ + +dynamic-extension = @soext_target@ + +bootstrap-threaded-rts = @GhcThreadedRts@ + +# Settings: +#========== + +# We are in the process of moving the settings file from being entirely +# generated by configure, to generated being by the build system. Many of these +# might become redundant. +# See Note [tooldir: How GHC finds mingw on Windows] + +settings-otool-command = @SettingsOtoolCommand@ +settings-install_name_tool-command = @SettingsInstallNameToolCommand@ +settings-llc-command = @SettingsLlcCommand@ +settings-opt-command = @SettingsOptCommand@ +settings-llvm-as-command = @SettingsLlvmAsCommand@ +settings-use-distro-mingw = @SettingsUseDistroMINGW@ + +target-has-libm = @TargetHasLibm@ + +# Include and library directories: +#================================= + +curses-lib-dir = @CURSES_LIB_DIRS@ +curses-include-dir = @CURSES_INCLUDE_DIRS@ + +iconv-include-dir = @ICONV_INCLUDE_DIRS@ +iconv-lib-dir = @ICONV_LIB_DIRS@ + +intree-gmp = @GMP_FORCE_INTREE@ +gmp-framework-preferred = @GMP_PREFER_FRAMEWORK@ +gmp-include-dir = @GMP_INCLUDE_DIRS@ +gmp-lib-dir = @GMP_LIB_DIRS@ + +use-system-ffi = @UseSystemLibFFI@ +ffi-include-dir = @FFIIncludeDir@ +ffi-lib-dir = @FFILibDir@ + +libdw-include-dir = @LibdwIncludeDir@ +libdw-lib-dir = @LibdwLibDir@ + +libnuma-include-dir = @LibNumaIncludeDir@ +libnuma-lib-dir = @LibNumaLibDir@ + +libzstd-include-dir = @LibZstdIncludeDir@ +libzstd-lib-dir = @LibZstdLibDir@ + +# Optional Dependencies: +#======================= + +use-lib-dw = @UseLibdw@ +use-lib-zstd = @UseLibZstd@ +static-lib-zstd = @UseStaticLibZstd@ +use-lib-numa = @UseLibNuma@ +use-lib-m = @UseLibm@ +use-lib-rt = @UseLibrt@ +use-lib-dl = @UseLibdl@ +use-lib-bfd = @UseLibbfd@ +use-lib-pthread = @UseLibpthread@ +need-libatomic = @NeedLibatomic@ ===================================== hadrian/src/Base.hs ===================================== @@ -29,7 +29,8 @@ module Base ( module Way, -- * Paths - hadrianPath, configPath, configFile, sourcePath, shakeFilesDir, + hadrianPath, configPath, configFile, buildConfigFileHost, buildConfigFileTarget, + sourcePath, shakeFilesDir, stageBinPath, stageLibPath, templateHscPath, buildTargetFile, hostTargetFile, targetTargetFile, ghcLibDeps, haddockDeps, @@ -80,6 +81,13 @@ configPath = hadrianPath -/- "cfg" configFile :: FilePath configFile = configPath -/- "system.config" +buildConfigFileHost :: FilePath +buildConfigFileHost = configPath -/- "system.config.host" + +buildConfigFileTarget :: FilePath +buildConfigFileTarget = configPath -/- "system.config.target" + + -- | The target configuration file generated by ghc-toolchain for the -- compilation build platform buildTargetFile :: FilePath ===================================== hadrian/src/Builder.hs ===================================== @@ -28,14 +28,13 @@ import Hadrian.Builder.Tar import Hadrian.Oracles.Path import Hadrian.Oracles.TextFile import Hadrian.Utilities -import Oracles.Setting (bashPath, targetStage) import System.Exit import System.IO (stderr) import Base import Context import Oracles.Flag -import Oracles.Setting (setting, Setting(..)) +import Oracles.Setting import Packages import GHC.IO.Encoding (getFileSystemEncoding) ===================================== hadrian/src/Expression.hs ===================================== @@ -146,7 +146,7 @@ buildingCompilerStage' f = f . succStage <$> getStage -- compiler's RTS ways. See Note [Linking ghc-bin against threaded stage0 RTS] -- in Settings.Packages for details. threadedBootstrapper :: Predicate -threadedBootstrapper = expr (flag BootstrapThreadedRts) +threadedBootstrapper = staged (buildFlag BootstrapThreadedRts) -- | Is a certain package /not/ built right now? notPackage :: Package -> Predicate ===================================== hadrian/src/Hadrian/Oracles/TextFile.hs ===================================== @@ -13,7 +13,7 @@ -- to read configuration or package metadata files and cache the parsing. ----------------------------------------------------------------------------- module Hadrian.Oracles.TextFile ( - lookupValue, lookupValueOrEmpty, lookupValueOrError, lookupSystemConfig, lookupValues, + lookupValue, lookupValueOrEmpty, lookupValueOrError, lookupSystemConfig, lookupHostBuildConfig, lookupTargetBuildConfig, lookupValues, lookupValuesOrEmpty, lookupValuesOrError, lookupDependencies, textFileOracle, getBuildTarget, getHostTarget, getTargetTarget, queryBuildTarget, queryHostTarget @@ -52,6 +52,23 @@ lookupSystemConfig = lookupValueOrError (Just configError) configFile where configError = "Perhaps you need to rerun ./configure" +lookupHostBuildConfig :: String -> Action String +lookupHostBuildConfig key = do + cross <- (== "YES") <$> lookupSystemConfig "cross-compiling" + -- If we are not cross compiling, the build the host compiler like the target. + let cfgFile = if cross then buildConfigFileHost else buildConfigFileTarget + lookupValueOrError (Just configError) cfgFile key + where + configError = "Perhaps you need to rerun ./configure" + +lookupTargetBuildConfig :: String -> Action String +lookupTargetBuildConfig key = + lookupValueOrError (Just configError) buildConfigFileTarget key + where + configError = "Perhaps you need to rerun ./configure" + + + -- | Lookup a list of values in a text file, tracking the result. Each line of -- the file is expected to have @key value1 value2 ...@ format. lookupValues :: FilePath -> String -> Action (Maybe [String]) @@ -104,6 +121,7 @@ getHostTarget = do -- MP: If we are not cross compiling then we should use the target file in order to -- build things for the host, in particular we want to use the configured values for the -- target for building the RTS (ie are we using Libffi for adjustors, and the wordsize) + -- TODO: Use "flag CrossCompiling" ht <- getTargetConfig hostTargetFile tt <- getTargetConfig targetTargetFile if (Toolchain.targetPlatformTriple ht) == (Toolchain.targetPlatformTriple tt) ===================================== hadrian/src/Oracles/Flag.hs ===================================== @@ -2,6 +2,7 @@ module Oracles.Flag ( Flag (..), flag, getFlag, + BuildFlag(..), buildFlag, targetSupportsSharedLibs, targetSupportsGhciObjects, targetSupportsThreadedRts, @@ -22,7 +23,8 @@ import qualified GHC.Toolchain as Toolchain import GHC.Platform.ArchOS data Flag = CrossCompiling - | CcLlvmBackend + | UseGhcToolchain +data BuildFlag = CcLlvmBackend | GmpInTree | GmpFrameworkPref | UseSystemFfi @@ -38,7 +40,15 @@ data Flag = CrossCompiling | UseLibbfd | UseLibpthread | NeedLibatomic - | UseGhcToolchain + | TargetHasLibm + +parseFlagResult :: String -> String -> Bool +parseFlagResult key value = + if (value `notElem` ["YES", "NO", ""]) + then error $ "Configuration flag " + ++ quote (key ++ " = " ++ value) ++ " cannot be parsed." + else value == "YES" + -- Note, if a flag is set to empty string we treat it as set to NO. This seems -- fragile, but some flags do behave like this. @@ -46,6 +56,12 @@ flag :: Flag -> Action Bool flag f = do let key = case f of CrossCompiling -> "cross-compiling" + UseGhcToolchain -> "use-ghc-toolchain" + parseFlagResult key <$> lookupSystemConfig key + +buildFlag :: BuildFlag -> Stage -> Action Bool +buildFlag f st = + let key = case f of CcLlvmBackend -> "cc-llvm-backend" GmpInTree -> "intree-gmp" GmpFrameworkPref -> "gmp-framework-preferred" @@ -62,11 +78,13 @@ flag f = do UseLibbfd -> "use-lib-bfd" UseLibpthread -> "use-lib-pthread" NeedLibatomic -> "need-libatomic" - UseGhcToolchain -> "use-ghc-toolchain" - value <- lookupSystemConfig key - when (value `notElem` ["YES", "NO", ""]) . error $ "Configuration flag " - ++ quote (key ++ " = " ++ value) ++ " cannot be parsed." - return $ value == "YES" + TargetHasLibm -> "target-has-libm" + in parseFlagResult key <$> (tgtConfig st key) + where + tgtConfig Stage0 {} = lookupHostBuildConfig + tgtConfig Stage1 = lookupHostBuildConfig + tgtConfig Stage2 = lookupTargetBuildConfig + tgtConfig Stage3 = lookupTargetBuildConfig -- | Get a configuration setting. getFlag :: Flag -> Expr c b Bool ===================================== hadrian/src/Oracles/Setting.hs ===================================== @@ -1,7 +1,8 @@ module Oracles.Setting ( configFile, -- * Settings - Setting (..), setting, getSetting, + ProjectSetting (..), setting, getSetting, + BuildSetting(..), buildSetting, ToolchainSetting (..), settingsFileSetting, -- * Helpers @@ -39,28 +40,14 @@ import GHC.Platform.ArchOS -- tracking the result in the Shake database. -- -- * ROMES:TODO: How to handle target-platform-full? -data Setting = CursesIncludeDir - | CursesLibDir - | DynamicExtension - | FfiIncludeDir - | FfiLibDir - | GhcMajorVersion +data ProjectSetting = + GhcMajorVersion | GhcMinorVersion | GhcPatchLevel | GhcVersion | GhcSourcePath | LlvmMinVersion | LlvmMaxVersion - | GmpIncludeDir - | GmpLibDir - | IconvIncludeDir - | IconvLibDir - | LibdwIncludeDir - | LibdwLibDir - | LibnumaIncludeDir - | LibnumaLibDir - | LibZstdIncludeDir - | LibZstdLibDir | ProjectGitCommitId | ProjectName | ProjectVersion @@ -73,6 +60,25 @@ data Setting = CursesIncludeDir | TargetPlatformFull | BourneShell + +-- Things which configure how a specific stage is built +data BuildSetting = + CursesIncludeDir + | CursesLibDir + | DynamicExtension + | FfiIncludeDir + | FfiLibDir + | GmpIncludeDir + | GmpLibDir + | IconvIncludeDir + | IconvLibDir + | LibdwIncludeDir + | LibdwLibDir + | LibnumaIncludeDir + | LibnumaLibDir + | LibZstdIncludeDir + | LibZstdLibDir + -- TODO compute solely in Hadrian, removing these variables' definitions -- from aclocal.m4 whenever they can be calculated from other variables -- already fed into Hadrian. @@ -93,13 +99,8 @@ data ToolchainSetting -- | Look up the value of a 'Setting' in @cfg/system.config@, tracking the -- result. -setting :: Setting -> Action String +setting :: ProjectSetting -> Action String setting key = lookupSystemConfig $ case key of - CursesIncludeDir -> "curses-include-dir" - CursesLibDir -> "curses-lib-dir" - DynamicExtension -> "dynamic-extension" - FfiIncludeDir -> "ffi-include-dir" - FfiLibDir -> "ffi-lib-dir" GhcMajorVersion -> "ghc-major-version" GhcMinorVersion -> "ghc-minor-version" GhcPatchLevel -> "ghc-patch-level" @@ -107,16 +108,6 @@ setting key = lookupSystemConfig $ case key of GhcSourcePath -> "ghc-source-path" LlvmMinVersion -> "llvm-min-version" LlvmMaxVersion -> "llvm-max-version" - GmpIncludeDir -> "gmp-include-dir" - GmpLibDir -> "gmp-lib-dir" - IconvIncludeDir -> "iconv-include-dir" - IconvLibDir -> "iconv-lib-dir" - LibdwIncludeDir -> "libdw-include-dir" - LibdwLibDir -> "libdw-lib-dir" - LibnumaIncludeDir -> "libnuma-include-dir" - LibnumaLibDir -> "libnuma-lib-dir" - LibZstdIncludeDir -> "libzstd-include-dir" - LibZstdLibDir -> "libzstd-lib-dir" ProjectGitCommitId -> "project-git-commit-id" ProjectName -> "project-name" ProjectVersion -> "project-version" @@ -129,22 +120,51 @@ setting key = lookupSystemConfig $ case key of TargetPlatformFull -> "target-platform-full" BourneShell -> "bourne-shell" +buildSetting :: BuildSetting -> Stage -> Action String +buildSetting key stage = tgtConfig stage $ case key of + CursesIncludeDir -> "curses-include-dir" + CursesLibDir -> "curses-lib-dir" + DynamicExtension -> "dynamic-extension" + FfiIncludeDir -> "ffi-include-dir" + FfiLibDir -> "ffi-lib-dir" + GmpIncludeDir -> "gmp-include-dir" + GmpLibDir -> "gmp-lib-dir" + IconvIncludeDir -> "iconv-include-dir" + IconvLibDir -> "iconv-lib-dir" + LibdwIncludeDir -> "libdw-include-dir" + LibdwLibDir -> "libdw-lib-dir" + LibnumaIncludeDir -> "libnuma-include-dir" + LibnumaLibDir -> "libnuma-lib-dir" + LibZstdIncludeDir -> "libzstd-include-dir" + LibZstdLibDir -> "libzstd-lib-dir" + where + tgtConfig Stage0 {} = lookupHostBuildConfig + tgtConfig Stage1 = lookupHostBuildConfig + tgtConfig Stage2 = lookupTargetBuildConfig + tgtConfig Stage3 = lookupTargetBuildConfig + + -- | Look up the value of a 'SettingList' in @cfg/system.config@, tracking the -- result. -- See Note [tooldir: How GHC finds mingw on Windows] -- ROMES:TODO: This should be queryTargetTargetConfig -settingsFileSetting :: ToolchainSetting -> Action String -settingsFileSetting key = lookupSystemConfig $ case key of +settingsFileSetting :: ToolchainSetting -> Stage -> Action String +settingsFileSetting key stage = tgtConfig stage $ case key of ToolchainSetting_OtoolCommand -> "settings-otool-command" ToolchainSetting_InstallNameToolCommand -> "settings-install_name_tool-command" ToolchainSetting_LlcCommand -> "settings-llc-command" ToolchainSetting_OptCommand -> "settings-opt-command" ToolchainSetting_LlvmAsCommand -> "settings-llvm-as-command" ToolchainSetting_DistroMinGW -> "settings-use-distro-mingw" -- ROMES:TODO: This option doesn't seem to be in ghc-toolchain yet. It corresponds to EnableDistroToolchain + where + tgtConfig Stage0 {} = lookupHostBuildConfig + tgtConfig Stage1 = lookupHostBuildConfig + tgtConfig Stage2 = lookupTargetBuildConfig + tgtConfig Stage3 = lookupTargetBuildConfig -- | An expression that looks up the value of a 'Setting' in @cfg/system.config@, -- tracking the result. -getSetting :: Setting -> Expr c b String +getSetting :: ProjectSetting -> Expr c b String getSetting = expr . setting -- | The path to a Bourne shell interpreter. @@ -247,7 +267,7 @@ libsuf :: Stage -> Way -> Action String libsuf st way | not (wayUnit Dynamic way) = return (waySuffix way ++ ".a") -- e.g., _p.a | otherwise = do - extension <- setting DynamicExtension -- e.g., .dll or .so + extension <- buildSetting DynamicExtension st-- e.g., .dll or .so version <- ghcVersionStage st -- e.g. 8.4.4 or 8.9.xxxx let suffix = waySuffix (removeWayUnit Dynamic way) return (suffix ++ "-ghc" ++ version ++ extension) ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -10,7 +10,7 @@ module Oracles.TestSettings import Base import Hadrian.Oracles.TextFile -import Oracles.Setting (topDirectory, setting, Setting(..), crossStage) +import Oracles.Setting (topDirectory, setting, ProjectSetting(..), crossStage) import Packages import Settings.Program (programContext) import Hadrian.Oracles.Path ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -10,7 +10,6 @@ import qualified Data.Set as Set import Base import qualified Context import Expression -import Hadrian.Oracles.TextFile (lookupSystemConfig) import Oracles.Flag hiding (arSupportsAtFile, arSupportsDashL) import Oracles.ModuleFiles import Oracles.Setting @@ -49,10 +48,9 @@ ghcPrimDependencies = do rtsDependencies :: Expr [FilePath] rtsDependencies = do - stage <- getStage - rtsPath <- expr (rtsBuildPath stage) - jsTarget <- expr (isJsTarget stage) - useSystemFfi <- expr (flag UseSystemFfi) + rtsPath <- staged rtsBuildPath + jsTarget <- staged isJsTarget + useSystemFfi <- staged (buildFlag UseSystemFfi) let -- headers common to native and JS RTS common_headers = @@ -276,7 +274,7 @@ runInterpolations (Interpolations mk_substs) input = do return (subst input) -- | Interpolate the given variable with the value of the given 'Setting'. -interpolateSetting :: String -> Setting -> Interpolations +interpolateSetting :: String -> ProjectSetting -> Interpolations interpolateSetting name settng = interpolateVar name $ setting settng -- | Interpolate the @ProjectVersion@ and @ProjectVersionMunged@ variables. @@ -401,8 +399,8 @@ generateSettings settingsFile = do , ("ar supports at file", queryTarget stage arSupportsAtFile') , ("ar supports -L", queryTarget stage arSupportsDashL') , ("ranlib command", queryTarget stage ranlibPath) - , ("otool command", expr $ settingsFileSetting ToolchainSetting_OtoolCommand) - , ("install_name_tool command", expr $ settingsFileSetting ToolchainSetting_InstallNameToolCommand) + , ("otool command", staged $ settingsFileSetting ToolchainSetting_OtoolCommand) + , ("install_name_tool command", staged $ settingsFileSetting ToolchainSetting_InstallNameToolCommand) , ("windres command", queryTarget stage (maybe "/bin/false" prgPath . tgtWindres)) -- TODO: /bin/false is not available on many distributions by default, but we keep it as it were before the ghc-toolchain patch. Fix-me. , ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit, Context.stage = predStage stage }))) , ("cross compiling", expr $ yesNo <$> crossStage (predStage stage)) @@ -414,13 +412,13 @@ generateSettings settingsFile = do , ("target has GNU nonexec stack", queryTarget stage (yesNo . Toolchain.tgtSupportsGnuNonexecStack)) , ("target has .ident directive", queryTarget stage (yesNo . Toolchain.tgtSupportsIdentDirective)) , ("target has subsections via symbols", queryTarget stage (yesNo . Toolchain.tgtSupportsSubsectionsViaSymbols)) - , ("target has libm", expr $ lookupSystemConfig "target-has-libm") + , ("target has libm", yesNo <$> staged (buildFlag TargetHasLibm)) , ("Unregisterised", queryTarget stage (yesNo . tgtUnregisterised)) , ("LLVM target", queryTarget stage tgtLlvmTarget) - , ("LLVM llc command", expr $ settingsFileSetting ToolchainSetting_LlcCommand) - , ("LLVM opt command", expr $ settingsFileSetting ToolchainSetting_OptCommand) - , ("LLVM llvm-as command", expr $ settingsFileSetting ToolchainSetting_LlvmAsCommand) - , ("Use inplace MinGW toolchain", expr $ settingsFileSetting ToolchainSetting_DistroMinGW) + , ("LLVM llc command", staged $ settingsFileSetting ToolchainSetting_LlcCommand) + , ("LLVM opt command", staged $ settingsFileSetting ToolchainSetting_OptCommand) + , ("LLVM llvm-as command", staged $ settingsFileSetting ToolchainSetting_LlvmAsCommand) + , ("Use inplace MinGW toolchain", staged $ settingsFileSetting ToolchainSetting_DistroMinGW) , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter stage) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP stage) @@ -428,7 +426,7 @@ generateSettings settingsFile = do , ("Tables next to code", queryTarget stage (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget stage (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> targetUseLibffiForAdjustors stage) - , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("RTS expects libdw", yesNo <$> staged (buildFlag UseLibdw)) , ("Relative Global Package DB", pure rel_pkg_db) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" ===================================== hadrian/src/Rules/Gmp.hs ===================================== @@ -17,7 +17,7 @@ import Settings.Builders.Common (cArgs, getStagedCCFlags) -- their paths. gmpObjects :: Stage -> Action [FilePath] gmpObjects s = do - isInTree <- flag GmpInTree + isInTree <- buildFlag GmpInTree s if not isInTree then return [] else do @@ -65,8 +65,9 @@ gmpRules = do packageP = takeDirectory buildP librariesP = takeDirectory packageP stageP = takeDirectory librariesP + stage <- parsePath parseStage "" (takeFileName stageP) - isInTree <- flag GmpInTree + isInTree <- buildFlag GmpInTree stage if isInTree then do ===================================== hadrian/src/Rules/Libffi.hs ===================================== @@ -87,7 +87,7 @@ libffiContext stage = do -- | The name of the library libffiName :: Expr String libffiName = do - useSystemFfi <- expr (flag UseSystemFfi) + useSystemFfi <- staged (buildFlag UseSystemFfi) if useSystemFfi then pure "ffi" else libffiLocalName Nothing @@ -118,8 +118,8 @@ libffiHeaderDir stage = do path <- libffiBuildPath stage return $ path -/- "inst/include" -libffiSystemHeaderDir :: Action FilePath -libffiSystemHeaderDir = setting FfiIncludeDir +libffiSystemHeaderDir :: Stage -> Action FilePath +libffiSystemHeaderDir = buildSetting FfiIncludeDir fixLibffiMakefile :: FilePath -> String -> String fixLibffiMakefile top = ===================================== hadrian/src/Rules/Rts.hs ===================================== @@ -53,9 +53,9 @@ withLibffi stage action = needLibffi stage -- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput. copyLibffiHeader :: Stage -> FilePath -> Action () copyLibffiHeader stage header = do - useSystemFfi <- flag UseSystemFfi + useSystemFfi <- buildFlag UseSystemFfi stage (fromStr, headerDir) <- if useSystemFfi - then ("system",) <$> libffiSystemHeaderDir + then ("system",) <$> libffiSystemHeaderDir stage else needLibffi stage >> ("custom",) <$> libffiHeaderDir stage copyFile @@ -122,7 +122,7 @@ rtsLibffiLibrary stage way = do needRtsLibffiTargets :: Stage -> Action [FilePath] needRtsLibffiTargets stage = do rtsPath <- rtsBuildPath stage - useSystemFfi <- flag UseSystemFfi + useSystemFfi <- buildFlag UseSystemFfi stage jsTarget <- isJsTarget stage -- Header files (in the rts build dir). ===================================== hadrian/src/Settings/Builders/Cabal.hs ===================================== @@ -199,11 +199,11 @@ configureArgs cFlags' ldFlags' = do mconcat [ conf "CFLAGS" cFlags , conf "LDFLAGS" ldFlags - , conf "--with-iconv-includes" $ arg =<< getSetting IconvIncludeDir - , conf "--with-iconv-libraries" $ arg =<< getSetting IconvLibDir - , conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir - , conf "--with-gmp-libraries" $ arg =<< getSetting GmpLibDir - , conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir + , conf "--with-iconv-includes" $ arg =<< staged (buildSetting IconvIncludeDir) + , conf "--with-iconv-libraries" $ arg =<< staged (buildSetting IconvLibDir) + , conf "--with-gmp-includes" $ arg =<< staged (buildSetting GmpIncludeDir) + , conf "--with-gmp-libraries" $ arg =<< staged (buildSetting GmpLibDir) + , conf "--with-curses-libraries" $ arg =<< staged (buildSetting CursesLibDir) , conf "--host" $ arg =<< flip queryTarget targetPlatformTriple . predStage' =<< getStage , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage , ghcVersionH ===================================== hadrian/src/Settings/Builders/Common.hs ===================================== @@ -51,9 +51,9 @@ cppArgs = mempty cWarnings :: Args cWarnings = mconcat [ arg "-Wall" - , flag CcLlvmBackend ? arg "-Wno-unknown-pragmas" - , notM (flag CcLlvmBackend) ? not windowsHost ? arg "-Werror=unused-but-set-variable" - , notM (flag CcLlvmBackend) ? arg "-Wno-error=inline" ] + , staged (buildFlag CcLlvmBackend) ? arg "-Wno-unknown-pragmas" + , notM (staged (buildFlag CcLlvmBackend)) ? not windowsHost ? arg "-Werror=unused-but-set-variable" + , notM (staged (buildFlag CcLlvmBackend)) ? arg "-Wno-error=inline" ] packageDatabaseArgs :: Args packageDatabaseArgs = do ===================================== hadrian/src/Settings/Builders/Ghc.hs ===================================== @@ -103,7 +103,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do st <- getStage distDir <- expr (Context.distDir st) - useSystemFfi <- expr (flag UseSystemFfi) + useSystemFfi <- staged (buildFlag UseSystemFfi) buildPath <- getBuildPath libffiName' <- libffiName debugged <- buildingCompilerStage' . ghcDebugged =<< expr flavour ===================================== hadrian/src/Settings/Builders/Hsc2Hs.hs ===================================== @@ -12,7 +12,7 @@ hsc2hsBuilderArgs :: Args hsc2hsBuilderArgs = builder Hsc2Hs ? do stage <- getStage ccPath <- getBuilderPath $ Cc CompileC stage - gmpDir <- getSetting GmpIncludeDir + gmpDir <- staged (buildSetting GmpIncludeDir) top <- expr topDirectory hArch <- queryHost queryArch hOs <- queryHost queryOS ===================================== hadrian/src/Settings/Builders/RunTest.hs ===================================== @@ -114,7 +114,7 @@ inTreeCompilerArgs stg = do platform <- queryTargetTarget ghcStage targetPlatformTriple wordsize <- show @Int . (*8) <$> queryTargetTarget ghcStage (wordSize2Bytes . tgtWordSize) - llc_cmd <- settingsFileSetting ToolchainSetting_LlcCommand + llc_cmd <- settingsFileSetting ToolchainSetting_LlcCommand ghcStage have_llvm <- liftIO (isJust <$> findExecutable llc_cmd) top <- topDirectory ===================================== hadrian/src/Settings/Packages.hs ===================================== @@ -30,10 +30,10 @@ packageArgs = do compilerStageOption f = buildingCompilerStage' . f =<< expr flavour - cursesIncludeDir <- getSetting CursesIncludeDir - cursesLibraryDir <- getSetting CursesLibDir - ffiIncludeDir <- getSetting FfiIncludeDir - ffiLibraryDir <- getSetting FfiLibDir + cursesIncludeDir <- staged (buildSetting CursesIncludeDir) + cursesLibraryDir <- staged (buildSetting CursesLibDir) + ffiIncludeDir <- staged (buildSetting FfiIncludeDir) + ffiLibraryDir <- staged (buildSetting FfiLibDir) stageVersion <- readVersion <$> (expr $ ghcVersionStage stage) mconcat @@ -80,13 +80,13 @@ packageArgs = do [ andM [expr (ghcWithInterpreter stage), notStage0] `cabalFlag` "internal-interpreter" , notM cross `cabalFlag` "terminfo" , arg "-build-tool-depends" - , flag UseLibzstd `cabalFlag` "with-libzstd" + , staged (buildFlag UseLibzstd) `cabalFlag` "with-libzstd" -- ROMES: While the boot compiler is not updated wrt -this-unit-id -- not being fixed to `ghc`, when building stage0, we must set -- -this-unit-id to `ghc` because the boot compiler expects that. -- We do it through a cabal flag in ghc.cabal , stageVersion < makeVersion [9,8,1] ? arg "+hadrian-stage0" - , flag StaticLibzstd `cabalFlag` "static-libzstd" + , staged (buildFlag StaticLibzstd) `cabalFlag` "static-libzstd" ] , builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ] @@ -116,9 +116,9 @@ packageArgs = do -------------------------------- ghcPrim ------------------------------- , package ghcPrim ? mconcat - [ builder (Cabal Flags) ? flag NeedLibatomic `cabalFlag` "need-atomic" + [ builder (Cabal Flags) ? staged (buildFlag NeedLibatomic) `cabalFlag` "need-atomic" - , builder (Cc CompileC) ? (not <$> flag CcLlvmBackend) ? + , builder (Cc CompileC) ? (not <$> staged (buildFlag CcLlvmBackend)) ? input "**/cbits/atomic.c" ? arg "-Wno-sync-nand" ] --------------------------------- ghci --------------------------------- @@ -229,8 +229,8 @@ packageArgs = do ghcBignumArgs :: Args ghcBignumArgs = package ghcBignum ? do -- These are only used for non-in-tree builds. - librariesGmp <- getSetting GmpLibDir - includesGmp <- getSetting GmpIncludeDir + librariesGmp <- staged (buildSetting GmpLibDir) + includesGmp <- staged (buildSetting GmpIncludeDir) backend <- getBignumBackend check <- getBignumCheck @@ -253,15 +253,15 @@ ghcBignumArgs = package ghcBignum ? do -- enable in-tree support: don't depend on external "gmp" -- library - , flag GmpInTree ? arg "--configure-option=--with-intree-gmp" + , staged (buildFlag GmpInTree) ? arg "--configure-option=--with-intree-gmp" -- prefer framework over library (on Darwin) - , flag GmpFrameworkPref ? + , staged (buildFlag GmpFrameworkPref) ? arg "--configure-option=--with-gmp-framework-preferred" -- Ensure that the ghc-bignum package registration includes -- knowledge of the system gmp's library and include directories. - , notM (flag GmpInTree) ? cabalExtraDirs includesGmp librariesGmp + , notM (staged (buildFlag GmpInTree)) ? cabalExtraDirs includesGmp librariesGmp ] ] _ -> mempty @@ -290,15 +290,15 @@ rtsPackageArgs = package rts ? do way <- getWay path <- getBuildPath top <- expr topDirectory - useSystemFfi <- getFlag UseSystemFfi - ffiIncludeDir <- getSetting FfiIncludeDir - ffiLibraryDir <- getSetting FfiLibDir - libdwIncludeDir <- getSetting LibdwIncludeDir - libdwLibraryDir <- getSetting LibdwLibDir - libnumaIncludeDir <- getSetting LibnumaIncludeDir - libnumaLibraryDir <- getSetting LibnumaLibDir - libzstdIncludeDir <- getSetting LibZstdIncludeDir - libzstdLibraryDir <- getSetting LibZstdLibDir + useSystemFfi <- staged (buildFlag UseSystemFfi) + ffiIncludeDir <- staged (buildSetting FfiIncludeDir) + ffiLibraryDir <- staged (buildSetting FfiLibDir) + libdwIncludeDir <- staged (buildSetting LibdwIncludeDir) + libdwLibraryDir <- staged (buildSetting LibdwLibDir) + libnumaIncludeDir <- staged (buildSetting LibnumaIncludeDir) + libnumaLibraryDir <- staged (buildSetting LibnumaLibDir) + libzstdIncludeDir <- staged (buildSetting LibZstdIncludeDir) + libzstdLibraryDir <- staged (buildSetting LibZstdLibDir) -- Arguments passed to GHC when compiling C and .cmm sources. @@ -392,10 +392,10 @@ rtsPackageArgs = package rts ? do -- any warnings in the module. See: -- https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions#Warnings - , (not <$> flag CcLlvmBackend) ? + , (not <$> staged (buildFlag CcLlvmBackend)) ? inputs ["**/Compact.c"] ? arg "-finline-limit=2500" - , input "**/RetainerProfile.c" ? flag CcLlvmBackend ? + , input "**/RetainerProfile.c" ? staged (buildFlag CcLlvmBackend) ? arg "-Wno-incompatible-pointer-types" ] @@ -405,18 +405,18 @@ rtsPackageArgs = package rts ? do , any (wayUnit Debug) rtsWays `cabalFlag` "debug" , any (wayUnit Dynamic) rtsWays `cabalFlag` "dynamic" , any (wayUnit Threaded) rtsWays `cabalFlag` "threaded" - , flag UseLibm `cabalFlag` "libm" - , flag UseLibrt `cabalFlag` "librt" - , flag UseLibdl `cabalFlag` "libdl" + , staged (buildFlag UseLibm) `cabalFlag` "libm" + , staged (buildFlag UseLibrt) `cabalFlag` "librt" + , staged (buildFlag UseLibdl) `cabalFlag` "libdl" , useSystemFfi `cabalFlag` "use-system-libffi" , targetUseLibffiForAdjustors stage `cabalFlag` "libffi-adjustors" - , flag UseLibpthread `cabalFlag` "need-pthread" - , flag UseLibbfd `cabalFlag` "libbfd" - , flag NeedLibatomic `cabalFlag` "need-atomic" - , flag UseLibdw `cabalFlag` "libdw" - , flag UseLibnuma `cabalFlag` "libnuma" - , flag UseLibzstd `cabalFlag` "libzstd" - , flag StaticLibzstd `cabalFlag` "static-libzstd" + , staged (buildFlag UseLibpthread) `cabalFlag` "need-pthread" + , staged (buildFlag UseLibbfd ) `cabalFlag` "libbfd" + , staged (buildFlag NeedLibatomic) `cabalFlag` "need-atomic" + , staged (buildFlag UseLibdw ) `cabalFlag` "libdw" + , staged (buildFlag UseLibnuma ) `cabalFlag` "libnuma" + , staged (buildFlag UseLibzstd ) `cabalFlag` "libzstd" + , staged (buildFlag StaticLibzstd) `cabalFlag` "static-libzstd" , queryTargetTarget stage tgtSymbolsHaveLeadingUnderscore `cabalFlag` "leading-underscore" , ghcUnreg `cabalFlag` "unregisterised" , ghcEnableTNC `cabalFlag` "tables-next-to-code" @@ -437,7 +437,7 @@ rtsPackageArgs = package rts ? do , builder HsCpp ? pure [ "-DTOP=" ++ show top ] - , builder HsCpp ? flag UseLibdw ? arg "-DUSE_LIBDW" ] + , builder HsCpp ? staged (buildFlag UseLibdw) ? arg "-DUSE_LIBDW" ] -- Compile various performance-critical pieces *without* -fPIC -dynamic -- even when building a shared library. If we don't do this, then the ===================================== hadrian/src/Settings/Warnings.hs ===================================== @@ -10,16 +10,15 @@ import Packages -- | Default Haskell warning-related arguments. defaultGhcWarningsArgs :: Args defaultGhcWarningsArgs = do - stage <- getStage mconcat [ notStage0 ? arg "-Wnoncanonical-monad-instances" - , notM (flag CcLlvmBackend) ? arg "-optc-Wno-error=inline" - , flag CcLlvmBackend ? arg "-optc-Wno-unknown-pragmas" + , notM (staged (buildFlag CcLlvmBackend)) ? arg "-optc-Wno-error=inline" + , staged (buildFlag CcLlvmBackend) ? arg "-optc-Wno-unknown-pragmas" -- Cabal can seemingly produce filepaths with incorrect case on filesystems -- with case-insensitive names. Ignore such issues for now as they seem benign. -- See #17798. - , isOsxTarget stage ? arg "-optP-Wno-nonportable-include-path" - , isWinTarget stage ? arg "-optP-Wno-nonportable-include-path" + , staged isOsxTarget ? arg "-optP-Wno-nonportable-include-path" + , staged isWinTarget ? arg "-optP-Wno-nonportable-include-path" ] -- | Package-specific warnings-related arguments, mostly suppressing various warnings. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/04bc9786e169cb88ca4a15a9d28e1819b58ee7a8 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/04bc9786e169cb88ca4a15a9d28e1819b58ee7a8 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 11:35:34 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 06:35:34 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65eaf8062177e_18ccf284b4ae456549@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - d17e0cfc by Patrick at 2024-03-08T08:54:36+00:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 21c7494d by Ben Gamari at 2024-03-08T06:35:23-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 21 changed files: - compiler/GHC.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - libraries/base/src/Data/Kind.hs - libraries/ghc-internal/ghc-internal.cabal - rts/include/rts/storage/ClosureMacros.h - rts/linker/Elf.c - + testsuite/tests/hiefile/should_compile/T24493.hs - + testsuite/tests/hiefile/should_compile/T24493.stderr - testsuite/tests/hiefile/should_compile/all.T - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/T14189.stderr - utils/haddock Changes: ===================================== compiler/GHC.hs ===================================== @@ -1157,7 +1157,7 @@ instance DesugaredMod DesugaredModule where type ParsedSource = Located (HsModule GhcPs) type RenamedSource = (HsGroup GhcRn, [LImportDecl GhcRn], Maybe [(LIE GhcRn, Avails)], - Maybe (LHsDoc GhcRn)) + Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName)) type TypecheckedSource = LHsBinds GhcTc -- NOTE: ===================================== compiler/GHC/HsToCore/Docs.hs ===================================== @@ -63,12 +63,12 @@ extractDocs dflags , tcg_imports = import_avails , tcg_insts = insts , tcg_fam_insts = fam_insts - , tcg_doc_hdr = mb_doc_hdr + , tcg_hdr_info = mb_hdr_info , tcg_th_docs = th_docs_var , tcg_type_env = ty_env } = do th_docs <- liftIO $ readIORef th_docs_var - let doc_hdr = (unLoc <$> mb_doc_hdr) + let doc_hdr = unLoc <$> fst mb_hdr_info ExtractedTHDocs th_hdr th_decl_docs th_arg_docs th_inst_docs = extractTHDocs th_docs mod_docs = Docs ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -210,7 +210,8 @@ call and just recurse directly in to the subexpressions. -- These synonyms match those defined in compiler/GHC.hs type RenamedSource = ( HsGroup GhcRn, [LImportDecl GhcRn] , Maybe [(LIE GhcRn, Avails)] - , Maybe (LHsDoc GhcRn) ) + , Maybe (LHsDoc GhcRn) + , Maybe (XRec GhcRn ModuleName) ) type TypecheckedSource = LHsBinds GhcTc @@ -321,8 +322,9 @@ getCompressedAsts ts rs top_ev_binds insts tcs = enrichHie :: TypecheckedSource -> RenamedSource -> Bag EvBind -> [ClsInst] -> [TyCon] -> HieASTs Type -enrichHie ts (hsGrp, imports, exports, docs) ev_bs insts tcs = +enrichHie ts (hsGrp, imports, exports, docs, modName) ev_bs insts tcs = runIdentity $ flip evalStateT initState $ flip runReaderT SourceInfo $ do + modName <- toHie (IEC Export <$> modName) tasts <- toHie $ fmap (BC RegularBind ModuleScope) ts rasts <- processGrp hsGrp imps <- toHie $ filter (not . ideclImplicit . ideclExt . unLoc) imports @@ -344,7 +346,8 @@ enrichHie ts (hsGrp, imports, exports, docs) ev_bs insts tcs = (realSrcSpanEnd $ nodeSpan (NE.last children)) flat_asts = concat - [ tasts + [ modName + , tasts , rasts , imps , exps ===================================== compiler/GHC/Tc/Module.hs ===================================== @@ -297,8 +297,8 @@ tcRnModuleTcRnM hsc_env mod_sum -- We will rename it properly after renaming everything else so that -- haddock can link the identifiers ; tcg_env <- return (tcg_env - { tcg_doc_hdr = fmap (\(WithHsDocIdentifiers str _) -> WithHsDocIdentifiers str []) - <$> maybe_doc_hdr }) + { tcg_hdr_info = (fmap (\(WithHsDocIdentifiers str _) -> WithHsDocIdentifiers str []) + <$> maybe_doc_hdr , maybe_mod ) }) ; -- If the whole module is warned about or deprecated -- (via mod_deprec) record that in tcg_warns. If we do thereby add -- a WarnAll, it will override any subsequent deprecations added to tcg_warns @@ -347,7 +347,7 @@ tcRnModuleTcRnM hsc_env mod_sum -- Rename the module header properly after we have renamed everything else ; maybe_doc_hdr <- traverse rnLHsDoc maybe_doc_hdr; ; tcg_env <- return (tcg_env - { tcg_doc_hdr = maybe_doc_hdr }) + { tcg_hdr_info = (maybe_doc_hdr, maybe_mod) }) ; -- add extra source files to tcg_dependent_files addDependentFiles src_files @@ -3115,14 +3115,15 @@ runRenamerPlugin gbl_env hs_group = do -- exception/signal an error. type RenamedStuff = (Maybe (HsGroup GhcRn, [LImportDecl GhcRn], Maybe [(LIE GhcRn, Avails)], - Maybe (LHsDoc GhcRn))) + Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))) -- | Extract the renamed information from TcGblEnv. getRenamedStuff :: TcGblEnv -> RenamedStuff getRenamedStuff tc_result = fmap (\decls -> ( decls, tcg_rn_imports tc_result - , tcg_rn_exports tc_result, tcg_doc_hdr tc_result ) ) + , tcg_rn_exports tc_result, doc_hdr, name_hdr )) (tcg_rn_decls tc_result) + where (doc_hdr, name_hdr) = tcg_hdr_info tc_result runTypecheckerPlugin :: ModSummary -> TcGblEnv -> TcM TcGblEnv runTypecheckerPlugin sum gbl_env = do ===================================== compiler/GHC/Tc/Types.hs ===================================== @@ -605,7 +605,9 @@ data TcGblEnv tcg_fords :: [LForeignDecl GhcTc], -- ...Foreign import & exports tcg_patsyns :: [PatSyn], -- ...Pattern synonyms - tcg_doc_hdr :: Maybe (LHsDoc GhcRn), -- ^ Maybe Haddock header docs + tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName)), + -- ^ Maybe Haddock header docs and Maybe located module name + tcg_hpc :: !AnyHpcUsage, -- ^ @True@ if any part of the -- prog uses hpc instrumentation. -- NB. BangPattern is to fix a leak, see #15111 ===================================== compiler/GHC/Tc/Utils/Backpack.hs ===================================== @@ -523,8 +523,8 @@ mergeSignatures tcg_rn_decls = tcg_rn_decls orig_tcg_env, -- Annotations tcg_ann_env = tcg_ann_env orig_tcg_env, - -- Documentation header - tcg_doc_hdr = tcg_doc_hdr orig_tcg_env + -- Documentation header and located module name + tcg_hdr_info = tcg_hdr_info orig_tcg_env -- tcg_dus? -- tcg_th_used = tcg_th_used orig_tcg_env, -- tcg_th_splice_used = tcg_th_splice_used orig_tcg_env ===================================== compiler/GHC/Tc/Utils/Monad.hs ===================================== @@ -346,7 +346,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this tcg_merged = [], tcg_dfun_n = dfun_n_var, tcg_keep = keep_var, - tcg_doc_hdr = Nothing, + tcg_hdr_info = (Nothing,Nothing), tcg_hpc = False, tcg_main = Nothing, tcg_self_boot = NoSelfBoot, ===================================== libraries/base/src/Data/Kind.hs ===================================== @@ -1,4 +1,4 @@ -{-# LANGUAGE Safe #-} +{-# LANGUAGE Trustworthy #-} -- | -- @@ -19,4 +19,6 @@ module Data.Kind FUN ) where -import GHC.Internal.Data.Kind \ No newline at end of file +import GHC.Num.BigNat () -- for build ordering (#23942) +import GHC.Prim (FUN) +import GHC.Types (Type, Constraint) ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -120,7 +120,6 @@ Library GHC.Internal.Data.Functor.Utils GHC.Internal.Data.IORef GHC.Internal.Data.Ix - GHC.Internal.Data.Kind GHC.Internal.Data.List GHC.Internal.Data.Maybe GHC.Internal.Data.Monoid ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.hp.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else ===================================== rts/linker/Elf.c ===================================== @@ -101,10 +101,10 @@ # include #endif +#include "elf_got.h" + #if defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH) -# define NEED_GOT # define NEED_PLT -# include "elf_got.h" # include "elf_plt.h" # include "elf_reloc.h" #endif @@ -798,7 +798,7 @@ ocGetNames_ELF ( ObjectCode* oc ) /* This is a non-empty .bss section. Allocate zeroed space for it, and set its .sh_offset field such that ehdrC + .sh_offset == addr_of_zeroed_space. */ -#if defined(NEED_GOT) || RTS_LINKER_USE_MMAP +#if RTS_LINKER_USE_MMAP if (USE_CONTIGUOUS_MMAP || RtsFlags.MiscFlags.linkerAlwaysPic) { /* The space for bss sections is already preallocated */ CHECK(oc->bssBegin != NULL); @@ -1113,13 +1113,11 @@ ocGetNames_ELF ( ObjectCode* oc ) } } -#if defined(NEED_GOT) if(makeGot( oc )) errorBelch("Failed to create GOT for %s", oc->archiveMemberName ? oc->archiveMemberName : oc->fileName); -#endif result = 1; goto end; @@ -1987,13 +1985,11 @@ ocResolve_ELF ( ObjectCode* oc ) } } -#if defined(NEED_GOT) if(fillGot( oc )) return 0; /* silence warnings */ (void) shnum; (void) shdr; -#endif /* NEED_GOT */ #if defined(aarch64_HOST_ARCH) /* use new relocation design */ ===================================== testsuite/tests/hiefile/should_compile/T24493.hs ===================================== @@ -0,0 +1,3 @@ +module T24493 where + +go = "1" ===================================== testsuite/tests/hiefile/should_compile/T24493.stderr ===================================== @@ -0,0 +1,33 @@ +==================== HIE AST ==================== +File: T24493.hs +Node at T24493.hs:(1,8)-(3,8): Source: From source + {(annotations: {(Module, Module)}), (types: []), + (identifier info: {})} + + Node at T24493.hs:1:8-13: Source: From source + {(annotations: {}), (types: []), + (identifier info: {(module T24493, Details: Nothing {export})})} + + Node at T24493.hs:3:1-8: Source: From source + {(annotations: {(FunBind, HsBindLR), (Match, Match), + (XHsBindsLR, HsBindLR)}), + (types: [0]), (identifier info: {})} + + Node at T24493.hs:3:1-2: Source: From source + {(annotations: {}), (types: []), + (identifier info: {(name T24493.go, Details: Just 0 {LHS of a match group, + regular value bound with scope: ModuleScope bound at: T24493.hs:3:1-8})})} + + Node at T24493.hs:3:4-8: Source: From source + {(annotations: {(GRHS, GRHS)}), (types: []), + (identifier info: {})} + + Node at T24493.hs:3:6-8: Source: From source + {(annotations: {(HsLit, HsExpr)}), (types: [0]), + (identifier info: {})} + + + + +Got valid scopes +Got no roundtrip errors \ No newline at end of file ===================================== testsuite/tests/hiefile/should_compile/all.T ===================================== @@ -23,3 +23,4 @@ test('Scopes', normal, compile, ['-fno-code -fwrite-ide- test('ScopesBug', expect_broken(18425), compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info']) test('T18425', normal, compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info']) test('T22416', normal, compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info']) +test('T24493', normal, compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info -ddump-hie']) ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/parser/should_compile/DumpRenamedAst.stderr ===================================== @@ -2,7 +2,7 @@ ==================== Renamer ==================== (Just - ((,,,) + ((,,,,) (HsGroup (NoExtField) (XValBindsLR @@ -2367,6 +2367,16 @@ {Name: GHC.Types.Type}))) (Nothing)))])))))] (Nothing) - (Nothing))) + (Nothing) + (Just + (L + (EpAnn + (EpaSpan { DumpRenamedAst.hs:4:8-21 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: DumpRenamedAst})))) + ===================================== testsuite/tests/parser/should_compile/T14189.stderr ===================================== @@ -2,7 +2,7 @@ ==================== Renamer ==================== (Just - ((,,,) + ((,,,,) (HsGroup (NoExtField) (XValBindsLR @@ -316,6 +316,13 @@ [{Name: T14189.MyType} ,{Name: T14189.f} ,{Name: T14189.NT}])])]) - (Nothing))) - - + (Nothing) + (Just + (L + (EpAnn + (EpaSpan { T14189.hs:1:8-13 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: T14189})))) ===================================== utils/haddock ===================================== @@ -1 +1 @@ -Subproject commit 91f338a4f1ae59fd6ea482b73a27708113912d5d +Subproject commit 730749b48c3d7b358f4fb07774a1ccfc1d63968a View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/acc39486d1b9b94a7378d08448b7450248131df5...21c7494d64fc83bcfbb3dbb4f8cb7965efb129cd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/acc39486d1b9b94a7378d08448b7450248131df5...21c7494d64fc83bcfbb3dbb4f8cb7965efb129cd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 11:41:48 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Fri, 08 Mar 2024 06:41:48 -0500 Subject: [Git][ghc/ghc][wip/simplifier-tweaks] 175 commits: Improve Monad, Functor & Applicative docs Message-ID: <65eaf97ce8ce8_18ccf288ae7a86218c@gitlab.mail> Simon Peyton Jones pushed to branch wip/simplifier-tweaks at Glasgow Haskell Compiler / GHC Commits: 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - b77dbb51 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Several improvements to the handling of coercions * Make `mkSymCo` and `mkInstCo` smarter Fixes #23642 * Fix return role of `SelCo` in the coercion optimiser. Fixes #23617 * Make the coercion optimiser `opt_trans_rule` work better for newtypes Fixes #23619 - - - - - 83bf77f6 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Simplifier improvements This MR started as: allow the simplifer to do more in one pass, arising from places I could see the simplifier taking two iterations where one would do. But it turned into a larger project, because these changes unexpectedly made inlining blow up, especially join points in deeply-nested cases. The net result is good: a 1.5% improvement in compile time. The table below shows changes over 1%. The main changes are: * The SimplEnv now has a seInlineDepth field, which says how deep in unfoldings we are. See Note [Inline depth] in Simplify.Env * Avoid repeatedly simplifying coercions. see Note [Avoid re-simplifying coercions] in Simplify.Iteration As you'll see from the Note, this makes use of the seInlineDepth. * Allow Simplify.Utils.postInlineUnconditionally to inline variables that are used exactly once. See Note [Post-inline for single-use things]. * Allow Simplify.Iteration.simplAuxBind to inline used-once things. This is another part of Note [Post-inline for single-use things], and is really good for reducing simplifier iterations in situations like case K e of { K x -> blah } wher x is used once in blah. * Make GHC.Core.SimpleOpt.exprIsConApp_maybe do some simple case elimination. Note [Case elim in exprIsConApp_maybe] * Many new or rewritten Notes. E.g. Note [Avoiding simplifying repeatedly] Join points ~~~~~~~~~~~ * Be very careful about inlining join points. See Note [Duplicating join points] in GHC.Core.Opt.Simplify.Iteration * When making join points, don't do so if the join point is so small it will immediately be inlined; check uncondInlineJoin. * When considering inlining a join point, never do so unless there is a positive gain: see (DJ5) in Note [Duplicating join points]. * Do not float join points at all, except to top level. See GHC.Core.Opt.SetLevels.dontFloatNonRec * Do not add an unfolding to a join point at birth. This is a tricky one and has a long Note [Do not add unfoldings to join points at birth] It shows up in two places - In `mkDupableAlt` do not add an inlining - (trickier) In `simplLetUnfolding` don't add an unfolding for a fresh join point I am not fully satisifed with this, but it works and is well documented. * In GHC.Core.Unfold.sizeExpr, make jumps small, so that we don't penalise having a non-inlined join point. * Use plan A for dataToTag and tagToEnum I discovered that GHC.HsToCore.Pmc.Solver.Types.trvVarInfo was very delicately balanced. It's a small, heavily used, overloaded function and it's important that it inlines. By a fluke it was before, but at various times in my journey it stopped doing so. So I added an INLINE pragma to it. Metrics: compile_time/bytes allocated ------------------------------------------------ CoOpt_Singletons(normal) -8.2% GOOD LargeRecord(normal) -22.7% GOOD PmSeriesS(normal) -4.1% PmSeriesT(normal) -3.1% PmSeriesV(normal) -1.6% T11195(normal) -1.9% T12227(normal) -19.9% GOOD T12545(normal) -5.4% T12707(normal) -2.1% GOOD T13253-spj(normal) -13.1% GOOD T13386(normal) -1.6% T14766(normal) -2.2% GOOD T15630a(normal) NEW T15703(normal) -13.5% GOOD T16577(normal) -4.3% GOOD T17096(normal) -4.4% T17516(normal) -0.2% T18223(normal) -16.3% GOOD T18282(normal) -5.3% GOOD T18730(optasm) NEW T18923(normal) -3.7% GOOD T21839c(normal) -2.3% GOOD T3064(normal) -1.3% T5030(normal) -16.1% GOOD T5321Fun(normal) -1.5% T6048(optasm) -11.8% GOOD T783(normal) -1.4% T8095(normal) -5.9% GOOD T9630(normal) -5.1% GOOD T9020(optasm) +1.5% T18698a(normal) +1.5% BAD T14683(normal) +1.2% DsIncompleteRecSel3(normal) +1.2% MultiComponentModulesRecomp(normal) +1.0% MultiLayerModulesRecomp(normal) +1.9% MultiLayerModulesTH_Make(normal) +1.4% T10421(normal) +1.9% BAD T10421a(normal) +3.0% T13056(optasm) +1.1% T13253(normal) +1.0% T1969(normal) +1.1% BAD T15304(normal) +1.7% T9675(optasm) +1.2% T9961(normal) +2.4% BAD geo. mean -1.5% minimum -22.7% maximum +3.0% Metric Decrease: CoOpt_Singletons LargeRecord T12227 T12707 T12990 T13253-spj T13536a T14766 T15703 T16577 T18223 T18282 T18923 T21839c T5030 T6048 T8095 T9630 Metric Increase: T10421 T18698a T1969 T9961 - - - - - 47354ebd by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Improve postInlineUnconditionally This commit adds two things to postInlineUnconditionally: 1. Do not postInlineUnconditionally join point, ever. Doing so does not reduce allocation, which is the main point, and with join points that are used a lot it can bloat code. See point (1) of Note [Duplicating join points] in GHC.Core.Opt.Simplify.Iteration. 2. Do not postInlineUnconditionally a strict (demanded) binding. It will not allocate a thunk (it'll turn into a case instead) so again the main point of inlining it doesn't hold. Better to check per-call-site. - - - - - 871b220a by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 More wibbles * Inline join points whose RHS just calls another join point * Don't float join points at all (SetLevels) * Ensure that WorkWrap preserves lambda binders, in case of join points - - - - - a5233f5a by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Unused variable wibbles - - - - - 357baf70 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 More import wibbles - - - - - eecf517a by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 More imports - - - - - 10b0e737 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 More wibbles - - - - - 94fea9a2 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 More on floating join points * Get rid of the "join ceiling" which I have always hated * Float joins to top level in final pass only (needs documenting--see my GHC log) * Refactor wantToFloat so that it applies to Rec and NonRec uniformly - - - - - 56a7e908 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Comments about floating joins - - - - - 3b936b63 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Improve occurrence analyis for bottoming function calls See Note [Bottoming function calls] - - - - - 6c844a18 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Test output wibbles - - - - - 78d37b5e by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 More testsuite wibbles - - - - - 79e0fed4 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Float recursive joins to top level This seems be be a net win. Example joinrec { f x = ..f x'... } in f v Despite Note [Floating join point bindings] - - - - - c0a935d4 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Inline join points that have evaluated things at the use site. This helps quite a bit with wheel-sieve1. Example let x = <small thunk> in join $j = (x,y) in case z of A -> case x of P -> $j Q -> blah B -> x C -> True Here `x` can't be duplicated into the branches becuase it is used in both the join point and the A branch. But if we inline $j we get let x = <small thunk> in join $j = (x,y) in case z of A -> case x of x' P -> (x', y) Q -> blah B -> x C -> True and now we /can/ duplicate x into the branches. - - - - - a33476b9 by Simon Peyton Jones at 2024-03-08T11:41:36+00:00 Two small things * isConLikeUnfolding is false for OtherCon * Evaluated args look like NonTrivArg not ValueArg See GHC log 15 Feb - - - - - 22 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/upload_ghc_libs.py - CODEOWNERS - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d29435b5c97e38a1b2f639c76a74841b3f775764...a33476b9bdca731d1a90466fe866b417f2cdd09c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d29435b5c97e38a1b2f639c76a74841b3f775764...a33476b9bdca731d1a90466fe866b417f2cdd09c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 13:24:41 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 08:24:41 -0500 Subject: [Git][ghc/ghc][wip/T24515] 15 commits: Bump array submodule Message-ID: <65eb1199230f_18ccf2b36d87c72448@gitlab.mail> Ben Gamari pushed to branch wip/T24515 at Glasgow Haskell Compiler / GHC Commits: d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 9662651a by Ben Gamari at 2024-03-08T08:24:35-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 44922e4f by Cheng Shao at 2024-03-08T08:24:35-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.8.1-notes.rst - docs/users_guide/using-warnings.rst - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/Control/Exception.hs - + libraries/base/src/Control/Exception/Annotation.hs - + libraries/base/src/Control/Exception/Backtrace.hs - + libraries/base/src/Control/Exception/Context.hs - libraries/base/src/Data/Kind.hs - libraries/base/tests/IO/T21336/T21336a.stderr - libraries/base/tests/IO/T21336/T21336b.stderr - libraries/base/tests/IO/T4808.stderr - libraries/base/tests/IO/mkdirExists.stderr - libraries/base/tests/IO/openFile002.stderr - libraries/base/tests/IO/openFile002.stderr-mingw32 - libraries/base/tests/IO/withBinaryFile001.stderr - libraries/base/tests/IO/withBinaryFile002.stderr - libraries/base/tests/IO/withFile001.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3731e3a528143a87927802c7d8c35ba9088f6dfa...44922e4f735c8f3c3fa06e6b59d43ebaba9fa3c7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3731e3a528143a87927802c7d8c35ba9088f6dfa...44922e4f735c8f3c3fa06e6b59d43ebaba9fa3c7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 13:25:03 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Fri, 08 Mar 2024 08:25:03 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T22859 Message-ID: <65eb11afd7325_18ccf2b41132873016@gitlab.mail> Teo Camarasu pushed new branch wip/T22859 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T22859 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 13:26:26 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Fri, 08 Mar 2024 08:26:26 -0500 Subject: [Git][ghc/ghc][wip/T22859] Implement user-defined allocation limit handlers Message-ID: <65eb12025c802_18ccf2b4a8c0074812@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: d73943ab by Teo Camarasu at 2024-03-08T13:26:20+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 8 changed files: - libraries/ghc-experimental/ghc-experimental.cabal - + libraries/ghc-experimental/src/System/Mem/Experimental.hs - libraries/ghc-internal/ghc-internal.cabal - + libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs - rts/Prelude.h - rts/Schedule.c - rts/external-symbols.list.in - rts/include/rts/storage/GC.h Changes: ===================================== libraries/ghc-experimental/ghc-experimental.cabal ===================================== @@ -27,6 +27,7 @@ library Data.Tuple.Experimental Data.Sum.Experimental Prelude.Experimental + System.Mem.Experimental if arch(wasm32) exposed-modules: GHC.Wasm.Prim other-extensions: ===================================== libraries/ghc-experimental/src/System/Mem/Experimental.hs ===================================== @@ -0,0 +1,6 @@ +module System.Mem.Experimental + ( setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + ) + where +import GHC.Internal.AllocationLimitHandler ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -91,6 +91,7 @@ Library ghc-bignum >= 1.0 && < 2.0 exposed-modules: + GHC.Internal.AllocationLimitHandler GHC.Internal.ClosureTypes GHC.Internal.Control.Arrow GHC.Internal.Control.Category ===================================== libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs ===================================== @@ -0,0 +1,69 @@ +{-# LANGUAGE MagicHash #-} +{-# OPTIONS_HADDOCK not-home #-} +module GHC.Internal.AllocationLimitHandler + ( runAllocationLimitHandler + , setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + ) + where +import GHC.Internal.Foreign.C.Types +import GHC.Internal.Control.Monad (return, join) +import GHC.Internal.Data.IORef (IORef, readIORef, writeIORef, newIORef) +import GHC.Internal.IO (IO, unsafePerformIO) +import GHC.Internal.System.IO (print) +import GHC.Internal.Conc.Sync (ThreadId(..)) +import GHC.Internal.Base + + +{-# NOINLINE allocationLimitHandler #-} +allocationLimitHandler :: IORef (ThreadId -> IO ()) +allocationLimitHandler = unsafePerformIO (newIORef defaultHandler) + +defaultHandler :: ThreadId -> IO () +defaultHandler _ = pure () + +foreign import ccall "setAllocLimitKill" setAllocLimitKill :: CBool -> CBool -> IO () + +runAllocationLimitHandler :: ThreadId# -> IO () +runAllocationLimitHandler tid = do + hook <- getAllocationLimitHandler + hook $ ThreadId tid + +getAllocationLimitHandler :: IO (ThreadId -> IO ()) +getAllocationLimitHandler = readIORef allocationLimitHandler + +data AllocationLimitKillBehaviour = + KillOnAllocationLimit + -- ^ Throw a @AllocationLimitExceeded@ async exception to the thread when the + -- allocation limit is exceeded. + | DontKillOnAllocationLimit + -- ^ Do not throw an exception when the allocation limit is exceeded. + +-- | Define the behaviour for handling allocation limits. +-- By default we throw a @AllocationLimitExceeded@ async exception to the thread. +-- This can be controlled using @AllocationLimitKillBehaviour at . +-- +-- We can also run a user-specified handler, which can be done in addition to +-- or in place of the exception. +-- This allows for instance logging on the allocation limit being exceeded, +-- or dynamically determining whether to terminate the thread. +-- The handler is not guaranteed to run before the thread is terminated or restarted. +-- +-- Note: that if you don't terminate the thread, then the allocation limit gets +-- removed. +-- If you wish to keep the allocation limit you will have to reset it using +-- @setAllocationCounter@ and @enableAllocationLimit at . +setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> Maybe (ThreadId -> IO ()) -> IO () +setGlobalAllocationLimitHandler killBehaviour mHandler = do + shouldRunHandler <- case mHandler of + Just hook -> do + writeIORef allocationLimitHandler hook + pure 1 + Nothing -> do + writeIORef allocationLimitHandler defaultHandler + pure 0 + let shouldKill = + case killBehaviour of + KillOnAllocationLimit -> 1 + DontKillOnAllocationLimit -> 0 + setAllocLimitKill shouldKill shouldRunHandler ===================================== rts/Prelude.h ===================================== @@ -67,6 +67,7 @@ PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziWindows_processRemoteComplet PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure); PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure); +PRELUDE_CLOSURE(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure); PRELUDE_INFO(ghczmprim_GHCziCString_unpackCStringzh_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_con_info); @@ -102,6 +103,7 @@ PRELUDE_INFO(ghczminternal_GHCziInternalziStable_StablePtr_con_info); #if defined(mingw32_HOST_OS) #define processRemoteCompletion_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure) #endif +#define runAllocationLimitHandler_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure) #define flushStdHandles_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure) #define runMainIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure) ===================================== rts/Schedule.c ===================================== @@ -94,6 +94,10 @@ StgWord recent_activity = ACTIVITY_YES; */ StgWord sched_state = SCHED_RUNNING; + +bool allocLimitKill = true; +bool allocLimitRunHook = false; + /* * This mutex protects most of the global scheduler data in * the THREADED_RTS runtime. @@ -1118,14 +1122,31 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // the AllocationLimitExceeded exception. if (PK_Int64((W_*)&(t->alloc_limit)) < 0 && (t->flags & TSO_ALLOC_LIMIT)) { - // Use a throwToSelf rather than a throwToSingleThreaded, because - // it correctly handles the case where the thread is currently - // inside mask. Also the thread might be blocked (e.g. on an - // MVar), and throwToSingleThreaded doesn't unblock it - // correctly in that case. - throwToSelf(cap, t, allocationLimitExceeded_closure); - ASSIGN_Int64((W_*)&(t->alloc_limit), - (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + if(allocLimitKill) { + // Use a throwToSelf rather than a throwToSingleThreaded, because + // it correctly handles the case where the thread is currently + // inside mask. Also the thread might be blocked (e.g. on an + // MVar), and throwToSingleThreaded doesn't unblock it + // correctly in that case. + throwToSelf(cap, t, allocationLimitExceeded_closure); + ASSIGN_Int64((W_*)&(t->alloc_limit), + (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + } else { + // If we aren't killing the thread, we must disable the limit + // otherwise we will immediatelly retrigger it. + // User defined handlers should re-enable it if wanted. + t->flags = t->flags & ~TSO_ALLOC_LIMIT; + } + + if(allocLimitRunHook) + { + // Create a thread to run the allocation limit handler. + StgClosure* c = rts_apply(cap, runAllocationLimitHandler_closure, (StgClosure*)t); + StgTSO* hookThread = createIOThread(cap, RtsFlags.GcFlags.initialStkSize, c); + // Schedule the handler to be run immediatelly. + pushOnRunQueue(cap, hookThread); + } + } /* some statistics gathering in the parallel case */ @@ -3327,3 +3348,9 @@ resurrectThreads (StgTSO *threads) } } } + +void setAllocLimitKill(bool shouldKill, bool shouldHook) +{ + allocLimitKill = shouldKill; + allocLimitRunHook = shouldHook; +} ===================================== rts/external-symbols.list.in ===================================== @@ -38,6 +38,7 @@ ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure ghczminternal_GHCziInternalziTopHandler_runMainIO_closure +ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure ghczmprim_GHCziTypes_Czh_con_info ghczmprim_GHCziTypes_Izh_con_info ghczmprim_GHCziTypes_Fzh_con_info ===================================== rts/include/rts/storage/GC.h ===================================== @@ -209,6 +209,10 @@ void flushExec(W_ len, AdjustorExecutable exec_addr); // Used by GC checks in external .cmm code: extern W_ large_alloc_lim; +// Should triggering an allocation limit kill the thread +// and should we run a user-defined hook when it is triggered. +void setAllocLimitKill(bool, bool); + /* ----------------------------------------------------------------------------- Performing Garbage Collection -------------------------------------------------------------------------- */ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d73943ab91d0a2e202cb8096a048b3ae9423bca9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d73943ab91d0a2e202cb8096a048b3ae9423bca9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 13:30:33 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 08:30:33 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 7 commits: ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65eb12f98c042_18ccf2bb4d49877944@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 59d808d6 by Ben Gamari at 2024-03-08T08:27:26-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - d3f91b30 by Ben Gamari at 2024-03-08T08:27:35-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - 10a1be48 by Cheng Shao at 2024-03-08T08:27:48-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. (cherry picked from commit 44922e4f735c8f3c3fa06e6b59d43ebaba9fa3c7) - - - - - 5ebdf90a by Ben Gamari at 2024-03-08T08:27:54-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. (cherry picked from commit 9662651af3e5d24ae4e0bd275bdee1e718954c0b) - - - - - 1da0bdcb by Ben Gamari at 2024-03-08T08:28:58-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - 15 changed files: - .gitlab-ci.yml - libraries/base/src/Data/Kind.hs - libraries/ghc-internal/ghc-internal.cabal - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/include/rts/storage/ClosureMacros.h - testsuite/driver/testlib.py - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - testsuite/tests/rts/linker/T24171/all.T - testsuite/tests/rts/linker/all.T Changes: ===================================== .gitlab-ci.yml ===================================== @@ -2,7 +2,7 @@ variables: GIT_SSL_NO_VERIFY: "1" # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: 7f63b34ac87b85470eef9c668e9528e8e2f5b46a + DOCKER_REV: a9297a370025101b479cfd4977f8f910814e03ab # Sequential version number of all cached things. # Bump to invalidate GitLab CI cache. ===================================== libraries/base/src/Data/Kind.hs ===================================== @@ -1,4 +1,4 @@ -{-# LANGUAGE Safe #-} +{-# LANGUAGE Trustworthy #-} -- | -- @@ -19,4 +19,6 @@ module Data.Kind FUN ) where -import GHC.Internal.Data.Kind \ No newline at end of file +import GHC.Num.BigNat () -- for build ordering (#23942) +import GHC.Prim (FUN) +import GHC.Types (Type, Constraint) ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -120,7 +120,6 @@ Library GHC.Internal.Data.Functor.Utils GHC.Internal.Data.IORef GHC.Internal.Data.Ix - GHC.Internal.Data.Kind GHC.Internal.Data.List GHC.Internal.Data.Maybe GHC.Internal.Data.Monoid ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(stem, ".exe"); +#elif defined(wasm32_HOST_ARCH) + dropExtension(stem, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasm32_HOST_ARCH) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.hp.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else ===================================== testsuite/driver/testlib.py ===================================== @@ -2329,14 +2329,13 @@ def write_file(f: Path, s: str) -> None: async def check_hp_ok(name: TestName) -> bool: opts = getTestOpts() - actual_name = name + exe_extension() if not opts.ignore_extension else name # do not qualify for hp2ps because we should be in the right directory - hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {actual_name}'.format(**locals()) + hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {name}'.format(**locals()) hp2psResult = await runCmd(hp2psCmd, print_output=True) - actual_ps_path = in_testdir(actual_name, 'ps') + actual_ps_path = in_testdir(name, 'ps') if hp2psResult == 0: if actual_ps_path.exists(): @@ -2345,15 +2344,15 @@ async def check_hp_ok(name: TestName) -> bool: if (gsResult == 0): return True else: - print("hp2ps output for " + actual_name + " is not valid PostScript") + print("hp2ps output for " + name + " is not valid PostScript") return False else: return True # assume postscript is valid without ghostscript else: - print("hp2ps did not generate PostScript for " + actual_name) + print("hp2ps did not generate PostScript for " + name) return False else: - print("hp2ps error when processing heap profile for " + actual_name) + print("hp2ps error when processing heap profile for " + name) return False async def check_prof_ok(name: TestName, way: WayName) -> bool: @@ -2365,7 +2364,7 @@ async def check_prof_ok(name: TestName, way: WayName) -> bool: if not expected_prof_path.exists(): return True - actual_prof_file = add_suffix(name + exe_extension(), 'prof') + actual_prof_file = add_suffix(name, 'prof') actual_prof_path = in_testdir(actual_prof_file) if not actual_prof_path.exists(): ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/rts/linker/T24171/all.T ===================================== @@ -1,6 +1,7 @@ test('T24171', [req_rts_linker, req_profiling, - extra_files(['Lib.hs', 'main.c'])], + extra_files(['Lib.hs', 'main.c']), + fragile(24512)], makefile_test, ['clean_build_and_run']) ===================================== testsuite/tests/rts/linker/all.T ===================================== @@ -113,6 +113,7 @@ test('linker_unload_native', [extra_files(['LinkerUnload.hs', 'Test.hs']), req_rts_linker, unless(have_dynamic(), skip), + fragile(23993), when(opsys('darwin') or opsys('mingw32'), skip)], makefile_test, ['linker_unload_native']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2739c799d0a9e4534372feed1e6e2e2d5c1ad34d...1da0bdcb4adbf4eb7d0584c0d76aee83bc7f5166 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2739c799d0a9e4534372feed1e6e2e2d5c1ad34d...1da0bdcb4adbf4eb7d0584c0d76aee83bc7f5166 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 13:36:10 2024 From: gitlab at gitlab.haskell.org (Vladislav Zavialov (@int-index)) Date: Fri, 08 Mar 2024 08:36:10 -0500 Subject: [Git][ghc/ghc][wip/sand-witch/fix-tysyn] Fix compiler crash caused by implicit RHS quantification in type synonyms (24470) Message-ID: <65eb144a8ee89_18ccf2bef76707818c@gitlab.mail> Vladislav Zavialov pushed to branch wip/sand-witch/fix-tysyn at Glasgow Haskell Compiler / GHC Commits: 350f84ea by Andrei Borzenkov at 2024-03-08T16:34:35+03:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (24470) - - - - - 9 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1911,6 +1911,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accomodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2543,6 +2555,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3209,6 +3223,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4263,6 +4265,24 @@ data TcRnMessage where -} TcRnNamespacedFixitySigWithoutFlag :: FixitySig GhcPs -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accomodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accomodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -605,6 +605,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -911,3 +911,4 @@ test('T22788', normal, compile, ['']) test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accomodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -721,3 +721,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/350f84ea75f5c4ab69716ae9e42ebdcb3e5ecef1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/350f84ea75f5c4ab69716ae9e42ebdcb3e5ecef1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 14:00:27 2024 From: gitlab at gitlab.haskell.org (Vladislav Zavialov (@int-index)) Date: Fri, 08 Mar 2024 09:00:27 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/int-index/comment-illformed-type-pattern Message-ID: <65eb19fb45bf6_18ccf2ca4096486092@gitlab.mail> Vladislav Zavialov pushed new branch wip/int-index/comment-illformed-type-pattern at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/int-index/comment-illformed-type-pattern You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 14:13:15 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Fri, 08 Mar 2024 09:13:15 -0500 Subject: [Git][ghc/ghc][wip/T22859] 29 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65eb1cfb1415f_18ccf2cfc2978943f5@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 84ff1c78 by Teo Camarasu at 2024-03-08T14:13:08+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 30 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC/Builtin/Names.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Types/Basic.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Panic.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/runtime_control.rst - docs/users_guide/using-warnings.rst - hadrian/README.md - hadrian/src/CommandLine.hs - hadrian/src/Settings/Builders/Haddock.hs - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d73943ab91d0a2e202cb8096a048b3ae9423bca9...84ff1c78f642a373568d41fa24468e40a95d0ada -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d73943ab91d0a2e202cb8096a048b3ae9423bca9...84ff1c78f642a373568d41fa24468e40a95d0ada You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 14:45:54 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 09:45:54 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: base: Use strerror_r instead of strerror Message-ID: <65eb24a2b3ac5_18ccf2de523081024dd@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: fb6b99f9 by Ben Gamari at 2024-03-08T09:45:44-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - 3e90e2b1 by Jade at 2024-03-08T09:45:45-05:00 Error Messages: Improve response for illegal forall and GADT Syntax forall in a type with -XNoExplicitForAll used to suggest RankNTypes. In this patch this is changed to the correct ExplicitForAll. using a where in a data declaration with -XNoGADTSyntax used to suggest GADTs In this patch this is changed to the correct GADTSyntax. Fixes: #24448 - - - - - 16a41a21 by Jade at 2024-03-08T09:45:46-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - 38f45533 by Patrick at 2024-03-08T09:45:47-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - e6a1f2dc by Ben Gamari at 2024-03-08T09:45:48-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - libraries/base/changelog.md - + libraries/ghc-internal/cbits/strerror.c - libraries/ghc-internal/configure.ac - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/jsbits/errno.js - libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs - rts/linker/Elf.c - testsuite/tests/dependent/should_fail/T16326_Fail7.stderr - + testsuite/tests/hiefile/should_compile/T24493.hs - + testsuite/tests/hiefile/should_compile/T24493.stderr - testsuite/tests/hiefile/should_compile/all.T - testsuite/tests/module/mod98.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/T14189.stderr - testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr - testsuite/tests/parser/should_fail/ParserNoForallUnicode.stderr - testsuite/tests/parser/should_fail/T16270.stderr - + testsuite/tests/parser/should_fail/T17879a.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/21c7494d64fc83bcfbb3dbb4f8cb7965efb129cd...e6a1f2dc9e28e3a1cf35e688561d901693958707 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/21c7494d64fc83bcfbb3dbb4f8cb7965efb129cd...e6a1f2dc9e28e3a1cf35e688561d901693958707 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 15:57:01 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 10:57:01 -0500 Subject: [Git][ghc/ghc][wip/ipe-sharing] base: Do not expose whereFrom# from GHC.Exts Message-ID: <65eb354d6ceb7_3ea39f18b04d8160a0@gitlab.mail> Ben Gamari pushed to branch wip/ipe-sharing at Glasgow Haskell Compiler / GHC Commits: 411f5289 by Ben Gamari at 2024-03-08T10:56:43-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 10 changed files: - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/changelog.md ===================================== @@ -46,6 +46,7 @@ matches a `data` or `data instance` declaration) with all of its constructors in scope and the levity of `t` is statically known, then the constraint `DataToTag t` can always be solved. + * `GHC.Exts` no longer exports the GHC-internal `whereFrom#` primop ([CLC proposal #214](https://github.com/haskell/core-libraries-committee/issues/214)) * `GHC.InfoProv.InfoProv` now provides a `ipUnitId :: String` field encoding the unit ID of the unit defining the info table ([CLC proposal #214](https://github.com/haskell/core-libraries-committee/issues/214)) ([CLC proposal #104](https://github.com/haskell/core-libraries-committee/issues/104)) ===================================== libraries/base/src/GHC/Base.hs ===================================== @@ -139,7 +139,12 @@ module GHC.Base ) where import GHC.Internal.Base -import GHC.Prim hiding (dataToTagLarge#, dataToTagSmall#) +import GHC.Prim hiding (dataToTagLarge#, dataToTagSmall#, whereFrom#) + -- Hide dataToTagLarge# because it is expected to break for + -- GHC-internal reasons in the near future, and shouldn't + -- be exposed from base (not even GHC.Exts) + -- whereFrom# is similarly internal. + import GHC.Prim.Ext import GHC.Prim.PtrEq import GHC.Internal.Err ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -111,10 +111,11 @@ module GHC.Exts import GHC.Internal.Exts import GHC.Internal.ArrayArray -import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge# ) +import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge#, whereFrom# ) -- Hide dataToTag# ops because they are expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts) + -- whereFrom# is similarly internal. import GHC.Prim.Ext ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -315,7 +315,7 @@ import GHC.Classes hiding ( import GHC.CString import GHC.Magic import GHC.Magic.Dict -import GHC.Prim hiding (dataToTagSmall#, dataToTagLarge#) +import GHC.Prim hiding (dataToTagSmall#, dataToTagLarge#, whereFrom#) -- Hide dataToTag# ops because they are expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts) ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -133,10 +133,11 @@ module GHC.Internal.Exts maxTupleSize, ) where -import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge# ) - -- Hide dataToTag# ops because they are expected to break for +import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge#, whereFrom# ) + -- Hide dataToTagLarge# because it is expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts) + -- whereFrom# is similarly internal. import GHC.Types hiding ( IO -- Exported from "GHC.IO" ===================================== libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc ===================================== @@ -29,6 +29,7 @@ import GHC.Internal.IO.Encoding (utf8) import GHC.Internal.Foreign.Storable (peekByteOff) import GHC.Internal.ClosureTypes import GHC.Internal.Text.Read +import GHC.Prim (whereFrom##) data InfoProv = InfoProv { ipName :: String, ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -4755,7 +4755,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -6857,7 +6856,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -4755,7 +4755,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -6826,7 +6825,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -4758,7 +4758,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -7006,7 +7005,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -4755,7 +4755,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -6857,7 +6856,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> Addr# -> State# d -> (# State# d, Int# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/411f5289da39b5a4aacd07ba7532c23c0347694a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/411f5289da39b5a4aacd07ba7532c23c0347694a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 16:14:17 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Fri, 08 Mar 2024 11:14:17 -0500 Subject: [Git][ghc/ghc][wip/T22859] Implement user-defined allocation limit handlers Message-ID: <65eb3959a3593_3ea39f21f5818166ba@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: 44f95ed2 by Teo Camarasu at 2024-03-08T16:13:54+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 8 changed files: - libraries/ghc-experimental/ghc-experimental.cabal - + libraries/ghc-experimental/src/System/Mem/Experimental.hs - libraries/ghc-internal/ghc-internal.cabal - + libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs - rts/Prelude.h - rts/Schedule.c - rts/external-symbols.list.in - rts/include/rts/storage/GC.h Changes: ===================================== libraries/ghc-experimental/ghc-experimental.cabal ===================================== @@ -27,6 +27,7 @@ library Data.Tuple.Experimental Data.Sum.Experimental Prelude.Experimental + System.Mem.Experimental if arch(wasm32) exposed-modules: GHC.Wasm.Prim other-extensions: ===================================== libraries/ghc-experimental/src/System/Mem/Experimental.hs ===================================== @@ -0,0 +1,6 @@ +module System.Mem.Experimental + ( setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + ) + where +import GHC.Internal.AllocationLimitHandler ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -91,6 +91,7 @@ Library ghc-bignum >= 1.0 && < 2.0 exposed-modules: + GHC.Internal.AllocationLimitHandler GHC.Internal.ClosureTypes GHC.Internal.Control.Arrow GHC.Internal.Control.Category ===================================== libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs ===================================== @@ -0,0 +1,69 @@ +{-# LANGUAGE MagicHash #-} +{-# OPTIONS_HADDOCK not-home #-} +module GHC.Internal.AllocationLimitHandler + ( runAllocationLimitHandler + , setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + ) + where +import GHC.Internal.Foreign.C.Types +import GHC.Internal.Control.Monad (return, join) +import GHC.Internal.Data.IORef (IORef, readIORef, writeIORef, newIORef) +import GHC.Internal.IO (IO, unsafePerformIO) +import GHC.Internal.System.IO (print) +import GHC.Internal.Conc.Sync (ThreadId(..)) +import GHC.Internal.Base + + +{-# NOINLINE allocationLimitHandler #-} +allocationLimitHandler :: IORef (ThreadId -> IO ()) +allocationLimitHandler = unsafePerformIO (newIORef defaultHandler) + +defaultHandler :: ThreadId -> IO () +defaultHandler _ = pure () + +foreign import ccall "setAllocLimitKill" setAllocLimitKill :: CBool -> CBool -> IO () + +runAllocationLimitHandler :: ThreadId# -> IO () +runAllocationLimitHandler tid = do + hook <- getAllocationLimitHandler + hook $ ThreadId tid + +getAllocationLimitHandler :: IO (ThreadId -> IO ()) +getAllocationLimitHandler = readIORef allocationLimitHandler + +data AllocationLimitKillBehaviour = + KillOnAllocationLimit + -- ^ Throw a @AllocationLimitExceeded@ async exception to the thread when the + -- allocation limit is exceeded. + | DontKillOnAllocationLimit + -- ^ Do not throw an exception when the allocation limit is exceeded. + +-- | Define the behaviour for handling allocation limits. +-- By default we throw a @AllocationLimitExceeded@ async exception to the thread. +-- This can be controlled using @AllocationLimitKillBehaviour at . +-- +-- We can also run a user-specified handler, which can be done in addition to +-- or in place of the exception. +-- This allows for instance logging on the allocation limit being exceeded, +-- or dynamically determining whether to terminate the thread. +-- The handler is not guaranteed to run before the thread is terminated or restarted. +-- +-- Note: that if you don't terminate the thread, then the allocation limit gets +-- removed. +-- If you wish to keep the allocation limit you will have to reset it using +-- @setAllocationCounter@ and @enableAllocationLimit at . +setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> Maybe (ThreadId -> IO ()) -> IO () +setGlobalAllocationLimitHandler killBehaviour mHandler = do + shouldRunHandler <- case mHandler of + Just hook -> do + writeIORef allocationLimitHandler hook + pure 1 + Nothing -> do + writeIORef allocationLimitHandler defaultHandler + pure 0 + let shouldKill = + case killBehaviour of + KillOnAllocationLimit -> 1 + DontKillOnAllocationLimit -> 0 + setAllocLimitKill shouldKill shouldRunHandler ===================================== rts/Prelude.h ===================================== @@ -67,6 +67,7 @@ PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziWindows_processRemoteComplet PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure); PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure); +PRELUDE_CLOSURE(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure); PRELUDE_INFO(ghczmprim_GHCziCString_unpackCStringzh_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_con_info); @@ -102,6 +103,7 @@ PRELUDE_INFO(ghczminternal_GHCziInternalziStable_StablePtr_con_info); #if defined(mingw32_HOST_OS) #define processRemoteCompletion_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure) #endif +#define runAllocationLimitHandler_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure) #define flushStdHandles_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure) #define runMainIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure) ===================================== rts/Schedule.c ===================================== @@ -94,6 +94,10 @@ StgWord recent_activity = ACTIVITY_YES; */ StgWord sched_state = SCHED_RUNNING; + +bool allocLimitKill = true; +bool allocLimitRunHook = false; + /* * This mutex protects most of the global scheduler data in * the THREADED_RTS runtime. @@ -1118,14 +1122,31 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // the AllocationLimitExceeded exception. if (PK_Int64((W_*)&(t->alloc_limit)) < 0 && (t->flags & TSO_ALLOC_LIMIT)) { - // Use a throwToSelf rather than a throwToSingleThreaded, because - // it correctly handles the case where the thread is currently - // inside mask. Also the thread might be blocked (e.g. on an - // MVar), and throwToSingleThreaded doesn't unblock it - // correctly in that case. - throwToSelf(cap, t, allocationLimitExceeded_closure); - ASSIGN_Int64((W_*)&(t->alloc_limit), - (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + if(allocLimitKill) { + // Use a throwToSelf rather than a throwToSingleThreaded, because + // it correctly handles the case where the thread is currently + // inside mask. Also the thread might be blocked (e.g. on an + // MVar), and throwToSingleThreaded doesn't unblock it + // correctly in that case. + throwToSelf(cap, t, allocationLimitExceeded_closure); + ASSIGN_Int64((W_*)&(t->alloc_limit), + (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + } else { + // If we aren't killing the thread, we must disable the limit + // otherwise we will immediatelly retrigger it. + // User defined handlers should re-enable it if wanted. + t->flags = t->flags & ~TSO_ALLOC_LIMIT; + } + + if(allocLimitRunHook) + { + // Create a thread to run the allocation limit handler. + StgClosure* c = rts_apply(cap, runAllocationLimitHandler_closure, (StgClosure*)t); + StgTSO* hookThread = createIOThread(cap, RtsFlags.GcFlags.initialStkSize, c); + // Schedule the handler to be run immediatelly. + pushOnRunQueue(cap, hookThread); + } + } /* some statistics gathering in the parallel case */ @@ -3327,3 +3348,9 @@ resurrectThreads (StgTSO *threads) } } } + +void setAllocLimitKill(bool shouldKill, bool shouldHook) +{ + allocLimitKill = shouldKill; + allocLimitRunHook = shouldHook; +} ===================================== rts/external-symbols.list.in ===================================== @@ -38,6 +38,7 @@ ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure ghczminternal_GHCziInternalziTopHandler_runMainIO_closure +ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure ghczmprim_GHCziTypes_Czh_con_info ghczmprim_GHCziTypes_Izh_con_info ghczmprim_GHCziTypes_Fzh_con_info ===================================== rts/include/rts/storage/GC.h ===================================== @@ -209,6 +209,10 @@ void flushExec(W_ len, AdjustorExecutable exec_addr); // Used by GC checks in external .cmm code: extern W_ large_alloc_lim; +// Should triggering an allocation limit kill the thread +// and should we run a user-defined hook when it is triggered. +void setAllocLimitKill(bool, bool); + /* ----------------------------------------------------------------------------- Performing Garbage Collection -------------------------------------------------------------------------- */ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44f95ed2c9588e99d70fe1ceca2059ef8820735a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44f95ed2c9588e99d70fe1ceca2059ef8820735a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 16:21:52 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Fri, 08 Mar 2024 11:21:52 -0500 Subject: [Git][ghc/ghc][wip/T22859] Implement user-defined allocation limit handlers Message-ID: <65eb3b2088434_3ea39f23da32c18691@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: 4ab9de86 by Teo Camarasu at 2024-03-08T16:21:43+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 8 changed files: - libraries/ghc-experimental/ghc-experimental.cabal - + libraries/ghc-experimental/src/System/Mem/Experimental.hs - libraries/ghc-internal/ghc-internal.cabal - + libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs - rts/Prelude.h - rts/Schedule.c - rts/external-symbols.list.in - rts/include/rts/storage/GC.h Changes: ===================================== libraries/ghc-experimental/ghc-experimental.cabal ===================================== @@ -27,6 +27,7 @@ library Data.Tuple.Experimental Data.Sum.Experimental Prelude.Experimental + System.Mem.Experimental if arch(wasm32) exposed-modules: GHC.Wasm.Prim other-extensions: ===================================== libraries/ghc-experimental/src/System/Mem/Experimental.hs ===================================== @@ -0,0 +1,6 @@ +module System.Mem.Experimental + ( setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + ) + where +import GHC.Internal.AllocationLimitHandler ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -91,6 +91,7 @@ Library ghc-bignum >= 1.0 && < 2.0 exposed-modules: + GHC.Internal.AllocationLimitHandler GHC.Internal.ClosureTypes GHC.Internal.Control.Arrow GHC.Internal.Control.Category ===================================== libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs ===================================== @@ -0,0 +1,67 @@ +{-# LANGUAGE MagicHash #-} +{-# OPTIONS_HADDOCK not-home #-} +module GHC.Internal.AllocationLimitHandler + ( runAllocationLimitHandler + , setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + ) + where +import GHC.Internal.Foreign.C.Types +import GHC.Internal.Data.IORef (IORef, readIORef, writeIORef, newIORef) +import GHC.Internal.IO (unsafePerformIO) +import GHC.Internal.Conc.Sync (ThreadId(..)) +import GHC.Internal.Base + + +{-# NOINLINE allocationLimitHandler #-} +allocationLimitHandler :: IORef (ThreadId -> IO ()) +allocationLimitHandler = unsafePerformIO (newIORef defaultHandler) + +defaultHandler :: ThreadId -> IO () +defaultHandler _ = pure () + +foreign import ccall "setAllocLimitKill" setAllocLimitKill :: CBool -> CBool -> IO () + +runAllocationLimitHandler :: ThreadId# -> IO () +runAllocationLimitHandler tid = do + hook <- getAllocationLimitHandler + hook $ ThreadId tid + +getAllocationLimitHandler :: IO (ThreadId -> IO ()) +getAllocationLimitHandler = readIORef allocationLimitHandler + +data AllocationLimitKillBehaviour = + KillOnAllocationLimit + -- ^ Throw a @AllocationLimitExceeded@ async exception to the thread when the + -- allocation limit is exceeded. + | DontKillOnAllocationLimit + -- ^ Do not throw an exception when the allocation limit is exceeded. + +-- | Define the behaviour for handling allocation limits. +-- By default we throw a @AllocationLimitExceeded@ async exception to the thread. +-- This can be controlled using @AllocationLimitKillBehaviour at . +-- +-- We can also run a user-specified handler, which can be done in addition to +-- or in place of the exception. +-- This allows for instance logging on the allocation limit being exceeded, +-- or dynamically determining whether to terminate the thread. +-- The handler is not guaranteed to run before the thread is terminated or restarted. +-- +-- Note: that if you don't terminate the thread, then the allocation limit gets +-- removed. +-- If you wish to keep the allocation limit you will have to reset it using +-- @setAllocationCounter@ and @enableAllocationLimit at . +setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> Maybe (ThreadId -> IO ()) -> IO () +setGlobalAllocationLimitHandler killBehaviour mHandler = do + shouldRunHandler <- case mHandler of + Just hook -> do + writeIORef allocationLimitHandler hook + pure 1 + Nothing -> do + writeIORef allocationLimitHandler defaultHandler + pure 0 + let shouldKill = + case killBehaviour of + KillOnAllocationLimit -> 1 + DontKillOnAllocationLimit -> 0 + setAllocLimitKill shouldKill shouldRunHandler ===================================== rts/Prelude.h ===================================== @@ -67,6 +67,7 @@ PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziWindows_processRemoteComplet PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure); PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure); +PRELUDE_CLOSURE(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure); PRELUDE_INFO(ghczmprim_GHCziCString_unpackCStringzh_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_con_info); @@ -102,6 +103,7 @@ PRELUDE_INFO(ghczminternal_GHCziInternalziStable_StablePtr_con_info); #if defined(mingw32_HOST_OS) #define processRemoteCompletion_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure) #endif +#define runAllocationLimitHandler_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure) #define flushStdHandles_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure) #define runMainIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure) ===================================== rts/Schedule.c ===================================== @@ -94,6 +94,10 @@ StgWord recent_activity = ACTIVITY_YES; */ StgWord sched_state = SCHED_RUNNING; + +bool allocLimitKill = true; +bool allocLimitRunHook = false; + /* * This mutex protects most of the global scheduler data in * the THREADED_RTS runtime. @@ -1118,14 +1122,31 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // the AllocationLimitExceeded exception. if (PK_Int64((W_*)&(t->alloc_limit)) < 0 && (t->flags & TSO_ALLOC_LIMIT)) { - // Use a throwToSelf rather than a throwToSingleThreaded, because - // it correctly handles the case where the thread is currently - // inside mask. Also the thread might be blocked (e.g. on an - // MVar), and throwToSingleThreaded doesn't unblock it - // correctly in that case. - throwToSelf(cap, t, allocationLimitExceeded_closure); - ASSIGN_Int64((W_*)&(t->alloc_limit), - (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + if(allocLimitKill) { + // Use a throwToSelf rather than a throwToSingleThreaded, because + // it correctly handles the case where the thread is currently + // inside mask. Also the thread might be blocked (e.g. on an + // MVar), and throwToSingleThreaded doesn't unblock it + // correctly in that case. + throwToSelf(cap, t, allocationLimitExceeded_closure); + ASSIGN_Int64((W_*)&(t->alloc_limit), + (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + } else { + // If we aren't killing the thread, we must disable the limit + // otherwise we will immediatelly retrigger it. + // User defined handlers should re-enable it if wanted. + t->flags = t->flags & ~TSO_ALLOC_LIMIT; + } + + if(allocLimitRunHook) + { + // Create a thread to run the allocation limit handler. + StgClosure* c = rts_apply(cap, runAllocationLimitHandler_closure, (StgClosure*)t); + StgTSO* hookThread = createIOThread(cap, RtsFlags.GcFlags.initialStkSize, c); + // Schedule the handler to be run immediatelly. + pushOnRunQueue(cap, hookThread); + } + } /* some statistics gathering in the parallel case */ @@ -3327,3 +3348,9 @@ resurrectThreads (StgTSO *threads) } } } + +void setAllocLimitKill(bool shouldKill, bool shouldHook) +{ + allocLimitKill = shouldKill; + allocLimitRunHook = shouldHook; +} ===================================== rts/external-symbols.list.in ===================================== @@ -38,6 +38,7 @@ ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure ghczminternal_GHCziInternalziTopHandler_runMainIO_closure +ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure ghczmprim_GHCziTypes_Czh_con_info ghczmprim_GHCziTypes_Izh_con_info ghczmprim_GHCziTypes_Fzh_con_info ===================================== rts/include/rts/storage/GC.h ===================================== @@ -209,6 +209,10 @@ void flushExec(W_ len, AdjustorExecutable exec_addr); // Used by GC checks in external .cmm code: extern W_ large_alloc_lim; +// Should triggering an allocation limit kill the thread +// and should we run a user-defined hook when it is triggered. +void setAllocLimitKill(bool, bool); + /* ----------------------------------------------------------------------------- Performing Garbage Collection -------------------------------------------------------------------------- */ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ab9de86d91015e3675d26b75f5ad21250dcd852 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ab9de86d91015e3675d26b75f5ad21250dcd852 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 17:00:59 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 12:00:59 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/T24512 Message-ID: <65eb444b26ba4_3ea39f36c34ac2332b@gitlab.mail> Ben Gamari pushed new branch wip/T24512 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24512 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 18:56:53 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 13:56:53 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: base: Use strerror_r instead of strerror Message-ID: <65eb5f75276ae_3ea39f6ac9044529c5@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 2f7121b9 by Ben Gamari at 2024-03-08T13:56:35-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - f5898080 by Jade at 2024-03-08T13:56:36-05:00 Error Messages: Improve response for illegal forall and GADT Syntax forall in a type with -XNoExplicitForAll used to suggest RankNTypes. In this patch this is changed to the correct ExplicitForAll. using a where in a data declaration with -XNoGADTSyntax used to suggest GADTs In this patch this is changed to the correct GADTSyntax. Fixes: #24448 - - - - - 0d33112f by Jade at 2024-03-08T13:56:37-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - f646f65c by Patrick at 2024-03-08T13:56:38-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 0af6b5ea by Ben Gamari at 2024-03-08T13:56:38-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 33f16f40 by Cheng Shao at 2024-03-08T13:56:38-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - a7c876e3 by Ben Gamari at 2024-03-08T13:56:39-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - libraries/base/changelog.md - + libraries/ghc-internal/cbits/strerror.c - libraries/ghc-internal/configure.ac - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/jsbits/errno.js - libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/linker/Elf.c - testsuite/driver/testlib.py - testsuite/tests/dependent/should_fail/T16326_Fail7.stderr - + testsuite/tests/hiefile/should_compile/T24493.hs - + testsuite/tests/hiefile/should_compile/T24493.stderr - testsuite/tests/hiefile/should_compile/all.T - testsuite/tests/module/mod98.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e6a1f2dc9e28e3a1cf35e688561d901693958707...a7c876e35ee0998bba256d4bf0808750d57dc7b4 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e6a1f2dc9e28e3a1cf35e688561d901693958707...a7c876e35ee0998bba256d4bf0808750d57dc7b4 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 19:38:06 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 14:38:06 -0500 Subject: [Git][ghc/ghc][wip/T24512] 4 commits: ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65eb691ee06c2_2fe318aee12458421@gitlab.mail> Ben Gamari pushed to branch wip/T24512 at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - dbb0be97 by Ben Gamari at 2024-03-08T14:37:41-05:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 0c6dc060 by Ben Gamari at 2024-03-08T14:37:59-05:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 11 changed files: - libraries/base/src/Data/Kind.hs - libraries/ghc-internal/ghc-internal.cabal - rts/CheckUnload.c - rts/Linker.c - rts/LinkerInternals.h - rts/include/rts/storage/ClosureMacros.h - rts/linker/Elf.c - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 Changes: ===================================== libraries/base/src/Data/Kind.hs ===================================== @@ -1,4 +1,4 @@ -{-# LANGUAGE Safe #-} +{-# LANGUAGE Trustworthy #-} -- | -- @@ -19,4 +19,6 @@ module Data.Kind FUN ) where -import GHC.Internal.Data.Kind \ No newline at end of file +import GHC.Num.BigNat () -- for build ordering (#23942) +import GHC.Prim (FUN) +import GHC.Types (Type, Constraint) ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -120,7 +120,6 @@ Library GHC.Internal.Data.Functor.Utils GHC.Internal.Data.IORef GHC.Internal.Data.Ix - GHC.Internal.Data.Kind GHC.Internal.Data.List GHC.Internal.Data.Maybe GHC.Internal.Data.Monoid ===================================== rts/CheckUnload.c ===================================== @@ -165,6 +165,18 @@ ObjectCode *loaded_objects; // map static closures to their ObjectCode. static OCSectionIndices *global_s_indices = NULL; +// Is it safe for us to unload code? +static bool safeToUnload(void) +{ + if (RtsFlags.ProfFlags.doHeapProfile != NO_HEAP_PROFILING) { + // We mustn't unload anything as the heap census may contain + // references into static data (e.g. cost centre names). + // See #24512. + return false; + } + return true; +} + static OCSectionIndices *createOCSectionIndices(void) { // TODO (osa): Maybe initialize as empty (without allocation) and allocate @@ -457,6 +469,8 @@ void checkUnload(void) { if (global_s_indices == NULL) { return; + } else if (!safeToUnload()) { + return; } // At this point we've marked all dynamically loaded static objects @@ -478,8 +492,6 @@ void checkUnload(void) next = oc->next; ASSERT(oc->status == OBJECT_UNLOADED); - removeOCSectionIndices(s_indices, oc); - // Symbols should be removed by unloadObj_. // NB (osa): If this assertion doesn't hold then freeObjectCode below // will corrupt symhash as keys of that table live in ObjectCodes. If @@ -487,8 +499,17 @@ void checkUnload(void) // RTS) then it's probably because this assertion did not hold. ASSERT(oc->symbols == NULL); - freeObjectCode(oc); - n_unloaded_objects -= 1; + if (oc->unloadable) { + removeOCSectionIndices(s_indices, oc); + freeObjectCode(oc); + n_unloaded_objects -= 1; + } else { + // If we don't have enough information to + // accurately determine the reachability of + // the object then hold onto it. + oc->next = objects; + objects = oc; + } } old_objects = NULL; ===================================== rts/Linker.c ===================================== @@ -1385,6 +1385,7 @@ mkOc( ObjectType type, pathchar *path, char *image, int imageSize, oc->prev = NULL; oc->next_loaded_object = NULL; oc->mark = object_code_mark_bit; + oc->unloadable = false; oc->dependencies = allocHashSet(); #if defined(NEED_M32) @@ -1527,6 +1528,12 @@ preloadObjectFile (pathchar *path) /* FIXME (AP): =mapped= parameter unconditionally set to true */ oc = mkOc(STATIC_OBJECT, path, image, fileSize, true, NULL, misalignment); + /* assume that static objects are safely unloadable since + * we have know of all references to symbols provided by + * the object. These are tracked by lookupDependentSymbol. + */ + oc->unloadable = true; + #if defined(OBJFORMAT_MACHO) if (ocVerifyImage_MachO( oc )) ocInit_MachO( oc ); ===================================== rts/LinkerInternals.h ===================================== @@ -313,8 +313,14 @@ struct _ObjectCode { struct _ObjectCode *next_loaded_object; // Mark bit + // N.B. This is a full word as we CAS it. StgWord mark; + // Can this object be safely unloaded? Not true for + // dynamic objects when dlinfo is not available as + // we cannot determine liveness. + bool unloadable; + // Set of dependencies (ObjectCode*) of the object file. Traverse // dependencies using `iterHashTable`. // @@ -376,7 +382,9 @@ struct _ObjectCode { /* handle returned from dlopen */ void *dlopen_handle; - /* virtual memory ranges of loaded code */ + /* virtual memory ranges of loaded code. NULL if no range information is + * available (e.g. if dlinfo is unavailable on the current platform). + */ NativeCodeRange *nc_ranges; }; ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) #if defined(PROFILING) /* The following macro works for both retainer profiling and LDV profiling. For - retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set - 'rs' to zero. - - Note that we don't have to bother handling the 'flip' bit properly[1] since the - retainer profiling code will just set 'rs' to NULL upon visiting a closure with - an invalid 'flip' bit anyways. - - See Note [Profiling heap traversal visited bit] for details. - - [1]: Technically we should set 'rs' to `NULL | flip`. + retainer profiling, we set 'trav' to 0, which is an invalid + RetainerSet. */ + /* MP: Various other places use the check era > 0 to check whether LDV profiling is enabled. The use of these predicates here is the reason for including RtsFlags.h in @@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) */ #define SET_PROF_HDR(c, ccs_) \ { \ - (c)->header.prof.ccs = ccs_; \ - if (doingLDVProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - } \ -\ - if (doingRetainerProfiling()) { \ - LDV_RECORD_CREATE((c)); \ - }; \ - if (doingErasProfiling()){ \ - ERA_RECORD_CREATE((c)); \ - }; \ + (c)->header.prof.ccs = ccs_; \ + if (doingLDVProfiling()) { \ + LDV_RECORD_CREATE((c)); \ + } else if (doingRetainerProfiling()) { \ + (c)->header.prof.hp.trav = 0; \ + } else if (doingErasProfiling()){ \ + ERA_RECORD_CREATE((c)); \ + } \ } #else ===================================== rts/linker/Elf.c ===================================== @@ -2190,6 +2190,10 @@ void * loadNativeObj_ELF (pathchar *path, char **errmsg) copyErrmsg(errmsg, "dl_iterate_phdr failed to find obj"); goto dl_iterate_phdr_fail; } + nc->unloadable = true; +#else + nc->nc_ranges = NULL; + nc->unloadable = false; #endif /* defined (HAVE_DLINFO) */ insertOCSectionIndices(nc); ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -1276,7 +1276,7 @@ module Data.Ix where {-# MINIMAL range, (index | GHC.Internal.Ix.unsafeIndex), inRange #-} module Data.Kind where - -- Safety: Safe + -- Safety: Trustworthy type Constraint :: * type Constraint = GHC.Prim.CONSTRAINT GHC.Types.LiftedRep type role FUN nominal representational representational View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7d3edc79eb17250515550344f3d75cf897eae880...0c6dc060c39a14e4eb4679aab655c2bcd32a87df -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7d3edc79eb17250515550344f3d75cf897eae880...0c6dc060c39a14e4eb4679aab655c2bcd32a87df You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 20:04:24 2024 From: gitlab at gitlab.haskell.org (Vladislav Zavialov (@int-index)) Date: Fri, 08 Mar 2024 15:04:24 -0500 Subject: [Git][ghc/ghc][wip/int-index/comment-illformed-type-pattern] Drop outdated comment on TcRnIllformedTypePattern Message-ID: <65eb6f48799dd_2fe31817789e465839@gitlab.mail> Vladislav Zavialov pushed to branch wip/int-index/comment-illformed-type-pattern at Glasgow Haskell Compiler / GHC Commits: b79a9071 by Vladislav Zavialov at 2024-03-08T23:04:14+03:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - 6 changed files: - compiler/GHC/Tc/Errors/Types.hs - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.hs - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.stderr - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.hs - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.stderr - testsuite/tests/vdq-rta/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -4129,19 +4129,15 @@ data TcRnMessage where corresponding to a required type argument (visible forall) does not have a form that can be interpreted as a type pattern. - At the moment, only patterns constructed using the @type@ keyword - are considered well-formed, but this restriction will be relaxed - when part 2 of GHC Proposal #281 is implemented. - Example: vfun :: forall (a :: k) -> () - vfun x = () - -- ^ - -- expected `type x` instead of `x` + vfun !x = () + -- ^^ + -- bang-patterns not allowed as type patterns Test cases: - T22326_fail_raw_pat + T22326_fail_bang_pat -} TcRnIllformedTypePattern :: !(Pat GhcRn) -> TcRnMessage @@ -4173,7 +4169,7 @@ data TcRnMessage where -- lambdas not allowed in type arguments Test cases: - T22326_fail_raw_arg + T22326_fail_lam_arg -} TcRnIllformedTypeArgument :: !(LHsExpr GhcRn) -> TcRnMessage ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.hs ===================================== @@ -1,6 +1,6 @@ {-# LANGUAGE RequiredTypeArguments #-} -module T22326_fail_raw_pat where +module T22326_fail_bang_pat where f :: forall (a :: k) -> () f !x = () \ No newline at end of file ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.stderr ===================================== @@ -1,5 +1,5 @@ -T22326_fail_raw_pat.hs:6:3: error: [GHC-88754] +T22326_fail_bang_pat.hs:6:3: error: [GHC-88754] • Ill-formed type pattern: !x • In the pattern: !x In an equation for ‘f’: f !x = () ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.hs ===================================== @@ -1,7 +1,7 @@ {-# LANGUAGE ExplicitNamespaces #-} {-# LANGUAGE RequiredTypeArguments #-} -module T22326_fail_raw_arg where +module T22326_fail_lam_arg where f :: forall (a :: k) -> () f (type _) = () ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.stderr ===================================== @@ -1,5 +1,5 @@ -T22326_fail_raw_arg.hs:9:5: error: [GHC-29092] +T22326_fail_lam_arg.hs:9:5: error: [GHC-29092] • Ill-formed type argument: \ _ -> _ • In the expression: f (\ _ -> _) In an equation for ‘x’: x = f (\ _ -> _) ===================================== testsuite/tests/vdq-rta/should_fail/all.T ===================================== @@ -3,8 +3,8 @@ test('T22326_fail_ext2', normal, compile_fail, ['']) test('T22326_fail_top', normal, compile_fail, ['']) test('T22326_fail_app', normal, compile_fail, ['']) test('T22326_fail_notInScope', normal, compile_fail, ['']) -test('T22326_fail_raw_pat', normal, compile_fail, ['']) -test('T22326_fail_raw_arg', normal, compile_fail, ['']) +test('T22326_fail_bang_pat', normal, compile_fail, ['']) +test('T22326_fail_lam_arg', normal, compile_fail, ['']) test('T22326_fail_pat', normal, compile_fail, ['']) test('T22326_fail_nonlinear', normal, compile_fail, ['']) test('T22326_fail_caseof', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b79a9071bd9a8f1de378567320c112ea05822a1c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b79a9071bd9a8f1de378567320c112ea05822a1c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 20:22:18 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 15:22:18 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 3 commits: configure: Bump version to 9.10 Message-ID: <65eb737aa23de_2fe31822b790469331@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: cdb256b0 by Ben Gamari at 2024-03-08T10:38:53-05:00 configure: Bump version to 9.10 - - - - - 53b7a1fb by Ben Gamari at 2024-03-08T11:15:25-05:00 Bump transformers submodule to 0.6.1.1 - - - - - ea2615f4 by Ben Gamari at 2024-03-08T15:19:21-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - 3 changed files: - configure.ac - libraries/transformers - testsuite/tests/rts/T18623/all.T Changes: ===================================== configure.ac ===================================== @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.9], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.10.0], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Version on master must be X.Y (not X.Y.Z) for ProjectVersionMunged variable # to be useful (cf #19058). However, the version must have three components # (X.Y.Z) on stable branches (e.g. ghc-9.2) to ensure that pre-releases are ===================================== libraries/transformers ===================================== @@ -1 +1 @@ -Subproject commit ef4fa181ebea77ac6997d392d1ef5a09524f06b2 +Subproject commit ba3503905dec072acc6515323c884706efd4dbb4 ===================================== testsuite/tests/rts/T18623/all.T ===================================== @@ -8,7 +8,7 @@ test('T18623', # Recent versions of osx report an error when running `ulimit -v` when(opsys('darwin'), skip), when(arch('powerpc64le'), skip), - cmd_prefix('ulimit -v ' + str(1024 ** 2) + ' && '), + cmd_prefix('ulimit -v ' + str(8 * 1024 ** 2) + ' && '), ignore_stdout], run_command, ['{compiler} --version']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1da0bdcb4adbf4eb7d0584c0d76aee83bc7f5166...ea2615f4d12f8d4fa5a1fe3824ed9a2ee588469f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1da0bdcb4adbf4eb7d0584c0d76aee83bc7f5166...ea2615f4d12f8d4fa5a1fe3824ed9a2ee588469f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 20:53:47 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 15:53:47 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 13 commits: base: Use strerror_r instead of strerror Message-ID: <65eb7adbab1b2_2fe3183170a407481b@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 2f7121b9 by Ben Gamari at 2024-03-08T13:56:35-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - f5898080 by Jade at 2024-03-08T13:56:36-05:00 Error Messages: Improve response for illegal forall and GADT Syntax forall in a type with -XNoExplicitForAll used to suggest RankNTypes. In this patch this is changed to the correct ExplicitForAll. using a where in a data declaration with -XNoGADTSyntax used to suggest GADTs In this patch this is changed to the correct GADTSyntax. Fixes: #24448 - - - - - 0d33112f by Jade at 2024-03-08T13:56:37-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - f646f65c by Patrick at 2024-03-08T13:56:38-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 0af6b5ea by Ben Gamari at 2024-03-08T13:56:38-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 33f16f40 by Cheng Shao at 2024-03-08T13:56:38-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - a7c876e3 by Ben Gamari at 2024-03-08T13:56:39-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - c2c039ae by Ben Gamari at 2024-03-08T15:52:01-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 8c456113 by Ben Gamari at 2024-03-08T15:52:01-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - 773c4d58 by Ben Gamari at 2024-03-08T15:52:01-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - 9f2df4c4 by Ben Gamari at 2024-03-08T15:52:01-05:00 configure: Bump version to 9.10 - - - - - 4913e54c by Ben Gamari at 2024-03-08T15:52:01-05:00 Bump transformers submodule to 0.6.1.1 - - - - - ec4d01fe by Ben Gamari at 2024-03-08T15:52:01-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - 30 changed files: - .gitlab-ci.yml - compiler/GHC.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - configure.ac - libraries/base/changelog.md - + libraries/ghc-internal/cbits/strerror.c - libraries/ghc-internal/configure.ac - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/jsbits/errno.js - libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs - libraries/transformers - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/linker/Elf.c - testsuite/driver/testlib.py - testsuite/tests/dependent/should_fail/T16326_Fail7.stderr - + testsuite/tests/hiefile/should_compile/T24493.hs - + testsuite/tests/hiefile/should_compile/T24493.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ea2615f4d12f8d4fa5a1fe3824ed9a2ee588469f...ec4d01feec804f80aef03f97f75f9095903e65d5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ea2615f4d12f8d4fa5a1fe3824ed9a2ee588469f...ec4d01feec804f80aef03f97f75f9095903e65d5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 23:08:34 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 18:08:34 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 7 commits: configure: Bump version to 9.10 Message-ID: <65eb9a72bcf85_2fe31868defa48352d@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 2a9e11c8 by Ben Gamari at 2024-03-08T17:43:04-05:00 configure: Bump version to 9.10 - - - - - feb08492 by Ben Gamari at 2024-03-08T17:43:04-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 02b9731a by Ben Gamari at 2024-03-08T17:43:04-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - 5c75d647 by Ben Gamari at 2024-03-08T17:44:31-05:00 base: Bump version to 4.20.0.0 - - - - - 56e18b26 by Ben Gamari at 2024-03-08T17:44:31-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 7c25cc05 by Ben Gamari at 2024-03-08T17:44:31-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 9b97d2c4 by Ben Gamari at 2024-03-08T17:44:31-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 30 changed files: - compiler/ghc.cabal.in - configure.ac - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal - libraries/ghc-boot-th/ghc-boot-th.cabal.in - libraries/ghc-boot/ghc-boot.cabal.in - libraries/ghc-compact/ghc-compact.cabal - libraries/ghc-experimental/ghc-experimental.cabal - libraries/ghc-heap/ghc-heap.cabal.in - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-prim/ghc-prim.cabal - libraries/ghci/ghci.cabal.in - libraries/haskeline - libraries/hpc - libraries/os-string - libraries/parsec - libraries/process - libraries/semaphore-compat - libraries/stm - libraries/template-haskell/template-haskell.cabal.in - libraries/terminfo - libraries/text - libraries/transformers - libraries/unix The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ec4d01feec804f80aef03f97f75f9095903e65d5...9b97d2c46e2d86ba4af9c10ece9e1b29553657cc -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ec4d01feec804f80aef03f97f75f9095903e65d5...9b97d2c46e2d86ba4af9c10ece9e1b29553657cc You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 23:27:26 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 18:27:26 -0500 Subject: [Git][ghc/ghc][master] base: Use strerror_r instead of strerror Message-ID: <65eb9edea1118_2fe31877ba69088934@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - 6 changed files: - libraries/base/changelog.md - + libraries/ghc-internal/cbits/strerror.c - libraries/ghc-internal/configure.ac - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/jsbits/errno.js - libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs Changes: ===================================== libraries/base/changelog.md ===================================== @@ -28,6 +28,7 @@ and [CLC proposal #258](https://github.com/haskell/core-libraries-committee/issues/258)) * Add `System.Mem.performMajorGC` ([CLC proposal #230](https://github.com/haskell/core-libraries-committee/issues/230)) * Fix exponent overflow/underflow bugs in the `Read` instances for `Float` and `Double` ([CLC proposal #192](https://github.com/haskell/core-libraries-committee/issues/192)) + * `Foreign.C.Error.errnoToIOError` now uses the reentrant `strerror_r` to render system errors when possible ([CLC proposal #249](https://github.com/haskell/core-libraries-committee/issues/249)) * Implement `many` and `some` methods of `instance Alternative (Compose f g)` explicitly. ([CLC proposal #181](https://github.com/haskell/core-libraries-committee/issues/181)) * Change the types of the `GHC.Stack.StackEntry.closureType` and `GHC.InfoProv.InfoProv.ipDesc` record fields to use `GHC.Exts.Heap.ClosureType` rather than an `Int`. To recover the old value use `fromEnum`. ([CLC proposal #210](https://github.com/haskell/core-libraries-committee/issues/210)) ===================================== libraries/ghc-internal/cbits/strerror.c ===================================== @@ -0,0 +1,29 @@ +// glibc will only expose the POSIX strerror_r if this is defined. +#define _POSIX_C_SOURCE 200112L + +#include +#include + +// This must be included after lest _GNU_SOURCE may be defined. +#include "HsBaseConfig.h" + +// returns zero on success +int base_strerror_r(int errnum, char *ptr, size_t buflen) +{ +#if defined(HAVE_STRERROR_R) + int ret = strerror_r(errnum, ptr, buflen); + if (ret == ERANGE) { + // Ellipsize the error + ptr[buflen-4] = '.'; + ptr[buflen-3] = '.'; + ptr[buflen-2] = '.'; + ret = 0; + } + return ret; +#elif defined(HAVE_STRERROR_S) + strerror_s(ptr, buflen, errnum); + return 0; +#else +#error neither strerror_r nor strerror_s are supported +#endif +} ===================================== libraries/ghc-internal/configure.ac ===================================== @@ -41,6 +41,12 @@ AC_CHECK_DECLS([CLOCK_PROCESS_CPUTIME_ID], [], [], [[#include ]]) AC_CHECK_FUNCS([getclock getrusage times]) AC_CHECK_FUNCS([_chsize_s ftruncate]) +AC_CHECK_FUNCS([strerror_r strerror_s]) + +if test "$ac_cv_func_strerror_r" = no && test "$ac_cv_func_strerror_s" = no; then + AC_MSG_ERROR([Either strerror_r or strerror_s must be available]) +fi + # event-related fun # The line below already defines HAVE_KQUEUE and HAVE_POLL, so technically some of the # subsequent portions that redefine them could be skipped. However, we keep those portions ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -330,6 +330,7 @@ Library cbits/primFloat.c cbits/sysconf.c cbits/fs.c + cbits/strerror.c cmm-sources: cbits/StackCloningDecoding.cmm ===================================== libraries/ghc-internal/jsbits/errno.js ===================================== @@ -22,7 +22,7 @@ function h$unsupported(status, c) { return status; } -function h$strerror(err) { +function h$base_strerror(err) { if(err === 12456) { RETURN_UBX_TUP2(h$encodeUtf8("operation unsupported on this platform"), 0); } ===================================== libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs ===================================== @@ -91,6 +91,9 @@ module GHC.Internal.Foreign.C.Error ( #include "HsBaseConfig.h" import GHC.Internal.Foreign.Ptr +#if !defined(javascript_HOST_ARCH) +import GHC.Internal.Foreign.Marshal.Alloc +#endif import GHC.Internal.Foreign.C.Types import GHC.Internal.Foreign.C.String import GHC.Internal.Data.Functor ( void ) @@ -460,6 +463,29 @@ throwErrnoPathIfMinus1_ = throwErrnoPathIf_ (== -1) -- conversion of an "errno" value into IO error -- -------------------------------------------- +errnoToString :: Errno -> IO String + +#if defined(javascript_HOST_ARCH) +foreign import ccall unsafe "base_strerror" + c_strerror :: Errno -> IO (Ptr CChar) + +errnoToString errno = c_strerror errno >>= peekCString + +#else +foreign import ccall "base_strerror_r" + c_strerror_r :: Errno -> Ptr CChar -> CSize -> IO CInt + +errnoToString errno = + allocaBytes len $ \ptr -> do + ret <- c_strerror_r errno ptr len + if ret /= 0 + then return "errnoToString failed" + else peekCString ptr + where + len :: Num a => a + len = 512 +#endif + -- | Construct an 'IOError' based on the given 'Errno' value. -- The optional information can be used to improve the accuracy of -- error messages. @@ -470,7 +496,7 @@ errnoToIOError :: String -- ^ the location where the error occurred -> Maybe String -- ^ optional filename associated with the error -> IOError errnoToIOError loc errno maybeHdl maybeName = unsafePerformIO $ do - str <- strerror errno >>= peekCString + str <- errnoToString errno return (IOError maybeHdl errType loc str (Just errno') maybeName) where Errno errno' = errno @@ -576,5 +602,3 @@ errnoToIOError loc errno maybeHdl maybeName = unsafePerformIO $ do | errno == eXDEV = UnsupportedOperation | otherwise = OtherError -foreign import ccall unsafe "string.h" strerror :: Errno -> IO (Ptr CChar) - View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2859a6379be53c5f6de34f6dd868ef0f0738b08c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2859a6379be53c5f6de34f6dd868ef0f0738b08c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 23:28:50 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 08 Mar 2024 18:28:50 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 16 commits: base: Use strerror_r instead of strerror Message-ID: <65eb9f32cbd4e_2fe31878e170890327@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - e2ea2ce8 by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/CloneStack: Bounds check array write - - - - - 23f81003 by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - c34a51b6 by Ben Gamari at 2024-03-08T18:28:35-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - c2608564 by Ben Gamari at 2024-03-08T18:28:35-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - a983949a by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/IPE: Don't expose helper in header - - - - - 00b4fe2e by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - 69118f5f by Ben Gamari at 2024-03-08T18:28:36-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 13568b23 by Ben Gamari at 2024-03-08T18:28:36-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - 0c93142d by Ben Gamari at 2024-03-08T18:28:36-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 6d4bdf9e by Jade at 2024-03-08T18:28:37-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - a930b2fd by Patrick at 2024-03-08T18:28:38-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 0852436a by Vaibhav Sagar at 2024-03-08T18:28:42-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 52525fcc by Ben Gamari at 2024-03-08T18:28:42-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - bb867146 by Cheng Shao at 2024-03-08T18:28:42-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 4e3e1f8b by Ben Gamari at 2024-03-08T18:28:43-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - + libraries/ghc-internal/cbits/strerror.c - libraries/ghc-internal/configure.ac - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/jsbits/errno.js - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs - + libraries/ghc-internal/src/GHC/Internal/InfoProv.hs - libraries/ghc-internal/src/GHC/Internal/InfoProv.hsc → libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc - libraries/ghc-internal/src/GHC/Internal/Stack/CloneStack.hs - rts/CloneStack.c - rts/CloneStack.h The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a7c876e35ee0998bba256d4bf0808750d57dc7b4...4e3e1f8be39871b43c788584543d27718a9dbe35 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a7c876e35ee0998bba256d4bf0808750d57dc7b4...4e3e1f8be39871b43c788584543d27718a9dbe35 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 8 23:52:50 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Fri, 08 Mar 2024 18:52:50 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 26 commits: base: Use strerror_r instead of strerror Message-ID: <65eba4d2642ea_2fe31886f9a5c1015d6@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - e2ea2ce8 by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/CloneStack: Bounds check array write - - - - - 23f81003 by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - c34a51b6 by Ben Gamari at 2024-03-08T18:28:35-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - c2608564 by Ben Gamari at 2024-03-08T18:28:35-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - a983949a by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/IPE: Don't expose helper in header - - - - - 00b4fe2e by Ben Gamari at 2024-03-08T18:28:35-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - 69118f5f by Ben Gamari at 2024-03-08T18:28:36-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 13568b23 by Ben Gamari at 2024-03-08T18:28:36-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - 0c93142d by Ben Gamari at 2024-03-08T18:28:36-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 6d4bdf9e by Jade at 2024-03-08T18:28:37-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - a930b2fd by Patrick at 2024-03-08T18:28:38-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 0852436a by Vaibhav Sagar at 2024-03-08T18:28:42-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 52525fcc by Ben Gamari at 2024-03-08T18:28:42-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - bb867146 by Cheng Shao at 2024-03-08T18:28:42-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 4e3e1f8b by Ben Gamari at 2024-03-08T18:28:43-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - f2b975d1 by Ben Gamari at 2024-03-08T18:36:11-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - ce0fb007 by Ben Gamari at 2024-03-08T18:36:12-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - 1c688389 by Ben Gamari at 2024-03-08T18:36:12-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - a3b450a6 by Ben Gamari at 2024-03-08T18:36:12-05:00 configure: Bump version to 9.10 - - - - - 49fd6982 by Ben Gamari at 2024-03-08T18:36:12-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 7548efc0 by Ben Gamari at 2024-03-08T18:36:12-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - 9752f8cd by Ben Gamari at 2024-03-08T18:52:24-05:00 base: Bump version to 4.20.0.0 - - - - - 936a0e62 by Ben Gamari at 2024-03-08T18:52:24-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4576390b by Ben Gamari at 2024-03-08T18:52:24-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 0ef1f84b by Ben Gamari at 2024-03-08T18:52:24-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 30 changed files: - .gitlab-ci.yml - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - compiler/ghc.cabal.in - configure.ac - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal - libraries/ghc-boot-th/ghc-boot-th.cabal.in The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9b97d2c46e2d86ba4af9c10ece9e1b29553657cc...0ef1f84b5381e189a92a8b0dd1c63796dac1cee1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9b97d2c46e2d86ba4af9c10ece9e1b29553657cc...0ef1f84b5381e189a92a8b0dd1c63796dac1cee1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 03:32:54 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 08 Mar 2024 22:32:54 -0500 Subject: [Git][ghc/ghc][wip/T23942] 21 commits: Rephrase error message to say "visible arguments" (#24318) Message-ID: <65ebd866c4cb7_2fe318e648a081095d@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 35de5373 by Matthew Craven at 2024-03-08T16:01:07-05:00 CorePrep: Rework lowering of BigNat# literals Don't use bigNatFromWord#, because that's terrible: * We shouldn't have to traverse a linked list at run-time to build a BigNat# literal. That's just silly! * The static List object we have to create is much larger than the actual BigNat#'s contents, bloating code size. * We have to read the corresponding interface file, which causes un-tracked implicit dependencies. (#23942) Instead, encode them into the appropriate platform-dependent sequence of bytes, and generate code that copies these bytes at run-time from an Addr# literal into a new ByteArray#. A ByteArray# literal would be the correct thing to generate, but these are not yet supported; see also #17747. Since this lowering no longer reads the interface file for GHC.Num.BigNat, the reasoning in Note [Depend on GHC.Num.Integer] is obsoleted. But the story of un-tracked built-in dependencies remains complex, and Note [Tracking dependencies on primitives] now exists to explain this complexity. - - - - - 69583bdb by Matthew Craven at 2024-03-08T16:01:07-05:00 small fixes and improvements - - - - - a776b257 by Matthew Craven at 2024-03-08T16:01:08-05:00 Accept test output changes - - - - - 2a506880 by Matthew Craven at 2024-03-08T16:01:08-05:00 review suggestion - - - - - 177e258e by Matthew Craven at 2024-03-08T22:30:44-05:00 Mess with an awful lot of build-order imports - - - - - 7530714c by Matthew Craven at 2024-03-08T22:31:24-05:00 Improve a variable name - - - - - 2e20ca9d by Matthew Craven at 2024-03-08T22:31:59-05:00 'toStrict' is not exported from Data.ByteString until 0.11 - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/PrimOps.hs-boot - compiler/GHC/Builtin/Types/Prim.hs - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Data/Word64Map/Strict.hs - compiler/GHC/Driver/CmdLine.hs - compiler/GHC/Driver/Config/CoreToStg/Prep.hs - compiler/GHC/Driver/Config/Diagnostic.hs - compiler/GHC/Driver/Errors/Ppr.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Iface/Errors/Ppr.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs-boot - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Platform.hs - compiler/GHC/StgToJS/Types.hs - compiler/GHC/Tc/Errors/Hole/Plugin.hs-boot - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Types/LclEnv.hs-boot - compiler/GHC/Tc/Utils/Env.hs - compiler/GHC/Tc/Utils/Unify.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/438278dd05e17598384b5bd74c930ad1747317a9...2e20ca9d12b4f3b64b2e51a258e6c929c5de4f59 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/438278dd05e17598384b5bd74c930ad1747317a9...2e20ca9d12b4f3b64b2e51a258e6c929c5de4f59 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 03:40:26 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Fri, 08 Mar 2024 22:40:26 -0500 Subject: [Git][ghc/ghc][wip/T23942] Reference newly-created ticket Message-ID: <65ebda2a55021_2fe318eb173cc11335e@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: ac5a901f by Matthew Craven at 2024-03-08T22:39:51-05:00 Reference newly-created ticket - - - - - 1 changed file: - libraries/ghc-internal/src/GHC/Internal/Base.hs Changes: ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -394,7 +394,7 @@ W1: build failures, so enforcement of that requirement has historically been pretty spotty, causing issues like #23942. - Improving this situation is discussed at #. + Improving this situation is discussed at #24520. W2: Non-exhaustive pattern matches, incomplete record selectors, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ac5a901f489568ce6869cff6faa77c883077cf8c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ac5a901f489568ce6869cff6faa77c883077cf8c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 05:39:50 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 00:39:50 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: Error messages: Improve Error messages for Data constructors in type signatures. Message-ID: <65ebf626cb718_2fe3181217522013619@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 4ee269db by Jade at 2024-03-09T00:39:27-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - 1a1ada5d by Patrick at 2024-03-09T00:39:28-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - ebf4709c by Vaibhav Sagar at 2024-03-09T00:39:30-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 2ea5608e by Ben Gamari at 2024-03-09T00:39:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 610d3c87 by Cheng Shao at 2024-03-09T00:39:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c4e85d48 by Ben Gamari at 2024-03-09T00:39:31-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 6204c3e7 by Vladislav Zavialov at 2024-03-09T00:39:31-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - rts/linker/Elf.c - testsuite/driver/testlib.py - + testsuite/tests/hiefile/should_compile/T24493.hs - + testsuite/tests/hiefile/should_compile/T24493.stderr - testsuite/tests/hiefile/should_compile/all.T - testsuite/tests/module/mod98.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/T14189.stderr - testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr - + testsuite/tests/parser/should_fail/T17879a.hs - + testsuite/tests/parser/should_fail/T17879a.stderr - + testsuite/tests/parser/should_fail/T17879b.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4e3e1f8be39871b43c788584543d27718a9dbe35...6204c3e781fd3f279eed73d6756a83a4ad7e5d78 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4e3e1f8be39871b43c788584543d27718a9dbe35...6204c3e781fd3f279eed73d6756a83a4ad7e5d78 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 08:40:10 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 03:40:10 -0500 Subject: [Git][ghc/ghc][master] Error messages: Improve Error messages for Data constructors in type signatures. Message-ID: <65ec206a39e9e_13136c4ce0bcc293bd@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - 14 changed files: - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - testsuite/tests/module/mod98.stderr - testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr - + testsuite/tests/parser/should_fail/T17879a.hs - + testsuite/tests/parser/should_fail/T17879a.stderr - + testsuite/tests/parser/should_fail/T17879b.hs - + testsuite/tests/parser/should_fail/T17879b.stderr - testsuite/tests/parser/should_fail/T3811.stderr - testsuite/tests/parser/should_fail/all.T - testsuite/tests/parser/should_fail/readFail031.stderr Changes: ===================================== compiler/GHC/Parser/Errors/Ppr.hs ===================================== @@ -455,11 +455,17 @@ instance Diagnostic PsMessage where PsErrIllegalRoleName role _nearby -> mkSimpleDecorated $ text "Illegal role name" <+> quotes (ppr role) - PsErrInvalidTypeSignature lhs - -> mkSimpleDecorated $ - text "Invalid type signature:" - <+> ppr lhs - <+> text ":: ..." + PsErrInvalidTypeSignature reason lhs + -> mkSimpleDecorated $ case reason of + PsErrInvalidTypeSig_DataCon -> text "Invalid data constructor" <+> quotes (ppr lhs) <+> + text "in type signature" <> colon $$ + text "You can only define data constructors in data type declarations." + PsErrInvalidTypeSig_Qualified -> text "Invalid qualified name in type signature." + PsErrInvalidTypeSig_Other -> text "Invalid type signature" <> colon $$ + text "A type signature should be of form" <+> + placeHolder "variables" <+> dcolon <+> placeHolder "type" <> + dot + where placeHolder = angleBrackets . text PsErrUnexpectedTypeInDecl t what tc tparms equals_or_where -> mkSimpleDecorated $ vcat [ text "Unexpected type" <+> quotes (ppr t) @@ -779,15 +785,17 @@ instance Diagnostic PsMessage where sug_missingdo _ = Nothing PsErrParseRightOpSectionInPat{} -> noHints PsErrIllegalRoleName _ nearby -> [SuggestRoles nearby] - PsErrInvalidTypeSignature lhs -> + PsErrInvalidTypeSignature reason lhs -> if | foreign_RDR `looks_like` lhs -> [suggestExtension LangExt.ForeignFunctionInterface] | default_RDR `looks_like` lhs -> [suggestExtension LangExt.DefaultSignatures] | pattern_RDR `looks_like` lhs -> [suggestExtension LangExt.PatternSynonyms] + | PsErrInvalidTypeSig_Qualified <- reason + -> [SuggestTypeSignatureRemoveQualifier] | otherwise - -> [SuggestTypeSignatureForm] + -> [] where -- A common error is to forget the ForeignFunctionInterface flag -- so check for that, and suggest. cf #3805 ===================================== compiler/GHC/Parser/Errors/Types.hs ===================================== @@ -389,7 +389,7 @@ data PsMessage | PsErrIllegalRoleName !FastString [Role] -- | Invalid type signature - | PsErrInvalidTypeSignature !(LHsExpr GhcPs) + | PsErrInvalidTypeSignature !PsInvalidTypeSignature !(LHsExpr GhcPs) -- | Unexpected type in declaration | PsErrUnexpectedTypeInDecl !(LHsType GhcPs) @@ -480,6 +480,11 @@ data PsErrParseDetails -- ^ Did we parse a \"pattern\" keyword? } +data PsInvalidTypeSignature + = PsErrInvalidTypeSig_Qualified + | PsErrInvalidTypeSig_DataCon + | PsErrInvalidTypeSig_Other + -- | Is the parsed pattern recursive? data PatIsRecursive = YesPatIsRecursive @@ -531,6 +536,7 @@ data NumUnderscoreReason | NumUnderscore_Float deriving (Show,Eq,Ord) + data LexErrKind = LexErrKind_EOF -- ^ End of input | LexErrKind_UTF8 -- ^ UTF-8 decoding error ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -1398,13 +1398,19 @@ checkPatBind _loc annsIn lhs (L _ grhss) mult = do checkValSigLhs :: LHsExpr GhcPs -> P (LocatedN RdrName) -checkValSigLhs (L _ (HsVar _ lrdr@(L _ v))) - | isUnqual v - , not (isDataOcc (rdrNameOcc v)) - = return lrdr +checkValSigLhs lhs@(L l lhs_expr) = + case lhs_expr of + HsVar _ lrdr@(L _ v) -> check_var v lrdr + _ -> make_err PsErrInvalidTypeSig_Other + where + check_var v lrdr + | not (isUnqual v) = make_err PsErrInvalidTypeSig_Qualified + | isDataOcc occ_n = make_err PsErrInvalidTypeSig_DataCon + | otherwise = pure lrdr + where occ_n = rdrNameOcc v + make_err reason = addFatalError $ + mkPlainErrorMsgEnvelope (locA l) (PsErrInvalidTypeSignature reason lhs) -checkValSigLhs lhs@(L l _) - = addFatalError $ mkPlainErrorMsgEnvelope (locA l) $ PsErrInvalidTypeSignature lhs checkDoAndIfThenElse :: (Outputable a, Outputable b, Outputable c) ===================================== compiler/GHC/Types/Hint.hs ===================================== @@ -54,6 +54,7 @@ data AvailableBindings | UnnamedBinding -- ^ An unknown binding (i.e. too complicated to turn into a 'Name') + data LanguageExtensionHint = -- | Suggest to enable the input extension. This is the hint that -- GHC emits if this is not a \"known\" fix, i.e. this is GHC giving @@ -297,13 +298,13 @@ data GhcHint -} | SuggestQualifyStarOperator - {-| Suggests that a type signature should have form :: + {-| Suggests that for a type signature 'M.x :: ...' the qualifier should be omitted in order to be accepted by GHC. Triggered by: 'GHC.Parser.Errors.Types.PsErrInvalidTypeSignature' - Test case(s): parser/should_fail/T3811 + Test case(s): module/mod98 -} - | SuggestTypeSignatureForm + | SuggestTypeSignatureRemoveQualifier {-| Suggests to move an orphan instance (for a typeclass or a type or data family), or to newtype-wrap it. ===================================== compiler/GHC/Types/Hint/Ppr.hs ===================================== @@ -127,8 +127,8 @@ instance Outputable GhcHint where -> text "To use (or export) this operator in" <+> text "modules with StarIsType," $$ text " including the definition module, you must qualify it." - SuggestTypeSignatureForm - -> text "A type signature should be of form :: " + SuggestTypeSignatureRemoveQualifier + -> text "Perhaps you meant to omit the qualifier" SuggestAddToHSigExportList _name mb_mod -> let header = text "Try adding it to the export list of" in case mb_mod of ===================================== testsuite/tests/module/mod98.stderr ===================================== @@ -1,5 +1,4 @@ mod98.hs:3:1: error: [GHC-94426] - Invalid type signature: M.x :: ... - Suggested fix: - A type signature should be of form :: + Invalid qualified name in type signature. + Suggested fix: Perhaps you meant to omit the qualifier ===================================== testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr ===================================== @@ -1,4 +1,5 @@ NoPatternSynonyms.hs:3:1: error: [GHC-94426] - Invalid type signature: pattern P :: ... + Invalid type signature: + A type signature should be of form :: . Suggested fix: Perhaps you intended to use PatternSynonyms ===================================== testsuite/tests/parser/should_fail/T17879a.hs ===================================== @@ -0,0 +1,4 @@ +module Main where + +Foo :: () +Foo = () ===================================== testsuite/tests/parser/should_fail/T17879a.stderr ===================================== @@ -0,0 +1,4 @@ + +T17879a.hs:3:1: error: [GHC-94426] + Invalid data constructor ‘Foo’ in type signature: + You can only define data constructors in data type declarations. ===================================== testsuite/tests/parser/should_fail/T17879b.hs ===================================== @@ -0,0 +1,4 @@ +module Main where + +_ :: () +_ = () ===================================== testsuite/tests/parser/should_fail/T17879b.stderr ===================================== @@ -0,0 +1,4 @@ + +T17879b.hs:3:1: error: [GHC-94426] + Invalid type signature: + A type signature should be of form :: . ===================================== testsuite/tests/parser/should_fail/T3811.stderr ===================================== @@ -1,5 +1,4 @@ T3811.hs:4:1: error: [GHC-94426] - Invalid type signature: f x :: ... - Suggested fix: - A type signature should be of form :: + Invalid type signature: + A type signature should be of form :: . ===================================== testsuite/tests/parser/should_fail/all.T ===================================== @@ -225,3 +225,5 @@ test('ListTuplePunsFail2', extra_files(['ListTuplePunsFail2.hs']), ghci_script, test('ListTuplePunsFail3', extra_files(['ListTuplePunsFail3.hs']), ghci_script, ['ListTuplePunsFail3.script']) test('ListTuplePunsFail4', extra_files(['ListTuplePunsFail4.hs']), ghci_script, ['ListTuplePunsFail4.script']) test('ListTuplePunsFail5', extra_files(['ListTuplePunsFail5.hs']), ghci_script, ['ListTuplePunsFail5.script']) +test('T17879a', normal, compile_fail, ['']) +test('T17879b', normal, compile_fail, ['']) ===================================== testsuite/tests/parser/should_fail/readFail031.stderr ===================================== @@ -1,5 +1,4 @@ readFail031.hs:4:3: error: [GHC-94426] - Invalid type signature: (:+) :: ... - Suggested fix: - A type signature should be of form :: + Invalid data constructor ‘(:+)’ in type signature: + You can only define data constructors in data type declarations. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/edb9bf77104a8afec6e54e646f07b1a9849dfc76 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/edb9bf77104a8afec6e54e646f07b1a9849dfc76 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 08:41:17 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 03:41:17 -0500 Subject: [Git][ghc/ghc][master] HieAst: add module name #24493 Message-ID: <65ec20ad9f625_13136c51fc9803549c@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 13 changed files: - compiler/GHC.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - + testsuite/tests/hiefile/should_compile/T24493.hs - + testsuite/tests/hiefile/should_compile/T24493.stderr - testsuite/tests/hiefile/should_compile/all.T - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/T14189.stderr - utils/haddock Changes: ===================================== compiler/GHC.hs ===================================== @@ -1157,7 +1157,7 @@ instance DesugaredMod DesugaredModule where type ParsedSource = Located (HsModule GhcPs) type RenamedSource = (HsGroup GhcRn, [LImportDecl GhcRn], Maybe [(LIE GhcRn, Avails)], - Maybe (LHsDoc GhcRn)) + Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName)) type TypecheckedSource = LHsBinds GhcTc -- NOTE: ===================================== compiler/GHC/HsToCore/Docs.hs ===================================== @@ -63,12 +63,12 @@ extractDocs dflags , tcg_imports = import_avails , tcg_insts = insts , tcg_fam_insts = fam_insts - , tcg_doc_hdr = mb_doc_hdr + , tcg_hdr_info = mb_hdr_info , tcg_th_docs = th_docs_var , tcg_type_env = ty_env } = do th_docs <- liftIO $ readIORef th_docs_var - let doc_hdr = (unLoc <$> mb_doc_hdr) + let doc_hdr = unLoc <$> fst mb_hdr_info ExtractedTHDocs th_hdr th_decl_docs th_arg_docs th_inst_docs = extractTHDocs th_docs mod_docs = Docs ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -210,7 +210,8 @@ call and just recurse directly in to the subexpressions. -- These synonyms match those defined in compiler/GHC.hs type RenamedSource = ( HsGroup GhcRn, [LImportDecl GhcRn] , Maybe [(LIE GhcRn, Avails)] - , Maybe (LHsDoc GhcRn) ) + , Maybe (LHsDoc GhcRn) + , Maybe (XRec GhcRn ModuleName) ) type TypecheckedSource = LHsBinds GhcTc @@ -321,8 +322,9 @@ getCompressedAsts ts rs top_ev_binds insts tcs = enrichHie :: TypecheckedSource -> RenamedSource -> Bag EvBind -> [ClsInst] -> [TyCon] -> HieASTs Type -enrichHie ts (hsGrp, imports, exports, docs) ev_bs insts tcs = +enrichHie ts (hsGrp, imports, exports, docs, modName) ev_bs insts tcs = runIdentity $ flip evalStateT initState $ flip runReaderT SourceInfo $ do + modName <- toHie (IEC Export <$> modName) tasts <- toHie $ fmap (BC RegularBind ModuleScope) ts rasts <- processGrp hsGrp imps <- toHie $ filter (not . ideclImplicit . ideclExt . unLoc) imports @@ -344,7 +346,8 @@ enrichHie ts (hsGrp, imports, exports, docs) ev_bs insts tcs = (realSrcSpanEnd $ nodeSpan (NE.last children)) flat_asts = concat - [ tasts + [ modName + , tasts , rasts , imps , exps ===================================== compiler/GHC/Tc/Module.hs ===================================== @@ -297,8 +297,8 @@ tcRnModuleTcRnM hsc_env mod_sum -- We will rename it properly after renaming everything else so that -- haddock can link the identifiers ; tcg_env <- return (tcg_env - { tcg_doc_hdr = fmap (\(WithHsDocIdentifiers str _) -> WithHsDocIdentifiers str []) - <$> maybe_doc_hdr }) + { tcg_hdr_info = (fmap (\(WithHsDocIdentifiers str _) -> WithHsDocIdentifiers str []) + <$> maybe_doc_hdr , maybe_mod ) }) ; -- If the whole module is warned about or deprecated -- (via mod_deprec) record that in tcg_warns. If we do thereby add -- a WarnAll, it will override any subsequent deprecations added to tcg_warns @@ -347,7 +347,7 @@ tcRnModuleTcRnM hsc_env mod_sum -- Rename the module header properly after we have renamed everything else ; maybe_doc_hdr <- traverse rnLHsDoc maybe_doc_hdr; ; tcg_env <- return (tcg_env - { tcg_doc_hdr = maybe_doc_hdr }) + { tcg_hdr_info = (maybe_doc_hdr, maybe_mod) }) ; -- add extra source files to tcg_dependent_files addDependentFiles src_files @@ -3115,14 +3115,15 @@ runRenamerPlugin gbl_env hs_group = do -- exception/signal an error. type RenamedStuff = (Maybe (HsGroup GhcRn, [LImportDecl GhcRn], Maybe [(LIE GhcRn, Avails)], - Maybe (LHsDoc GhcRn))) + Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))) -- | Extract the renamed information from TcGblEnv. getRenamedStuff :: TcGblEnv -> RenamedStuff getRenamedStuff tc_result = fmap (\decls -> ( decls, tcg_rn_imports tc_result - , tcg_rn_exports tc_result, tcg_doc_hdr tc_result ) ) + , tcg_rn_exports tc_result, doc_hdr, name_hdr )) (tcg_rn_decls tc_result) + where (doc_hdr, name_hdr) = tcg_hdr_info tc_result runTypecheckerPlugin :: ModSummary -> TcGblEnv -> TcM TcGblEnv runTypecheckerPlugin sum gbl_env = do ===================================== compiler/GHC/Tc/Types.hs ===================================== @@ -605,7 +605,9 @@ data TcGblEnv tcg_fords :: [LForeignDecl GhcTc], -- ...Foreign import & exports tcg_patsyns :: [PatSyn], -- ...Pattern synonyms - tcg_doc_hdr :: Maybe (LHsDoc GhcRn), -- ^ Maybe Haddock header docs + tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName)), + -- ^ Maybe Haddock header docs and Maybe located module name + tcg_hpc :: !AnyHpcUsage, -- ^ @True@ if any part of the -- prog uses hpc instrumentation. -- NB. BangPattern is to fix a leak, see #15111 ===================================== compiler/GHC/Tc/Utils/Backpack.hs ===================================== @@ -523,8 +523,8 @@ mergeSignatures tcg_rn_decls = tcg_rn_decls orig_tcg_env, -- Annotations tcg_ann_env = tcg_ann_env orig_tcg_env, - -- Documentation header - tcg_doc_hdr = tcg_doc_hdr orig_tcg_env + -- Documentation header and located module name + tcg_hdr_info = tcg_hdr_info orig_tcg_env -- tcg_dus? -- tcg_th_used = tcg_th_used orig_tcg_env, -- tcg_th_splice_used = tcg_th_splice_used orig_tcg_env ===================================== compiler/GHC/Tc/Utils/Monad.hs ===================================== @@ -346,7 +346,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this tcg_merged = [], tcg_dfun_n = dfun_n_var, tcg_keep = keep_var, - tcg_doc_hdr = Nothing, + tcg_hdr_info = (Nothing,Nothing), tcg_hpc = False, tcg_main = Nothing, tcg_self_boot = NoSelfBoot, ===================================== testsuite/tests/hiefile/should_compile/T24493.hs ===================================== @@ -0,0 +1,3 @@ +module T24493 where + +go = "1" ===================================== testsuite/tests/hiefile/should_compile/T24493.stderr ===================================== @@ -0,0 +1,33 @@ +==================== HIE AST ==================== +File: T24493.hs +Node at T24493.hs:(1,8)-(3,8): Source: From source + {(annotations: {(Module, Module)}), (types: []), + (identifier info: {})} + + Node at T24493.hs:1:8-13: Source: From source + {(annotations: {}), (types: []), + (identifier info: {(module T24493, Details: Nothing {export})})} + + Node at T24493.hs:3:1-8: Source: From source + {(annotations: {(FunBind, HsBindLR), (Match, Match), + (XHsBindsLR, HsBindLR)}), + (types: [0]), (identifier info: {})} + + Node at T24493.hs:3:1-2: Source: From source + {(annotations: {}), (types: []), + (identifier info: {(name T24493.go, Details: Just 0 {LHS of a match group, + regular value bound with scope: ModuleScope bound at: T24493.hs:3:1-8})})} + + Node at T24493.hs:3:4-8: Source: From source + {(annotations: {(GRHS, GRHS)}), (types: []), + (identifier info: {})} + + Node at T24493.hs:3:6-8: Source: From source + {(annotations: {(HsLit, HsExpr)}), (types: [0]), + (identifier info: {})} + + + + +Got valid scopes +Got no roundtrip errors \ No newline at end of file ===================================== testsuite/tests/hiefile/should_compile/all.T ===================================== @@ -23,3 +23,4 @@ test('Scopes', normal, compile, ['-fno-code -fwrite-ide- test('ScopesBug', expect_broken(18425), compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info']) test('T18425', normal, compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info']) test('T22416', normal, compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info']) +test('T24493', normal, compile, ['-fno-code -fwrite-ide-info -fvalidate-ide-info -ddump-hie']) ===================================== testsuite/tests/parser/should_compile/DumpRenamedAst.stderr ===================================== @@ -2,7 +2,7 @@ ==================== Renamer ==================== (Just - ((,,,) + ((,,,,) (HsGroup (NoExtField) (XValBindsLR @@ -2367,6 +2367,16 @@ {Name: GHC.Types.Type}))) (Nothing)))])))))] (Nothing) - (Nothing))) + (Nothing) + (Just + (L + (EpAnn + (EpaSpan { DumpRenamedAst.hs:4:8-21 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: DumpRenamedAst})))) + ===================================== testsuite/tests/parser/should_compile/T14189.stderr ===================================== @@ -2,7 +2,7 @@ ==================== Renamer ==================== (Just - ((,,,) + ((,,,,) (HsGroup (NoExtField) (XValBindsLR @@ -316,6 +316,13 @@ [{Name: T14189.MyType} ,{Name: T14189.f} ,{Name: T14189.NT}])])]) - (Nothing))) - - + (Nothing) + (Just + (L + (EpAnn + (EpaSpan { T14189.hs:1:8-13 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: T14189})))) ===================================== utils/haddock ===================================== @@ -1 +1 @@ -Subproject commit 91f338a4f1ae59fd6ea482b73a27708113912d5d +Subproject commit 730749b48c3d7b358f4fb07774a1ccfc1d63968a View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cfb197e3dee6781978a8143d686f0fb593614e52 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cfb197e3dee6781978a8143d686f0fb593614e52 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 08:42:05 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 03:42:05 -0500 Subject: [Git][ghc/ghc][master] GHC.Utils.Binary: fix a couple of typos Message-ID: <65ec20dd74747_13136c53eaa44406be@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 1 changed file: - compiler/GHC/Utils/Binary.hs Changes: ===================================== compiler/GHC/Utils/Binary.hs ===================================== @@ -597,9 +597,9 @@ getSLEB128 bh = do -- is to the interface file without the variable length encoding we usually -- apply. --- | Encode the argument in it's full length. This is different from many default +-- | Encode the argument in its full length. This is different from many default -- binary instances which make no guarantee about the actual encoding and --- might do things use variable length encoding. +-- might do things using variable length encoding. newtype FixedLengthEncoding a = FixedLengthEncoding { unFixedLength :: a } deriving (Eq,Ord,Show) @@ -824,11 +824,11 @@ we stored a tag byte to discriminate between the two cases. This made some sense as it's highly portable but also not very efficient. -However GHC stores a surprisingly large number off large Integer +However GHC stores a surprisingly large number of large Integer values. In the examples looked at between 25% and 50% of Integers serialized were outside of the Int32 range. -Consider a valie like `2724268014499746065`, some sort of hash +Consider a value like `2724268014499746065`, some sort of hash actually generated by GHC. In the old scheme this was encoded as a list of 19 chars. This gave a size of 77 Bytes, one for the length of the list and 76 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2341d81ec72f5ae963072957911a67a739a83db9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2341d81ec72f5ae963072957911a67a739a83db9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 08:42:46 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 03:42:46 -0500 Subject: [Git][ghc/ghc][master] 2 commits: rts: Drop .wasm suffix from .prof file names Message-ID: <65ec210645a50_13136c5588ba84377f@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - 5 changed files: - rts/ProfHeap.c - rts/Profiling.c - rts/RtsUtils.c - rts/RtsUtils.h - testsuite/driver/testlib.py Changes: ===================================== rts/ProfHeap.c ===================================== @@ -448,18 +448,14 @@ initHeapProfiling(void) stem = stgMallocBytes(strlen(RtsFlags.CcFlags.outputFileNameStem) + 1, "initHeapProfiling"); strcpy(stem, RtsFlags.CcFlags.outputFileNameStem); } else { - stem = stgMallocBytes(strlen(prog_name) + 1, "initHeapProfiling"); strcpy(stem, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(stem,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(stem, ".exe"); +#elif defined(wasm32_HOST_ARCH) + dropExtension(stem, ".wasm"); #endif } ===================================== rts/Profiling.c ===================================== @@ -245,19 +245,14 @@ initProfilingLogFile(void) if (RtsFlags.CcFlags.outputFileNameStem) { stem = RtsFlags.CcFlags.outputFileNameStem; } else { - char *prog; - - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + char *prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); strcpy(prog, prog_name); + + // Drop the platform's executable suffix if there is one #if defined(mingw32_HOST_OS) - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; - } - } + dropExtension(prog, ".exe"); +#elif defined(wasm32_HOST_ARCH) + dropExtension(prog, ".wasm"); #endif stem = prog; } ===================================== rts/RtsUtils.c ===================================== @@ -456,3 +456,15 @@ void checkFPUStack(void) } #endif } + +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension) { + int ext_len = strlen(extension); + int path_len = strlen(path); + if (ext_len < path_len) { + char *s = &path[path_len - ext_len]; + if (strcmp(s, extension) == 0) { + *s = '\0'; + } + } +} ===================================== rts/RtsUtils.h ===================================== @@ -62,4 +62,7 @@ void checkFPUStack(void); #define xstr(s) str(s) #define str(s) #s +// Drop the given extension from a filepath. +void dropExtension(char *path, const char *extension); + #include "EndPrivate.h" ===================================== testsuite/driver/testlib.py ===================================== @@ -2329,14 +2329,13 @@ def write_file(f: Path, s: str) -> None: async def check_hp_ok(name: TestName) -> bool: opts = getTestOpts() - actual_name = name + exe_extension() if not opts.ignore_extension else name # do not qualify for hp2ps because we should be in the right directory - hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {actual_name}'.format(**locals()) + hp2psCmd = 'cd "{opts.testdir}" && {{hp2ps}} {name}'.format(**locals()) hp2psResult = await runCmd(hp2psCmd, print_output=True) - actual_ps_path = in_testdir(actual_name, 'ps') + actual_ps_path = in_testdir(name, 'ps') if hp2psResult == 0: if actual_ps_path.exists(): @@ -2345,15 +2344,15 @@ async def check_hp_ok(name: TestName) -> bool: if (gsResult == 0): return True else: - print("hp2ps output for " + actual_name + " is not valid PostScript") + print("hp2ps output for " + name + " is not valid PostScript") return False else: return True # assume postscript is valid without ghostscript else: - print("hp2ps did not generate PostScript for " + actual_name) + print("hp2ps did not generate PostScript for " + name) return False else: - print("hp2ps error when processing heap profile for " + actual_name) + print("hp2ps error when processing heap profile for " + name) return False async def check_prof_ok(name: TestName, way: WayName) -> bool: @@ -2365,7 +2364,7 @@ async def check_prof_ok(name: TestName, way: WayName) -> bool: if not expected_prof_path.exists(): return True - actual_prof_file = add_suffix(name + exe_extension(), 'prof') + actual_prof_file = add_suffix(name, 'prof') actual_prof_path = in_testdir(actual_prof_file) if not actual_prof_path.exists(): View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2341d81ec72f5ae963072957911a67a739a83db9...259495ee3de352d259a07b577f3089b34ddf283f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2341d81ec72f5ae963072957911a67a739a83db9...259495ee3de352d259a07b577f3089b34ddf283f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 08:43:20 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 03:43:20 -0500 Subject: [Git][ghc/ghc][master] rts/linker: Enable GOT support on all platforms Message-ID: <65ec2128f2041_13136c57b0868481b8@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 1 changed file: - rts/linker/Elf.c Changes: ===================================== rts/linker/Elf.c ===================================== @@ -101,10 +101,10 @@ # include #endif +#include "elf_got.h" + #if defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH) -# define NEED_GOT # define NEED_PLT -# include "elf_got.h" # include "elf_plt.h" # include "elf_reloc.h" #endif @@ -798,7 +798,7 @@ ocGetNames_ELF ( ObjectCode* oc ) /* This is a non-empty .bss section. Allocate zeroed space for it, and set its .sh_offset field such that ehdrC + .sh_offset == addr_of_zeroed_space. */ -#if defined(NEED_GOT) || RTS_LINKER_USE_MMAP +#if RTS_LINKER_USE_MMAP if (USE_CONTIGUOUS_MMAP || RtsFlags.MiscFlags.linkerAlwaysPic) { /* The space for bss sections is already preallocated */ CHECK(oc->bssBegin != NULL); @@ -1113,13 +1113,11 @@ ocGetNames_ELF ( ObjectCode* oc ) } } -#if defined(NEED_GOT) if(makeGot( oc )) errorBelch("Failed to create GOT for %s", oc->archiveMemberName ? oc->archiveMemberName : oc->fileName); -#endif result = 1; goto end; @@ -1987,13 +1985,11 @@ ocResolve_ELF ( ObjectCode* oc ) } } -#if defined(NEED_GOT) if(fillGot( oc )) return 0; /* silence warnings */ (void) shnum; (void) shdr; -#endif /* NEED_GOT */ #if defined(aarch64_HOST_ARCH) /* use new relocation design */ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c477a8d28d6dd28b0b2e2ca6a937aa2a1db92ea5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c477a8d28d6dd28b0b2e2ca6a937aa2a1db92ea5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 08:43:47 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 03:43:47 -0500 Subject: [Git][ghc/ghc][master] Drop outdated comment on TcRnIllformedTypePattern Message-ID: <65ec2143c5af0_13136c5884a8c4832@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - 6 changed files: - compiler/GHC/Tc/Errors/Types.hs - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.hs - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.stderr - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.hs - testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.stderr - testsuite/tests/vdq-rta/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -4129,19 +4129,15 @@ data TcRnMessage where corresponding to a required type argument (visible forall) does not have a form that can be interpreted as a type pattern. - At the moment, only patterns constructed using the @type@ keyword - are considered well-formed, but this restriction will be relaxed - when part 2 of GHC Proposal #281 is implemented. - Example: vfun :: forall (a :: k) -> () - vfun x = () - -- ^ - -- expected `type x` instead of `x` + vfun !x = () + -- ^^ + -- bang-patterns not allowed as type patterns Test cases: - T22326_fail_raw_pat + T22326_fail_bang_pat -} TcRnIllformedTypePattern :: !(Pat GhcRn) -> TcRnMessage @@ -4173,7 +4169,7 @@ data TcRnMessage where -- lambdas not allowed in type arguments Test cases: - T22326_fail_raw_arg + T22326_fail_lam_arg -} TcRnIllformedTypeArgument :: !(LHsExpr GhcRn) -> TcRnMessage ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.hs ===================================== @@ -1,6 +1,6 @@ {-# LANGUAGE RequiredTypeArguments #-} -module T22326_fail_raw_pat where +module T22326_fail_bang_pat where f :: forall (a :: k) -> () f !x = () \ No newline at end of file ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_pat.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_bang_pat.stderr ===================================== @@ -1,5 +1,5 @@ -T22326_fail_raw_pat.hs:6:3: error: [GHC-88754] +T22326_fail_bang_pat.hs:6:3: error: [GHC-88754] • Ill-formed type pattern: !x • In the pattern: !x In an equation for ‘f’: f !x = () ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.hs → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.hs ===================================== @@ -1,7 +1,7 @@ {-# LANGUAGE ExplicitNamespaces #-} {-# LANGUAGE RequiredTypeArguments #-} -module T22326_fail_raw_arg where +module T22326_fail_lam_arg where f :: forall (a :: k) -> () f (type _) = () ===================================== testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.stderr → testsuite/tests/vdq-rta/should_fail/T22326_fail_lam_arg.stderr ===================================== @@ -1,5 +1,5 @@ -T22326_fail_raw_arg.hs:9:5: error: [GHC-29092] +T22326_fail_lam_arg.hs:9:5: error: [GHC-29092] • Ill-formed type argument: \ _ -> _ • In the expression: f (\ _ -> _) In an equation for ‘x’: x = f (\ _ -> _) ===================================== testsuite/tests/vdq-rta/should_fail/all.T ===================================== @@ -3,8 +3,8 @@ test('T22326_fail_ext2', normal, compile_fail, ['']) test('T22326_fail_top', normal, compile_fail, ['']) test('T22326_fail_app', normal, compile_fail, ['']) test('T22326_fail_notInScope', normal, compile_fail, ['']) -test('T22326_fail_raw_pat', normal, compile_fail, ['']) -test('T22326_fail_raw_arg', normal, compile_fail, ['']) +test('T22326_fail_bang_pat', normal, compile_fail, ['']) +test('T22326_fail_lam_arg', normal, compile_fail, ['']) test('T22326_fail_pat', normal, compile_fail, ['']) test('T22326_fail_nonlinear', normal, compile_fail, ['']) test('T22326_fail_caseof', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2e592857b6e028fbad83712ceda6a0860191d379 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2e592857b6e028fbad83712ceda6a0860191d379 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 11:40:20 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sat, 09 Mar 2024 06:40:20 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Fix odd register move reduction Message-ID: <65ec4aa46064b_13136ca8962f059854@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: 46b55bb4 by Sven Tennie at 2024-03-09T12:38:09+01:00 Fix odd register move reduction Probably, there're OpRegs with wrong format around. - - - - - 1 changed file: - compiler/GHC/CmmToAsm/RV64/Instr.hs Changes: ===================================== compiler/GHC/CmmToAsm/RV64/Instr.hs ===================================== @@ -434,7 +434,20 @@ mkRegRegMoveInstr src dst = ANN desc instr -- We have to be a bit careful here: A `MOV` can also mean an implicit -- conversion. This case is filtered out. takeRegRegMoveInstr :: Instr -> Maybe (Reg,Reg) -takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = pure (src, dst) +-- TODO: If this doesn't work (I don't understand WHY): +-- ghc: panic! (the 'impossible' happened) +-- GHC version 9.6.3: +-- RV64.ppr: unhandled CSET conditional +-- FLE t6, t0, ft0 +-- Call stack: +-- CallStack (from HasCallStack): +-- callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic +-- pprPanic, called at compiler/GHC/CmmToAsm/RV64/Ppr.hs:598:11 in ghc:GHC.CmmToAsm.RV64.Ppr +-- CallStack (from HasCallStack): +-- panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error +-- +-- Maybe, checking the format isn't enough and we have to check register types by their number? +-- takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = pure (src, dst) takeRegRegMoveInstr _ = Nothing -- | Make an unconditional jump instruction. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/46b55bb485edadb28be7b9fcf7e16abea4f5a12e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/46b55bb485edadb28be7b9fcf7e16abea4f5a12e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 12:47:43 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Sat, 09 Mar 2024 07:47:43 -0500 Subject: [Git][ghc/ghc][wip/T23942] Even more implicit dependency import stuff Message-ID: <65ec5a6f21f38_13136cc4231a862422@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 62c6ce49 by Matthew Craven at 2024-03-09T07:46:58-05:00 Even more implicit dependency import stuff - - - - - 3 changed files: - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs-boot - libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Conc/Internal.hs Changes: ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -370,7 +370,7 @@ imports of X must include Y. Such implicit dependencies can be introduced in at least the following ways: W1: - Awkward dependencies: + Common awkward dependencies: * TypeRep metadata introduces references to GHC.Types in EVERY module. * A String literal introduces a reference to GHC.CString, for either unpackCString# or unpackCStringUtf8# depending on its contents. @@ -443,6 +443,11 @@ W5: type-checking. (This doesn't apply to hs-boot files, which can't be given "default" declarations anyway.) +W6: + In the wasm backend, JSFFI imports and exports pull in a bunch of stuff; + see Note [Desugaring JSFFI static export] and Note [Desugaring JSFFI import] + in GHC.HsToCore.Foreign.Wasm. + A complete list could probably be made by going through the known-key names in GHC.Builtin.Names and GHC.Builtin.Names.TH. To test whether the transitive imports are sufficient for any single module, instruct ===================================== libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs-boot ===================================== @@ -2,5 +2,8 @@ module GHC.Internal.Exception.Context where +-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base +import GHC.Types () + data ExceptionContext ===================================== libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Conc/Internal.hs ===================================== @@ -7,6 +7,9 @@ module GHC.Internal.Wasm.Prim.Conc.Internal ( import GHC.Internal.Base import GHC.Internal.IO +-- See W6 of Note [Tracking dependencies on primitives] in GHC.Internal.Base +import GHC.Internal.Wasm.Prim.Imports () + foreign import javascript safe "new Promise(res => setTimeout(res, $1 / 1000))" js_delay :: Int -> IO () View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/62c6ce498cd2bd1fe0cf8e17cfc7d84fa3ae44c0 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/62c6ce498cd2bd1fe0cf8e17cfc7d84fa3ae44c0 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 14:09:49 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sat, 09 Mar 2024 09:09:49 -0500 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Re-implement takeRegRegMoveInstr Message-ID: <65ec6dad6299_1f4c8ba5730096329@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: 886d2e7a by Sven Tennie at 2024-03-09T15:07:51+01:00 Re-implement takeRegRegMoveInstr - - - - - 2 changed files: - compiler/GHC/CmmToAsm/RV64/Instr.hs - compiler/GHC/CmmToAsm/RV64/Ppr.hs Changes: ===================================== compiler/GHC/CmmToAsm/RV64/Instr.hs ===================================== @@ -433,21 +433,9 @@ mkRegRegMoveInstr src dst = ANN desc instr -- -- We have to be a bit careful here: A `MOV` can also mean an implicit -- conversion. This case is filtered out. -takeRegRegMoveInstr :: Instr -> Maybe (Reg,Reg) --- TODO: If this doesn't work (I don't understand WHY): --- ghc: panic! (the 'impossible' happened) --- GHC version 9.6.3: --- RV64.ppr: unhandled CSET conditional --- FLE t6, t0, ft0 --- Call stack: --- CallStack (from HasCallStack): --- callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic --- pprPanic, called at compiler/GHC/CmmToAsm/RV64/Ppr.hs:598:11 in ghc:GHC.CmmToAsm.RV64.Ppr --- CallStack (from HasCallStack): --- panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error --- --- Maybe, checking the format isn't enough and we have to check register types by their number? --- takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = pure (src, dst) +takeRegRegMoveInstr :: Instr -> Maybe (Reg, Reg) +takeRegRegMoveInstr (MOV (OpReg width dst) (OpReg width' src)) + | width == width' && (isFloatReg dst == isFloatReg src) = pure (src, dst) takeRegRegMoveInstr _ = Nothing -- | Make an unconditional jump instruction. @@ -863,6 +851,20 @@ isNbitEncodeable n i = let shift = n - 1 in (-1 `shiftL` shift) <= i && i < (1 ` isEncodeableInWidth :: Width -> Integer -> Bool isEncodeableInWidth = isNbitEncodeable . widthInBits +isIntOp :: Operand -> Bool +isIntOp = not . isFloatOp + +isFloatOp :: Operand -> Bool +isFloatOp (OpReg _ reg) | isFloatReg reg = True +isFloatOp _ = False + +isFloatReg :: Reg -> Bool +isFloatReg (RegReal (RealRegSingle i)) | i > 31 = True +isFloatReg (RegVirtual (VirtualRegF _)) = True +isFloatReg (RegVirtual (VirtualRegD _)) = True +isFloatReg _ = False + + -- | Making far branches -- Conditional branch instructions can target labels in a range of +/- 4 KiB. ===================================== compiler/GHC/CmmToAsm/RV64/Ppr.hs ===================================== @@ -393,15 +393,6 @@ pprReg w r = case r of -- no support for widths > W64. | otherwise = pprPanic "Unsupported width in register (max is 64)" (ppr w <+> int i) -isIntOp :: Operand -> Bool -isIntOp = not . isFloatOp - -isFloatOp :: Operand -> Bool -isFloatOp (OpReg _ (RegReal (RealRegSingle i))) | i > 31 = True -isFloatOp (OpReg _ (RegVirtual (VirtualRegF _))) = True -isFloatOp (OpReg _ (RegVirtual (VirtualRegD _))) = True -isFloatOp _ = False - isSingleOp :: Operand -> Bool isSingleOp (OpReg W32 _) = True isSingleOp _ = False View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/886d2e7aa463200f39dd6eedcc07d7e3a3fd420f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/886d2e7aa463200f39dd6eedcc07d7e3a3fd420f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 14:39:46 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 09:39:46 -0500 Subject: [Git][ghc/ghc][wip/ipe-sharing] 19 commits: ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65ec74b26c7d7_1f4c8b17da57c99223@gitlab.mail> Ben Gamari pushed to branch wip/ipe-sharing at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - libraries/base/changelog.md - libraries/base/src/Data/Kind.hs - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - + libraries/ghc-internal/cbits/strerror.c - libraries/ghc-internal/configure.ac - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/jsbits/errno.js - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs - + libraries/ghc-internal/src/GHC/Internal/InfoProv.hs - libraries/ghc-internal/src/GHC/Internal/InfoProv.hsc → libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc - libraries/ghc-internal/src/GHC/Internal/Stack/CloneStack.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/411f5289da39b5a4aacd07ba7532c23c0347694a...ed0b69dc069a23692bff89cfcab1ad9d61999506 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/411f5289da39b5a4aacd07ba7532c23c0347694a...ed0b69dc069a23692bff89cfcab1ad9d61999506 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 14:41:04 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 09:41:04 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 27 commits: Error messages: Improve Error messages for Data constructors in type signatures. Message-ID: <65ec7500c1a07_1f4c8b18f09c01018c3@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - 0e5ffaba by Ben Gamari at 2024-03-09T09:37:37-05:00 rts/CloneStack: Bounds check array write - - - - - 8340a88e by Ben Gamari at 2024-03-09T09:37:37-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - 11790370 by Ben Gamari at 2024-03-09T09:37:37-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 0b998ac8 by Ben Gamari at 2024-03-09T09:37:37-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - e369a4eb by Ben Gamari at 2024-03-09T09:37:37-05:00 rts/IPE: Don't expose helper in header - - - - - 42581aa7 by Ben Gamari at 2024-03-09T09:37:37-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - 1d489ee0 by Ben Gamari at 2024-03-09T09:37:37-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 8d60d39c by Ben Gamari at 2024-03-09T09:40:48-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - 783b8e27 by Ben Gamari at 2024-03-09T09:40:48-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 55ad2cee by Ben Gamari at 2024-03-09T09:40:48-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 9280b252 by Ben Gamari at 2024-03-09T09:40:48-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - 2849f53d by Ben Gamari at 2024-03-09T09:40:48-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - e4eb4a0b by Ben Gamari at 2024-03-09T09:40:48-05:00 configure: Bump version to 9.10 - - - - - d11dd298 by Ben Gamari at 2024-03-09T09:40:48-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 04feee4d by Ben Gamari at 2024-03-09T09:40:48-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - 59889436 by Ben Gamari at 2024-03-09T09:40:48-05:00 base: Bump version to 4.20.0.0 - - - - - c27bdcad by Ben Gamari at 2024-03-09T09:40:48-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 1689700b by Ben Gamari at 2024-03-09T09:40:48-05:00 ghc-prim: Bump version to 0.11.0 - - - - - b1c7d8ad by Ben Gamari at 2024-03-09T09:40:48-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 5772336b by Ben Gamari at 2024-03-09T09:40:48-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 30 changed files: - .gitlab-ci.yml - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - compiler/ghc.cabal.in - configure.ac - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0ef1f84b5381e189a92a8b0dd1c63796dac1cee1...5772336bad8480459a6a8fe2e7d5d9e340738bd4 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0ef1f84b5381e189a92a8b0dd1c63796dac1cee1...5772336bad8480459a6a8fe2e7d5d9e340738bd4 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 16:43:09 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 11:43:09 -0500 Subject: [Git][ghc/ghc][wip/T24512] rts/linker: Don't unload native objects when dlinfo isn't available Message-ID: <65ec919d78993_1f4c8b4cb58dc104391@gitlab.mail> Ben Gamari pushed to branch wip/T24512 at Glasgow Haskell Compiler / GHC Commits: 7eeef6b8 by Ben Gamari at 2024-03-09T11:42:25-05:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 5 changed files: - rts/CheckUnload.c - rts/Linker.c - rts/LinkerInternals.h - rts/linker/Elf.c - testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c Changes: ===================================== rts/CheckUnload.c ===================================== @@ -492,8 +492,6 @@ void checkUnload(void) next = oc->next; ASSERT(oc->status == OBJECT_UNLOADED); - removeOCSectionIndices(s_indices, oc); - // Symbols should be removed by unloadObj_. // NB (osa): If this assertion doesn't hold then freeObjectCode below // will corrupt symhash as keys of that table live in ObjectCodes. If @@ -501,8 +499,17 @@ void checkUnload(void) // RTS) then it's probably because this assertion did not hold. ASSERT(oc->symbols == NULL); - freeObjectCode(oc); - n_unloaded_objects -= 1; + if (oc->unloadable) { + removeOCSectionIndices(s_indices, oc); + freeObjectCode(oc); + n_unloaded_objects -= 1; + } else { + // If we don't have enough information to + // accurately determine the reachability of + // the object then hold onto it. + oc->next = objects; + objects = oc; + } } old_objects = NULL; ===================================== rts/Linker.c ===================================== @@ -1385,6 +1385,8 @@ mkOc( ObjectType type, pathchar *path, char *image, int imageSize, oc->prev = NULL; oc->next_loaded_object = NULL; oc->mark = object_code_mark_bit; + /* this will get cleared by the caller if object is not safely unloadable */ + oc->unloadable = true; oc->dependencies = allocHashSet(); #if defined(NEED_M32) ===================================== rts/LinkerInternals.h ===================================== @@ -313,8 +313,14 @@ struct _ObjectCode { struct _ObjectCode *next_loaded_object; // Mark bit + // N.B. This is a full word as we CAS it. StgWord mark; + // Can this object be safely unloaded? Not true for + // dynamic objects when dlinfo is not available as + // we cannot determine liveness. + bool unloadable; + // Set of dependencies (ObjectCode*) of the object file. Traverse // dependencies using `iterHashTable`. // @@ -376,7 +382,9 @@ struct _ObjectCode { /* handle returned from dlopen */ void *dlopen_handle; - /* virtual memory ranges of loaded code */ + /* virtual memory ranges of loaded code. NULL if no range information is + * available (e.g. if dlinfo is unavailable on the current platform). + */ NativeCodeRange *nc_ranges; }; ===================================== rts/linker/Elf.c ===================================== @@ -2190,6 +2190,10 @@ void * loadNativeObj_ELF (pathchar *path, char **errmsg) copyErrmsg(errmsg, "dl_iterate_phdr failed to find obj"); goto dl_iterate_phdr_fail; } + nc->unloadable = true; +#else + nc->nc_ranges = NULL; + nc->unloadable = false; #endif /* defined (HAVE_DLINFO) */ insertOCSectionIndices(nc); ===================================== testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c ===================================== @@ -64,7 +64,7 @@ void check_object_freed(char *obj_path) { OStatus st; st = getObjectLoadStatus(toPathchar(obj_path)); if (st != OBJECT_NOT_LOADED) { - errorBelch("object %s status != OBJECT_NOT_LOADED", obj_path); + errorBelch("object %s status != OBJECT_NOT_LOADED, is %d instead", obj_path, st); exit(1); } } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7eeef6b8d719fe8886cc521003a8d6fa379ee32c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7eeef6b8d719fe8886cc521003a8d6fa379ee32c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 17:42:49 2024 From: gitlab at gitlab.haskell.org (Vladislav Zavialov (@int-index)) Date: Sat, 09 Mar 2024 12:42:49 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/int-index/type-abstractions-release-notes Message-ID: <65ec9f99c42c6_1f4c8b6866450109368@gitlab.mail> Vladislav Zavialov pushed new branch wip/int-index/type-abstractions-release-notes at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/int-index/type-abstractions-release-notes You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 18:00:18 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 13:00:18 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/build-ordering Message-ID: <65eca3b2c2a54_1f4c8b70ce7b4118110@gitlab.mail> Ben Gamari pushed new branch wip/build-ordering at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/build-ordering You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 18:00:37 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 13:00:37 -0500 Subject: [Git][ghc/ghc][wip/build-ordering] base: Ensure that ghc-bignum builds before GHC.IO.Encoding.Iconv Message-ID: <65eca3c566b5b_1f4c8b7123ef81183d0@gitlab.mail> Ben Gamari pushed to branch wip/build-ordering at Glasgow Haskell Compiler / GHC Commits: 244a1c32 by Ben Gamari at 2024-03-09T13:00:32-05:00 base: Ensure that ghc-bignum builds before GHC.IO.Encoding.Iconv On Windows `GHC.IO.Encoding.Iconv` is empty and has no dependencies. Consequently, we must add dummy build ordering imports to ensure that, e.g., `GHC.Types` and `GHC.BigNum.Nat` are built before `GHC.IO.Encoding.Iconv`. - - - - - 1 changed file: - libraries/base/src/GHC/IO/Encoding/Iconv.hs Changes: ===================================== libraries/base/src/GHC/IO/Encoding/Iconv.hs ===================================== @@ -15,8 +15,8 @@ -- This module provides text encoding/decoding using iconv -- -module GHC.IO.Encoding.Iconv #if !defined(mingw32_HOST_OS) +module GHC.IO.Encoding.Iconv (iconvEncoding, mkIconvEncoding, localeEncodingName @@ -25,6 +25,8 @@ module GHC.IO.Encoding.Iconv import GHC.Internal.IO.Encoding.Iconv #else - ( ) where +module GHC.IO.Encoding.Iconv ( ) where + +import GHC.Internal.Base () -- For build ordering #endif View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/244a1c323e469f9b3b20ccebe6ceb58f4c6946d9 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/244a1c323e469f9b3b20ccebe6ceb58f4c6946d9 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 19:32:31 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 14:32:31 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/tsan/fixes-3 Message-ID: <65ecb94fb397f_1f4c8b9af11cc12175@gitlab.mail> Ben Gamari pushed new branch wip/tsan/fixes-3 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/tsan/fixes-3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 20:17:45 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 15:17:45 -0500 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 17 commits: Error messages: Improve Error messages for Data constructors in type signatures. Message-ID: <65ecc3e9b720a_1f4c8baf7b4e41311fb@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - ddffaba0 by Vladislav Zavialov at 2024-03-09T15:17:41-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - docs/users_guide/9.10.1-notes.rst - docs/users_guide/exts/type_abstractions.rst - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - + libraries/ghc-internal/src/GHC/Internal/InfoProv.hs - libraries/ghc-internal/src/GHC/Internal/InfoProv.hsc → libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc - libraries/ghc-internal/src/GHC/Internal/Stack/CloneStack.hs - rts/CloneStack.c - rts/CloneStack.h - rts/IPE.c The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6204c3e781fd3f279eed73d6756a83a4ad7e5d78...ddffaba03ecb57b90b33ee72f3371a10bf1e1c1f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6204c3e781fd3f279eed73d6756a83a4ad7e5d78...ddffaba03ecb57b90b33ee72f3371a10bf1e1c1f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 22:38:23 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 17:38:23 -0500 Subject: [Git][ghc/ghc][master] 9 commits: rts/CloneStack: Bounds check array write Message-ID: <65ece4dfd2af9_3a044c3cc1d2c1015e@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 30 changed files: - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/StgToCmm/InfoTableProv.hs - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Exts.hs - + libraries/ghc-internal/src/GHC/Internal/InfoProv.hs - libraries/ghc-internal/src/GHC/Internal/InfoProv.hsc → libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc - libraries/ghc-internal/src/GHC/Internal/Stack/CloneStack.hs - rts/CloneStack.c - rts/CloneStack.h - rts/IPE.c - rts/IPE.h - rts/PrimOps.cmm - rts/Trace.c - rts/include/rts/IPE.h - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - testsuite/tests/profiling/should_run/staticcallstack001.stdout - testsuite/tests/profiling/should_run/staticcallstack002.stdout - testsuite/tests/rts/ipe/T24005/t24005.stdout - testsuite/tests/rts/ipe/ipeEventLog.stderr - testsuite/tests/rts/ipe/ipeEventLog_fromMap.c - testsuite/tests/rts/ipe/ipeEventLog_fromMap.stderr - testsuite/tests/rts/ipe/ipeMap.c - testsuite/tests/rts/ipe/ipe_lib.c Changes: ===================================== compiler/GHC/Builtin/primops.txt.pp ===================================== @@ -3849,10 +3849,9 @@ primop ClearCCSOp "clearCCS#" GenPrimOp section "Info Table Origin" ------------------------------------------------------------------------ primop WhereFromOp "whereFrom#" GenPrimOp - a -> State# s -> (# State# s, Addr# #) - { Returns the @InfoProvEnt @ for the info table of the given object - (value is @NULL@ if the table does not exist or there is no information - about the closure).} + a -> Addr# -> State# s -> (# State# s, Int# #) + { Fills the given buffer with the @InfoProvEnt@ for the info table of the + given object. Returns @1#@ on success and @0#@ otherwise.} with out_of_line = True ===================================== compiler/GHC/StgToCmm/InfoTableProv.hs ===================================== @@ -83,9 +83,11 @@ emitIpeBufferListNode this_mod ents = do platform = stgToCmmPlatform cfg int n = mkIntCLit platform n - (cg_ipes, strtab) = flip runState emptyStringTable $ do - module_name <- lookupStringTable $ ST.pack $ renderWithContext ctx (ppr this_mod) - mapM (toCgIPE platform ctx module_name) ents + ((cg_ipes, unit_id, module_name), strtab) = flip runState emptyStringTable $ do + unit_id <- lookupStringTable $ ST.pack $ renderWithContext ctx (ppr $ moduleName this_mod) + module_name <- lookupStringTable $ ST.pack $ renderWithContext ctx (ppr $ moduleUnit this_mod) + cg_ipes <- mapM (toCgIPE platform ctx) ents + return (cg_ipes, unit_id, module_name) tables :: [CmmStatic] tables = map (CmmStaticLit . CmmLabel . ipeInfoTablePtr) cg_ipes @@ -136,6 +138,12 @@ emitIpeBufferListNode this_mod ents = do -- 'string_table_size' field (decompressed size) , int $ BS.length uncompressed_strings + + -- 'module_name' field + , CmmInt (fromIntegral module_name) W32 + + -- 'unit_id' field + , CmmInt (fromIntegral unit_id) W32 ] -- Emit the list of info table pointers @@ -173,10 +181,8 @@ toIpeBufferEntries byte_order cg_ipes = , ipeClosureDesc cg_ipe , ipeTypeDesc cg_ipe , ipeLabel cg_ipe - , ipeModuleName cg_ipe , ipeSrcFile cg_ipe , ipeSrcSpan cg_ipe - , 0 -- padding ] word32Builder :: Word32 -> BSB.Builder @@ -184,8 +190,8 @@ toIpeBufferEntries byte_order cg_ipes = BigEndian -> BSB.word32BE LittleEndian -> BSB.word32LE -toCgIPE :: Platform -> SDocContext -> StrTabOffset -> InfoProvEnt -> State StringTable CgInfoProvEnt -toCgIPE platform ctx module_name ipe = do +toCgIPE :: Platform -> SDocContext -> InfoProvEnt -> State StringTable CgInfoProvEnt +toCgIPE platform ctx ipe = do table_name <- lookupStringTable $ ST.pack $ renderWithContext ctx (pprCLabel platform (infoTablePtr ipe)) closure_desc <- lookupStringTable $ ST.pack $ show (infoProvEntClosureType ipe) type_desc <- lookupStringTable $ ST.pack $ infoTableType ipe @@ -205,7 +211,6 @@ toCgIPE platform ctx module_name ipe = do , ipeClosureDesc = closure_desc , ipeTypeDesc = type_desc , ipeLabel = label - , ipeModuleName = module_name , ipeSrcFile = src_file , ipeSrcSpan = src_span } @@ -216,7 +221,6 @@ data CgInfoProvEnt = CgInfoProvEnt , ipeClosureDesc :: !StrTabOffset , ipeTypeDesc :: !StrTabOffset , ipeLabel :: !StrTabOffset - , ipeModuleName :: !StrTabOffset , ipeSrcFile :: !StrTabOffset , ipeSrcSpan :: !StrTabOffset } ===================================== libraries/base/changelog.md ===================================== @@ -47,6 +47,8 @@ matches a `data` or `data instance` declaration) with all of its constructors in scope and the levity of `t` is statically known, then the constraint `DataToTag t` can always be solved. + * `GHC.Exts` no longer exports the GHC-internal `whereFrom#` primop ([CLC proposal #214](https://github.com/haskell/core-libraries-committee/issues/214)) + * `GHC.InfoProv.InfoProv` now provides a `ipUnitId :: String` field encoding the unit ID of the unit defining the info table ([CLC proposal #214](https://github.com/haskell/core-libraries-committee/issues/214)) ([CLC proposal #104](https://github.com/haskell/core-libraries-committee/issues/104)) * Add `sortOn` to `Data.List.NonEmpty` ===================================== libraries/base/src/GHC/Base.hs ===================================== @@ -139,7 +139,12 @@ module GHC.Base ) where import GHC.Internal.Base -import GHC.Prim hiding (dataToTagLarge#, dataToTagSmall#) +import GHC.Prim hiding (dataToTagLarge#, dataToTagSmall#, whereFrom#) + -- Hide dataToTagLarge# because it is expected to break for + -- GHC-internal reasons in the near future, and shouldn't + -- be exposed from base (not even GHC.Exts) + -- whereFrom# is similarly internal. + import GHC.Prim.Ext import GHC.Prim.PtrEq import GHC.Internal.Err ===================================== libraries/base/src/GHC/Exts.hs ===================================== @@ -111,10 +111,11 @@ module GHC.Exts import GHC.Internal.Exts import GHC.Internal.ArrayArray -import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge# ) +import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge#, whereFrom# ) -- Hide dataToTag# ops because they are expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts) + -- whereFrom# is similarly internal. import GHC.Prim.Ext ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -197,6 +197,7 @@ Library GHC.Internal.GHCi.Helpers GHC.Internal.Generics GHC.Internal.InfoProv + GHC.Internal.InfoProv.Types GHC.Internal.IO GHC.Internal.IO.Buffer GHC.Internal.IO.BufferedIO ===================================== libraries/ghc-internal/src/GHC/Internal/Base.hs ===================================== @@ -315,7 +315,7 @@ import GHC.Classes hiding ( import GHC.CString import GHC.Magic import GHC.Magic.Dict -import GHC.Prim hiding (dataToTagSmall#, dataToTagLarge#) +import GHC.Prim hiding (dataToTagSmall#, dataToTagLarge#, whereFrom#) -- Hide dataToTag# ops because they are expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts) ===================================== libraries/ghc-internal/src/GHC/Internal/Exts.hs ===================================== @@ -133,10 +133,11 @@ module GHC.Internal.Exts maxTupleSize, ) where -import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge# ) - -- Hide dataToTag# ops because they are expected to break for +import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge#, whereFrom# ) + -- Hide dataToTagLarge# because it is expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts) + -- whereFrom# is similarly internal. import GHC.Types hiding ( IO -- Exported from "GHC.IO" ===================================== libraries/ghc-internal/src/GHC/Internal/InfoProv.hs ===================================== @@ -0,0 +1,53 @@ +{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE TypeApplications #-} + +----------------------------------------------------------------------------- +-- | +-- Module : GHC.Internal.InfoProv +-- Copyright : (c) The University of Glasgow 2011 +-- License : see libraries/base/LICENSE +-- +-- Maintainer : ghc-devs at haskell.org +-- Stability : internal +-- Portability : non-portable (GHC Extensions) +-- +-- Access to GHC's info-table provenance metadata. +-- +-- /The API of this module is unstable and not meant to be consumed by the general public./ +-- If you absolutely must depend on it, make sure to use a tight upper +-- bound, e.g., @base < 4.X@ rather than @base < 5@, because the interface can +-- change rapidly without much warning. +-- +-- @since base-4.18.0.0 +----------------------------------------------------------------------------- + +module GHC.Internal.InfoProv + ( InfoProv(..) + , ipLoc + , whereFrom + -- * Internals + , InfoProvEnt + , ipeProv + , peekInfoProv + ) where + +import GHC.Internal.Base +import GHC.Internal.InfoProv.Types + +-- | Get information about where a value originated from. +-- This information is stored statically in a binary when @-finfo-table-map@ is +-- enabled. The source positions will be greatly improved by also enabled debug +-- information with @-g3 at . Finally you can enable @-fdistinct-constructor-tables@ to +-- get more precise information about data constructor allocations. +-- +-- The information is collect by looking at the info table address of a specific closure and +-- then consulting a specially generated map (by @-finfo-table-map@) to find out where we think +-- the best source position to describe that info table arose from. +-- +-- @since base-4.16.0.0 +whereFrom :: a -> IO (Maybe InfoProv) +whereFrom obj = getIPE obj Nothing $ \p -> + Just `fmap` peekInfoProv (ipeProv p) ===================================== libraries/ghc-internal/src/GHC/Internal/InfoProv.hsc → libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc ===================================== @@ -1,79 +1,80 @@ +{-# LANGUAGE TypeApplications #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE TypeApplications #-} ------------------------------------------------------------------------------ --- | --- Module : GHC.Internal.InfoProv --- Copyright : (c) The University of Glasgow 2011 --- License : see libraries/base/LICENSE --- --- Maintainer : ghc-devs at haskell.org --- Stability : internal --- Portability : non-portable (GHC Extensions) --- --- Access to GHC's info-table provenance metadata. --- --- /The API of this module is unstable and not meant to be consumed by the general public./ --- If you absolutely must depend on it, make sure to use a tight upper --- bound, e.g., @base < 4.X@ rather than @base < 5@, because the interface can --- change rapidly without much warning. --- --- @since base-4.18.0.0 ------------------------------------------------------------------------------ +#include "Rts.h" -module GHC.Internal.InfoProv +module GHC.Internal.InfoProv.Types ( InfoProv(..) , ipLoc , ipeProv - , whereFrom - -- * Internals , InfoProvEnt , peekInfoProv + , getIPE + , StgInfoTable + , lookupIPE ) where -#include "Rts.h" - import GHC.Internal.Base +import GHC.Internal.Data.Maybe import GHC.Internal.Enum -import GHC.Internal.Show -import GHC.Internal.Ptr (Ptr(..), plusPtr, nullPtr) +import GHC.Internal.Show (Show) +import GHC.Internal.Ptr (Ptr(..), plusPtr) +import GHC.Internal.Foreign.C.String.Encoding (CString, peekCString) +import GHC.Internal.Foreign.C.Types (CBool(..)) +import GHC.Internal.Foreign.Marshal.Alloc (allocaBytes) import GHC.Internal.IO.Encoding (utf8) import GHC.Internal.Foreign.Storable (peekByteOff) -import GHC.Internal.Foreign.C.String.Encoding -import GHC.Internal.Text.Read (readMaybe) -import GHC.Internal.Data.Maybe (maybe) -import GHC.Internal.ClosureTypes ( ClosureType(..) ) +import GHC.Internal.ClosureTypes +import GHC.Internal.Text.Read +import GHC.Prim (whereFrom##) data InfoProv = InfoProv { ipName :: String, ipDesc :: ClosureType, ipTyDesc :: String, ipLabel :: String, + -- | @since base-4.20.0.0 + ipUnitId :: String, ipMod :: String, ipSrcFile :: String, ipSrcSpan :: String } deriving (Eq, Show) -data InfoProvEnt - ipLoc :: InfoProv -> String ipLoc ipe = ipSrcFile ipe ++ ":" ++ ipSrcSpan ipe -getIPE :: a -> IO (Ptr InfoProvEnt) -getIPE obj = IO $ \s -> - case whereFrom## obj s of - (## s', addr ##) -> (## s', Ptr addr ##) +data InfoProvEnt + +data StgInfoTable + +foreign import ccall "lookupIPE" c_lookupIPE :: Ptr StgInfoTable -> Ptr InfoProvEnt -> IO CBool + +lookupIPE :: Ptr StgInfoTable -> IO (Maybe InfoProv) +lookupIPE itbl = allocaBytes (#size InfoProvEnt) $ \p -> do + res <- c_lookupIPE itbl p + case res of + 1 -> Just `fmap` peekInfoProv (ipeProv p) + _ -> return Nothing + +getIPE :: a -> r -> (Ptr InfoProvEnt -> IO r) -> IO r +getIPE obj fail k = allocaBytes (#size InfoProvEnt) $ \p -> IO $ \s -> + case whereFrom## obj (unPtr p) s of + (## s', 1## ##) -> unIO (k p) s' + (## s', _ ##) -> (## s', fail ##) + where + unPtr (Ptr p) = p ipeProv :: Ptr InfoProvEnt -> Ptr InfoProv ipeProv p = (#ptr InfoProvEnt, prov) p -peekIpName, peekIpDesc, peekIpLabel, peekIpModule, peekIpSrcFile, peekIpSrcSpan, peekIpTyDesc :: Ptr InfoProv -> IO CString +peekIpName, peekIpDesc, peekIpLabel, peekIpUnitId, peekIpModule, peekIpSrcFile, peekIpSrcSpan, peekIpTyDesc :: Ptr InfoProv -> IO CString peekIpName p = (# peek InfoProv, table_name) p peekIpDesc p = (# peek InfoProv, closure_desc) p peekIpLabel p = (# peek InfoProv, label) p +peekIpUnitId p = (# peek InfoProv, unit_id) p peekIpModule p = (# peek InfoProv, module) p peekIpSrcFile p = (# peek InfoProv, src_file) p peekIpSrcSpan p = (# peek InfoProv, src_span) p @@ -85,6 +86,7 @@ peekInfoProv infop = do desc <- peekCString utf8 =<< peekIpDesc infop tyDesc <- peekCString utf8 =<< peekIpTyDesc infop label <- peekCString utf8 =<< peekIpLabel infop + unit_id <- peekCString utf8 =<< peekIpUnitId infop mod <- peekCString utf8 =<< peekIpModule infop file <- peekCString utf8 =<< peekIpSrcFile infop span <- peekCString utf8 =<< peekIpSrcSpan infop @@ -95,31 +97,9 @@ peekInfoProv infop = do ipDesc = maybe INVALID_OBJECT toEnum . readMaybe @Int $ desc, ipTyDesc = tyDesc, ipLabel = label, + ipUnitId = unit_id, ipMod = mod, ipSrcFile = file, ipSrcSpan = span } --- | Get information about where a value originated from. --- This information is stored statically in a binary when @-finfo-table-map@ is --- enabled. The source positions will be greatly improved by also enabled debug --- information with @-g3 at . Finally you can enable @-fdistinct-constructor-tables@ to --- get more precise information about data constructor allocations. --- --- The information is collect by looking at the info table address of a specific closure and --- then consulting a specially generated map (by @-finfo-table-map@) to find out where we think --- the best source position to describe that info table arose from. --- --- @since base-4.16.0.0 -whereFrom :: a -> IO (Maybe InfoProv) -whereFrom obj = do - ipe <- getIPE obj - -- The primop returns the null pointer in two situations at the moment - -- 1. The lookup fails for whatever reason - -- 2. -finfo-table-map is not enabled. - -- It would be good to distinguish between these two cases somehow. - if ipe == nullPtr - then return Nothing - else do - infoProv <- peekInfoProv (ipeProv ipe) - return $ Just infoProv ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/CloneStack.hs ===================================== @@ -25,21 +25,23 @@ module GHC.Internal.Stack.CloneStack ( import GHC.Internal.MVar import GHC.Internal.Data.Maybe (catMaybes) import GHC.Internal.Base +import GHC.Internal.Foreign.Storable import GHC.Internal.Conc.Sync -import GHC.Internal.Exts () -- (Int (I#), RealWorld, StackSnapshot#, ThreadId#, Array#, sizeofArray#, indexArray#, State#, StablePtr#) -import GHC.Internal.InfoProv (InfoProv (..), InfoProvEnt, ipLoc, ipeProv, peekInfoProv) +import GHC.Internal.IO (unsafeInterleaveIO) +import GHC.Internal.InfoProv.Types (InfoProv (..), ipLoc, lookupIPE, StgInfoTable) import GHC.Internal.Num +import GHC.Internal.Real (div) import GHC.Internal.Stable import GHC.Internal.Text.Show import GHC.Internal.Ptr -import GHC.Internal.ClosureTypes ( ClosureType(..) ) +import GHC.Internal.ClosureTypes -- | A frozen snapshot of the state of an execution stack. -- -- @since base-4.17.0.0 data StackSnapshot = StackSnapshot !StackSnapshot# -foreign import prim "stg_decodeStackzh" decodeStack# :: StackSnapshot# -> State# RealWorld -> (# State# RealWorld, Array# (Ptr InfoProvEnt) #) +foreign import prim "stg_decodeStackzh" decodeStack# :: StackSnapshot# -> State# RealWorld -> (# State# RealWorld, ByteArray# #) foreign import prim "stg_cloneMyStackzh" cloneMyStack# :: State# RealWorld -> (# State# RealWorld, StackSnapshot# #) @@ -231,39 +233,35 @@ data StackEntry = StackEntry -- -- @since base-4.17.0.0 decode :: StackSnapshot -> IO [StackEntry] -decode stackSnapshot = do - stackEntries <- getDecodedStackArray stackSnapshot - ipes <- mapM unmarshal stackEntries - return $ catMaybes ipes - - where - unmarshal :: Ptr InfoProvEnt -> IO (Maybe StackEntry) - unmarshal ipe = if ipe == nullPtr then - pure Nothing - else do - infoProv <- (peekInfoProv . ipeProv) ipe - pure $ Just (toStackEntry infoProv) - toStackEntry :: InfoProv -> StackEntry - toStackEntry infoProv = - StackEntry - { functionName = ipLabel infoProv, - moduleName = ipMod infoProv, - srcLoc = ipLoc infoProv, - closureType = ipDesc $ infoProv - } - -getDecodedStackArray :: StackSnapshot -> IO [Ptr InfoProvEnt] +decode stackSnapshot = catMaybes `fmap` getDecodedStackArray stackSnapshot + +toStackEntry :: InfoProv -> StackEntry +toStackEntry infoProv = + StackEntry + { functionName = ipLabel infoProv, + moduleName = ipMod infoProv, + srcLoc = ipLoc infoProv, + closureType = ipDesc infoProv + } + +getDecodedStackArray :: StackSnapshot -> IO [Maybe StackEntry] getDecodedStackArray (StackSnapshot s) = IO $ \s0 -> case decodeStack# s s0 of - (# s1, a #) -> (# s1, (go a ((I# (sizeofArray# a)) - 1)) #) + (# s1, arr #) -> + let n = I# (sizeofByteArray# arr) `div` wordSize - 1 + in unIO (go arr n) s1 where - go :: Array# (Ptr InfoProvEnt) -> Int -> [Ptr InfoProvEnt] - go stack 0 = [stackEntryAt stack 0] - go stack i = (stackEntryAt stack i) : go stack (i - 1) + go :: ByteArray# -> Int -> IO [Maybe StackEntry] + go _stack (-1) = return [] + go stack i = do + infoProv <- lookupIPE (stackEntryAt stack i) + rest <- unsafeInterleaveIO $ go stack (i-1) + return ((toStackEntry `fmap` infoProv) : rest) + + stackEntryAt :: ByteArray# -> Int -> Ptr StgInfoTable + stackEntryAt stack (I# i) = Ptr (indexAddrArray# stack i) - stackEntryAt :: Array# (Ptr InfoProvEnt) -> Int -> Ptr InfoProvEnt - stackEntryAt stack (I# i) = case indexArray# stack i of - (# se #) -> se + wordSize = sizeOf (nullPtr :: Ptr ()) prettyStackEntry :: StackEntry -> String prettyStackEntry (StackEntry {moduleName=mod_nm, functionName=fun_nm, srcLoc=loc}) = ===================================== rts/CloneStack.c ===================================== @@ -25,6 +25,12 @@ #include + +static StgWord getStackFrameCount(StgStack* stack); +static StgWord getStackChunkClosureCount(StgStack* stack); +static StgArrBytes* allocateByteArray(Capability *cap, StgWord bytes); +static void copyPtrsToArray(StgArrBytes* arr, StgStack* stack); + static StgStack* cloneStackChunk(Capability* capability, const StgStack* stack) { StgWord spOffset = stack->sp - stack->stack; @@ -109,12 +115,12 @@ void sendCloneStackMessage(StgTSO *tso STG_UNUSED, HsStablePtr mvar STG_UNUSED) // array is the count of stack frames. // Each InfoProvEnt* is looked up by lookupIPE(). If there's no IPE for a stack // frame it's represented by null. -StgMutArrPtrs* decodeClonedStack(Capability *cap, StgStack* stack) { +StgArrBytes* decodeClonedStack(Capability *cap, StgStack* stack) { StgWord closureCount = getStackFrameCount(stack); - StgMutArrPtrs* array = allocateMutableArray(closureCount); + StgArrBytes* array = allocateByteArray(cap, sizeof(StgInfoTable*) * closureCount); - copyPtrsToArray(cap, array, stack); + copyPtrsToArray(array, stack); return array; } @@ -150,52 +156,34 @@ StgWord getStackChunkClosureCount(StgStack* stack) { return closureCount; } -// Allocate and initialize memory for a MutableArray# (Haskell representation). -StgMutArrPtrs* allocateMutableArray(StgWord closureCount) { +// Allocate and initialize memory for a ByteArray# (Haskell representation). +StgArrBytes* allocateByteArray(Capability *cap, StgWord bytes) { // Idea stolen from PrimOps.cmm:stg_newArrayzh() - StgWord size = closureCount + mutArrPtrsCardTableSize(closureCount); - StgWord words = sizeofW(StgMutArrPtrs) + size; - - StgMutArrPtrs* array = (StgMutArrPtrs*) allocate(myTask()->cap, words); + StgWord words = sizeofW(StgArrBytes) + bytes; - SET_HDR(array, &stg_MUT_ARR_PTRS_DIRTY_info, CCS_SYSTEM); - array->ptrs = closureCount; - array->size = size; + StgArrBytes* array = (StgArrBytes*) allocate(cap, words); + SET_HDR(array, &stg_ARR_WORDS_info, CCS_SYSTEM); + array->bytes = bytes; return array; } - -void copyPtrsToArray(Capability *cap, StgMutArrPtrs* arr, StgStack* stack) { +static void copyPtrsToArray(StgArrBytes* arr, StgStack* stack) { StgWord index = 0; StgStack *last_stack = stack; + const StgInfoTable **result = (const StgInfoTable **) arr->payload; while (true) { StgPtr sp = last_stack->sp; StgPtr spBottom = last_stack->stack + last_stack->stack_size; for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) { - const StgInfoTable* infoTable = get_itbl((StgClosure *)sp); - - // Add the IPE that was looked up by lookupIPE() to the MutableArray#. - // The "Info Table Provernance Entry Map" (IPE) idea is to use a pointer - // (address) to the info table to lookup entries, this is fulfilled in - // non-"Tables Next to Code" builds. - // When "Tables Next to Code" is used, the assembly label of the info table - // is between the info table and it's code. There's no other label in the - // assembly code which could be used instead, thus lookupIPE() is actually - // called with the code pointer of the info table. - // (As long as it's used consistently, this doesn't really matter - IPE uses - // the pointer only to connect an info table to it's provenance entry in the - // IPE map.) -#if defined(TABLES_NEXT_TO_CODE) - InfoProvEnt* ipe = lookupIPE((StgInfoTable*) infoTable->code); -#else - InfoProvEnt* ipe = lookupIPE(infoTable); -#endif - arr->payload[index] = createPtrClosure(cap, ipe); - + const StgInfoTable* infoTable = ((StgClosure *)sp)->header.info; + result[index] = infoTable; index++; } + // Ensure that we didn't overflow the result array + ASSERT(index-1 < arr->bytes / sizeof(StgInfoTable*)); + // check whether the stack ends in an underflow frame StgUnderflowFrame *frame = (StgUnderflowFrame *) (last_stack->stack + last_stack->stack_size - sizeofW(StgUnderflowFrame)); @@ -206,12 +194,3 @@ void copyPtrsToArray(Capability *cap, StgMutArrPtrs* arr, StgStack* stack) { } } } - -// Create a GHC.Ptr (Haskell constructor: `Ptr InfoProvEnt`) pointing to the -// IPE. -StgClosure* createPtrClosure(Capability *cap, InfoProvEnt* ipe) { - StgClosure *p = (StgClosure *) allocate(cap, CONSTR_sizeW(0,1)); - SET_HDR(p, &ghczminternal_GHCziInternalziPtr_Ptr_con_info, CCS_SYSTEM); - p->payload[0] = (StgClosure*) ipe; - return TAG_CLOSURE(1, p); -} ===================================== rts/CloneStack.h ===================================== @@ -15,7 +15,7 @@ StgStack* cloneStack(Capability* capability, const StgStack* stack); void sendCloneStackMessage(StgTSO *tso, HsStablePtr mvar); -StgMutArrPtrs* decodeClonedStack(Capability *cap, StgStack* stack); +StgArrBytes* decodeClonedStack(Capability *cap, StgStack* stack); #include "BeginPrivate.h" @@ -23,10 +23,4 @@ StgMutArrPtrs* decodeClonedStack(Capability *cap, StgStack* stack); void handleCloneStackMessage(MessageCloneStack *msg); #endif -StgWord getStackFrameCount(StgStack* stack); -StgWord getStackChunkClosureCount(StgStack* stack); -void copyPtrsToArray(Capability *cap, StgMutArrPtrs* arr, StgStack* stack); -StgClosure* createPtrClosure(Capability* cap, InfoProvEnt* ipe); -StgMutArrPtrs* allocateMutableArray(StgWord size); - #include "EndPrivate.h" ===================================== rts/IPE.c ===================================== @@ -52,16 +52,23 @@ of InfoProvEnt are represented in IpeBufferEntry as 32-bit offsets into the string table. This allows us to halve the size of the buffer entries on 64-bit machines while significantly reducing the number of needed relocations, reducing linking cost. Moreover, the code generator takes care -to deduplicate strings when generating the string table. When we insert a -set of IpeBufferEntrys into the IPE hash-map we convert them to InfoProvEnts, -which contain proper string pointers. +to deduplicate strings when generating the string table. Building the hash map is done lazily, i.e. on first lookup or traversal. For this all IPE lists of all IpeBufferListNode are traversed to insert all IPEs. +This involves allocating a IpeMapEntry for each IPE entry, pointing to the +entry's containing IpeBufferListNode and its index in that node. + +When the user looks up an IPE entry, we convert it to the user-facing +InfoProvEnt representation. -After the content of a IpeBufferListNode has been inserted, it's freed. */ +typedef struct { + IpeBufferListNode *node; + uint32_t idx; +} IpeMapEntry; + #if defined(THREADED_RTS) static Mutex ipeMapLock; #endif @@ -71,6 +78,9 @@ static HashTable *ipeMap = NULL; // Accessed atomically static IpeBufferListNode *ipeBufferList = NULL; +static void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode*); +static void updateIpeMap(void); + #if defined(THREADED_RTS) void initIpe(void) { initMutex(&ipeMapLock); } @@ -85,18 +95,23 @@ void exitIpe(void) { } #endif // THREADED_RTS -static InfoProvEnt ipeBufferEntryToIpe(const char *strings, const StgInfoTable *tbl, const IpeBufferEntry ent) +static InfoProvEnt ipeBufferEntryToIpe(const IpeBufferListNode *node, uint32_t idx) { + CHECK(idx < node->count); + CHECK(!node->compressed); + const char *strings = node->string_table; + const IpeBufferEntry *ent = &node->entries[idx]; return (InfoProvEnt) { - .info = tbl, + .info = node->tables[idx], .prov = { - .table_name = &strings[ent.table_name], - .closure_desc = &strings[ent.closure_desc], - .ty_desc = &strings[ent.ty_desc], - .label = &strings[ent.label], - .module = &strings[ent.module_name], - .src_file = &strings[ent.src_file], - .src_span = &strings[ent.src_span] + .table_name = &strings[ent->table_name], + .closure_desc = &strings[ent->closure_desc], + .ty_desc = &strings[ent->ty_desc], + .label = &strings[ent->label], + .unit_id = &strings[node->unit_id], + .module = &strings[node->module_name], + .src_file = &strings[ent->src_file], + .src_span = &strings[ent->src_span] } }; } @@ -105,29 +120,22 @@ static InfoProvEnt ipeBufferEntryToIpe(const char *strings, const StgInfoTable * #if defined(TRACING) static void traceIPEFromHashTable(void *data STG_UNUSED, StgWord key STG_UNUSED, const void *value) { - InfoProvEnt *ipe = (InfoProvEnt *)value; - traceIPE(ipe); + const IpeMapEntry *map_ent = (const IpeMapEntry *)value; + const InfoProvEnt ipe = ipeBufferEntryToIpe(map_ent->node, map_ent->idx); + traceIPE(&ipe); } void dumpIPEToEventLog(void) { // Dump pending entries - IpeBufferListNode *cursor = RELAXED_LOAD(&ipeBufferList); - while (cursor != NULL) { - IpeBufferEntry *entries; - const char *strings; + IpeBufferListNode *node = RELAXED_LOAD(&ipeBufferList); + while (node != NULL) { + decompressIPEBufferListNodeIfCompressed(node); - // Decompress if compressed - decompressIPEBufferListNodeIfCompressed(cursor, &entries, &strings); - - for (uint32_t i = 0; i < cursor->count; i++) { - const InfoProvEnt ent = ipeBufferEntryToIpe( - strings, - cursor->tables[i], - entries[i] - ); + for (uint32_t i = 0; i < node->count; i++) { + const InfoProvEnt ent = ipeBufferEntryToIpe(node, i); traceIPE(&ent); } - cursor = cursor->next; + node = node->next; } // Dump entries already in hashmap @@ -168,9 +176,15 @@ void registerInfoProvList(IpeBufferListNode *node) { } } -InfoProvEnt *lookupIPE(const StgInfoTable *info) { +bool lookupIPE(const StgInfoTable *info, InfoProvEnt *out) { updateIpeMap(); - return lookupHashTable(ipeMap, (StgWord)info); + IpeMapEntry *map_ent = (IpeMapEntry *) lookupHashTable(ipeMap, (StgWord)info); + if (map_ent) { + *out = ipeBufferEntryToIpe(map_ent->node, map_ent->idx); + return true; + } else { + return false; + } } void updateIpeMap(void) { @@ -188,47 +202,40 @@ void updateIpeMap(void) { } while (pending != NULL) { - IpeBufferListNode *current_node = pending; - IpeBufferEntry *entries; - const char *strings; + IpeBufferListNode *node = pending; // Decompress if compressed - decompressIPEBufferListNodeIfCompressed(current_node, &entries, &strings); - - // Convert the on-disk IPE buffer entry representation (IpeBufferEntry) - // into the runtime representation (InfoProvEnt) - InfoProvEnt *ip_ents = stgMallocBytes( - sizeof(InfoProvEnt) * current_node->count, - "updateIpeMap: ip_ents" - ); - for (uint32_t i = 0; i < current_node->count; i++) { - const IpeBufferEntry ent = entries[i]; - const StgInfoTable *tbl = current_node->tables[i]; - ip_ents[i] = ipeBufferEntryToIpe(strings, tbl, ent); - insertHashTable(ipeMap, (StgWord) tbl, &ip_ents[i]); + decompressIPEBufferListNodeIfCompressed(node); + + // Insert entries into ipeMap + IpeMapEntry *map_ents = stgMallocBytes(node->count * sizeof(IpeMapEntry), "updateIpeMap: ip_ents"); + for (uint32_t i = 0; i < node->count; i++) { + const StgInfoTable *tbl = node->tables[i]; + map_ents[i].node = node; + map_ents[i].idx = i; + insertHashTable(ipeMap, (StgWord) tbl, &map_ents[i]); } - pending = current_node->next; + pending = node->next; } RELEASE_LOCK(&ipeMapLock); } /* Decompress the IPE data and strings table referenced by an IPE buffer list -node if it is compressed. No matter whether the data is compressed, the pointers -referenced by the 'entries_dst' and 'string_table_dst' parameters will point at -the decompressed IPE data and string table for the given node, respectively, -upon return from this function. -*/ -void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node, IpeBufferEntry **entries_dst, const char **string_table_dst) { + * node if it is compressed. After returning node->compressed with be 0 and the + * string_table and entries fields will have their uncompressed values. + */ +void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node) { if (node->compressed == 1) { + node->compressed = 0; + // The IPE list buffer node indicates that the strings table and // entries list has been compressed. If zstd is not available, fail. // If zstd is available, decompress. #if HAVE_LIBZSTD == 0 barf("An IPE buffer list node has been compressed, but the " - "decompression library (zstd) is not available." -); + "decompression library (zstd) is not available."); #else size_t compressed_sz = ZSTD_findFrameCompressedSize( node->string_table, @@ -244,7 +251,7 @@ void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node, IpeBufferE node->string_table, compressed_sz ); - *string_table_dst = decompressed_strings; + node->string_table = (const char *) decompressed_strings; // Decompress the IPE data compressed_sz = ZSTD_findFrameCompressedSize( @@ -261,12 +268,8 @@ void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node, IpeBufferE node->entries, compressed_sz ); - *entries_dst = decompressed_entries; + node->entries = decompressed_entries; #endif // HAVE_LIBZSTD == 0 - } else { - // Not compressed, no need to decompress - *entries_dst = node->entries; - *string_table_dst = node->string_table; } } ===================================== rts/IPE.h ===================================== @@ -14,9 +14,7 @@ #include "BeginPrivate.h" void dumpIPEToEventLog(void); -void updateIpeMap(void); void initIpe(void); void exitIpe(void); -void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode*, IpeBufferEntry**, const char**); #include "EndPrivate.h" ===================================== rts/PrimOps.cmm ===================================== @@ -2533,13 +2533,13 @@ stg_closureSizzezh (P_ clos) return (len); } -stg_whereFromzh (P_ clos) +stg_whereFromzh (P_ clos, W_ buf) { - P_ ipe; + CBool success; W_ info; info = GET_INFO(UNTAG(clos)); - (ipe) = foreign "C" lookupIPE(info "ptr"); - return (ipe); + (success) = foreign "C" lookupIPE(info, buf); + return (TO_W_(success)); } /* ----------------------------------------------------------------------------- ===================================== rts/Trace.c ===================================== @@ -689,9 +689,10 @@ void traceIPE(const InfoProvEnt *ipe) ACQUIRE_LOCK(&trace_utx); tracePreface(); - debugBelch("IPE: table_name %s, closure_desc %s, ty_desc %s, label %s, module %s, srcloc %s:%s\n", + debugBelch("IPE: table_name %s, closure_desc %s, ty_desc %s, label %s, unit %s, module %s, srcloc %s:%s\n", ipe->prov.table_name, ipe->prov.closure_desc, ipe->prov.ty_desc, - ipe->prov.label, ipe->prov.module, ipe->prov.src_file, ipe->prov.src_span); + ipe->prov.label, ipe->prov.unit_id, ipe->prov.module, + ipe->prov.src_file, ipe->prov.src_span); RELEASE_LOCK(&trace_utx); } else ===================================== rts/include/rts/IPE.h ===================================== @@ -18,6 +18,7 @@ typedef struct InfoProv_ { const char *closure_desc; const char *ty_desc; const char *label; + const char *unit_id; const char *module; const char *src_file; const char *src_span; @@ -56,10 +57,8 @@ typedef struct { StringIdx closure_desc; StringIdx ty_desc; StringIdx label; - StringIdx module_name; StringIdx src_file; StringIdx src_span; - uint32_t _padding; } IpeBufferEntry; GHC_STATIC_ASSERT(sizeof(IpeBufferEntry) % (WORD_SIZE_IN_BITS / 8) == 0, "sizeof(IpeBufferEntry) must be a multiple of the word size"); @@ -77,13 +76,18 @@ typedef struct IpeBufferListNode_ { // When TNTC is enabled, these will point to the entry code // not the info table itself. const StgInfoTable **tables; - IpeBufferEntry *entries; StgWord entries_size; // decompressed size const char *string_table; StgWord string_table_size; // decompressed size + + // Shared by all entries + StringIdx unit_id; + StringIdx module_name; } IpeBufferListNode; void registerInfoProvList(IpeBufferListNode *node); -InfoProvEnt *lookupIPE(const StgInfoTable *info); + +// Returns true on success, initializes `out`. +bool lookupIPE(const StgInfoTable *info, InfoProvEnt *out); ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -4755,7 +4755,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -6857,7 +6856,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -8105,7 +8103,7 @@ module GHC.IORef where module GHC.InfoProv where -- Safety: Safe type InfoProv :: * - data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} + data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipUnitId :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} type InfoProvEnt :: * data InfoProvEnt ipLoc :: InfoProv -> GHC.Internal.Base.String @@ -12521,7 +12519,7 @@ instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.RTSFlags -- Defined in instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.TickyFlags -- Defined in ‘GHC.Internal.RTS.Flags’ instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.TraceFlags -- Defined in ‘GHC.Internal.RTS.Flags’ instance GHC.Internal.Show.Show GHC.Internal.IOPort.IOPortException -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Internal.Show.Show GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Internal.Show.Show GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Internal.Show.Show GHC.Internal.Stack.CloneStack.StackEntry -- Defined in ‘GHC.Internal.Stack.CloneStack’ instance GHC.Internal.Show.Show GHC.Internal.StaticPtr.StaticPtrInfo -- Defined in ‘GHC.Internal.StaticPtr’ instance GHC.Internal.Show.Show GHC.Internal.Stats.GCDetails -- Defined in ‘GHC.Internal.Stats’ @@ -12717,7 +12715,7 @@ instance GHC.Classes.Eq GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Inter instance GHC.Classes.Eq GHC.Internal.RTS.Flags.IoSubSystem -- Defined in ‘GHC.Internal.RTS.Flags’ instance forall i e. GHC.Classes.Eq (GHC.Internal.IOArray.IOArray i e) -- Defined in ‘GHC.Internal.IOArray’ instance forall a. GHC.Classes.Eq (GHC.Internal.IOPort.IOPort a) -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Classes.Eq GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Classes.Eq GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Classes.Eq GHC.Num.Integer.Integer -- Defined in ‘GHC.Num.Integer’ instance GHC.Classes.Eq GHC.Num.BigNat.BigNat -- Defined in ‘GHC.Num.BigNat’ instance GHC.Classes.Eq GHC.Num.Natural.Natural -- Defined in ‘GHC.Num.Natural’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -4755,7 +4755,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -6826,7 +6825,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -8074,7 +8072,7 @@ module GHC.IORef where module GHC.InfoProv where -- Safety: Safe type InfoProv :: * - data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} + data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipUnitId :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} type InfoProvEnt :: * data InfoProvEnt ipLoc :: InfoProv -> GHC.Internal.Base.String @@ -15551,7 +15549,7 @@ instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.RTSFlags -- Defined in instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.TickyFlags -- Defined in ‘GHC.Internal.RTS.Flags’ instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.TraceFlags -- Defined in ‘GHC.Internal.RTS.Flags’ instance GHC.Internal.Show.Show GHC.Internal.IOPort.IOPortException -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Internal.Show.Show GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Internal.Show.Show GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Internal.Show.Show GHC.Internal.JS.Prim.JSException -- Defined in ‘GHC.Internal.JS.Prim’ instance GHC.Internal.Show.Show GHC.Internal.JS.Prim.WouldBlockException -- Defined in ‘GHC.Internal.JS.Prim’ instance GHC.Internal.Show.Show GHC.Internal.Stack.CloneStack.StackEntry -- Defined in ‘GHC.Internal.Stack.CloneStack’ @@ -15743,7 +15741,7 @@ instance GHC.Classes.Eq GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Inter instance GHC.Classes.Eq GHC.Internal.RTS.Flags.IoSubSystem -- Defined in ‘GHC.Internal.RTS.Flags’ instance forall i e. GHC.Classes.Eq (GHC.Internal.IOArray.IOArray i e) -- Defined in ‘GHC.Internal.IOArray’ instance forall a. GHC.Classes.Eq (GHC.Internal.IOPort.IOPort a) -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Classes.Eq GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Classes.Eq GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Classes.Eq GHC.Num.Integer.Integer -- Defined in ‘GHC.Num.Integer’ instance GHC.Classes.Eq GHC.Internal.JS.Foreign.Callback.OnBlocked -- Defined in ‘GHC.Internal.JS.Foreign.Callback’ instance GHC.Classes.Eq GHC.Num.BigNat.BigNat -- Defined in ‘GHC.Num.BigNat’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -4758,7 +4758,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -7006,7 +7005,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -8329,7 +8327,7 @@ module GHC.IORef where module GHC.InfoProv where -- Safety: Safe type InfoProv :: * - data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} + data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipUnitId :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} type InfoProvEnt :: * data InfoProvEnt ipLoc :: InfoProv -> GHC.Internal.Base.String @@ -12799,7 +12797,7 @@ instance GHC.Internal.Show.Show GHC.Internal.IO.Windows.Handle.CONSOLE_READCONSO instance GHC.Internal.Show.Show (GHC.Internal.IO.Windows.Handle.Io GHC.Internal.IO.Windows.Handle.NativeHandle) -- Defined in ‘GHC.Internal.IO.Windows.Handle’ instance GHC.Internal.Show.Show (GHC.Internal.IO.Windows.Handle.Io GHC.Internal.IO.Windows.Handle.ConsoleHandle) -- Defined in ‘GHC.Internal.IO.Windows.Handle’ instance GHC.Internal.Show.Show GHC.Internal.IOPort.IOPortException -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Internal.Show.Show GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Internal.Show.Show GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Internal.Show.Show GHC.Internal.Stack.CloneStack.StackEntry -- Defined in ‘GHC.Internal.Stack.CloneStack’ instance GHC.Internal.Show.Show GHC.Internal.StaticPtr.StaticPtrInfo -- Defined in ‘GHC.Internal.StaticPtr’ instance GHC.Internal.Show.Show GHC.Internal.Stats.GCDetails -- Defined in ‘GHC.Internal.Stats’ @@ -12993,7 +12991,7 @@ instance GHC.Classes.Eq GHC.Internal.RTS.Flags.IoSubSystem -- Defined in ‘GHC. instance GHC.Classes.Eq GHC.Internal.IO.Windows.Handle.TempFileOptions -- Defined in ‘GHC.Internal.IO.Windows.Handle’ instance forall i e. GHC.Classes.Eq (GHC.Internal.IOArray.IOArray i e) -- Defined in ‘GHC.Internal.IOArray’ instance forall a. GHC.Classes.Eq (GHC.Internal.IOPort.IOPort a) -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Classes.Eq GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Classes.Eq GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Classes.Eq GHC.Num.Integer.Integer -- Defined in ‘GHC.Num.Integer’ instance GHC.Classes.Eq GHC.Num.BigNat.BigNat -- Defined in ‘GHC.Num.BigNat’ instance GHC.Classes.Eq GHC.Num.Natural.Natural -- Defined in ‘GHC.Num.Natural’ ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -4755,7 +4755,6 @@ module GHC.Base where waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d when :: forall (f :: * -> *). Applicative f => Bool -> f () -> f () - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -6857,7 +6856,6 @@ module GHC.Exts where void# :: (# #) waitRead# :: forall d. Int# -> State# d -> State# d waitWrite# :: forall d. Int# -> State# d -> State# d - whereFrom# :: forall a d. a -> State# d -> (# State# d, Addr# #) word16ToInt16# :: Word16# -> Int16# word16ToWord# :: Word16# -> Word# word2Double# :: Word# -> Double# @@ -8105,7 +8103,7 @@ module GHC.IORef where module GHC.InfoProv where -- Safety: Safe type InfoProv :: * - data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} + data InfoProv = InfoProv {ipName :: GHC.Internal.Base.String, ipDesc :: GHC.Internal.ClosureTypes.ClosureType, ipTyDesc :: GHC.Internal.Base.String, ipLabel :: GHC.Internal.Base.String, ipUnitId :: GHC.Internal.Base.String, ipMod :: GHC.Internal.Base.String, ipSrcFile :: GHC.Internal.Base.String, ipSrcSpan :: GHC.Internal.Base.String} type InfoProvEnt :: * data InfoProvEnt ipLoc :: InfoProv -> GHC.Internal.Base.String @@ -12521,7 +12519,7 @@ instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.RTSFlags -- Defined in instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.TickyFlags -- Defined in ‘GHC.Internal.RTS.Flags’ instance GHC.Internal.Show.Show GHC.Internal.RTS.Flags.TraceFlags -- Defined in ‘GHC.Internal.RTS.Flags’ instance GHC.Internal.Show.Show GHC.Internal.IOPort.IOPortException -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Internal.Show.Show GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Internal.Show.Show GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Internal.Show.Show GHC.Internal.Stack.CloneStack.StackEntry -- Defined in ‘GHC.Internal.Stack.CloneStack’ instance GHC.Internal.Show.Show GHC.Internal.StaticPtr.StaticPtrInfo -- Defined in ‘GHC.Internal.StaticPtr’ instance GHC.Internal.Show.Show GHC.Internal.Stats.GCDetails -- Defined in ‘GHC.Internal.Stats’ @@ -12717,7 +12715,7 @@ instance GHC.Classes.Eq GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Inter instance GHC.Classes.Eq GHC.Internal.RTS.Flags.IoSubSystem -- Defined in ‘GHC.Internal.RTS.Flags’ instance forall i e. GHC.Classes.Eq (GHC.Internal.IOArray.IOArray i e) -- Defined in ‘GHC.Internal.IOArray’ instance forall a. GHC.Classes.Eq (GHC.Internal.IOPort.IOPort a) -- Defined in ‘GHC.Internal.IOPort’ -instance GHC.Classes.Eq GHC.Internal.InfoProv.InfoProv -- Defined in ‘GHC.Internal.InfoProv’ +instance GHC.Classes.Eq GHC.Internal.InfoProv.Types.InfoProv -- Defined in ‘GHC.Internal.InfoProv.Types’ instance GHC.Classes.Eq GHC.Num.Integer.Integer -- Defined in ‘GHC.Num.Integer’ instance GHC.Classes.Eq GHC.Num.BigNat.BigNat -- Defined in ‘GHC.Num.BigNat’ instance GHC.Classes.Eq GHC.Num.Natural.Natural -- Defined in ‘GHC.Num.Natural’ ===================================== testsuite/tests/profiling/should_run/staticcallstack001.stdout ===================================== @@ -1,3 +1,3 @@ -Just (InfoProv {ipName = "D_Main_4_con_info", ipDesc = CONSTR_1_0, ipTyDesc = "D", ipLabel = "main", ipMod = "Main", ipSrcFile = "staticcallstack001.hs", ipSrcSpan = "16:13-27"}) -Just (InfoProv {ipName = "D_Main_2_con_info", ipDesc = CONSTR_1_0, ipTyDesc = "D", ipLabel = "caf", ipMod = "Main", ipSrcFile = "staticcallstack001.hs", ipSrcSpan = "13:1-9"}) -Just (InfoProv {ipName = "sat_s11M_info", ipDesc = THUNK, ipTyDesc = "D", ipLabel = "main", ipMod = "Main", ipSrcFile = "staticcallstack001.hs", ipSrcSpan = "18:23-32"}) +Just (InfoProv {ipName = "D_Main_4_con_info", ipDesc = CONSTR_1_0, ipTyDesc = "D", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack001.hs", ipSrcSpan = "16:13-27"}) +Just (InfoProv {ipName = "D_Main_2_con_info", ipDesc = CONSTR_1_0, ipTyDesc = "D", ipLabel = "caf", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack001.hs", ipSrcSpan = "13:1-9"}) +Just (InfoProv {ipName = "sat_s23z_info", ipDesc = THUNK, ipTyDesc = "D", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack001.hs", ipSrcSpan = "18:23-32"}) ===================================== testsuite/tests/profiling/should_run/staticcallstack002.stdout ===================================== @@ -1,4 +1,4 @@ -Just (InfoProv {ipName = "sat_s11p_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "10:23-39"}) -Just (InfoProv {ipName = "sat_s11F_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "11:23-42"}) -Just (InfoProv {ipName = "sat_s11V_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "12:23-46"}) -Just (InfoProv {ipName = "sat_s12b_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "13:23-44"}) +Just (InfoProv {ipName = "sat_s237_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "10:23-39"}) +Just (InfoProv {ipName = "sat_s23r_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "11:23-42"}) +Just (InfoProv {ipName = "sat_s23L_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "12:23-46"}) +Just (InfoProv {ipName = "sat_s245_info", ipDesc = THUNK, ipTyDesc = "Any", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "13:23-44"}) ===================================== testsuite/tests/rts/ipe/T24005/t24005.stdout ===================================== @@ -1,2 +1,2 @@ -Just (InfoProv {ipName = "C:Show_Main_1_con_info", ipDesc = CONSTR, ipTyDesc = "Show", ipLabel = "$fShowA", ipMod = "Main", ipSrcFile = "t24005.hs", ipSrcSpan = "25:10-15"}) -Just (InfoProv {ipName = "C:Show_Main_0_con_info", ipDesc = CONSTR, ipTyDesc = "Show", ipLabel = "$fShowB", ipMod = "Main", ipSrcFile = "t24005.hs", ipSrcSpan = "29:10-29"}) +Just (InfoProv {ipName = "C:Show_Main_1_con_info", ipDesc = CONSTR, ipTyDesc = "Show", ipLabel = "$fShowA", ipUnitId = "main", ipMod = "Main", ipSrcFile = "t24005.hs", ipSrcSpan = "25:10-15"}) +Just (InfoProv {ipName = "C:Show_Main_0_con_info", ipDesc = CONSTR, ipTyDesc = "Show", ipLabel = "$fShowB", ipUnitId = "main", ipMod = "Main", ipSrcFile = "t24005.hs", ipSrcSpan = "29:10-29"}) ===================================== testsuite/tests/rts/ipe/ipeEventLog.stderr ===================================== @@ -1,20 +1,20 @@ -7f5278bc0740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, module module_000, srcloc src_file_000:src_span_000 -7f5278bc0740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, module module_001, srcloc src_file_001:src_span_001 -7f5278bc0740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, module module_002, srcloc src_file_002:src_span_002 -7f5278bc0740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, module module_003, srcloc src_file_003:src_span_003 -7f5278bc0740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, module module_004, srcloc src_file_004:src_span_004 -7f5278bc0740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, module module_005, srcloc src_file_005:src_span_005 -7f5278bc0740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, module module_006, srcloc src_file_006:src_span_006 -7f5278bc0740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, module module_007, srcloc src_file_007:src_span_007 -7f5278bc0740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, module module_008, srcloc src_file_008:src_span_008 -7f5278bc0740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, module module_009, srcloc src_file_009:src_span_009 -7f5278bc0740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, module module_000, srcloc src_file_000:src_span_000 -7f5278bc0740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, module module_001, srcloc src_file_001:src_span_001 -7f5278bc0740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, module module_002, srcloc src_file_002:src_span_002 -7f5278bc0740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, module module_003, srcloc src_file_003:src_span_003 -7f5278bc0740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, module module_004, srcloc src_file_004:src_span_004 -7f5278bc0740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, module module_005, srcloc src_file_005:src_span_005 -7f5278bc0740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, module module_006, srcloc src_file_006:src_span_006 -7f5278bc0740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, module module_007, srcloc src_file_007:src_span_007 -7f5278bc0740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, module module_008, srcloc src_file_008:src_span_008 -7f5278bc0740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, module module_009, srcloc src_file_009:src_span_009 +7ffff7a4d740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, unit unit_id_000, module module_000, srcloc src_file_000:src_span_000 +7ffff7a4d740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, unit unit_id_000, module module_000, srcloc src_file_001:src_span_001 +7ffff7a4d740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, unit unit_id_000, module module_000, srcloc src_file_002:src_span_002 +7ffff7a4d740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, unit unit_id_000, module module_000, srcloc src_file_003:src_span_003 +7ffff7a4d740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, unit unit_id_000, module module_000, srcloc src_file_004:src_span_004 +7ffff7a4d740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, unit unit_id_000, module module_000, srcloc src_file_005:src_span_005 +7ffff7a4d740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, unit unit_id_000, module module_000, srcloc src_file_006:src_span_006 +7ffff7a4d740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, unit unit_id_000, module module_000, srcloc src_file_007:src_span_007 +7ffff7a4d740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, unit unit_id_000, module module_000, srcloc src_file_008:src_span_008 +7ffff7a4d740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, unit unit_id_000, module module_000, srcloc src_file_009:src_span_009 +7ffff7a4d740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, unit unit_id_000, module module_000, srcloc src_file_000:src_span_000 +7ffff7a4d740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, unit unit_id_000, module module_000, srcloc src_file_001:src_span_001 +7ffff7a4d740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, unit unit_id_000, module module_000, srcloc src_file_002:src_span_002 +7ffff7a4d740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, unit unit_id_000, module module_000, srcloc src_file_003:src_span_003 +7ffff7a4d740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, unit unit_id_000, module module_000, srcloc src_file_004:src_span_004 +7ffff7a4d740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, unit unit_id_000, module module_000, srcloc src_file_005:src_span_005 +7ffff7a4d740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, unit unit_id_000, module module_000, srcloc src_file_006:src_span_006 +7ffff7a4d740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, unit unit_id_000, module module_000, srcloc src_file_007:src_span_007 +7ffff7a4d740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, unit unit_id_000, module module_000, srcloc src_file_008:src_span_008 +7ffff7a4d740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, unit unit_id_000, module module_000, srcloc src_file_009:src_span_009 ===================================== testsuite/tests/rts/ipe/ipeEventLog_fromMap.c ===================================== @@ -19,7 +19,8 @@ int main(int argc, char *argv[]) { registerInfoProvList(list2); // Query an IPE to initialize the underlying hash map. - lookupIPE(list1->tables[0]); + InfoProvEnt ipe; + lookupIPE(list1->tables[0], &ipe); // Trace all IPE events. dumpIPEToEventLog(); ===================================== testsuite/tests/rts/ipe/ipeEventLog_fromMap.stderr ===================================== @@ -1,68 +1,20 @@ -7f86c4be8740: created capset 0 of type 2 -7f86c4be8740: created capset 1 of type 3 -7f86c4be8740: cap 0: initialised -7f86c4be8740: assigned cap 0 to capset 0 -7f86c4be8740: assigned cap 0 to capset 1 -7f86c4be8740: cap 0: created thread 1[""] -7f86c4be8740: cap 0: running thread 1[""] (ThreadRunGHC) -7f86c4be8740: cap 0: thread 1[""] stopped (stack overflow, size 109) -7f86c4be8740: cap 0: running thread 1[""] (ThreadRunGHC) -7f86c4be8740: cap 0: created thread 2[""] -7f86c4be8740: cap 0: thread 2 has label IOManager on cap 0 -7f86c4be8740: cap 0: thread 1[""] stopped (yielding) -7f86b67fc640: cap 0: running thread 2["IOManager on cap 0"] (ThreadRunGHC) -7f86b67fc640: cap 0: thread 2["IOManager on cap 0"] stopped (yielding) -7f86c4be8740: cap 0: running thread 1[""] (ThreadRunGHC) -7f86c4be8740: cap 0: created thread 3[""] -7f86c4be8740: cap 0: thread 3 has label TimerManager -7f86c4be8740: cap 0: thread 1[""] stopped (finished) -7f86c4be8740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, module module_009, srcloc src_file_009:src_span_009 -7f86c4be8740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, module module_008, srcloc src_file_008:src_span_008 -7f86c4be8740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, module module_007, srcloc src_file_007:src_span_007 -7f86c4be8740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, module module_006, srcloc src_file_006:src_span_006 -7f86c4be8740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, module module_005, srcloc src_file_005:src_span_005 -7f86c4be8740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, module module_004, srcloc src_file_004:src_span_004 -7f86c4be8740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, module module_003, srcloc src_file_003:src_span_003 -7f86c4be8740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, module module_002, srcloc src_file_002:src_span_002 -7f86c4be8740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, module module_001, srcloc src_file_001:src_span_001 -7f86c4be8740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, module module_000, srcloc src_file_000:src_span_000 -7f86c4be8740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, module module_009, srcloc src_file_009:src_span_009 -7f86c4be8740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, module module_008, srcloc src_file_008:src_span_008 -7f86c4be8740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, module module_007, srcloc src_file_007:src_span_007 -7f86c4be8740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, module module_006, srcloc src_file_006:src_span_006 -7f86c4be8740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, module module_005, srcloc src_file_005:src_span_005 -7f86c4be8740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, module module_004, srcloc src_file_004:src_span_004 -7f86c4be8740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, module module_003, srcloc src_file_003:src_span_003 -7f86c4be8740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, module module_002, srcloc src_file_002:src_span_002 -7f86c4be8740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, module module_001, srcloc src_file_001:src_span_001 -7f86c4be8740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, module module_000, srcloc src_file_000:src_span_000 -7f86c4be8740: cap 0: created thread 4[""] -7f86b67fc640: cap 0: running thread 2["IOManager on cap 0"] (ThreadRunGHC) -7f86b67fc640: cap 0: thread 2["IOManager on cap 0"] stopped (suspended while making a foreign call) -7f86b5ffb640: cap 0: running thread 3["TimerManager"] (ThreadRunGHC) -7f86b5ffb640: cap 0: thread 3["TimerManager"] stopped (suspended while making a foreign call) -7f86c4be8740: cap 0: running thread 4[""] (ThreadRunGHC) -7f86c4be8740: cap 0: thread 4[""] stopped (yielding) -7f86c4be8740: cap 0: running thread 4[""] (ThreadRunGHC) -7f86c4be8740: cap 0: thread 4[""] stopped (finished) -7f86b57fa640: cap 0: requesting sequential GC -7f86b57fa640: cap 0: starting GC -7f86b57fa640: cap 0: GC working -7f86b57fa640: cap 0: GC idle -7f86b57fa640: cap 0: GC done -7f86b57fa640: cap 0: GC idle -7f86b57fa640: cap 0: GC done -7f86b57fa640: cap 0: GC idle -7f86b57fa640: cap 0: GC done -7f86b57fa640: cap 0: Memory Return (Current: 6) (Needed: 8) (Returned: 0) -7f86b57fa640: cap 0: all caps stopped for GC -7f86b57fa640: cap 0: finished GC -7f86b5ffb640: cap 0: running thread 3["TimerManager"] (ThreadRunGHC) -7f86b5ffb640: cap 0: thread 3["TimerManager"] stopped (finished) -7f86b67fc640: cap 0: running thread 2["IOManager on cap 0"] (ThreadRunGHC) -7f86b67fc640: cap 0: thread 2["IOManager on cap 0"] stopped (finished) -7f86c4be8740: removed cap 0 from capset 0 -7f86c4be8740: removed cap 0 from capset 1 -7f86c4be8740: cap 0: shutting down -7f86c4be8740: deleted capset 0 -7f86c4be8740: deleted capset 1 +7ffff7a4d740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, unit unit_id_000, module module_000, srcloc src_file_009:src_span_009 +7ffff7a4d740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, unit unit_id_000, module module_000, srcloc src_file_008:src_span_008 +7ffff7a4d740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, unit unit_id_000, module module_000, srcloc src_file_007:src_span_007 +7ffff7a4d740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, unit unit_id_000, module module_000, srcloc src_file_006:src_span_006 +7ffff7a4d740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, unit unit_id_000, module module_000, srcloc src_file_005:src_span_005 +7ffff7a4d740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, unit unit_id_000, module module_000, srcloc src_file_004:src_span_004 +7ffff7a4d740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, unit unit_id_000, module module_000, srcloc src_file_003:src_span_003 +7ffff7a4d740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, unit unit_id_000, module module_000, srcloc src_file_002:src_span_002 +7ffff7a4d740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, unit unit_id_000, module module_000, srcloc src_file_001:src_span_001 +7ffff7a4d740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, unit unit_id_000, module module_000, srcloc src_file_000:src_span_000 +7ffff7a4d740: IPE: table_name table_name_009, closure_desc closure_desc_009, ty_desc ty_desc_009, label label_009, unit unit_id_000, module module_000, srcloc src_file_009:src_span_009 +7ffff7a4d740: IPE: table_name table_name_008, closure_desc closure_desc_008, ty_desc ty_desc_008, label label_008, unit unit_id_000, module module_000, srcloc src_file_008:src_span_008 +7ffff7a4d740: IPE: table_name table_name_007, closure_desc closure_desc_007, ty_desc ty_desc_007, label label_007, unit unit_id_000, module module_000, srcloc src_file_007:src_span_007 +7ffff7a4d740: IPE: table_name table_name_006, closure_desc closure_desc_006, ty_desc ty_desc_006, label label_006, unit unit_id_000, module module_000, srcloc src_file_006:src_span_006 +7ffff7a4d740: IPE: table_name table_name_005, closure_desc closure_desc_005, ty_desc ty_desc_005, label label_005, unit unit_id_000, module module_000, srcloc src_file_005:src_span_005 +7ffff7a4d740: IPE: table_name table_name_004, closure_desc closure_desc_004, ty_desc ty_desc_004, label label_004, unit unit_id_000, module module_000, srcloc src_file_004:src_span_004 +7ffff7a4d740: IPE: table_name table_name_003, closure_desc closure_desc_003, ty_desc ty_desc_003, label label_003, unit unit_id_000, module module_000, srcloc src_file_003:src_span_003 +7ffff7a4d740: IPE: table_name table_name_002, closure_desc closure_desc_002, ty_desc ty_desc_002, label label_002, unit unit_id_000, module module_000, srcloc src_file_002:src_span_002 +7ffff7a4d740: IPE: table_name table_name_001, closure_desc closure_desc_001, ty_desc ty_desc_001, label label_001, unit unit_id_000, module module_000, srcloc src_file_001:src_span_001 +7ffff7a4d740: IPE: table_name table_name_000, closure_desc closure_desc_000, ty_desc ty_desc_000, label label_000, unit unit_id_000, module module_000, srcloc src_file_000:src_span_000 ===================================== testsuite/tests/rts/ipe/ipeMap.c ===================================== @@ -28,14 +28,19 @@ int main(int argc, char *argv[]) { hs_exit(); } +static InfoProvEnt lookupIPE_(const char *where, const StgInfoTable *itbl) { + InfoProvEnt ent; + if (!lookupIPE(itbl, &ent)) { + barf("%s: Expected to find IPE entry", where); + } + return ent; +} + void shouldFindNothingInAnEmptyIPEMap(Capability *cap) { HaskellObj fortyTwo = UNTAG_CLOSURE(rts_mkInt(cap, 42)); - - InfoProvEnt *result = lookupIPE(get_itbl(fortyTwo)); - - if (result != NULL) { - errorBelch("Found entry in an empty IPE map!"); - exit(1); + InfoProvEnt ent; + if (lookupIPE(get_itbl(fortyTwo), &ent)) { + barf("Found entry in an empty IPE map!"); } } @@ -48,6 +53,9 @@ HaskellObj shouldFindOneIfItHasBeenRegistered(Capability *cap) { StringTable st; init_string_table(&st); + node->unit_id = add_string(&st, "unit-id"); + node->module_name = add_string(&st, "TheModule"); + HaskellObj fortyTwo = UNTAG_CLOSURE(rts_mkInt(cap, 42)); node->next = NULL; node->compressed = 0; @@ -60,20 +68,16 @@ HaskellObj shouldFindOneIfItHasBeenRegistered(Capability *cap) { registerInfoProvList(node); - InfoProvEnt *result = lookupIPE(get_itbl(fortyTwo)); + InfoProvEnt result = lookupIPE_("shouldFindOneIfItHasBeenRegistered", get_itbl(fortyTwo)); - if (result == NULL) { - errorBelch("shouldFindOneIfItHasBeenRegistered: Found no entry in IPE map!"); - exit(1); - } - - assertStringsEqual(result->prov.table_name, "table_name_042"); - assertStringsEqual(result->prov.closure_desc, "closure_desc_042"); - assertStringsEqual(result->prov.ty_desc, "ty_desc_042"); - assertStringsEqual(result->prov.label, "label_042"); - assertStringsEqual(result->prov.module, "module_042"); - assertStringsEqual(result->prov.src_file, "src_file_042"); - assertStringsEqual(result->prov.src_span, "src_span_042"); + assertStringsEqual(result.prov.table_name, "table_name_042"); + assertStringsEqual(result.prov.closure_desc, "closure_desc_042"); + assertStringsEqual(result.prov.ty_desc, "ty_desc_042"); + assertStringsEqual(result.prov.label, "label_042"); + assertStringsEqual(result.prov.unit_id, "unit-id"); + assertStringsEqual(result.prov.module, "TheModule"); + assertStringsEqual(result.prov.src_file, "src_file_042"); + assertStringsEqual(result.prov.src_span, "src_span_042"); return fortyTwo; } @@ -88,6 +92,9 @@ void shouldFindTwoIfTwoHaveBeenRegistered(Capability *cap, StringTable st; init_string_table(&st); + node->unit_id = add_string(&st, "unit-id"); + node->module_name = add_string(&st, "TheModule"); + HaskellObj twentyThree = UNTAG_CLOSURE(rts_mkInt8(cap, 23)); node->next = NULL; node->compressed = 0; @@ -100,22 +107,11 @@ void shouldFindTwoIfTwoHaveBeenRegistered(Capability *cap, registerInfoProvList(node); - InfoProvEnt *resultFortyTwo = - lookupIPE(get_itbl(fortyTwo)); - InfoProvEnt *resultTwentyThree = - lookupIPE(get_itbl(twentyThree)); + InfoProvEnt resultFortyTwo = lookupIPE_("shouldFindTwoIfTwoHaveBeenRegistered", get_itbl(fortyTwo)); + assertStringsEqual(resultFortyTwo.prov.table_name, "table_name_042"); - if (resultFortyTwo == NULL) { - errorBelch("shouldFindTwoIfTwoHaveBeenRegistered(42): Found no entry in IPE map!"); - exit(1); - } - if (resultTwentyThree == NULL) { - errorBelch("shouldFindTwoIfTwoHaveBeenRegistered(23): Found no entry in IPE map!"); - exit(1); - } - - assertStringsEqual(resultFortyTwo->prov.table_name, "table_name_042"); - assertStringsEqual(resultTwentyThree->prov.table_name, "table_name_023"); + InfoProvEnt resultTwentyThree = lookupIPE_("shouldFindTwoIfTwoHaveBeenRegistered", get_itbl(twentyThree)); + assertStringsEqual(resultTwentyThree.prov.table_name, "table_name_023"); } void shouldFindTwoFromTheSameList(Capability *cap) { @@ -142,20 +138,11 @@ void shouldFindTwoFromTheSameList(Capability *cap) { registerInfoProvList(node); - InfoProvEnt *resultOne = lookupIPE(get_itbl(one)); - InfoProvEnt *resultTwo = lookupIPE(get_itbl(two)); - - if (resultOne == NULL) { - errorBelch("shouldFindTwoFromTheSameList(1): Found no entry in IPE map!"); - exit(1); - } - if (resultTwo == NULL) { - errorBelch("shouldFindTwoFromTheSameList(2): Found no entry in IPE map!"); - exit(1); - } + InfoProvEnt resultOne = lookupIPE_("shouldFindTwoFromTheSameList", get_itbl(one)); + assertStringsEqual(resultOne.prov.table_name, "table_name_001"); - assertStringsEqual(resultOne->prov.table_name, "table_name_001"); - assertStringsEqual(resultTwo->prov.table_name, "table_name_002"); + InfoProvEnt resultTwo = lookupIPE_("shouldFindTwoFromTheSameList", get_itbl(two)); + assertStringsEqual(resultTwo.prov.table_name, "table_name_002"); } void shouldDealWithAnEmptyList(Capability *cap, HaskellObj fortyTwo) { @@ -166,15 +153,8 @@ void shouldDealWithAnEmptyList(Capability *cap, HaskellObj fortyTwo) { registerInfoProvList(node); - InfoProvEnt *resultFortyTwo = - lookupIPE(get_itbl(fortyTwo)); - - if (resultFortyTwo == NULL) { - errorBelch("shouldDealWithAnEmptyList: Found no entry in IPE map!"); - exit(1); - } - - assertStringsEqual(resultFortyTwo->prov.table_name, "table_name_042"); + InfoProvEnt resultFortyTwo = lookupIPE_("shouldDealWithAnEmptyList", get_itbl(fortyTwo)); + assertStringsEqual(resultFortyTwo.prov.table_name, "table_name_042"); } void assertStringsEqual(const char *s1, const char *s2) { ===================================== testsuite/tests/rts/ipe/ipe_lib.c ===================================== @@ -48,11 +48,6 @@ IpeBufferEntry makeAnyProvEntry(Capability *cap, StringTable *st, int i) { snprintf(label, labelLength, "label_%03i", i); provEnt.label = add_string(st, label); - unsigned int moduleLength = strlen("module_") + 3 /* digits */ + 1 /* null character */; - char *module = malloc(sizeof(char) * moduleLength); - snprintf(module, moduleLength, "module_%03i", i); - provEnt.module_name = add_string(st, module); - unsigned int srcFileLength = strlen("src_file_") + 3 /* digits */ + 1 /* null character */; char *srcFile = malloc(sizeof(char) * srcFileLength); snprintf(srcFile, srcFileLength, "src_file_%03i", i); @@ -77,6 +72,16 @@ IpeBufferListNode *makeAnyProvEntries(Capability *cap, int start, int end) { StringTable st; init_string_table(&st); + unsigned int unitIdLength = strlen("unit_id_") + 3 /* digits */ + 1 /* null character */; + char *unitId = malloc(sizeof(char) * unitIdLength); + snprintf(unitId, unitIdLength, "unit_id_%03i", start); + node->unit_id = add_string(&st, unitId); + + unsigned int moduleLength = strlen("module_") + 3 /* digits */ + 1 /* null character */; + char *module = malloc(sizeof(char) * moduleLength); + snprintf(module, moduleLength, "module_%03i", start); + node->module_name = add_string(&st, module); + // Make the entries and fill the buffers for (int i=start; i < end; i++) { HaskellObj closure = rts_mkInt(cap, 42); View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2e592857b6e028fbad83712ceda6a0860191d379...ed0b69dc069a23692bff89cfcab1ad9d61999506 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2e592857b6e028fbad83712ceda6a0860191d379...ed0b69dc069a23692bff89cfcab1ad9d61999506 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 9 22:38:54 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 09 Mar 2024 17:38:54 -0500 Subject: [Git][ghc/ghc][master] docs: Update info on TypeAbstractions Message-ID: <65ece4fe16598_3a044c3e4cc50133b5@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - 2 changed files: - docs/users_guide/9.10.1-notes.rst - docs/users_guide/exts/type_abstractions.rst Changes: ===================================== docs/users_guide/9.10.1-notes.rst ===================================== @@ -124,6 +124,20 @@ Language The extension is enabled by default, establishing the usual behavior. +- In accordance with GHC Proposal `#448 `_, + the :extension:`TypeAbstractions` extension has been extended to support + ``@``-binders in lambdas and function equations:: + + id :: forall a. a -> a + id @t x = x :: t + -- ^^ @-binder in a function equation + + e = higherRank (\ @t -> ... ) + -- ^^ @-binder in a lambda + + This feature is an experimental alternative to :extension:`ScopedTypeVariables`, + see the :ref:`type-abstractions-in-functions` section. + Compiler ~~~~~~~~ ===================================== docs/users_guide/exts/type_abstractions.rst ===================================== @@ -6,7 +6,7 @@ Type abstractions :since: 9.8.1 - :status: Partially implemented + :status: Experimental Allow the use of type abstraction syntax. @@ -22,6 +22,8 @@ and `#425 From gitlab at gitlab.haskell.org Sun Mar 10 01:25:32 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Sat, 09 Mar 2024 20:25:32 -0500 Subject: [Git][ghc/ghc][wip/T23942] 20 commits: base: Use strerror_r instead of strerror Message-ID: <65ed0c0c9d068_3a044c8d8b960177c3@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - c6c19071 by Matthew Craven at 2024-03-09T20:24:20-05:00 Remove unused ghc-internal module "GHC.Internal.Constants" - - - - - 154c54e5 by Matthew Craven at 2024-03-09T20:24:20-05:00 CorePrep: Rework lowering of BigNat# literals Don't use bigNatFromWord#, because that's terrible: * We shouldn't have to traverse a linked list at run-time to build a BigNat# literal. That's just silly! * The static List object we have to create is much larger than the actual BigNat#'s contents, bloating code size. * We have to read the corresponding interface file, which causes un-tracked implicit dependencies. (#23942) Instead, encode them into the appropriate platform-dependent sequence of bytes, and generate code that copies these bytes at run-time from an Addr# literal into a new ByteArray#. A ByteArray# literal would be the correct thing to generate, but these are not yet supported; see also #17747. Since this lowering no longer reads the interface file for GHC.Num.BigNat, the reasoning in Note [Depend on GHC.Num.Integer] is obsoleted. But the story of un-tracked built-in dependencies remains complex, and Note [Tracking dependencies on primitives] now exists to explain this complexity. Additionally, many empty imports have been modified to refer to this new note and comply with its guidance. Several empty imports necessary for other reasons have also been given brief explanations. - - - - - 30 changed files: - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/PrimOps.hs-boot - compiler/GHC/Builtin/Types/Prim.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Data/Word64Map/Strict.hs - compiler/GHC/Driver/CmdLine.hs - compiler/GHC/Driver/Config/CoreToStg/Prep.hs - compiler/GHC/Driver/Config/Diagnostic.hs - compiler/GHC/Driver/Errors/Ppr.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Errors/Ppr.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs-boot - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Platform.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/StgToJS/Types.hs - compiler/GHC/Tc/Errors/Hole/Plugin.hs-boot - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Types/LclEnv.hs-boot - compiler/GHC/Tc/Utils/Backpack.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/62c6ce498cd2bd1fe0cf8e17cfc7d84fa3ae44c0...154c54e5712d6e5f55a271917b53a20545c291b3 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/62c6ce498cd2bd1fe0cf8e17cfc7d84fa3ae44c0...154c54e5712d6e5f55a271917b53a20545c291b3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 02:05:27 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 21:05:27 -0500 Subject: [Git][ghc/ghc] Pushed new branch wip/release-fixes Message-ID: <65ed15677ff5a_3a044c9d4af1822185@gitlab.mail> Ben Gamari pushed new branch wip/release-fixes at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/release-fixes You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 03:13:21 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 22:13:21 -0500 Subject: [Git][ghc/ghc][wip/release-fixes] 36 commits: ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65ed255152ab7_3a044cbb631bc25683@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - c8bf2af7 by Ben Gamari at 2024-03-09T22:12:56-05:00 configure: Bump GHC version to 9.11 - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/exts/type_abstractions.rst - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5fb7591d0a63b297d83c64f4f5b3c3e1e0115032...c8bf2af7739126087eafb5a7eb2854d53e62ee6e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5fb7591d0a63b297d83c64f4f5b3c3e1e0115032...c8bf2af7739126087eafb5a7eb2854d53e62ee6e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 03:18:44 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sat, 09 Mar 2024 22:18:44 -0500 Subject: [Git][ghc/ghc][wip/ghc-9.10] 26 commits: rts/CloneStack: Bounds check array write Message-ID: <65ed2694c0ccc_3a044cc06f4582593b@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - 19bca2fe by Ben Gamari at 2024-03-09T22:18:01-05:00 gitlab-ci: Allow test-primops to fail It's still a bit sensitive to warnings, unfortunately. - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/exts/type_abstractions.rst - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal - libraries/ghc-boot-th/ghc-boot-th.cabal.in - libraries/ghc-boot/ghc-boot.cabal.in - libraries/ghc-compact/ghc-compact.cabal - libraries/ghc-experimental/ghc-experimental.cabal - libraries/ghc-heap/ghc-heap.cabal.in - libraries/ghc-internal/ghc-internal.cabal The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5772336bad8480459a6a8fe2e7d5d9e340738bd4...19bca2fec8650034b1f9d9c3407713e69d653c73 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5772336bad8480459a6a8fe2e7d5d9e340738bd4...19bca2fec8650034b1f9d9c3407713e69d653c73 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 03:59:42 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Sat, 09 Mar 2024 22:59:42 -0500 Subject: [Git][ghc/ghc][wip/T23942] CorePrep: Rework lowering of BigNat# literals Message-ID: <65ed302eb8c7b_3a044cd1a6b18277c5@gitlab.mail> Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC Commits: 6d8f274b by Matthew Craven at 2024-03-09T22:51:50-05:00 CorePrep: Rework lowering of BigNat# literals Don't use bigNatFromWord#, because that's terrible: * We shouldn't have to traverse a linked list at run-time to build a BigNat# literal. That's just silly! * The static List object we have to create is much larger than the actual BigNat#'s contents, bloating code size. * We have to read the corresponding interface file, which causes un-tracked implicit dependencies. (#23942) Instead, encode them into the appropriate platform-dependent sequence of bytes, and generate code that copies these bytes at run-time from an Addr# literal into a new ByteArray#. A ByteArray# literal would be the correct thing to generate, but these are not yet supported; see also #17747. Somewhat surprisingly, this change results in a slight reduction in compiler allocations, averaging around 0.5% on ghc's compiler performance tests, including when compiling programs that contain no bignum literals to begin with. The specific cause of this has not been investigated. Since this lowering no longer reads the interface file for GHC.Num.BigNat, the reasoning in Note [Depend on GHC.Num.Integer] is obsoleted. But the story of un-tracked built-in dependencies remains complex, and Note [Tracking dependencies on primitives] now exists to explain this complexity. Additionally, many empty imports have been modified to refer to this new note and comply with its guidance. Several empty imports necessary for other reasons have also been given brief explanations. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 30 changed files: - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/PrimOps.hs-boot - compiler/GHC/Builtin/Types/Prim.hs - compiler/GHC/Cmm/Dominators.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Data/Word64Map/Strict.hs - compiler/GHC/Driver/CmdLine.hs - compiler/GHC/Driver/Config/CoreToStg/Prep.hs - compiler/GHC/Driver/Config/Diagnostic.hs - compiler/GHC/Driver/Errors/Ppr.hs - compiler/GHC/Iface/Errors/Ppr.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs-boot - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Platform.hs - compiler/GHC/StgToJS/Types.hs - compiler/GHC/Tc/Errors/Hole/Plugin.hs-boot - compiler/GHC/Tc/Types/LclEnv.hs-boot - compiler/GHC/Tc/Utils/Env.hs - compiler/GHC/Types/Id.hs-boot - compiler/GHC/Types/Var.hs-boot - compiler/GHC/Utils/Containers/Internal/StrictPair.hs - compiler/ghc.cabal.in - libraries/base/src/Data/Functor/Product.hs - libraries/base/src/Data/Functor/Sum.hs - libraries/base/src/Data/Kind.hs - libraries/base/src/GHC/ConsoleHandler.hs - libraries/base/src/GHC/Constants.hs - libraries/base/src/GHC/IO/Encoding/CodePage.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6d8f274b8677fcf9519d569875145f9f5434d779 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6d8f274b8677fcf9519d569875145f9f5434d779 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 12:56:18 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sun, 10 Mar 2024 08:56:18 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] configure: Bump GHC version to 9.11 Message-ID: <65edadf2a7d26_1969874edb0bc11736@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 2 changed files: - configure.ac - utils/haddock Changes: ===================================== configure.ac ===================================== @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.10.0], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.11], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Version on master must be X.Y (not X.Y.Z) for ProjectVersionMunged variable # to be useful (cf #19058). However, the version must have three components # (X.Y.Z) on stable branches (e.g. ghc-9.2) to ensure that pre-releases are ===================================== utils/haddock ===================================== @@ -1 +1 @@ -Subproject commit 243fefaa40ddcc7c657a95e92f30cb79ec4ecb45 +Subproject commit 504d4c1842db93704b4c5e158ecc3af7050ba9fe View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dc207d06e9a42bfb531cc0d24271547557b1c488 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dc207d06e9a42bfb531cc0d24271547557b1c488 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 12:58:50 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sun, 10 Mar 2024 08:58:50 -0400 Subject: [Git][ghc/ghc][master] 16 commits: ci-images: Bump Alpine image to bootstrap with 9.8.2 Message-ID: <65edae8ae0039_196987512037c166bf@gitlab.mail> Ben Gamari pushed to branch master at Glasgow Haskell Compiler / GHC Commits: f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal - libraries/ghc-boot-th/ghc-boot-th.cabal.in - libraries/ghc-boot/ghc-boot.cabal.in - libraries/ghc-compact/ghc-compact.cabal - libraries/ghc-experimental/ghc-experimental.cabal - libraries/ghc-heap/ghc-heap.cabal.in - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-prim/ghc-prim.cabal - libraries/ghci/ghci.cabal.in - libraries/haskeline - libraries/hpc - libraries/os-string - libraries/parsec The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2b1faea90dff1ad743925eb5a0b552a11c514349...dc207d06e9a42bfb531cc0d24271547557b1c488 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2b1faea90dff1ad743925eb5a0b552a11c514349...dc207d06e9a42bfb531cc0d24271547557b1c488 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 12:59:08 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sun, 10 Mar 2024 08:59:08 -0400 Subject: [Git][ghc/ghc] Pushed new tag ghc-9.11-start Message-ID: <65edae9ce765b_196987516215016869@gitlab.mail> Ben Gamari pushed new tag ghc-9.11-start at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/ghc-9.11-start You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 13:32:53 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sun, 10 Mar 2024 09:32:53 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] rel_eng/upload: Purge both $rel_name/ and $ver/ Message-ID: <65edb685b34b6_196987654a938192df@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: 865d7339 by Ben Gamari at 2024-03-10T09:32:46-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 1 changed file: - .gitlab/rel_eng/upload.sh Changes: ===================================== .gitlab/rel_eng/upload.sh ===================================== @@ -136,7 +136,7 @@ function upload() { } function purge_all() { - dir="$(echo $rel_name | sed s/-release//)" + local dir="$(echo $rel_name | sed s/-release//)" # Purge CDN cache curl -X PURGE http://downloads.haskell.org/ghc/ curl -X PURGE http://downloads.haskell.org/~ghc/ @@ -150,12 +150,18 @@ function purge_all() { } function purge_file() { - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/docs/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/docs/ + dirs=( + "~ghc/$rel_name" + "ghc/$rel_name" + "~ghc/$ver" + "ghc/$ver" + ) + + for dir in ${dirs[@]}; do + curl -X PURGE http://downloads.haskell.org/$dir/$i + curl -X PURGE http://downloads.haskell.org/$dir/$i/ + curl -X PURGE http://downloads.haskell.org/$dir/$i/docs/ + done } function prepare_docs() { View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/865d73393d91b6f86310c9729a05a7fe871aaa6f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/865d73393d91b6f86310c9729a05a7fe871aaa6f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 10 17:19:19 2024 From: gitlab at gitlab.haskell.org (Krzysztof Gogolewski (@monoidal)) Date: Sun, 10 Mar 2024 13:19:19 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/minor-cleanups Message-ID: <65edeb97d9153_196987c63d2182563d@gitlab.mail> Krzysztof Gogolewski pushed new branch wip/minor-cleanups at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/minor-cleanups You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 02:39:01 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sun, 10 Mar 2024 22:39:01 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/T24528 Message-ID: <65ee6ec56bfad_3939ed355b1b47998@gitlab.mail> Ben Gamari pushed new branch wip/T24528 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24528 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 02:39:14 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Sun, 10 Mar 2024 22:39:14 -0400 Subject: [Git][ghc/ghc][wip/T24528] Bump time submodule to 1.14 Message-ID: <65ee6ed2e33fd_3939ed35924ac814@gitlab.mail> Ben Gamari pushed to branch wip/T24528 at Glasgow Haskell Compiler / GHC Commits: 667daed5 by Ben Gamari at 2024-03-10T22:39:02-04:00 Bump time submodule to 1.14 As requested in #24528. - - - - - 1 changed file: - libraries/time Changes: ===================================== libraries/time ===================================== @@ -1 +1 @@ -Subproject commit baab563ee2ce547f7b7f7e7069ed09db2d406941 +Subproject commit e5c5d1987011efe88a21ab6ded45aaa33a16274f View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/667daed5d41d1370a48bf79fc35c681eb958416e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/667daed5d41d1370a48bf79fc35c681eb958416e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 02:50:04 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sun, 10 Mar 2024 22:50:04 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 20 commits: docs: Update info on TypeAbstractions Message-ID: <65ee715c1358f_3939ed39063a4127d1@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - bf4fab85 by Ben Gamari at 2024-03-10T22:49:58-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 0dc8dcc2 by Ben Gamari at 2024-03-10T22:49:58-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 869d8867 by Ben Gamari at 2024-03-10T22:49:58-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/exts/type_abstractions.rst - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal - libraries/ghc-boot-th/ghc-boot-th.cabal.in - libraries/ghc-boot/ghc-boot.cabal.in - libraries/ghc-compact/ghc-compact.cabal - libraries/ghc-experimental/ghc-experimental.cabal - libraries/ghc-heap/ghc-heap.cabal.in - libraries/ghc-internal/ghc-internal.cabal - libraries/ghc-prim/ghc-prim.cabal - libraries/ghci/ghci.cabal.in - libraries/haskeline - libraries/hpc - libraries/os-string The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ddffaba03ecb57b90b33ee72f3371a10bf1e1c1f...869d8867c758cf2587aa2990bdd73f68268c0f3d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ddffaba03ecb57b90b33ee72f3371a10bf1e1c1f...869d8867c758cf2587aa2990bdd73f68268c0f3d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 05:21:21 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 11 Mar 2024 01:21:21 -0400 Subject: [Git][ghc/ghc][master] 2 commits: rts/linker: Don't unload code when profiling is enabled Message-ID: <65ee94d140a4a_3939ed7ead7cc27088@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 5 changed files: - rts/CheckUnload.c - rts/Linker.c - rts/LinkerInternals.h - rts/linker/Elf.c - testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c Changes: ===================================== rts/CheckUnload.c ===================================== @@ -165,6 +165,18 @@ ObjectCode *loaded_objects; // map static closures to their ObjectCode. static OCSectionIndices *global_s_indices = NULL; +// Is it safe for us to unload code? +static bool safeToUnload(void) +{ + if (RtsFlags.ProfFlags.doHeapProfile != NO_HEAP_PROFILING) { + // We mustn't unload anything as the heap census may contain + // references into static data (e.g. cost centre names). + // See #24512. + return false; + } + return true; +} + static OCSectionIndices *createOCSectionIndices(void) { // TODO (osa): Maybe initialize as empty (without allocation) and allocate @@ -457,6 +469,8 @@ void checkUnload(void) { if (global_s_indices == NULL) { return; + } else if (!safeToUnload()) { + return; } // At this point we've marked all dynamically loaded static objects @@ -478,8 +492,6 @@ void checkUnload(void) next = oc->next; ASSERT(oc->status == OBJECT_UNLOADED); - removeOCSectionIndices(s_indices, oc); - // Symbols should be removed by unloadObj_. // NB (osa): If this assertion doesn't hold then freeObjectCode below // will corrupt symhash as keys of that table live in ObjectCodes. If @@ -487,8 +499,17 @@ void checkUnload(void) // RTS) then it's probably because this assertion did not hold. ASSERT(oc->symbols == NULL); - freeObjectCode(oc); - n_unloaded_objects -= 1; + if (oc->unloadable) { + removeOCSectionIndices(s_indices, oc); + freeObjectCode(oc); + n_unloaded_objects -= 1; + } else { + // If we don't have enough information to + // accurately determine the reachability of + // the object then hold onto it. + oc->next = objects; + objects = oc; + } } old_objects = NULL; ===================================== rts/Linker.c ===================================== @@ -1385,6 +1385,8 @@ mkOc( ObjectType type, pathchar *path, char *image, int imageSize, oc->prev = NULL; oc->next_loaded_object = NULL; oc->mark = object_code_mark_bit; + /* this will get cleared by the caller if object is not safely unloadable */ + oc->unloadable = true; oc->dependencies = allocHashSet(); #if defined(NEED_M32) ===================================== rts/LinkerInternals.h ===================================== @@ -313,8 +313,14 @@ struct _ObjectCode { struct _ObjectCode *next_loaded_object; // Mark bit + // N.B. This is a full word as we CAS it. StgWord mark; + // Can this object be safely unloaded? Not true for + // dynamic objects when dlinfo is not available as + // we cannot determine liveness. + bool unloadable; + // Set of dependencies (ObjectCode*) of the object file. Traverse // dependencies using `iterHashTable`. // @@ -376,7 +382,9 @@ struct _ObjectCode { /* handle returned from dlopen */ void *dlopen_handle; - /* virtual memory ranges of loaded code */ + /* virtual memory ranges of loaded code. NULL if no range information is + * available (e.g. if dlinfo is unavailable on the current platform). + */ NativeCodeRange *nc_ranges; }; ===================================== rts/linker/Elf.c ===================================== @@ -2186,6 +2186,10 @@ void * loadNativeObj_ELF (pathchar *path, char **errmsg) copyErrmsg(errmsg, "dl_iterate_phdr failed to find obj"); goto dl_iterate_phdr_fail; } + nc->unloadable = true; +#else + nc->nc_ranges = NULL; + nc->unloadable = false; #endif /* defined (HAVE_DLINFO) */ insertOCSectionIndices(nc); ===================================== testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c ===================================== @@ -64,7 +64,7 @@ void check_object_freed(char *obj_path) { OStatus st; st = getObjectLoadStatus(toPathchar(obj_path)); if (st != OBJECT_NOT_LOADED) { - errorBelch("object %s status != OBJECT_NOT_LOADED", obj_path); + errorBelch("object %s status != OBJECT_NOT_LOADED, is %d instead", obj_path, st); exit(1); } } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/dc207d06e9a42bfb531cc0d24271547557b1c488...7810b4c37c7d03772215102a8db5e84d29fe2221 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/dc207d06e9a42bfb531cc0d24271547557b1c488...7810b4c37c7d03772215102a8db5e84d29fe2221 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 05:21:42 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 11 Mar 2024 01:21:42 -0400 Subject: [Git][ghc/ghc][master] rel_eng/upload: Purge both $rel_name/ and $ver/ Message-ID: <65ee94e64db35_3939ed7edeafc2720@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 1 changed file: - .gitlab/rel_eng/upload.sh Changes: ===================================== .gitlab/rel_eng/upload.sh ===================================== @@ -136,7 +136,7 @@ function upload() { } function purge_all() { - dir="$(echo $rel_name | sed s/-release//)" + local dir="$(echo $rel_name | sed s/-release//)" # Purge CDN cache curl -X PURGE http://downloads.haskell.org/ghc/ curl -X PURGE http://downloads.haskell.org/~ghc/ @@ -150,12 +150,18 @@ function purge_all() { } function purge_file() { - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/docs/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/docs/ + dirs=( + "~ghc/$rel_name" + "ghc/$rel_name" + "~ghc/$ver" + "ghc/$ver" + ) + + for dir in ${dirs[@]}; do + curl -X PURGE http://downloads.haskell.org/$dir/$i + curl -X PURGE http://downloads.haskell.org/$dir/$i/ + curl -X PURGE http://downloads.haskell.org/$dir/$i/docs/ + done } function prepare_docs() { View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0590764c73841115fc567757e370d5c9dc7e6478 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0590764c73841115fc567757e370d5c9dc7e6478 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 15:23:29 2024 From: gitlab at gitlab.haskell.org (Apoorv Ingle (@ani)) Date: Mon, 11 Mar 2024 11:23:29 -0400 Subject: [Git][ghc/ghc][wip/expansions-appdo] 156 commits: JS: add simple optimizer Message-ID: <65ef21f1dda6e_3503b984fcac147763@gitlab.mail> Apoorv Ingle pushed to branch wip/expansions-appdo at Glasgow Haskell Compiler / GHC Commits: 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 091a113e by Apoorv Ingle at 2024-03-11T08:25:26-05:00 make applicative do work with expansions, possibly badly Fixes: #24406 - - - - - b3d90ba3 by Apoorv Ingle at 2024-03-11T08:25:26-05:00 enable the flow - - - - - 5106889a by Apoorv Ingle at 2024-03-11T08:25:26-05:00 renaming do_or_lc to doFlavour and debugging error contexts - - - - - 21 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Names/TH.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f6ec2c444332b32273f9b9abedee4c92a3242d97...5106889a7948f353f83f1584aa22f822e72680ed -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f6ec2c444332b32273f9b9abedee4c92a3242d97...5106889a7948f353f83f1584aa22f822e72680ed You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 15:32:52 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Mon, 11 Mar 2024 11:32:52 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/fix-tysyn] 52 commits: Rephrase error message to say "visible arguments" (#24318) Message-ID: <65ef2424930fe_3503b9f224581509f6@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/fix-tysyn at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 7da705c2 by Andrei Borzenkov at 2024-03-11T19:32:39+04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (24470) - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Tc/Utils/Unify.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/350f84ea75f5c4ab69716ae9e42ebdcb3e5ecef1...7da705c22859db07b5a22858a68f1fc49281d577 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/350f84ea75f5c4ab69716ae9e42ebdcb3e5ecef1...7da705c22859db07b5a22858a68f1fc49281d577 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 15:34:32 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Mon, 11 Mar 2024 11:34:32 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/fix-tysyn] Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) Message-ID: <65ef2488d3e27_3503b9ffd28815118f@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/fix-tysyn at Glasgow Haskell Compiler / GHC Commits: 6c9bca43 by Andrei Borzenkov at 2024-03-11T19:34:08+04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 9 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accomodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c9bca4333c20de6aa3df9c629f40f33faccd887 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c9bca4333c20de6aa3df9c629f40f33faccd887 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 15:36:12 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Mon, 11 Mar 2024 11:36:12 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/fix-tysyn] Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) Message-ID: <65ef24ecd4bbb_3503ba0be050152959@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/fix-tysyn at Glasgow Haskell Compiler / GHC Commits: 283f257f by Andrei Borzenkov at 2024-03-11T19:35:59+04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 9 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accommodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/283f257f45b11e3824ff7d7bd3fe1ae6881c713a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/283f257f45b11e3824ff7d7bd3fe1ae6881c713a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 17:38:49 2024 From: gitlab at gitlab.haskell.org (Apoorv Ingle (@ani)) Date: Mon, 11 Mar 2024 13:38:49 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/T18313 Message-ID: <65ef41a9e7391_358193c3dbec67531@gitlab.mail> Apoorv Ingle pushed new branch wip/T18313 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T18313 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 20:25:22 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 11 Mar 2024 16:25:22 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] 5 commits: gitlab/rel_eng: Fix name of Rocky8 artifact Message-ID: <65ef68b2cb3be_3581934f1c058751b6@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: da97c238 by Ben Gamari at 2024-03-09T20:08:12-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - d7fa9dd9 by Ben Gamari at 2024-03-09T20:08:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - 5fb7591d by Ben Gamari at 2024-03-09T20:28:41-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - 3e109143 by Ben Gamari at 2024-03-11T16:24:22-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 7c32c59b by Ben Gamari at 2024-03-11T16:24:24-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - 7 changed files: - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - hadrian/bindist/Makefile - hadrian/src/Rules/BinaryDist.hs Changes: ===================================== .gitlab/rel_eng/default.nix ===================================== @@ -27,6 +27,15 @@ let buildCommand = '' mkdir -p $out/bin + makeWrapper ${./recompress-all} $out/bin/recompress-all \ + --prefix PATH : ${gnumake}/bin \ + --prefix PATH : ${gnutar}/bin \ + --prefix PATH : ${lzip}/bin \ + --prefix PATH : ${bzip2}/bin \ + --prefix PATH : ${gzip}/bin \ + --prefix PATH : ${xz}/bin \ + --prefix PATH : ${zip}/bin + makeWrapper ${./upload.sh} $out/bin/upload.sh \ --prefix PATH : ${moreutils}/bin \ --prefix PATH : ${lftp}/bin \ @@ -35,8 +44,8 @@ let --prefix PATH : ${s3cmd}/bin \ --prefix PATH : ${gnupg}/bin \ --prefix PATH : ${pinentry}/bin \ - --prefix PATH : ${parallel}/bin \ --prefix PATH : ${python3}/bin \ + --prefix PATH : $out/bin \ --set ENTER_FHS_ENV ${bindistPrepEnv}/bin/enter-fhs \ --set BASH ${bash}/bin/bash ===================================== .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py ===================================== @@ -18,7 +18,7 @@ def job_triple(job_name): bindists = { 'release-x86_64-windows-release': 'x86_64-unknown-mingw32', 'release-x86_64-windows-int_native-release': 'x86_64-unknown-mingw32-int_native', - 'release-x86_64-rocky8-release': 'x86_64-rocky8-linux', + 'release-x86_64-linux-rocky8-release': 'x86_64-rocky8-linux', 'release-x86_64-linux-ubuntu20_04-release': 'x86_64-ubuntu20_04-linux', 'release-x86_64-linux-ubuntu18_04-release': 'x86_64-ubuntu18_04-linux', 'release-x86_64-linux-fedora33-release+debug_info': 'x86_64-fedora33-linux-dwarf', ===================================== .gitlab/rel_eng/mk-ghcup-metadata/README.mkd ===================================== @@ -22,7 +22,7 @@ options: ``` The script also requires the `.gitlab/jobs-metadata.yaml` file which can be generated -by running `.gitlab/generate_jobs_metadata` script if you want to run it locally. +by running `.gitlab/generate-ci/generate_jobs_metadata` script if you want to run it locally. ## CI Pipelines ===================================== .gitlab/rel_eng/recompress-all ===================================== @@ -0,0 +1,29 @@ +#!/usr/bin/env -S make -f + +MAKEFLAGS += --no-builtin-rules +MAKEFLAGS += --no-builtin-variables + +usage : + echo "recompress [dest files]" + exit 1 + +%.gz : %.xz + echo "[xz->gz] $< to $@..." + xz -c $< | gzip -c > $@ + +%.bz2 : %.xz + echo "[xz->bz2] $< to $@..." + xz -c $< | bzip2 -c > $@ + +%.lz : %.xz + echo "[xz->lz] $< to $@..." + xz -c $< | lzip -c > $@ + +%.zip : %.tar.xz + echo "[tarxz->zip] $< to $@..." + tmp="$(mktemp tmp.XXX)" && \ + tar -C "$$tmp" -xf $< && \ + cd "$$tmp" && \ + zip -9 -r $@ * && \ + rm -R "$$tmp" + ===================================== .gitlab/rel_eng/upload.sh ===================================== @@ -193,29 +193,21 @@ function prepare_docs() { function recompress() { set -Eeuo pipefail - combine <(basename -s .xz *.xz) not <(basename -s .lz *.lz) | \ - parallel 'echo "Recompressing {}.xz to {}.lz"; unxz -c {}.xz | lzip - -o {}.lz' - - for darwin_bindist in $(ls ghc-*-darwin.tar.xz); do - local dest="$(basename $darwin_bindist .xz).bz2" - if [[ ! -f "$dest" ]]; then - echo "Recompressing Darwin bindist to bzip2..." - unxz -c "$darwin_bindist" | bzip2 > "$dest" - fi + needed=() + + for i in ghc-*.tar.xz; do + needed+=( "$(basename $i .xz).gz" ) done - for windows_bindist in $(ls ghc-*-mingw32*.tar.xz); do - local tmp="$(mktemp -d tmp.XXX)" - local dest="$(realpath $(basename $windows_bindist .tar.xz).zip)" - echo $dest - if [[ ! -f "$dest" ]]; then - echo "Recompressing Windows bindist to zip..." - tar -C "$tmp" -xf "$windows_bindist" - ls $tmp - (cd "$tmp"; zip -9 -r "$dest" *) - fi - rm -R "$tmp" + for i in ghc-*-darwin.tar.xz; do + needed+=( "$(basename $i .xz).bz2" ) done + + for i in ghc-*-mingw32.tar.xz; do + needed+=( "$(basename $i .tar.xz).zip" ) + done + + recompress-all -l ${needed[@]} } function upload_docs() { ===================================== hadrian/bindist/Makefile ===================================== @@ -175,18 +175,19 @@ install_lib: lib/settings @dest="$(DESTDIR)$(ActualLibsDir)"; \ cd lib; \ for i in `$(FIND) . -type f`; do \ - $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \ + dir="`dirname $$i`" + $(INSTALL_DIR) "$$dest/$$dir" ; \ case $$i in \ *.a) \ - $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_DATA) $$i "$$dest/$$dir" ; \ $(RANLIB_CMD) "$$dest"/$$i ;; \ *.dll) \ - $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \ $(STRIP_CMD) "$$dest"/$$i ;; \ *.so) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.dylib) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.mjs) \ $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \ *) \ ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -135,7 +135,8 @@ bindistRules = do let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty installTo Relocatable prefix - + copyDirectory (root -/- "mingw") prefix + liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw") phony "install" $ do need ["binary-dist-dir"] @@ -145,8 +146,6 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - - version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull distDir <- Context.distDir Stage1 @@ -309,7 +308,7 @@ bindistRules = do let buildBinDist compressor = do win_target <- isWinTarget - when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.") + when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.") buildBinDistX "binary-dist-dir" "bindist" compressor buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist" View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/865d73393d91b6f86310c9729a05a7fe871aaa6f...7c32c59b924f59ce0718f5894b7ff0ebdb85fe65 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/865d73393d91b6f86310c9729a05a7fe871aaa6f...7c32c59b924f59ce0718f5894b7ff0ebdb85fe65 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 20:35:33 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 11 Mar 2024 16:35:33 -0400 Subject: [Git][ghc/ghc][wip/ghc-9.10] 5 commits: configure: Bump GHC version to 9.11 Message-ID: <65ef6b15ec95d_35819354a17a877092@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - eb933212 by Ben Gamari at 2024-03-10T09:32:03-04:00 gitlab-ci: Allow test-primops to fail It's still a bit sensitive to warnings, unfortunately. - - - - - fc270d76 by Ben Gamari at 2024-03-10T09:32:03-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 570c32dd by Ben Gamari at 2024-03-11T16:33:44-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - eee314ac by Ben Gamari at 2024-03-11T16:33:47-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 6 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/upload.sh - configure.ac - hadrian/bindist/Makefile - hadrian/src/Rules/BinaryDist.hs - utils/haddock Changes: ===================================== .gitlab-ci.yml ===================================== @@ -899,6 +899,7 @@ test-primops-nightly: test-primops-release: extends: .test-primops + allow_failure: true rules: - if: '$RELEASE_JOB == "yes"' ===================================== .gitlab/rel_eng/upload.sh ===================================== @@ -136,7 +136,7 @@ function upload() { } function purge_all() { - dir="$(echo $rel_name | sed s/-release//)" + local dir="$(echo $rel_name | sed s/-release//)" # Purge CDN cache curl -X PURGE http://downloads.haskell.org/ghc/ curl -X PURGE http://downloads.haskell.org/~ghc/ @@ -150,12 +150,18 @@ function purge_all() { } function purge_file() { - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/docs/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/docs/ + dirs=( + "~ghc/$rel_name" + "ghc/$rel_name" + "~ghc/$ver" + "ghc/$ver" + ) + + for dir in ${dirs[@]}; do + curl -X PURGE http://downloads.haskell.org/$dir/$i + curl -X PURGE http://downloads.haskell.org/$dir/$i/ + curl -X PURGE http://downloads.haskell.org/$dir/$i/docs/ + done } function prepare_docs() { ===================================== configure.ac ===================================== @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.10.0], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.11], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Version on master must be X.Y (not X.Y.Z) for ProjectVersionMunged variable # to be useful (cf #19058). However, the version must have three components # (X.Y.Z) on stable branches (e.g. ghc-9.2) to ensure that pre-releases are ===================================== hadrian/bindist/Makefile ===================================== @@ -175,18 +175,19 @@ install_lib: lib/settings @dest="$(DESTDIR)$(ActualLibsDir)"; \ cd lib; \ for i in `$(FIND) . -type f`; do \ - $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \ + dir="`dirname $$i`" + $(INSTALL_DIR) "$$dest/$$dir" ; \ case $$i in \ *.a) \ - $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_DATA) $$i "$$dest/$$dir" ; \ $(RANLIB_CMD) "$$dest"/$$i ;; \ *.dll) \ - $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \ $(STRIP_CMD) "$$dest"/$$i ;; \ *.so) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.dylib) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.mjs) \ $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \ *) \ ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -135,7 +135,8 @@ bindistRules = do let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty installTo Relocatable prefix - + copyDirectory (root -/- "mingw") prefix + liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw") phony "install" $ do need ["binary-dist-dir"] @@ -145,8 +146,6 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - - version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull distDir <- Context.distDir Stage1 @@ -309,7 +308,7 @@ bindistRules = do let buildBinDist compressor = do win_target <- isWinTarget - when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.") + when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.") buildBinDistX "binary-dist-dir" "bindist" compressor buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist" ===================================== utils/haddock ===================================== @@ -1 +1 @@ -Subproject commit 243fefaa40ddcc7c657a95e92f30cb79ec4ecb45 +Subproject commit 504d4c1842db93704b4c5e158ecc3af7050ba9fe View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/19bca2fec8650034b1f9d9c3407713e69d653c73...eee314ac17396357c9e0520a3b389f47cd90e80b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/19bca2fec8650034b1f9d9c3407713e69d653c73...eee314ac17396357c9e0520a3b389f47cd90e80b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 21:56:04 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 11 Mar 2024 17:56:04 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] 2 commits: hadrian/bindist: Eliminate extraneous `dirname` invocation Message-ID: <65ef7df4b0ba_35819379d20b887019@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: fe9f4cda by Ben Gamari at 2024-03-11T17:55:48-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 069a38ec by Ben Gamari at 2024-03-11T17:55:57-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - 2 changed files: - hadrian/bindist/Makefile - hadrian/src/Rules/BinaryDist.hs Changes: ===================================== hadrian/bindist/Makefile ===================================== @@ -175,18 +175,19 @@ install_lib: lib/settings @dest="$(DESTDIR)$(ActualLibsDir)"; \ cd lib; \ for i in `$(FIND) . -type f`; do \ - $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \ + dir="`dirname $$i`"; \ + $(INSTALL_DIR) "$$dest/$$dir" ; \ case $$i in \ *.a) \ - $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_DATA) $$i "$$dest/$$dir" ; \ $(RANLIB_CMD) "$$dest"/$$i ;; \ *.dll) \ - $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \ $(STRIP_CMD) "$$dest"/$$i ;; \ *.so) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.dylib) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.mjs) \ $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \ *) \ ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -135,7 +135,8 @@ bindistRules = do let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty installTo Relocatable prefix - + copyDirectory (root -/- "mingw") prefix + liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw") phony "install" $ do need ["binary-dist-dir"] @@ -145,8 +146,6 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - - version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull distDir <- Context.distDir Stage1 @@ -309,7 +308,7 @@ bindistRules = do let buildBinDist compressor = do win_target <- isWinTarget - when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.") + when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.") buildBinDistX "binary-dist-dir" "bindist" compressor buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist" View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c32c59b924f59ce0718f5894b7ff0ebdb85fe65...069a38ec2120f10fdfe40e3fa2807b93c03857d1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c32c59b924f59ce0718f5894b7ff0ebdb85fe65...069a38ec2120f10fdfe40e3fa2807b93c03857d1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 21:56:39 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 11 Mar 2024 17:56:39 -0400 Subject: [Git][ghc/ghc][wip/ghc-9.10] hadrian/bindist: Eliminate extraneous `dirname` invocation Message-ID: <65ef7e1756143_3581937ad56e08746e@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 563fa0fd by Ben Gamari at 2024-03-11T17:56:26-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 1 changed file: - hadrian/bindist/Makefile Changes: ===================================== hadrian/bindist/Makefile ===================================== @@ -175,18 +175,19 @@ install_lib: lib/settings @dest="$(DESTDIR)$(ActualLibsDir)"; \ cd lib; \ for i in `$(FIND) . -type f`; do \ - $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \ + dir="`dirname $$i`" ; \ + $(INSTALL_DIR) "$$dest/$$dir" ; \ case $$i in \ *.a) \ - $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_DATA) $$i "$$dest/$$dir" ; \ $(RANLIB_CMD) "$$dest"/$$i ;; \ *.dll) \ - $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \ $(STRIP_CMD) "$$dest"/$$i ;; \ *.so) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.dylib) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.mjs) \ $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \ *) \ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/563fa0fd6d25b6187e763832adaae2659fe1f52e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/563fa0fd6d25b6187e763832adaae2659fe1f52e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 21:57:11 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Mon, 11 Mar 2024 17:57:11 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] 2 commits: hadrian/bindist: Eliminate extraneous `dirname` invocation Message-ID: <65ef7e3737587_3581937b9218c88031@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: 3116d29a by Ben Gamari at 2024-03-11T17:57:04-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 7553df38 by Ben Gamari at 2024-03-11T17:57:04-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - 2 changed files: - hadrian/bindist/Makefile - hadrian/src/Rules/BinaryDist.hs Changes: ===================================== hadrian/bindist/Makefile ===================================== @@ -175,18 +175,19 @@ install_lib: lib/settings @dest="$(DESTDIR)$(ActualLibsDir)"; \ cd lib; \ for i in `$(FIND) . -type f`; do \ - $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \ + dir="`dirname $$i`" ; \ + $(INSTALL_DIR) "$$dest/$$dir" ; \ case $$i in \ *.a) \ - $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_DATA) $$i "$$dest/$$dir" ; \ $(RANLIB_CMD) "$$dest"/$$i ;; \ *.dll) \ - $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \ $(STRIP_CMD) "$$dest"/$$i ;; \ *.so) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.dylib) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.mjs) \ $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \ *) \ ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -135,7 +135,8 @@ bindistRules = do let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty installTo Relocatable prefix - + copyDirectory (root -/- "mingw") prefix + liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw") phony "install" $ do need ["binary-dist-dir"] @@ -145,8 +146,6 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - - version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull distDir <- Context.distDir Stage1 @@ -309,7 +308,7 @@ bindistRules = do let buildBinDist compressor = do win_target <- isWinTarget - when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.") + when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.") buildBinDistX "binary-dist-dir" "bindist" compressor buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist" View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/069a38ec2120f10fdfe40e3fa2807b93c03857d1...7553df3897c2170b42fbbfbc254fff85e9c0bb10 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/069a38ec2120f10fdfe40e3fa2807b93c03857d1...7553df3897c2170b42fbbfbc254fff85e9c0bb10 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 22:23:21 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Mon, 11 Mar 2024 18:23:21 -0400 Subject: [Git][ghc/ghc][wip/tsan/fixes-3] 33 commits: rts/CloneStack: Bounds check array write Message-ID: <65ef8459e441c_3581938c7a9049202@gitlab.mail> Cheng Shao pushed to branch wip/tsan/fixes-3 at Glasgow Haskell Compiler / GHC Commits: c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - d4a22bab by Ben Gamari at 2024-03-11T08:25:44+00:00 rts: Fix TSAN_ENABLED CPP guard This should be `#if defined(TSAN_ENABLED)`, not `#if TSAN_ENABLED`, lest we suffer warnings. - - - - - bc8ccc11 by Cheng Shao at 2024-03-11T22:02:02+00:00 rts: fix errors when compiling with TSAN This commit fixes rts compilation errors when compiling with TSAN: - xxx_FENCE macros are redefined and trigger CPP warnings. - Use SIZEOF_W. WORD_SIZE_IN_BITS is provided by MachDeps.h which Cmm.h doesn't include by default. - - - - - 8c381639 by Cheng Shao at 2024-03-11T22:04:45+00:00 rts: fix clang-specific errors when compiling with TSAN This commit fixes clang-specific rts compilation errors when compiling with TSAN: - clang doesn't have -Wtsan flag - Fix prototype of ghc_tsan_* helper functions - __tsan_atomic_* functions aren't clang built-ins and sanitizer/tsan_interface_atomic.h needs to be included - - - - - 917fc23e by Cheng Shao at 2024-03-11T22:12:18+00:00 ci: improve TSAN CI jobs - Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm instrumentation as well. - Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc that @bgamari confirms he's using in #GHC:matrix.org. Ideally we should be using latest clang release for latest improvements in sanitizers, though that's left as future work. - Mark TSAN jobs as manual+allow_failure in validate pipelines. The purpose is to demonstrate that we have indeed at least fixed building of TSAN mode in CI without blocking the patch to land, and once merged other people can begin playing with TSAN using their own dev setups and feature branches. - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/exts/type_abstractions.rst - ghc/ghc-bin.cabal.in - libraries/array - libraries/base/base.cabal - libraries/base/changelog.md - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/deepseq - libraries/directory - libraries/exceptions - libraries/filepath - libraries/ghc-bignum/ghc-bignum.cabal - libraries/ghc-boot-th/ghc-boot-th.cabal.in - libraries/ghc-boot/ghc-boot.cabal.in - libraries/ghc-compact/ghc-compact.cabal - libraries/ghc-experimental/ghc-experimental.cabal The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/981eedbe8fbd7253c2b9f943d1a19ab33a9e40df...917fc23ec9b8ebcca3a5beead2b94dd7b8ec3975 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/981eedbe8fbd7253c2b9f943d1a19ab33a9e40df...917fc23ec9b8ebcca3a5beead2b94dd7b8ec3975 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 22:25:06 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Mon, 11 Mar 2024 18:25:06 -0400 Subject: [Git][ghc/ghc][wip/tsan/fixes-3] ci: improve TSAN CI jobs Message-ID: <65ef84c235b49_3581938def6049243@gitlab.mail> Cheng Shao pushed to branch wip/tsan/fixes-3 at Glasgow Haskell Compiler / GHC Commits: 361b2707 by Cheng Shao at 2024-03-11T22:24:14+00:00 ci: improve TSAN CI jobs - Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm instrumentation as well. - Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc that @bgamari confirms he's using in #GHC:matrix.org. Ideally we should be using latest clang release for latest improvements in sanitizers, though that's left as future work. - Mark TSAN jobs as manual+allow_failure in validate pipelines. The purpose is to demonstrate that we have indeed at least fixed building of TSAN mode in CI without blocking the patch to land, and once merged other people can begin playing with TSAN using their own dev setups and feature branches. - - - - - 2 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -339,7 +339,7 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f flavour_string Llvm = "llvm" flavour_string Dwarf = "debug_info" flavour_string FullyStatic = "fully_static" - flavour_string ThreadSanitiser = "thread_sanitizer" + flavour_string ThreadSanitiser = "thread_sanitizer_cmm" flavour_string NoSplitSections = "no_split_sections" flavour_string BootNonmovingGc = "boot_nonmoving_gc" @@ -969,9 +969,9 @@ job_groups = , validateBuilds Amd64 (Linux Debian10) nativeInt , validateBuilds Amd64 (Linux Debian10) unreg , fastCI (validateBuilds Amd64 (Linux Debian10) debug) - , -- Nightly allowed to fail: #22520 + , -- More work is needed to address TSAN failures: #22520 modifyNightlyJobs allowFailure - (modifyValidateJobs manual tsan_jobs) + (modifyValidateJobs (allowFailure . manual) tsan_jobs) , -- Nightly allowed to fail: #22343 modifyNightlyJobs allowFailure (modifyValidateJobs manual (validateBuilds Amd64 (Linux Debian10) noTntc)) @@ -1039,7 +1039,7 @@ job_groups = -- Haddock is large enough to make TSAN choke without massive quantities of -- memory. . addVariable "HADRIAN_ARGS" "--docs=none") $ - validateBuilds Amd64 (Linux Debian10) tsan + validateBuilds Amd64 (Linux Debian12) tsan make_wasm_jobs cfg = modifyJobs ===================================== .gitlab/jobs.yaml ===================================== @@ -1644,18 +1644,18 @@ "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-validate+thread_sanitizer": { + "nightly-x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": true, + "allow_failure": false, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1698,17 +1698,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", + "TEST_ENV": "x86_64-linux-deb10-zstd-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-zstd-validate": { + "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1719,7 +1717,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1729,14 +1727,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -1762,15 +1760,17 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate", + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1781,7 +1781,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1823,18 +1823,19 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "nightly-x86_64-linux-deb11-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1845,7 +1846,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1887,19 +1888,16 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "TEST_ENV": "x86_64-linux-deb11-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate": { + "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1910,7 +1908,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1953,15 +1951,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-validate", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "nightly-x86_64-linux-deb12-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1972,7 +1970,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1982,14 +1980,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -2015,15 +2013,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", + "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate": { + "nightly-x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -2034,7 +2032,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2077,26 +2075,26 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate+llvm": { + "nightly-x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2139,11 +2137,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm", + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", "XZ_OPT": "-9" } }, @@ -5090,7 +5090,7 @@ "TEST_ENV": "x86_64-linux-deb10-validate+debug_info" } }, - "x86_64-linux-deb10-validate+thread_sanitizer": { + "x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5101,7 +5101,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5127,9 +5127,8 @@ ], "rules": [ { - "allow_failure": true, - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "manual" + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "on_success" } ], "script": [ @@ -5145,16 +5144,14 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" + "TEST_ENV": "x86_64-linux-deb10-zstd-validate" } }, - "x86_64-linux-deb10-zstd-validate": { + "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5165,7 +5162,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5175,14 +5172,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5191,7 +5188,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5208,14 +5205,16 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate" + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" } }, - "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5226,7 +5225,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5252,7 +5251,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5268,17 +5267,18 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" } }, - "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5289,7 +5289,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5315,7 +5315,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5331,18 +5331,15 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" } }, - "x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5353,7 +5350,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5363,14 +5360,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5379,7 +5376,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5396,25 +5393,25 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm" } }, - "x86_64-linux-deb12-validate+llvm": { + "x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5440,8 +5437,9 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "on_success" + "allow_failure": true, + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "manual" } ], "script": [ @@ -5457,11 +5455,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm" + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" } }, "x86_64-linux-fedora33-release": { View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/361b270730677562a1324acd6736dab564a5a947 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/361b270730677562a1324acd6736dab564a5a947 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 11 23:03:11 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Mon, 11 Mar 2024 19:03:11 -0400 Subject: [Git][ghc/ghc][wip/tsan/fixes-3] ci: improve TSAN CI jobs Message-ID: <65ef8daf45c88_3581939d820bc94564@gitlab.mail> Cheng Shao pushed to branch wip/tsan/fixes-3 at Glasgow Haskell Compiler / GHC Commits: c4128331 by Cheng Shao at 2024-03-11T23:02:43+00:00 ci: improve TSAN CI jobs - Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm instrumentation as well. - Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc that @bgamari confirms he's using in #GHC:matrix.org. Ideally we should be using latest clang release for latest improvements in sanitizers, though that's left as future work. - Mark TSAN jobs as manual+allow_failure in validate pipelines. The purpose is to demonstrate that we have indeed at least fixed building of TSAN mode in CI without blocking the patch to land, and once merged other people can begin playing with TSAN using their own dev setups and feature branches. - - - - - 2 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -339,7 +339,7 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f flavour_string Llvm = "llvm" flavour_string Dwarf = "debug_info" flavour_string FullyStatic = "fully_static" - flavour_string ThreadSanitiser = "thread_sanitizer" + flavour_string ThreadSanitiser = "thread_sanitizer_cmm" flavour_string NoSplitSections = "no_split_sections" flavour_string BootNonmovingGc = "boot_nonmoving_gc" @@ -969,9 +969,9 @@ job_groups = , validateBuilds Amd64 (Linux Debian10) nativeInt , validateBuilds Amd64 (Linux Debian10) unreg , fastCI (validateBuilds Amd64 (Linux Debian10) debug) - , -- Nightly allowed to fail: #22520 + , -- More work is needed to address TSAN failures: #22520 modifyNightlyJobs allowFailure - (modifyValidateJobs manual tsan_jobs) + (modifyValidateJobs (allowFailure . manual) tsan_jobs) , -- Nightly allowed to fail: #22343 modifyNightlyJobs allowFailure (modifyValidateJobs manual (validateBuilds Amd64 (Linux Debian10) noTntc)) @@ -1039,7 +1039,7 @@ job_groups = -- Haddock is large enough to make TSAN choke without massive quantities of -- memory. . addVariable "HADRIAN_ARGS" "--docs=none") $ - validateBuilds Amd64 (Linux Debian10) tsan + validateBuilds Amd64 (Linux Debian12) tsan make_wasm_jobs cfg = modifyJobs @@ -1083,6 +1083,7 @@ platform_mapping = Map.map go combined_result , "nightly-x86_64-linux-deb11-validate" , "nightly-x86_64-linux-deb12-validate" , "x86_64-linux-alpine3_18-wasm-cross_wasm32-wasi-release+fully_static" + , "x86_64-linux-deb12-validate+thread_sanitizer_cmm" , "nightly-aarch64-linux-deb10-validate" , "nightly-x86_64-linux-alpine3_12-validate" , "nightly-x86_64-linux-deb10-validate" ===================================== .gitlab/jobs.yaml ===================================== @@ -1644,18 +1644,18 @@ "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-validate+thread_sanitizer": { + "nightly-x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": true, + "allow_failure": false, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1698,17 +1698,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", + "TEST_ENV": "x86_64-linux-deb10-zstd-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-zstd-validate": { + "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1719,7 +1717,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1729,14 +1727,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -1762,15 +1760,17 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate", + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1781,7 +1781,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1823,18 +1823,19 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "nightly-x86_64-linux-deb11-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1845,7 +1846,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1887,19 +1888,16 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "TEST_ENV": "x86_64-linux-deb11-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate": { + "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1910,7 +1908,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1953,15 +1951,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-validate", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "nightly-x86_64-linux-deb12-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1972,7 +1970,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1982,14 +1980,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -2015,15 +2013,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", + "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate": { + "nightly-x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -2034,7 +2032,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2077,26 +2075,26 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate+llvm": { + "nightly-x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2139,11 +2137,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm", + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", "XZ_OPT": "-9" } }, @@ -5090,7 +5090,7 @@ "TEST_ENV": "x86_64-linux-deb10-validate+debug_info" } }, - "x86_64-linux-deb10-validate+thread_sanitizer": { + "x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5101,7 +5101,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5127,9 +5127,8 @@ ], "rules": [ { - "allow_failure": true, - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "manual" + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "on_success" } ], "script": [ @@ -5145,16 +5144,14 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" + "TEST_ENV": "x86_64-linux-deb10-zstd-validate" } }, - "x86_64-linux-deb10-zstd-validate": { + "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5165,7 +5162,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5175,14 +5172,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5191,7 +5188,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5208,14 +5205,16 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate" + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" } }, - "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5226,7 +5225,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5252,7 +5251,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5268,17 +5267,18 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" } }, - "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5289,7 +5289,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5315,7 +5315,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5331,18 +5331,15 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" } }, - "x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5353,7 +5350,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5363,14 +5360,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5379,7 +5376,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5396,25 +5393,25 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm" } }, - "x86_64-linux-deb12-validate+llvm": { + "x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5440,8 +5437,9 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "on_success" + "allow_failure": true, + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "manual" } ], "script": [ @@ -5457,11 +5455,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm" + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" } }, "x86_64-linux-fedora33-release": { View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4128331d766c13b5333e14e06251ff7fc1d5e96 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4128331d766c13b5333e14e06251ff7fc1d5e96 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 07:26:56 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Tue, 12 Mar 2024 03:26:56 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/sand-witch/tysyn-info-ppr Message-ID: <65f003c0287f1_25db4e8567720829be@gitlab.mail> Andrei Borzenkov pushed new branch wip/sand-witch/tysyn-info-ppr at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/sand-witch/tysyn-info-ppr You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 07:28:05 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Tue, 12 Mar 2024 03:28:05 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/tysyn-info-ppr] Update GHCi :info type synonym printing (24459) Message-ID: <65f004053d06_25db4e88b8c3083186@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/tysyn-info-ppr at Glasgow Haskell Compiler / GHC Commits: 1fc7d5a7 by Andrei Borzenkov at 2024-03-12T11:27:37+04:00 Update GHCi :info type synonym printing (24459) - Do not print result's kind since we have full kind in SAKS and have arity using @-binders - Do not suppress significant invisible binders Invisible binder is considered significant when it meets at least one of two following criteria: - It visibly occurs in the RHS type - It is not followed by a visible binder, so it affects arity of type synonym - - - - - 23 changed files: - compiler/GHC/Core/TyCon.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs - testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout - testsuite/tests/backpack/should_fail/T19244a.stderr - testsuite/tests/backpack/should_fail/T19244b.stderr - testsuite/tests/backpack/should_fail/bkpfail46.stderr - testsuite/tests/ghci/T18060/T18060.stdout - testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout - testsuite/tests/ghci/scripts/T15941.stdout - testsuite/tests/ghci/scripts/T19310.stdout - testsuite/tests/ghci/scripts/T21294a.stdout - + testsuite/tests/ghci/scripts/T24459.script - + testsuite/tests/ghci/scripts/T24459.stdout - testsuite/tests/ghci/scripts/T8535.stdout - testsuite/tests/ghci/scripts/T9181.stdout - testsuite/tests/ghci/scripts/all.T - testsuite/tests/ghci/scripts/ghci020.stdout - testsuite/tests/ghci/should_run/T10145.stdout - testsuite/tests/ghci/should_run/T18594.stdout - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/rep-poly/RepPolyBackpack3.stderr Changes: ===================================== compiler/GHC/Core/TyCon.hs ===================================== @@ -25,7 +25,7 @@ module GHC.Core.TyCon( mkRequiredTyConBinder, mkAnonTyConBinder, mkAnonTyConBinders, tyConBinderForAllTyFlag, tyConBndrVisForAllTyFlag, isNamedTyConBinder, - isVisibleTyConBinder, isInvisibleTyConBinder, + isVisibleTyConBinder, isInvisSpecTyConBinder, isInvisibleTyConBinder, isVisibleTcbVis, isInvisSpecTcbVis, -- ** Field labels @@ -514,6 +514,10 @@ isInvisSpecTcbVis :: TyConBndrVis -> Bool isInvisSpecTcbVis (NamedTCB Specified) = True isInvisSpecTcbVis _ = False +isInvisSpecTyConBinder :: VarBndr tv TyConBndrVis -> Bool +-- Works for IfaceTyConBinder too +isInvisSpecTyConBinder (Bndr _ tcb_vis) = isInvisSpecTcbVis tcb_vis + isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool -- Works for IfaceTyConBinder too isInvisibleTyConBinder tcb = not (isVisibleTyConBinder tcb) ===================================== compiler/GHC/Iface/Syntax.hs ===================================== @@ -1033,15 +1033,14 @@ pprIfaceDecl ss (IfaceClass { ifName = clas pprIfaceDecl ss (IfaceSynonym { ifName = tc , ifBinders = binders - , ifSynRhs = mono_ty + , ifSynRhs = poly_ty , ifResKind = res_kind}) = vcat [ pprStandaloneKindSig name_doc (mkIfaceTyConKind binders res_kind) - , hang (text "type" <+> pprIfaceDeclHead suppress_bndr_sig [] ss tc binders <+> equals) - 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau - , ppUnless (isIfaceLiftedTypeKind res_kind) (dcolon <+> ppr res_kind) ]) + , hang (text "type" <+> pprIfaceDeclHeadInvis suppress_bndr_sig [] ss tc binders tau <+> equals) + 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau ]) ] where - (tvs, theta, tau) = splitIfaceSigmaTy mono_ty + (tvs, theta, tau) = splitIfaceSigmaTy poly_ty name_doc = pprPrefixIfDeclBndr (ss_how_much ss) (occName tc) -- See Note [Printing type abbreviations] in GHC.Iface.Type @@ -1232,6 +1231,18 @@ pprIfaceDeclHead suppress_sig context ss tc_occ bndrs <+> pprIfaceTyConBinders suppress_sig (suppressIfaceInvisibles (PrintExplicitKinds print_kinds) bndrs bndrs) ] +pprIfaceDeclHeadInvis :: SuppressBndrSig + -> IfaceContext -> ShowSub -> Name + -> [IfaceTyConBinder] -- of the tycon, for invisible-suppression + -> IfaceType -- RHS + -> SDoc +pprIfaceDeclHeadInvis suppress_sig context ss tc_occ bndrs rhs + = sdocOption sdocPrintExplicitKinds $ \print_kinds -> + sep [ pprIfaceContextArr context + , pprPrefixIfDeclBndr (ss_how_much ss) (occName tc_occ) + <+> pprIfaceTyConBinders suppress_sig + (suppressIfaceInsignificantInvisibles (PrintExplicitKinds print_kinds) rhs bndrs) ] + pprIfaceConDecl :: ShowSub -> Bool -> IfaceTopBndr -> [IfaceTyConBinder] ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -54,7 +54,7 @@ module GHC.Iface.Type ( pprIfaceCoTcApp, pprTyTcApp, pprIfacePrefixApp, isIfaceRhoType, - suppressIfaceInvisibles, + suppressIfaceInvisibles, suppressIfaceInsignificantInvisibles, stripIfaceInvisVars, stripInvisArgs, @@ -521,6 +521,26 @@ suppressIfaceInvisibles (PrintExplicitKinds False) tys xs = suppress tys xs | isInvisibleTyConBinder k = suppress ks xs | otherwise = x : suppress ks xs +-- Invisible binder is considered significant when it meet at least +-- one of two following criteria: +-- - It visibly occurs in the RHS type +-- - It is not followed by a visible binder, so it +-- affects arity of type synonym +suppressIfaceInsignificantInvisibles :: PrintExplicitKinds -> IfaceType -> [IfaceTyConBinder] -> [IfaceTyConBinder] +suppressIfaceInsignificantInvisibles (PrintExplicitKinds True) _rhs tys = tys +suppressIfaceInsignificantInvisibles (PrintExplicitKinds False) rhs tys = suppress [] tys + where + mentioned_var var = ifTyConBinderName var `ifTypeVarVisiblyOccurs` rhs + + mentioned_vars vars = + filter mentioned_var vars + + suppress acc [] = reverse acc + suppress acc (k:ks) = case binderFlag k of + NamedTCB Specified -> suppress (k : acc) ks + NamedTCB Inferred -> suppress acc ks + _ -> reverse (mentioned_vars acc) ++ k : suppress [] ks + stripIfaceInvisVars :: PrintExplicitKinds -> [IfaceTyConBinder] -> [IfaceTyConBinder] stripIfaceInvisVars (PrintExplicitKinds True) tyvars = tyvars stripIfaceInvisVars (PrintExplicitKinds False) tyvars @@ -561,6 +581,27 @@ ifTypeIsVarFree ty = go ty go_args IA_Nil = True go_args (IA_Arg arg _ args) = go arg && go_args args +ifTypeVarVisiblyOccurs :: IfLclName -> IfaceType -> Bool +-- Returns True if the type contains this name. Doesn't count +-- invisible application +-- Just used to control pretty printing +ifTypeVarVisiblyOccurs name ty = go ty + where + go (IfaceTyVar var) = var == name + go (IfaceFreeTyVar {}) = False + go (IfaceAppTy fun args) = go fun || go_args args + go (IfaceFunTy _ w arg res) = go w || go arg || go res + go (IfaceForAllTy bndr ty) = go (ifaceBndrType (binderVar bndr)) || go ty + go (IfaceTyConApp _ args) = go_args args + go (IfaceTupleTy _ _ args) = go_args args + go (IfaceLitTy _) = False + go (IfaceCastTy {}) = False -- Safe + go (IfaceCoercionTy {}) = False -- Safe + + go_args IA_Nil = False + go_args (IA_Arg arg Required args) = go arg || go_args args + go_args (IA_Arg _arg _ args) = go_args args + {- Note [Substitution on IfaceType] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Substitutions on IfaceType are done only during pretty-printing to ===================================== testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout ===================================== @@ -1,11 +1,11 @@ -Preprocessing library 'impl' for bkpcabal08-0.1.0.0... -Building library 'impl' for bkpcabal08-0.1.0.0... Preprocessing library 'p' for bkpcabal08-0.1.0.0... Building library 'p' instantiated with A = B = for bkpcabal08-0.1.0.0... [2 of 2] Compiling B[sig] ( p/B.hsig, nothing ) +Preprocessing library 'impl' for bkpcabal08-0.1.0.0... +Building library 'impl' for bkpcabal08-0.1.0.0... Preprocessing library 'q' for bkpcabal08-0.1.0.0... Building library 'q' instantiated with A = @@ -13,13 +13,13 @@ Building library 'q' instantiated with for bkpcabal08-0.1.0.0... [2 of 4] Compiling B[sig] ( q/B.hsig, nothing ) [3 of 4] Compiling M ( q/M.hs, nothing ) [A changed] -[4 of 4] Instantiating bkpcabal08-0.1.0.0-5O1mUtZZLBeDZEqqtwJcCj-p +[4 of 4] Instantiating bkpcabal08-0.1.0.0-CoQJNXLfoYQ4TyvApzFHv-p Preprocessing library 'q' for bkpcabal08-0.1.0.0... Building library 'q' instantiated with - A = bkpcabal08-0.1.0.0-DlVb5PcmUolGCHYbfTL7EP-impl:A - B = bkpcabal08-0.1.0.0-DlVb5PcmUolGCHYbfTL7EP-impl:B + A = bkpcabal08-0.1.0.0-5HJrxUERN7CD204UZeT4Ws-impl:A + B = bkpcabal08-0.1.0.0-5HJrxUERN7CD204UZeT4Ws-impl:B for bkpcabal08-0.1.0.0... -[1 of 3] Compiling A[sig] ( q/A.hsig, dist/build/bkpcabal08-0.1.0.0-LFiTKyjPqyn9yyuysCoVKg-q+5IA1jA4bEzCFcXtraqAC38/A.o ) [Prelude package changed] -[2 of 3] Compiling B[sig] ( q/B.hsig, dist/build/bkpcabal08-0.1.0.0-LFiTKyjPqyn9yyuysCoVKg-q+5IA1jA4bEzCFcXtraqAC38/B.o ) [Prelude package changed] +[1 of 3] Compiling A[sig] ( q/A.hsig, dist/build/bkpcabal08-0.1.0.0-1DQJ9DKc4h59P07qcb0kBc-q+J5mAfRWG9IgLmFQVftCb8t/A.o ) [Prelude package changed] +[2 of 3] Compiling B[sig] ( q/B.hsig, dist/build/bkpcabal08-0.1.0.0-1DQJ9DKc4h59P07qcb0kBc-q+J5mAfRWG9IgLmFQVftCb8t/B.o ) [Prelude package changed] Preprocessing library 'r' for bkpcabal08-0.1.0.0... Building library 'r' for bkpcabal08-0.1.0.0... ===================================== testsuite/tests/backpack/should_fail/T19244a.stderr ===================================== @@ -17,7 +17,7 @@ T19244a.bkp:22:9: error: [GHC-15843] • Type constructor ‘Key’ has conflicting definitions in the module and its hsig file. Main module: type Key :: * -> Constraint - type Key = GHC.Classes.Ord :: * -> Constraint + type Key = GHC.Classes.Ord Hsig file: type Key :: forall {k}. k -> Constraint class Key k1 The types have different kinds. ===================================== testsuite/tests/backpack/should_fail/T19244b.stderr ===================================== @@ -1,20 +1,20 @@ [1 of 3] Processing user - [1 of 2] Compiling Map[sig] ( user\Map.hsig, nothing ) - [2 of 2] Compiling User ( user\User.hs, nothing ) + [1 of 2] Compiling Map[sig] ( user/Map.hsig, nothing ) + [2 of 2] Compiling User ( user/User.hs, nothing ) [2 of 3] Processing ordmap Instantiating ordmap - [1 of 1] Compiling Map ( ordmap\Map.hs, T19244b.out\ordmap\Map.o ) + [1 of 1] Compiling Map ( ordmap/Map.hs, T19244b.out/ordmap/Map.o ) [3 of 3] Processing main Instantiating main [1 of 1] Including user[Map=ordmap:Map] Instantiating user[Map=ordmap:Map] - [1 of 2] Compiling Map[sig] ( user\Map.hsig, T19244b.out\user\user-GzloW2NeDdA2M0V8qzN4g2\Map.o ) + [1 of 2] Compiling Map[sig] ( user/Map.hsig, T19244b.out/user/user-GzloW2NeDdA2M0V8qzN4g2/Map.o ) T19244b.bkp:11:27: error: [GHC-15843] • Type constructor ‘Key’ has conflicting definitions in the module and its hsig file. Main module: type Key :: * -> Constraint - type Key = GHC.Classes.Ord :: * -> Constraint + type Key = GHC.Classes.Ord Hsig file: type Key :: forall {k}. k -> Constraint class Key k1 The types have different kinds. ===================================== testsuite/tests/backpack/should_fail/bkpfail46.stderr ===================================== @@ -1,20 +1,20 @@ [1 of 3] Processing p - [1 of 2] Compiling A[sig] ( p\A.hsig, nothing ) - [2 of 2] Compiling M ( p\M.hs, nothing ) + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling M ( p/M.hs, nothing ) [2 of 3] Processing q Instantiating q - [1 of 1] Compiling A ( q\A.hs, bkpfail46.out\q\A.o ) + [1 of 1] Compiling A ( q/A.hs, bkpfail46.out/q/A.o ) [3 of 3] Processing r Instantiating r [1 of 1] Including p[A=q:A] Instantiating p[A=q:A] - [1 of 2] Compiling A[sig] ( p\A.hsig, bkpfail46.out\p\p-HVmFlcYSefiK5n1aDP1v7x\A.o ) + [1 of 2] Compiling A[sig] ( p/A.hsig, bkpfail46.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o ) bkpfail46.bkp:16:9: error: [GHC-15843] • Type constructor ‘K’ has conflicting definitions in the module and its hsig file. Main module: type K :: * -> Constraint - type K a = GHC.Classes.Eq a :: Constraint + type K a = GHC.Classes.Eq a Hsig file: type K :: * -> Constraint class K a Illegal parameterized type synonym in implementation of abstract data. ===================================== testsuite/tests/ghci/T18060/T18060.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout ===================================== @@ -74,13 +74,13 @@ data Tuple2# a b = (#,#) a b (# , #) :: a -> b -> Tuple2# a b (Int, Int) :: Tuple2 (*) (*) type T :: Tuple2 (*) (*) -type T = (Int, Int) :: Tuple2 (*) (*) +type T = (Int, Int) -- Defined at :18:1 type S :: Solo (*) -type S = MkSolo Int :: Solo (*) +type S = MkSolo Int -- Defined at :19:1 type L :: List (*) -type L = [Int] :: List (*) +type L = [Int] -- Defined at :20:1 f :: Int -> Tuple2 Int Int -> Int (\ (_, _) -> ()) :: Tuple2 a b -> Unit ===================================== testsuite/tests/ghci/scripts/T15941.stdout ===================================== @@ -1,4 +1,3 @@ type T :: * -> * -> * -type T = - (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} :: * -> * -> * +type T = (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} -- Defined at :2:1 ===================================== testsuite/tests/ghci/scripts/T19310.stdout ===================================== @@ -1,3 +1,3 @@ type T :: * -> * -> * -type T = (->) @{LiftedRep} @{LiftedRep} :: * -> * -> * +type T = (->) @{LiftedRep} @{LiftedRep} -- Defined at :3:1 ===================================== testsuite/tests/ghci/scripts/T21294a.stdout ===================================== @@ -1,5 +1,5 @@ type L0 :: * -> * -type L0 = [] :: * -> * +type L0 = [] -- Defined at :1:1 type L1 :: * -> * type L1 a = [a] ===================================== testsuite/tests/ghci/scripts/T24459.script ===================================== @@ -0,0 +1,36 @@ +:set -XTypeAbstractions + +:{ +import Data.Kind +import Data.Data + + +type T6 :: forall k. Type -> Type +type T6 _a = () + +type T5 :: forall a. Type -> Type +type T5 @a _b = Proxy _b + +type T4 :: forall a. Type -> Type +type T4 @a _b = Proxy a + +type T3 :: forall k. k -> Type +type T3 a = Proxy a + +type T2 :: forall k. k -> Type +type T2 @k = Proxy + +type T1 :: forall k. k -> Type +type T1 = Proxy + +type T0 :: forall k. k -> Type +type T0 = Proxy :: forall k. k -> Type +:} + +:i T0 +:i T1 +:i T2 +:i T3 +:i T4 +:i T5 +:i T6 ===================================== testsuite/tests/ghci/scripts/T24459.stdout ===================================== @@ -0,0 +1,21 @@ +type T0 :: forall k. k -> * +type T0 = Proxy + -- Defined at :27:1 +type T1 :: forall k. k -> * +type T1 = Proxy + -- Defined at :24:1 +type T2 :: forall k. k -> * +type T2 @k = Proxy + -- Defined at :21:1 +type T3 :: forall k. k -> * +type T3 a = Proxy a + -- Defined at :18:1 +type T4 :: forall {k} (a :: k). * -> * +type T4 @a _b = Proxy a + -- Defined at :15:1 +type T5 :: forall {k} (a :: k). * -> * +type T5 _b = Proxy _b + -- Defined at :12:1 +type T6 :: forall {k} (k1 :: k). * -> * +type T6 _a = () + -- Defined at :9:1 ===================================== testsuite/tests/ghci/scripts/T8535.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/scripts/T9181.stdout ===================================== @@ -13,12 +13,10 @@ type (GHC.Internal.Data.Type.Ord.<=) x y = GHC.Internal.TypeError.Assert (x GHC.Internal.Data.Type.Ord.<=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) - :: Constraint type (GHC.Internal.Data.Type.Ord.<=?) :: forall k. k -> k -> Bool type (GHC.Internal.Data.Type.Ord.<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) True True False - :: Bool type GHC.Internal.TypeLits.AppendSymbol :: GHC.Types.Symbol -> GHC.Types.Symbol -> GHC.Types.Symbol type family GHC.Internal.TypeLits.AppendSymbol a b ===================================== testsuite/tests/ghci/scripts/all.T ===================================== @@ -384,3 +384,4 @@ test('T23686', normal, ghci_script, ['T23686.script']) test('T13869', extra_files(['T13869a.hs', 'T13869b.hs']), ghci_script, ['T13869.script']) test('ListTuplePunsPpr', normal, ghci_script, ['ListTuplePunsPpr.script']) test('ListTuplePunsPprNoAbbrevTuple', [expect_broken(23135), limit_stdout_lines(13)], ghci_script, ['ListTuplePunsPprNoAbbrevTuple.script']) +test('T24459', normal, ghci_script, ['T24459.script']) ===================================== testsuite/tests/ghci/scripts/ghci020.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/should_run/T10145.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/should_run/T18594.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1760,27 +1760,27 @@ module Data.Type.Equality where module Data.Type.Ord where -- Safety: Safe type (<) :: forall {t}. t -> t -> Constraint - type (<) x y = GHC.Internal.TypeError.Assert (x t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type ( k -> GHC.Types.Bool - type () :: forall {t}. t -> t -> Constraint - type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) :: Constraint + type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) type (>=) :: forall {t}. t -> t -> Constraint - type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) :: Constraint + type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) type (>=?) :: forall k. k -> k -> GHC.Types.Bool - type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True :: GHC.Types.Bool + type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True type (>?) :: forall k. k -> k -> GHC.Types.Bool - type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True :: GHC.Types.Bool + type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True type Compare :: forall k. k -> k -> GHC.Types.Ordering type family Compare a b type Max :: forall k. k -> k -> k - type Max m n = OrdCond (Compare m n) n n m :: k + type Max m n = OrdCond (Compare m n) n n m type Min :: forall k. k -> k -> k - type Min m n = OrdCond (Compare m n) m m n :: k + type Min m n = OrdCond (Compare m n) m m n type OrdCond :: forall k. GHC.Types.Ordering -> k -> k -> k -> k type family OrdCond o lt eq gt where forall k (lt :: k) (eq :: k) (gt :: k). OrdCond GHC.Types.LT lt eq gt = lt @@ -3315,7 +3315,7 @@ module GHC.Base where type Levity :: * data Levity = Lifted | Unlifted type LiftedRep :: RuntimeRep - type LiftedRep = BoxedRep Lifted :: RuntimeRep + type LiftedRep = BoxedRep Lifted type List :: * -> * data List a = ... type role MVar# nominal representational @@ -3428,7 +3428,7 @@ module GHC.Base where type TypeLitSort :: * data TypeLitSort = TypeLitSymbol | TypeLitNat | TypeLitChar type UnliftedRep :: RuntimeRep - type UnliftedRep = BoxedRep Unlifted :: RuntimeRep + type UnliftedRep = BoxedRep Unlifted type UnliftedType :: * type UnliftedType = TYPE UnliftedRep type VecCount :: * @@ -3438,7 +3438,7 @@ module GHC.Base where type Void :: * data Void type Void# :: ZeroBitType - type Void# = (# #) :: ZeroBitType + type Void# = (# #) type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType data Weak# a type WithDict :: Constraint -> * -> Constraint @@ -3484,7 +3484,7 @@ module GHC.Base where type WordBox :: TYPE WordRep -> * data WordBox a = MkWordBox a type ZeroBitRep :: RuntimeRep - type ZeroBitRep = TupleRep '[] :: RuntimeRep + type ZeroBitRep = TupleRep '[] type ZeroBitType :: * type ZeroBitType = TYPE ZeroBitRep absentErr :: forall a. a @@ -5513,7 +5513,7 @@ module GHC.Exts where type Levity :: * data Levity = Lifted | Unlifted type LiftedRep :: RuntimeRep - type LiftedRep = BoxedRep Lifted :: RuntimeRep + type LiftedRep = BoxedRep Lifted type List :: * -> * data List a = ... type role MVar# nominal representational @@ -5588,7 +5588,7 @@ module GHC.Exts where TypeLitNat :: GHC.Types.TypeLitSort TypeLitSymbol :: GHC.Types.TypeLitSort type UnliftedRep :: RuntimeRep - type UnliftedRep = BoxedRep Unlifted :: RuntimeRep + type UnliftedRep = BoxedRep Unlifted type UnliftedType :: * type UnliftedType = TYPE UnliftedRep type VecCount :: * @@ -5596,7 +5596,7 @@ module GHC.Exts where type VecElem :: * data VecElem = Int8ElemRep | Int16ElemRep | Int32ElemRep | Int64ElemRep | Word8ElemRep | Word16ElemRep | Word32ElemRep | Word64ElemRep | FloatElemRep | DoubleElemRep type Void# :: ZeroBitType - type Void# = (# #) :: ZeroBitType + type Void# = (# #) type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType data Weak# a type WithDict :: Constraint -> * -> Constraint @@ -5642,7 +5642,7 @@ module GHC.Exts where type WordBox :: TYPE WordRep -> * data WordBox a = MkWordBox a type ZeroBitRep :: RuntimeRep - type ZeroBitRep = TupleRep '[] :: RuntimeRep + type ZeroBitRep = TupleRep '[] type ZeroBitType :: * type ZeroBitType = TYPE ZeroBitRep acosDouble# :: Double# -> Double# @@ -7377,7 +7377,7 @@ module GHC.Generics where type C :: * data C type C1 :: forall {k}. Meta -> (k -> *) -> k -> * - type C1 = M1 C :: Meta -> (k -> *) -> k -> * + type C1 = M1 C type Constructor :: forall {k}. k -> Constraint class Constructor c where conName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t c f a -> [GHC.Types.Char] @@ -7387,7 +7387,7 @@ module GHC.Generics where type D :: * data D type D1 :: forall {k}. Meta -> (k -> *) -> k -> * - type D1 = M1 D :: Meta -> (k -> *) -> k -> * + type D1 = M1 D type Datatype :: forall {k}. k -> Constraint class Datatype d where datatypeName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t d f a -> [GHC.Types.Char] @@ -7434,14 +7434,14 @@ module GHC.Generics where type R :: * data R type Rec0 :: forall {k}. * -> k -> * - type Rec0 = K1 R :: * -> k -> * + type Rec0 = K1 R type role Rec1 representational nominal type Rec1 :: forall k. (k -> *) -> k -> * newtype Rec1 f p = Rec1 {unRec1 :: f p} type S :: * data S type S1 :: forall {k}. Meta -> (k -> *) -> k -> * - type S1 = M1 S :: Meta -> (k -> *) -> k -> * + type S1 = M1 S type Selector :: forall {k}. k -> Constraint class Selector s where selName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t s f a -> [GHC.Types.Char] @@ -7458,24 +7458,24 @@ module GHC.Generics where data U1 p = U1 UAddr :: forall k (p :: k). GHC.Prim.Addr# -> URec (GHC.Internal.Ptr.Ptr ()) p type UAddr :: forall {k}. k -> * - type UAddr = URec (GHC.Internal.Ptr.Ptr ()) :: k -> * + type UAddr = URec (GHC.Internal.Ptr.Ptr ()) UChar :: forall k (p :: k). GHC.Prim.Char# -> URec GHC.Types.Char p type UChar :: forall {k}. k -> * - type UChar = URec GHC.Types.Char :: k -> * + type UChar = URec GHC.Types.Char UDouble :: forall k (p :: k). GHC.Prim.Double# -> URec GHC.Types.Double p type UDouble :: forall {k}. k -> * - type UDouble = URec GHC.Types.Double :: k -> * + type UDouble = URec GHC.Types.Double UFloat :: forall k (p :: k). GHC.Prim.Float# -> URec GHC.Types.Float p type UFloat :: forall {k}. k -> * - type UFloat = URec GHC.Types.Float :: k -> * + type UFloat = URec GHC.Types.Float UInt :: forall k (p :: k). GHC.Prim.Int# -> URec GHC.Types.Int p type UInt :: forall {k}. k -> * - type UInt = URec GHC.Types.Int :: k -> * + type UInt = URec GHC.Types.Int type URec :: forall k. * -> k -> * data family URec a p UWord :: forall k (p :: k). GHC.Prim.Word# -> URec GHC.Types.Word p type UWord :: forall {k}. k -> * - type UWord = URec GHC.Types.Word :: k -> * + type UWord = URec GHC.Types.Word type role V1 phantom type V1 :: forall k. k -> * data V1 p @@ -8563,7 +8563,7 @@ module GHC.Num.BigNat where type BigNat :: * data BigNat = BN# {unBigNat :: BigNat#} type BigNat# :: GHC.Types.UnliftedType - type BigNat# = GHC.Num.WordArray.WordArray# :: GHC.Types.UnliftedType + type BigNat# = GHC.Num.WordArray.WordArray# bigNatAdd :: BigNat# -> BigNat# -> BigNat# bigNatAddWord :: BigNat# -> GHC.Types.Word -> BigNat# bigNatAddWord# :: BigNat# -> GHC.Prim.Word# -> BigNat# @@ -9345,7 +9345,7 @@ module GHC.Stack where type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint - type HasCallStack = ?callStack::CallStack :: Constraint + type HasCallStack = ?callStack::CallStack type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack @@ -9406,7 +9406,7 @@ module GHC.Stack.Types where type CallStack :: * data CallStack = EmptyCallStack | PushCallStack [GHC.Types.Char] SrcLoc CallStack | FreezeCallStack CallStack type HasCallStack :: Constraint - type HasCallStack = ?callStack::CallStack :: Constraint + type HasCallStack = ?callStack::CallStack type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} emptyCallStack :: CallStack @@ -9561,9 +9561,9 @@ module GHC.TypeLits where type (-) :: Natural -> Natural -> Natural type family (-) a b type (<=) :: forall {t}. t -> t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type AppendSymbol :: Symbol -> Symbol -> Symbol type family AppendSymbol a b type CharToNat :: GHC.Types.Char -> Natural @@ -9680,9 +9680,9 @@ module GHC.TypeNats where type (-) :: Natural -> Natural -> Natural type family (-) a b type (<=) :: forall {t}. t -> t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type CmpNat :: Natural -> Natural -> GHC.Types.Ordering type family CmpNat a b type Div :: Natural -> Natural -> Natural ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout ===================================== @@ -1480,9 +1480,9 @@ module Data.Tuple.Experimental where class a => CSolo a {-# MINIMAL #-} type CTuple0 :: Constraint - type CTuple0 = () :: Constraint :: Constraint + type CTuple0 = () :: Constraint type CTuple1 :: Constraint -> Constraint - type CTuple1 = CSolo :: Constraint -> Constraint + type CTuple1 = CSolo type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j {-# MINIMAL #-} @@ -2637,11 +2637,11 @@ module Data.Tuple.Experimental where type Tuple0 :: * type Tuple0 = () type Tuple0# :: GHC.Types.ZeroBitType - type Tuple0# = (# #) :: GHC.Types.ZeroBitType + type Tuple0# = (# #) type Tuple1 :: * -> * - type Tuple1 = Solo :: * -> * + type Tuple1 = Solo type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) - type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) + type Tuple1# = Solo# type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * data Tuple10 a b c d e f g h i j = ... type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9]) @@ -4328,9 +4328,9 @@ module Prelude.Experimental where class a => CSolo a {-# MINIMAL #-} type CTuple0 :: Constraint - type CTuple0 = () :: Constraint :: Constraint + type CTuple0 = () :: Constraint type CTuple1 :: Constraint -> Constraint - type CTuple1 = CSolo :: Constraint -> Constraint + type CTuple1 = CSolo type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j {-# MINIMAL #-} @@ -6959,11 +6959,11 @@ module Prelude.Experimental where type Tuple0 :: * type Tuple0 = () type Tuple0# :: GHC.Types.ZeroBitType - type Tuple0# = (# #) :: GHC.Types.ZeroBitType + type Tuple0# = (# #) type Tuple1 :: * -> * - type Tuple1 = Solo :: * -> * + type Tuple1 = Solo type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) - type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) + type Tuple1# = Solo# type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * data Tuple10 a b c d e f g h i j = ... type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9]) ===================================== testsuite/tests/rep-poly/RepPolyBackpack3.stderr ===================================== @@ -1,19 +1,19 @@ [1 of 3] Processing sig - [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, nothing ) + [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, nothing ) [2 of 3] Processing impl Instantiating impl - [1 of 1] Compiling Impl ( impl\Impl.hs, RepPolyBackpack3.out\impl\Impl.o ) + [1 of 1] Compiling Impl ( impl/Impl.hs, RepPolyBackpack3.out/impl/Impl.o ) [3 of 3] Processing main Instantiating main [1 of 1] Including sig[Sig=impl:Impl] Instantiating sig[Sig=impl:Impl] - [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, RepPolyBackpack3.out\sig\sig-Absk5cIXTXe6UYhGMYGber\Sig.o ) + [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, RepPolyBackpack3.out/sig/sig-Absk5cIXTXe6UYhGMYGber/Sig.o ) RepPolyBackpack3.bkp:17:5: error: [GHC-15843] • Type constructor ‘Rep’ has conflicting definitions in the module and its hsig file. Main module: type Rep :: GHC.Types.RuntimeRep - type Rep = T :: GHC.Types.RuntimeRep + type Rep = T Hsig file: type Rep :: GHC.Types.RuntimeRep data Rep Illegal implementation of abstract data: Invalid type family ‘T’. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1fc7d5a7a281fffcdc83600eefe705f050b5b273 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1fc7d5a7a281fffcdc83600eefe705f050b5b273 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 07:29:25 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Tue, 12 Mar 2024 03:29:25 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/tysyn-info-ppr] Update GHCi :info type synonym printing (24459) Message-ID: <65f0045593890_25db4e8996d1483312@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/tysyn-info-ppr at Glasgow Haskell Compiler / GHC Commits: 6227a9ce by Andrei Borzenkov at 2024-03-12T11:29:03+04:00 Update GHCi :info type synonym printing (24459) - Do not print result's kind since we have full kind in SAKS and we display invisible arity using @-binders - Do not suppress significant invisible binders Invisible binder is considered significant when it meets at least one of two following criteria: - It visibly occurs in the RHS type - It is not followed by a visible binder, so it affects arity of type synonym - - - - - 23 changed files: - compiler/GHC/Core/TyCon.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs - testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout - testsuite/tests/backpack/should_fail/T19244a.stderr - testsuite/tests/backpack/should_fail/T19244b.stderr - testsuite/tests/backpack/should_fail/bkpfail46.stderr - testsuite/tests/ghci/T18060/T18060.stdout - testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout - testsuite/tests/ghci/scripts/T15941.stdout - testsuite/tests/ghci/scripts/T19310.stdout - testsuite/tests/ghci/scripts/T21294a.stdout - + testsuite/tests/ghci/scripts/T24459.script - + testsuite/tests/ghci/scripts/T24459.stdout - testsuite/tests/ghci/scripts/T8535.stdout - testsuite/tests/ghci/scripts/T9181.stdout - testsuite/tests/ghci/scripts/all.T - testsuite/tests/ghci/scripts/ghci020.stdout - testsuite/tests/ghci/should_run/T10145.stdout - testsuite/tests/ghci/should_run/T18594.stdout - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/rep-poly/RepPolyBackpack3.stderr Changes: ===================================== compiler/GHC/Core/TyCon.hs ===================================== @@ -25,7 +25,7 @@ module GHC.Core.TyCon( mkRequiredTyConBinder, mkAnonTyConBinder, mkAnonTyConBinders, tyConBinderForAllTyFlag, tyConBndrVisForAllTyFlag, isNamedTyConBinder, - isVisibleTyConBinder, isInvisibleTyConBinder, + isVisibleTyConBinder, isInvisSpecTyConBinder, isInvisibleTyConBinder, isVisibleTcbVis, isInvisSpecTcbVis, -- ** Field labels @@ -514,6 +514,10 @@ isInvisSpecTcbVis :: TyConBndrVis -> Bool isInvisSpecTcbVis (NamedTCB Specified) = True isInvisSpecTcbVis _ = False +isInvisSpecTyConBinder :: VarBndr tv TyConBndrVis -> Bool +-- Works for IfaceTyConBinder too +isInvisSpecTyConBinder (Bndr _ tcb_vis) = isInvisSpecTcbVis tcb_vis + isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool -- Works for IfaceTyConBinder too isInvisibleTyConBinder tcb = not (isVisibleTyConBinder tcb) ===================================== compiler/GHC/Iface/Syntax.hs ===================================== @@ -1033,15 +1033,14 @@ pprIfaceDecl ss (IfaceClass { ifName = clas pprIfaceDecl ss (IfaceSynonym { ifName = tc , ifBinders = binders - , ifSynRhs = mono_ty + , ifSynRhs = poly_ty , ifResKind = res_kind}) = vcat [ pprStandaloneKindSig name_doc (mkIfaceTyConKind binders res_kind) - , hang (text "type" <+> pprIfaceDeclHead suppress_bndr_sig [] ss tc binders <+> equals) - 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau - , ppUnless (isIfaceLiftedTypeKind res_kind) (dcolon <+> ppr res_kind) ]) + , hang (text "type" <+> pprIfaceDeclHeadInvis suppress_bndr_sig [] ss tc binders tau <+> equals) + 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau ]) ] where - (tvs, theta, tau) = splitIfaceSigmaTy mono_ty + (tvs, theta, tau) = splitIfaceSigmaTy poly_ty name_doc = pprPrefixIfDeclBndr (ss_how_much ss) (occName tc) -- See Note [Printing type abbreviations] in GHC.Iface.Type @@ -1232,6 +1231,18 @@ pprIfaceDeclHead suppress_sig context ss tc_occ bndrs <+> pprIfaceTyConBinders suppress_sig (suppressIfaceInvisibles (PrintExplicitKinds print_kinds) bndrs bndrs) ] +pprIfaceDeclHeadInvis :: SuppressBndrSig + -> IfaceContext -> ShowSub -> Name + -> [IfaceTyConBinder] -- of the tycon, for invisible-suppression + -> IfaceType -- RHS + -> SDoc +pprIfaceDeclHeadInvis suppress_sig context ss tc_occ bndrs rhs + = sdocOption sdocPrintExplicitKinds $ \print_kinds -> + sep [ pprIfaceContextArr context + , pprPrefixIfDeclBndr (ss_how_much ss) (occName tc_occ) + <+> pprIfaceTyConBinders suppress_sig + (suppressIfaceInsignificantInvisibles (PrintExplicitKinds print_kinds) rhs bndrs) ] + pprIfaceConDecl :: ShowSub -> Bool -> IfaceTopBndr -> [IfaceTyConBinder] ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -54,7 +54,7 @@ module GHC.Iface.Type ( pprIfaceCoTcApp, pprTyTcApp, pprIfacePrefixApp, isIfaceRhoType, - suppressIfaceInvisibles, + suppressIfaceInvisibles, suppressIfaceInsignificantInvisibles, stripIfaceInvisVars, stripInvisArgs, @@ -521,6 +521,26 @@ suppressIfaceInvisibles (PrintExplicitKinds False) tys xs = suppress tys xs | isInvisibleTyConBinder k = suppress ks xs | otherwise = x : suppress ks xs +-- Invisible binder is considered significant when it meet at least +-- one of two following criteria: +-- - It visibly occurs in the RHS type +-- - It is not followed by a visible binder, so it +-- affects arity of type synonym +suppressIfaceInsignificantInvisibles :: PrintExplicitKinds -> IfaceType -> [IfaceTyConBinder] -> [IfaceTyConBinder] +suppressIfaceInsignificantInvisibles (PrintExplicitKinds True) _rhs tys = tys +suppressIfaceInsignificantInvisibles (PrintExplicitKinds False) rhs tys = suppress [] tys + where + mentioned_var var = ifTyConBinderName var `ifTypeVarVisiblyOccurs` rhs + + mentioned_vars vars = + filter mentioned_var vars + + suppress acc [] = reverse acc + suppress acc (k:ks) = case binderFlag k of + NamedTCB Specified -> suppress (k : acc) ks + NamedTCB Inferred -> suppress acc ks + _ -> reverse (mentioned_vars acc) ++ k : suppress [] ks + stripIfaceInvisVars :: PrintExplicitKinds -> [IfaceTyConBinder] -> [IfaceTyConBinder] stripIfaceInvisVars (PrintExplicitKinds True) tyvars = tyvars stripIfaceInvisVars (PrintExplicitKinds False) tyvars @@ -561,6 +581,27 @@ ifTypeIsVarFree ty = go ty go_args IA_Nil = True go_args (IA_Arg arg _ args) = go arg && go_args args +ifTypeVarVisiblyOccurs :: IfLclName -> IfaceType -> Bool +-- Returns True if the type contains this name. Doesn't count +-- invisible application +-- Just used to control pretty printing +ifTypeVarVisiblyOccurs name ty = go ty + where + go (IfaceTyVar var) = var == name + go (IfaceFreeTyVar {}) = False + go (IfaceAppTy fun args) = go fun || go_args args + go (IfaceFunTy _ w arg res) = go w || go arg || go res + go (IfaceForAllTy bndr ty) = go (ifaceBndrType (binderVar bndr)) || go ty + go (IfaceTyConApp _ args) = go_args args + go (IfaceTupleTy _ _ args) = go_args args + go (IfaceLitTy _) = False + go (IfaceCastTy {}) = False -- Safe + go (IfaceCoercionTy {}) = False -- Safe + + go_args IA_Nil = False + go_args (IA_Arg arg Required args) = go arg || go_args args + go_args (IA_Arg _arg _ args) = go_args args + {- Note [Substitution on IfaceType] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Substitutions on IfaceType are done only during pretty-printing to ===================================== testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout ===================================== @@ -1,11 +1,11 @@ -Preprocessing library 'impl' for bkpcabal08-0.1.0.0... -Building library 'impl' for bkpcabal08-0.1.0.0... Preprocessing library 'p' for bkpcabal08-0.1.0.0... Building library 'p' instantiated with A = B = for bkpcabal08-0.1.0.0... [2 of 2] Compiling B[sig] ( p/B.hsig, nothing ) +Preprocessing library 'impl' for bkpcabal08-0.1.0.0... +Building library 'impl' for bkpcabal08-0.1.0.0... Preprocessing library 'q' for bkpcabal08-0.1.0.0... Building library 'q' instantiated with A = @@ -13,13 +13,13 @@ Building library 'q' instantiated with for bkpcabal08-0.1.0.0... [2 of 4] Compiling B[sig] ( q/B.hsig, nothing ) [3 of 4] Compiling M ( q/M.hs, nothing ) [A changed] -[4 of 4] Instantiating bkpcabal08-0.1.0.0-5O1mUtZZLBeDZEqqtwJcCj-p +[4 of 4] Instantiating bkpcabal08-0.1.0.0-CoQJNXLfoYQ4TyvApzFHv-p Preprocessing library 'q' for bkpcabal08-0.1.0.0... Building library 'q' instantiated with - A = bkpcabal08-0.1.0.0-DlVb5PcmUolGCHYbfTL7EP-impl:A - B = bkpcabal08-0.1.0.0-DlVb5PcmUolGCHYbfTL7EP-impl:B + A = bkpcabal08-0.1.0.0-5HJrxUERN7CD204UZeT4Ws-impl:A + B = bkpcabal08-0.1.0.0-5HJrxUERN7CD204UZeT4Ws-impl:B for bkpcabal08-0.1.0.0... -[1 of 3] Compiling A[sig] ( q/A.hsig, dist/build/bkpcabal08-0.1.0.0-LFiTKyjPqyn9yyuysCoVKg-q+5IA1jA4bEzCFcXtraqAC38/A.o ) [Prelude package changed] -[2 of 3] Compiling B[sig] ( q/B.hsig, dist/build/bkpcabal08-0.1.0.0-LFiTKyjPqyn9yyuysCoVKg-q+5IA1jA4bEzCFcXtraqAC38/B.o ) [Prelude package changed] +[1 of 3] Compiling A[sig] ( q/A.hsig, dist/build/bkpcabal08-0.1.0.0-1DQJ9DKc4h59P07qcb0kBc-q+J5mAfRWG9IgLmFQVftCb8t/A.o ) [Prelude package changed] +[2 of 3] Compiling B[sig] ( q/B.hsig, dist/build/bkpcabal08-0.1.0.0-1DQJ9DKc4h59P07qcb0kBc-q+J5mAfRWG9IgLmFQVftCb8t/B.o ) [Prelude package changed] Preprocessing library 'r' for bkpcabal08-0.1.0.0... Building library 'r' for bkpcabal08-0.1.0.0... ===================================== testsuite/tests/backpack/should_fail/T19244a.stderr ===================================== @@ -17,7 +17,7 @@ T19244a.bkp:22:9: error: [GHC-15843] • Type constructor ‘Key’ has conflicting definitions in the module and its hsig file. Main module: type Key :: * -> Constraint - type Key = GHC.Classes.Ord :: * -> Constraint + type Key = GHC.Classes.Ord Hsig file: type Key :: forall {k}. k -> Constraint class Key k1 The types have different kinds. ===================================== testsuite/tests/backpack/should_fail/T19244b.stderr ===================================== @@ -1,20 +1,20 @@ [1 of 3] Processing user - [1 of 2] Compiling Map[sig] ( user\Map.hsig, nothing ) - [2 of 2] Compiling User ( user\User.hs, nothing ) + [1 of 2] Compiling Map[sig] ( user/Map.hsig, nothing ) + [2 of 2] Compiling User ( user/User.hs, nothing ) [2 of 3] Processing ordmap Instantiating ordmap - [1 of 1] Compiling Map ( ordmap\Map.hs, T19244b.out\ordmap\Map.o ) + [1 of 1] Compiling Map ( ordmap/Map.hs, T19244b.out/ordmap/Map.o ) [3 of 3] Processing main Instantiating main [1 of 1] Including user[Map=ordmap:Map] Instantiating user[Map=ordmap:Map] - [1 of 2] Compiling Map[sig] ( user\Map.hsig, T19244b.out\user\user-GzloW2NeDdA2M0V8qzN4g2\Map.o ) + [1 of 2] Compiling Map[sig] ( user/Map.hsig, T19244b.out/user/user-GzloW2NeDdA2M0V8qzN4g2/Map.o ) T19244b.bkp:11:27: error: [GHC-15843] • Type constructor ‘Key’ has conflicting definitions in the module and its hsig file. Main module: type Key :: * -> Constraint - type Key = GHC.Classes.Ord :: * -> Constraint + type Key = GHC.Classes.Ord Hsig file: type Key :: forall {k}. k -> Constraint class Key k1 The types have different kinds. ===================================== testsuite/tests/backpack/should_fail/bkpfail46.stderr ===================================== @@ -1,20 +1,20 @@ [1 of 3] Processing p - [1 of 2] Compiling A[sig] ( p\A.hsig, nothing ) - [2 of 2] Compiling M ( p\M.hs, nothing ) + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling M ( p/M.hs, nothing ) [2 of 3] Processing q Instantiating q - [1 of 1] Compiling A ( q\A.hs, bkpfail46.out\q\A.o ) + [1 of 1] Compiling A ( q/A.hs, bkpfail46.out/q/A.o ) [3 of 3] Processing r Instantiating r [1 of 1] Including p[A=q:A] Instantiating p[A=q:A] - [1 of 2] Compiling A[sig] ( p\A.hsig, bkpfail46.out\p\p-HVmFlcYSefiK5n1aDP1v7x\A.o ) + [1 of 2] Compiling A[sig] ( p/A.hsig, bkpfail46.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o ) bkpfail46.bkp:16:9: error: [GHC-15843] • Type constructor ‘K’ has conflicting definitions in the module and its hsig file. Main module: type K :: * -> Constraint - type K a = GHC.Classes.Eq a :: Constraint + type K a = GHC.Classes.Eq a Hsig file: type K :: * -> Constraint class K a Illegal parameterized type synonym in implementation of abstract data. ===================================== testsuite/tests/ghci/T18060/T18060.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout ===================================== @@ -74,13 +74,13 @@ data Tuple2# a b = (#,#) a b (# , #) :: a -> b -> Tuple2# a b (Int, Int) :: Tuple2 (*) (*) type T :: Tuple2 (*) (*) -type T = (Int, Int) :: Tuple2 (*) (*) +type T = (Int, Int) -- Defined at :18:1 type S :: Solo (*) -type S = MkSolo Int :: Solo (*) +type S = MkSolo Int -- Defined at :19:1 type L :: List (*) -type L = [Int] :: List (*) +type L = [Int] -- Defined at :20:1 f :: Int -> Tuple2 Int Int -> Int (\ (_, _) -> ()) :: Tuple2 a b -> Unit ===================================== testsuite/tests/ghci/scripts/T15941.stdout ===================================== @@ -1,4 +1,3 @@ type T :: * -> * -> * -type T = - (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} :: * -> * -> * +type T = (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} -- Defined at :2:1 ===================================== testsuite/tests/ghci/scripts/T19310.stdout ===================================== @@ -1,3 +1,3 @@ type T :: * -> * -> * -type T = (->) @{LiftedRep} @{LiftedRep} :: * -> * -> * +type T = (->) @{LiftedRep} @{LiftedRep} -- Defined at :3:1 ===================================== testsuite/tests/ghci/scripts/T21294a.stdout ===================================== @@ -1,5 +1,5 @@ type L0 :: * -> * -type L0 = [] :: * -> * +type L0 = [] -- Defined at :1:1 type L1 :: * -> * type L1 a = [a] ===================================== testsuite/tests/ghci/scripts/T24459.script ===================================== @@ -0,0 +1,36 @@ +:set -XTypeAbstractions + +:{ +import Data.Kind +import Data.Data + + +type T6 :: forall k. Type -> Type +type T6 _a = () + +type T5 :: forall a. Type -> Type +type T5 @a _b = Proxy _b + +type T4 :: forall a. Type -> Type +type T4 @a _b = Proxy a + +type T3 :: forall k. k -> Type +type T3 a = Proxy a + +type T2 :: forall k. k -> Type +type T2 @k = Proxy + +type T1 :: forall k. k -> Type +type T1 = Proxy + +type T0 :: forall k. k -> Type +type T0 = Proxy :: forall k. k -> Type +:} + +:i T0 +:i T1 +:i T2 +:i T3 +:i T4 +:i T5 +:i T6 ===================================== testsuite/tests/ghci/scripts/T24459.stdout ===================================== @@ -0,0 +1,21 @@ +type T0 :: forall k. k -> * +type T0 = Proxy + -- Defined at :27:1 +type T1 :: forall k. k -> * +type T1 = Proxy + -- Defined at :24:1 +type T2 :: forall k. k -> * +type T2 @k = Proxy + -- Defined at :21:1 +type T3 :: forall k. k -> * +type T3 a = Proxy a + -- Defined at :18:1 +type T4 :: forall {k} (a :: k). * -> * +type T4 @a _b = Proxy a + -- Defined at :15:1 +type T5 :: forall {k} (a :: k). * -> * +type T5 _b = Proxy _b + -- Defined at :12:1 +type T6 :: forall {k} (k1 :: k). * -> * +type T6 _a = () + -- Defined at :9:1 ===================================== testsuite/tests/ghci/scripts/T8535.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/scripts/T9181.stdout ===================================== @@ -13,12 +13,10 @@ type (GHC.Internal.Data.Type.Ord.<=) x y = GHC.Internal.TypeError.Assert (x GHC.Internal.Data.Type.Ord.<=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) - :: Constraint type (GHC.Internal.Data.Type.Ord.<=?) :: forall k. k -> k -> Bool type (GHC.Internal.Data.Type.Ord.<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) True True False - :: Bool type GHC.Internal.TypeLits.AppendSymbol :: GHC.Types.Symbol -> GHC.Types.Symbol -> GHC.Types.Symbol type family GHC.Internal.TypeLits.AppendSymbol a b ===================================== testsuite/tests/ghci/scripts/all.T ===================================== @@ -384,3 +384,4 @@ test('T23686', normal, ghci_script, ['T23686.script']) test('T13869', extra_files(['T13869a.hs', 'T13869b.hs']), ghci_script, ['T13869.script']) test('ListTuplePunsPpr', normal, ghci_script, ['ListTuplePunsPpr.script']) test('ListTuplePunsPprNoAbbrevTuple', [expect_broken(23135), limit_stdout_lines(13)], ghci_script, ['ListTuplePunsPprNoAbbrevTuple.script']) +test('T24459', normal, ghci_script, ['T24459.script']) ===================================== testsuite/tests/ghci/scripts/ghci020.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/should_run/T10145.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/should_run/T18594.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1760,27 +1760,27 @@ module Data.Type.Equality where module Data.Type.Ord where -- Safety: Safe type (<) :: forall {t}. t -> t -> Constraint - type (<) x y = GHC.Internal.TypeError.Assert (x t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type ( k -> GHC.Types.Bool - type () :: forall {t}. t -> t -> Constraint - type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) :: Constraint + type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) type (>=) :: forall {t}. t -> t -> Constraint - type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) :: Constraint + type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) type (>=?) :: forall k. k -> k -> GHC.Types.Bool - type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True :: GHC.Types.Bool + type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True type (>?) :: forall k. k -> k -> GHC.Types.Bool - type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True :: GHC.Types.Bool + type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True type Compare :: forall k. k -> k -> GHC.Types.Ordering type family Compare a b type Max :: forall k. k -> k -> k - type Max m n = OrdCond (Compare m n) n n m :: k + type Max m n = OrdCond (Compare m n) n n m type Min :: forall k. k -> k -> k - type Min m n = OrdCond (Compare m n) m m n :: k + type Min m n = OrdCond (Compare m n) m m n type OrdCond :: forall k. GHC.Types.Ordering -> k -> k -> k -> k type family OrdCond o lt eq gt where forall k (lt :: k) (eq :: k) (gt :: k). OrdCond GHC.Types.LT lt eq gt = lt @@ -3315,7 +3315,7 @@ module GHC.Base where type Levity :: * data Levity = Lifted | Unlifted type LiftedRep :: RuntimeRep - type LiftedRep = BoxedRep Lifted :: RuntimeRep + type LiftedRep = BoxedRep Lifted type List :: * -> * data List a = ... type role MVar# nominal representational @@ -3428,7 +3428,7 @@ module GHC.Base where type TypeLitSort :: * data TypeLitSort = TypeLitSymbol | TypeLitNat | TypeLitChar type UnliftedRep :: RuntimeRep - type UnliftedRep = BoxedRep Unlifted :: RuntimeRep + type UnliftedRep = BoxedRep Unlifted type UnliftedType :: * type UnliftedType = TYPE UnliftedRep type VecCount :: * @@ -3438,7 +3438,7 @@ module GHC.Base where type Void :: * data Void type Void# :: ZeroBitType - type Void# = (# #) :: ZeroBitType + type Void# = (# #) type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType data Weak# a type WithDict :: Constraint -> * -> Constraint @@ -3484,7 +3484,7 @@ module GHC.Base where type WordBox :: TYPE WordRep -> * data WordBox a = MkWordBox a type ZeroBitRep :: RuntimeRep - type ZeroBitRep = TupleRep '[] :: RuntimeRep + type ZeroBitRep = TupleRep '[] type ZeroBitType :: * type ZeroBitType = TYPE ZeroBitRep absentErr :: forall a. a @@ -5513,7 +5513,7 @@ module GHC.Exts where type Levity :: * data Levity = Lifted | Unlifted type LiftedRep :: RuntimeRep - type LiftedRep = BoxedRep Lifted :: RuntimeRep + type LiftedRep = BoxedRep Lifted type List :: * -> * data List a = ... type role MVar# nominal representational @@ -5588,7 +5588,7 @@ module GHC.Exts where TypeLitNat :: GHC.Types.TypeLitSort TypeLitSymbol :: GHC.Types.TypeLitSort type UnliftedRep :: RuntimeRep - type UnliftedRep = BoxedRep Unlifted :: RuntimeRep + type UnliftedRep = BoxedRep Unlifted type UnliftedType :: * type UnliftedType = TYPE UnliftedRep type VecCount :: * @@ -5596,7 +5596,7 @@ module GHC.Exts where type VecElem :: * data VecElem = Int8ElemRep | Int16ElemRep | Int32ElemRep | Int64ElemRep | Word8ElemRep | Word16ElemRep | Word32ElemRep | Word64ElemRep | FloatElemRep | DoubleElemRep type Void# :: ZeroBitType - type Void# = (# #) :: ZeroBitType + type Void# = (# #) type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType data Weak# a type WithDict :: Constraint -> * -> Constraint @@ -5642,7 +5642,7 @@ module GHC.Exts where type WordBox :: TYPE WordRep -> * data WordBox a = MkWordBox a type ZeroBitRep :: RuntimeRep - type ZeroBitRep = TupleRep '[] :: RuntimeRep + type ZeroBitRep = TupleRep '[] type ZeroBitType :: * type ZeroBitType = TYPE ZeroBitRep acosDouble# :: Double# -> Double# @@ -7377,7 +7377,7 @@ module GHC.Generics where type C :: * data C type C1 :: forall {k}. Meta -> (k -> *) -> k -> * - type C1 = M1 C :: Meta -> (k -> *) -> k -> * + type C1 = M1 C type Constructor :: forall {k}. k -> Constraint class Constructor c where conName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t c f a -> [GHC.Types.Char] @@ -7387,7 +7387,7 @@ module GHC.Generics where type D :: * data D type D1 :: forall {k}. Meta -> (k -> *) -> k -> * - type D1 = M1 D :: Meta -> (k -> *) -> k -> * + type D1 = M1 D type Datatype :: forall {k}. k -> Constraint class Datatype d where datatypeName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t d f a -> [GHC.Types.Char] @@ -7434,14 +7434,14 @@ module GHC.Generics where type R :: * data R type Rec0 :: forall {k}. * -> k -> * - type Rec0 = K1 R :: * -> k -> * + type Rec0 = K1 R type role Rec1 representational nominal type Rec1 :: forall k. (k -> *) -> k -> * newtype Rec1 f p = Rec1 {unRec1 :: f p} type S :: * data S type S1 :: forall {k}. Meta -> (k -> *) -> k -> * - type S1 = M1 S :: Meta -> (k -> *) -> k -> * + type S1 = M1 S type Selector :: forall {k}. k -> Constraint class Selector s where selName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t s f a -> [GHC.Types.Char] @@ -7458,24 +7458,24 @@ module GHC.Generics where data U1 p = U1 UAddr :: forall k (p :: k). GHC.Prim.Addr# -> URec (GHC.Internal.Ptr.Ptr ()) p type UAddr :: forall {k}. k -> * - type UAddr = URec (GHC.Internal.Ptr.Ptr ()) :: k -> * + type UAddr = URec (GHC.Internal.Ptr.Ptr ()) UChar :: forall k (p :: k). GHC.Prim.Char# -> URec GHC.Types.Char p type UChar :: forall {k}. k -> * - type UChar = URec GHC.Types.Char :: k -> * + type UChar = URec GHC.Types.Char UDouble :: forall k (p :: k). GHC.Prim.Double# -> URec GHC.Types.Double p type UDouble :: forall {k}. k -> * - type UDouble = URec GHC.Types.Double :: k -> * + type UDouble = URec GHC.Types.Double UFloat :: forall k (p :: k). GHC.Prim.Float# -> URec GHC.Types.Float p type UFloat :: forall {k}. k -> * - type UFloat = URec GHC.Types.Float :: k -> * + type UFloat = URec GHC.Types.Float UInt :: forall k (p :: k). GHC.Prim.Int# -> URec GHC.Types.Int p type UInt :: forall {k}. k -> * - type UInt = URec GHC.Types.Int :: k -> * + type UInt = URec GHC.Types.Int type URec :: forall k. * -> k -> * data family URec a p UWord :: forall k (p :: k). GHC.Prim.Word# -> URec GHC.Types.Word p type UWord :: forall {k}. k -> * - type UWord = URec GHC.Types.Word :: k -> * + type UWord = URec GHC.Types.Word type role V1 phantom type V1 :: forall k. k -> * data V1 p @@ -8563,7 +8563,7 @@ module GHC.Num.BigNat where type BigNat :: * data BigNat = BN# {unBigNat :: BigNat#} type BigNat# :: GHC.Types.UnliftedType - type BigNat# = GHC.Num.WordArray.WordArray# :: GHC.Types.UnliftedType + type BigNat# = GHC.Num.WordArray.WordArray# bigNatAdd :: BigNat# -> BigNat# -> BigNat# bigNatAddWord :: BigNat# -> GHC.Types.Word -> BigNat# bigNatAddWord# :: BigNat# -> GHC.Prim.Word# -> BigNat# @@ -9345,7 +9345,7 @@ module GHC.Stack where type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint - type HasCallStack = ?callStack::CallStack :: Constraint + type HasCallStack = ?callStack::CallStack type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack @@ -9406,7 +9406,7 @@ module GHC.Stack.Types where type CallStack :: * data CallStack = EmptyCallStack | PushCallStack [GHC.Types.Char] SrcLoc CallStack | FreezeCallStack CallStack type HasCallStack :: Constraint - type HasCallStack = ?callStack::CallStack :: Constraint + type HasCallStack = ?callStack::CallStack type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} emptyCallStack :: CallStack @@ -9561,9 +9561,9 @@ module GHC.TypeLits where type (-) :: Natural -> Natural -> Natural type family (-) a b type (<=) :: forall {t}. t -> t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type AppendSymbol :: Symbol -> Symbol -> Symbol type family AppendSymbol a b type CharToNat :: GHC.Types.Char -> Natural @@ -9680,9 +9680,9 @@ module GHC.TypeNats where type (-) :: Natural -> Natural -> Natural type family (-) a b type (<=) :: forall {t}. t -> t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type CmpNat :: Natural -> Natural -> GHC.Types.Ordering type family CmpNat a b type Div :: Natural -> Natural -> Natural ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout ===================================== @@ -1480,9 +1480,9 @@ module Data.Tuple.Experimental where class a => CSolo a {-# MINIMAL #-} type CTuple0 :: Constraint - type CTuple0 = () :: Constraint :: Constraint + type CTuple0 = () :: Constraint type CTuple1 :: Constraint -> Constraint - type CTuple1 = CSolo :: Constraint -> Constraint + type CTuple1 = CSolo type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j {-# MINIMAL #-} @@ -2637,11 +2637,11 @@ module Data.Tuple.Experimental where type Tuple0 :: * type Tuple0 = () type Tuple0# :: GHC.Types.ZeroBitType - type Tuple0# = (# #) :: GHC.Types.ZeroBitType + type Tuple0# = (# #) type Tuple1 :: * -> * - type Tuple1 = Solo :: * -> * + type Tuple1 = Solo type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) - type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) + type Tuple1# = Solo# type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * data Tuple10 a b c d e f g h i j = ... type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9]) @@ -4328,9 +4328,9 @@ module Prelude.Experimental where class a => CSolo a {-# MINIMAL #-} type CTuple0 :: Constraint - type CTuple0 = () :: Constraint :: Constraint + type CTuple0 = () :: Constraint type CTuple1 :: Constraint -> Constraint - type CTuple1 = CSolo :: Constraint -> Constraint + type CTuple1 = CSolo type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j {-# MINIMAL #-} @@ -6959,11 +6959,11 @@ module Prelude.Experimental where type Tuple0 :: * type Tuple0 = () type Tuple0# :: GHC.Types.ZeroBitType - type Tuple0# = (# #) :: GHC.Types.ZeroBitType + type Tuple0# = (# #) type Tuple1 :: * -> * - type Tuple1 = Solo :: * -> * + type Tuple1 = Solo type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) - type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) + type Tuple1# = Solo# type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * data Tuple10 a b c d e f g h i j = ... type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9]) ===================================== testsuite/tests/rep-poly/RepPolyBackpack3.stderr ===================================== @@ -1,19 +1,19 @@ [1 of 3] Processing sig - [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, nothing ) + [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, nothing ) [2 of 3] Processing impl Instantiating impl - [1 of 1] Compiling Impl ( impl\Impl.hs, RepPolyBackpack3.out\impl\Impl.o ) + [1 of 1] Compiling Impl ( impl/Impl.hs, RepPolyBackpack3.out/impl/Impl.o ) [3 of 3] Processing main Instantiating main [1 of 1] Including sig[Sig=impl:Impl] Instantiating sig[Sig=impl:Impl] - [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, RepPolyBackpack3.out\sig\sig-Absk5cIXTXe6UYhGMYGber\Sig.o ) + [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, RepPolyBackpack3.out/sig/sig-Absk5cIXTXe6UYhGMYGber/Sig.o ) RepPolyBackpack3.bkp:17:5: error: [GHC-15843] • Type constructor ‘Rep’ has conflicting definitions in the module and its hsig file. Main module: type Rep :: GHC.Types.RuntimeRep - type Rep = T :: GHC.Types.RuntimeRep + type Rep = T Hsig file: type Rep :: GHC.Types.RuntimeRep data Rep Illegal implementation of abstract data: Invalid type family ‘T’. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6227a9ce164538d2df0526d76420c45a695e5f03 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6227a9ce164538d2df0526d76420c45a695e5f03 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 14:07:21 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Tue, 12 Mar 2024 10:07:21 -0400 Subject: [Git][ghc/ghc][wip/andreask/stm] STM: Be more optimistic when validating in-flight transactions. Message-ID: <65f06199a5f9f_2824f561403b010898@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/stm at Glasgow Haskell Compiler / GHC Commits: 4bd1875d by Andreas Klebinger at 2024-03-12T14:47:16+01:00 STM: Be more optimistic when validating in-flight transactions. * Don't lock tvars when performing non-committal validation. * If we encounter a locked tvar don't consider it a failure. This means in-flight validation will only fail if committing at the moment of validation is *guaranteed* to fail. This prevents in-flight validation from failing spuriously if it happens in parallel on multiple threads or parallel to thread comitting. - - - - - 3 changed files: - rts/STM.c - rts/STM.h - rts/Schedule.c Changes: ===================================== rts/STM.c ===================================== @@ -681,6 +681,42 @@ static void revert_ownership(Capability *cap STG_UNUSED, /*......................................................................*/ +// validate_optimistic() +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec); + +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec) { + StgBool result; + TRACE("cap %d, trec %p : validate_trec_optimistic", + cap->no, trec); + + if (shake()) { + TRACE("%p : shake, pretending trec is invalid when it may not be", trec); + return false; + } + + ASSERT((trec -> state == TREC_ACTIVE) || + (trec -> state == TREC_WAITING) || + (trec -> state == TREC_CONDEMNED)); + result = !((trec -> state) == TREC_CONDEMNED); + if (result) { + FOR_EACH_ENTRY(trec, e, { + StgTVar *s; + s = e -> tvar; + StgClosure *current = RELAXED_LOAD(&s->current_value); + if(current != e->expected_value && (GET_INFO(UNTAG_CLOSURE(current)) != &stg_TREC_HEADER_info)) + { TRACE("%p : failed optimistic validate %p", trec, s); + result = false; + BREAK_FOR_EACH; + } + }); + } + + + TRACE("%p : validate_trec_optimistic, result: %d", trec, result); + return result; +} + + // validate_and_acquire_ownership : this performs the twin functions // of checking that the TVars referred to by entries in trec hold the // expected values and: @@ -751,7 +787,7 @@ static StgBool validate_and_acquire_ownership (Capability *cap, revert_ownership(cap, trec, acquire_all); } - // TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); + TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); return result; } @@ -973,6 +1009,30 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { return result; } +StgBool stmValidateNestOfTransactionsOptimistic(Capability *cap, StgTRecHeader *trec) { + StgTRecHeader *t; + + TRACE("%p : stmValidateNestOfTransactionsOptimistic", trec); + ASSERT(trec != NO_TREC); + ASSERT((trec -> state == TREC_ACTIVE) || + (trec -> state == TREC_WAITING) || + (trec -> state == TREC_CONDEMNED)); + + t = trec; + StgBool result = true; + while (t != NO_TREC) { + // TODO: I don't think there is a need to lock any tvars here, all even less so. + result &= validate_trec_optimistic(cap, t); + t = t -> enclosing_trec; + } + + if (!result && trec -> state != TREC_WAITING) { + trec -> state = TREC_CONDEMNED; + } + + TRACE("%p : stmValidateNestOfTransactions()=%d", trec, result); + return result; +} /*......................................................................*/ static TRecEntry *get_entry_for(StgTRecHeader *trec, StgTVar *tvar, StgTRecHeader **in) { ===================================== rts/STM.h ===================================== @@ -95,6 +95,8 @@ void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec); StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); +StgBool stmValidateNestOfTransactionsOptimistic(Capability *cap, StgTRecHeader *trec); + /*---------------------------------------------------------------------- Commit/wait/rewait operations ===================================== rts/Schedule.c ===================================== @@ -1099,7 +1099,7 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // and a is never equal to b given a consistent view of memory. // if (t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { - if (!stmValidateNestOfTransactions(cap, t -> trec)) { + if (!stmValidateNestOfTransactionsOptimistic(cap, t -> trec)) { debugTrace(DEBUG_sched | DEBUG_stm, "trec %p found wasting its time", t); View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4bd1875d1fd9c06c21fa28ae0dc6c64a84732f9d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4bd1875d1fd9c06c21fa28ae0dc6c64a84732f9d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 14:16:55 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Tue, 12 Mar 2024 10:16:55 -0400 Subject: [Git][ghc/ghc][wip/ghc-9.10] 6 commits: rts/linker: Don't unload code when profiling is enabled Message-ID: <65f063d729345_2824f56859f481117f0@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 09d92280 by Ben Gamari at 2024-03-12T10:14:28-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - a27a477d by Ben Gamari at 2024-03-12T10:14:28-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 63928aeb by Ben Gamari at 2024-03-12T10:14:28-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 2e713fdb by Ben Gamari at 2024-03-12T10:14:28-04:00 gitlab-ci: Allow test-primops to fail It's still a bit sensitive to warnings, unfortunately. - - - - - 66c51e75 by Ben Gamari at 2024-03-12T10:14:28-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - d574a10d by Ben Gamari at 2024-03-12T10:14:28-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 9 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/upload.sh - hadrian/bindist/Makefile - hadrian/src/Rules/BinaryDist.hs - rts/CheckUnload.c - rts/Linker.c - rts/LinkerInternals.h - rts/linker/Elf.c - testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c Changes: ===================================== .gitlab-ci.yml ===================================== @@ -899,6 +899,7 @@ test-primops-nightly: test-primops-release: extends: .test-primops + allow_failure: true rules: - if: '$RELEASE_JOB == "yes"' ===================================== .gitlab/rel_eng/upload.sh ===================================== @@ -136,7 +136,7 @@ function upload() { } function purge_all() { - dir="$(echo $rel_name | sed s/-release//)" + local dir="$(echo $rel_name | sed s/-release//)" # Purge CDN cache curl -X PURGE http://downloads.haskell.org/ghc/ curl -X PURGE http://downloads.haskell.org/~ghc/ @@ -150,12 +150,18 @@ function purge_all() { } function purge_file() { - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/docs/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/docs/ + dirs=( + "~ghc/$rel_name" + "ghc/$rel_name" + "~ghc/$ver" + "ghc/$ver" + ) + + for dir in ${dirs[@]}; do + curl -X PURGE http://downloads.haskell.org/$dir/$i + curl -X PURGE http://downloads.haskell.org/$dir/$i/ + curl -X PURGE http://downloads.haskell.org/$dir/$i/docs/ + done } function prepare_docs() { ===================================== hadrian/bindist/Makefile ===================================== @@ -175,18 +175,19 @@ install_lib: lib/settings @dest="$(DESTDIR)$(ActualLibsDir)"; \ cd lib; \ for i in `$(FIND) . -type f`; do \ - $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \ + dir="`dirname $$i`" ; \ + $(INSTALL_DIR) "$$dest/$$dir" ; \ case $$i in \ *.a) \ - $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_DATA) $$i "$$dest/$$dir" ; \ $(RANLIB_CMD) "$$dest"/$$i ;; \ *.dll) \ - $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \ + $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \ $(STRIP_CMD) "$$dest"/$$i ;; \ *.so) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.dylib) \ - $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \ + $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \ *.mjs) \ $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \ *) \ ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -135,7 +135,8 @@ bindistRules = do let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty installTo Relocatable prefix - + copyDirectory (root -/- "mingw") prefix + liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw") phony "install" $ do need ["binary-dist-dir"] @@ -145,8 +146,6 @@ bindistRules = do installTo NotRelocatable installPrefix phony "binary-dist-dir" $ do - - version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull distDir <- Context.distDir Stage1 @@ -309,7 +308,7 @@ bindistRules = do let buildBinDist compressor = do win_target <- isWinTarget - when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.") + when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.") buildBinDistX "binary-dist-dir" "bindist" compressor buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist" ===================================== rts/CheckUnload.c ===================================== @@ -165,6 +165,18 @@ ObjectCode *loaded_objects; // map static closures to their ObjectCode. static OCSectionIndices *global_s_indices = NULL; +// Is it safe for us to unload code? +static bool safeToUnload(void) +{ + if (RtsFlags.ProfFlags.doHeapProfile != NO_HEAP_PROFILING) { + // We mustn't unload anything as the heap census may contain + // references into static data (e.g. cost centre names). + // See #24512. + return false; + } + return true; +} + static OCSectionIndices *createOCSectionIndices(void) { // TODO (osa): Maybe initialize as empty (without allocation) and allocate @@ -457,6 +469,8 @@ void checkUnload(void) { if (global_s_indices == NULL) { return; + } else if (!safeToUnload()) { + return; } // At this point we've marked all dynamically loaded static objects @@ -478,8 +492,6 @@ void checkUnload(void) next = oc->next; ASSERT(oc->status == OBJECT_UNLOADED); - removeOCSectionIndices(s_indices, oc); - // Symbols should be removed by unloadObj_. // NB (osa): If this assertion doesn't hold then freeObjectCode below // will corrupt symhash as keys of that table live in ObjectCodes. If @@ -487,8 +499,17 @@ void checkUnload(void) // RTS) then it's probably because this assertion did not hold. ASSERT(oc->symbols == NULL); - freeObjectCode(oc); - n_unloaded_objects -= 1; + if (oc->unloadable) { + removeOCSectionIndices(s_indices, oc); + freeObjectCode(oc); + n_unloaded_objects -= 1; + } else { + // If we don't have enough information to + // accurately determine the reachability of + // the object then hold onto it. + oc->next = objects; + objects = oc; + } } old_objects = NULL; ===================================== rts/Linker.c ===================================== @@ -1385,6 +1385,8 @@ mkOc( ObjectType type, pathchar *path, char *image, int imageSize, oc->prev = NULL; oc->next_loaded_object = NULL; oc->mark = object_code_mark_bit; + /* this will get cleared by the caller if object is not safely unloadable */ + oc->unloadable = true; oc->dependencies = allocHashSet(); #if defined(NEED_M32) ===================================== rts/LinkerInternals.h ===================================== @@ -313,8 +313,14 @@ struct _ObjectCode { struct _ObjectCode *next_loaded_object; // Mark bit + // N.B. This is a full word as we CAS it. StgWord mark; + // Can this object be safely unloaded? Not true for + // dynamic objects when dlinfo is not available as + // we cannot determine liveness. + bool unloadable; + // Set of dependencies (ObjectCode*) of the object file. Traverse // dependencies using `iterHashTable`. // @@ -376,7 +382,9 @@ struct _ObjectCode { /* handle returned from dlopen */ void *dlopen_handle; - /* virtual memory ranges of loaded code */ + /* virtual memory ranges of loaded code. NULL if no range information is + * available (e.g. if dlinfo is unavailable on the current platform). + */ NativeCodeRange *nc_ranges; }; ===================================== rts/linker/Elf.c ===================================== @@ -2186,6 +2186,10 @@ void * loadNativeObj_ELF (pathchar *path, char **errmsg) copyErrmsg(errmsg, "dl_iterate_phdr failed to find obj"); goto dl_iterate_phdr_fail; } + nc->unloadable = true; +#else + nc->nc_ranges = NULL; + nc->unloadable = false; #endif /* defined (HAVE_DLINFO) */ insertOCSectionIndices(nc); ===================================== testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c ===================================== @@ -64,7 +64,7 @@ void check_object_freed(char *obj_path) { OStatus st; st = getObjectLoadStatus(toPathchar(obj_path)); if (st != OBJECT_NOT_LOADED) { - errorBelch("object %s status != OBJECT_NOT_LOADED", obj_path); + errorBelch("object %s status != OBJECT_NOT_LOADED, is %d instead", obj_path, st); exit(1); } } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/563fa0fd6d25b6187e763832adaae2659fe1f52e...d574a10dc96681f0aecccbbb218b9a4e11f511b8 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/563fa0fd6d25b6187e763832adaae2659fe1f52e...d574a10dc96681f0aecccbbb218b9a4e11f511b8 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 15:01:24 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Tue, 12 Mar 2024 11:01:24 -0400 Subject: [Git][ghc/ghc][wip/tsan/fixes-3] 2 commits: rts: fix clang-specific errors when compiling with TSAN Message-ID: <65f06e44e469f_2824f57c9d4c8145972@gitlab.mail> Cheng Shao pushed to branch wip/tsan/fixes-3 at Glasgow Haskell Compiler / GHC Commits: da8998c6 by Cheng Shao at 2024-03-12T14:57:17+00:00 rts: fix clang-specific errors when compiling with TSAN This commit fixes clang-specific rts compilation errors when compiling with TSAN: - clang doesn't have -Wtsan flag - Fix prototype of ghc_tsan_* helper functions - __tsan_atomic_* functions aren't clang built-ins and sanitizer/tsan_interface_atomic.h needs to be included - On macOS, TSAN runtime library is libclang_rt.tsan_osx_dynamic.dylib, not libtsan. -fsanitize-thread as a link-time flag will take care of linking the TSAN runtime library anyway so remove tsan as an rts extra library - - - - - 657d2870 by Cheng Shao at 2024-03-12T15:00:01+00:00 ci: improve TSAN CI jobs - Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm instrumentation as well. - Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc that @bgamari confirms he's using in #GHC:matrix.org. Ideally we should be using latest clang release for latest improvements in sanitizers, though that's left as future work. - Mark TSAN jobs as manual+allow_failure in validate pipelines. The purpose is to demonstrate that we have indeed at least fixed building of TSAN mode in CI without blocking the patch to land, and once merged other people can begin playing with TSAN using their own dev setups and feature branches. - - - - - 6 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - rts/TSANUtils.c - rts/include/rts/TSANUtils.h - rts/include/stg/SMP.h - rts/rts.cabal Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -339,7 +339,7 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f flavour_string Llvm = "llvm" flavour_string Dwarf = "debug_info" flavour_string FullyStatic = "fully_static" - flavour_string ThreadSanitiser = "thread_sanitizer" + flavour_string ThreadSanitiser = "thread_sanitizer_cmm" flavour_string NoSplitSections = "no_split_sections" flavour_string BootNonmovingGc = "boot_nonmoving_gc" @@ -969,9 +969,9 @@ job_groups = , validateBuilds Amd64 (Linux Debian10) nativeInt , validateBuilds Amd64 (Linux Debian10) unreg , fastCI (validateBuilds Amd64 (Linux Debian10) debug) - , -- Nightly allowed to fail: #22520 + , -- More work is needed to address TSAN failures: #22520 modifyNightlyJobs allowFailure - (modifyValidateJobs manual tsan_jobs) + (modifyValidateJobs (allowFailure . manual) tsan_jobs) , -- Nightly allowed to fail: #22343 modifyNightlyJobs allowFailure (modifyValidateJobs manual (validateBuilds Amd64 (Linux Debian10) noTntc)) @@ -1039,7 +1039,7 @@ job_groups = -- Haddock is large enough to make TSAN choke without massive quantities of -- memory. . addVariable "HADRIAN_ARGS" "--docs=none") $ - validateBuilds Amd64 (Linux Debian10) tsan + validateBuilds Amd64 (Linux Debian12) tsan make_wasm_jobs cfg = modifyJobs @@ -1083,6 +1083,7 @@ platform_mapping = Map.map go combined_result , "nightly-x86_64-linux-deb11-validate" , "nightly-x86_64-linux-deb12-validate" , "x86_64-linux-alpine3_18-wasm-cross_wasm32-wasi-release+fully_static" + , "x86_64-linux-deb12-validate+thread_sanitizer_cmm" , "nightly-aarch64-linux-deb10-validate" , "nightly-x86_64-linux-alpine3_12-validate" , "nightly-x86_64-linux-deb10-validate" ===================================== .gitlab/jobs.yaml ===================================== @@ -1644,18 +1644,18 @@ "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-validate+thread_sanitizer": { + "nightly-x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": true, + "allow_failure": false, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1698,17 +1698,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", + "TEST_ENV": "x86_64-linux-deb10-zstd-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-zstd-validate": { + "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1719,7 +1717,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1729,14 +1727,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -1762,15 +1760,17 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate", + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1781,7 +1781,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1823,18 +1823,19 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "nightly-x86_64-linux-deb11-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1845,7 +1846,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1887,19 +1888,16 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "TEST_ENV": "x86_64-linux-deb11-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate": { + "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1910,7 +1908,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1953,15 +1951,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-validate", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "nightly-x86_64-linux-deb12-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1972,7 +1970,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1982,14 +1980,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -2015,15 +2013,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", + "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate": { + "nightly-x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -2034,7 +2032,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2077,26 +2075,26 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate+llvm": { + "nightly-x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2139,11 +2137,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm", + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", "XZ_OPT": "-9" } }, @@ -5090,7 +5090,7 @@ "TEST_ENV": "x86_64-linux-deb10-validate+debug_info" } }, - "x86_64-linux-deb10-validate+thread_sanitizer": { + "x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5101,7 +5101,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5127,9 +5127,8 @@ ], "rules": [ { - "allow_failure": true, - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "manual" + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "on_success" } ], "script": [ @@ -5145,16 +5144,14 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" + "TEST_ENV": "x86_64-linux-deb10-zstd-validate" } }, - "x86_64-linux-deb10-zstd-validate": { + "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5165,7 +5162,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5175,14 +5172,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5191,7 +5188,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5208,14 +5205,16 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate" + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" } }, - "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5226,7 +5225,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5252,7 +5251,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5268,17 +5267,18 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" } }, - "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5289,7 +5289,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5315,7 +5315,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5331,18 +5331,15 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" } }, - "x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5353,7 +5350,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5363,14 +5360,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5379,7 +5376,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5396,25 +5393,25 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm" } }, - "x86_64-linux-deb12-validate+llvm": { + "x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5440,8 +5437,9 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "on_success" + "allow_failure": true, + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "manual" } ], "script": [ @@ -5457,11 +5455,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm" + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" } }, "x86_64-linux-fedora33-release": { ===================================== rts/TSANUtils.c ===================================== @@ -2,7 +2,7 @@ #if defined(TSAN_ENABLED) -uint64_t ghc_tsan_atomic64_compare_exchange(uint64_t *ptr, uint64_t expected, uint64_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic64 ghc_tsan_atomic64_compare_exchange(volatile __tsan_atomic64 *ptr, __tsan_atomic64 expected, __tsan_atomic64 new_value, int success_memorder, int failure_memorder) { __tsan_atomic64_compare_exchange_strong( ptr, &expected, new_value, @@ -10,7 +10,7 @@ uint64_t ghc_tsan_atomic64_compare_exchange(uint64_t *ptr, uint64_t expected, ui return expected; } -uint32_t ghc_tsan_atomic32_compare_exchange(uint32_t *ptr, uint32_t expected, uint32_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic32 ghc_tsan_atomic32_compare_exchange(volatile __tsan_atomic32 *ptr, __tsan_atomic32 expected, __tsan_atomic32 new_value, int success_memorder, int failure_memorder) { __tsan_atomic32_compare_exchange_strong( ptr, &expected, new_value, @@ -18,7 +18,7 @@ uint32_t ghc_tsan_atomic32_compare_exchange(uint32_t *ptr, uint32_t expected, ui return expected; } -uint16_t ghc_tsan_atomic16_compare_exchange(uint16_t *ptr, uint16_t expected, uint16_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic16 ghc_tsan_atomic16_compare_exchange(volatile __tsan_atomic16 *ptr, __tsan_atomic16 expected, __tsan_atomic16 new_value, int success_memorder, int failure_memorder) { __tsan_atomic16_compare_exchange_strong( ptr, &expected, new_value, @@ -26,7 +26,7 @@ uint16_t ghc_tsan_atomic16_compare_exchange(uint16_t *ptr, uint16_t expected, ui return expected; } -uint8_t ghc_tsan_atomic8_compare_exchange(uint8_t *ptr, uint8_t expected, uint8_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic8 ghc_tsan_atomic8_compare_exchange(volatile __tsan_atomic8 *ptr, __tsan_atomic8 expected, __tsan_atomic8 new_value, int success_memorder, int failure_memorder) { __tsan_atomic8_compare_exchange_strong( ptr, &expected, new_value, ===================================== rts/include/rts/TSANUtils.h ===================================== @@ -98,10 +98,18 @@ void AnnotateBenignRaceSized(const char *file, #define TSAN_ANNOTATE_BENIGN_RACE(addr,desc) \ TSAN_ANNOTATE_BENIGN_RACE_SIZED((void*)(addr), sizeof(*addr), desc) +#if defined(__clang__) +#include +#else +typedef char __tsan_atomic8; +typedef short __tsan_atomic16; +typedef int __tsan_atomic32; +typedef long __tsan_atomic64; +#endif -uint64_t ghc_tsan_atomic64_compare_exchange(uint64_t *ptr, uint64_t expected, uint64_t new_value, int success_memorder, int failure_memorder); -uint32_t ghc_tsan_atomic32_compare_exchange(uint32_t *ptr, uint32_t expected, uint32_t new_value, int success_memorder, int failure_memorder); -uint16_t ghc_tsan_atomic16_compare_exchange(uint16_t *ptr, uint16_t expected, uint16_t new_value, int success_memorder, int failure_memorder); -uint8_t ghc_tsan_atomic8_compare_exchange(uint8_t *ptr, uint8_t expected, uint8_t new_value, int success_memorder, int failure_memorder); +__tsan_atomic64 ghc_tsan_atomic64_compare_exchange(volatile __tsan_atomic64 *ptr, __tsan_atomic64 expected, __tsan_atomic64 new_value, int success_memorder, int failure_memorder); +__tsan_atomic32 ghc_tsan_atomic32_compare_exchange(volatile __tsan_atomic32 *ptr, __tsan_atomic32 expected, __tsan_atomic32 new_value, int success_memorder, int failure_memorder); +__tsan_atomic16 ghc_tsan_atomic16_compare_exchange(volatile __tsan_atomic16 *ptr, __tsan_atomic16 expected, __tsan_atomic16 new_value, int success_memorder, int failure_memorder); +__tsan_atomic8 ghc_tsan_atomic8_compare_exchange(volatile __tsan_atomic8 *ptr, __tsan_atomic8 expected, __tsan_atomic8 new_value, int success_memorder, int failure_memorder); #endif ===================================== rts/include/stg/SMP.h ===================================== @@ -549,12 +549,14 @@ busy_wait_nop(void) #define SEQ_CST_FENCE() __atomic_thread_fence(__ATOMIC_SEQ_CST) #if defined(TSAN_ENABLED) +#if !defined(__clang__) #undef ACQUIRE_FENCE #undef RELEASE_FENCE #undef SEQ_CST_FENCE #define ACQUIRE_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_ACQUIRE);) #define RELEASE_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_RELEASE);) #define SEQ_CST_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_SEQ_CST);) +#endif #define ACQUIRE_FENCE_ON(x) (void)ACQUIRE_LOAD(x) #else #define ACQUIRE_FENCE_ON(x) __atomic_thread_fence(__ATOMIC_ACQUIRE) ===================================== rts/rts.cabal ===================================== @@ -184,7 +184,6 @@ library if flag(thread-sanitizer) cc-options: -fsanitize=thread ld-options: -fsanitize=thread - extra-libraries: tsan if os(linux) -- the RTS depends upon libc. while this dependency is generally View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c4128331d766c13b5333e14e06251ff7fc1d5e96...657d2870457ffff6fbac82588c0ac603cdc0f8e6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c4128331d766c13b5333e14e06251ff7fc1d5e96...657d2870457ffff6fbac82588c0ac603cdc0f8e6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 17:05:33 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 12 Mar 2024 13:05:33 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: rts/linker: Don't unload code when profiling is enabled Message-ID: <65f08b5d3128d_16f2141a9049c1472@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 32ab851b by Brandon Chinn at 2024-03-12T13:05:05-04:00 Remove duplicate code normalising slashes - - - - - 268bcbc5 by Brandon Chinn at 2024-03-12T13:05:06-04:00 Simplify regexes with raw strings - - - - - 56113578 by Brandon Chinn at 2024-03-12T13:05:06-04:00 Don't normalize backslashes in characters - - - - - 83d82da6 by Andrei Borzenkov at 2024-03-12T13:05:06-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 22 changed files: - .gitlab/rel_eng/upload.sh - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - rts/CheckUnload.c - rts/Linker.c - rts/LinkerInternals.h - rts/linker/Elf.c - testsuite/driver/testlib.py - testsuite/tests/parser/should_fail/T21843a.stderr - testsuite/tests/parser/should_fail/T21843b.stderr - testsuite/tests/parser/should_fail/T21843c.stderr - testsuite/tests/parser/should_fail/T21843d.stderr - testsuite/tests/parser/should_fail/T21843e.stderr - testsuite/tests/parser/should_fail/T21843f.stderr - testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== .gitlab/rel_eng/upload.sh ===================================== @@ -136,7 +136,7 @@ function upload() { } function purge_all() { - dir="$(echo $rel_name | sed s/-release//)" + local dir="$(echo $rel_name | sed s/-release//)" # Purge CDN cache curl -X PURGE http://downloads.haskell.org/ghc/ curl -X PURGE http://downloads.haskell.org/~ghc/ @@ -150,12 +150,18 @@ function purge_all() { } function purge_file() { - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/~ghc/$rel_name/$i/docs/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/ - curl -X PURGE http://downloads.haskell.org/ghc/$rel_name/$i/docs/ + dirs=( + "~ghc/$rel_name" + "ghc/$rel_name" + "~ghc/$ver" + "ghc/$ver" + ) + + for dir in ${dirs[@]}; do + curl -X PURGE http://downloads.haskell.org/$dir/$i + curl -X PURGE http://downloads.haskell.org/$dir/$i/ + curl -X PURGE http://downloads.haskell.org/$dir/$i/docs/ + done } function prepare_docs() { ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== rts/CheckUnload.c ===================================== @@ -165,6 +165,18 @@ ObjectCode *loaded_objects; // map static closures to their ObjectCode. static OCSectionIndices *global_s_indices = NULL; +// Is it safe for us to unload code? +static bool safeToUnload(void) +{ + if (RtsFlags.ProfFlags.doHeapProfile != NO_HEAP_PROFILING) { + // We mustn't unload anything as the heap census may contain + // references into static data (e.g. cost centre names). + // See #24512. + return false; + } + return true; +} + static OCSectionIndices *createOCSectionIndices(void) { // TODO (osa): Maybe initialize as empty (without allocation) and allocate @@ -457,6 +469,8 @@ void checkUnload(void) { if (global_s_indices == NULL) { return; + } else if (!safeToUnload()) { + return; } // At this point we've marked all dynamically loaded static objects @@ -478,8 +492,6 @@ void checkUnload(void) next = oc->next; ASSERT(oc->status == OBJECT_UNLOADED); - removeOCSectionIndices(s_indices, oc); - // Symbols should be removed by unloadObj_. // NB (osa): If this assertion doesn't hold then freeObjectCode below // will corrupt symhash as keys of that table live in ObjectCodes. If @@ -487,8 +499,17 @@ void checkUnload(void) // RTS) then it's probably because this assertion did not hold. ASSERT(oc->symbols == NULL); - freeObjectCode(oc); - n_unloaded_objects -= 1; + if (oc->unloadable) { + removeOCSectionIndices(s_indices, oc); + freeObjectCode(oc); + n_unloaded_objects -= 1; + } else { + // If we don't have enough information to + // accurately determine the reachability of + // the object then hold onto it. + oc->next = objects; + objects = oc; + } } old_objects = NULL; ===================================== rts/Linker.c ===================================== @@ -1385,6 +1385,8 @@ mkOc( ObjectType type, pathchar *path, char *image, int imageSize, oc->prev = NULL; oc->next_loaded_object = NULL; oc->mark = object_code_mark_bit; + /* this will get cleared by the caller if object is not safely unloadable */ + oc->unloadable = true; oc->dependencies = allocHashSet(); #if defined(NEED_M32) ===================================== rts/LinkerInternals.h ===================================== @@ -313,8 +313,14 @@ struct _ObjectCode { struct _ObjectCode *next_loaded_object; // Mark bit + // N.B. This is a full word as we CAS it. StgWord mark; + // Can this object be safely unloaded? Not true for + // dynamic objects when dlinfo is not available as + // we cannot determine liveness. + bool unloadable; + // Set of dependencies (ObjectCode*) of the object file. Traverse // dependencies using `iterHashTable`. // @@ -376,7 +382,9 @@ struct _ObjectCode { /* handle returned from dlopen */ void *dlopen_handle; - /* virtual memory ranges of loaded code */ + /* virtual memory ranges of loaded code. NULL if no range information is + * available (e.g. if dlinfo is unavailable on the current platform). + */ NativeCodeRange *nc_ranges; }; ===================================== rts/linker/Elf.c ===================================== @@ -2186,6 +2186,10 @@ void * loadNativeObj_ELF (pathchar *path, char **errmsg) copyErrmsg(errmsg, "dl_iterate_phdr failed to find obj"); goto dl_iterate_phdr_fail; } + nc->unloadable = true; +#else + nc->nc_ranges = NULL; + nc->unloadable = false; #endif /* defined (HAVE_DLINFO) */ insertOCSectionIndices(nc); ===================================== testsuite/driver/testlib.py ===================================== @@ -1119,8 +1119,8 @@ def normalise_win32_io_errors(name, opts): def normalise_version_( *pkgs ): def normalise_version__( str ): # (name)(-version)(-hash)(-components) - return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-zA-Z\+]+)?(-[0-9a-zA-Z]+)?', - '\\1--', str) + return re.sub('(' + '|'.join(map(re.escape,pkgs)) + r')-[0-9.]+(-[0-9a-zA-Z+]+)?(-[0-9a-zA-Z]+)?', + r'\1--', str) return normalise_version__ def normalise_version( *pkgs ): @@ -1491,7 +1491,7 @@ async def do_test(name: TestName, if opts.expect not in ['pass', 'fail', 'missing-lib']: framework_fail(name, way, 'bad expected ' + opts.expect) - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) if way in opts.fragile_ways: if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail')) @@ -1538,7 +1538,7 @@ def override_options(pre_cmd): def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = '%s(%s)' % (name, way) if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) name2 = name if name is not None else TestName('none') @@ -1549,7 +1549,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str def framework_warn(name: TestName, way: WayName, reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = name + '(' + way + ')' if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) t.framework_warnings.append(TestResult(directory, name, reason, way)) @@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str: s = normalise_callstacks(s) s = normalise_type_reps(s) - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + # normalise slashes to minimise Windows/Unix filename differences, + # but don't normalize backslashes in chars + s = re.sub(r"(?!')\\", '/', s) # Normalize the name of the GHC executable. Specifically, # this catches the cases that: @@ -2614,14 +2615,11 @@ def normalise_errmsg(s: str) -> str: # the colon is there because it appears in error messages; this # hacky solution is used in place of more sophisticated filename # mangling - s = re.sub('([^\\s])\\.exe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) # Same thing for .wasm modules generated by the Wasm backend - s = re.sub('([^\\s])\\.wasm', '\\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) # Same thing for .jsexe directories generated by the JS backend - s = re.sub('([^\\s])\\.jsexe', '\\1', s) - - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) # hpc executable is given ghc suffix s = re.sub('hpc-ghc', 'hpc', s) @@ -2631,8 +2629,8 @@ def normalise_errmsg(s: str) -> str: s = re.sub('ghc-stage[123]', 'ghc', s) # Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools # (ghc, ghc-pkg, unlit, etc.) - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) - s = re.sub('\\w+(-\\w+)*-unlit', 'unlit', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-unlit', 'unlit', s) # On windows error messages can mention versioned executables s = re.sub('ghc-[0-9.]+', 'ghc', s) @@ -2735,8 +2733,8 @@ def normalise_prof (s: str) -> str: return s def normalise_slashes_( s: str ) -> str: - s = re.sub('\\\\', '/', s) - s = re.sub('//', '/', s) + s = re.sub(r'\\', '/', s) + s = re.sub(r'//', '/', s) return s def normalise_exe_( s: str ) -> str: @@ -2754,9 +2752,9 @@ def normalise_output( s: str ) -> str: # and .wasm extension (for the Wasm backend) # and .jsexe extension (for the JS backend) # This can occur in error messages generated by the program. - s = re.sub('([^\\s])\\.exe', '\\1', s) - s = re.sub('([^\\s])\\.wasm', '\\1', s) - s = re.sub('([^\\s])\\.jsexe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) s = normalise_callstacks(s) s = normalise_type_reps(s) # ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is @@ -2776,7 +2774,7 @@ def normalise_output( s: str ) -> str: s = re.sub('.*warning: argument unused during compilation:.*\n', '', s) # strip the cross prefix if any - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) return s ===================================== testsuite/tests/parser/should_fail/T21843a.stderr ===================================== @@ -1,4 +1,4 @@ T21843a.hs:3:13: [GHC-31623] - Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not + Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843b.stderr ===================================== @@ -1,3 +1,3 @@ T21843b.hs:3:11: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843c.stderr ===================================== @@ -1,6 +1,6 @@ T21843c.hs:3:19: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not T21843c.hs:3:20: [GHC-21231] - lexical error in string/character literal at character '/n' + lexical error in string/character literal at character '\n' ===================================== testsuite/tests/parser/should_fail/T21843d.stderr ===================================== @@ -1,3 +1,3 @@ T21843d.hs:3:13: [GHC-31623] - Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not + Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843e.stderr ===================================== @@ -1,3 +1,3 @@ T21843e.hs:3:15: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843f.stderr ===================================== @@ -1,3 +1,3 @@ T21843f.hs:3:13: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.c ===================================== @@ -64,7 +64,7 @@ void check_object_freed(char *obj_path) { OStatus st; st = getObjectLoadStatus(toPathchar(obj_path)); if (st != OBJECT_NOT_LOADED) { - errorBelch("object %s status != OBJECT_NOT_LOADED", obj_path); + errorBelch("object %s status != OBJECT_NOT_LOADED, is %d instead", obj_path, st); exit(1); } } ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accommodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/869d8867c758cf2587aa2990bdd73f68268c0f3d...83d82da64b304381e856bb43e2d453501ca9d908 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/869d8867c758cf2587aa2990bdd73f68268c0f3d...83d82da64b304381e856bb43e2d453501ca9d908 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 17:38:54 2024 From: gitlab at gitlab.haskell.org (Cheng Shao (@TerrorJack)) Date: Tue, 12 Mar 2024 13:38:54 -0400 Subject: [Git][ghc/ghc][wip/tsan/fixes-3] 3 commits: rts: fix clang-specific errors when compiling with TSAN Message-ID: <65f0932e9f543_16f2142a0687c3077e@gitlab.mail> Cheng Shao pushed to branch wip/tsan/fixes-3 at Glasgow Haskell Compiler / GHC Commits: 157c28bc by Cheng Shao at 2024-03-12T17:37:55+00:00 rts: fix clang-specific errors when compiling with TSAN This commit fixes clang-specific rts compilation errors when compiling with TSAN: - clang doesn't have -Wtsan flag - Fix prototype of ghc_tsan_* helper functions - __tsan_atomic_* functions aren't clang built-ins and sanitizer/tsan_interface_atomic.h needs to be included - On macOS, TSAN runtime library is libclang_rt.tsan_osx_dynamic.dylib, not libtsan. -fsanitize-thread as a link-time flag will take care of linking the TSAN runtime library anyway so remove tsan as an rts extra library - - - - - 9b8dad42 by Cheng Shao at 2024-03-12T17:38:01+00:00 compiler: fix github link to __tsan_memory_order in a comment - - - - - ca80d93d by Cheng Shao at 2024-03-12T17:38:33+00:00 ci: improve TSAN CI jobs - Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm instrumentation as well. - Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc that @bgamari confirms he's using in #GHC:matrix.org. Ideally we should be using latest clang release for latest improvements in sanitizers, though that's left as future work. - Mark TSAN jobs as manual+allow_failure in validate pipelines. The purpose is to demonstrate that we have indeed at least fixed building of TSAN mode in CI without blocking the patch to land, and once merged other people can begin playing with TSAN using their own dev setups and feature branches. - - - - - 7 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC/Cmm/ThreadSanitizer.hs - rts/TSANUtils.c - rts/include/rts/TSANUtils.h - rts/include/stg/SMP.h - rts/rts.cabal Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -339,7 +339,7 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f flavour_string Llvm = "llvm" flavour_string Dwarf = "debug_info" flavour_string FullyStatic = "fully_static" - flavour_string ThreadSanitiser = "thread_sanitizer" + flavour_string ThreadSanitiser = "thread_sanitizer_cmm" flavour_string NoSplitSections = "no_split_sections" flavour_string BootNonmovingGc = "boot_nonmoving_gc" @@ -969,9 +969,9 @@ job_groups = , validateBuilds Amd64 (Linux Debian10) nativeInt , validateBuilds Amd64 (Linux Debian10) unreg , fastCI (validateBuilds Amd64 (Linux Debian10) debug) - , -- Nightly allowed to fail: #22520 + , -- More work is needed to address TSAN failures: #22520 modifyNightlyJobs allowFailure - (modifyValidateJobs manual tsan_jobs) + (modifyValidateJobs (allowFailure . manual) tsan_jobs) , -- Nightly allowed to fail: #22343 modifyNightlyJobs allowFailure (modifyValidateJobs manual (validateBuilds Amd64 (Linux Debian10) noTntc)) @@ -1039,7 +1039,7 @@ job_groups = -- Haddock is large enough to make TSAN choke without massive quantities of -- memory. . addVariable "HADRIAN_ARGS" "--docs=none") $ - validateBuilds Amd64 (Linux Debian10) tsan + validateBuilds Amd64 (Linux Debian12) tsan make_wasm_jobs cfg = modifyJobs @@ -1083,6 +1083,7 @@ platform_mapping = Map.map go combined_result , "nightly-x86_64-linux-deb11-validate" , "nightly-x86_64-linux-deb12-validate" , "x86_64-linux-alpine3_18-wasm-cross_wasm32-wasi-release+fully_static" + , "x86_64-linux-deb12-validate+thread_sanitizer_cmm" , "nightly-aarch64-linux-deb10-validate" , "nightly-x86_64-linux-alpine3_12-validate" , "nightly-x86_64-linux-deb10-validate" ===================================== .gitlab/jobs.yaml ===================================== @@ -1644,18 +1644,18 @@ "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-validate+thread_sanitizer": { + "nightly-x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": true, + "allow_failure": false, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1698,17 +1698,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", + "TEST_ENV": "x86_64-linux-deb10-zstd-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb10-zstd-validate": { + "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1719,7 +1717,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1729,14 +1727,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -1762,15 +1760,17 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate", + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1781,7 +1781,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1823,18 +1823,19 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "nightly-x86_64-linux-deb11-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1845,7 +1846,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1887,19 +1888,16 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", + "TEST_ENV": "x86_64-linux-deb11-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate": { + "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1910,7 +1908,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1953,15 +1951,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-validate", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "nightly-x86_64-linux-deb12-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -1972,7 +1970,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -1982,14 +1980,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -2015,15 +2013,15 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", + "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc", + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate": { + "nightly-x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -2034,7 +2032,7 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2077,26 +2075,26 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate", - "BUILD_FLAVOUR": "validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm", "XZ_OPT": "-9" } }, - "nightly-x86_64-linux-deb12-validate+llvm": { + "nightly-x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -2139,11 +2137,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm", + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions", "XZ_OPT": "-9" } }, @@ -5090,7 +5090,7 @@ "TEST_ENV": "x86_64-linux-deb10-validate+debug_info" } }, - "x86_64-linux-deb10-validate+thread_sanitizer": { + "x86_64-linux-deb10-zstd-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5101,7 +5101,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-validate+thread_sanitizer.tar.xz", + "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5127,9 +5127,8 @@ ], "rules": [ { - "allow_failure": true, - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "manual" + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "on_success" } ], "script": [ @@ -5145,16 +5144,14 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+thread_sanitizer", - "BUILD_FLAVOUR": "validate+thread_sanitizer", - "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "HADRIAN_ARGS": "--docs=none", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-validate+thread_sanitizer", - "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" + "TEST_ENV": "x86_64-linux-deb10-zstd-validate" } }, - "x86_64-linux-deb10-zstd-validate": { + "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5165,7 +5162,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb10-zstd-validate.tar.xz", + "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5175,14 +5172,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb10-$CACHE_REV", + "key": "x86_64-linux-deb11-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5191,7 +5188,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*IPE.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5208,14 +5205,16 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-zstd-validate", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--enable-ipe-data-compression --enable-strict-ghc-toolchain-check", + "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", + "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", + "CROSS_TARGET": "aarch64-linux-gnu", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb10-zstd-validate" + "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" } }, - "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": { + "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5226,7 +5225,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz", + "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5252,7 +5251,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5268,17 +5267,18 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_TARGET": "aarch64-linux-gnu", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_EMULATOR": "js-emulator", + "CROSS_TARGET": "javascript-unknown-ghcjs", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" } }, - "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": { + "x86_64-linux-deb11-validate+boot_nonmoving_gc": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5289,7 +5289,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz", + "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5315,7 +5315,7 @@ ], "rules": [ { - "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5331,18 +5331,15 @@ "x86_64-linux" ], "variables": { - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_EMULATOR": "js-emulator", - "CROSS_TARGET": "javascript-unknown-ghcjs", - "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate" + "BIGNUM_BACKEND": "gmp", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", + "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", + "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" } }, - "x86_64-linux-deb11-validate+boot_nonmoving_gc": { + "x86_64-linux-deb12-validate+llvm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", @@ -5353,7 +5350,7 @@ "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc.tar.xz", + "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5363,14 +5360,14 @@ "when": "always" }, "cache": { - "key": "x86_64-linux-deb11-$CACHE_REV", + "key": "x86_64-linux-deb12-$CACHE_REV", "paths": [ "cabal-cache", "toolchain" ] }, "dependencies": [], - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV", "needs": [ { "artifacts": false, @@ -5379,7 +5376,7 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*non-moving GC.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", "when": "on_success" } ], @@ -5396,25 +5393,25 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate+boot_nonmoving_gc", - "BUILD_FLAVOUR": "validate+boot_nonmoving_gc", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", + "BUILD_FLAVOUR": "validate+llvm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity", - "TEST_ENV": "x86_64-linux-deb11-validate+boot_nonmoving_gc" + "RUNTEST_ARGS": "", + "TEST_ENV": "x86_64-linux-deb12-validate+llvm" } }, - "x86_64-linux-deb12-validate+llvm": { + "x86_64-linux-deb12-validate+thread_sanitizer_cmm": { "after_script": [ ".gitlab/ci.sh save_cache", ".gitlab/ci.sh save_test_output", ".gitlab/ci.sh clean", "cat ci_timings" ], - "allow_failure": false, + "allow_failure": true, "artifacts": { "expire_in": "2 weeks", "paths": [ - "ghc-x86_64-linux-deb12-validate+llvm.tar.xz", + "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm.tar.xz", "junit.xml", "unexpected-test-output.tar.gz" ], @@ -5440,8 +5437,9 @@ ], "rules": [ { - "if": "(($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/)) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", - "when": "on_success" + "allow_failure": true, + "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)", + "when": "manual" } ], "script": [ @@ -5457,11 +5455,13 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "BUILD_FLAVOUR": "validate+thread_sanitizer_cmm", "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", + "HADRIAN_ARGS": "--docs=none", "RUNTEST_ARGS": "", - "TEST_ENV": "x86_64-linux-deb12-validate+llvm" + "TEST_ENV": "x86_64-linux-deb12-validate+thread_sanitizer_cmm", + "TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions" } }, "x86_64-linux-fedora33-release": { ===================================== compiler/GHC/Cmm/ThreadSanitizer.hs ===================================== @@ -184,7 +184,7 @@ saveRestoreCallerRegs us platform = restore = blockFromList restore_nodes -- | Mirrors __tsan_memory_order --- +-- memoryOrderToTsanMemoryOrder :: Env -> MemoryOrdering -> CmmExpr memoryOrderToTsanMemoryOrder env mord = mkIntExpr (platform env) n @@ -294,4 +294,3 @@ tsanAtomicRMW env mord op w addr val dest = AMO_Or -> "fetch_or" AMO_Xor -> "fetch_xor" fn = fsLit $ "__tsan_atomic" ++ show (widthInBits w) ++ "_" ++ op' - ===================================== rts/TSANUtils.c ===================================== @@ -2,7 +2,7 @@ #if defined(TSAN_ENABLED) -uint64_t ghc_tsan_atomic64_compare_exchange(uint64_t *ptr, uint64_t expected, uint64_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic64 ghc_tsan_atomic64_compare_exchange(volatile __tsan_atomic64 *ptr, __tsan_atomic64 expected, __tsan_atomic64 new_value, int success_memorder, int failure_memorder) { __tsan_atomic64_compare_exchange_strong( ptr, &expected, new_value, @@ -10,7 +10,7 @@ uint64_t ghc_tsan_atomic64_compare_exchange(uint64_t *ptr, uint64_t expected, ui return expected; } -uint32_t ghc_tsan_atomic32_compare_exchange(uint32_t *ptr, uint32_t expected, uint32_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic32 ghc_tsan_atomic32_compare_exchange(volatile __tsan_atomic32 *ptr, __tsan_atomic32 expected, __tsan_atomic32 new_value, int success_memorder, int failure_memorder) { __tsan_atomic32_compare_exchange_strong( ptr, &expected, new_value, @@ -18,7 +18,7 @@ uint32_t ghc_tsan_atomic32_compare_exchange(uint32_t *ptr, uint32_t expected, ui return expected; } -uint16_t ghc_tsan_atomic16_compare_exchange(uint16_t *ptr, uint16_t expected, uint16_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic16 ghc_tsan_atomic16_compare_exchange(volatile __tsan_atomic16 *ptr, __tsan_atomic16 expected, __tsan_atomic16 new_value, int success_memorder, int failure_memorder) { __tsan_atomic16_compare_exchange_strong( ptr, &expected, new_value, @@ -26,7 +26,7 @@ uint16_t ghc_tsan_atomic16_compare_exchange(uint16_t *ptr, uint16_t expected, ui return expected; } -uint8_t ghc_tsan_atomic8_compare_exchange(uint8_t *ptr, uint8_t expected, uint8_t new_value, int success_memorder, int failure_memorder) +__tsan_atomic8 ghc_tsan_atomic8_compare_exchange(volatile __tsan_atomic8 *ptr, __tsan_atomic8 expected, __tsan_atomic8 new_value, int success_memorder, int failure_memorder) { __tsan_atomic8_compare_exchange_strong( ptr, &expected, new_value, ===================================== rts/include/rts/TSANUtils.h ===================================== @@ -98,10 +98,18 @@ void AnnotateBenignRaceSized(const char *file, #define TSAN_ANNOTATE_BENIGN_RACE(addr,desc) \ TSAN_ANNOTATE_BENIGN_RACE_SIZED((void*)(addr), sizeof(*addr), desc) +#if defined(TSAN_ENABLED) && defined(__clang__) +#include +#else +typedef char __tsan_atomic8; +typedef short __tsan_atomic16; +typedef int __tsan_atomic32; +typedef long __tsan_atomic64; +#endif -uint64_t ghc_tsan_atomic64_compare_exchange(uint64_t *ptr, uint64_t expected, uint64_t new_value, int success_memorder, int failure_memorder); -uint32_t ghc_tsan_atomic32_compare_exchange(uint32_t *ptr, uint32_t expected, uint32_t new_value, int success_memorder, int failure_memorder); -uint16_t ghc_tsan_atomic16_compare_exchange(uint16_t *ptr, uint16_t expected, uint16_t new_value, int success_memorder, int failure_memorder); -uint8_t ghc_tsan_atomic8_compare_exchange(uint8_t *ptr, uint8_t expected, uint8_t new_value, int success_memorder, int failure_memorder); +__tsan_atomic64 ghc_tsan_atomic64_compare_exchange(volatile __tsan_atomic64 *ptr, __tsan_atomic64 expected, __tsan_atomic64 new_value, int success_memorder, int failure_memorder); +__tsan_atomic32 ghc_tsan_atomic32_compare_exchange(volatile __tsan_atomic32 *ptr, __tsan_atomic32 expected, __tsan_atomic32 new_value, int success_memorder, int failure_memorder); +__tsan_atomic16 ghc_tsan_atomic16_compare_exchange(volatile __tsan_atomic16 *ptr, __tsan_atomic16 expected, __tsan_atomic16 new_value, int success_memorder, int failure_memorder); +__tsan_atomic8 ghc_tsan_atomic8_compare_exchange(volatile __tsan_atomic8 *ptr, __tsan_atomic8 expected, __tsan_atomic8 new_value, int success_memorder, int failure_memorder); #endif ===================================== rts/include/stg/SMP.h ===================================== @@ -549,12 +549,14 @@ busy_wait_nop(void) #define SEQ_CST_FENCE() __atomic_thread_fence(__ATOMIC_SEQ_CST) #if defined(TSAN_ENABLED) +#if !defined(__clang__) #undef ACQUIRE_FENCE #undef RELEASE_FENCE #undef SEQ_CST_FENCE #define ACQUIRE_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_ACQUIRE);) #define RELEASE_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_RELEASE);) #define SEQ_CST_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_SEQ_CST);) +#endif #define ACQUIRE_FENCE_ON(x) (void)ACQUIRE_LOAD(x) #else #define ACQUIRE_FENCE_ON(x) __atomic_thread_fence(__ATOMIC_ACQUIRE) ===================================== rts/rts.cabal ===================================== @@ -184,7 +184,6 @@ library if flag(thread-sanitizer) cc-options: -fsanitize=thread ld-options: -fsanitize=thread - extra-libraries: tsan if os(linux) -- the RTS depends upon libc. while this dependency is generally View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/657d2870457ffff6fbac82588c0ac603cdc0f8e6...ca80d93d9cec0d6d423cbf1ba1e21b67516a1490 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/657d2870457ffff6fbac82588c0ac603cdc0f8e6...ca80d93d9cec0d6d423cbf1ba1e21b67516a1490 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 18:59:18 2024 From: gitlab at gitlab.haskell.org (Ben Orchard (@raehik)) Date: Tue, 12 Mar 2024 14:59:18 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/raehik/primop-array-mutability-docs Message-ID: <65f0a6064f215_16f2144e0c1a442016@gitlab.mail> Ben Orchard pushed new branch wip/raehik/primop-array-mutability-docs at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/raehik/primop-array-mutability-docs You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 20:36:04 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 12 Mar 2024 16:36:04 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: Remove duplicate code normalising slashes Message-ID: <65f0bcb4fabd_16f214773f60c500d7@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 8a39431d by Brandon Chinn at 2024-03-12T16:35:47-04:00 Remove duplicate code normalising slashes - - - - - 607b493f by Brandon Chinn at 2024-03-12T16:35:47-04:00 Simplify regexes with raw strings - - - - - 7aab64a3 by Brandon Chinn at 2024-03-12T16:35:47-04:00 Don't normalize backslashes in characters - - - - - 56dbd6c9 by Andrei Borzenkov at 2024-03-12T16:35:48-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 3d6fecd6 by Cheng Shao at 2024-03-12T16:35:50-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - 5a999d85 by Cheng Shao at 2024-03-12T16:35:50-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 18 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Unique/Supply.hs - compiler/cbits/genSym.c - testsuite/driver/testlib.py - testsuite/tests/parser/should_fail/T21843a.stderr - testsuite/tests/parser/should_fail/T21843b.stderr - testsuite/tests/parser/should_fail/T21843c.stderr - testsuite/tests/parser/should_fail/T21843d.stderr - testsuite/tests/parser/should_fail/T21843e.stderr - testsuite/tests/parser/should_fail/T21843f.stderr - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== compiler/GHC/Types/Unique/Supply.hs ===================================== @@ -7,7 +7,6 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE UnboxedTuples #-} -{-# LANGUAGE UnliftedFFITypes #-} module GHC.Types.Unique.Supply ( -- * Main data type @@ -49,16 +48,16 @@ import Foreign.Storable #define NO_FETCH_ADD #endif -#if defined(javascript_HOST_ARCH) -import GHC.Exts ( atomicCasWord64Addr#, eqWord64# ) -#elif !defined(NO_FETCH_ADD) -import GHC.Exts( fetchAddWordAddr#, word64ToWord#, wordToWord64# ) +#if defined(NO_FETCH_ADD) +import GHC.Exts ( atomicCasWord64Addr#, eqWord64#, readWord64OffAddr# ) +#else +import GHC.Exts( fetchAddWordAddr#, word64ToWord# ) #endif import GHC.Exts ( Addr#, State#, Word64#, RealWorld ) - +import GHC.Int ( Int(..) ) import GHC.Word( Word64(..) ) -import GHC.Exts( plusWord64#, readWord64OffAddr# ) +import GHC.Exts( plusWord64#, int2Word#, wordToWord64# ) {- ************************************************************************ @@ -233,8 +232,9 @@ mkSplitUniqSupply c (# s4, MkSplitUniqSupply (tag .|. u) x y #) }}}} -#if defined(javascript_HOST_ARCH) --- CAS-based pure Haskell implementation +#if defined(NO_FETCH_ADD) +-- GHC currently does not provide this operation on 32-bit platforms, +-- hence the CAS-based implementation. fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# = go @@ -246,35 +246,7 @@ fetchAddWord64Addr# = go (# s2, res #) | 1# <- res `eqWord64#` n0 -> (# s2, n0 #) | otherwise -> go ptr inc s2 - -#elif defined(NO_FETCH_ADD) - --- atomic_inc64 is defined in compiler/cbits/genSym.c. This is of --- course not ideal, but we need to live with it for now given the --- current situation: --- 1. There's no Haskell primop fetchAddWord64Addr# on 32-bit --- platforms yet --- 2. The Cmm %fetch_add64 primop syntax is only present in ghc 9.8 --- but we currently bootstrap from older ghc in our CI --- 3. The Cmm MO_AtomicRMW operation with 64-bit width is well --- supported on 32-bit platforms already, but the plumbing from --- either Haskell or Cmm doesn't work yet because of 1 or 2 --- 4. There's hs_atomic_add64 in ghc-prim cbits that we ought to use, --- but it's only available on 32-bit starting from ghc 9.8 --- 5. The pure Haskell implementation causes mysterious i386 --- regression in unrelated ghc work that can only be fixed by the C --- version here - -foreign import ccall unsafe "atomic_inc64" atomic_inc64 :: Addr# -> Word64# -> IO Word64 - -fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld - -> (# State# RealWorld, Word64# #) -fetchAddWord64Addr# addr inc s0 = - case unIO (atomic_inc64 addr inc) s0 of - (# s1, W64# res #) -> (# s1, res #) - #else - fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# addr inc s0 = @@ -286,9 +258,9 @@ genSym :: IO Word64 genSym = do let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1 let !(Ptr counter) = ghc_unique_counter64 - let !(Ptr inc_ptr) = ghc_unique_inc - u <- IO $ \s0 -> case readWord64OffAddr# inc_ptr 0# s0 of - (# s1, inc #) -> case fetchAddWord64Addr# counter inc s1 of + I# inc# <- peek ghc_unique_inc + let !inc = wordToWord64# (int2Word# inc#) + u <- IO $ \s1 -> case fetchAddWord64Addr# counter inc s1 of (# s2, val #) -> let !u = W64# (val `plusWord64#` inc) .&. mask in (# s2, u #) ===================================== compiler/cbits/genSym.c ===================================== @@ -15,11 +15,3 @@ HsWord64 ghc_unique_counter64 = 0; #if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) HsInt ghc_unique_inc = 1; #endif - -// Only used on 32-bit non-JS platforms -#if WORD_SIZE_IN_BITS != 64 -StgWord64 atomic_inc64(StgWord64 volatile* p, StgWord64 incr) -{ - return __atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST); -} -#endif ===================================== testsuite/driver/testlib.py ===================================== @@ -1119,8 +1119,8 @@ def normalise_win32_io_errors(name, opts): def normalise_version_( *pkgs ): def normalise_version__( str ): # (name)(-version)(-hash)(-components) - return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-zA-Z\+]+)?(-[0-9a-zA-Z]+)?', - '\\1--', str) + return re.sub('(' + '|'.join(map(re.escape,pkgs)) + r')-[0-9.]+(-[0-9a-zA-Z+]+)?(-[0-9a-zA-Z]+)?', + r'\1--', str) return normalise_version__ def normalise_version( *pkgs ): @@ -1491,7 +1491,7 @@ async def do_test(name: TestName, if opts.expect not in ['pass', 'fail', 'missing-lib']: framework_fail(name, way, 'bad expected ' + opts.expect) - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) if way in opts.fragile_ways: if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail')) @@ -1538,7 +1538,7 @@ def override_options(pre_cmd): def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = '%s(%s)' % (name, way) if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) name2 = name if name is not None else TestName('none') @@ -1549,7 +1549,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str def framework_warn(name: TestName, way: WayName, reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = name + '(' + way + ')' if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) t.framework_warnings.append(TestResult(directory, name, reason, way)) @@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str: s = normalise_callstacks(s) s = normalise_type_reps(s) - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + # normalise slashes to minimise Windows/Unix filename differences, + # but don't normalize backslashes in chars + s = re.sub(r"(?!')\\", '/', s) # Normalize the name of the GHC executable. Specifically, # this catches the cases that: @@ -2614,14 +2615,11 @@ def normalise_errmsg(s: str) -> str: # the colon is there because it appears in error messages; this # hacky solution is used in place of more sophisticated filename # mangling - s = re.sub('([^\\s])\\.exe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) # Same thing for .wasm modules generated by the Wasm backend - s = re.sub('([^\\s])\\.wasm', '\\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) # Same thing for .jsexe directories generated by the JS backend - s = re.sub('([^\\s])\\.jsexe', '\\1', s) - - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) # hpc executable is given ghc suffix s = re.sub('hpc-ghc', 'hpc', s) @@ -2631,8 +2629,8 @@ def normalise_errmsg(s: str) -> str: s = re.sub('ghc-stage[123]', 'ghc', s) # Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools # (ghc, ghc-pkg, unlit, etc.) - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) - s = re.sub('\\w+(-\\w+)*-unlit', 'unlit', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-unlit', 'unlit', s) # On windows error messages can mention versioned executables s = re.sub('ghc-[0-9.]+', 'ghc', s) @@ -2735,8 +2733,8 @@ def normalise_prof (s: str) -> str: return s def normalise_slashes_( s: str ) -> str: - s = re.sub('\\\\', '/', s) - s = re.sub('//', '/', s) + s = re.sub(r'\\', '/', s) + s = re.sub(r'//', '/', s) return s def normalise_exe_( s: str ) -> str: @@ -2754,9 +2752,9 @@ def normalise_output( s: str ) -> str: # and .wasm extension (for the Wasm backend) # and .jsexe extension (for the JS backend) # This can occur in error messages generated by the program. - s = re.sub('([^\\s])\\.exe', '\\1', s) - s = re.sub('([^\\s])\\.wasm', '\\1', s) - s = re.sub('([^\\s])\\.jsexe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) s = normalise_callstacks(s) s = normalise_type_reps(s) # ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is @@ -2776,7 +2774,7 @@ def normalise_output( s: str ) -> str: s = re.sub('.*warning: argument unused during compilation:.*\n', '', s) # strip the cross prefix if any - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) return s ===================================== testsuite/tests/parser/should_fail/T21843a.stderr ===================================== @@ -1,4 +1,4 @@ T21843a.hs:3:13: [GHC-31623] - Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not + Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843b.stderr ===================================== @@ -1,3 +1,3 @@ T21843b.hs:3:11: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843c.stderr ===================================== @@ -1,6 +1,6 @@ T21843c.hs:3:19: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not T21843c.hs:3:20: [GHC-21231] - lexical error in string/character literal at character '/n' + lexical error in string/character literal at character '\n' ===================================== testsuite/tests/parser/should_fail/T21843d.stderr ===================================== @@ -1,3 +1,3 @@ T21843d.hs:3:13: [GHC-31623] - Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not + Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843e.stderr ===================================== @@ -1,3 +1,3 @@ T21843e.hs:3:15: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843f.stderr ===================================== @@ -1,3 +1,3 @@ T21843f.hs:3:13: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accommodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/83d82da64b304381e856bb43e2d453501ca9d908...5a999d85560752ad7d66159a70ef1b9e7cff4c41 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/83d82da64b304381e856bb43e2d453501ca9d908...5a999d85560752ad7d66159a70ef1b9e7cff4c41 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 22:01:29 2024 From: gitlab at gitlab.haskell.org (Sebastian Graf (@sgraf812)) Date: Tue, 12 Mar 2024 18:01:29 -0400 Subject: [Git][ghc/ghc][wip/or-pats] 491 commits: Teach tag-inference about SeqOp/seq# Message-ID: <65f0d0b95a0b8_16f2149e718c45949@gitlab.mail> Sebastian Graf pushed to branch wip/or-pats at Glasgow Haskell Compiler / GHC Commits: 9bc5cb92 by Matthew Craven at 2023-10-28T07:06:17-04:00 Teach tag-inference about SeqOp/seq# Fixes the STG/tag-inference analogue of #15226. Co-Authored-By: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - 34f06334 by Moritz Angermann at 2023-10-28T07:06:53-04:00 [PEi386] Mask SYM_TYPE_DUP_DISCARD in makeSymbolExtra 48e391952c17ff7eab10b0b1456e3f2a2af28a9b introduced `SYM_TYPE_DUP_DISCARD` to the bitfield. The linker however, failed to mask the `SYM_TYPE_DUP_DISCARD` value. Thus `== SYM_TYPE_CODE` comparisons easily failed. This lead to us relocating DATA lookups (GOT) into E8 (call) and E9 (jump) instructions. - - - - - 5b51b2a2 by Mario Blažević at 2023-10-28T07:07:33-04:00 Fix and test for issue #24111, TH.Ppr output of pattern synonyms - - - - - 723bc352 by Alan Zimmerman at 2023-10-30T20:36:41-04:00 EPA: print doc comments as normal comments And ignore the ones allocated in haddock processing. It does not guarantee that every original haddock-like comment appears in the output, as it discards ones that have no legal attachment point. closes #23459 - - - - - 21b76843 by Simon Peyton Jones at 2023-10-30T20:37:17-04:00 Fix non-termination bug in equality solver constraint left-to-right then right to left, forever. Easily fixed. - - - - - 270867ac by Sebastian Graf at 2023-10-30T20:37:52-04:00 ghc-toolchain: build with `-package-env=-` (#24131) Otherwise globally installed libraries (via `cabal install --lib`) break the build. Fixes #24131. - - - - - 7a90020f by Krzysztof Gogolewski at 2023-10-31T20:03:37-04:00 docs: fix ScopedTypeVariables example (#24101) The previous example didn't compile. Furthermore, it wasn't demonstrating the point properly. I have changed it to an example which shows that 'a' in the signature must be the same 'a' as in the instance head. - - - - - 49f69f50 by Krzysztof Gogolewski at 2023-10-31T20:04:13-04:00 Fix pretty-printing of type family dependencies "where" should be after the injectivity annotation. - - - - - 73c191c0 by Ben Gamari at 2023-10-31T20:04:49-04:00 gitlab-ci: Bump LLVM bootstrap jobs to Debian 12 As the Debian 10 images have too old an LLVM. Addresses #24056. - - - - - 5b0392e0 by Matthew Pickering at 2023-10-31T20:04:49-04:00 ci: Run aarch64 llvm backend job with "LLVM backend" label This brings it into line with the x86 LLVM backend job. - - - - - 9f9c9227 by Ryan Scott at 2023-11-01T09:19:12-04:00 More robust checking for DataKinds As observed in #22141, GHC was not doing its due diligence in catching code that should require `DataKinds` in order to use. Most notably, it was allowing the use of arbitrary data types in kind contexts without `DataKinds`, e.g., ```hs data Vector :: Nat -> Type -> Type where ``` This patch revamps how GHC tracks `DataKinds`. The full specification is written out in the `DataKinds` section of the GHC User's Guide, and the implementation thereof is described in `Note [Checking for DataKinds]` in `GHC.Tc.Validity`. In brief: * We catch _type_-level `DataKinds` violations in the renamer. See `checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in `GHC.Rename.Pat`. * We catch _kind_-level `DataKinds` violations in the typechecker, as this allows us to catch things that appear beneath type synonyms. (We do *not* want to do this in type-level contexts, as it is perfectly fine for a type synonym to mention something that requires DataKinds while still using the type synonym in a module that doesn't enable DataKinds.) See `checkValidType` in `GHC.Tc.Validity`. * There is now a single `TcRnDataKindsError` that classifies all manner of `DataKinds` violations, both in the renamer and the typechecker. The `NoDataKindsDC` error has been removed, as it has been subsumed by `TcRnDataKindsError`. * I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit uses of data types at the kind level without `DataKinds`. Previously, `isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`. Moreover, it thwarted the implementation of the `DataKinds` check in `checkValidType`, since we would expand `Constraint` (which was OK without `DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and reject it. Now both are allowed. * I have added a flurry of additional test cases that test various corners of `DataKinds` checking. Fixes #22141. - - - - - 575d7690 by Sylvain Henry at 2023-11-01T09:19:53-04:00 JS: fix FFI "wrapper" and "dynamic" Fix codegen and helper functions for "wrapper" and "dynamic" foreign imports. Fix tests: - ffi006 - ffi011 - T2469 - T4038 Related to #22363 - - - - - 81fb8885 by Alan Zimmerman at 2023-11-01T22:23:56-04:00 EPA: Use full range for Anchor This change requires a series of related changes, which must all land at the same time, otherwise all the EPA tests break. * Use the current Anchor end as prior end Use the original anchor location end as the source of truth for calculating print deltas. This allows original spacing to apply in most cases, only changed AST items need initial delta positions. * Add DArrow to TrailingAnn * EPA Introduce HasTrailing in ExactPrint Use [TrailingAnn] in enterAnn and remove it from ExactPrint (LocatedN RdrName) * In HsDo, put TrailingAnns at top of LastStmt * EPA: do not convert comments to deltas when balancing. * EPA: deal with fallout from getMonoBind * EPA fix captureLineSpacing * EPA print any comments in the span before exiting it * EPA: Add comments to AnchorOperation * EPA: remove AnnEofComment, it is no longer used Updates Haddock submodule - - - - - 03e82511 by Rodrigo Mesquita at 2023-11-01T22:24:32-04:00 Fix in docs regarding SSymbol, SNat, SChar (#24119) - - - - - 362cc693 by Matthew Pickering at 2023-11-01T22:25:08-04:00 hadrian: Update bootstrap plans (9.4.6, 9.4.7, 9.6.2, 9.6.3, 9.8.1) Updating the bootstrap plans with more recent GHC versions. - - - - - 00b9b8d3 by Matthew Pickering at 2023-11-01T22:25:08-04:00 ci: Add 9.8.1 bootstrap testing job - - - - - ef3d20f8 by Matthew Pickering at 2023-11-01T22:25:08-04:00 Compatibility with 9.8.1 as boot compiler This fixes several compatability issues when using 9.8.1 as the boot compiler. * An incorrect version guard on the stack decoding logic in ghc-heap * Some ghc-prim bounds need relaxing * ghc is no longer wired in, so we have to remove the -this-unit-id ghc call. Fixes #24077 - - - - - 6755d833 by Jaro Reinders at 2023-11-03T10:54:42+01:00 Add NCG support for common 64bit operations to the x86 backend. These used to be implemented via C calls which was obviously quite bad for performance for operations like simple addition. Co-authored-by: Andreas Klebinger - - - - - 0dfb1fa7 by Vladislav Zavialov at 2023-11-03T14:08:41-04:00 T2T in Expressions (#23738) This patch implements the T2T (term-to-type) transformation in expressions. Given a function with a required type argument vfun :: forall a -> ... the user can now call it as vfun (Maybe Int) instead of vfun (type (Maybe Int)) The Maybe Int argument is parsed and renamed as a term (HsExpr), but then undergoes a conversion to a type (HsType). See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs and Note [RequiredTypeArguments and the T2T mapping] Left as future work: checking for puns. - - - - - cc1c7c54 by Duncan Coutts at 2023-11-05T00:23:44-04:00 Add a test for I/O managers It tries to cover the cases of multiple threads waiting on the same fd for reading and multiple threads waiting for writing, including wait cancellation by async exceptions. It should work for any I/O manager, in-RTS or in-Haskell. Unfortunately it will not currently work for Windows because it relies on anonymous unix sockets. It could in principle be ported to use Windows named pipes. - - - - - 2e448f98 by Cheng Shao at 2023-11-05T00:23:44-04:00 Skip the IOManager test on wasm32 arch. The test relies on the sockets API which are not (yet) available. - - - - - fe50eb35 by Cheng Shao at 2023-11-05T00:24:20-04:00 compiler: fix eager blackhole symbol in wasm32 NCG - - - - - af771148 by Cheng Shao at 2023-11-05T00:24:20-04:00 testsuite: fix optasm tests for wasm32 - - - - - 1b90735c by Matthew Pickering at 2023-11-05T00:24:20-04:00 testsuite: Add wasm32 to testsuite arches with NCG The compiler --info reports that wasm32 compilers have a NCG, so we should agree with that here. - - - - - db9a6496 by Alan Zimmerman at 2023-11-05T00:24:55-04:00 EPA: make locA a function, not a field name And use it to generalise reLoc The following for the windows pipeline one. 5.5% Metric Increase: T5205 - - - - - 833e250c by Simon Peyton Jones at 2023-11-05T00:25:31-04:00 Update the unification count in wrapUnifierX Omitting this caused type inference to fail in #24146. This was an accidental omision in my refactoring of the equality solver. - - - - - e451139f by Andreas Klebinger at 2023-11-05T00:26:07-04:00 Remove an accidental git conflict marker from a comment. - - - - - 30baac7a by Tobias Haslop at 2023-11-06T10:50:32+00:00 Add laws relating between Foldable/Traversable with their Bi- superclasses See https://github.com/haskell/core-libraries-committee/issues/205 for discussion. This commit also documents that the tuple instances only satisfy the laws up to lazyness, similar to the documentation added in !9512. - - - - - df626f00 by Tobias Haslop at 2023-11-07T02:20:37-05:00 Elaborate on the quantified superclass of Bifunctor This was requested in the comment https://github.com/haskell/core-libraries-committee/issues/93#issuecomment-1597271700 for when Traversable becomes a superclass of Bitraversable, but similarly applies to Functor/Bifunctor, which already are in a superclass relationship. - - - - - 8217acb8 by Alan Zimmerman at 2023-11-07T02:21:12-05:00 EPA: get rid of l2l and friends Replace them with l2l to convert the location la2la to convert a GenLocated thing Updates haddock submodule - - - - - dd88a260 by Luite Stegeman at 2023-11-07T02:21:53-05:00 JS: remove broken newIdents from JStg Monad GHC.JS.JStg.Monad.newIdents was broken, resulting in duplicate identifiers being generated in h$c1, h$c2, ... . This change removes the broken newIdents. - - - - - 455524a2 by Matthew Craven at 2023-11-09T08:41:59-05:00 Create specially-solved DataToTag class Closes #20532. This implements CLC proposal 104: https://github.com/haskell/core-libraries-committee/issues/104 The design is explained in Note [DataToTag overview] in GHC.Tc.Instance.Class. This replaces the existing `dataToTag#` primop. These metric changes are not "real"; they represent Unique-related flukes triggering on a different set of jobs than they did previously. See also #19414. Metric Decrease: T13386 T8095 Metric Increase: T13386 T8095 Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com> - - - - - a05f4554 by Alan Zimmerman at 2023-11-09T08:42:35-05:00 EPA: get rid of glRR and friends in GHC/Parser.y With the HasLoc and HasAnnotation classes, we can replace a number of type-specific helper functions in the parser with polymorphic ones instead Metric Decrease: MultiLayerModulesTH_Make - - - - - 18498538 by Cheng Shao at 2023-11-09T16:58:12+00:00 ci: bump ci-images for wasi-sdk upgrade - - - - - 52c0fc69 by PHO at 2023-11-09T19:16:22-05:00 Don't assume the current locale is *.UTF-8, set the encoding explicitly primops.txt contains Unicode characters: > LC_ALL=C ./genprimopcode --data-decl < ./primops.txt > genprimopcode: <stdin>: hGetContents: invalid argument (cannot decode byte sequence starting from 226) Hadrian must also avoid using readFile' to read primops.txt because it tries to decode the file with a locale-specific encoding. - - - - - 7233b3b1 by PHO at 2023-11-09T19:17:01-05:00 Use '[' instead of '[[' because the latter is a Bash-ism It doesn't work on platforms where /bin/sh is something other than Bash. - - - - - 6dbab180 by Simon Peyton Jones at 2023-11-09T19:17:36-05:00 Add an extra check in kcCheckDeclHeader_sig Fix #24083 by checking for a implicitly-scoped type variable that is not actually bound. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType For some reason, on aarch64-darwin we saw a 2.8% decrease in compiler allocations for MultiLayerModulesTH_Make; but 0.0% on other architectures. Metric Decrease: MultiLayerModulesTH_Make - - - - - 22551364 by Sven Tennie at 2023-11-11T06:35:22-05:00 AArch64: Delete unused LDATA pseudo-instruction Though there were consuming functions for LDATA, there were no producers. Thus, the removed code was "dead". - - - - - 2a0ec8eb by Alan Zimmerman at 2023-11-11T06:35:59-05:00 EPA: harmonise acsa and acsA in GHC/Parser.y With the HasLoc class, we can remove the acsa helper function, using acsA instead. - - - - - 7ae517a0 by Teo Camarasu at 2023-11-12T08:04:12-05:00 nofib: bump submodule This includes changes that: - fix building a benchmark with HEAD - remove a Makefile-ism that causes errors in bash scripts Resolves #24178 - - - - - 3f0036ec by Alan Zimmerman at 2023-11-12T08:04:47-05:00 EPA: Replace Anchor with EpaLocation An Anchor has a location and an operation, which is either that it is unchanged or that it has moved with a DeltaPos data Anchor = Anchor { anchor :: RealSrcSpan , anchor_op :: AnchorOperation } An EpaLocation also has either a location or a DeltaPos data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan) | EpaDelta !DeltaPos ![LEpaComment] Now that we do not care about always having a location in the anchor, we remove Anchor and replace it with EpaLocation We do this with a type alias initially, to ease the transition. The alias will be removed in time. We also have helpers to reconstruct the AnchorOperation from an EpaLocation. This is also temporary. Updates Haddock submodule - - - - - a7492048 by Alan Zimmerman at 2023-11-12T13:43:07+00:00 EPA: get rid of AnchorOperation Now that the Anchor type is an alias for EpaLocation, remove AnchorOperation. Updates haddock submodule - - - - - 0745c34d by Andrew Lelechenko at 2023-11-13T16:25:07-05:00 Add since annotation for showHFloat - - - - - e98051a5 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 Suppress duplicate librares linker warning of new macOS linker Fixes #24167 XCode 15 introduced a new linker which warns on duplicate libraries being linked. To disable this warning, we pass -Wl,-no_warn_duplicate_libraries as suggested by Brad King in CMake issue #25297. This flag isn't necessarily available to other linkers on darwin, so we must only configure it into the CC linker arguments if valid. - - - - - c411c431 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Encoding test witnesses recent iconv bug is fragile A regression in the new iconv() distributed with XCode 15 and MacOS Sonoma causes the test 'encoding004' to fail in the CP936 roundrip. We mark this test as fragile until this is fixed upstream (rather than broken, since previous versions of iconv pass the test) See #24161 - - - - - ce7fe5a9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Update to LC_ALL=C no longer being ignored in darwin MacOS seems to have fixed an issue where it used to ignore the variable `LC_ALL` in program invocations and default to using Unicode. Since the behaviour seems to be fixed to account for the locale variable, we mark tests that were previously broken in spite of it as fragile (since they now pass in recent macOS distributions) See #24161 - - - - - e6c803f7 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 darwin: Fix single_module is obsolete warning In XCode 15's linker, -single_module is the default and otherwise passing it as a flag results in a warning being raised: ld: warning: -single_module is obsolete This patch fixes this warning by, at configure time, determining whether the linker supports -single_module (which is likely false for all non-darwin linkers, and true for darwin linkers in previous versions of macOS), and using that information at runtime to decide to pass or not the flag in the invocation. Fixes #24168 - - - - - 929ba2f9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 testsuite: Skip MultiLayerModulesTH_Make on darwin The recent toolchain upgrade on darwin machines resulted in the MultiLayerModulesTH_Make test metrics varying too much from the baseline, ultimately blocking the CI pipelines. This commit skips the test on darwin to temporarily avoid failures due to the environment change in the runners. However, the metrics divergence is being investigated still (tracked in #24177) - - - - - af261ccd by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00 configure: check target (not build) understands -no_compact_unwind Previously, we were branching on whether the build system was darwin to shortcut this check, but we really want to branch on whether the target system (which is what we are configuring ld_prog for) is darwin. - - - - - 2125c176 by Luite Stegeman at 2023-11-15T13:19:38-05:00 JS: Fix missing variable declarations The JStg IR update was missing some local variable declarations that were present earlier, causing global variables to be used implicitly (or an error in JavaScript strict mode). This adds the local variable declarations again. - - - - - 99ced73b by Krzysztof Gogolewski at 2023-11-15T13:20:14-05:00 Remove loopy superclass solve mechanism Programs with a -Wloopy-superclass-solve warning will now fail with an error. Fixes #23017 - - - - - 2aff2361 by Zubin Duggal at 2023-11-15T13:20:50-05:00 users-guide: Fix links to libraries from the users-guide. The unit-ids generated in c1a3ecde720b3bddc2c8616daaa06ee324e602ab include the package name, so we don't need to explicitly add it to the links. Fixes #24151 - - - - - 27981fac by Alan Zimmerman at 2023-11-15T13:21:25-05:00 EPA: splitLHsForAllTyInvis does not return ann We did not use the annotations returned from splitLHsForAllTyInvis, so do not return them. - - - - - a6467834 by Krzysztof Gogolewski at 2023-11-15T22:22:59-05:00 Document defaulting of RuntimeReps Fixes #24099 - - - - - 2776920e by Simon Peyton Jones at 2023-11-15T22:23:35-05:00 Second fix to #24083 My earlier fix turns out to be too aggressive for data/type families See wrinkle (DTV1) in Note [Disconnected type variables] - - - - - cee81370 by Sylvain Henry at 2023-11-16T09:57:46-05:00 Fix unusable units and module reexport interaction (#21097) This commit fixes an issue with ModUnusable introduced in df0f148feae. In mkUnusableModuleNameProvidersMap we traverse the list of unusable units and generate ModUnusable origin for all the modules they contain: exposed modules, hidden modules, and also re-exported modules. To do this we have a two-level map: ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin So for each module name "M" in broken unit "u" we have: "M" -> u:M -> ModUnusable reason However in the case of module reexports we were using the *target* module as a key. E.g. if "u:M" is a reexport for "X" from unit "o": "M" -> o:X -> ModUnusable reason Case 1: suppose a reexport without module renaming (u:M -> o:M) from unusable unit u: "M" -> o:M -> ModUnusable reason Here it's claiming that the import of M is unusable because a reexport from u is unusable. But if unit o isn't unusable we could also have in the map: "M" -> o:M -> ModOrigin ... Issue: the Semigroup instance of ModuleOrigin doesn't handle the case (ModUnusable <> ModOrigin) Case 2: similarly we could have 2 unusable units reexporting the same module without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v unusable. It gives: "M" -> o:M -> ModUnusable ... (for u) "M" -> o:M -> ModUnusable ... (for v) Issue: the Semigroup instance of ModuleOrigin doesn't handle the case (ModUnusable <> ModUnusable). This led to #21097, #16996, #11050. To fix this, in this commit we make ModUnusable track whether the module used as key is a reexport or not (for better error messages) and we use the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u is unusable, we now record: "M" -> u:M -> ModUnusable reason reexported=True So now, we have two cases for a reexport u:M -> o:X: - u unusable: "M" -> u:M -> ModUnusable ... reexported=True - u usable: "M" -> o:X -> ModOrigin ... reexportedFrom=u:M The second case is indexed with o:X because in this case the Semigroup instance of ModOrigin is used to combine valid expositions of a module (directly or via reexports). Note that module lookup functions select usable modules first (those who have a ModOrigin value), so it doesn't matter if we add new ModUnusable entries in the map like this: "M" -> { u:M -> ModUnusable ... reexported=True o:M -> ModOrigin ... } The ModOrigin one will be used. Only if there is no ModOrigin or ModHidden entry will the ModUnusable error be printed. See T21097 for an example printing several reasons why an import is unusable. - - - - - 3e606230 by Krzysztof Gogolewski at 2023-11-16T09:58:22-05:00 Fix IPE test A helper function was defined in a different module than used. To reproduce: ./hadrian/build test --test-root-dirs=testsuite/tests/rts/ipe - - - - - 49f5264b by Andreas Klebinger at 2023-11-16T20:52:11-05:00 Properly compute unpacked sizes for -funpack-small-strict-fields. Use rep size rather than rep count to compute the size. Fixes #22309 - - - - - b4f84e4b by James Henri Haydon at 2023-11-16T20:52:53-05:00 Explicit methods for Alternative Compose Explicitly define some and many in Alternative instance for Data.Functor.Compose Implementation of https://github.com/haskell/core-libraries-committee/issues/181 - - - - - 9bc0dd1f by Ignat Insarov at 2023-11-16T20:53:34-05:00 Add permutations for non-empty lists. Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837 - - - - - 5643ecf9 by Andrew Lelechenko at 2023-11-16T20:53:34-05:00 Update changelog and since annotations for Data.List.NonEmpty.permutations Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837 - - - - - 94ff2134 by Oleg Alexander at 2023-11-16T20:54:15-05:00 Update doc string for traceShow Updated doc string for traceShow. - - - - - faff671a by Luite Stegeman at 2023-11-17T14:12:51+01:00 JS: clean up some foreign imports - - - - - 856e0a4e by Sven Tennie at 2023-11-18T06:54:11-05:00 AArch64: Remove unused instructions As these aren't ever emitted, we don't even know if they work or will ever be used. If one of them is needed in future, we may easily re-add it. Deleted instructions are: - CMN - ANDS - BIC - BICS - EON - ORN - ROR - TST - STP - LDP - DMBSY - - - - - 615441ef by Alan Zimmerman at 2023-11-18T06:54:46-05:00 EPA: Replace Monoid with NoAnn Remove the final Monoid instances in the exact print infrastructure. For Windows CI Metric Decrease: T5205 - - - - - 5a6c49d4 by David Feuer at 2023-11-20T18:53:18-05:00 Speed up stimes in instance Semigroup Endo As discussed at https://github.com/haskell/core-libraries-committee/issues/4 - - - - - cf9da4b3 by Andrew Lelechenko at 2023-11-20T18:53:18-05:00 base: reflect latest changes in the changelog - - - - - 48bf364e by Alan Zimmerman at 2023-11-20T18:53:54-05:00 EPA: Use SrcSpan in EpaSpan This is more natural, since we already need to deal with invalid RealSrcSpans, and that is exactly what SrcSpan.UnhelpfulSpan is for. Updates haddock submodule. - - - - - 97ec37cc by Sebastian Graf at 2023-11-20T18:54:31-05:00 Add regression test for #6070 Fixes #6070. - - - - - e9d5ae41 by Owen Shepherd at 2023-11-21T18:32:23-05:00 chore: Correct typo in the gitlab MR template [skip ci] - - - - - f158a8d0 by Rodrigo Mesquita at 2023-11-21T18:32:59-05:00 Improve error message when reading invalid `.target` files A `.target` file generated by ghc-toolchain or by configure can become invalid if the target representation (`Toolchain.Target`) is changed while the files are not re-generated by calling `./configure` or `ghc-toolchain` again. There is also the issue of hadrian caching the dependencies on `.target` files, which makes parsing fail when reading reading the cached value if the representation has been updated. This patch provides a better error message in both situations, moving away from a terrible `Prelude.read: no parse` error that you would get otherwise. Fixes #24199 - - - - - 955520c6 by Ben Gamari at 2023-11-21T18:33:34-05:00 users guide: Note that QuantifiedConstraints implies ExplicitForAll Fixes #24025. - - - - - 17ec3e97 by Owen Shepherd at 2023-11-22T09:37:28+01:00 fix: Change type signatures in NonEmpty export comments to reflect reality This fixes several typos in the comments of Data.List.NonEmpty export list items. - - - - - 2fd78f9f by Samuel Thibault at 2023-11-22T11:49:13-05:00 Fix the platform string for GNU/Hurd As commited in Cargo https://github.com/haskell/cabal/pull/9434 there is confusion between "gnu" and "hurd". This got fixed in Cargo, we need the converse in Hadrian. Fixes #24180 - - - - - a79960fe by Alan Zimmerman at 2023-11-22T11:49:48-05:00 EPA: Tuple Present no longer has annotation The Present constructor for a Tuple argument will never have an exact print annotation. So make this impossible. - - - - - 121c9ab7 by David Binder at 2023-11-22T21:12:29-05:00 Unify the hpc testsuites The hpc testsuite was split between testsuite/tests/hpc and the submodule libraries/hpc/test. This commit unifies the two testsuites in the GHC repository in the directory testsuite/tests/hpc. - - - - - d2733a05 by Alan Zimmerman at 2023-11-22T21:13:05-05:00 EPA: empty tup_tail has noAnn In Parser.y, the tup_tail rule had the following option | {- empty -} %shift { return [Left noAnn] } Once this works through PostProcess.hs, it means we add an extra Missing constructor if the last item was a comma. Change the annotation type to a Bool to indicate this, and use the EpAnn Anchor for the print location for the others. - - - - - fa576eb8 by Andreas Klebinger at 2023-11-24T08:29:13-05:00 Fix FMA primops generating broken assembly on x86. `genFMA3Code` assumed that we had to take extra precations to avoid overwriting the result of `getNonClobberedReg`. One of these special cases caused a bug resulting in broken assembly. I believe we don't need to hadle these cases specially at all, which means this MR simply deletes the special cases to fix the bug. Fixes #24160 - - - - - 34d86315 by Alan Zimmerman at 2023-11-24T08:29:49-05:00 EPA: Remove parenthesizeHsType This is called from PostProcess.hs, and adds spurious parens. With the looser version of exact printing we had before we could tolerate this, as they would be swallowed by the original at the same place. But with the next change (remove EpAnnNotUsed) they result in duplicates in the output. For Darwin build: Metric Increase: MultiLayerModulesTH_OneShot - - - - - 3ede659d by Vladislav Zavialov at 2023-11-26T06:43:32-05:00 Add name for -Wdeprecated-type-abstractions (#24154) This warning had no name or flag and was triggered unconditionally. Now it is part of -Wcompat. - - - - - 7902ebf8 by Alan Zimmerman at 2023-11-26T06:44:08-05:00 EPA: Remove EpAnnNotUsed We no longer need the EpAnnNotUsed constructor for EpAnn, as we can represent an unused annotation with an anchor having a EpaDelta of zero, and empty comments and annotations. This simplifies code handling annotations considerably. Updates haddock submodule Metric Increase: parsing001 - - - - - 471b2672 by Mario Blažević at 2023-11-26T06:44:48-05:00 Bumped the upper bound of text to <2.2 - - - - - d1bf25c7 by Vladislav Zavialov at 2023-11-26T11:45:49-05:00 Term variable capture (#23740) This patch changes type variable lookup rules (lookupTypeOccRn) and implicit quantification rules (filterInScope) so that variables bound in the term namespace can be captured at the type level {-# LANGUAGE RequiredTypeArguments #-} f1 x = g1 @x -- `x` used in a type application f2 x = g2 (undefined :: x) -- `x` used in a type annotation f3 x = g3 (type x) -- `x` used in an embedded type f4 x = ... where g4 :: x -> x -- `x` used in a type signature g4 = ... This change alone does not allow us to accept examples shown above, but at least it gets them past the renamer. - - - - - da863d15 by Vladislav Zavialov at 2023-11-26T11:46:26-05:00 Update Note [hsScopedTvs and visible foralls] The Note was written before GHC gained support for visible forall in types of terms. Rewrite a few sentences and use a better example. - - - - - b5213542 by Matthew Pickering at 2023-11-27T12:53:59-05:00 testsuite: Add mechanism to collect generic metrics * Generalise the metric logic by adding an additional field which allows you to specify how to query for the actual value. Previously the method of querying the baseline value was abstracted (but always set to the same thing). * This requires rejigging how the stat collection works slightly but now it's more uniform and hopefully simpler. * Introduce some new "generic" helper functions for writing generic stats tests. - collect_size ( deviation, path ) Record the size of the file as a metric - stat_from_file ( metric, deviation, path ) Read a value from the given path, and store that as a metric - collect_generic_stat ( metric, deviation, get_stat) Provide your own `get_stat` function, `lambda way: <Int>`, which can be used to establish the current value of the metric. - collect_generic_stats ( metric_info ): Like collect_generic_stat but provide the whole dictionary of metric definitions. { metric: { deviation: <Int> current: lambda way: <Int> } } * Introduce two new "size" metrics for keeping track of build products. - `size_hello_obj` - The size of `hello.o` from compiling hello.hs - `libdir` - The total size of the `libdir` folder. * Track the number of modules in the AST tests - CountDepsAst - CountDepsParser This lays the infrastructure for #24191 #22256 #17129 - - - - - 7d9a2e44 by ARATA Mizuki at 2023-11-27T12:54:39-05:00 x86: Don't require -mavx2 when using 256-bit floating-point SIMD primitives Fixes #24222 - - - - - 4e5ff6a4 by Alan Zimmerman at 2023-11-27T12:55:15-05:00 EPA: Remove SrcSpanAnn Now that we only have a single constructor for EpAnn, And it uses a SrcSpan for its location, we can do away with SrcSpanAnn completely. It only existed to wrap the original SrcSpan in a location, and provide a place for the exact print annotation. For darwin only: Metric Increase: MultiLayerModulesTH_OneShot Updates haddock submodule - - - - - e05bca39 by Krzysztof Gogolewski at 2023-11-28T08:00:55-05:00 testsuite: don't initialize testdir to '.' The test directory is removed during cleanup, if there's an interrupt that could remove the entire repository. Fixes #24219 - - - - - af881674 by Alan Zimmerman at 2023-11-28T08:01:30-05:00 EPA: Clean up mkScope in Ast.hs Now that we have HasLoc we can get rid of all the custom variants of mkScope For deb10-numa Metric Increase: libdir - - - - - 292983c8 by Ben Gamari at 2023-11-28T22:44:28-05:00 distrib: Rediscover otool and install_name_tool on Darwin In the bindist configure script we must rediscover the `otool` and `install_name_tool`s since they may be different from the build environment. Fixes #24211. - - - - - dfe1c354 by Stefan Schulze Frielinghaus at 2023-11-28T22:45:04-05:00 llvmGen: Align objects in the data section Objects in the data section may be referenced via tagged pointers. Thus, align those objects to a 4- or 8-byte boundary for 32- or 64-bit platforms, respectively. Note, this may need to be reconsidered if objects with a greater natural alignment requirement are emitted as e.g. 128-bit atomics. Fixes #24163. - - - - - f6c486c3 by Matthew Pickering at 2023-11-29T11:08:13-05:00 metrics: Widen libdir and size_hello_obj acceptance window af8816740d9b8759be1a22af8adcb5f13edeb61d shows that the libdir size can fluctuate quite significantly even when the change is quite small. Therefore we widen the acceptance window to 10%. - - - - - 99a6a49c by Alan Zimmerman at 2023-11-29T11:08:49-05:00 EPA: Clean up TC Monad Utils We no longer need the alternative variant of addLocM (addLocMA) nor wrapLocAM, wrapLocSndMA. aarch64-darwin Metric Increase: MultiLayerModulesTH_OneShot deb10-numa-slow Metric Decrease: libdir - - - - - cbc03fa0 by Sebastian Graf at 2023-11-30T12:37:21-05:00 perf tests: Move comments into new `Note [Sensitivity to unique increment]` (#19414) And additionally to T12545, link from T8095, T13386 to this new Note. - - - - - c7623b22 by Alan Zimmerman at 2023-11-30T12:37:56-05:00 EPA: EpaDelta for comment has no comments EpaLocation is used to position things. It has two constructors, EpaSpan holding a SrcSpan, and EpaDelta with a delta position and a possible list of comments. The comment list is needed because the location in EpaDelta has no absolute information to decide which comments should be emitted before them when printing. But it is also used for specifying the position of a comment. To prevent the absurdity of a comment position having a list of comments in it, we make EpaLocation parameterisable, using comments for the normal case and a constant for within comments. Updates haddock submodule. aarch64-darwin Metric Decrease: MultiLayerModulesTH_OneShot - - - - - bd8acc0c by Krzysztof Gogolewski at 2023-11-30T12:38:32-05:00 Kind-check body of a required forall We now require that in 'forall a -> ty', ty has kind TYPE r for some r. Fixes #24176 - - - - - 010fb784 by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Remove incorrect haddock link quotes in code block - - - - - cda9c12d by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Remove cycle from group haddock example - - - - - 495265b9 by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Use repl haddock syntax in group docs - - - - - d134d1de by Owen Shepherd at 2023-12-03T00:10:09-05:00 docs(NonEmpty/group): Use list [] notation in group haddock - - - - - dfcf629c by Owen Shepherd at 2023-12-03T00:10:10-05:00 docs(NonEmpty/group): Specify final property of group function in haddock - - - - - cad3b734 by Owen Shepherd at 2023-12-03T00:10:10-05:00 fix: Add missing property of List.group - - - - - bad37656 by Matthew Pickering at 2023-12-03T00:10:46-05:00 testsuite: Fix T21097b test with make 4.1 (deb9) cee81370cd6ef256f66035e3116878d4cb82e28b recently added a test which failed on deb9 because the version of make was emitting the recipe failure to stdout rather than stderr. One way to fix this is to be more precise in the test about which part of the output we care about inspecting. - - - - - 5efdf421 by Matthew Pickering at 2023-12-03T00:11:21-05:00 testsuite: Track size of libdir in bytes For consistency it's better if we track all size metrics in bytes. Metric Increase: libdir - - - - - f5eb0f29 by Matthew Pickering at 2023-12-03T00:11:22-05:00 testsuite: Remove rogue trace in testsuite I accidentally left a trace in the generics metric patch. - - - - - d5610737 by Claudio Bley at 2023-12-06T16:13:33-05:00 Only exit ghci in -e mode when :add command fails Previously, when running `ghci -e ':add Sample.hs'` the process would exit with exit code 1 if the file exists and could be loaded. Fixes #24115 - - - - - 0f0c53a5 by Vladislav Zavialov at 2023-12-06T16:14:09-05:00 T2T in Patterns (#23739) This patch implements the T2T (term-to-type) transformation in patterns. Patterns that are checked against a visible forall can now be written without the `type` keyword: \(type t) (x :: t) -> ... -- old \t (x :: t) -> ... -- new The `t` binder is parsed and renamed as a term pattern (Pat), but then undergoes a conversion to a type pattern (HsTyPat). See the new function pat_to_type_pat in compiler/GHC/Tc/Gen/Pat.hs - - - - - 10a1a6c6 by Sebastian Graf at 2023-12-06T16:14:45-05:00 Pmc: Fix SrcLoc and warning for incomplete irrefutable pats (#24234) Before, the source location would point at the surrounding function definition, causing the confusion in #24234. I also took the opportunity to introduce a new `LazyPatCtx :: HsMatchContext _` to make the warning message say "irrefutable pattern" instead of "pattern binding". - - - - - 36b9a38c by Matthew Pickering at 2023-12-06T16:15:21-05:00 libraries: Bump filepath to 1.4.200.1 and unix to 2.8.4.0 Updates filepath submodule Updates unix submodule Fixes #24240 - - - - - 91ff0971 by Matthew Pickering at 2023-12-06T16:15:21-05:00 Submodule linter: Allow references to tags We modify the submodule linter so that if the bumped commit is a specific tag then the commit is accepted. Fixes #24241 - - - - - 86f652dc by Zubin Duggal at 2023-12-06T16:15:21-05:00 hadrian: set -Wno-deprecations for directory and Win32 The filepath bump to 1.4.200.1 introduces a deprecation warning. See https://gitlab.haskell.org/ghc/ghc/-/issues/24240 https://github.com/haskell/filepath/pull/206 - - - - - 7ac6006e by Sylvain Henry at 2023-12-06T16:16:02-05:00 Zap OccInfo on case binders during StgCse #14895 #24233 StgCse can revive dead binders: case foo of dead { Foo x y -> Foo x y; ... } ===> case foo of dead { Foo x y -> dead; ... } -- dead is no longer dead So we must zap occurrence information on case binders. Fix #14895 and #24233 - - - - - 57c391c4 by Sebastian Graf at 2023-12-06T16:16:37-05:00 Cpr: Turn an assertion into a check to deal with some dead code (#23862) See the new `Note [Dead code may contain type confusions]`. Fixes #23862. - - - - - c1c8abf8 by Zubin Duggal at 2023-12-08T02:25:07-05:00 testsuite: add test for #23944 - - - - - 6329d308 by Zubin Duggal at 2023-12-08T02:25:07-05:00 driver: Only run a dynamic-too pipeline if object files are going to be generated Otherwise we run into a panic in hscMaybeWriteIface: "Unexpected DT_Dyn state when writing simple interface" when dynamic-too is enabled We could remove the panic and just write the interface even if the state is `DT_Dyn`, but it seems pointless to run the pipeline twice when `hscMaybeWriteIface` is already designed to write both `hi` and `dyn_hi` files if dynamic-too is enabled. Fixes #23944. - - - - - 28811f88 by Simon Peyton Jones at 2023-12-08T05:47:18-05:00 Improve duplicate elimination in SpecConstr This partially fixes #24229. See the new Note [Pattern duplicate elimination] in SpecConstr - - - - - fec7894f by Simon Peyton Jones at 2023-12-08T05:47:18-05:00 Make SpecConstr deal with casts better This patch does two things, to fix #23209: * It improves SpecConstr so that it no longer quantifies over coercion variables. See Note [SpecConstr and casts] * It improves the rule matcher to deal nicely with the case where the rule does not quantify over coercion variables, but the the template has a cast in it. See Note [Casts in the template] - - - - - 8db8d2fd by Zubin Duggal at 2023-12-08T05:47:54-05:00 driver: Don't lose track of nodes when we fail to resolve cycles The nodes that take part in a cycle should include both hs-boot and hs files, but when we fail to resolve a cycle, we were only counting the nodes from the graph without boot files. Fixes #24196 - - - - - c5b4efd3 by Zubin Duggal at 2023-12-08T05:48:30-05:00 testsuite: Skip MultiLayerModulesTH_OneShot on darwin See #24177 - - - - - fae472a9 by Wendao Lee at 2023-12-08T05:49:12-05:00 docs(Data.Char):Add more detailed descriptions for some functions Related changed function's docs: -GHC.Unicode.isAlpha -GHC.Unicode.isPrint -GHC.Unicode.isAlphaNum Add more details for what the function will return. Co-authored-by: Bodigrim <andrew.lelechenko at gmail.com> - - - - - ca7510e4 by Malik Ammar Faisal at 2023-12-08T05:49:55-05:00 Fix float parsing in GHC Cmm Lexer Add test case for bug #24224 - - - - - d8baa1bd by Simon Peyton Jones at 2023-12-08T15:40:37+00:00 Take care when simplifying unfoldings This MR fixes a very subtle bug exposed by #24242. See Note [Environment for simplLetUnfolding]. I also updated a bunch of Notes on shadowing - - - - - 03ca551d by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Comments only in FloatIn Relevant to #3458 - - - - - 50c78779 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Comments only in SpecConstr - - - - - 9431e195 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00 Add test for #22238 - - - - - d9e4c597 by Vladislav Zavialov at 2023-12-11T04:19:34-05:00 Make forall a keyword (#23719) Before this change, GHC used to accept `forall` as a term-level identifier: -- from constraints-0.13 forall :: forall p. (forall a. Dict (p a)) -> Dict (Forall p) forall d = ... Now it is a parse error. The -Wforall-identifier warning has served its purpose and is now a deprecated no-op. - - - - - 58d56644 by Zubin Duggal at 2023-12-11T04:20:10-05:00 driver: Ensure we actually clear the interactive context before reloading Previously we called discardIC, but immediately after set the session back to an old HscEnv that still contained the IC Partially addresses #24107 Fixes #23405 - - - - - 8e5745a0 by Zubin Duggal at 2023-12-11T04:20:10-05:00 driver: Ensure we force the lookup of old build artifacts before returning the build plan This prevents us from retaining all previous build artifacts in memory until a recompile finishes, instead only retaining the exact artifacts we need. Fixes #24118 - - - - - 105c370c by Zubin Duggal at 2023-12-11T04:20:10-05:00 testsuite: add test for #24118 and #24107 MultiLayerModulesDefsGhci was not able to catch the leak because it uses :l which discards the previous environment. Using :r catches both of these leaks - - - - - e822ff88 by Zubin Duggal at 2023-12-11T04:20:10-05:00 compiler: Add some strictness annotations to ImportSpec and related constructors This prevents us from retaining entire HscEnvs. Force these ImportSpecs when forcing the GlobalRdrEltX Adds an NFData instance for Bag Fixes #24107 - - - - - 522c12a4 by Zubin Duggal at 2023-12-11T04:20:10-05:00 compiler: Force IfGlobalRdrEnv in NFData instance. - - - - - 188b280d by Arnaud Spiwack at 2023-12-11T15:33:31+01:00 LinearTypes => MonoLocalBinds - - - - - 8e0446df by Arnaud Spiwack at 2023-12-11T15:44:28+01:00 Linear let and where bindings For expediency, the initial implementation of linear types in GHC made it so that let and where binders would always be considered unrestricted. This was rather unpleasant, and probably a big obstacle to adoption. At any rate, this was not how the proposal was designed. This patch fixes this infelicity. It was surprisingly difficult to build, which explains, in part, why it took so long to materialise. As of this patch, let or where bindings marked with %1 will be linear (respectively %p for an arbitrary multiplicity p). Unmarked let will infer their multiplicity. Here is a prototypical example of program that used to be rejected and is accepted with this patch: ```haskell f :: A %1 -> B g :: B %1 -> C h :: A %1 -> C h x = g y where y = f x ``` Exceptions: - Recursive let are unrestricted, as there isn't a clear semantics of what a linear recursive binding would be. - Destructive lets with lazy bindings are unrestricted, as their desugaring isn't linear (see also #23461). - (Strict) destructive lets with inferred polymorphic type are unrestricted. Because the desugaring isn't linear (See #18461 down-thread). Closes #18461 and #18739 Co-authored-by: @jackohughes - - - - - effa7e2d by Matthew Craven at 2023-12-12T04:37:20-05:00 Introduce `dataToTagSmall#` primop (closes #21710) ...and use it to generate slightly better code when dataToTag# is used at a "small data type" where there is no need to mess with "is_too_big_tag" or potentially look at an info table. Metric Decrease: T18304 - - - - - 35c7aef6 by Matthew Craven at 2023-12-12T04:37:20-05:00 Fix formatting of Note [alg-alt heap check] - - - - - 7397c784 by Oleg Grenrus at 2023-12-12T04:37:56-05:00 Allow untyped brackets in typed splices and vice versa. Resolves #24190 Apparently the check was essentially always (as far as I can trace back: d0d47ba76f8f0501cf3c4966bc83966ab38cac27), and while it does catch some mismatches, the type-checker will catch them too. OTOH, it prevents writing completely reasonable programs. - - - - - a3ee3b99 by Moritz Angermann at 2023-12-12T19:50:58-05:00 Drop hard Xcode dependency XCODE_VERSION calls out to `xcodebuild`, which is only available when having `Xcode` installed. The CommandLineTools are not sufficient. To install Xcode, you must have an apple id to download the Xcode.xip from apple. We do not use xcodebuild anywhere in our build explicilty. At best it appears to be a proxy for checking the linker or the compiler. These should rather be done with ``` xcrun ld -version ``` or similar, and not by proxy through Xcode. The CLR should be sufficient for building software on macOS. - - - - - 1c9496e0 by Vladislav Zavialov at 2023-12-12T19:51:34-05:00 docs: update information on RequiredTypeArguments Update the User's Guide and Release Notes to account for the recent progress in the implementation of RequiredTypeArguments. - - - - - d0b17576 by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Fix off-by-one in assertion Previously we failed to account for the NULL terminator `postString` asserted that there is enough room in the buffer for the string. - - - - - a10f9b9b by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Honor result of ensureRoomForVariableEvent is Previously we would keep plugging along, even if isn't enough room for the event. - - - - - 0e0f41c0 by Ben Gamari at 2023-12-13T06:33:37-05:00 rts/eventlog: Avoid truncating event sizes Previously ensureRoomForVariableEvent would truncate the desired size to 16-bits, resulting in #24197. Fixes #24197. - - - - - 64e724c8 by Artin Ghasivand at 2023-12-13T06:34:20-05:00 Remove the "Derived Constraint" argument of TcPluginSolver, docs - - - - - fe6d97dd by Vladislav Zavialov at 2023-12-13T06:34:56-05:00 EPA: Move tokens into GhcPs extension fields (#23447) Summary of changes * Remove Language.Haskell.Syntax.Concrete * Move all tokens into GhcPs extension fields (LHsToken -> EpToken) * Create new TTG extension fields as needed * Drop the MultAnn wrapper Updates the haddock submodule. Co-authored-by: Alan Zimmerman <alan.zimm at gmail.com> - - - - - 8106e695 by Zubin Duggal at 2023-12-13T06:35:34-05:00 testsuite: use copy_files in T23405 This prevents the tree from being dirtied when the file is modified. - - - - - ed0e4099 by Bryan Richter at 2023-12-14T04:30:53-05:00 Document ghc package's PVP-noncompliance This changes nothing, it just makes the status quo explicit. - - - - - 8bef8d9f by Luite Stegeman at 2023-12-14T04:31:33-05:00 JS: Mark spurious CI failures js_fragile(24259) This marks the spurious test failures on the JS platform as js_fragile(24259), so we don't hold up merge requests while fixing the underlying issues. See #24259 - - - - - 1c79526a by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Late plugins - - - - - 000c3302 by Finley McIlwaine at 2023-12-15T12:24:40-08:00 withTiming on LateCCs and late plugins - - - - - be4551ac by Finley McIlwaine at 2023-12-15T12:24:40-08:00 add test for late plugins - - - - - 7c29da9f by Finley McIlwaine at 2023-12-15T12:24:40-08:00 Document late plugins - - - - - 9a52ae46 by Ben Gamari at 2023-12-20T07:07:26-05:00 Fix thunk update ordering Previously we attempted to ensure soundness of concurrent thunk update by synchronizing on the access of the thunk's info table pointer field. This was believed to be sufficient since the indirectee (which may expose a closure allocated by another core) would not be examined until the info table pointer update is complete. However, it turns out that this can result in data races in the presence of multiple threads racing a update a single thunk. For instance, consider this interleaving under the old scheme: Thread A Thread B --------- --------- t=0 Enter t 1 Push update frame 2 Begin evaluation 4 Pause thread 5 t.indirectee=tso 6 Release t.info=BLACKHOLE 7 ... (e.g. GC) 8 Resume thread 9 Finish evaluation 10 Relaxed t.indirectee=x 11 Load t.info 12 Acquire fence 13 Inspect t.indirectee 14 Release t.info=BLACKHOLE Here Thread A enters thunk `t` but is soon paused, resulting in `t` being lazily blackholed at t=6. Then, at t=10 Thread A finishes evaluation and updates `t.indirectee` with a relaxed store. Meanwhile, Thread B enters the blackhole. Under the old scheme this would introduce an acquire-fence but this would only synchronize with Thread A at t=6. Consequently, the result of the evaluation, `x`, is not visible to Thread B, introducing a data race. We fix this by treating the `indirectee` field as we do all other mutable fields. This means we must always access this field with acquire-loads and release-stores. See #23185. - - - - - f4b53538 by Vladislav Zavialov at 2023-12-20T07:08:02-05:00 docs: Fix link to 051-ghc-base-libraries.rst The proposal is no longer available at the previous URL. - - - - - f7e21fab by Matthew Pickering at 2023-12-21T14:57:40+00:00 hadrian: Build all executables in bin/ folder In the end the bindist creation logic copies them all into the bin folder. There is no benefit to building a specific few binaries in the lib/bin folder anymore. This also removes the ad-hoc logic to copy the touchy and unlit executables from stage0 into stage1. It takes <1s to build so we might as well just build it. - - - - - 0038d052 by Zubin Duggal at 2023-12-22T23:28:00-05:00 testsuite: mark jspace as fragile on i386. This test has been flaky for some time and has been failing consistently on i386-linux since 8e0446df landed. See #24261 - - - - - dfd670a0 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 609e6225 by Ben Bellick at 2023-12-24T10:10:31-05:00 Deprecate -ddump-json and introduce -fdiagnostics-as-json Addresses #19278 This commit deprecates the underspecified -ddump-json flag and introduces a newer, well-specified flag -fdiagnostics-as-json. Also included is a JSON schema as part of the documentation. The -ddump-json flag will be slated for removal shortly after this merge. - - - - - 865513b2 by Ömer Sinan Ağacan at 2023-12-24T10:11:13-05:00 Fix BNF in user manual 6.6.8.2: formal syntax for instance declarations - - - - - c247b6be by Zubin Duggal at 2023-12-25T16:01:23-05:00 docs: document permissibility of -XOverloadedLabels (#24249) Document the permissibility introduced by https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst - - - - - e5b7eb59 by Ömer Sinan Ağacan at 2023-12-25T16:02:03-05:00 Fix a code block syntax in user manual sec. 6.8.8.6 - - - - - 2db11c08 by Ben Gamari at 2023-12-29T15:35:48-05:00 genSym: Reimplement via CAS on 32-bit platforms Previously the remaining use of the C implementation on 32-bit platforms resulted in a subtle bug, #24261. This was due to the C object (which used the RTS's `atomic_inc64` macro) being compiled without `-threaded` yet later being used in a threaded compiler. Side-step this issue by using the pure Haskell `genSym` implementation on all platforms. This required implementing `fetchAddWord64Addr#` in terms of CAS on 64-bit platforms. - - - - - 19328a8c by Xiaoyan Ren at 2023-12-29T15:36:30-05:00 Do not color the diagnostic code in error messages (#24172) - - - - - 685b467c by Krzysztof Gogolewski at 2023-12-29T15:37:06-05:00 Enforce that bindings of implicit parameters are lifted Fixes #24298 - - - - - bc4d67b7 by Matthew Craven at 2023-12-31T06:15:42-05:00 StgToCmm: Detect some no-op case-continuations ...and generate no code for them. Fixes #24264. - - - - - 5b603139 by Krzysztof Gogolewski at 2023-12-31T06:16:18-05:00 Revert "testsuite: mark jspace as fragile on i386." This reverts commit 0038d052c8c80b4b430bb2aa1c66d5280be1aa95. The atomicity bug should be fixed by !11802. - - - - - d55216ad by Krzysztof Gogolewski at 2024-01-01T12:05:49-05:00 Refactor: store [[PrimRep]] rather than [Type] in STG StgConApp stored a list of types. This list was used exclusively during unarisation of unboxed sums (mkUbxSum). However, this is at a wrong level of abstraction: STG shouldn't be concerned with Haskell types, only PrimReps. Update the code to store a [[PrimRep]]. Also, there's no point in storing this list when we're not dealing with an unboxed sum. - - - - - 8b340bc7 by Ömer Sinan Ağacan at 2024-01-01T12:06:29-05:00 Kind signatures docs: mention that they're allowed in newtypes - - - - - 989bf8e5 by Zubin Duggal at 2024-01-03T20:08:47-05:00 ci: Ensure we use the correct bindist name for the test artifact when generating release ghcup metadata Fixes #24268 - - - - - 89299a89 by Krzysztof Gogolewski at 2024-01-03T20:09:23-05:00 Refactor: remove calls to typePrimRepArgs The function typePrimRepArgs is just a thin wrapper around typePrimRep, adding a VoidRep if the list is empty. However, in StgToByteCode, we were discarding that VoidRep anyway, so there's no point in calling it. - - - - - c7be0c68 by mmzk1526 at 2024-01-03T20:10:07-05:00 Use "-V" for alex version check for better backward compatibility Fixes #24302. In recent versions of alex, "-v" is used for "--verbose" instead of "-version". - - - - - 67dbcc0a by Krzysztof Gogolewski at 2024-01-05T02:07:18-05:00 Fix VoidRep handling in ghci debugger 'go' inside extractSubTerms was giving a bad result given a VoidRep, attempting to round towards the next multiple of 0. I don't understand much about the debugger but the code should be better than it was. Fixes #24306 - - - - - 90ea574e by Krzysztof Gogolewski at 2024-01-05T02:07:54-05:00 VoidRep-related refactor * In GHC.StgToByteCode, replace bcIdPrimId with idPrimRep, bcIdArgRep with idArgRep, atomPrimRep with stgArgRep1. All of them were duplicates. * In GHC.Stg.Unarise, we were converting a PrimRep to a Type and back to PrimRep. Remove the calls to primRepToType and typePrimRep1 which cancel out. * In GHC.STG.Lint, GHC.StgToCmm, GHC.Types.RepType we were filtering out VoidRep from the result of typePrimRep. But typePrimRep never returns VoidRep - remove the filtering. - - - - - eaf72479 by brian at 2024-01-06T23:03:09-05:00 Add unaligned Addr# primops Implements CLC proposal #154: https://github.com/haskell/core-libraries-committee/issues/154 * add unaligned addr primops * add tests * accept tests * add documentation * fix js primops * uncomment in access ops * use Word64 in tests * apply suggestions * remove extra file * move docs * remove random options * use setByteArray# primop * better naming * update base-exports test * add base-exports for other architectures - - - - - d471d445 by Krzysztof Gogolewski at 2024-01-06T23:03:47-05:00 Remove VoidRep from PrimRep, introduce PrimOrVoidRep This introduces data PrimOrVoidRep = VoidRep | NVRep PrimRep changes typePrimRep1 to return PrimOrVoidRep, and adds a new function typePrimRepU to be used when the argument is definitely non-void. Details in Note [VoidRep] in GHC.Types.RepType. Fixes #19520 - - - - - 48720a07 by Matthew Craven at 2024-01-08T18:57:36-05:00 Apply Note [Sensitivity to unique increment] to LargeRecord - - - - - 9e2e180f by Sebastian Graf at 2024-01-08T18:58:13-05:00 Debugging: Add diffUFM for convenient diffing between UniqFMs - - - - - 948f3e35 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Rename Opt_D_dump_stranal to Opt_D_dump_dmdanal ... and Opt_D_dump_str_signatures to Opt_D_dump_dmd_signatures - - - - - 4e217e3e by Sebastian Graf at 2024-01-08T18:58:13-05:00 Deprecate -ddump-stranal and -ddump-str-signatures ... and suggest -ddump-dmdanal and -ddump-dmd-signatures instead - - - - - 6c613c90 by Sebastian Graf at 2024-01-08T18:58:13-05:00 Move testsuite/tests/stranal to testsuite/tests/dmdanal A separate commit so that the rename is obvious to Git(Lab) - - - - - c929f02b by Sebastian Graf at 2024-01-08T18:58:13-05:00 CoreSubst: Stricten `substBndr` and `cloneBndr` Doing so reduced allocations of `cloneBndr` by about 25%. ``` T9233(normal) ghc/alloc 672,488,656 663,083,216 -1.4% GOOD T9675(optasm) ghc/alloc 423,029,256 415,812,200 -1.7% geo. mean -0.1% minimum -1.7% maximum +0.1% ``` Metric Decrease: T9233 - - - - - e3ca78f3 by Krzysztof Gogolewski at 2024-01-10T17:35:59-05:00 Deprecate -Wsemigroup This warning was used to prepare for Semigroup becoming a superclass of Monoid, and for (<>) being exported from Prelude. This happened in GHC 8.4 in 8ae263ceb3566 and feac0a3bc69fd3. The leftover logic for (<>) has been removed in GHC 9.8, 4d29ecdfcc79. Now the warning does nothing at all and can be deprecated. - - - - - 08d14925 by amesgen at 2024-01-10T17:36:42-05:00 WASM metadata: use correct GHC version - - - - - 7a808419 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Allow SCC declarations in TH (#24081) - - - - - 28827c51 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00 Fix prettyprinting of SCC pragmas - - - - - ae9cc1a8 by Matthew Craven at 2024-01-10T17:38:01-05:00 Fix loopification in the presence of void arguments This also removes Note [Void arguments in self-recursive tail calls], which was just misleading. It's important to count void args both in the function's arity and at the call site. Fixes #24295. - - - - - b718b145 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: Teach testsuite driver about c++ sources - - - - - 09cb57ad by Zubin Duggal at 2024-01-10T17:38:36-05:00 driver: Set -DPROFILING when compiling C++ sources with profiling Earlier, we used to pass all preprocessor flags to the c++ compiler. This meant that -DPROFILING was passed to the c++ compiler because it was a part of C++ flags However, this was incorrect and the behaviour was changed in 8ff3134ed4aa323b0199ad683f72165e51a59ab6. See #21291. But that commit exposed this bug where -DPROFILING was no longer being passed when compiling c++ sources. The fix is to explicitly include -DPROFILING in `opt_cxx` when profiling is enabled to ensure we pass the correct options for the way to both C and C++ compilers Fixes #24286 - - - - - 2cf9dd96 by Zubin Duggal at 2024-01-10T17:38:36-05:00 testsuite: rename objcpp -> objcxx To avoid confusion with C Pre Processsor - - - - - af6932d6 by Simon Peyton Jones at 2024-01-10T17:39:12-05:00 Make TYPE and CONSTRAINT not-apart Issue #24279 showed up a bug in the logic in GHC.Core.Unify.unify_ty which is supposed to make TYPE and CONSTRAINT be not-apart. Easily fixed. - - - - - 4a39b5ff by Zubin Duggal at 2024-01-10T17:39:48-05:00 ci: Fix typo in mk_ghcup_metadata.py There was a missing colon in the fix to #24268 in 989bf8e53c08eb22de716901b914b3607bc8dd08 - - - - - 13503451 by Zubin Duggal at 2024-01-10T17:40:24-05:00 release-ci: remove release-x86_64-linux-deb11-release+boot_nonmoving_gc job There is no reason to have this release build or distribute this variation. This configuration is for testing purposes only. - - - - - afca46a4 by Sebastian Graf at 2024-01-10T17:41:00-05:00 Parser: Add a Note detailing why we need happy's `error` to implement layout - - - - - eaf8a06d by Krzysztof Gogolewski at 2024-01-11T00:43:17+01:00 Turn -Wtype-equality-out-of-scope on by default Also remove -Wnoncanonical-{monoid,monad}-instances from -Wcompat, since they are enabled by default. Refresh wcompat-warnings/ test with new -Wcompat warnings. Part of #24267 Co-authored-by: sheaf <sam.derbyshire at gmail.com> - - - - - 42bee5aa by Sebastian Graf at 2024-01-12T21:16:21-05:00 Arity: Require called *exactly once* for eta exp with -fpedantic-bottoms (#24296) In #24296, we had a program in which we eta expanded away an error despite the presence of `-fpedantic-bottoms`. This was caused by turning called *at least once* lambdas into one-shot lambdas, while with `-fpedantic-bottoms` it is only sound to eta expand over lambdas that are called *exactly* once. An example can be found in `Note [Combining arity type with demand info]`. Fixes #24296. - - - - - 7e95f738 by Andreas Klebinger at 2024-01-12T21:16:57-05:00 Aarch64: Enable -mfma by default. Fixes #24311 - - - - - e43788d0 by Jason Shipman at 2024-01-14T12:47:38-05:00 Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat CLC proposal #226 https://github.com/haskell/core-libraries-committee/issues/226 - - - - - ae6d8cd2 by Sebastian Graf at 2024-01-14T12:48:15-05:00 Pmc: COMPLETE pragmas associated with Family TyCons should apply to representation TyCons as well (#24326) Fixes #24326. - - - - - c5fc7304 by sheaf at 2024-01-15T14:15:29-05:00 Use lookupOccRn_maybe in TH.lookupName When looking up a value, we want to be able to find both variables and record fields. So we should not use the lookupSameOccRn_maybe function, as we can't know ahead of time which record field namespace a record field with the given textual name will belong to. Fixes #24293 - - - - - da908790 by Krzysztof Gogolewski at 2024-01-15T14:16:05-05:00 Make the build more strict on documentation errors * Detect undefined labels. This can be tested by adding :ref:`nonexistent` to a documentation rst file; attempting to build docs will fail. Fixed the undefined label in `9.8.1-notes.rst`. * Detect errors. While we have plenty of warnings, we can at least enforce that Sphinx does not report errors. Fixed the error in `required_type_arguments.rst`. Unrelated change: I have documented that the `-dlint` enables `-fcatch-nonexhaustive-cases`, as can be verified by checking `enableDLint`. - - - - - 5077416e by Javier Sagredo at 2024-01-16T15:40:06-05:00 Profiling: Adds an option to not start time profiling at startup Using the functionality provided by d89deeba47ce04a5198a71fa4cbc203fe2c90794, this patch creates a new rts flag `--no-automatic-time-samples` which disables the time profiling when starting a program. It is then expected that the user starts it whenever it is needed. Fixes #24337 - - - - - 5776008c by Matthew Pickering at 2024-01-16T15:40:42-05:00 eventlog: Fix off-by-one error in postIPE We were missing the extra_comma from the calculation of the size of the payload of postIPE. This was causing assertion failures when the event would overflow the buffer by one byte, as ensureRoomForVariable event would report there was enough space for `n` bytes but then we would write `n + 1` bytes into the buffer. Fixes #24287 - - - - - 66dc09b1 by Simon Peyton Jones at 2024-01-16T15:41:18-05:00 Improve SpecConstr (esp nofib/spectral/ansi) This MR makes three improvements to SpecConstr: see #24282 * It fixes an outright (and recently-introduced) bug in `betterPat`, which was wrongly forgetting to compare the lengths of the argument lists. * It enhances ConVal to inclue a boolean for work-free-ness, so that the envt can contain non-work-free constructor applications, so that we can do more: see Note [ConVal work-free-ness] * It rejigs `subsumePats` so that it doesn't reverse the list. This can make a difference because, when patterns overlap, we arbitrarily pick the first. There is no "right" way, but this retains the old pre-subsumePats behaviour, thereby "fixing" the regression in #24282. Nofib results +======================================== | spectral/ansi -21.14% | spectral/hartel/comp_lab_zift -0.12% | spectral/hartel/parstof +0.09% | spectral/last-piece -2.32% | spectral/multiplier +6.03% | spectral/para +0.60% | spectral/simple -0.26% +======================================== | geom mean -0.18% +---------------------------------------- The regression in `multiplier` is sad, but it simply replicates GHC's previous behaviour (e.g. GHC 9.6). - - - - - 65da79b3 by Matthew Pickering at 2024-01-16T15:41:54-05:00 hadrian: Reduce Cabal verbosity The comment claims that `simpleUserHooks` decrease verbosity, and it does, but only for the `postConf` phase. The other phases are too verbose with `-V`. At the moment > 5000 lines of the build log are devoted to output from `cabal copy`. So I take the simple approach and just decrease the verbosity level again. If the output of `postConf` is essential then it would be better to implement our own `UserHooks` which doesn't decrease the verbosity for `postConf`. Fixes #24338 - - - - - 16414d7d by Matthew Pickering at 2024-01-17T10:54:59-05:00 Stop retaining old ModGuts throughout subsequent simplifier phases Each phase of the simplifier typically rewrites the majority of ModGuts, so we want to be able to release the old ModGuts as soon as possible. `name_ppr_ctxt` lives throught the whole optimiser phase and it was retaining a reference to `ModGuts`, so we were failing to release the old `ModGuts` until the end of the phase (potentially doubling peak memory usage for that particular phase). This was discovered using eras profiling (#24332) Fixes #24328 - - - - - 7f0879e1 by Matthew Pickering at 2024-01-17T10:55:35-05:00 Update nofib submodule - - - - - 320454d3 by Cheng Shao at 2024-01-17T23:02:40+00:00 ci: bump ci-images for updated wasm image - - - - - 2eca52b4 by Cheng Shao at 2024-01-17T23:06:44+00:00 base: treat all FDs as "nonblocking" on wasm On posix platforms, when performing read/write on FDs, we check the nonblocking flag first. For FDs without this flag (e.g. stdout), we call fdReady() first, which in turn calls poll() to wait for I/O to be available on that FD. This is problematic for wasm32-wasi: although select()/poll() is supported via the poll_oneoff() wasi syscall, that syscall is rather heavyweight and runtime behavior differs in different wasi implementations. The issue is even worse when targeting browsers, given there's no satisfactory way to implement async I/O as a synchronous syscall, so existing JS polyfills for wasi often give up and simply return ENOSYS. Before we have a proper I/O manager that avoids poll_oneoff() for async I/O on wasm, this patch improves the status quo a lot by merely pretending all FDs are "nonblocking". Read/write on FDs will directly invoke read()/write(), which are much more reliably handled in existing wasi implementations, especially those in browsers. Fixes #23275 and the following test cases: T7773 isEOF001 openFile009 T4808 cgrun025 Approved by CLC proposal #234: https://github.com/haskell/core-libraries-committee/issues/234 - - - - - 83c6c710 by Andrew Lelechenko at 2024-01-18T05:21:49-05:00 base: clarify how to disable warnings about partiality of Data.List.{head,tail} - - - - - c4078f2f by Simon Peyton Jones at 2024-01-18T05:22:25-05:00 Fix four bug in handling of (forall cv. body_ty) These bugs are all described in #24335 It's not easy to provoke the bug, hence no test case. - - - - - 119586ea by Alexis King at 2024-01-19T00:08:00-05:00 Always refresh profiling CCSes after running pending initializers Fixes #24171. - - - - - 9718d970 by Oleg Grenrus at 2024-01-19T00:08:36-05:00 Set default-language: GHC2021 in ghc library Go through compiler/ sources, and remove all BangPatterns (and other GHC2021 enabled extensions in these files). - - - - - 3ef71669 by Matthew Pickering at 2024-01-19T21:55:16-05:00 testsuite: Remove unused have_library function Also remove the hence unused testsuite option `--test-package-db`. Fixes #24342 - - - - - 5b7fa20c by Jade at 2024-01-19T21:55:53-05:00 Fix Spelling in the compiler Tracking: #16591 - - - - - 09875f48 by Matthew Pickering at 2024-01-20T12:20:44-05:00 testsuite: Implement `isInTreeCompiler` in a more robust way Just a small refactoring to avoid redundantly specifying the same strings in two different places. - - - - - 0d12b987 by Jade at 2024-01-20T12:21:20-05:00 Change maintainer email from cvs-ghc at haskell.org to ghc-devs at haskell.org. Fixes #22142 - - - - - 1fa1c00c by Jade at 2024-01-23T19:17:03-05:00 Enhance Documentation of functions exported by Data.Function This patch aims to improve the documentation of functions exported in Data.Function Tracking: #17929 Fixes: #10065 - - - - - ab47a43d by Jade at 2024-01-23T19:17:39-05:00 Improve documentation of hGetLine. - Add explanation for whether a newline is returned - Add examples Fixes #14804 - - - - - dd4af0e5 by Cheng Shao at 2024-01-23T19:18:17-05:00 Fix genapply for cross-compilation by nuking fragile CPP logic This commit fixes incorrectly built genapply when cross compiling (#24347) by nuking all fragile CPP logic in it from the orbit. All target-specific info are now read from DerivedConstants.h at runtime, see added note for details. Also removes a legacy Makefile and adds haskell language server support for genapply. - - - - - 0cda2b8b by Cheng Shao at 2024-01-23T19:18:17-05:00 rts: enable wasm32 register mapping The wasm backend didn't properly make use of all Cmm global registers due to #24347. Now that it is fixed, this patch re-enables full register mapping for wasm32, and we can now generate smaller & faster wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152. - - - - - 0325a6e5 by Greg Steuck at 2024-01-24T01:29:44-05:00 Avoid utf8 in primops.txt.pp comments They don't make it through readFile' without explicitly setting the encoding. See https://gitlab.haskell.org/ghc/ghc/-/issues/17755 - - - - - 1aaf0bd8 by David Binder at 2024-01-24T01:30:20-05:00 Bump hpc and hpc-bin submodule Bump hpc to 0.7.0.1 Bump hpc-bin to commit d1780eb2 - - - - - e693a4e8 by Ben Gamari at 2024-01-24T01:30:56-05:00 testsuite: Ignore stderr in T8089 Otherwise spurious "Killed: 9" messages to stderr may cause the test to fail. Fixes #24361. - - - - - a40f4ab2 by sheaf at 2024-01-24T14:04:33-05:00 Fix FMA instruction on LLVM We were emitting the wrong instructions for fused multiply-add operations on LLVM: - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd" - LLVM does not support other instructions such as "fmsub"; instead we implement these by flipping signs of some arguments - the instruction is an LLVM intrinsic, which requires handling it like a normal function call instead of a machine instruction Fixes #24223 - - - - - 69abc786 by Andrei Borzenkov at 2024-01-24T14:05:09-05:00 Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291) - - - - - 0ac8f385 by Cheng Shao at 2024-01-25T00:27:48-05:00 compiler: remove unused GHC.Linker module The GHC.Linker module is empty and unused, other than as a hack for the make build system. We can remove it now that make is long gone; the note is moved to GHC.Linker.Loader instead. - - - - - 699da01b by Hécate Moonlight at 2024-01-25T00:28:27-05:00 Clarification for newtype constructors when using `coerce` - - - - - b2d8cd85 by Matt Walker at 2024-01-26T09:50:08-05:00 Fix #24308 Add tests for semicolon separated where clauses - - - - - 0da490a1 by Ben Gamari at 2024-01-26T17:34:41-05:00 hsc2hs: Bump submodule - - - - - 3f442fd2 by Ben Gamari at 2024-01-26T17:34:41-05:00 Bump containers submodule to 0.7 - - - - - 82a1c656 by Sebastian Nagel at 2024-01-29T02:32:40-05:00 base: with{Binary}File{Blocking} only annotates own exceptions Fixes #20886 This ensures that inner, unrelated exceptions are not misleadingly annotated with the opened file. - - - - - 9294a086 by Andreas Klebinger at 2024-01-29T02:33:15-05:00 Fix fma warning when using llvm on aarch64. On aarch64 fma is always on so the +fma flag doesn't exist for that target. Hence no need to try and pass +fma to llvm. Fixes #24379 - - - - - ced2e731 by sheaf at 2024-01-29T17:27:12-05:00 No shadowing warnings for NoFieldSelector fields This commit ensures we don't emit shadowing warnings when a user shadows a field defined with NoFieldSelectors. Fixes #24381 - - - - - 8eeadfad by Patrick at 2024-01-29T17:27:51-05:00 Fix bug wrong span of nested_doc_comment #24378 close #24378 1. Update the start position of span in `nested_doc_comment` correctly. and hence the spans of identifiers of haddoc can be computed correctly. 2. add test `HaddockSpanIssueT24378`. - - - - - a557580f by Alexey Radkov at 2024-01-30T19:41:52-05:00 Fix irrelevant dodgy-foreign-imports warning on import f-pointers by value A test *сс018* is attached (not sure about the naming convention though). Note that without the fix, the test fails with the *dodgy-foreign-imports* warning passed to stderr. The warning disappears after the fix. GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as ```haskell foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ()) ``` where ```c void (*f)(int); ``` See a related real-world use-case [here](https://gitlab.com/daniel-casanueva/pcre-light/-/merge_requests/17). There, GHC warns on import of C function pointer `pcre_free`. - - - - - ca99efaf by Alexey Radkov at 2024-01-30T19:41:53-05:00 Rename test cc018 -> T24034 - - - - - 88c38dd5 by Ben Gamari at 2024-01-30T19:42:28-05:00 rts/TraverseHeap.c: Ensure that PosixSource.h is included first - - - - - ca2e919e by Simon Peyton Jones at 2024-01-31T09:29:45+00:00 Make decomposeRuleLhs a bit more clever This fixes #24370 by making decomposeRuleLhs undertand dictionary /functions/ as well as plain /dictionaries/ - - - - - 94ce031d by Teo Camarasu at 2024-02-01T05:49:49-05:00 doc: Add -Dn flag to user guide Resolves #24394 - - - - - 31553b11 by Ben Gamari at 2024-02-01T12:21:29-05:00 cmm: Introduce MO_RelaxedRead In hand-written Cmm it can sometimes be necessary to atomically load from memory deep within an expression (e.g. see the `CHECK_GC` macro). This MachOp provides a convenient way to do so without breaking the expression into multiple statements. - - - - - 0785cf81 by Ben Gamari at 2024-02-01T12:21:29-05:00 codeGen: Use relaxed accesses in ticky bumping - - - - - be423dda by Ben Gamari at 2024-02-01T12:21:29-05:00 base: use atomic write when updating timer manager - - - - - 8a310e35 by Ben Gamari at 2024-02-01T12:21:29-05:00 Use relaxed atomics to manipulate TSO status fields - - - - - d6809ee4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Add necessary barriers when manipulating TSO owner - - - - - 39e3ac5d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Use `switch` to branch on why_blocked This is a semantics-preserving refactoring. - - - - - 515eb33d by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix synchronization on thread blocking state We now use a release barrier whenever we update a thread's blocking state. This required widening StgTSO.why_blocked as AArch64 does not support atomic writes on 16-bit values. - - - - - eb38812e by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadPaused This only affects an assertion in the debug RTS and only needs relaxed ordering. - - - - - 26c48dd6 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in threadStatus# - - - - - 6af43ab4 by Ben Gamari at 2024-02-01T12:21:29-05:00 rts: Fix data race in Interpreter's preemption check - - - - - 9502ad3c by Ben Gamari at 2024-02-01T12:21:29-05:00 rts/Messages: Fix data race - - - - - 60802db5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts/Prof: Fix data race - - - - - ef8ccef5 by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use relaxed ordering on dirty/clean info tables updates When changing the dirty/clean state of a mutable object we needn't have any particular ordering. - - - - - 76fe2b75 by Ben Gamari at 2024-02-01T12:21:30-05:00 codeGen: Use relaxed-read in closureInfoPtr - - - - - a6316eb4 by Ben Gamari at 2024-02-01T12:21:30-05:00 STM: Use acquire loads when possible Full sequential consistency is not needed here. - - - - - 6bddfd3d by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Use fence rather than redundant load Previously we would use an atomic load to ensure acquire ordering. However, we now have `ACQUIRE_FENCE_ON`, which allows us to express this more directly. - - - - - 55c65dbc by Ben Gamari at 2024-02-01T12:21:30-05:00 rts: Fix data races in profiling timer - - - - - 856b5e75 by Ben Gamari at 2024-02-01T12:21:30-05:00 Add Note [C11 memory model] - - - - - 6534da24 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: move generic cmm optimization logic in NCG to a standalone module This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. - - - - - 87e34888 by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. - - - - - c6ce242e by Cheng Shao at 2024-02-01T12:22:07-05:00 compiler: enable generic cmm optimizations in wasm backend NCG This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. - - - - - 151dda4e by Andrei Borzenkov at 2024-02-01T12:22:43-05:00 Namespacing for WARNING/DEPRECATED pragmas (#24396) New syntax for WARNING and DEPRECATED pragmas was added, namely namespace specifierss: namespace_spec ::= 'type' | 'data' | {- empty -} warning ::= warning_category namespace_spec namelist strings deprecation ::= namespace_spec namelist strings A new data type was introduced to represent these namespace specifiers: data NamespaceSpecifier = NoSpecifier | TypeNamespaceSpecifier (EpToken "type") | DataNamespaceSpecifier (EpToken "data") Extension field XWarning now contains this NamespaceSpecifier. lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier and checks that the namespace of the found names matches the passed flag. With this change {-# WARNING data D "..." #-} pragma will only affect value namespace and {-# WARNING type D "..." #-} will only affect type namespace. The same logic is applicable to DEPRECATED pragmas. Finding duplicated warnings inside rnSrcWarnDecls now takes into consideration NamespaceSpecifier flag to allow warnings with the same names that refer to different namespaces. - - - - - 38c3afb6 by Bryan Richter at 2024-02-01T12:23:19-05:00 CI: Disable the test-cabal-reinstall job Fixes #24363 - - - - - 27020458 by Matthew Craven at 2024-02-03T01:53:26-05:00 Bump bytestring submodule to something closer to 0.12.1 ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c (which reworks unaligned writes in Builder) and the stuff in https://github.com/haskell/bytestring/pull/631 can see wider testing. The less-terrible code for unaligned writes used in Builder on hosts not known to be ulaigned-friendly also takes less effort for GHC to compile, resulting in a metric decrease for T21839c on some platforms. The metric increase on T21839r is caused by the unrelated commit 750dac33465e7b59100698a330b44de7049a345c. It perhaps warrants further analysis and discussion (see #23822) but is not critical. Metric Decrease: T21839c Metric Increase: T21839r - - - - - cdddeb0f by Rodrigo Mesquita at 2024-02-03T01:54:02-05:00 Work around autotools setting C11 standard in CC/CXX In autoconf >=2.70, C11 is set by default for $CC and $CXX via the -std=...11 flag. In this patch, we split the "-std" flag out of the $CC and $CXX variables, which we traditionally assume to be just the executable name/path, and move it to $CFLAGS/$CXXFLAGS instead. Fixes #24324 - - - - - 5ff7cc26 by Apoorv Ingle at 2024-02-03T13:14:46-06:00 Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206 - The change is detailed in - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do` - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr` expains the rational of doing expansions in type checker as opposed to in the renamer - Adds new datatypes: - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier 1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`) 2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam` - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc` - Ensures warnings such as 1. Pattern match checks 2. Failable patterns 3. non-() return in body statements are preserved - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker` - Testcases: * T18324 T20020 T23147 T22788 T15598 T22086 * T23147b (error message check), * DoubleMatch (match inside a match for pmc check) * pattern-fails (check pattern match with non-refutable pattern, eg. newtype) * Simple-rec (rec statements inside do statment) * T22788 (code snippet from #22788) * DoExpanion1 (Error messages for body statments) * DoExpansion2 (Error messages for bind statements) * DoExpansion3 (Error messages for let statements) Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass Metric Increase 'compile_time/bytes allocated': T9020 The testcase is a pathalogical example of a `do`-block with many statements that do nothing. Given that we are expanding the statements into function binds, we will have to bear a (small) 2% cost upfront in the compiler to unroll the statements. - - - - - 0df8ce27 by Vladislav Zavialov at 2024-02-04T03:55:14-05:00 Reduce parser allocations in allocateCommentsP In the most common case, the comment queue is empty, so we can skip the work of processing it. This reduces allocations by about 10% in the parsing001 test. Metric Decrease: MultiLayerModulesRecomp parsing001 - - - - - cfd68290 by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Stop dropping a case whose binder is demanded This MR fixes #24251. See Note [Case-to-let for strictly-used binders] in GHC.Core.Opt.Simplify.Iteration, plus #24251, for lots of discussion. Final Nofib changes over 0.1%: +----------------------------------------- | imaginary/digits-of-e2 -2.16% | imaginary/rfib -0.15% | real/fluid -0.10% | real/gamteb -1.47% | real/gg -0.20% | real/maillist +0.19% | real/pic -0.23% | real/scs -0.43% | shootout/n-body -0.41% | shootout/spectral-norm -0.12% +======================================== | geom mean -0.05% Pleasingly, overall executable size is down by just over 1%. Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the geometric mean is -0.1% which seems good. - - - - - e4d137bb by Simon Peyton Jones at 2024-02-05T17:58:33-05:00 Add Note [Bangs in Integer functions] ...to document the bangs in the functions in GHC.Num.Integer - - - - - ce90f12f by Andrei Borzenkov at 2024-02-05T17:59:09-05:00 Hide WARNING/DEPRECATED namespacing under -XExplicitNamespaces (#24396) - - - - - e2ea933f by Simon Peyton Jones at 2024-02-06T10:12:04-05:00 Refactoring in preparation for lazy skolemisation * Make HsMatchContext and HsStmtContext be parameterised over the function name itself, rather than over the pass. See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr - Replace types HsMatchContext GhcPs --> HsMatchContextPs HsMatchContext GhcRn --> HsMatchContextRn HsMatchContext GhcTc --> HsMatchContextRn (sic! not Tc) HsStmtContext GhcRn --> HsStmtContextRn - Kill off convertHsMatchCtxt * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing a complete user-supplied signature) is its own data type. - Split TcIdSigInfo(CompleteSig, PartialSig) into TcCompleteSig(CSig) TcPartialSig(PSig) - Use TcCompleteSig in tcPolyCheck, CheckGen - Rename types and data constructors: TcIdSigInfo --> TcIdSig TcPatSynInfo(TPSI) --> TcPatSynSig(PatSig) - Shuffle around helper functions: tcSigInfoName (moved to GHC.Tc.Types.BasicTypes) completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes) tcIdSigName (inlined and removed) tcIdSigLoc (introduced) - Rearrange the pattern match in chooseInferredQuantifiers * Rename functions and types: tcMatchesCase --> tcCaseMatches tcMatchesFun --> tcFunBindMatches tcMatchLambda --> tcLambdaMatches tcPats --> tcMatchPats matchActualFunTysRho --> matchActualFunTys matchActualFunTySigma --> matchActualFunTy * Add HasDebugCallStack constraints to: mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy, mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe * Use `penv` from the outer context in the inner loop of GHC.Tc.Gen.Pat.tcMultiple * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file, factor out and export tcMkScaledFunTy. * Move isPatSigCtxt down the file. * Formatting and comments Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com> - - - - - f5d3e03c by Andrei Borzenkov at 2024-02-06T10:12:04-05:00 Lazy skolemisation for @a-binders (#17594) This patch is a preparation for @a-binders implementation. The main changes are: * Skolemisation is now prepared to deal with @binders. See Note [Skolemisation overview] in GHC.Tc.Utils.Unify. Most of the action is in - Utils.Unify.matchExpectedFunTys - Gen.Pat.tcMatchPats - Gen.Expr.tcPolyExprCheck - Gen.Binds.tcPolyCheck Some accompanying refactoring: * I found that funTyConAppTy_maybe was doing a lot of allocation, and rejigged userTypeError_maybe to avoid calling it. - - - - - 532993c8 by Zubin Duggal at 2024-02-06T10:12:41-05:00 driver: Really don't lose track of nodes when we fail to resolve cycles This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose track of acyclic components at the start of an unresolved cycle. We now ensure we never loose track of any of these components. As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC: When viewed without boot files, we have a single SCC ``` [REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A [main:T24275A {-# SOURCE #-}]] ``` But with boot files this turns into ``` [NONREC main:T24275B {-# SOURCE #-} [], REC main:T24275B [main:T24275B {-# SOURCE #-}, main:T24275A {-# SOURCE #-}] main:T24275A {-# SOURCE #-} [main:T24275B], NONREC main:T24275A [main:T24275A {-# SOURCE #-}]] ``` Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot. However, we treat this entire group as a single "SCC" because it seems so when we analyse the graph without taking boot files into account. Indeed, we must return a single ResolvedCycle element in the BuildPlan for this as described in Note [Upsweep]. However, since after resolving this is not a true SCC anymore, `findCycle` fails to find a cycle and we have a sub-optimal error message as a result. To handle this, I extended `findCycle` to not assume its input is an SCC, and to try harder to find cycles in its input. Fixes #24275 - - - - - b35dd613 by Zubin Duggal at 2024-02-06T10:13:17-05:00 GHCi: Lookup breakpoint CCs in the correct module We need to look up breakpoint CCs in the module that the breakpoint points to, and not the current module. Fixes #24327 - - - - - b09e6958 by Zubin Duggal at 2024-02-06T10:13:17-05:00 testsuite: Add test for #24327 - - - - - 569b4c10 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add compile_artifact, ignore_extension flag In b521354216f2821e00d75f088d74081d8b236810 the testsuite gained the capability to collect generic metrics. But this assumed that the test was not linking and producing artifacts and we only wanted to track object files, interface files, or build artifacts from the compiler build. However, some backends, such as the JS backend, produce artifacts when compiling, such as the jsexe directory which we want to track. This patch: - tweaks the testsuite to collect generic metrics on any build artifact in the test directory. - expands the exe_extension function to consider windows and adds the ignore_extension flag. - Modifies certain tests to add the ignore_extension flag. Tests such as heaprof002 expect a .ps file, but on windows without ignore_extensions the testsuite will look for foo.exe.ps. Hence the flag. - adds the size_hello_artifact test - - - - - 75a31379 by doyougnu at 2024-02-07T03:06:26-05:00 ts: add wasm_arch, heapprof002 wasm extension - - - - - c9731d6d by Rodrigo Mesquita at 2024-02-07T03:07:03-05:00 Synchronize bindist configure for #24324 In cdddeb0f1280b40cc194028bbaef36e127175c4c, we set up a workaround for #24324 in the in-tree configure script, but forgot to update the bindist configure script accordingly. This updates it. - - - - - d309f4e7 by Matthew Pickering at 2024-02-07T03:07:38-05:00 distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we were missing passing `--target` when invoking the linker. Fixes #24414 - - - - - 77db84ab by Ben Gamari at 2024-02-08T00:35:22-05:00 llvmGen: Adapt to allow use of new pass manager. We now must use `-passes` in place of `-O<n>` due to #21936. Closes #21936. - - - - - 3c9ddf97 by Matthew Pickering at 2024-02-08T00:35:59-05:00 testsuite: Mark length001 as fragile on javascript Modifying the timeout multiplier is not a robust way to get this test to reliably fail. Therefore we mark it as fragile until/if javascript ever supports the stack limit. - - - - - 20b702b5 by Matthew Pickering at 2024-02-08T00:35:59-05:00 Javascript: Don't filter out rtsDeps list This logic appears to be incorrect as it would drop any dependency which was not in a direct dependency of the package being linked. In the ghc-internals split this started to cause errors because `ghc-internal` is not a direct dependency of most packages, and hence important symbols to keep which are hard coded into the js runtime were getting dropped. - - - - - 2df96366 by Ben Gamari at 2024-02-08T00:35:59-05:00 base: Cleanup whitespace in cbits - - - - - 44f6557a by Ben Gamari at 2024-02-08T00:35:59-05:00 Move `base` to `ghc-internal` Here we move a good deal of the implementation of `base` into a new package, `ghc-internal` such that it can be evolved independently from the user-visible interfaces of `base`. While we want to isolate implementation from interfaces, naturally, we would like to avoid turning `base` into a mere set of module re-exports. However, this is a non-trivial undertaking for a variety of reasons: * `base` contains numerous known-key and wired-in things, requiring corresponding changes in the compiler * `base` contains a significant amount of C code and corresponding autoconf logic, which is very fragile and difficult to break apart * `base` has numerous import cycles, which are currently dealt with via carefully balanced `hs-boot` files * We must not break existing users To accomplish this migration, I tried the following approaches: * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental migration of modules into ghc-internal: this knot is simply too intertwined to be easily pulled apart, especially given the rather tricky import cycles that it contains) * [Move-Core]: Moving the "core" connected component of base (roughly 150 modules) into ghc-internal. While the Haskell side of this seems tractable, the C dependencies are very subtle to break apart. * [Move-Incrementally]: 1. Move all of base into ghc-internal 2. Examine the module structure and begin moving obvious modules (e.g. leaves of the import graph) back into base 3. Examine the modules remaining in ghc-internal, refactor as necessary to facilitate further moves 4. Go to (2) iterate until the cost/benefit of further moves is insufficient to justify continuing 5. Rename the modules moved into ghc-internal to ensure that they don't overlap with those in base 6. For each module moved into ghc-internal, add a shim module to base with the declarations which should be exposed and any requisite Haddocks (thus guaranteeing that base will be insulated from changes in the export lists of modules in ghc-internal Here I am using the [Move-Incrementally] approach, which is empirically the least painful of the unpleasant options above Bumps haddock submodule. Metric Decrease: haddock.Cabal haddock.base Metric Increase: MultiComponentModulesRecomp T16875 size_hello_artifact - - - - - e8fb2451 by Vladislav Zavialov at 2024-02-08T00:36:36-05:00 Haddock comments on infix constructors (#24221) Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for infix constructors. This change fixes a Haddock regression (introduced in 19e80b9af252) that affected leading comments on infix data constructor declarations: -- | Docs for infix constructor | Int :* Bool The comment should be associated with the data constructor (:*), not with its left-hand side Int. - - - - - 9060d55b by Ben Gamari at 2024-02-08T00:37:13-05:00 Add os-string as a boot package Introduces `os-string` submodule. This will be necessary for `filepath-1.5`. - - - - - 9d65235a by Ben Gamari at 2024-02-08T00:37:13-05:00 gitignore: Ignore .hadrian_ghci_multi/ - - - - - d7ee12ea by Ben Gamari at 2024-02-08T00:37:13-05:00 hadrian: Set -this-package-name When constructing the GHC flags for a package Hadrian must take care to set `-this-package-name` in addition to `-this-unit-id`. This hasn't broken until now as we have not had any uses of qualified package imports. However, this will change with `filepath-1.5` and the corresponding `unix` bump, breaking `hadrian/multi-ghci`. - - - - - f2dffd2e by Ben Gamari at 2024-02-08T00:37:13-05:00 Bump filepath to 1.5.0.0 Required bumps of the following submodules: * `directory` * `filepath` * `haskeline` * `process` * `unix` * `hsc2hs` * `Win32` * `semaphore-compat` and the addition of `os-string` as a boot package. - - - - - ab533e71 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Use specific clang assembler when compiling with -fllvm There are situations where LLVM will produce assembly which older gcc toolchains can't handle. For example on Deb10, it seems that LLVM >= 13 produces assembly which the default gcc doesn't support. A more robust solution in the long term is to require a specific LLVM compatible assembler when using -fllvm. Fixes #16354 - - - - - c32b6426 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update CI images with LLVM 15, ghc-9.6.4 and cabal-install-3.10.2.0 - - - - - 5fcd58be by Matthew Pickering at 2024-02-08T00:37:50-05:00 Update bootstrap plans for 9.4.8 and 9.6.4 - - - - - 707a32f5 by Matthew Pickering at 2024-02-08T00:37:50-05:00 Add alpine 3_18 release job This is mainly experimental and future proofing to enable a smooth transition to newer alpine releases once 3_12 is too old. - - - - - c37931b3 by John Ericson at 2024-02-08T06:39:05-05:00 Generate LLVM min/max bound policy via Hadrian Per #23966, I want the top-level configure to only generate configuration data for Hadrian, not do any "real" tasks on its own. This is part of that effort --- one less file generated by it. (It is still done with a `.in` file, so in a future world non-Hadrian also can easily create this file.) Split modules: - GHC.CmmToLlvm.Config - GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds - GHC.CmmToLlvm.Version.Type This also means we can get rid of the silly `unused.h` introduced in !6803 / 7dfcab2f4bcb7206174ea48857df1883d05e97a2 as temporary kludge. Part of #23966 - - - - - 9f987235 by Apoorv Ingle at 2024-02-08T06:39:42-05:00 Enable mdo statements to use HsExpansions Fixes: #24411 Added test T24411 for regression - - - - - 762b2120 by Jade at 2024-02-08T15:17:15+00:00 Improve Monad, Functor & Applicative docs This patch aims to improve the documentation of Functor, Applicative, Monad and related symbols. The main goal is to make it more consistent and make accessible. See also: !10979 (closed) and !10985 (closed) Ticket #17929 Updates haddock submodule - - - - - 151770ca by Josh Meredith at 2024-02-10T14:28:15-05:00 JavaScript codegen: Use GHC's tag inference where JS backend-specific evaluation inference was previously used (#24309) - - - - - 2e880635 by Zubin Duggal at 2024-02-10T14:28:51-05:00 ci: Allow release-hackage-lint to fail Otherwise it blocks the ghcup metadata pipeline from running. - - - - - b0293f78 by Matthew Pickering at 2024-02-10T14:29:28-05:00 rts: eras profiling mode The eras profiling mode is useful for tracking the life-time of closures. When a closure is written, the current era is recorded in the profiling header. This records the era in which the closure was created. * Enable with -he * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era * Automatically: --automatic-era-increment, increases the user era on major collections * The first era is era 1 * -he<era> can be used with other profiling modes to select a specific era If you just want to record the era but not to perform heap profiling you can use `-he --no-automatic-heap-samples`. https://well-typed.com/blog/2024/01/ghc-eras-profiling/ Fixes #24332 - - - - - be674a2c by Jade at 2024-02-10T14:30:04-05:00 Adjust error message for trailing whitespace in as-pattern. Fixes #22524 - - - - - 53ef83f9 by doyougnu at 2024-02-10T14:30:47-05:00 gitlab: js: add codeowners Fixes: - #24409 Follow on from: - #21078 and MR !9133 - When we added the JS backend this was forgotten. This patch adds the rightful codeowners. - - - - - 8bbe12f2 by Matthew Pickering at 2024-02-10T14:31:23-05:00 Bump CI images so that alpine3_18 image includes clang15 The only changes here are that clang15 is now installed on the alpine-3_18 image. - - - - - df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: handle stored null StablePtr Some Haskell codes unsafely cast StablePtr into ptr to compare against NULL. E.g. in direct-sqlite: if castStablePtrToPtr aggStPtr /= nullPtr then where `aggStPtr` is read (`peek`) from zeroed memory initially. We fix this by giving these StablePtr the same representation as other null pointers. It's safe because StablePtr at offset 0 is unused (for this exact reason). - - - - - 55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: disable MergeObjsMode test This isn't implemented for JS backend objects. - - - - - aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: add support for linking C sources Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js. - - - - - b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00 JS: avoid EMCC logging spurious failure emcc would sometime output messages like: cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds) cache:INFO: - ok Cf https://github.com/emscripten-core/emscripten/issues/18607 This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0 - - - - - ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00 Remove a dead comment Just remove an out of date block of commented-out code, and tidy up the relevant Notes. See #8317. - - - - - bedb4f0d by Teo Camarasu at 2024-02-12T18:50:33-05:00 nonmoving: Add support for heap profiling Add support for heap profiling while using the nonmoving collector. We greatly simply the implementation by disabling concurrent collection for GCs when heap profiling is enabled. This entails that the marked objects on the nonmoving heap are exactly the live objects. Note that we match the behaviour for live bytes accounting by taking the size of objects on the nonmoving heap to be that of the segment's block rather than the object itself. Resolves #22221 - - - - - d0d5acb5 by Teo Camarasu at 2024-02-12T18:51:09-05:00 doc: Add requires prof annotation to options that require it Resolves #24421 - - - - - 57bb8c92 by Cheng Shao at 2024-02-13T14:07:49-05:00 deriveConstants: add needed constants for wasm backend This commit adds needed constants to deriveConstants. They are used by RTS code in the wasm backend to support the JSFFI logic. - - - - - 615eb855 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms The pure Haskell implementation causes i386 regression in unrelated work that can be fixed by using C-based atomic increment, see added comment for details. - - - - - a9918891 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow JSFFI for wasm32 This commit allows the javascript calling convention to be used when the target platform is wasm32. - - - - - 8771a53b by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: allow boxed JSVal as a foreign type This commit allows the boxed JSVal type to be used as a foreign argument/result type. - - - - - 053c92b3 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: ensure ctors have the right priority on wasm32 This commit fixes the priorities of ctors generated by GHC codegen on wasm32, see the referred note for details. - - - - - b7942e0a by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JSFFI desugar logic for wasm32 This commit adds JSFFI desugar logic for the wasm backend. - - - - - 2c1dca76 by Cheng Shao at 2024-02-13T14:07:49-05:00 compiler: add JavaScriptFFI to supported extension list on wasm32 This commit adds JavaScriptFFI as a supported extension when the target platform is wasm32. - - - - - 9ad0e2b4 by Cheng Shao at 2024-02-13T14:07:49-05:00 rts/ghc-internal: add JSFFI support logic for wasm32 This commit adds rts/ghc-internal logic to support the wasm backend's JSFFI functionality. - - - - - e9ebea66 by Cheng Shao at 2024-02-13T14:07:49-05:00 ghc-internal: fix threadDelay for wasm in browsers This commit fixes broken threadDelay for wasm when it runs in browsers, see added note for detailed explanation. - - - - - f85f3fdb by Cheng Shao at 2024-02-13T14:07:49-05:00 utils: add JSFFI utility code This commit adds JavaScript util code to utils to support the wasm backend's JSFFI functionality: - jsffi/post-link.mjs, a post-linker to process the linked wasm module and emit a small complement JavaScript ESM module to be used with it at runtime - jsffi/prelude.js, a tiny bit of prelude code as the JavaScript side of runtime logic - jsffi/test-runner.mjs, run the jsffi test cases Co-authored-by: amesgen <amesgen at amesgen.de> - - - - - 77e91500 by Cheng Shao at 2024-02-13T14:07:49-05:00 hadrian: distribute jsbits needed for wasm backend's JSFFI support The post-linker.mjs/prelude.js files are now distributed in the bindist libdir, so when using the wasm backend's JSFFI feature, the user wouldn't need to fetch them from a ghc checkout manually. - - - - - c47ba1c3 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. - - - - - 8e048675 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: T22774 should work for wasm JSFFI T22774 works since the wasm backend now supports the JSFFI feature. - - - - - 1d07f9a6 by Cheng Shao at 2024-02-13T14:07:49-05:00 testsuite: add JSFFI test cases for wasm backend This commit adds a few test cases for the wasm backend's JSFFI functionality, as well as a simple README to instruct future contributors to add new test cases. - - - - - b8997080 by Cheng Shao at 2024-02-13T14:07:49-05:00 docs: add documentation for wasm backend JSFFI This commit adds changelog and user facing documentation for the wasm backend's JSFFI feature. - - - - - ffeb000d by David Binder at 2024-02-13T14:08:30-05:00 Add tests from libraries/process/tests and libraries/Win32/tests to GHC These tests were previously part of the libraries, which themselves are submodules of the GHC repository. This commit moves the tests directly to the GHC repository. - - - - - 5a932cf2 by David Binder at 2024-02-13T14:08:30-05:00 Do not execute win32 tests on non-windows runners - - - - - 500d8cb8 by Jade at 2024-02-13T14:09:07-05:00 prevent GHCi (and runghc) from suggesting other symbols when not finding main Fixes: #23996 - - - - - b19ec331 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: update xxHash to v0.8.2 - - - - - 4a97bdb8 by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: use XXH3_64bits hash on all 64-bit platforms This commit enables XXH3_64bits hash to be used on all 64-bit platforms. Previously it was only enabled on x86_64, so platforms like aarch64 silently falls back to using XXH32 which degrades the hashing function quality. - - - - - ee01de7d by Cheng Shao at 2024-02-13T14:09:46-05:00 rts: define XXH_INLINE_ALL This commit cleans up how we include the xxhash.h header and only define XXH_INLINE_ALL, which is sufficient to inline the xxHash functions without symbol collision. - - - - - 0e01e1db by Alan Zimmerman at 2024-02-14T02:13:22-05:00 EPA: Move EpAnn out of extension points Leaving a few that are too tricky, maybe some other time. Also - remove some unneeded helpers from Parser.y - reduce allocations with strictness annotations Updates haddock submodule Metric Decrease: parsing001 - - - - - de589554 by Andreas Klebinger at 2024-02-14T02:13:59-05:00 Fix ffi callbacks with >6 args and non-64bit args. Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 - - - - - 325b7613 by Ben Gamari at 2024-02-14T14:27:45-05:00 rts/EventLog: Place eliminate duplicate strlens Previously many of the `post*` implementations would first compute the length of the event's strings in order to determine the event length. Later we would then end up computing the length yet again in `postString`. Now we instead pass the string length to `postStringLen`, avoiding the repeated work. - - - - - 8aafa51c by Ben Gamari at 2024-02-14T14:27:46-05:00 rts/eventlog: Place upper bound on IPE string field lengths The strings in IPE events may be of unbounded length. Limit the lengths of these fields to 64k characters to ensure that we don't exceed the maximum event length. - - - - - 0e60d52c by Zubin Duggal at 2024-02-14T14:27:46-05:00 rts: drop unused postString function - - - - - d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00 compiler/rts: fix wasm unreg regression This commit fixes two wasm unreg regressions caught by a nightly pipeline: - Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm - Invalid _hs_constructor(101) function name when handling ctor - - - - - 264a4fa9 by Owen Shepherd at 2024-02-15T09:41:06-05:00 feat: Add sortOn to Data.List.NonEmpty Adds `sortOn` to `Data.List.NonEmpty`, and adds comments describing when to use it, compared to `sortWith` or `sortBy . comparing`. The aim is to smooth out the API between `Data.List`, and `Data.List.NonEmpty`. This change has been discussed in the [clc issue](https://github.com/haskell/core-libraries-committee/issues/227). - - - - - b57200de by Fendor at 2024-02-15T09:41:47-05:00 Prefer RdrName over OccName for looking up locations in doc renaming step Looking up by OccName only does not take into account when functions are only imported in a qualified way. Fixes issue #24294 Bump haddock submodule to include regression test - - - - - 8ad02724 by Luite Stegeman at 2024-02-15T17:33:32-05:00 JS: add simple optimizer The simple optimizer reduces the size of the code generated by the JavaScript backend without the complexity and performance penalty of the optimizer in GHCJS. Also see #22736 Metric Decrease: libdir size_hello_artifact - - - - - 20769b36 by Matthew Pickering at 2024-02-15T17:34:07-05:00 base: Expose `--no-automatic-time-samples` in `GHC.RTS.Flags` API This patch builds on 5077416e12cf480fb2048928aa51fa4c8fc22cf1 and modifies the base API to reflect the new RTS flag. CLC proposal #243 - https://github.com/haskell/core-libraries-committee/issues/243 Fixes #24337 - - - - - 08031ada by Teo Camarasu at 2024-02-16T13:37:00-05:00 base: export System.Mem.performBlockingMajorGC The corresponding C function was introduced in ba73a807edbb444c49e0cf21ab2ce89226a77f2e. As part of #22264. Resolves #24228 The CLC proposal was disccused at: https://github.com/haskell/core-libraries-committee/issues/230 Co-authored-by: Ben Gamari <bgamari.foss at gmail.com> - - - - - 1f534c2e by Florian Weimer at 2024-02-16T13:37:42-05:00 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones <rjones at redhat.com> - - - - - 5d3f7862 by Matthew Craven at 2024-02-16T13:38:18-05:00 Bump bytestring submodule to 0.12.1.0 - - - - - 902ebcc2 by Ian-Woo Kim at 2024-02-17T06:01:01-05:00 Add missing BCO handling in scavenge_one. - - - - - 97d26206 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Make cast between words and floats real primops (#24331) First step towards fixing #24331. Replace foreign prim imports with real primops. - - - - - a40e4781 by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: add constant folding for bitcast between float and word (#24331) - - - - - 5fd2c00f by Sylvain Henry at 2024-02-17T06:01:44-05:00 Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. - - - - - 401dfe7b by Sylvain Henry at 2024-02-17T06:01:44-05:00 Reexport primops from GHC.Float + add deprecation - - - - - 4ab48edb by Ben Gamari at 2024-02-17T06:02:21-05:00 rts/Hash: Don't iterate over chunks if we don't need to free data When freeing a `HashTable` there is no reason to walk over the hash list before freeing it if the user has not given us a `dataFreeFun`. Noticed while looking at #24410. - - - - - bd5a1f91 by Cheng Shao at 2024-02-17T06:03:00-05:00 compiler: add SEQ_CST fence support In addition to existing Acquire/Release fences, this commit adds SEQ_CST fence support to GHC, allowing Cmm code to explicitly emit a fence that enforces total memory ordering. The following logic is added: - The MO_SeqCstFence callish MachOp - The %prim fence_seq_cst() Cmm syntax and the SEQ_CST_FENCE macro in Cmm.h - MO_SeqCstFence lowering logic in every single GHC codegen backend - - - - - 2ce2a493 by Cheng Shao at 2024-02-17T06:03:38-05:00 testsuite: fix hs_try_putmvar002 for targets without pthread.h hs_try_putmvar002 includes pthread.h and doesn't work on targets without this header (e.g. wasm32). It doesn't need to include this header at all. This was previously unnoticed by wasm CI, though recent toolchain upgrade brought in upstream changes that completely removes pthread.h in the single-threaded wasm32-wasi sysroot, therefore we need to handle that change. - - - - - 1fb3974e by Cheng Shao at 2024-02-17T06:03:38-05:00 ci: bump ci-images to use updated wasm image This commit bumps our ci-images revision to use updated wasm image. - - - - - 56e3f097 by Andrew Lelechenko at 2024-02-17T06:04:13-05:00 Bump submodule text to 2.1.1 T17123 allocates less because of improvements to Data.Text.concat in 1a6a06a. Metric Decrease: T17123 - - - - - a7569495 by Cheng Shao at 2024-02-17T06:04:51-05:00 rts: remove redundant rCCCS initialization This commit removes the redundant logic of initializing each Capability's rCCCS to CCS_SYSTEM in initProfiling(). Before initProfiling() is called during RTS startup, each Capability's rCCCS has already been assigned CCS_SYSTEM when they're first initialized. - - - - - 7a0293cc by Ben Gamari at 2024-02-19T07:11:00-05:00 Drop dependence on `touch` This drops GHC's dependence on the `touch` program, instead implementing it within GHC. This eliminates an external dependency and means that we have one fewer program to keep track of in the `configure` script - - - - - 0dbd729e by Andrei Borzenkov at 2024-02-19T07:11:37-05:00 Parser, renamer, type checker for @a-binders (#17594) GHC Proposal 448 introduces binders for invisible type arguments (@a-binders) in various contexts. This patch implements @-binders in lambda patterns and function equations: {-# LANGUAGE TypeAbstractions #-} id1 :: a -> a id1 @t x = x :: t -- @t-binder on the LHS of a function equation higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16) higherRank f = (f 42, f 42) ex :: (Int8, Int16) ex = higherRank (\ @a x -> maxBound @a - x ) -- @a-binder in a lambda pattern in an argument -- to a higher-order function Syntax ------ To represent those @-binders in the AST, the list of patterns in Match now uses ArgPat instead of Pat: data Match p body = Match { ... - m_pats :: [LPat p], + m_pats :: [LArgPat p], ... } + data ArgPat pass + = VisPat (XVisPat pass) (LPat pass) + | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass)) + | XArgPat !(XXArgPat pass) The VisPat constructor represents patterns for visible arguments, which include ordinary value-level arguments and required type arguments (neither is prefixed with a @), while InvisPat represents invisible type arguments (prefixed with a @). Parser ------ In the grammar (Parser.y), the lambda and lambda-cases productions of aexp non-terminal were updated to accept argpats instead of apats: aexp : ... - | '\\' apats '->' exp + | '\\' argpats '->' exp ... - | '\\' 'lcases' altslist(apats) + | '\\' 'lcases' altslist(argpats) ... + argpat : apat + | PREFIX_AT atype Function left-hand sides did not require any changes to the grammar, as they were already parsed with productions capable of parsing @-binders. Those binders were being rejected in post-processing (isFunLhs), and now we accept them. In Parser.PostProcess, patterns are constructed with the help of PatBuilder, which is used as an intermediate data structure when disambiguating between FunBind and PatBind. In this patch we define ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived data structure produced in isFunLhs and consumed in checkFunBind. Renamer ------- Renaming of @-binders builds upon prior work on type patterns, implemented in 2afbddb0f24, which guarantees proper scoping and shadowing behavior of bound type variables. This patch merely defines rnLArgPatsAndThen to process a mix of visible and invisible patterns: + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn] + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where + rnArgPatAndThen (VisPat x p) = ... rnLPatAndThen ... + rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ... Common logic between rnArgPats and rnPats is factored out into the rn_pats_general helper. Type checker ------------ Type-checking of @-binders builds upon prior work on lazy skolemisation, implemented in f5d3e03c56f. This patch extends tcMatchPats to handle @-binders. Now it takes and returns a list of LArgPat rather than LPat: tcMatchPats :: ... - -> [LPat GhcRn] + -> [LArgPat GhcRn] ... - -> TcM ([LPat GhcTc], a) + -> TcM ([LArgPat GhcTc], a) Invisible binders in the Match are matched up with invisible (Specified) foralls in the type. This is done with a new clause in the `loop` worker of tcMatchPats: loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a) loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys) ... -- NEW CLAUSE: | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis = ... In addition to that, tcMatchPats no longer discards type patterns. This is done by filterOutErasedPats in the desugarer instead. x86_64-linux-deb10-validate+debug_info Metric Increase: MultiLayerModulesTH_OneShot - - - - - 486979b0 by Jade at 2024-02-19T07:12:13-05:00 Add specialized sconcat implementation for Data.Monoid.First and Data.Semigroup.First Approved CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/246 Fixes: #24346 - - - - - 17e309d2 by John Ericson at 2024-02-19T07:12:49-05:00 Fix reST in users guide It appears that aef587f65de642142c1dcba0335a301711aab951 wasn't valid syntax. - - - - - 35b0ad90 by Brandon Chinn at 2024-02-19T07:13:25-05:00 Fix searching for errors in sphinx build - - - - - 4696b966 by Cheng Shao at 2024-02-19T07:14:02-05:00 hadrian: fix wasm backend post linker script permissions The post-link.mjs script was incorrectly copied and installed as a regular data file without executable permission, this commit fixes it. - - - - - a6142e0c by Cheng Shao at 2024-02-19T07:14:40-05:00 testsuite: mark T23540 as fragile on i386 See #24449 for details. - - - - - 249caf0d by Matthew Craven at 2024-02-19T20:36:09-05:00 Add @since annotation to Data.Data.mkConstrTag - - - - - cdd939e7 by Jade at 2024-02-19T20:36:46-05:00 Enhance documentation of Data.Complex - - - - - d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian/bindist: Ensure that phony rules are marked as such Otherwise make may not run the rule if file with the same name as the rule happens to exist. - - - - - efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00 hadrian: Generate HSC2HS_EXTRAS variable in bindist installation We must generate the hsc2hs wrapper at bindist installation time since it must contain `--lflag` and `--cflag` arguments which depend upon the installation path. The solution here is to substitute these variables in the configure script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in the install rules. Fixes #24050. - - - - - c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00 ci: Show --info for installed compiler - - - - - ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00 configure: Correctly set --target flag for linker opts Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4 arguments, when it only takes 3 arguments. Instead we need to use the `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags. Actually fixes #24414 - - - - - 9460d504 by Rodrigo Mesquita at 2024-02-21T04:59:59-05:00 configure: Do not override existing linker flags in FP_LD_NO_FIXUP_CHAINS - - - - - 77629e76 by Andrei Borzenkov at 2024-02-21T05:00:35-05:00 Namespacing for fixity signatures (#14032) Namespace specifiers were added to syntax of fixity signatures: - sigdecl ::= infix prec ops | ... + sigdecl ::= infix prec namespace_spec ops | ... To preserve namespace during renaming MiniFixityEnv type now has separate FastStringEnv fields for names that should be on the term level and for name that should be on the type level. makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way: - signatures without namespace specifiers fill both fields - signatures with 'data' specifier fill data field only - signatures with 'type' specifier fill type field only Was added helper function lookupMiniFixityEnv that takes care about looking for a name in an appropriate namespace. Updates haddock submodule. Metric Decrease: MultiLayerModulesTH_OneShot - - - - - 84357d11 by Teo Camarasu at 2024-02-21T05:01:11-05:00 rts: only collect live words in nonmoving census when non-concurrent This avoids segfaults when the mutator modifies closures as we examine them. Resolves #24393 - - - - - 9ca56dd3 by Ian-Woo Kim at 2024-02-21T05:01:53-05:00 mutex wrap in refreshProfilingCCSs - - - - - 1387966a by Cheng Shao at 2024-02-21T05:02:32-05:00 rts: remove unused HAVE_C11_ATOMICS macro This commit removes the unused HAVE_C11_ATOMICS macro. We used to have a few places that have fallback paths when HAVE_C11_ATOMICS is not defined, but that is completely redundant, since the FP_CC_SUPPORTS__ATOMICS configure check will fail when the C compiler doesn't support C11 style atomics. There are also many places (e.g. in unreg backend, SMP.h, library cbits, etc) where we unconditionally use C11 style atomics anyway which work in even CentOS 7 (gcc 4.8), the oldest distro we test in our CI, so there's no value in keeping HAVE_C11_ATOMICS. - - - - - 0f40d68f by Andreas Klebinger at 2024-02-21T05:03:09-05:00 RTS: -Ds - make sure incall is non-zero before dereferencing it. Fixes #24445 - - - - - e5886de5 by Ben Gamari at 2024-02-21T05:03:44-05:00 rts/AdjustorPool: Use ExecPage abstraction This is just a minor cleanup I found while reviewing the implementation. - - - - - 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - eccba6d1 by Sebastian Graf at 2024-03-12T20:26:16+01:00 Parser: Remove unused `apats` rule - - - - - 3b25a96d by David Knothe at 2024-03-12T23:00:07+01:00 Implement Or Patterns (#22596) This commit introduces a new language extension, `-XOrPatterns`, as described in GHC Proposal 522. An or-pattern `pat1; ...; patk` succeeds iff one of the patterns `pat1`, ..., `patk` succeed, in this order. See also the summary `Note [Implmentation of OrPatterns]`. Co-Authored-By: Sebastian Graf <sgraf1337 at gmail.com> - - - - - 68160db0 by Sebastian Graf at 2024-03-12T23:00:59+01:00 Undo PgNoPat stuff - - - - - 19 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/merge_request_templates/Default.md - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - .gitlab/rel_eng/upload_ghc_libs.py - .gitmodules - CODEOWNERS - compiler/GHC.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/438218fe2555c066d51e1a5bb009e4f8edaa7aaa...68160db0a7c09d07c292c87d530897537adbb3d5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/438218fe2555c066d51e1a5bb009e4f8edaa7aaa...68160db0a7c09d07c292c87d530897537adbb3d5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 23:26:25 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 12 Mar 2024 19:26:25 -0400 Subject: [Git][ghc/ghc][master] 3 commits: Remove duplicate code normalising slashes Message-ID: <65f0e4a135e96_16f214c4d491c6779b@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7 changed files: - testsuite/driver/testlib.py - testsuite/tests/parser/should_fail/T21843a.stderr - testsuite/tests/parser/should_fail/T21843b.stderr - testsuite/tests/parser/should_fail/T21843c.stderr - testsuite/tests/parser/should_fail/T21843d.stderr - testsuite/tests/parser/should_fail/T21843e.stderr - testsuite/tests/parser/should_fail/T21843f.stderr Changes: ===================================== testsuite/driver/testlib.py ===================================== @@ -1119,8 +1119,8 @@ def normalise_win32_io_errors(name, opts): def normalise_version_( *pkgs ): def normalise_version__( str ): # (name)(-version)(-hash)(-components) - return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-zA-Z\+]+)?(-[0-9a-zA-Z]+)?', - '\\1--', str) + return re.sub('(' + '|'.join(map(re.escape,pkgs)) + r')-[0-9.]+(-[0-9a-zA-Z+]+)?(-[0-9a-zA-Z]+)?', + r'\1--', str) return normalise_version__ def normalise_version( *pkgs ): @@ -1491,7 +1491,7 @@ async def do_test(name: TestName, if opts.expect not in ['pass', 'fail', 'missing-lib']: framework_fail(name, way, 'bad expected ' + opts.expect) - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) if way in opts.fragile_ways: if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail')) @@ -1538,7 +1538,7 @@ def override_options(pre_cmd): def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = '%s(%s)' % (name, way) if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) name2 = name if name is not None else TestName('none') @@ -1549,7 +1549,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str def framework_warn(name: TestName, way: WayName, reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = name + '(' + way + ')' if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) t.framework_warnings.append(TestResult(directory, name, reason, way)) @@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str: s = normalise_callstacks(s) s = normalise_type_reps(s) - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + # normalise slashes to minimise Windows/Unix filename differences, + # but don't normalize backslashes in chars + s = re.sub(r"(?!')\\", '/', s) # Normalize the name of the GHC executable. Specifically, # this catches the cases that: @@ -2614,14 +2615,11 @@ def normalise_errmsg(s: str) -> str: # the colon is there because it appears in error messages; this # hacky solution is used in place of more sophisticated filename # mangling - s = re.sub('([^\\s])\\.exe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) # Same thing for .wasm modules generated by the Wasm backend - s = re.sub('([^\\s])\\.wasm', '\\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) # Same thing for .jsexe directories generated by the JS backend - s = re.sub('([^\\s])\\.jsexe', '\\1', s) - - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) # hpc executable is given ghc suffix s = re.sub('hpc-ghc', 'hpc', s) @@ -2631,8 +2629,8 @@ def normalise_errmsg(s: str) -> str: s = re.sub('ghc-stage[123]', 'ghc', s) # Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools # (ghc, ghc-pkg, unlit, etc.) - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) - s = re.sub('\\w+(-\\w+)*-unlit', 'unlit', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-unlit', 'unlit', s) # On windows error messages can mention versioned executables s = re.sub('ghc-[0-9.]+', 'ghc', s) @@ -2735,8 +2733,8 @@ def normalise_prof (s: str) -> str: return s def normalise_slashes_( s: str ) -> str: - s = re.sub('\\\\', '/', s) - s = re.sub('//', '/', s) + s = re.sub(r'\\', '/', s) + s = re.sub(r'//', '/', s) return s def normalise_exe_( s: str ) -> str: @@ -2754,9 +2752,9 @@ def normalise_output( s: str ) -> str: # and .wasm extension (for the Wasm backend) # and .jsexe extension (for the JS backend) # This can occur in error messages generated by the program. - s = re.sub('([^\\s])\\.exe', '\\1', s) - s = re.sub('([^\\s])\\.wasm', '\\1', s) - s = re.sub('([^\\s])\\.jsexe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) s = normalise_callstacks(s) s = normalise_type_reps(s) # ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is @@ -2776,7 +2774,7 @@ def normalise_output( s: str ) -> str: s = re.sub('.*warning: argument unused during compilation:.*\n', '', s) # strip the cross prefix if any - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) return s ===================================== testsuite/tests/parser/should_fail/T21843a.stderr ===================================== @@ -1,4 +1,4 @@ T21843a.hs:3:13: [GHC-31623] - Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not + Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843b.stderr ===================================== @@ -1,3 +1,3 @@ T21843b.hs:3:11: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843c.stderr ===================================== @@ -1,6 +1,6 @@ T21843c.hs:3:19: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not T21843c.hs:3:20: [GHC-21231] - lexical error in string/character literal at character '/n' + lexical error in string/character literal at character '\n' ===================================== testsuite/tests/parser/should_fail/T21843d.stderr ===================================== @@ -1,3 +1,3 @@ T21843d.hs:3:13: [GHC-31623] - Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not + Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843e.stderr ===================================== @@ -1,3 +1,3 @@ T21843e.hs:3:15: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843f.stderr ===================================== @@ -1,3 +1,3 @@ T21843f.hs:3:13: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0590764c73841115fc567757e370d5c9dc7e6478...1a5f53c6d4f3812835b8b72f36d9d23004b38f1f -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0590764c73841115fc567757e370d5c9dc7e6478...1a5f53c6d4f3812835b8b72f36d9d23004b38f1f You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 23:27:04 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 12 Mar 2024 19:27:04 -0400 Subject: [Git][ghc/ghc][master] Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) Message-ID: <65f0e4c8bcc07_16f214c5e30d870862@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 9 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accommodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ea971d314c4eba59e12e94bf3eb8edb95fbfac5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ea971d314c4eba59e12e94bf3eb8edb95fbfac5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 12 23:27:47 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 12 Mar 2024 19:27:47 -0400 Subject: [Git][ghc/ghc][master] 2 commits: Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" Message-ID: <65f0e4f3a6be6_16f214c835afc7394c@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 2 changed files: - compiler/GHC/Types/Unique/Supply.hs - compiler/cbits/genSym.c Changes: ===================================== compiler/GHC/Types/Unique/Supply.hs ===================================== @@ -7,7 +7,6 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE UnboxedTuples #-} -{-# LANGUAGE UnliftedFFITypes #-} module GHC.Types.Unique.Supply ( -- * Main data type @@ -49,16 +48,16 @@ import Foreign.Storable #define NO_FETCH_ADD #endif -#if defined(javascript_HOST_ARCH) -import GHC.Exts ( atomicCasWord64Addr#, eqWord64# ) -#elif !defined(NO_FETCH_ADD) -import GHC.Exts( fetchAddWordAddr#, word64ToWord#, wordToWord64# ) +#if defined(NO_FETCH_ADD) +import GHC.Exts ( atomicCasWord64Addr#, eqWord64#, readWord64OffAddr# ) +#else +import GHC.Exts( fetchAddWordAddr#, word64ToWord# ) #endif import GHC.Exts ( Addr#, State#, Word64#, RealWorld ) - +import GHC.Int ( Int(..) ) import GHC.Word( Word64(..) ) -import GHC.Exts( plusWord64#, readWord64OffAddr# ) +import GHC.Exts( plusWord64#, int2Word#, wordToWord64# ) {- ************************************************************************ @@ -233,8 +232,9 @@ mkSplitUniqSupply c (# s4, MkSplitUniqSupply (tag .|. u) x y #) }}}} -#if defined(javascript_HOST_ARCH) --- CAS-based pure Haskell implementation +#if defined(NO_FETCH_ADD) +-- GHC currently does not provide this operation on 32-bit platforms, +-- hence the CAS-based implementation. fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# = go @@ -246,35 +246,7 @@ fetchAddWord64Addr# = go (# s2, res #) | 1# <- res `eqWord64#` n0 -> (# s2, n0 #) | otherwise -> go ptr inc s2 - -#elif defined(NO_FETCH_ADD) - --- atomic_inc64 is defined in compiler/cbits/genSym.c. This is of --- course not ideal, but we need to live with it for now given the --- current situation: --- 1. There's no Haskell primop fetchAddWord64Addr# on 32-bit --- platforms yet --- 2. The Cmm %fetch_add64 primop syntax is only present in ghc 9.8 --- but we currently bootstrap from older ghc in our CI --- 3. The Cmm MO_AtomicRMW operation with 64-bit width is well --- supported on 32-bit platforms already, but the plumbing from --- either Haskell or Cmm doesn't work yet because of 1 or 2 --- 4. There's hs_atomic_add64 in ghc-prim cbits that we ought to use, --- but it's only available on 32-bit starting from ghc 9.8 --- 5. The pure Haskell implementation causes mysterious i386 --- regression in unrelated ghc work that can only be fixed by the C --- version here - -foreign import ccall unsafe "atomic_inc64" atomic_inc64 :: Addr# -> Word64# -> IO Word64 - -fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld - -> (# State# RealWorld, Word64# #) -fetchAddWord64Addr# addr inc s0 = - case unIO (atomic_inc64 addr inc) s0 of - (# s1, W64# res #) -> (# s1, res #) - #else - fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# addr inc s0 = @@ -286,9 +258,9 @@ genSym :: IO Word64 genSym = do let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1 let !(Ptr counter) = ghc_unique_counter64 - let !(Ptr inc_ptr) = ghc_unique_inc - u <- IO $ \s0 -> case readWord64OffAddr# inc_ptr 0# s0 of - (# s1, inc #) -> case fetchAddWord64Addr# counter inc s1 of + I# inc# <- peek ghc_unique_inc + let !inc = wordToWord64# (int2Word# inc#) + u <- IO $ \s1 -> case fetchAddWord64Addr# counter inc s1 of (# s2, val #) -> let !u = W64# (val `plusWord64#` inc) .&. mask in (# s2, u #) ===================================== compiler/cbits/genSym.c ===================================== @@ -15,11 +15,3 @@ HsWord64 ghc_unique_counter64 = 0; #if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) HsInt ghc_unique_inc = 1; #endif - -// Only used on 32-bit non-JS platforms -#if WORD_SIZE_IN_BITS != 64 -StgWord64 atomic_inc64(StgWord64 volatile* p, StgWord64 incr) -{ - return __atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST); -} -#endif View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7ea971d314c4eba59e12e94bf3eb8edb95fbfac5...e6bfb85c842edca36754bb8914e725fbaa1a83a6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7ea971d314c4eba59e12e94bf3eb8edb95fbfac5...e6bfb85c842edca36754bb8914e725fbaa1a83a6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 00:39:46 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Tue, 12 Mar 2024 20:39:46 -0400 Subject: [Git][ghc/ghc][wip/andreask/stm] STM: Be more optimistic when validating in-flight transactions. Message-ID: <65f0f5d289cfc_67be2cb3cc08217f@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/stm at Glasgow Haskell Compiler / GHC Commits: c50cc783 by Andreas Klebinger at 2024-03-13T01:21:50+01:00 STM: Be more optimistic when validating in-flight transactions. * Don't lock tvars when performing non-committal validation. * If we encounter a locked tvar don't consider it a failure. This means in-flight validation will only fail if committing at the moment of validation is *guaranteed* to fail. This prevents in-flight validation from failing spuriously if it happens in parallel on multiple threads or parallel to thread comitting. - - - - - 5 changed files: - rts/Exception.cmm - rts/STM.c - rts/STM.h - rts/Schedule.c - rts/include/stg/SMP.h Changes: ===================================== rts/Exception.cmm ===================================== @@ -495,7 +495,7 @@ retry_pop_stack: W_ trec, outer; W_ r; trec = StgTSO_trec(CurrentTSO); - (r) = ccall stmValidateNestOfTransactions(MyCapability() "ptr", trec "ptr"); + (r) = ccall stmValidateNestOfTransactions(MyCapability() "ptr", trec "ptr", 0); outer = StgTRecHeader_enclosing_trec(trec); ccall stmAbortTransaction(MyCapability() "ptr", trec "ptr"); ccall stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr"); ===================================== rts/STM.c ===================================== @@ -359,6 +359,8 @@ static StgTRecHeader *new_stg_trec_header(Capability *cap, // Allocation / deallocation functions that retain per-capability lists // of closures that can be re-used +//TODO: I think some of these lack write barriers required by the non-moving gc. + static StgTVarWatchQueue *alloc_stg_tvar_watch_queue(Capability *cap, StgClosure *closure) { StgTVarWatchQueue *result = NULL; @@ -681,6 +683,44 @@ static void revert_ownership(Capability *cap STG_UNUSED, /*......................................................................*/ +// validate_optimistic() +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec); + +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec) { + StgBool result; + TRACE("cap %d, trec %p : validate_trec_optimistic", + cap->no, trec); + + if (shake()) { + TRACE("%p : shake, pretending trec is invalid when it may not be", trec); + return false; + } + + ASSERT((trec -> state == TREC_ACTIVE) || + (trec -> state == TREC_WAITING) || + (trec -> state == TREC_CONDEMNED)); + result = !((trec -> state) == TREC_CONDEMNED); + if (result) { + FOR_EACH_ENTRY(trec, e, { + StgTVar *s; + s = e -> tvar; + StgClosure *current = RELAXED_LOAD(&s->current_value); + if(current != e->expected_value && + //If the trec is locked we optimistically assume our trec will still be valid after it's unlocked. + (GET_INFO(UNTAG_CLOSURE(current)) != &stg_TREC_HEADER_info)) + { TRACE("%p : failed optimistic validate %p", trec, s); + result = false; + BREAK_FOR_EACH; + } + }); + } + + + TRACE("%p : validate_trec_optimistic, result: %d", trec, result); + return result; +} + + // validate_and_acquire_ownership : this performs the twin functions // of checking that the TVars referred to by entries in trec hold the // expected values and: @@ -751,7 +791,7 @@ static StgBool validate_and_acquire_ownership (Capability *cap, revert_ownership(cap, trec, acquire_all); } - // TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); + TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); return result; } @@ -941,17 +981,124 @@ void stmCondemnTransaction(Capability *cap, TRACE("%p : stmCondemnTransaction done", trec); } -/*......................................................................*/ - -// Check if a transaction is known to be invalid by this point. -// Currently we use this to: -// * Eagerly abort invalid transactions from the scheduler. -// * If an exception occured inside a transaction, decide weither or not to -// abort by checking if the transaction was valid. -StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { +/*...................................................................... + +Note [STM Validation] +~~~~~~~~~~~~~~~~~~~~~ +We validate STM transactions for two purposes: +* Ensure the trec (transaction log) is valid *after* execution. Either during + commit or after an exception has occured. Potentially locking the tvars in + the process. This is done by validate_and_acquire_ownership. +* Terminate transactions early after their trec became invalid. + This is done by validate_trec_optimistic, + +Note that the second point is not merely a optimization. Consider transactions +that are in an infinite loop as a result of seeing an inconsistent view of +memory, e.g. + + atomically $ do + [a,b] <- mapM readTVar [ta,tb] + -- a is never equal to b given a consistent view of memory. + when (a == b) loop + +We want to to always get a precise result for both checks. And indeed for the +non-threaded runtime this is reasonably (see STM paper "Composable Memory Transactions"). +However for SMP things are more difficult. + +The easiest way to avoid false positives is to lock all relevant tvars during +validation. And indeed that is what we still use for post-run validation. +While this can lead to validation spuriously failing in edge cases when multiple +threads perform validation in parallel the relevant transactions will simply be +restarted and as long as the false-negative rate is reasonably low this is not +problematic. + +However compared to post-run validation in-flight validation can happen multiple +times per transaction. This means even a fairly low rate of spurious validation +failures will result in a large performance hit. In the worst case preventing +progress alltogether (See #24446). + +We don't want to reduce validation frequency too much to detect invalid +transactions early. So we simply stick with the frequency "on return to scheduler" +that's described in the stm paper. + +However we can improve the behaviour of in-flight validations by taking advantage +of the fact that we can allow false positives for these. + +The biggest overhead we can reduce for in-flight validation is locking. We simply +won't take any locks for in-flight validation. If the tvar is already locked we +simply assume the value in our trec is still valid. + +This has the following effects: + +Benefits: +* No lock contention between post-run and in-flight validations operating on the + same tvars. This reduces the false negative rate significantly for both. +* Concurrent in-flight validations won't cause each other to fail spuriously + through lock contention. +* No cas operations for in-flight validation reduces it's overhead significantly. + +Drawbacks: +* We will sometimes fail to recognize invalid trecs as such by assuming locked + tvars contain valid values. + +Why can we simply not lock tvars for in-flight validations? Unlike with post-run +validation if we miss part of an update which would invalidate the trec it will +be either seen by a later validation (at the latest in the post-run validation +which still locks). However there is one exception: Looping transactions. + +If a transaction loops it will *only* be validated optimistically. I think this +is not an issue. The only way for in-flight validation to constantly +result in false-positives is for the conflicting tvar(s) to get constantly locked +for updates by post-run validations. Which seems impossibly unlikely over a long +period of time. At at least not any more likely than some of the other similarly +unlikely live-lock scenarious for the STM implementation. + +Alternatives: + +All of these primarily revolve around ways to ensure that we can recognize invalid +looping transactions. However without proof this is a real problem implementing +those seems not worthwhile. + + +A1: +Take locks for in-flight validation opportunistically to improve things. +While this would solve lock contention/false positives caused +by concurrent in-flight validations. It would still result in in-flight validation +potentially triggering false-negatives during post-run validation by holding a +lock a post-run validation is trying to take. Neither is it guaranteed to +recognize a looping transaction as invalid, so this does not seem like an +improvement to the lock-free inflight validation. + +A2: +Perform occasional locking in-flight validation for long running transactions. +This would solve the theoretical looping transaction recognition issue at the +cost of some performance and complexity. This could done by adding a counter to +the trec, counting the number of validations it has endured. + +A2.1: +Like A2, but instead of counting the number of validations count the number of +potentially false-positives by keeping track of how often we couldn't validate +locked tvars. Could be done fine grained on a trec-entry bases or for the trec +overall. + +A3: +When encountering a locked tvar, validate the trec based on the value of the +tvar before it was locked. This could be done by either adding another field +to the tvar, or by looking for the expected value in the trec that holds the +lock of the tvar. But neither option sounds great. + + +*/ + +// Check if a transaction is possibly invalid by this point. +// Pessimistically - Currently we use this if an exception occured inside a transaction. +// To decide weither or not to abort by checking if the transaction was valid. +// Optimistically - Currently we use this to eagerly abort invalid transactions from the scheduler. +// See Note [STM Validation] +StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec, StgBool optimistically) { StgTRecHeader *t; - TRACE("%p : stmValidateNestOfTransactions", trec); + TRACE("%p : stmValidateNestOfTransactions, %b", trec, optimistically); ASSERT(trec != NO_TREC); ASSERT((trec -> state == TREC_ACTIVE) || (trec -> state == TREC_WAITING) || @@ -960,8 +1107,13 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { t = trec; StgBool result = true; while (t != NO_TREC) { - // TODO: I don't think there is a need to lock any tvars here, all even less so. - result &= validate_and_acquire_ownership(cap, t, true, false); + if(optimistically) { + result &= validate_trec_optimistic(cap, t); + + } else { + // TODO: I don't think there is a need to lock all tvars here. + result &= validate_and_acquire_ownership(cap, t, true, false); + } t = t -> enclosing_trec; } @@ -972,7 +1124,6 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { TRACE("%p : stmValidateNestOfTransactions()=%d", trec, result); return result; } - /*......................................................................*/ static TRecEntry *get_entry_for(StgTRecHeader *trec, StgTVar *tvar, StgTRecHeader **in) { ===================================== rts/STM.h ===================================== @@ -84,16 +84,22 @@ void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec); Validation ---------- - Test whether the specified transaction record, and all those within which - it is nested, are still valid. + Test whether the specified transaction record, and all those within which + it is nested, are still valid. + + stmValidateNestOfTransactions - optimistically + - Can return false positives when tvars are locked. + - Faster + - Does not take any locks + + stmValidateNestOfTransactions - pessimistic + - Can return false negatives. + - Slower + - Takes locks, negatively affecting performance of other threads. - Note: the caller can assume that once stmValidateTransaction has - returned false for a given trec then that transaction will never - again be valid -- we rely on this in Schedule.c when kicking invalid - threads at GC (in case they are stuck looping) */ -StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); +StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec, StgBool optimistically); /*---------------------------------------------------------------------- @@ -110,7 +116,7 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); Note that, for nested operations, validity here is solely in terms of the specified trec: it does not say whether those that it may be nested are themselves valid. Callers can check this with - stmValidateNestOfTransactions. + stmValidateNestOfTransactionsPessimistic. The user of the STM should ensure that it is always safe to assume that a transaction context is not valid when in fact it is (i.e. to return false in ===================================== rts/Schedule.c ===================================== @@ -1099,7 +1099,7 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // and a is never equal to b given a consistent view of memory. // if (t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { - if (!stmValidateNestOfTransactions(cap, t -> trec)) { + if (!stmValidateNestOfTransactions(cap, t -> trec, true)) { debugTrace(DEBUG_sched | DEBUG_stm, "trec %p found wasting its time", t); ===================================== rts/include/stg/SMP.h ===================================== @@ -201,14 +201,15 @@ EXTERN_INLINE void busy_wait_nop(void); * - StgWeak: finalizer * - StgMVar: head, tail, value * - StgMVarTSOQueue: link - * - StgTVar: current_value, first_watch_queue_entry - * - StgTVarWatchQueue: {next,prev}_queue_entry - * - StgTRecChunk: TODO * - StgMutArrPtrs: payload * - StgSmallMutArrPtrs: payload * - StgThunk although this is a somewhat special case; see below * - StgInd: indirectee * - StgTSO: block_info + + * - StgTVar: current_value, first_watch_queue_entry + * - StgTVarWatchQueue: {next,prev}_queue_entry + * - StgTRecChunk: TODO * * Finally, non-pointer fields can be safely mutated without barriers as * they do not refer to other memory locations. Technically, concurrent View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c50cc783e9bc67a6ece9a5c4ae57baaa775687ea -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c50cc783e9bc67a6ece9a5c4ae57baaa775687ea You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 00:57:14 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Tue, 12 Mar 2024 20:57:14 -0400 Subject: [Git][ghc/ghc][wip/andreask/stm] STM: Be more optimistic when validating in-flight transactions. Message-ID: <65f0f9e9ede04_67be2148e8a083923@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/stm at Glasgow Haskell Compiler / GHC Commits: 896dbb54 by Andreas Klebinger at 2024-03-13T01:42:49+01:00 STM: Be more optimistic when validating in-flight transactions. * Don't lock tvars when performing non-committal validation. * If we encounter a locked tvar don't consider it a failure. This means in-flight validation will only fail if committing at the moment of validation is *guaranteed* to fail. This prevents in-flight validation from failing spuriously if it happens in parallel on multiple threads or parallel to thread comitting. - - - - - 7 changed files: - rts/Exception.cmm - rts/STM.c - rts/STM.h - rts/Schedule.c - rts/include/stg/SMP.h - + testsuite/tests/rts/T24142.hs - testsuite/tests/rts/all.T Changes: ===================================== rts/Exception.cmm ===================================== @@ -495,7 +495,7 @@ retry_pop_stack: W_ trec, outer; W_ r; trec = StgTSO_trec(CurrentTSO); - (r) = ccall stmValidateNestOfTransactions(MyCapability() "ptr", trec "ptr"); + (r) = ccall stmValidateNestOfTransactions(MyCapability() "ptr", trec "ptr", 0); outer = StgTRecHeader_enclosing_trec(trec); ccall stmAbortTransaction(MyCapability() "ptr", trec "ptr"); ccall stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr"); ===================================== rts/STM.c ===================================== @@ -359,6 +359,8 @@ static StgTRecHeader *new_stg_trec_header(Capability *cap, // Allocation / deallocation functions that retain per-capability lists // of closures that can be re-used +//TODO: I think some of these lack write barriers required by the non-moving gc. + static StgTVarWatchQueue *alloc_stg_tvar_watch_queue(Capability *cap, StgClosure *closure) { StgTVarWatchQueue *result = NULL; @@ -681,6 +683,44 @@ static void revert_ownership(Capability *cap STG_UNUSED, /*......................................................................*/ +// validate_optimistic() +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec); + +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec) { + StgBool result; + TRACE("cap %d, trec %p : validate_trec_optimistic", + cap->no, trec); + + if (shake()) { + TRACE("%p : shake, pretending trec is invalid when it may not be", trec); + return false; + } + + ASSERT((trec -> state == TREC_ACTIVE) || + (trec -> state == TREC_WAITING) || + (trec -> state == TREC_CONDEMNED)); + result = !((trec -> state) == TREC_CONDEMNED); + if (result) { + FOR_EACH_ENTRY(trec, e, { + StgTVar *s; + s = e -> tvar; + StgClosure *current = RELAXED_LOAD(&s->current_value); + if(current != e->expected_value && + //If the trec is locked we optimistically assume our trec will still be valid after it's unlocked. + (GET_INFO(UNTAG_CLOSURE(current)) != &stg_TREC_HEADER_info)) + { TRACE("%p : failed optimistic validate %p", trec, s); + result = false; + BREAK_FOR_EACH; + } + }); + } + + + TRACE("%p : validate_trec_optimistic, result: %d", trec, result); + return result; +} + + // validate_and_acquire_ownership : this performs the twin functions // of checking that the TVars referred to by entries in trec hold the // expected values and: @@ -751,7 +791,7 @@ static StgBool validate_and_acquire_ownership (Capability *cap, revert_ownership(cap, trec, acquire_all); } - // TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); + TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); return result; } @@ -941,17 +981,124 @@ void stmCondemnTransaction(Capability *cap, TRACE("%p : stmCondemnTransaction done", trec); } -/*......................................................................*/ - -// Check if a transaction is known to be invalid by this point. -// Currently we use this to: -// * Eagerly abort invalid transactions from the scheduler. -// * If an exception occured inside a transaction, decide weither or not to -// abort by checking if the transaction was valid. -StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { +/*...................................................................... + +Note [STM Validation] +~~~~~~~~~~~~~~~~~~~~~ +We validate STM transactions for two purposes: +* Ensure the trec (transaction log) is valid *after* execution. Either during + commit or after an exception has occured. Potentially locking the tvars in + the process. This is done by validate_and_acquire_ownership. +* Terminate transactions early after their trec became invalid. + This is done by validate_trec_optimistic, + +Note that the second point is not merely a optimization. Consider transactions +that are in an infinite loop as a result of seeing an inconsistent view of +memory, e.g. + + atomically $ do + [a,b] <- mapM readTVar [ta,tb] + -- a is never equal to b given a consistent view of memory. + when (a == b) loop + +We want to to always get a precise result for both checks. And indeed for the +non-threaded runtime this is reasonably (see STM paper "Composable Memory Transactions"). +However for SMP things are more difficult. + +The easiest way to avoid false positives is to lock all relevant tvars during +validation. And indeed that is what we still use for post-run validation. +While this can lead to validation spuriously failing in edge cases when multiple +threads perform validation in parallel the relevant transactions will simply be +restarted and as long as the false-negative rate is reasonably low this is not +problematic. + +However compared to post-run validation in-flight validation can happen multiple +times per transaction. This means even a fairly low rate of spurious validation +failures will result in a large performance hit. In the worst case preventing +progress alltogether (See #24446). + +We don't want to reduce validation frequency too much to detect invalid +transactions early. So we simply stick with the frequency "on return to scheduler" +that's described in the stm paper. + +However we can improve the behaviour of in-flight validations by taking advantage +of the fact that we can allow false positives for these. + +The biggest overhead we can reduce for in-flight validation is locking. We simply +won't take any locks for in-flight validation. If the tvar is already locked we +simply assume the value in our trec is still valid. + +This has the following effects: + +Benefits: +* No lock contention between post-run and in-flight validations operating on the + same tvars. This reduces the false negative rate significantly for both. +* Concurrent in-flight validations won't cause each other to fail spuriously + through lock contention. +* No cas operations for in-flight validation reduces it's overhead significantly. + +Drawbacks: +* We will sometimes fail to recognize invalid trecs as such by assuming locked + tvars contain valid values. + +Why can we simply not lock tvars for in-flight validations? Unlike with post-run +validation if we miss part of an update which would invalidate the trec it will +be either seen by a later validation (at the latest in the post-run validation +which still locks). However there is one exception: Looping transactions. + +If a transaction loops it will *only* be validated optimistically. I think this +is not an issue. The only way for in-flight validation to constantly +result in false-positives is for the conflicting tvar(s) to get constantly locked +for updates by post-run validations. Which seems impossibly unlikely over a long +period of time. At at least not any more likely than some of the other similarly +unlikely live-lock scenarious for the STM implementation. + +Alternatives: + +All of these primarily revolve around ways to ensure that we can recognize invalid +looping transactions. However without proof this is a real problem implementing +those seems not worthwhile. + + +A1: +Take locks for in-flight validation opportunistically to improve things. +While this would solve lock contention/false positives caused +by concurrent in-flight validations. It would still result in in-flight validation +potentially triggering false-negatives during post-run validation by holding a +lock a post-run validation is trying to take. Neither is it guaranteed to +recognize a looping transaction as invalid, so this does not seem like an +improvement to the lock-free inflight validation. + +A2: +Perform occasional locking in-flight validation for long running transactions. +This would solve the theoretical looping transaction recognition issue at the +cost of some performance and complexity. This could done by adding a counter to +the trec, counting the number of validations it has endured. + +A2.1: +Like A2, but instead of counting the number of validations count the number of +potentially false-positives by keeping track of how often we couldn't validate +locked tvars. Could be done fine grained on a trec-entry bases or for the trec +overall. + +A3: +When encountering a locked tvar, validate the trec based on the value of the +tvar before it was locked. This could be done by either adding another field +to the tvar, or by looking for the expected value in the trec that holds the +lock of the tvar. But neither option sounds great. + + +*/ + +// Check if a transaction is possibly invalid by this point. +// Pessimistically - Currently we use this if an exception occured inside a transaction. +// To decide weither or not to abort by checking if the transaction was valid. +// Optimistically - Currently we use this to eagerly abort invalid transactions from the scheduler. +// See Note [STM Validation] +StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec, StgBool optimistically) { StgTRecHeader *t; - TRACE("%p : stmValidateNestOfTransactions", trec); + TRACE("%p : stmValidateNestOfTransactions, %b", trec, optimistically); ASSERT(trec != NO_TREC); ASSERT((trec -> state == TREC_ACTIVE) || (trec -> state == TREC_WAITING) || @@ -960,8 +1107,13 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { t = trec; StgBool result = true; while (t != NO_TREC) { - // TODO: I don't think there is a need to lock any tvars here, all even less so. - result &= validate_and_acquire_ownership(cap, t, true, false); + if(optimistically) { + result &= validate_trec_optimistic(cap, t); + + } else { + // TODO: I don't think there is a need to lock all tvars here. + result &= validate_and_acquire_ownership(cap, t, true, false); + } t = t -> enclosing_trec; } @@ -972,7 +1124,6 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { TRACE("%p : stmValidateNestOfTransactions()=%d", trec, result); return result; } - /*......................................................................*/ static TRecEntry *get_entry_for(StgTRecHeader *trec, StgTVar *tvar, StgTRecHeader **in) { ===================================== rts/STM.h ===================================== @@ -84,16 +84,22 @@ void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec); Validation ---------- - Test whether the specified transaction record, and all those within which - it is nested, are still valid. + Test whether the specified transaction record, and all those within which + it is nested, are still valid. + + stmValidateNestOfTransactions - optimistically + - Can return false positives when tvars are locked. + - Faster + - Does not take any locks + + stmValidateNestOfTransactions - pessimistic + - Can return false negatives. + - Slower + - Takes locks, negatively affecting performance of other threads. - Note: the caller can assume that once stmValidateTransaction has - returned false for a given trec then that transaction will never - again be valid -- we rely on this in Schedule.c when kicking invalid - threads at GC (in case they are stuck looping) */ -StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); +StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec, StgBool optimistically); /*---------------------------------------------------------------------- @@ -110,7 +116,7 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); Note that, for nested operations, validity here is solely in terms of the specified trec: it does not say whether those that it may be nested are themselves valid. Callers can check this with - stmValidateNestOfTransactions. + stmValidateNestOfTransactionsPessimistic. The user of the STM should ensure that it is always safe to assume that a transaction context is not valid when in fact it is (i.e. to return false in ===================================== rts/Schedule.c ===================================== @@ -1099,7 +1099,7 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // and a is never equal to b given a consistent view of memory. // if (t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { - if (!stmValidateNestOfTransactions(cap, t -> trec)) { + if (!stmValidateNestOfTransactions(cap, t -> trec, true)) { debugTrace(DEBUG_sched | DEBUG_stm, "trec %p found wasting its time", t); ===================================== rts/include/stg/SMP.h ===================================== @@ -201,14 +201,15 @@ EXTERN_INLINE void busy_wait_nop(void); * - StgWeak: finalizer * - StgMVar: head, tail, value * - StgMVarTSOQueue: link - * - StgTVar: current_value, first_watch_queue_entry - * - StgTVarWatchQueue: {next,prev}_queue_entry - * - StgTRecChunk: TODO * - StgMutArrPtrs: payload * - StgSmallMutArrPtrs: payload * - StgThunk although this is a somewhat special case; see below * - StgInd: indirectee * - StgTSO: block_info + + * - StgTVar: current_value, first_watch_queue_entry + * - StgTVarWatchQueue: {next,prev}_queue_entry + * - StgTRecChunk: TODO * * Finally, non-pointer fields can be safely mutated without barriers as * they do not refer to other memory locations. Technically, concurrent ===================================== testsuite/tests/rts/T24142.hs ===================================== @@ -0,0 +1,63 @@ +{- This test constructs a program that used to trigger an excessive amount of STM retries. -} +{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE BangPatterns #-} +module Main where + +import GHC.Conc +import Control.Concurrent (newMVar, newEmptyMVar, takeMVar, putMVar) +import Control.Monad +import Control.Concurrent.STM.TArray +import Data.Array.MArray +import Data.IORef + + +main :: IO () +main = + forM_ [2..40] $ \i -> do + -- Run the test with an increasing number of tvars + let tvar_count = i * 10 + -- print $ "Tvars: " ++ show tvar_count + provokeLivelock tvar_count + + +-- Forks two threads running a STM transactions, both accessing the same tvars but in opposite order. +provokeLivelock :: Int -> IO () +provokeLivelock n = do + -- Use tvar array as a convenient way to bundle up n Tvars. + tvarArray <- atomically $ do + newListArray (0,n) [0.. fromIntegral n :: Integer] :: STM (TArray Int Integer) + m1 <- newEmptyMVar + m2 <- newEmptyMVar + updateCount <- newIORef (0 :: Int) + + let useTvars :: [Int] -> Bool -> IO () + useTvars tvar_order use_writes = atomically $ do + -- Walk the array once in the given order to add all tvars to the transaction log. + unsafeIOToSTM $ atomicModifyIORef' updateCount (\i -> (i+1,())) + mapM_ (\i -> readArray tvarArray i >>= \(!_n) -> return ()) tvar_order + + + -- Then we just enter the scheduler a lot + forM_ tvar_order $ \i -> do + -- when use_writes $ + -- readArray tvarArray i >>= \(!n) -> writeArray tvarArray i (n+1 :: Integer) + unsafeIOToSTM yield + + _ <- forkIO $ do + useTvars [0..n] False + -- print "Thread1 done." + putMVar m1 True + _ <- forkIO $ do + useTvars (reverse [0..n]) False + -- print "Thread1 done." + putMVar m2 True + -- Wait for forked threads. + _ <- takeMVar m1 + _ <- takeMVar m2 + updates <- readIORef updateCount + if updates > n + then putStrLn $ "TVars: " ++ show n ++ ", ERROR: more than " ++ show n ++ " transaction attempts. (" ++ show updates ++")\n" + else putStrLn $ "TVars: " ++ show n ++ ", OK: no more than " ++ show n ++ " transaction attempts." + + return () + ===================================== testsuite/tests/rts/all.T ===================================== @@ -609,3 +609,6 @@ test('T23400', [], compile_and_run, ['-with-rtsopts -A8k']) test('IOManager', [js_skip, when(arch('wasm32'), skip), when(opsys('mingw32'), skip), pre_cmd('$MAKE -s --no-print-directory IOManager.hs')], compile_and_run, ['']) + +test('T24142', [], compile_and_run, ['-threaded -with-rtsopts "-N2"']) + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/896dbb542b5c474621090fe300cc00aaf37211d8 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/896dbb542b5c474621090fe300cc00aaf37211d8 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 08:26:44 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Wed, 13 Mar 2024 04:26:44 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/tysyn-info-ppr] Update GHCi :info type synonym printing (24459) Message-ID: <65f16344408c8_67be2d008928964ae@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/tysyn-info-ppr at Glasgow Haskell Compiler / GHC Commits: 61f884a0 by Andrei Borzenkov at 2024-03-13T12:26:22+04:00 Update GHCi :info type synonym printing (24459) - Do not print result's kind since we have full kind in SAKS and we display invisible arity using @-binders - Do not suppress significant invisible binders Invisible binder is considered significant when it meets at least one of two following criteria: - It visibly occurs in the RHS type - It is not followed by a visible binder, so it affects arity of type synonym - - - - - 23 changed files: - compiler/GHC/Core/TyCon.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Type.hs - testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout - testsuite/tests/backpack/should_fail/T19244a.stderr - testsuite/tests/backpack/should_fail/T19244b.stderr - testsuite/tests/backpack/should_fail/bkpfail46.stderr - testsuite/tests/ghci/T18060/T18060.stdout - testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout - testsuite/tests/ghci/scripts/T15941.stdout - testsuite/tests/ghci/scripts/T19310.stdout - testsuite/tests/ghci/scripts/T21294a.stdout - + testsuite/tests/ghci/scripts/T24459.script - + testsuite/tests/ghci/scripts/T24459.stdout - testsuite/tests/ghci/scripts/T8535.stdout - testsuite/tests/ghci/scripts/T9181.stdout - testsuite/tests/ghci/scripts/all.T - testsuite/tests/ghci/scripts/ghci020.stdout - testsuite/tests/ghci/should_run/T10145.stdout - testsuite/tests/ghci/should_run/T18594.stdout - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/rep-poly/RepPolyBackpack3.stderr Changes: ===================================== compiler/GHC/Core/TyCon.hs ===================================== @@ -25,7 +25,7 @@ module GHC.Core.TyCon( mkRequiredTyConBinder, mkAnonTyConBinder, mkAnonTyConBinders, tyConBinderForAllTyFlag, tyConBndrVisForAllTyFlag, isNamedTyConBinder, - isVisibleTyConBinder, isInvisibleTyConBinder, + isVisibleTyConBinder, isInvisSpecTyConBinder, isInvisibleTyConBinder, isVisibleTcbVis, isInvisSpecTcbVis, -- ** Field labels @@ -514,6 +514,10 @@ isInvisSpecTcbVis :: TyConBndrVis -> Bool isInvisSpecTcbVis (NamedTCB Specified) = True isInvisSpecTcbVis _ = False +isInvisSpecTyConBinder :: VarBndr tv TyConBndrVis -> Bool +-- Works for IfaceTyConBinder too +isInvisSpecTyConBinder (Bndr _ tcb_vis) = isInvisSpecTcbVis tcb_vis + isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool -- Works for IfaceTyConBinder too isInvisibleTyConBinder tcb = not (isVisibleTyConBinder tcb) ===================================== compiler/GHC/Iface/Syntax.hs ===================================== @@ -1033,15 +1033,14 @@ pprIfaceDecl ss (IfaceClass { ifName = clas pprIfaceDecl ss (IfaceSynonym { ifName = tc , ifBinders = binders - , ifSynRhs = mono_ty + , ifSynRhs = poly_ty , ifResKind = res_kind}) = vcat [ pprStandaloneKindSig name_doc (mkIfaceTyConKind binders res_kind) - , hang (text "type" <+> pprIfaceDeclHead suppress_bndr_sig [] ss tc binders <+> equals) - 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau - , ppUnless (isIfaceLiftedTypeKind res_kind) (dcolon <+> ppr res_kind) ]) + , hang (text "type" <+> pprIfaceDeclHeadInvis suppress_bndr_sig [] ss tc binders tau <+> equals) + 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau ]) ] where - (tvs, theta, tau) = splitIfaceSigmaTy mono_ty + (tvs, theta, tau) = splitIfaceSigmaTy poly_ty name_doc = pprPrefixIfDeclBndr (ss_how_much ss) (occName tc) -- See Note [Printing type abbreviations] in GHC.Iface.Type @@ -1232,6 +1231,18 @@ pprIfaceDeclHead suppress_sig context ss tc_occ bndrs <+> pprIfaceTyConBinders suppress_sig (suppressIfaceInvisibles (PrintExplicitKinds print_kinds) bndrs bndrs) ] +pprIfaceDeclHeadInvis :: SuppressBndrSig + -> IfaceContext -> ShowSub -> Name + -> [IfaceTyConBinder] -- of the tycon, for invisible-suppression + -> IfaceType -- RHS + -> SDoc +pprIfaceDeclHeadInvis suppress_sig context ss tc_occ bndrs rhs + = sdocOption sdocPrintExplicitKinds $ \print_kinds -> + sep [ pprIfaceContextArr context + , pprPrefixIfDeclBndr (ss_how_much ss) (occName tc_occ) + <+> pprIfaceTyConBinders suppress_sig + (suppressIfaceInsignificantInvisibles (PrintExplicitKinds print_kinds) rhs bndrs) ] + pprIfaceConDecl :: ShowSub -> Bool -> IfaceTopBndr -> [IfaceTyConBinder] ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -54,7 +54,7 @@ module GHC.Iface.Type ( pprIfaceCoTcApp, pprTyTcApp, pprIfacePrefixApp, isIfaceRhoType, - suppressIfaceInvisibles, + suppressIfaceInvisibles, suppressIfaceInsignificantInvisibles, stripIfaceInvisVars, stripInvisArgs, @@ -521,6 +521,26 @@ suppressIfaceInvisibles (PrintExplicitKinds False) tys xs = suppress tys xs | isInvisibleTyConBinder k = suppress ks xs | otherwise = x : suppress ks xs +-- Invisible binder is considered significant when it meet at least +-- one of two following criteria: +-- - It visibly occurs in the RHS type +-- - It is not followed by a visible binder, so it +-- affects arity of type synonym +suppressIfaceInsignificantInvisibles :: PrintExplicitKinds -> IfaceType -> [IfaceTyConBinder] -> [IfaceTyConBinder] +suppressIfaceInsignificantInvisibles (PrintExplicitKinds True) _rhs tys = tys +suppressIfaceInsignificantInvisibles (PrintExplicitKinds False) rhs tys = suppress [] tys + where + mentioned_var var = ifTyConBinderName var `ifTypeVarVisiblyOccurs` rhs + + mentioned_vars vars = + filter mentioned_var vars + + suppress acc [] = reverse acc + suppress acc (k:ks) = case binderFlag k of + NamedTCB Specified -> suppress (k : acc) ks + NamedTCB Inferred -> suppress acc ks + _ -> reverse (mentioned_vars acc) ++ k : suppress [] ks + stripIfaceInvisVars :: PrintExplicitKinds -> [IfaceTyConBinder] -> [IfaceTyConBinder] stripIfaceInvisVars (PrintExplicitKinds True) tyvars = tyvars stripIfaceInvisVars (PrintExplicitKinds False) tyvars @@ -561,6 +581,27 @@ ifTypeIsVarFree ty = go ty go_args IA_Nil = True go_args (IA_Arg arg _ args) = go arg && go_args args +ifTypeVarVisiblyOccurs :: IfLclName -> IfaceType -> Bool +-- Returns True if the type contains this name. Doesn't count +-- invisible application +-- Just used to control pretty printing +ifTypeVarVisiblyOccurs name ty = go ty + where + go (IfaceTyVar var) = var == name + go (IfaceFreeTyVar {}) = False + go (IfaceAppTy fun args) = go fun || go_args args + go (IfaceFunTy _ w arg res) = go w || go arg || go res + go (IfaceForAllTy bndr ty) = go (ifaceBndrType (binderVar bndr)) || go ty + go (IfaceTyConApp _ args) = go_args args + go (IfaceTupleTy _ _ args) = go_args args + go (IfaceLitTy _) = False + go (IfaceCastTy {}) = False -- Safe + go (IfaceCoercionTy {}) = False -- Safe + + go_args IA_Nil = False + go_args (IA_Arg arg Required args) = go arg || go_args args + go_args (IA_Arg _arg _ args) = go_args args + {- Note [Substitution on IfaceType] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Substitutions on IfaceType are done only during pretty-printing to ===================================== testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout ===================================== @@ -1,11 +1,11 @@ -Preprocessing library 'impl' for bkpcabal08-0.1.0.0... -Building library 'impl' for bkpcabal08-0.1.0.0... Preprocessing library 'p' for bkpcabal08-0.1.0.0... Building library 'p' instantiated with A = B = for bkpcabal08-0.1.0.0... [2 of 2] Compiling B[sig] ( p/B.hsig, nothing ) +Preprocessing library 'impl' for bkpcabal08-0.1.0.0... +Building library 'impl' for bkpcabal08-0.1.0.0... Preprocessing library 'q' for bkpcabal08-0.1.0.0... Building library 'q' instantiated with A = @@ -13,13 +13,13 @@ Building library 'q' instantiated with for bkpcabal08-0.1.0.0... [2 of 4] Compiling B[sig] ( q/B.hsig, nothing ) [3 of 4] Compiling M ( q/M.hs, nothing ) [A changed] -[4 of 4] Instantiating bkpcabal08-0.1.0.0-5O1mUtZZLBeDZEqqtwJcCj-p +[4 of 4] Instantiating bkpcabal08-0.1.0.0-CoQJNXLfoYQ4TyvApzFHv-p Preprocessing library 'q' for bkpcabal08-0.1.0.0... Building library 'q' instantiated with - A = bkpcabal08-0.1.0.0-DlVb5PcmUolGCHYbfTL7EP-impl:A - B = bkpcabal08-0.1.0.0-DlVb5PcmUolGCHYbfTL7EP-impl:B + A = bkpcabal08-0.1.0.0-5HJrxUERN7CD204UZeT4Ws-impl:A + B = bkpcabal08-0.1.0.0-5HJrxUERN7CD204UZeT4Ws-impl:B for bkpcabal08-0.1.0.0... -[1 of 3] Compiling A[sig] ( q/A.hsig, dist/build/bkpcabal08-0.1.0.0-LFiTKyjPqyn9yyuysCoVKg-q+5IA1jA4bEzCFcXtraqAC38/A.o ) [Prelude package changed] -[2 of 3] Compiling B[sig] ( q/B.hsig, dist/build/bkpcabal08-0.1.0.0-LFiTKyjPqyn9yyuysCoVKg-q+5IA1jA4bEzCFcXtraqAC38/B.o ) [Prelude package changed] +[1 of 3] Compiling A[sig] ( q/A.hsig, dist/build/bkpcabal08-0.1.0.0-1DQJ9DKc4h59P07qcb0kBc-q+J5mAfRWG9IgLmFQVftCb8t/A.o ) [Prelude package changed] +[2 of 3] Compiling B[sig] ( q/B.hsig, dist/build/bkpcabal08-0.1.0.0-1DQJ9DKc4h59P07qcb0kBc-q+J5mAfRWG9IgLmFQVftCb8t/B.o ) [Prelude package changed] Preprocessing library 'r' for bkpcabal08-0.1.0.0... Building library 'r' for bkpcabal08-0.1.0.0... ===================================== testsuite/tests/backpack/should_fail/T19244a.stderr ===================================== @@ -17,7 +17,7 @@ T19244a.bkp:22:9: error: [GHC-15843] • Type constructor ‘Key’ has conflicting definitions in the module and its hsig file. Main module: type Key :: * -> Constraint - type Key = GHC.Classes.Ord :: * -> Constraint + type Key = GHC.Classes.Ord Hsig file: type Key :: forall {k}. k -> Constraint class Key k1 The types have different kinds. ===================================== testsuite/tests/backpack/should_fail/T19244b.stderr ===================================== @@ -1,20 +1,20 @@ [1 of 3] Processing user - [1 of 2] Compiling Map[sig] ( user\Map.hsig, nothing ) - [2 of 2] Compiling User ( user\User.hs, nothing ) + [1 of 2] Compiling Map[sig] ( user/Map.hsig, nothing ) + [2 of 2] Compiling User ( user/User.hs, nothing ) [2 of 3] Processing ordmap Instantiating ordmap - [1 of 1] Compiling Map ( ordmap\Map.hs, T19244b.out\ordmap\Map.o ) + [1 of 1] Compiling Map ( ordmap/Map.hs, T19244b.out/ordmap/Map.o ) [3 of 3] Processing main Instantiating main [1 of 1] Including user[Map=ordmap:Map] Instantiating user[Map=ordmap:Map] - [1 of 2] Compiling Map[sig] ( user\Map.hsig, T19244b.out\user\user-GzloW2NeDdA2M0V8qzN4g2\Map.o ) + [1 of 2] Compiling Map[sig] ( user/Map.hsig, T19244b.out/user/user-GzloW2NeDdA2M0V8qzN4g2/Map.o ) T19244b.bkp:11:27: error: [GHC-15843] • Type constructor ‘Key’ has conflicting definitions in the module and its hsig file. Main module: type Key :: * -> Constraint - type Key = GHC.Classes.Ord :: * -> Constraint + type Key = GHC.Classes.Ord Hsig file: type Key :: forall {k}. k -> Constraint class Key k1 The types have different kinds. ===================================== testsuite/tests/backpack/should_fail/bkpfail46.stderr ===================================== @@ -1,20 +1,20 @@ [1 of 3] Processing p - [1 of 2] Compiling A[sig] ( p\A.hsig, nothing ) - [2 of 2] Compiling M ( p\M.hs, nothing ) + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling M ( p/M.hs, nothing ) [2 of 3] Processing q Instantiating q - [1 of 1] Compiling A ( q\A.hs, bkpfail46.out\q\A.o ) + [1 of 1] Compiling A ( q/A.hs, bkpfail46.out/q/A.o ) [3 of 3] Processing r Instantiating r [1 of 1] Including p[A=q:A] Instantiating p[A=q:A] - [1 of 2] Compiling A[sig] ( p\A.hsig, bkpfail46.out\p\p-HVmFlcYSefiK5n1aDP1v7x\A.o ) + [1 of 2] Compiling A[sig] ( p/A.hsig, bkpfail46.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o ) bkpfail46.bkp:16:9: error: [GHC-15843] • Type constructor ‘K’ has conflicting definitions in the module and its hsig file. Main module: type K :: * -> Constraint - type K a = GHC.Classes.Eq a :: Constraint + type K a = GHC.Classes.Eq a Hsig file: type K :: * -> Constraint class K a Illegal parameterized type synonym in implementation of abstract data. ===================================== testsuite/tests/ghci/T18060/T18060.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout ===================================== @@ -74,13 +74,13 @@ data Tuple2# a b = (#,#) a b (# , #) :: a -> b -> Tuple2# a b (Int, Int) :: Tuple2 (*) (*) type T :: Tuple2 (*) (*) -type T = (Int, Int) :: Tuple2 (*) (*) +type T = (Int, Int) -- Defined at :18:1 type S :: Solo (*) -type S = MkSolo Int :: Solo (*) +type S = MkSolo Int -- Defined at :19:1 type L :: List (*) -type L = [Int] :: List (*) +type L = [Int] -- Defined at :20:1 f :: Int -> Tuple2 Int Int -> Int (\ (_, _) -> ()) :: Tuple2 a b -> Unit ===================================== testsuite/tests/ghci/scripts/T15941.stdout ===================================== @@ -1,4 +1,3 @@ type T :: * -> * -> * -type T = - (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} :: * -> * -> * +type T = (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} -- Defined at :2:1 ===================================== testsuite/tests/ghci/scripts/T19310.stdout ===================================== @@ -1,3 +1,3 @@ type T :: * -> * -> * -type T = (->) @{LiftedRep} @{LiftedRep} :: * -> * -> * +type T = (->) @{LiftedRep} @{LiftedRep} -- Defined at :3:1 ===================================== testsuite/tests/ghci/scripts/T21294a.stdout ===================================== @@ -1,5 +1,5 @@ type L0 :: * -> * -type L0 = [] :: * -> * +type L0 = [] -- Defined at :1:1 type L1 :: * -> * type L1 a = [a] ===================================== testsuite/tests/ghci/scripts/T24459.script ===================================== @@ -0,0 +1,46 @@ +:set -XTypeAbstractions + +:{ +import Data.Kind +import Data.Data + + +type T6 :: forall k. Type -> Type +type T6 _a = () + +type T5 :: forall a. Type -> Type +type T5 @a _b = Proxy _b + +type T4 :: forall a. Type -> Type +type T4 @a _b = Proxy a + +type T3 :: forall k. k -> Type +type T3 a = Proxy a + +type T2 :: forall k. k -> Type +type T2 @k = Proxy + +type T1 :: forall k. k -> Type +type T1 = Proxy + +type T0 :: forall k. k -> Type +type T0 = Proxy :: forall k. k -> Type +:} + +:i T0 +:i T1 +:i T2 +:i T3 +:i T4 +:i T5 +:i T6 + +:set -fprint-explicit-kinds + +:i T0 +:i T1 +:i T2 +:i T3 +:i T4 +:i T5 +:i T6 ===================================== testsuite/tests/ghci/scripts/T24459.stdout ===================================== @@ -0,0 +1,42 @@ +type T0 :: forall k. k -> * +type T0 = Proxy + -- Defined at :27:1 +type T1 :: forall k. k -> * +type T1 = Proxy + -- Defined at :24:1 +type T2 :: forall k. k -> * +type T2 @k = Proxy + -- Defined at :21:1 +type T3 :: forall k. k -> * +type T3 a = Proxy a + -- Defined at :18:1 +type T4 :: forall {k} (a :: k). * -> * +type T4 @a _b = Proxy a + -- Defined at :15:1 +type T5 :: forall {k} (a :: k). * -> * +type T5 _b = Proxy _b + -- Defined at :12:1 +type T6 :: forall {k} (k1 :: k). * -> * +type T6 _a = () + -- Defined at :9:1 +type T0 :: forall k. k -> * +type T0 = Proxy + -- Defined at :27:1 +type T1 :: forall k. k -> * +type T1 = Proxy + -- Defined at :24:1 +type T2 :: forall k. k -> * +type T2 @k = Proxy @{k} + -- Defined at :21:1 +type T3 :: forall k. k -> * +type T3 @k a = Proxy @{k} a + -- Defined at :18:1 +type T4 :: forall {k} (a :: k). * -> * +type T4 @{k} @a _b = Proxy @{k} a + -- Defined at :15:1 +type T5 :: forall {k} (a :: k). * -> * +type T5 @{k} @a _b = Proxy @{*} _b + -- Defined at :12:1 +type T6 :: forall {k} (k1 :: k). * -> * +type T6 @{k} @k1 _a = () + -- Defined at :9:1 ===================================== testsuite/tests/ghci/scripts/T8535.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/scripts/T9181.stdout ===================================== @@ -13,12 +13,10 @@ type (GHC.Internal.Data.Type.Ord.<=) x y = GHC.Internal.TypeError.Assert (x GHC.Internal.Data.Type.Ord.<=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) - :: Constraint type (GHC.Internal.Data.Type.Ord.<=?) :: forall k. k -> k -> Bool type (GHC.Internal.Data.Type.Ord.<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) True True False - :: Bool type GHC.Internal.TypeLits.AppendSymbol :: GHC.Types.Symbol -> GHC.Types.Symbol -> GHC.Types.Symbol type family GHC.Internal.TypeLits.AppendSymbol a b ===================================== testsuite/tests/ghci/scripts/all.T ===================================== @@ -384,3 +384,4 @@ test('T23686', normal, ghci_script, ['T23686.script']) test('T13869', extra_files(['T13869a.hs', 'T13869b.hs']), ghci_script, ['T13869.script']) test('ListTuplePunsPpr', normal, ghci_script, ['ListTuplePunsPpr.script']) test('ListTuplePunsPprNoAbbrevTuple', [expect_broken(23135), limit_stdout_lines(13)], ghci_script, ['ListTuplePunsPprNoAbbrevTuple.script']) +test('T24459', normal, ghci_script, ['T24459.script']) ===================================== testsuite/tests/ghci/scripts/ghci020.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/should_run/T10145.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/ghci/should_run/T18594.stdout ===================================== @@ -1,5 +1,5 @@ type (->) :: * -> * -> * -type (->) = FUN Many :: * -> * -> * +type (->) = FUN Many -- Defined in ‘GHC.Types’ infixr -1 -> instance Monoid b => Monoid (a -> b) ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -1760,27 +1760,27 @@ module Data.Type.Equality where module Data.Type.Ord where -- Safety: Safe type (<) :: forall {t}. t -> t -> Constraint - type (<) x y = GHC.Internal.TypeError.Assert (x t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type ( k -> GHC.Types.Bool - type () :: forall {t}. t -> t -> Constraint - type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) :: Constraint + type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) type (>=) :: forall {t}. t -> t -> Constraint - type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) :: Constraint + type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) type (>=?) :: forall k. k -> k -> GHC.Types.Bool - type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True :: GHC.Types.Bool + type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True type (>?) :: forall k. k -> k -> GHC.Types.Bool - type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True :: GHC.Types.Bool + type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True type Compare :: forall k. k -> k -> GHC.Types.Ordering type family Compare a b type Max :: forall k. k -> k -> k - type Max m n = OrdCond (Compare m n) n n m :: k + type Max m n = OrdCond (Compare m n) n n m type Min :: forall k. k -> k -> k - type Min m n = OrdCond (Compare m n) m m n :: k + type Min m n = OrdCond (Compare m n) m m n type OrdCond :: forall k. GHC.Types.Ordering -> k -> k -> k -> k type family OrdCond o lt eq gt where forall k (lt :: k) (eq :: k) (gt :: k). OrdCond GHC.Types.LT lt eq gt = lt @@ -3315,7 +3315,7 @@ module GHC.Base where type Levity :: * data Levity = Lifted | Unlifted type LiftedRep :: RuntimeRep - type LiftedRep = BoxedRep Lifted :: RuntimeRep + type LiftedRep = BoxedRep Lifted type List :: * -> * data List a = ... type role MVar# nominal representational @@ -3428,7 +3428,7 @@ module GHC.Base where type TypeLitSort :: * data TypeLitSort = TypeLitSymbol | TypeLitNat | TypeLitChar type UnliftedRep :: RuntimeRep - type UnliftedRep = BoxedRep Unlifted :: RuntimeRep + type UnliftedRep = BoxedRep Unlifted type UnliftedType :: * type UnliftedType = TYPE UnliftedRep type VecCount :: * @@ -3438,7 +3438,7 @@ module GHC.Base where type Void :: * data Void type Void# :: ZeroBitType - type Void# = (# #) :: ZeroBitType + type Void# = (# #) type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType data Weak# a type WithDict :: Constraint -> * -> Constraint @@ -3484,7 +3484,7 @@ module GHC.Base where type WordBox :: TYPE WordRep -> * data WordBox a = MkWordBox a type ZeroBitRep :: RuntimeRep - type ZeroBitRep = TupleRep '[] :: RuntimeRep + type ZeroBitRep = TupleRep '[] type ZeroBitType :: * type ZeroBitType = TYPE ZeroBitRep absentErr :: forall a. a @@ -5513,7 +5513,7 @@ module GHC.Exts where type Levity :: * data Levity = Lifted | Unlifted type LiftedRep :: RuntimeRep - type LiftedRep = BoxedRep Lifted :: RuntimeRep + type LiftedRep = BoxedRep Lifted type List :: * -> * data List a = ... type role MVar# nominal representational @@ -5588,7 +5588,7 @@ module GHC.Exts where TypeLitNat :: GHC.Types.TypeLitSort TypeLitSymbol :: GHC.Types.TypeLitSort type UnliftedRep :: RuntimeRep - type UnliftedRep = BoxedRep Unlifted :: RuntimeRep + type UnliftedRep = BoxedRep Unlifted type UnliftedType :: * type UnliftedType = TYPE UnliftedRep type VecCount :: * @@ -5596,7 +5596,7 @@ module GHC.Exts where type VecElem :: * data VecElem = Int8ElemRep | Int16ElemRep | Int32ElemRep | Int64ElemRep | Word8ElemRep | Word16ElemRep | Word32ElemRep | Word64ElemRep | FloatElemRep | DoubleElemRep type Void# :: ZeroBitType - type Void# = (# #) :: ZeroBitType + type Void# = (# #) type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType data Weak# a type WithDict :: Constraint -> * -> Constraint @@ -5642,7 +5642,7 @@ module GHC.Exts where type WordBox :: TYPE WordRep -> * data WordBox a = MkWordBox a type ZeroBitRep :: RuntimeRep - type ZeroBitRep = TupleRep '[] :: RuntimeRep + type ZeroBitRep = TupleRep '[] type ZeroBitType :: * type ZeroBitType = TYPE ZeroBitRep acosDouble# :: Double# -> Double# @@ -7377,7 +7377,7 @@ module GHC.Generics where type C :: * data C type C1 :: forall {k}. Meta -> (k -> *) -> k -> * - type C1 = M1 C :: Meta -> (k -> *) -> k -> * + type C1 = M1 C type Constructor :: forall {k}. k -> Constraint class Constructor c where conName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t c f a -> [GHC.Types.Char] @@ -7387,7 +7387,7 @@ module GHC.Generics where type D :: * data D type D1 :: forall {k}. Meta -> (k -> *) -> k -> * - type D1 = M1 D :: Meta -> (k -> *) -> k -> * + type D1 = M1 D type Datatype :: forall {k}. k -> Constraint class Datatype d where datatypeName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t d f a -> [GHC.Types.Char] @@ -7434,14 +7434,14 @@ module GHC.Generics where type R :: * data R type Rec0 :: forall {k}. * -> k -> * - type Rec0 = K1 R :: * -> k -> * + type Rec0 = K1 R type role Rec1 representational nominal type Rec1 :: forall k. (k -> *) -> k -> * newtype Rec1 f p = Rec1 {unRec1 :: f p} type S :: * data S type S1 :: forall {k}. Meta -> (k -> *) -> k -> * - type S1 = M1 S :: Meta -> (k -> *) -> k -> * + type S1 = M1 S type Selector :: forall {k}. k -> Constraint class Selector s where selName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t s f a -> [GHC.Types.Char] @@ -7458,24 +7458,24 @@ module GHC.Generics where data U1 p = U1 UAddr :: forall k (p :: k). GHC.Prim.Addr# -> URec (GHC.Internal.Ptr.Ptr ()) p type UAddr :: forall {k}. k -> * - type UAddr = URec (GHC.Internal.Ptr.Ptr ()) :: k -> * + type UAddr = URec (GHC.Internal.Ptr.Ptr ()) UChar :: forall k (p :: k). GHC.Prim.Char# -> URec GHC.Types.Char p type UChar :: forall {k}. k -> * - type UChar = URec GHC.Types.Char :: k -> * + type UChar = URec GHC.Types.Char UDouble :: forall k (p :: k). GHC.Prim.Double# -> URec GHC.Types.Double p type UDouble :: forall {k}. k -> * - type UDouble = URec GHC.Types.Double :: k -> * + type UDouble = URec GHC.Types.Double UFloat :: forall k (p :: k). GHC.Prim.Float# -> URec GHC.Types.Float p type UFloat :: forall {k}. k -> * - type UFloat = URec GHC.Types.Float :: k -> * + type UFloat = URec GHC.Types.Float UInt :: forall k (p :: k). GHC.Prim.Int# -> URec GHC.Types.Int p type UInt :: forall {k}. k -> * - type UInt = URec GHC.Types.Int :: k -> * + type UInt = URec GHC.Types.Int type URec :: forall k. * -> k -> * data family URec a p UWord :: forall k (p :: k). GHC.Prim.Word# -> URec GHC.Types.Word p type UWord :: forall {k}. k -> * - type UWord = URec GHC.Types.Word :: k -> * + type UWord = URec GHC.Types.Word type role V1 phantom type V1 :: forall k. k -> * data V1 p @@ -8563,7 +8563,7 @@ module GHC.Num.BigNat where type BigNat :: * data BigNat = BN# {unBigNat :: BigNat#} type BigNat# :: GHC.Types.UnliftedType - type BigNat# = GHC.Num.WordArray.WordArray# :: GHC.Types.UnliftedType + type BigNat# = GHC.Num.WordArray.WordArray# bigNatAdd :: BigNat# -> BigNat# -> BigNat# bigNatAddWord :: BigNat# -> GHC.Types.Word -> BigNat# bigNatAddWord# :: BigNat# -> GHC.Prim.Word# -> BigNat# @@ -9345,7 +9345,7 @@ module GHC.Stack where type CostCentreStack :: * data CostCentreStack type HasCallStack :: Constraint - type HasCallStack = ?callStack::CallStack :: Constraint + type HasCallStack = ?callStack::CallStack type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} callStack :: HasCallStack => CallStack @@ -9406,7 +9406,7 @@ module GHC.Stack.Types where type CallStack :: * data CallStack = EmptyCallStack | PushCallStack [GHC.Types.Char] SrcLoc CallStack | FreezeCallStack CallStack type HasCallStack :: Constraint - type HasCallStack = ?callStack::CallStack :: Constraint + type HasCallStack = ?callStack::CallStack type SrcLoc :: * data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int} emptyCallStack :: CallStack @@ -9561,9 +9561,9 @@ module GHC.TypeLits where type (-) :: Natural -> Natural -> Natural type family (-) a b type (<=) :: forall {t}. t -> t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type AppendSymbol :: Symbol -> Symbol -> Symbol type family AppendSymbol a b type CharToNat :: GHC.Types.Char -> Natural @@ -9680,9 +9680,9 @@ module GHC.TypeNats where type (-) :: Natural -> Natural -> Natural type family (-) a b type (<=) :: forall {t}. t -> t -> Constraint - type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint + type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) type (<=?) :: forall k. k -> k -> GHC.Types.Bool - type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool + type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False type CmpNat :: Natural -> Natural -> GHC.Types.Ordering type family CmpNat a b type Div :: Natural -> Natural -> Natural ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout ===================================== @@ -1480,9 +1480,9 @@ module Data.Tuple.Experimental where class a => CSolo a {-# MINIMAL #-} type CTuple0 :: Constraint - type CTuple0 = () :: Constraint :: Constraint + type CTuple0 = () :: Constraint type CTuple1 :: Constraint -> Constraint - type CTuple1 = CSolo :: Constraint -> Constraint + type CTuple1 = CSolo type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j {-# MINIMAL #-} @@ -2637,11 +2637,11 @@ module Data.Tuple.Experimental where type Tuple0 :: * type Tuple0 = () type Tuple0# :: GHC.Types.ZeroBitType - type Tuple0# = (# #) :: GHC.Types.ZeroBitType + type Tuple0# = (# #) type Tuple1 :: * -> * - type Tuple1 = Solo :: * -> * + type Tuple1 = Solo type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) - type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) + type Tuple1# = Solo# type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * data Tuple10 a b c d e f g h i j = ... type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9]) @@ -4328,9 +4328,9 @@ module Prelude.Experimental where class a => CSolo a {-# MINIMAL #-} type CTuple0 :: Constraint - type CTuple0 = () :: Constraint :: Constraint + type CTuple0 = () :: Constraint type CTuple1 :: Constraint -> Constraint - type CTuple1 = CSolo :: Constraint -> Constraint + type CTuple1 = CSolo type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j {-# MINIMAL #-} @@ -6959,11 +6959,11 @@ module Prelude.Experimental where type Tuple0 :: * type Tuple0 = () type Tuple0# :: GHC.Types.ZeroBitType - type Tuple0# = (# #) :: GHC.Types.ZeroBitType + type Tuple0# = (# #) type Tuple1 :: * -> * - type Tuple1 = Solo :: * -> * + type Tuple1 = Solo type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) - type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep]) + type Tuple1# = Solo# type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * data Tuple10 a b c d e f g h i j = ... type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9]) ===================================== testsuite/tests/rep-poly/RepPolyBackpack3.stderr ===================================== @@ -1,19 +1,19 @@ [1 of 3] Processing sig - [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, nothing ) + [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, nothing ) [2 of 3] Processing impl Instantiating impl - [1 of 1] Compiling Impl ( impl\Impl.hs, RepPolyBackpack3.out\impl\Impl.o ) + [1 of 1] Compiling Impl ( impl/Impl.hs, RepPolyBackpack3.out/impl/Impl.o ) [3 of 3] Processing main Instantiating main [1 of 1] Including sig[Sig=impl:Impl] Instantiating sig[Sig=impl:Impl] - [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, RepPolyBackpack3.out\sig\sig-Absk5cIXTXe6UYhGMYGber\Sig.o ) + [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, RepPolyBackpack3.out/sig/sig-Absk5cIXTXe6UYhGMYGber/Sig.o ) RepPolyBackpack3.bkp:17:5: error: [GHC-15843] • Type constructor ‘Rep’ has conflicting definitions in the module and its hsig file. Main module: type Rep :: GHC.Types.RuntimeRep - type Rep = T :: GHC.Types.RuntimeRep + type Rep = T Hsig file: type Rep :: GHC.Types.RuntimeRep data Rep Illegal implementation of abstract data: Invalid type family ‘T’. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/61f884a02e9a3360f0a0e911e203c763ea33b90a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/61f884a02e9a3360f0a0e911e203c763ea33b90a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 08:55:47 2024 From: gitlab at gitlab.haskell.org (Sebastian Graf (@sgraf812)) Date: Wed, 13 Mar 2024 04:55:47 -0400 Subject: [Git][ghc/ghc][wip/or-pats] 2 commits: Implement Or Patterns (#22596) Message-ID: <65f16a137790a_67be2ddc85cc982d2@gitlab.mail> Sebastian Graf pushed to branch wip/or-pats at Glasgow Haskell Compiler / GHC Commits: 67709931 by David Knothe at 2024-03-13T09:55:32+01:00 Implement Or Patterns (#22596) This commit introduces a new language extension, `-XOrPatterns`, as described in GHC Proposal 522. An or-pattern `pat1; ...; patk` succeeds iff one of the patterns `pat1`, ..., `patk` succeed, in this order. See also the summary `Note [Implmentation of OrPatterns]`. Co-Authored-By: Sebastian Graf <sgraf1337 at gmail.com> - - - - - 22a2c32e by Sebastian Graf at 2024-03-13T09:55:32+01:00 Undo PgNoPat stuff - - - - - 30 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Pat.hs - compiler/GHC/Hs/Syn/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Match.hs - compiler/GHC/HsToCore/Pmc/Check.hs - compiler/GHC/HsToCore/Pmc/Desugar.hs - compiler/GHC/HsToCore/Pmc/Types.hs - compiler/GHC/HsToCore/Utils.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Bind.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/TyCl/PatSyn.hs - compiler/GHC/Tc/Zonk/Type.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Extension.hs - compiler/Language/Haskell/Syntax/Pat.hs - + docs/users_guide/exts/or_patterns.rst - docs/users_guide/exts/patterns.rst - libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/68160db0a7c09d07c292c87d530897537adbb3d5...22a2c32e57f94894b398ba4b8b6478fe4fcf4a1a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/68160db0a7c09d07c292c87d530897537adbb3d5...22a2c32e57f94894b398ba4b8b6478fe4fcf4a1a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 09:24:58 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Wed, 13 Mar 2024 05:24:58 -0400 Subject: [Git][ghc/ghc][wip/andreask/stm] STM: Be more optimistic when validating in-flight transactions. Message-ID: <65f170e9ead5e_29bf3dcbe8f067855@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/stm at Glasgow Haskell Compiler / GHC Commits: 4d1be3de by Andreas Klebinger at 2024-03-13T10:10:37+01:00 STM: Be more optimistic when validating in-flight transactions. * Don't lock tvars when performing non-committal validation. * If we encounter a locked tvar don't consider it a failure. This means in-flight validation will only fail if committing at the moment of validation is *guaranteed* to fail. This prevents in-flight validation from failing spuriously if it happens in parallel on multiple threads or parallel to thread comitting. - - - - - 8 changed files: - rts/Exception.cmm - rts/STM.c - rts/STM.h - rts/Schedule.c - rts/include/stg/SMP.h - + testsuite/tests/rts/T24142.hs - + testsuite/tests/rts/T24142.stdout - testsuite/tests/rts/all.T Changes: ===================================== rts/Exception.cmm ===================================== @@ -495,7 +495,7 @@ retry_pop_stack: W_ trec, outer; W_ r; trec = StgTSO_trec(CurrentTSO); - (r) = ccall stmValidateNestOfTransactions(MyCapability() "ptr", trec "ptr"); + (r) = ccall stmValidateNestOfTransactions(MyCapability() "ptr", trec "ptr", 0); outer = StgTRecHeader_enclosing_trec(trec); ccall stmAbortTransaction(MyCapability() "ptr", trec "ptr"); ccall stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr"); ===================================== rts/STM.c ===================================== @@ -359,6 +359,8 @@ static StgTRecHeader *new_stg_trec_header(Capability *cap, // Allocation / deallocation functions that retain per-capability lists // of closures that can be re-used +//TODO: I think some of these lack write barriers required by the non-moving gc. + static StgTVarWatchQueue *alloc_stg_tvar_watch_queue(Capability *cap, StgClosure *closure) { StgTVarWatchQueue *result = NULL; @@ -681,6 +683,44 @@ static void revert_ownership(Capability *cap STG_UNUSED, /*......................................................................*/ +// validate_optimistic() +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec); + +StgBool validate_trec_optimistic (Capability *cap, StgTRecHeader *trec) { + StgBool result; + TRACE("cap %d, trec %p : validate_trec_optimistic", + cap->no, trec); + + if (shake()) { + TRACE("%p : shake, pretending trec is invalid when it may not be", trec); + return false; + } + + ASSERT((trec -> state == TREC_ACTIVE) || + (trec -> state == TREC_WAITING) || + (trec -> state == TREC_CONDEMNED)); + result = !((trec -> state) == TREC_CONDEMNED); + if (result) { + FOR_EACH_ENTRY(trec, e, { + StgTVar *s; + s = e -> tvar; + StgClosure *current = RELAXED_LOAD(&s->current_value); + if(current != e->expected_value && + //If the trec is locked we optimistically assume our trec will still be valid after it's unlocked. + (GET_INFO(UNTAG_CLOSURE(current)) != &stg_TREC_HEADER_info)) + { TRACE("%p : failed optimistic validate %p", trec, s); + result = false; + BREAK_FOR_EACH; + } + }); + } + + + TRACE("%p : validate_trec_optimistic, result: %d", trec, result); + return result; +} + + // validate_and_acquire_ownership : this performs the twin functions // of checking that the TVars referred to by entries in trec hold the // expected values and: @@ -751,7 +791,7 @@ static StgBool validate_and_acquire_ownership (Capability *cap, revert_ownership(cap, trec, acquire_all); } - // TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); + TRACE("%p : validate_and_acquire_ownership, result: %d", trec, result); return result; } @@ -941,17 +981,124 @@ void stmCondemnTransaction(Capability *cap, TRACE("%p : stmCondemnTransaction done", trec); } -/*......................................................................*/ - -// Check if a transaction is known to be invalid by this point. -// Currently we use this to: -// * Eagerly abort invalid transactions from the scheduler. -// * If an exception occured inside a transaction, decide weither or not to -// abort by checking if the transaction was valid. -StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { +/*...................................................................... + +Note [STM Validation] +~~~~~~~~~~~~~~~~~~~~~ +We validate STM transactions for two purposes: +* Ensure the trec (transaction log) is valid *after* execution. Either during + commit or after an exception has occured. Potentially locking the tvars in + the process. This is done by validate_and_acquire_ownership. +* Terminate transactions early after their trec became invalid. + This is done by validate_trec_optimistic, + +Note that the second point is not merely a optimization. Consider transactions +that are in an infinite loop as a result of seeing an inconsistent view of +memory, e.g. + + atomically $ do + [a,b] <- mapM readTVar [ta,tb] + -- a is never equal to b given a consistent view of memory. + when (a == b) loop + +We want to to always get a precise result for both checks. And indeed for the +non-threaded runtime this is reasonably (see STM paper "Composable Memory Transactions"). +However for SMP things are more difficult. + +The easiest way to avoid false positives is to lock all relevant tvars during +validation. And indeed that is what we still use for post-run validation. +While this can lead to validation spuriously failing in edge cases when multiple +threads perform validation in parallel the relevant transactions will simply be +restarted and as long as the false-negative rate is reasonably low this is not +problematic. + +However compared to post-run validation in-flight validation can happen multiple +times per transaction. This means even a fairly low rate of spurious validation +failures will result in a large performance hit. In the worst case preventing +progress alltogether (See #24446). + +We don't want to reduce validation frequency too much to detect invalid +transactions early. So we simply stick with the frequency "on return to scheduler" +that's described in the stm paper. + +However we can improve the behaviour of in-flight validations by taking advantage +of the fact that we can allow false positives for these. + +The biggest overhead we can reduce for in-flight validation is locking. We simply +won't take any locks for in-flight validation. If the tvar is already locked we +simply assume the value in our trec is still valid. + +This has the following effects: + +Benefits: +* No lock contention between post-run and in-flight validations operating on the + same tvars. This reduces the false negative rate significantly for both. +* Concurrent in-flight validations won't cause each other to fail spuriously + through lock contention. +* No cas operations for in-flight validation reduces it's overhead significantly. + +Drawbacks: +* We will sometimes fail to recognize invalid trecs as such by assuming locked + tvars contain valid values. + +Why can we simply not lock tvars for in-flight validations? Unlike with post-run +validation if we miss part of an update which would invalidate the trec it will +be either seen by a later validation (at the latest in the post-run validation +which still locks). However there is one exception: Looping transactions. + +If a transaction loops it will *only* be validated optimistically. I think this +is not an issue. The only way for in-flight validation to constantly +result in false-positives is for the conflicting tvar(s) to get constantly locked +for updates by post-run validations. Which seems impossibly unlikely over a long +period of time. At at least not any more likely than some of the other similarly +unlikely live-lock scenarious for the STM implementation. + +Alternatives: + +All of these primarily revolve around ways to ensure that we can recognize invalid +looping transactions. However without proof this is a real problem implementing +those seems not worthwhile. + + +A1: +Take locks for in-flight validation opportunistically to improve things. +While this would solve lock contention/false positives caused +by concurrent in-flight validations. It would still result in in-flight validation +potentially triggering false-negatives during post-run validation by holding a +lock a post-run validation is trying to take. Neither is it guaranteed to +recognize a looping transaction as invalid, so this does not seem like an +improvement to the lock-free inflight validation. + +A2: +Perform occasional locking in-flight validation for long running transactions. +This would solve the theoretical looping transaction recognition issue at the +cost of some performance and complexity. This could done by adding a counter to +the trec, counting the number of validations it has endured. + +A2.1: +Like A2, but instead of counting the number of validations count the number of +potentially false-positives by keeping track of how often we couldn't validate +locked tvars. Could be done fine grained on a trec-entry bases or for the trec +overall. + +A3: +When encountering a locked tvar, validate the trec based on the value of the +tvar before it was locked. This could be done by either adding another field +to the tvar, or by looking for the expected value in the trec that holds the +lock of the tvar. But neither option sounds great. + + +*/ + +// Check if a transaction is possibly invalid by this point. +// Pessimistically - Currently we use this if an exception occured inside a transaction. +// To decide weither or not to abort by checking if the transaction was valid. +// Optimistically - Currently we use this to eagerly abort invalid transactions from the scheduler. +// See Note [STM Validation] +StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec, StgBool optimistically) { StgTRecHeader *t; - TRACE("%p : stmValidateNestOfTransactions", trec); + TRACE("%p : stmValidateNestOfTransactions, %b", trec, optimistically); ASSERT(trec != NO_TREC); ASSERT((trec -> state == TREC_ACTIVE) || (trec -> state == TREC_WAITING) || @@ -960,8 +1107,13 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { t = trec; StgBool result = true; while (t != NO_TREC) { - // TODO: I don't think there is a need to lock any tvars here, all even less so. - result &= validate_and_acquire_ownership(cap, t, true, false); + if(optimistically) { + result &= validate_trec_optimistic(cap, t); + + } else { + // TODO: I don't think there is a need to lock all tvars here. + result &= validate_and_acquire_ownership(cap, t, true, false); + } t = t -> enclosing_trec; } @@ -972,7 +1124,6 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec) { TRACE("%p : stmValidateNestOfTransactions()=%d", trec, result); return result; } - /*......................................................................*/ static TRecEntry *get_entry_for(StgTRecHeader *trec, StgTVar *tvar, StgTRecHeader **in) { ===================================== rts/STM.h ===================================== @@ -20,7 +20,7 @@ non-conflicting transactions to commit in parallel. The implementation treats reads optimistically -- extra versioning information is retained in the - saw_update_by field of the TVars so that they do not + num_updates field of the TVars so that they do not need to be locked for reading. STM.C contains more details about the locking schemes used. @@ -84,16 +84,23 @@ void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec); Validation ---------- - Test whether the specified transaction record, and all those within which - it is nested, are still valid. + Test whether the specified transaction record, and all those within which + it is nested, are still valid. + + stmValidateNestOfTransactions - optimistically + - Can return false positives when tvars are locked. + - Faster + - Does not take any locks + + stmValidateNestOfTransactions - pessimistic + - Can return false negatives. + - Slower + - Takes locks, negatively affecting performance of other threads. + - Most importantly - no false positives! - Note: the caller can assume that once stmValidateTransaction has - returned false for a given trec then that transaction will never - again be valid -- we rely on this in Schedule.c when kicking invalid - threads at GC (in case they are stuck looping) */ -StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); +StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec, StgBool optimistically); /*---------------------------------------------------------------------- @@ -110,7 +117,7 @@ StgBool stmValidateNestOfTransactions(Capability *cap, StgTRecHeader *trec); Note that, for nested operations, validity here is solely in terms of the specified trec: it does not say whether those that it may be nested are themselves valid. Callers can check this with - stmValidateNestOfTransactions. + stmValidateNestOfTransactionsPessimistic. The user of the STM should ensure that it is always safe to assume that a transaction context is not valid when in fact it is (i.e. to return false in ===================================== rts/Schedule.c ===================================== @@ -1099,7 +1099,7 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // and a is never equal to b given a consistent view of memory. // if (t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { - if (!stmValidateNestOfTransactions(cap, t -> trec)) { + if (!stmValidateNestOfTransactions(cap, t -> trec, true)) { debugTrace(DEBUG_sched | DEBUG_stm, "trec %p found wasting its time", t); ===================================== rts/include/stg/SMP.h ===================================== @@ -201,14 +201,15 @@ EXTERN_INLINE void busy_wait_nop(void); * - StgWeak: finalizer * - StgMVar: head, tail, value * - StgMVarTSOQueue: link - * - StgTVar: current_value, first_watch_queue_entry - * - StgTVarWatchQueue: {next,prev}_queue_entry - * - StgTRecChunk: TODO * - StgMutArrPtrs: payload * - StgSmallMutArrPtrs: payload * - StgThunk although this is a somewhat special case; see below * - StgInd: indirectee * - StgTSO: block_info + + * - StgTVar: current_value, first_watch_queue_entry + * - StgTVarWatchQueue: {next,prev}_queue_entry + * - StgTRecChunk: TODO * * Finally, non-pointer fields can be safely mutated without barriers as * they do not refer to other memory locations. Technically, concurrent ===================================== testsuite/tests/rts/T24142.hs ===================================== @@ -0,0 +1,63 @@ +{- This test constructs a program that used to trigger an excessive amount of STM retries. -} +{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE BangPatterns #-} +module Main where + +import GHC.Conc +import Control.Concurrent (newMVar, newEmptyMVar, takeMVar, putMVar) +import Control.Monad +import Control.Concurrent.STM.TArray +import Data.Array.MArray +import Data.IORef + + +main :: IO () +main = + forM_ [2..40] $ \i -> do + -- Run the test with an increasing number of tvars + let tvar_count = i * 10 + -- print $ "Tvars: " ++ show tvar_count + provokeLivelock tvar_count + + +-- Forks two threads running a STM transactions, both accessing the same tvars but in opposite order. +provokeLivelock :: Int -> IO () +provokeLivelock n = do + -- Use tvar array as a convenient way to bundle up n Tvars. + tvarArray <- atomically $ do + newListArray (0,n) [0.. fromIntegral n :: Integer] :: STM (TArray Int Integer) + m1 <- newEmptyMVar + m2 <- newEmptyMVar + updateCount <- newIORef (0 :: Int) + + let useTvars :: [Int] -> Bool -> IO () + useTvars tvar_order use_writes = atomically $ do + -- Walk the array once in the given order to add all tvars to the transaction log. + unsafeIOToSTM $ atomicModifyIORef' updateCount (\i -> (i+1,())) + mapM_ (\i -> readArray tvarArray i >>= \(!_n) -> return ()) tvar_order + + + -- Then we just enter the scheduler a lot + forM_ tvar_order $ \i -> do + -- when use_writes $ + -- readArray tvarArray i >>= \(!n) -> writeArray tvarArray i (n+1 :: Integer) + unsafeIOToSTM yield + + _ <- forkIO $ do + useTvars [0..n] False + -- print "Thread1 done." + putMVar m1 True + _ <- forkIO $ do + useTvars (reverse [0..n]) False + -- print "Thread1 done." + putMVar m2 True + -- Wait for forked threads. + _ <- takeMVar m1 + _ <- takeMVar m2 + updates <- readIORef updateCount + if updates > n + then putStrLn $ "TVars: " ++ show n ++ ", ERROR: more than " ++ show n ++ " transaction attempts. (" ++ show updates ++")\n" + else putStrLn $ "TVars: " ++ show n ++ ", OK: no more than " ++ show n ++ " transaction attempts." + + return () + ===================================== testsuite/tests/rts/T24142.stdout ===================================== @@ -0,0 +1,39 @@ +TVars: 20, OK: no more than 20 transaction attempts. +TVars: 30, OK: no more than 30 transaction attempts. +TVars: 40, OK: no more than 40 transaction attempts. +TVars: 50, OK: no more than 50 transaction attempts. +TVars: 60, OK: no more than 60 transaction attempts. +TVars: 70, OK: no more than 70 transaction attempts. +TVars: 80, OK: no more than 80 transaction attempts. +TVars: 90, OK: no more than 90 transaction attempts. +TVars: 100, OK: no more than 100 transaction attempts. +TVars: 110, OK: no more than 110 transaction attempts. +TVars: 120, OK: no more than 120 transaction attempts. +TVars: 130, OK: no more than 130 transaction attempts. +TVars: 140, OK: no more than 140 transaction attempts. +TVars: 150, OK: no more than 150 transaction attempts. +TVars: 160, OK: no more than 160 transaction attempts. +TVars: 170, OK: no more than 170 transaction attempts. +TVars: 180, OK: no more than 180 transaction attempts. +TVars: 190, OK: no more than 190 transaction attempts. +TVars: 200, OK: no more than 200 transaction attempts. +TVars: 210, OK: no more than 210 transaction attempts. +TVars: 220, OK: no more than 220 transaction attempts. +TVars: 230, OK: no more than 230 transaction attempts. +TVars: 240, OK: no more than 240 transaction attempts. +TVars: 250, OK: no more than 250 transaction attempts. +TVars: 260, OK: no more than 260 transaction attempts. +TVars: 270, OK: no more than 270 transaction attempts. +TVars: 280, OK: no more than 280 transaction attempts. +TVars: 290, OK: no more than 290 transaction attempts. +TVars: 300, OK: no more than 300 transaction attempts. +TVars: 310, OK: no more than 310 transaction attempts. +TVars: 320, OK: no more than 320 transaction attempts. +TVars: 330, OK: no more than 330 transaction attempts. +TVars: 340, OK: no more than 340 transaction attempts. +TVars: 350, OK: no more than 350 transaction attempts. +TVars: 360, OK: no more than 360 transaction attempts. +TVars: 370, OK: no more than 370 transaction attempts. +TVars: 380, OK: no more than 380 transaction attempts. +TVars: 390, OK: no more than 390 transaction attempts. +TVars: 400, OK: no more than 400 transaction attempts. ===================================== testsuite/tests/rts/all.T ===================================== @@ -609,3 +609,6 @@ test('T23400', [], compile_and_run, ['-with-rtsopts -A8k']) test('IOManager', [js_skip, when(arch('wasm32'), skip), when(opsys('mingw32'), skip), pre_cmd('$MAKE -s --no-print-directory IOManager.hs')], compile_and_run, ['']) + +test('T24142', [], compile_and_run, ['-threaded -with-rtsopts "-N2"']) + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4d1be3deb90759b53d78ea6d5603e33e7a28bd03 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4d1be3deb90759b53d78ea6d5603e33e7a28bd03 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 11:46:57 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Wed, 13 Mar 2024 07:46:57 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/sand-witch/bidir-ki-check Message-ID: <65f19231e8f2e_29bf3d4a0257c788e7@gitlab.mail> Andrei Borzenkov pushed new branch wip/sand-witch/bidir-ki-check at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/sand-witch/bidir-ki-check You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 13:07:16 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 13 Mar 2024 09:07:16 -0400 Subject: [Git][ghc/ghc][wip/ghc-9.10] mk/relpath: Fix quoting Message-ID: <65f1a504213da_29bf3d6c31c889148f@gitlab.mail> Ben Gamari pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: 9f85900d by Ben Gamari at 2024-03-13T08:59:50-04:00 mk/relpath: Fix quoting Previously there were two instances in this script which lacked proper quoting. This resulted in `relpath` invocations in the binary distribution Makefile producing incorrect results on Windows, leading to confusing failures from `sed` and the production of empty package registrations. Fixes #24538. - - - - - 1 changed file: - mk/relpath.sh Changes: ===================================== mk/relpath.sh ===================================== @@ -15,7 +15,7 @@ target="$2" common_part="$src" result="" -while test "${target#$common_part}" = "${target}" ; do +while test "${target#"$common_part"}" = "${target}" ; do #echo "common_part is now : \"$common_part\"" #echo "result is now : \"$result\"" #echo "target#common_part : \"${target#$common_part}\"" @@ -39,7 +39,7 @@ fi # since we now have identified the common part, # compute the non-common part -forward_part="${target#$common_part}" +forward_part="${target#"$common_part"}" #echo "forward_part = \"$forward_part\"" if test -n "$result" && test -n "$forward_part" ; then View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9f85900d1d851adaa91215b21d362eed95387b5d -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9f85900d1d851adaa91215b21d362eed95387b5d You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 13:16:36 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 13 Mar 2024 09:16:36 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/T24538 Message-ID: <65f1a734eadb0_29bf3d7164a5c94120@gitlab.mail> Ben Gamari pushed new branch wip/T24538 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24538 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 13:16:57 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 13 Mar 2024 09:16:57 -0400 Subject: [Git][ghc/ghc][wip/T24538] mk/relpath: Fix quoting Message-ID: <65f1a74975e80_29bf3d719e7ac943b4@gitlab.mail> Ben Gamari pushed to branch wip/T24538 at Glasgow Haskell Compiler / GHC Commits: 5cd42fc8 by Ben Gamari at 2024-03-13T09:16:52-04:00 mk/relpath: Fix quoting Previously there were two instances in this script which lacked proper quoting. This resulted in `relpath` invocations in the binary distribution Makefile producing incorrect results on Windows, leading to confusing failures from `sed` and the production of empty package registrations. Fixes #24538. - - - - - 1 changed file: - mk/relpath.sh Changes: ===================================== mk/relpath.sh ===================================== @@ -15,7 +15,7 @@ target="$2" common_part="$src" result="" -while test "${target#$common_part}" = "${target}" ; do +while test "${target#"$common_part"}" = "${target}" ; do #echo "common_part is now : \"$common_part\"" #echo "result is now : \"$result\"" #echo "target#common_part : \"${target#$common_part}\"" @@ -39,7 +39,7 @@ fi # since we now have identified the common part, # compute the non-common part -forward_part="${target#$common_part}" +forward_part="${target#"$common_part"}" #echo "forward_part = \"$forward_part\"" if test -n "$result" && test -n "$forward_part" ; then View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5cd42fc830146f02309d61031180dc551e6c721b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5cd42fc830146f02309d61031180dc551e6c721b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 13:45:49 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Wed, 13 Mar 2024 09:45:49 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/bidir-ki-check] Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy Message-ID: <65f1ae0d1c03_29bf3d7efbf6c9745c@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/bidir-ki-check at Glasgow Haskell Compiler / GHC Commits: 8afa1b09 by Andrei Borzenkov at 2024-03-13T17:45:30+04:00 Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy - - - - - 3 changed files: - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Utils/Unify.hs - testsuite/tests/partial-sigs/should_run/GHCiWildcardKind.stdout Changes: ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -854,7 +854,7 @@ tcInferLHsTypeUnsaturated :: LHsType GhcRn -> TcM (TcType, TcKind) tcInferLHsTypeUnsaturated hs_ty = addTypeCtxt hs_ty $ do { mode <- mkHoleMode TypeLevel HM_Sig -- Allow and report holes - ; case splitHsAppTys (unLoc hs_ty) of + ; case splitHsAppTys_maybe (unLoc hs_ty) of Just (hs_fun_ty, hs_args) -> do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty ; tcInferTyApps_nosat mode hs_fun_ty fun_ty hs_args } @@ -1022,74 +1022,13 @@ tc_infer_lhs_type mode (L span ty) = setSrcSpanA span $ tc_infer_hs_type mode ty ---------------------------- --- | Call 'tc_infer_hs_type' and check its result against an expected kind. -tc_infer_hs_type_ek :: HasDebugCallStack => TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -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 } - --------------------------- -- | Infer the kind of a type and desugar. This is the "up" type-checker, -- as described in Note [Bidirectional type checking] tc_infer_hs_type :: TcTyMode -> HsType GhcRn -> TcM (TcType, TcKind) -tc_infer_hs_type mode (HsParTy _ t) - = tc_infer_lhs_type mode t - -tc_infer_hs_type mode ty - | Just (hs_fun_ty, hs_args) <- splitHsAppTys ty - = do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty - ; tcInferTyApps mode hs_fun_ty fun_ty hs_args } - -tc_infer_hs_type mode (HsKindSig _ ty sig) - = do { let mode' = mode { mode_tyki = KindLevel } - ; sig' <- tc_lhs_kind_sig mode' KindSigCtxt sig - -- We must typecheck the kind signature, and solve all - -- its equalities etc; from this point on we may do - -- things like instantiate its foralls, so it needs - -- to be fully determined (#14904) - ; traceTc "tc_infer_hs_type:sig" (ppr ty $$ ppr sig') - ; ty' <- tcAddKindSigPlaceholders sig $ - tc_lhs_type mode ty sig' - ; return (ty', sig') } - --- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSpliceType' to communicate --- the splice location to the typechecker. Here we skip over it in order to have --- the same kind inferred for a given expression whether it was produced from --- splices or not. --- --- See Note [Delaying modFinalizers in untyped splices]. -tc_infer_hs_type mode (HsSpliceTy (HsUntypedSpliceTop _ ty) _) - = tc_infer_lhs_type mode ty - -tc_infer_hs_type _ (HsSpliceTy (HsUntypedSpliceNested n) s) = pprPanic "tc_infer_hs_type: invalid nested splice" (pprUntypedSplice True (Just n) s) - -tc_infer_hs_type mode (HsDocTy _ ty _) = tc_infer_lhs_type mode ty - --- See Note [Typechecking HsCoreTys] -tc_infer_hs_type _ (XHsType ty) - = do env <- getLclEnv - -- Raw uniques since we go from NameEnv to TvSubstEnv. - let subst_prs :: [(Unique, TcTyVar)] - subst_prs = [ (getUnique nm, tv) - | ATyVar nm tv <- nonDetNameEnvElts (getLclEnvTypeEnv env) ] - subst = mkTvSubst - (mkInScopeSetList $ map snd subst_prs) - (listToUFM_Directly $ map (fmap mkTyVarTy) subst_prs) - ty' = substTy subst ty - return (ty', typeKind ty') - -tc_infer_hs_type _ (HsExplicitListTy _ _ tys) - | null tys -- this is so that we can use visible kind application with '[] - -- e.g ... '[] @Bool - = return (mkTyConTy promotedNilDataCon, - mkSpecForAllTys [alphaTyVar] $ mkListTy alphaTy) - -tc_infer_hs_type mode other_ty - = do { kv <- newMetaKindVar - ; ty' <- tc_hs_type mode other_ty kv - ; return (ty', kv) } +tc_infer_hs_type mode rn_ty + = tcInfer $ \exp_kind -> tc_hs_type_exp mode rn_ty exp_kind {- Note [Typechecking HsCoreTys] @@ -1144,15 +1083,33 @@ tc_lhs_type mode (L span ty) exp_kind tc_hs_type :: TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -- See Note [Bidirectional type checking] +tc_hs_type mode ty ek = tc_hs_type_exp mode ty (Check ek) + +type ExpKind = ExpType + +checkExpKind :: HsType GhcRn -> TcType -> TcKind -> ExpKind -> TcM TcType +checkExpKind rn_ty ty ki (Check ki') = + checkExpectedKind rn_ty ty ki ki' +checkExpKind _rn_ty ty ki (Infer cell) = do + co <- fillInferResult ki cell + pure (ty `mkCastTy` co) + +tc_lhs_type_exp :: TcTyMode -> LHsType GhcRn -> ExpKind -> TcM TcType +tc_lhs_type_exp mode (L span ty) exp_kind + = setSrcSpanA span $ + tc_hs_type_exp mode ty exp_kind + +tc_hs_type_exp :: TcTyMode -> HsType GhcRn -> ExpKind -> TcM TcType +-- See Note [Bidirectional type checking] -tc_hs_type mode (HsParTy _ ty) exp_kind = tc_lhs_type mode ty exp_kind -tc_hs_type mode (HsDocTy _ ty _) exp_kind = tc_lhs_type mode ty exp_kind -tc_hs_type _ ty@(HsBangTy _ bang _) _ +tc_hs_type_exp mode (HsParTy _ ty) exp_kind = tc_lhs_type_exp mode ty exp_kind +tc_hs_type_exp mode (HsDocTy _ ty _) exp_kind = tc_lhs_type_exp mode ty exp_kind +tc_hs_type_exp _ ty@(HsBangTy _ bang _) _ -- While top-level bangs at this point are eliminated (eg !(Maybe Int)), -- other kinds of bangs are not (eg ((!Maybe) Int)). These kinds of -- bangs are invalid, so fail. (#7210, #14761) = failWith $ TcRnUnexpectedAnnotation ty bang -tc_hs_type _ ty@(HsRecTy {}) _ +tc_hs_type_exp _ ty@(HsRecTy {}) _ -- Record types (which only show up temporarily in constructor -- signatures) should have been removed by now = failWithTc $ TcRnIllegalRecordSyntax (Right ty) @@ -1162,23 +1119,25 @@ tc_hs_type _ ty@(HsRecTy {}) _ -- while capturing the local environment. -- -- See Note [Delaying modFinalizers in untyped splices]. -tc_hs_type mode (HsSpliceTy (HsUntypedSpliceTop mod_finalizers ty) _) +tc_hs_type_exp mode (HsSpliceTy (HsUntypedSpliceTop mod_finalizers ty) _) exp_kind = do addModFinalizersWithLclEnv mod_finalizers - tc_lhs_type mode ty exp_kind + tc_lhs_type_exp mode ty exp_kind -tc_hs_type _ (HsSpliceTy (HsUntypedSpliceNested n) s) _ = pprPanic "tc_hs_type: invalid nested splice" (pprUntypedSplice True (Just n) s) +tc_hs_type_exp _ (HsSpliceTy (HsUntypedSpliceNested n) s) _ = pprPanic "tc_hs_type_exp: invalid nested splice" (pprUntypedSplice True (Just n) s) ---------- Functions and applications -tc_hs_type mode (HsFunTy _ mult ty1 ty2) exp_kind - = tc_fun_type mode mult ty1 ty2 exp_kind +tc_hs_type_exp mode (HsFunTy _ mult ty1 ty2) exp_kind + = do k <- expTypeToType exp_kind + tc_fun_type mode mult ty1 ty2 k -tc_hs_type mode (HsOpTy _ _ ty1 (L _ op) ty2) exp_kind +tc_hs_type_exp mode (HsOpTy _ _ ty1 (L _ op) ty2) exp_kind | op `hasKey` unrestrictedFunTyConKey - = tc_fun_type mode (HsUnrestrictedArrow noExtField) ty1 ty2 exp_kind + = do k <- expTypeToType exp_kind + tc_fun_type mode (HsUnrestrictedArrow noExtField) ty1 ty2 k --------- Foralls -tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind +tc_hs_type_exp mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind | HsForAllInvis{} <- tele = tc_hs_forall_ty tele ty exp_kind -- For an invisible forall, we allow the body to have @@ -1187,15 +1146,15 @@ tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind | HsForAllVis{} <- tele = do { ek <- newOpenTypeKind - ; r <- tc_hs_forall_ty tele ty ek - ; checkExpectedKind t r ek exp_kind } + ; r <- tc_hs_forall_ty tele ty (Check ek) + ; checkExpKind t r ek exp_kind } -- For a visible forall, we require that the body is of kind TYPE r. -- See Note [Body kind of a HsForAllTy] where tc_hs_forall_ty tele ty ek = do { (tv_bndrs, ty') <- tcTKTelescope mode tele $ - tc_lhs_type mode ty ek + tc_lhs_type_exp mode ty ek -- Pass on the mode from the type, to any wildcards -- in kind signatures on the forall'd variables -- e.g. f :: _ -> Int -> forall (a :: _). blah @@ -1203,65 +1162,40 @@ tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind -- Do not kind-generalise here! See Note [Kind generalisation] ; return (mkForAllTys tv_bndrs ty') } -tc_hs_type mode (HsQualTy { hst_ctxt = ctxt, hst_body = rn_ty }) exp_kind - | null (unLoc ctxt) - = tc_lhs_type mode rn_ty exp_kind - - -- See Note [Body kind of a HsQualTy] - | isConstraintLikeKind exp_kind - = do { ctxt' <- tc_hs_context mode ctxt - ; ty' <- tc_lhs_type mode rn_ty constraintKind - ; return (tcMkDFunPhiTy ctxt' ty') } +tc_hs_type_exp mode (HsQualTy { hst_ctxt = ctxt, hst_body = rn_ty }) exp_kind + = do k <- expTypeToType exp_kind + tc_hs_qual_ty k + where + tc_hs_qual_ty kind + | null (unLoc ctxt) + = tc_lhs_type mode rn_ty kind - | otherwise - = do { ctxt' <- tc_hs_context mode ctxt - - ; ek <- newOpenTypeKind -- The body kind (result of the function) can - -- be TYPE r, for any r, hence newOpenTypeKind - ; ty' <- tc_lhs_type mode rn_ty ek - ; checkExpectedKind (unLoc rn_ty) (tcMkPhiTy ctxt' ty') - liftedTypeKind exp_kind } + -- See Note [Body kind of a HsQualTy] + | isConstraintLikeKind kind + = do { ctxt' <- tc_hs_context mode ctxt + ; ty' <- tc_lhs_type mode rn_ty constraintKind + ; return (tcMkDFunPhiTy ctxt' ty') } + | otherwise + = do { ctxt' <- tc_hs_context mode ctxt + + ; ek <- newOpenTypeKind -- The body kind (result of the function) can + -- be TYPE r, for any r, hence newOpenTypeKind + ; ty' <- tc_lhs_type mode rn_ty ek + ; let res_ty = tcMkPhiTy ctxt' ty' + ; checkExpectedKind (unLoc rn_ty) res_ty + liftedTypeKind kind } --------- Lists, arrays, and tuples -tc_hs_type mode rn_ty@(HsListTy _ elt_ty) exp_kind +tc_hs_type_exp mode rn_ty@(HsListTy _ elt_ty) exp_kind = do { tau_ty <- tc_lhs_type mode elt_ty liftedTypeKind ; checkWiredInTyCon listTyCon - ; checkExpectedKind rn_ty (mkListTy tau_ty) liftedTypeKind exp_kind } + ; checkExpKind rn_ty (mkListTy tau_ty) liftedTypeKind exp_kind } --- See Note [Distinguishing tuple kinds] in Language.Haskell.Syntax.Type --- See Note [Inferring tuple kinds] -tc_hs_type mode rn_ty@(HsTupleTy _ HsBoxedOrConstraintTuple hs_tys) exp_kind - -- (NB: not zonking before looking at exp_k, to avoid left-right bias) - | Just tup_sort <- tupKindSort_maybe exp_kind - = traceTc "tc_hs_type tuple" (ppr hs_tys) >> - tc_tuple rn_ty mode tup_sort hs_tys exp_kind - | otherwise - = do { traceTc "tc_hs_type tuple 2" (ppr hs_tys) - ; (tys, kinds) <- mapAndUnzipM (tc_infer_lhs_type mode) hs_tys - ; kinds <- liftZonkM $ mapM zonkTcType kinds - -- Infer each arg type separately, because errors can be - -- confusing if we give them a shared kind. Eg #7410 - -- (Either Int, Int), we do not want to get an error saying - -- "the second argument of a tuple should have kind *->*" +tc_hs_type_exp mode rn_ty@(HsTupleTy _ tup_sort tys) exp_kind + = do k <- expTypeToType exp_kind + tc_hs_tuple_ty rn_ty mode tup_sort tys k - ; let (arg_kind, tup_sort) - = case [ (k,s) | k <- kinds - , Just s <- [tupKindSort_maybe k] ] of - ((k,s) : _) -> (k,s) - [] -> (liftedTypeKind, BoxedTuple) - -- In the [] case, it's not clear what the kind is, so guess * - - ; tys' <- sequence [ setSrcSpanA loc $ - checkExpectedKind hs_ty ty kind arg_kind - | ((L loc hs_ty),ty,kind) <- zip3 hs_tys tys kinds ] - - ; finish_tuple rn_ty tup_sort tys' (map (const arg_kind) tys') exp_kind } - - -tc_hs_type mode rn_ty@(HsTupleTy _ HsUnboxedTuple tys) exp_kind - = tc_tuple rn_ty mode UnboxedTuple tys exp_kind - -tc_hs_type mode rn_ty@(HsSumTy _ hs_tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsSumTy _ hs_tys) exp_kind = do { let arity = length hs_tys ; arg_kinds <- mapM (\_ -> newOpenTypeKind) hs_tys ; tau_tys <- zipWithM (tc_lhs_type mode) hs_tys arg_kinds @@ -1269,26 +1203,28 @@ tc_hs_type mode rn_ty@(HsSumTy _ hs_tys) exp_kind arg_tys = arg_reps ++ tau_tys sum_ty = mkTyConApp (sumTyCon arity) arg_tys sum_kind = unboxedSumKind arg_reps - ; checkExpectedKind rn_ty sum_ty sum_kind exp_kind + ; checkExpKind rn_ty sum_ty sum_kind exp_kind } --------- Promoted lists and tuples -tc_hs_type mode rn_ty@(HsExplicitListTy _ _ tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsExplicitListTy _ _ tys) exp_kind -- The '[] case is handled in tc_infer_hs_type. -- See Note [Future-proofing the type checker]. | null tys - = tc_infer_hs_type_ek mode rn_ty exp_kind + = do let ty = mkTyConTy promotedNilDataCon + let kind = mkSpecForAllTys [alphaTyVar] $ mkListTy alphaTy + checkExpKind rn_ty ty kind exp_kind | otherwise = do { tks <- mapM (tc_infer_lhs_type mode) tys ; (taus', kind) <- unifyKinds tys tks ; let ty = (foldr (mk_cons kind) (mk_nil kind) taus') - ; checkExpectedKind rn_ty ty (mkListTy kind) exp_kind } + ; checkExpKind rn_ty ty (mkListTy kind) exp_kind } where mk_cons k a b = mkTyConApp (promoteDataCon consDataCon) [k, a, b] mk_nil k = mkTyConApp (promoteDataCon nilDataCon) [k] -tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind -- using newMetaKindVar means that we force instantiations of any polykinded -- types. At first, I just used tc_infer_lhs_type, but that led to #11255. = do { ks <- replicateM arity newMetaKindVar @@ -1297,49 +1233,117 @@ tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind ty_con = promotedTupleDataCon Boxed arity tup_k = mkTyConApp kind_con ks ; checkTupSize arity - ; checkExpectedKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind } + ; checkExpKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind } where arity = length tys --------- Constraint types -tc_hs_type mode rn_ty@(HsIParamTy _ (L _ n) ty) exp_kind +tc_hs_type_exp mode rn_ty@(HsIParamTy _ (L _ n) ty) exp_kind = do { massert (isTypeLevel (mode_tyki mode)) ; ty' <- tc_lhs_type mode ty liftedTypeKind ; let n' = mkStrLitTy $ hsIPNameFS n ; ipClass <- tcLookupClass ipClassName - ; checkExpectedKind rn_ty (mkClassPred ipClass [n',ty']) + ; checkExpKind rn_ty (mkClassPred ipClass [n',ty']) constraintKind exp_kind } -tc_hs_type _ rn_ty@(HsStarTy _ _) exp_kind +tc_hs_type_exp _ rn_ty@(HsStarTy _ _) exp_kind -- Desugaring 'HsStarTy' to 'Data.Kind.Type' here means that we don't -- have to handle it in 'coreView' - = checkExpectedKind rn_ty liftedTypeKind liftedTypeKind exp_kind + = checkExpKind rn_ty liftedTypeKind liftedTypeKind exp_kind --------- Literals -tc_hs_type _ rn_ty@(HsTyLit _ (HsNumTy _ n)) exp_kind +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsNumTy _ n)) exp_kind = do { checkWiredInTyCon naturalTyCon - ; checkExpectedKind rn_ty (mkNumLitTy n) naturalTy exp_kind } + ; checkExpKind rn_ty (mkNumLitTy n) naturalTy exp_kind } -tc_hs_type _ rn_ty@(HsTyLit _ (HsStrTy _ s)) exp_kind +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsStrTy _ s)) exp_kind = do { checkWiredInTyCon typeSymbolKindCon - ; checkExpectedKind rn_ty (mkStrLitTy s) typeSymbolKind exp_kind } -tc_hs_type _ rn_ty@(HsTyLit _ (HsCharTy _ c)) exp_kind + ; checkExpKind rn_ty (mkStrLitTy s) typeSymbolKind exp_kind } +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsCharTy _ c)) exp_kind = do { checkWiredInTyCon charTyCon - ; checkExpectedKind rn_ty (mkCharLitTy c) charTy exp_kind } + ; checkExpKind rn_ty (mkCharLitTy c) charTy exp_kind } --------- Wildcards -tc_hs_type mode ty@(HsWildCardTy _) ek - = tcAnonWildCardOcc NoExtraConstraint mode ty ek +tc_hs_type_exp mode ty@(HsWildCardTy _) ek + = do k <- expTypeToType ek + tcAnonWildCardOcc NoExtraConstraint mode ty k ---------- Potentially kind-polymorphic types: call the "up" checker --- See Note [Future-proofing the type checker] -tc_hs_type mode ty@(HsTyVar {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsAppTy {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsAppKindTy{}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsOpTy {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsKindSig {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(XHsType {}) ek = tc_infer_hs_type_ek mode ty ek +--------- Infer +tc_hs_type_exp mode rn_ty@(HsTyVar{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsAppTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsAppKindTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsOpTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind + +tc_hs_type_exp mode rn_ty@(HsKindSig _ ty sig) exp_kind + = do { let mode' = mode { mode_tyki = KindLevel } + ; sig' <- tc_lhs_kind_sig mode' KindSigCtxt sig + -- We must typecheck the kind signature, and solve all + -- its equalities etc; from this point on we may do + -- things like instantiate its foralls, so it needs + -- to be fully determined (#14904) + ; traceTc "tc_hs_type_exp:sig" (ppr ty $$ ppr sig') + ; ty' <- tcAddKindSigPlaceholders sig $ + tc_lhs_type mode ty sig' + ; checkExpKind rn_ty ty' sig' exp_kind } + +-- See Note [Typechecking HsCoreTys] +tc_hs_type_exp _ rn_ty@(XHsType ty) exp_kind + = do env <- getLclEnv + -- Raw uniques since we go from NameEnv to TvSubstEnv. + let subst_prs :: [(Unique, TcTyVar)] + subst_prs = [ (getUnique nm, tv) + | ATyVar nm tv <- nonDetNameEnvElts (getLclEnvTypeEnv env) ] + subst = mkTvSubst + (mkInScopeSetList $ map snd subst_prs) + (listToUFM_Directly $ map (fmap mkTyVarTy) subst_prs) + ty' = substTy subst ty + checkExpKind rn_ty ty' (typeKind ty') exp_kind + +tc_hs_tuple_ty :: HsType GhcRn + -> TcTyMode + -> HsTupleSort + -> [LHsType GhcRn] + -> TcKind + -> TcM TcType +-- See Note [Distinguishing tuple kinds] in GHC.Hs.Type +-- See Note [Inferring tuple kinds] +tc_hs_tuple_ty rn_ty mode HsBoxedOrConstraintTuple hs_tys exp_kind + -- (NB: not zonking before looking at exp_k, to avoid left-right bias) + | Just tup_sort <- tupKindSort_maybe exp_kind + = traceTc "tc_hs_type_exp tuple" (ppr hs_tys) >> + tc_tuple rn_ty mode tup_sort hs_tys exp_kind + | otherwise + = do { traceTc "tc_hs_type_exp tuple 2" (ppr hs_tys) + ; (tys, kinds) <- mapAndUnzipM (tc_infer_lhs_type mode) hs_tys + ; kinds <- liftZonkM $ mapM zonkTcType kinds + -- Infer each arg type separately, because errors can be + -- confusing if we give them a shared kind. Eg #7410 + -- (Either Int, Int), we do not want to get an error saying + -- "the second argument of a tuple should have kind *->*" + + ; let (arg_kind, tup_sort) + = case [ (k,s) | k <- kinds + , Just s <- [tupKindSort_maybe k] ] of + ((k,s) : _) -> (k,s) + [] -> (liftedTypeKind, BoxedTuple) + -- In the [] case, it's not clear what the kind is, so guess * + + ; tys' <- sequence [ setSrcSpanA loc $ + checkExpectedKind hs_ty ty kind arg_kind + | ((L loc hs_ty),ty,kind) <- zip3 hs_tys tys kinds ] + + ; finish_tuple rn_ty tup_sort tys' (map (const arg_kind) tys') exp_kind } +tc_hs_tuple_ty rn_ty mode HsUnboxedTuple tys exp_kind = + tc_tuple rn_ty mode UnboxedTuple tys exp_kind + +tc_app_ty :: TcTyMode -> HsType GhcRn -> ExpKind -> TcM TcType +tc_app_ty mode rn_ty exp_kind + = do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty + ; (ty, infered_kind) <- tcInferTyApps mode hs_fun_ty fun_ty hs_args + ; checkExpKind rn_ty ty infered_kind exp_kind } + where + (hs_fun_ty, hs_args) = splitHsAppTys rn_ty {- Note [Variable Specificity and Forall Visibility] @@ -1530,9 +1534,9 @@ since the two constraints should be semantically equivalent. * * ********************************************************************* -} -splitHsAppTys :: HsType GhcRn -> Maybe (LHsType GhcRn, [LHsTypeArg GhcRn]) -splitHsAppTys hs_ty - | is_app hs_ty = Just (go (noLocA hs_ty) []) +splitHsAppTys_maybe :: HsType GhcRn -> Maybe (LHsType GhcRn, [LHsTypeArg GhcRn]) +splitHsAppTys_maybe hs_ty + | is_app hs_ty = Just (splitHsAppTys hs_ty) | otherwise = Nothing where is_app :: HsType GhcRn -> Bool @@ -1547,6 +1551,10 @@ splitHsAppTys hs_ty is_app (HsParTy _ (L _ ty)) = is_app ty is_app _ = False +splitHsAppTys :: HsType GhcRn -> (LHsType GhcRn, [LHsTypeArg GhcRn]) + +splitHsAppTys hs_ty = go (noLocA hs_ty) [] + where go :: LHsType GhcRn -> [HsArg GhcRn (LHsType GhcRn) (LHsKind GhcRn)] -> (LHsType GhcRn, @@ -4355,7 +4363,7 @@ tc_type_in_pat ctxt hole_mode hs_ty wcs ns ctxt_kind -- and c.f #16033 bindNamedWildCardBinders wcs $ \ wcs -> tcExtendNameTyVarEnv tkv_prs $ - do { ek <- newExpectedKind ctxt_kind + do { ek <- newExpectedKind ctxt_kind ; ty <- tc_lhs_type mode hs_ty ek ; return (wcs, ty) } ===================================== compiler/GHC/Tc/Utils/Unify.hs ===================================== @@ -43,6 +43,9 @@ module GHC.Tc.Utils.Unify ( PuResult(..), failCheckWith, okCheckRefl, mapCheck, TyEqFlags(..), TyEqFamApp(..), AreUnifying(..), LevelCheck(..), FamAppBreaker, famAppArgFlags, simpleUnifyCheck, checkPromoteFreeVars, + + -- Is that safe? + fillInferResult, ) where import GHC.Prelude ===================================== testsuite/tests/partial-sigs/should_run/GHCiWildcardKind.stdout ===================================== @@ -1,2 +1,2 @@ -_ :: k +_ :: p Maybe _ :: * View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8afa1b09393deadd4d509514cd8065e3f7ae4ce2 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8afa1b09393deadd4d509514cd8065e3f7ae4ce2 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 14:02:07 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Wed, 13 Mar 2024 10:02:07 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/bidir-ki-check] Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy Message-ID: <65f1b1df1e365_29bf3d875262099522@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/bidir-ki-check at Glasgow Haskell Compiler / GHC Commits: 1eb6c06e by Andrei Borzenkov at 2024-03-13T18:01:48+04:00 Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy - - - - - 6 changed files: - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Utils/Unify.hs - testsuite/tests/partial-sigs/should_run/GHCiWildcardKind.stdout - + testsuite/tests/th/T24299.hs - + testsuite/tests/th/T24299.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -854,7 +854,7 @@ tcInferLHsTypeUnsaturated :: LHsType GhcRn -> TcM (TcType, TcKind) tcInferLHsTypeUnsaturated hs_ty = addTypeCtxt hs_ty $ do { mode <- mkHoleMode TypeLevel HM_Sig -- Allow and report holes - ; case splitHsAppTys (unLoc hs_ty) of + ; case splitHsAppTys_maybe (unLoc hs_ty) of Just (hs_fun_ty, hs_args) -> do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty ; tcInferTyApps_nosat mode hs_fun_ty fun_ty hs_args } @@ -1022,74 +1022,13 @@ tc_infer_lhs_type mode (L span ty) = setSrcSpanA span $ tc_infer_hs_type mode ty ---------------------------- --- | Call 'tc_infer_hs_type' and check its result against an expected kind. -tc_infer_hs_type_ek :: HasDebugCallStack => TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -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 } - --------------------------- -- | Infer the kind of a type and desugar. This is the "up" type-checker, -- as described in Note [Bidirectional type checking] tc_infer_hs_type :: TcTyMode -> HsType GhcRn -> TcM (TcType, TcKind) -tc_infer_hs_type mode (HsParTy _ t) - = tc_infer_lhs_type mode t - -tc_infer_hs_type mode ty - | Just (hs_fun_ty, hs_args) <- splitHsAppTys ty - = do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty - ; tcInferTyApps mode hs_fun_ty fun_ty hs_args } - -tc_infer_hs_type mode (HsKindSig _ ty sig) - = do { let mode' = mode { mode_tyki = KindLevel } - ; sig' <- tc_lhs_kind_sig mode' KindSigCtxt sig - -- We must typecheck the kind signature, and solve all - -- its equalities etc; from this point on we may do - -- things like instantiate its foralls, so it needs - -- to be fully determined (#14904) - ; traceTc "tc_infer_hs_type:sig" (ppr ty $$ ppr sig') - ; ty' <- tcAddKindSigPlaceholders sig $ - tc_lhs_type mode ty sig' - ; return (ty', sig') } - --- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSpliceType' to communicate --- the splice location to the typechecker. Here we skip over it in order to have --- the same kind inferred for a given expression whether it was produced from --- splices or not. --- --- See Note [Delaying modFinalizers in untyped splices]. -tc_infer_hs_type mode (HsSpliceTy (HsUntypedSpliceTop _ ty) _) - = tc_infer_lhs_type mode ty - -tc_infer_hs_type _ (HsSpliceTy (HsUntypedSpliceNested n) s) = pprPanic "tc_infer_hs_type: invalid nested splice" (pprUntypedSplice True (Just n) s) - -tc_infer_hs_type mode (HsDocTy _ ty _) = tc_infer_lhs_type mode ty - --- See Note [Typechecking HsCoreTys] -tc_infer_hs_type _ (XHsType ty) - = do env <- getLclEnv - -- Raw uniques since we go from NameEnv to TvSubstEnv. - let subst_prs :: [(Unique, TcTyVar)] - subst_prs = [ (getUnique nm, tv) - | ATyVar nm tv <- nonDetNameEnvElts (getLclEnvTypeEnv env) ] - subst = mkTvSubst - (mkInScopeSetList $ map snd subst_prs) - (listToUFM_Directly $ map (fmap mkTyVarTy) subst_prs) - ty' = substTy subst ty - return (ty', typeKind ty') - -tc_infer_hs_type _ (HsExplicitListTy _ _ tys) - | null tys -- this is so that we can use visible kind application with '[] - -- e.g ... '[] @Bool - = return (mkTyConTy promotedNilDataCon, - mkSpecForAllTys [alphaTyVar] $ mkListTy alphaTy) - -tc_infer_hs_type mode other_ty - = do { kv <- newMetaKindVar - ; ty' <- tc_hs_type mode other_ty kv - ; return (ty', kv) } +tc_infer_hs_type mode rn_ty + = tcInfer $ \exp_kind -> tc_hs_type_exp mode rn_ty exp_kind {- Note [Typechecking HsCoreTys] @@ -1144,15 +1083,33 @@ tc_lhs_type mode (L span ty) exp_kind tc_hs_type :: TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -- See Note [Bidirectional type checking] +tc_hs_type mode ty ek = tc_hs_type_exp mode ty (Check ek) + +type ExpKind = ExpType + +checkExpKind :: HsType GhcRn -> TcType -> TcKind -> ExpKind -> TcM TcType +checkExpKind rn_ty ty ki (Check ki') = + checkExpectedKind rn_ty ty ki ki' +checkExpKind _rn_ty ty ki (Infer cell) = do + co <- fillInferResult ki cell + pure (ty `mkCastTy` co) + +tc_lhs_type_exp :: TcTyMode -> LHsType GhcRn -> ExpKind -> TcM TcType +tc_lhs_type_exp mode (L span ty) exp_kind + = setSrcSpanA span $ + tc_hs_type_exp mode ty exp_kind + +tc_hs_type_exp :: TcTyMode -> HsType GhcRn -> ExpKind -> TcM TcType +-- See Note [Bidirectional type checking] -tc_hs_type mode (HsParTy _ ty) exp_kind = tc_lhs_type mode ty exp_kind -tc_hs_type mode (HsDocTy _ ty _) exp_kind = tc_lhs_type mode ty exp_kind -tc_hs_type _ ty@(HsBangTy _ bang _) _ +tc_hs_type_exp mode (HsParTy _ ty) exp_kind = tc_lhs_type_exp mode ty exp_kind +tc_hs_type_exp mode (HsDocTy _ ty _) exp_kind = tc_lhs_type_exp mode ty exp_kind +tc_hs_type_exp _ ty@(HsBangTy _ bang _) _ -- While top-level bangs at this point are eliminated (eg !(Maybe Int)), -- other kinds of bangs are not (eg ((!Maybe) Int)). These kinds of -- bangs are invalid, so fail. (#7210, #14761) = failWith $ TcRnUnexpectedAnnotation ty bang -tc_hs_type _ ty@(HsRecTy {}) _ +tc_hs_type_exp _ ty@(HsRecTy {}) _ -- Record types (which only show up temporarily in constructor -- signatures) should have been removed by now = failWithTc $ TcRnIllegalRecordSyntax (Right ty) @@ -1162,23 +1119,25 @@ tc_hs_type _ ty@(HsRecTy {}) _ -- while capturing the local environment. -- -- See Note [Delaying modFinalizers in untyped splices]. -tc_hs_type mode (HsSpliceTy (HsUntypedSpliceTop mod_finalizers ty) _) +tc_hs_type_exp mode (HsSpliceTy (HsUntypedSpliceTop mod_finalizers ty) _) exp_kind = do addModFinalizersWithLclEnv mod_finalizers - tc_lhs_type mode ty exp_kind + tc_lhs_type_exp mode ty exp_kind -tc_hs_type _ (HsSpliceTy (HsUntypedSpliceNested n) s) _ = pprPanic "tc_hs_type: invalid nested splice" (pprUntypedSplice True (Just n) s) +tc_hs_type_exp _ (HsSpliceTy (HsUntypedSpliceNested n) s) _ = pprPanic "tc_hs_type_exp: invalid nested splice" (pprUntypedSplice True (Just n) s) ---------- Functions and applications -tc_hs_type mode (HsFunTy _ mult ty1 ty2) exp_kind - = tc_fun_type mode mult ty1 ty2 exp_kind +tc_hs_type_exp mode (HsFunTy _ mult ty1 ty2) exp_kind + = do k <- expTypeToType exp_kind + tc_fun_type mode mult ty1 ty2 k -tc_hs_type mode (HsOpTy _ _ ty1 (L _ op) ty2) exp_kind +tc_hs_type_exp mode (HsOpTy _ _ ty1 (L _ op) ty2) exp_kind | op `hasKey` unrestrictedFunTyConKey - = tc_fun_type mode (HsUnrestrictedArrow noExtField) ty1 ty2 exp_kind + = do k <- expTypeToType exp_kind + tc_fun_type mode (HsUnrestrictedArrow noExtField) ty1 ty2 k --------- Foralls -tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind +tc_hs_type_exp mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind | HsForAllInvis{} <- tele = tc_hs_forall_ty tele ty exp_kind -- For an invisible forall, we allow the body to have @@ -1187,15 +1146,15 @@ tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind | HsForAllVis{} <- tele = do { ek <- newOpenTypeKind - ; r <- tc_hs_forall_ty tele ty ek - ; checkExpectedKind t r ek exp_kind } + ; r <- tc_hs_forall_ty tele ty (Check ek) + ; checkExpKind t r ek exp_kind } -- For a visible forall, we require that the body is of kind TYPE r. -- See Note [Body kind of a HsForAllTy] where tc_hs_forall_ty tele ty ek = do { (tv_bndrs, ty') <- tcTKTelescope mode tele $ - tc_lhs_type mode ty ek + tc_lhs_type_exp mode ty ek -- Pass on the mode from the type, to any wildcards -- in kind signatures on the forall'd variables -- e.g. f :: _ -> Int -> forall (a :: _). blah @@ -1203,65 +1162,40 @@ tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind -- Do not kind-generalise here! See Note [Kind generalisation] ; return (mkForAllTys tv_bndrs ty') } -tc_hs_type mode (HsQualTy { hst_ctxt = ctxt, hst_body = rn_ty }) exp_kind - | null (unLoc ctxt) - = tc_lhs_type mode rn_ty exp_kind - - -- See Note [Body kind of a HsQualTy] - | isConstraintLikeKind exp_kind - = do { ctxt' <- tc_hs_context mode ctxt - ; ty' <- tc_lhs_type mode rn_ty constraintKind - ; return (tcMkDFunPhiTy ctxt' ty') } +tc_hs_type_exp mode (HsQualTy { hst_ctxt = ctxt, hst_body = rn_ty }) exp_kind + = do k <- expTypeToType exp_kind + tc_hs_qual_ty k + where + tc_hs_qual_ty kind + | null (unLoc ctxt) + = tc_lhs_type mode rn_ty kind - | otherwise - = do { ctxt' <- tc_hs_context mode ctxt - - ; ek <- newOpenTypeKind -- The body kind (result of the function) can - -- be TYPE r, for any r, hence newOpenTypeKind - ; ty' <- tc_lhs_type mode rn_ty ek - ; checkExpectedKind (unLoc rn_ty) (tcMkPhiTy ctxt' ty') - liftedTypeKind exp_kind } + -- See Note [Body kind of a HsQualTy] + | isConstraintLikeKind kind + = do { ctxt' <- tc_hs_context mode ctxt + ; ty' <- tc_lhs_type mode rn_ty constraintKind + ; return (tcMkDFunPhiTy ctxt' ty') } + | otherwise + = do { ctxt' <- tc_hs_context mode ctxt + + ; ek <- newOpenTypeKind -- The body kind (result of the function) can + -- be TYPE r, for any r, hence newOpenTypeKind + ; ty' <- tc_lhs_type mode rn_ty ek + ; let res_ty = tcMkPhiTy ctxt' ty' + ; checkExpectedKind (unLoc rn_ty) res_ty + liftedTypeKind kind } --------- Lists, arrays, and tuples -tc_hs_type mode rn_ty@(HsListTy _ elt_ty) exp_kind +tc_hs_type_exp mode rn_ty@(HsListTy _ elt_ty) exp_kind = do { tau_ty <- tc_lhs_type mode elt_ty liftedTypeKind ; checkWiredInTyCon listTyCon - ; checkExpectedKind rn_ty (mkListTy tau_ty) liftedTypeKind exp_kind } + ; checkExpKind rn_ty (mkListTy tau_ty) liftedTypeKind exp_kind } --- See Note [Distinguishing tuple kinds] in Language.Haskell.Syntax.Type --- See Note [Inferring tuple kinds] -tc_hs_type mode rn_ty@(HsTupleTy _ HsBoxedOrConstraintTuple hs_tys) exp_kind - -- (NB: not zonking before looking at exp_k, to avoid left-right bias) - | Just tup_sort <- tupKindSort_maybe exp_kind - = traceTc "tc_hs_type tuple" (ppr hs_tys) >> - tc_tuple rn_ty mode tup_sort hs_tys exp_kind - | otherwise - = do { traceTc "tc_hs_type tuple 2" (ppr hs_tys) - ; (tys, kinds) <- mapAndUnzipM (tc_infer_lhs_type mode) hs_tys - ; kinds <- liftZonkM $ mapM zonkTcType kinds - -- Infer each arg type separately, because errors can be - -- confusing if we give them a shared kind. Eg #7410 - -- (Either Int, Int), we do not want to get an error saying - -- "the second argument of a tuple should have kind *->*" +tc_hs_type_exp mode rn_ty@(HsTupleTy _ tup_sort tys) exp_kind + = do k <- expTypeToType exp_kind + tc_hs_tuple_ty rn_ty mode tup_sort tys k - ; let (arg_kind, tup_sort) - = case [ (k,s) | k <- kinds - , Just s <- [tupKindSort_maybe k] ] of - ((k,s) : _) -> (k,s) - [] -> (liftedTypeKind, BoxedTuple) - -- In the [] case, it's not clear what the kind is, so guess * - - ; tys' <- sequence [ setSrcSpanA loc $ - checkExpectedKind hs_ty ty kind arg_kind - | ((L loc hs_ty),ty,kind) <- zip3 hs_tys tys kinds ] - - ; finish_tuple rn_ty tup_sort tys' (map (const arg_kind) tys') exp_kind } - - -tc_hs_type mode rn_ty@(HsTupleTy _ HsUnboxedTuple tys) exp_kind - = tc_tuple rn_ty mode UnboxedTuple tys exp_kind - -tc_hs_type mode rn_ty@(HsSumTy _ hs_tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsSumTy _ hs_tys) exp_kind = do { let arity = length hs_tys ; arg_kinds <- mapM (\_ -> newOpenTypeKind) hs_tys ; tau_tys <- zipWithM (tc_lhs_type mode) hs_tys arg_kinds @@ -1269,26 +1203,28 @@ tc_hs_type mode rn_ty@(HsSumTy _ hs_tys) exp_kind arg_tys = arg_reps ++ tau_tys sum_ty = mkTyConApp (sumTyCon arity) arg_tys sum_kind = unboxedSumKind arg_reps - ; checkExpectedKind rn_ty sum_ty sum_kind exp_kind + ; checkExpKind rn_ty sum_ty sum_kind exp_kind } --------- Promoted lists and tuples -tc_hs_type mode rn_ty@(HsExplicitListTy _ _ tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsExplicitListTy _ _ tys) exp_kind -- The '[] case is handled in tc_infer_hs_type. -- See Note [Future-proofing the type checker]. | null tys - = tc_infer_hs_type_ek mode rn_ty exp_kind + = do let ty = mkTyConTy promotedNilDataCon + let kind = mkSpecForAllTys [alphaTyVar] $ mkListTy alphaTy + checkExpKind rn_ty ty kind exp_kind | otherwise = do { tks <- mapM (tc_infer_lhs_type mode) tys ; (taus', kind) <- unifyKinds tys tks ; let ty = (foldr (mk_cons kind) (mk_nil kind) taus') - ; checkExpectedKind rn_ty ty (mkListTy kind) exp_kind } + ; checkExpKind rn_ty ty (mkListTy kind) exp_kind } where mk_cons k a b = mkTyConApp (promoteDataCon consDataCon) [k, a, b] mk_nil k = mkTyConApp (promoteDataCon nilDataCon) [k] -tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind -- using newMetaKindVar means that we force instantiations of any polykinded -- types. At first, I just used tc_infer_lhs_type, but that led to #11255. = do { ks <- replicateM arity newMetaKindVar @@ -1297,49 +1233,117 @@ tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind ty_con = promotedTupleDataCon Boxed arity tup_k = mkTyConApp kind_con ks ; checkTupSize arity - ; checkExpectedKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind } + ; checkExpKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind } where arity = length tys --------- Constraint types -tc_hs_type mode rn_ty@(HsIParamTy _ (L _ n) ty) exp_kind +tc_hs_type_exp mode rn_ty@(HsIParamTy _ (L _ n) ty) exp_kind = do { massert (isTypeLevel (mode_tyki mode)) ; ty' <- tc_lhs_type mode ty liftedTypeKind ; let n' = mkStrLitTy $ hsIPNameFS n ; ipClass <- tcLookupClass ipClassName - ; checkExpectedKind rn_ty (mkClassPred ipClass [n',ty']) + ; checkExpKind rn_ty (mkClassPred ipClass [n',ty']) constraintKind exp_kind } -tc_hs_type _ rn_ty@(HsStarTy _ _) exp_kind +tc_hs_type_exp _ rn_ty@(HsStarTy _ _) exp_kind -- Desugaring 'HsStarTy' to 'Data.Kind.Type' here means that we don't -- have to handle it in 'coreView' - = checkExpectedKind rn_ty liftedTypeKind liftedTypeKind exp_kind + = checkExpKind rn_ty liftedTypeKind liftedTypeKind exp_kind --------- Literals -tc_hs_type _ rn_ty@(HsTyLit _ (HsNumTy _ n)) exp_kind +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsNumTy _ n)) exp_kind = do { checkWiredInTyCon naturalTyCon - ; checkExpectedKind rn_ty (mkNumLitTy n) naturalTy exp_kind } + ; checkExpKind rn_ty (mkNumLitTy n) naturalTy exp_kind } -tc_hs_type _ rn_ty@(HsTyLit _ (HsStrTy _ s)) exp_kind +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsStrTy _ s)) exp_kind = do { checkWiredInTyCon typeSymbolKindCon - ; checkExpectedKind rn_ty (mkStrLitTy s) typeSymbolKind exp_kind } -tc_hs_type _ rn_ty@(HsTyLit _ (HsCharTy _ c)) exp_kind + ; checkExpKind rn_ty (mkStrLitTy s) typeSymbolKind exp_kind } +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsCharTy _ c)) exp_kind = do { checkWiredInTyCon charTyCon - ; checkExpectedKind rn_ty (mkCharLitTy c) charTy exp_kind } + ; checkExpKind rn_ty (mkCharLitTy c) charTy exp_kind } --------- Wildcards -tc_hs_type mode ty@(HsWildCardTy _) ek - = tcAnonWildCardOcc NoExtraConstraint mode ty ek +tc_hs_type_exp mode ty@(HsWildCardTy _) ek + = do k <- expTypeToType ek + tcAnonWildCardOcc NoExtraConstraint mode ty k ---------- Potentially kind-polymorphic types: call the "up" checker --- See Note [Future-proofing the type checker] -tc_hs_type mode ty@(HsTyVar {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsAppTy {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsAppKindTy{}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsOpTy {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsKindSig {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(XHsType {}) ek = tc_infer_hs_type_ek mode ty ek +--------- Infer +tc_hs_type_exp mode rn_ty@(HsTyVar{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsAppTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsAppKindTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsOpTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind + +tc_hs_type_exp mode rn_ty@(HsKindSig _ ty sig) exp_kind + = do { let mode' = mode { mode_tyki = KindLevel } + ; sig' <- tc_lhs_kind_sig mode' KindSigCtxt sig + -- We must typecheck the kind signature, and solve all + -- its equalities etc; from this point on we may do + -- things like instantiate its foralls, so it needs + -- to be fully determined (#14904) + ; traceTc "tc_hs_type_exp:sig" (ppr ty $$ ppr sig') + ; ty' <- tcAddKindSigPlaceholders sig $ + tc_lhs_type mode ty sig' + ; checkExpKind rn_ty ty' sig' exp_kind } + +-- See Note [Typechecking HsCoreTys] +tc_hs_type_exp _ rn_ty@(XHsType ty) exp_kind + = do env <- getLclEnv + -- Raw uniques since we go from NameEnv to TvSubstEnv. + let subst_prs :: [(Unique, TcTyVar)] + subst_prs = [ (getUnique nm, tv) + | ATyVar nm tv <- nonDetNameEnvElts (getLclEnvTypeEnv env) ] + subst = mkTvSubst + (mkInScopeSetList $ map snd subst_prs) + (listToUFM_Directly $ map (fmap mkTyVarTy) subst_prs) + ty' = substTy subst ty + checkExpKind rn_ty ty' (typeKind ty') exp_kind + +tc_hs_tuple_ty :: HsType GhcRn + -> TcTyMode + -> HsTupleSort + -> [LHsType GhcRn] + -> TcKind + -> TcM TcType +-- See Note [Distinguishing tuple kinds] in GHC.Hs.Type +-- See Note [Inferring tuple kinds] +tc_hs_tuple_ty rn_ty mode HsBoxedOrConstraintTuple hs_tys exp_kind + -- (NB: not zonking before looking at exp_k, to avoid left-right bias) + | Just tup_sort <- tupKindSort_maybe exp_kind + = traceTc "tc_hs_type_exp tuple" (ppr hs_tys) >> + tc_tuple rn_ty mode tup_sort hs_tys exp_kind + | otherwise + = do { traceTc "tc_hs_type_exp tuple 2" (ppr hs_tys) + ; (tys, kinds) <- mapAndUnzipM (tc_infer_lhs_type mode) hs_tys + ; kinds <- liftZonkM $ mapM zonkTcType kinds + -- Infer each arg type separately, because errors can be + -- confusing if we give them a shared kind. Eg #7410 + -- (Either Int, Int), we do not want to get an error saying + -- "the second argument of a tuple should have kind *->*" + + ; let (arg_kind, tup_sort) + = case [ (k,s) | k <- kinds + , Just s <- [tupKindSort_maybe k] ] of + ((k,s) : _) -> (k,s) + [] -> (liftedTypeKind, BoxedTuple) + -- In the [] case, it's not clear what the kind is, so guess * + + ; tys' <- sequence [ setSrcSpanA loc $ + checkExpectedKind hs_ty ty kind arg_kind + | ((L loc hs_ty),ty,kind) <- zip3 hs_tys tys kinds ] + + ; finish_tuple rn_ty tup_sort tys' (map (const arg_kind) tys') exp_kind } +tc_hs_tuple_ty rn_ty mode HsUnboxedTuple tys exp_kind = + tc_tuple rn_ty mode UnboxedTuple tys exp_kind + +tc_app_ty :: TcTyMode -> HsType GhcRn -> ExpKind -> TcM TcType +tc_app_ty mode rn_ty exp_kind + = do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty + ; (ty, infered_kind) <- tcInferTyApps mode hs_fun_ty fun_ty hs_args + ; checkExpKind rn_ty ty infered_kind exp_kind } + where + (hs_fun_ty, hs_args) = splitHsAppTys rn_ty {- Note [Variable Specificity and Forall Visibility] @@ -1530,9 +1534,9 @@ since the two constraints should be semantically equivalent. * * ********************************************************************* -} -splitHsAppTys :: HsType GhcRn -> Maybe (LHsType GhcRn, [LHsTypeArg GhcRn]) -splitHsAppTys hs_ty - | is_app hs_ty = Just (go (noLocA hs_ty) []) +splitHsAppTys_maybe :: HsType GhcRn -> Maybe (LHsType GhcRn, [LHsTypeArg GhcRn]) +splitHsAppTys_maybe hs_ty + | is_app hs_ty = Just (splitHsAppTys hs_ty) | otherwise = Nothing where is_app :: HsType GhcRn -> Bool @@ -1547,6 +1551,10 @@ splitHsAppTys hs_ty is_app (HsParTy _ (L _ ty)) = is_app ty is_app _ = False +splitHsAppTys :: HsType GhcRn -> (LHsType GhcRn, [LHsTypeArg GhcRn]) + +splitHsAppTys hs_ty = go (noLocA hs_ty) [] + where go :: LHsType GhcRn -> [HsArg GhcRn (LHsType GhcRn) (LHsKind GhcRn)] -> (LHsType GhcRn, @@ -4355,7 +4363,7 @@ tc_type_in_pat ctxt hole_mode hs_ty wcs ns ctxt_kind -- and c.f #16033 bindNamedWildCardBinders wcs $ \ wcs -> tcExtendNameTyVarEnv tkv_prs $ - do { ek <- newExpectedKind ctxt_kind + do { ek <- newExpectedKind ctxt_kind ; ty <- tc_lhs_type mode hs_ty ek ; return (wcs, ty) } ===================================== compiler/GHC/Tc/Utils/Unify.hs ===================================== @@ -43,6 +43,9 @@ module GHC.Tc.Utils.Unify ( PuResult(..), failCheckWith, okCheckRefl, mapCheck, TyEqFlags(..), TyEqFamApp(..), AreUnifying(..), LevelCheck(..), FamAppBreaker, famAppArgFlags, simpleUnifyCheck, checkPromoteFreeVars, + + -- Is that safe? + fillInferResult, ) where import GHC.Prelude ===================================== testsuite/tests/partial-sigs/should_run/GHCiWildcardKind.stdout ===================================== @@ -1,2 +1,2 @@ -_ :: k +_ :: p Maybe _ :: * ===================================== testsuite/tests/th/T24299.hs ===================================== @@ -0,0 +1,16 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T24299 where +import Language.Haskell.TH.Syntax (addModFinalizer, runIO) +import GHC.Types (Type) + +type Proxy :: forall a. a -> Type +data Proxy a = MkProxy + +check :: ($(addModFinalizer (runIO (putStrLn "check")) >> + [t| Proxy |]) :: Type -> Type) Int -- There is kind signature, we are in check mode +check = MkProxy + +infer :: ($(addModFinalizer (runIO (putStrLn "infer")) >> + [t| Proxy |]) ) Int -- no kind signature, inference mode is enabled +infer = MkProxy ===================================== testsuite/tests/th/T24299.stderr ===================================== @@ -0,0 +1,2 @@ +check +infer ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24299', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1eb6c06e63f0faa03d7c7a1f6c9eb5aa97967153 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1eb6c06e63f0faa03d7c7a1f6c9eb5aa97967153 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 14:31:02 2024 From: gitlab at gitlab.haskell.org (Ben Orchard (@raehik)) Date: Wed, 13 Mar 2024 10:31:02 -0400 Subject: [Git][ghc/ghc][wip/raehik/primop-array-mutability-docs] Note mutability of array and address access primops Message-ID: <65f1b8a662e88_29bf3d9567954102382@gitlab.mail> Ben Orchard pushed to branch wip/raehik/primop-array-mutability-docs at Glasgow Haskell Compiler / GHC Commits: 1dfe742f by Ben Orchard at 2024-03-13T14:19:37+00:00 Note mutability of array and address access primops Without understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature. This adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 1 changed file: - utils/genprimopcode/AccessOps.hs Changes: ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1dfe742fdbcdb001dc99e67ff9f09db3a84d9c6c -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1dfe742fdbcdb001dc99e67ff9f09db3a84d9c6c You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 14:36:04 2024 From: gitlab at gitlab.haskell.org (Ben Orchard (@raehik)) Date: Wed, 13 Mar 2024 10:36:04 -0400 Subject: [Git][ghc/ghc][wip/raehik/primop-array-mutability-docs] Note mutability of array and address access primops Message-ID: <65f1b9d4858cf_29bf3d95fc3b010259@gitlab.mail> Ben Orchard pushed to branch wip/raehik/primop-array-mutability-docs at Glasgow Haskell Compiler / GHC Commits: f4d3406d by Ben Orchard at 2024-03-13T14:31:08+00:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 1 changed file: - utils/genprimopcode/AccessOps.hs Changes: ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f4d3406d13abb4a32020d303181982be7800f5ff -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f4d3406d13abb4a32020d303181982be7800f5ff You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 16:06:10 2024 From: gitlab at gitlab.haskell.org (Sebastian Graf (@sgraf812)) Date: Wed, 13 Mar 2024 12:06:10 -0400 Subject: [Git][ghc/ghc][wip/or-pats] Implement Or Patterns (#22596) Message-ID: <65f1cef2c1e85_29bf3dc0a9ec81153e0@gitlab.mail> Sebastian Graf pushed to branch wip/or-pats at Glasgow Haskell Compiler / GHC Commits: 1bd60794 by David Knothe at 2024-03-13T17:06:00+01:00 Implement Or Patterns (#22596) This commit introduces a new language extension, `-XOrPatterns`, as described in GHC Proposal 522. An or-pattern `pat1; ...; patk` succeeds iff one of the patterns `pat1`, ..., `patk` succeed, in this order. See also the summary `Note [Implmentation of OrPatterns]`. Co-Authored-By: Sebastian Graf <sgraf1337 at gmail.com> - - - - - 30 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Pat.hs - compiler/GHC/Hs/Syn/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Match.hs - compiler/GHC/HsToCore/Pmc/Check.hs - compiler/GHC/HsToCore/Pmc/Desugar.hs - compiler/GHC/HsToCore/Pmc/Types.hs - compiler/GHC/HsToCore/Utils.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Bind.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/TyCl/PatSyn.hs - compiler/GHC/Tc/Zonk/Type.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Extension.hs - compiler/Language/Haskell/Syntax/Pat.hs - + docs/users_guide/exts/or_patterns.rst - docs/users_guide/exts/patterns.rst - libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bd60794813b00c47d20931847e8790ccf062378 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bd60794813b00c47d20931847e8790ccf062378 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 19:36:10 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Wed, 13 Mar 2024 15:36:10 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 8 commits: Remove duplicate code normalising slashes Message-ID: <65f2002a99922_29bf3d11d21bd814227@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 19dfb9b7 by Andreas Klebinger at 2024-03-13T15:35:35-04:00 RTS: Emit warning when -M < -H Fixes #24487 - - - - - 026033de by Ben Orchard at 2024-03-13T15:35:36-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 20 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Unique/Supply.hs - compiler/cbits/genSym.c - rts/RtsFlags.c - testsuite/driver/testlib.py - testsuite/tests/parser/should_fail/T21843a.stderr - testsuite/tests/parser/should_fail/T21843b.stderr - testsuite/tests/parser/should_fail/T21843c.stderr - testsuite/tests/parser/should_fail/T21843d.stderr - testsuite/tests/parser/should_fail/T21843e.stderr - testsuite/tests/parser/should_fail/T21843f.stderr - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T - utils/genprimopcode/AccessOps.hs Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== compiler/GHC/Types/Unique/Supply.hs ===================================== @@ -7,7 +7,6 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE UnboxedTuples #-} -{-# LANGUAGE UnliftedFFITypes #-} module GHC.Types.Unique.Supply ( -- * Main data type @@ -49,16 +48,16 @@ import Foreign.Storable #define NO_FETCH_ADD #endif -#if defined(javascript_HOST_ARCH) -import GHC.Exts ( atomicCasWord64Addr#, eqWord64# ) -#elif !defined(NO_FETCH_ADD) -import GHC.Exts( fetchAddWordAddr#, word64ToWord#, wordToWord64# ) +#if defined(NO_FETCH_ADD) +import GHC.Exts ( atomicCasWord64Addr#, eqWord64#, readWord64OffAddr# ) +#else +import GHC.Exts( fetchAddWordAddr#, word64ToWord# ) #endif import GHC.Exts ( Addr#, State#, Word64#, RealWorld ) - +import GHC.Int ( Int(..) ) import GHC.Word( Word64(..) ) -import GHC.Exts( plusWord64#, readWord64OffAddr# ) +import GHC.Exts( plusWord64#, int2Word#, wordToWord64# ) {- ************************************************************************ @@ -233,8 +232,9 @@ mkSplitUniqSupply c (# s4, MkSplitUniqSupply (tag .|. u) x y #) }}}} -#if defined(javascript_HOST_ARCH) --- CAS-based pure Haskell implementation +#if defined(NO_FETCH_ADD) +-- GHC currently does not provide this operation on 32-bit platforms, +-- hence the CAS-based implementation. fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# = go @@ -246,35 +246,7 @@ fetchAddWord64Addr# = go (# s2, res #) | 1# <- res `eqWord64#` n0 -> (# s2, n0 #) | otherwise -> go ptr inc s2 - -#elif defined(NO_FETCH_ADD) - --- atomic_inc64 is defined in compiler/cbits/genSym.c. This is of --- course not ideal, but we need to live with it for now given the --- current situation: --- 1. There's no Haskell primop fetchAddWord64Addr# on 32-bit --- platforms yet --- 2. The Cmm %fetch_add64 primop syntax is only present in ghc 9.8 --- but we currently bootstrap from older ghc in our CI --- 3. The Cmm MO_AtomicRMW operation with 64-bit width is well --- supported on 32-bit platforms already, but the plumbing from --- either Haskell or Cmm doesn't work yet because of 1 or 2 --- 4. There's hs_atomic_add64 in ghc-prim cbits that we ought to use, --- but it's only available on 32-bit starting from ghc 9.8 --- 5. The pure Haskell implementation causes mysterious i386 --- regression in unrelated ghc work that can only be fixed by the C --- version here - -foreign import ccall unsafe "atomic_inc64" atomic_inc64 :: Addr# -> Word64# -> IO Word64 - -fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld - -> (# State# RealWorld, Word64# #) -fetchAddWord64Addr# addr inc s0 = - case unIO (atomic_inc64 addr inc) s0 of - (# s1, W64# res #) -> (# s1, res #) - #else - fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# addr inc s0 = @@ -286,9 +258,9 @@ genSym :: IO Word64 genSym = do let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1 let !(Ptr counter) = ghc_unique_counter64 - let !(Ptr inc_ptr) = ghc_unique_inc - u <- IO $ \s0 -> case readWord64OffAddr# inc_ptr 0# s0 of - (# s1, inc #) -> case fetchAddWord64Addr# counter inc s1 of + I# inc# <- peek ghc_unique_inc + let !inc = wordToWord64# (int2Word# inc#) + u <- IO $ \s1 -> case fetchAddWord64Addr# counter inc s1 of (# s2, val #) -> let !u = W64# (val `plusWord64#` inc) .&. mask in (# s2, u #) ===================================== compiler/cbits/genSym.c ===================================== @@ -15,11 +15,3 @@ HsWord64 ghc_unique_counter64 = 0; #if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) HsInt ghc_unique_inc = 1; #endif - -// Only used on 32-bit non-JS platforms -#if WORD_SIZE_IN_BITS != 64 -StgWord64 atomic_inc64(StgWord64 volatile* p, StgWord64 incr) -{ - return __atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST); -} -#endif ===================================== rts/RtsFlags.c ===================================== @@ -1951,6 +1951,9 @@ static void normaliseRtsOpts (void) if (RtsFlags.GcFlags.maxHeapSize != 0 && RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) { + errorBelch("Maximum heap size (-M) is smaller than suggested heap size (-H)\n" + "Setting maximum heap size to suggested heap size ( %" FMT_Word " )", + (StgWord64) RtsFlags.GcFlags.maxHeapSize * (StgWord64) BLOCK_SIZE); RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion; } ===================================== testsuite/driver/testlib.py ===================================== @@ -1119,8 +1119,8 @@ def normalise_win32_io_errors(name, opts): def normalise_version_( *pkgs ): def normalise_version__( str ): # (name)(-version)(-hash)(-components) - return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-zA-Z\+]+)?(-[0-9a-zA-Z]+)?', - '\\1--', str) + return re.sub('(' + '|'.join(map(re.escape,pkgs)) + r')-[0-9.]+(-[0-9a-zA-Z+]+)?(-[0-9a-zA-Z]+)?', + r'\1--', str) return normalise_version__ def normalise_version( *pkgs ): @@ -1491,7 +1491,7 @@ async def do_test(name: TestName, if opts.expect not in ['pass', 'fail', 'missing-lib']: framework_fail(name, way, 'bad expected ' + opts.expect) - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) if way in opts.fragile_ways: if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail')) @@ -1538,7 +1538,7 @@ def override_options(pre_cmd): def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = '%s(%s)' % (name, way) if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) name2 = name if name is not None else TestName('none') @@ -1549,7 +1549,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str def framework_warn(name: TestName, way: WayName, reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = name + '(' + way + ')' if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) t.framework_warnings.append(TestResult(directory, name, reason, way)) @@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str: s = normalise_callstacks(s) s = normalise_type_reps(s) - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + # normalise slashes to minimise Windows/Unix filename differences, + # but don't normalize backslashes in chars + s = re.sub(r"(?!')\\", '/', s) # Normalize the name of the GHC executable. Specifically, # this catches the cases that: @@ -2614,14 +2615,11 @@ def normalise_errmsg(s: str) -> str: # the colon is there because it appears in error messages; this # hacky solution is used in place of more sophisticated filename # mangling - s = re.sub('([^\\s])\\.exe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) # Same thing for .wasm modules generated by the Wasm backend - s = re.sub('([^\\s])\\.wasm', '\\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) # Same thing for .jsexe directories generated by the JS backend - s = re.sub('([^\\s])\\.jsexe', '\\1', s) - - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) # hpc executable is given ghc suffix s = re.sub('hpc-ghc', 'hpc', s) @@ -2631,8 +2629,8 @@ def normalise_errmsg(s: str) -> str: s = re.sub('ghc-stage[123]', 'ghc', s) # Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools # (ghc, ghc-pkg, unlit, etc.) - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) - s = re.sub('\\w+(-\\w+)*-unlit', 'unlit', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-unlit', 'unlit', s) # On windows error messages can mention versioned executables s = re.sub('ghc-[0-9.]+', 'ghc', s) @@ -2735,8 +2733,8 @@ def normalise_prof (s: str) -> str: return s def normalise_slashes_( s: str ) -> str: - s = re.sub('\\\\', '/', s) - s = re.sub('//', '/', s) + s = re.sub(r'\\', '/', s) + s = re.sub(r'//', '/', s) return s def normalise_exe_( s: str ) -> str: @@ -2754,9 +2752,9 @@ def normalise_output( s: str ) -> str: # and .wasm extension (for the Wasm backend) # and .jsexe extension (for the JS backend) # This can occur in error messages generated by the program. - s = re.sub('([^\\s])\\.exe', '\\1', s) - s = re.sub('([^\\s])\\.wasm', '\\1', s) - s = re.sub('([^\\s])\\.jsexe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) s = normalise_callstacks(s) s = normalise_type_reps(s) # ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is @@ -2776,7 +2774,7 @@ def normalise_output( s: str ) -> str: s = re.sub('.*warning: argument unused during compilation:.*\n', '', s) # strip the cross prefix if any - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) return s ===================================== testsuite/tests/parser/should_fail/T21843a.stderr ===================================== @@ -1,4 +1,4 @@ T21843a.hs:3:13: [GHC-31623] - Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not + Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843b.stderr ===================================== @@ -1,3 +1,3 @@ T21843b.hs:3:11: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843c.stderr ===================================== @@ -1,6 +1,6 @@ T21843c.hs:3:19: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not T21843c.hs:3:20: [GHC-21231] - lexical error in string/character literal at character '/n' + lexical error in string/character literal at character '\n' ===================================== testsuite/tests/parser/should_fail/T21843d.stderr ===================================== @@ -1,3 +1,3 @@ T21843d.hs:3:13: [GHC-31623] - Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not + Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843e.stderr ===================================== @@ -1,3 +1,3 @@ T21843e.hs:3:15: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843f.stderr ===================================== @@ -1,3 +1,3 @@ T21843f.hs:3:13: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accommodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5a999d85560752ad7d66159a70ef1b9e7cff4c41...026033dee79a59057340b0fe0fc99c096efb7fcf -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5a999d85560752ad7d66159a70ef1b9e7cff4c41...026033dee79a59057340b0fe0fc99c096efb7fcf You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 22:32:59 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 13 Mar 2024 18:32:59 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] 49 commits: ghc-internal: Eliminate GHC.Internal.Data.Kind Message-ID: <65f2299be2939_269833f8d3443271c@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 8ec9a1f2 by Ben Gamari at 2024-03-13T18:32:39-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 6dd1498f by Ben Gamari at 2024-03-13T18:32:39-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - 28c8e644 by Ben Gamari at 2024-03-13T18:32:39-04:00 gitlab/rel_eng: More upload.sh tweaks - - - - - 07e986d4 by Ben Gamari at 2024-03-13T18:32:39-04:00 rel_eng: Drop dead prepare_docs codepath - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Types/Unique/Supply.hs - compiler/GHC/Utils/Binary.hs - compiler/cbits/genSym.c - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7553df3897c2170b42fbbfbc254fff85e9c0bb10...07e986d4a4611ccda5ea6c6d913a21837cf69f75 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7553df3897c2170b42fbbfbc254fff85e9c0bb10...07e986d4a4611ccda5ea6c6d913a21837cf69f75 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 23:04:41 2024 From: gitlab at gitlab.haskell.org (Alan Zimmerman (@alanz)) Date: Wed, 13 Mar 2024 19:04:41 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/az/T24533-missing-comments Message-ID: <65f23109545f7_269834e2da70347c9@gitlab.mail> Alan Zimmerman pushed new branch wip/az/T24533-missing-comments at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/az/T24533-missing-comments You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 23:22:08 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 13 Mar 2024 19:22:08 -0400 Subject: [Git][ghc/ghc] Pushed new tag ghc-9.10.1-alpha1 Message-ID: <65f235207419b_2698356c44f44092b@gitlab.mail> Ben Gamari pushed new tag ghc-9.10.1-alpha1 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/ghc-9.10.1-alpha1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Wed Mar 13 23:22:43 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Wed, 13 Mar 2024 19:22:43 -0400 Subject: [Git][ghc/ghc][ghc-9.10] 62 commits: rts: expose HeapAlloc.h as public header Message-ID: <65f235434133a_26983577bc44411c7@gitlab.mail> Ben Gamari pushed to branch ghc-9.10 at Glasgow Haskell Compiler / GHC Commits: dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - 09d92280 by Ben Gamari at 2024-03-12T10:14:28-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - a27a477d by Ben Gamari at 2024-03-12T10:14:28-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 63928aeb by Ben Gamari at 2024-03-12T10:14:28-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 2e713fdb by Ben Gamari at 2024-03-12T10:14:28-04:00 gitlab-ci: Allow test-primops to fail It's still a bit sensitive to warnings, unfortunately. - - - - - 66c51e75 by Ben Gamari at 2024-03-12T10:14:28-04:00 hadrian: Package mingw toolchain in expected location This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89. Specifically, GHC expects to find the mingw32 toolchain in the binary distribution root. However, after this patch it was packaged in the `lib/` directory. - - - - - d574a10d by Ben Gamari at 2024-03-12T10:14:28-04:00 hadrian/bindist: Eliminate extraneous `dirname` invocation Previously we would call `dirname` twice per installed library file. We now instead reuse this result. This helps appreciably on Windows, where processes are quite expensive. - - - - - 9f85900d by Ben Gamari at 2024-03-13T08:59:50-04:00 mk/relpath: Fix quoting Previously there were two instances in this script which lacked proper quoting. This resulted in `relpath` invocations in the binary distribution Makefile producing incorrect results on Windows, leading to confusing failures from `sed` and the production of empty package registrations. Fixes #24538. - - - - - 47272633 by Ben Gamari at 2024-03-13T18:21:37-04:00 docs: Drop old release notes - - - - - db8a17a0 by Ben Gamari at 2024-03-13T18:33:12-04:00 gitlab/rel_eng: More upload.sh tweaks - - - - - b55e0ef9 by Ben Gamari at 2024-03-13T18:33:17-04:00 rel_eng: Drop dead prepare_docs codepath - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/21e3f3250e88640087a1a60bee2cc113bf04509f...b55e0ef930f93c13e0f23ed7e129247fb06af9d2 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/21e3f3250e88640087a1a60bee2cc113bf04509f...b55e0ef930f93c13e0f23ed7e129247fb06af9d2 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 00:12:24 2024 From: gitlab at gitlab.haskell.org (Matthew Craven (@clyring)) Date: Wed, 13 Mar 2024 20:12:24 -0400 Subject: [Git][ghc/ghc][wip/improve-Word32ToInteger-on-64bit] Improve toInteger @Word32 on 64-bit platforms Message-ID: <65f240e86ba5d_2698373ef5604832@gitlab.mail> Matthew Craven pushed to branch wip/improve-Word32ToInteger-on-64bit at Glasgow Haskell Compiler / GHC Commits: 5c7c67e9 by Matthew Craven at 2024-03-13T20:11:38-04:00 Improve toInteger @Word32 on 64-bit platforms On 64-bit platforms, every Word32 fits in an Int, so we can convert to Int# without having to perform the overflow check integerFromWord# uses internally. - - - - - 2 changed files: - libraries/base/changelog.md - libraries/ghc-internal/src/GHC/Internal/Word.hs Changes: ===================================== libraries/base/changelog.md ===================================== @@ -1,5 +1,8 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) +## 4.21.0.0 *TBA* + * Improve `toInteger :: Word32 -> Integer` on 64-bit platforms ([CLC proposal #259](https://github.com/haskell/core-libraries-committee/issues/259)) + ## 4.20.0.0 *TBA* * Export `foldl'` from `Prelude` ([CLC proposal #167](https://github.com/haskell/core-libraries-committee/issues/167)) * The top-level handler for uncaught exceptions now displays the output of `displayException` rather than `show` ([CLC proposal #198](https://github.com/haskell/core-libraries-committee/issues/198)) ===================================== libraries/ghc-internal/src/GHC/Internal/Word.hs ===================================== @@ -592,7 +592,13 @@ instance Integral Word32 where mod x y = rem x y divMod x y = quotRem x y - toInteger (W32# x#) = integerFromWord# (word32ToWord# x#) + toInteger (W32# x#) = +#if WORD_SIZE_IN_BITS > 32 + -- In this case the conversion to Int# cannot overflow. + IS (word2Int# (word32ToWord# x#)) +#else + integerFromWord# (word32ToWord# x#) +#endif -- | @since base-2.01 instance Bits Word32 where View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5c7c67e9a9dcea2e0293c68224e3fad12a08afc6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5c7c67e9a9dcea2e0293c68224e3fad12a08afc6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 07:15:32 2024 From: gitlab at gitlab.haskell.org (Andrei Borzenkov (@sand-witch)) Date: Thu, 14 Mar 2024 03:15:32 -0400 Subject: [Git][ghc/ghc][wip/sand-witch/bidir-ki-check] Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy Message-ID: <65f2a4141edf5_2b6bf25553d1833955@gitlab.mail> Andrei Borzenkov pushed to branch wip/sand-witch/bidir-ki-check at Glasgow Haskell Compiler / GHC Commits: 1bcd70ed by Andrei Borzenkov at 2024-03-14T11:15:11+04:00 Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy - - - - - 6 changed files: - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Utils/Unify.hs - testsuite/tests/partial-sigs/should_run/GHCiWildcardKind.stdout - + testsuite/tests/th/T24299.hs - + testsuite/tests/th/T24299.stderr - testsuite/tests/th/all.T Changes: ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -854,7 +854,7 @@ tcInferLHsTypeUnsaturated :: LHsType GhcRn -> TcM (TcType, TcKind) tcInferLHsTypeUnsaturated hs_ty = addTypeCtxt hs_ty $ do { mode <- mkHoleMode TypeLevel HM_Sig -- Allow and report holes - ; case splitHsAppTys (unLoc hs_ty) of + ; case splitHsAppTys_maybe (unLoc hs_ty) of Just (hs_fun_ty, hs_args) -> do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty ; tcInferTyApps_nosat mode hs_fun_ty fun_ty hs_args } @@ -1022,74 +1022,13 @@ tc_infer_lhs_type mode (L span ty) = setSrcSpanA span $ tc_infer_hs_type mode ty ---------------------------- --- | Call 'tc_infer_hs_type' and check its result against an expected kind. -tc_infer_hs_type_ek :: HasDebugCallStack => TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -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 } - --------------------------- -- | Infer the kind of a type and desugar. This is the "up" type-checker, -- as described in Note [Bidirectional type checking] tc_infer_hs_type :: TcTyMode -> HsType GhcRn -> TcM (TcType, TcKind) -tc_infer_hs_type mode (HsParTy _ t) - = tc_infer_lhs_type mode t - -tc_infer_hs_type mode ty - | Just (hs_fun_ty, hs_args) <- splitHsAppTys ty - = do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty - ; tcInferTyApps mode hs_fun_ty fun_ty hs_args } - -tc_infer_hs_type mode (HsKindSig _ ty sig) - = do { let mode' = mode { mode_tyki = KindLevel } - ; sig' <- tc_lhs_kind_sig mode' KindSigCtxt sig - -- We must typecheck the kind signature, and solve all - -- its equalities etc; from this point on we may do - -- things like instantiate its foralls, so it needs - -- to be fully determined (#14904) - ; traceTc "tc_infer_hs_type:sig" (ppr ty $$ ppr sig') - ; ty' <- tcAddKindSigPlaceholders sig $ - tc_lhs_type mode ty sig' - ; return (ty', sig') } - --- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSpliceType' to communicate --- the splice location to the typechecker. Here we skip over it in order to have --- the same kind inferred for a given expression whether it was produced from --- splices or not. --- --- See Note [Delaying modFinalizers in untyped splices]. -tc_infer_hs_type mode (HsSpliceTy (HsUntypedSpliceTop _ ty) _) - = tc_infer_lhs_type mode ty - -tc_infer_hs_type _ (HsSpliceTy (HsUntypedSpliceNested n) s) = pprPanic "tc_infer_hs_type: invalid nested splice" (pprUntypedSplice True (Just n) s) - -tc_infer_hs_type mode (HsDocTy _ ty _) = tc_infer_lhs_type mode ty - --- See Note [Typechecking HsCoreTys] -tc_infer_hs_type _ (XHsType ty) - = do env <- getLclEnv - -- Raw uniques since we go from NameEnv to TvSubstEnv. - let subst_prs :: [(Unique, TcTyVar)] - subst_prs = [ (getUnique nm, tv) - | ATyVar nm tv <- nonDetNameEnvElts (getLclEnvTypeEnv env) ] - subst = mkTvSubst - (mkInScopeSetList $ map snd subst_prs) - (listToUFM_Directly $ map (fmap mkTyVarTy) subst_prs) - ty' = substTy subst ty - return (ty', typeKind ty') - -tc_infer_hs_type _ (HsExplicitListTy _ _ tys) - | null tys -- this is so that we can use visible kind application with '[] - -- e.g ... '[] @Bool - = return (mkTyConTy promotedNilDataCon, - mkSpecForAllTys [alphaTyVar] $ mkListTy alphaTy) - -tc_infer_hs_type mode other_ty - = do { kv <- newMetaKindVar - ; ty' <- tc_hs_type mode other_ty kv - ; return (ty', kv) } +tc_infer_hs_type mode rn_ty + = tcInfer $ \exp_kind -> tc_hs_type_exp mode rn_ty exp_kind {- Note [Typechecking HsCoreTys] @@ -1144,15 +1083,33 @@ tc_lhs_type mode (L span ty) exp_kind tc_hs_type :: TcTyMode -> HsType GhcRn -> TcKind -> TcM TcType -- See Note [Bidirectional type checking] +tc_hs_type mode ty ek = tc_hs_type_exp mode ty (Check ek) + +type ExpKind = ExpType + +checkExpKind :: HsType GhcRn -> TcType -> TcKind -> ExpKind -> TcM TcType +checkExpKind rn_ty ty ki (Check ki') = + checkExpectedKind rn_ty ty ki ki' +checkExpKind _rn_ty ty ki (Infer cell) = do + co <- fillInferResult ki cell + pure (ty `mkCastTy` co) + +tc_lhs_type_exp :: TcTyMode -> LHsType GhcRn -> ExpKind -> TcM TcType +tc_lhs_type_exp mode (L span ty) exp_kind + = setSrcSpanA span $ + tc_hs_type_exp mode ty exp_kind + +tc_hs_type_exp :: TcTyMode -> HsType GhcRn -> ExpKind -> TcM TcType +-- See Note [Bidirectional type checking] -tc_hs_type mode (HsParTy _ ty) exp_kind = tc_lhs_type mode ty exp_kind -tc_hs_type mode (HsDocTy _ ty _) exp_kind = tc_lhs_type mode ty exp_kind -tc_hs_type _ ty@(HsBangTy _ bang _) _ +tc_hs_type_exp mode (HsParTy _ ty) exp_kind = tc_lhs_type_exp mode ty exp_kind +tc_hs_type_exp mode (HsDocTy _ ty _) exp_kind = tc_lhs_type_exp mode ty exp_kind +tc_hs_type_exp _ ty@(HsBangTy _ bang _) _ -- While top-level bangs at this point are eliminated (eg !(Maybe Int)), -- other kinds of bangs are not (eg ((!Maybe) Int)). These kinds of -- bangs are invalid, so fail. (#7210, #14761) = failWith $ TcRnUnexpectedAnnotation ty bang -tc_hs_type _ ty@(HsRecTy {}) _ +tc_hs_type_exp _ ty@(HsRecTy {}) _ -- Record types (which only show up temporarily in constructor -- signatures) should have been removed by now = failWithTc $ TcRnIllegalRecordSyntax (Right ty) @@ -1162,23 +1119,25 @@ tc_hs_type _ ty@(HsRecTy {}) _ -- while capturing the local environment. -- -- See Note [Delaying modFinalizers in untyped splices]. -tc_hs_type mode (HsSpliceTy (HsUntypedSpliceTop mod_finalizers ty) _) +tc_hs_type_exp mode (HsSpliceTy (HsUntypedSpliceTop mod_finalizers ty) _) exp_kind = do addModFinalizersWithLclEnv mod_finalizers - tc_lhs_type mode ty exp_kind + tc_lhs_type_exp mode ty exp_kind -tc_hs_type _ (HsSpliceTy (HsUntypedSpliceNested n) s) _ = pprPanic "tc_hs_type: invalid nested splice" (pprUntypedSplice True (Just n) s) +tc_hs_type_exp _ (HsSpliceTy (HsUntypedSpliceNested n) s) _ = pprPanic "tc_hs_type_exp: invalid nested splice" (pprUntypedSplice True (Just n) s) ---------- Functions and applications -tc_hs_type mode (HsFunTy _ mult ty1 ty2) exp_kind - = tc_fun_type mode mult ty1 ty2 exp_kind +tc_hs_type_exp mode (HsFunTy _ mult ty1 ty2) exp_kind + = do k <- expTypeToType exp_kind + tc_fun_type mode mult ty1 ty2 k -tc_hs_type mode (HsOpTy _ _ ty1 (L _ op) ty2) exp_kind +tc_hs_type_exp mode (HsOpTy _ _ ty1 (L _ op) ty2) exp_kind | op `hasKey` unrestrictedFunTyConKey - = tc_fun_type mode (HsUnrestrictedArrow noExtField) ty1 ty2 exp_kind + = do k <- expTypeToType exp_kind + tc_fun_type mode (HsUnrestrictedArrow noExtField) ty1 ty2 k --------- Foralls -tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind +tc_hs_type_exp mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind | HsForAllInvis{} <- tele = tc_hs_forall_ty tele ty exp_kind -- For an invisible forall, we allow the body to have @@ -1187,15 +1146,15 @@ tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind | HsForAllVis{} <- tele = do { ek <- newOpenTypeKind - ; r <- tc_hs_forall_ty tele ty ek - ; checkExpectedKind t r ek exp_kind } + ; r <- tc_hs_forall_ty tele ty (Check ek) + ; checkExpKind t r ek exp_kind } -- For a visible forall, we require that the body is of kind TYPE r. -- See Note [Body kind of a HsForAllTy] where tc_hs_forall_ty tele ty ek = do { (tv_bndrs, ty') <- tcTKTelescope mode tele $ - tc_lhs_type mode ty ek + tc_lhs_type_exp mode ty ek -- Pass on the mode from the type, to any wildcards -- in kind signatures on the forall'd variables -- e.g. f :: _ -> Int -> forall (a :: _). blah @@ -1203,65 +1162,40 @@ tc_hs_type mode t@(HsForAllTy { hst_tele = tele, hst_body = ty }) exp_kind -- Do not kind-generalise here! See Note [Kind generalisation] ; return (mkForAllTys tv_bndrs ty') } -tc_hs_type mode (HsQualTy { hst_ctxt = ctxt, hst_body = rn_ty }) exp_kind - | null (unLoc ctxt) - = tc_lhs_type mode rn_ty exp_kind - - -- See Note [Body kind of a HsQualTy] - | isConstraintLikeKind exp_kind - = do { ctxt' <- tc_hs_context mode ctxt - ; ty' <- tc_lhs_type mode rn_ty constraintKind - ; return (tcMkDFunPhiTy ctxt' ty') } +tc_hs_type_exp mode (HsQualTy { hst_ctxt = ctxt, hst_body = rn_ty }) exp_kind + = do k <- expTypeToType exp_kind + tc_hs_qual_ty k + where + tc_hs_qual_ty kind + | null (unLoc ctxt) + = tc_lhs_type mode rn_ty kind - | otherwise - = do { ctxt' <- tc_hs_context mode ctxt - - ; ek <- newOpenTypeKind -- The body kind (result of the function) can - -- be TYPE r, for any r, hence newOpenTypeKind - ; ty' <- tc_lhs_type mode rn_ty ek - ; checkExpectedKind (unLoc rn_ty) (tcMkPhiTy ctxt' ty') - liftedTypeKind exp_kind } + -- See Note [Body kind of a HsQualTy] + | isConstraintLikeKind kind + = do { ctxt' <- tc_hs_context mode ctxt + ; ty' <- tc_lhs_type mode rn_ty constraintKind + ; return (tcMkDFunPhiTy ctxt' ty') } + | otherwise + = do { ctxt' <- tc_hs_context mode ctxt + + ; ek <- newOpenTypeKind -- The body kind (result of the function) can + -- be TYPE r, for any r, hence newOpenTypeKind + ; ty' <- tc_lhs_type mode rn_ty ek + ; let res_ty = tcMkPhiTy ctxt' ty' + ; checkExpectedKind (unLoc rn_ty) res_ty + liftedTypeKind kind } --------- Lists, arrays, and tuples -tc_hs_type mode rn_ty@(HsListTy _ elt_ty) exp_kind +tc_hs_type_exp mode rn_ty@(HsListTy _ elt_ty) exp_kind = do { tau_ty <- tc_lhs_type mode elt_ty liftedTypeKind ; checkWiredInTyCon listTyCon - ; checkExpectedKind rn_ty (mkListTy tau_ty) liftedTypeKind exp_kind } + ; checkExpKind rn_ty (mkListTy tau_ty) liftedTypeKind exp_kind } --- See Note [Distinguishing tuple kinds] in Language.Haskell.Syntax.Type --- See Note [Inferring tuple kinds] -tc_hs_type mode rn_ty@(HsTupleTy _ HsBoxedOrConstraintTuple hs_tys) exp_kind - -- (NB: not zonking before looking at exp_k, to avoid left-right bias) - | Just tup_sort <- tupKindSort_maybe exp_kind - = traceTc "tc_hs_type tuple" (ppr hs_tys) >> - tc_tuple rn_ty mode tup_sort hs_tys exp_kind - | otherwise - = do { traceTc "tc_hs_type tuple 2" (ppr hs_tys) - ; (tys, kinds) <- mapAndUnzipM (tc_infer_lhs_type mode) hs_tys - ; kinds <- liftZonkM $ mapM zonkTcType kinds - -- Infer each arg type separately, because errors can be - -- confusing if we give them a shared kind. Eg #7410 - -- (Either Int, Int), we do not want to get an error saying - -- "the second argument of a tuple should have kind *->*" +tc_hs_type_exp mode rn_ty@(HsTupleTy _ tup_sort tys) exp_kind + = do k <- expTypeToType exp_kind + tc_hs_tuple_ty rn_ty mode tup_sort tys k - ; let (arg_kind, tup_sort) - = case [ (k,s) | k <- kinds - , Just s <- [tupKindSort_maybe k] ] of - ((k,s) : _) -> (k,s) - [] -> (liftedTypeKind, BoxedTuple) - -- In the [] case, it's not clear what the kind is, so guess * - - ; tys' <- sequence [ setSrcSpanA loc $ - checkExpectedKind hs_ty ty kind arg_kind - | ((L loc hs_ty),ty,kind) <- zip3 hs_tys tys kinds ] - - ; finish_tuple rn_ty tup_sort tys' (map (const arg_kind) tys') exp_kind } - - -tc_hs_type mode rn_ty@(HsTupleTy _ HsUnboxedTuple tys) exp_kind - = tc_tuple rn_ty mode UnboxedTuple tys exp_kind - -tc_hs_type mode rn_ty@(HsSumTy _ hs_tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsSumTy _ hs_tys) exp_kind = do { let arity = length hs_tys ; arg_kinds <- mapM (\_ -> newOpenTypeKind) hs_tys ; tau_tys <- zipWithM (tc_lhs_type mode) hs_tys arg_kinds @@ -1269,26 +1203,28 @@ tc_hs_type mode rn_ty@(HsSumTy _ hs_tys) exp_kind arg_tys = arg_reps ++ tau_tys sum_ty = mkTyConApp (sumTyCon arity) arg_tys sum_kind = unboxedSumKind arg_reps - ; checkExpectedKind rn_ty sum_ty sum_kind exp_kind + ; checkExpKind rn_ty sum_ty sum_kind exp_kind } --------- Promoted lists and tuples -tc_hs_type mode rn_ty@(HsExplicitListTy _ _ tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsExplicitListTy _ _ tys) exp_kind -- The '[] case is handled in tc_infer_hs_type. -- See Note [Future-proofing the type checker]. | null tys - = tc_infer_hs_type_ek mode rn_ty exp_kind + = do let ty = mkTyConTy promotedNilDataCon + let kind = mkSpecForAllTys [alphaTyVar] $ mkListTy alphaTy + checkExpKind rn_ty ty kind exp_kind | otherwise = do { tks <- mapM (tc_infer_lhs_type mode) tys ; (taus', kind) <- unifyKinds tys tks ; let ty = (foldr (mk_cons kind) (mk_nil kind) taus') - ; checkExpectedKind rn_ty ty (mkListTy kind) exp_kind } + ; checkExpKind rn_ty ty (mkListTy kind) exp_kind } where mk_cons k a b = mkTyConApp (promoteDataCon consDataCon) [k, a, b] mk_nil k = mkTyConApp (promoteDataCon nilDataCon) [k] -tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind +tc_hs_type_exp mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind -- using newMetaKindVar means that we force instantiations of any polykinded -- types. At first, I just used tc_infer_lhs_type, but that led to #11255. = do { ks <- replicateM arity newMetaKindVar @@ -1297,49 +1233,117 @@ tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind ty_con = promotedTupleDataCon Boxed arity tup_k = mkTyConApp kind_con ks ; checkTupSize arity - ; checkExpectedKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind } + ; checkExpKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind } where arity = length tys --------- Constraint types -tc_hs_type mode rn_ty@(HsIParamTy _ (L _ n) ty) exp_kind +tc_hs_type_exp mode rn_ty@(HsIParamTy _ (L _ n) ty) exp_kind = do { massert (isTypeLevel (mode_tyki mode)) ; ty' <- tc_lhs_type mode ty liftedTypeKind ; let n' = mkStrLitTy $ hsIPNameFS n ; ipClass <- tcLookupClass ipClassName - ; checkExpectedKind rn_ty (mkClassPred ipClass [n',ty']) + ; checkExpKind rn_ty (mkClassPred ipClass [n',ty']) constraintKind exp_kind } -tc_hs_type _ rn_ty@(HsStarTy _ _) exp_kind +tc_hs_type_exp _ rn_ty@(HsStarTy _ _) exp_kind -- Desugaring 'HsStarTy' to 'Data.Kind.Type' here means that we don't -- have to handle it in 'coreView' - = checkExpectedKind rn_ty liftedTypeKind liftedTypeKind exp_kind + = checkExpKind rn_ty liftedTypeKind liftedTypeKind exp_kind --------- Literals -tc_hs_type _ rn_ty@(HsTyLit _ (HsNumTy _ n)) exp_kind +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsNumTy _ n)) exp_kind = do { checkWiredInTyCon naturalTyCon - ; checkExpectedKind rn_ty (mkNumLitTy n) naturalTy exp_kind } + ; checkExpKind rn_ty (mkNumLitTy n) naturalTy exp_kind } -tc_hs_type _ rn_ty@(HsTyLit _ (HsStrTy _ s)) exp_kind +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsStrTy _ s)) exp_kind = do { checkWiredInTyCon typeSymbolKindCon - ; checkExpectedKind rn_ty (mkStrLitTy s) typeSymbolKind exp_kind } -tc_hs_type _ rn_ty@(HsTyLit _ (HsCharTy _ c)) exp_kind + ; checkExpKind rn_ty (mkStrLitTy s) typeSymbolKind exp_kind } +tc_hs_type_exp _ rn_ty@(HsTyLit _ (HsCharTy _ c)) exp_kind = do { checkWiredInTyCon charTyCon - ; checkExpectedKind rn_ty (mkCharLitTy c) charTy exp_kind } + ; checkExpKind rn_ty (mkCharLitTy c) charTy exp_kind } --------- Wildcards -tc_hs_type mode ty@(HsWildCardTy _) ek - = tcAnonWildCardOcc NoExtraConstraint mode ty ek +tc_hs_type_exp mode ty@(HsWildCardTy _) ek + = do k <- expTypeToType ek + tcAnonWildCardOcc NoExtraConstraint mode ty k ---------- Potentially kind-polymorphic types: call the "up" checker --- See Note [Future-proofing the type checker] -tc_hs_type mode ty@(HsTyVar {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsAppTy {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsAppKindTy{}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsOpTy {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(HsKindSig {}) ek = tc_infer_hs_type_ek mode ty ek -tc_hs_type mode ty@(XHsType {}) ek = tc_infer_hs_type_ek mode ty ek +--------- Infer +tc_hs_type_exp mode rn_ty@(HsTyVar{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsAppTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsAppKindTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind +tc_hs_type_exp mode rn_ty@(HsOpTy{}) exp_kind = tc_app_ty mode rn_ty exp_kind + +tc_hs_type_exp mode rn_ty@(HsKindSig _ ty sig) exp_kind + = do { let mode' = mode { mode_tyki = KindLevel } + ; sig' <- tc_lhs_kind_sig mode' KindSigCtxt sig + -- We must typecheck the kind signature, and solve all + -- its equalities etc; from this point on we may do + -- things like instantiate its foralls, so it needs + -- to be fully determined (#14904) + ; traceTc "tc_hs_type_exp:sig" (ppr ty $$ ppr sig') + ; ty' <- tcAddKindSigPlaceholders sig $ + tc_lhs_type mode ty sig' + ; checkExpKind rn_ty ty' sig' exp_kind } + +-- See Note [Typechecking HsCoreTys] +tc_hs_type_exp _ rn_ty@(XHsType ty) exp_kind + = do env <- getLclEnv + -- Raw uniques since we go from NameEnv to TvSubstEnv. + let subst_prs :: [(Unique, TcTyVar)] + subst_prs = [ (getUnique nm, tv) + | ATyVar nm tv <- nonDetNameEnvElts (getLclEnvTypeEnv env) ] + subst = mkTvSubst + (mkInScopeSetList $ map snd subst_prs) + (listToUFM_Directly $ map (fmap mkTyVarTy) subst_prs) + ty' = substTy subst ty + checkExpKind rn_ty ty' (typeKind ty') exp_kind + +tc_hs_tuple_ty :: HsType GhcRn + -> TcTyMode + -> HsTupleSort + -> [LHsType GhcRn] + -> TcKind + -> TcM TcType +-- See Note [Distinguishing tuple kinds] in GHC.Hs.Type +-- See Note [Inferring tuple kinds] +tc_hs_tuple_ty rn_ty mode HsBoxedOrConstraintTuple hs_tys exp_kind + -- (NB: not zonking before looking at exp_k, to avoid left-right bias) + | Just tup_sort <- tupKindSort_maybe exp_kind + = traceTc "tc_hs_type_exp tuple" (ppr hs_tys) >> + tc_tuple rn_ty mode tup_sort hs_tys exp_kind + | otherwise + = do { traceTc "tc_hs_type_exp tuple 2" (ppr hs_tys) + ; (tys, kinds) <- mapAndUnzipM (tc_infer_lhs_type mode) hs_tys + ; kinds <- liftZonkM $ mapM zonkTcType kinds + -- Infer each arg type separately, because errors can be + -- confusing if we give them a shared kind. Eg #7410 + -- (Either Int, Int), we do not want to get an error saying + -- "the second argument of a tuple should have kind *->*" + + ; let (arg_kind, tup_sort) + = case [ (k,s) | k <- kinds + , Just s <- [tupKindSort_maybe k] ] of + ((k,s) : _) -> (k,s) + [] -> (liftedTypeKind, BoxedTuple) + -- In the [] case, it's not clear what the kind is, so guess * + + ; tys' <- sequence [ setSrcSpanA loc $ + checkExpectedKind hs_ty ty kind arg_kind + | ((L loc hs_ty),ty,kind) <- zip3 hs_tys tys kinds ] + + ; finish_tuple rn_ty tup_sort tys' (map (const arg_kind) tys') exp_kind } +tc_hs_tuple_ty rn_ty mode HsUnboxedTuple tys exp_kind = + tc_tuple rn_ty mode UnboxedTuple tys exp_kind + +tc_app_ty :: TcTyMode -> HsType GhcRn -> ExpKind -> TcM TcType +tc_app_ty mode rn_ty exp_kind + = do { (fun_ty, _ki) <- tcInferTyAppHead mode hs_fun_ty + ; (ty, infered_kind) <- tcInferTyApps mode hs_fun_ty fun_ty hs_args + ; checkExpKind rn_ty ty infered_kind exp_kind } + where + (hs_fun_ty, hs_args) = splitHsAppTys rn_ty {- Note [Variable Specificity and Forall Visibility] @@ -1530,9 +1534,9 @@ since the two constraints should be semantically equivalent. * * ********************************************************************* -} -splitHsAppTys :: HsType GhcRn -> Maybe (LHsType GhcRn, [LHsTypeArg GhcRn]) -splitHsAppTys hs_ty - | is_app hs_ty = Just (go (noLocA hs_ty) []) +splitHsAppTys_maybe :: HsType GhcRn -> Maybe (LHsType GhcRn, [LHsTypeArg GhcRn]) +splitHsAppTys_maybe hs_ty + | is_app hs_ty = Just (splitHsAppTys hs_ty) | otherwise = Nothing where is_app :: HsType GhcRn -> Bool @@ -1547,6 +1551,10 @@ splitHsAppTys hs_ty is_app (HsParTy _ (L _ ty)) = is_app ty is_app _ = False +splitHsAppTys :: HsType GhcRn -> (LHsType GhcRn, [LHsTypeArg GhcRn]) + +splitHsAppTys hs_ty = go (noLocA hs_ty) [] + where go :: LHsType GhcRn -> [HsArg GhcRn (LHsType GhcRn) (LHsKind GhcRn)] -> (LHsType GhcRn, @@ -4355,7 +4363,7 @@ tc_type_in_pat ctxt hole_mode hs_ty wcs ns ctxt_kind -- and c.f #16033 bindNamedWildCardBinders wcs $ \ wcs -> tcExtendNameTyVarEnv tkv_prs $ - do { ek <- newExpectedKind ctxt_kind + do { ek <- newExpectedKind ctxt_kind ; ty <- tc_lhs_type mode hs_ty ek ; return (wcs, ty) } ===================================== compiler/GHC/Tc/Utils/Unify.hs ===================================== @@ -43,6 +43,9 @@ module GHC.Tc.Utils.Unify ( PuResult(..), failCheckWith, okCheckRefl, mapCheck, TyEqFlags(..), TyEqFamApp(..), AreUnifying(..), LevelCheck(..), FamAppBreaker, famAppArgFlags, simpleUnifyCheck, checkPromoteFreeVars, + + -- Is that safe? + fillInferResult, ) where import GHC.Prelude ===================================== testsuite/tests/partial-sigs/should_run/GHCiWildcardKind.stdout ===================================== @@ -1,2 +1,2 @@ -_ :: k +_ :: p Maybe _ :: * ===================================== testsuite/tests/th/T24299.hs ===================================== @@ -0,0 +1,17 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T24299 where +import Language.Haskell.TH.Syntax (addModFinalizer, runIO) +import GHC.Types (Type) +import System.IO + +type Proxy :: forall a. a -> Type +data Proxy a = MkProxy + +check :: ($(addModFinalizer (runIO (do putStrLn "check"; hFlush stdout)) >> + [t| Proxy |]) :: Type -> Type) Int -- There is kind signature, we are in check mode +check = MkProxy + +infer :: ($(addModFinalizer (runIO (do putStrLn "infer"; hFlush stdout)) >> + [t| Proxy |]) ) Int -- no kind signature, inference mode is enabled +infer = MkProxy ===================================== testsuite/tests/th/T24299.stderr ===================================== @@ -0,0 +1,2 @@ +check +infer ===================================== testsuite/tests/th/all.T ===================================== @@ -604,3 +604,4 @@ test('T24308', normal, compile_and_run, ['']) test('T14032a', normal, compile, ['']) test('T14032e', normal, compile_fail, ['-dsuppress-uniques']) test('ListTuplePunsTH', [only_ways(['ghci']), extra_files(['ListTuplePunsTH.hs', 'T15843a.hs'])], ghci_script, ['ListTuplePunsTH.script']) +test('T24299', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bcd70ed195e52c41dd1b65203431037645d89a6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bcd70ed195e52c41dd1b65203431037645d89a6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 08:52:19 2024 From: gitlab at gitlab.haskell.org (Sebastian Graf (@sgraf812)) Date: Thu, 14 Mar 2024 04:52:19 -0400 Subject: [Git][ghc/ghc][wip/or-pats] Implement Or Patterns (#22596) Message-ID: <65f2bac3bd0ae_2b6bf27d4694c4033d@gitlab.mail> Sebastian Graf pushed to branch wip/or-pats at Glasgow Haskell Compiler / GHC Commits: 14a1c35c by David Knothe at 2024-03-14T09:52:13+01:00 Implement Or Patterns (#22596) This commit introduces a new language extension, `-XOrPatterns`, as described in GHC Proposal 522. An or-pattern `pat1; ...; patk` succeeds iff one of the patterns `pat1`, ..., `patk` succeed, in this order. See also the summary `Note [Implmentation of OrPatterns]`. Co-Authored-By: Sebastian Graf <sgraf1337 at gmail.com> - - - - - 30 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Pat.hs - compiler/GHC/Hs/Syn/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Match.hs - compiler/GHC/HsToCore/Pmc/Check.hs - compiler/GHC/HsToCore/Pmc/Desugar.hs - compiler/GHC/HsToCore/Pmc/Types.hs - compiler/GHC/HsToCore/Utils.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Bind.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/TyCl/PatSyn.hs - compiler/GHC/Tc/Zonk/Type.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Extension.hs - compiler/Language/Haskell/Syntax/Pat.hs - + docs/users_guide/exts/or_patterns.rst - docs/users_guide/exts/patterns.rst - libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/14a1c35cc51a0baa14fde85b8bf4c28dfc6120b0 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/14a1c35cc51a0baa14fde85b8bf4c28dfc6120b0 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 09:40:45 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 14 Mar 2024 05:40:45 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Note mutability of array and address access primops Message-ID: <65f2c61ceffef_2b6bf291d0200493e0@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 70043eba by Ben Orchard at 2024-03-14T05:40:34-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 53f757e4 by Alan Zimmerman at 2024-03-14T05:40:34-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 6 changed files: - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/printer/Makefile - + testsuite/tests/printer/Test24533.hs - + testsuite/tests/printer/Test24533.stdout - testsuite/tests/printer/all.T - utils/genprimopcode/AccessOps.hs Changes: ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -1135,8 +1135,8 @@ checkCmdBlockArguments :: LHsCmd GhcPs -> PV () -- (((Eq a))) --> [Eq a] -- @ checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) -checkContext orig_t@(L (EpAnn l _ _) _orig_t) = - check ([],[],emptyComments) orig_t +checkContext orig_t@(L (EpAnn l _ cs) _orig_t) = + check ([],[],cs) orig_t where check :: ([EpaLocation],[EpaLocation],EpAnnComments) -> LHsType GhcPs -> P (LHsContext GhcPs) ===================================== testsuite/tests/printer/Makefile ===================================== @@ -816,3 +816,8 @@ Test23885: AnnotationNoListTuplePuns: $(CHECK_PPR) $(LIBDIR) AnnotationNoListTuplePuns.hs $(CHECK_EXACT) $(LIBDIR) AnnotationNoListTuplePuns.hs + +.PHONY: Test24533 +Test24533: + $(CHECK_PPR) $(LIBDIR) Test24533.hs + $(CHECK_EXACT) $(LIBDIR) Test24533.hs ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -0,0 +1,8 @@ +{-# OPTIONS -ddump-parsed-ast #-} +module Test24533 where + +instance + ( Read a, -- Weird + Read b + ) => + Read (a, b) ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -0,0 +1,548 @@ + +==================== Parser AST ==================== + +(L + { Test24533.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.hs:9:1 } + { Test24533.hs:8:13 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.hs:(4,1)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:4:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(7,3) }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.hs:7:5-6 }))) + [(EpaSpan { Test24533.hs:5:3 })] + [(EpaSpan { Test24533.hs:7:3 })]) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:5:13-20 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:5:11 }))])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:5:5-10 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:5:11 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:6:5-10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:8-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.hs:8:8 }) + (EpaSpan { Test24533.hs:8:13 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:8:10 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) + + + +==================== Parser AST ==================== + +(L + { Test24533.ppr.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.ppr.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.ppr.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.ppr.hs:3:41 } + { Test24533.ppr.hs:3:40 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.ppr.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.ppr.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:1-40 }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:3:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-25 }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.ppr.hs:3:27-28 }))) + [(EpaSpan { Test24533.ppr.hs:3:10 })] + [(EpaSpan { Test24533.ppr.hs:3:25 })]) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-16 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:17 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:35-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.ppr.hs:3:35 }) + (EpaSpan { Test24533.ppr.hs:3:40 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:37 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) \ No newline at end of file ===================================== testsuite/tests/printer/all.T ===================================== @@ -196,3 +196,4 @@ test('Test23887', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23887']) test('Test23885', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23885']) test('ListTuplePuns', extra_files(['ListTuplePuns.hs']), ghci_script, ['ListTuplePuns.script']) test('AnnotationNoListTuplePuns', [ignore_stderr, req_ppr_deps], makefile_test, ['AnnotationNoListTuplePuns']) +test('Test24533', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24533']) ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/026033dee79a59057340b0fe0fc99c096efb7fcf...53f757e4cc6f6708af3483f17c6812859495ef93 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/026033dee79a59057340b0fe0fc99c096efb7fcf...53f757e4cc6f6708af3483f17c6812859495ef93 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 10:28:27 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Thu, 14 Mar 2024 06:28:27 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/9.10-windows-configure Message-ID: <65f2d14b32e83_2b6bf2a6c2c085519@gitlab.mail> Zubin pushed new branch wip/9.10-windows-configure at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/9.10-windows-configure You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 11:46:40 2024 From: gitlab at gitlab.haskell.org (Zubin (@wz1000)) Date: Thu, 14 Mar 2024 07:46:40 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/windows-topdir Message-ID: <65f2e3a0a7098_2b6bf2c7e468459567@gitlab.mail> Zubin pushed new branch wip/windows-topdir at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/windows-topdir You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 12:45:19 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Thu, 14 Mar 2024 08:45:19 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/T24251a Message-ID: <65f2f15f9402c_dbb551a35f7470f8@gitlab.mail> Simon Peyton Jones pushed new branch wip/T24251a at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24251a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 13:01:03 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 14 Mar 2024 09:01:03 -0400 Subject: [Git][ghc/ghc][master] Note mutability of array and address access primops Message-ID: <65f2f50fe6def_dbb5522e20b411957@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 1 changed file: - utils/genprimopcode/AccessOps.hs Changes: ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/77171cd1d482dbb2776ee06b2454cc2176a891ce -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/77171cd1d482dbb2776ee06b2454cc2176a891ce You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 13:01:55 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 14 Mar 2024 09:01:55 -0400 Subject: [Git][ghc/ghc][master] EPA: Fix regression discarding comments in contexts Message-ID: <65f2f5431d608_dbb55248fc7c167b8@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 5 changed files: - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/printer/Makefile - + testsuite/tests/printer/Test24533.hs - + testsuite/tests/printer/Test24533.stdout - testsuite/tests/printer/all.T Changes: ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -1135,8 +1135,8 @@ checkCmdBlockArguments :: LHsCmd GhcPs -> PV () -- (((Eq a))) --> [Eq a] -- @ checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) -checkContext orig_t@(L (EpAnn l _ _) _orig_t) = - check ([],[],emptyComments) orig_t +checkContext orig_t@(L (EpAnn l _ cs) _orig_t) = + check ([],[],cs) orig_t where check :: ([EpaLocation],[EpaLocation],EpAnnComments) -> LHsType GhcPs -> P (LHsContext GhcPs) ===================================== testsuite/tests/printer/Makefile ===================================== @@ -816,3 +816,8 @@ Test23885: AnnotationNoListTuplePuns: $(CHECK_PPR) $(LIBDIR) AnnotationNoListTuplePuns.hs $(CHECK_EXACT) $(LIBDIR) AnnotationNoListTuplePuns.hs + +.PHONY: Test24533 +Test24533: + $(CHECK_PPR) $(LIBDIR) Test24533.hs + $(CHECK_EXACT) $(LIBDIR) Test24533.hs ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -0,0 +1,8 @@ +{-# OPTIONS -ddump-parsed-ast #-} +module Test24533 where + +instance + ( Read a, -- Weird + Read b + ) => + Read (a, b) ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -0,0 +1,548 @@ + +==================== Parser AST ==================== + +(L + { Test24533.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.hs:9:1 } + { Test24533.hs:8:13 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.hs:(4,1)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:4:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(7,3) }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.hs:7:5-6 }))) + [(EpaSpan { Test24533.hs:5:3 })] + [(EpaSpan { Test24533.hs:7:3 })]) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:5:13-20 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:5:11 }))])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:5:5-10 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:5:11 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:6:5-10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:8-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.hs:8:8 }) + (EpaSpan { Test24533.hs:8:13 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:8:10 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) + + + +==================== Parser AST ==================== + +(L + { Test24533.ppr.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.ppr.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.ppr.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.ppr.hs:3:41 } + { Test24533.ppr.hs:3:40 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.ppr.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.ppr.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:1-40 }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:3:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-25 }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.ppr.hs:3:27-28 }))) + [(EpaSpan { Test24533.ppr.hs:3:10 })] + [(EpaSpan { Test24533.ppr.hs:3:25 })]) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-16 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:17 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:35-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.ppr.hs:3:35 }) + (EpaSpan { Test24533.ppr.hs:3:40 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:37 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) \ No newline at end of file ===================================== testsuite/tests/printer/all.T ===================================== @@ -196,3 +196,4 @@ test('Test23887', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23887']) test('Test23885', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23885']) test('ListTuplePuns', extra_files(['ListTuplePuns.hs']), ghci_script, ['ListTuplePuns.script']) test('AnnotationNoListTuplePuns', [ignore_stderr, req_ppr_deps], makefile_test, ['AnnotationNoListTuplePuns']) +test('Test24533', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24533']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7da7f8f643f1bfc4aa034a731f2f85cda007b286 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7da7f8f643f1bfc4aa034a731f2f85cda007b286 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 13:26:09 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 14 Mar 2024 09:26:09 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] rel_env/recompress_all: unxz before recompressing Message-ID: <65f2faf17c82f_dbb55324036c218bf@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: 036aedd0 by Ben Gamari at 2024-03-14T09:25:58-04:00 rel_env/recompress_all: unxz before recompressing Previously we would rather compress the xz *again*, before in addition compressing it with the desired scheme. Fixes #24545. - - - - - 1 changed file: - .gitlab/rel_eng/recompress-all Changes: ===================================== .gitlab/rel_eng/recompress-all ===================================== @@ -9,15 +9,15 @@ usage : %.gz : %.xz echo "[xz->gz] $< to $@..." - xz -c $< | gzip -c > $@ + xz -cd $< | gzip -c > $@ %.bz2 : %.xz echo "[xz->bz2] $< to $@..." - xz -c $< | bzip2 -c > $@ + xz -cd $< | bzip2 -c > $@ %.lz : %.xz echo "[xz->lz] $< to $@..." - xz -c $< | lzip -c > $@ + xz -cd $< | lzip -c > $@ %.zip : %.tar.xz echo "[tarxz->zip] $< to $@..." View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/036aedd045a523e70260af58b7e8643b5b6daff8 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/036aedd045a523e70260af58b7e8643b5b6daff8 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 13:48:28 2024 From: gitlab at gitlab.haskell.org (Sebastian Graf (@sgraf812)) Date: Thu, 14 Mar 2024 09:48:28 -0400 Subject: [Git][ghc/ghc][wip/or-pats] Implement Or Patterns (#22596) Message-ID: <65f3002c184b2_dbb553f1707c2768@gitlab.mail> Sebastian Graf pushed to branch wip/or-pats at Glasgow Haskell Compiler / GHC Commits: 3f5cf4ef by David Knothe at 2024-03-14T14:48:20+01:00 Implement Or Patterns (#22596) This commit introduces a new language extension, `-XOrPatterns`, as described in GHC Proposal 522. An or-pattern `pat1; ...; patk` succeeds iff one of the patterns `pat1`, ..., `patk` succeed, in this order. See also the summary `Note [Implmentation of OrPatterns]`. Co-Authored-By: Sebastian Graf <sgraf1337 at gmail.com> - - - - - 30 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Pat.hs - compiler/GHC/Hs/Syn/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Match.hs - compiler/GHC/HsToCore/Pmc/Check.hs - compiler/GHC/HsToCore/Pmc/Desugar.hs - compiler/GHC/HsToCore/Pmc/Types.hs - compiler/GHC/HsToCore/Utils.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Bind.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/Pat.hs - compiler/GHC/Tc/TyCl/PatSyn.hs - compiler/GHC/Tc/Zonk/Type.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Extension.hs - compiler/Language/Haskell/Syntax/Pat.hs - + docs/users_guide/exts/or_patterns.rst - docs/users_guide/exts/patterns.rst - libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3f5cf4ef92ed7b3a4c36698ea0896f1ca3e70ee6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3f5cf4ef92ed7b3a4c36698ea0896f1ca3e70ee6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 15:33:27 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 14 Mar 2024 11:33:27 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Note mutability of array and address access primops Message-ID: <65f318c7eae95_dbb556c5926052556@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - a8a170b5 by Fendor at 2024-03-14T11:33:12-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - e0a1d520 by Fendor at 2024-03-14T11:33:15-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 15 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Settings/IO.hs - hadrian/src/Rules/Generate.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep - testsuite/tests/printer/Makefile - + testsuite/tests/printer/Test24533.hs - + testsuite/tests/printer/Test24533.stdout - testsuite/tests/printer/all.T - utils/genprimopcode/AccessOps.hs Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -1135,8 +1135,8 @@ checkCmdBlockArguments :: LHsCmd GhcPs -> PV () -- (((Eq a))) --> [Eq a] -- @ checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) -checkContext orig_t@(L (EpAnn l _ _) _orig_t) = - check ([],[],emptyComments) orig_t +checkContext orig_t@(L (EpAnn l _ cs) _orig_t) = + check ([],[],cs) orig_t where check :: ([EpaLocation],[EpaLocation],EpAnnComments) -> LHsType GhcPs -> P (LHsContext GhcPs) ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -135,12 +141,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +267,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -416,7 +417,7 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) @@ -431,23 +432,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +572,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== ===================================== testsuite/tests/printer/Makefile ===================================== @@ -816,3 +816,8 @@ Test23885: AnnotationNoListTuplePuns: $(CHECK_PPR) $(LIBDIR) AnnotationNoListTuplePuns.hs $(CHECK_EXACT) $(LIBDIR) AnnotationNoListTuplePuns.hs + +.PHONY: Test24533 +Test24533: + $(CHECK_PPR) $(LIBDIR) Test24533.hs + $(CHECK_EXACT) $(LIBDIR) Test24533.hs ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -0,0 +1,8 @@ +{-# OPTIONS -ddump-parsed-ast #-} +module Test24533 where + +instance + ( Read a, -- Weird + Read b + ) => + Read (a, b) ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -0,0 +1,548 @@ + +==================== Parser AST ==================== + +(L + { Test24533.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.hs:9:1 } + { Test24533.hs:8:13 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.hs:(4,1)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:4:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(7,3) }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.hs:7:5-6 }))) + [(EpaSpan { Test24533.hs:5:3 })] + [(EpaSpan { Test24533.hs:7:3 })]) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:5:13-20 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:5:11 }))])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:5:5-10 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:5:11 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:6:5-10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:8-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.hs:8:8 }) + (EpaSpan { Test24533.hs:8:13 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:8:10 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) + + + +==================== Parser AST ==================== + +(L + { Test24533.ppr.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.ppr.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.ppr.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.ppr.hs:3:41 } + { Test24533.ppr.hs:3:40 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.ppr.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.ppr.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:1-40 }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:3:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-25 }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.ppr.hs:3:27-28 }))) + [(EpaSpan { Test24533.ppr.hs:3:10 })] + [(EpaSpan { Test24533.ppr.hs:3:25 })]) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-16 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:17 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:35-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.ppr.hs:3:35 }) + (EpaSpan { Test24533.ppr.hs:3:40 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:37 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) \ No newline at end of file ===================================== testsuite/tests/printer/all.T ===================================== @@ -196,3 +196,4 @@ test('Test23887', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23887']) test('Test23885', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23885']) test('ListTuplePuns', extra_files(['ListTuplePuns.hs']), ghci_script, ['ListTuplePuns.script']) test('AnnotationNoListTuplePuns', [ignore_stderr, req_ppr_deps], makefile_test, ['AnnotationNoListTuplePuns']) +test('Test24533', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24533']) ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/53f757e4cc6f6708af3483f17c6812859495ef93...e0a1d5202af25a49398f266cc011ac281ff8f914 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/53f757e4cc6f6708af3483f17c6812859495ef93...e0a1d5202af25a49398f266cc011ac281ff8f914 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 15:43:11 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Thu, 14 Mar 2024 11:43:11 -0400 Subject: [Git][ghc/ghc][wip/T24251a] Wibbles Message-ID: <65f31b0f3401b_dbb5571d919057693@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24251a at Glasgow Haskell Compiler / GHC Commits: ca405979 by Simon Peyton Jones at 2024-03-14T15:42:54+00:00 Wibbles - - - - - 2 changed files: - compiler/GHC/Core/Opt/Simplify/Env.hs - compiler/GHC/Core/Opt/Simplify/Iteration.hs Changes: ===================================== compiler/GHC/Core/Opt/Simplify/Env.hs ===================================== @@ -17,7 +17,7 @@ module GHC.Core.Opt.Simplify.Env ( seDoEtaReduction, seEtaExpand, seFloatEnable, seInline, seNames, seOptCoercionOpts, sePedanticBottoms, sePhase, sePlatform, sePreInline, seRuleOpts, seRules, seUnfoldingOpts, - mkSimplEnv, extendIdSubst, + mkSimplEnv, extendIdSubst, extendCvIdSubst, extendTvSubst, extendCvSubst, zapSubstEnv, setSubstEnv, bumpCaseDepth, getInScope, setInScopeFromE, setInScopeFromF, @@ -550,6 +550,10 @@ extendCvSubst env@(SimplEnv {seCvSubst = csubst}) var co = assert (isCoVar var) $ env {seCvSubst = extendVarEnv csubst var co} +extendCvIdSubst :: SimplEnv -> Id -> OutExpr -> SimplEnv +extendCvIdSubst env bndr (Coercion co) = extendCvSubst env bndr co +extendCvIdSubst env bndr rhs = extendIdSubst env bndr (DoneEx rhs NotJoinPoint) + --------------------- getInScope :: SimplEnv -> InScopeSet getInScope env = seInScope env ===================================== compiler/GHC/Core/Opt/Simplify/Iteration.hs ===================================== @@ -412,9 +412,7 @@ simplAuxBind env bndr new_rhs -- have no NOLINE pragmas, nor RULEs | exprIsTrivial new_rhs -- Short-cut for let x = y in ... = return ( emptyFloats env - , case new_rhs of - Coercion co -> extendCvSubst env bndr co - _ -> extendIdSubst env bndr (DoneEx new_rhs NotJoinPoint) ) + , extendCvIdSubst env bndr new_rhs ) -- bndr can be a CoVar | otherwise = do { -- ANF-ise the RHS @@ -3062,10 +3060,10 @@ rebuildCase env scrut case_bndr alts@[Alt con bndrs rhs] cont | DEFAULT <- con , exprIsTrivial scrut , isEvaldSoon case_bndr rhs - , let env' = extendIdSubst env case_bndr (DoneEx scrut NotJoinPoint) = assert( null bndrs ) $ do { tick (CaseElim case_bndr) - ; simplExprF env' rhs cont } + ; simplExprF (extendCvIdSubst env case_bndr scrut) rhs cont } + -- case_bndr can be a CoVar -- 2a. Dropping the case altogether, if -- a) it binds nothing (so it's really just a 'seq') View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ca405979ea626e3e7bcb137f356320827ff18253 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ca405979ea626e3e7bcb137f356320827ff18253 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 15:43:41 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Thu, 14 Mar 2024 11:43:41 -0400 Subject: [Git][ghc/ghc][wip/T24251a] 11 commits: Remove duplicate code normalising slashes Message-ID: <65f31b2d47409_dbb5573ad6c4578c9@gitlab.mail> Simon Peyton Jones pushed to branch wip/T24251a at Glasgow Haskell Compiler / GHC Commits: b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 25a754c5 by Simon Peyton Jones at 2024-03-14T15:43:15+00:00 Rename tryCaseMerge - - - - - 8b8a269c by Simon Peyton Jones at 2024-03-14T15:43:16+00:00 Try a more clever discard-eval Addresses programs like this f xs = xs `seq` (let t = reverse $ reverse $ reverse $ reverse $ reverse $ reverse xs in case xs of [] -> (t,True) (_:_) -> (t,False)) Also including the case where t is a join point. Relates to #24251. See GHC Log 13 March - - - - - 9975ad57 by Simon Peyton Jones at 2024-03-14T15:43:16+00:00 Wibbles - - - - - 27 changed files: - compiler/GHC/Core/Opt/Simplify/Env.hs - compiler/GHC/Core/Opt/Simplify/Iteration.hs - compiler/GHC/Core/Opt/Simplify/Utils.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Unique/Supply.hs - compiler/cbits/genSym.c - testsuite/driver/testlib.py - testsuite/tests/parser/should_fail/T21843a.stderr - testsuite/tests/parser/should_fail/T21843b.stderr - testsuite/tests/parser/should_fail/T21843c.stderr - testsuite/tests/parser/should_fail/T21843d.stderr - testsuite/tests/parser/should_fail/T21843e.stderr - testsuite/tests/parser/should_fail/T21843f.stderr - testsuite/tests/printer/Makefile - + testsuite/tests/printer/Test24533.hs - + testsuite/tests/printer/Test24533.stdout - testsuite/tests/printer/all.T - + testsuite/tests/typecheck/should_compile/T24470b.hs - testsuite/tests/typecheck/should_compile/all.T - + testsuite/tests/typecheck/should_fail/T24470a.hs - + testsuite/tests/typecheck/should_fail/T24470a.stderr - testsuite/tests/typecheck/should_fail/all.T - utils/genprimopcode/AccessOps.hs Changes: ===================================== compiler/GHC/Core/Opt/Simplify/Env.hs ===================================== @@ -17,7 +17,7 @@ module GHC.Core.Opt.Simplify.Env ( seDoEtaReduction, seEtaExpand, seFloatEnable, seInline, seNames, seOptCoercionOpts, sePedanticBottoms, sePhase, sePlatform, sePreInline, seRuleOpts, seRules, seUnfoldingOpts, - mkSimplEnv, extendIdSubst, + mkSimplEnv, extendIdSubst, extendCvIdSubst, extendTvSubst, extendCvSubst, zapSubstEnv, setSubstEnv, bumpCaseDepth, getInScope, setInScopeFromE, setInScopeFromF, @@ -550,6 +550,10 @@ extendCvSubst env@(SimplEnv {seCvSubst = csubst}) var co = assert (isCoVar var) $ env {seCvSubst = extendVarEnv csubst var co} +extendCvIdSubst :: SimplEnv -> Id -> OutExpr -> SimplEnv +extendCvIdSubst env bndr (Coercion co) = extendCvSubst env bndr co +extendCvIdSubst env bndr rhs = extendIdSubst env bndr (DoneEx rhs NotJoinPoint) + --------------------- getInScope :: SimplEnv -> InScopeSet getInScope env = seInScope env ===================================== compiler/GHC/Core/Opt/Simplify/Iteration.hs ===================================== @@ -412,9 +412,7 @@ simplAuxBind env bndr new_rhs -- have no NOLINE pragmas, nor RULEs | exprIsTrivial new_rhs -- Short-cut for let x = y in ... = return ( emptyFloats env - , case new_rhs of - Coercion co -> extendCvSubst env bndr co - _ -> extendIdSubst env bndr (DoneEx new_rhs NotJoinPoint) ) + , extendCvIdSubst env bndr new_rhs ) -- bndr can be a CoVar | otherwise = do { -- ANF-ise the RHS @@ -3053,12 +3051,20 @@ rebuildCase env scrut case_bndr alts cont -- 2. Eliminate the case if scrutinee is evaluated -------------------------------------------------- -rebuildCase env scrut case_bndr alts@[Alt _ bndrs rhs] cont +rebuildCase env scrut case_bndr alts@[Alt con bndrs rhs] cont -- See if we can get rid of the case altogether -- See Note [Case elimination] -- mkCase made sure that if all the alternatives are equal, -- then there is now only one (DEFAULT) rhs + | DEFAULT <- con + , exprIsTrivial scrut + , isEvaldSoon case_bndr rhs + = assert( null bndrs ) $ + do { tick (CaseElim case_bndr) + ; simplExprF (extendCvIdSubst env case_bndr scrut) rhs cont } + -- case_bndr can be a CoVar + -- 2a. Dropping the case altogether, if -- a) it binds nothing (so it's really just a 'seq') -- b) evaluating the scrutinee has no side effects @@ -3106,6 +3112,24 @@ rebuildCase env scrut case_bndr alts cont = reallyRebuildCase env scrut case_bndr alts cont +isEvaldSoon :: InId -> InExpr -> Bool +-- (isEvaldSoon b e) is True is evaluated soon by e +isEvaldSoon bndr expr + = go expr + where + go (Var v) = v==bndr + go (Case scrut cb _ alts) + | Var v <- scrut, v==bndr = True + | otherwise = all go_alt alts && cb /= bndr && all ok_alt alts + -- ok_alt only runs if things look good + go (Let _ e) = go e + go (Tick _ e) = go e + go (Cast e _) = go e + go _ = False + + go_alt (Alt _ _ rhs) = go rhs + ok_alt (Alt _ cbs _) = not (bndr `elem` cbs) + doCaseToLet :: OutExpr -- Scrutinee -> InId -- Case binder -> Bool ===================================== compiler/GHC/Core/Opt/Simplify/Utils.hs ===================================== @@ -2395,7 +2395,7 @@ Wrinkles This story is not fully robust; it will be defeated by a let-binding, whih we don't want to duplicate. But accounting for single-alternative case-on-variable is easy to do, and seems useful in common cases so - `tryMergeCase` does it. + `tryCaseMerge` does it. Note [Eliminate Identity Case] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2578,7 +2578,7 @@ mkCase, mkCase1, mkCase2, mkCase3 mkCase mode scrut outer_bndr alts_ty alts | sm_case_merge mode - , Just alts' <- tryMergeCase outer_bndr alts + , Just alts' <- tryCaseMerge outer_bndr alts = do { tick (CaseMerge outer_bndr) ; mkCase1 mode scrut outer_bndr alts_ty alts' } -- Warning: don't call mkCase recursively! @@ -2589,9 +2589,9 @@ mkCase mode scrut outer_bndr alts_ty alts | otherwise = mkCase1 mode scrut outer_bndr alts_ty alts -tryMergeCase :: OutId -> [OutAlt] -> Maybe [OutAlt] +tryCaseMerge :: OutId -> [OutAlt] -> Maybe [OutAlt] -- See Note [Merge Nested Cases] -tryMergeCase outer_bndr (Alt DEFAULT _ deflt_rhs : outer_alts) +tryCaseMerge outer_bndr (Alt DEFAULT _ deflt_rhs : outer_alts) = case go 5 (\e -> e) emptyVarSet deflt_rhs of Nothing -> Nothing Just inner_alts -> Just (mergeAlts outer_alts inner_alts) @@ -2630,7 +2630,7 @@ tryMergeCase outer_bndr (Alt DEFAULT _ deflt_rhs : outer_alts) go n wrap free_bndrs (Case (Var inner_scrut) inner_bndr ty inner_alts) | [Alt con bndrs rhs] <- inner_alts -- Wrinkle (MC1) , let wrap_case rhs' = Case (Var inner_scrut) inner_bndr ty $ - tryMergeCase inner_bndr alts `orElse` alts + tryCaseMerge inner_bndr alts `orElse` alts where alts = [Alt con bndrs rhs'] = assert (not (outer_bndr `elem` (inner_bndr : bndrs))) $ @@ -2638,7 +2638,7 @@ tryMergeCase outer_bndr (Alt DEFAULT _ deflt_rhs : outer_alts) go _ _ _ _ = Nothing -tryMergeCase _ _ = Nothing +tryCaseMerge _ _ = Nothing -------------------------------------------------- -- 2. Eliminate Identity Case ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -1135,8 +1135,8 @@ checkCmdBlockArguments :: LHsCmd GhcPs -> PV () -- (((Eq a))) --> [Eq a] -- @ checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) -checkContext orig_t@(L (EpAnn l _ _) _orig_t) = - check ([],[],emptyComments) orig_t +checkContext orig_t@(L (EpAnn l _ cs) _orig_t) = + check ([],[],cs) orig_t where check :: ([EpaLocation],[EpaLocation],EpAnnComments) -> LHsType GhcPs -> P (LHsContext GhcPs) ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where , text "in a fixity signature" ] + TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated + [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate" + , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ] + , suggestion ] + where + suggestion = + text "Use" <+> quotes at_bndr <+> text "on the LHS" <+> + text "or" <+> quotes forall_bndr <+> text "on the RHS" <+> + text "to bring it into scope." + at_bndr = char '@' <> ppr tv_name + forall_bndr = text "forall" <+> ppr tv_name <> text "." + diagnosticReason :: TcRnMessage -> DiagnosticReason diagnosticReason = \case TcRnUnknownMessage m @@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where -> ErrorWithoutFlag TcRnNamespacedFixitySigWithoutFlag{} -> ErrorWithoutFlag + TcRnOutOfArityTyVar{} + -> ErrorWithoutFlag diagnosticHints = \case TcRnUnknownMessage m @@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where -> noHints TcRnNamespacedFixitySigWithoutFlag{} -> [suggestExtension LangExt.ExplicitNamespaces] + TcRnOutOfArityTyVar{} + -> noHints diagnosticCode = constructorCode ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -2272,6 +2272,8 @@ data TcRnMessage where where the implicitly-bound type type variables can't be matched up unambiguously with the ones from the signature. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType. + + Test cases: T24083 -} TcRnDisconnectedTyVar :: !Name -> TcRnMessage @@ -4267,6 +4269,24 @@ data TcRnMessage where -} TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage + {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym + (as determined by the SAKS and the LHS) is insufficiently high to + accommodate an implicit binding for a free variable that occurs in the + outermost kind signature on the RHS of the said type synonym. + + Example: + + type SynBad :: forall k. k -> Type + type SynBad = Proxy :: j -> Type + + Test cases: + T24770a + -} + TcRnOutOfArityTyVar + :: Name -- ^ Type synonym's name + -> Name -- ^ Type variable's name + -> TcRnMessage + deriving Generic ---- ===================================== compiler/GHC/Tc/Gen/HsType.hs ===================================== @@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav ; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs ; let implicit_prs = implicit_nms `zip` implicit_tvs ; checkForDuplicateScopedTyVars implicit_prs - ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs + ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs -- Swizzle the Names so that the TyCon uses the user-declared implicit names -- E.g type T :: k -> Type @@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind * * ********************************************************************* -} -checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder] +checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder] -> [(Name,TcTyVar)] -> TcM () -- See Note [Disconnected type variables] +-- For the type synonym case see Note [Out of arity type variables] -- `scoped_prs` is the mapping gotten by unifying -- - the standalone kind signature for T, with -- - the header of the type/class declaration for T -checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs - = when (needsEtaExpansion flav) $ +checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs -- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables] - mapM_ report_disconnected (filterOut ok scoped_prs) + | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs) + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + | otherwise = pure () where - sig_tvs = mkVarSet (binderVars sig_tcbs) - ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs + all_tvs = mkVarSet (binderVars all_tcbs) + ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs report_disconnected :: (Name,TcTyVar) -> TcM () report_disconnected (nm, _) = setSrcSpan (getSrcSpan nm) $ addErrTc $ TcRnDisconnectedTyVar nm + report_out_of_arity :: (Name,TcTyVar) -> TcM () + report_out_of_arity (tv_nm, _) + = setSrcSpan (getSrcSpan tv_nm) $ + addErrTc $ TcRnOutOfArityTyVar name tv_nm + checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM () -- Check for duplicates -- E.g. data SameKind (a::k) (b::k) @@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification. The scoped-tyvar stuff is needed precisely for data/class/newtype declarations, where needsEtaExpansion is True. + +Note [Out of arity type variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(Relevant ticket: #24470) +Type synonyms have a special scoping rule that allows implicit quantification in +the outermost kind signature: + + type P_e :: k -> Type + type P_e @k = Proxy :: k -> Type -- explicit binding + + type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule) + +This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but +we have to support it for a couple more releases. It is explained in more detail +in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType. + +Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind +`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is +the number of arguments it requires at use sites; the arity matter because +unsaturated application of type families and type synonyms is not allowed). + +We start to see problems when implicit RHS quantification (as in `P_i`) is +combined with a standalone king signature (like the one that `P_e` has). +That is: + + type P_i_sig :: k -> Type + type P_i_sig = Proxy :: k -> Type + +Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/, +which has no binders. So the arity of `P_i_sig` is 0. +At the same time, the legacy implicit quantification rule dictates that `k` is +brought into scope, as if there was a binder `@k` on the LHS. + +We end up with a `k` that is in scope on the RHS but cannot be bound implicitly +on the LHS without affecting the arity. This led to #24470 (a compiler crash) + + GHC internal error: ‘k’ is not in scope during type checking, + but it passed the renamer + +This problem occurs only if the arity of the type synonym is insufficiently +high to accommodate an implicit binding. It can be worked around by adding an +unused binder on the LHS: + + type P_w :: k -> Type + type P_w @_w = Proxy :: k -> Type + +The variable `_w` is unused. The only effect of the `@_w` binder is that the +arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly +what's needed to make the implicit binding of `k` possible. + +All this is a rather unfortunate bit of accidental complexity that will go away +when GHC drops support for implicit RHS quantification. In the meantime, we +ought to produce a proper error message instead of a compiler panic, and we do +that with a check in checkForDisconnectedScopedTyVars: + + | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs) + -} {- ********************************************************************* ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964 GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249 GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534 + GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925 -- TcRnTypeApplicationsDisabled GhcDiagnosticCode "TypeApplication" = 23482 ===================================== compiler/GHC/Types/Unique/Supply.hs ===================================== @@ -7,7 +7,6 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE UnboxedTuples #-} -{-# LANGUAGE UnliftedFFITypes #-} module GHC.Types.Unique.Supply ( -- * Main data type @@ -49,16 +48,16 @@ import Foreign.Storable #define NO_FETCH_ADD #endif -#if defined(javascript_HOST_ARCH) -import GHC.Exts ( atomicCasWord64Addr#, eqWord64# ) -#elif !defined(NO_FETCH_ADD) -import GHC.Exts( fetchAddWordAddr#, word64ToWord#, wordToWord64# ) +#if defined(NO_FETCH_ADD) +import GHC.Exts ( atomicCasWord64Addr#, eqWord64#, readWord64OffAddr# ) +#else +import GHC.Exts( fetchAddWordAddr#, word64ToWord# ) #endif import GHC.Exts ( Addr#, State#, Word64#, RealWorld ) - +import GHC.Int ( Int(..) ) import GHC.Word( Word64(..) ) -import GHC.Exts( plusWord64#, readWord64OffAddr# ) +import GHC.Exts( plusWord64#, int2Word#, wordToWord64# ) {- ************************************************************************ @@ -233,8 +232,9 @@ mkSplitUniqSupply c (# s4, MkSplitUniqSupply (tag .|. u) x y #) }}}} -#if defined(javascript_HOST_ARCH) --- CAS-based pure Haskell implementation +#if defined(NO_FETCH_ADD) +-- GHC currently does not provide this operation on 32-bit platforms, +-- hence the CAS-based implementation. fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# = go @@ -246,35 +246,7 @@ fetchAddWord64Addr# = go (# s2, res #) | 1# <- res `eqWord64#` n0 -> (# s2, n0 #) | otherwise -> go ptr inc s2 - -#elif defined(NO_FETCH_ADD) - --- atomic_inc64 is defined in compiler/cbits/genSym.c. This is of --- course not ideal, but we need to live with it for now given the --- current situation: --- 1. There's no Haskell primop fetchAddWord64Addr# on 32-bit --- platforms yet --- 2. The Cmm %fetch_add64 primop syntax is only present in ghc 9.8 --- but we currently bootstrap from older ghc in our CI --- 3. The Cmm MO_AtomicRMW operation with 64-bit width is well --- supported on 32-bit platforms already, but the plumbing from --- either Haskell or Cmm doesn't work yet because of 1 or 2 --- 4. There's hs_atomic_add64 in ghc-prim cbits that we ought to use, --- but it's only available on 32-bit starting from ghc 9.8 --- 5. The pure Haskell implementation causes mysterious i386 --- regression in unrelated ghc work that can only be fixed by the C --- version here - -foreign import ccall unsafe "atomic_inc64" atomic_inc64 :: Addr# -> Word64# -> IO Word64 - -fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld - -> (# State# RealWorld, Word64# #) -fetchAddWord64Addr# addr inc s0 = - case unIO (atomic_inc64 addr inc) s0 of - (# s1, W64# res #) -> (# s1, res #) - #else - fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #) fetchAddWord64Addr# addr inc s0 = @@ -286,9 +258,9 @@ genSym :: IO Word64 genSym = do let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1 let !(Ptr counter) = ghc_unique_counter64 - let !(Ptr inc_ptr) = ghc_unique_inc - u <- IO $ \s0 -> case readWord64OffAddr# inc_ptr 0# s0 of - (# s1, inc #) -> case fetchAddWord64Addr# counter inc s1 of + I# inc# <- peek ghc_unique_inc + let !inc = wordToWord64# (int2Word# inc#) + u <- IO $ \s1 -> case fetchAddWord64Addr# counter inc s1 of (# s2, val #) -> let !u = W64# (val `plusWord64#` inc) .&. mask in (# s2, u #) ===================================== compiler/cbits/genSym.c ===================================== @@ -15,11 +15,3 @@ HsWord64 ghc_unique_counter64 = 0; #if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) HsInt ghc_unique_inc = 1; #endif - -// Only used on 32-bit non-JS platforms -#if WORD_SIZE_IN_BITS != 64 -StgWord64 atomic_inc64(StgWord64 volatile* p, StgWord64 incr) -{ - return __atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST); -} -#endif ===================================== testsuite/driver/testlib.py ===================================== @@ -1119,8 +1119,8 @@ def normalise_win32_io_errors(name, opts): def normalise_version_( *pkgs ): def normalise_version__( str ): # (name)(-version)(-hash)(-components) - return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-zA-Z\+]+)?(-[0-9a-zA-Z]+)?', - '\\1--', str) + return re.sub('(' + '|'.join(map(re.escape,pkgs)) + r')-[0-9.]+(-[0-9a-zA-Z+]+)?(-[0-9a-zA-Z]+)?', + r'\1--', str) return normalise_version__ def normalise_version( *pkgs ): @@ -1491,7 +1491,7 @@ async def do_test(name: TestName, if opts.expect not in ['pass', 'fail', 'missing-lib']: framework_fail(name, way, 'bad expected ' + opts.expect) - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) if way in opts.fragile_ways: if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail')) @@ -1538,7 +1538,7 @@ def override_options(pre_cmd): def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = '%s(%s)' % (name, way) if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) name2 = name if name is not None else TestName('none') @@ -1549,7 +1549,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str def framework_warn(name: TestName, way: WayName, reason: str) -> None: opts = getTestOpts() - directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir)) + directory = re.sub(r'^\.[/\\]', '', str(opts.testdir)) full_name = name + '(' + way + ')' if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) t.framework_warnings.append(TestResult(directory, name, reason, way)) @@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str: s = normalise_callstacks(s) s = normalise_type_reps(s) - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + # normalise slashes to minimise Windows/Unix filename differences, + # but don't normalize backslashes in chars + s = re.sub(r"(?!')\\", '/', s) # Normalize the name of the GHC executable. Specifically, # this catches the cases that: @@ -2614,14 +2615,11 @@ def normalise_errmsg(s: str) -> str: # the colon is there because it appears in error messages; this # hacky solution is used in place of more sophisticated filename # mangling - s = re.sub('([^\\s])\\.exe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) # Same thing for .wasm modules generated by the Wasm backend - s = re.sub('([^\\s])\\.wasm', '\\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) # Same thing for .jsexe directories generated by the JS backend - s = re.sub('([^\\s])\\.jsexe', '\\1', s) - - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub('\\\\', '/', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) # hpc executable is given ghc suffix s = re.sub('hpc-ghc', 'hpc', s) @@ -2631,8 +2629,8 @@ def normalise_errmsg(s: str) -> str: s = re.sub('ghc-stage[123]', 'ghc', s) # Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools # (ghc, ghc-pkg, unlit, etc.) - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) - s = re.sub('\\w+(-\\w+)*-unlit', 'unlit', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-unlit', 'unlit', s) # On windows error messages can mention versioned executables s = re.sub('ghc-[0-9.]+', 'ghc', s) @@ -2735,8 +2733,8 @@ def normalise_prof (s: str) -> str: return s def normalise_slashes_( s: str ) -> str: - s = re.sub('\\\\', '/', s) - s = re.sub('//', '/', s) + s = re.sub(r'\\', '/', s) + s = re.sub(r'//', '/', s) return s def normalise_exe_( s: str ) -> str: @@ -2754,9 +2752,9 @@ def normalise_output( s: str ) -> str: # and .wasm extension (for the Wasm backend) # and .jsexe extension (for the JS backend) # This can occur in error messages generated by the program. - s = re.sub('([^\\s])\\.exe', '\\1', s) - s = re.sub('([^\\s])\\.wasm', '\\1', s) - s = re.sub('([^\\s])\\.jsexe', '\\1', s) + s = re.sub(r'([^\s])\.exe', r'\1', s) + s = re.sub(r'([^\s])\.wasm', r'\1', s) + s = re.sub(r'([^\s])\.jsexe', r'\1', s) s = normalise_callstacks(s) s = normalise_type_reps(s) # ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is @@ -2776,7 +2774,7 @@ def normalise_output( s: str ) -> str: s = re.sub('.*warning: argument unused during compilation:.*\n', '', s) # strip the cross prefix if any - s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s) + s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s) return s ===================================== testsuite/tests/parser/should_fail/T21843a.stderr ===================================== @@ -1,4 +1,4 @@ T21843a.hs:3:13: [GHC-31623] - Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not + Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843b.stderr ===================================== @@ -1,3 +1,3 @@ T21843b.hs:3:11: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843c.stderr ===================================== @@ -1,6 +1,6 @@ T21843c.hs:3:19: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not T21843c.hs:3:20: [GHC-21231] - lexical error in string/character literal at character '/n' + lexical error in string/character literal at character '\n' ===================================== testsuite/tests/parser/should_fail/T21843d.stderr ===================================== @@ -1,3 +1,3 @@ T21843d.hs:3:13: [GHC-31623] - Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not + Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/parser/should_fail/T21843e.stderr ===================================== @@ -1,3 +1,3 @@ T21843e.hs:3:15: [GHC-31623] - Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not ===================================== testsuite/tests/parser/should_fail/T21843f.stderr ===================================== @@ -1,3 +1,3 @@ T21843f.hs:3:13: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not ===================================== testsuite/tests/printer/Makefile ===================================== @@ -816,3 +816,8 @@ Test23885: AnnotationNoListTuplePuns: $(CHECK_PPR) $(LIBDIR) AnnotationNoListTuplePuns.hs $(CHECK_EXACT) $(LIBDIR) AnnotationNoListTuplePuns.hs + +.PHONY: Test24533 +Test24533: + $(CHECK_PPR) $(LIBDIR) Test24533.hs + $(CHECK_EXACT) $(LIBDIR) Test24533.hs ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -0,0 +1,8 @@ +{-# OPTIONS -ddump-parsed-ast #-} +module Test24533 where + +instance + ( Read a, -- Weird + Read b + ) => + Read (a, b) ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -0,0 +1,548 @@ + +==================== Parser AST ==================== + +(L + { Test24533.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.hs:9:1 } + { Test24533.hs:8:13 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.hs:(4,1)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:4:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(8,13) }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:(5,3)-(7,3) }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.hs:7:5-6 }))) + [(EpaSpan { Test24533.hs:5:3 })] + [(EpaSpan { Test24533.hs:7:3 })]) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:5:13-20 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:5:11 }))])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:5:5-10 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:5:11 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:5:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:6:5-10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:6:10 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:3-6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:8-13 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.hs:8:8 }) + (EpaSpan { Test24533.hs:8:13 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.hs:8:10 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:8:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) + + + +==================== Parser AST ==================== + +(L + { Test24533.ppr.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { Test24533.ppr.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { Test24533.ppr.hs:2:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:2:18-22 }))] + [] + (Just + ((,) + { Test24533.ppr.hs:3:41 } + { Test24533.ppr.hs:3:40 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { Test24533.ppr.hs:1:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { Test24533.ppr.hs:1:1 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:2:8-16 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: Test24533})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:1-40 }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:3:1-8 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsQualTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:10-25 }) + (AnnContext + (Just + ((,) + (NormalSyntax) + (EpaSpan { Test24533.ppr.hs:3:27-28 }))) + [(EpaSpan { Test24533.ppr.hs:3:10 })] + [(EpaSpan { Test24533.ppr.hs:3:25 })]) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-16 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:17 }))]) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:11-14 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:16 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:19-22 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:24 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))))]) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:30-33 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Read})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:35-40 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTupleTy + (AnnParen + AnnParens + (EpaSpan { Test24533.ppr.hs:3:35 }) + (EpaSpan { Test24533.ppr.hs:3:40 })) + (HsBoxedOrConstraintTuple) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (AnnListItem + [(AddCommaAnn + (EpaSpan { Test24533.ppr.hs:3:37 }))]) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:36 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:3:39 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: b}))))])))))))) + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + [] + (Nothing)))))])) \ No newline at end of file ===================================== testsuite/tests/printer/all.T ===================================== @@ -196,3 +196,4 @@ test('Test23887', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23887']) test('Test23885', [ignore_stderr, req_ppr_deps], makefile_test, ['Test23885']) test('ListTuplePuns', extra_files(['ListTuplePuns.hs']), ghci_script, ['ListTuplePuns.script']) test('AnnotationNoListTuplePuns', [ignore_stderr, req_ppr_deps], makefile_test, ['AnnotationNoListTuplePuns']) +test('Test24533', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24533']) ===================================== testsuite/tests/typecheck/should_compile/T24470b.hs ===================================== @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-} +{-# LANGUAGE TypeAbstractions #-} + +module T24470b where + +import Data.Kind +import Data.Data + +type SynOK :: forall k. k -> Type +type SynOK @t = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -912,3 +912,4 @@ test('T21206', normal, compile, ['']) test('T17594a', req_th, compile, ['']) test('T17594f', normal, compile, ['']) test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context']) +test('T24470b', normal, compile, ['']) ===================================== testsuite/tests/typecheck/should_fail/T24470a.hs ===================================== @@ -0,0 +1,7 @@ +module T24470a where + +import Data.Data +import Data.Kind + +type SynBad :: forall k. k -> Type +type SynBad = Proxy :: j -> Type ===================================== testsuite/tests/typecheck/should_fail/T24470a.stderr ===================================== @@ -0,0 +1,6 @@ + +T24470a.hs:7:24: error: [GHC-84925] + • The arity of ‘SynBad’ is insufficiently high to accommodate + an implicit binding for the ‘j’ type variable. + • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope. + • In the type synonym declaration for ‘SynBad’ ===================================== testsuite/tests/typecheck/should_fail/all.T ===================================== @@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors']) test('T17594c', normal, compile_fail, ['']) test('T17594d', normal, compile_fail, ['']) test('T17594g', normal, compile_fail, ['']) + +test('T24470a', normal, compile_fail, ['']) ===================================== utils/genprimopcode/AccessOps.hs ===================================== @@ -82,7 +82,7 @@ mkIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect CanFail] } @@ -94,7 +94,7 @@ mkUnalignedIndexByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable array; offset in bytes." , opts = [OptionEffect CanFail] } @@ -106,7 +106,7 @@ mkReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -118,7 +118,7 @@ mkUnalignedReadByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -130,7 +130,7 @@ mkWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ "." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in " ++ prettyOffset e ++ "." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -142,7 +142,7 @@ mkUnalignedWriteByteArrayOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable array; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -166,7 +166,7 @@ mkIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect CanFail] } @@ -179,7 +179,7 @@ mkUnalignedIndexOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") (elt_rep_ty e) , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from immutable address; offset in bytes." , opts = [OptionEffect CanFail] } @@ -191,7 +191,7 @@ mkReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -204,7 +204,7 @@ mkUnalignedReadOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ readResTy e , cat = GenPrimOp - , desc = "Read " ++ elt_desc e ++ "; offset in bytes." + , desc = "Read " ++ elt_desc e ++ " from mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -216,7 +216,7 @@ mkWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in " ++ prettyOffset e ++ ".\n\n" + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in " ++ prettyOffset e ++ ".\n\n" ++ getAlignWarn e , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } @@ -229,7 +229,7 @@ mkUnalignedWriteOffAddrOp e = PrimOpSpec $ TyF (strToTy "Int#") $ writeResTy e , cat = GenPrimOp - , desc = "Write " ++ elt_desc e ++ "; offset in bytes." + , desc = "Write " ++ elt_desc e ++ " to mutable address; offset in bytes." , opts = [OptionEffect ReadWriteEffect, OptionCanFailWarnFlag YesWarnCanFail] } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ca405979ea626e3e7bcb137f356320827ff18253...9975ad57752aacdf96eed7874c1a042bce3e05af -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ca405979ea626e3e7bcb137f356320827ff18253...9975ad57752aacdf96eed7874c1a042bce3e05af You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 16:09:37 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Thu, 14 Mar 2024 12:09:37 -0400 Subject: [Git][ghc/ghc][wip/simplifier-tweaks] 64 commits: base: Use strerror_r instead of strerror Message-ID: <65f3214155de4_dbb557e56f585988c@gitlab.mail> Simon Peyton Jones pushed to branch wip/simplifier-tweaks at Glasgow Haskell Compiler / GHC Commits: 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 89166ff5 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Several improvements to the handling of coercions * Make `mkSymCo` and `mkInstCo` smarter Fixes #23642 * Fix return role of `SelCo` in the coercion optimiser. Fixes #23617 * Make the coercion optimiser `opt_trans_rule` work better for newtypes Fixes #23619 - - - - - 232eea83 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Simplifier improvements This MR started as: allow the simplifer to do more in one pass, arising from places I could see the simplifier taking two iterations where one would do. But it turned into a larger project, because these changes unexpectedly made inlining blow up, especially join points in deeply-nested cases. The net result is good: a 1.5% improvement in compile time. The table below shows changes over 1%. The main changes are: * The SimplEnv now has a seInlineDepth field, which says how deep in unfoldings we are. See Note [Inline depth] in Simplify.Env * Avoid repeatedly simplifying coercions. see Note [Avoid re-simplifying coercions] in Simplify.Iteration As you'll see from the Note, this makes use of the seInlineDepth. * Allow Simplify.Utils.postInlineUnconditionally to inline variables that are used exactly once. See Note [Post-inline for single-use things]. * Allow Simplify.Iteration.simplAuxBind to inline used-once things. This is another part of Note [Post-inline for single-use things], and is really good for reducing simplifier iterations in situations like case K e of { K x -> blah } wher x is used once in blah. * Make GHC.Core.SimpleOpt.exprIsConApp_maybe do some simple case elimination. Note [Case elim in exprIsConApp_maybe] * Many new or rewritten Notes. E.g. Note [Avoiding simplifying repeatedly] Join points ~~~~~~~~~~~ * Be very careful about inlining join points. See Note [Duplicating join points] in GHC.Core.Opt.Simplify.Iteration * When making join points, don't do so if the join point is so small it will immediately be inlined; check uncondInlineJoin. * When considering inlining a join point, never do so unless there is a positive gain: see (DJ5) in Note [Duplicating join points]. * Do not float join points at all, except to top level. See GHC.Core.Opt.SetLevels.dontFloatNonRec * Do not add an unfolding to a join point at birth. This is a tricky one and has a long Note [Do not add unfoldings to join points at birth] It shows up in two places - In `mkDupableAlt` do not add an inlining - (trickier) In `simplLetUnfolding` don't add an unfolding for a fresh join point I am not fully satisifed with this, but it works and is well documented. * In GHC.Core.Unfold.sizeExpr, make jumps small, so that we don't penalise having a non-inlined join point. * Use plan A for dataToTag and tagToEnum I discovered that GHC.HsToCore.Pmc.Solver.Types.trvVarInfo was very delicately balanced. It's a small, heavily used, overloaded function and it's important that it inlines. By a fluke it was before, but at various times in my journey it stopped doing so. So I added an INLINE pragma to it. Metrics: compile_time/bytes allocated ------------------------------------------------ CoOpt_Singletons(normal) -8.2% GOOD LargeRecord(normal) -22.7% GOOD PmSeriesS(normal) -4.1% PmSeriesT(normal) -3.1% PmSeriesV(normal) -1.6% T11195(normal) -1.9% T12227(normal) -19.9% GOOD T12545(normal) -5.4% T12707(normal) -2.1% GOOD T13253-spj(normal) -13.1% GOOD T13386(normal) -1.6% T14766(normal) -2.2% GOOD T15630a(normal) NEW T15703(normal) -13.5% GOOD T16577(normal) -4.3% GOOD T17096(normal) -4.4% T17516(normal) -0.2% T18223(normal) -16.3% GOOD T18282(normal) -5.3% GOOD T18730(optasm) NEW T18923(normal) -3.7% GOOD T21839c(normal) -2.3% GOOD T3064(normal) -1.3% T5030(normal) -16.1% GOOD T5321Fun(normal) -1.5% T6048(optasm) -11.8% GOOD T783(normal) -1.4% T8095(normal) -5.9% GOOD T9630(normal) -5.1% GOOD T9020(optasm) +1.5% T18698a(normal) +1.5% BAD T14683(normal) +1.2% DsIncompleteRecSel3(normal) +1.2% MultiComponentModulesRecomp(normal) +1.0% MultiLayerModulesRecomp(normal) +1.9% MultiLayerModulesTH_Make(normal) +1.4% T10421(normal) +1.9% BAD T10421a(normal) +3.0% T13056(optasm) +1.1% T13253(normal) +1.0% T1969(normal) +1.1% BAD T15304(normal) +1.7% T9675(optasm) +1.2% T9961(normal) +2.4% BAD geo. mean -1.5% minimum -22.7% maximum +3.0% Metric Decrease: CoOpt_Singletons LargeRecord T12227 T12707 T12990 T13253-spj T13536a T14766 T15703 T16577 T18223 T18282 T18923 T21839c T5030 T6048 T8095 T9630 Metric Increase: T10421 T18698a T1969 T9961 - - - - - 55455474 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Improve postInlineUnconditionally This commit adds two things to postInlineUnconditionally: 1. Do not postInlineUnconditionally join point, ever. Doing so does not reduce allocation, which is the main point, and with join points that are used a lot it can bloat code. See point (1) of Note [Duplicating join points] in GHC.Core.Opt.Simplify.Iteration. 2. Do not postInlineUnconditionally a strict (demanded) binding. It will not allocate a thunk (it'll turn into a case instead) so again the main point of inlining it doesn't hold. Better to check per-call-site. - - - - - b1163fb7 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 More wibbles * Inline join points whose RHS just calls another join point * Don't float join points at all (SetLevels) * Ensure that WorkWrap preserves lambda binders, in case of join points - - - - - 329c3e58 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Unused variable wibbles - - - - - e239a94a by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 More import wibbles - - - - - adddc6aa by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 More imports - - - - - b01b7089 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 More wibbles - - - - - 70ae1bbf by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 More on floating join points * Get rid of the "join ceiling" which I have always hated * Float joins to top level in final pass only (needs documenting--see my GHC log) * Refactor wantToFloat so that it applies to Rec and NonRec uniformly - - - - - 660ce223 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Comments about floating joins - - - - - 5ca6974d by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Improve occurrence analyis for bottoming function calls See Note [Bottoming function calls] - - - - - 045227d7 by Simon Peyton Jones at 2024-03-14T16:07:33+00:00 Test output wibbles - - - - - 5fdcd133 by Simon Peyton Jones at 2024-03-14T16:07:34+00:00 More testsuite wibbles - - - - - 86bf6d2f by Simon Peyton Jones at 2024-03-14T16:07:34+00:00 Float recursive joins to top level This seems be be a net win. Example joinrec { f x = ..f x'... } in f v Despite Note [Floating join point bindings] - - - - - 9fb899b8 by Simon Peyton Jones at 2024-03-14T16:07:34+00:00 Inline join points that have evaluated things at the use site. This helps quite a bit with wheel-sieve1. Example let x = <small thunk> in join $j = (x,y) in case z of A -> case x of P -> $j Q -> blah B -> x C -> True Here `x` can't be duplicated into the branches becuase it is used in both the join point and the A branch. But if we inline $j we get let x = <small thunk> in join $j = (x,y) in case z of A -> case x of x' P -> (x', y) Q -> blah B -> x C -> True and now we /can/ duplicate x into the branches. - - - - - 7b20d3a7 by Simon Peyton Jones at 2024-03-14T16:07:34+00:00 Two small things * isConLikeUnfolding is false for OtherCon * Evaluated args look like NonTrivArg not ValueArg See GHC log 15 Feb - - - - - bb585b86 by Simon Peyton Jones at 2024-03-14T16:07:34+00:00 Further careful changes - - - - - e18261b5 by Simon Peyton Jones at 2024-03-14T16:07:51+00:00 Try a more clever discard-eval Addresses programs like this f xs = xs `seq` (let t = reverse $ reverse $ reverse $ reverse $ reverse $ reverse xs in case xs of [] -> (t,True) (_:_) -> (t,False)) Also including the case where t is a join point. Relates to #24251. See GHC Log 13 March - - - - - 401113c9 by Simon Peyton Jones at 2024-03-14T16:08:09+00:00 Wibbles - - - - - 22 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core.hs - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/Coercion/Opt.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/FloatOut.hs - compiler/GHC/Core/Opt/Monad.hs - compiler/GHC/Core/Opt/OccurAnal.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Opt/Simplify.hs - compiler/GHC/Core/Opt/Simplify/Env.hs - compiler/GHC/Core/Opt/Simplify/Inline.hs - compiler/GHC/Core/Opt/Simplify/Iteration.hs - compiler/GHC/Core/Opt/Simplify/Monad.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a33476b9bdca731d1a90466fe866b417f2cdd09c...401113c9731c7dcd47e5f2e39ffb6c5ee3975af4 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a33476b9bdca731d1a90466fe866b417f2cdd09c...401113c9731c7dcd47e5f2e39ffb6c5ee3975af4 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 16:25:17 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 14 Mar 2024 12:25:17 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] mk-ghcup-metadata: Fix directory of testsuite tarball Message-ID: <65f324ed5dac3_dbb55858d6c86273c@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: e8bb627d by Ben Gamari at 2024-03-14T11:10:40-04:00 mk-ghcup-metadata: Fix directory of testsuite tarball As reported in #24546, the `dlTest` artifact should be extracted into the `testsuite` directory. - - - - - 1 changed file: - .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py Changes: ===================================== .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py ===================================== @@ -80,7 +80,7 @@ source_artifact = Artifact('source-tarball' test_artifact = Artifact('source-tarball' , 'ghc-{version}-testsuite.tar.xz' , 'ghc-{version}-testsuite.tar.xz' - , 'ghc-{version}' ) + , 'ghc-{version}/testsuite' ) def debian(arch, n): return linux_platform(arch, "{arch}-linux-deb{n}".format(arch=arch, n=n)) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e8bb627d23028bfaf4f29033be2e50a01bb36e6e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e8bb627d23028bfaf4f29033be2e50a01bb36e6e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 16:33:08 2024 From: gitlab at gitlab.haskell.org (Ben Gamari (@bgamari)) Date: Thu, 14 Mar 2024 12:33:08 -0400 Subject: [Git][ghc/ghc][wip/release-fixes] ghcup-metadata: Don't populate dlOutput unless necessary Message-ID: <65f326c485df6_dbb5588c92ec64866@gitlab.mail> Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC Commits: 470331cd by Ben Gamari at 2024-03-14T12:32:01-04:00 ghcup-metadata: Don't populate dlOutput unless necessary ghcup can apparently infer the output name of an artifact from its URL. Consequently, we should only include the `dlOutput` field when it would differ from the filename of `dlUri`. Fixes #24547. - - - - - 1 changed file: - .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py Changes: ===================================== .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py ===================================== @@ -36,6 +36,7 @@ import os import yaml import gitlab from urllib.request import urlopen +from urllib.parse import urlparse import hashlib import sys import json @@ -156,13 +157,18 @@ def mk_one_metadata(release_mode, version, job_map, artifact): eprint(f"Bindist URL: {url}") eprint(f"Download URL: {final_url}") - #Download and hash from the release pipeline, this must not change anyway during upload. + # Download and hash from the release pipeline, this must not change anyway during upload. h = download_and_hash(url) res = { "dlUri": final_url , "dlSubdir": artifact.subdir.format(version=version) - , "dlOutput": artifact.output_name.format(version=version) , "dlHash" : h } + + # Only add dlOutput if it is inconsistent with the filename inferred from the URL + output = artifact.output_name.format(version=version) + if Path(urlparse(final_url).path).name != output: + res["dlOutput"] = output + eprint(res) return res View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/470331cd89b6184125f8876085c2aae073d3ea43 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/470331cd89b6184125f8876085c2aae073d3ea43 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 17:31:43 2024 From: gitlab at gitlab.haskell.org (Brandon Chinn (@brandonchinn178)) Date: Thu, 14 Mar 2024 13:31:43 -0400 Subject: [Git][ghc/ghc] Deleted branch wip/stderr-normalize-escape Message-ID: <65f3347f5e4e2_dbb55a34f5946744b@gitlab.mail> Brandon Chinn deleted branch wip/stderr-normalize-escape at Glasgow Haskell Compiler / GHC -- You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 17:40:44 2024 From: gitlab at gitlab.haskell.org (Brandon Chinn (@brandonchinn178)) Date: Thu, 14 Mar 2024 13:40:44 -0400 Subject: [Git][ghc/ghc][wip/multiline-strings] 129 commits: Improve the synopsis and description of base Message-ID: <65f3369ccb84a_1ca96757a094966f3@gitlab.mail> Brandon Chinn pushed to branch wip/multiline-strings at Glasgow Haskell Compiler / GHC Commits: 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 7ff30f85 by Brandon Chinn at 2024-03-14T10:32:54-07:00 Add MultilineStrings extension - - - - - d69c82d3 by Brandon Chinn at 2024-03-14T10:40:33-07:00 Add test cases for MultilineStrings - - - - - f7a57615 by Brandon Chinn at 2024-03-14T10:40:34-07:00 Break out common lex_magic_hash logic for strings and chars - - - - - 857bbf05 by Brandon Chinn at 2024-03-14T10:40:34-07:00 Factor out string processing functions - - - - - 8d2cf320 by Brandon Chinn at 2024-03-14T10:40:34-07:00 Implement MultilineStrings (#24390) Updates haddock submodule for new ITmultiline constructor - - - - - 775254fb by Brandon Chinn at 2024-03-14T10:40:34-07:00 Add docs for MultilineStrings - - - - - 30 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs - compiler/GHC/Cmm/Dataflow/Graph.hs - compiler/GHC/Cmm/Dataflow/Label.hs - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/Cmm/Dominators.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d2edce69340c31ab7ed995f7db5fae269976733f...775254fb84509381e042bba0d03d3b88139e6eed -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d2edce69340c31ab7ed995f7db5fae269976733f...775254fb84509381e042bba0d03d3b88139e6eed You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Thu Mar 14 23:24:09 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Thu, 14 Mar 2024 19:24:09 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Escape multiple arguments in the settings file Message-ID: <65f38719ca945_1ca967962718c130824@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 5bea24cf by Fendor at 2024-03-14T19:24:01-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - 9848d580 by Fendor at 2024-03-14T19:24:03-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 9 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Settings/IO.hs - hadrian/src/Rules/Generate.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -135,12 +141,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +267,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -416,7 +417,7 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) @@ -431,23 +432,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +572,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e0a1d5202af25a49398f266cc011ac281ff8f914...9848d58006f7361b847e4991d899fdc5a06d75ca -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e0a1d5202af25a49398f266cc011ac281ff8f914...9848d58006f7361b847e4991d899fdc5a06d75ca You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 15 12:44:06 2024 From: gitlab at gitlab.haskell.org (Torsten Schmits (@torsten.schmits)) Date: Fri, 15 Mar 2024 08:44:06 -0400 Subject: [Git][ghc/ghc][wip/torsten.schmits/rts-linker-direct-symbol-lookup] 3 commits: move test to subdir Message-ID: <65f44296b0bc1_2befd6d187a88392ca@gitlab.mail> Torsten Schmits pushed to branch wip/torsten.schmits/rts-linker-direct-symbol-lookup at Glasgow Haskell Compiler / GHC Commits: a68cbaf2 by Torsten Schmits at 2024-03-13T15:15:18+01:00 move test to subdir - - - - - fb25ac08 by Torsten Schmits at 2024-03-15T13:42:56+01:00 add flag and logging - - - - - 17319148 by Torsten Schmits at 2024-03-15T13:43:51+01:00 add test case with long chain of package deps - - - - - 17 changed files: - compiler/GHC/ByteCode/Linker.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Linker/Loader.hs - compiler/GHC/Linker/Types.hs - ghc/Main.hs - testsuite/tests/rts/linker/Makefile - + testsuite/tests/rts/linker/T23415/Makefile - testsuite/tests/rts/linker/Reuse.hs → testsuite/tests/rts/linker/T23415/Reuse.hs - testsuite/tests/rts/linker/Reuse.script → testsuite/tests/rts/linker/T23415/Reuse.script - testsuite/tests/rts/linker/ReusePlugin.hs → testsuite/tests/rts/linker/T23415/ReusePlugin.hs - testsuite/tests/rts/linker/T23415.stderr → testsuite/tests/rts/linker/T23415/T23415a.stderr - + testsuite/tests/rts/linker/T23415/T23415b.script - + testsuite/tests/rts/linker/T23415/all.T - + testsuite/tests/rts/linker/T23415/prepare-load.sh - testsuite/tests/rts/linker/reuse.conf → testsuite/tests/rts/linker/T23415/reuse.conf - testsuite/tests/rts/linker/all.T Changes: ===================================== compiler/GHC/ByteCode/Linker.hs ===================================== @@ -46,6 +46,7 @@ import Language.Haskell.Syntax.Module.Name import Data.Array.Unboxed import Foreign.Ptr import GHC.Exts +import GHC.Utils.Error (debugTraceMsg) {- Linking interpretables into something we can run @@ -53,7 +54,7 @@ import GHC.Exts linkBCO :: Interp - -> PkgsLoaded + -> PkgsLoadedEnv -> LinkerEnv -> NameEnv Int -> UnlinkedBCO @@ -68,7 +69,7 @@ linkBCO interp pkgs_loaded le bco_ix (listArray (0, fromIntegral (sizeSS lits0)-1) lits) (addListToSS emptySS ptrs)) -lookupLiteral :: Interp -> PkgsLoaded -> LinkerEnv -> BCONPtr -> IO Word +lookupLiteral :: Interp -> PkgsLoadedEnv -> LinkerEnv -> BCONPtr -> IO Word lookupLiteral interp pkgs_loaded le ptr = case ptr of BCONPtrWord lit -> return lit BCONPtrLbl sym -> do @@ -92,7 +93,7 @@ lookupStaticPtr interp addr_of_label_string = do Nothing -> linkFail "GHC.ByteCode.Linker: can't find label" (unpackFS addr_of_label_string) -lookupIE :: Interp -> PkgsLoaded -> ItblEnv -> Name -> IO (Ptr ()) +lookupIE :: Interp -> PkgsLoadedEnv -> ItblEnv -> Name -> IO (Ptr ()) lookupIE interp pkgs_loaded ie con_nm = case lookupNameEnv ie con_nm of Just (_, ItblPtr a) -> return (fromRemotePtr (castRemotePtr a)) @@ -112,7 +113,7 @@ lookupIE interp pkgs_loaded ie con_nm = unpackFS sym_to_find2) -- see Note [Generating code for top-level string literal bindings] in GHC.StgToByteCode -lookupAddr :: Interp -> PkgsLoaded -> AddrEnv -> Name -> IO (Ptr ()) +lookupAddr :: Interp -> PkgsLoadedEnv -> AddrEnv -> Name -> IO (Ptr ()) lookupAddr interp pkgs_loaded ae addr_nm = do case lookupNameEnv ae addr_nm of Just (_, AddrPtr ptr) -> return (fromRemotePtr ptr) @@ -135,7 +136,7 @@ lookupPrimOp interp primop = do resolvePtr :: Interp - -> PkgsLoaded + -> PkgsLoadedEnv -> LinkerEnv -> NameEnv Int -> BCOPtr @@ -166,8 +167,8 @@ resolvePtr interp pkgs_loaded le bco_ix ptr = case ptr of BCOPtrBreakArray breakarray -> withForeignRef breakarray $ \ba -> return (ResolvedBCOPtrBreakArray ba) -lookupHsSymbol :: Interp -> PkgsLoaded -> Name -> String -> IO (Maybe (Ptr ())) -lookupHsSymbol interp pkgs_loaded nm sym_suffix = do +lookupHsSymbol :: Interp -> PkgsLoadedEnv -> Name -> String -> IO (Maybe (Ptr ())) +lookupHsSymbol interp PkgsLoadedEnv {ple_pkgs_loaded = pkgs_loaded, ple_logger = logger} nm sym_suffix = do massertPpr (isExternalName nm) (ppr nm) let sym_to_find = nameToCLabel nm sym_suffix pkg_id = moduleUnitId $ nameModule nm @@ -176,12 +177,20 @@ lookupHsSymbol interp pkgs_loaded nm sym_suffix = do go (dll:dlls) = do mb_ptr <- lookupSymbolInDLL interp dll sym_to_find case mb_ptr of - Just ptr -> pure (Just ptr) + Just ptr -> do + log_resolution sym_to_find "hit" + pure (Just ptr) Nothing -> go dlls - go [] = + go [] = do + log_resolution sym_to_find "miss" lookupSymbol interp sym_to_find go loaded_dlls + where + log_resolution sym_to_find res = + debugTraceMsg logger 3 $ + text "lookupHsSymbol: Cache" <+> text res <+> text "for" <+> ppr nm <+> + parens (ftext sym_to_find) linkFail :: String -> String -> IO a linkFail who what ===================================== compiler/GHC/Driver/Flags.hs ===================================== @@ -468,6 +468,7 @@ data GeneralFlag -- temporary flags | Opt_AutoLinkPackages | Opt_ImplicitImportQualified + | Opt_CacheLoadedLibraryUnits -- keeping stuff | Opt_KeepHscppFiles ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -2345,8 +2345,8 @@ fFlagsDeps = [ flagGhciSpec "break-on-error" Opt_BreakOnError, flagGhciSpec "break-on-exception" Opt_BreakOnException, flagSpec "building-cabal-package" Opt_BuildingCabalPackage, + flagGhciSpec "cache-loaded-library-units" Opt_CacheLoadedLibraryUnits, flagSpec "call-arity" Opt_CallArity, - flagSpec "exitification" Opt_Exitification, flagSpec "case-merge" Opt_CaseMerge, flagSpec "case-folding" Opt_CaseFolding, flagSpec "cmm-elim-common-blocks" Opt_CmmElimCommonBlocks, @@ -2379,6 +2379,7 @@ fFlagsDeps = [ flagSpec "enable-th-splice-warnings" Opt_EnableThSpliceWarnings, flagSpec "error-spans" Opt_ErrorSpans, flagSpec "excess-precision" Opt_ExcessPrecision, + flagSpec "exitification" Opt_Exitification, flagSpec "expose-all-unfoldings" Opt_ExposeAllUnfoldings, flagSpec "keep-auto-rules" Opt_KeepAutoRules, flagSpec "expose-internal-symbols" Opt_ExposeInternalSymbols, ===================================== compiler/GHC/Linker/Loader.hs ===================================== @@ -588,7 +588,7 @@ loadExpr interp hsc_env span root_ul_bco = do -- Load the necessary packages and linkables let le = linker_env pls bco_ix = mkNameEnv [(unlinkedBCOName root_ul_bco, 0)] - resolved <- linkBCO interp (pkgs_loaded pls) le bco_ix root_ul_bco + resolved <- linkBCO interp (PkgsLoadedEnv (pkgs_loaded pls) (hsc_logger hsc_env)) le bco_ix root_ul_bco [root_hvref] <- createBCOs interp [resolved] fhv <- mkFinalizedHValue interp root_hvref return (pls, fhv) @@ -651,7 +651,7 @@ loadDecls interp hsc_env span cbc at CompiledByteCode{..} = do , addr_env = plusNameEnv (addr_env le) bc_strs } -- Link the necessary packages and linkables - new_bindings <- linkSomeBCOs interp (pkgs_loaded pls) le2 [cbc] + new_bindings <- linkSomeBCOs interp (PkgsLoadedEnv (pkgs_loaded pls) (hsc_logger hsc_env)) le2 [cbc] nms_fhvs <- makeForeignNamedHValueRefs interp new_bindings let ce2 = extendClosureEnv (closure_env le2) nms_fhvs !pls2 = pls { linker_env = le2 { closure_env = ce2 } } @@ -706,7 +706,7 @@ loadModuleLinkables interp hsc_env pls linkables if failed ok_flag then return (pls1, Failed) else do - pls2 <- dynLinkBCOs interp pls1 bcos + pls2 <- dynLinkBCOs interp hsc_env pls1 bcos return (pls2, Succeeded) @@ -856,8 +856,8 @@ rmDupLinkables already ls ********************************************************************* -} -dynLinkBCOs :: Interp -> LoaderState -> [Linkable] -> IO LoaderState -dynLinkBCOs interp pls bcos = do +dynLinkBCOs :: Interp -> HscEnv -> LoaderState -> [Linkable] -> IO LoaderState +dynLinkBCOs interp hsc_env pls bcos = do let (bcos_loaded', new_bcos) = rmDupLinkables (bcos_loaded pls) bcos pls1 = pls { bcos_loaded = bcos_loaded' } @@ -873,7 +873,7 @@ dynLinkBCOs interp pls bcos = do ae2 = foldr plusNameEnv (addr_env le1) (map bc_strs cbcs) le2 = le1 { itbl_env = ie2, addr_env = ae2 } - names_and_refs <- linkSomeBCOs interp (pkgs_loaded pls) le2 cbcs + names_and_refs <- linkSomeBCOs interp (PkgsLoadedEnv (pkgs_loaded pls) (hsc_logger hsc_env)) le2 cbcs -- We only want to add the external ones to the ClosureEnv let (to_add, to_drop) = partition (isExternalName.fst) names_and_refs @@ -888,7 +888,7 @@ dynLinkBCOs interp pls bcos = do -- Link a bunch of BCOs and return references to their values linkSomeBCOs :: Interp - -> PkgsLoaded + -> PkgsLoadedEnv -> LinkerEnv -> [CompiledByteCode] -> IO [(Name,HValueRef)] @@ -896,7 +896,7 @@ linkSomeBCOs :: Interp -- the incoming unlinked BCOs. Each gives the -- value of the corresponding unlinked BCO -linkSomeBCOs interp pkgs_loaded le mods = foldr fun do_link mods [] +linkSomeBCOs interp pkgs_loaded_env le mods = foldr fun do_link mods [] where fun CompiledByteCode{..} inner accum = inner (bc_bcos : accum) @@ -905,7 +905,7 @@ linkSomeBCOs interp pkgs_loaded le mods = foldr fun do_link mods [] let flat = [ bco | bcos <- mods, bco <- bcos ] names = map unlinkedBCOName flat bco_ix = mkNameEnv (zip names [0..]) - resolved <- sequence [ linkBCO interp pkgs_loaded le bco_ix bco | bco <- flat ] + resolved <- sequence [ linkBCO interp pkgs_loaded_env le bco_ix bco | bco <- flat ] hvrefs <- createBCOs interp resolved return (zip names hvrefs) @@ -1072,11 +1072,18 @@ loadPackages' interp hsc_env new_pks pls = do | dep_pkg <- deps , Just loaded_pkg_info <- pure (lookupUDFM pkgs' dep_pkg) ] - ; return (addToUDFM pkgs' new_pkg (LoadedPkgInfo new_pkg hs_cls extra_cls loaded_dlls trans_deps)) } + cached | cacheDlls = loaded_dlls + | otherwise = [] + ; when (cacheDlls && not (null cached)) $ + debugTraceMsg (hsc_logger hsc_env) 3 $ + text "loadPackages': Updating cache for" <+> ppr (unitId pkg_cfg) + ; return (addToUDFM pkgs' new_pkg (LoadedPkgInfo new_pkg hs_cls extra_cls cached trans_deps)) } | otherwise = throwGhcExceptionIO (CmdLineError ("unknown package: " ++ unpackFS (unitIdFS new_pkg))) + cacheDlls = gopt Opt_CacheLoadedLibraryUnits (hsc_dflags hsc_env) + loadPackage :: Interp -> HscEnv -> UnitInfo -> IO ([LibrarySpec], [LibrarySpec], [RemotePtr LoadedDLL]) loadPackage interp hsc_env pkg ===================================== compiler/GHC/Linker/Types.hs ===================================== @@ -33,6 +33,7 @@ module GHC.Linker.Types , LibrarySpec(..) , LoadedPkgInfo(..) , PkgsLoaded + , PkgsLoadedEnv(..) ) where @@ -57,6 +58,7 @@ import GHC.Unit.Module.Env import GHC.Types.Unique.DSet import GHC.Types.Unique.DFM import GHC.Unit.Module.WholeCoreBindings +import GHC.Utils.Logger (Logger) {- ********************************************************************** @@ -140,6 +142,12 @@ extendClosureEnv :: ClosureEnv -> [(Name,ForeignHValue)] -> ClosureEnv extendClosureEnv cl_env pairs = extendNameEnvList cl_env [ (n, (n,v)) | (n,v) <- pairs] +data PkgsLoadedEnv = + PkgsLoadedEnv { + ple_pkgs_loaded :: !PkgsLoaded, + ple_logger :: !Logger + } + type PkgsLoaded = UniqDFM UnitId LoadedPkgInfo data LoadedPkgInfo ===================================== ghc/Main.hs ===================================== @@ -218,6 +218,8 @@ main' postLoadMode units dflags0 args flagWarnings = do `gopt_set` Opt_UseBytecodeRatherThanObjects -- By default enable the debugger by inserting breakpoints `gopt_set` Opt_InsertBreakpoints + -- Speed up symbol lookup + `gopt_set` Opt_CacheLoadedLibraryUnits logger1 <- getLogger let logger2 = setLogFlags logger1 (initLogFlags dflags2) ===================================== testsuite/tests/rts/linker/Makefile ===================================== @@ -140,35 +140,3 @@ T20918: T21618: "$(TEST_HC)" -c T21618_c.c -o T21618_c.o echo main | '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) T21618_c.o T21618.hs - -REUSE_DB=db -REUSE_CONF=reuse.conf -REUSE_PKG=pkg-reuse - -.PHONY: T23415 -T23415: - mkdir -p "$(REUSE_PKG)"/{lib,hi} - mkdir -p src - mkdir -p "$(REUSE_DB)" - mv Reuse.hs ReusePlugin.hs src/ - "$(TEST_HC)" $(filter-out -rtsopts, $(TEST_HC_OPTS)) \ - -dynamic-too \ - -hidir "$(REUSE_PKG)/hi/" \ - -O0 \ - -this-unit-id reuse-1.0 \ - -package ghc \ - -c src/* - "$(TEST_HC)" $(filter-out -rtsopts, $(TEST_HC_OPTS)) \ - -dynamic -shared -fPIC \ - -hidir "$(REUSE_PKG)/hi/" \ - -this-unit-id reuse-1.0 \ - -package ghc \ - -O0 \ - -o "$(REUSE_PKG)/lib/libHSreuse-1.0-ghc$(shell "$(TEST_HC)" --numeric-version)$(dllext)" src/*.dyn_o - "$(GHC_PKG)" --no-user-package-db --package-db="$(REUSE_DB)" recache - "$(GHC_PKG)" --no-user-package-db --package-db="$(REUSE_DB)" register "$(REUSE_CONF)" - "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) \ - -package-db $(REUSE_DB) \ - -v0 +RTS -Dl -RTS \ - -fplugin=ReusePlugin \ - -ghci-script Reuse.script ===================================== testsuite/tests/rts/linker/T23415/Makefile ===================================== @@ -0,0 +1,43 @@ +TOP=../../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +REUSE_DB=db +REUSE_CONF=reuse.conf +REUSE_PKG=pkg-reuse + +.PHONY: T23415a +T23415a: + mkdir -p "$(REUSE_PKG)"/{lib,hi} + mkdir -p src + mkdir -p "$(REUSE_DB)" + mv Reuse.hs ReusePlugin.hs src/ + "$(TEST_HC)" $(filter-out -rtsopts, $(TEST_HC_OPTS)) \ + -dynamic-too \ + -hidir "$(REUSE_PKG)/hi/" \ + -O0 \ + -this-unit-id reuse-1.0 \ + -package ghc \ + -c src/* + "$(TEST_HC)" $(filter-out -rtsopts, $(TEST_HC_OPTS)) \ + -dynamic -shared -fPIC \ + -hidir "$(REUSE_PKG)/hi/" \ + -this-unit-id reuse-1.0 \ + -package ghc \ + -O0 \ + -o "$(REUSE_PKG)/lib/libHSreuse-1.0-ghc$(shell "$(TEST_HC)" --numeric-version)$(dllext)" src/*.dyn_o + "$(GHC_PKG)" --no-user-package-db --package-db="$(REUSE_DB)" recache + "$(GHC_PKG)" --no-user-package-db --package-db="$(REUSE_DB)" register "$(REUSE_CONF)" + "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) \ + -package-db $(REUSE_DB) \ + -v0 +RTS -Dl -RTS \ + -fplugin=ReusePlugin \ + -ghci-script Reuse.script + +.PHONY: T23415b +T23415b: + ./prepare-load.sh "$(TEST_HC)" " $(filter-out -rtsopts, $(TEST_HC_OPTS))" "$(GHC_PKG)" "$(dllext)" 30 100 1000 + +.PHONY: T23415d +T23415d: T23415b + "$(TEST_HC)" -package-db=db -fcache-loaded-library-units -v0 --interactive -ghci-script T23415.script ===================================== testsuite/tests/rts/linker/Reuse.hs → testsuite/tests/rts/linker/T23415/Reuse.hs ===================================== ===================================== testsuite/tests/rts/linker/Reuse.script → testsuite/tests/rts/linker/T23415/Reuse.script ===================================== ===================================== testsuite/tests/rts/linker/ReusePlugin.hs → testsuite/tests/rts/linker/T23415/ReusePlugin.hs ===================================== ===================================== testsuite/tests/rts/linker/T23415.stderr → testsuite/tests/rts/linker/T23415/T23415a.stderr ===================================== ===================================== testsuite/tests/rts/linker/T23415/T23415b.script ===================================== @@ -0,0 +1,13 @@ +import Data.Time.Clock.System +import System.IO +import Data.Int +start <- systemSeconds <$> getSystemTime +writeFile "start-time" (show start) +hPutStrLn stderr "--------------------- START" +:load Main +hPutStrLn stderr "--------------------- LOADED" +main +hPutStrLn stderr "--------------------- EXECUTED" +end <- systemSeconds <$> getSystemTime +start :: Int64 <- readIO =<< readFile "start-time" +hPutStrLn stderr (show (end - start) ++ " seconds") ===================================== testsuite/tests/rts/linker/T23415/all.T ===================================== @@ -0,0 +1,36 @@ +setTestOpts([ + # unless(doing_ghci, skip), + unless(have_dynamic(),skip), +]) + +###################################### +# https://gitlab.haskell.org/ghc/ghc/-/issues/23415 + +###################################### +# When loading a Haskell symbol from a shared object (here `libHS_Reuse-1.0-ghcXXX.so` created from `Reuse.hs`), +# the native object loader in `loadNativeObj_ELF` stores the object code in a list. +# When the function is called again for the same object, the previously stored object code is returned. +test('T23415a', + [extra_files(['Reuse.hs', 'Reuse.script', 'reuse.conf', 'ReusePlugin.hs']), + grep_stderr('Found existing OC for.*libHSreuse-1.*'), + req_rts_linker], + makefile_test, ['T23415a']) + +test('T23415b', + [extra_files(['prepare-load.sh']), + pre_cmd('$MAKE T23415b'), + req_rts_linker, + # extra_hc_opts('-package-db=db -fno-cache-loaded-library-units -v3')], + extra_hc_opts('-package-db=db -fno-cache-loaded-library-units -v3')], + ghci_script, ['T23415b.script']) + +test('T23415c', + [extra_files(['prepare-load.sh']), + pre_cmd('$MAKE T23415b'), + req_rts_linker], + multimod_compile_and_run, ['Main', '-dynamic -package-db=db -O0']) + +test('T23415d', + [extra_files(['prepare-load.sh']), + req_rts_linker], + makefile_test, ['T23415d']) ===================================== testsuite/tests/rts/linker/T23415/prepare-load.sh ===================================== @@ -0,0 +1,203 @@ +#!/usr/bin/env bash + +set -e + +if [[ $# < 6 ]] +then + echo "Usage: ./prepare-transitive-load.sh GHC GHC_OPTS GHC_PKG DLL_EXT NUM_PKGS NUM_FUNCS NUM_REFS" + exit 1 +fi + +ghc_cmd="$1" +ghc_opts="$2" +ghc_pkg_cmd="$3" +dll_ext="$4" +num_pkgs="$5" +num_funcs="$6" +num_refs="$7" + +base="$PWD" +src="$base/src" +build="$base/build" +db="$base/db" + +ghc_pkg() +{ + eval "${ghc_pkg_cmd at Q} --no-user-package-db --package-db=${db at Q} $@" +} + +ghc() +{ + eval "${ghc_cmd at Q} $ghc_opts $@" +} + +version_suffix=$(ghc --numeric-version) + +range() +{ + eval echo "{1..$1}" +} + +append() +{ + echo -e "$*" >> $file_name +} + +create_sources() +{ + local num="$1" + local prev="$(($num - 1))" + local name="load${num}" + local module_name="Load${num}" + local fun expr + file_name="${module_name}.hs" + cd "$base" + mkdir -p "$src/$name" "$build/$name/lib" "$build/$name/hi" + cd "$src" + cd "$name" + append "module $module_name where" + if [[ $prev != 0 ]] + then + append "\nimport Load${prev}" + fi + for j in $(range $num_funcs) + do + fun="num${num}_${j}" + append "\n$fun :: Int" + if [[ $prev == 0 ]] + then + expr="$j" + else + expr="num${prev}_${j}" + fi + append "$fun = $expr" + done + cd "$build" + file_name="${name}/${name}.conf" + append "name: $name +version: 1.0 +id: ${name}-1.0 +key: ${name}-1.0 +exposed: True +exposed-modules: ${module_name} +import-dirs: \${pkgroot}/build/${name}/hi +dynamic-library-dirs: \${pkgroot}/build/${name}/lib +hs-libraries: HS${name}-1.0" + if [[ $prev != 0 ]] + then + append "depends: load${prev}-1.0" + fi +} + +create_package() +{ + local num="$1" + local prev="$(($num - 1))" + local name="load${num}" + local module_name="Load${num}" + local pkg_build="$build/$name" + if [[ $prev != 0 ]] + then + extra="-package load${prev}" + fi + local opts="-package-db ${db at Q} -hidir ${pkg_build at Q}/hi -O0 -this-unit-id ${name}-1.0 $extra" + # dynamic-too produces .dyn_o and .dyn_hi + # eval "${ghc at Q} $opts -dynamic-too -c ${src at Q}/${name}/${module_name}.hs" + ghc "$opts -dynamic-too -c ${src at Q}/${name}/${module_name}.hs" + # -dynamic instructs GHC to link against shared objects of dependencies + ghc "$opts -dynamic -shared -fPIC -o ${pkg_build at Q}/lib/libHS${name}-1.0-ghc${version_suffix}${dll_ext} ${src at Q}/${name}/${module_name}.dyn_o" + ghc_pkg register "${build at Q}/${name}/${name}.conf" +} + +mkdir "$src" "$build" "$db" + +for i in $(range $num_pkgs) +do + create_sources $i +done + +cd "$base" +ghc_pkg recache + +for i in $(range $num_pkgs) +do + create_package $i +done + +cd "$base" + +file_name="Main.hs" + +append "module Main where" + +# for i in $(range $num_pkgs) +# do +# append "import Load${i}" +# done + +append "import Load${num_pkgs}" + +for i in $(range $num_refs) +do + append " +ref${i} :: Int +ref${i} = sum [" + for j in $(range $num_funcs) + do + append " num${num_pkgs}_${j}," + done + append " 0]" +done + +append ' +main :: IO () +main = do' + +append ' putStrLn $ show $ sum [' + +for i in $(range $num_refs) +do + append " ref${i}," +done + +append " 0]" + +file_name=T23415.script + +append 'import Data.Time.Clock.System +import System.IO +import Data.Int +start <- systemSeconds <$> getSystemTime +writeFile "start-time" (show start) +hPutStrLn stderr "--------------------- START" +' + +for i in $(eval echo "{1..${num_pkgs}}") +# for i in $(eval echo "{${num_pkgs}..1}") +do + append "import Load${i} +putStrLn (show num${i}_1)" +done + +append ' +endLoad1 <- systemSeconds <$> getSystemTime +start :: Int64 <- readIO =<< readFile "start-time" +writeFile "start-time" (show endLoad1) +hPutStrLn stderr ("--------------------- LOADED 1: " ++ show (endLoad1 - start) ++ " seconds") +:load Main +endLoad2 <- systemSeconds <$> getSystemTime +endLoad1 :: Int64 <- readIO =<< readFile "start-time" +hPutStrLn stderr ("--------------------- LOADED 2: " ++ show (endLoad2 - endLoad1) ++ " seconds") +main +endExec1 <- systemSeconds <$> getSystemTime +hPutStrLn stderr ("--------------------- EXECUTED 1: " ++ show (endExec1 - endLoad2) ++ " seconds") +main +endExec2 <- systemSeconds <$> getSystemTime +writeFile "start-time" (show endExec2) +hPutStrLn stderr ("--------------------- EXECUTED 2: " ++ show (endExec2 - endExec1) ++ " seconds") +:reload +main +endExec3 <- systemSeconds <$> getSystemTime +endExec2 :: Int64 <- readIO =<< readFile "start-time" +hPutStrLn stderr ("--------------------- EXECUTED 3: " ++ show (endExec3 - endExec2) ++ " seconds") +' ===================================== testsuite/tests/rts/linker/reuse.conf → testsuite/tests/rts/linker/T23415/reuse.conf ===================================== ===================================== testsuite/tests/rts/linker/all.T ===================================== @@ -159,18 +159,3 @@ test('T20918', test('T21618', [unless(opsys('mingw32'), skip), req_rts_linker], makefile_test, ['T21618']) - -###################################### -# https://gitlab.haskell.org/ghc/ghc/-/issues/23415 -# When loading a Haskell symbol from a shared object (here `libHS_Reuse-1.0-ghcXXX.so` created from `Reuse.hs`), -# the native object loader in `loadNativeObj_ELF` stores the object code in a list. -# When the function is called again for the same object, the previously stored object code is returned. -test('T23415', - [extra_files(['Reuse.hs', 'Reuse.script', 'reuse.conf', 'ReusePlugin.hs']), - unless(arch('x86_64'), skip), - unless(opsys('linux'), skip), - unless(doing_ghci, skip), - unless(have_dynamic(),skip), - # grep_stderr('Found existing OC for.*libHSreuse-1.*'), - req_rts_linker], - makefile_test, ['T23415']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e7f4491aaae861bb2c64bb8e9ffa8aaf22ef8bff...17319148af7f860ab0c7a813b601767a8611229a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e7f4491aaae861bb2c64bb8e9ffa8aaf22ef8bff...17319148af7f860ab0c7a813b601767a8611229a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Fri Mar 15 23:55:38 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Fri, 15 Mar 2024 19:55:38 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Escape multiple arguments in the settings file Message-ID: <65f4dffa3ef90_27ddd1c97a110709c8@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 220568fe by Fendor at 2024-03-15T19:55:07-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - a8186ca5 by Matthew Pickering at 2024-03-15T19:55:08-04:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - ab9d3bb9 by Matthew Pickering at 2024-03-15T19:55:08-04:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - eb914c7b by Fendor at 2024-03-15T19:55:11-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 15 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Settings/IO.hs - hadrian/bindist/Makefile - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Test.hs - libraries/ghc-boot/GHC/Settings/Utils.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep - utils/ghc-pkg/Main.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3611,7 +3611,8 @@ compilerInfo dflags ("GHC Profiled", showBool hostIsProfiled), ("Debug on", showBool debugIsOn), ("LibDir", topDir dflags), - -- The path of the global package database used by GHC + -- This is always an absolute path, unlike "Relative Global Package DB" which is + -- in the settings file. ("Global Package DB", globalPackageDatabasePath dflags) ] where ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -112,8 +118,14 @@ initSettings top_dir = do ldIsGnuLd <- getBooleanSetting "ld is GNU ld" arSupportsDashL <- getBooleanSetting "ar supports -L" - let globalpkgdb_path = installed "package.conf.d" - ghc_usage_msg_path = installed "ghc-usage.txt" + + -- The package database is either a relative path to the location of the settings file + -- OR an absolute path. + -- In case the path is absolute then top_dir abs_path == abs_path + -- the path is relative then top_dir rel_path == top_dir rel_path + globalpkgdb_path <- installed <$> getSetting "Relative Global Package DB" + + let ghc_usage_msg_path = installed "ghc-usage.txt" ghci_usage_msg_path = installed "ghci-usage.txt" -- For all systems, unlit, split, mangle are GHC utilities @@ -135,12 +147,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +273,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/bindist/Makefile ===================================== @@ -141,6 +141,7 @@ lib/settings : config.mk @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Use LibFFI", "$(UseLibffiForAdjustors)")' >> $@ @echo ',("RTS expects libdw", "$(GhcRtsWithLibdw)")' >> $@ + @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ @echo "]" >> $@ # We need to install binaries relative to libraries. ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -13,8 +13,6 @@ import Hadrian.Oracles.TextFile import Oracles.Setting (topDirectory, setting, Setting(..)) import Packages import Settings.Program (programContext) -import Hadrian.Oracles.Path -import System.Directory (makeAbsolute) testConfigFile :: Action FilePath testConfigFile = buildRoot <&> (-/- "test/ghcconfig") @@ -81,15 +79,12 @@ testRTSSettings = do file <- testConfigFile words <$> lookupValueOrError Nothing file "GhcRTSWays" -absoluteBuildRoot :: Action FilePath -absoluteBuildRoot = (fixAbsolutePathOnWindows =<< liftIO . makeAbsolute =<< buildRoot) - -- | Directory to look for binaries. -- We assume that required programs are present in the same binary directory -- in which ghc is stored and that they have their conventional name. getBinaryDirectory :: String -> Action FilePath getBinaryDirectory "stage0" = takeDirectory <$> setting SystemGhc -getBinaryDirectory "stage1" = liftM2 (-/-) absoluteBuildRoot (pure "stage1-test/bin/") +getBinaryDirectory "stage1" = liftM2 (-/-) topDirectory (stageBinPath stage0InTree) getBinaryDirectory "stage2" = liftM2 (-/-) topDirectory (stageBinPath Stage1) getBinaryDirectory "stage3" = liftM2 (-/-) topDirectory (stageBinPath Stage2) getBinaryDirectory "stage-cabal" = do @@ -101,7 +96,7 @@ getBinaryDirectory compiler = pure $ takeDirectory compiler -- | Get the path to the given @--test-compiler at . getCompilerPath :: String -> Action FilePath getCompilerPath "stage0" = setting SystemGhc -getCompilerPath "stage1" = liftM2 (-/-) absoluteBuildRoot (pure ("stage1-test/bin/ghc" <.> exe)) +getCompilerPath "stage1" = liftM2 (-/-) topDirectory (fullPath stage0InTree ghc) getCompilerPath "stage2" = liftM2 (-/-) topDirectory (fullPath Stage1 ghc) getCompilerPath "stage3" = liftM2 (-/-) topDirectory (fullPath Stage2 ghc) getCompilerPath "stage-cabal" = do ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -234,8 +235,8 @@ generateRules = do forM_ allStages $ \stage -> do let prefix = root -/- stageString stage -/- "lib" - go gen file = generate file (semiEmptyTarget stage) gen - (prefix -/- "settings") %> go generateSettings + go gen file = generate file (semiEmptyTarget (succStage stage)) gen + (prefix -/- "settings") %> \out -> go (generateSettings out) out where file <~+ gen = file %> \out -> generate out emptyTarget gen >> makeExecutable out @@ -355,21 +356,26 @@ templateRules = do ghcWrapper :: Stage -> Expr String ghcWrapper (Stage0 {}) = error "Stage0 GHC does not require a wrapper script to run." ghcWrapper stage = do - dbPath <- expr $ () <$> topDirectory <*> packageDbPath (PackageDbLoc stage Final) ghcPath <- expr $ () <$> topDirectory <*> programPath (vanillaContext (predStage stage) ghc) return $ unwords $ map show $ [ ghcPath ] - ++ (if stage == Stage1 - then ["-no-global-package-db" - , "-package-env=-" - , "-package-db " ++ dbPath - ] - else []) ++ [ "$@" ] -generateSettings :: Expr String -generateSettings = do +generateSettings :: FilePath -> Expr String +generateSettings settingsFile = do ctx <- getContext + stage <- getStage + + package_db_path <- expr $ do + let get_pkg_db stg = packageDbPath (PackageDbLoc stg Final) + case stage of + Stage0 {} -> error "Unable to generate settings for stage0" + Stage1 -> get_pkg_db Stage1 + Stage2 -> get_pkg_db Stage1 + Stage3 -> get_pkg_db Stage2 + + let rel_pkg_db = makeRelativeNoSysLink (dropFileName settingsFile) package_db_path + settings <- traverse sequence $ [ ("C compiler command", queryTarget ccPath) , ("C compiler flags", queryTarget ccFlags) @@ -416,11 +422,12 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("Relative Global Package DB", pure rel_pkg_db) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" pure $ case settings of @@ -431,23 +438,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +578,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Test.hs ===================================== @@ -124,28 +124,6 @@ testRules = do testsuiteDeps - -- we need to create wrappers to test the stage1 compiler - -- as the stage1 compiler needs the stage2 libraries - -- to have any hope of passing tests. - root -/- "stage1-test/bin/*" %> \path -> do - - bin_path <- stageBinPath stage0InTree - let prog = takeBaseName path - stage0prog = bin_path -/- prog <.> exe - need [stage0prog] - abs_prog_path <- liftIO (IO.canonicalizePath stage0prog) - -- Use the stage1 package database - pkgDb <- liftIO . IO.makeAbsolute =<< packageDbPath (PackageDbLoc Stage1 Final) - if prog `elem` ["ghc","runghc"] then do - let flags = [ "-no-global-package-db", "-no-user-package-db", "-hide-package", "ghc" , "-package-env","-","-package-db",pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else if prog == "ghc-pkg" then do - let flags = ["--no-user-package-db", "--global-package-db", pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else createFileLink abs_prog_path path - -- Rules for building check-ppr, check-exact and -- check-ppr-annotations with the compiler we are going to test -- (in-tree or out-of-tree). @@ -344,18 +322,6 @@ needTestsuitePackages stg = do need =<< mapM (uncurry pkgFile) pkgs cross <- flag CrossCompiling when (not cross) $ needIservBins stg - root <- buildRoot - -- require the shims for testing stage1 - when (stg == stage0InTree) $ do - -- Windows not supported as the wrapper scripts don't work on windows.. we could - -- support it with a separate .bat or C wrapper code path but seems overkill when no-one will - -- probably ever try and do this. - when windowsHost $ do - putFailure $ unlines [ "Testing stage1 compiler with windows is currently unsupported," - , "if you desire to do this then please open a ticket"] - fail "Testing stage1 is not supported" - - need =<< sequence [(\f -> root -/- "stage1-test/bin" -/- takeFileName f) <$> (pkgFile stage0InTree p) | (Stage0 InTreeLibs,p) <- exepkgs] -- stage 1 ghc lives under stage0/bin, -- stage 2 ghc lives under stage1/bin, etc ===================================== libraries/ghc-boot/GHC/Settings/Utils.hs ===================================== @@ -8,6 +8,7 @@ import qualified Data.Map as Map import GHC.BaseDir import GHC.Platform.ArchOS +import System.FilePath maybeRead :: Read a => String -> Maybe a maybeRead str = case reads str of @@ -42,6 +43,12 @@ getTargetArchOS settingsFile settings = ArchOS <$> readRawSetting settingsFile settings "target arch" <*> readRawSetting settingsFile settings "target os" +getGlobalPackageDb :: FilePath -> RawSettings -> Either String FilePath +getGlobalPackageDb settingsFile settings = do + rel_db <- getRawSetting settingsFile settings "Relative Global Package DB" + return (dropFileName settingsFile rel_db) + + getRawSetting :: FilePath -> RawSettings -> String -> Either String String ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== ===================================== utils/ghc-pkg/Main.hs ===================================== @@ -28,7 +28,7 @@ import qualified GHC.Unit.Database as GhcPkg import GHC.Unit.Database hiding (mkMungePathUrl) import GHC.HandleEncoding import GHC.BaseDir (getBaseDir) -import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy) +import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy, getGlobalPackageDb, RawSettings) import GHC.Platform.Host (hostPlatformArchOS) import GHC.UniqueSubdir (uniqueSubdir) import qualified GHC.Data.ShortText as ST @@ -582,6 +582,21 @@ allPackagesInStack = concatMap packages stackUpTo :: FilePath -> PackageDBStack -> PackageDBStack stackUpTo to_modify = dropWhile ((/= to_modify) . location) +readFromSettingsFile :: FilePath + -> (FilePath -> RawSettings -> Either String b) + -> IO (Either String b) +readFromSettingsFile settingsFile f = do + settingsStr <- readFile settingsFile + pure $ do + mySettings <- case maybeReadFuzzy settingsStr of + Just s -> pure $ Map.fromList s + -- It's excusable to not have a settings file (for now at + -- least) but completely inexcusable to have a malformed one. + Nothing -> Left $ "Can't parse settings file " ++ show settingsFile + case f settingsFile mySettings of + Right archOS -> Right archOS + Left e -> Left e + getPkgDatabases :: Verbosity -> GhcPkg.DbOpenMode mode DbModifySelector -> Bool -- use the user db @@ -605,24 +620,38 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do -- location is passed to the binary using the --global-package-db flag by the -- wrapper script. let err_msg = "missing --global-package-db option, location of global package database unknown\n" - global_conf <- + (top_dir, global_conf) <- case [ f | FlagGlobalConfig f <- my_flags ] of -- See Note [Base Dir] for more information on the base dir / top dir. [] -> do mb_dir <- getBaseDir case mb_dir of Nothing -> die err_msg Just dir -> do - r <- lookForPackageDBIn dir - case r of - Nothing -> die ("Can't find package database in " ++ dir) - Just path -> return path - fs -> return (last fs) - - -- The value of the $topdir variable used in some package descriptions - -- Note that the way we calculate this is slightly different to how it - -- is done in ghc itself. We rely on the convention that the global - -- package db lives in ghc's libdir. - top_dir <- absolutePath (takeDirectory global_conf) + -- Look for where it is given in the settings file, if marked there. + let settingsFile = dir "settings" + exists_settings_file <- doesFileExist settingsFile + erel_db <- + if exists_settings_file + then readFromSettingsFile settingsFile getGlobalPackageDb + else pure (Left ("Settings file doesn't exist: " ++ settingsFile)) + + case erel_db of + Right rel_db -> return (dir, dir rel_db) + -- If the version of GHC doesn't have this field or the settings file + -- doesn't exist for some reason, look in the libdir. + Left err -> do + r <- lookForPackageDBIn dir + case r of + Nothing -> die (unlines [err, ("Fallback: Can't find package database in " ++ dir)]) + Just path -> return (dir, path) + fs -> do + -- The value of the $topdir variable used in some package descriptions + -- Note that the way we calculate this is slightly different to how it + -- is done in ghc itself. We rely on the convention that the global + -- package db lives in ghc's libdir. + let pkg_db = last fs + top_dir <- absolutePath (takeDirectory pkg_db) + return (top_dir, pkg_db) let no_user_db = FlagNoUserDb `elem` my_flags @@ -641,16 +670,11 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do warn $ "WARNING: settings file doesn't exist " ++ show settingsFile warn "cannot know target platform so guessing target == host (native compiler)." pure hostPlatformArchOS - True -> do - settingsStr <- readFile settingsFile - mySettings <- case maybeReadFuzzy settingsStr of - Just s -> pure $ Map.fromList s - -- It's excusable to not have a settings file (for now at - -- least) but completely inexcusable to have a malformed one. - Nothing -> die $ "Can't parse settings file " ++ show settingsFile - case getTargetArchOS settingsFile mySettings of - Right archOS -> pure archOS + True -> + readFromSettingsFile settingsFile getTargetArchOS >>= \case + Right v -> pure v Left e -> die e + let subdir = uniqueSubdir targetArchOS getFirstSuccess :: [IO a] -> IO (Maybe a) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9848d58006f7361b847e4991d899fdc5a06d75ca...eb914c7bc49307f246cb58770b167a92e0ddccd5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9848d58006f7361b847e4991d899fdc5a06d75ca...eb914c7bc49307f246cb58770b167a92e0ddccd5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 16 13:46:27 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 16 Mar 2024 09:46:27 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Escape multiple arguments in the settings file Message-ID: <65f5a2b388bc9_194f2babac340685eb@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 3875b5f0 by Fendor at 2024-03-16T09:46:01-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - c4e33527 by Matthew Pickering at 2024-03-16T09:46:02-04:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - da69a7a0 by Matthew Pickering at 2024-03-16T09:46:02-04:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 601e560a by Fendor at 2024-03-16T09:46:05-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 15 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Settings/IO.hs - hadrian/bindist/Makefile - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Test.hs - libraries/ghc-boot/GHC/Settings/Utils.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep - utils/ghc-pkg/Main.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3611,7 +3611,8 @@ compilerInfo dflags ("GHC Profiled", showBool hostIsProfiled), ("Debug on", showBool debugIsOn), ("LibDir", topDir dflags), - -- The path of the global package database used by GHC + -- This is always an absolute path, unlike "Relative Global Package DB" which is + -- in the settings file. ("Global Package DB", globalPackageDatabasePath dflags) ] where ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -112,8 +118,14 @@ initSettings top_dir = do ldIsGnuLd <- getBooleanSetting "ld is GNU ld" arSupportsDashL <- getBooleanSetting "ar supports -L" - let globalpkgdb_path = installed "package.conf.d" - ghc_usage_msg_path = installed "ghc-usage.txt" + + -- The package database is either a relative path to the location of the settings file + -- OR an absolute path. + -- In case the path is absolute then top_dir abs_path == abs_path + -- the path is relative then top_dir rel_path == top_dir rel_path + globalpkgdb_path <- installed <$> getSetting "Relative Global Package DB" + + let ghc_usage_msg_path = installed "ghc-usage.txt" ghci_usage_msg_path = installed "ghci-usage.txt" -- For all systems, unlit, split, mangle are GHC utilities @@ -135,12 +147,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +273,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/bindist/Makefile ===================================== @@ -141,6 +141,7 @@ lib/settings : config.mk @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Use LibFFI", "$(UseLibffiForAdjustors)")' >> $@ @echo ',("RTS expects libdw", "$(GhcRtsWithLibdw)")' >> $@ + @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ @echo "]" >> $@ # We need to install binaries relative to libraries. ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -13,8 +13,6 @@ import Hadrian.Oracles.TextFile import Oracles.Setting (topDirectory, setting, Setting(..)) import Packages import Settings.Program (programContext) -import Hadrian.Oracles.Path -import System.Directory (makeAbsolute) testConfigFile :: Action FilePath testConfigFile = buildRoot <&> (-/- "test/ghcconfig") @@ -81,15 +79,12 @@ testRTSSettings = do file <- testConfigFile words <$> lookupValueOrError Nothing file "GhcRTSWays" -absoluteBuildRoot :: Action FilePath -absoluteBuildRoot = (fixAbsolutePathOnWindows =<< liftIO . makeAbsolute =<< buildRoot) - -- | Directory to look for binaries. -- We assume that required programs are present in the same binary directory -- in which ghc is stored and that they have their conventional name. getBinaryDirectory :: String -> Action FilePath getBinaryDirectory "stage0" = takeDirectory <$> setting SystemGhc -getBinaryDirectory "stage1" = liftM2 (-/-) absoluteBuildRoot (pure "stage1-test/bin/") +getBinaryDirectory "stage1" = liftM2 (-/-) topDirectory (stageBinPath stage0InTree) getBinaryDirectory "stage2" = liftM2 (-/-) topDirectory (stageBinPath Stage1) getBinaryDirectory "stage3" = liftM2 (-/-) topDirectory (stageBinPath Stage2) getBinaryDirectory "stage-cabal" = do @@ -101,7 +96,7 @@ getBinaryDirectory compiler = pure $ takeDirectory compiler -- | Get the path to the given @--test-compiler at . getCompilerPath :: String -> Action FilePath getCompilerPath "stage0" = setting SystemGhc -getCompilerPath "stage1" = liftM2 (-/-) absoluteBuildRoot (pure ("stage1-test/bin/ghc" <.> exe)) +getCompilerPath "stage1" = liftM2 (-/-) topDirectory (fullPath stage0InTree ghc) getCompilerPath "stage2" = liftM2 (-/-) topDirectory (fullPath Stage1 ghc) getCompilerPath "stage3" = liftM2 (-/-) topDirectory (fullPath Stage2 ghc) getCompilerPath "stage-cabal" = do ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -234,8 +235,8 @@ generateRules = do forM_ allStages $ \stage -> do let prefix = root -/- stageString stage -/- "lib" - go gen file = generate file (semiEmptyTarget stage) gen - (prefix -/- "settings") %> go generateSettings + go gen file = generate file (semiEmptyTarget (succStage stage)) gen + (prefix -/- "settings") %> \out -> go (generateSettings out) out where file <~+ gen = file %> \out -> generate out emptyTarget gen >> makeExecutable out @@ -355,21 +356,26 @@ templateRules = do ghcWrapper :: Stage -> Expr String ghcWrapper (Stage0 {}) = error "Stage0 GHC does not require a wrapper script to run." ghcWrapper stage = do - dbPath <- expr $ () <$> topDirectory <*> packageDbPath (PackageDbLoc stage Final) ghcPath <- expr $ () <$> topDirectory <*> programPath (vanillaContext (predStage stage) ghc) return $ unwords $ map show $ [ ghcPath ] - ++ (if stage == Stage1 - then ["-no-global-package-db" - , "-package-env=-" - , "-package-db " ++ dbPath - ] - else []) ++ [ "$@" ] -generateSettings :: Expr String -generateSettings = do +generateSettings :: FilePath -> Expr String +generateSettings settingsFile = do ctx <- getContext + stage <- getStage + + package_db_path <- expr $ do + let get_pkg_db stg = packageDbPath (PackageDbLoc stg Final) + case stage of + Stage0 {} -> error "Unable to generate settings for stage0" + Stage1 -> get_pkg_db Stage1 + Stage2 -> get_pkg_db Stage1 + Stage3 -> get_pkg_db Stage2 + + let rel_pkg_db = makeRelativeNoSysLink (dropFileName settingsFile) package_db_path + settings <- traverse sequence $ [ ("C compiler command", queryTarget ccPath) , ("C compiler flags", queryTarget ccFlags) @@ -416,11 +422,12 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("Relative Global Package DB", pure rel_pkg_db) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" pure $ case settings of @@ -431,23 +438,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +578,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Test.hs ===================================== @@ -124,28 +124,6 @@ testRules = do testsuiteDeps - -- we need to create wrappers to test the stage1 compiler - -- as the stage1 compiler needs the stage2 libraries - -- to have any hope of passing tests. - root -/- "stage1-test/bin/*" %> \path -> do - - bin_path <- stageBinPath stage0InTree - let prog = takeBaseName path - stage0prog = bin_path -/- prog <.> exe - need [stage0prog] - abs_prog_path <- liftIO (IO.canonicalizePath stage0prog) - -- Use the stage1 package database - pkgDb <- liftIO . IO.makeAbsolute =<< packageDbPath (PackageDbLoc Stage1 Final) - if prog `elem` ["ghc","runghc"] then do - let flags = [ "-no-global-package-db", "-no-user-package-db", "-hide-package", "ghc" , "-package-env","-","-package-db",pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else if prog == "ghc-pkg" then do - let flags = ["--no-user-package-db", "--global-package-db", pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else createFileLink abs_prog_path path - -- Rules for building check-ppr, check-exact and -- check-ppr-annotations with the compiler we are going to test -- (in-tree or out-of-tree). @@ -344,18 +322,6 @@ needTestsuitePackages stg = do need =<< mapM (uncurry pkgFile) pkgs cross <- flag CrossCompiling when (not cross) $ needIservBins stg - root <- buildRoot - -- require the shims for testing stage1 - when (stg == stage0InTree) $ do - -- Windows not supported as the wrapper scripts don't work on windows.. we could - -- support it with a separate .bat or C wrapper code path but seems overkill when no-one will - -- probably ever try and do this. - when windowsHost $ do - putFailure $ unlines [ "Testing stage1 compiler with windows is currently unsupported," - , "if you desire to do this then please open a ticket"] - fail "Testing stage1 is not supported" - - need =<< sequence [(\f -> root -/- "stage1-test/bin" -/- takeFileName f) <$> (pkgFile stage0InTree p) | (Stage0 InTreeLibs,p) <- exepkgs] -- stage 1 ghc lives under stage0/bin, -- stage 2 ghc lives under stage1/bin, etc ===================================== libraries/ghc-boot/GHC/Settings/Utils.hs ===================================== @@ -8,6 +8,7 @@ import qualified Data.Map as Map import GHC.BaseDir import GHC.Platform.ArchOS +import System.FilePath maybeRead :: Read a => String -> Maybe a maybeRead str = case reads str of @@ -42,6 +43,12 @@ getTargetArchOS settingsFile settings = ArchOS <$> readRawSetting settingsFile settings "target arch" <*> readRawSetting settingsFile settings "target os" +getGlobalPackageDb :: FilePath -> RawSettings -> Either String FilePath +getGlobalPackageDb settingsFile settings = do + rel_db <- getRawSetting settingsFile settings "Relative Global Package DB" + return (dropFileName settingsFile rel_db) + + getRawSetting :: FilePath -> RawSettings -> String -> Either String String ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== ===================================== utils/ghc-pkg/Main.hs ===================================== @@ -28,7 +28,7 @@ import qualified GHC.Unit.Database as GhcPkg import GHC.Unit.Database hiding (mkMungePathUrl) import GHC.HandleEncoding import GHC.BaseDir (getBaseDir) -import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy) +import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy, getGlobalPackageDb, RawSettings) import GHC.Platform.Host (hostPlatformArchOS) import GHC.UniqueSubdir (uniqueSubdir) import qualified GHC.Data.ShortText as ST @@ -582,6 +582,21 @@ allPackagesInStack = concatMap packages stackUpTo :: FilePath -> PackageDBStack -> PackageDBStack stackUpTo to_modify = dropWhile ((/= to_modify) . location) +readFromSettingsFile :: FilePath + -> (FilePath -> RawSettings -> Either String b) + -> IO (Either String b) +readFromSettingsFile settingsFile f = do + settingsStr <- readFile settingsFile + pure $ do + mySettings <- case maybeReadFuzzy settingsStr of + Just s -> pure $ Map.fromList s + -- It's excusable to not have a settings file (for now at + -- least) but completely inexcusable to have a malformed one. + Nothing -> Left $ "Can't parse settings file " ++ show settingsFile + case f settingsFile mySettings of + Right archOS -> Right archOS + Left e -> Left e + getPkgDatabases :: Verbosity -> GhcPkg.DbOpenMode mode DbModifySelector -> Bool -- use the user db @@ -605,24 +620,38 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do -- location is passed to the binary using the --global-package-db flag by the -- wrapper script. let err_msg = "missing --global-package-db option, location of global package database unknown\n" - global_conf <- + (top_dir, global_conf) <- case [ f | FlagGlobalConfig f <- my_flags ] of -- See Note [Base Dir] for more information on the base dir / top dir. [] -> do mb_dir <- getBaseDir case mb_dir of Nothing -> die err_msg Just dir -> do - r <- lookForPackageDBIn dir - case r of - Nothing -> die ("Can't find package database in " ++ dir) - Just path -> return path - fs -> return (last fs) - - -- The value of the $topdir variable used in some package descriptions - -- Note that the way we calculate this is slightly different to how it - -- is done in ghc itself. We rely on the convention that the global - -- package db lives in ghc's libdir. - top_dir <- absolutePath (takeDirectory global_conf) + -- Look for where it is given in the settings file, if marked there. + let settingsFile = dir "settings" + exists_settings_file <- doesFileExist settingsFile + erel_db <- + if exists_settings_file + then readFromSettingsFile settingsFile getGlobalPackageDb + else pure (Left ("Settings file doesn't exist: " ++ settingsFile)) + + case erel_db of + Right rel_db -> return (dir, dir rel_db) + -- If the version of GHC doesn't have this field or the settings file + -- doesn't exist for some reason, look in the libdir. + Left err -> do + r <- lookForPackageDBIn dir + case r of + Nothing -> die (unlines [err, ("Fallback: Can't find package database in " ++ dir)]) + Just path -> return (dir, path) + fs -> do + -- The value of the $topdir variable used in some package descriptions + -- Note that the way we calculate this is slightly different to how it + -- is done in ghc itself. We rely on the convention that the global + -- package db lives in ghc's libdir. + let pkg_db = last fs + top_dir <- absolutePath (takeDirectory pkg_db) + return (top_dir, pkg_db) let no_user_db = FlagNoUserDb `elem` my_flags @@ -641,16 +670,11 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do warn $ "WARNING: settings file doesn't exist " ++ show settingsFile warn "cannot know target platform so guessing target == host (native compiler)." pure hostPlatformArchOS - True -> do - settingsStr <- readFile settingsFile - mySettings <- case maybeReadFuzzy settingsStr of - Just s -> pure $ Map.fromList s - -- It's excusable to not have a settings file (for now at - -- least) but completely inexcusable to have a malformed one. - Nothing -> die $ "Can't parse settings file " ++ show settingsFile - case getTargetArchOS settingsFile mySettings of - Right archOS -> pure archOS + True -> + readFromSettingsFile settingsFile getTargetArchOS >>= \case + Right v -> pure v Left e -> die e + let subdir = uniqueSubdir targetArchOS getFirstSuccess :: [IO a] -> IO (Maybe a) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eb914c7bc49307f246cb58770b167a92e0ddccd5...601e560a187b2902ab43a2a6db424caf423cd31a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eb914c7bc49307f246cb58770b167a92e0ddccd5...601e560a187b2902ab43a2a6db424caf423cd31a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sat Mar 16 14:28:23 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Sat, 16 Mar 2024 10:28:23 -0400 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] Implement switch (case) jump tables Message-ID: <65f5ac87c0c36_194f2bc39fc0475013@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: 9be2b121 by Sven Tennie at 2024-03-16T15:26:36+01:00 Implement switch (case) jump tables - - - - - 3 changed files: - compiler/GHC/CmmToAsm/RV64/CodeGen.hs - compiler/GHC/CmmToAsm/RV64/Instr.hs - compiler/GHC/CmmToAsm/RV64/Ppr.hs Changes: ===================================== compiler/GHC/CmmToAsm/RV64/CodeGen.hs ===================================== @@ -23,10 +23,16 @@ import GHC.CmmToAsm.RV64.Cond import GHC.CmmToAsm.CPrim import GHC.Cmm.DebugBlock import GHC.CmmToAsm.Monad - ( NatM, getNewRegNat - , getPicBaseMaybeNat, getPlatform, getConfig - , getDebugBlock, getFileId - ) + ( NatM, + getConfig, + getDebugBlock, + getFileId, + getNewLabelNat, + getNewRegNat, + getPicBaseMaybeNat, + getPlatform, + ) + -- import GHC.CmmToAsm.Instr import GHC.CmmToAsm.PIC import GHC.CmmToAsm.Format @@ -208,42 +214,66 @@ annExpr e {- debugIsOn -} = ANN (text . show $ e) -- ----------------------------------------------------------------------------- -- Generating a table-branch --- TODO jump tables would be a lot faster, but we'll use bare bones for now. --- this is usually done by sticking the jump table ids into an instruction --- and then have the @generateJumpTableForInstr@ callback produce the jump --- table as a static. --- --- See Ticket 19912 --- --- data SwitchTargets = --- SwitchTargets --- Bool -- Signed values --- (Integer, Integer) -- Range --- (Maybe Label) -- Default value --- (M.Map Integer Label) -- The branches +-- | Generate jump to jump table target -- --- Non Jumptable plan: --- xE <- expr +-- The index into the jump table is calulated by evaluating @expr at . The +-- corresponding table entry contains the address to jump to. +genSwitch :: NCGConfig -> CmmExpr -> SwitchTargets -> NatM InstrBlock +genSwitch config expr targets = do + (reg, fmt1, e_code) <- getSomeReg indexExpr + let fmt = II64 + tmp <- getNewRegNat fmt + lbl <- getNewLabelNat + dynRef <- cmmMakeDynamicReference config DataReference lbl + (tableReg, fmt2, t_code) <- getSomeReg $ dynRef + let code = + toOL [ COMMENT (text "indexExpr" <+> (text . show) indexExpr) + , COMMENT (text "dynRef" <+> (text . show) dynRef) + ] + `appOL` e_code + `appOL` t_code + `appOL` toOL + [ + COMMENT (ftext "Jump table for switch") + , annExpr expr (LSL (OpReg (formatToWidth fmt1) reg) (OpReg (formatToWidth fmt1) reg) (OpImm (ImmInt 3))) + , ADD (OpReg W64 tmp) (OpReg (formatToWidth fmt1) reg) (OpReg (formatToWidth fmt2) tableReg) + , LDRU II64 (OpReg W64 tmp) (OpAddr (AddrRegImm tmp (ImmInt 0))) + , J_TBL ids (Just lbl) tmp + ] + return code + where + -- See Note [Sub-word subtlety during jump-table indexing] in + -- GHC.CmmToAsm.X86.CodeGen for why we must first offset, then widen. + indexExpr0 = cmmOffset platform expr offset + -- We widen to a native-width register to sanitize the high bits + indexExpr = + CmmMachOp + (MO_UU_Conv expr_w (platformWordWidth platform)) + [indexExpr0] + expr_w = cmmExprWidth platform expr + (offset, ids) = switchTargetsToTable targets + platform = ncgPlatform config + +-- | Generate jump table data (if required) -- -genSwitch :: CmmExpr -> SwitchTargets -> NatM InstrBlock -genSwitch expr targets = do -- pprPanic "genSwitch" (ppr expr) - (reg, format, code) <- getSomeReg expr - let w = formatToWidth format - let mkbranch acc (key, bid) = do - (keyReg, _format, code) <- getSomeReg (CmmLit (CmmInt key w)) - return $ code `appOL` - toOL [ BCOND EQ (OpReg w reg) (OpReg w keyReg) (TBlock bid) - ] `appOL` acc - def_code = case switchTargetsDefault targets of - Just bid -> unitOL (B (TBlock bid)) - Nothing -> nilOL - - switch_code <- foldM mkbranch nilOL (switchTargetsCases targets) - return $ code `appOL` switch_code `appOL` def_code - --- We don't do jump tables for now, see Ticket 19912 -generateJumpTableForInstr :: NCGConfig -> Instr - -> Maybe (NatCmmDecl RawCmmStatics Instr) +-- Relies on PIC relocations. The idea is to emit one table entry per case. The +-- entry is the label of the block to jump to. This will be relocated to be the +-- address of the jump target. +generateJumpTableForInstr :: + NCGConfig -> + Instr -> + Maybe (NatCmmDecl RawCmmStatics Instr) +generateJumpTableForInstr config (J_TBL ids (Just lbl) _) = + let jumpTable = + map jumpTableEntryRel ids + where + jumpTableEntryRel Nothing = + CmmStaticLit (CmmInt 0 (ncgWordWidth config)) + jumpTableEntryRel (Just blockid) = + CmmStaticLit (CmmLabel blockLabel) + where + blockLabel = blockLbl blockid + in Just (CmmData (Section ReadOnlyData lbl) (CmmStaticsRaw lbl jumpTable)) generateJumpTableForInstr _ _ = Nothing -- ----------------------------------------------------------------------------- @@ -275,6 +305,7 @@ stmtToInstrs :: BlockId -- ^ Basic block this statement will start to be placed stmtToInstrs bid stmt = do -- traceM $ "-- -------------------------- stmtToInstrs -------------------------- --\n" -- ++ showSDocUnsafe (ppr stmt) + config <- getConfig platform <- getPlatform case stmt of CmmUnsafeForeignCall target result_regs args @@ -303,7 +334,7 @@ stmtToInstrs bid stmt = do CmmCondBranch arg true false _prediction -> genCondBranch bid true false arg - CmmSwitch arg ids -> genSwitch arg ids + CmmSwitch arg ids -> genSwitch config arg ids CmmCall { cml_target = arg } -> genJump arg ===================================== compiler/GHC/CmmToAsm/RV64/Instr.hs ===================================== @@ -117,6 +117,7 @@ regUsageOfInstr platform instr = case instr of XORI dst src1 _ -> usage (regOp src1, regOp dst) -- 4. Branch Instructions ---------------------------------------------------- J t -> usage (regTarget t, []) + J_TBL _ _ t -> usage ([t], []) B t -> usage (regTarget t, []) B_FAR _t -> usage ([], []) BCOND _ l r t -> usage (regTarget t ++ regOp l ++ regOp r, []) @@ -248,6 +249,7 @@ patchRegsOfInstr instr env = case instr of -- 4. Branch Instructions -------------------------------------------------- J t -> J (patchTarget t) + J_TBL ids mbLbl t -> J_TBL ids mbLbl (env t) B t -> B (patchTarget t) B_FAR t -> B_FAR t BL t rs ts -> BL (patchTarget t) rs ts @@ -296,6 +298,7 @@ isJumpishInstr :: Instr -> Bool isJumpishInstr instr = case instr of ANN _ i -> isJumpishInstr i J {} -> True + J_TBL {} -> True B {} -> True B_FAR {} -> True BL {} -> True @@ -307,6 +310,7 @@ isJumpishInstr instr = case instr of jumpDestsOfInstr :: Instr -> [BlockId] jumpDestsOfInstr (ANN _ i) = jumpDestsOfInstr i jumpDestsOfInstr (J t) = [id | TBlock id <- [t]] +jumpDestsOfInstr (J_TBL ids _mbLbl _r) = [id | Just id <- ids] jumpDestsOfInstr (B t) = [id | TBlock id <- [t]] jumpDestsOfInstr (B_FAR t) = [t] jumpDestsOfInstr (BL t _ _) = [id | TBlock id <- [t]] @@ -323,6 +327,7 @@ patchJumpInstr instr patchF = case instr of ANN d i -> ANN d (patchJumpInstr i patchF) J (TBlock bid) -> J (TBlock (patchF bid)) + J_TBL ids mbLbl r -> J_TBL (map (fmap patchF) ids) mbLbl r B (TBlock bid) -> B (TBlock (patchF bid)) B_FAR bid -> B_FAR (patchF bid) BL (TBlock bid) ps rs -> BL (TBlock (patchF bid)) ps rs @@ -510,7 +515,8 @@ allocMoreStack platform slots proc@(CmmProc info lbl live (ListGraph code)) = do insert_dealloc insn r = case insn of J _ -> dealloc ++ (insn : r) - ANN _ (J _) -> dealloc ++ (insn : r) + J_TBL {} -> dealloc ++ (insn : r) + ANN _ e -> insert_dealloc e r _other | jumpDestsOfInstr insn /= [] -> patchJumpInstr insn retarget : r _other -> insn : r @@ -659,6 +665,8 @@ data Instr -- Branching. -- TODO: Unused | J Target -- like B, but only generated from genJump. Used to distinguish genJumps from others. + -- | A `J` instruction with data for switch jump tables + | J_TBL [Maybe BlockId] (Maybe CLabel) Reg | B Target -- unconditional branching b/br. (To a blockid, label or register) -- | pseudo-op for far branch targets | B_FAR BlockId @@ -721,6 +729,7 @@ instrCon i = LDRU{} -> "LDRU" CSET{} -> "CSET" J{} -> "J" + J_TBL{} -> "J_TBL" B{} -> "B" B_FAR{} -> "B_FAR" BL{} -> "BL" ===================================== compiler/GHC/CmmToAsm/RV64/Ppr.hs ===================================== @@ -531,6 +531,7 @@ pprInstr platform instr = case instr of -- 4. Branch Instructions ---------------------------------------------------- J t -> pprInstr platform (B t) + J_TBL _ _ r -> pprInstr platform (J (TReg r)) -- TODO: This is odd: (B)ranch and branch and link (BL) do the same: branch and link B l | isLabel l -> line $ text "\tjal" <+> pprOp platform x0 <> comma <+> getLabel platform l B (TReg r) -> line $ text "\tjalr" <+> text "x0" <> comma <+> pprReg W64 r <> comma <+> text "0" View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9be2b1217a7ba6ca5da5ed157abf4959747bdb95 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9be2b1217a7ba6ca5da5ed157abf4959747bdb95 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 17 03:27:18 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sat, 16 Mar 2024 23:27:18 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Escape multiple arguments in the settings file Message-ID: <65f66316b9055_3a248fb5ccb681566d@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: c8c0732b by Fendor at 2024-03-16T23:27:02-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - effeb877 by Matthew Pickering at 2024-03-16T23:27:03-04:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - fdcdb69f by Matthew Pickering at 2024-03-16T23:27:03-04:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 182a0997 by Fendor at 2024-03-16T23:27:05-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 15 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Settings/IO.hs - hadrian/bindist/Makefile - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Test.hs - libraries/ghc-boot/GHC/Settings/Utils.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep - utils/ghc-pkg/Main.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3611,7 +3611,8 @@ compilerInfo dflags ("GHC Profiled", showBool hostIsProfiled), ("Debug on", showBool debugIsOn), ("LibDir", topDir dflags), - -- The path of the global package database used by GHC + -- This is always an absolute path, unlike "Relative Global Package DB" which is + -- in the settings file. ("Global Package DB", globalPackageDatabasePath dflags) ] where ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -112,8 +118,14 @@ initSettings top_dir = do ldIsGnuLd <- getBooleanSetting "ld is GNU ld" arSupportsDashL <- getBooleanSetting "ar supports -L" - let globalpkgdb_path = installed "package.conf.d" - ghc_usage_msg_path = installed "ghc-usage.txt" + + -- The package database is either a relative path to the location of the settings file + -- OR an absolute path. + -- In case the path is absolute then top_dir abs_path == abs_path + -- the path is relative then top_dir rel_path == top_dir rel_path + globalpkgdb_path <- installed <$> getSetting "Relative Global Package DB" + + let ghc_usage_msg_path = installed "ghc-usage.txt" ghci_usage_msg_path = installed "ghci-usage.txt" -- For all systems, unlit, split, mangle are GHC utilities @@ -135,12 +147,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +273,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/bindist/Makefile ===================================== @@ -141,6 +141,7 @@ lib/settings : config.mk @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Use LibFFI", "$(UseLibffiForAdjustors)")' >> $@ @echo ',("RTS expects libdw", "$(GhcRtsWithLibdw)")' >> $@ + @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ @echo "]" >> $@ # We need to install binaries relative to libraries. ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -13,8 +13,6 @@ import Hadrian.Oracles.TextFile import Oracles.Setting (topDirectory, setting, Setting(..)) import Packages import Settings.Program (programContext) -import Hadrian.Oracles.Path -import System.Directory (makeAbsolute) testConfigFile :: Action FilePath testConfigFile = buildRoot <&> (-/- "test/ghcconfig") @@ -81,15 +79,12 @@ testRTSSettings = do file <- testConfigFile words <$> lookupValueOrError Nothing file "GhcRTSWays" -absoluteBuildRoot :: Action FilePath -absoluteBuildRoot = (fixAbsolutePathOnWindows =<< liftIO . makeAbsolute =<< buildRoot) - -- | Directory to look for binaries. -- We assume that required programs are present in the same binary directory -- in which ghc is stored and that they have their conventional name. getBinaryDirectory :: String -> Action FilePath getBinaryDirectory "stage0" = takeDirectory <$> setting SystemGhc -getBinaryDirectory "stage1" = liftM2 (-/-) absoluteBuildRoot (pure "stage1-test/bin/") +getBinaryDirectory "stage1" = liftM2 (-/-) topDirectory (stageBinPath stage0InTree) getBinaryDirectory "stage2" = liftM2 (-/-) topDirectory (stageBinPath Stage1) getBinaryDirectory "stage3" = liftM2 (-/-) topDirectory (stageBinPath Stage2) getBinaryDirectory "stage-cabal" = do @@ -101,7 +96,7 @@ getBinaryDirectory compiler = pure $ takeDirectory compiler -- | Get the path to the given @--test-compiler at . getCompilerPath :: String -> Action FilePath getCompilerPath "stage0" = setting SystemGhc -getCompilerPath "stage1" = liftM2 (-/-) absoluteBuildRoot (pure ("stage1-test/bin/ghc" <.> exe)) +getCompilerPath "stage1" = liftM2 (-/-) topDirectory (fullPath stage0InTree ghc) getCompilerPath "stage2" = liftM2 (-/-) topDirectory (fullPath Stage1 ghc) getCompilerPath "stage3" = liftM2 (-/-) topDirectory (fullPath Stage2 ghc) getCompilerPath "stage-cabal" = do ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -234,8 +235,8 @@ generateRules = do forM_ allStages $ \stage -> do let prefix = root -/- stageString stage -/- "lib" - go gen file = generate file (semiEmptyTarget stage) gen - (prefix -/- "settings") %> go generateSettings + go gen file = generate file (semiEmptyTarget (succStage stage)) gen + (prefix -/- "settings") %> \out -> go (generateSettings out) out where file <~+ gen = file %> \out -> generate out emptyTarget gen >> makeExecutable out @@ -355,21 +356,26 @@ templateRules = do ghcWrapper :: Stage -> Expr String ghcWrapper (Stage0 {}) = error "Stage0 GHC does not require a wrapper script to run." ghcWrapper stage = do - dbPath <- expr $ () <$> topDirectory <*> packageDbPath (PackageDbLoc stage Final) ghcPath <- expr $ () <$> topDirectory <*> programPath (vanillaContext (predStage stage) ghc) return $ unwords $ map show $ [ ghcPath ] - ++ (if stage == Stage1 - then ["-no-global-package-db" - , "-package-env=-" - , "-package-db " ++ dbPath - ] - else []) ++ [ "$@" ] -generateSettings :: Expr String -generateSettings = do +generateSettings :: FilePath -> Expr String +generateSettings settingsFile = do ctx <- getContext + stage <- getStage + + package_db_path <- expr $ do + let get_pkg_db stg = packageDbPath (PackageDbLoc stg Final) + case stage of + Stage0 {} -> error "Unable to generate settings for stage0" + Stage1 -> get_pkg_db Stage1 + Stage2 -> get_pkg_db Stage1 + Stage3 -> get_pkg_db Stage2 + + let rel_pkg_db = makeRelativeNoSysLink (dropFileName settingsFile) package_db_path + settings <- traverse sequence $ [ ("C compiler command", queryTarget ccPath) , ("C compiler flags", queryTarget ccFlags) @@ -416,11 +422,12 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("Relative Global Package DB", pure rel_pkg_db) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" pure $ case settings of @@ -431,23 +438,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +578,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Test.hs ===================================== @@ -124,28 +124,6 @@ testRules = do testsuiteDeps - -- we need to create wrappers to test the stage1 compiler - -- as the stage1 compiler needs the stage2 libraries - -- to have any hope of passing tests. - root -/- "stage1-test/bin/*" %> \path -> do - - bin_path <- stageBinPath stage0InTree - let prog = takeBaseName path - stage0prog = bin_path -/- prog <.> exe - need [stage0prog] - abs_prog_path <- liftIO (IO.canonicalizePath stage0prog) - -- Use the stage1 package database - pkgDb <- liftIO . IO.makeAbsolute =<< packageDbPath (PackageDbLoc Stage1 Final) - if prog `elem` ["ghc","runghc"] then do - let flags = [ "-no-global-package-db", "-no-user-package-db", "-hide-package", "ghc" , "-package-env","-","-package-db",pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else if prog == "ghc-pkg" then do - let flags = ["--no-user-package-db", "--global-package-db", pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else createFileLink abs_prog_path path - -- Rules for building check-ppr, check-exact and -- check-ppr-annotations with the compiler we are going to test -- (in-tree or out-of-tree). @@ -344,18 +322,6 @@ needTestsuitePackages stg = do need =<< mapM (uncurry pkgFile) pkgs cross <- flag CrossCompiling when (not cross) $ needIservBins stg - root <- buildRoot - -- require the shims for testing stage1 - when (stg == stage0InTree) $ do - -- Windows not supported as the wrapper scripts don't work on windows.. we could - -- support it with a separate .bat or C wrapper code path but seems overkill when no-one will - -- probably ever try and do this. - when windowsHost $ do - putFailure $ unlines [ "Testing stage1 compiler with windows is currently unsupported," - , "if you desire to do this then please open a ticket"] - fail "Testing stage1 is not supported" - - need =<< sequence [(\f -> root -/- "stage1-test/bin" -/- takeFileName f) <$> (pkgFile stage0InTree p) | (Stage0 InTreeLibs,p) <- exepkgs] -- stage 1 ghc lives under stage0/bin, -- stage 2 ghc lives under stage1/bin, etc ===================================== libraries/ghc-boot/GHC/Settings/Utils.hs ===================================== @@ -8,6 +8,7 @@ import qualified Data.Map as Map import GHC.BaseDir import GHC.Platform.ArchOS +import System.FilePath maybeRead :: Read a => String -> Maybe a maybeRead str = case reads str of @@ -42,6 +43,12 @@ getTargetArchOS settingsFile settings = ArchOS <$> readRawSetting settingsFile settings "target arch" <*> readRawSetting settingsFile settings "target os" +getGlobalPackageDb :: FilePath -> RawSettings -> Either String FilePath +getGlobalPackageDb settingsFile settings = do + rel_db <- getRawSetting settingsFile settings "Relative Global Package DB" + return (dropFileName settingsFile rel_db) + + getRawSetting :: FilePath -> RawSettings -> String -> Either String String ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== ===================================== utils/ghc-pkg/Main.hs ===================================== @@ -28,7 +28,7 @@ import qualified GHC.Unit.Database as GhcPkg import GHC.Unit.Database hiding (mkMungePathUrl) import GHC.HandleEncoding import GHC.BaseDir (getBaseDir) -import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy) +import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy, getGlobalPackageDb, RawSettings) import GHC.Platform.Host (hostPlatformArchOS) import GHC.UniqueSubdir (uniqueSubdir) import qualified GHC.Data.ShortText as ST @@ -582,6 +582,21 @@ allPackagesInStack = concatMap packages stackUpTo :: FilePath -> PackageDBStack -> PackageDBStack stackUpTo to_modify = dropWhile ((/= to_modify) . location) +readFromSettingsFile :: FilePath + -> (FilePath -> RawSettings -> Either String b) + -> IO (Either String b) +readFromSettingsFile settingsFile f = do + settingsStr <- readFile settingsFile + pure $ do + mySettings <- case maybeReadFuzzy settingsStr of + Just s -> pure $ Map.fromList s + -- It's excusable to not have a settings file (for now at + -- least) but completely inexcusable to have a malformed one. + Nothing -> Left $ "Can't parse settings file " ++ show settingsFile + case f settingsFile mySettings of + Right archOS -> Right archOS + Left e -> Left e + getPkgDatabases :: Verbosity -> GhcPkg.DbOpenMode mode DbModifySelector -> Bool -- use the user db @@ -605,24 +620,38 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do -- location is passed to the binary using the --global-package-db flag by the -- wrapper script. let err_msg = "missing --global-package-db option, location of global package database unknown\n" - global_conf <- + (top_dir, global_conf) <- case [ f | FlagGlobalConfig f <- my_flags ] of -- See Note [Base Dir] for more information on the base dir / top dir. [] -> do mb_dir <- getBaseDir case mb_dir of Nothing -> die err_msg Just dir -> do - r <- lookForPackageDBIn dir - case r of - Nothing -> die ("Can't find package database in " ++ dir) - Just path -> return path - fs -> return (last fs) - - -- The value of the $topdir variable used in some package descriptions - -- Note that the way we calculate this is slightly different to how it - -- is done in ghc itself. We rely on the convention that the global - -- package db lives in ghc's libdir. - top_dir <- absolutePath (takeDirectory global_conf) + -- Look for where it is given in the settings file, if marked there. + let settingsFile = dir "settings" + exists_settings_file <- doesFileExist settingsFile + erel_db <- + if exists_settings_file + then readFromSettingsFile settingsFile getGlobalPackageDb + else pure (Left ("Settings file doesn't exist: " ++ settingsFile)) + + case erel_db of + Right rel_db -> return (dir, dir rel_db) + -- If the version of GHC doesn't have this field or the settings file + -- doesn't exist for some reason, look in the libdir. + Left err -> do + r <- lookForPackageDBIn dir + case r of + Nothing -> die (unlines [err, ("Fallback: Can't find package database in " ++ dir)]) + Just path -> return (dir, path) + fs -> do + -- The value of the $topdir variable used in some package descriptions + -- Note that the way we calculate this is slightly different to how it + -- is done in ghc itself. We rely on the convention that the global + -- package db lives in ghc's libdir. + let pkg_db = last fs + top_dir <- absolutePath (takeDirectory pkg_db) + return (top_dir, pkg_db) let no_user_db = FlagNoUserDb `elem` my_flags @@ -641,16 +670,11 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do warn $ "WARNING: settings file doesn't exist " ++ show settingsFile warn "cannot know target platform so guessing target == host (native compiler)." pure hostPlatformArchOS - True -> do - settingsStr <- readFile settingsFile - mySettings <- case maybeReadFuzzy settingsStr of - Just s -> pure $ Map.fromList s - -- It's excusable to not have a settings file (for now at - -- least) but completely inexcusable to have a malformed one. - Nothing -> die $ "Can't parse settings file " ++ show settingsFile - case getTargetArchOS settingsFile mySettings of - Right archOS -> pure archOS + True -> + readFromSettingsFile settingsFile getTargetArchOS >>= \case + Right v -> pure v Left e -> die e + let subdir = uniqueSubdir targetArchOS getFirstSuccess :: [IO a] -> IO (Maybe a) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/601e560a187b2902ab43a2a6db424caf423cd31a...182a09975b1d834b0aeead3c277d72e34d2fb1e5 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/601e560a187b2902ab43a2a6db424caf423cd31a...182a09975b1d834b0aeead3c277d72e34d2fb1e5 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 17 11:19:45 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Sun, 17 Mar 2024 07:19:45 -0400 Subject: [Git][ghc/ghc][wip/global-package-db] 75 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65f6d1d1e0492_79c4c1f3d1e885223@gitlab.mail> Matthew Pickering pushed to branch wip/global-package-db at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 382ac566 by Matthew Pickering at 2024-03-17T11:19:39+00:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - bc8d1842 by Matthew Pickering at 2024-03-17T11:19:39+00:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Settings/IO.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8e3cb48ce42cfd6ea83528ae70df486e011bb017...bc8d184209e1e9767a7229d7f5ad048f5a4f22ab -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8e3cb48ce42cfd6ea83528ae70df486e011bb017...bc8d184209e1e9767a7229d7f5ad048f5a4f22ab You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 17 15:26:15 2024 From: gitlab at gitlab.haskell.org (Alan Zimmerman (@alanz)) Date: Sun, 17 Mar 2024 11:26:15 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/az/T24533-missing-comments-2 Message-ID: <65f70b97d3f27_79c4c872358c90057@gitlab.mail> Alan Zimmerman pushed new branch wip/az/T24533-missing-comments-2 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/az/T24533-missing-comments-2 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 17 15:58:19 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Sun, 17 Mar 2024 11:58:19 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Escape multiple arguments in the settings file Message-ID: <65f7131b6ba89_79c4c95faa881110e0@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: d7ed2c1a by Fendor at 2024-03-17T11:58:00-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - 47d2eaf6 by Fendor at 2024-03-17T11:58:03-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 9 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Settings/IO.hs - hadrian/src/Rules/Generate.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -135,12 +141,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +267,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -416,7 +417,7 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) @@ -431,23 +432,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +572,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/182a09975b1d834b0aeead3c277d72e34d2fb1e5...47d2eaf6eef0600fb9132e2a22ccac5ff1e514e1 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/182a09975b1d834b0aeead3c277d72e34d2fb1e5...47d2eaf6eef0600fb9132e2a22ccac5ff1e514e1 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Sun Mar 17 20:18:59 2024 From: gitlab at gitlab.haskell.org (Alan Zimmerman (@alanz)) Date: Sun, 17 Mar 2024 16:18:59 -0400 Subject: [Git][ghc/ghc][wip/az/T24533-missing-comments-2] EPA: Address more 9.10.1-alpha1 regressions from recent changes Message-ID: <65f7503395f97_26f06c1becea8912c8@gitlab.mail> Alan Zimmerman pushed to branch wip/az/T24533-missing-comments-2 at Glasgow Haskell Compiler / GHC Commits: 77aeba3c by Alan Zimmerman at 2024-03-17T20:02:20+00:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 5 changed files: - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/77aeba3c35a0f741a9f06a96888a2197fd04e07e -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/77aeba3c35a0f741a9f06a96888a2197fd04e07e You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 04:29:10 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 18 Mar 2024 00:29:10 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Escape multiple arguments in the settings file Message-ID: <65f7c316bf55e_26f06cf4aa0b0119567@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: d93c241f by Fendor at 2024-03-18T00:28:58-04:00 Escape multiple arguments in the settings file Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up our flags. We avoid this by escaping the $topdir before replacing in GHC. Add regression test case to count the number of options after variable expansion took place. Additionally, check escaping works. - - - - - 4f7386e8 by Fendor at 2024-03-18T00:29:01-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 9 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Settings/IO.hs - hadrian/src/Rules/Generate.hs - + test.hs - + testsuite/tests/ghc-api/settings-escape/T11938.hs - + testsuite/tests/ghc-api/settings-escape/T11938.stderr - + testsuite/tests/ghc-api/settings-escape/all.T - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings - + testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -16,9 +16,11 @@ import GHC.Utils.CliOption import GHC.Utils.Fingerprint import GHC.Platform import GHC.Utils.Panic +import GHC.ResponseFile import GHC.Settings import GHC.SysTools.BaseDir +import Data.Char import Control.Monad.Trans.Except import Control.Monad.IO.Class import qualified Data.Map as Map @@ -72,9 +74,13 @@ initSettings top_dir = do -- just partially applying those functions and throwing 'Left's; they're -- written in a very portable style to keep ghc-boot light. let getSetting key = either pgmError pure $ - getRawFilePathSetting top_dir settingsFile mySettings key + -- Escape the 'top_dir', to make sure we don't accidentally introduce an + -- unescaped space + getRawFilePathSetting (escapeArg top_dir) settingsFile mySettings key getToolSetting :: String -> ExceptT SettingsError m String - getToolSetting key = expandToolDir useInplaceMinGW mtool_dir <$> getSetting key + -- Escape the 'mtool_dir', to make sure we don't accidentally introduce + -- an unescaped space + getToolSetting key = expandToolDir useInplaceMinGW (fmap escapeArg mtool_dir) <$> getSetting key targetPlatformString <- getSetting "target platform string" cc_prog <- getToolSetting "C compiler command" cxx_prog <- getToolSetting "C++ compiler command" @@ -91,10 +97,10 @@ initSettings top_dir = do let unreg_cc_args = if platformUnregisterised platform then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] else [] - cpp_args = map Option (words cpp_args_str) - hs_cpp_args = map Option (words hs_cpp_args_str) - cc_args = words cc_args_str ++ unreg_cc_args - cxx_args = words cxx_args_str + cpp_args = map Option (unescapeArgs cpp_args_str) + hs_cpp_args = map Option (unescapeArgs hs_cpp_args_str) + cc_args = unescapeArgs cc_args_str ++ unreg_cc_args + cxx_args = unescapeArgs cxx_args_str -- The extra flags we need to pass gcc when we invoke it to compile .hc code. -- @@ -135,12 +141,12 @@ initSettings top_dir = do let as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_prog - ld_args = map Option (cc_args ++ words cc_link_args_str) + ld_args = map Option (cc_args ++ unescapeArgs cc_link_args_str) ld_r_prog <- getToolSetting "Merge objects command" ld_r_args <- getToolSetting "Merge objects flags" let ld_r | null ld_r_prog = Nothing - | otherwise = Just (ld_r_prog, map Option $ words ld_r_args) + | otherwise = Just (ld_r_prog, map Option $ unescapeArgs ld_r_args) llvmTarget <- getSetting "LLVM target" @@ -261,3 +267,19 @@ getTargetPlatform settingsFile settings = do , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } + +-- ---------------------------------------------------------------------------- +-- Escape Args helpers +-- ---------------------------------------------------------------------------- + +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -6,6 +6,7 @@ module Rules.Generate ( ) where import Development.Shake.FilePath +import Data.Char (isSpace) import qualified Data.Set as Set import Base import qualified Context @@ -416,7 +417,7 @@ generateSettings = do , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter) , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Tables next to code", queryTarget (yesNo . tgtTablesNextToCode)) , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) @@ -431,23 +432,23 @@ generateSettings = do ++ ["]"] where ccPath = prgPath . ccProgram . tgtCCompiler - ccFlags = unwords . prgFlags . ccProgram . tgtCCompiler + ccFlags = escapeArgs . prgFlags . ccProgram . tgtCCompiler cxxPath = prgPath . cxxProgram . tgtCxxCompiler - cxxFlags = unwords . prgFlags . cxxProgram . tgtCxxCompiler - clinkFlags = unwords . prgFlags . ccLinkProgram . tgtCCompilerLink + cxxFlags = escapeArgs . prgFlags . cxxProgram . tgtCxxCompiler + clinkFlags = escapeArgs . prgFlags . ccLinkProgram . tgtCCompilerLink linkSupportsNoPie = yesNo . ccLinkSupportsNoPie . tgtCCompilerLink cppPath = prgPath . cppProgram . tgtCPreprocessor - cppFlags = unwords . prgFlags . cppProgram . tgtCPreprocessor + cppFlags = escapeArgs . prgFlags . cppProgram . tgtCPreprocessor hsCppPath = prgPath . hsCppProgram . tgtHsCPreprocessor - hsCppFlags = unwords . prgFlags . hsCppProgram . tgtHsCPreprocessor + hsCppFlags = escapeArgs . prgFlags . hsCppProgram . tgtHsCPreprocessor mergeObjsPath = maybe "" (prgPath . mergeObjsProgram) . tgtMergeObjs - mergeObjsFlags = maybe "" (unwords . prgFlags . mergeObjsProgram) . tgtMergeObjs + mergeObjsFlags = maybe "" (escapeArgs . prgFlags . mergeObjsProgram) . tgtMergeObjs linkSupportsSingleModule = yesNo . ccLinkSupportsSingleModule . tgtCCompilerLink linkSupportsFilelist = yesNo . ccLinkSupportsFilelist . tgtCCompilerLink linkSupportsCompactUnwind = yesNo . ccLinkSupportsCompactUnwind . tgtCCompilerLink linkIsGnu = yesNo . ccLinkIsGnu . tgtCCompilerLink arPath = prgPath . arMkArchive . tgtAr - arFlags = unwords . prgFlags . arMkArchive . tgtAr + arFlags = escapeArgs . prgFlags . arMkArchive . tgtAr arSupportsAtFile' = yesNo . arSupportsAtFile . tgtAr arSupportsDashL' = yesNo . arSupportsDashL . tgtAr ranlibPath = maybe "" (prgPath . ranlibProgram) . tgtRanlib @@ -571,3 +572,19 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + +-- | Just like 'GHC.ResponseFile.escapeArgs', but use spaces instead of newlines +-- for splitting elements. +escapeArgs :: [String] -> String +escapeArgs = unwords . map escapeArg + +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs ===================================== test.hs ===================================== @@ -0,0 +1,14 @@ +import Data.Char +import Data.Foldable +-- | Just like 'GHC.ResponseFile.escapeArg', but it is not exposed from base. +escapeArg :: String -> String +escapeArg = reverse . foldl' escape [] + +escape :: String -> Char -> String +escape cs c + | isSpace c + || '\\' == c + || '\'' == c + || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result + | otherwise = c:cs + ===================================== testsuite/tests/ghc-api/settings-escape/T11938.hs ===================================== @@ -0,0 +1,73 @@ + +import GHC.Settings +import GHC.Settings.IO +import GHC.Utils.CliOption (Option, showOpt) + +import Control.Monad.Trans.Except (runExceptT) +import Data.Maybe (fromJust) +import System.Directory (makeAbsolute) +import System.IO (hPutStrLn, stderr) +import System.Exit (exitWith, ExitCode(ExitFailure)) + +-- Precondition: this test case must be executed in a directory with a space. +main :: IO () +main = do + topDir <- makeAbsolute "./ghc-install-folder/lib" + settingsm <- runExceptT $ initSettings topDir + + case settingsm of + Left (SettingsError_MissingData msg) -> do + hPutStrLn stderr $ "WARNING: " ++ show msg + hPutStrLn stderr $ "dont know target platform" + exitWith $ ExitFailure 1 + Left (SettingsError_BadData msg) -> do + hPutStrLn stderr msg + exitWith $ ExitFailure 1 + Right settings -> do + let + recordSetting :: String -> (Settings -> [String]) -> IO () + recordSetting label selector = do + let opts = selector settings + -- At least one of the options must contain a space + containsSpaces = any (' ' `elem`) opts + hPutStrLn stderr $ "=== Number of '" <> label <> "' options: " ++ show (length opts) + hPutStrLn stderr $ " Contains spaces: " ++ show containsSpaces + + recordFpSetting :: String -> (Settings -> String) -> IO () + recordFpSetting label selector = do + let fp = selector settings + containsOnlyEscapedSpaces ('\\':' ':xs) = containsOnlyEscapedSpaces xs + containsOnlyEscapedSpaces (' ':_) = False + containsOnlyEscapedSpaces [] = True + containsOnlyEscapedSpaces (_:xs) = containsOnlyEscapedSpaces xs + + -- Filepath may only contain escaped spaces + containsSpaces = containsOnlyEscapedSpaces fp + hPutStrLn stderr $ "=== FilePath '" <> label <> "' contains only escaped spaces: " ++ show containsSpaces + + -- Assertions + -- Assumption: this test case is executed in a directory with a space. + + -- Setting 'Haskell CPP flags' contains '$topdir' and '$tooldir' references. + -- Resolving those while containing spaces, should not introduce more options. + -- '$tooldir' will only be expanded in windows, while '$topdir' is always expanded. + recordSetting "Haskell CPP flags" (map showOpt . snd . toolSettings_pgm_P . sToolSettings) + -- Setting 'C compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler flags" (toolSettings_opt_c . sToolSettings) + -- Setting 'C compiler link flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C compiler link flags" (map showOpt . snd . toolSettings_pgm_l . sToolSettings) + -- Setting 'C++ compiler flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "C++ compiler flags" (toolSettings_opt_cxx . sToolSettings) + -- Setting 'CPP Flags' contains strings with spaces. + -- GHC should not split these by word. + recordSetting "CPP Flags" (map showOpt . snd . toolSettings_pgm_cpp . sToolSettings) + -- Setting 'Merge objects flags' contains strings with spaces. + -- GHC should not split these by word. + -- We know in this case, that 'toolSettings_pgm_lm' is 'Just' + recordSetting "Merge objects flags" (map showOpt . snd . fromJust . toolSettings_pgm_lm . sToolSettings) + -- Setting 'unlit command' contains '$topdir' reference. + -- Resolving those while containing spaces, should be escaped correctly. + recordFpSetting "unlit command" (toolSettings_pgm_L . sToolSettings) ===================================== testsuite/tests/ghc-api/settings-escape/T11938.stderr ===================================== @@ -0,0 +1,13 @@ +=== Number of 'Haskell CPP flags' options: 5 + Contains spaces: True +=== Number of 'C compiler flags' options: 3 + Contains spaces: True +=== Number of 'C compiler link flags' options: 7 + Contains spaces: True +=== Number of 'C++ compiler flags' options: 2 + Contains spaces: True +=== Number of 'CPP Flags' options: 3 + Contains spaces: True +=== Number of 'Merge objects flags' options: 3 + Contains spaces: True +=== FilePath 'unlit command' contains only escaped spaces: True ===================================== testsuite/tests/ghc-api/settings-escape/all.T ===================================== @@ -0,0 +1 @@ +test('T11938', [normal, extra_files(['ghc-install-folder/'])], compile_and_run, ['-package ghc -package directory -package transformers']) ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/settings ===================================== @@ -0,0 +1,51 @@ +[("C compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("C compiler flags", "-O2 \"-some option\" -some\\ other") +,("C++ compiler command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/g++") +,("C++ compiler flags", "\"-some option\" -some\\ other") +,("C compiler link flags", "-fuse-ld=gold -Wl,--no-as-needed \"-some option\" -some\\ other") +,("C compiler supports -no-pie", "YES") +,("CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("CPP flags", "-E \"-some option\" -some\\ other") +,("Haskell CPP command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/cc") +,("Haskell CPP flags", "-E -undef -traditional -I$topdir/ -I$tooldir/") +,("ld supports compact unwind", "NO") +,("ld supports filelist", "NO") +,("ld supports single module", "NO") +,("ld is GNU ld", "YES") +,("Merge objects command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ld.gold") +,("Merge objects flags", "-r \"-some option\" -some\\ other") +,("Merge objects supports response files", "YES") +,("ar command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ar") +,("ar flags", "q") +,("ar supports at file", "YES") +,("ar supports -L", "NO") +,("ranlib command", "/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin/ranlib") +,("otool command", "otool") +,("install_name_tool command", "install_name_tool") +,("touch command", "touch") +,("windres command", "/bin/false") +,("unlit command", "$topdir/../bin/unlit") +,("cross compiling", "NO") +,("target platform string", "x86_64-unknown-linux") +,("target os", "OSLinux") +,("target arch", "ArchX86_64") +,("target word size", "8") +,("target word big endian", "NO") +,("target has GNU nonexec stack", "YES") +,("target has .ident directive", "YES") +,("target has subsections via symbols", "NO") +,("target has libm", "YES") +,("Unregisterised", "NO") +,("LLVM target", "x86_64-unknown-linux") +,("LLVM llc command", "llc") +,("LLVM opt command", "opt") +,("LLVM llvm-as command", "clang") +,("Use inplace MinGW toolchain", "NO") +,("Use interpreter", "YES") +,("Support SMP", "YES") +,("RTS ways", "v thr thr_debug thr_debug_dyn thr_dyn debug debug_dyn dyn") +,("Tables next to code", "YES") +,("Leading underscore", "NO") +,("Use LibFFI", "NO") +,("RTS expects libdw", "YES") +] ===================================== testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep ===================================== View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/47d2eaf6eef0600fb9132e2a22ccac5ff1e514e1...4f7386e8aa1ab74361c2a74c92d1c0d758da6a89 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/47d2eaf6eef0600fb9132e2a22ccac5ff1e514e1...4f7386e8aa1ab74361c2a74c92d1c0d758da6a89 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 09:48:25 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 18 Mar 2024 05:48:25 -0400 Subject: [Git][ghc/ghc][wip/windows-topdir] Revert "Apply shellcheck suggestion to SUBST_TOOLDIR" Message-ID: <65f80de91dcc7_32062326d63004613@gitlab.mail> Matthew Pickering pushed to branch wip/windows-topdir at Glasgow Haskell Compiler / GHC Commits: ae112bbb by Zubin Duggal at 2024-03-18T09:47:30+00:00 Revert "Apply shellcheck suggestion to SUBST_TOOLDIR" This reverts commit c82770f57977a2b5add6e1378f234f8dd6153392. The shellcheck suggestion is spurious and results in SUBST_TOOLDIR being a no-op. `set` sets positional arguments for bash, but we want to set the variable given as the first autoconf argument. Fixes #24542 Metric decreases because the paths in the settings file are now shorter, so we allocate less when we read the settings file. ------------------------- Metric Decrease: T12425 T13035 T9198 ------------------------- - - - - - 1 changed file: - m4/fp_settings.m4 Changes: ===================================== m4/fp_settings.m4 ===================================== @@ -44,7 +44,7 @@ dnl ghc-toolchain. AC_DEFUN([SUBST_TOOLDIR], [ dnl and Note [How we configure the bundled windows toolchain] -set -- "$(echo "$$1" | sed 's%'"$mingw_prefix"'%'"$mingw_install_prefix"'%g')" + $1=`echo "$$1" | sed 's%'"$mingw_prefix"'%'"$mingw_install_prefix"'%g'` ]) # FP_SETTINGS View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ae112bbbbd8c7db7fbc677e589d9803b5e47de2a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ae112bbbbd8c7db7fbc677e589d9803b5e47de2a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 11:32:54 2024 From: gitlab at gitlab.haskell.org (Bryan R (@chreekat)) Date: Mon, 18 Mar 2024 07:32:54 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/b/T21336a-skip-wasm Message-ID: <65f82666af1a1_32062350f3a48591b1@gitlab.mail> Bryan R pushed new branch wip/b/T21336a-skip-wasm at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/b/T21336a-skip-wasm You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 11:34:38 2024 From: gitlab at gitlab.haskell.org (Bryan R (@chreekat)) Date: Mon, 18 Mar 2024 07:34:38 -0400 Subject: [Git][ghc/ghc][wip/b/T21336a-skip-wasm] testsuite: Disable T21336a on wasm Message-ID: <65f826ce42c77_32062352dbd3860979@gitlab.mail> Bryan R pushed to branch wip/b/T21336a-skip-wasm at Glasgow Haskell Compiler / GHC Commits: 9765247d by Bryan Richter at 2024-03-18T13:34:27+02:00 testsuite: Disable T21336a on wasm - - - - - 1 changed file: - libraries/base/tests/IO/T21336/all.T Changes: ===================================== libraries/base/tests/IO/T21336/all.T ===================================== @@ -3,6 +3,10 @@ test('T21336a', [ unless(opsys('linux') or opsys('freebsd'), skip) , js_broken(22261) , fragile(22022) + # More than fragile, the test is failing consistently on wasm. See #22022. + # It would be nice to see if the test is NOT fragile on the other + # architectures, but right now I don't know how to check. + , when(arch('wasm32'), skip) , extra_files(['FinalizerExceptionHandler.hs']) ], compile_and_run, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9765247d06764e86931b908c90fa408ec8f66b78 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9765247d06764e86931b908c90fa408ec8f66b78 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 11:35:25 2024 From: gitlab at gitlab.haskell.org (Bryan R (@chreekat)) Date: Mon, 18 Mar 2024 07:35:25 -0400 Subject: [Git][ghc/ghc][wip/b/T21336a-skip-wasm] 74 commits: rel_eng: Update hackage docs upload scripts Message-ID: <65f826fda71ad_3206235494440613b1@gitlab.mail> Bryan R pushed to branch wip/b/T21336a-skip-wasm at Glasgow Haskell Compiler / GHC Commits: 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 2ef9b382 by Bryan Richter at 2024-03-18T13:34:59+02:00 testsuite: Disable T21336a on wasm - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Match.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9765247d06764e86931b908c90fa408ec8f66b78...2ef9b382b99f5b22ea9ab3ca7ce9228a0cf97aae -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9765247d06764e86931b908c90fa408ec8f66b78...2ef9b382b99f5b22ea9ab3ca7ce9228a0cf97aae You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 12:41:09 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 18 Mar 2024 08:41:09 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f8366541092_320623728457c77899@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 8304f8fe by Fendor at 2024-03-18T08:40:57-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 7ae667db by Alan Zimmerman at 2024-03-18T08:40:58-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 6 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f7386e8aa1ab74361c2a74c92d1c0d758da6a89...7ae667dbbc811ac944728a3608d72796de6505ba -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f7386e8aa1ab74361c2a74c92d1c0d758da6a89...7ae667dbbc811ac944728a3608d72796de6505ba You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 13:15:53 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Mon, 18 Mar 2024 09:15:53 -0400 Subject: [Git][ghc/ghc][wip/T24031] 60 commits: Rephrase error message to say "visible arguments" (#24318) Message-ID: <65f83e89201fb_320623856b140862cf@gitlab.mail> Teo Camarasu pushed to branch wip/T24031 at Glasgow Haskell Compiler / GHC Commits: 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 87702681 by Teo Camarasu at 2024-03-18T13:15:48+00:00 Deprecate PrimTyConI - We produce `TyConI` for types where we used to use `PrimTyConI`. - We add a deprecation warning to `PrimTyConI` - We add a test case to ensure we can actually reify primitive types. Resolves #24031 - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Core/Predicate.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Gen/Splice.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3ead2f38a5f448ea1a669fcbbfa8469004b46f4d...877026819baaba0a63b8709840b151ded8f33df4 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3ead2f38a5f448ea1a669fcbbfa8469004b46f4d...877026819baaba0a63b8709840b151ded8f33df4 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 14:38:51 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 18 Mar 2024 10:38:51 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/mpickering-hannes Message-ID: <65f851fb26c28_320623a68eb3810067c@gitlab.mail> Matthew Pickering pushed new branch wip/mpickering-hannes at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/mpickering-hannes You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 15:13:13 2024 From: gitlab at gitlab.haskell.org (John Ericson (@Ericson2314)) Date: Mon, 18 Mar 2024 11:13:13 -0400 Subject: [Git][ghc/ghc][wip/hadrian-subst-bindist] 126 commits: Define GHC2024 language edition (#24320) Message-ID: <65f85a09c32e3_320623b8df63410817@gitlab.mail> John Ericson pushed to branch wip/hadrian-subst-bindist at Glasgow Haskell Compiler / GHC Commits: 09941666 by Adam Gundry at 2024-02-21T13:53:12+00:00 Define GHC2024 language edition (#24320) See https://github.com/ghc-proposals/ghc-proposals/pull/613. Also fixes #24343 and improves the documentation of language editions. Co-authored-by: Joachim Breitner <mail at joachim-breitner.de> - - - - - 5121a4ed by Ben Gamari at 2024-02-23T06:40:55-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. Bumps haddock submodule. - - - - - 0eb2265d by Hécate Moonlight at 2024-02-24T16:02:16-05:00 Improve the synopsis and description of base - - - - - 2e36f5d2 by Jade at 2024-02-24T16:02:51-05:00 Error Messages: Properly align cyclic module error Fixes: #24476 - - - - - bbfb051c by Ben Gamari at 2024-02-24T19:10:23-05:00 Allow docstrings after exports Here we extend the parser and AST to preserve docstrings following export items. We then extend Haddock to parse `@since` annotations in such docstrings, allowing changes in export structure to be properly documented. - - - - - d8d6ad8c by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Move modules into GHC.Internal.* namespace Bumps haddock submodule due to testsuite output changes. - - - - - a82af7cd by Ben Gamari at 2024-02-24T19:10:23-05:00 ghc-internal: Rewrite `@since ` to `@since base-` These will be incrementally moved to the export sites in `base` where possible. - - - - - ca3836e1 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Migrate Haddock `not-home` pragmas from `ghc-internal` This ensures that we do not use `base` stub modules as declarations' homes when not appropriate. - - - - - c8cf3e26 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Partially freeze exports of GHC.Base Sadly there are still a few module reexports. However, at least we have decoupled from the exports of `GHC.Internal.Base`. - - - - - 272573c6 by Ben Gamari at 2024-02-24T19:10:23-05:00 Move Haddock named chunks - - - - - 2d8a881d by Ben Gamari at 2024-02-24T19:10:23-05:00 Drop GHC.Internal.Data.Int - - - - - 55c4c385 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler: Fix mention to `GHC....` modules in wasm desugaring Really, these references should be via known-key names anyways. I have fixed the proximate issue here but have opened #24472 to track the additional needed refactoring. - - - - - 64150911 by Ben Gamari at 2024-02-24T19:10:23-05:00 Accept performance shifts from ghc-internal restructure As expected, Haddock now does more work. Less expected is that some other testcases actually get faster, presumably due to less interface file loading. As well, the size_hello_artifact test regressed a bit when debug information is enabled due to debug information for the new stub symbols. Metric Decrease: T12227 T13056 Metric Increase: haddock.Cabal haddock.base MultiLayerModulesTH_OneShot size_hello_artifact - - - - - 317a915b by Ben Gamari at 2024-02-24T19:10:23-05:00 Expose GHC.Wasm.Prim from ghc-experimental Previously this was only exposed from `ghc-internal` which violates our agreement that users shall not rely on things exposed from that package. Fixes #24479. - - - - - 3bbd2bf2 by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Small optimisation of evCallStack Don't lookupIds unless we actually need them. - - - - - 3e5c9e3c by Ben Gamari at 2024-02-24T19:10:23-05:00 compiler/tc: Use toException instead of SomeException - - - - - 125714a6 by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Factor out errorBelch This was useful when debugging - - - - - 3d6aae7c by Ben Gamari at 2024-02-24T19:10:23-05:00 base: Clean up imports of GHC.Stack.CloneStack - - - - - 6900306e by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move PrimMVar to GHC.Internal.MVar - - - - - 28f8a148 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Move prettyCallStack to GHC.Internal.Stack - - - - - 4892de47 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Explicit dependency to workaround #24436 Currently `ghc -M` fails to account for `.hs-boot` files correctly, leading to issues with cross-package one-shot builds failing. This currently manifests in `GHC.Exception` due to the boot file for `GHC.Internal.Stack`. Work around this by adding an explicit `import`, ensuring that `GHC.Internal.Stack` is built before `GHC.Exception`. See #24436. - - - - - 294c93a5 by Ben Gamari at 2024-02-24T19:10:24-05:00 base: Use displayException in top-level exception handler Happily this also allows us to eliminate a special case for Deadlock exceptions. Implements [CLC #198](https://github.com/haskell/core-libraries-committee/issues/198). - - - - - cf756a25 by Ben Gamari at 2024-02-24T22:11:53-05:00 rts: Fix symbol references in Wasm RTS - - - - - 4e4d47a0 by Jade at 2024-02-26T15:17:20-05:00 GHCi: Improve response to unloading, loading and reloading modules Fixes #13869 - - - - - f3de8a3c by Zubin Duggal at 2024-02-26T15:17:57-05:00 rel-eng/fetch-gitlab.py: Fix name of aarch64 alpine 3_18 release job - - - - - c71bfdff by Cheng Shao at 2024-02-26T15:18:35-05:00 hadrian/hie-bios: pass -j to hadrian This commit passes -j to hadrian in the hadrian/hie-bios scripts. When the user starts HLS in a fresh clone that has just been configured, it takes quite a while for hie-bios to pick up the ghc flags and start actual indexing, due to the fact that the hadrian build step defaulted to -j1, so -j speeds things up and improve HLS user experience in GHC. Also add -j flag to .ghcid to speed up ghcid, and sets the Windows build root to .hie-bios which also works and unifies with other platforms, the previous build root _hie-bios was missing from .gitignore anyway. - - - - - 50bfdb46 by Cheng Shao at 2024-02-26T15:18:35-05:00 ci: enable parallelism in hadrian/ghci scripts This commit enables parallelism when the hadrian/ghci scripts are called in CI. The time bottleneck is in the hadrian build step, but previously the build step wasn't parallelized. - - - - - 61a78231 by Felix Yan at 2024-02-26T15:19:14-05:00 m4: Correctly detect GCC version When calling as `cc`, GCC does not outputs lowercased "gcc" at least in 13.2.1 version here. ``` $ cc --version cc (GCC) 13.2.1 20230801 ... ``` This fails the check and outputs the confusing message: `configure: $CC is not gcc; assuming it's a reasonably new C compiler` This patch makes it check for upper-cased "GCC" too so that it works correctly: ``` checking version of gcc... 13.2.1 ``` - - - - - 001aa539 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Fix formatting in whereFrom docstring Previously it used markdown syntax rather than Haddock syntax for code quotes - - - - - e8034d15 by Teo Camarasu at 2024-02-27T13:26:46-05:00 Move ClosureType type to ghc-internal - Use ClosureType for InfoProv.ipDesc. - Use ClosureType for CloneStack.closureType. - Now ghc-heap re-exports this type from ghc-internal. See the accompanying CLC proposal: https://github.com/haskell/core-libraries-committee/issues/210 Resolves #22600 - - - - - 3da0a551 by Matthew Craven at 2024-02-27T13:27:22-05:00 StgToJS: Simplify ExprInline constructor of ExprResult Its payload was used only for a small optimization in genAlts, avoiding a few assignments for programs of this form: case NormalDataCon arg1 arg2 of x { NormalDataCon x1 x2 -> ... ; } But when compiling with optimizations, this sort of code is generally eliminated by case-of-known-constructor in Core-to-Core. So it doesn't seem worth tracking and cleaning up again in StgToJS. - - - - - 61bc92cc by Cheng Shao at 2024-02-27T16:58:42-05:00 rts: add missing ccs_mutex guard to internal_dlopen See added comment for details. Closes #24423. - - - - - dd29d3b2 by doyougnu at 2024-02-27T16:59:23-05:00 cg: Remove GHC.Cmm.DataFlow.Collections In pursuit of #15560 and #17957 and generally removing redundancy. - - - - - d3a050d2 by Cheng Shao at 2024-02-27T17:00:00-05:00 utils: remove unused lndir from tree Ever since the removal of the make build system, the in tree lndir hasn't been actually built, so this patch removes it. - - - - - 74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00 rts: avoid checking bdescr of value outside of Haskell heap In nonmovingTidyWeaks we want to check if the key of a weak pointer lives in the non-moving heap. We do this by checking the flags of the block the key lives in. But we need to be careful with values that live outside the Haskell heap, since they will lack a block descriptor and looking for one may lead to a segfault. In this case we should just accept that it isn't on the non-moving heap. Resolves #24492 - - - - - b4cae4ec by Simon Peyton Jones at 2024-02-29T02:10:08-05:00 In mkDataConRep, ensure the in-scope set is right A small change that fixes #24489 - - - - - 3836a110 by Cheng Shao at 2024-02-29T21:25:45-05:00 testsuite: fix T23540 fragility on 32-bit platforms T23540 is fragile on 32-bit platforms. The root cause is usage of `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord` instance, which is indeterministic. The solution is adding a deterministic `Ord` instance for `EvidenceInfo` and sorting the evidence trees before pretty printing. Fixes #24449. - - - - - 960c8d47 by Teo Camarasu at 2024-02-29T21:26:20-05:00 Reduce AtomicModifyIORef increment count This test leads to a lot of contention when N>2 and becomes very slow. Let's reduce the amount of work we do to compensate. Resolves #24490 - - - - - 2e46c8ad by Matthew Pickering at 2024-03-01T05:48:06-05:00 hadrian: Improve parallelism in binary-dist-dir rule I noticed that the "docs" target was needed after the libraries and executables were built. We can improve the parallelism by needing everything at once so that documentation can be built immediately after a library is built for example. - - - - - cb6c11fe by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Bump windows and freebsd boot compilers to 9.6.4 We have previously bumped the docker images to use 9.6.4, but neglected to bump the windows images until now. - - - - - 30f06996 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: darwin: Update to 9.6.2 for boot compiler 9.6.4 is currently broken due to #24050 Also update to use LLVM-15 rather than LLVM-11, which is out of date. - - - - - d9d69e12 by Matthew Pickering at 2024-03-01T05:48:07-05:00 Bump minimum bootstrap version to 9.6 - - - - - 67ace1c5 by Matthew Pickering at 2024-03-01T05:48:07-05:00 ci: Enable more documentation building Here we enable documentation building on 1. Darwin: The sphinx toolchain was already installed so we enable html and manpages. 2. Rocky8: Full documentation (toolchain already installed) 3. Alpine: Full documetnation (toolchain already installed) 4. Windows: HTML and manpages (toolchain already installed) Fixes #24465 - - - - - 39583c39 by Matthew Pickering at 2024-03-01T05:48:42-05:00 ci: Bump ci-images to allow updated aarch64-alpine image with llvm15 and clang15 - - - - - d91d00fc by Torsten Schmits at 2024-03-01T15:01:50-05:00 Introduce ListTuplePuns extension This implements Proposal 0475, introducing the `ListTuplePuns` extension which is enabled by default. Disabling this extension makes it invalid to refer to list, tuple and sum type constructors by using built-in syntax like `[Int]`, `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`. Instead, this syntax exclusively denotes data constructors for use with `DataKinds`. The conventional way of referring to these data constructors by prefixing them with a single quote (`'(Int, Int)`) is now a parser error. Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo` data constructor has been renamed to `MkSolo` (in a previous commit). Unboxed tuples and sums now have real source declarations in `GHC.Types`. Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo` and `Solo#`. Constraint tuples now have the unambiguous type constructors `CTuple<n>` as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before. A new parser construct has been added for the unboxed sum data constructor declarations. The type families `Tuple`, `Sum#` etc. that were intended to provide nicer syntax have been omitted from this change set due to inference problems, to be implemented at a later time. See the MR discussion for more info. Updates the submodule utils/haddock. Updates the cabal submodule due to new language extension. Metric Increase: haddock.base Metric Decrease: MultiLayerModulesTH_OneShot size_hello_artifact Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Merge request: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8820 Tracking ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21294 - - - - - bbdb6286 by Sylvain Henry at 2024-03-01T15:01:50-05:00 JS linker: filter unboxed tuples - - - - - dec6d8d3 by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Improve error messages coming from non-linear patterns This enriched the `CtOrigin` for non-linear patterns to include data of the pattern that created the constraint (which can be quite useful if it occurs nested in a pattern) as well as an explanation why the pattern is non-restricted in (at least in some cases). - - - - - 6612388e by Arnaud Spiwack at 2024-03-01T15:02:30-05:00 Adjust documentation of linear lets according to committee decision - - - - - 1c064ef1 by Cheng Shao at 2024-03-02T17:11:19-05:00 compiler: start deprecating cmmToRawCmmHook cmmToRawCmmHook was added 4 years ago in d561c8f6244f8280a2483e8753c38e39d34c1f01. Its only user is the Asterius project, which has been archived and deprecated in favor of the ghc wasm backend. This patch starts deprecating cmmToRawCmmHook by placing a DEPRECATED pragma, and actual removal shall happen in a future GHC major release if no issue to oppose the deprecation has been raised in the meantime. - - - - - 9b74845f by Andrew Lelechenko at 2024-03-02T17:11:55-05:00 Data.List.NonEmpty.unzip: use WARNING with category instead of DEPRECATED CLC proposal: https://github.com/haskell/core-libraries-committee/issues/258 - - - - - 61bb5ff6 by Finley McIlwaine at 2024-03-04T09:01:40-08:00 add -fprof-late-overloaded and -fprof-late-overloaded-calls * Refactor late cost centre insertion for extensibility * Add two more late cost centre insertion methods that add SCCs to overloaded top level bindings and call sites with dictionary arguments. * Some tests for the basic functionality of the new insertion methods Resolves: #24500 - - - - - 82ccb801 by Andreas Klebinger at 2024-03-04T19:59:14-05:00 x86-ncg: Fix fma codegen when arguments are globals Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 - - - - - 18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00 rel_eng: Update hackage docs upload scripts This adds the upload of ghc-internal and ghc-experimental to our scripts which upload packages to hackage. - - - - - bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00 docs: Remove stray module comment from GHC.Profiling.Eras - - - - - 37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix ghc-internal cabal file The file mentioned some artifacts relating to the base library. I have renamed these to the new ghc-internal variants. - - - - - 23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00 Fix haddock source links and hyperlinked source There were a few issues with the hackage links: 1. We were using the package id rather than the package name for the package links. This is fixed by now allowing the template to mention %pkg% or %pkgid% and substituing both appropiatly. 2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage` as the new base link works on a local or remote hackage server. 3. The "src" path including too much stuff, so cross-package source links were broken as the template was getting double expanded. Fixes #24086 - - - - - 2fa336a9 by Ben Gamari at 2024-03-05T14:23:07-05:00 filepath: Bump submodule to 1.5.2.0 - - - - - 31217944 by Ben Gamari at 2024-03-05T14:23:07-05:00 os-string: Bump submodule to 2.0.2 - - - - - 4074a3f2 by Matthew Pickering at 2024-03-05T21:44:35-05:00 base: Reflect new era profiling RTS flags in GHC.RTS.Flags * -he profiling mode * -he profiling selector * --automatic-era-increment CLC proposal #254 - https://github.com/haskell/core-libraries-committee/issues/254 - - - - - a8c0e31b by Sylvain Henry at 2024-03-05T21:45:14-05:00 JS: faster implementation for some numeric primitives (#23597) Use faster implementations for the following primitives in the JS backend by not using JavaScript's BigInt: - plusInt64 - minusInt64 - minusWord64 - timesWord64 - timesInt64 Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com> - - - - - 21e3f325 by Cheng Shao at 2024-03-05T21:45:52-05:00 rts: add -xr option to control two step allocator reserved space size This patch adds a -xr RTS option to control the size of virtual memory address space reserved by the two step allocator on a 64-bit platform, see added documentation for explanation. Closes #24498. - - - - - dedcf102 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: expose HeapAlloc.h as public header This commit exposes HeapAlloc.h as a public header. The intention is to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in assertions in other public headers, and they may also be useful for user code. - - - - - d19441d7 by Cheng Shao at 2024-03-06T13:39:04-05:00 rts: assert pointer is indeed heap allocated in Bdescr() This commit adds an assertion to Bdescr() to assert the pointer is indeed heap allocated. This is useful to rule out RTS bugs that attempt to access non-existent block descriptor of a static closure, #24492 being one such example. - - - - - 9a656a04 by Ben Gamari at 2024-03-06T13:39:39-05:00 ghc-experimental: Add dummy dependencies to work around #23942 This is a temporary measure to improve CI reliability until a proper solution is developed. Works around #23942. - - - - - 1e84b924 by Simon Peyton Jones at 2024-03-06T13:39:39-05:00 Three compile perf improvements with deep nesting These were changes are all triggered by #24471. 1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are many free variables. See Note [Large free-variable sets]. 2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument. This benefits the common case where the ArityType turns out to be nullary. See Note [Care with nested expressions] 3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested expressions. See Note [Eta expansion of arguments in CorePrep] wrinkle (EA2). Compile times go down by up to 4.5%, and much more in artificial cases. (Geo mean of compiler/perf changes is -0.4%.) Metric Decrease: CoOpt_Read T10421 T12425 - - - - - c4b13113 by Hécate Moonlight at 2024-03-06T13:40:17-05:00 Use "module" instead of "library" when applicable in base haddocks - - - - - 9cd9efb4 by Vladislav Zavialov at 2024-03-07T13:01:54+03:00 Rephrase error message to say "visible arguments" (#24318) * Main change: make the error message generated by mkFunTysMsg more accurate by changing "value arguments" to "visible arguments". * Refactor: define a new type synonym VisArity and use it instead of Arity in a few places. It might be the case that there other places in the compiler that should talk about visible arguments rather than value arguments, but I haven't tried to find them all, focusing only on the error message reported in the ticket. - - - - - d523a6a7 by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump array submodule - - - - - 7e55003c by Ben Gamari at 2024-03-07T19:40:45-05:00 Bump stm submodule - - - - - 32d337ef by Ben Gamari at 2024-03-07T19:40:45-05:00 Introduce exception context Here we introduce the `ExceptionContext` type and `ExceptionAnnotation` class, allowing dynamically-typed user-defined annotations to be attached to exceptions. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 - - - - - 39f3d922 by Ben Gamari at 2024-03-07T19:40:46-05:00 testsuite/interface-stability: Update documentation - - - - - fdea7ada by Ben Gamari at 2024-03-07T19:40:46-05:00 ghc-internal: comment formatting - - - - - 4fba42ef by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Default and warn ExceptionContext constraints - - - - - 3886a205 by Ben Gamari at 2024-03-07T19:40:46-05:00 base: Introduce exception backtraces Here we introduce the `Backtraces` type and associated machinery for attaching these via `ExceptionContext`. These has a few compile-time regressions (`T15703` and `T9872d`) due to the additional dependencies in the exception machinery. As well, there is a surprisingly large regression in the `size_hello_artifact` test. This appears to be due to various `Integer` and `Read` bits now being reachable at link-time. I believe it should be possible to avoid this but I have accepted the change for now to get the feature merged. CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/199 GHC Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/330 Metric Increase: T15703 T9872d size_hello_artifact - - - - - 18c5409f by Ben Gamari at 2024-03-07T19:40:46-05:00 users guide: Release notes for exception backtrace work - - - - - f849c5fc by Ben Gamari at 2024-03-07T19:40:46-05:00 compiler: Don't show ExceptionContext of GhcExceptions Most GhcExceptions are user-facing errors and therefore the ExceptionContext has little value. Ideally we would enable it in the DEBUG compiler but I am leaving this for future work. - - - - - dc646e6f by Sylvain Henry at 2024-03-07T19:40:46-05:00 Disable T9930fail for the JS target (cf #19174) - - - - - bfc09760 by Alan Zimmerman at 2024-03-07T19:41:22-05:00 Update showAstData to honour blanking of AnnParen Also tweak rendering of SrcSpan to remove extra blank line. - - - - - 50454a29 by Ben Gamari at 2024-03-08T03:32:42-05:00 ghc-internal: Eliminate GHC.Internal.Data.Kind This was simply reexporting things from `ghc-prim`. Instead reexport these directly from `Data.Kind`. Also add build ordering dependency to work around #23942. - - - - - 38a4b6ab by Ben Gamari at 2024-03-08T03:33:18-05:00 rts: Fix SET_HDR initialization of retainer set This fixes a regression in retainer set profiling introduced by b0293f78cb6acf2540389e22bdda420d0ab874da. Prior to that commit the heap traversal word would be initialized by `SET_HDR` using `LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling` check in `LDV_RECORD_CREATE`, meaning that this initialization no longer happened. Given that this initialization was awkwardly indirectly anyways, I have fixed this by explicitly initializating the heap traversal word to `NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior, but much more direct. Fixes #24513. - - - - - 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - 951f109f by John Ericson at 2024-03-18T11:12:42-04:00 Substitute bindist files with Hadrian not configure The `ghc-toolchain` overhaul will eventually replace all this stuff with something much more cleaned up, but I think it is still worth making this sort of cleanup in the meantime so other untanglings and dead code cleaning can procede. I was able to delete a fair amount of dead code doing this too. `LLVMTarget_CPP` is renamed to / merged with `LLVMTarget` because it wasn't actually turned into a valid CPP identifier. (Original to 1345c7cc42c45e63ab1726a8fd24a7e4d4222467, actually.) Progress on #23966 Co-Authored-By: Sylvain Henry <hsyl20 at gmail.com> - - - - - 30 changed files: - .ghcid - .gitignore - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - .gitlab/rel_eng/upload_ghc_libs.py - compiler/GHC.hs - compiler/GHC/Builtin/Names.hs - compiler/GHC/Builtin/Types.hs - compiler/GHC/Builtin/Types.hs-boot - compiler/GHC/Builtin/Types/Literals.hs - compiler/GHC/Builtin/Uniques.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Dataflow.hs - − compiler/GHC/Cmm/Dataflow/Collections.hs - compiler/GHC/Cmm/Dataflow/Graph.hs - compiler/GHC/Cmm/Dataflow/Label.hs - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/Cmm/Dominators.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/454cc14472536fd21243a44af8404003b2b3c4ce...951f109f9ba2a02b30be18b573ecc09962ab0b6a -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/454cc14472536fd21243a44af8404003b2b3c4ce...951f109f9ba2a02b30be18b573ecc09962ab0b6a You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 15:31:36 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 18 Mar 2024 11:31:36 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f85e581c2ee_320623c599118115953@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 3b4fb239 by Fendor at 2024-03-18T11:31:21-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 47b06a3a by Alan Zimmerman at 2024-03-18T11:31:21-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 6 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7ae667dbbc811ac944728a3608d72796de6505ba...47b06a3a877222c316ece5e279bf7c4b39aa9529 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7ae667dbbc811ac944728a3608d72796de6505ba...47b06a3a877222c316ece5e279bf7c4b39aa9529 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 15:40:20 2024 From: gitlab at gitlab.haskell.org (Matthew Pickering (@mpickering)) Date: Mon, 18 Mar 2024 11:40:20 -0400 Subject: [Git][ghc/ghc][wip/mpickering-hannes] Make it not take ages Message-ID: <65f8606463d49_320623c7587881240d4@gitlab.mail> Matthew Pickering pushed to branch wip/mpickering-hannes at Glasgow Haskell Compiler / GHC Commits: b9ce372a by Matthew Pickering at 2024-03-18T15:39:58+00:00 Make it not take ages - - - - - 2 changed files: - compiler/GHC/Iface/Binary.hs - compiler/GHC/Utils/Binary.hs Changes: ===================================== compiler/GHC/Iface/Binary.hs ===================================== @@ -241,13 +241,13 @@ writeBinIface profile traceBinIface hi_path mod_iface = do report <- profileBinMem bh writeStackFormat (hi_path <.> "stats") report -writeStackFormat :: FilePath -> Map.Map [String] Int -> IO () +writeStackFormat :: Show a => FilePath -> Map.Map [a] Int -> IO () writeStackFormat fp report = do let elems = Map.assocs report remove_bad = map (\c -> if c `elem` " ;" then '_' else c) withFile fp WriteMode $ \h -> do forM_ elems $ \(k, v) -> do - hPutStrLn h (intercalate ";" (map remove_bad (reverse k)) ++ " " ++ show v) + hPutStrLn h (intercalate ";" (map (remove_bad . show) (reverse k)) ++ " " ++ show v) -- | Put a piece of data with an initialised `UserData` field. This -- is necessary if you want to serialise Names or FastStrings. ===================================== compiler/GHC/Utils/Binary.hs ===================================== @@ -190,12 +190,18 @@ data BinHandle prof :: {-# UNPACK #-} !BinProf } -data BinProf = BinProf { stack :: ![String], report :: IORef (Map.Map [String] Int) } +data ProfKey = StringKey !String | TypeableKey !TypeRep deriving (Eq, Ord) -initBinProf = BinProf <$> pure ["TOP"] <*> newIORef (Map.empty) +instance Show ProfKey where + show (StringKey s) = s + show (TypeableKey tr) = show tr -addStack :: String -> BinProf -> BinProf -addStack s (BinProf ss i) = (BinProf (s:ss) i) +data BinProf = BinProf { stack :: ![ProfKey], report :: IORef (Map.Map [ProfKey] Int) } + +initBinProf = BinProf <$> pure [StringKey "TOP"] <*> newIORef (Map.empty) + +addStack :: TypeRep -> BinProf -> BinProf +addStack s (BinProf ss i) = (BinProf (TypeableKey s:ss) i) recordSample :: Int -> BinProf -> IO () recordSample weight (BinProf ss i) = modifyIORef i (Map.insertWith (+) ss weight) @@ -259,15 +265,15 @@ class Typeable a => Binary a where putNoStack bh a = do p <- tellBin bh; put_ bh a; return p put_ :: forall a . (Binary a, Typeable a) => BinHandle -> a -> IO () -put_ bh = withCC (show (typeRep (Proxy @a))) bh putNoStack_ +put_ bh = putNoStack_ (withCC ((typeRep (Proxy @a))) bh) -withCC :: String -> BinHandle -> (BinHandle -> k) -> k -withCC c bh k = - if c == head (stack (prof bh)) +withCC :: TypeRep -> BinHandle -> BinHandle +withCC c bh = + if TypeableKey c == head (stack (prof bh)) then - k bh + bh else - k (bh { prof = addStack c (prof bh) }) + (bh { prof = addStack c (prof bh) }) putAt :: Binary a => BinHandle -> Bin a -> a -> IO () putAt bh p x = do seekBin bh p; put_ bh x; return () @@ -312,7 +318,7 @@ writeBinMem (BinMem _ ix_r _ arr_r bp) fn = do unsafeWithForeignPtr arr $ \p -> hPutBuf h p ix hClose h -profileBinMem :: BinHandle -> IO (Map.Map [String] Int) +profileBinMem :: BinHandle -> IO (Map.Map [ProfKey] Int) profileBinMem (BinMem _ _ _ _ bp) = readIORef (report bp) readBinMem :: HasCallStack => FilePath -> IO BinHandle View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b9ce372a38510482910ea20bae04a153fc7a5892 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b9ce372a38510482910ea20bae04a153fc7a5892 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 15:44:11 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Mon, 18 Mar 2024 11:44:11 -0400 Subject: [Git][ghc/ghc][wip/T22859] 38 commits: base: Use strerror_r instead of strerror Message-ID: <65f8614b5ee97_320623c990af01242be@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: 2859a637 by Ben Gamari at 2024-03-08T18:26:47-05:00 base: Use strerror_r instead of strerror As noted by #24344, `strerror` is not necessarily thread-safe. Thankfully, POSIX.1-2001 has long offered `strerror_r`, which is safe to use. Fixes #24344. CLC discussion: https://github.com/haskell/core-libraries-committee/issues/249 - - - - - edb9bf77 by Jade at 2024-03-09T03:39:38-05:00 Error messages: Improve Error messages for Data constructors in type signatures. This patch improves the error messages from invalid type signatures by trying to guess what the user did and suggesting an appropriate fix. Partially fixes: #17879 - - - - - cfb197e3 by Patrick at 2024-03-09T03:40:15-05:00 HieAst: add module name #24493 The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst. It should fix #24493. The following have been done: 1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))` To store the located module name information. 2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information. 3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests. 4. accompanied submodule haddoc test update MR in https://gitlab.haskell.org/ghc/haddock/-/merge_requests/53 - - - - - 2341d81e by Vaibhav Sagar at 2024-03-09T03:40:54-05:00 GHC.Utils.Binary: fix a couple of typos - - - - - 5580e1bd by Ben Gamari at 2024-03-09T03:41:30-05:00 rts: Drop .wasm suffix from .prof file names This replicates the behavior on Windows, where `Hi.exe` will produce profiling output named `Hi.prof` instead of `Hi.exe.prof`. While in the area I also fixed the extension-stripping logic, which incorrectly rewrote `Hi.exefoo` to `Hi.foo`. Closes #24515. - - - - - 259495ee by Cheng Shao at 2024-03-09T03:41:30-05:00 testsuite: drop exe extension from .hp & .prof filenames See #24515 for details. - - - - - c477a8d2 by Ben Gamari at 2024-03-09T03:42:05-05:00 rts/linker: Enable GOT support on all platforms There is nothing platform-dependent about our GOT implementation and GOT support is needed by `T24171` on i386. - - - - - 2e592857 by Vladislav Zavialov at 2024-03-09T03:42:41-05:00 Drop outdated comment on TcRnIllformedTypePattern This should have been done in 0f0c53a501b but I missed it. - - - - - c554b4da by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Bounds check array write - - - - - 15c590a5 by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/CloneStack: Don't expose helper functions in header - - - - - e831ce31 by Ben Gamari at 2024-03-09T09:39:20-05:00 base: Move internals of GHC.InfoProv into GHC.InfoProv.Types Such that we can add new helpers into GHC.InfoProv.Types without breakage. - - - - - 6948e24d by Ben Gamari at 2024-03-09T09:39:20-05:00 rts: Lazily decode IPE tables Previously we would eagerly allocate `InfoTableEnt`s for each info table registered in the info table provenance map. However, this costs considerable memory and initialization time. Instead we now lazily decode these tables. This allows us to use one-third the memory *and* opens the door to taking advantage of sharing opportunities within a module. This required considerable reworking since lookupIPE now must be passed its result buffer. - - - - - 9204a04e by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Don't expose helper in header - - - - - 308926ff by Ben Gamari at 2024-03-09T09:39:20-05:00 rts/IPE: Share module_name within a Node This allows us to shave a 64-bit word off of the packed IPE entry size. - - - - - bebdea05 by Ben Gamari at 2024-03-09T09:39:20-05:00 IPE: Expose unit ID in InfoTableProv Here we add the unit ID to the info table provenance structure. - - - - - 6519c9ad by Ben Gamari at 2024-03-09T09:39:35-05:00 rts: Refactor GHC.Stack.CloneStack.decode Don't allocate a Ptr constructor per frame. - - - - - ed0b69dc by Ben Gamari at 2024-03-09T09:39:35-05:00 base: Do not expose whereFrom# from GHC.Exts - - - - - 2b1faea9 by Vladislav Zavialov at 2024-03-09T17:38:21-05:00 docs: Update info on TypeAbstractions * Mention TypeAbstractions in 9.10.1-notes.rst * Set the status to "Experimental". * Add a "Since: GHC 9.x" comment to each section. - - - - - f8b88918 by Ben Gamari at 2024-03-09T21:21:46-05:00 ci-images: Bump Alpine image to bootstrap with 9.8.2 - - - - - 705e6927 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark T24171 as fragile due to #24512 I will fix this but not in time for 9.10.1-alpha1 - - - - - c74196e1 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Mark linker_unload_native as fragile In particular this fails on platforms without `dlinfo`. I plan to address this but not before 9.10.1-alpha1. - - - - - f4d87f7a by Ben Gamari at 2024-03-09T21:21:46-05:00 configure: Bump version to 9.10 - - - - - 88df9a5f by Ben Gamari at 2024-03-09T21:21:46-05:00 Bump transformers submodule to 0.6.1.1 - - - - - 8176d5e8 by Ben Gamari at 2024-03-09T21:21:46-05:00 testsuite: Increase ulimit for T18623 1 MByte was just too tight and failed intermittently on some platforms (e.g. CentOS 7). Bumping the limit to 8 MByte should provide sufficient headroom. Fixes #23139. - - - - - c74b38a3 by Ben Gamari at 2024-03-09T21:21:46-05:00 base: Bump version to 4.20.0.0 - - - - - b2937fc3 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-internal: Set initial version at 9.1001.0 This provides PVP compliance while maintaining a clear correspondence between GHC releases and `ghc-internal` versions. - - - - - 4ae7d868 by Ben Gamari at 2024-03-09T21:21:46-05:00 ghc-prim: Bump version to 0.11.0 - - - - - 50798dc6 by Ben Gamari at 2024-03-09T21:21:46-05:00 template-haskell: Bump version to 2.22.0.0 - - - - - 8564f976 by Ben Gamari at 2024-03-09T21:21:46-05:00 base-exports: Accommodate spurious whitespace changes in 32-bit output It appears that this was - - - - - 9d4f0e98 by Ben Gamari at 2024-03-09T21:21:46-05:00 users-guide: Move exception backtrace relnotes to 9.10 This was previously mistakenly added to the GHC 9.8 release notes. - - - - - 145eae60 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix name of Rocky8 artifact - - - - - 39c2a630 by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/rel_eng: Fix path of generate_jobs_metadata - - - - - aed034de by Ben Gamari at 2024-03-09T21:21:46-05:00 gitlab/upload: Rework recompression The old `combine` approach was quite fragile due to use of filename globbing. Moreover, it didn't parallelize well. This refactoring makes the goal more obvious, parallelizes better, and is more robust. - - - - - dc207d06 by Ben Gamari at 2024-03-10T08:56:08-04:00 configure: Bump GHC version to 9.11 Bumps haddock submodule. - - - - - 8b2513e8 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload code when profiling is enabled The heap census may contain references (e.g. `Counter.identity`) to static data which must be available when the census is reported at the end of execution. Fixes #24512. - - - - - 7810b4c3 by Ben Gamari at 2024-03-11T01:20:03-04:00 rts/linker: Don't unload native objects when dlinfo isn't available To do so is unsafe as we have no way of identifying references to symbols provided by the object. Fixes #24513. Fixes #23993. - - - - - 0590764c by Ben Gamari at 2024-03-11T01:20:39-04:00 rel_eng/upload: Purge both $rel_name/ and $ver/ This is necessary for prereleases, where GHCup accesses the release via `$ver/` - - - - - 7f9cdce4 by Teo Camarasu at 2024-03-18T15:14:47+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 30 changed files: - .gitlab-ci.yml - .gitlab/rel_eng/default.nix - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/README.mkd - + .gitlab/rel_eng/recompress-all - .gitlab/rel_eng/upload.sh - compiler/GHC.hs - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/Errors/Ppr.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/InfoTableProv.hs - compiler/GHC/StgToCmm/Prim.hs - compiler/GHC/StgToJS/Prim.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Utils/Binary.hs - compiler/ghc.cabal.in - configure.ac - docs/users_guide/9.10.1-notes.rst - docs/users_guide/9.8.1-notes.rst - docs/users_guide/exts/type_abstractions.rst - ghc/ghc-bin.cabal.in The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ab9de86d91015e3675d26b75f5ad21250dcd852...7f9cdce47e6c30b40540cdb2d9c91bada4d187dd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ab9de86d91015e3675d26b75f5ad21250dcd852...7f9cdce47e6c30b40540cdb2d9c91bada4d187dd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 17:37:33 2024 From: gitlab at gitlab.haskell.org (Sven Tennie (@supersven)) Date: Mon, 18 Mar 2024 13:37:33 -0400 Subject: [Git][ghc/ghc][wip/supersven/riscv64-ncg] adjustor: Fence for generated code Message-ID: <65f87bdd14b50_3b76e5ef8968385cb@gitlab.mail> Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC Commits: c9f1189f by Sven Tennie at 2024-03-18T18:36:34+01:00 adjustor: Fence for generated code - - - - - 1 changed file: - rts/adjustor/LibffiAdjustor.c Changes: ===================================== rts/adjustor/LibffiAdjustor.c ===================================== @@ -187,5 +187,16 @@ createAdjustor (int cconv, barf("createAdjustor: failed to allocate memory"); } +#if defined(riscv64_HOST_ARCH) + // Synchronize the memory and instruction cache to prevent illegal + // instruction exceptions. fence.i works per hart. I'm not sure what happens + // when the generated code is called on another hart. Probably, the fence on + // read/write is good enough for that. However, if there are illegal + // instruction exceptions, this is the place to look at (maybe, that the + // fence.i needs to be moved closely before the call.) + asm volatile ("fence rw, rw" : : : "memory"); + asm volatile ("fence.i" ::: "memory"); +#endif + return (void*)code; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c9f1189f524bd1b19bb4410082e2b669155dec67 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c9f1189f524bd1b19bb4410082e2b669155dec67 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 17:53:43 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Mon, 18 Mar 2024 13:53:43 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/andreask/shortcut_bug Message-ID: <65f87fa71d0fd_3b76e514ae02440525@gitlab.mail> Andreas Klebinger pushed new branch wip/andreask/shortcut_bug at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/andreask/shortcut_bug You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 17:54:27 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Mon, 18 Mar 2024 13:54:27 -0400 Subject: [Git][ghc/ghc][wip/andreask/shortcut_bug] NCG: Fix a bug in jump shortcutting. Message-ID: <65f87fd3c2fe6_3b76e5163247c407e7@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/shortcut_bug at Glasgow Haskell Compiler / GHC Commits: 0134d5aa by Andreas Klebinger at 2024-03-18T18:40:10+01:00 NCG: Fix a bug in jump shortcutting. When checking if a jump has more than one destination account for the possibility of some jumps not being representable by a BlockId. We do so by having isJumpishInstr return a `Maybe BlockId` where Nothing represents non-BlockId jump destinations. Fixes #24507 - - - - - 8 changed files: - compiler/GHC/CmmToAsm/AArch64/Instr.hs - compiler/GHC/CmmToAsm/BlockLayout.hs - compiler/GHC/CmmToAsm/Instr.hs - compiler/GHC/CmmToAsm/PPC/Instr.hs - compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs - compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs - compiler/GHC/CmmToAsm/Reg/Liveness.hs - compiler/GHC/CmmToAsm/X86/Instr.hs Changes: ===================================== compiler/GHC/CmmToAsm/AArch64/Instr.hs ===================================== @@ -301,14 +301,14 @@ isJumpishInstr instr = case instr of -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr (ANN _ i) = jumpDestsOfInstr i -jumpDestsOfInstr (CBZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (CBNZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (J t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (B t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (BL t _ _) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (BCOND _ t) = [ id | TBlock id <- [t]] +jumpDestsOfInstr (CBZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (CBNZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (J t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (B t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (BL t _ _) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (BCOND _ t) = [ Just id | TBlock id <- [t]] jumpDestsOfInstr _ = [] -- | Change the destination of this jump instruction. ===================================== compiler/GHC/CmmToAsm/BlockLayout.hs ===================================== @@ -771,7 +771,7 @@ dropJumps :: forall a i. Instruction i => LabelMap a -> [GenBasicBlock i] dropJumps _ [] = [] dropJumps info (BasicBlock lbl ins:todo) | Just ins <- nonEmpty ins --This can happen because of shortcutting - , [dest] <- jumpDestsOfInstr (NE.last ins) + , [Just dest] <- jumpDestsOfInstr (NE.last ins) , BasicBlock nextLbl _ : _ <- todo , not (mapMember dest info) , nextLbl == dest @@ -870,7 +870,7 @@ mkNode edgeWeights block@(BasicBlock id instrs) = | length successors > 2 || edgeWeight info <= 0 -> [] | otherwise -> [target] | Just instr <- lastMaybe instrs - , [one] <- jumpDestsOfInstr instr + , [one] <- jumpBlockDestsOfInstr instr = [one] | otherwise = [] ===================================== compiler/GHC/CmmToAsm/Instr.hs ===================================== @@ -17,6 +17,8 @@ import GHC.Cmm.BlockId import GHC.CmmToAsm.Config import GHC.Data.FastString +import Data.Maybe (catMaybes) + -- | Holds a list of source and destination registers used by a -- particular instruction. -- @@ -73,9 +75,17 @@ class Instruction instr where -- | Give the possible destinations of this jump instruction. -- Must be defined for all jumpish instructions. + -- Returns Nothing for non BlockId destinations. jumpDestsOfInstr + :: instr -> [Maybe BlockId] + + -- | Give the possible block destinations of this jump instruction. + -- Must be defined for all jumpish instructions. + jumpBlockDestsOfInstr :: instr -> [BlockId] + jumpBlockDestsOfInstr = catMaybes . jumpDestsOfInstr + -- | Change the destination of this jump instruction. -- Used in the linear allocator when adding fixup blocks for join ===================================== compiler/GHC/CmmToAsm/PPC/Instr.hs ===================================== @@ -513,12 +513,12 @@ isJumpishInstr instr -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - BCC _ id _ -> [id] - BCCFAR _ id _ -> [id] - BCTR targets _ _ -> [id | Just id <- targets] + BCC _ id _ -> [Just id] + BCCFAR _ id _ -> [Just id] + BCTR targets _ _ -> [Just id | Just id <- targets] _ -> [] ===================================== compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs ===================================== @@ -207,7 +207,7 @@ cleanForward platform blockId assoc acc (li : instrs) -- Remember the association over a jump. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accJumpValid assoc) targets cleanForward platform blockId assoc (li : acc) instrs @@ -386,7 +386,7 @@ cleanBackward' liveSlotsOnEntry reloadedBy noReloads acc (li : instrs) -- it always does, but if those reloads are cleaned the slot -- liveness map doesn't get updated. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr = do let slotsReloadedByTargets = IntSet.unions ===================================== compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs ===================================== @@ -57,7 +57,7 @@ joinToTargets block_live id instr = return ([], instr) | otherwise - = joinToTargets' block_live [] id instr (jumpDestsOfInstr instr) + = joinToTargets' block_live [] id instr (jumpBlockDestsOfInstr instr) ----- joinToTargets' ===================================== compiler/GHC/CmmToAsm/Reg/Liveness.hs ===================================== @@ -468,7 +468,7 @@ slurpReloadCoalesce live -- if we hit a jump, remember the current slotMap | LiveInstr (Instr instr) _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accSlotMap slotMap) targets return (slotMap, Nothing) @@ -760,7 +760,7 @@ sccBlocks blocks entries mcfg = map (fmap node_payload) sccs sccs = stronglyConnCompG g2 getOutEdges :: Instruction instr => [instr] -> [BlockId] - getOutEdges instrs = concatMap jumpDestsOfInstr instrs + getOutEdges instrs = concatMap jumpBlockDestsOfInstr instrs -- This is truly ugly, but I don't see a good alternative. -- Digraph just has the wrong API. We want to identify nodes @@ -837,7 +837,7 @@ checkIsReverseDependent sccs' slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets - $ map (mkUniqSet . jumpDestsOfInstr) + $ map (mkUniqSet . jumpBlockDestsOfInstr) [ i | LiveInstr i _ <- instrs] @@ -1047,7 +1047,7 @@ liveness1 platform liveregs blockmap (LiveInstr instr _) -- union in the live regs from all the jump destinations of this -- instruction. - targets = jumpDestsOfInstr instr -- where we go from here + targets = jumpBlockDestsOfInstr instr -- where we go from here not_a_branch = null targets targetLiveRegs target ===================================== compiler/GHC/CmmToAsm/X86/Instr.hs ===================================== @@ -672,12 +672,12 @@ isJumpishInstr instr jumpDestsOfInstr :: Instr - -> [BlockId] + -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - JXX _ id -> [id] - JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] + JXX _ id -> [Just id] + JMP_TBL _ ids _ _ -> [Just id | Just (DestBlockId id) <- ids] _ -> [] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0134d5aa841287d8ee3813ee07cefdeb1dafe6cc -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0134d5aa841287d8ee3813ee07cefdeb1dafe6cc You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 17:59:54 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Mon, 18 Mar 2024 13:59:54 -0400 Subject: [Git][ghc/ghc][wip/andreask/shortcut_bug] NCG: Fix a bug in jump shortcutting. Message-ID: <65f8811a5f472_3b76e51bb4e4042566@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/shortcut_bug at Glasgow Haskell Compiler / GHC Commits: 09d7049b by Andreas Klebinger at 2024-03-18T18:45:43+01:00 NCG: Fix a bug in jump shortcutting. When checking if a jump has more than one destination account for the possibility of some jumps not being representable by a BlockId. We do so by having isJumpishInstr return a `Maybe BlockId` where Nothing represents non-BlockId jump destinations. Fixes #24507 - - - - - 8 changed files: - compiler/GHC/CmmToAsm/AArch64/Instr.hs - compiler/GHC/CmmToAsm/BlockLayout.hs - compiler/GHC/CmmToAsm/Instr.hs - compiler/GHC/CmmToAsm/PPC/Instr.hs - compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs - compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs - compiler/GHC/CmmToAsm/Reg/Liveness.hs - compiler/GHC/CmmToAsm/X86/Instr.hs Changes: ===================================== compiler/GHC/CmmToAsm/AArch64/Instr.hs ===================================== @@ -301,14 +301,14 @@ isJumpishInstr instr = case instr of -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr (ANN _ i) = jumpDestsOfInstr i -jumpDestsOfInstr (CBZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (CBNZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (J t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (B t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (BL t _ _) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (BCOND _ t) = [ id | TBlock id <- [t]] +jumpDestsOfInstr (CBZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (CBNZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (J t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (B t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (BL t _ _) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (BCOND _ t) = [ Just id | TBlock id <- [t]] jumpDestsOfInstr _ = [] -- | Change the destination of this jump instruction. ===================================== compiler/GHC/CmmToAsm/BlockLayout.hs ===================================== @@ -771,7 +771,7 @@ dropJumps :: forall a i. Instruction i => LabelMap a -> [GenBasicBlock i] dropJumps _ [] = [] dropJumps info (BasicBlock lbl ins:todo) | Just ins <- nonEmpty ins --This can happen because of shortcutting - , [dest] <- jumpDestsOfInstr (NE.last ins) + , [Just dest] <- jumpDestsOfInstr (NE.last ins) , BasicBlock nextLbl _ : _ <- todo , not (mapMember dest info) , nextLbl == dest @@ -870,7 +870,7 @@ mkNode edgeWeights block@(BasicBlock id instrs) = | length successors > 2 || edgeWeight info <= 0 -> [] | otherwise -> [target] | Just instr <- lastMaybe instrs - , [one] <- jumpDestsOfInstr instr + , [one] <- jumpBlockDestsOfInstr instr = [one] | otherwise = [] ===================================== compiler/GHC/CmmToAsm/Instr.hs ===================================== @@ -17,6 +17,8 @@ import GHC.Cmm.BlockId import GHC.CmmToAsm.Config import GHC.Data.FastString +import Data.Maybe (catMaybes) + -- | Holds a list of source and destination registers used by a -- particular instruction. -- @@ -73,9 +75,17 @@ class Instruction instr where -- | Give the possible destinations of this jump instruction. -- Must be defined for all jumpish instructions. + -- Returns Nothing for non BlockId destinations. jumpDestsOfInstr + :: instr -> [Maybe BlockId] + + -- | Give the possible block destinations of this jump instruction. + -- Must be defined for all jumpish instructions. + jumpBlockDestsOfInstr :: instr -> [BlockId] + jumpBlockDestsOfInstr = catMaybes . jumpDestsOfInstr + -- | Change the destination of this jump instruction. -- Used in the linear allocator when adding fixup blocks for join ===================================== compiler/GHC/CmmToAsm/PPC/Instr.hs ===================================== @@ -513,12 +513,12 @@ isJumpishInstr instr -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - BCC _ id _ -> [id] - BCCFAR _ id _ -> [id] - BCTR targets _ _ -> [id | Just id <- targets] + BCC _ id _ -> [Just id] + BCCFAR _ id _ -> [Just id] + BCTR targets _ _ -> [Just id | Just id <- targets] _ -> [] ===================================== compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs ===================================== @@ -207,7 +207,7 @@ cleanForward platform blockId assoc acc (li : instrs) -- Remember the association over a jump. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accJumpValid assoc) targets cleanForward platform blockId assoc (li : acc) instrs @@ -386,7 +386,7 @@ cleanBackward' liveSlotsOnEntry reloadedBy noReloads acc (li : instrs) -- it always does, but if those reloads are cleaned the slot -- liveness map doesn't get updated. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr = do let slotsReloadedByTargets = IntSet.unions ===================================== compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs ===================================== @@ -57,7 +57,7 @@ joinToTargets block_live id instr = return ([], instr) | otherwise - = joinToTargets' block_live [] id instr (jumpDestsOfInstr instr) + = joinToTargets' block_live [] id instr (jumpBlockDestsOfInstr instr) ----- joinToTargets' ===================================== compiler/GHC/CmmToAsm/Reg/Liveness.hs ===================================== @@ -468,7 +468,7 @@ slurpReloadCoalesce live -- if we hit a jump, remember the current slotMap | LiveInstr (Instr instr) _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accSlotMap slotMap) targets return (slotMap, Nothing) @@ -760,7 +760,7 @@ sccBlocks blocks entries mcfg = map (fmap node_payload) sccs sccs = stronglyConnCompG g2 getOutEdges :: Instruction instr => [instr] -> [BlockId] - getOutEdges instrs = concatMap jumpDestsOfInstr instrs + getOutEdges instrs = concatMap jumpBlockDestsOfInstr instrs -- This is truly ugly, but I don't see a good alternative. -- Digraph just has the wrong API. We want to identify nodes @@ -837,7 +837,7 @@ checkIsReverseDependent sccs' slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets - $ map (mkUniqSet . jumpDestsOfInstr) + $ map (mkUniqSet . jumpBlockDestsOfInstr) [ i | LiveInstr i _ <- instrs] @@ -1047,7 +1047,7 @@ liveness1 platform liveregs blockmap (LiveInstr instr _) -- union in the live regs from all the jump destinations of this -- instruction. - targets = jumpDestsOfInstr instr -- where we go from here + targets = jumpBlockDestsOfInstr instr -- where we go from here not_a_branch = null targets targetLiveRegs target ===================================== compiler/GHC/CmmToAsm/X86/Instr.hs ===================================== @@ -672,13 +672,16 @@ isJumpishInstr instr jumpDestsOfInstr :: Instr - -> [BlockId] + -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - JXX _ id -> [id] - JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] + JXX _ id -> [Just id] + JMP_TBL _ ids _ _ -> [Just (mkDest dest) | Just dest <- ids] _ -> [] + where + mkDest (DestBlockId id) = Just id + mkDest _ = Nothing patchJumpInstr View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/09d7049b442caad786b42786b9d518c24401fe83 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/09d7049b442caad786b42786b9d518c24401fe83 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 18:16:53 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Mon, 18 Mar 2024 14:16:53 -0400 Subject: [Git][ghc/ghc][wip/andreask/shortcut_bug] NCG: Fix a bug in jump shortcutting. Message-ID: <65f88515c96d8_3b76e51f7dd88430de@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/shortcut_bug at Glasgow Haskell Compiler / GHC Commits: 8a28bdc1 by Andreas Klebinger at 2024-03-18T19:02:42+01:00 NCG: Fix a bug in jump shortcutting. When checking if a jump has more than one destination account for the possibility of some jumps not being representable by a BlockId. We do so by having isJumpishInstr return a `Maybe BlockId` where Nothing represents non-BlockId jump destinations. Fixes #24507 - - - - - 8 changed files: - compiler/GHC/CmmToAsm/AArch64/Instr.hs - compiler/GHC/CmmToAsm/BlockLayout.hs - compiler/GHC/CmmToAsm/Instr.hs - compiler/GHC/CmmToAsm/PPC/Instr.hs - compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs - compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs - compiler/GHC/CmmToAsm/Reg/Liveness.hs - compiler/GHC/CmmToAsm/X86/Instr.hs Changes: ===================================== compiler/GHC/CmmToAsm/AArch64/Instr.hs ===================================== @@ -301,14 +301,14 @@ isJumpishInstr instr = case instr of -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr (ANN _ i) = jumpDestsOfInstr i -jumpDestsOfInstr (CBZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (CBNZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (J t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (B t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (BL t _ _) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (BCOND _ t) = [ id | TBlock id <- [t]] +jumpDestsOfInstr (CBZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (CBNZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (J t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (B t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (BL t _ _) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (BCOND _ t) = [ Just id | TBlock id <- [t]] jumpDestsOfInstr _ = [] -- | Change the destination of this jump instruction. ===================================== compiler/GHC/CmmToAsm/BlockLayout.hs ===================================== @@ -771,7 +771,7 @@ dropJumps :: forall a i. Instruction i => LabelMap a -> [GenBasicBlock i] dropJumps _ [] = [] dropJumps info (BasicBlock lbl ins:todo) | Just ins <- nonEmpty ins --This can happen because of shortcutting - , [dest] <- jumpDestsOfInstr (NE.last ins) + , [Just dest] <- jumpDestsOfInstr (NE.last ins) , BasicBlock nextLbl _ : _ <- todo , not (mapMember dest info) , nextLbl == dest @@ -870,7 +870,7 @@ mkNode edgeWeights block@(BasicBlock id instrs) = | length successors > 2 || edgeWeight info <= 0 -> [] | otherwise -> [target] | Just instr <- lastMaybe instrs - , [one] <- jumpDestsOfInstr instr + , [one] <- jumpBlockDestsOfInstr instr = [one] | otherwise = [] ===================================== compiler/GHC/CmmToAsm/Instr.hs ===================================== @@ -17,6 +17,8 @@ import GHC.Cmm.BlockId import GHC.CmmToAsm.Config import GHC.Data.FastString +import Data.Maybe (catMaybes) + -- | Holds a list of source and destination registers used by a -- particular instruction. -- @@ -73,9 +75,17 @@ class Instruction instr where -- | Give the possible destinations of this jump instruction. -- Must be defined for all jumpish instructions. + -- Returns Nothing for non BlockId destinations. jumpDestsOfInstr + :: instr -> [Maybe BlockId] + + -- | Give the possible block destinations of this jump instruction. + -- Must be defined for all jumpish instructions. + jumpBlockDestsOfInstr :: instr -> [BlockId] + jumpBlockDestsOfInstr = catMaybes . jumpDestsOfInstr + -- | Change the destination of this jump instruction. -- Used in the linear allocator when adding fixup blocks for join ===================================== compiler/GHC/CmmToAsm/PPC/Instr.hs ===================================== @@ -513,12 +513,12 @@ isJumpishInstr instr -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - BCC _ id _ -> [id] - BCCFAR _ id _ -> [id] - BCTR targets _ _ -> [id | Just id <- targets] + BCC _ id _ -> [Just id] + BCCFAR _ id _ -> [Just id] + BCTR targets _ _ -> [Just id | Just id <- targets] _ -> [] ===================================== compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs ===================================== @@ -207,7 +207,7 @@ cleanForward platform blockId assoc acc (li : instrs) -- Remember the association over a jump. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accJumpValid assoc) targets cleanForward platform blockId assoc (li : acc) instrs @@ -386,7 +386,7 @@ cleanBackward' liveSlotsOnEntry reloadedBy noReloads acc (li : instrs) -- it always does, but if those reloads are cleaned the slot -- liveness map doesn't get updated. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr = do let slotsReloadedByTargets = IntSet.unions ===================================== compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs ===================================== @@ -57,7 +57,7 @@ joinToTargets block_live id instr = return ([], instr) | otherwise - = joinToTargets' block_live [] id instr (jumpDestsOfInstr instr) + = joinToTargets' block_live [] id instr (jumpBlockDestsOfInstr instr) ----- joinToTargets' ===================================== compiler/GHC/CmmToAsm/Reg/Liveness.hs ===================================== @@ -468,7 +468,7 @@ slurpReloadCoalesce live -- if we hit a jump, remember the current slotMap | LiveInstr (Instr instr) _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accSlotMap slotMap) targets return (slotMap, Nothing) @@ -760,7 +760,7 @@ sccBlocks blocks entries mcfg = map (fmap node_payload) sccs sccs = stronglyConnCompG g2 getOutEdges :: Instruction instr => [instr] -> [BlockId] - getOutEdges instrs = concatMap jumpDestsOfInstr instrs + getOutEdges instrs = concatMap jumpBlockDestsOfInstr instrs -- This is truly ugly, but I don't see a good alternative. -- Digraph just has the wrong API. We want to identify nodes @@ -837,7 +837,7 @@ checkIsReverseDependent sccs' slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets - $ map (mkUniqSet . jumpDestsOfInstr) + $ map (mkUniqSet . jumpBlockDestsOfInstr) [ i | LiveInstr i _ <- instrs] @@ -1047,7 +1047,7 @@ liveness1 platform liveregs blockmap (LiveInstr instr _) -- union in the live regs from all the jump destinations of this -- instruction. - targets = jumpDestsOfInstr instr -- where we go from here + targets = jumpBlockDestsOfInstr instr -- where we go from here not_a_branch = null targets targetLiveRegs target ===================================== compiler/GHC/CmmToAsm/X86/Instr.hs ===================================== @@ -672,13 +672,16 @@ isJumpishInstr instr jumpDestsOfInstr :: Instr - -> [BlockId] + -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - JXX _ id -> [id] - JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] + JXX _ id -> [Just id] + JMP_TBL _ ids _ _ -> [(mkDest dest) | Just dest <- ids] _ -> [] + where + mkDest (DestBlockId id) = Just id + mkDest _ = Nothing patchJumpInstr View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8a28bdc178ff3828d93c491e0270d4b1d17959dc -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8a28bdc178ff3828d93c491e0270d4b1d17959dc You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 18:46:42 2024 From: gitlab at gitlab.haskell.org (Apoorv Ingle (@ani)) Date: Mon, 18 Mar 2024 14:46:42 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/T24552 Message-ID: <65f88c12aa7af_3b76e52d92dec45743@gitlab.mail> Apoorv Ingle pushed new branch wip/T24552 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24552 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 19:41:53 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 18 Mar 2024 15:41:53 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f899012949b_3b76e54a299b060583@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 57c490e6 by Fendor at 2024-03-18T15:41:43-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 7d88de7d by Alan Zimmerman at 2024-03-18T15:41:44-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 6 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/47b06a3a877222c316ece5e279bf7c4b39aa9529...7d88de7d87ea424d1142ab6cae8658c6f676e057 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/47b06a3a877222c316ece5e279bf7c4b39aa9529...7d88de7d87ea424d1142ab6cae8658c6f676e057 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 22:03:45 2024 From: gitlab at gitlab.haskell.org (Apoorv Ingle (@ani)) Date: Mon, 18 Mar 2024 18:03:45 -0400 Subject: [Git][ghc/ghc][wip/T24552] Fix for #24552 (see testcase T24552) Message-ID: <65f8ba4155216_3b76e585896187527d@gitlab.mail> Apoorv Ingle pushed to branch wip/T24552 at Glasgow Haskell Compiler / GHC Commits: 33e5ce45 by Apoorv Ingle at 2024-03-18T16:59:51-05:00 Fix for #24552 (see testcase T24552) Fixes for a bug in desugaring pattern synonyms matches. It now matches the expected semantics. The desugaring for match via `matchWrapper` was overly complex (and wrong) which was introduced while working on expanding `do`-blocks (#18324) - - - - - 4 changed files: - compiler/GHC/HsToCore/Match.hs - + testsuite/tests/patsyn/should_run/T24552.hs - + testsuite/tests/patsyn/should_run/T24552.stdout - testsuite/tests/patsyn/should_run/all.T Changes: ===================================== compiler/GHC/HsToCore/Match.hs ===================================== @@ -29,7 +29,7 @@ import Language.Haskell.Syntax.Basic (Boxity(..)) import {-#SOURCE#-} GHC.HsToCore.Expr (dsExpr) -import GHC.Types.Basic ( Origin(..), requiresPMC, isDoExpansionGenerated ) +import GHC.Types.Basic ( Origin(..), requiresPMC ) import GHC.Types.SourceText ( FractionalLit, @@ -765,20 +765,11 @@ one pattern, and match simply only accepts one pattern. JJQC 30-Nov-1997 -} -matchWrapper ctxt scrs (MG { mg_alts = L _ matches' +matchWrapper ctxt scrs (MG { mg_alts = L _ matches , mg_ext = MatchGroupTc arg_tys rhs_ty origin }) = do { dflags <- getDynFlags ; locn <- getSrcSpanDs - ; let matches - = if any (is_pat_syn_match origin) matches' - then filter (non_gen_wc origin) matches' - -- filter out the wild pattern fail alternatives - -- which have a do expansion origin - -- They generate spurious overlapping warnings - -- Due to pattern synonyms treated as refutable patterns - -- See Part 1's Wrinkle 1 in Note [Expanding HsDo with XXExprGhcRn] in GHC.Tc.Gen.Do - else matches' ; new_vars <- case matches of [] -> newSysLocalsDs arg_tys (m:_) -> @@ -843,16 +834,6 @@ matchWrapper ctxt scrs (MG { mg_alts = L _ matches' $ NEL.nonEmpty $ replicate (length (grhssGRHSs m)) ldi_nablas - is_pat_syn_match :: Origin -> LMatch GhcTc (LHsExpr GhcTc) -> Bool - is_pat_syn_match origin (L _ (Match _ _ [L _ (VisPat _ l_pat)] _)) | isDoExpansionGenerated origin - = isPatSyn l_pat - is_pat_syn_match _ _ = False - -- generated match pattern that is not a wildcard - non_gen_wc :: Origin -> LMatch GhcTc (LHsExpr GhcTc) -> Bool - non_gen_wc origin (L _ (Match _ _ ([L _ (VisPat _ (L _ (WildPat _)))]) _)) - = not . isDoExpansionGenerated $ origin - non_gen_wc _ _ = True - {- Note [Long-distance information in matchWrapper] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The pattern match checking in matchWrapper is done conditionally, depending ===================================== testsuite/tests/patsyn/should_run/T24552.hs ===================================== @@ -0,0 +1,16 @@ +{-# language PatternSynonyms #-} + +module Main where + +import Prelude hiding (Maybe, Nothing,Just) +import qualified Prelude as P + +data Maybe a = Nothing_ | Just_ a + +pattern Nothing :: Maybe a +pattern Nothing <- Nothing_ where Nothing = Nothing_ + +pattern Just :: a -> Maybe a +pattern Just x <- Just_ x where Just = Just_ + +main = print $ do Just x <- [Nothing, Just ()] ; return x ===================================== testsuite/tests/patsyn/should_run/T24552.stdout ===================================== @@ -0,0 +1 @@ +[()] ===================================== testsuite/tests/patsyn/should_run/all.T ===================================== @@ -17,3 +17,4 @@ test('T11224', normal, compile_and_run, ['-Wincomplete-patterns -Woverlapping-pa test('T13688', req_th, multimod_compile_and_run, ['T13688', '-v0']) test('T14228', normal, compile_and_run, ['']) test('records-poly-update', normal, compile_and_run, ['']) +test('T24552', normal, compile_and_run, ['']) \ No newline at end of file View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/33e5ce45e3b3342b93deeade11c1759c387664b6 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/33e5ce45e3b3342b93deeade11c1759c387664b6 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Mon Mar 18 23:02:36 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 18 Mar 2024 19:02:36 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f8c80c11f75_3b76e59fd40e08538b@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: e882d9ca by Fendor at 2024-03-18T19:02:24-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 289acbf8 by Alan Zimmerman at 2024-03-18T19:02:24-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 6 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7d88de7d87ea424d1142ab6cae8658c6f676e057...289acbf8bfda82f9e0f25403540facb21f0b8041 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7d88de7d87ea424d1142ab6cae8658c6f676e057...289acbf8bfda82f9e0f25403540facb21f0b8041 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 02:32:58 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Mon, 18 Mar 2024 22:32:58 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f8f95aced03_1c1d4940a2c20305e1@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 8f4e883d by Fendor at 2024-03-18T22:32:43-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - fb64a428 by Alan Zimmerman at 2024-03-18T22:32:44-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 6 changed files: - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/289acbf8bfda82f9e0f25403540facb21f0b8041...fb64a4282009f5707290d4d5c04a818b542467a3 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/289acbf8bfda82f9e0f25403540facb21f0b8041...fb64a4282009f5707290d4d5c04a818b542467a3 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 05:43:19 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 19 Mar 2024 01:43:19 -0400 Subject: [Git][ghc/ghc][master] Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f925f7bffc2_1c1d4993bb5104614b@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 73be65ab by Fendor at 2024-03-19T01:42:53-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - 1 changed file: - compiler/GHC/Iface/Type.hs Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73be65abafcd4db8e3913415ec866f6e89881f22 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73be65abafcd4db8e3913415ec866f6e89881f22 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 05:44:06 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 19 Mar 2024 01:44:06 -0400 Subject: [Git][ghc/ghc][master] EPA: Address more 9.10.1-alpha1 regressions from recent changes Message-ID: <65f926263b93e_1c1d499551f3c511ea@gitlab.mail> Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: bd8209eb by Alan Zimmerman at 2024-03-19T01:43:28-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - 5 changed files: - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout Changes: ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bd8209eb8e447a5ae1d736f034f4a3986e0727f7 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bd8209eb8e447a5ae1d736f034f4a3986e0727f7 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 09:18:01 2024 From: gitlab at gitlab.haskell.org (Hannes Siebenhandl (@fendor)) Date: Tue, 19 Mar 2024 05:18:01 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/binary-iaarg-instance Message-ID: <65f95849968a4_1c1d49f50cb5c68614@gitlab.mail> Hannes Siebenhandl pushed new branch wip/binary-iaarg-instance at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/binary-iaarg-instance You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 09:39:47 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Tue, 19 Mar 2024 05:39:47 -0400 Subject: [Git][ghc/ghc][wip/T22859] 9 commits: Remove duplicate code normalising slashes Message-ID: <65f95d6332fe3_2621dcae48cc10124@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: b85a4631 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Remove duplicate code normalising slashes - - - - - c91946f9 by Brandon Chinn at 2024-03-12T19:25:56-04:00 Simplify regexes with raw strings - - - - - 1a5f53c6 by Brandon Chinn at 2024-03-12T19:25:57-04:00 Don't normalize backslashes in characters - - - - - 7ea971d3 by Andrei Borzenkov at 2024-03-12T19:26:32-04:00 Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470) - - - - - 39f3ac3e by Cheng Shao at 2024-03-12T19:27:11-04:00 Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms" This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was originally intended to fix #24449, but it was merely sweeping the bug under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly fixed the fragile test, and we no longer need the C version of genSym. Furthermore, the C implementation causes trouble when compiling with clang that targets i386 due to alignment warning and libatomic linking issue, so it makes sense to revert it. - - - - - e6bfb85c by Cheng Shao at 2024-03-12T19:27:11-04:00 compiler: fix out-of-bound memory access of genSym on 32-bit This commit fixes an unnoticed out-of-bound memory access of genSym on 32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms, but we mistakenly treat it as a Word64 pointer in genSym, and therefore will accidentally load 2 garbage higher bytes, or with a small but non-zero chance, overwrite something else in the data section depends on how the linker places the data segments. This regression was introduced in !11802 and fixed here. - - - - - 77171cd1 by Ben Orchard at 2024-03-14T09:00:40-04:00 Note mutability of array and address access primops Without an understanding of immutable vs. mutable memory, the index primop family have a potentially non-intuitive type signature: indexOffAddr :: Addr# -> Int# -> a readOffAddr :: Addr# -> Int# -> State# d -> (# State# d, a #) indexOffAddr# might seem like a free generality improvement, which it certainly is not! This change adds a brief note on mutability expectations for most index/read/write access primops. - - - - - 7da7f8f6 by Alan Zimmerman at 2024-03-14T09:01:15-04:00 EPA: Fix regression discarding comments in contexts Closes #24533 - - - - - d0f2d5c5 by Teo Camarasu at 2024-03-19T09:39:34+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 30 changed files: - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/StgToCmm/Prim.hs - compiler/GHC/StgToJS/Prim.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Unique/Supply.hs - compiler/cbits/genSym.c - libraries/ghc-experimental/ghc-experimental.cabal - + libraries/ghc-experimental/src/System/Mem/Experimental.hs - libraries/ghc-internal/ghc-internal.cabal - + libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs - rts/Prelude.h - rts/PrimOps.cmm - rts/RtsSymbols.c - rts/Schedule.c - rts/external-symbols.list.in - rts/include/rts/storage/GC.h - rts/include/rts/storage/TSO.h - rts/include/stg/MiscClosures.h - testsuite/driver/testlib.py - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/parser/should_fail/T21843a.stderr - testsuite/tests/parser/should_fail/T21843b.stderr - testsuite/tests/parser/should_fail/T21843c.stderr - testsuite/tests/parser/should_fail/T21843d.stderr - testsuite/tests/parser/should_fail/T21843e.stderr - testsuite/tests/parser/should_fail/T21843f.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7f9cdce47e6c30b40540cdb2d9c91bada4d187dd...d0f2d5c51b2d05d98c330eac8bcbccaf54a33956 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7f9cdce47e6c30b40540cdb2d9c91bada4d187dd...d0f2d5c51b2d05d98c330eac8bcbccaf54a33956 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 09:47:39 2024 From: gitlab at gitlab.haskell.org (Rodrigo Mesquita (@alt-romes)) Date: Tue, 19 Mar 2024 05:47:39 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/romes/rts-linker-direct-symbol-lookup Message-ID: <65f95f3b97466_2621dcc20bc81036de@gitlab.mail> Rodrigo Mesquita pushed new branch wip/romes/rts-linker-direct-symbol-lookup at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/romes/rts-linker-direct-symbol-lookup You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 10:26:37 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Tue, 19 Mar 2024 06:26:37 -0400 Subject: [Git][ghc/ghc][wip/T22859] Implement user-defined allocation limit handlers Message-ID: <65f9685d2d1e3_2621dc1ccc24c1060c2@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: 52b27a8c by Teo Camarasu at 2024-03-19T10:26:23+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 16 changed files: - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/StgToCmm/Prim.hs - compiler/GHC/StgToJS/Prim.hs - libraries/ghc-experimental/ghc-experimental.cabal - + libraries/ghc-experimental/src/System/Mem/Experimental.hs - libraries/ghc-internal/ghc-internal.cabal - + libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs - rts/Prelude.h - rts/PrimOps.cmm - rts/RtsSymbols.c - rts/Schedule.c - rts/external-symbols.list.in - rts/include/rts/storage/GC.h - rts/include/rts/storage/TSO.h - rts/include/stg/MiscClosures.h - testsuite/tests/interface-stability/ghc-experimental-exports.stdout Changes: ===================================== compiler/GHC/Builtin/primops.txt.pp ===================================== @@ -3952,6 +3952,15 @@ primop SetThreadAllocationCounter "setThreadAllocationCounter#" GenPrimOp effect = ReadWriteEffect out_of_line = True +primop SetOtherThreadAllocationCounter "setOtherThreadAllocationCounter#" GenPrimOp + Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld + { Sets the allocation counter for the another thread to the given value. + This doesn't take allocations into the current nursery chunk into account. + Therefore it is only accurate if the other thread is not currently running. } + with + effect = ReadWriteEffect + out_of_line = True + primtype StackSnapshot# { Haskell representation of a @StgStack*@ that was created (cloned) with a function in "GHC.Stack.CloneStack". Please check the ===================================== compiler/GHC/StgToCmm/Prim.hs ===================================== @@ -1746,6 +1746,7 @@ emitPrimOp cfg primop = TraceEventBinaryOp -> alwaysExternal TraceMarkerOp -> alwaysExternal SetThreadAllocationCounter -> alwaysExternal + SetOtherThreadAllocationCounter -> alwaysExternal KeepAliveOp -> alwaysExternal CastWord32ToFloatOp -> alwaysExternal CastWord64ToDoubleOp -> alwaysExternal ===================================== compiler/GHC/StgToJS/Prim.hs ===================================== @@ -1167,6 +1167,7 @@ genPrim prof bound ty op = case op of WhereFromOp -> unhandledPrimop op -- should be easily implementable with o.f.n SetThreadAllocationCounter -> unhandledPrimop op + SetOtherThreadAllocationCounter -> unhandledPrimop op ------------------------------- Vector ----------------------------------------- -- For now, vectors are unsupported on the JS backend. Simply put, they do not ===================================== libraries/ghc-experimental/ghc-experimental.cabal ===================================== @@ -27,6 +27,7 @@ library Data.Tuple.Experimental Data.Sum.Experimental Prelude.Experimental + System.Mem.Experimental if arch(wasm32) exposed-modules: GHC.Wasm.Prim other-extensions: ===================================== libraries/ghc-experimental/src/System/Mem/Experimental.hs ===================================== @@ -0,0 +1,10 @@ +module System.Mem.Experimental + ( setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + , getAllocationCounterFor + , setAllocationCounterFor + , enableAllocationLimitFor + , disableAllocationLimitFor + ) + where +import GHC.Internal.AllocationLimitHandler ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -91,6 +91,7 @@ Library ghc-bignum >= 1.0 && < 2.0 exposed-modules: + GHC.Internal.AllocationLimitHandler GHC.Internal.ClosureTypes GHC.Internal.Control.Arrow GHC.Internal.Control.Category ===================================== libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs ===================================== @@ -0,0 +1,106 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE UnliftedFFITypes #-} +{-# LANGUAGE GHCForeignImportPrim #-} +{-# OPTIONS_HADDOCK not-home #-} +module GHC.Internal.AllocationLimitHandler + ( runAllocationLimitHandler + , setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + , getAllocationCounterFor + , setAllocationCounterFor + , enableAllocationLimitFor + , disableAllocationLimitFor + ) + where +import GHC.Internal.Base +import GHC.Internal.Conc.Sync (ThreadId(..)) +import GHC.Internal.Data.IORef (IORef, readIORef, writeIORef, newIORef) +import GHC.Internal.Foreign.C.Types +import GHC.Internal.IO (unsafePerformIO) +import GHC.Internal.Int (Int64(..)) + + +{-# NOINLINE allocationLimitHandler #-} +allocationLimitHandler :: IORef (ThreadId -> IO ()) +allocationLimitHandler = unsafePerformIO (newIORef defaultHandler) + +defaultHandler :: ThreadId -> IO () +defaultHandler _ = pure () + +foreign import ccall "setAllocLimitKill" setAllocLimitKill :: CBool -> CBool -> IO () + +runAllocationLimitHandler :: ThreadId# -> IO () +runAllocationLimitHandler tid = do + hook <- getAllocationLimitHandler + hook $ ThreadId tid + +getAllocationLimitHandler :: IO (ThreadId -> IO ()) +getAllocationLimitHandler = readIORef allocationLimitHandler + +data AllocationLimitKillBehaviour = + KillOnAllocationLimit + -- ^ Throw a @AllocationLimitExceeded@ async exception to the thread when the + -- allocation limit is exceeded. + | DontKillOnAllocationLimit + -- ^ Do not throw an exception when the allocation limit is exceeded. + +-- | Define the behaviour for handling allocation limits. +-- By default we throw a @AllocationLimitExceeded@ async exception to the thread. +-- This can be controlled using @AllocationLimitKillBehaviour at . +-- +-- We can also run a user-specified handler, which can be done in addition to +-- or in place of the exception. +-- This allows for instance logging on the allocation limit being exceeded, +-- or dynamically determining whether to terminate the thread. +-- The handler is not guaranteed to run before the thread is terminated or restarted. +-- +-- Note: that if you don't terminate the thread, then the allocation limit gets +-- removed. +-- If you wish to keep the allocation limit you will have to reset it using +-- @setAllocationCounter@ and @enableAllocationLimit at . +setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> Maybe (ThreadId -> IO ()) -> IO () +setGlobalAllocationLimitHandler killBehaviour mHandler = do + shouldRunHandler <- case mHandler of + Just hook -> do + writeIORef allocationLimitHandler hook + pure 1 + Nothing -> do + writeIORef allocationLimitHandler defaultHandler + pure 0 + let shouldKill = + case killBehaviour of + KillOnAllocationLimit -> 1 + DontKillOnAllocationLimit -> 0 + setAllocLimitKill shouldKill shouldRunHandler + +-- | Retrieves the allocation counter for the another thread. +foreign import prim "stg_getOtherThreadAllocationCounterzh" getOtherThreadAllocationCounter# + :: ThreadId# + -> State# RealWorld + -> (# State# RealWorld, Int64# #) + +getAllocationCounterFor :: ThreadId -> IO Int64 +getAllocationCounterFor (ThreadId t#) = IO $ \s -> + case getOtherThreadAllocationCounter# t# s of (# s', i# #) -> (# s', I64# i# #) + +setAllocationCounterFor :: Int64 -> ThreadId -> IO () +setAllocationCounterFor (I64# i#) (ThreadId t#) = IO $ \s -> + case setOtherThreadAllocationCounter# i# t# s of s' -> (# s', () #) + + +-- | Enable allocation limit processing the thread @t at . +enableAllocationLimitFor :: ThreadId -> IO () +enableAllocationLimitFor (ThreadId t) = do + rts_enableThreadAllocationLimit t + +-- | Disable allocation limit processing the thread @t at . +disableAllocationLimitFor :: ThreadId -> IO () +disableAllocationLimitFor (ThreadId t) = do + rts_disableThreadAllocationLimit t + +foreign import ccall unsafe "rts_enableThreadAllocationLimit" + rts_enableThreadAllocationLimit :: ThreadId# -> IO () + +foreign import ccall unsafe "rts_disableThreadAllocationLimit" + rts_disableThreadAllocationLimit :: ThreadId# -> IO () ===================================== rts/Prelude.h ===================================== @@ -67,6 +67,7 @@ PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziWindows_processRemoteComplet PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure); PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure); +PRELUDE_CLOSURE(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure); PRELUDE_INFO(ghczmprim_GHCziCString_unpackCStringzh_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_con_info); @@ -102,6 +103,7 @@ PRELUDE_INFO(ghczminternal_GHCziInternalziStable_StablePtr_con_info); #if defined(mingw32_HOST_OS) #define processRemoteCompletion_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure) #endif +#define runAllocationLimitHandler_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure) #define flushStdHandles_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure) #define runMainIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure) ===================================== rts/PrimOps.cmm ===================================== @@ -2923,6 +2923,11 @@ stg_getThreadAllocationCounterzh () return (StgTSO_alloc_limit(CurrentTSO) - TO_I64(offset)); } +stg_getOtherThreadAllocationCounterzh ( gcptr t ) +{ + return (StgTSO_alloc_limit(t)); +} + stg_setThreadAllocationCounterzh ( I64 counter ) { // Allocation in the current block will be subtracted by @@ -2935,6 +2940,12 @@ stg_setThreadAllocationCounterzh ( I64 counter ) return (); } +stg_setOtherThreadAllocationCounterzh ( I64 counter, gcptr t ) +{ + StgTSO_alloc_limit(t) = counter; + return (); +} + #define KEEP_ALIVE_FRAME_FIELDS(w_,p_,info_ptr,p1,p2,c) \ w_ info_ptr, \ ===================================== rts/RtsSymbols.c ===================================== @@ -914,7 +914,9 @@ extern char **environ; SymI_HasDataProto(stg_traceMarkerzh) \ SymI_HasDataProto(stg_traceBinaryEventzh) \ SymI_HasDataProto(stg_getThreadAllocationCounterzh) \ + SymI_HasDataProto(stg_getOtherThreadAllocationCounterzh) \ SymI_HasDataProto(stg_setThreadAllocationCounterzh) \ + SymI_HasDataProto(stg_setOtherThreadAllocationCounterzh) \ SymI_HasProto(getMonotonicNSec) \ SymI_HasProto(lockFile) \ SymI_HasProto(unlockFile) \ ===================================== rts/Schedule.c ===================================== @@ -94,6 +94,10 @@ StgWord recent_activity = ACTIVITY_YES; */ StgWord sched_state = SCHED_RUNNING; + +bool allocLimitKill = true; +bool allocLimitRunHook = false; + /* * This mutex protects most of the global scheduler data in * the THREADED_RTS runtime. @@ -1113,19 +1117,35 @@ schedulePostRunThread (Capability *cap, StgTSO *t) } } - // - // If the current thread's allocation limit has run out, send it - // the AllocationLimitExceeded exception. + // Handle the current thread's allocation limit running out, if (PK_Int64((W_*)&(t->alloc_limit)) < 0 && (t->flags & TSO_ALLOC_LIMIT)) { - // Use a throwToSelf rather than a throwToSingleThreaded, because - // it correctly handles the case where the thread is currently - // inside mask. Also the thread might be blocked (e.g. on an - // MVar), and throwToSingleThreaded doesn't unblock it - // correctly in that case. - throwToSelf(cap, t, allocationLimitExceeded_closure); - ASSIGN_Int64((W_*)&(t->alloc_limit), - (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + if(allocLimitKill) { + // Throw the AllocationLimitExceeded exception. + // Use a throwToSelf rather than a throwToSingleThreaded, because + // it correctly handles the case where the thread is currently + // inside mask. Also the thread might be blocked (e.g. on an + // MVar), and throwToSingleThreaded doesn't unblock it + // correctly in that case. + throwToSelf(cap, t, allocationLimitExceeded_closure); + ASSIGN_Int64((W_*)&(t->alloc_limit), + (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + } else { + // If we aren't killing the thread, we must disable the limit + // otherwise we will immediatelly retrigger it. + // User defined handlers should re-enable it if wanted. + t->flags = t->flags & ~TSO_ALLOC_LIMIT; + } + + if(allocLimitRunHook) + { + // Create a thread to run the allocation limit handler. + StgClosure* c = rts_apply(cap, runAllocationLimitHandler_closure, (StgClosure*)t); + StgTSO* hookThread = createIOThread(cap, RtsFlags.GcFlags.initialStkSize, c); + // Schedule the handler to be run immediatelly. + pushOnRunQueue(cap, hookThread); + } + } /* some statistics gathering in the parallel case */ @@ -3327,3 +3347,9 @@ resurrectThreads (StgTSO *threads) } } } + +void setAllocLimitKill(bool shouldKill, bool shouldHook) +{ + allocLimitKill = shouldKill; + allocLimitRunHook = shouldHook; +} ===================================== rts/external-symbols.list.in ===================================== @@ -38,6 +38,7 @@ ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure ghczminternal_GHCziInternalziTopHandler_runMainIO_closure +ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure ghczmprim_GHCziTypes_Czh_con_info ghczmprim_GHCziTypes_Izh_con_info ghczmprim_GHCziTypes_Fzh_con_info ===================================== rts/include/rts/storage/GC.h ===================================== @@ -209,6 +209,10 @@ void flushExec(W_ len, AdjustorExecutable exec_addr); // Used by GC checks in external .cmm code: extern W_ large_alloc_lim; +// Should triggering an allocation limit kill the thread +// and should we run a user-defined hook when it is triggered. +void setAllocLimitKill(bool, bool); + /* ----------------------------------------------------------------------------- Performing Garbage Collection -------------------------------------------------------------------------- */ ===================================== rts/include/rts/storage/TSO.h ===================================== @@ -157,9 +157,10 @@ typedef struct StgTSO_ { /* * The allocation limit for this thread, which is updated as the * thread allocates. If the value drops below zero, and - * TSO_ALLOC_LIMIT is set in flags, we raise an exception in the - * thread, and give the thread a little more space to handle the - * exception before we raise the exception again. + * TSO_ALLOC_LIMIT is set in flags, then a handler is triggerd. + * Either we raise an exception in the thread, and give the thread + * a little more space to handle the exception before we raise the + * exception again; or we run a user defined handler. * * This is an integer, because we might update it in a place where * it isn't convenient to raise the exception, so we want it to ===================================== rts/include/stg/MiscClosures.h ===================================== @@ -588,7 +588,9 @@ RTS_FUN_DECL(stg_traceEventzh); RTS_FUN_DECL(stg_traceBinaryEventzh); RTS_FUN_DECL(stg_traceMarkerzh); RTS_FUN_DECL(stg_getThreadAllocationCounterzh); +RTS_FUN_DECL(stg_getOtherThreadAllocationCounterzh); RTS_FUN_DECL(stg_setThreadAllocationCounterzh); +RTS_FUN_DECL(stg_setOtherThreadAllocationCounterzh); RTS_FUN_DECL(stg_castWord64ToDoublezh); RTS_FUN_DECL(stg_castDoubleToWord64zh); ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout ===================================== @@ -8638,6 +8638,16 @@ module Prelude.Experimental where data Unit# = ... getSolo :: forall a. Solo a -> a +module System.Mem.Experimental where + -- Safety: None + type AllocationLimitKillBehaviour :: * + data AllocationLimitKillBehaviour = KillOnAllocationLimit | DontKillOnAllocationLimit + disableAllocationLimitFor :: GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO () + enableAllocationLimitFor :: GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO () + getAllocationCounterFor :: GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO GHC.Internal.Int.Int64 + setAllocationCounterFor :: GHC.Internal.Int.Int64 -> GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO () + setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> GHC.Internal.Maybe.Maybe (GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO ()) -> GHC.Types.IO () + -- Instances: instance GHC.Classes.Eq GHC.Types.Bool -- Defined in ‘GHC.Classes’ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/52b27a8c01e9712ab7c5c36319474580062d93fa -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/52b27a8c01e9712ab7c5c36319474580062d93fa You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 11:35:25 2024 From: gitlab at gitlab.haskell.org (Hannes Siebenhandl (@fendor)) Date: Tue, 19 Mar 2024 07:35:25 -0400 Subject: [Git][ghc/ghc][wip/binary-iaarg-instance] Compact serialisation of IfaceAppArgs Message-ID: <65f9787dc6a06_2621dc3c809441208c0@gitlab.mail> Hannes Siebenhandl pushed to branch wip/binary-iaarg-instance at Glasgow Haskell Compiler / GHC Commits: 0aadb090 by Fendor at 2024-03-19T12:35:11+01:00 Compact serialisation of IfaceAppArgs In #24563, we identified that IfaceAppArgs serialisation tags each cons cell element with a discriminator byte. These bytes add up quickly, blowing up interface files considerably when '-fwrite-if-simplified-core' is enabled. We compact the serialisation by writing out the length of 'IfaceAppArgs', followed by serialising the elements directly without any discriminator byte. This improvement can decrease the size of some interface files by up to 35%. - - - - - 1 changed file: - compiler/GHC/Iface/Type.hs Changes: ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -716,6 +716,12 @@ ifaceVisAppArgsLength = go 0 | isVisibleForAllTyFlag argf = go (n+1) rest | otherwise = go n rest +ifaceAppArgsLength :: IfaceAppArgs -> Int +ifaceAppArgsLength = go 0 + where + go !n IA_Nil = n + go !n (IA_Arg _ _ ts) = go (n + 1) ts + {- Note [Suppressing invisible arguments] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2072,21 +2078,27 @@ instance Binary IfaceTyLit where _ -> panic ("get IfaceTyLit " ++ show tag) instance Binary IfaceAppArgs where - put_ bh tk = - case tk of - IA_Arg t a ts -> putByte bh 0 >> put_ bh t >> put_ bh a >> put_ bh ts - IA_Nil -> putByte bh 1 + put_ bh tk = do + -- Int is variable length encoded so only + -- one byte for small lists. + put_ bh (ifaceAppArgsLength tk) + go tk + where + go IA_Nil = pure () + go (IA_Arg a b t) = do + put_ bh a + put_ bh b + go t - get bh = - do c <- getByte bh - case c of - 0 -> do - t <- get bh - a <- get bh - ts <- get bh - return $! IA_Arg t a ts - 1 -> return IA_Nil - _ -> panic ("get IfaceAppArgs " ++ show c) + get bh = do + n <- get bh :: IO Int + go n + where + go 0 = return IA_Nil + go c = do + a <- get bh + b <- get bh + IA_Arg a b <$> go (c - 1) ------------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0aadb09036d0c66f30e99298039f10c5cb85cc26 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0aadb09036d0c66f30e99298039f10c5cb85cc26 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 11:48:54 2024 From: gitlab at gitlab.haskell.org (Simon Peyton Jones (@simonpj)) Date: Tue, 19 Mar 2024 07:48:54 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/T24559 Message-ID: <65f97ba6af5e5_2621dc43bef58121168@gitlab.mail> Simon Peyton Jones pushed new branch wip/T24559 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T24559 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 11:53:23 2024 From: gitlab at gitlab.haskell.org (Teo Camarasu (@teo)) Date: Tue, 19 Mar 2024 07:53:23 -0400 Subject: [Git][ghc/ghc][wip/T22859] Implement user-defined allocation limit handlers Message-ID: <65f97cb3c8710_2621dc46a0834124464@gitlab.mail> Teo Camarasu pushed to branch wip/T22859 at Glasgow Haskell Compiler / GHC Commits: 64ee0149 by Teo Camarasu at 2024-03-19T11:53:07+00:00 Implement user-defined allocation limit handlers Resolves #22859 - - - - - 20 changed files: - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/StgToCmm/Prim.hs - compiler/GHC/StgToJS/Prim.hs - libraries/ghc-experimental/ghc-experimental.cabal - + libraries/ghc-experimental/src/System/Mem/Experimental.hs - libraries/ghc-internal/ghc-internal.cabal - + libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs - rts/Prelude.h - rts/PrimOps.cmm - rts/RtsSymbols.c - rts/Schedule.c - rts/external-symbols.list.in - rts/include/rts/storage/GC.h - rts/include/rts/storage/TSO.h - rts/include/stg/MiscClosures.h - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - testsuite/tests/interface-stability/ghc-experimental-exports.stdout Changes: ===================================== compiler/GHC/Builtin/primops.txt.pp ===================================== @@ -3952,6 +3952,15 @@ primop SetThreadAllocationCounter "setThreadAllocationCounter#" GenPrimOp effect = ReadWriteEffect out_of_line = True +primop SetOtherThreadAllocationCounter "setOtherThreadAllocationCounter#" GenPrimOp + Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld + { Sets the allocation counter for the another thread to the given value. + This doesn't take allocations into the current nursery chunk into account. + Therefore it is only accurate if the other thread is not currently running. } + with + effect = ReadWriteEffect + out_of_line = True + primtype StackSnapshot# { Haskell representation of a @StgStack*@ that was created (cloned) with a function in "GHC.Stack.CloneStack". Please check the ===================================== compiler/GHC/StgToCmm/Prim.hs ===================================== @@ -1746,6 +1746,7 @@ emitPrimOp cfg primop = TraceEventBinaryOp -> alwaysExternal TraceMarkerOp -> alwaysExternal SetThreadAllocationCounter -> alwaysExternal + SetOtherThreadAllocationCounter -> alwaysExternal KeepAliveOp -> alwaysExternal CastWord32ToFloatOp -> alwaysExternal CastWord64ToDoubleOp -> alwaysExternal ===================================== compiler/GHC/StgToJS/Prim.hs ===================================== @@ -1167,6 +1167,7 @@ genPrim prof bound ty op = case op of WhereFromOp -> unhandledPrimop op -- should be easily implementable with o.f.n SetThreadAllocationCounter -> unhandledPrimop op + SetOtherThreadAllocationCounter -> unhandledPrimop op ------------------------------- Vector ----------------------------------------- -- For now, vectors are unsupported on the JS backend. Simply put, they do not ===================================== libraries/ghc-experimental/ghc-experimental.cabal ===================================== @@ -27,6 +27,7 @@ library Data.Tuple.Experimental Data.Sum.Experimental Prelude.Experimental + System.Mem.Experimental if arch(wasm32) exposed-modules: GHC.Wasm.Prim other-extensions: ===================================== libraries/ghc-experimental/src/System/Mem/Experimental.hs ===================================== @@ -0,0 +1,10 @@ +module System.Mem.Experimental + ( setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + , getAllocationCounterFor + , setAllocationCounterFor + , enableAllocationLimitFor + , disableAllocationLimitFor + ) + where +import GHC.Internal.AllocationLimitHandler ===================================== libraries/ghc-internal/ghc-internal.cabal ===================================== @@ -91,6 +91,7 @@ Library ghc-bignum >= 1.0 && < 2.0 exposed-modules: + GHC.Internal.AllocationLimitHandler GHC.Internal.ClosureTypes GHC.Internal.Control.Arrow GHC.Internal.Control.Category ===================================== libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs ===================================== @@ -0,0 +1,106 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE UnliftedFFITypes #-} +{-# LANGUAGE GHCForeignImportPrim #-} +{-# OPTIONS_HADDOCK not-home #-} +module GHC.Internal.AllocationLimitHandler + ( runAllocationLimitHandler + , setGlobalAllocationLimitHandler + , AllocationLimitKillBehaviour(..) + , getAllocationCounterFor + , setAllocationCounterFor + , enableAllocationLimitFor + , disableAllocationLimitFor + ) + where +import GHC.Internal.Base +import GHC.Internal.Conc.Sync (ThreadId(..)) +import GHC.Internal.Data.IORef (IORef, readIORef, writeIORef, newIORef) +import GHC.Internal.Foreign.C.Types +import GHC.Internal.IO (unsafePerformIO) +import GHC.Internal.Int (Int64(..)) + + +{-# NOINLINE allocationLimitHandler #-} +allocationLimitHandler :: IORef (ThreadId -> IO ()) +allocationLimitHandler = unsafePerformIO (newIORef defaultHandler) + +defaultHandler :: ThreadId -> IO () +defaultHandler _ = pure () + +foreign import ccall "setAllocLimitKill" setAllocLimitKill :: CBool -> CBool -> IO () + +runAllocationLimitHandler :: ThreadId# -> IO () +runAllocationLimitHandler tid = do + hook <- getAllocationLimitHandler + hook $ ThreadId tid + +getAllocationLimitHandler :: IO (ThreadId -> IO ()) +getAllocationLimitHandler = readIORef allocationLimitHandler + +data AllocationLimitKillBehaviour = + KillOnAllocationLimit + -- ^ Throw a @AllocationLimitExceeded@ async exception to the thread when the + -- allocation limit is exceeded. + | DontKillOnAllocationLimit + -- ^ Do not throw an exception when the allocation limit is exceeded. + +-- | Define the behaviour for handling allocation limits. +-- By default we throw a @AllocationLimitExceeded@ async exception to the thread. +-- This can be controlled using @AllocationLimitKillBehaviour at . +-- +-- We can also run a user-specified handler, which can be done in addition to +-- or in place of the exception. +-- This allows for instance logging on the allocation limit being exceeded, +-- or dynamically determining whether to terminate the thread. +-- The handler is not guaranteed to run before the thread is terminated or restarted. +-- +-- Note: that if you don't terminate the thread, then the allocation limit gets +-- removed. +-- If you wish to keep the allocation limit you will have to reset it using +-- @setAllocationCounter@ and @enableAllocationLimit at . +setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> Maybe (ThreadId -> IO ()) -> IO () +setGlobalAllocationLimitHandler killBehaviour mHandler = do + shouldRunHandler <- case mHandler of + Just hook -> do + writeIORef allocationLimitHandler hook + pure 1 + Nothing -> do + writeIORef allocationLimitHandler defaultHandler + pure 0 + let shouldKill = + case killBehaviour of + KillOnAllocationLimit -> 1 + DontKillOnAllocationLimit -> 0 + setAllocLimitKill shouldKill shouldRunHandler + +-- | Retrieves the allocation counter for the another thread. +foreign import prim "stg_getOtherThreadAllocationCounterzh" getOtherThreadAllocationCounter# + :: ThreadId# + -> State# RealWorld + -> (# State# RealWorld, Int64# #) + +getAllocationCounterFor :: ThreadId -> IO Int64 +getAllocationCounterFor (ThreadId t#) = IO $ \s -> + case getOtherThreadAllocationCounter# t# s of (# s', i# #) -> (# s', I64# i# #) + +setAllocationCounterFor :: Int64 -> ThreadId -> IO () +setAllocationCounterFor (I64# i#) (ThreadId t#) = IO $ \s -> + case setOtherThreadAllocationCounter# i# t# s of s' -> (# s', () #) + + +-- | Enable allocation limit processing the thread @t at . +enableAllocationLimitFor :: ThreadId -> IO () +enableAllocationLimitFor (ThreadId t) = do + rts_enableThreadAllocationLimit t + +-- | Disable allocation limit processing the thread @t at . +disableAllocationLimitFor :: ThreadId -> IO () +disableAllocationLimitFor (ThreadId t) = do + rts_disableThreadAllocationLimit t + +foreign import ccall unsafe "rts_enableThreadAllocationLimit" + rts_enableThreadAllocationLimit :: ThreadId# -> IO () + +foreign import ccall unsafe "rts_disableThreadAllocationLimit" + rts_disableThreadAllocationLimit :: ThreadId# -> IO () ===================================== rts/Prelude.h ===================================== @@ -67,6 +67,7 @@ PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziWindows_processRemoteComplet PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure); PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure); +PRELUDE_CLOSURE(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure); PRELUDE_INFO(ghczmprim_GHCziCString_unpackCStringzh_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_con_info); @@ -102,6 +103,7 @@ PRELUDE_INFO(ghczminternal_GHCziInternalziStable_StablePtr_con_info); #if defined(mingw32_HOST_OS) #define processRemoteCompletion_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure) #endif +#define runAllocationLimitHandler_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure) #define flushStdHandles_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure) #define runMainIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure) ===================================== rts/PrimOps.cmm ===================================== @@ -2923,6 +2923,11 @@ stg_getThreadAllocationCounterzh () return (StgTSO_alloc_limit(CurrentTSO) - TO_I64(offset)); } +stg_getOtherThreadAllocationCounterzh ( gcptr t ) +{ + return (StgTSO_alloc_limit(t)); +} + stg_setThreadAllocationCounterzh ( I64 counter ) { // Allocation in the current block will be subtracted by @@ -2935,6 +2940,12 @@ stg_setThreadAllocationCounterzh ( I64 counter ) return (); } +stg_setOtherThreadAllocationCounterzh ( I64 counter, gcptr t ) +{ + StgTSO_alloc_limit(t) = counter; + return (); +} + #define KEEP_ALIVE_FRAME_FIELDS(w_,p_,info_ptr,p1,p2,c) \ w_ info_ptr, \ ===================================== rts/RtsSymbols.c ===================================== @@ -914,7 +914,9 @@ extern char **environ; SymI_HasDataProto(stg_traceMarkerzh) \ SymI_HasDataProto(stg_traceBinaryEventzh) \ SymI_HasDataProto(stg_getThreadAllocationCounterzh) \ + SymI_HasDataProto(stg_getOtherThreadAllocationCounterzh) \ SymI_HasDataProto(stg_setThreadAllocationCounterzh) \ + SymI_HasDataProto(stg_setOtherThreadAllocationCounterzh) \ SymI_HasProto(getMonotonicNSec) \ SymI_HasProto(lockFile) \ SymI_HasProto(unlockFile) \ ===================================== rts/Schedule.c ===================================== @@ -94,6 +94,10 @@ StgWord recent_activity = ACTIVITY_YES; */ StgWord sched_state = SCHED_RUNNING; + +bool allocLimitKill = true; +bool allocLimitRunHook = false; + /* * This mutex protects most of the global scheduler data in * the THREADED_RTS runtime. @@ -1113,19 +1117,35 @@ schedulePostRunThread (Capability *cap, StgTSO *t) } } - // - // If the current thread's allocation limit has run out, send it - // the AllocationLimitExceeded exception. + // Handle the current thread's allocation limit running out, if (PK_Int64((W_*)&(t->alloc_limit)) < 0 && (t->flags & TSO_ALLOC_LIMIT)) { - // Use a throwToSelf rather than a throwToSingleThreaded, because - // it correctly handles the case where the thread is currently - // inside mask. Also the thread might be blocked (e.g. on an - // MVar), and throwToSingleThreaded doesn't unblock it - // correctly in that case. - throwToSelf(cap, t, allocationLimitExceeded_closure); - ASSIGN_Int64((W_*)&(t->alloc_limit), - (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + if(allocLimitKill) { + // Throw the AllocationLimitExceeded exception. + // Use a throwToSelf rather than a throwToSingleThreaded, because + // it correctly handles the case where the thread is currently + // inside mask. Also the thread might be blocked (e.g. on an + // MVar), and throwToSingleThreaded doesn't unblock it + // correctly in that case. + throwToSelf(cap, t, allocationLimitExceeded_closure); + ASSIGN_Int64((W_*)&(t->alloc_limit), + (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); + } else { + // If we aren't killing the thread, we must disable the limit + // otherwise we will immediatelly retrigger it. + // User defined handlers should re-enable it if wanted. + t->flags = t->flags & ~TSO_ALLOC_LIMIT; + } + + if(allocLimitRunHook) + { + // Create a thread to run the allocation limit handler. + StgClosure* c = rts_apply(cap, runAllocationLimitHandler_closure, (StgClosure*)t); + StgTSO* hookThread = createIOThread(cap, RtsFlags.GcFlags.initialStkSize, c); + // Schedule the handler to be run immediatelly. + pushOnRunQueue(cap, hookThread); + } + } /* some statistics gathering in the parallel case */ @@ -3327,3 +3347,9 @@ resurrectThreads (StgTSO *threads) } } } + +void setAllocLimitKill(bool shouldKill, bool shouldHook) +{ + allocLimitKill = shouldKill; + allocLimitRunHook = shouldHook; +} ===================================== rts/external-symbols.list.in ===================================== @@ -38,6 +38,7 @@ ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure ghczminternal_GHCziInternalziTopHandler_runMainIO_closure +ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure ghczmprim_GHCziTypes_Czh_con_info ghczmprim_GHCziTypes_Izh_con_info ghczmprim_GHCziTypes_Fzh_con_info ===================================== rts/include/rts/storage/GC.h ===================================== @@ -209,6 +209,10 @@ void flushExec(W_ len, AdjustorExecutable exec_addr); // Used by GC checks in external .cmm code: extern W_ large_alloc_lim; +// Should triggering an allocation limit kill the thread +// and should we run a user-defined hook when it is triggered. +void setAllocLimitKill(bool, bool); + /* ----------------------------------------------------------------------------- Performing Garbage Collection -------------------------------------------------------------------------- */ ===================================== rts/include/rts/storage/TSO.h ===================================== @@ -157,9 +157,10 @@ typedef struct StgTSO_ { /* * The allocation limit for this thread, which is updated as the * thread allocates. If the value drops below zero, and - * TSO_ALLOC_LIMIT is set in flags, we raise an exception in the - * thread, and give the thread a little more space to handle the - * exception before we raise the exception again. + * TSO_ALLOC_LIMIT is set in flags, then a handler is triggerd. + * Either we raise an exception in the thread, and give the thread + * a little more space to handle the exception before we raise the + * exception again; or we run a user defined handler. * * This is an integer, because we might update it in a place where * it isn't convenient to raise the exception, so we want it to ===================================== rts/include/stg/MiscClosures.h ===================================== @@ -588,7 +588,9 @@ RTS_FUN_DECL(stg_traceEventzh); RTS_FUN_DECL(stg_traceBinaryEventzh); RTS_FUN_DECL(stg_traceMarkerzh); RTS_FUN_DECL(stg_getThreadAllocationCounterzh); +RTS_FUN_DECL(stg_getOtherThreadAllocationCounterzh); RTS_FUN_DECL(stg_setThreadAllocationCounterzh); +RTS_FUN_DECL(stg_setOtherThreadAllocationCounterzh); RTS_FUN_DECL(stg_castWord64ToDoublezh); RTS_FUN_DECL(stg_castDoubleToWord64zh); ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -4585,6 +4585,7 @@ module GHC.Base where sequence :: forall (m :: * -> *) a. Monad m => [m a] -> m [a] setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# @@ -6689,6 +6690,7 @@ module GHC.Exts where seq# :: forall a d. a -> State# d -> (# State# d, a #) setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -4585,6 +4585,7 @@ module GHC.Base where sequence :: forall (m :: * -> *) a. Monad m => [m a] -> m [a] setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# @@ -6658,6 +6659,7 @@ module GHC.Exts where seq# :: forall a d. a -> State# d -> (# State# d, a #) setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -4588,6 +4588,7 @@ module GHC.Base where sequence :: forall (m :: * -> *) a. Monad m => [m a] -> m [a] setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# @@ -6838,6 +6839,7 @@ module GHC.Exts where seq# :: forall a d. a -> State# d -> (# State# d, a #) setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# ===================================== testsuite/tests/interface-stability/base-exports.stdout-ws-32 ===================================== @@ -4585,6 +4585,7 @@ module GHC.Base where sequence :: forall (m :: * -> *) a. Monad m => [m a] -> m [a] setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# @@ -6689,6 +6690,7 @@ module GHC.Exts where seq# :: forall a d. a -> State# d -> (# State# d, a #) setAddrRange# :: Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld setByteArray# :: forall d. MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d + setOtherThreadAllocationCounter# :: Int64# -> ThreadId# -> State# RealWorld -> State# RealWorld setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld shiftL# :: Word# -> Int# -> Word# shiftRL# :: Word# -> Int# -> Word# ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout ===================================== @@ -8638,6 +8638,16 @@ module Prelude.Experimental where data Unit# = ... getSolo :: forall a. Solo a -> a +module System.Mem.Experimental where + -- Safety: None + type AllocationLimitKillBehaviour :: * + data AllocationLimitKillBehaviour = KillOnAllocationLimit | DontKillOnAllocationLimit + disableAllocationLimitFor :: GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO () + enableAllocationLimitFor :: GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO () + getAllocationCounterFor :: GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO GHC.Internal.Int.Int64 + setAllocationCounterFor :: GHC.Internal.Int.Int64 -> GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO () + setGlobalAllocationLimitHandler :: AllocationLimitKillBehaviour -> GHC.Internal.Maybe.Maybe (GHC.Internal.Conc.Sync.ThreadId -> GHC.Types.IO ()) -> GHC.Types.IO () + -- Instances: instance GHC.Classes.Eq GHC.Types.Bool -- Defined in ‘GHC.Classes’ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/64ee01494af677371fbc33e13c2d830ea9d5eacd -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/64ee01494af677371fbc33e13c2d830ea9d5eacd You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 12:17:12 2024 From: gitlab at gitlab.haskell.org (Marge Bot (@marge-bot)) Date: Tue, 19 Mar 2024 08:17:12 -0400 Subject: [Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: Fix sharing of 'IfaceTyConInfo' during core to iface type translation Message-ID: <65f982484550f_2621dc52d57081262c0@gitlab.mail> Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 73be65ab by Fendor at 2024-03-19T01:42:53-04:00 Fix sharing of 'IfaceTyConInfo' during core to iface type translation During heap analysis, we noticed that during generation of 'mi_extra_decls' we have lots of duplicates for the instances: * `IfaceTyConInfo NotPromoted IfaceNormalTyCon` * `IfaceTyConInfo IsPromoted IfaceNormalTyCon` which should be shared instead of duplicated. This duplication increased the number of live bytes by around 200MB while loading the agda codebase into GHCi. These instances are created during `CoreToIface` translation, in particular `toIfaceTyCon`. The generated core looks like: toIfaceTyCon = \ tc_sjJw -> case $wtoIfaceTyCon tc_sjJw of { (# ww_sjJz, ww1_sjNL, ww2_sjNM #) -> IfaceTyCon ww_sjJz (IfaceTyConInfo ww1_sjNL ww2_sjNM) } whichs removes causes the sharing to work propery. Adding explicit sharing, with NOINLINE annotations, changes the core to: toIfaceTyCon = \ tc_sjJq -> case $wtoIfaceTyCon tc_sjJq of { (# ww_sjNB, ww1_sjNC #) -> IfaceTyCon ww_sjNB ww1_sjNC } which looks much more like sharing is happening. We confirmed via ghc-debug that all duplications were eliminated and the number of live bytes are noticeably reduced. - - - - - bd8209eb by Alan Zimmerman at 2024-03-19T01:43:28-04:00 EPA: Address more 9.10.1-alpha1 regressions from recent changes Closes #24533 Hopefully for good this time - - - - - ebaaf32c by Matthew Pickering at 2024-03-19T08:16:58-04:00 Read global package database from settings file Before this patch, the global package database was always assumed to be in libdir </> package.conf.d. This causes issues in GHC's build system because there are sometimes situations where the package database you need to use is not located in the same place as the settings file. * The stage1 compiler needs to use stage1 libraries, so we should set "Global Package DB" for the stage1 compiler to the stage1 package database. * Stage 2 cross compilers need to use stage2 libraries, so likewise, we should set the package database path to `_build/stage2/lib/` * The normal situation is where the stage2 compiler uses stage1 libraries. Then everything lines up. * When installing we have rearranged everything so that the settings file and package database line up properly, so then everything should continue to work as before. In this case we set the relative package db path to `package.conf.d`, so it resolves the same as before. * ghc-pkg needs to be modified as well to look in the settings file fo the package database rather than assuming the global package database location relative to the lib folder. * Cabal/cabal-install will work correctly because they query the global package database using `--print-global-package-db`. A reasonable question is why not generate the "right" settings files in the right places in GHC's build system. In order to do this you would need to engineer wrappers for all executables to point to a specific libdir. There are also situations where the same package db is used by two different compilers with two different settings files (think stage2 cross compiler and stage3 compiler). In short, this 10 line patch allows for some reasonable simplifications in Hadrian at very little cost to anything else. Fixes #24502 - - - - - 7059ffa8 by Matthew Pickering at 2024-03-19T08:16:58-04:00 hadrian: Remove stage1 testsuite wrappers logic Now instead of producing wrappers which pass the global package database argument to ghc and ghc-pkg, we write the location of the correct package database into the settings file so you can just use the intree compiler directly. - - - - - 14a7e8f4 by Bryan Richter at 2024-03-19T08:16:58-04:00 testsuite: Disable T21336a on wasm - - - - - 15 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Settings/IO.hs - hadrian/bindist/Makefile - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Test.hs - libraries/base/tests/IO/T21336/all.T - libraries/ghc-boot/GHC/Settings/Utils.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/printer/Test24533.hs - testsuite/tests/printer/Test24533.stdout - utils/ghc-pkg/Main.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3611,7 +3611,8 @@ compilerInfo dflags ("GHC Profiled", showBool hostIsProfiled), ("Debug on", showBool debugIsOn), ("LibDir", topDir dflags), - -- The path of the global package database used by GHC + -- This is always an absolute path, unlike "Relative Global Package DB" which is + -- in the settings file. ("Global Package DB", globalPackageDatabasePath dflags) ] where ===================================== compiler/GHC/Iface/Type.hs ===================================== @@ -361,12 +361,51 @@ data IfaceTyConInfo -- Used only to guide pretty-printing , ifaceTyConSort :: IfaceTyConSort } deriving (Eq) --- This smart constructor allows sharing of the two most common --- cases. See #19194 +-- | This smart constructor allows sharing of the two most common +-- cases. See Note [Sharing IfaceTyConInfo] mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo -mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = IfaceTyConInfo IsPromoted IfaceNormalTyCon -mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = IfaceTyConInfo NotPromoted IfaceNormalTyCon -mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort +mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo +mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo +mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +{-# NOINLINE promotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +promotedNormalTyConInfo :: IfaceTyConInfo +promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + +{-# NOINLINE notPromotedNormalTyConInfo #-} +-- | See Note [Sharing IfaceTyConInfo] +notPromotedNormalTyConInfo :: IfaceTyConInfo +notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + +{- +Note [Sharing IfaceTyConInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'IfaceTyConInfo' occurs an awful lot in 'ModIface', see #19194 for an example. +But almost all of them are + + IfaceTyConInfo IsPromoted IfaceNormalTyCon + IfaceTyConInfo NotPromoted IfaceNormalTyCon. + +The smart constructor `mkIfaceTyConInfo` arranges to share these instances, +thus: + + promotedNormalTyConInfo = IfaceTyConInfo IsPromoted IfaceNormalTyCon + notPromotedNormalTyConInfo = IfaceTyConInfo NotPromoted IfaceNormalTyCon + + mkIfaceTyConInfo IsPromoted IfaceNormalTyCon = promotedNormalTyConInfo + mkIfaceTyConInfo NotPromoted IfaceNormalTyCon = notPromotedNormalTyConInfo + mkIfaceTyConInfo prom sort = IfaceTyConInfo prom sort + +But ALAS, the (nested) CPR transform can lose this sharing, completely +negating the effect of `mkIfaceTyConInfo`: see #24530 and #19326. + +Sticking-plaster solution: add a NOINLINE pragma to those top-level constants. +When we fix the CPR bug we can remove the NOINLINE pragmas. + +This one change leads to an 15% reduction in residency for GHC when embedding +'mi_extra_decls': see !12222. +-} data IfaceMCoercion = IfaceMRefl ===================================== compiler/GHC/Parser.y ===================================== @@ -1237,12 +1237,12 @@ topdecl_cs : topdecl {% commentsPA $1 } ----------------------------------------------------------------------------- topdecl :: { LHsDecl GhcPs } - : cl_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | ty_decl { sL1a $1 (TyClD noExtField (unLoc $1)) } - | standalone_kind_sig { sL1a $1 (KindSigD noExtField (unLoc $1)) } - | inst_decl { sL1a $1 (InstD noExtField (unLoc $1)) } - | stand_alone_deriving { sL1a $1 (DerivD noExtField (unLoc $1)) } - | role_annot { sL1a $1 (RoleAnnotD noExtField (unLoc $1)) } + : cl_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | ty_decl { L (getLoc $1) (TyClD noExtField (unLoc $1)) } + | standalone_kind_sig { L (getLoc $1) (KindSigD noExtField (unLoc $1)) } + | inst_decl { L (getLoc $1) (InstD noExtField (unLoc $1)) } + | stand_alone_deriving { L (getLoc $1) (DerivD noExtField (unLoc $1)) } + | role_annot { L (getLoc $1) (RoleAnnotD noExtField (unLoc $1)) } | 'default' '(' comma_types0 ')' {% amsA' (sLL $1 $> (DefD noExtField (DefaultDecl [mj AnnDefault $1,mop $2,mcp $4] $3))) } | 'foreign' fdecl {% amsA' (sLL $1 $> ((snd $ unLoc $2) (mj AnnForeign $1:(fst $ unLoc $2)))) } ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -943,11 +943,13 @@ checkTyVars pp_what equals_or_where tc tparms -- Keep around an action for adjusting the annotations of extra parens chkParens :: [AddEpAnn] -> [AddEpAnn] -> HsBndrVis GhcPs -> LHsType GhcPs -> P (LHsTyVarBndr (HsBndrVis GhcPs) GhcPs) - chkParens ops cps bvis (L l (HsParTy _ ty)) + chkParens ops cps bvis (L l (HsParTy _ (L lt ty))) = let (o,c) = mkParensEpAnn (realSrcSpan $ locA l) + lcs = epAnnComments l + lt' = setCommentsEpAnn lt lcs in - chkParens (o:ops) (c:cps) bvis ty + chkParens (o:ops) (c:cps) bvis (L lt' ty) chkParens ops cps bvis ty = chk ops cps bvis ty -- Check that the name space is correct! ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -112,8 +112,14 @@ initSettings top_dir = do ldIsGnuLd <- getBooleanSetting "ld is GNU ld" arSupportsDashL <- getBooleanSetting "ar supports -L" - let globalpkgdb_path = installed "package.conf.d" - ghc_usage_msg_path = installed "ghc-usage.txt" + + -- The package database is either a relative path to the location of the settings file + -- OR an absolute path. + -- In case the path is absolute then top_dir abs_path == abs_path + -- the path is relative then top_dir rel_path == top_dir rel_path + globalpkgdb_path <- installed <$> getSetting "Relative Global Package DB" + + let ghc_usage_msg_path = installed "ghc-usage.txt" ghci_usage_msg_path = installed "ghci-usage.txt" -- For all systems, unlit, split, mangle are GHC utilities ===================================== hadrian/bindist/Makefile ===================================== @@ -141,6 +141,7 @@ lib/settings : config.mk @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Use LibFFI", "$(UseLibffiForAdjustors)")' >> $@ @echo ',("RTS expects libdw", "$(GhcRtsWithLibdw)")' >> $@ + @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ @echo "]" >> $@ # We need to install binaries relative to libraries. ===================================== hadrian/src/Oracles/TestSettings.hs ===================================== @@ -13,8 +13,6 @@ import Hadrian.Oracles.TextFile import Oracles.Setting (topDirectory, setting, Setting(..)) import Packages import Settings.Program (programContext) -import Hadrian.Oracles.Path -import System.Directory (makeAbsolute) testConfigFile :: Action FilePath testConfigFile = buildRoot <&> (-/- "test/ghcconfig") @@ -81,15 +79,12 @@ testRTSSettings = do file <- testConfigFile words <$> lookupValueOrError Nothing file "GhcRTSWays" -absoluteBuildRoot :: Action FilePath -absoluteBuildRoot = (fixAbsolutePathOnWindows =<< liftIO . makeAbsolute =<< buildRoot) - -- | Directory to look for binaries. -- We assume that required programs are present in the same binary directory -- in which ghc is stored and that they have their conventional name. getBinaryDirectory :: String -> Action FilePath getBinaryDirectory "stage0" = takeDirectory <$> setting SystemGhc -getBinaryDirectory "stage1" = liftM2 (-/-) absoluteBuildRoot (pure "stage1-test/bin/") +getBinaryDirectory "stage1" = liftM2 (-/-) topDirectory (stageBinPath stage0InTree) getBinaryDirectory "stage2" = liftM2 (-/-) topDirectory (stageBinPath Stage1) getBinaryDirectory "stage3" = liftM2 (-/-) topDirectory (stageBinPath Stage2) getBinaryDirectory "stage-cabal" = do @@ -101,7 +96,7 @@ getBinaryDirectory compiler = pure $ takeDirectory compiler -- | Get the path to the given @--test-compiler at . getCompilerPath :: String -> Action FilePath getCompilerPath "stage0" = setting SystemGhc -getCompilerPath "stage1" = liftM2 (-/-) absoluteBuildRoot (pure ("stage1-test/bin/ghc" <.> exe)) +getCompilerPath "stage1" = liftM2 (-/-) topDirectory (fullPath stage0InTree ghc) getCompilerPath "stage2" = liftM2 (-/-) topDirectory (fullPath Stage1 ghc) getCompilerPath "stage3" = liftM2 (-/-) topDirectory (fullPath Stage2 ghc) getCompilerPath "stage-cabal" = do ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -234,8 +234,8 @@ generateRules = do forM_ allStages $ \stage -> do let prefix = root -/- stageString stage -/- "lib" - go gen file = generate file (semiEmptyTarget stage) gen - (prefix -/- "settings") %> go generateSettings + go gen file = generate file (semiEmptyTarget (succStage stage)) gen + (prefix -/- "settings") %> \out -> go (generateSettings out) out where file <~+ gen = file %> \out -> generate out emptyTarget gen >> makeExecutable out @@ -355,21 +355,26 @@ templateRules = do ghcWrapper :: Stage -> Expr String ghcWrapper (Stage0 {}) = error "Stage0 GHC does not require a wrapper script to run." ghcWrapper stage = do - dbPath <- expr $ () <$> topDirectory <*> packageDbPath (PackageDbLoc stage Final) ghcPath <- expr $ () <$> topDirectory <*> programPath (vanillaContext (predStage stage) ghc) return $ unwords $ map show $ [ ghcPath ] - ++ (if stage == Stage1 - then ["-no-global-package-db" - , "-package-env=-" - , "-package-db " ++ dbPath - ] - else []) ++ [ "$@" ] -generateSettings :: Expr String -generateSettings = do +generateSettings :: FilePath -> Expr String +generateSettings settingsFile = do ctx <- getContext + stage <- getStage + + package_db_path <- expr $ do + let get_pkg_db stg = packageDbPath (PackageDbLoc stg Final) + case stage of + Stage0 {} -> error "Unable to generate settings for stage0" + Stage1 -> get_pkg_db Stage1 + Stage2 -> get_pkg_db Stage1 + Stage3 -> get_pkg_db Stage2 + + let rel_pkg_db = makeRelativeNoSysLink (dropFileName settingsFile) package_db_path + settings <- traverse sequence $ [ ("C compiler command", queryTarget ccPath) , ("C compiler flags", queryTarget ccFlags) @@ -421,6 +426,7 @@ generateSettings = do , ("Leading underscore", queryTarget (yesNo . tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors) , ("RTS expects libdw", yesNo <$> getFlag UseLibdw) + , ("Relative Global Package DB", pure rel_pkg_db) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" pure $ case settings of ===================================== hadrian/src/Rules/Test.hs ===================================== @@ -124,28 +124,6 @@ testRules = do testsuiteDeps - -- we need to create wrappers to test the stage1 compiler - -- as the stage1 compiler needs the stage2 libraries - -- to have any hope of passing tests. - root -/- "stage1-test/bin/*" %> \path -> do - - bin_path <- stageBinPath stage0InTree - let prog = takeBaseName path - stage0prog = bin_path -/- prog <.> exe - need [stage0prog] - abs_prog_path <- liftIO (IO.canonicalizePath stage0prog) - -- Use the stage1 package database - pkgDb <- liftIO . IO.makeAbsolute =<< packageDbPath (PackageDbLoc Stage1 Final) - if prog `elem` ["ghc","runghc"] then do - let flags = [ "-no-global-package-db", "-no-user-package-db", "-hide-package", "ghc" , "-package-env","-","-package-db",pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else if prog == "ghc-pkg" then do - let flags = ["--no-user-package-db", "--global-package-db", pkgDb] - writeFile' path $ unlines ["#!/bin/sh",unwords ((abs_prog_path : flags) ++ ["${1+\"$@\"}"])] - makeExecutable path - else createFileLink abs_prog_path path - -- Rules for building check-ppr, check-exact and -- check-ppr-annotations with the compiler we are going to test -- (in-tree or out-of-tree). @@ -344,18 +322,6 @@ needTestsuitePackages stg = do need =<< mapM (uncurry pkgFile) pkgs cross <- flag CrossCompiling when (not cross) $ needIservBins stg - root <- buildRoot - -- require the shims for testing stage1 - when (stg == stage0InTree) $ do - -- Windows not supported as the wrapper scripts don't work on windows.. we could - -- support it with a separate .bat or C wrapper code path but seems overkill when no-one will - -- probably ever try and do this. - when windowsHost $ do - putFailure $ unlines [ "Testing stage1 compiler with windows is currently unsupported," - , "if you desire to do this then please open a ticket"] - fail "Testing stage1 is not supported" - - need =<< sequence [(\f -> root -/- "stage1-test/bin" -/- takeFileName f) <$> (pkgFile stage0InTree p) | (Stage0 InTreeLibs,p) <- exepkgs] -- stage 1 ghc lives under stage0/bin, -- stage 2 ghc lives under stage1/bin, etc ===================================== libraries/base/tests/IO/T21336/all.T ===================================== @@ -3,6 +3,10 @@ test('T21336a', [ unless(opsys('linux') or opsys('freebsd'), skip) , js_broken(22261) , fragile(22022) + # More than fragile, the test is failing consistently on wasm. See #22022. + # It would be nice to see if the test is NOT fragile on the other + # architectures, but right now I don't know how to check. + , when(arch('wasm32'), skip) , extra_files(['FinalizerExceptionHandler.hs']) ], compile_and_run, ['']) ===================================== libraries/ghc-boot/GHC/Settings/Utils.hs ===================================== @@ -8,6 +8,7 @@ import qualified Data.Map as Map import GHC.BaseDir import GHC.Platform.ArchOS +import System.FilePath maybeRead :: Read a => String -> Maybe a maybeRead str = case reads str of @@ -42,6 +43,12 @@ getTargetArchOS settingsFile settings = ArchOS <$> readRawSetting settingsFile settings "target arch" <*> readRawSetting settingsFile settings "target os" +getGlobalPackageDb :: FilePath -> RawSettings -> Either String FilePath +getGlobalPackageDb settingsFile settings = do + rel_db <- getRawSetting settingsFile settings "Relative Global Package DB" + return (dropFileName settingsFile rel_db) + + getRawSetting :: FilePath -> RawSettings -> String -> Either String String ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -212,7 +212,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:9:11 }) (EpaSpan { DumpSemis.hs:9:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:9:11 }) + (EpaSpan { DumpSemis.hs:9:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -498,7 +501,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:14:11 }) (EpaSpan { DumpSemis.hs:14:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:14:11 }) + (EpaSpan { DumpSemis.hs:14:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L @@ -747,7 +753,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { DumpSemis.hs:21:11 }) (EpaSpan { DumpSemis.hs:21:12 })) + (AnnParen + AnnParens + (EpaSpan { DumpSemis.hs:21:11 }) + (EpaSpan { DumpSemis.hs:21:12 })) (HsBoxedOrConstraintTuple) [])))))))))) ,(L ===================================== testsuite/tests/printer/Test24533.hs ===================================== @@ -6,3 +6,9 @@ instance Read b ) => Read (a, b) + +class Foo (a :: Type {- Weird -}) + +instance Eq Foo where + -- Weird + Foo == Foo = True ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -13,8 +13,8 @@ [] (Just ((,) - { Test24533.hs:9:1 } - { Test24533.hs:8:13 }))) + { Test24533.hs:15:1 } + { Test24533.hs:14:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -273,6 +273,323 @@ [] [] [] + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:10:1-33 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.hs:10:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.hs:10:11-33 }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:10:22-32 }) + (EpaComment + (EpaBlockComment + "{- Weird -}") + { Test24533.hs:10:17-20 }))])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.hs:10:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.hs:10:33 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.hs:10:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:10:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:(12,1)-(14,19) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { Test24533.hs:13:3-10 }) + (EpaComment + (EpaLineComment + "-- Weird") + { Test24533.hs:12:17-21 }))])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.hs:12:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:12:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.hs:12:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.hs:14:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.hs:14:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.hs:14:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.hs:14:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] (Nothing)))))])) @@ -291,8 +608,8 @@ [] (Just ((,) - { Test24533.ppr.hs:3:41 } - { Test24533.ppr.hs:3:40 }))) + { Test24533.ppr.hs:6:20 } + { Test24533.ppr.hs:6:16-19 }))) (EpaCommentsBalanced [(L (EpaSpan @@ -545,4 +862,311 @@ [] [] [] - (Nothing)))))])) \ No newline at end of file + (Nothing))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:1-21 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (ClassDecl + ((,,) + [(AddEpAnn AnnClass (EpaSpan { Test24533.ppr.hs:4:1-5 }))] + (EpNoLayout) + (NoAnnSortKey)) + (Nothing) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:7-9 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (HsQTvs + (NoExtField) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:11-21 }) + (AnnListItem + []) + (EpaComments + [])) + (KindedTyVar + [(AddEpAnn AnnOpenP (EpaSpan { Test24533.ppr.hs:4:11 })) + ,(AddEpAnn AnnCloseP (EpaSpan { Test24533.ppr.hs:4:21 })) + ,(AddEpAnn AnnDcolon (EpaSpan { Test24533.ppr.hs:4:14-15 }))] + (HsBndrRequired + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: a})) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:4:17-20 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Type}))))))]) + (Prefix) + [] + [] + {Bag(LocatedA (HsBind GhcPs)): + []} + [] + [] + []))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:(5,1)-(6,19) }) + (AnnListItem + []) + (EpaComments + [])) + (InstD + (NoExtField) + (ClsInstD + (NoExtField) + (ClsInstDecl + ((,,) + (Nothing) + [(AddEpAnn AnnInstance (EpaSpan { Test24533.ppr.hs:5:1-8 })) + ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:5:17-21 }))] + (NoAnnSortKey)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsSig + (NoExtField) + (HsOuterImplicit + (NoExtField)) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsAppTy + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:10-11 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Eq})))) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:5:13-15 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})))))))) + {Bag(LocatedA (HsBind GhcPs)): + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (FunBind + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (MG + (FromSource) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnList + (Nothing) + (Nothing) + (Nothing) + [] + []) + (EpaComments + [])) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-19 }) + (AnnListItem + []) + (EpaComments + [])) + (Match + [] + (FunRhs + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:7-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: ==})) + (Infix) + (NoSrcStrict)) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-5 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + []))))) + ,(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (VisPat + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (AnnListItem + []) + (EpaComments + [])) + (ConPat + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:10-12 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Foo})) + (PrefixCon + [] + [])))))] + (GRHSs + (EpaComments + []) + [(L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (NoEpAnns) + (EpaComments + [])) + (GRHS + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:14-19 }) + (GrhsAnn + (Nothing) + (AddEpAnn AnnEqual (EpaSpan { Test24533.ppr.hs:6:14 }))) + (EpaComments + [])) + [] + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (AnnListItem + []) + (EpaComments + [])) + (HsVar + (NoExtField) + (L + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:16-19 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: True}))))))] + (EmptyLocalBinds + (NoExtField)))))]))))]} + [] + [] + [] + (Nothing)))))])) + + ===================================== utils/ghc-pkg/Main.hs ===================================== @@ -28,7 +28,7 @@ import qualified GHC.Unit.Database as GhcPkg import GHC.Unit.Database hiding (mkMungePathUrl) import GHC.HandleEncoding import GHC.BaseDir (getBaseDir) -import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy) +import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy, getGlobalPackageDb, RawSettings) import GHC.Platform.Host (hostPlatformArchOS) import GHC.UniqueSubdir (uniqueSubdir) import qualified GHC.Data.ShortText as ST @@ -582,6 +582,21 @@ allPackagesInStack = concatMap packages stackUpTo :: FilePath -> PackageDBStack -> PackageDBStack stackUpTo to_modify = dropWhile ((/= to_modify) . location) +readFromSettingsFile :: FilePath + -> (FilePath -> RawSettings -> Either String b) + -> IO (Either String b) +readFromSettingsFile settingsFile f = do + settingsStr <- readFile settingsFile + pure $ do + mySettings <- case maybeReadFuzzy settingsStr of + Just s -> pure $ Map.fromList s + -- It's excusable to not have a settings file (for now at + -- least) but completely inexcusable to have a malformed one. + Nothing -> Left $ "Can't parse settings file " ++ show settingsFile + case f settingsFile mySettings of + Right archOS -> Right archOS + Left e -> Left e + getPkgDatabases :: Verbosity -> GhcPkg.DbOpenMode mode DbModifySelector -> Bool -- use the user db @@ -605,24 +620,38 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do -- location is passed to the binary using the --global-package-db flag by the -- wrapper script. let err_msg = "missing --global-package-db option, location of global package database unknown\n" - global_conf <- + (top_dir, global_conf) <- case [ f | FlagGlobalConfig f <- my_flags ] of -- See Note [Base Dir] for more information on the base dir / top dir. [] -> do mb_dir <- getBaseDir case mb_dir of Nothing -> die err_msg Just dir -> do - r <- lookForPackageDBIn dir - case r of - Nothing -> die ("Can't find package database in " ++ dir) - Just path -> return path - fs -> return (last fs) - - -- The value of the $topdir variable used in some package descriptions - -- Note that the way we calculate this is slightly different to how it - -- is done in ghc itself. We rely on the convention that the global - -- package db lives in ghc's libdir. - top_dir <- absolutePath (takeDirectory global_conf) + -- Look for where it is given in the settings file, if marked there. + let settingsFile = dir "settings" + exists_settings_file <- doesFileExist settingsFile + erel_db <- + if exists_settings_file + then readFromSettingsFile settingsFile getGlobalPackageDb + else pure (Left ("Settings file doesn't exist: " ++ settingsFile)) + + case erel_db of + Right rel_db -> return (dir, dir rel_db) + -- If the version of GHC doesn't have this field or the settings file + -- doesn't exist for some reason, look in the libdir. + Left err -> do + r <- lookForPackageDBIn dir + case r of + Nothing -> die (unlines [err, ("Fallback: Can't find package database in " ++ dir)]) + Just path -> return (dir, path) + fs -> do + -- The value of the $topdir variable used in some package descriptions + -- Note that the way we calculate this is slightly different to how it + -- is done in ghc itself. We rely on the convention that the global + -- package db lives in ghc's libdir. + let pkg_db = last fs + top_dir <- absolutePath (takeDirectory pkg_db) + return (top_dir, pkg_db) let no_user_db = FlagNoUserDb `elem` my_flags @@ -641,16 +670,11 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do warn $ "WARNING: settings file doesn't exist " ++ show settingsFile warn "cannot know target platform so guessing target == host (native compiler)." pure hostPlatformArchOS - True -> do - settingsStr <- readFile settingsFile - mySettings <- case maybeReadFuzzy settingsStr of - Just s -> pure $ Map.fromList s - -- It's excusable to not have a settings file (for now at - -- least) but completely inexcusable to have a malformed one. - Nothing -> die $ "Can't parse settings file " ++ show settingsFile - case getTargetArchOS settingsFile mySettings of - Right archOS -> pure archOS + True -> + readFromSettingsFile settingsFile getTargetArchOS >>= \case + Right v -> pure v Left e -> die e + let subdir = uniqueSubdir targetArchOS getFirstSuccess :: [IO a] -> IO (Maybe a) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fb64a4282009f5707290d4d5c04a818b542467a3...14a7e8f4e8e040a6409d16b54b3aee4902240cc0 -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fb64a4282009f5707290d4d5c04a818b542467a3...14a7e8f4e8e040a6409d16b54b3aee4902240cc0 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 13:32:05 2024 From: gitlab at gitlab.haskell.org (Andreas Klebinger (@AndreasK)) Date: Tue, 19 Mar 2024 09:32:05 -0400 Subject: [Git][ghc/ghc][wip/andreask/shortcut_bug] NCG: Fix a bug in jump shortcutting. Message-ID: <65f993d5df925_2621dc714f2c4131911@gitlab.mail> Andreas Klebinger pushed to branch wip/andreask/shortcut_bug at Glasgow Haskell Compiler / GHC Commits: 700e393b by Andreas Klebinger at 2024-03-19T14:17:49+01:00 NCG: Fix a bug in jump shortcutting. When checking if a jump has more than one destination account for the possibility of some jumps not being representable by a BlockId. We do so by having isJumpishInstr return a `Maybe BlockId` where Nothing represents non-BlockId jump destinations. Fixes #24507 - - - - - 12 changed files: - compiler/GHC/CmmToAsm/AArch64/Instr.hs - compiler/GHC/CmmToAsm/BlockLayout.hs - compiler/GHC/CmmToAsm/Instr.hs - compiler/GHC/CmmToAsm/PPC/Instr.hs - compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs - compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs - compiler/GHC/CmmToAsm/Reg/Liveness.hs - compiler/GHC/CmmToAsm/X86/Instr.hs - + testsuite/tests/codeGen/should_run/T24507.hs - + testsuite/tests/codeGen/should_run/T24507.stdout - + testsuite/tests/codeGen/should_run/T24507_cmm.cmm - testsuite/tests/codeGen/should_run/all.T Changes: ===================================== compiler/GHC/CmmToAsm/AArch64/Instr.hs ===================================== @@ -301,14 +301,14 @@ isJumpishInstr instr = case instr of -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr (ANN _ i) = jumpDestsOfInstr i -jumpDestsOfInstr (CBZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (CBNZ _ t) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (J t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (B t) = [id | TBlock id <- [t]] -jumpDestsOfInstr (BL t _ _) = [ id | TBlock id <- [t]] -jumpDestsOfInstr (BCOND _ t) = [ id | TBlock id <- [t]] +jumpDestsOfInstr (CBZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (CBNZ _ t) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (J t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (B t) = [Just id | TBlock id <- [t]] +jumpDestsOfInstr (BL t _ _) = [ Just id | TBlock id <- [t]] +jumpDestsOfInstr (BCOND _ t) = [ Just id | TBlock id <- [t]] jumpDestsOfInstr _ = [] -- | Change the destination of this jump instruction. ===================================== compiler/GHC/CmmToAsm/BlockLayout.hs ===================================== @@ -771,7 +771,7 @@ dropJumps :: forall a i. Instruction i => LabelMap a -> [GenBasicBlock i] dropJumps _ [] = [] dropJumps info (BasicBlock lbl ins:todo) | Just ins <- nonEmpty ins --This can happen because of shortcutting - , [dest] <- jumpDestsOfInstr (NE.last ins) + , [Just dest] <- jumpDestsOfInstr (NE.last ins) , BasicBlock nextLbl _ : _ <- todo , not (mapMember dest info) , nextLbl == dest @@ -870,7 +870,7 @@ mkNode edgeWeights block@(BasicBlock id instrs) = | length successors > 2 || edgeWeight info <= 0 -> [] | otherwise -> [target] | Just instr <- lastMaybe instrs - , [one] <- jumpDestsOfInstr instr + , [one] <- jumpBlockDestsOfInstr instr = [one] | otherwise = [] ===================================== compiler/GHC/CmmToAsm/Instr.hs ===================================== @@ -17,6 +17,8 @@ import GHC.Cmm.BlockId import GHC.CmmToAsm.Config import GHC.Data.FastString +import Data.Maybe (catMaybes) + -- | Holds a list of source and destination registers used by a -- particular instruction. -- @@ -73,9 +75,17 @@ class Instruction instr where -- | Give the possible destinations of this jump instruction. -- Must be defined for all jumpish instructions. + -- Returns Nothing for non BlockId destinations. jumpDestsOfInstr + :: instr -> [Maybe BlockId] + + -- | Give the possible block destinations of this jump instruction. + -- Must be defined for all jumpish instructions. + jumpBlockDestsOfInstr :: instr -> [BlockId] + jumpBlockDestsOfInstr = catMaybes . jumpDestsOfInstr + -- | Change the destination of this jump instruction. -- Used in the linear allocator when adding fixup blocks for join ===================================== compiler/GHC/CmmToAsm/PPC/Instr.hs ===================================== @@ -513,12 +513,12 @@ isJumpishInstr instr -- | Checks whether this instruction is a jump/branch instruction. -- One that can change the flow of control in a way that the -- register allocator needs to worry about. -jumpDestsOfInstr :: Instr -> [BlockId] +jumpDestsOfInstr :: Instr -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - BCC _ id _ -> [id] - BCCFAR _ id _ -> [id] - BCTR targets _ _ -> [id | Just id <- targets] + BCC _ id _ -> [Just id] + BCCFAR _ id _ -> [Just id] + BCTR targets _ _ -> [Just id | Just id <- targets] _ -> [] ===================================== compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs ===================================== @@ -207,7 +207,7 @@ cleanForward platform blockId assoc acc (li : instrs) -- Remember the association over a jump. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accJumpValid assoc) targets cleanForward platform blockId assoc (li : acc) instrs @@ -386,7 +386,7 @@ cleanBackward' liveSlotsOnEntry reloadedBy noReloads acc (li : instrs) -- it always does, but if those reloads are cleaned the slot -- liveness map doesn't get updated. | LiveInstr instr _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr = do let slotsReloadedByTargets = IntSet.unions ===================================== compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs ===================================== @@ -57,7 +57,7 @@ joinToTargets block_live id instr = return ([], instr) | otherwise - = joinToTargets' block_live [] id instr (jumpDestsOfInstr instr) + = joinToTargets' block_live [] id instr (jumpBlockDestsOfInstr instr) ----- joinToTargets' ===================================== compiler/GHC/CmmToAsm/Reg/Liveness.hs ===================================== @@ -468,7 +468,7 @@ slurpReloadCoalesce live -- if we hit a jump, remember the current slotMap | LiveInstr (Instr instr) _ <- li - , targets <- jumpDestsOfInstr instr + , targets <- jumpBlockDestsOfInstr instr , not $ null targets = do mapM_ (accSlotMap slotMap) targets return (slotMap, Nothing) @@ -760,7 +760,7 @@ sccBlocks blocks entries mcfg = map (fmap node_payload) sccs sccs = stronglyConnCompG g2 getOutEdges :: Instruction instr => [instr] -> [BlockId] - getOutEdges instrs = concatMap jumpDestsOfInstr instrs + getOutEdges instrs = concatMap jumpBlockDestsOfInstr instrs -- This is truly ugly, but I don't see a good alternative. -- Digraph just has the wrong API. We want to identify nodes @@ -837,7 +837,7 @@ checkIsReverseDependent sccs' slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets - $ map (mkUniqSet . jumpDestsOfInstr) + $ map (mkUniqSet . jumpBlockDestsOfInstr) [ i | LiveInstr i _ <- instrs] @@ -1047,7 +1047,7 @@ liveness1 platform liveregs blockmap (LiveInstr instr _) -- union in the live regs from all the jump destinations of this -- instruction. - targets = jumpDestsOfInstr instr -- where we go from here + targets = jumpBlockDestsOfInstr instr -- where we go from here not_a_branch = null targets targetLiveRegs target ===================================== compiler/GHC/CmmToAsm/X86/Instr.hs ===================================== @@ -672,13 +672,16 @@ isJumpishInstr instr jumpDestsOfInstr :: Instr - -> [BlockId] + -> [Maybe BlockId] jumpDestsOfInstr insn = case insn of - JXX _ id -> [id] - JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] + JXX _ id -> [Just id] + JMP_TBL _ ids _ _ -> [(mkDest dest) | Just dest <- ids] _ -> [] + where + mkDest (DestBlockId id) = Just id + mkDest _ = Nothing patchJumpInstr ===================================== testsuite/tests/codeGen/should_run/T24507.hs ===================================== @@ -0,0 +1,15 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE GHCForeignImportPrim #-} +{-# LANGUAGE UnliftedFFITypes #-} + +module Main where + +import GHC.Exts + +foreign import prim "foo" foo :: Int# -> Int# + +main = do + + let f x = case x of I# x' -> case foo x' of x -> print (I# x) + mapM_ f [1..7] \ No newline at end of file ===================================== testsuite/tests/codeGen/should_run/T24507.stdout ===================================== @@ -0,0 +1,7 @@ +1 +2 +2 +2 +2 +2 +2 ===================================== testsuite/tests/codeGen/should_run/T24507_cmm.cmm ===================================== @@ -0,0 +1,35 @@ +#include "Cmm.h" + +foo(W_ x) { + + switch(x) { + case 1: goto a; + case 2: goto b; + case 3: goto c; + case 4: goto d; + case 5: goto e; + case 6: goto f; + case 7: goto g; + } + return (1); + + a: + return (1); + b: + jump bar(); + c: + jump bar(); + d: + jump bar(); + e: + jump bar(); + f: + jump bar(); + g: + jump bar(); + +} + +bar() { + return (2); +} \ No newline at end of file ===================================== testsuite/tests/codeGen/should_run/all.T ===================================== @@ -243,3 +243,6 @@ test('MulMayOflo_full', test('T24264run', normal, compile_and_run, ['']) test('T24295a', normal, compile_and_run, ['-O -floopification']) test('T24295b', normal, compile_and_run, ['-O -floopification -fpedantic-bottoms']) + +test('T24507', [req_cmm], multi_compile_and_run, + ['T24507', [('T24507_cmm.cmm', '')], '-O2']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/700e393bd3c2cb4d6e15101f1bbdf7522871ee7b -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/700e393bd3c2cb4d6e15101f1bbdf7522871ee7b You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 14:42:26 2024 From: gitlab at gitlab.haskell.org (Rodrigo Mesquita (@alt-romes)) Date: Tue, 19 Mar 2024 10:42:26 -0400 Subject: [Git][ghc/ghc] Pushed new branch wip/romes/24562 Message-ID: <65f9a4524b837_2621dc918e3dc17213d@gitlab.mail> Rodrigo Mesquita pushed new branch wip/romes/24562 at Glasgow Haskell Compiler / GHC -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/romes/24562 You're receiving this email because of your account on gitlab.haskell.org. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gitlab at gitlab.haskell.org Tue Mar 19 15:30:45 2024 From: gitlab at gitlab.haskell.org (Apoorv Ingle (@ani)) Date: Tue, 19 Mar 2024 11:30:45 -0400 Subject: [Git][ghc/ghc][wip/T24552] Fix for #24552 (see testcase T24552) Message-ID: <65f9afa539744_2621dca9dbb8824372e@gitlab.mail> Apoorv Ingle pushed to branch wip/T24552 at Glasgow Haskell Compiler / GHC Commits: fee59d05 by Apoorv Ingle at 2024-03-19T10:28:59-05:00 Fix for #24552 (see testcase T24552) Fixes for a bug in desugaring pattern synonyms matches. It now matches the expected semantics. The desugaring for match via `matchWrapper` was overly complex (and wrong) which was introduced while working on expanding `do`-blo