[Git][ghc/ghc][wip/clc-86] 273 commits: hadrian: Pass haddock file arguments in a response file

Melanie Brown (@mixphix) gitlab at gitlab.haskell.org
Mon Jun 12 19:25:56 UTC 2023



Melanie Brown pushed to branch wip/clc-86 at Glasgow Haskell Compiler / GHC


Commits:
f15b0ce5 by Matthew Pickering at 2023-04-20T11:01:06-04:00
hadrian: Pass haddock file arguments in a response file

In !10119 CI was failing on windows because the command line was too
long. We can mitigate this by passing the file arguments to haddock in a
response file.

We can't easily pass all the arguments in a response file because the
`+RTS` arguments can't be placed in the response file.

Fixes #23273

- - - - -
7012ec2f by tocic at 2023-04-20T11:01:42-04:00
Fix doc typo in GHC.Read.readList

- - - - -
5c873124 by sheaf at 2023-04-20T18:33:34-04:00
Implement -jsem: parallelism controlled by semaphores

See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a
complete description for the motivation for this feature.

The `-jsem` option allows a build tool to pass a semaphore to GHC which
GHC can use in order to control how much parallelism it requests.

GHC itself acts as a client in the GHC jobserver protocol.

```
GHC Jobserver Protocol
~~~~~~~~~~~~~~~~~~~~~~

This proposal introduces the GHC Jobserver Protocol. This protocol allows
a server to dynamically invoke many instances of a client process,
while restricting all of those instances to use no more than <n> capabilities.
This is achieved by coordination over a system semaphore (either a POSIX
semaphore [6]_  in the case of Linux and Darwin, or a Win32 semaphore [7]_
in the case of Windows platforms).

There are two kinds of participants in the GHC Jobserver protocol:

- The *jobserver* creates a system semaphore with a certain number of
  available tokens.

  Each time the jobserver wants to spawn a new jobclient subprocess, it **must**
  first acquire a single token from the semaphore, before spawning
  the subprocess. This token **must** be released once the subprocess terminates.

  Once work is finished, the jobserver **must** destroy the semaphore it created.

- A *jobclient* is a subprocess spawned by the jobserver or another jobclient.

  Each jobclient starts with one available token (its *implicit token*,
  which was acquired by the parent which spawned it), and can request more
  tokens through the Jobserver Protocol by waiting on the semaphore.

  Each time a jobclient wants to spawn a new jobclient subprocess, it **must**
  pass on a single token to the child jobclient. This token can either be the
  jobclient's implicit token, or another token which the jobclient acquired
  from the semaphore.

  Each jobclient **must** release exactly as many tokens as it has acquired from
  the semaphore (this does not include the implicit tokens).
```

Build tools such as cabal act as jobservers in the protocol and are
responsibile for correctly creating, cleaning up and managing the
semaphore.

Adds a new submodule (semaphore-compat) for managing and interacting
with semaphores in a cross-platform way.

Fixes #19349

- - - - -
52d3e9b4 by Ben Gamari at 2023-04-20T18:34:11-04:00
rts: Initialize Array# header in listThreads#

Previously the implementation of listThreads# failed to initialize the
header of the created array, leading to various nastiness.

Fixes #23071

- - - - -
1db30fe1 by Ben Gamari at 2023-04-20T18:34:11-04:00
testsuite: Add test for #23071

- - - - -
dae514f9 by tocic at 2023-04-21T13:31:21-04:00
Fix doc typos in libraries/base/GHC

- - - - -
113e21d7 by Sylvain Henry at 2023-04-21T13:32:01-04:00
Testsuite: replace some js_broken/js_skip predicates with req_c

Using req_c is more precise.

- - - - -
038bb031 by Krzysztof Gogolewski at 2023-04-21T18:03:04-04:00
Minor doc fixes

- Add docs/index.html to .gitignore.
  It is created by ./hadrian/build docs, and it was the only file
  in Hadrian's templateRules not present in .gitignore.
- Mention that MultiWayIf supports non-boolean guards
- Remove documentation of optdll - removed in 2007, 763daed95
- Fix markdown syntax

- - - - -
e826cdb2 by amesgen at 2023-04-21T18:03:44-04:00
User's guide: DeepSubsumption is implied by Haskell{98,2010}

- - - - -
499a1c20 by PHO at 2023-04-23T13:39:32-04:00
Implement executablePath for Solaris and make getBaseDir less platform-dependent

Use base-4.17 executablePath when possible, and fall back on
getExecutablePath when it's not available. The sole reason why getBaseDir
had #ifdef's was apparently that getExecutablePath wasn't reliable, and we
could reduce the number of CPP conditionals by making use of
executablePath instead.

Also export executablePath on js_HOST_ARCH.

- - - - -
97a6f7bc by tocic at 2023-04-23T13:40:08-04:00
Fix doc typos in libraries/base

- - - - -
787c6e8c by Ben Gamari at 2023-04-24T12:19:06-04:00
testsuite/T20137: Avoid impl.-defined behavior

Previously we would cast pointers to uint64_t. However, implementations
are allowed to either zero- or sign-extend such casts. Instead cast to
uintptr_t to avoid this.

Fixes #23247.

- - - - -
87095f6a by Cheng Shao at 2023-04-24T12:19:44-04:00
rts: always build 64-bit atomic ops

This patch does a few things:

- Always build 64-bit atomic ops in rts/ghc-prim, even on 32-bit
  platforms
- Remove legacy "64bit" cabal flag of rts package
- Fix hs_xchg64 function prototype for 32-bit platforms
- Fix AtomicFetch test for wasm32

- - - - -
2685a12d by Cheng Shao at 2023-04-24T12:20:21-04:00
compiler: don't install signal handlers when the host platform doesn't have signals

Previously, large parts of GHC API will transitively invoke
withSignalHandlers, which doesn't work on host platforms without
signal functionality at all (e.g. wasm32-wasi). By making
withSignalHandlers a no-op on those platforms, we can make more parts
of GHC API work out of the box when signals aren't supported.

- - - - -
1338b7a3 by Cheng Shao at 2023-04-24T16:21:30-04:00
hadrian: fix non-ghc program paths passed to testsuite driver when testing cross GHC

- - - - -
1a10f556 by Bodigrim at 2023-04-24T16:22:09-04:00
Add since pragma to Data.Functor.unzip

- - - - -
0da9e882 by Soham Chowdhury at 2023-04-25T00:15:22-04:00
More informative errors for bad imports (#21826)

- - - - -
ebd5b078 by Josh Meredith at 2023-04-25T00:15:58-04:00
JS/base: provide implementation for mkdir (issue 22374)

- - - - -
8f656188 by Josh Meredith at 2023-04-25T18:12:38-04:00
JS: Fix h$base_access implementation (issue 22576)

- - - - -
74c55712 by Andrei Borzenkov at 2023-04-25T18:13:19-04:00
Give more guarntees about ImplicitParams (#23289)

- Added new section in the GHC user's guide that legends behavior of
nested implicit parameter bindings in these two cases:

  let ?f = 1 in let ?f = 2 in ?f

and

  data T where MkT :: (?f :: Int) => T

  f :: T -> T -> Int
  f MkT MkT = ?f

- Added new test case to examine this behavior.

- - - - -
c30ac25f by Sebastian Graf at 2023-04-26T14:50:51-04:00
DmdAnal: Unleash demand signatures of free RULE and unfolding binders (#23208)

In #23208 we observed that the demand signature of a binder occuring in a RULE
wasn't unleashed, leading to a transitively used binder being discarded as
absent. The solution was to use the same code path that we already use for
handling exported bindings.

See the changes to `Note [Absence analysis for stable unfoldings and RULES]`
for more details.

I took the chance to factor out the old notion of a `PlusDmdArg` (a pair of a
`VarEnv Demand` and a `Divergence`) into `DmdEnv`, which fits nicely into our
existing framework. As a result, I had to touch quite a few places in the code.

This refactoring exposed a few small bugs around correct handling of bottoming
demand environments. As a result, some strictness signatures now mention uniques
that weren't there before which caused test output changes to T13143, T19969 and
T22112. But these tests compared whole -ddump-simpl listings which is a very
fragile thing to begin with. I changed what exactly they test for based on the
symptoms in the corresponding issues.

There is a single regression in T18894 because we are more conservative around
stable unfoldings now. Unfortunately it is not easily fixed; let's wait until
there is a concrete motivation before invest more time.

Fixes #23208.

- - - - -
77f506b8 by Josh Meredith at 2023-04-26T14:51:28-04:00
Refactor GenStgRhs to include the Type in both constructors (#23280, #22576, #22364)

Carry the actual type of an expression through the PreStgRhs and into GenStgRhs
for use in later stages. Currently this is used in the JavaScript backend to fix
some tests from the above mentioned issues: EtaExpandLevPoly, RepPolyWrappedVar2,
T13822, T14749.

- - - - -
052e2bb6 by Alan Zimmerman at 2023-04-26T14:52:05-04:00
EPA: Use ExplicitBraces only in HsModule

!9018 brought in exact print annotations in LayoutInfo for open and
close braces at the top level.

But it retained them in the HsModule annotations too.

Remove the originals, so exact printing uses LayoutInfo

- - - - -
d5c4629b by Cheng Shao at 2023-04-27T16:00:35-04:00
ci: update ci.sh to actually run the entire testsuite for wasm backend

For the time being, we still need to use in-tree mode and can't test
the bindist yet.

- - - - -
533d075e by Cheng Shao at 2023-04-27T16:00:35-04:00
ci: additional wasm32 manual jobs in validate pipelines

This patch enables bignum native & unregisterised wasm32 jobs as
manual jobs in validate pipelines, which can be useful to prevent
breakage when working on wasm32 related patches.

- - - - -
b5f00811 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: fix cross prefix stripping

This patch fixes cross prefix stripping in the testsuite driver. The
normalization logic used to only handle prefixes of the triple form
<arch>-<vendor>-<os>, now it's relaxed to allow any number of tokens
in the prefix tuple, so the cross prefix stripping logic would work
when ghc is configured with something like --target=wasm32-wasi.

- - - - -
6f511c36 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: include target exe extension in heap profile filenames

This patch fixes hp2ps related framework failures when testing the
wasm backend by including target exe extension in heap profile
filenames.

- - - - -
e6416b10 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: exclude ghci ways if no rts linker is present

This patch implements logic to automatically exclude ghci ways when
there is no rts linker. It's way better than having to annotate
individual test cases.

- - - - -
791cce64 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: fix permission bits in copy_files

When the testsuite driver copy files instead of symlinking them, it
should also copy the permission bits, otherwise there'll be permission
denied errors. Also, enforce file copying when testing wasm32, since
wasmtime doesn't handle host symlinks quite well
(https://github.com/bytecodealliance/wasmtime/issues/6227).

- - - - -
aa6afe8a by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add the req_ghc_with_threaded_rts predicate

This patch adds the req_ghc_with_threaded_rts predicate to the
testsuite to assert the platform has threaded RTS, and mark some tests
as req_ghc_with_threaded_rts. Also makes ghc_with_threaded_rts a
config field instead of a global variable.

- - - - -
ce580426 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add the req_process predicate

This patch adds the req_process predicate to the testsuite to assert
the platform has a process model, also marking tests that involve
spawning processes as req_process. Also bumps hpc & process submodule.

- - - - -
cb933665 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add the req_host_target_ghc predicate

This patch adds the req_host_target_ghc predicate to the testsuite to
assert the ghc compiler being tested can compile both host/target
code. When testing cross GHCs this is not supported yet, but it may
change in the future.

- - - - -
b174a110 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add missing annotations for some tests

This patch adds missing annotations (req_th, req_dynamic_lib_support,
req_rts_linker) to some tests. They were discovered when testing
wasm32, though it's better to be explicit about what features they
require, rather than simply adding when(arch('wasm32'), skip).

- - - - -
bd2bfdec by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: wasm32-specific fixes

This patch includes all wasm32-specific testsuite fixes.

- - - - -
4eaf2c2a by Josh Meredith at 2023-04-27T16:01:11-04:00
JS: change GHC.JS.Transform.identsS/E/V to take a saturated IR (#23304)

- - - - -
57277662 by sheaf at 2023-04-29T20:23:06+02:00
Add the Unsatisfiable class

This commit implements GHC proposal #433, adding the Unsatisfiable
class to the GHC.TypeError module. This provides an alternative to
TypeError for which error reporting is more predictable: we report it
when we are reporting unsolved Wanted constraints.

Fixes #14983 #16249 #16906 #18310 #20835

- - - - -
00a8a5ff by Torsten Schmits at 2023-04-30T03:45:09-04:00
Add structured error messages for GHC.Rename.Names

Tracking ticket: #20115

MR: !10336

This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.

- - - - -
931c8d82 by Ben Orchard at 2023-05-03T20:16:18-04:00
Add sized primitive literal syntax

Adds a new LANGUAGE pragma ExtendedLiterals, which enables defining
unboxed numeric literals such as `0xFF#Word8 :: Word8#`.

Implements GHC proposal 0451:
https://github.com/ghc-proposals/ghc-proposals/blob/b384a538b34f79d18a0201455b7b3c473bc8c936/proposals/0451-sized-literals.rst

Fixes #21422.

Bumps haddock submodule.

Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski at tweag.io>

- - - - -
f3460845 by Bodigrim at 2023-05-03T20:16:57-04:00
Document instances of Double

- - - - -
1e9caa1a by Sylvain Henry at 2023-05-03T20:17:37-04:00
Bump Cabal submodule (#22356)

- - - - -
4eafb52a by sheaf at 2023-05-03T20:18:16-04:00
Don't forget to check the parent in an export list

Commit 3f374399 introduced a bug which caused us to forget to include
the parent of an export item of the form T(..) (that is, IEThingAll)
when checking for duplicate exports.

Fixes #23318

- - - - -
8fde4ac8 by amesgen at 2023-05-03T20:18:57-04:00
Fix unlit path in cross bindists

- - - - -
8cc9a534 by Matthew Pickering at 2023-05-04T14:58:14-04:00
hadrian: Flavour: Change args -> extraArgs

Previously in a flavour definition you could override all the flags
which were passed to GHC. This causes issues when needed to compute a
package hash because we need to know what these extra arguments are
going to be before computing the hash. The solution is to modify flavour
so that the arguments you pass here are just extra ones rather than all
the arguments that you need to compile something.

This makes things work more like how cabal.project files work when you
give extra arguments to a package and also means that flavour
transformers correctly affect the hash.

- - - - -
3fdb18f8 by romes at 2023-05-04T14:58:14-04:00
Hardwire a better unit-id for ghc

Previously, the unit-id of ghc-the-library was fixed as `ghc`.
This was done primarily because the compiler must know the unit-id of
some packages (including ghc) a-priori to define wired-in names.

However, as seen in #20742, a reinstallable `ghc` whose unit-id is fixed
to `ghc` might result in subtle bugs when different ghc's interact.

A good example of this is having GHC_A load a plugin compiled by GHC_B,
where GHC_A and GHC_B are linked to ghc-libraries that are ABI
incompatible. Without a distinction between the unit-id of the ghc library
GHC_A is linked against and the ghc library the plugin it is loading was
compiled against, we can't check compatibility.

This patch gives a slightly better unit-id to ghc (ghc-version) by
(1) Not setting -this-unit-id to ghc, but rather to the new unit-id (modulo stage0)
(2) Adding a definition to `GHC.Settings.Config` whose value is the new unit-id.
    (2.1) `GHC.Settings.Config` is generated by Hadrian
    (2.2) and also by cabal through `compiler/Setup.hs`
This unit-id definition is imported by `GHC.Unit.Types` and used to
set the wired-in unit-id of "ghc", which was previously fixed to "ghc"

The commits following this one will improve the unit-id with a
cabal-style package hash and check compatibility when loading plugins.

Note that we also ensure that ghc's unit key matches unit id both when
hadrian or cabal builds ghc, and in this way we no longer need to add
`ghc` to the WiringMap.

- - - - -
6689c9c6 by romes at 2023-05-04T14:58:14-04:00
Validate compatibility of ghcs when loading plugins

Ensure, when loading plugins, that the ghc the plugin depends on is the
ghc loading the plugin -- otherwise fail to load the plugin.

Progress towards #20742.

- - - - -
db4be339 by romes at 2023-05-04T14:58:14-04:00
Add hashes to unit-ids created by hadrian

This commit adds support for computing an inputs hash for packages
compiled by hadrian. The result is that ABI incompatible packages should
be given different hashes and therefore be distinct in a cabal store.

Hashing is enabled by the `--flag`, and is off by default as the hash
contains a hash of the source files. We enable it when we produce
release builds so that the artifacts we distribute have the right unit
ids.

- - - - -
944a9b94 by Matthew Pickering at 2023-05-04T14:58:14-04:00
Use hash-unit-ids in release jobs

Includes fix upload_ghc_libs glob

- - - - -
116d7312 by Josh Meredith at 2023-05-04T14:58:51-04:00
JS: fix bounds checking (Issue 23123)

* For ByteArray-based bounds-checking, the JavaScript backend must use the
`len` field, instead of the inbuild JavaScript `length` field.

* Range-based operations must also check both the start and end of the range
for bounds

* All indicies are valid for ranges of size zero, since they are essentially no-ops

* For cases of ByteArray accesses (e.g. read as Int), the end index is
(i * sizeof(type) + sizeof(type) - 1), while the previous implementation
uses (i + sizeof(type) - 1). In the Int32 example, this is (i * 4 + 3)

* IndexByteArrayOp_Word8As* primitives use byte array indicies (unlike
the previous point), but now check both start and end indicies

* Byte array copies now check if the arrays are the same by identity and
then if the ranges overlap.

- - - - -
2d5c1dde by Sylvain Henry at 2023-05-04T14:58:51-04:00
Fix remaining issues with bound checking (#23123)

While fixing these I've also changed the way we store addresses into
ByteArray#. Addr# are composed of two parts: a JavaScript array and an
offset (32-bit number).

Suppose we want to store an Addr# in a ByteArray# foo at offset i.
Before this patch, we were storing both fields as a tuple in the "arr"
array field:

  foo.arr[i] = [addr_arr, addr_offset];

Now we only store the array part in the "arr" field and the offset
directly in the array:

  foo.dv.setInt32(i, addr_offset):
  foo.arr[i] = addr_arr;

It avoids wasting space for the tuple.

- - - - -
98c5ee45 by Luite Stegeman at 2023-05-04T14:59:31-04:00
JavaScript: Correct arguments to h$appendToHsStringA

fixes #23278

- - - - -
ca611447 by Josh Meredith at 2023-05-04T15:00:07-04:00
base/encoding: add an allocations performance test (#22946)

- - - - -
e3ddf58d by Krzysztof Gogolewski at 2023-05-04T15:00:44-04:00
linear types: Don't add external names to the usage env

This has no observable effect, but avoids storing useless data.

- - - - -
b3226616 by Andrei Borzenkov at 2023-05-04T15:01:25-04:00
Improved documentation for the Data.OldList.nub function

There was recomentation to use map head . group . sort instead of nub
function, but containers library has more suitable and efficient
analogue

- - - - -
e8b72ff6 by Ryan Scott at 2023-05-04T15:02:02-04:00
Fix type variable substitution in gen_Newtype_fam_insts

Previously, `gen_Newtype_fam_insts` was substituting the type variable binders
of a type family instance using `substTyVars`, which failed to take type
variable dependencies into account. There is similar code in
`GHC.Tc.TyCl.Class.tcATDefault` that _does_ perform this substitution properly,
so this patch:

1. Factors out this code into a top-level `substATBndrs` function, and
2. Uses `substATBndrs` in `gen_Newtype_fam_insts`.

Fixes #23329.

- - - - -
275836d2 by Torsten Schmits at 2023-05-05T08:43:02+00:00
Add structured error messages for GHC.Rename.Utils

Tracking ticket: #20115

MR: !10350

This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.

- - - - -
983ce558 by Oleg Grenrus at 2023-05-05T13:11:29-04:00
Use TemplateHaskellQuotes in TH.Syntax to construct Names

- - - - -
a5174a59 by Matthew Pickering at 2023-05-05T18:42:31-04:00
driver: Use hooks from plugin_hsc_env

This fixes a bug in oneshot mode where hooks modified in a plugin
wouldn't be used in oneshot mode because we neglected to use the right
hsc_env. This was observed by @csabahruska.

- - - - -
18a7d03d by Aaron Allen at 2023-05-05T18:42:31-04:00
Rework plugin initialisation points

In general this patch pushes plugin initialisation points to earlier in
the pipeline. As plugins can modify the `HscEnv`, it's imperative that
the plugins are initialised as soon as possible and used thereafter.

For example, there are some new tests which modify hsc_logger and other
hooks which failed to fire before (and now do)

One consequence of this change is that the error for specifying the
usage of a HPT plugin from the command line has changed, because it's
now attempted to be loaded at initialisation rather than causing a
cyclic module import.

Closes #21279

Co-authored-by: Matthew Pickering <matthewtpickering at gmail.com>

- - - - -
6e776ed3 by Matthew Pickering at 2023-05-05T18:42:31-04:00
docs: Add Note [Timing of plugin initialization]

- - - - -
e1df8511 by Matthew Pickering at 2023-05-05T18:43:07-04:00
Incrementally update ghcup metadata in ghc/ghcup-metadata

This job paves the way for distributing nightly builds

* A new repo https://gitlab.haskell.org/ghc/ghcup-metadata stores the
  metadata on the "updates" branch.
* Each night this metadata is downloaded and the nightly builds are
  appended to the end of the metadata.
* The update job only runs on the scheduled nightly pipeline, not just
  when NIGHTLY=1.

Things which are not done yet

* Modify the retention policy for nightly jobs
* Think about building release flavour compilers to distribute nightly.

Fixes #23334

- - - - -
8f303d27 by Rodrigo Mesquita at 2023-05-05T22:04:31-04:00
docs: Remove mentions of ArrayArray# from unlifted FFI section

Fixes #23277

- - - - -
994bda56 by Torsten Schmits at 2023-05-05T22:05:12-04:00
Add structured error messages for GHC.Rename.Module

Tracking ticket: #20115

MR: !10361

This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.

Only addresses the single warning missing from the previous MR.

- - - - -
3e3a6be4 by Ben Gamari at 2023-05-08T12:15:19+00:00
rts: Fix data-race in hs_init_ghc

As noticed by @Terrorjack, `hs_init_ghc` previously used non-atomic
increment/decrement on the RTS's initialization count. This may go wrong
in a multithreaded program which initializes the runtime multiple times.

Closes #22756.

- - - - -
78c8dc50 by Torsten Schmits at 2023-05-08T21:41:51-04:00
Add structured error messages for GHC.IfaceToCore

Tracking ticket: #20114

MR: !10390

This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.

- - - - -
0e2df4c9 by Bryan Richter at 2023-05-09T12:03:35+03:00
Fix up rules for ghcup-metadata-nightly-push

- - - - -
b970e64f by Ben Gamari at 2023-05-09T08:41:33-04:00
testsuite: Add test for atomicSwapIORef

- - - - -
81cfefd2 by Ben Gamari at 2023-05-09T08:41:53-04:00
compiler: Implement atomicSwapIORef with xchg

As requested by @treeowl in CLC#139.

- - - - -
6b29154d by Ben Gamari at 2023-05-09T08:41:53-04:00
Make atomicSwapMutVar# an inline primop

- - - - -
64064cfe by doyougnu at 2023-05-09T18:40:01-04:00
JS: add GHC.JS.Optimizer, remove RTS.Printer, add Linker.Opt

This MR changes some simple optimizations and is a first step in re-architecting
the JS backend pipeline to add the optimizer. In particular it:

- removes simple peep hole optimizations from `GHC.StgToJS.Printer` and removes that module
- adds module `GHC.JS.Optimizer`
- defines the same peep hole opts that were removed only now they are `Syntax -> Syntax` transformations rather than `Syntax -> JS code` optimizations
- hooks the optimizer into code gen
- adds FuncStat and ForStat constructors to the backend.

Working Ticket:
- #22736

Related MRs:
- MR !10142
- MR !10000

-------------------------
Metric Decrease:
    CoOpt_Read
    ManyAlternatives
    PmSeriesS
    PmSeriesT
    PmSeriesV
    T10421
    T12707
    T13253
    T13253-spj
    T15164
    T17516
    T18140
    T18282
    T18698a
    T18698b
    T18923
    T1969
    T19695
    T20049
    T3064
    T5321FD
    T5321Fun
    T783
    T9198
    T9233
    T9630
-------------------------

- - - - -
6738c01d by Krzysztof Gogolewski at 2023-05-09T18:40:38-04:00
Add a regression test for #21050

- - - - -
b2cdb7da by Ben Gamari at 2023-05-09T18:41:14-04:00
nonmoving: Account for mutator allocations in bytes_allocated

Previously we failed to account direct mutator allocations into the
nonmoving heap against the mutator's allocation limit and
`cap->total_allocated`. This only manifests during CAF evaluation (since
we allocate the CAF's blackhole directly into the nonmoving heap).

Fixes #23312.

- - - - -
0657b482 by Sven Tennie at 2023-05-09T22:22:42-04:00
Adjust AArch64 stackFrameHeaderSize

The prologue of each stack frame are the saved LR and FP registers, 8
byte each. I.e. the size of the stack frame header is 2 * 8 byte.

- - - - -
7788c09c by konsumlamm at 2023-05-09T22:23:23-04:00
Make `(&)` representation polymorphic in the return type

- - - - -
b3195922 by Ben Gamari at 2023-05-10T05:06:45-04:00
ghc-prim: Generalize keepAlive#/touch# in state token type

Closes #23163.

- - - - -
1e6861dd by Cheng Shao at 2023-05-10T05:07:25-04:00
Bump hsc2hs submodule

Fixes #22981.

- - - - -
0a513952 by Ben Gamari at 2023-05-11T04:10:17-04:00
base: Export GHC.Conc.Sync.fromThreadId

Closes #22706.

- - - - -
29be39ba by Matthew Pickering at 2023-05-11T04:10:54-04:00
Build vanilla alpine bindists

We currently attempt to build and distribute fully static alpine
bindists (ones which could be used on any linux platform) but most
people who use the alpine bindists want to use alpine to build their own
static applications (for which a fully static bindist is not necessary).
We should build and distribute these bindists for these users whilst the
fully-static bindist is still unusable.

Fixes #23349

- - - - -
40c7daed by Simon Peyton Jones at 2023-05-11T04:11:30-04:00
Look both ways when looking for quantified equalities

When looking up (t1 ~# t2) in the quantified constraints,
check both orientations.  Forgetting this led to #23333.

- - - - -
c17bb82f by Rodrigo Mesquita at 2023-05-11T04:12:07-04:00
Move "target has RTS linker" out of settings

We move the "target has RTS linker" information out of configure into a
predicate in GHC, and remove this option from the settings file where it
is unnecessary -- it's information statically known from the platform.

Note that previously we would consider `powerpc`s and `s390x`s other
than `powerpc-ibm-aix*` and `s390x-ibm-linux` to have an RTS linker,
but the RTS linker supports neither platform.

Closes #23361

- - - - -
bd0b056e by Krzysztof Gogolewski at 2023-05-11T04:12:44-04:00
Add a test for #17284

Since !10123 we now reject this program.

- - - - -
630b1fea by Bodigrim at 2023-05-11T04:13:24-04:00
Document unlawfulness of instance Num Fixed

Fixes #22712

- - - - -
87eebf98 by sheaf at 2023-05-11T11:55:22-04:00
Add fused multiply-add instructions

This patch adds eight new primops that fuse a multiplication and an
addition or subtraction:

  - `{fmadd,fmsub,fnmadd,fnmsub}{Float,Double}#`

fmadd x y z is x * y + z, computed with a single rounding step.

This patch implements code generation for these primops in the following
backends:

  - X86, AArch64 and PowerPC NCG,
  - LLVM
  - C

WASM uses the C implementation. The primops are unsupported in the
JavaScript backend.

The following constant folding rules are also provided:

  - compute a * b + c when a, b, c are all literals,
  - x * y + 0 ==> x * y,
  - ±1 * y + z ==> z ± y and x * ±1 + z ==> z ± x.

NB: the constant folding rules incorrectly handle signed zero.
This is a known limitation with GHC's floating-point constant folding
rules (#21227), which we hope to resolve in the future.

- - - - -
ad16a066 by Krzysztof Gogolewski at 2023-05-11T11:55:59-04:00
Add a test for #21278

- - - - -
05cea68c by Matthew Pickering at 2023-05-11T11:56:36-04:00
rts: Refine memory retention behaviour to account for pinned/compacted objects

When using the copying collector there is still a lot of data which
isn't copied (such as pinned, compacted, large objects etc). The logic
to decide how much memory to retain didn't take into account that these
wouldn't be copied. Therefore we pessimistically retained 2* the amount
of memory for these blocks even though they wouldn't be copied by the
collector.

The solution is to split up the heap into two parts, the parts which
will be copied and the parts which won't be copied. Then the appropiate
factor is applied to each part individually (2 * for copying and 1.2 *
for not copying).

The T23221 test demonstrates this improvement with a program which first
allocates many unpinned ByteArray# followed by many pinned ByteArray#
and observes the difference in the ultimate memory baseline between the
two.

There are some charts on #23221.

Fixes #23221

- - - - -
1bb24432 by Cheng Shao at 2023-05-11T11:57:15-04:00
hadrian: fix no_dynamic_libs flavour transformer

This patch fixes the no_dynamic_libs flavour transformer and make
fully_static reuse it. Previously building with no_dynamic_libs fails
since ghc program is still dynamic and transitively brings in dyn ways
of rts which are produced by no rules.

- - - - -
0ed493a3 by Josh Meredith at 2023-05-11T23:08:27-04:00
JS: refactor jsSaturate to return a saturated JStat (#23328)

- - - - -
a856d98e by Pierre Le Marre at 2023-05-11T23:09:08-04:00
Doc: Fix out-of-sync using-optimisation page

- Make explicit that default flag values correspond to their -O0 value.
- Fix -fignore-interface-pragmas, -fstg-cse, -fdo-eta-reduction,
  -fcross-module-specialise, -fsolve-constant-dicts, -fworker-wrapper.

- - - - -
c176ad18 by sheaf at 2023-05-12T06:10:57-04:00
Don't panic in mkNewTyConRhs

This function could come across invalid newtype constructors, as we
only perform validity checking of newtypes once we are outside the
knot-tied typechecking loop.
This patch changes this function to fake up a stub type in the case of
an invalid newtype, instead of panicking.

This patch also changes "checkNewDataCon" so that it reports as many
errors as possible at once.

Fixes #23308

- - - - -
ab63daac by Krzysztof Gogolewski at 2023-05-12T06:11:38-04:00
Allow Core optimizations when interpreting bytecode

Tracking ticket: #23056

MR: !10399

This adds the flag `-funoptimized-core-for-interpreter`, permitting use
of the `-O` flag to enable optimizations when compiling with the
interpreter backend, like in ghci.

- - - - -
c6cf9433 by Ben Gamari at 2023-05-12T06:12:14-04:00
hadrian: Fix mention of non-existent removeFiles function

Previously Hadrian's bindist Makefile referred to a `removeFiles`
function that was previously defined by the `make` build system. Since
the `make` build system is no longer around, this function is now
undefined. Naturally, make being make, this appears to be silently
ignored instead of producing an error.

Fix this by rewriting it to `rm -f`.

Closes #23373.

- - - - -
eb60ec18 by Bodigrim at 2023-05-12T06:12:54-04:00
Mention new implementation of GHC.IORef.atomicSwapIORef in the changelog

- - - - -
aa84cff4 by Teo Camarasu at 2023-05-12T19:27:23-04:00
rts: Ensure non-moving gc is not running when pausing

- - - - -
5ad776ab by Teo Camarasu at 2023-05-12T19:27:23-04:00
rts: Teach listAllBlocks about nonmoving heap

List all blocks on the non-moving heap.

Resolves #22627

- - - - -
d683b2e5 by Krzysztof Gogolewski at 2023-05-12T19:28:00-04:00
Fix coercion optimisation for SelCo (#23362)

setNominalRole_maybe is supposed to output a nominal coercion.
In the SelCo case, it was not updating the stored role to Nominal,
causing #23362.

- - - - -
59aa4676 by Alexis King at 2023-05-12T19:28:47-04:00
hadrian: Fix linker script flag for MergeObjects builder

This fixes what appears to have been a typo in !9530. The `-t` flag just
enables tracing on all versions of `ld` I’ve looked at, while `-T` is
used to specify a linker script. It seems that this worked anyway for
some reason on some `ld` implementations (perhaps because they
automatically detect linker scripts), but the missing `-T` argument
causes `gold` to complain.

- - - - -
4bf9fa0f by Adam Gundry at 2023-05-12T23:49:49-04:00
Less coercion optimization for non-newtype axioms

See Note [Push transitivity inside newtype axioms only] for an explanation
of the change here.  This change substantially improves the performance of
coercion optimization for programs involving transitive type family reductions.

-------------------------
Metric Decrease:
    CoOpt_Singletons
    LargeRecord
    T12227
    T12545
    T13386
    T15703
    T5030
    T8095
-------------------------

- - - - -
dc0c9574 by Adam Gundry at 2023-05-12T23:49:49-04:00
Move checkAxInstCo to GHC.Core.Lint

A consequence of the previous change is that checkAxInstCo is no longer
called during coercion optimization, so it can be moved back where it belongs.

Also includes some edits to Note [Conflict checking with AxiomInstCo] as
suggested by @simonpj.

- - - - -
8b9b7dbc by Simon Peyton Jones at 2023-05-12T23:50:25-04:00
Use the eager unifier in the constraint solver

This patch continues the refactoring of the constraint solver
described in #23070.

The Big Deal in this patch is to call the regular, eager unifier from the
constraint solver, when we want to create new equalities. This
replaces the existing, unifyWanted which amounted to
yet-another-unifier, so it reduces duplication of a rather subtle
piece of technology. See

  * Note [The eager unifier] in GHC.Tc.Utils.Unify
  * GHC.Tc.Solver.Monad.wrapUnifierTcS

I did lots of other refactoring along the way

* I simplified the treatment of right hand sides that contain CoercionHoles.
  Now, a constraint that contains a hetero-kind CoercionHole is non-canonical,
  and cannot be used for rewriting or unification alike.  This required me
  to add the ch_hertero_kind flag to CoercionHole, with consequent knock-on
  effects. See wrinkle (2) of `Note [Equalities with incompatible kinds]` in
  GHC.Tc.Solver.Equality.

* I refactored the StopOrContinue type to add StartAgain, so that after a
  fundep improvement (for example) we can simply start the pipeline again.

* I got rid of the unpleasant (and inefficient) rewriterSetFromType/Co functions.
  With Richard I concluded that they are never needed.

* I discovered Wrinkle (W1) in Note [Wanteds rewrite Wanteds] in
  GHC.Tc.Types.Constraint, and therefore now prioritise non-rewritten equalities.

Quite a few error messages change, I think always for the better.

Compiler runtime stays about the same, with one outlier: a 17% improvement in T17836

Metric Decrease:
    T17836
    T18223

- - - - -
5cad28e7 by Bartłomiej Cieślar at 2023-05-12T23:51:06-04:00
Cleanup of dynflags override in export renaming
The deprecation warnings are normally emitted whenever the name's GRE is being looked up, which calls the GHC.Rename.Env.addUsedGRE function. We do not want those warnings to be emitted when renaming export lists, so they are artificially turned off by removing all warning categories from DynFlags at the beginning of GHC.Tc.Gen.Export.rnExports. This commit removes that dependency by unifying the function used for GRE lookup in lookup_ie to lookupGreAvailRn and disabling the call to addUsedGRE in said function (the warnings are also disabled in a call to lookupSubBndrOcc_helper in lookupChildrenExport), as per #17957. This commit also changes the setting for whether to warn about deprecated names in addUsedGREs to be an explicit enum instead of a boolean.

- - - - -
d85ed900 by Alexis King at 2023-05-13T08:45:18-04:00
Use a uniform return convention in bytecode for unary results

fixes #22958

- - - - -
8a0d45f7 by Bodigrim at 2023-05-13T08:45:58-04:00
Add more instances for Compose: Enum, Bounded, Num, Real, Integral

See https://github.com/haskell/core-libraries-committee/issues/160 for discussion

- - - - -
902f0730 by Simon Peyton Jones at 2023-05-13T14:58:34-04:00
Make GHC.Types.Id.Make.shouldUnpackTy a bit more clever

As #23307, GHC.Types.Id.Make.shouldUnpackTy was leaving money on the
table, failing to unpack arguments that are perfectly unpackable.

The fix is pretty easy; see Note [Recursive unboxing]

- - - - -
a5451438 by sheaf at 2023-05-13T14:59:13-04:00
Fix bad multiplicity role in tyConAppFunCo_maybe

The function tyConAppFunCo_maybe produces a multiplicity coercion
for the multiplicity argument of the function arrow, except that
it could be at the wrong role if asked to produce a representational
coercion. We fix this by using the 'funRole' function, which computes
the right roles for arguments to the function arrow TyCon.

Fixes #23386

- - - - -
5b9e9300 by sheaf at 2023-05-15T11:26:59-04:00
Turn "ambiguous import" error into a panic

This error should never occur, as a lookup of a type or data constructor
should never be ambiguous. This is because a single module cannot export
multiple Names with the same OccName, as per item (1) of
Note [Exporting duplicate declarations] in GHC.Tc.Gen.Export.

This code path was intended to handle duplicate record fields, but the
rest of the code had since been refactored to handle those in a
different way.

We also remove the AmbiguousImport constructor of IELookupError, as
it is no longer used.

Fixes #23302

- - - - -
e305e60c by M Farkas-Dyck at 2023-05-15T11:27:41-04:00
Unbreak some tests with latest GNU grep, which now warns about stray '\'.

Confusingly, the testsuite mangled the error to say "stray /".

We also migrate some tests from grep to grep -E, as it seems the author actually wanted an "POSIX extended" (a.k.a. sane) regex.

Background: POSIX specifies 2 "regex" syntaxen: "basic" and "extended". Of these, only "extended" syntax is actually a regular expression. Furthermore, "basic" syntax is inconsistent in its use of the '\' character — sometimes it escapes a regex metacharacter, but sometimes it unescapes it, i.e. it makes an otherwise normal character become a metacharacter. This baffles me and it seems also the authors of these tests. Also, the regex(7) man page (at least on Linux) says "basic" syntax is obsolete. Nearly all modern tools and libraries are consistent in this use of the '\' character (of which many use "extended" syntax by default).

- - - - -
5ae81842 by sheaf at 2023-05-15T14:49:17-04:00
Improve "ambiguous occurrence" error messages

This error was sometimes a bit confusing, especially when data families
were involved. This commit improves the general presentation of the
"ambiguous occurrence" error, and adds a bit of extra context in the
case of data families.

Fixes #23301

- - - - -
2f571afe by Sylvain Henry at 2023-05-15T14:50:07-04:00
Fix GHCJS OS platform (fix #23346)

- - - - -
86aae570 by Oleg Grenrus at 2023-05-15T14:50:43-04:00
Split DynFlags structure into own module

This will allow to make command line parsing to depend on
diagnostic system (which depends on dynflags)

- - - - -
fbe3fe00 by Josh Meredith at 2023-05-15T18:01:43-04:00
Replace the implementation of CodeBuffers with unboxed types

- - - - -
21f3aae7 by Josh Meredith at 2023-05-15T18:01:43-04:00
Use unboxed codebuffers in base

Metric Decrease:
    encodingAllocations

- - - - -
18ea2295 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Weak pointer cleanups

Various stylistic cleanups. No functional changes.

- - - - -
c343112f by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Don't force debug output to stderr

Previously `+RTS -Dw -l` would emit debug output to the eventlog while
`+RTS -l -Dw` would emit it to stderr. This was because the parser for
`-D` would unconditionally override the debug output target. Now we
instead only do so if no it is currently `TRACE_NONE`.

- - - - -
a5f5f067 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Forcibly flush eventlog on barf

Previously we would attempt to flush via `endEventLogging` which can
easily deadlock, e.g., if `barf` fails during GC.

Using `flushEventLog` directly may result in slightly less consistent
eventlog output (since we don't take all capabilities before flushing)
but avoids deadlocking.

- - - - -
73b1e87c by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Assert that pointers aren't cleared by -DZ

This turns many segmentation faults into much easier-to-debug assertion
failures by ensuring that LOOKS_LIKE_*_PTR checks recognize bit-patterns
produced by `+RTS -DZ` clearing as invalid pointers.

This is a bit ad-hoc but this is the debug runtime.

- - - - -
37fb61d8 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Introduce printGlobalThreads

- - - - -
451d65a6 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Don't sanity-check StgTSO.global_link

See Note [Avoid dangling global_link pointers].

Fixes #19146.

- - - - -
d69cbd78 by sheaf at 2023-05-15T18:03:00-04:00
Split up tyThingToIfaceDecl from GHC.Iface.Make

This commit moves tyThingToIfaceDecl and coAxiomToIfaceDecl
from GHC.Iface.Make into GHC.Iface.Decl.
This avoids GHC.Types.TyThing.Ppr, which needs tyThingToIfaceDecl,
transitively depending on e.g. GHC.Iface.Load and GHC.Tc.Utils.Monad.

- - - - -
4d29ecdf by sheaf at 2023-05-15T18:03:00-04:00
Migrate errors to diagnostics in GHC.Tc.Module

This commit migrates the errors in GHC.Tc.Module to use the new
diagnostic infrastructure.

It required a significant overhaul of the compatibility checks between
an hs-boot or signature module and its implementation; we now use
a Writer monad to accumulate errors; see the BootMismatch datatype
in GHC.Tc.Errors.Types, with its panoply of subtypes.
For the sake of readability, several local functions inside the
'checkBootTyCon' function were split off into top-level functions.

We split off GHC.Types.HscSource into a "boot or sig" vs "normal hs file"
datatype, as this mirrors the logic in several other places where we
want to treat hs-boot and hsig files in a similar fashion.

This commit also refactors the Backpack checks for type synonyms
implementing abstract data, to correctly reject implementations that
contain qualified or quantified types (this fixes #23342 and #23344).

- - - - -
d986c98e by Rodrigo Mesquita at 2023-05-16T00:14:04-04:00
configure: Drop unused AC_PROG_CPP

In configure, we were calling `AC_PROG_CPP` but never making use of the
$CPP variable it sets or reads.

The issue is $CPP will show up in the --help output of configure,
falsely advertising a configuration option that does nothing.

The reason we don't use the $CPP variable is because HS_CPP_CMD is
expected to be a single command (without flags), but AC_PROG_CPP, when
CPP is unset, will set said variable to something like `/usr/bin/gcc -E`.
Instead, we configure HS_CPP_CMD through $CC.

- - - - -
a8f0435f by Cheng Shao at 2023-05-16T00:14:42-04:00
rts: fix --disable-large-address-space

This patch moves
ACQUIRE_ALLOC_BLOCK_SPIN_LOCK/RELEASE_ALLOC_BLOCK_SPIN_LOCK from
Storage.h to HeapAlloc.h. When --disable-large-address-space is passed
to configure, the code in HeapAlloc.h makes use of these two macros.
Fixes #23385.

- - - - -
bdb93cd2 by Oleg Grenrus at 2023-05-16T07:59:21+03:00
Add -Wmissing-role-annotations

Implements #22702

- - - - -
41ecfc34 by Ben Gamari at 2023-05-16T07:28:15-04:00
base: Export {get,set}ExceptionFinalizer from System.Mem.Weak

As proposed in CLC Proposal #126 [1].

[1]: https://github.com/haskell/core-libraries-committee/issues/126

- - - - -
67330303 by Ben Gamari at 2023-05-16T07:28:16-04:00
base: Introduce printToHandleFinalizerExceptionHandler

- - - - -
5e3f9bb5 by Josh Meredith at 2023-05-16T13:59:22-04:00
JS: Implement h$clock_gettime in the JavaScript RTS (#23360)

- - - - -
90e69d5d by Zubin Duggal at 2023-05-16T14:00:00-04:00
compiler: Use compact representation for SourceText

SourceText is serialized along with INLINE pragmas into interface files. Many of
these SourceTexts are identical, for example "{-# INLINE#". When deserialized,
each such SourceText was previously expanded out into a [Char], which is highly
wasteful of memory, and each such instance of the text would allocate an
independent list with its contents as deserializing breaks any sharing that might
have existed.

Instead, we use a `FastString` to represent these, so that each instance unique
text will be interned and stored in a memory efficient manner.

- - - - -
b70bc690 by Zubin Duggal at 2023-05-16T14:00:00-04:00
compiler: Use compact representation/FastStrings for `SourceNote`s

`SourceNote`s should not be stored as [Char] as this is highly wasteful
and in certain scenarios can be highly duplicated.

Metric Decrease:
  hard_hole_fits

- - - - -
6231a126 by Zubin Duggal at 2023-05-16T14:00:00-04:00
compiler: Use compact representation for UsageFile (#22744)

Use FastString to store filepaths in interface files, as this data is
highly redundant so we want to share all instances of filepaths in the
compiler session.

- - - - -
47a58150 by Zubin Duggal at 2023-05-16T14:00:00-04:00
testsuite: add test for T22744

This test checks for #22744 by compiling 100 modules which each have
a dependency on 1000 distinct external files.

Previously, when loading these interfaces from disk, each individual instance
of a filepath in the interface will would be allocated as an individual object
on the heap, meaning we have heap objects for 100*1000 files, when there are
only 1000 distinct files we care about.

This test checks this by first compiling the module normally, then measuring
the peak memory usage in a no-op recompile, as the recompilation checking will
force the allocation of all these filepaths.

- - - - -
0451bdc9 by Ben Gamari at 2023-05-16T21:31:40-04:00
users guide: Add glossary

Currently this merely explains the meaning of "technology preview" in
the context of released features.

- - - - -
0ba52e4e by Ben Gamari at 2023-05-16T21:31:40-04:00
Update glossary.rst
- - - - -
3d23060c by Ben Gamari at 2023-05-16T21:31:40-04:00
Use glossary directive
- - - - -
2972fd66 by Sylvain Henry at 2023-05-16T21:32:20-04:00
JS: fix getpid (fix #23399)

- - - - -
5fe1d3e6 by Matthew Pickering at 2023-05-17T21:42:00-04:00
Use setSrcSpan rather than setLclEnv in solveForAll

In subsequent MRs (#23409) we want to remove the TcLclEnv argument from
a CtLoc. This MR prepares us for that by removing the one place where
the entire TcLclEnv is used, by using it more precisely to just set the
contexts source location.

Fixes #23390

- - - - -
385edb65 by Torsten Schmits at 2023-05-17T21:42:40-04:00
Update the users guide paragraph on -O in GHCi

In relation to #23056

- - - - -
87626ef0 by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Add test for #13660

- - - - -
9eef53b1 by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Move implementation of GHC.Foreign to GHC.Internal

- - - - -
174ea2fa by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Introduce {new,with}CStringLen0

These are useful helpers for implementing the internal-NUL code unit
check needed to fix #13660.

- - - - -
a46ced16 by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Clean up documentation

- - - - -
b98d99cc by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Ensure that FilePaths don't contain NULs

POSIX filepaths may not contain the NUL octet but previously we did not
reject such paths. This could be exploited by untrusted input to cause
discrepancies between various `FilePath` queries and the opened
filename. For instance, `readFile "hello.so\x00.txt"` would open the
file `"hello.so"` yet `takeFileExtension` would return `".txt"`.

The same argument applies to Windows FilePaths

Fixes #13660.

- - - - -
7ae45459 by Simon Peyton Jones at 2023-05-18T15:19:29-04:00
Allow the demand analyser to unpack tuple and equality dictionaries

Addresses #23398. The demand analyser usually does not unpack class
dictionaries: see Note [Do not unbox class dictionaries] in
GHC.Core.Opt.DmdAnal.

This patch makes an exception for tuple dictionaries and equality
dictionaries, for reasons explained in wrinkles (DNB1) and (DNB2) of
the above Note.

Compile times fall by 0.1% for some reason (max 0.7% on T18698b).

- - - - -
b53a9086 by Greg Steuck at 2023-05-18T15:20:08-04:00
Use a simpler and more portable construct in ld.ldd check

printf '%q\n' is a bash extension which led to incorrectly
failing an ld.lld test on OpenBSD which uses pdksh as /bin/sh

- - - - -
dd5710af by Torsten Schmits at 2023-05-18T15:20:50-04:00
Update the warning about interpreter optimizations

to reflect that they're not incompatible anymore, but guarded by a flag

- - - - -
4f6dd999 by Matthew Pickering at 2023-05-18T15:21:26-04:00
Remove stray dump flags in GHC.Rename.Names

- - - - -
4bca0486 by Oleg Grenrus at 2023-05-19T11:51:33+03:00
Make Warn = Located DriverMessage

This change makes command line argument parsing use diagnostic
framework for producing warnings.

- - - - -
525ed554 by Simon Peyton Jones at 2023-05-19T10:09:15-04:00
Type inference for data family newtype instances

This patch addresses #23408, a tricky case with data family
newtype instances.  Consider

  type family TF a where TF Char = Bool
  data family DF a
  newtype instance DF Bool = MkDF Int

and [W] Int ~R# DF (TF a), with a Given (a ~# Char).   We must fully
rewrite the Wanted so the tpye family can fire; that wasn't happening.

- - - - -
c6fb6690 by Peter Trommler at 2023-05-20T03:16:08-04:00
testsuite: fix predicate on rdynamic test

Test rdynamic requires dynamic linking support, which is
orthogonal to RTS linker support. Change the predicate accordingly.

Fixes #23316

- - - - -
735d504e by Matthew Pickering at 2023-05-20T03:16:44-04:00
docs: Use ghc-ticket directive where appropiate in users guide

Using the directive automatically formats and links the ticket
appropiately.

- - - - -
b56d7379 by Sylvain Henry at 2023-05-22T14:21:22-04:00
NCG: remove useless .align directive (#20758)

- - - - -
15b93d2f by Simon Peyton Jones at 2023-05-22T14:21:58-04:00
Add test for #23156

This program had exponential typechecking time in GHC 9.4 and 9.6

- - - - -
2b53f206 by Greg Steuck at 2023-05-22T20:23:11-04:00
Revert "Change hostSupportsRPaths to report False on OpenBSD"

This reverts commit 1e0d8fdb55a38ece34fa6cf214e1d2d46f5f5bf2.

- - - - -
882e43b7 by Greg Steuck at 2023-05-22T20:23:11-04:00
Disable T17414 on OpenBSD

Like on other systems it's not guaranteed that there's sufficient
space in /tmp to write 2G out.

- - - - -
9d531f9a by Greg Steuck at 2023-05-22T20:23:11-04:00
Bring back getExecutablePath to getBaseDir on OpenBSD

Fix #18173

- - - - -
9db0eadd by Krzysztof Gogolewski at 2023-05-22T20:23:47-04:00
Add an error origin for impedance matching (#23427)

- - - - -
33cf4659 by Ben Gamari at 2023-05-23T03:46:20-04:00
testsuite: Add tests for #23146

Both lifted and unlifted variants.

- - - - -
76727617 by Ben Gamari at 2023-05-23T03:46:21-04:00
codeGen: Fix some Haddocks

- - - - -
33a8c348 by Ben Gamari at 2023-05-23T03:46:21-04:00
codeGen: Give proper LFInfo to datacon wrappers

As noted in `Note [Conveying CAF-info and LFInfo between modules]`,
when importing a binding from another module we must ensure that it gets
the appropriate `LambdaFormInfo` if it is in WHNF to ensure that
references to it are tagged correctly.

However, the implementation responsible for doing this,
`GHC.StgToCmm.Closure.mkLFImported`, only dealt with datacon workers and
not wrappers. This lead to the crash of this program in #23146:

    module B where

    type NP :: [UnliftedType] -> UnliftedType
    data NP xs where
      UNil :: NP '[]

    module A where
    import B

    fieldsSam :: NP xs -> NP xs -> Bool
    fieldsSam UNil UNil = True

    x = fieldsSam UNil UNil

Due to its GADT nature, `UNil` produces a trivial wrapper

    $WUNil :: NP '[]
    $WUNil = UNil @'[] @~(<co:1>)

which is referenced in the RHS of `A.x`. Due to the above-mentioned bug
in `mkLFImported`, the references to `$WUNil` passed to `fieldsSam` were
not tagged. This is problematic as `fieldsSam` expected its arguments to
be tagged as they are unlifted.

The fix is straightforward: extend the logic in `mkLFImported` to cover
(nullary) datacon wrappers as well as workers. This is safe because we
know that the wrapper of a nullary datacon will be in WHNF, even if it
includes equalities evidence (since such equalities are not runtime
relevant).

Thanks to @MangoIV for the great ticket and @alt-romes for his
minimization and help debugging.

Fixes #23146.

- - - - -
2fc18e9e by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00
codeGen: Fix LFInfo of imported datacon wrappers

As noted in #23231 and in the previous commit, we were failing to give a
an LFInfo of LFCon to a nullary datacon wrapper from another module,
failing to properly tag pointers which ultimately led to the
segmentation fault in #23146.

On top of the previous commit which now considers wrappers where we
previously only considered workers, we change the order of the guards so
that we check for the arity of the binding before we check whether it is
a constructor. This allows us to
(1) Correctly assign `LFReEntrant` to imported wrappers whose worker was
nullary, which we previously would fail to do
(2) Remove the `isNullaryRepDataCon` predicate:
    (a) which was previously wrong, since it considered wrappers whose
    workers had zero-width arguments to be non-nullary and would fail to
    give `LFCon` to them
    (b) is now unnecessary, since arity == 0 guarantees
        - that the worker takes no arguments at all
        - and the wrapper takes no arguments and its RHS must be an
          application of the worker to zero-width-args only.
        - we lint these two items with an assertion that the datacon
          `hasNoNonZeroWidthArgs`

We also update `isTagged` to use the new logic in determining the
LFInfos of imported Ids.

The creation of LFInfos for imported Ids and this detail are explained
in Note [The LFInfo of Imported Ids].

Note that before the patch to those issues we would already consider these
nullary wrappers to have `LFCon` lambda form info; but failed to re-construct
that information in `mkLFImported`

Closes #23231, #23146

(I've additionally batched some fixes to documentation I found while
investigating this issue)

- - - - -
0598f7f0 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00
Make LFInfos for DataCons on construction

As a result of the discussion in !10165, we decided to amend the
previous commit which fixed the logic of `mkLFImported` with regard to
datacon workers and wrappers.

Instead of having the logic for the LFInfo of datacons be in
`mkLFImported`, we now construct an LFInfo for all data constructors on
GHC.Types.Id.Make and store it in the `lfInfo` field.

See the new Note [LFInfo of DataCon workers and wrappers] and
ammendments to Note [The LFInfo of Imported Ids]

- - - - -
12294b22 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00
Update Note [Core letrec invariant]

Authored by @simonpj

- - - - -
e93ab972 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00
Rename mkLFImported to importedIdLFInfo

The `mkLFImported` sounded too much like a constructor of sorts, when
really it got the `LFInfo` of an imported Id from its `lf_info` field
when this existed, and otherwise returned a conservative estimate of
that imported Id's LFInfo. This in contrast to functions such as
`mkLFReEntrant` which really are about constructing an `LFInfo`.

- - - - -
e54d9259 by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00
Enforce invariant on typePrimRepArgs in the types

As part of the documentation effort in !10165 I came across this
invariant on 'typePrimRepArgs' which is easily expressed at the
type-level through a NonEmpty list.

It allowed us to remove one panic.

- - - - -
b8fe6a0c by Rodrigo Mesquita at 2023-05-23T03:46:21-04:00
Merge outdated Note [Data con representation] into Note [Data constructor representation]

Introduce new Note [Constructor applications in STG] to better support
the merge, and reference it from the relevant bits in the STG syntax.

- - - - -
e1590ddc by Simon Peyton Jones at 2023-05-23T03:46:57-04:00
Add the SolverStage monad

This refactoring makes a substantial improvement in the
structure of the type-checker's constraint solver: #23070.

Specifically:

* Introduced the SolverStage monad.   See GHC.Tc.Solver.Monad
  Note [The SolverStage monad]

* Make each solver pipeline (equalities, dictionaries, irreds etc)
  deal with updating the inert set, as a separate SolverStage.  There
  is sometimes special stuff to do, and it means that each full
  pipeline can have type SolverStage Void, indicating that they never
  return anything.

* Made GHC.Tc.Solver.Equality.zonkEqTypes into a SolverStage.  Much nicer.

* Combined the remnants of GHC.Tc.Solver.Canonical and
  GHC.Tc.Solver.Interact into a new module GHC.Tc.Solver.Solve.
  (Interact and Canonical are removed.)

* Gave the same treatment to dictionary and irred constraints
  as I have already done for equality constraints:
    * New types (akin to EqCt): IrredCt and DictCt
    * Ct is now just a simple sum type
          data Ct
            = CDictCan      DictCt
            | CIrredCan     IrredCt
            | CEqCan        EqCt
            | CQuantCan     QCInst
            | CNonCanonical CtEvidence
    * inert_dicts can now have the better type DictMap DictCt, instead of
      DictMap Ct; and similarly inert_irreds.

* Significantly simplified the treatment of implicit parameters.
  Previously we had a number of special cases
    * interactGivenIP, an entire function
    * special case in maybeKickOut
    * special case in findDict, when looking up dictionaries
  But actually it's simpler than that. When adding a new Given, implicit
  parameter constraint to the InertSet, we just need to kick out any
  existing inert constraints that mention that implicit parameter.

  The main work is done in GHC.Tc.Solver.InertSet.delIPDict, along with
  its auxiliary GHC.Core.Predicate.mentionsIP.

  See Note [Shadowing of implicit parameters] in GHC.Tc.Solver.Dict.

* Add a new fast-path in GHC.Tc.Errors.Hole.tcCheckHoleFit.
  See Note [Fast path for tcCheckHoleFit].  This is a big win in some cases:
  test hard_hole_fits gets nearly 40% faster (at compile time).

* Add a new fast-path for solving /boxed/ equality constraints
  (t1 ~ t2).  See Note [Solving equality classes] in GHC.Tc.Solver.Dict.
  This makes a big difference too: test T17836 compiles 40% faster.

* Implement the PermissivePlan of #23413, which concerns what happens with
  insoluble Givens.   Our previous treatment was wildly inconsistent as that
  ticket pointed out.

  A part of this, I simplified GHC.Tc.Validity.checkAmbiguity: now we simply
  don't run the ambiguity check at all if -XAllowAmbiguousTypes is on.

Smaller points:

* In `GHC.Tc.Errors.misMatchOrCND` instead of having a special case for
  insoluble /occurs/ checks, broaden in to all insouluble constraints.
  Just generally better. See Note [Insoluble mis-match] in that module.

As noted above, compile time perf gets better.  Here are the changes
over 0.5% on Fedora.  (The figures are slightly larger on Windows for
some reason.)

Metrics: compile_time/bytes allocated
-------------------------------------
                LargeRecord(normal)   -0.9%
MultiLayerModulesTH_OneShot(normal)   +0.5%
                     T11822(normal)   -0.6%
                     T12227(normal)   -1.8% GOOD
                     T12545(normal)   -0.5%
                     T13035(normal)   -0.6%
                     T15703(normal)   -1.4% GOOD
                     T16875(normal)   -0.5%
                     T17836(normal)  -40.7% GOOD
                    T17836b(normal)  -12.3% GOOD
                    T17977b(normal)   -0.5%
                      T5837(normal)   -1.1%
                      T8095(normal)   -2.7% GOOD
                      T9020(optasm)   -1.1%
             hard_hole_fits(normal)  -37.0% GOOD

                          geo. mean   -1.3%
                          minimum    -40.7%
                          maximum     +0.5%

Metric Decrease:
    T12227
    T15703
    T17836
    T17836b
    T8095
    hard_hole_fits
    LargeRecord
    T9198
    T13035

- - - - -
6abf3648 by Simon Peyton Jones at 2023-05-23T03:46:57-04:00
Avoid an assertion failure in abstractFloats

The function GHC.Core.Opt.Simplify.Utils.abstractFloats
was carelessly calling lookupIdSubst_maybe on a CoVar;
but a precondition of the latter is being given an Id.

In fact it's harmless to call it on a CoVar, but still, the
precondition on lookupIdSubst_maybe makes sense, so I added
a test for CoVars.

This avoids a crash in a DEBUG compiler, but otherwise has
no effect. Fixes #23426.

- - - - -
838aaf4b by hainq at 2023-05-24T12:41:19-04:00
Migrate errors in GHC.Tc.Validity

This patch migrates the error messages in GHC.Tc.Validity to use
the new diagnostic infrastructure.

It adds the constructors:

  - TcRnSimplifiableConstraint
  - TcRnArityMismatch
  - TcRnIllegalInstanceDecl, with sub-datatypes for HasField errors
    and fundep coverage condition errors.

- - - - -
8539764b by Krzysztof Gogolewski at 2023-05-24T12:41:56-04:00
linear lint: Add missing processing of DEFAULT

In this correct program

f :: a %1 -> a
f x = case x of x { _DEFAULT -> x }

after checking the alternative we weren't popping the case binder 'x'
from the usage environment, which meant that the lambda-bound 'x'
was counted twice: in the scrutinee and (incorrectly) in the alternative.
In fact, we weren't checking the usage of 'x' at all.
Now the code for handling _DEFAULT is similar to the one handling
data constructors.

Fixes #23025.

- - - - -
ae683454 by Matthew Pickering at 2023-05-24T12:42:32-04:00
Remove outdated "Don't check hs-boot type family instances too early" note

This note was introduced in 25b70a29f623 which delayed performing some
consistency checks for type families. However, the change was reverted
later in 6998772043a7f0b0360116eb5ffcbaa5630b21fb but the note was not
removed.

I found it confusing when reading to code to try and work out what
special behaviour there was for hs-boot files (when in-fact there isn't
any).

- - - - -
44af57de by Matthew Pickering at 2023-05-24T12:43:08-04:00
rts: Define ticky macro stubs

These macros have long been undefined which has meant we were missing
reporting these allocations in ticky profiles.

The most critical missing definition was TICK_ALLOC_HEAP_NOCTR which was
missing all the RTS calls to allocate, this leads to a the overall
ALLOC_RTS_tot number to be severaly underreported.

Of particular interest though is the ALLOC_STACK_ctr and ALLOC_STACK_tot
counters which are useful to tracking stack allocations.

Fixes #23421

- - - - -
b2dabe3a by Matthew Pickering at 2023-05-24T12:43:08-04:00
rts: ticky: Rename TICK_ALLOC_HEAP_NOCTR to TICK_ALLOC_RTS

This macro increments the ALLOC_HEAP_tot and ALLOC_HEAP_ctr so it makes
more sense to name it after that rather than the suffix NOCTR, whose
meaning has been lost to the mists of time.

- - - - -
eac4420a by Ben Gamari at 2023-05-24T12:43:45-04:00
users guide: A few small mark-up fixes

- - - - -
a320ca76 by Rodrigo Mesquita at 2023-05-24T12:44:20-04:00
configure: Fix support check for response files.

In failing to escape the '-o' in '-o\nconftest\nconftest.o\n' argument
to printf, the writing of the arguments response file always failed.

The fix is to pass the arguments after `--` so that they are treated
positional arguments rather than flags to printf.

Closes #23435

- - - - -
f21ce0e4 by mangoiv at 2023-05-24T12:45:00-04:00
[feat] add .direnv to the .gitignore file

- - - - -
36d5944d by Bodigrim at 2023-05-24T20:58:34-04:00
Add Data.List.unsnoc

See https://github.com/haskell/core-libraries-committee/issues/165 for discussion

- - - - -
c0f2f9e3 by Bartłomiej Cieślar at 2023-05-24T20:59:14-04:00
Fix crash in backpack signature merging with -ddump-rn-trace

In some cases, backpack signature merging could crash in addUsedGRE
when -ddump-rn-trace was enabled, as pretty-printing the GREInfo would cause
unavailable interfaces to be loaded.
This commit fixes that issue by not pretty-printing the GREInfo in addUsedGRE
when -ddump-rn-trace is enabled.

Fixes #23424

Signed-off-by: Bartłomiej Cieślar <bcieslar2001 at gmail.com>

- - - - -
5a07d94a by Krzysztof Gogolewski at 2023-05-25T03:30:20-04:00
Add a regression test for #13981

The panic was fixed by 6998772043a7f0b. Fixes #13981.

- - - - -
182df90e by Krzysztof Gogolewski at 2023-05-25T03:30:57-04:00
Add a test for #23355

It was fixed by !10061, so I'm adding it in the same group.

- - - - -
1b31b039 by uhbif19 at 2023-05-25T12:08:28+02:00
Migrate errors in GHC.Rename.Splice GHC.Rename.Pat

This commit migrates the errors in GHC.Rename.Splice and GHC.Rename.Pat
to use the new diagnostic infrastructure.

- - - - -
56abe494 by sheaf at 2023-05-25T12:09:55+02:00
Common up Template Haskell errors in TcRnMessage

This commit commons up the various Template Haskell errors into a
single constructor, TcRnTHError, of TcRnMessage.

- - - - -
a487ba9e by Krzysztof Gogolewski at 2023-05-25T14:35:56-04:00
Enable ghci tests for unboxed tuples

The tests were originally skipped because ghci used not to support
unboxed tuples/sums.

- - - - -
dc3422d4 by Matthew Pickering at 2023-05-25T18:57:19-04:00
rts: Build ticky GHC with single-threaded RTS

The threaded RTS allows you to use ticky profiling but only for the
counters in the generated code. The counters used in the C portion of
the RTS are disabled. Updating the counters is also racy using the
threaded RTS which can lead to misleading or incorrect ticky results.

Therefore we change the hadrian flavour to build using the
single-threaded RTS (mainly in order to get accurate C code counter
increments)

Fixes #23430

- - - - -
fbc8e04e by sheaf at 2023-05-25T18:58:00-04:00
Propagate long-distance info in generated code

When desugaring generated pattern matches, we skip pattern match checks.
However, this ended up also discarding long-distance information, which
might be needed for user-written sub-expressions.

Example:

```haskell
okay (GADT di) cd =
  let sr_field :: ()
      sr_field = case getFooBar di of { Foo -> () }
  in case cd of { SomeRec _ -> SomeRec sr_field }
```

With sr_field a generated FunBind, we still want to propagate the outer
long-distance information from the GADT pattern match into the checks
for the user-written RHS of sr_field.

Fixes #23445

- - - - -
f8ced241 by Matthew Pickering at 2023-05-26T15:26:21-04:00
Introduce GHCiMessage to wrap GhcMessage

By introducing a wrapped message type we can control how certain
messages are printed in GHCi (to add extra information for example)

- - - - -
58e554c1 by Matthew Pickering at 2023-05-26T15:26:22-04:00
Generalise UnknownDiagnostic to allow embedded diagnostics to access
parent diagnostic options.

* Split default diagnostic options from Diagnostic class into
  HasDefaultDiagnosticOpts class.
* Generalise UnknownDiagnostic to allow embedded diagnostics to access
  options.

The principle idea here is that when wrapping an error message (such as
GHCMessage to make GHCiMessage) then we need to also be able to lift the
configuration when overriding how messages are printed (see load' for an
example).

- - - - -
b112546a by Matthew Pickering at 2023-05-26T15:26:22-04:00
Allow API users to wrap error messages created during 'load'

This allows API users to configure how messages are rendered when they
are emitted from the load function. For an example see how
'loadWithCache' is used in GHCi.

- - - - -
2e4cf0ee by Matthew Pickering at 2023-05-26T15:26:22-04:00
Abstract cantFindError and turn Opt_BuildingCabal into a print-time option

* cantFindError is abstracted so that the parts which mention specific
  things about ghc/ghci are parameters. The intention being that
  GHC/GHCi can specify the right values to put here but otherwise
  display the same error message.
* The BuildingCabalPackage argument from GenericMissing is removed and
  turned into a print-time option. The reason for the error is not
  dependent on whether `-fbuilding-cabal-package` is passed, so we don't
  want to store that in the error message.

- - - - -
34b44f7d by Matthew Pickering at 2023-05-26T15:26:22-04:00
error messages: Don't display ghci specific hints for missing packages

Tickets like #22884 suggest that it is confusing that GHC used on the
command line can suggest options which only work in GHCi.

This ticket uses the error message infrastructure to override certain
error messages which displayed GHCi specific information so that this
information is only showed when using GHCi.

The main annoyance is that we mostly want to display errors in the same
way as before, but with some additional information. This means that the
error rendering code has to be exported from the Iface/Errors/Ppr.hs
module.

I am unsure about whether the approach taken here is the best or most
maintainable solution.

Fixes #22884

- - - - -
05a1b626 by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Don't override existing metadata if version already exists.

If a nightly pipeline runs twice for some reason for the same version
then we really don't want to override an existing entry with new
bindists. This could cause ABI compatability issues for users or break
ghcup's caching logic.

- - - - -
fcbcb3cc by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Use proper API url for bindist download

Previously we were using links from the web interface, but it's more
robust and future-proof to use the documented links to the artifacts.

https://docs.gitlab.com/ee/api/job_artifacts.html

- - - - -
5b59c8fe by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Set Nightly and LatestNightly tags

The latest nightly release needs the LatestNightly tag, and all other
nightly releases need the Nightly tag. Therefore when the metadata is
updated we need to replace all LatestNightly with Nightly.`

- - - - -
914e1468 by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Download nightly metadata for correct date

The metadata now lives in https://gitlab.haskell.org/ghc/ghcup-metadata
with one metadata file per year. When we update the metadata we download
and update the right file for the current year.

- - - - -
16cf7d2e by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Download metadata and update for correct year

something about pipeline date

- - - - -
14792c4b by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Don't skip CI

On a push we now have a CI job which updates gitlab pages with the
metadata files.

- - - - -
1121bdd8 by Matthew Pickering at 2023-05-26T15:26:59-04:00
ghcup-metadata: Add --date flag to specify the release date

The ghcup-metadata now has a viReleaseDay field which needs to be
populated with the day of the release.

- - - - -
bc478bee by Matthew Pickering at 2023-05-26T15:26:59-04:00
ghcup-metadata: Add dlOutput field

ghcup now requires us to add this field which specifies where it should
download the bindist to. See
https://gitlab.haskell.org/ghc/ghcup-metadata/-/issues/1 for some more
discussion.

- - - - -
2bdbd9da by Josh Meredith at 2023-05-26T15:27:35-04:00
JS: Convert rendering to use HLine instead of SDoc (#22455)

- - - - -
abd9e37c by Norman Ramsey at 2023-05-26T15:28:12-04:00
testsuite: add WasmControlFlow test

This patch adds the WasmControlFlow test to test the wasm backend's
relooper component.

- - - - -
07f858eb by Sylvain Henry at 2023-05-26T15:28:53-04:00
Factorize getLinkDeps

Prepare reuse of getLinkDeps for TH implementation in the JS backend
(cf #22261 and review of !9779).

- - - - -
fad9d092 by Oleg Grenrus at 2023-05-27T13:38:08-04:00
Change GHC.Driver.Session import to .DynFlags

Also move targetPlatform selector

Plenty of GHC needs just DynFlags.
Even more can be made to use .DynFlags if more selectors is migrated.
This is a low hanging fruit.

- - - - -
69fdbece by Alan Zimmerman at 2023-05-27T13:38:45-04:00
EPA: Better fix for #22919

The original fix for #22919 simply removed the ability to match up
prior comments with the first declaration in the file.

Restore it, but add a check that the comment is on a single line, by
ensuring that it comes immediately prior to the next thing (comment or
start of declaration), and that the token preceding it is not on the
same line.

closes #22919

- - - - -
0350b186 by Josh Meredith at 2023-05-29T12:46:27+00:00
Remove JavaScriptFFI from --supported-extensions for non-JS targets (#11214)

- - - - -
b4816919 by Matthew Pickering at 2023-05-30T17:07:43-04:00
testsuite: Pass -kb16k -kc128k for performance tests

Setting a larger stack chunk size gives a greater protection
from stack thrashing (where the repeated overflow/underflow allocates a lot of
stack chunks which sigificantly impact allocations). This
stabilises some tests against differences cause by more things being
pushed onto the stack.

The performance tests are generally testing work done by the compiler,
using allocation as a proxy, so removing/stabilising the allocations due
to the stack gives us more stable tests which are also more sensitive
to actual changes in compiler performance.

The tests which increase are ones where we compile a lot of modules, and
for each module we spawn a thread to compile the module in. Therefore
increasing these numbers has a multiplying effect on these tests because
there are many more stacks which we can increase in size.

The most significant improvements though are cases such as T8095 which
reduce significantly in allocations (30%). This isn't a performance
improvement really but just helps stabilise the test against this
threshold set by the defaults.

Fixes #23439

-------------------------
Metric Decrease:
    InstanceMatching
    T14683
    T8095
    T9872b_defer
    T9872d
    T9961
    hie002
    T19695
    T3064
Metric Increase:
    MultiLayerModules
    T13701
    T14697
-------------------------

- - - - -
6629f1c5 by Ben Gamari at 2023-05-30T17:08:20-04:00
Move via-C flags into GHC

These were previously hardcoded in configure (with no option for
overriding them) and simply passed onto ghc through the settings file.

Since configure already guarantees gcc supports those flags, we simply
move them into GHC.

- - - - -
981e5e11 by Arnaud Spiwack at 2023-05-31T08:34:33-04:00
Allow CPR on unrestricted constructors

Per the new `Note [Linting linearity]`, we want optimisations over
trying to preserve linearity. This will allow CPR to handle `Ur`, in
particular.

- - - - -
bf9344d2 by Arnaud Spiwack at 2023-05-31T08:34:33-04:00
Push coercions across multiplicity boundaries

Per the new `Note [Linting linearity]`, we want optimisations over
trying to preserve linearity. This will avoid preventing inlinings and
reductions and make linear programs more efficient.

- - - - -
d56dd695 by sheaf at 2023-05-31T11:37:12-04:00
Data.Bag: add INLINEABLE to polymorphic functions

This commit allows polymorphic methods in GHC.Data.Bag to be
specialised, avoiding having to pass explicit dictionaries when they
are instantiated with e.g. a known monad.

- - - - -
5366cd35 by sheaf at 2023-05-31T11:37:12-04:00
Split off TcBinderStack into its own module

This commit splits off TcBinderStack into its own module,
to avoid module cycles: we might want to refer to it without also
pulling in the TcM monad.

- - - - -
09d4d307 by sheaf at 2023-05-31T11:37:12-04:00
Split off TcRef into its own module

This helps avoid pull in the full TcM monad when we just want access
to mutable references in the typechecker. This facilitates later patches
which introduce a slimmed down TcM monad for zonking.

- - - - -
88cc19b3 by sheaf at 2023-05-31T11:37:12-04:00
Introduce Codensity monad

The Codensity monad is useful to write state-passing computations in
continuation-passing style, e.g. to implement a State monad as
continuation-passing style over a Reader monad.

- - - - -
f62d8195 by sheaf at 2023-05-31T11:37:12-04:00
Restructure the zonker

This commit splits up the zonker into a few separate components, described
in Note [The structure of the zonker] in `GHC.Tc.Zonk.Type`.

1. `GHC.Tc.Zonk.Monad` introduces a pared-down `TcM` monad, `ZonkM`,
     which has enough information for zonking types.
     This allows us to refactor `ErrCtxt` to use `ZonkM` instead of `TcM`,
     which guarantees we don't throw an error while reporting an error.

2. `GHC.Tc.Zonk.Env` is the new home of `ZonkEnv`, and also defines
    two zonking monad transformers, `ZonkT` and `ZonkBndrT`.
    `ZonkT` is a reader monad transformer over `ZonkEnv`.
    `ZonkBndrT m` is the codensity monad over `ZonkT m`.

     `ZonkBndrT` is used for computations that accumulate binders
     in the `ZonkEnv`.

3. `GHC.Tc.Zonk.TcType` contains the code for zonking types, for use
    in the typechecker. It uses the `ZonkM` monad.

4. `GHC.Tc.Zonk.Type` contains the code for final zonking to `Type`,
    which has been refactored to use `ZonkTcM = ZonkT TcM` and
    `ZonkBndrTcM = ZonkBndrT TcM`.

Allocations slightly decrease on the whole due to using
continuation-passing style instead of manual state passing of ZonkEnv
in the final zonking to Type.

-------------------------
Metric Decrease:
    T4029
    T8095
    T14766
    T15304
    hard_hole_fits
    RecordUpdPerf
Metric Increase:
    T10421
-------------------------

- - - - -
70526f5b by mimi.vx at 2023-05-31T11:37:53-04:00
Update rdt-theme to latest upstream version

Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/23444

- - - - -
f3556d6c by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Restructure IPE buffer layout

Reference ticket #21766

This commit restructures IPE buffer list entries to not contain
references to their corresponding info tables. IPE buffer list nodes now
point to two lists of equal length, one holding the list of info table
pointers and one holding the corresponding entries for each info table.
This will allow the entry data to be compressed without losing the
references to the info tables.

- - - - -
5d1f2411 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Add IPE compression to configure

Reference ticket #21766

Adds an `--enable-ipe-data-compreesion` flag to the configure script
which will check for libzstd and set the appropriate flags to allow for
IPE data compression in the compiler

- - - - -
b7a640ac by Finley McIlwaine at 2023-06-01T04:53:12-04:00
IPE data compression

Reference ticket #21766

When IPE data compression is enabled, compress the emitted IPE buffer
entries and decompress them in the RTS.

- - - - -
5aef5658 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Fix libzstd detection in configure and RTS

Ensure that `HAVE_LIBZSTD` gets defined to either 0 or 1 in all cases
and properly check that before IPE data decompression in the RTS. See
ticket #21766.

- - - - -
69563c97 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Add note describing IPE data compression

See ticket #21766

- - - - -
7872e2b6 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Fix byte order of IPE data, fix IPE tests

Make sure byte order of written IPE buffer entries matches target.

Make sure the IPE-related tests properly access the fields of IPE buffer
entry nodes with the new IPE layout.

This commit also introduces checks to avoid importing modules if IPE
compression is not enabled.

See ticket #21766.

- - - - -
0e85099b by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Fix IPE data decompression buffer allocation

Capacity of buffers allocated for decompressed IPE data was
incorrect due to a misuse of the `ZSTD_findFrameCompressedSize`
function. Fix by always storing decompressed size of IPE data in IPE
buffer list nodes and using `ZSTD_findFrameCompressedSize` to determine
the size of the compressed data.

See ticket #21766

- - - - -
a0048866 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Add optional dependencies to ./configure output

Changes the configure script to indicate whether libnuma, libzstd, or
libdw are being used as dependencies due to their optional features
being enabled.

- - - - -
09d93bd0 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Add IPE-enabled builds to CI

- Adds an IPE job to the CI pipeline which is triggered by the ~IPE label
- Introduces CI logic to enable IPE data compression
- Enables uncompressed IPE data on debug CI job
- Regenerates jobs.yaml

MR https://gitlab.haskell.org/ghc/ci-images/-/merge_requests/112 on the
images repository is meant to ensure that the proper images have
libzstd-dev installed.

- - - - -
3ded9a1c by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Update user's guide and release notes, small fixes

Add mention of IPE data compression to user's guide and the release
notes for 9.8.1. Also note the impact compression has on binary size in
both places.

Change IpeBufferListNode compression check so only the value `1`
indicates compression.

See ticket #21766

- - - - -
41b41577 by Finley McIlwaine at 2023-06-01T04:53:12-04:00
Remove IPE enabled builds from CI

We don't need to explicitly specify the +ipe transformer to test IPE data
since there are tests which manually enable IPE information. This commit does
leave zstd IPE data compression enabled on the debian CI jobs.

- - - - -
982bef3a by Krzysztof Gogolewski at 2023-06-01T04:53:49-04:00
Fix build with 9.2

GHC.Tc.Zonk.Type uses an equality constraint.
ghc.nix currently provides 9.2.

- - - - -
1c96bc3d by Krzysztof Gogolewski at 2023-06-01T10:56:11-04:00
Output Lint errors to stderr instead of stdout

This is a continuation of 7b095b99, which fixed warnings but not errors.

Refs #13342

- - - - -
8e81f140 by sheaf at 2023-06-01T10:56:51-04:00
Refactor lookupExactOrOrig & friends

This refactors the panoply of renamer lookup functions relating to
lookupExactOrOrig to more graciously handle Exact and Orig names.

In particular, we avoid the situation in which we would add Exact/Orig
GREs to the tcg_used_gres field, which could cause a panic in bestImport
like in #23240.

Fixes #23428

- - - - -
5d415bfd by Krzysztof Gogolewski at 2023-06-01T10:57:31-04:00
Use the one-shot trick for UM and RewriteM functors

As described in Note [The one-shot state monad trick],
we shouldn't use derived Functor instances for monads using
one-shot. This was done for most of them, but UM and RewriteM
were missed.

- - - - -
2c38551e by Krzysztof Gogolewski at 2023-06-01T10:58:08-04:00
Fix testsuite skipping Lint

setTestOpts() is used to modify the test options for an entire .T file,
rather than a single test.
If there was a test using collect_compiler_stats, all of the tests
in the same file had lint disabled.

Fixes #21247

- - - - -
00a1e50b by Krzysztof Gogolewski at 2023-06-01T10:58:44-04:00
Add testcases for already fixed #16432

They were fixed by 40c7daed0.

Fixes #16432

- - - - -
f6e060cc by Krzysztof Gogolewski at 2023-06-02T09:07:25-04:00
cleanup: Remove unused field from SelfBoot

It is no longer needed since Note [Extra dependencies from .hs-boot files]
was deleted in 6998772043.

I've also added tildes to Note headers, otherwise they're not detected
by the linter.

- - - - -
82eacab6 by sheaf at 2023-06-02T09:08:01-04:00
Delete GHC.Tc.Utils.Zonk

This module was split up into GHC.Tc.Zonk.Type and GHC.Tc.Zonk.TcType
in commit f62d8195, but I forgot to delete the original module
- - - - -
4a4eb761 by Ben Gamari at 2023-06-02T23:53:21-04:00
base: Add build-order import of GHC.Types in GHC.IO.Handle.Types

For reasons similar to those described in Note [Depend on
GHC.Num.Integer].

Fixes #23411.

- - - - -
f53ac0ae by Sylvain Henry at 2023-06-02T23:54:01-04:00
JS: fix and enhance non-minimized code generation (#22455)

Flag -ddisable-js-minimizer was producing invalid code. Fix that and
also a few other things to generate nicer JS code for debugging.

The added test checks that we don't regress when using the flag.

- - - - -
f7744e8e by Andrey Mokhov at 2023-06-03T16:49:44-04:00
[hadrian] Fix multiline synopsis rendering

- - - - -
b2c745db by Bodigrim at 2023-06-03T16:50:23-04:00
Elaborate on performance properties of Data.List.++

- - - - -
7cd8a61e by Matthew Pickering at 2023-06-05T11:46:23+01:00
Big TcLclEnv and CtLoc refactoring

The overall goal of this refactoring is to reduce the dependency
footprint of the parser and syntax tree. Good reasons include:

- Better module graph parallelisability
- Make it easier to migrate error messages without introducing module loops
- Philosophically, there's not reason for the AST to depend on half the
  compiler.

One of the key edges which added this dependency was

> GHC.Hs.Expr -> GHC.Tc.Types (TcLclEnv)

As this in turn depending on TcM which depends on HscEnv and so on.

Therefore the goal of this patch is to move `TcLclEnv` out of
`GHC.Tc.Types` so that `GHC.Hs.Expr` can import TcLclEnv without
incurring a huge dependency chain.

The changes in this patch are:

* Move TcLclEnv from GHC.Tc.Types to GHC.Tc.Types.LclEnv
* Create new smaller modules for the types used in TcLclEnv
  New Modules:
  - GHC.Tc.Types.ErrCtxt
  - GHC.Tc.Types.BasicTypes
  - GHC.Tc.Types.TH
  - GHC.Tc.Types.LclEnv
  - GHC.Tc.Types.CtLocEnv
  - GHC.Tc.Errors.Types.PromotionErr

  Removed Boot File:
  - {-# SOURCE #-} GHC.Tc.Types

* Introduce TcLclCtxt, the part of the TcLclEnv which doesn't
  participate in restoreLclEnv.

* Replace TcLclEnv in CtLoc with specific CtLocEnv which is defined in
  GHC.Tc.Types.CtLocEnv. Use CtLocEnv in Implic and CtLoc to record the
  location of the implication and constraint.

By splitting up TcLclEnv from GHC.Tc.Types we allow GHC.Hs.Expr to no
longer depend on the TcM monad and all that entails.

Fixes #23389 #23409

- - - - -
3d8d39d1 by Matthew Pickering at 2023-06-05T11:46:23+01:00
Remove dependency of GHC.Tc.Utils.TcType on GHC.Driver.Session

This removes the usage of DynFlags from Tc.Utils.TcType  so that it no
longer depends on GHC.Driver.Session. In general we don't want anything
which is a dependency of Language.Haskell.Syntax to depend on
GHC.Driver.Session and removing this edge gets us closer to that goal.

- - - - -
18db5ada by Matthew Pickering at 2023-06-05T11:46:23+01:00
Move isIrrefutableHsPat to GHC.Rename.Utils and rename to isIrrefutableHsPatRn

This removes edge from GHC.Hs.Pat to GHC.Driver.Session, which makes
Language.Haskell.Syntax end up depending on GHC.Driver.Session.

- - - - -
12919dd5 by Matthew Pickering at 2023-06-05T11:46:23+01:00
Remove dependency of GHC.Tc.Types.Constraint on GHC.Driver.Session

- - - - -
eb852371 by Matthew Pickering at 2023-06-05T11:46:24+01:00
hole fit plugins: Split definition into own module

The hole fit plugins are defined in terms of TcM, a type we want to
avoid depending on from `GHC.Tc.Errors.Types`. By moving it into its own
module we can remove this dependency. It also simplifies the necessary
boot file.

- - - - -
9e5246d7 by Matthew Pickering at 2023-06-05T11:46:24+01:00
Move GHC.Core.Opt.CallerCC Types into separate module

This allows `GHC.Driver.DynFlags` to depend on these types without
depending on CoreM and hence the entire simplifier pipeline.

We can also remove a hs-boot file with this change.

- - - - -
52d6a7d7 by Matthew Pickering at 2023-06-05T11:46:24+01:00
Remove unecessary SOURCE import

- - - - -
698d160c by Matthew Pickering at 2023-06-05T11:46:24+01:00
testsuite: Accept new output for CountDepsAst and CountDepsParser tests

These are in a separate commit as the improvement to these tests is the
cumulative effect of the previous set of patches rather than just the
responsibility of the last one in the patchset.

- - - - -
58ccf02e by sheaf at 2023-06-05T16:00:47-04:00
TTG: only allow VarBind at GhcTc

The VarBind constructor of HsBind is only used at the GhcTc stage.
This commit makes that explicit by setting the extension field of
VarBind to be DataConCantHappen at all other stages.

This allows us to delete a dead code path in GHC.HsToCore.Quote.rep_bind,
and remove some panics.

- - - - -
54b83253 by Matthew Craven at 2023-06-06T12:59:25-04:00
Generate Addr# access ops programmatically

The existing utils/genprimopcode/gen_bytearray_ops.py was
relocated and extended for this purpose.  Additionally, hadrian
now knows about this script and uses it when generating primops.txt

- - - - -
ecadbc7e by Matthew Pickering at 2023-06-06T13:00:01-04:00
ghcup-metadata: Only add Nightly tag when replacing LatestNightly

Previously we were always adding the Nightly tag, but this led to all
the previous builds getting an increasing number of nightly tags over
time. Now we just add it once, when we remove the LatestNightly tag.

- - - - -
4aea0a72 by Vladislav Zavialov at 2023-06-07T12:06:46+02:00
Invisible binders in type declarations (#22560)

This patch implements @k-binders introduced in GHC Proposal #425
and guarded behind the TypeAbstractions extension:

	type D :: forall k j. k -> j -> Type
	data D @k @j a b = ...
	       ^^ ^^

To represent the new syntax, we modify LHsQTyVars as follows:

	-  hsq_explicit :: [LHsTyVarBndr () pass]
	+  hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass]

HsBndrVis is a new data type that records the distinction between
type variable binders written with and without the @ sign:

	data HsBndrVis pass
	  = HsBndrRequired
	  | HsBndrInvisible (LHsToken "@" pass)

The rest of the patch updates GHC, template-haskell, and haddock
to handle the new syntax.

Parser:
  The PsErrUnexpectedTypeAppInDecl error message is removed.
  The syntax it used to reject is now permitted.

Renamer:
  The @ sign does not affect the scope of a binder, so the changes to
  the renamer are minimal.  See rnLHsTyVarBndrVisFlag.

Type checker:
  There are three code paths that were updated to deal with the newly
  introduced invisible type variable binders:

    1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl
    2. checking CUSK: see kcCheckDeclHeader_cusk
    3. inference: see kcInferDeclHeader, rejectInvisibleBinders

  Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv
  are generalized to work with HsBndrVis.

Updates the haddock submodule.

Metric Increase:
    MultiLayerModulesTH_OneShot

Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>

- - - - -
b7600997 by Josh Meredith at 2023-06-07T13:10:21-04:00
JS: clean up FFI 'fat arrow' calls in base:System.Posix.Internals (#23481)

- - - - -
e5d3940d by Sebastian Graf at 2023-06-07T18:01:28-04:00
Update CODEOWNERS
- - - - -
960ef111 by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Remove IPE enabled builds from CI"

This reverts commit 41b41577c8a28c236fa37e8f73aa1c6dc368d951.

- - - - -
bad1c8cc by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Update user's guide and release notes, small fixes"

This reverts commit 3ded9a1cd22f9083f31bc2f37ee1b37f9d25dab7.

- - - - -
12726d90 by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Add IPE-enabled builds to CI"

This reverts commit 09d93bd0305b0f73422ce7edb67168c71d32c15f.

- - - - -
dbdd989d by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Add optional dependencies to ./configure output"

This reverts commit a00488665cd890a26a5564a64ba23ff12c9bec58.

- - - - -
240483af by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Fix IPE data decompression buffer allocation"

This reverts commit 0e85099b9316ee24565084d5586bb7290669b43a.

- - - - -
9b8c7dd8 by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Fix byte order of IPE data, fix IPE tests"

This reverts commit 7872e2b6f08ea40d19a251c4822a384d0b397327.

- - - - -
3364379b by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Add note describing IPE data compression"

This reverts commit 69563c97396b8fde91678fae7d2feafb7ab9a8b0.

- - - - -
fda30670 by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Fix libzstd detection in configure and RTS"

This reverts commit 5aef5658ad5fb96bac7719710e0ea008bf7b62e0.

- - - - -
1cbcda9a by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "IPE data compression"

This reverts commit b7a640acf7adc2880e5600d69bcf2918fee85553.

- - - - -
fb5e99aa by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Add IPE compression to configure"

This reverts commit 5d1f2411f4becea8650d12d168e989241edee186.

- - - - -
2cdcb3a5 by Matthew Pickering at 2023-06-07T18:02:04-04:00
Revert "Restructure IPE buffer layout"

This reverts commit f3556d6cefd3d923b36bfcda0c8185abb1d11a91.

- - - - -
2b0c9f5e by Simon Peyton Jones at 2023-06-08T07:52:34+00:00
Don't report redundant Givens from quantified constraints

This fixes #23323

See (RC4) in Note [Tracking redundant constraints]

- - - - -
567b32e1 by David Binder at 2023-06-08T18:41:29-04:00
Update the outdated instructions in HACKING.md on how to compile GHC

- - - - -
2b1a4abe by Ryan Scott at 2023-06-09T07:56:58-04:00
Restore mingwex dependency on Windows

This partially reverts some of the changes in !9475 to make `base` and
`ghc-prim` depend on the `mingwex` library on Windows. It also restores the
RTS's stubs for `mingwex`-specific symbols such as `_lock_file`.

This is done because the C runtime provides `libmingwex` nowadays, and
moreoever, not linking against `mingwex` requires downstream users to link
against it explicitly in difficult-to-predict circumstances. Better to always
link against `mingwex` and prevent users from having to do the guesswork
themselves.

See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10360#note_495873 for
the discussion that led to this.

- - - - -
28954758 by Ryan Scott at 2023-06-09T07:56:58-04:00
RtsSymbols.c: Remove mingwex symbol stubs

As of !9475, the RTS now links against `ucrt` instead of `msvcrt` on Windows,
which means that the RTS no longer needs to declare stubs for the `__mingw_*`
family of symbols. Let's remove these stubs to avoid confusion.

Fixes #23309.

- - - - -
3ab0155b by Ryan Scott at 2023-06-09T07:57:35-04:00
Consistently use validity checks for TH conversion of data constructors

We were checking that TH-spliced data declarations do not look like this:

```hs
data D :: Type = MkD Int
```

But we were only doing so for `data` declarations' data constructors, not for
`newtype`s, `data instance`s, or `newtype instance`s. This patch factors out
the necessary validity checks into its own `cvtDataDefnCons` function and uses
it in all of the places where it needs to be.

Fixes #22559.

- - - - -
a24b83dd by Matthew Pickering at 2023-06-09T15:19:00-04:00
Fix behaviour of -keep-tmp-files when used in OPTIONS_GHC pragma

This fixes the behaviour of -keep-tmp-files when used in an OPTIONS_GHC
pragma for files with module level scope.

Instead of simple not deleting the files, we also need to remove them
from the TmpFs so they are not deleted later on when all the other files
are deleted.

There are additional complications because you also need to remove the
directory where these files live from the TmpFs so we don't try to
delete those later either.

I added two tests.

1. Tests simply that -keep-tmp-files works at all with a single module
   and --make mode.
2. The other tests that temporary files are deleted for other modules
   which don't enable -keep-tmp-files.

Fixes #23339

- - - - -
dcf32882 by Matthew Pickering at 2023-06-09T15:19:00-04:00
withDeferredDiagnostics: When debugIsOn, write landmine into IORef to catch use-after-free.

Ticket #23305 reports an error where we were attempting to use the
logger which was created by withDeferredDiagnostics after its scope had
ended.

This problem would have been caught by this patch and a validate build:

```
+*** Exception: Use after free
+CallStack (from HasCallStack):
+  error, called at compiler/GHC/Driver/Make.hs:<line>:<column> in <package-id>:GHC.Driver.Make
```

This general issue is tracked by #20981

- - - - -
432c736c by Matthew Pickering at 2023-06-09T15:19:00-04:00
Don't return complete HscEnv from upsweep

By returning a complete HscEnv from upsweep the logger (as introduced by
withDeferredDiagnostics) was escaping the scope of
withDeferredDiagnostics and hence we were losing error messages.

This is reminiscent of #20981, which also talks about writing errors
into messages after their scope has ended.

See #23305 for details.

- - - - -
26013cdc by Alexander McKenna at 2023-06-09T15:19:41-04:00
Dump `SpecConstr` specialisations separately

Introduce a `-ddump-spec-constr` flag which debugs specialisations from
`SpecConstr`. These are no longer shown when you use `-ddump-spec`.

- - - - -
4639100b by Matthew Pickering at 2023-06-09T18:50:43-04:00
Add role annotations to SNat, SSymbol and SChar

Ticket #23454 explained it was possible to implement unsafeCoerce
because SNat was lacking a role annotation.

As these are supposed to be singleton types but backed by an efficient
representation the correct annotation is nominal to ensure these kinds
of coerces are forbidden.

These annotations were missed from https://github.com/haskell/core-libraries-committee/issues/85
which was implemented in 532de36870ed9e880d5f146a478453701e9db25d.

CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/170

Fixes #23454

- - - - -
9c0dcff7 by Matthew Pickering at 2023-06-09T18:51:19-04:00
Remove non-existant bytearray-ops.txt.pp file from ghc.cabal.in

This broke the sdist generation.

Fixes #23489

- - - - -
273ff0c7 by David Binder at 2023-06-09T18:52:00-04:00
Regression test T13438 is no longer marked as "expect_broken" in the testsuite driver.

- - - - -
b84a2900 by Andrei Borzenkov at 2023-06-10T08:27:28-04:00
Fix -Wterm-variable-capture scope (#23434)

-Wterm-variable-capture wasn't accordant with type variable
scoping in associated types, in type classes. For example,
this code produced the warning:
  k = 12

  class C k a where
    type AT a :: k -> Type

I solved this issue by reusing machinery of newTyVarNameRn function
that is accordand with associated types: it does lookup for each free type
variable when we are in the type class context. And in this patch I
use result of this work to make sure that -Wterm-variable-capture warns
only on implicitly quantified type variables.

- - - - -
9d1a8d87 by Jorge Mendes at 2023-06-10T08:28:10-04:00
Remove redundant case statement in rts/js/mem.js.
- - - - -
1d669e25 by Melanie Brown at 2023-06-12T15:25:48-04:00
merge changelogs

- - - - -


30 changed files:

- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- .gitlab/rel_eng/mk-ghcup-metadata/README.mkd
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitlab/rel_eng/upload_ghc_libs.py
- .gitmodules
- CODEOWNERS
- HACKING.md
- cabal.project-reinstall
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- − compiler/GHC/Builtin/bytearray-ops.txt.pp
- utils/genprimopcode/gen_bytearray_ops.py → compiler/GHC/Builtin/gen_bytearray_addr_access_ops.py
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/055f5daf6728917fee5bb0b5aed99852fb8c6a28...1d669e2574926d5052767c57e8c8775efc105ac1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/055f5daf6728917fee5bb0b5aed99852fb8c6a28...1d669e2574926d5052767c57e8c8775efc105ac1
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/20230612/406a92ce/attachment-0001.html>


More information about the ghc-commits mailing list