Contributions to GHC 9.4
Tags: GHC, Haskell August 10, 2022

This is my GHC activities report for GHC 9.4

I’ve made roughly 176 commits for the GHC 9.4 series at the time of writing.

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

Mostly a continuation of my work for GHC-9.2.

Quite a lot of work in progress towards:

  • allowing bignum primitives to inline
  • supporting plugins in cross-compilers
  • Windows support
  • performance
  • and a few other things.

Appendix: commit list

# Numeric

0d758dc36e1 Add missing int64/word64-to-double/float rules (#23907)
3570eda512d Fix comments about Int64/Word64 primops
c48a7c3a616 Use Word64# primops in Word64 Num instance
be9d78625f1 Fix Int64/Word64's Enum instance fusion
4c86df25d36 Fix Int64ToInt/Word64ToWord rules on 32-bit architectures
e279ea64792 Add missing Int64/Word64 constant-folding rules
c8d89f62a32 Bignum: add missing rule
a901a1ae670 Bignum: allow Integer's signum to inline (#20361)
758e0d7bbe5 Bignum: allow Integer predicates to inline (#20361)
0b575899eca Bignum: constant folding for bigNatCompareWord# (#20361)
4d44058d631 Bignum: transfer NOINLINE from Natural to BigNat
714568bb9e6 Bignum: remove outdated comment
3a5a5c859b5 Bignum: allow naturalToWordClamp/Negate/Signum to inline (#20361)
44886aaba46 Bignum: allow inlining of naturalEq/Ne/Gt/Lt/Ge/Le/Compare (#20361)
e1d02fb0f04 Bignum: allow naturalEq#/Ne# to inline (#20361)
11240b7427c Constant folding for (.&.) maxBound (#20448)
b3267fadd42 Constant folding for negate (#20347)
33eb4a4e396 Constant-folding for timesInt2# (#20374)
d41cfdd4455 Constant folding for ctz/clz/popCnt (#20376)
089de88ef52 Canonicalize bignum literals
f72aa31d36f Bignum: refactor conversion rules
247684adc83 Bignum: remove unused extra files
54880c131db Bignum: fix invalid hs-boot declaration (#19638)
a951e06921f Bignum: add BigNat Eq/Ord instances (#19647)
7bb3443a4fe Fix inlining of division wrappers
c308c9af2e1 Make divModInt# branchless
e50d06752e2 Allow divInt#/modInt# to inline (#18067)
8d069477b77 Refactor modInt# to make it branchless
59cf287d372 Refactor divInt# to make it branchless (#18067, #19636)
df4a0a53691 Bignum: bump to version 1.1 (#19846)
941d3792b2e Rules for sized conversion primops (#19769)
5798357d939 StgToCmm: use correct bounds for switches on sized values
748636388b0 Remove ad-hoc fromIntegral rules
a820f9002d8 Detect underflow in fromIntegral/Int->Natural rule
e5a4cfa5189 Bignum: don't allocate in bignat_mul (#20028)
8838241f7d6 Fix naturalToFloat/Double
453877600b7 Bignum: match on DataCon workers in rules (#19892)
df997fac54b Use quotRemWord in showWord
737b0ae194c Fix Integral instances for Words

# Cross-compilation, build system, Windows support...

69ab7f358a0 configure: support "windows" as an OS
9e07003f2aa Fix RTS build on Windows
35b059d8b52 Hadrian: fix Windows cross-compilation
3247e44aa25 Hadrian: correctly detect AR at-file support
8f8194539b6 linker: fix linking with aligned sections (#23066)
cc59648adbf Hadrian: allow testsuite to run with cross-compilers (#21292)
ed04aed2b2d Hadrian: use IntSet Binary instance for Way (#19209)
c82fb93476b Hadrian: avoid allocations in WayUnit's Read instance (#19209)
c062fac0023 Hadrian: remove useless imports
2509d676a77 Hadrian: avoid allocating in stageString (#19209)
88a945410fe Hadrian: avoid useless allocations in trackArgument
68a3665a73c Hadrian: bump stackage LTS to 18.18 (GHC 8.10.7)
bdeea37efc7 More support for optional home-unit
d9f5490591c Hadrian: fix windows cross-build (#20657)
3302f42a57a Fix windres invocation
8c0aec38c12 Hadrian: fix building/registering of .dll libraries
79a26df1475 Don't expose bignum backend in ghc --info (#20495)
bc498fdfa48 Bignum: expose backendName (#20495)
2800eee24d0 Make Word64 use Word64# on every architecture
20956e5784f Remove target dependent CPP for Word64/Int64 (#11470)
bbb1f6dab34 Hadrian: display command line above errors (#20490)
ecd6d14215e i386: fix codegen of 64-bit comparisons
3d31f11e83a Don't link plugins' units with target code (#20218)
41d6cfc4d36 Add Word64#/Int64# primops
5741caeb045 Only update config.sub when it already exists (#19574)
d014ab0db0c Remove dynamic-by-default (#16782)
8d87975ebe9 Produce constant file atomically (#19684)
b699c4fb0d2 Constants: add a note and fix minor doc glitches
2cdc95f9c06 Don't produce platformConstants file
085983e63bf Read constants header instead of global platformConstants
9c762f27d54 Generate parser for DerivedConstants.h
6623790d748 Hadrian: build check-* with -Wall/-Werror
f0b73ddd8bd Hadrian: add comment to avoid surprises
92257abd4b6 Link with libm dynamically (#19877)
8b9acc4d58f Hadrian: fix .cabal file
323473e86d4 Hadrian: disable profiled RTS with no_profiled_libs flavour transformer
cddafcf6a96 PIC: test for cross-module references
e2d8023dfe1 Add some tests for sized primops
703c0c3c13c Bump libffi submodule to libffi-3.3 (#16940)
82b097b3d43 Remove wired-in names hs-boot check bypass (#19855)
fc9546caf3e genprimopcode: fix bootstrap errors

# Modularity, refactorings

940feaf3c23 Modularize Tidy (#17957)
e6585ca168b Define filterOut with filter
e3f60577b5c Reverse dependency between StgToCmm and Runtime.Heap.Layout
1a7cf0963e3 Avoid redundant imports of GHC.Driver.Session
52ffd38c610 Avoid some SOURCE imports
929c280f991 Derive Enum instances for CCallConv and Safety
ad04953b0d2 Allow hscGenHardCode to not return CgInfos
677c6c913a9 Testsuite: remove arch conditional in T8832
2b1cced1815 NCG: minor code factorization
a31ace56209 Untangled GHC.Types.Id.Make from the driver
7b0c938483b Abstract BangOpts
9728d6c2b62 Give plugins a better interface (#17957)
14e9cab675f Use Monoid in hptSomeThingsBelowUs
b0a1ed5579a Add test for T15547 (#15547)
806e49ae36a Refactor package imports
6fd7da745a5 Remove Indefinite
fa5870d3ac0 Add test for #19641
f6a69fb897b Use an ADT for RecompReason
c662ac7e39a Refactor module dependencies code
da60e6276e4 Fix annoying warning about Data.List unqualified import
628417b42c9 Fix lint issue
a9c0b3ca1d4 Bump haddock submodule
89ee9206548 Use foldGet in getSymbolTable
532c6a54157 Remove UniqSupply from NameCache
599efd90d54 Refactor FinderCache
872a9444df4 Refactor NameCache
d930fecb6d2 Refactor interface loading
751b21448c8 Encapsulate the EPS IORef in a newtype
706fad606db Fix tests
85d7056a53f Move the EPS into UnitEnv
7acfb61777c Move HPT in UnitEnv
0219297c874 Move unit DBs in UnitEnv
29326979eeb Properly initialise UnitEnv
48c2c2af41a Fix genprimopcode warning
491266eeaa6 Make GHC.Runtime.Interpreter independent of GHC.Driver
c7ca3619e25 Interpreter: replace DynFlags with EvalOpts/BCOOpts
8d6b25254e7 Move shift ops out of GHC.Base
67a5a91ef5e Remove useless {-# LANGUAGE CPP #-} pragmas
0ef11907134 Fully remove HsVersions.h
bfabf94f63b Replace CPP assertions with Haskell functions
da56ed41b62 Ensure assert from Control.Exception isn't used
f78c25da058 Move GlobalVar macros into GHC.Utils.GlobalVars
6d712150f8f Dynflags: introduce DiagOpts
58b960d2af0 Make TmpFs independent of DynFlags
c367b39e523 Refactoring module dependencies
4f6726779fa Don't store tmpDir in Settings
2d4cdfda6a7 Avoid unsafePerformIO for getProgName
354ac99de09 Use target platform in guessOutputFile
6f097a8161d Remove useless .hs-boot
b51b4b9777d Make withException use SDocContext instead of DynFlags
61c51c00b6e Fix redundant import
4dc681c7c03 Make Logger independent of DynFlags
9a28680d2e2 Put Unique related global variables in the RTS (#19940)
14956cb89d8 Put tracing functions into their own module
40c0f67fb55 Bump haddock submodule
3a90814fdf5 Parser: make less DynFlags dependent
6b2952cfab2 RTS: fix indentation warning
3e4ef4b2d05 Move warning flag handling into Flags module

# Performance

bc8de322d31 NCG: inline some 64-bit primops on x86/32-bit (#5444)
6fa7591e832 NCG: refactor the way registers are handled
f07b13e38a2 NCG: refactor X86 codegen
90a26f8b0dd Fix documentation about Word64Rep/Int64Rep (#16964)
bc6ba8ef663 Make most shifts branchless
ec26c38bfac Use primOpIds cache more often (#20857)
c080b443142 Perf: use SmallArray for primops' Ids cache (#20857)
9529d859fef Perf: avoid using (replicateM . length) when possible
3f31bfe8c3c Perf: inline exprIsCheapX
352284de379 Perf: remove allocation in writeBlocks and fix comment (#14309)
4c6985cc91b Perf: remove an indirection when fetching the unique mask
4bdafb48b40 Add (++)/literal rule
8b3d98ff376 Don't use FastString for UTF-8 encoding only
0bdb867e37b CoreTidy: handle special cases to preserve more sharing.
3f851bbd473 Enhance pretty-printing perf
1d03d8bef96 Replace (ptext .. sLit) with `text`
e61d2d47c49 Make sized division primops ok-for-spec (#19026)
b128a880b22 Ensure that newtype deriving strategy is used for CTypes
901c79d8de4 Lookup string literals in top-level thunks (fix #16373)
3968cd0c928 Constant-fold unpackAppendCString (fix #20174)
fd7e272eab1 Perf: fix strictness in OccurAnal
de98a0ce8f1 Additional constant-folding rule for binary AND/OR
6eed426bf24 SysTools: make file copy more efficient
23bb09c919a Perf: fix appendFS


2929850f013 RTS: open timerfd synchronously (#20618)
5f3991c7cab RTS: try to fix timer races

# Misc

e01ffec2456 ByteCode: avoid out-of-bound read
646c3e21dd3 CI: allow perf-nofib to fail
45a674aacf3 Add `-dsuppress-core-sizes` flag (#20342)
87d93745fa1 Only dump Core stats when requested to do so (#20342)
3fb1afea019 GHCi: don't discard plugins on reload (#20335)
7bff8bf527d Fix pprDeps
92b0037b3e1 Fix recomp021 locale
7bad93a2866 Only create callstack in DEBUG builds
4ae1e53c49f Fix spelling
f192e623f57 Cmm: fix sinking after suspendThread
0f8872ecac4 Fix and slight improvement to datacon worker/wrapper notes