[Git][ghc/ghc][wip/az/ghc-9.4-epa-backports-2] 163 commits: Improve BUILD_PAP comments

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Mon Oct 17 15:36:31 UTC 2022



Ben Gamari pushed to branch wip/az/ghc-9.4-epa-backports-2 at Glasgow Haskell Compiler / GHC


Commits:
82c0cc6c by Andreas Klebinger at 2022-07-13T10:04:43+02:00
Improve BUILD_PAP comments

- - - - -
8143fdf3 by Andreas Klebinger at 2022-07-13T10:04:52+02:00
Make dropTail comment a haddock comment

- - - - -
16956d22 by Andreas Klebinger at 2022-07-13T10:05:01+02:00
Add one more sanity check in stg_restore_cccs

- - - - -
ee1b3cb5 by Andreas Klebinger at 2022-07-13T10:05:09+02:00
StgToCmm: Fix isSimpleScrut when profiling is enabled.

When profiling is enabled we must enter functions that might represent
thunks in order for their sccs to show up in the profile.

We might allocate even if the function is already evaluated in this
case. So we can't consider any potential function thunk to be a simple
scrut when profiling.

Not doing so caused profiled binaries to segfault.

- - - - -
664fded7 by Andreas Klebinger at 2022-07-13T19:52:59+02:00
Change `-fprof-late` to insert cost centres after unfolding creation.

The former behaviour of adding cost centres after optimization but
before unfoldings are created is not available via the flag
`prof-late-inline` instead.

I also reduced the overhead of -fprof-late* by pushing the cost centres
into lambdas. This means the cost centres will only account for
execution of functions and not their partial application.

Further I made LATE_CC cost centres it's own CC flavour so they now
won't clash with user defined ones if a user uses the same string for
a custom scc.

LateCC: Don't put cost centres inside constructor workers.

With -fprof-late they are rarely useful as the worker is usually
inlined. Even if the worker is not inlined or we use -fprof-late-linline
they are generally not helpful but bloat compile and run time
significantly. So we just don't add sccs inside constructor workers.

-------------------------
Metric Decrease:
    T13701
-------------------------

- - - - -
41374d55 by Matthew Pickering at 2022-07-13T19:53:07+02:00
Give Cmm files fake ModuleNames which include full filepath

This fixes the initialisation functions when using -prof or
-finfo-table-map.

Fixes #21370

- - - - -
72364127 by Ben Gamari at 2022-07-14T14:02:08-04:00
rts: Fix AdjustorPool bitmap manipulation

Previously the implementation of bitmap_first_unset assumed that
`__builtin_clz` would accept `uint8_t` however it apparently rather
extends its argument to `unsigned int`.

To fix this we simply revert to a naive implementation since handling
the various corner cases with `clz` is quite tricky. This should be
fine given that AdjustorPool isn't particularly hot. Ideally we would
have a single, optimised bitmap implementation in the RTS but I'll leave
this for future work.

Fixes #21838.

(cherry picked from commit dfa95eccf7b45a8961e034710d5e3ca45a36bf5e)

- - - - -
a463659c by Matthew Pickering at 2022-07-14T14:02:08-04:00
ghci: Fix most calls to isLoaded to work in multi-mode

The most egrarious thing this fixes is the report about the total number
of loaded modules after starting a session.

Ticket #20889

(cherry picked from commit 2b0e0862ff57125963b3bb023642d1c86b7aeca2)

- - - - -
41615501 by Matthew Pickering at 2022-07-14T14:02:08-04:00
Enable :edit command in ghci multi-mode.

This works after the last change to isLoaded.

Ticket #20888

(cherry picked from commit 456e477225908b300dbc5359d64b7a601ac82e5a)

- - - - -
78623f8f by Zubin Duggal at 2022-07-14T14:02:08-04:00
Fix potential space leak that arise from ModuleGraphs retaining references
to previous ModuleGraphs, in particular the lazy `mg_non_boot` field.
This manifests in `extendMG`.

Solution: Delete `mg_non_boot` as it is only used for `mgLookupModule`, which
is only called in two places in the compiler, and should only be called at most
once for every home unit:

GHC.Driver.Make:
      mainModuleSrcPath :: Maybe String
      mainModuleSrcPath = do
        ms <- mgLookupModule mod_graph (mainModIs hue)
        ml_hs_file (ms_location ms)

GHCI.UI:
listModuleLine modl line = do
   graph <- GHC.getModuleGraph
   let this = GHC.mgLookupModule graph modl

Instead `mgLookupModule` can be a linear function that looks through the entire
list of `ModuleGraphNodes`

Fixes #21816

(cherry picked from commit fb73b5f4ba3cb76e381c7e43f9c12840f779eab5)

- - - - -
a5e8523c by Matthew Pickering at 2022-07-14T14:02:08-04:00
driver: Fix issue with module loops and multiple home units

We were attempting to rehydrate all dependencies of a particular module,
but we actually only needed to rehydrate those of the current package
(as those are the ones participating in the loop).

This fixes loading GHC into a multi-unit session.

Fixes #21814

(cherry picked from commit 665fa5a73e385bdfce13180048701a179ec3f36a)

- - - - -
723e381f by Matthew Pickering at 2022-07-14T14:02:08-04:00
Vendor filepath inside template-haskell

Adding filepath as a dependency of template-haskell means that it can't
be reinstalled if any build-plan depends on template-haskell.

This is a temporary solution for the 9.4 release.

A longer term solution is to split-up the template-haskell package into
the wired-in part and a non-wired-in part which can be reinstalled. This
was deemed quite risky on the 9.4 release timescale.

Fixes #21738

(cherry picked from commit b151b65ec469405dcf25f9358e7e99bcc8c2b3ac)

- - - - -
cec4d01d by Tamar Christina at 2022-07-14T14:02:08-04:00
winio: make consoleReadNonBlocking not wait for any events at all.

(cherry picked from commit fa59223b05e24d6e477e3ab0ab296e32b2b65a8b)

- - - - -
41a39b37 by Ben Gamari at 2022-07-14T14:02:08-04:00
eventlog: Don't leave dangling pointers hanging around

Previously we failed to reset pointers to various eventlog buffers to
NULL after freeing them. In principle we shouldn't look at them after
they are freed but nevertheless it is good practice to set them to a
well-defined value.

(cherry picked from commit 980d19547fe3d4e3f03e7d0d35dd4c18b6aa6506)

- - - - -
71f74009 by Simon Peyton Jones at 2022-07-14T17:40:12-04:00
Implement DeepSubsumption

This MR adds the language extension -XDeepSubsumption, implementing
GHC proposal #511.  This change mitigates the impact of GHC proposal

The changes are highly localised, by design.  See Note [Deep subsumption]
in GHC.Tc.Utils.Unify.

The main changes are:

* Add -XDeepSubsumption, which is on by default in Haskell98 and Haskell2010,
  but off in Haskell2021.

  -XDeepSubsumption largely restores the behaviour before the "simple subsumption" change.
  -XDeepSubsumpition has a similar flavour as -XNoMonoLocalBinds:
  it makes type inference more complicated and less predictable, but it
  may be convenient in practice.

* The main changes are in:
  * GHC.Tc.Utils.Unify.tcSubType, which does deep susumption and eta-expanansion
  * GHC.Tc.Utils.Unify.tcSkolemiseET, which does deep skolemisation
  * In GHC.Tc.Gen.App.tcApp we call tcSubTypeNC to match the result
    type. Without deep subsumption, unifyExpectedType would be sufficent.

  See Note [Deep subsumption] in GHC.Tc.Utils.Unify.

* There are no changes to Quick Look at all.

* The type of `withDict` becomes ambiguous; so add -XAllowAmbiguousTypes to
  GHC.Magic.Dict

* I fixed a small but egregious bug in GHC.Core.FVs.varTypeTyCoFVs, where
  we'd forgotten to take the free vars of the multiplicity of an Id.

(cherry picked from commit 7b9be6c8b94b3c2eb3441febb4a8005a03fa34a5)

- - - - -
58ad696d by Matthew Pickering at 2022-07-14T17:40:15-04:00
Fix tcSplitNestedSigmaTys

When I did the shallow-subusmptuion patch

  commit 2b792facab46f7cdd09d12e79499f4e0dcd4293f
  Date:   Sun Feb 2 18:23:11 2020 +0000

    Simple subsumption

I changed tcSplitNestedSigmaTys to not look through function arrows
any more.  But that was actually an un-forced change.  This function
is used only in

* Improving error messages in GHC.Tc.Gen.Head.addFunResCtxt
* Validity checking for default methods: GHC.Tc.TyCl.checkValidClass
* A couple of calls in the GHCi debugger: GHC.Runtime.Heap.Inspect

all to do with validity checking and error messages. Acutally its
fine to look under function arrows here, and quite useful a test
DeepSubsumption05 (a test motivated by a build failure in the
`lens` package) shows.

The fix is easy.  I added Note [tcSplitNestedSigmaTys].

(cherry picked from commit 936fe7435d9da63f78c032b027179e1f1f22a482)

- - - - -
363be362 by Ben Gamari at 2022-07-14T17:40:15-04:00
Fix hlint warning in GHC.Types.Demand

- - - - -
639e5c09 by Zubin Duggal at 2022-07-14T21:41:10+00:00
hie-files: Fix scopes for deriving clauses and instance signatures (#18425)

(cherry picked from commit e9d9f0784e8670c6b85f1bf80e26b571b08519b5)

- - - - -
b5f38510 by Zubin Duggal at 2022-07-14T21:41:10+00:00
hie-files: Record location of filled in default method bindings

This is useful for hie files to reconstruct the evidence that default methods
depend on.

(cherry picked from commit c4989131563efca8692c341e7b08096ac9a3b53b)

- - - - -
79b48898 by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/Elf: Introduce support for invoking finalizers on unload

Addresses #20494.

(cherry picked from commit f4919e6fd22dae59cb51a13c25f89ebe9d6f856d)

- - - - -
3b3f755b by Ben Gamari at 2022-07-14T19:49:10-04:00
testsuite: Add T20494

(cherry picked from commit 65eab273f8b22f7548f12bdcaad718ac395ce891)

- - - - -
99a4c1d6 by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/PEi386: Rename finit field to fini

fini is short for "finalizer", which does not contain a "t".

(cherry picked from commit f8fef29f9a46b0a9ffd925377bdec5a8a84cc96d)

- - - - -
76adb450 by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/PEi386: Refactor handling of oc->info

Previously we would free oc->info after running initializers. However,
we can't do this is we want to also run finalizers.

Moreover, freeing oc->info so early was wrong for another reason:
we will need it in order to unregister the exception tables (see the
call to `RtlDeleteFunctionTable`).

In service of #20494.

(cherry picked from commit fc13142da02835cf90198145def98c667218d2ee)

- - - - -
445482bc by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/PEi386: Add finalization support

This implements #20494 for the PEi386 linker.

Happily, this also appears to fix `T9405`, resolving #21361.

(cherry picked from commit aa3de0cfbc74671f9f22970aead9c430548dd05e)

- - - - -
a1395984 by Ben Gamari at 2022-07-14T19:49:10-04:00
Loader: Implement gnu-style -l:$path syntax

Gnu ld allows `-l` to be passed an absolute file path,
signalled by a `:` prefix. Implement this in the GHC's
loader search logic.

(cherry picked from commit 27b27cd487d5ba9ddc8b9d70ad782186931157fe)

- - - - -
2b7d4b00 by Ben Gamari at 2022-07-14T19:49:10-04:00
Statically-link against libc++ on Windows

Unfortunately on Windows we have no RPATH-like facility, making dynamic
linking extremely fragile. Since we cannot assume that the user will
add their GHC installation to `$PATH` (and therefore their DLL
search path) we cannot assume that the loader will be able to locate our
`libc++.dll`. To avoid this, we instead statically link against `libc++.a` on
Windows.

Fixes #21435.

(cherry picked from commit 91a6d53ba77ce7d977b137b69690567dd9f92d98)

- - - - -
43b7997b by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/PEi386: Ensure that all .ctors/.dtors sections are run

It turns out that PE objects may have multiple `.ctors`/`.dtors`
sections but the RTS linker had assumed that there was only one. Fix
this.

Fixes #21618.

(cherry picked from commit 8c8dfa3e9558c2a198195c8b9c2bf638d2ca6d05)

- - - - -
669d60cf by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/PEi386: Respect dtor/ctor priority

Previously we would run constructors and destructors in arbitrary order
despite explicit priorities.

Fixes #21847.

(cherry picked from commit 6f2d9164d366a76f5ae2cf9a110836b5b629bee5)

- - - - -
7c5a8ca6 by Ben Gamari at 2022-07-14T19:49:10-04:00
testsuite: Add test for #21618 and #21847

(cherry picked from commit 3480b973833ac2826f2aa175a155bb76dc67c008)

- - - - -
5a69a9ff by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/PEi386: Fix exception unwind unregistration

RtlDeleteFunctionTable expects a pointer to the .pdata section
yet we passed it the .xdata section.

Happily, this fixes #21354.

(cherry picked from commit 8ad577ddad66f2a7a9bb334b6ee7f0837e0c19be)

- - - - -
7c481f0f by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/MachO: Drop dead code

(cherry picked from commit 0115b0b141611f5ad9a22ac0d77212000e209504)

- - - - -
88ad0503 by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/MachO: Use section flags to identify initializers

(cherry picked from commit 14f6dc27a46936b8aa99829436d0aca6ba4f16b4)

- - - - -
a82a8f46 by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/MachO: Introduce finalizer support

(cherry picked from commit 8ce5db8c2544268f05385995ffb6e31a02fd804f)

- - - - -
a2f00909 by Ben Gamari at 2022-07-14T19:49:10-04:00
testsuite: Use system-cxx-std-lib instead of config.stdcxx_impl

(cherry picked from commit a4ca19aba198fdbed4b1ec4215411a3fc7cee14e)

- - - - -
7334e380 by Ben Gamari at 2022-07-14T19:49:10-04:00
rts/linker/Elf: Work around GCC 6 init/fini behavior

It appears that GCC 6t (at least on i386) fails to give
init_array/fini_array sections the correct SHT_INIT_ARRAY/SHT_FINI_ARRAY
section types, instead marking them as SHT_PROGBITS. This caused T20494
to fail on Debian.

(cherry picked from commit e950217c2d19267a84f1ba27cf623bd7832ef002)

- - - - -
a32f4d6f by Ben Gamari at 2022-07-14T19:49:10-04:00
Bump text submodule

(cherry picked from commit 8734727d83756cc2ba6e5a77d2aac12d8ff4fda7)

- - - - -
114b9bc4 by Ben Gamari at 2022-07-14T19:49:10-04:00
testsuite: Mark T13366Cxx as unbroken on Darwin

(cherry picked from commit 9811dafb9436e9a8ccc19b78ea41baea71adfaa3)

- - - - -
ae428688 by Ben Gamari at 2022-07-14T19:49:11-04:00
rts/linker: Fix resolution of __dso_handle on Darwin

Darwin expects a leading underscore.

(cherry picked from commit 1790cc8d6193ea08526b0ae556167aa4146f2cc4)

- - - - -
26955304 by Ben Gamari at 2022-07-14T19:49:11-04:00
rts/linker: Clean up section kinds

(cherry picked from commit f2d1b447abf73e878cdbe3d4ab55554c6edc6ea4)

- - - - -
4b5812a0 by Ben Gamari at 2022-07-14T19:49:11-04:00
rts/linker: Ensure that __cxa_finalize is called on code unload

(cherry picked from commit 443df82ea3e5095b7d25b03c1e8b7dbdb16e3874)

- - - - -
805a4b1f by Matthew Pickering at 2022-07-14T23:02:07-04:00
Make -fcompact-unwind the default

This is a follow-up to !7247 (closed) making the inclusion of compact unwinding
sections the default.

Also a slight refactoring/simplification of the flag handling to add
-fno-compact-unwind.

(cherry picked from commit 468f919b1bd27d8a58a789a6bb1be4295097388c)

- - - - -
06ea642a by Greg Steuck at 2022-07-15T22:22:52-04:00
Suppress extra output from configure check for c++ libraries

(cherry picked from commit ac6a1a1366d6b9c045b3837c832f7e0fa312d42b)

- - - - -
d339b68f by Luite Stegeman at 2022-07-15T22:22:52-04:00
Change GHCi bytecode return convention for unlifted datatypes.

This changes the bytecode return convention for unlifted
algebraic datatypes to be the same as for lifted
types, i.e. ENTER/PUSH_ALTS instead of
RETURN_UNLIFTED/PUSH_ALTS_UNLIFTED

Fixes #20849

(cherry picked from commit fcc964ad5cf7141449ad487102b7c19f0798e73f)

- - - - -
3e58f0ba by Sergei Trofimovich at 2022-07-15T22:22:52-04:00
ghc.mk: fix 'make install' (`mk/system-cxx-std-lib-1.0.conf.install` does not exist)

before the change `make install` was failing as:

```
"mv" "/<<NIX>>/ghc-9.3.20220406/lib/ghc-9.5.20220625/bin/ghc-stage2" "/<<NIX>>/ghc-9.3.20220406/lib/ghc-9.5.20220625/bin/ghc"
make[1]: *** No rule to make target 'mk/system-cxx-std-lib-1.0.conf.install', needed by 'install_packages'.  Stop.
```

I think it's a recent regression caused by 0ef249aa where `system-cxx-std-lib-1.0.conf`
is created (somewhat manually), but not the .install varianlt of it.

The fix is to consistently use `mk/system-cxx-std-lib-1.0.conf` everywhere.

Closes: https://gitlab.haskell.org/ghc/ghc/-/issues/21784
(cherry picked from commit 03cc5d0258294fc83f65479e78dbe937622cfc88)

- - - - -
22a3efa2 by Ben Gamari at 2022-07-15T22:22:52-04:00
hadrian: Rename documentation directories for consistency with make

* Rename `docs` to `doc`
* Place pdf documentation in `doc/` instead of `doc/pdfs/`

Fixes #21164.

- - - - -
41714736 by Ben Gamari at 2022-07-16T00:40:55-04:00
Make keepAlive# out-of-line

This is a naive approach to fixing the unsoundness noticed in #21708.
Specifically, we remove the lowering of `keepAlive#` via CorePrep and
instead turn it into an out-of-line primop.
This is simple, inefficient (since the continuation must now be heap
allocated), but good enough for 9.4.1. We will revisit this
(particiularly via #16098) in a future release.

Metric Increase:
    T4978
    T7257
    T9203
    T13701
    T14697

(cherry picked from commit d75c540d439510491b45f64c1113762dcb251ae1)

- - - - -
96559c8b by Ben Gamari at 2022-07-16T00:41:03-04:00
configure: Don't override Windows CXXFLAGS

At some point we used the clang distribution from msys2's `MINGW64`
environment for our Windows toolchain. This defaulted to using libgcc
and libstdc++ for its runtime library. However, we found for a variety
of reasons that compiler-rt, libunwind, and libc++ were more reliable,
consequently we explicitly overrode the CXXFLAGS to use these.

However, since then we have switched to use the `CLANG64` packaging,
which default to these already. Consequently we can drop these
arguments, silencing some redundant argument warnings from clang.

Fixes #21669.

(cherry picked from commit 582bde433879042a42ad8a1862b1c46d6832b00b)

- - - - -
2e8dec67 by Ben Gamari at 2022-07-16T00:41:03-04:00
Document RuntimeRep polymorphism limitations of catch#, et al

As noted in #21868, several primops accepting continuations producing
RuntimeRep-polymorphic results aren't nearly as polymorphic as their
types suggest. Document this limitation and adapt the `UnliftedWeakPtr`
test to avoid breaking this limitation in `keepAlive#`.

(cherry picked from commit 3d5f9ba19fea5455d778d2ee9c3fdcaad77d1db7)

- - - - -
11782f0f by sheaf at 2022-07-16T13:27:40-04:00
Make withDict noinline

As pointed out in #21575, it is not sufficient to set withDict to inline
after the typeclass specialiser, because we might inline withDict in one
module and then import it in another, and we run into the same problem.
This means we could still end up with incorrect runtime results because
the typeclass specialiser would assume that distinct typeclass evidence
terms at the same type are equal, when this is not necessarily the case
when using withDict.

Instead, this patch gives withDict a NOINLINE pragma, to circumvent this
issue. This is not entirely satisfactory, as it causes a performance
penalty. Hopefully in the future a better fix can be implemented.

Fixes #21575

(cherry picked from commit 1bbbbab816a5beda01bf97deb50651263db58ca0)

- - - - -
11441162 by Colten Webb at 2022-07-19T15:19:36+05:30
Compute record-dot-syntax types
Ensures type information for record-dot-syntax
is included in HieASTs. See #21797

(cherry picked from commit 5434d1a355e127d44c6f116b4b7f8a1d254815d4)

- - - - -
b2d4feb4 by Colten Webb at 2022-07-19T15:21:49+05:30
Add record-dot-syntax test

(cherry picked from commit 89d169ec0c4e9c1e6cf4a6373a1992dad7474d55)

- - - - -
ddf6c670 by Ben Gamari at 2022-07-20T22:30:53-04:00
gitlab-ci: Fix hadrian bootstrapping of release pipelines

Previously we would attempt to test hadrian bootstrapping in the
`validate` build flavour. However, `ci.sh` refuses to run validation
builds during release pipelines, resulting in job failures. Fix this by
testing bootstrapping in the `release` flavour during release pipelines.

We also attempted to record perf notes for these builds, which is
redundant work and undesirable now since we no longer build in a
consistent flavour.

- - - - -
b889f123 by Matthew Pickering at 2022-07-20T22:30:53-04:00
Add tests that -XHaskell98 and -XHaskell2010 enable DeepSubsumption

(cherry picked from commit 5c4fbaf53f258d64aeb66a8172e13dc559eb8d8b)

- - - - -
ed6aabc4 by Ben Gamari at 2022-07-20T22:30:53-04:00
upload_ghc_libs: Fix path to documentation

- - - - -
00d4bf22 by Ben Gamari at 2022-07-20T22:30:54-04:00
testsuite: Fix T11829 on Centos 7

It appears that Centos 7 has a more strict C++ compiler than most
distributions since std::runtime_error is defined in <stdexcept> rather
than <exception>. In T11829 we mistakenly imported the latter.

(cherry picked from commit 028f081e4e748794d7a0e6359987ec799c3dc404)

- - - - -
3d3f3dcf by Ben Gamari at 2022-07-20T22:30:54-04:00
Bump bytestring submodule to 0.11.3.1

- - - - -
086ecfa2 by Ben Gamari at 2022-07-20T22:30:54-04:00
Update autoconf scripts

Scripts taken from autoconf 02ba26b218d3d3db6c56e014655faf463cefa983

- - - - -
8d491b78 by Ben Gamari at 2022-07-20T22:30:54-04:00
Add dates to base, ghc-prim changelogs

- - - - -
e294c22f by Ben Gamari at 2022-07-20T22:30:54-04:00
testsuite: Normalise versions in UnusedPackages

- - - - -
8af3a682 by Ben Gamari at 2022-07-20T22:30:54-04:00
Bump unix submodule to 2.7.3

- - - - -
55f9ff5b by Ben Gamari at 2022-07-20T22:30:54-04:00
Bump text submodule

- - - - -
2deb51b7 by Ben Gamari at 2022-07-20T22:30:54-04:00
Bump deepseq submodule to 1.4.8.0

- - - - -
85b99a00 by Ben Gamari at 2022-07-20T22:37:31-04:00
cmm: Add surface syntax for MO_MulMayOflo

(cherry picked from commit 6dd8a3ca1d96a662d9a0c19c5b769536fa6472b8)

- - - - -
82090ac3 by Ben Gamari at 2022-07-20T22:37:31-04:00
CmmToAsm/AArch64: Add SMUL[LH] instructions

These will be needed to fix #21624.

(cherry picked from commit 70895c3782ecf7dfe12e4534777084344ba2968f)

- - - - -
7f1fcfd7 by Ben Gamari at 2022-07-20T22:37:31-04:00
CmmToAsm/AArch64: Fix syntax of OpRegShift operands

Previously this produced invalid assembly containing a redundant comma.

(cherry picked from commit 07c75704f014f62f9ea332319da2e14803263216)

- - - - -
a51b5001 by Ben Gamari at 2022-07-20T22:37:31-04:00
ncg/aarch64: Fix implementation of IntMulMayOflo

The code generated for IntMulMayOflo was previously wrong as it
depended upon the overflow flag, which the AArch64 MUL instruction does
not set. Fix this.

Fixes #21624.

(cherry picked from commit 5dcc2c84409c2c3f97198b4116c47e861aafd1fb)

- - - - -
126e3753 by Ben Gamari at 2022-07-20T22:37:31-04:00
testsuite: Add test for #21624

Ensuring that mulIntMayOflo# behaves as expected.

(cherry picked from commit 83e0efe12874108cf957ab5cdd49b7da217d3bb8)

- - - - -
99f6655e by Matthew Pickering at 2022-07-20T22:39:31-04:00
rts: Remove explicit timescale for deprecating -h flag

We originally planned to remove the flag in 9.4 but there's actually no
great rush to do so and it's probably less confusing (forever) to keep
the message around suggesting an explicit profiling option.

Fixes #21545

(cherry picked from commit 18326ad29b315ed9f086672c38b2c8f611bc7d19)

- - - - -
2023d7d8 by Ben Gamari at 2022-07-20T22:40:18-04:00
base: Drop changelog entry for traceWith, et al.

This won't be introduced until 9.6. Closes #21542.

- - - - -
8a682037 by Matthew Pickering at 2022-07-20T23:43:50-04:00
driver: Fix implementation of -S

We were failing to stop before running the assembler so the object file
was also created.

Fixes #21869

(cherry picked from commit e8c07aa91f0f05816b455457e3781c247b7399ca)

- - - - -
7757465f by Andreas Klebinger at 2022-07-20T23:43:50-04:00
exprIsDeadEnd: Use isDeadEndAppSig to check if a function appliction is bottoming.

We used to check the divergence and that the number of arguments > arity.
But arity zero represents unknown arity so this was subtly broken for a long time!

We would check if the saturated function diverges, and if we applied >=arity arguments.
But for unknown arity functions any number of arguments is >=idArity.

This fixes #21440.

(cherry picked from commit 2b2e30203a125dc5bfe70f3df7b39787aaf62b1e)

- - - - -
19d8c3c2 by Ben Gamari at 2022-07-23T09:00:07-04:00
Release notes and changelog wibbles

- - - - -
133c4405 by Ben Gamari at 2022-07-27T11:29:55+01:00
Bump directory submodule to 1.3.7.1

- - - - -
bcfdc07d by Douglas Wilson at 2022-07-27T11:29:56+01:00
bump text submodule to 2.0.1

- - - - -
cd8a85fb by Ben Gamari at 2022-07-27T11:29:56+01:00
user guide: Mention DeepSubsumpion in the release notes

- - - - -
a9c0b989 by Simon Jakobi at 2022-07-27T11:29:56+01:00
docs: Fix documentation of \cases

Fixes #21902.

(cherry picked from commit 79f1b0219f5c00f5c8eb7884bd33993bd98680a0)

- - - - -
1198d751 by sternenseemann at 2022-07-27T11:29:56+01:00
hadrian: add flag disabling selftest rules which require QuickCheck

The hadrian executable depends on QuickCheck for building, meaning this
library (and its dependencies) will need to be built for bootstrapping
GHC in the future. Building QuickCheck, however, can require
TemplateHaskell. When building a statically linking GHC toolchain,
TemplateHaskell can be tricky to get to work, and cross-compiling
TemplateHaskell doesn't work at all without -fexternal-interpreter,
so QuickCheck introduces an element of fragility to GHC's bootstrap.

Since the selftest rules are the only part of hadrian that need
QuickCheck, we can easily eliminate this bootstrap dependency when
required by introducing a `selftest` flag guarding the rules' inclusion.

Closes #8699.

(cherry picked from commit 42147534320f9ac22f16ffc226148ae553337d2e)

- - - - -
e4522c03 by sternenseemann at 2022-07-27T11:29:56+01:00
ghc-cabal: allow Cabal 3.8 to unbreak make build

When bootstrapping GHC 9.4.*, the build will fail when configuring
ghc-cabal as part of the make based build system due to this upper
bound, as Cabal has been updated to a 3.8 release.

Reference #21914, see especially
https://gitlab.haskell.org/ghc/ghc/-/issues/21914#note_444699

(cherry picked from commit e4bf95920a9bbcb5b6ac3715282c69f612137156)

- - - - -
6bb1e4bc by Zubin Duggal at 2022-07-27T11:29:56+01:00
Fix #21889, GHCi misbehaves with Ctrl-C on Windows

On Windows, we create multiple levels of wrappers for GHCi which ultimately
execute ghc --interactive. In order to handle console events properly, each of
these wrappers must call FreeConsole() in order to hand off event processing to
the child process. See #14150.

In addition to this, FreeConsole must only be called from interactive processes (#13411).

This commit makes two changes to fix this situation:

1. The hadrian wrappers generated using `hadrian/bindist/cwrappers/version-wrapper.c` call `FreeConsole`
   if the CPP flag INTERACTIVE_PROCESS is set, which is set when we are generating a wrapper for GHCi.
2. The GHCi wrapper in `driver/ghci/` calls the `ghc-$VER.exe` executable which is not wrapped rather
   than calling `ghc.exe` is is wrapped on windows (and usually non-interactive, so can't call `FreeConsole`:

   Before:
   ghci-$VER.exe calls ghci.exe which calls ghc.exe which calls ghc-$VER.exe

   After:
   ghci-$VER.exe calls ghci.exe which calls ghc-$VER.exe

(cherry picked from commit 3bbde95769aa2986adb8bef7d718aa0e8731f9fd)

- - - - -
2c64742b by Ben Gamari at 2022-07-27T11:29:56+01:00
testsuite: introduce nonmoving_thread_sanity way

(cherry picked from commit 19f8fce3659de3d72046bea9c61d1a82904bc4ae)
(cherry picked from commit 82a0991a73130f2cb70bd8ccaaff30cffd1dd2b0)

- - - - -
4c678ffb by Ben Gamari at 2022-07-27T11:29:56+01:00
rts/nonmoving: Track segment state

It can often be useful during debugging to be able to determine the
state of a nonmoving segment. Introduce some state, enabled by DEBUG, to
track this.

(cherry picked from commit 40e797ef591ae3122ccc98ab0cc3cfcf9d17bd7f)
(cherry picked from commit 4b08797380a0a0a789844c17c6ed1570b62dc119)

- - - - -
094221ef by Ben Gamari at 2022-07-27T11:29:56+01:00
rts/nonmoving: Don't scavenge objects which weren't evacuated

This fixes a rather subtle bug in the logic responsible for scavenging
objects evacuated to the non-moving generation. In particular, objects
can be allocated into the non-moving generation by two ways:

 a. evacuation out of from-space by the garbage collector
 b. direct allocation by the mutator

Like all evacuation, objects moved by (a) must be scavenged, since they
may contain references to other objects located in from-space. To
accomplish this we have the following scheme:

 * each nonmoving segment's block descriptor has a scan pointer which
   points to the first object which has yet to be scavenged

 * the GC tracks a set of "todo" segments which have pending scavenging
   work

 * to scavenge a segment, we scavenge each of the unmarked blocks
   between the scan pointer and segment's `next_free` pointer.

   We skip marked blocks since we know the allocator wouldn't have
   allocated into marked blocks (since they contain presumably live
   data).

   We can stop at `next_free` since, by
   definition, the GC could not have evacuated any objects to blocks
   above `next_free` (otherwise `next_free wouldn't be the first free
   block).

However, this neglected to consider objects allocated by path (b).
In short, the problem is that objects directly allocated by the mutator
may become unreachable (but not swept, since the containing segment is
not yet full), at which point they may contain references to swept objects.
Specifically, we observed this in #21885 in the following way:

1. the mutator (specifically in #21885, a `lockCAF`) allocates an object
   (specifically a blackhole, which here we will call `blkh`; see Note
   [Static objects under the nonmoving collector] for the reason why) on
   the non-moving heap. The bitmap of the allocated block remains 0
   (since allocation doesn't affect the bitmap) and the containing
   segment's (which we will call `blkh_seg`) `next_free` is advanced.
2. We enter the blackhole, evaluating the blackhole to produce a result
   (specificaly a cons cell) in the nursery
3. The blackhole gets updated into an indirection pointing to the cons
   cell; it is pushed to the generational remembered set
4. we perform a GC, the cons cell is evacuated into the nonmoving heap
   (into segment `cons_seg`)
5. the cons cell is marked
6. the GC concludes
7. the CAF and blackhole become unreachable
8. `cons_seg` is filled
9. we start another GC; the cons cell is swept
10. we start a new GC
11. something is evacuated into `blkh_seg`, adding it to the "todo" list
12. we attempt to scavenge `blkh_seg` (namely, all unmarked blocks
    between `scan` and `next_free`, which includes `blkh`). We attempt to
    evacuate `blkh`'s indirectee, which is the previously-swept cons cell.
    This is unsafe, since the indirectee is no longer a valid heap
    object.

The problem here was that the scavenging logic *assumed* that (a) was
the only source of allocations into the non-moving heap and therefore
*all* unmarked blocks between `scan` and `next_free` were evacuated.
However, due to (b) this is not true.

The solution is to ensure that that the scanned region only encompasses
the region of objects allocated during evacuation. We do this by
updating `scan` as we push the segment to the todo-segment list to
point to the block which was evacuated into.

Doing this required changing the nonmoving scavenging implementation's
update of the `scan` pointer to bump it *once*, instead of after
scavenging each block as was done previously. This is because we may end
up evacuating into the segment being scavenged as we scavenge it. This
was quite tricky to discover but the result is quite simple,
demonstrating yet again that global mutable state should be used
exceedingly sparingly.

Fixes #21885

(cherry picked from commit 0b27ea23efcb08639309293faf13fdfef03f1060)
(cherry picked from commit 54a5c32d9d0792d8f3f80728edf6f39db5321fe5)

- - - - -
ed9c4c6a by Ben Gamari at 2022-07-27T11:29:56+01:00
testsuite: Skip a few tests as in the nonmoving collector

Residency monitoring under the non-moving collector is quite
conservative (e.g. the reported value is larger than reality) since
otherwise we would need to block on concurrent collection. Skip a few
tests that are sensitive to residency.

(cherry picked from commit 6880e4fbf728c04e8ce83e725bfc028fcb18cd70)
(cherry picked from commit 25c24535ad51aa22b9cae425c6ac4ad9a8f1e1e9)

- - - - -
9187b984 by Ben Gamari at 2022-07-27T11:38:09+01:00
rts/ProfHeap: Ensure new Censuses are zeroed

When growing the Census array ProfHeap previously neglected to
zero the new part of the array. Consequently `freeEra` would attempt to
free random words that often looked suspiciously like pointers.

Fixes #21880.

(cherry picked from commit e2f0094c315746ff15b8d9650cf318f81d8416d7)

- - - - -
388ec68f by Krzysztof Gogolewski at 2022-07-28T10:31:44+01:00
Update 9.4 release notes regarding withDict

The type was changed in !8249 and this was backported to 9.4.

(cherry picked from commit b0d98619a3bc01246bd5b23e6d4afb340df46150)

- - - - -
6971ec58 by Matthew Pickering at 2022-07-28T10:32:34+01:00
Fix since annotations in GHC.Stack.CloneStack

Fixes #21894

(cherry picked from commit abd62256ea2fb78990ee83464abc7e2a291a7731)

- - - - -
a5590869 by sternenseemann at 2022-07-28T10:40:23+01:00
hadrian: also include boot-generated files only needed for make

For some libraries the `boot` script generates a `ghc.mk` and
`GNUmakefile` which is required for the make build system. We also
should include these files in the source-dist to save make users from
having to run the `./boot.source` script in the tarball (which
confusingly has a different name to previous GHC releases, thanks to
hadrian).

With this change, the source-dist should be on parity with GHC 9.2.2 and
earlier releases again after the regression in GHC 9.2.3.

Closes #21626.

(cherry picked from commit 90ccdb9c84fe7133244d661766f1aa7a29a94a72)

- - - - -
16c0829a by Douglas Wilson at 2022-07-28T11:06:14+01:00
Update submodule Cabal to tag Cabal-v3.8.1.0

- - - - -
c3a9ac29 by Matthew Pickering at 2022-08-02T10:16:45+01:00
Store interfaces in ModIfaceCache more directly

I realised hydration was completely irrelavant for this cache because
the ModDetails are pruned from the result. So now it simplifies things a
lot to just store the ModIface and Linkable, which we can put into the
cache straight away rather than wait for the final version of a
HomeModInfo to appear.

(cherry picked from commit 30a3a1de9eb4ad3a5697f99c4933f9f7386c598b)

- - - - -
43eb4c6d by Douglas Wilson at 2022-08-03T09:31:56+01:00
Update submodule process to 1.6.15.0

- - - - -
3646d6b1 by Douglas Wilson at 2022-08-03T09:31:56+01:00
Update submodule containers to 0.6.6

- - - - -
e5a895de by Douglas Wilson at 2022-08-03T09:44:29+01:00
Update submodule haddock to commit 7484cf8

- - - - -
55f8541f by Matthew Pickering at 2022-08-03T10:37:58+01:00
ghc-9.4: make buildsystem: build stage0 cabal with older process

Cabal has grown a bound process >= 1.6.14.0 to work around a bug in process.

Making process a stage0 package proved difficult, so instead we
carefully build stage0 cabal --exact-configuration including boot
package-db's process.

This is very ugly, but is only necessary on the 9.4 branch as the make
build system will not be supported in the future.

- - - - -
c18d64bb by Douglas Wilson at 2022-08-03T16:40:04+01:00
ghc-9.4: make build system: Detect too-new boot compiler and docs

- - - - -
b147ac16 by Greg Steuck at 2022-08-03T16:40:04+01:00
Fix haddock_*_perf tests on non-GNU-grep systems

Using regexp pattern requires `egrep` and straight up `+`.  The
haddock_parser_perf and haddock_renamer_perf tests now pass on
OpenBSD. They previously incorrectly parsed the files and awk
complained about invalid syntax.

- - - - -
12ae2a9c by Douglas Wilson at 2022-08-03T17:17:36+01:00
ghc-9.4: make build system: add container module dependencies on template-haskell

- - - - -
c62e65b7 by Douglas Wilson at 2022-08-04T10:17:16+01:00
Update submodule nofib to upstream master

- - - - -
14bf0f22 by Douglas Wilson at 2022-08-04T10:33:52+01:00
ghc-9.4: update llvm-targets

These updates were generated with:
clang version 13.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix

Windows targets are omitted because the script errored with:
clang-13: error: unsupported option '-fPIC' for target 'x86_64-unknown-windows-msvc'

- - - - -
f20c2c91 by Douglas Wilson at 2022-08-04T10:45:06+01:00
ghc-9.4.1: RELEASE=YES

- - - - -
2205c225 by Ben Gamari at 2022-08-04T16:35:48-04:00
users-guide: Clean up release notes

Moving breaking changes into their own section, as suggested in #21630.

- - - - -
6747655d by Ben Gamari at 2022-08-04T16:35:48-04:00
users-guide: Document system-cxx-std-lib

- - - - -
1446be75 by Douglas Wilson at 2022-08-04T16:51:23-04:00
libraries: template-haskell: vendor filepath differently

Vendoring with ../ in hs-source-dirs prevents upload to hackage.

- - - - -
b39f0e0d by Matthew Pickering at 2022-08-04T18:20:10-04:00
make: Add directory dependency on hs-boot copying rules

We need to create these directories before attempting the copy,
apparently this race could be observed in systems under high load.

Fixes #21934

- - - - -
258e68b1 by Ben Gamari at 2022-08-04T18:20:15-04:00
Accept performance shifts

Metric Decrease:
    T18923
Metric Increase:
    ManyAlternatives
    ManyConstructors
    MultiComponentModules
    MultiComponentModulesRecomp
    T10421
    T12234
    T12425
    T12707
    T13035
    T13056
    T13379
    T13719
    T14697
    T15703
    T16875
    T18698a
    T1969
    T3294
    T4801
    T4978
    T5321FD
    T5321Fun
    T7257
    T783
    T9020
    T9198
    T9233
    T9961
    WWRec

- - - - -
f17b56bb by Ben Gamari at 2022-08-04T18:53:59-04:00
Bump stm submodule to 2.5.1.0

- - - - -
e00b823d by Ben Gamari at 2022-08-04T19:02:11-04:00
Bump binary submodule to 0.8.9.1

- - - - -
d1558383 by Ben Gamari at 2022-08-05T11:46:40-04:00
gitlab-ci: Bump Docker images

To give the ARMv7 job access to lld, fixing #21875.

- - - - -
d24765e4 by Ben Gamari at 2022-08-05T12:53:40-04:00
codeGen/X86: Don't clobber switch variable in switch generation

Previously ce8745952f99174ad9d3bdc7697fd086b47cdfb5 assumed that it was
safe to clobber the switch variable when generating code for a jump
table since we were at the end of a block. However, this assumption is
wrong; the register could be live in the jump target.

Fixes #21968.

(cherry picked from commit b4342e32823bb0bfc8e83b53055647d64e0431ab)

- - - - -
69db7406 by Ben Gamari at 2022-08-06T16:32:09-04:00
users-guide: Mention representation change of Word64 and Int64

Closes #21641.

- - - - -
f08a73a0 by Ben Gamari at 2022-08-06T16:32:09-04:00
make: Fix too-old bootstrap compiler error

- - - - -
669fd338 by Ben Gamari at 2022-08-06T16:32:09-04:00
hadrian: Fix binary distribution install attributes

Previously we would use plain `cp` to install various parts of the
binary distribution. However, `cp`'s behavior w.r.t. file attributes is
quite unclear; for this reason it is much better to rather use
`install`.

Fixes #21965.

(cherry picked from commit 4d8e0fd3fe3d648c6d37b3eb43b89e1bdbef36af)

- - - - -
cc715935 by Ben Gamari at 2022-08-06T16:32:09-04:00
hadrian: Fix installation of system-cxx-std-lib package conf

(cherry picked from commit 119ee22dd09d8977de67939de7324af941ae7196)

- - - - -
cb320017 by Ben Gamari at 2022-08-06T22:58:44-04:00
hadrian: Extend xattr Darwin hack to cover /lib

As noted in #21506, it is now necessary to remove extended attributes
from `/lib` as well as `/bin` to avoid SIP issues on Darwin.

Fixes #21506.

(cherry picked from commit a30ef212790e41ba01f92f24e3be4d645502d9ee)

- - - - -
6d01245c by Ben Gamari at 2022-08-06T22:58:44-04:00
Bump haddock submodule

- - - - -
616c77fa by Ben Gamari at 2022-08-07T17:42:19-04:00
configure: Set RELEASE=NO

- - - - -
2441c2f4 by Ben Gamari at 2022-08-12T09:44:50-04:00
users-guide: Fix typo in release notes

- - - - -
dae00493 by Ben Gamari at 2022-08-12T09:44:50-04:00
users-guide: Fix incorrect directives

- - - - -
ddd0a67f by Ben Gamari at 2022-08-12T09:44:50-04:00
relnotes: Reintroduce "included libraries" section

As requested in #21988.

- - - - -
05a86964 by Ben Gamari at 2022-08-12T09:44:50-04:00
make: Fix bootstrapping with profiling enabled

12ae2a9cf89af3ae9e4df051818b631cf213a1b8 attempted to work around a make
build system deficiency by adding some dependencies from modules of
`containers` which contain TH splices to the `template-haskell` package.
However, it only did this for the vanilla way. Here we add similar edges
for profiled objects.

Fixes #21987.

- - - - -
05eef6e2 by Ben Gamari at 2022-08-15T17:03:18-04:00
make: Add another missing build dependency on template-haskell

This time the culprit is Data.Sequence.Internal.

Closes #22047.

- - - - -
c2043b0a by normalcoder at 2022-08-15T17:11:26-04:00
ncg/aarch64: Don't use x18 register on AArch64/Darwin

Apple's ABI documentation [1] says: "The platforms reserve register x18.
Don’t use this register." While this wasn't problematic in previous
Darwin releases, macOS 13 appears to start zeroing this register
periodically. See #21964.

[1] https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms

(cherry picked from commit 67575f2004340564d6e52af055ed6fb43d3f9711)

- - - - -
44b60e03 by Ben Gamari at 2022-08-15T17:11:26-04:00
gitlab-ci: Don't use coreutils on Darwin

In general we want to ensure that the tested environment is as similar
as possible to the environment the user will use. In the case of Darwin,
this means we want to use the system's BSD command-line utilities, not
coreutils.

This would have caught #21974.

(cherry picked from commit c1c08bd829fb33a185f0a71f08babe5d7e6556fc)

- - - - -
658d3fd5 by Ben Gamari at 2022-08-15T17:11:26-04:00
hadrian: Fix bindist installation on Darwin

It turns out that `cp -P` on Darwin does not always copy a symlink as
a symlink. In order to get these semantics one must pass `-RP`. It's not
entirely clear whether this is valid under POSIX, but it is nevertheless
what Apple does.

(cherry picked from commit 1c582f44e41f534a8506a76618f6cffe5d71ed42)

- - - - -
e2832cbd by Ben Gamari at 2022-08-15T17:11:26-04:00
hadrian: Fix access mode of installed package registration files

Previously hadrian's bindist Makefile would modify package
registrations placed by `install` via a shell pipeline and `mv`.
However, the use of `mv` means that if umask is set then the user may
otherwise end up with package registrations which are inaccessible.
Fix this by ensuring that the mode is 0644.

(cherry picked from commit 681aa076259c05c626266cf516de7e7c5524eadb)

- - - - -
cdf69083 by Ben Gamari at 2022-08-15T17:11:26-04:00
rts/linker: Resolve iconv_* on FreeBSD

FreeBSD's libiconv includes an implementation of the
iconv_* functions in libc. Unfortunately these can
only be resolved using dlvsym, which is how the RTS linker
usually resolves such functions. To fix this we include an ad-hoc
special case for iconv_*.

Fixes #20354.

(cherry picked from commit 844df61e8de5e2d9a058e6cbe388802755fc0305)
(cherry picked from commit d8961a2dc974b7f8f8752781c4aec261ae8f8c0f)

- - - - -
4f1e1a30 by Ben Gamari at 2022-08-15T17:11:26-04:00
system-cxx-std-lib: Add support for FreeBSD libcxxrt

(cherry picked from commit 5d66a0ce39f47b7b9f6c732a18ac6e102a21ee6b)

- - - - -
573569d5 by Ben Gamari at 2022-08-15T17:11:26-04:00
gitlab-ci: Bump to use freebsd13 runners

(cherry picked from commit ea90e61dc3c6ba0433e008284dc6c3970ead98a7)

- - - - -
12244700 by Douglas Wilson at 2022-08-15T17:11:26-04:00
testsuite: 21651 add test for closeFdWith + setNumCapabilities

This bug does not affect windows, which does not use the
base module GHC.Event.Thread.

(cherry picked from commit 76b52cf0c52ee05c20f7d1b80f5600eecab3c42a)

- - - - -
feceab56 by Douglas Wilson at 2022-08-15T17:11:26-04:00
base: Fix races in IOManager (setNumCapabilities,closeFdWith)

Fix for #21651

Fixes three bugs:

- writes to eventManager should be atomic. It is accessed concurrently by ioManagerCapabilitiesChanged and closeFdWith.
- The race in closeFdWith described in the ticket.
- A race in getSystemEventManager where it accesses the 'IOArray' in
  'eventManager' before 'ioManagerCapabilitiesChanged' has written to
  'eventManager', causing an Array Index exception. The fix here is to
  'yield' and retry.

(cherry picked from commit 7589ee7241d46b393979d98d4ded17a15ee974fb)

- - - - -
088071e5 by Jens Petersen at 2022-08-15T17:11:26-04:00
hadrian RunRest: add type signature for stageNumber

avoids warning seen on 9.4.1:

src/Settings/Builders/RunTest.hs:264:53: warning: [-Wtype-defaults]
    • Defaulting the following constraints to type ‘Integer’
        (Show a0)
          arising from a use of ‘show’
          at src/Settings/Builders/RunTest.hs:264:53-84
        (Num a0)
          arising from a use of ‘stageNumber’
          at src/Settings/Builders/RunTest.hs:264:59-83
    • In the second argument of ‘(++)’, namely
        ‘show (stageNumber (C.stage ctx))’
      In the second argument of ‘($)’, namely
        ‘"config.stage=" ++ show (stageNumber (C.stage ctx))’
      In the expression:
        arg $ "config.stage=" ++ show (stageNumber (C.stage ctx))
    |
264 |             , arg "-e", arg $ "config.stage="    ++ show (stageNumber (C.stage ctx))
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

compilation tested locally

(cherry picked from commit 823fe5b56450a7eefbf41ce8ece34095bf2217ee)

- - - - -
f7322f2a by Ben Gamari at 2022-08-15T17:11:26-04:00
hadrian: Don't attempt to install documentation if doc/ doesn't exist

Previously we would attempt to install documentation even if the `doc`
directory doesn't exist (e.g. due to `--docs=none`). This would result
in the surprising side-effect of the entire contents of the bindist
being installed in the destination documentation directory. Fix this.

Fixes #21976.

(cherry picked from commit 7cabea7c9b10d2d15a4798be9f3130994393dd9c)

- - - - -
a77c7462 by Ben Gamari at 2022-08-15T17:11:26-04:00
relnotes: Fix typo

- - - - -
d87e0545 by Matthew Pickering at 2022-08-15T17:11:27-04:00
driver: Don't create LinkNodes when -no-link is enabled

Fixes #21866

(cherry picked from commit ef30e21594e44af309c627052f63aea6fd575c9e)

- - - - -
0bea62ff by Ben Gamari at 2022-08-15T17:11:27-04:00
base: Add changelog entries from ghc-9.2

Closes #21922.

- - - - -
4f70fbff by Ben Gamari at 2022-08-17T16:39:43+00:00
linters-common: Add LICENSE

- - - - -
d04c592d by Ben Gamari at 2022-08-17T17:50:22+00:00
make: Fix bindist installation

- - - - -
aeb04c72 by Ben Gamari at 2022-08-18T15:59:46-04:00
gitlab-ci: Fix ARMv7 build

It appears that the CI refactoring carried out in
5ff690b8474c74e9c968ef31e568c1ad0fe719a1 failed to carry over some
critical configuration: setting the build/host/target platforms and
forcing use of a non-broken linker.

(cherry picked from commit 5bc489cac104717f09be73f2b578719bcc1e3fcb)

- - - - -
c534eb5d by Ben Gamari at 2022-08-18T16:06:45-04:00
gitlab-ci: Run ARMv7 jobs when ~ARM label is used

(cherry picked from commit 596db9a5f966643bcc9994d45f2f6ffb4037ad74)

- - - - -
ed84e10b by Matthew Pickering at 2022-08-18T16:06:45-04:00
driver: Honour -x option

The -x option is used to manually specify which phase a file should be
started to be compiled from (even if it lacks the correct extension). I
just failed to implement this when refactoring the driver.

In particular Cabal calls GHC with `-E -cpp -x hs Foo.cpphs` to
preprocess source files using GHC.

I added a test to exercise this case.

Fixes #22044

(cherry picked from commit a740a4c56416c7c1bc914a7a9207207e17833573)

- - - - -
0868c8a5 by Andreas Klebinger at 2022-08-19T10:21:04-04:00
Fix GHCis interaction with tag inference.

I had assumed that wrappers were not inlined in interactive mode.
Meaning we would always execute the compiled wrapper which properly
takes care of upholding the strict field invariant.
This turned out to be wrong. So instead we now run tag inference even
when we generate bytecode. In that case only for correctness not
performance reasons although it will be still beneficial for runtime
in some cases.

I further fixed a bug where GHCi didn't tag nullary constructors
properly when used as arguments. Which caused segfaults when calling
into compiled functions which expect the strict field invariant to
be upheld.

-------------------------
Metric Increase:
    T4801

Metric Decrease:
    T13035
-------------------------

- - - - -
b9ed1a48 by Matthew Pickering at 2022-08-19T16:31:33-04:00
Update haddock submodule to revert quickjump breakage

Fixes #21984

- - - - -
42aff86e by Ben Gamari at 2022-08-20T12:07:08-04:00
Bump haddock submodule

Bumps haddock-api version to 2.27.1

- - - - -
6466747b by Ben Gamari at 2022-08-20T12:07:08-04:00
Add release notes for 9.4.2

- - - - -
8e6b979c by Ben Gamari at 2022-08-20T12:07:08-04:00
hadrian: Place manpage in docroot

This relocates it from docs/ to doc/

(cherry picked from commit 37c61cc05f82f4cdc43aece152df8630b7c0419d)

- - - - -
ed1f88eb by Ben Gamari at 2022-08-20T12:07:08-04:00
users-guide: Add :ghc-flag: reference

(cherry picked from commit 14853adf9571c9fe57d70456a4e8470299a81b8e)

- - - - -
ba137e8b by Ben Gamari at 2022-08-20T12:07:08-04:00
users-guide: Fix reference to dead llvm-version substitution

Fixes #22052.

(cherry picked from commit f0dc6f3e2333cc4625bdfb75990f80ef0ef96638)

- - - - -
0ce2dc79 by Ben Gamari at 2022-08-20T12:07:08-04:00
users-guide: Rephrase the rewrite rule documentation

Previously the wording was a tad unclear. Fix this.

Closes #21114.

(cherry picked from commit c57075ebbed5dc8ae82902999b9f5ae5f3e83b0e)

- - - - -
b67d4ac6 by Ben Gamari at 2022-08-20T12:07:08-04:00
Release 9.4.2

- - - - -
c126db99 by Ben Gamari at 2022-08-20T12:07:46-04:00
hadrian: Don't duplicate binaries on installation

Previously we used `install` on symbolic links, which ended up
copying the target file rather than installing a symbolic link.

Fixes #22062.

- - - - -
e8a889a7 by Ben Gamari at 2022-08-20T12:20:29-04:00
Document -no-link

- - - - -
2cf828e8 by Simon Peyton Jones at 2022-09-15T10:28:17+02:00
Fix a nasty loop in Tidy

As the remarkably-simple #22112 showed, we were making a black hole
in the unfolding of a self-recursive binding.  Boo!

It's a bit tricky.  Documented in GHC.Iface.Tidy,
   Note [tidyTopUnfolding: avoiding black holes]

This is the 9.4 packport based on
commit 4945953823620b223a0b51b2b1275a1de8f4a851

- - - - -
15c496c5 by Sebastian Graf at 2022-10-12T19:20:16-04:00
Ignore .hie-bios

(cherry picked from commit 2563b95cda983cd6be23a5be01fe1f1873f1fa4f)

- - - - -
26af15a0 by Sebastian Graf at 2022-10-12T19:20:16-04:00
CprAnal: Set signatures of DFuns to top

The recursive DFun in the reproducer for #20836 also triggered a bug in CprAnal
that is observable in a debug build. The CPR signature of a recursive DFunId
was never updated and hence the optimistic arity 0 bottom signature triggered a
mismatch with the arity 1 of the binding in WorkWrap. We never miscompiled any
code because WW doesn't exploit bottom CPR signatures.

(cherry picked from commit 94f2e92a2510a3338c5201a4dcc69666fa9575f8)

- - - - -
ecb6accd by Sebastian Graf at 2022-10-14T16:16:07-04:00
CorePrep: Don't speculatively evaluate recursive calls (#20836)

In #20836 we have optimised a terminating program into an endless loop,
because we speculated the self-recursive call of a recursive DFun.
Now we track the set of enclosing recursive binders in CorePrep to prevent
speculation of such self-recursive calls.

See the updates to Note [Speculative evaluation] for details.

Fixes #20836.

(cherry picked from commit b570da84b7aad5ca3f90f2d1c1a690c927e99fe9)

- - - - -
c0b5736c by Sebastian Graf at 2022-10-14T17:10:27-04:00
Simplify: Take care with eta reduction in recursive RHSs (#21652)

Similar to the fix to #20836 in CorePrep, we now track the set of enclosing
recursive binders in the SimplEnv and SimpleOptEnv.
See Note [Eta reduction in recursive RHSs] for details.

I also updated Note [Arity robustness] with the insights Simon and I had in a
call discussing the issue.

Fixes #21652.

Unfortunately, we get a 5% ghc/alloc regression in T16577. That is due to
additional eta reduction in GHC.Read.choose1 and the resulting ANF-isation
of a large list literal at the top-level that didn't happen before (presumably
because it was too interesting to float to the top-level). There's not much we
can do about that.

Metric Increase:
    T16577

(cherry picked from commit 49fb2f9b16ca987648d2ac57eecf1892d49852ec)

- - - - -
ccdaa83c by Ben Gamari at 2022-10-14T17:10:27-04:00
CmmToLlvm: Don't aliasify builtin LLVM variables

Our aliasification logic would previously turn builtin LLVM variables
into aliases, which apparently confuses LLVM. This manifested in
initializers failing to be emitted, resulting in many profiling failures
with the LLVM backend.

Fixes #22019.

(cherry picked from commit cd6f5bfd0cc2bcf74de1d9edb43fe4b338b4c4e3)

- - - - -
671491cc by Matthew Pickering at 2022-10-14T17:10:27-04:00
haddock docs: Fix links from identifiers to dependent packages

When implementing the base_url changes I made the pretty bad mistake of
zipping together two lists which were in different orders. The simpler
thing to do is just modify `haddockDependencies` to also return the
package identifier so that everything stays in sync.

Fixes #22001

(cherry picked from commit 2361b3bc08811b0d2fb8f8fc5635b7c2fec157c6)

- - - - -
6bf992e6 by Ryan Scott at 2022-10-14T17:10:27-04:00
DeriveFunctor: Check for last type variables using dataConUnivTyVars

Previously, derived instances of `Functor` (as well as the related classes
`Foldable`, `Traversable`, and `Generic1`) would determine which constraints to
infer by checking for fields that contain the last type variable. The problem
was that this last type variable was taken from `tyConTyVars`. For GADTs, the
type variables in each data constructor are _not_ the same type variables as
in `tyConTyVars`, leading to #22167.

This fixes the issue by instead checking for the last type variable using
`dataConUnivTyVars`. (This is very similar in spirit to the fix for #21185,
which also replaced an errant use of `tyConTyVars` with type variables from
each data constructor.)

Fixes #22167.

(cherry picked from commit 8a666ad2a89a8ad2aa24a6406b88f516afaec671)

- - - - -
3eace272 by Ryan Scott at 2022-10-14T17:10:27-04:00
Windows: Always define _UCRT when compiling C code

As seen in #22159, this is required to ensure correct behavior when MinGW-w64
headers are in the `C_INCLUDE_PATH`.

Fixes #22159.

(cherry picked from commit 3a815f30bcba5672085e823aeef90863253b0b1a)

- - - - -
9ae4865b by Cheng Shao at 2022-10-14T17:10:27-04:00
rts: fix missing dirty_MVAR argument in stg_writeIOPortzh

(cherry picked from commit ee471dfb8a4a4bb5131a5baa61d1d0d22c933d5f)

- - - - -
6af677a9 by Matthew Pickering at 2022-10-14T17:10:27-04:00
Don't include BufPos in interface files

Ticket #22162 pointed out that the build directory was leaking into the
ABI hash of a module because the BufPos depended on the location of the
build tree.

BufPos is only used in GHC.Parser.PostProcess.Haddock, and the
information doesn't need to be propagated outside the context of a
module.

Fixes #22162

(cherry picked from commit 7f0decd5063a853fc8f38a8944b2c91995cd5e48)

- - - - -
9a12e496 by Ben Gamari at 2022-10-16T10:41:41-04:00
gitlab-ci: Ensure that ghc derivation is in scope

Previously the lint-ci job attempted to use cabal-install (specifically
`cabal update`) without a GHC in PATH. However, cabal-install-3.8
appears to want GHC, even for `cabal update`.

(cherry picked from commit 25f68acedf822e9ea21d1659b1f897fcfc96e5d4)

- - - - -
fa55c566 by Alan Zimmerman at 2022-10-17T15:36:19+00:00
EPA: DotFieldOcc does not have exact print annotations

For the code

    {-# LANGUAGE OverloadedRecordUpdate #-}

    operatorUpdate f = f{(+) = 1}

There are no exact print annotations for the parens around the +
symbol, nor does normal ppr print them.

This MR fixes that.

Closes #21805

(cherry picked from commit 792ef44d455c6e987f342fb61515464322a9fa77)

- - - - -


30 changed files:

- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/toolchain.nix
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/upload_ghc_libs.py
- compiler/CodeGen.Platform.h
- compiler/GHC.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/LateCC.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/63a15e3e04e761c1e7a101bc89c2db38adf83553...fa55c5662fc2ce8ea03152a21cd00c268d3d6741

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/63a15e3e04e761c1e7a101bc89c2db38adf83553...fa55c5662fc2ce8ea03152a21cd00c268d3d6741
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221017/f982fa75/attachment-0001.html>


More information about the ghc-commits mailing list