[Git][ghc/ghc][wip/case-bndr-unf] 13 commits: add options for resizing bytearrays (#27244)
Simon Peyton Jones pushed to branch wip/case-bndr-unf at Glasgow Haskell Compiler / GHC Commits: 13dff5d0 by L0neGamer at 2026-10-22T21:37:31-04:00 add options for resizing bytearrays (#27244) add five mutable bytearray resizing operations for various kinds of pinnedness and aligning. - prefer unpinned when allocating new array (``resizeMutableByteArrayPreferUnpinned#``; the ``resizeMutableByteArray#`` default) - prefer pinned when allocating new array (``resizeMutableByteArrayPreferPinned#``) - prefer aligned and pinned when allocating new array (``resizeMutableByteArrayPreferAlignedPinned#``) - prefer same as input bytearray when allocating new array (``resizeMutableByteArrayKeepPinnedness#``) - ensure the output array is aligned and pinned after operation (``resizeMutableByteArrayMakeAlignedPinned#``) - - - - - 0c17201c by Sylvain Henry at 2026-10-22T21:38:23-04:00 JS: implement performMinorGC and performBlockingMajorGC (#28012) GHC.Internal.System.Mem imports three C entry points: performMajorGC, performGC (for performMinorGC) and performBlockingMajorGC. The JS RTS only defined h$performMajorGC, so calling performMinorGC or performBlockingMajorGC threw "ReferenceError: h$performGC is not defined" at runtime. The JS RTS has a single non-generational collector, so both missing entry points are now aliases of h$performMajorGC. Add a test that calls every GC entry point of System.Mem. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> - - - - - 7a631ff2 by L0neGamer at 2026-10-23T09:11:39-04:00 Mon(a|oi)d of No (Return|Mappend) progress (!15795) Make non-canonical definitions of return and mappend non-suppressible errors, and make canonical definitions of those methods warnings. CLC proposal: https://github.com/haskell/core-libraries-committee/issues/328 - - - - - 14656fd4 by Simon Jakobi at 2026-10-23T09:12:27-04:00 Cmm: keep the CBE substitution idempotent When blocks are merged over multiple rounds during common block elimination, a block that won a merge in an earlier round can still lose a merge in a later round. The substitution map (Subst) used to record this as a chain: the earlier loser mapped to a block that was itself eliminated. In PLT terminology, the substitution became *non-idempotent*. Applying such a substitution with a single lookup left edges to unreachable blocks in the Cmm graph, eventually leading to a setInfoTableStackMap panic (#27368). With this patch, each round's fresh substitutions are applied to the old ones as they are added (extendSubst), so every eliminated block maps directly to its final replacement and the substitution stays idempotent. Fixes #27368. Assisted-by: Claude Fable 5.1 - - - - - 92848e61 by Evgeny Malyshev at 2026-10-23T20:26:04-04:00 hadrian: Include transitive dependencies in Haddock builds Haddock needs indirect dependency interfaces to resolve references to definitions outside a package's direct dependencies. Expose Cabal's configured dependency closure through ContextData and use it alongside the direct list, preserving direct-interface precedence. Bump Shake's cache version for the serialized oracle change. Add a Hadrian selftest requiring template-haskell's indirect ghc-prim interface. Fixes #25850. Fixes #27786. Assisted-By: OpenAI Codex Metric Increase: haddock.Cabal - - - - - 5e8ae81b by Zubin Duggal at 2026-10-23T20:26:47-04:00 WinIO: Don't confuse Win32 errors and NTSTATUS codes WinIO misinterpreted NTSTATUS codes as Win32 errors, and had some ad hoc logic to deal with this. However, this logic was incomplete and resulted in the mishandling of results of certain I/O operations (see testcase). Now the `ErrCode` argument in `CompletionCallback` is always the Win32 error code, and we convert the NTSTATUS using RtlNtStatusToDosError. Also when an overlapped/async operation such as ReadFile fails immediately, with a Win32 error such as ERROR_BROKEN_PIPE, we don't get a further completion notification, so we never recorded the failure. This worked by coincidence earlier, because `STATUS_PENDING` happened to have the same numerical code as `ERROR_NO_MORE_ITEMS`, but it doesn't now that we translate `STATUS_PENDING` into the correct Win32 error code (`ERROR_IO_PENDING`). Fix this by using the Win32 error value we obtained when an operation returns `STATUS_PENDING`. Fixes #27971 - - - - - c42ed66a by Martijn Bastiaan at 2026-10-24T16:00:42+02:00 Add single-threaded test for #27526 + #27123 Issue #27526 is a duplicate of #27123, which has already been fixed in HEAD. The proposed patch in the former carries a "nicer" regression test in that it doesn't rely on multi-threading to trigger. Closes #27526 - - - - - 7f73f515 by Simon Peyton Jones at 2026-10-24T17:29:19-04:00 Refactor QuickLook a bit This MR simply refactors QuickLook a bit. In particular, it simplifies `tcApp`, and moves shared code into `finishApp`. It also adds `Note [QuickLook: arguments before result]` responding to #26599. There should be no user-visible changes, except perhaps in error messages, which improve marginally. For some reason T24984 compiles 8% faster. I'll take the win! Metric Decrease: T24984 - - - - - a4a3a964 by Alan Zimmerman at 2026-10-24T17:30:03-04:00 EPA: Use AnnList for XClosedTypeFamily We now have TTG annotations for FamilyInfo. Make use of it to store the AnnList annotations for a closed type family. - - - - - 0172589a by Simon Peyton Jones at 2026-10-26T13:14:03+00:00 Make pushCast pure, and move it to Simplify.Utils pushCast and pushCastMCo were in the SimplM monad, but no longer do anything monadic. (Historically, pushing a coercion into an argument used to simplify that argument; but now the coercion is recorded in the sc_cast field of ApplyToVal.) This patch makes them pure functions, and moves them, together with addCastMCo, optOutCoercion and Note [The sc_cast field of ApplyToVal], from GHC.Core.Opt.Simplify.Iteration to GHC.Core.Opt.Simplify.Utils, alongside the SimplCont type they manipulate. No change in behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> - - - - - d3edca55 by Simon Peyton Jones at 2026-10-26T16:21:31+00:00 Lambda and case binders have vanilla IdInfo (#27965) Lambda binders, case binders, and case-alternative binders should never have RULES, a (non-default) inline pragma, or a stable unfolding. See the new Note [Lambda and case binders have vanilla IdInfo] in GHC.Core. This patch * Makes Core Lint check the invariant, using the new predicate GHC.Types.Id.lamBndrInfoOK. * Fixes the desugarer, which violated it. For a strict binding let !x = rhs in body we generate let x = rhs in case x of x { DEFAULT -> body } re-using x (shadowed) as the case binder; see Note [Desugar Strict binds]. But the case binder inherited x's IdInfo, including, say, a NOINLINE pragma (e.g. `res1` in GHC.Internal.Control.Monad.ST.Lazy.Imp). Now GHC.HsToCore.Utils.seqVar gives the case binder vanilla IdInfo. This was not just a matter of taste. For example h fm s = let {-# NOINLINE res1 #-} !res1 = fm s !(f, s') = res1 in (f+1, s') The NOINLINE case binder becomes a NOINLINE alias `let res3 = res2`, which is never inlined, and survives (as a silly join point) into the final code. * Fixes the Simplifier, which could violate it when duplicating a StrictBind continuation, which makes a join point let x = <> in b ==> join j x = b in j <> If x has such IdInfo, we now use a fresh binder for the join point let x = <> in b ==> join j x' = let x = x' in b in j <> See (DSB1) in Note [Duplicating StrictBind]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> - - - - - 7a3bd0a6 by Simon Peyton Jones at 2026-10-26T16:21:31+00:00 Add varIsHNF, and use it in move_transit_vars `varIsHNF v` is the same as `exprIsHNF (Var v)`, but avoids building the Var only to take it apart. The (Var v) case of exprIsHNFlike now uses the shared varIsHNFlike, so the two cannot drift apart. In GHC.Core.Opt.WorkWrap.Utils.move_transit_vars we had the guard isUnliftedType var_ty || exprIsHNF (Var var) but exprIsHNF is already True of variables of (definitely) unlifted type, so the isUnliftedType test was redundant. Now it is just (varIsHNF var). No change in behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> - - - - - db813b76 by Simon Peyton Jones at 2026-10-26T16:23:05+00:00 Use SimplClo for the argument of ApplyToVal This patch renames SimplSR to SimplClo (a "closure"), and uses it not only as the range of the Simplifier's substitution, but also as the argument of an ApplyToVal continuation. ApplyToVal used to have three fields sc_env :: StaticEnv sc_arg :: CoreExpr sc_cast :: MOutCoercion but now has just sc_dup :: DupFlag sc_arg :: SimplClo An un-simplified argument is (ContEx env arg mco), and an already-simplified one is (DoneEx arg _). See Note [The argument of ApplyToVal] in GHC.Core.Opt.Simplify.Utils. The main payoff is that, since the substitution maps an Id to a SimplClo, beta-reduction can substitute the argument for the lambda binder without further ado. Accordingly, preInlineUnconditionally is split into * preInlineLetUnconditionally, for let-bindings * preInlineBetaUnconditionally, for beta-redexes, which takes a SimplClo The latter omits some checks that cannot fire for lambda binders. Other notes * The new (ContEx env arg mco) form makes it easy to push a cast into an argument (mkCloCastMCo), whether or not it has been simplified. See Note [The MOutCoercion field of ContEx]. * Fixes #27963. contOutArgs, which supplies the arguments for Plan (BEFORE) rule matching, ignored the sc_cast field of ApplyToVal. So in (f |> co) n ==> f (n |> co1) -- co1 in sc_cast a rule for `f` saw `f n` rather than `f (n |> co1)`, and failed to match (the rule matcher checks the types of template variables). If f's unfolding is active, f may then be inlined, and the rule is lost for good. Now contOutArgs uses simplCloExpr, which includes the pending cast. Almost no change in behaviour, except for the #27963 bug-fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> - - - - - 168 changed files: - + changelog.d/25850 - + changelog.d/27368 - + changelog.d/27971 - + changelog.d/28012 - + changelog.d/T27962 - + changelog.d/T27963 - + changelog.d/monad-of-no-return-canonical - + changelog.d/resizeMutableByteArray-pinnedness - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/ByteCode/Asm.hs - compiler/GHC/Cmm/CommonBlockElim.hs - compiler/GHC/CmmToAsm/CFG/Dominators.hs - compiler/GHC/CmmToLlvm/CodeGen.hs - compiler/GHC/Core.hs - compiler/GHC/Core/Lint.hs - compiler/GHC/Core/Opt/Simplify/Env.hs - compiler/GHC/Core/Opt/Simplify/Iteration.hs - compiler/GHC/Core/Opt/Simplify/Utils.hs - compiler/GHC/Core/Opt/SpecConstr.hs - compiler/GHC/Core/Opt/WorkWrap/Utils.hs - compiler/GHC/Core/Utils.hs - compiler/GHC/Data/FastString.hs - compiler/GHC/Data/OrdList.hs - compiler/GHC/Data/Pair.hs - compiler/GHC/Data/Word64Map/Internal.hs - compiler/GHC/Data/Word64Set/Internal.hs - compiler/GHC/Driver/CmdLine.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/HsToCore/Pmc/Types.hs - compiler/GHC/HsToCore/Utils.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/JS/Opt/Simple.hs - compiler/GHC/Parser.y - compiler/GHC/Rename/Env.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/StgToCmm/Prim.hs - compiler/GHC/StgToJS/Prim.hs - compiler/GHC/Tc/Deriv/Generate.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/App.hs - compiler/GHC/Tc/Solver/Monad.hs - compiler/GHC/Tc/Types/Constraint.hs - compiler/GHC/Tc/Utils/TcMType.hs - compiler/GHC/ThToHs.hs - compiler/GHC/Types/Basic.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/Hint.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Types/Id.hs - compiler/GHC/Types/Unique/FM.hs - compiler/GHC/Types/Unique/Map.hs - compiler/GHC/Unit/External/ModuleOrigin.hs - compiler/GHC/Unit/External/Visibility.hs - compiler/GHC/Utils/Monad/Codensity.hs - compiler/GHC/Utils/Ppr/Colour.hs - compiler/ghc.cabal.in - docs/users_guide/using-warnings.rst - ghc/ghc-bin.cabal.in - hadrian/src/Hadrian/Haskell/Cabal/Parse.hs - hadrian/src/Hadrian/Haskell/Cabal/Type.hs - hadrian/src/Main.hs - hadrian/src/Rules/Documentation.hs - hadrian/src/Rules/Selftest.hs - hadrian/src/Settings/Warnings.hs - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - + libraries/base/tests/IO/T27971.hs - + libraries/base/tests/IO/T27971.stdout - libraries/base/tests/IO/all.T - libraries/ghc-internal/ghc-internal.cabal.in - libraries/ghc-internal/src/GHC/Internal/Base.hs - libraries/ghc-internal/src/GHC/Internal/Event/Windows.hsc - libraries/ghc-internal/src/GHC/Internal/Event/Windows/FFI.hsc - libraries/ghc-internal/src/GHC/Internal/IO/Windows/Handle.hsc - rts/PrimOps.cmm - rts/RtsSymbols.c - rts/include/stg/MiscClosures.h - rts/js/environment.js - testsuite/tests/ado/ado-optimal.hs - testsuite/tests/ado/ado001.hs - + testsuite/tests/codeGen/should_compile/T27368.hs - testsuite/tests/codeGen/should_compile/all.T - testsuite/tests/concurrent/T13615/Parallel.hs - testsuite/tests/concurrent/should_run/T21651.hs - testsuite/tests/concurrent/should_run/setnumcapabilities001.hs - testsuite/tests/cpranal/should_run/T20598a.hs - testsuite/tests/deriving/should_compile/T13758.hs - testsuite/tests/deriving/should_run/all.T - + testsuite/tests/deriving/should_run/drvrun-canonical-methods.hs - + testsuite/tests/deriving/should_run/drvrun-canonical-methods.stderr - + testsuite/tests/deriving/should_run/drvrun-canonical-methods.stdout - testsuite/tests/determinism/determ017/A.hs - testsuite/tests/dmdanal/should_compile/T9208.hs - testsuite/tests/generics/T27245.hs - testsuite/tests/generics/T27245.stdout - testsuite/tests/ghci.debugger/scripts/T14628.stderr - testsuite/tests/haddock/perf/Fold.hs - testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr - testsuite/tests/hiefile/should_compile/hie002.hs - testsuite/tests/hpc/raytrace/Eval.hs - testsuite/tests/indexed-types/should_compile/T3787.hs - testsuite/tests/indexed-types/should_fail/T7729.hs - testsuite/tests/indexed-types/should_fail/T7729a.hs - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32 - testsuite/tests/interface-stability/ghc-prim-exports.stdout - testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32 - testsuite/tests/module/mod133.hs - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/KindSigs.stderr - testsuite/tests/perf/compiler/T13253.hs - testsuite/tests/perf/compiler/T14683.hs - testsuite/tests/perf/compiler/T16473.hs - testsuite/tests/perf/compiler/T18730_A.hs - testsuite/tests/perf/compiler/T25723.hs - testsuite/tests/pmcheck/should_compile/T11276.hs - + testsuite/tests/primops/should_run/ResizeByteArrayPinnedness.hs - + testsuite/tests/primops/should_run/ResizeByteArrayPinnedness.stdout - testsuite/tests/primops/should_run/all.T - testsuite/tests/profiling/should_compile/T19894/StreamK.hs - testsuite/tests/profiling/should_run/T3001-2.hs - testsuite/tests/programs/galois_raytrace/Eval.hs - testsuite/tests/rebindable/rebindable2.hs - + testsuite/tests/rename/should_fail/Noncanonical.hs - + testsuite/tests/rename/should_fail/Noncanonical.stderr - testsuite/tests/rename/should_fail/all.T - testsuite/tests/rename/should_fail/rnfail026.hs - + testsuite/tests/rts/T27526.hs - + testsuite/tests/rts/T27526.stdout - + testsuite/tests/rts/T28012.hs - + testsuite/tests/rts/T28012.stdout - testsuite/tests/rts/all.T - testsuite/tests/rts/ipe/IpeStats/Fold.hs - testsuite/tests/simplCore/should_compile/T14908_Deps.hs - + testsuite/tests/simplCore/should_compile/T27962.hs - + testsuite/tests/simplCore/should_compile/T27963.hs - + testsuite/tests/simplCore/should_compile/T27963.stderr - + testsuite/tests/simplCore/should_compile/T27965.hs - testsuite/tests/simplCore/should_compile/all.T - testsuite/tests/simplCore/should_compile/simpl017.hs - testsuite/tests/typecheck/should_compile/DeepSubsumption02.hs - testsuite/tests/typecheck/should_compile/T4524.hs - testsuite/tests/typecheck/should_compile/T4969.hs - testsuite/tests/typecheck/should_fail/T22707.hs - testsuite/tests/typecheck/should_fail/T22707.stderr - testsuite/tests/typecheck/should_fail/T25950.stderr - testsuite/tests/typecheck/should_fail/T7019.hs - testsuite/tests/typecheck/should_fail/T8450.stderr - testsuite/tests/typecheck/should_fail/T8603.hs - + testsuite/tests/warnings/should_compile/RedundantCanonicalMethods.hs - + testsuite/tests/warnings/should_compile/RedundantCanonicalMethods.stderr - testsuite/tests/warnings/should_compile/WarnNoncanonical.hs - testsuite/tests/warnings/should_compile/WarnNoncanonical.stderr - testsuite/tests/warnings/should_compile/all.T - utils/check-exact/ExactPrint.hs - utils/haddock/haddock-api/haddock-api.cabal - utils/haddock/haddock-api/src/Haddock/Convert.hs - utils/haddock/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs - utils/haddock/haddock-api/src/Haddock/Types.hs - utils/haddock/haddock-api/src/Haddock/Utils/Json.hs - utils/haddock/haddock-library/haddock-library.cabal - utils/haddock/haddock.cabal - utils/runghc/Main.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/360bcb51e9ef7eafcae105be6f3ee18... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/360bcb51e9ef7eafcae105be6f3ee18... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Simon Peyton Jones (@simonpj)