[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: Add GHC.Internal.Unboxed.Do: do-notation for unboxed values (#27944)
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 71808e29 by Sylvain Henry at 2026-10-22T04:50:24-04:00 Add GHC.Internal.Unboxed.Do: do-notation for unboxed values (#27944) QualifiedDo operators can be representation-polymorphic: a do-block is expanded into ordinary applications before typechecking, and the only check on a bound variable is the deferred fixed-runtime-rep check. A representation-polymorphic (>>=) cannot be defined directly, though, because its body would bind a variable of unknown representation. The new module provides such operators for State#-passing code as methods of a class indexed by RuntimeRep, with one instance per representation. With optimisation the dictionaries disappear and a block compiles to the usual nested case expressions: Ubx.do { x <- readWordArray# mba 0# -- x :: Word# ; writeWordArray# mba 1# x -- unit actions are statements ; Ubx.pure x } Also add users guide documentation and tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> - - - - - 33247780 by Sylvain Henry at 2026-10-22T04:50:24-04:00 Bignum: use Ubx.do for State#-passing code (#27944) Rewrite the State#-passing code of the GHC.Internal.Bignum modules (Primitives, WordArray, BigNat, Natural, Integer, Backend.Native, Backend.GMP) with the qualified do-notation of GHC.Internal.Unboxed.Do. Nested case chains such as case newWordArray# sz s of { (# s, mwa #) -> case act mwa s of { s -> unsafeFreezeByteArray# mwa s }} become Ubx.do mwa <- newWordArray# sz act mwa unsafeFreezeByteArray# mwa The optimised Core is unchanged (compared per top-level binding). BigNat now enables MonoLocalBinds: local loops written with Ubx.do must stay monomorphic in the state type, otherwise GHC does not turn them into join points. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> - - - - - 593f5f5b by Sylvain Henry at 2026-10-22T04:51:16-04:00 JS: remove archive padding after wasm objects (#25665) On Darwin hosts, emar (llvm-ar) writes archives in the Darwin format when the first member is not a known object file, which is the case for the archives of the JS backend. This format pads each member to 8 bytes with '\n' and includes the padding in the member size. Wasm objects do not accept trailing bytes: wasm-ld failed with "section too large". The JS linker now removes this padding when it extracts a wasm object from an archive. In addition, Hadrian passes --format=gnu to emar for the JS target. See Note [Wasm objects in Darwin archives]. Also document the format of Cc (wasm) objects in Note [Cc object format]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> - - - - - 7a4c2305 by L0neGamer at 2026-10-22T13:06:56-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#``) - - - - - c0df89a6 by Sylvain Henry at 2026-10-22T13:07:01-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> - - - - - 54 changed files: - + changelog.d/25665 - + changelog.d/28012 - + changelog.d/resizeMutableByteArray-pinnedness - + changelog.d/unboxed-do - compiler/GHC/Builtin/primops.txt.pp - compiler/GHC/StgToCmm/Prim.hs - compiler/GHC/StgToJS/Linker/Linker.hs - compiler/GHC/StgToJS/Object.hs - compiler/GHC/StgToJS/Prim.hs - docs/users_guide/exts/qualified_do.rst - hadrian/src/Settings/Builders/Ar.hs - libraries/base/src/GHC/Base.hs - libraries/base/src/GHC/Exts.hs - libraries/ghc-internal/CHANGELOG.md - libraries/ghc-internal/ghc-internal.cabal.in - libraries/ghc-internal/src/GHC/Internal/Bignum/Backend/GMP.hs - libraries/ghc-internal/src/GHC/Internal/Bignum/Backend/Native.hs - libraries/ghc-internal/src/GHC/Internal/Bignum/BigNat.hs - libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs - libraries/ghc-internal/src/GHC/Internal/Bignum/Natural.hs - libraries/ghc-internal/src/GHC/Internal/Bignum/Primitives.hs - libraries/ghc-internal/src/GHC/Internal/Bignum/WordArray.hs - + libraries/ghc-internal/src/GHC/Internal/Unboxed/Do.hs - rts/PrimOps.cmm - rts/RtsSymbols.c - rts/include/stg/MiscClosures.h - rts/js/environment.js - 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/javascript/Makefile - + testsuite/tests/javascript/T25665.hs - + testsuite/tests/javascript/T25665.pkg - + testsuite/tests/javascript/T25665.stdout - + testsuite/tests/javascript/T25665Lib.hs - + testsuite/tests/javascript/T25665_c.c - + testsuite/tests/javascript/T25665_js.js - testsuite/tests/javascript/all.T - + testsuite/tests/primops/should_run/ResizeByteArrayPinnedness.hs - + testsuite/tests/primops/should_run/ResizeByteArrayPinnedness.stdout - testsuite/tests/primops/should_run/all.T - testsuite/tests/qualifieddo/should_compile/all.T - + testsuite/tests/qualifieddo/should_compile/qdocompile003.hs - + testsuite/tests/qualifieddo/should_compile/qdocompile003.stderr - testsuite/tests/qualifieddo/should_fail/all.T - + testsuite/tests/qualifieddo/should_fail/qdofail006.hs - + testsuite/tests/qualifieddo/should_fail/qdofail006.stderr - testsuite/tests/qualifieddo/should_run/all.T - + testsuite/tests/qualifieddo/should_run/qdorun008.hs - + testsuite/tests/qualifieddo/should_run/qdorun008.stdout - + testsuite/tests/rts/T28012.hs - + testsuite/tests/rts/T28012.stdout - testsuite/tests/rts/all.T The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2122dc00c8967d010c4c93873535142... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2122dc00c8967d010c4c93873535142... 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)
-
Marge Bot (@marge-bot)