Contributions to GHC 9.6
Tags: GHC, Haskell April 1, 2023

This is my GHC activities report for GHC 9.6

I’ve made roughly 38 commits for the GHC 9.6 series at the time of writing.

This blog post only lists my personal contributions and thoughts and doesn’t engage my team nor IOG.

JavaScript backend

This time the focus of my team was to upstream GHCJS (Haskell to GHC compiler) into GHC. The commit adding the JS backend is a squash of a few hundreds of commits (about 522 commits in a branch before the squash) of which I’ve made over 60% (not that commits are a very good metrics).

External static plugins

I’ve spent quite some time trying to make GHC support more than one context at once to support plugins while doing cross-compilation: one context for the target, one context for the host (for plugins). I now think it’s a dead-end because the code still isn’t modular enough. It would be a lot of work to fix and there are opposing forces which make it very unlikely to happen in practice.

I’ve implemented a workaround called “external static plugins”. GHC still doesn’t know how to build plugins in a cross compiler, but if there are built beforehand and put in a library, it can now load them.

Appendix: commit list

# JavaScript

cc25d52e0f6 Add Javascript backend
d86cd08b268 Fix remaining issues with bound checking (#23123)
d5de8a2ab9d Hadrian: enable `-fcheck-prim-bounds` in validate flavour
86a9404a8bc Fix GHCJS OS platform (fix #23346)
5292bdf87f1 JS: fix getpid (fix #23399)
7083db5a7ff JS: fix thread-related primops
b821cdbd911 JS: fix for overlap with copyMutableByteArray# (#23033)
e0cfea59a30 Testsuite: decrease length001 timeout for JS (#22921)
6164ceb89b2 JS: disable debugging info for heap objects
bafa3899758 JS: replace "js" architecture with "javascript"
42ea9cea6ab JS: fix support for -outputdir (#22641)
8b1f1b4503b JS: fix object file name comparison (#22578)

# External static plugins

f95bbdcae3e Add support for external static plugins (#20964)

# Numeric

c284a3e8b1c Bignum: fix right shift of negative BigNat with native backend
9283b7d388d Avoid out-of-bound array access in bigNatIsPowerOf2 (fix #24066)
b6bd8c09e1e Add missing int64/word64-to-double/float rules (#23907)
7f203d00edd Numeric exceptions: replace FFI calls with primops

# Misc

1ae57288cab Fix unusable units and module reexport interaction (#21097)
1838c3d8ed5 GHC.HsToCore.Breakpoints: Slightly improve perf
83467435c4e Avoid using DynFlags in GHC.Linker.Unit (#17957)
f2e707077bf Hadrian: remove unused code
6f5ff4fa0ee Bump hadrian to LTS-19.8 (GHC 9.0.2)
5a5a28dafbb Split GHC.HsToCore.Foreign.Decl
5878f439d42 Enable USE_INLINE_SRT_FIELD on ARM64
acc268064da Some fixes to SRT documentation
913963271f9 MachO linker: fix handling of ARM64_RELOC_SUBTRACTOR
ef3c8d9e077 Don't store LlvmConfig into DynFlags
a4fbb589fd1 STG: only print cost-center if asked to
7a51125dff1 Rts: expose rtsOutOfBoundsAccess symbol
2d7ca624481 linker: fix linking with aligned sections (#23066)
826a311221c configure: support "windows" as an OS
e0d9ef66737 Fix RTS build on Windows
7d86db2be74 Hadrian: fix Windows cross-compilation
ef21780f8b8 Hadrian: correctly detect AR at-file support
b5c714545ab Don't let configure perform trivial substitutions (#21846)
9ab31f42da8 Testsuite: more precise test options
a2f53ac8d96 Add GHC.SysTools.Cpp module
0988a23d211 Enable popcount rewrite rule when cross-compiling