Skip to main content

IOG GHC Update #8

· 3 min read

Biweekly update from the GHC DevX team at IOG.

Previous updates can be found here.

JavaScript backend

  • Sylvain: fixed the implementation of some thread-related primops (listThreads, getThreadLabel...). See GHC!10303

  • Sylvain: regenerated Cabal lexer with a newer Alex containing his bug fix for the JS backend (cf previous update). Some Cabal tests had to be updated in the process because they were relying on an Alex bug which has been fixed. This raised the question of bug fixes vs the PVP. See Cabal#8896, Alex#227, and PVP#49.

  • Josh: added an implementation for mkdir for node targets. Primarily this is expected to be used by Cabal setup scripts, but any JS backend programs running on node will be able to use it. See GHC!10279.

  • Josh: fixed the -fcheck-prim-bounds flag for the JS backend. The old implementation mostly only caused false negatives in the bounds that were rejected (i.e. it would miss some invalid bounds), but it some cases there were also false positives, caused by casted byte array indexing operations being indexed on the casted type's size. See GHC!10234.

  • Josh: fixed the JS implementation for the access function on files. This function comes from C, but node also provides a direct equivalent - which the new implementation uses. See GHC!10301.

  • Luite: Worked on optimizing finalizers by disabling heap scanning and found an issue affecting debugIO in the base library. This is caused by the code generated for h$appendToHsStringA. A fix is now ready, see GHC!10312

Pipeline refactoring and new IR

  • Jeff: MR!10260 ready to land. This MR paves the way for the new IR, changes the small optimization pass the JavaScript backend had to target the current IR instead of directly printing optimized forms, and adds an IR to IR optimizer. CI shows that the compile time allocations for the JavaScript backend is reduced an average of 3.3% with a maximum reduction 13% with this MR. Note that these reductions come from cleaner code generation, not from the optimizer.

Testsuite and cleanup

  • Sylvain: replaced uses of obsolescent egrep with grep -E. Otherwise recent egrep programs print a warning that makes some GHC golden tests fail. See GHC#22351 and GHC!10308.

Documentation

  • Luite: Finished the blog post on the lightweight stacks and calling convention the JavaScript backend uses. This will be published on the IOG engineering blog shortly.

GHC Proposal #0134 (Deprecated Exports)

  • Bartek: Implemented the parsing and pretty printing of warnings of deprecated exports. See GHC!10283 for the partial implementation of the proposal so far.

Performance

  • Jeff : First case study on performance engineering for the Haskell Optimization Handbook is almost done. The case study demonstrates a first pass of performance engineering on the klister programming language's interpreter. The chapter demonstrates the use of ticky ticky, info-table, biography and retainer analysis profiling to gain a 6-fold improvement in the interpreter.

  • Josh: Updated the unboxed codebuffers implementation to include pattern synonyms for backwards-compatability. Now, the implementation of handle encoding in base can be updated to be more performant without requiring external changes. See GHC!9948.