GHC WebAssembly Weekly Update, 2023-01-25

Two bugs sniped in two days. The stars seem to have aligned in my favor this week.

  • Fixed a bug in the unregisterised codegen (!9778). This bug affects all 32-bit targets, when a CmmRegOff is emitted with a 64-bit Cmm register operand and a negative offset. The negative offset would be emitted as something like (uint32_t)(-1), which is then implicitly casted to an incorrect 64-bit integer.
  • Fixed a bug in the wasm native codegen (!9798). This bug involves incorrect handling of floating-point negation, the previous behavior almost works, but can’t properly handle negative zero in IEEE754 floating-point numbers.
  • Created the 9.6 backporting MR including recent wasm-related fixes (!9807).
  • A small patch to add a release notes point for the wasm backend (!9811). The actual documentation still lives in ghc-wasm-meta for the time being, given how rapidly things are changing; those shall be moved back to the user guide once the dust really settles.
  • Updated ghc-wasm-meta (ghc-wasm-meta!11), with multiple improvements:
    • The GHC wasm backend’s x86_64-linux bindists are now produced by the upstream nightly pipelines. They are fully statically linked and work in all distros, even in NixOS, without needing to patchelf. In addition to the existing gmp/native flavours, the unreg flavour is also provided, so users can also experiment with the unregisterised codegen.
    • The WASI reactor tutorial is added to README. Future versions will add more examples and more detailed explanations.
    • Two integration tests are added to catch potential downstream breakage: the unix package’s wasm test, and the ormolu-live compile test.
  • A wasi-libc patch (#388) to add a safety check for WASI reactor modules, ensuring the _initialize function traps if called more than once.

Previous update: https://discourse.haskell.org/t/ghc-webassembly-weekly-update-2023-01-18

9 Likes