Skip to main content

IOG GHC Update #5

ยท 2 min read

Biweekly update from the GHC DevX team at IOG.

Previous updates can be found here.

JavaScript backendโ€‹

Luite: !10059 Implemented computing a valid LambdaFormInfo for the JavaScript backend so that interface files can be written without warnings. Fixes #23053.

Template Haskellโ€‹

Luite: !10008 implemented keeping track of subdirectories in GHC's temporary file manager. It has been updated after reviews and is now ready to be merged.

JavaScript EDSLโ€‹

Jeff: MR is open. In response to feedback from the team Jeff has added (and removed) several features that distinguish the eDSL from sunroof. These include:

  • removing threading and continuations
  • adding named unique variables and a proper switch statement
  • removing a dependency on the operational package
  • removing a dependency on the data-reify package
  • added a compilation function that compiles the eDSL to the IR the JavaScript backend uses.

These changes allow more of the RTS to be replaced in the eDSL and allow the RTS to be typed using Haskell's type system. For example, now the STG registers track the type of the values they hold. The RTS migration is now underway.

copyMutableArray primopsโ€‹

Sylvain: fixed JS implementations for copyMutableByteArray# and copySmallMutableArray primops. They were wrong in some cases when the source and target arrays overlap. See #23033 and !10037.

Testsuiteโ€‹

Sylvain: made a minor cleanup in the testsuite to correctly tag tests requiring Cmm support (which the JS backend doesn't have): !10043.

Callbacksโ€‹

Josh: ported GHCJS's GHCJS.Foreign.Callback module. Manual testing revealed some minor changes required in the JavaScript backend, including to base.GHC.JS.Prim, to make everything work as expected.

This will enable passing Haskell functions into foreign imports, which in turn enables a form of calling into Haskell from JavaScript code.


Compiler performanceโ€‹

Optimization Handbookโ€‹

Jeff: Work has begun on the first major case study: a performance regression in the sbv library.


RTS linkerโ€‹

Sylvain: helped fixing a RTS linker bug. The RTS ELF linker didn't properly take into account required section alignments and always used 16-bytes alignment. However AVX instructions generated by the C compiler may expect 32-bytes alignment (even if the code uses unaligned load intrinsics, the C compiler may optimize them into aligned load instructions, as was the case here). The fix was simple, the test case a bit more involved. See #23066 and !10087.