Skip to main content

IOG GHC Update #14

· 4 min read

Biweekly update from the GHC DevX team at IOG.

Previous updates can be found here.

JavaScript backend

Note that all GHC compilers (including JavaScript and Windows cross-compilers) can be easily used from the Nix environments we provide: see https://github.com/input-output-hk/devx#compilers-and-flavours

  • Sylvain: implemented support for rmdir and fixed some issues with lstat. GHC!10803

  • Sylvain: refactored and cleaned up the code responsible for converting Haskell types into their JavaScript representation. GHC!10806 and GHC#23314.

  • Sylvain: fixed a bug in the JS linker that was assuming that the unit-id of a program was always main. This is no longer true to support multiple home-units. GHC#23613 and GHC!10819.

  • Sylvain: fixed support for utimes/futimes/lutimes in unix library to support touchFd on JavaScript target (to fix Ben's GHC!9237). Not yet merged because it lacks CI (this triggered the work on fixing ghcup). Unix#285.

  • Jeff: Re-enabled the CI perf tests for the JS Backend. These were accidentally disabled because in Josh fixed a bug in the testsuite that treated the JavaScript backend as a Stage1 compiler, which it is. But Stage1 compilers are built with assertions and thus the testsuite does not track performance metrics. The fix changes the JavaScript backend CI to add a debug job and a release job which tracks the performance metrics.

  • Luite: Looked into some file access failures that caused the JavaScript CI pipeline to fail and found a related issue of platform compatibility, because of mode flags in the stat struct. GHC#23651

  • Luite: Looked into CI breakage and found that emsdk 3.1.42 has some changes in data layout relative to 3.1.41. In particular changes in the stat struct were causing file operations to fail. CI is fixed now by pinning it to 3.1.40, but work is still ongoing to make sure that we can handle a wider emsdk version range and to test for a compatible version at installation time. GHC#23649

  • Josh: fixed an issue where toJSString didn't support unicode code points that take up more than one UTF-16 value (i.e. values greater than 2^16). See: GHC#23628 GHC!10838

  • Josh: fixed an issue where Buffers in ghcjs-base were producing incorrect results. This was a result of changes between GHCJS and the JavaScript backend:

    • Addr# is now a pair of (pointer, offset) and is passed as function arguments
    • A value was being returned as a MK_TUP2, which is a JavaScript macro that expands to apply the Haskell (,) constructor. This is no longer supported in the JavaScript backend, in favour of RETURN_UBX_TUP2, which is another macro that returns multiple values in an unboxed way through the JavaScript RTS.
  • Josh: added a wiki page to track the support of the JavaScript backend for various libraries. GHC Wiki

Incomplete Record Selectors

  • Bartek: The Incomplete Record Selectors MR is now ready to be merged, See GHC!10736

Deprecated Instances

  • Bartek: A lot of the major work done for the Deprecated Instances, will soon be creating a MR for it
  • Bartek: Some investigation of how interface tidying can potentially affect this proposal and the Deprecated Exports proposal, See GHC!10844

Miscellaneous

  • Jeff: Continued work on adding Haskell Error Index links to GHC's error messages. Almost done, only windows is failing on CI.

  • Bartek: Work on several reported bugs is moving forward, See GHC#23569, GHC#23546, GHC#23520, and GHC#23279