Skip to main content

IOG GHC Update #36

ยท 2 min read

Triweekly update from the GHC DevX team at IOG.

Previous updates can be found here.

High-level Summaryโ€‹

We confirmed that speculative evaluation (GHC#25284 is indeed causing the Cardano node performance regression and that there are no other blocking performance issues. This means that we can upgrade Cardano to GHC 9.6 once we have a release with a backported fix.

Detailsโ€‹

Code generationโ€‹

Sylvain: fixed z-encoding of tuple symbols issue leading to overlong symbols. GHC#25364 GHC!13404.

Jeff: Swapped the use of lists with an OrdList GHC!13221 GHC's code generator. Unfortunately, this led to a 2% increase in compile time allocations which is unavoidable due to the need to pattern match on pattern synonyms that allocate a new spine for the OrdList. Trying to make the OrdList more strict does not work because the knot tying in the Cmm Parser requires a certain amount of laziness, and OrdList is used throughout the code generator. Thus, changes in the OrdList's strictness impact the knot tying and can make the compiler loop. See GHC#19245 for more knot tying mayhem.

Sylvain: tried to use the Cosmopolitan toolchain with GHC. Still a work in progress.

GHC/Base Stabilityโ€‹

Jeff: Added an RTS flag, called --optimistic-linking to make the runtime linker less conservative. GHC!13012.

Jeff: Got CLC approval to improve the stability of base by removing GHC's RTS flags out of base and into ghc-experimental. The present flag api in base will be unchanged and deprecated. This work lays the groundwork for the transition. New flags will be exposed through ghc-experimental instead of base. GHC!13428.

Template Haskell / GHCi interpreterโ€‹

Luite: added locking in the communication with the external interpreter. This fixes errors and deadlocks when using Template Haskell in combination with parallel (-j) builds. GHC#25083 GHC!13447.

JavaScript backendโ€‹

Sylvain: started writing a blog post to showcase the JavaScript backend feature allowing it to compile and to link with C sources compiled to WebAssembly/JavaScript. Once completed it will be published on this blog.

Binary Sizesโ€‹

Jeff: Made the SrcLoc data type more strict, which allowed GHC to automatically unpack certain fields. This yields about a 7% reduction in certain boot libraries like exception. See GHC!13381, this also closes CLC!55. While that works we can still go farther. GHC!13438 tries to squeeze these fields into just two machine words (instead of 12); this is still in draft though.