.. _release-9-10-2:

Version 9.10.2
==============
The significant changes to the various parts of the compiler are listed in the
following sections. See the `migration guide
<https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.10>`_ on the GHC Wiki
for specific guidance on migrating programs to this release.


Compiler
~~~~~~~~

- Optimized lowering of ``BigNat#`` literals. (:ghc-ticket:`23942`)

- Look for Haskell symbols only in relevant libraries. (:ghc-ticket:`23415`)

  When dynamically loading a Haskell symbol (typical when running a splice or
  GHCi expression), before this change we would search for the symbol in
  all dynamic libraries that were loaded. However, this could be very
  inefficient when too many packages are loaded (which can happen if there are
  many package dependencies) because the time to lookup the would be
  linear in the number of packages loaded.

  In one measurement this improved performance for executing a GHCi expression
  from ~38 seconds down to ~2s.

- Fixed a bug that could cause a linker error when ``TypeData`` and ``StrictData``
  where used in combination. (:ghc-ticket:`24620`)

- Fixed an issue where :ghc-flag:`-Wmissing-home-modules` caused quadratic compile time increases. (:ghc-ticket:`24778`)

- Better type inference in certain situations. (:ghc-ticket:`24810`)

- Fixed a bug where the magic ``GHC.Magic.inline`` function sometimes failed to inline functions
  if there were coercions involved. (:ghc-ticket:`24808`)

- Fixed a bug where the simplifier sometimes destroyed join points during float out. (:ghc-ticket:`24768`)

- Fixed inability to re-export the ``Data.Tuple.MkSolo`` constructor (:ghc-ticket:`25182`)

- Fixed ``Language.Haskell.TH.mkName "FUN"`` (:ghc-ticket:`25174`)

- Fixed a bug that could case segfaults in GHCi when :ghc-flag:`-fworker-wrapper-cbv` was enabled. (:ghc-ticket:`24870`)

- Fixed a bug where the use of ``throw`` caused a loss of strictness (:ghc-ticket:`25066`).

- Fixed incorrect behaviour that could occur when using ``control0#/prompt#`` (:ghc-ticket:`25439`) by making `prompt#` lazy.

- Fixed a bug where GHC panicked during type checking. (:ghc-ticket:`25325`)

- Fix linearity for strict unit patterns in a local ``let`` bindings. (:ghc-ticket:`25428`)

- Improve the performance of type family consistency checks. ((:ghc-ticket:`25554`))

- Fixed a bug where type checking failed to terminate. (:ghc-ticket:`25597`)

- Added flags to control speculative evaluation: :ghc-flag:`-fspec-eval` and :ghc-flag:`-fspec-eval-dictfun`. This allows
  users to work around cases where recent changes to speculative evaluation caused performance regressions. (:ghc-ticket:`25606`)

Profiling
~~~~~~~~~

- The flag :ghc-flag:`-fprof-late` when combined with :ghc-flag:`-prof` will no longer prevent top level
  constructors from being statically allocated.

  It used to be the case that we would add a cost centre for bindings like ``foo = Just bar``.
  This turned the binding into a constant applicative form that would allocate
  the constructor on first evaluation.

  However without the cost-centre ``foo`` can be allocated at compile time. This reduces code-bloat and
  reduces overhead for short-running applications.

  The tradeoff is that calling ``GHC.Stack.whoCreated`` on top level value definitions like ``foo`` will be less informative.

- Fixed a crash when using :ghc-flag:`-prof` with :ghc-flag:`-forig-thunk-info`. (:ghc-ticket:`24809`)

- Optimize the representation of :ghc-flag:`info table provenance maps <-finfo-table-map>`, significantly reducing code size when this feature is in use. (:ghc-ticket:`24504`)

Native code generator backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Fixed a bug where the jump shortcutting optimization could lead to unsoundness in pattern matching. (:ghc-ticket:`24507`)

- PowerPC: Fix sign hints in C calls. This bug caused segfaults when using FFI under some
  circumstances. (:ghc-ticket:`23034`)

- AArch64: Various code generation performance improvements

- AArch64: Fixed a bug that caused GHC to panic when using :ghc-flag:`-fregs-graph`
  on certain programs. (:ghc-ticket:`24941`)

- AArch64: Multiway branches are now lowered to jump tables for better performance. (:ghc-ticket:`19912`)

- Fixed a correctness issues for ``Int64``/``Word64`` on 32-bit backends (:ghc-ticket:`24893`)

LLVM backend
~~~~~~~~~~~~

- Fixes related to better use of SSE4:
  - Use ``+sse4.2`` rather than ``+sse42``, fixing (:ghc-ticket:`25019`),
  - make SSE4.2 imply ``+popcnt``, fixing (:ghc-ticket:`25353`).

- Fixed a bug where ``__GLASGOW_HASKELL_LLVM__`` was not defined even if :ghc-flag:`-fllvm` was set. (:ghc-ticket:`25606`)


JavaScript backend
~~~~~~~~~~~~~~~~~~

- Changes for better support of the Google Closure Compiler (:ghc-ticket:`24602`)

- Add support for rubbish static literals

- Fix ``h$withCStringOnHeap`` helper (:ghc-ticket:`25288`)

WebAssembly backend
~~~~~~~~~~~~~~~~~~~

- Use ``scheduler.postTask()`` for context switch when available

- The in-tree gmp library now is configured to produce faster and smaller code given
  the current constraints of the wasm backend.

GHCi
~~~~

- When using XDG directories ``.ghci_history`` now uses the ``$XDG_DATA_HOME`` variable as expected. ((:ghc-ticket:`24266`))

- Replaced some uses of lists with Arrays for better performance during bytecode compilation.

- GHCi: support cross-module inlining of breakpoints. Fixing (:ghc-ticket:`24712`)

- Fix a bug where GHCi would not start alongside a local file called ``Prelude.hs``
  or ``Prelude.lhs`` (:ghc-ticket:`10920`).

- Fixed a panic in the ghci debugger when using breakpoints around field selectors. ((:ghc-ticket:`25109`))

- Fixed a bug (:ghc-ticket:`25150`) where ghc would not consider ``-working-dir`` when
  looking for foreign files.

Runtime system
~~~~~~~~~~~~~~

- Memory return logic now uses live bytes rather than live blocks to measure the size of the heap.
  This primarily affects the non-moving GC, which should now be more willing to return memory to the OS.
  Users who have fine-tuned the :rts-flag:`-F ⟨factor⟩`, :rts-flag:`-Fd ⟨factor⟩`, or :rts-flag:`-O ⟨size⟩` flags,
  and use the non-moving GC, should see if adjustments are needed in light of this change.

- Reduce fragmentation incurred by the non-moving GC's segment allocator. In one application this reduced resident
  set size by 26%. See :ghc-ticket:`24150`.

- Emit warning when :rts-flag:`-M ⟨size⟩` is less than :rts-flag:`-H [⟨size⟩]`.

- Fix a bug ((:ghc-ticket:`24672`)) causing programms on FreeBSD to occasionally terminate with the error:
  ``internal error: Ticker: read(timerfd) failed with Operation not supported and returned -1``

- Fixed a bug ((:ghc-ticket:`25503`)) that sometimes caused the runtime to terminate with
  ``internal error: alloc_adjustor_chunk: failed to allocate`` on windows.
  This primarily affect programs making use of the ``foreign import "wrapper"`` functionality.

- Fixed a bug in compacting gc that could result in program termination with
  ``update_fwd_large: unknown/strange object  38`` (:ghc-ticket:`24791`).

- Fixed a bug where calling ``setNumCapabilities`` with a argument larger than 256 caused crashes. (:ghc-ticket:`25560`)

- Various runtime system linker improvements:
  - ``R_X86_64_PC64`` relocation support on windows
  - Use m32 allocator for sections when ``NEED_PLT`` - works around ((:ghc-ticket:`24432`))
  - AArch64 - Skip ``NONE`` relocations


Build system and packaging
~~~~~~~~~~~~~~~~~~~~~~~~~~

- Escape argument strings when storing them in the settings file. Fixes (:ghc-ticket:`24265`)

- Updated autoconf scripts to commit 948ae97ca5703224bd3eada06b7a69f40dd15a02 (dated 2024-01-01).
  (From https://git.savannah.gnu.org/cgit/config.git/)

- GHC now distinguishes more between the Cmm and C preprocessor. The new flags
  :ghc-flag:`-pgmCmmP ⟨cmd⟩` and :ghc-flag:`-optCmmP ⟨option⟩` can be used to control
  the Cmm preprocessor. C preprocessor flags will still be passed to the Cmm
  preprocessor, expect for :ghc-flag:`-g` flags which have special handling. Fixes (:ghc-ticket:`24474`)

- Bindists: Fixed a bug in the Makefile which caused windows installs to duplicate files. ((:ghc-ticket:`24800`))

- The packages ghc-internal and ghc-experimental are now versioned based on the GHC version they are shipped with.

- Fixed a bug where running ``Xelatex`` concurrently failed. (:ghc-ticket:`25564`)

- Fixed a bug where building ghc from source using GHC 9.8.4 failed with an error mentioning ``ghc_unique_counter64`` (:ghc-ticket:`25576`)

``ghc`` library
~~~~~~~~~~~~~~~

- Added some utility functions to ``GHC.Data.SmallArray``

``ghc-heap`` library
~~~~~~~~~~~~~~~~~~~~

- Fix typo in ghc-heap cbits that caused compilation errors when assertions were enabled.

``ghc-experimental`` library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Primops and other GHC extensions are now exported via ``GHC.PrimOps``

- The library is now versioned according to the ghc version it shipped with.


Included libraries
~~~~~~~~~~~~~~~~~~

The package database provided with this distribution also contains a number of
packages other than GHC itself. See the changelogs provided with these packages
for further change information.

.. ghc-package-list::

    libraries/array/array.cabal:             Dependency of ``ghc`` library
    libraries/base/base.cabal:               Core library
    libraries/binary/binary.cabal:           Dependency of ``ghc`` library
    libraries/bytestring/bytestring.cabal:   Dependency of ``ghc`` library
    libraries/Cabal/Cabal/Cabal.cabal:       Dependency of ``ghc-pkg`` utility
    libraries/Cabal/Cabal-syntax/Cabal-syntax.cabal:  Dependency of ``ghc-pkg`` utility
    libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library
    libraries/deepseq/deepseq.cabal:         Dependency of ``ghc`` library
    libraries/directory/directory.cabal:     Dependency of ``ghc`` library
    libraries/exceptions/exceptions.cabal:   Dependency of ``ghc`` and ``haskeline`` library
    libraries/filepath/filepath.cabal:       Dependency of ``ghc`` library
    compiler/ghc.cabal:                      The compiler itself
    libraries/ghci/ghci.cabal:               The REPL interface
    libraries/ghc-boot/ghc-boot.cabal:       Internal compiler library
    libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library
    libraries/ghc-compact/ghc-compact.cabal: Core library
    libraries/ghc-heap/ghc-heap.cabal:       GHC heap-walking library
    libraries/ghc-prim/ghc-prim.cabal:       Core library
    libraries/haskeline/haskeline.cabal:     Dependency of ``ghci`` executable
    libraries/hpc/hpc.cabal:                 Dependency of ``hpc`` executable
    libraries/integer-gmp/integer-gmp.cabal: Core library
    libraries/mtl/mtl.cabal:                 Dependency of ``Cabal`` library
    libraries/parsec/parsec.cabal:           Dependency of ``Cabal`` library
    libraries/pretty/pretty.cabal:           Dependency of ``ghc`` library
    libraries/process/process.cabal:         Dependency of ``ghc`` library
    libraries/stm/stm.cabal:                 Dependency of ``haskeline`` library
    libraries/template-haskell/template-haskell.cabal: Core library
    libraries/terminfo/terminfo.cabal:       Dependency of ``haskeline`` library
    libraries/text/text.cabal:               Dependency of ``Cabal`` library
    libraries/time/time.cabal:               Dependency of ``ghc`` library
    libraries/transformers/transformers.cabal: Dependency of ``ghc`` library
    libraries/unix/unix.cabal:               Dependency of ``ghc`` library
    libraries/Win32/Win32.cabal:             Dependency of ``ghc`` library
    libraries/xhtml/xhtml.cabal:             Dependency of ``haddock`` executable
