Skip to main content

IOG GHC Update #35

ยท 3 min read

Triweekly update from the GHC DevX team at IOG.

Previous updates can be found here.

High-level Summaryโ€‹

  • Luite found the precise GHC commit introducing the performance regression in cardano-node. This was the reason why we were stuck with GHC 8.10. A fix has been provided in haskell.nix and, if performance tests are positive that the regression is gone, it should finally be possible to upgrade to a more recent GHC!

  • Sylvain fixed a bug on FreeBSD. Once backported to GHC 9.{6,8,10}, ghcup might start recommending GHC 9.6 or even a newer GHC release. Sylvain also did some triage on GHC's bug tracker, leading to several smallish patches in addition to the more substantive ones (see details below).

  • Jeff finished the Memory Footprints of Data Types chapter in the Haskell Optimization Handbook. Added a new RTS flag in a Haskell.nix patch migration and worked on refactoring the code generator to use an OrdList instead of a list.

Detailsโ€‹

Cardano performanceโ€‹

Luite: spent some time bisecting to find out why cardano-node is slower with recent GHC. It turned out to be speculative evaluation having a detrimental effect on allocations. GHC#25284

Parserโ€‹

Sylvain: fixed parsing of extended literals that was too permissive (e.g. 80#Int3 would be lexed as two tokens 80#Int and 3). GHC#25258 GHC!13272

Code generationโ€‹

Sylvain: fixed GHC build with -dppr-debug enabled (useful for debugging). GHC#25255 GHC!13260

Sylvain: fixed generation of a static closure for a datacon with an unboxed sum field (e.g. an unpacked sum type). GHC#25166 GHC!13146

Sylvain: added missing "absorb rules" in Core for binary and/or operations. GHC#16351 GHC!13273

Sylvain: improved deriving of Enum instances by reusing more code for error cases and by using a single unsigned comparison instead of two signed ones to check for out-of-bound errors. GHC#16364 GHC!13266

Jeff: Refactored the Code Generator to use an OrdList rather than a list. This slightly un-pessimizes the code generator's implementation by removing a lot of superfluous Data.List.reverse but is still a work in progess. See GHC#19910.

RTS linkerโ€‹

Sylvain, Jeff: upstreamed the haskell.nix patch adding some support for ELF hidden symbols in the RTS linker GHC#25191 GHC!13013

Sylvain: upstreamed an adaptation of the haskell.nix patch adding support for additional RTS linker symbols. This is particularly useful for cross-compilation. See the added documentation in the patch. GHC#25155 GHC!13129

Sylvain: upstreamed an haskell.nix patch fixing support for the RTS closure_sizeW_ with the RTS linker. GHC#25252 GHC!13249

RTS IO and Event managersโ€‹

Sylvain: fixed file descriptor closing for the timerfd-based ticker after a fork. GHC#25280 GHC!13279

Sylvain: fixed the invalid closing of a kqueue file descriptor after a fork leading to crashes on FreeBSD. GHC#24672 GHC!13276

JavaScript backendโ€‹

Sylvain: fixed the build system to avoid trying to use libffi with the JS backend for adjustors. GHC#25159 GHC!13224

Sylvain: fixed a helper used to interact with C code compiler to WebAssembly from JavaScript. GHC#25288 GHC!13303