[Git][ghc/ghc][wip/tsan-ghc-9.0] 257 commits: Bignum: add support for negative shifts (fix #18499)

Ben Gamari gitlab at gitlab.haskell.org
Tue Nov 24 17:03:18 UTC 2020



Ben Gamari pushed to branch wip/tsan-ghc-9.0 at Glasgow Haskell Compiler / GHC


Commits:
32496789 by Sylvain Henry at 2020-08-11T17:43:13+02:00
Bignum: add support for negative shifts (fix #18499)

shiftR/shiftL support negative arguments despite Haskell 2010 report
saying otherwise. We explicitly test for negative values which is bad
(it gets in the way of constant folding, etc.). Anyway, for consistency
we fix Bits instancesof Integer/Natural.

- - - - -
b4cccab3 by Sylvain Henry at 2020-08-11T17:48:05+02:00
Fix bug in Natural multiplication (fix #18509)

A bug was lingering in Natural multiplication (inverting two limbs)
despite QuickCheck tests used during the development leading to wrong
results (independently of the selected backend).

- - - - -
817f94f5 by Sylvain Henry at 2020-08-11T17:48:22+02:00
Bignum: fix powMod for gmp backend (#18515)

Also reenable integerPowMod test which had never been reenabled by
mistake.

- - - - -
eab2511e by Sylvain Henry at 2020-08-12T11:43:42+02:00
Bignum: add backward compat integer-gmp functions

Also enhance bigNatCheck# and isValidNatural test

- - - - -
3745bdb6 by Sylvain Henry at 2020-08-12T11:43:42+02:00
Bignum: add more BigNat compat functions in integer-gmp

- - - - -
7cf007cc by David Binder at 2020-08-13T18:22:38-04:00
Fix dead link to haskell prime discussion

- - - - -
205f168c by BinderDavid at 2020-08-13T18:22:38-04:00
Replace broken links to old haskell-prime site by working links to gitlab instance.
[skip ci]

- - - - -
29794212 by Daniel Gröber at 2020-08-13T18:22:38-04:00
Remove length field from FastString

- - - - -
f8804cd8 by Daniel Gröber at 2020-08-13T18:22:38-04:00
Use ShortByteString for FastString

There are multiple reasons we want this:

- Fewer allocations: ByteString has 3 fields, ShortByteString just has one.
- ByteString memory is pinned:
  - This can cause fragmentation issues (see for example #13110) but also
  - makes using FastStrings in compact regions impossible.

Metric Decrease:
    T5837
    T12150
    T12234
    T12425

- - - - -
5acdf506 by Daniel Gröber at 2020-08-13T18:22:38-04:00
Pass specialised utf8DecodeChar# to utf8DecodeLazy# for performance

Currently we're passing a indexWord8OffAddr# type function to
utf8DecodeLazy# which then passes it on to utf8DecodeChar#. By passing one
of utf8DecodeCharAddr# or utf8DecodeCharByteArray# instead we benefit from
the inlining and specialization already done for those.

- - - - -
a9b46ec3 by Daniel Gröber at 2020-08-13T18:22:38-04:00
Encoding: Add comment about tricky ForeignPtr lifetime

- - - - -
fcb9e94d by Daniel Gröber at 2020-08-13T18:22:38-04:00
Use IO constructor instead of `stToIO . ST`

- - - - -
44b28e97 by Daniel Gröber at 2020-08-13T18:22:38-04:00
Encoding: Remove redundant use of withForeignPtr

- - - - -
f0fe989d by Daniel Gröber at 2020-08-13T18:22:38-04:00
Encoding: Reformat utf8EncodeShortByteString to be more consistent

- - - - -
59cd5cd4 by Daniel Gröber at 2020-08-13T18:22:38-04:00
FastString: Reintroduce character count cache

Metric Increase:
    ManyConstructors

Metric Decrease:
    T4029

- - - - -
0f66e49e by Ben Gamari at 2020-08-13T18:22:38-04:00
get-win32-tarballs: Fix detection of missing tarballs

This fixes the error message given by configure when the user
attempts to configure without first download the win32 tarballs.

- - - - -
3ecac53c by Andreas Klebinger at 2020-08-13T18:22:39-04:00
Enable BangPatterns, ScopedTypeVariables for ghc and hadrian by default.

This is only for their respective codebases.

- - - - -
dbf77b79 by Sylvain Henry at 2020-08-13T18:22:39-04:00
Remove unused "ncg" flag

This flag has been removed in 066b369de2c6f7da03c88206288dca29ab061b31
in 2011.

- - - - -
4e22de2a by Sylvain Henry at 2020-08-13T18:22:39-04:00
Don't panic if the NCG isn't built (it is always built)

- - - - -
e27698ce by Sylvain Henry at 2020-08-13T18:22:39-04:00
Remove unused sGhcWithNativeCodeGen

- - - - -
666acbd4 by Sylvain Henry at 2020-08-13T18:22:39-04:00
Correctly test active backend

Previously we used a platform settings to detect if the native code
generator was used. This was wrong. We need to use the
`DynFlags.hscTarget` field instead.

- - - - -
ce5408c0 by Sylvain Henry at 2020-08-13T18:22:39-04:00
Replace ghcWithNativeCodeGen with a proper Backend datatype

* Represent backends with a `Backend` datatype in GHC.Driver.Backend

* Don't detect the default backend to use for the target platform at
  compile time in Hadrian/make but at runtime. It makes "Settings"
  simpler and it is a step toward making GHC multi-target.

* The latter change also fixes hadrian which has not been updated to
  take into account that the NCG now supports AIX and PPC64 (cf
  df26b95559fd467abc0a3a4151127c95cb5011b9 and
  d3c1dda60d0ec07fc7f593bfd83ec9457dfa7984)

* Also we don't treat iOS specifically anymore (cf
  cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f)

- - - - -
9751d499 by Tamar Christina at 2020-08-13T18:22:39-04:00
winio: restore console cp on exit

(cherry picked from commit cdd0ff16f20ce920c74f9128a1067cbe1bd378c2)

- - - - -
5438dcec by Tamar Christina at 2020-08-13T18:22:39-04:00
winio: change memory allocation strategy and fix double free errors.

(cherry picked from commit c1f4f81d3a439cd1a8128e4ab11c7caac7cc0ad8)

- - - - -
5544d17a by Stefan Schulze Frielinghaus at 2020-08-13T18:22:39-04:00
Require SMP support in order to build a threaded stage1

Fixes 18266

(cherry picked from commit fc0f6fbcd95f2dc69a8efabbee2d8a485c34cc47)

- - - - -
e66e281d by Matthias Andreas Benkard at 2020-08-13T18:22:39-04:00
Document loadFramework changes. (#18446)

Adds commentary on the rationale for the changes made in merge request
!3689.

(cherry picked from commit a7c4439a407ad85b76aab9301fda61e7c10183ff)

- - - - -
986063cf by Ben Gamari at 2020-08-13T18:22:39-04:00
rts/win32: Exit with EXIT_HEAPOVERFLOW if memory commit fails

Since switching to the two-step allocator, the `outofmem` test fails via
`osCommitMemory` failing to commit. However, this was previously exiting
with `EXIT_FAILURE`, rather than `EXIT_HEAPOVERFLOW`. I think the latter
is a more reasonable exit code for this case and matches the behavior on
POSIX platforms.

(cherry picked from commit da7269a4472856ba701d956a247599f721e9915e)

- - - - -
b2f8c6a7 by Ben Gamari at 2020-08-13T18:22:39-04:00
testsuite: Update win32 output for parseTree

(cherry picked from commit f153a1d0a3351ad4d94cef4cef8e63bab5b47008)

- - - - -
83a0649c by Ben Gamari at 2020-08-13T18:22:39-04:00
testsuite: Normalise WinIO error message differences

Previously the old Windows IO manager threw different errors than WinIO.
We now canonicalise these to the WinIO errors.

(cherry picked from commit e91672f0b7185bbafbe8ed1f2ae2cb775111f950)

- - - - -
97ac5b2a by Ben Gamari at 2020-08-13T18:22:39-04:00
gitlab-ci: Kill ssh-agent after pushing test metrics

Otherwise the Windows builds hang forever waiting for the process to
terminate.

(cherry picked from commit 9cbfe0868418a531da0872b0c477a15aa67f8861)

- - - - -
8f1154d3 by Tamar Christina at 2020-08-13T18:22:39-04:00
winio: remove dead argument to stg_newIOPortzh

(cherry picked from commit 8236925fc8cc2e6e3fed61a0676fa65270a4a538)

- - - - -
39c6fbae by Tamar Christina at 2020-08-13T18:22:39-04:00
winio: fix detection of tty terminals

(cherry picked from commit ce0a1d678fbc8efa5fd384fd0227b7b3dc97cadd)

- - - - -
b784c75a by Tamar Christina at 2020-08-13T18:22:40-04:00
winio: update codeowners

(cherry picked from commit 52685cf7c077c51e3719e3c4dd5ca8257a99c4ea)

- - - - -
8388567e by Ben Gamari at 2020-08-13T18:22:40-04:00
Drop 32-bit Windows support

As noted in #18487, we have reached the end of this road.

(cherry picked from commit aa054d32a8ff69c334293a0d6c9d11b83a236a96)

- - - - -
353521ab by Simon Peyton Jones at 2020-08-13T18:22:40-04:00
Eta-expand the Simplifier monad

This patch eta-expands the Simplifier's monad, using the method
explained in GHC.Core.Unify Note [The one-shot state monad trick].
It's part of the exta-expansion programme in #18202.

It's a tiny patch, but is worth a 1-2% reduction in bytes-allocated
by the compiler.  Here's the list, based on the compiler-performance
tests in perf/compiler:

                    Reduction in bytes allocated
   T10858(normal)      -0.7%
   T12425(optasm)      -1.3%
   T13056(optasm)      -1.8%
   T14683(normal)      -1.1%
   T15164(normal)      -1.3%
   T15630(normal)      -1.4%
   T17516(normal)      -2.3%
   T18282(normal)      -1.6%
   T18304(normal)      -0.8%
   T1969(normal)       -0.6%
   T4801(normal)       -0.8%
   T5321FD(normal)     -0.7%
   T5321Fun(normal)    -0.5%
   T5642(normal)       -0.9%
   T6048(optasm)       -1.1%
   T9020(optasm)       -2.7%
   T9233(normal)       -0.7%
   T9675(optasm)       -0.5%
   T9961(normal)       -2.9%
   WWRec(normal)       -1.2%

Metric Decrease:
    T12425
    T9020
    T9961

(cherry picked from commit 3d345c9680ab3d766ef43dd8389ccc1eaeca066c)

- - - - -
c0a3283a by Ben Gamari at 2020-08-13T18:22:40-04:00
gitlab-ci: Ensure that Hadrian jobs don't download artifacts

Previously the Hadrian jobs had the default dependencies, meaning that
they would download artifacts from all jobs of earlier stages. This is
unneccessary.

(cherry picked from commit 57aca6bba1c000f8542ce94e8b724b0334ff96d4)

- - - - -
e14ee26b by Ben Gamari at 2020-08-13T18:22:40-04:00
gitlab-ci: Bump bootstrap compiler to 8.8.4

Hopefully this will make the Windows jobs a bit more reliable.

(cherry picked from commit 0a815cea9fa11ce6ef22aec3525dd7a0df541daf)

- - - - -
cf9a6c17 by Simon Peyton Jones at 2020-08-13T18:22:40-04:00
This patch addresses the exponential blow-up in the simplifier.

Specifically:
  #13253 exponential inlining
  #10421 ditto
  #18140 strict constructors
  #18282 another nested-function call case

This patch makes one really significant changes: change the way that
mkDupableCont handles StrictArg.  The details are explained in
GHC.Core.Opt.Simplify Note [Duplicating StrictArg].

Specific changes

* In mkDupableCont, when making auxiliary bindings for the other arguments
  of a call, add extra plumbing so that we don't forget the demand on them.
  Otherwise we haev to wait for another round of strictness analysis. But
  actually all the info is to hand.  This change affects:
  - Make the strictness list in ArgInfo be [Demand] instead of [Bool],
    and rename it to ai_dmds.
  - Add as_dmd to ValArg
  - Simplify.makeTrivial takes a Demand
  - mkDupableContWithDmds takes a [Demand]

There are a number of other small changes

1. For Ids that are used at most once in each branch of a case, make
   the occurrence analyser record the total number of syntactic
   occurrences.  Previously we recorded just OneBranch or
   MultipleBranches.

   I thought this was going to be useful, but I ended up barely
   using it; see Note [Note [Suppress exponential blowup] in
   GHC.Core.Opt.Simplify.Utils

   Actual changes:
     * See the occ_n_br field of OneOcc.
     * postInlineUnconditionally

2. I found a small perf buglet in SetLevels; see the new
   function GHC.Core.Opt.SetLevels.hasFreeJoin

3. Remove the sc_cci field of StrictArg.  I found I could get
   its information from the sc_fun field instead.  Less to get
   wrong!

4. In ArgInfo, arrange that ai_dmds and ai_discs have a simpler
   invariant: they line up with the value arguments beyond ai_args
   This allowed a bit of nice refactoring; see isStrictArgInfo,
   lazyArgcontext, strictArgContext

There is virtually no difference in nofib. (The runtime numbers
are bogus -- I tried a few manually.)

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
            fft          +0.0%     -2.0%    -48.3%    -49.4%      0.0%
     multiplier          +0.0%     -2.2%    -50.3%    -50.9%      0.0%
--------------------------------------------------------------------------------
            Min          -0.4%     -2.2%    -59.2%    -60.4%      0.0%
            Max          +0.0%     +0.1%     +3.3%     +4.9%      0.0%
 Geometric Mean          +0.0%     -0.0%    -33.2%    -34.3%     -0.0%

Test T18282 is an existing example of these deeply-nested strict calls.
We get a big decrease in compile time (-85%) because so much less
inlining takes place.

Metric Decrease:
    T18282

(cherry picked from commit 0bd60059b0edfee9e8f66c6817257bbb946656cd)

- - - - -
6ba13945 by Sergei Trofimovich at 2020-08-13T18:22:40-04:00
ghc/mk: don't build gmp packages for BIGNUM_BACKEND=native

Before this change make-based `BIGNUM_BACKEND=native` build was failing as:

```
x86_64-pc-linux-gnu-gcc: error: libraries/ghc-bignum/gmp/objs/*.o: No such file or directory
```

This happens because ghc.mk was pulling in gmp-dependent
ghc-bignum library unconditionally. The change avoid building
ghc-bignum.

Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437
Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
(cherry picked from commit 39c89862161bf488a6aca9372cbb67690f436ce7)

- - - - -
59226e20 by Felix Wiemuth at 2020-08-13T18:22:40-04:00
Fix typo

(cherry picked from commit b9a880fce484d0a87bb794b9d2d8a73e54819011)

- - - - -
9166d4d6 by Simon Peyton Jones at 2020-08-13T18:22:40-04:00
Kill off sc_mult and as_mult fields

They are readily derivable from other fields, so this is more
efficient, and less error prone.

Fixes #18494

(cherry picked from commit bbc5191640761ca9773abc898c077363b7beb4e7)

- - - - -
505a9d68 by John Ericson at 2020-08-13T18:22:40-04:00
For `-fkeep-going` do not duplicate dependency edge code

We now compute the deps for `-fkeep-going` the same way that the
original graph calculates them, so the edges are correct. Upsweep really
ought to take the graph rather than a topological sort so we are never
recalculating anything, but at least things are recaluclated
consistently now.

(cherry picked from commit 6c68a84254d70280e2dc73485f361787a3503850)

- - - - -
bd365c1d by Simon Peyton Jones at 2020-08-13T18:22:40-04:00
Add two bangs to improve perf of flattening

This tiny patch improves the compile time of flatten-heavy
programs by 1-2%, by adding two bangs.

Addresses (somewhat) #18502

This reduces allocation by
   T9872b   -1.1%
   T9872d   -3.3%

   T5321Fun -0.2%
   T5631    -0.2%
   T5837    +0.1%
   T6048    +0.1%

Metric Decrease:
    T9872b
    T9872d

(cherry picked from commit 9f71f69714255165d0fdc2790a588487ff9439dc)

- - - - -
6653e139 by Sylvain Henry at 2020-08-13T18:22:40-04:00
Fix minimal imports dump for boot files (fix #18497)

(cherry picked from commit 7c274cd530cc42a26028050b75d56b3437e06ec1)

- - - - -
2c86713b by Leon Schoorl at 2020-08-13T18:22:41-04:00
Fix GHC_STAGE definition generated by make

Fixes #18070

GHC_STAGE is the stage of the compiler we're building, it should be 1,2(,3?).
But make was generating 0 and 1.

Hadrian does this correctly using a similar `+ 1`:
https://gitlab.haskell.org/ghc/ghc/-/blob/eb8115a8c4cbc842b66798480fefc7ab64d31931/hadrian/src/Rules/Generate.hs#L245

(cherry picked from commit f2d1accf67cb6e1dab6b2c78fef4b64526c31a4a)

- - - - -
36d8cd6f by Niklas Hambüchen at 2020-08-13T18:22:41-04:00
hadrian: Fix running stage0/bin/ghc with wrong package DB. Fixes #17468.

In the invocation of `cabal configure`, `--ghc-pkg-option=--global-package-db`
was already given correctly to tell `stage0/bin/ghc-pkg` that it should use
the package DB in `stage1/`.

However, `ghc` needs to be given this information as well, not only `ghc-pkg`!
Until now that was not the case; the package DB in `stage0` was given to
`ghc` instead.
This was wrong, because there is no binary compatibility guarantee that says
that the `stage0` DB's `package.cache` (which is written by the
stage0 == system-provided ghc-pkg) can be deserialised by the `ghc-pkg`
from the source code tree.

As a result, when trying to add fields to `InstalledPackageInfo` that get
serialised into / deserialised from the `package.cache`, errors like

    _build/stage0/lib/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)

would appear. This was because the `stage0/bin/ghc would try to
deserialise the newly added fields from
`_build/stage0/lib/package.conf.d/package.cache`, but they were not in there
because the system `ghc-pkg` doesn't know about them and thus didn't write them
there.
It would try to do that because any GHC by default tries to read the global
package db in `../lib/package.conf.d/package.cache`.
For `stage0/bin/ghc` that *can never work* as explained above, so we
must disable this default via `-no-global-package-db` and give it the
correct package DB explicitly.

This is the same problem as #16534, and the same fix as in MR !780
(but in another context; that one was for developers trying out the
`stage0/bin/ghc` == `_build/ghc-stage1` interactively, while this fix
is for a `cabal configure` invocation).

I also noticed that the fix for #16534 forgot to pass `-no-global-package-db`,
and have fixed that in this commit as well.
It only worked until now because nobody tried to add a new ghc-pkg `.conf`
field since the introduction of Hadrian.

(cherry picked from commit 947206f478d4eef641dfc58cb4c13471a23260c3)

- - - - -
01534bf9 by Krzysztof Gogolewski at 2020-08-13T18:22:48-04:00
Rename Core.Opt.Driver -> Core.Opt.Pipeline

Closes #18504.

(cherry picked from commit 5e12cd1733b581f48a5873b12971b6974778eabb)

- - - - -
20a45d0c by Ben Gamari at 2020-08-13T18:22:48-04:00
Revert "iserv: Don't pass --export-dynamic on FreeBSD"

This reverts commit 2290eb02cf95e9cfffcb15fc9c593d5ef79c75d9.

(cherry picked from commit 2bff2f87e43985e02bdde8c6fa39279df86cb617)

- - - - -
2911d640 by Ben Gamari at 2020-08-13T18:22:48-04:00
Refactor handling of object merging

Previously to merge a set of object files we would invoke the linker as
usual, adding -r to the command-line. However, this can result in
non-sensical command-lines which causes lld to balk (#17962).

To avoid this we introduce a new tool setting into GHC, -pgmlm, which is
the linker which we use to merge object files.

(cherry picked from commit 53ce0db5a06598c88c6b8cb32043b878e7083dd4)

- - - - -
cb3e202a by Ryan Scott at 2020-08-13T18:22:48-04:00
Make CodeQ and TExpQ levity polymorphic

The patch is quite straightforward. The only tricky part is that
`Language.Haskell.TH.Lib.Internal` now must be `Trustworthy` instead
of `Safe` due to the `GHC.Exts` import (in order to import `TYPE`).

Since `CodeQ` has yet to appear in any released version of
`template-haskell`, I didn't bother mentioning the change to `CodeQ`
in the `template-haskell` release notes.

Fixes #18521.

(cherry picked from commit fbcb886d503dd7aaebc4c40e59615068b3fd0bd7)

- - - - -
bd506bd6 by Vladislav Zavialov at 2020-08-13T18:22:48-04:00
Improve NegativeLiterals (#18022, GHC Proposal #344)

Before this patch, NegativeLiterals used to parse x-1 as x (-1).

This may not be what the user expects, and now it is fixed:
x-1 is parsed as (-) x 1.

We achieve this by the following requirement:

  * When lexing a negative literal,
    it must not be preceded by a 'closing token'.

This also applies to unboxed literals, e.g. -1#.

See GHC Proposal #229 for the definition of a closing token.

A nice consequence of this change is that -XNegativeLiterals becomes a
subset of -XLexicalNegation. In other words, enabling both of those
extensions has the same effect as enabling -XLexicalNegation alone.

(cherry picked from commit aee45d9ea8c6cf4ebad4d5c732748923c7865cbe)

- - - - -
bc186461 by Takenobu Tani at 2020-08-13T18:22:48-04:00
users-guide: Rename 8.12 to 9.0

GHC 8.12.1 has been renamed to GHC 9.0.1.

See also:
  https://mail.haskell.org/pipermail/ghc-devs/2020-July/019083.html

[skip ci]

(cherry picked from commit 9570c21295a2b4a1d1e40939869124f0b9b9bf91)

- - - - -
77653d5c by Ben Gamari at 2020-08-13T18:22:48-04:00
cmm: Clean up Notes a bit

(cherry picked from commit 5f03606319f745b10e9918c76a47426b293f0bf9)

- - - - -
47de152f by Ben Gamari at 2020-08-13T18:22:48-04:00
CmmLint: Check foreign call argument register invariant

As mentioned in Note [Register parameter passing] the arguments of
foreign calls cannot refer to caller-saved registers.

(cherry picked from commit 6402c1240d5bd768b8fe8b4368413932bedbe107)

- - - - -
e64ac078 by Ben Gamari at 2020-08-13T18:22:48-04:00
nativeGen: One approach to fix #18527

Previously the code generator could produce corrupt C call sequences due
to register overlap between MachOp lowerings and the platform's calling
convention. We fix this using a hack described in Note [Evaluate C-call
arguments before placing in destination registers].

(cherry picked from commit 15b36de030ecdd60897bc7a6a02bdeabd0825be4)

- - - - -
24c230ce by Ben Gamari at 2020-08-13T18:22:48-04:00
testsuite: Add test for #18527

(cherry picked from commit 3847ae0ccf67bddf73304a39f5320c3ba285aa48)

- - - - -
ee2ed876 by Ben Gamari at 2020-08-13T18:22:48-04:00
testsuite: Fix prog001

Previously it failed as the `ghc` package was not visible.

(cherry picked from commit dd51d53be42114c105b5ab15fcbdb387526b1c17)

- - - - -
b4c33250 by Alan Zimmerman at 2020-08-13T18:22:48-04:00
ApiAnnotations; tweaks for ghc-exactprint update

Remove unused ApiAnns, add one for linear arrow.

Include API Annotations for trailing comma in export list.

(cherry picked from commit e4f1b73ad9f292a6bbeb21fee44b0ba1a7f3c33b)

- - - - -
cb39cfdc by Ben Gamari at 2020-08-13T18:22:48-04:00
configure: Fix double-negation in ld merge-objects check

We want to only run the check if ld is gold.

Fixes the fix to #17962.

(cherry picked from commit 8a665db6174eaedbbae925c0ccb4c22b3f29bcaf)

- - - - -
b221b571 by Alex Biehl at 2020-08-13T18:22:48-04:00
Hardcode RTS includes to cope with unregistered builds

(cherry picked from commit ef2ae81a394df573510b12b7e11bba0c931249d8)

- - - - -
c15fb71b by Ben Gamari at 2020-08-13T18:22:48-04:00
testsuite: Specify metrics collected by T17516

Previously it collected everything, including "max bytes used". This is
problematic since the test makes no attempt to control for deviations in
GC timing, resulting in high variability. Fix this by only collecting
"bytes allocated".

(cherry picked from commit f1088b3f31ceddf918a319c97557fb1f08a9a387)

- - - - -
3bda53ad by Ben Gamari at 2020-08-13T20:44:39-04:00
testsuite: Allow baseline commit to be set explicitly

(cherry picked from commit bbde6ea0ce80a154735f1302251d073a56606c20)

- - - - -
ce32390c by Ben Gamari at 2020-08-15T12:19:32-04:00
gitlab-ci: Use MR base commit as performance baseline

(cherry picked from commit 4b91e5edf64363eff7d087731c2806464033447c)

Metric Decrease:
  T13056
  T18304
  T1969
  T9233

- - - - -
57fd3ff0 by Ben Gamari at 2020-08-16T12:18:11-04:00
Allow unsaturated runRW# applications

Previously we had a very aggressive Core Lint check which caught
unsaturated applications of runRW#. However, there is nothing
wrong with such applications and they may naturally arise in desugared
Core. For instance, the desugared Core of Data.Primitive.Array.runArray#
from the `primitive` package contains:

    case ($) (runRW# @_ @_) (\s -> ...) of ...

In this case it's almost certain that ($) will be inlined, turning the
application into a saturated application. However, even if this weren't
the case there isn't a problem: CorePrep (after deleting an unnecessary
case) can simply generate code in its usual way, resulting in a call to
the Haskell definition of runRW#.

Fixes #18291.

(cherry picked from commit 2f0bae734e2dc8737fbbb8465de7ded89c1121b6)

- - - - -
0af2db18 by Ben Gamari at 2020-08-16T12:18:19-04:00
testsuite: Add test for #18291

(cherry picked from commit 6c7785f8e17a43a2578366134f74fd1989077b73)

- - - - -
614ac76d by Ben Gamari at 2020-08-17T15:14:35-04:00
Clean up TBDs in changelog

(cherry picked from commit 4f334120c8e9cc4aefcbf11d99f169f648af9fde)

- - - - -
1a54d708 by Ben Gamari at 2020-08-17T15:14:35-04:00
Bump bytestring submodule

- - - - -
20e19811 by Ben Gamari at 2020-08-17T15:14:35-04:00
Bump binary submodule

- - - - -
8c7e8e1c by Ben Gamari at 2020-08-17T20:09:30+00:00
Bump Cabal submodule

- - - - -
1f6824a1 by Ben Gamari at 2020-08-21T11:35:00-04:00
Accept spurious performance shift

Metric Decrease:
    T13035

- - - - -
5ccf44c6 by Krzysztof Gogolewski at 2020-08-24T21:35:48-04:00
Fix types in silly shifts (#18589)

Patch written by Simon. I have only added a testcase.

(cherry picked from commit 364258e0ad25bc95e69745554f5ca831ce80baf8)

- - - - -
29e9d2d1 by Vladislav Zavialov at 2020-08-29T16:54:45+02:00
Import qualified Prelude in Cmm/Parser.y

In preparation for the next version of 'happy', c95920 added a qualified
import to GHC/Parser.y but for some reason neglected GHC/Cmm/Parser.y

This patch adds the missing qualified import to GHC/Cmm/Parser.y and
also adds a clarifying comment to explain why this import is needed.

(cherry picked from commit fddddbf47d6ba2b1b3b6ec89bd40c8fa020e6606)

- - - - -
bf8bb9e7 by Sylvain Henry at 2020-08-31T13:49:08-04:00
Bignum: fix BigNat subtraction (#18604)

There was a confusion between the boolean expected by
withNewWordArrayTrimedMaybe and the boolean returned by subtracting
functions.

- - - - -
a3e90763 by Sylvain Henry at 2020-09-01T10:22:24+02:00
Fix documentation and fix "check" bignum backend (#18604)

(cherry-picked from 0a3723876c6c79a0a407d50f4baa2818a13f232e)

- - - - -
d5c3a027 by Sylvain Henry at 2020-09-01T10:22:46+02:00
Bignum: add BigNat compat functions (#18613)

(cherry-picked from a8a2568b7b64e5b9fca5b12df7da759de4db39ae)

- - - - -
a6809cf8 by Ben Gamari at 2020-09-02T15:27:27-04:00
users-guide: A few release notes fixes

- - - - -
2dbdb7b9 by GHC GitLab CI at 2020-09-03T19:55:38-04:00
configure: Avoid hard-coded ld path on Windows

The fix to #17962 ended up regressing on Windows as it failed to
replicate the logic responsible for overriding the toolchain paths on
Windows. This resulted in a hard-coded path to a directory that likely
doesn't exist on the user's system (#18550).

(cherry picked from commit 34e0fa963f35a77093fc7111a80c557fc6bd614f)

- - - - -
4e8f05fa by Ben Gamari at 2020-09-06T15:27:00-04:00
gitlab-ci: More intelligent detection of locale availability

Previously ci.sh would unconditionally use C.UTF-8. However, this fails
on Centos 7, which appears not to provide this locale. Now we first try
C.UTF-8, then try en_US.UTF-8, then fail.

Works around #18607.

(cherry picked from commit be2cc0ad2109894d2f576c73e3f037b6b79a6bdc)

- - - - -
104b0ccd by Ben Gamari at 2020-09-07T03:18:32-04:00
gitlab-ci: Configure bignum backend in Hadrian builds

- - - - -
cee137dc by Ben Gamari at 2020-09-07T03:18:32-04:00
gitlab-ci: Use hadrian builds for Window release artifacts

- - - - -
c2030f00 by Ben Gamari at 2020-09-07T16:16:05-04:00
testsuite: Only run llvm ways if llc is available

As noted in #18560, we previously would always run the LLVM ways since
`configure` would set `SettingsLlcCommand` to something non-null when
it otherwise couldn't find the `llc` executable. Now we rather probe for
the existence of the `llc` executable in the testsuite driver.

Fixes #18560.

(cherry picked from commit aa4b744d51aa6bdb46064f981ea8e001627921d6)

- - - - -
6dbd1054 by Sylvain Henry at 2020-09-07T16:20:38-04:00
Remove outdated note

- - - - -
c23275f4 by Sylvain Henry at 2020-09-07T16:20:38-04:00
Bignum: add missing compat import/export functions

- - - - -
214b2b69 by Ben Gamari at 2020-09-07T20:28:21-04:00
gitlab-ci: Accept Centos 7 C.utf8 locale

Centos apparently has C.utf8 rather than C.UTF-8.

(cherry picked from commit d9f85dd25a26a04d3485470afb3395ee2dec6464)
(cherry picked from commit 9374737005c9fa36a870111f100fe27f9a0efd8e)

- - - - -
b093074e by Ben Gamari at 2020-09-07T20:28:26-04:00
gitlab-ci: Handle distributions without locales

Previously we would assume that the `locale` utility exists. However,
this is not so on Alpine as musl's locale support is essentially
non-existent.

(cherry picked from commit 17cdb7ac3b557a245fee1686e066f9f770ddc21e)
(cherry picked from commit c10ff55fddf8c6708d679e91f3253dc642b91565)

- - - - -
3e55edd9 by Ben Gamari at 2020-09-08T09:46:42-04:00
gitlab-ci: Rename RELEASE variable to RELEASE_JOB

This interfered with the autoconf variable of the same name, breaking
pre-release builds.

(cherry picked from commit 15dca84793d5ec4ff922726477923e40caa075eb)

- - - - -
12d9742c by Zubin Duggal at 2020-09-16T14:38:15-04:00
Export enrichHie from GHC.Iface.Ext.Ast

This is useful for `ghcide`

Backport of !4037

- - - - -
59862b4a by Ben Gamari at 2020-09-17T19:46:29-04:00
Bump Win32 submodule to 2.9.0.0

Also bumps Cabal, directory

(cherry picked from commit 9c6c1ebc9ab2f18d711a8793c7f0ec36e989d687)

- - - - -
e8f5e16a by Ryan Scott at 2020-09-17T19:46:29-04:00
Don't mark closed type family equations as occurrences

Previously, `rnFamInstEqn` would mark the name of the type/data
family used in an equation as an occurrence, regardless of what sort
of family it is. Most of the time, this is the correct thing to do.
The exception is closed type families, whose equations constitute its
definition and therefore should not be marked as occurrences.
Overzealously counting the equations of a closed type family as
occurrences can cause certain warnings to not be emitted, as observed
in #18470.  See `Note [Type family equations and occurrences]` in
`GHC.Rename.Module` for the full story.

This fixes #18470 with a little bit of extra-casing in
`rnFamInstEqn`. To accomplish this, I added an extra
`ClosedTyFamInfo` field to the `NonAssocTyFamEqn` constructor of
`AssocTyFamInfo` and refactored the relevant call sites accordingly
so that this information is propagated to `rnFamInstEqn`.

While I was in town, I moved `wrongTyFamName`, which checks that the
name of a closed type family matches the name in an equation for that
family, from the renamer to the typechecker to avoid the need for an
`ASSERT`. As an added bonus, this lets us simplify the details of
`ClosedTyFamInfo` a bit.

(cherry picked from commit 4f83e9ad76b1e7c67a440ea89f22f6fc03921b5d)

- - - - -
eae6f239 by Ryan Scott at 2020-09-17T19:46:29-04:00
Clean up the inferred type variable restriction

This patch primarily:

* Documents `checkInferredVars` (previously called
  `check_inferred_vars`) more carefully. This is the
  function which throws an error message if a user quantifies an
  inferred type variable in a place where specificity cannot be
  observed. See `Note [Unobservably inferred type variables]` in
  `GHC.Rename.HsType`.

  Note that I now invoke `checkInferredVars` _alongside_
  `rnHsSigType`, `rnHsWcSigType`, etc. rather than doing so _inside_
  of these functions. This results in slightly more call sites for
  `checkInferredVars`, but it makes it much easier to enumerate the
  spots where the inferred type variable restriction comes into
  effect.
* Removes the inferred type variable restriction for default method
  type signatures, per the discussion in #18432. As a result, this
  patch fixes #18432.

Along the way, I performed some various cleanup:

* I moved `no_nested_foralls_contexts_err` into `GHC.Rename.Utils`
  (under the new name `noNestedForallsContextsErr`), since it now
  needs to be invoked from multiple modules. I also added a helper
  function `addNoNestedForallsContextsErr` that throws the error
  message after producing it, as this is a common idiom.
* In order to ensure that users cannot sneak inferred type variables
  into `SPECIALISE instance` pragmas by way of nested `forall`s, I
  now invoke `addNoNestedForallsContextsErr` when renaming
  `SPECIALISE instance` pragmas, much like when we rename normal
  instance declarations. (This probably should have originally been
  done as a part of the fix for #18240, but this task was somehow
  overlooked.) As a result, this patch fixes #18455 as a side effect.

(cherry picked from commit 502605f7ae9907a6b0b9823e8f055ae390c57b1d)

- - - - -
8dcbbeec by Ben Gamari at 2020-09-17T19:46:29-04:00
typecheck: Drop SPECIALISE pragmas when there is no unfolding

Previously the desugarer would instead fall over when it realized that
there was no unfolding for an imported function with a SPECIALISE
pragma. We now rather drop the SPECIALISE pragma and throw a warning.

Fixes #18118.

(cherry picked from commit 708e374a8bf108999c11b6cf59c7d27677ed24a8)

- - - - -
df6d0218 by Ben Gamari at 2020-09-17T19:46:29-04:00
testsuite: Add test for #18118

(cherry picked from commit 2cdb72a569f6049a390626bca0dd6e362045ed65)

- - - - -
675c0cce by Ben Gamari at 2020-09-17T19:46:29-04:00
testsuite: Drop --io-manager flag from testsuite configuration

This is no longer necessary as there are now dedicated testsuite ways
which run tests with WinIO.

(cherry picked from commit 77b1ebf6dd34df8068a07865d92301ff298cf5ca)

- - - - -
7e315b15 by Ben Gamari at 2020-09-17T19:46:29-04:00
llvm-targets: Add i686 targets

Addresses #18422.

(cherry picked from commit 12dadd04a09c23c91d7da6f5b17ef78688d93fe7)

- - - - -
264afed3 by Krzysztof Gogolewski at 2020-09-17T19:46:29-04:00
Do not print synonyms in :i (->), :i Type (#18594)

This adds a new printing flag `sdocPrintTypeAbbreviations` that is used
specifically to avoid ghci printing 'type (->) = (->)' and 'type Type = Type'.

(cherry picked from commit 8b86509270227dbc61f0700c7d9261a4c7672361)

- - - - -
2c2ed25b by Krzysztof Gogolewski at 2020-09-17T19:46:29-04:00
Move pprTyTcApp' inside pprTyTcApp

No semantic change

(cherry picked from commit d8f61182c3bdd1b6121c83be632b4941b907de88)

- - - - -
8d0a75c6 by Takenobu Tani at 2020-09-17T19:46:29-04:00
Limit upper version of Happy for ghc-9.0 and earlier (#18620)

This patch adds the upper bound of a happy version for ghc-9.0
and earlier.

Currently, we can't use happy-1.20.0 for ghc-9.0.

See #18620.

(cherry picked from commit 84ec8daa016d07ae42f0f0f48575dd7d907d5f9d)

- - - - -
aac5417a by Ben Gamari at 2020-09-17T19:46:29-04:00
configure: Fix whitespace

(cherry picked from commit 1213fd87564ab092aa914d8633df4de07fe04905)

- - - - -
b83682c7 by Ben Gamari at 2020-09-17T19:46:29-04:00
gitlab-ci: Bump Windows toolchain version

This should have been done when we bumped the bootstrap compiler to
8.8.4.

(cherry picked from commit 566ac68de70e5b580c96e8ab8b3b02ad0f1acd42)

- - - - -
cb8610b8 by Ben Gamari at 2020-09-17T19:46:29-04:00
gitlab-ci: Drop Windows make job

These are a significant burden on our CI resources and end up failing
quite often due to #18274. Here I drop the make jobs during
validaion; it is now run only during the nightly builds.

(cherry picked from commit 72036e1c03385aa4f5ed70179ab4b154beed81cb)

- - - - -
ab244fc9 by Ben Gamari at 2020-09-17T19:46:29-04:00
testsuite: Drop Windows-specific output for parseTree

The normalise_slashes normaliser should handle this.

(cherry picked from commit 4597752ad3c031e17fe3cceb20c61e4d5b58c52f)

- - - - -
ad6cef78 by Ben Gamari at 2020-09-17T19:46:29-04:00
testsuite: Mark T5975[ab] as broken on Windows

Due to #7305.

(cherry picked from commit 5b12bb7c98529374ff8e932d0c36104d1a0fe509)

- - - - -
cc3e00cb by Ben Gamari at 2020-09-17T19:46:29-04:00
gitlab-ci: Fix typo

A small typo in a rule regular expression.

(cherry picked from commit c4fd8947f4104e7b6d6bf3d320a63a361191bde1)

- - - - -
702bd58c by Ben Gamari at 2020-09-17T19:46:29-04:00
rts: Add stg_copyArray_barrier to RtsSymbols list

It's incredible that this wasn't noticed until now.

(cherry picked from commit c2fefaf37ae134aefc4136bae7e5976f991d76f4)

- - - - -
5b0fb69f by Ryan Scott at 2020-09-17T19:46:29-04:00
Postpone associated tyfam default checks until after typechecking

Previously, associated type family defaults were validity-checked
during typechecking. Unfortunately, the error messages that these
checks produce run the risk of printing knot-tied type constructors,
which will cause GHC to diverge. In order to preserve the current
error message's descriptiveness, this patch postpones these validity
checks until after typechecking, which are now located in the new
function `GHC.Tc.Validity.checkValidAssocTyFamDeflt`.

Fixes #18648.

(cherry picked from commit 5e883375409efc2336da6295c7d81bd10b542210)

- - - - -
7d00408b by Ryan Scott at 2020-09-17T19:46:29-04:00
Don't quote argument to Hadrian's test-env flag (#18656)

Doing so causes the name of the test environment to gain an extra
set of double quotes, which changes the name entirely.

Fixes #18656.

(cherry picked from commit bc487caf830ce6cd2c03845b29416c6706185fbc)

- - - - -
8edda01f by Krzysztof Gogolewski at 2020-09-17T19:46:29-04:00
Make sure we can read past perf notes

See #18656.

(cherry picked from commit b8a9cff2ce651c085c84980d3e709db2ecda8c3f)

- - - - -
af32a4cb by Ben Gamari at 2020-09-17T19:46:29-04:00
rts: Fix erroneous usage of vsnprintf

As pointed out in #18685, this should be snprintf not vsnprintf. This
appears to be due to a cut-and-paste error.

Fixes #18658.

(cherry picked from commit 35ea92708e17c90e476167163ae24747a3f5508e)

- - - - -
efc41fcc by HaskellMouse at 2020-09-17T19:46:29-04:00
Added explicit fixity to (~).

Solves #18252

(cherry picked from commit 3c94c81629ac9159775b8b70baf2c635f0331708)

- - - - -
3309d2a2 by Ben Gamari at 2020-09-17T19:46:29-04:00
rts/nonmoving: Add missing STM write barrier

When updating a TRec for a TVar already part of a transaction we
previously neglected to add the old value to the update remembered set.
I suspect this was the cause of #18587.

(cherry picked from commit a64e94f98ca18e53ecc13f736d50b9cb2d156b05)

- - - - -
4e00ee7b by Ben Gamari at 2020-09-17T19:46:29-04:00
gitlab-ci: Use hadrian builds for Windows release artifacts

(cherry picked from commit d4bc9f0de7992f60bce403731019829f6248cc2c)

- - - - -
4ffa7d40 by Ben Gamari at 2020-09-18T08:31:56-04:00
rts: Drop field initializer on thread_basic_info_data_t

This struct has a number of fields and we only care that the value is
initialized with zeros. This eliminates the warnings noted in #17905.

(cherry picked from commit 09b91e8b95eb16fe72aef8405896fd6caf789f61)

- - - - -
e5f6188b by Zubin Duggal at 2020-09-18T08:32:37-04:00
Stop removing definitions of record fields in GHC.Iface.Ext.Ast

- - - - -
d16223fd by Alan Zimmerman at 2020-09-18T08:38:16-04:00
Api Annotations : Adjust SrcSpans for prefix bang (!).

And prefix ~

(cherry picked from commit 8dbee2c578b1f642d45561be3f416119863e01eb)
(cherry picked from commit 701463ec9998c679b03dcc848912a7ce9da9a66a)

- - - - -
23f34f7b by Alan Zimmerman at 2020-09-18T08:38:29-04:00
ApiAnnotations: Fix parser for new GHC 9.0 features

(cherry picked from commit 0f4d29cac3826392ceb26ea219fce6e8a7505107)

- - - - -
f91ea170 by Alan Zimmerman at 2020-09-20T19:25:22+01:00
API Annotations: Fix annotation for strictness

This adds the correct location for a ! or ~.

It is a reconstruction of 3ccc80ee6120db7ead579c6e9fc5c2164f3bf575,
some of which got mangled in the backport process.

- - - - -
fbdc93e7 by Ben Gamari at 2020-09-21T15:27:17-04:00
Bump Win32 submodule

- - - - -
17740c20 by Ben Gamari at 2020-09-21T15:27:17-04:00
ci.sh: Enforce minimum happy/alex versions

Also, always invoke cabal-install to ensure that happy/alex symlinks are
up-to-date.

(cherry picked from commit a89c2fbab9bcf7d769e9d27262ab29f93342f114)

Modified to use happy-1.19

- - - - -
d4d44edb by Ben Gamari at 2020-09-22T17:05:52-04:00
gitlab-ci: Ensure that cabal-install overwrites existing executables

Previously cabal-install wouldn't overwrite toolchain executables if
they already existed (as they likely would due to caching).

(cherry picked from commit 2f7ef2fb3234cdfb89b3da1298fc9c1b7381e418)

- - - - -
b1c4116d by Simon Jakobi at 2020-09-24T13:09:09-04:00
Deprecate Data.Semigroup.Option

Libraries email: https://mail.haskell.org/pipermail/libraries/2018-April/028724.html

GHC issue: https://gitlab.haskell.org/ghc/ghc/issues/15028

Corresponding PRs for deepseq:
* https://github.com/haskell/deepseq/pull/55
* https://github.com/haskell/deepseq/pull/57

Bumps the deepseq submodule.

(cherry picked from commit a90d13091ff82e954432bedd0bb20845c666eddb)

- - - - -
29fc00bc by Wander Hillen at 2020-09-24T13:11:02-04:00
Export singleton function from Data.List

Data.OldList exports a monomorphized singleton function but
it is not re-exported by Data.List. Adding the export to
Data.List causes a conflict with a 14-year old function of the
same name and type by SPJ in GHC.Utils.Misc. We can't just remove
this function because that leads to a problems when building
GHC with a stage0 compiler that does not have singleton in
Data.List yet. We also can't hide the function in GHC.Utils.Misc
since it is not possible to hide a function from a module if the
module does not export the function. To work around this, all
places where the Utils.Misc singleton was used now use a qualified
version like Utils.singleton and in GHC.Utils.Misc we are very
specific about which version we export.

(cherry picked from commit e195dae6d959e2a9b1a22a2ca78db5955e1d7dea)

- - - - -
7f418acf by Ryan Scott at 2020-09-24T13:14:46-04:00
Remove ConDeclGADTPrefixPs

This removes the `ConDeclGADTPrefixPs` per the discussion in #18517.
Most of this patch simply removes code, although the code in the
`rnConDecl` case for `ConDeclGADTPrefixPs` had to be moved around a
bit:

* The nested `forall`s check now lives in the `rnConDecl` case for
  `ConDeclGADT`.
* The `LinearTypes`-specific code that used to live in the
  `rnConDecl` case for `ConDeclGADTPrefixPs` now lives in
  `GHC.Parser.PostProcess.mkGadtDecl`, which is now monadic so that
  it can check if `-XLinearTypes` is enabled.

Fixes #18157.

(cherry picked from commit 3ea8ac774efd9ee25156f444eacf49893d48a6c9)

- - - - -
4c37274a by Ben Gamari at 2020-09-25T17:39:53-04:00
Bump Cabal, haskeline, directory, process submodules

To accomodate Win32 2.10.0.0.

- - - - -
12957a0b by Ben Gamari at 2020-09-25T17:39:53-04:00
Disable -Wdeprecations for deepseq

Use to use of Data.Semigroup.Option for NFData instance.

- - - - -
6c98a930 by Sylvain Henry at 2020-09-28T08:37:29+02:00
Bignum: refactor backend modules

* move backends into GHC.Num.Backend.*
* split backend selection into GHC.Num.Backend and
  GHC.Num.Backend.Selected to avoid duplication with the Check backend

- - - - -
74f3f581 by Sylvain Henry at 2020-09-28T08:37:29+02:00
Bignum: implement extended GCD (#18427)

- - - - -
ebcc0968 by Sylvain Henry at 2020-09-28T09:56:49+02:00
Bignum: add bigNatFromWordArray

Reimplementation of integer-gmp's byteArrayToBigNat#

- - - - -
edfa896e by Arnaud Spiwack at 2020-09-29T11:41:25-04:00
Pattern guards BindStmt always use multiplicity Many

Fixes #18439 .

The rhs of the pattern guard was consumed with multiplicity one, while
the pattern assumed it was Many. We use Many everywhere instead.

This is behaviour consistent with that of `case` expression. See #18738.

(cherry picked from commit 2707c4eae4cf99e6da2709e128f560d91e468357)

- - - - -
a64ea9d0 by Krzysztof Gogolewski at 2020-09-29T11:41:25-04:00
Disallow linear types in FFI (#18472)

(cherry picked from commit 160fba4aa306c0649c72a6dcd7c98d9782a0e74b)

- - - - -
f8d8c343 by Krzysztof Gogolewski at 2020-09-29T11:41:25-04:00
Various documentation fixes

* Remove UnliftedFFITypes from conf. Some time ago, this extension
  was undocumented and we had to silence a warning.
  This is no longer needed.
* Use r'' in conf.py. This fixes a Sphinx warning:
  WARNING: Support for evaluating Python 2 syntax is deprecated and will be removed in Sphinx 4.0. Convert docs/users_guide/conf.py to Python 3 syntax.
* Mark GHCForeignImportPrim as documented
* Fix formatting in template_haskell.rst
* Remove 'recursive do' from the list of unsupported items in TH

(cherry picked from commit 83407ffc7acc00cc025b9f6ed063add9ab9f9bcc)

- - - - -
90fe5cff by Krzysztof Gogolewski at 2020-09-29T11:41:25-04:00
Fix handling of function coercions (#18747)

This was broken when we added multiplicity to the function type.

(cherry picked from commit e124f2a7d9a5932a4c2383fd3f9dd772b2059885)

- - - - -
93df442a by Krzysztof Gogolewski at 2020-09-30T01:05:27+03:00
Linear types: fix kind inference when checking datacons

(cherry picked from b31a3360e2ef12f3ec7eaf66b3600247c1eb36c3)

- - - - -
7c7bd94d by Vladislav Zavialov at 2020-09-30T01:06:07+03:00
New linear types syntax: a %p -> b (#18459)

Implements GHC Proposal #356

Updates the haddock submodule.

(cherry-picked from 5830a12c46e7227c276a8a71213057595ee4fc04)

- - - - -
d5e13ceb by Vladislav Zavialov at 2020-10-02T01:39:25+03:00
Fix pretty-printing of the mult-polymorphic arrow

(cherry-picked from a8018c17747342444c67eeec21a506c89c1110e8)

- - - - -
89a00150 by Sylvain Henry at 2020-10-05T10:32:31+02:00
Bignum: add integerNegate RULE

- - - - -
175d7141 by Sylvain Henry at 2020-10-05T10:32:38+02:00
Bignum: implement integerRecipMod (#18427)

- - - - -
5d414fdc by Sylvain Henry at 2020-10-05T10:32:43+02:00
Bignum: implement integerPowMod (#18427)

Incidentally fix powModInteger which was crashing in integer-gmp for
negative exponents when the modular multiplicative inverse for the base
didn't exist. Now we compute it explicitly with integerRecipMod so that
every backend returns the same result without crashing.

- - - - -
b936c542 by MaxGabriel at 2020-10-12T14:19:41+02:00
Document -Wderiving-typeable

Tracking: #18641
(cherry picked from commit 73d2521688bd1da4b6bd1202e5325a00cb410a44)

- - - - -
c073a4ab by Hécate at 2020-10-12T14:20:47+02:00
Remove the list of loaded modules from the ghci prompt

(cherry picked from commit 086ef01813069fad84cafe81cab37527d41c8568)

- - - - -
aff164bc by Benjamin Maurer at 2020-10-12T14:21:51+02:00
Workaround for #18623: GHC crashes bc. under rlimit for vmem it will reserve
_all_ of it, leaving nothing for, e.g., thread stacks.
Fix will only allocate 2/3rds and check whether remainder is at least large
enough for minimum amount of thread stacks.

(cherry picked from commit 74c797f6b72c4d01f5e0092dfac1461f3f3dd7a2)

- - - - -
44779899 by Krzysztof Gogolewski at 2020-10-12T14:22:35+02:00
Add a flag to indicate that gcc supports -no-pie

Fixes #17919.

(cherry picked from commit e48cab2a57f2342891f985bcb44817e17e985275)

- - - - -
ba446875 by Krzysztof Gogolewski at 2020-10-12T14:23:25+02:00
Fix linear types in TH splices (#18465)

(cherry picked from commit 802b5e6fdd6dfc58396a9dca1903dc5a1d6634ca)

- - - - -
b10154d6 by Icelandjack at 2020-10-12T14:25:47+02:00
Replaced MkT1 with T1 in type signatures.

(cherry picked from commit b81350bb925f8cb309355ee46238dbc11b796faf)

- - - - -
baa55369 by Krzysztof Gogolewski at 2020-10-12T14:26:12+02:00
Linear types: fix quantification in GADTs (#18790)

(cherry picked from commit 22f218b729a751bc5e5965624a716fc542f502a5)

- - - - -
146cff70 by Alan Zimmerman at 2020-10-12T14:27:02+02:00
Preserve as-parsed arrow type for HsUnrestrictedArrow

When linear types are disabled, HsUnrestrictedArrow is treated as
HslinearArrow.

Move this adjustment into the type checking phase, so that the parsed
source accurately represents the source as parsed.

Closes #18791

(cherry picked from commit d6dff830754a97220eacf032c32cd54b18654917)

- - - - -
8c370e11 by Alan Zimmerman at 2020-10-12T14:27:30+02:00
ApiAnnotations : preserve parens in GADTs

A cleanup in 7f418acf61e accidentally discarded some parens in
ConDeclGADT.

Make sure these stay in the AST in a usable format.

Also ensure the AnnLolly does not get lost in a GADT.

(cherry picked from commit 36787bba78ae5acbb857c84b85b8feb7c83e54a5)

- - - - -
15c4eb1f by Krzysztof Gogolewski at 2020-10-12T14:28:15+02:00
Linear types: fix roles in GADTs (#18799)

(cherry picked from commit 8fafb304cacae69f8dbbdcf22ab858a5b28b6818)

- - - - -
a740aa0b by Sylvain Henry at 2020-10-12T15:10:13+02:00
Bignum: match on small Integer/Natural

Previously we only matched on *variables* whose unfoldings were a ConApp
of the form `IS lit#` or `NS lit##`. But we forgot to match on the
ConApp directly... As a consequence, constant folding only worked after
the FloatOut pass which creates bindings for most sub-expressions. With
this patch, matching on bignums works even with -O0 (see bignumMatch
test).

- - - - -
d09e7e41 by Sylvain Henry at 2020-10-12T15:10:30+02:00
Bignum: fix bigNatCompareWord# bug (#18813)

(cherry picked from commit 74ee1237bf243dd7d8b758a53695575c364c3088)

- - - - -
7e257575 by Simon Peyton Jones at 2020-10-13T23:35:26+02:00
Care with implicit-parameter superclasses

Two bugs, #18627 and #18649, had the same cause: we were not
account for the fact that a constaint tuple might hide an implicit
parameter.

The solution is not hard: look for implicit parameters in
superclasses.  See Note [Local implicit parameters] in
GHC.Core.Predicate.

Then we use this new function in two places

* The "short-cut solver" in GHC.Tc.Solver.Interact.shortCutSolver
  which simply didn't handle implicit parameters properly at all.
  This fixes #18627

* The specialiser, which should not specialise on implicit parameters
  This fixes #18649

There are some lingering worries (see Note [Local implicit
parameters]) but things are much better.

(cherry picked from commit c7182a5c67fe8b5bd256cb8eb805562636853ea2)

- - - - -
9060a9dd by Ben Gamari at 2020-10-13T23:36:56+02:00
sdist: Include hadrian sources in source distribution

Previously the make build system's source distribution rules neglected
to include Hadrian's sources.

Fixes #18794.

(cherry picked from commit 9657f6f34a1a00008a0db935dbf25733cb483cd4)

- - - - -
fb5eb8ab by Simon Peyton Jones at 2020-10-13T23:37:29+02:00
Fix desugaring of record updates on data families

This fixes a long-standing bug in the desugaring of record
updates for data families, when the latter involves a GADT. It's
all explained in Note [Update for GADTs] in GHC.HsToCore.Expr.

Building the correct cast is surprisingly tricky, as that Note
explains.

Fixes #18809.  The test case (in indexed-types/should_compile/T18809)
contains several examples that exercise the dark corners.

(cherry picked from commit bfdccac6acce84e15292a454d12f4e0d87ef6f10)

- - - - -
64ab97bf by Krzysztof Gogolewski at 2020-10-13T23:39:06+02:00
Add -pgmlm and -optlm flags

!3798 added documentation and semantics for the flags,
but not parsing.

(cherry picked from commit fd302e938ebf48c73d9f715d67ce8cd990f972ff)

- - - - -
b1a2c5e4 by Tamar Christina at 2020-10-16T10:21:20-04:00
winio: add release note

- - - - -
51b09fe4 by Alan Zimmerman at 2020-10-21T23:53:56-04:00
API Annotations: Keep track of unicode for linear arrow notation

The linear arrow can be parsed as `%1 ->` or a direct single token unicode
equivalent.

Make sure that this distinction is captured in the parsed AST by using
IsUnicodeSyntax where it appears, and introduce a new API Annotation,
AnnMult to represent its location when unicode is not used.

Updated haddock submodule

(cherry picked from commit ea736839d85594c95490dcf02d3325c2bbc68f33)

- - - - -
5a2400c6 by Viktor Dukhovni at 2020-10-23T20:51:00-04:00
Naming, value types and tests for Addr# atomics

The atomic Exchange and CAS operations on integral types are updated to
take and return more natural `Word#` rather than `Int#` values.  These
are bit-block not arithmetic operations, and the sign bit plays no
special role.

Standardises the names to `atomic<OpType><ValType>Addr#`, where `OpType` is one
of `Cas` or `Exchange` and `ValType` is presently either `Word` or `Addr`.
Eventually, variants for `Word32` and `Word64` can and should be added,
once #11953 and related issues (e.g. #13825) are resolved.

Adds tests for `Addr#` CAS that mirror existing tests for
`MutableByteArray#`.

- - - - -
7644d85c by Moritz Angermann at 2020-10-30T10:59:36-04:00
[macOS] improved runpath handling

In b592bd98ff25730bbe3c13d6f62a427df8c78e28 we started using
-dead_strip_dylib on macOS when lining dynamic libraries and binaries.
The underlying reason being the Load Command Size Limit in macOS
Sierra (10.14) and later.

GHC will produce @rpath/libHS... dependency entries together with a
corresponding RPATH entry pointing to the location of the libHS...
library. Thus for every library we produce two Load Commands.  One to
specify the dependent library, and one with the path where to find it.
This makes relocating libraries and binaries easier, as we just need to
update the RPATH entry with the install_name_tool. The dynamic linker
will then subsitute each @rpath with the RPATH entries it finds in the
libraries load commands or the environement, when looking up @rpath
relative libraries.

-dead_strip_dylibs intructs the linker to drop unused libraries. This in
turn help us reduce the number of referenced libraries, and subsequently
the size of the load commands.  This however does not remove the RPATH
entries.  Subsequently we can end up (in extreme cases) with only a
single @rpath/libHS... entry, but 100s or more RPATH entries in the Load
Commands.

This patch rectifies this (slighly unorthodox) by passing *no* -rpath
arguments to the linker at link time, but -headerpad 8000.  The
headerpad argument is in hexadecimal and the maxium 32k of the load
command size.  This tells the linker to pad the load command section
enough for us to inject the RPATHs later.  We then proceed to link the
library or binary with -dead_strip_dylibs, and *after* the linking
inspect the library to find the left over (non-dead-stripped)
dependencies (using otool).  We find the corresponding RPATHs for each
@rpath relative dependency, and inject them into the library or binary
using the install_name_tool.  Thus achieving a deadstripped dylib (and
rpaths) build product.

We can not do this in GHC, without starting to reimplement a dynamic
linker as we do not know which symbols and subsequently libraries are
necessary.

Commissioned-by: Mercury Technologies, Inc. (mercury.com)
(cherry picked from commit 89a753308deb2c7ed012e875e220b1d39e1798d8)
Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
3d7f5ec8 by Alan Zimmerman at 2020-11-01T11:45:02-05:00
Api Annotations: Introduce AnnPercent for HsExplicitMult

For the case

  foo :: a %p -> b

The location of the '%' is captured, separate from the 'p'

(cherry picked from commit c15b5f25ad54164c951e797ecbd10d0df1cf4ba6)

- - - - -
bba8f79c by Sylvain Henry at 2020-11-09T11:10:17-05:00
Bignum: make GMP's bignat_add not recursive

bignat_add was a loopbreaker with an INLINE pragma (spotted by
@mpickering). This patch makes it non recursive to avoid the issue.

(cherry picked from commit bff74de713dac3e62c3bb6f1946e0649549f2215)

- - - - -
ed1699b2 by Tamar Christina at 2020-11-09T11:11:52-05:00
winio: Fix unused variables warnings

(cherry picked from commit cb1f755c6fb77f140aee11fdc7b4da04dd5dcd02)

- - - - -
0736b4e3 by Simon Peyton Jones at 2020-11-09T11:13:57-05:00
Fix two constraint solving problems

This patch fixes two problems in the constraint solver.

* An actual bug #18555: we were floating out a constraint to eagerly,
  and that was ultimately fatal.  It's explained in
  Note [Do not float blocked constraints] in GHC.Core.Constraint.

  This is all very delicate, but it's all going to become irrelevant
  when we stop floating constraints (#17656).

* A major performance infelicity in the flattener.  When flattening
  (ty |> co) we *never* generated Refl, even when there was nothing
  at all to do.  Result: we would gratuitously rewrite the constraint
  to exactly the same thing, wasting work.  Described in #18413, and
  came up again in #18855.

  Solution: exploit the special case by calling the new function
  castCoercionKind1.  See Note [castCoercionKind1] in
  GHC.Core.Coercion

(cherry picked from commit 0b3d23afcad8bc14f2ba69b8dbe05c314e6e7b29)

- - - - -
6c1cf280 by Tamar Christina at 2020-11-09T11:17:24-05:00
winio: simplify logic remove optimization step.

(cherry picked from commit 412018c1214a19649e0ccfff73e80a0622635dd5)

- - - - -
e49c8923 by David Beacham at 2020-11-09T14:15:13-05:00
Fix `instance Bounded a => Bounded (Down a)` (#18716)

* Flip `minBound` and `maxBound` to respect the change in ordering
* Remove awkward `Enum` (and hence `Integral`) instances for
  `Data.Ord.Down`
* Update changelog

(cherry picked from commit 9ad51bc9d2ad9168abad271f715ce73d3562218a)

- - - - -
fb544de7 by Sylvain Henry at 2020-11-09T14:15:15-05:00
Fix parsing of PIE flags

-fPIE and -fno-PIE flags were (un)setting Opt_PIC instead of Opt_PIE.

Original commit: 3625728a0e3a9b56c2b85ae7ea8bcabdd83ece6a

(cherry picked from commit 17d2f0a886f9f56ea408d2dd8b7f054021da19a4)

- - - - -
fa671e75 by Vladislav Zavialov at 2020-11-09T14:15:15-05:00
Fix PostfixOperators (#18151)

This fixes a regression introduced in 2b89ca5b850b4097447cc4908cbb0631011ce979
See the new T18151x test case.

(cherry picked from commit bf2411a3c198cb2df93a9e0aa0c3b8297f47058d)

- - - - -
e5f73b99 by Ben Gamari at 2020-11-09T14:15:15-05:00
Bump win32-tarballs version to 0.3

This should fix #18774.

(cherry picked from commit e5c7c9c8578de1248826c21ebd08e475d094a552)

- - - - -
063d174f by Ben Gamari at 2020-11-09T14:15:15-05:00
mingw: Extract zst toolchain archives

This should have been done when the toolchain was bumped.

(cherry picked from commit a848d52748c09a27ed5bef0fb039c51656bebdf1)

- - - - -
da266403 by Tamar Christina at 2020-11-09T14:15:15-05:00
winio: fixed bytestring reading interface.

(cherry picked from commit 0fd3d360cab977e00fb6d90d0519962227b029bb)

- - - - -
c4fa35fa by Tamar Christina at 2020-11-09T14:15:15-05:00
winio: fixed more data error.

(cherry picked from commit dfaef1cae7a4a0cb8783933274dae7f39d7165a0)

- - - - -
556c2356 by Tamar Christina at 2020-11-09T14:15:15-05:00
winio: fix array splat

(cherry picked from commit 6f0243ae5b359124936a8ff3dd0a287df3d7aca2)

- - - - -
c3a8c0bf by Tamar Christina at 2020-11-09T14:15:16-05:00
winio: fixed timeouts non-threaded.

(cherry picked from commit c832f7e2a9314cfd61257cb161b1795b612d12b5)

- - - - -
e615aa85 by Andreas Klebinger at 2020-11-09T14:15:16-05:00
NCG: Fix 64bit int comparisons on 32bit x86

We no compare these by doing 64bit subtraction and
checking the resulting flags.

We used to do this differently but the old approach was
broken when the high bits compared equal and the comparison
was one of >= or <=.

The new approach should be both correct and faster.

(cherry picked from commit bb100805337adc666867da300ee5b0b11c18fe00)

- - - - -
25a24e5d by Alan Zimmerman at 2020-11-09T14:15:16-05:00
Restrict Linear arrow %1 to exactly literal 1 only

This disallows `a %001 -> b`, and makes sure the type literal is
printed from its SourceText so it is clear why.

Closes #18888

(cherry picked from commit 616bec0dee67ae4841c4e60e9406cc9c63358223)

- - - - -
2b3af303 by Ben Gamari at 2020-11-09T14:15:16-05:00
rts: Add __mingw_vfprintf to RtsSymbols.c

Following the model of the other printf symbols. See Note [Symbols for
MinGW's printf].

(cherry picked from commit 6434c2e35122886ad28a861cb857fa47bcc7e82d)

- - - - -
06e7aed0 by Ben Gamari at 2020-11-09T14:15:16-05:00
testsuite: Account for -Wnoncanonical-monoid-instances changes on Windows

(cherry picked from commit d76224c29a78ab962d86b9a1a92cde73e41b6479)

- - - - -
918157d5 by Ben Gamari at 2020-11-09T19:17:08-05:00
testsuite: Update output for T18888_datakinds

- - - - -
7fcca77f by Ben Gamari at 2020-11-09T19:17:13-05:00
testsuite: Update output for T12427a

- - - - -
c94c56d5 by Sylvain Henry at 2020-11-10T11:04:03-05:00
Export SPEC from GHC.Exts (#13681)

(cherry picked from commit 4c407f6e71f096835f8671e2d3ea6bda38074314)

- - - - -
d4483f7b by Ben Gamari at 2020-11-14T06:49:57-05:00
rts/linker: Fix relocation overflow in PE linker

Previously the overflow check for the IMAGE_REL_AMD64_ADDR32NB
relocation failed to account for the signed nature of the value.
Specifically, the overflow check was:

    uint64_t v;
    v = S + A;
    if (v >> 32) { ... }

However, `v` ultimately needs to fit into 32-bits as a signed value.
Consequently, values `v > 2^31` in fact overflow yet this is not caught
by the existing overflow check.

Here we rewrite the overflow check to rather ensure that
`INT32_MIN <= v <= INT32_MAX`. There is now quite a bit of repetition
between the `IMAGE_REL_AMD64_REL32` and `IMAGE_REL_AMD64_ADDR32` cases
but I am leaving fixing this for future work.

This bug was first noticed by @awson.

Fixes #15808.

(cherry picked from commit 6d21ecee535782f01dba9947a49e282afee25724)

- - - - -
08d75467 by Ben Gamari at 2020-11-24T12:03:00-05:00
SMP.h: Add C11-style atomic operations

- - - - -
9f6d3341 by Ben Gamari at 2020-11-24T12:03:00-05:00
rts: Infrastructure for testing with ThreadSanitizer

- - - - -
8b5e7dc7 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts/CNF: Initialize all bdescrs in group

It seems wise and cheap to ensure that the whole bdescr of all blocks of
a compact group is valid, even if most cases only look at the flags
field.

- - - - -
67c0f410 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts/Capability: Intialize interrupt field

Previously this was left uninitialized.

Also clarify some comments.

- - - - -
829a72cd by Ben Gamari at 2020-11-24T12:03:01-05:00
rts/Task: Make comments proper Notes

- - - - -
c19ee6d5 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts/SpinLock: Move to proper atomics

This is fairly straightforward; we just needed to use relaxed operations
for the PROF_SPIN counters and a release store instead of a write
barrier.

- - - - -
5ed8139a by Ben Gamari at 2020-11-24T12:03:01-05:00
rts/OSThreads: Fix data race

Previously we would race on the cached processor count. Avoiding this is
straightforward; just use relaxed operations.

- - - - -
3c35c588 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts/ClosureMaros: Use relaxed atomics

- - - - -
83e759a7 by Ben Gamari at 2020-11-24T12:03:01-05:00
configure: Bump minimum-supported gcc version to 4.7

Since the __atomic_* builtins are not supported until gcc 4.7. Given
that this version was released in 2012 I think this is acceptable.

- - - - -
7d846a79 by Ben Gamari at 2020-11-24T12:03:01-05:00
testsuite: Fix thread leak in hs_try_putmvar00[13]

- - - - -
37886925 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts: Introduce SET_HDR_RELEASE

Also ensure that we also store the info table pointer last to ensure
that the synchronization covers all stores.

- - - - -
5541b8ea by Ben Gamari at 2020-11-24T12:03:01-05:00
rts: Factor out logic to identify a good capability for running a task

Not only does this make the control flow a bit clearer but it also
allows us to add a TSAN suppression on this logic, which requires
(harmless) data races.

- - - - -
12c8702a by Ben Gamari at 2020-11-24T12:03:01-05:00
rts: Annotate benign race in waitForCapability

- - - - -
3eb46f2e by Ben Gamari at 2020-11-24T12:03:01-05:00
rts: Clarify locking behavior of releaseCapability_

- - - - -
e052a812 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts: Add assertions for task ownership of capabilities

- - - - -
2b1da3d8 by Ben Gamari at 2020-11-24T12:03:01-05:00
rts: Use relaxed atomics on n_returning_tasks

This mitigates the warning of a benign race on n_returning_tasks in
shouldYieldCapability.

See #17261.

- - - - -
053d3c5b by Ben Gamari at 2020-11-24T12:03:02-05:00
rts: Mitigate races in capability interruption logic

- - - - -
7ebad34c by Ben Gamari at 2020-11-24T12:03:02-05:00
rts/Capability: Use relaxed operations for last_free_capability

- - - - -
67716ed3 by Ben Gamari at 2020-11-24T12:03:02-05:00
rts: Use relaxed operations for cap->running_task (TODO)

This shouldn't be necessary since only the owning thread of the capability
should be touching this.

- - - - -
5615aac8 by Ben Gamari at 2020-11-24T12:03:02-05:00
rts/Schedule: Use relaxed operations for sched_state

- - - - -
677988d5 by Ben Gamari at 2020-11-24T12:03:02-05:00
rts: Accept data race in work-stealing implementation

This race is okay since the task is owned by the capability pushing it.
By Note [Ownership of Task] this means that the capability is free to
write to `task->cap` without taking `task->lock`.

Fixes #17276.

- - - - -
7ce38423 by Ben Gamari at 2020-11-24T12:03:02-05:00
rts: Eliminate data races on pending_sync

- - - - -
05f59c23 by Ben Gamari at 2020-11-24T12:03:02-05:00
rts/Schedule: Eliminate data races on recent_activity

We cannot safely use relaxed atomics here.

- - - - -
6417288c by Ben Gamari at 2020-11-24T12:03:02-05:00
rts: Avoid data races in message handling

- - - - -
dba1771b by Ben Gamari at 2020-11-24T12:03:02-05:00
rts/Messages: Drop incredibly fishy write barrier

executeMessage previously had a write barrier at the beginning of its
loop apparently in an attempt to synchronize with another thread's
writes to the Message. I would guess that the author had intended to use
a load barrier here given that there are no globally-visible writes done
in executeMessage.

I've removed the redundant barrier since the necessary load barrier is
now provided by the ACQUIRE_LOAD.

- - - - -
1727bc57 by Ben Gamari at 2020-11-24T12:03:02-05:00
rts/ThreadPaused: Avoid data races

- - - - -
3e36d9ee by Ben Gamari at 2020-11-24T12:03:02-05:00
rts/Schedule: Eliminate data races in run queue management

- - - - -
7b856fcd by Ben Gamari at 2020-11-24T12:03:03-05:00
rts: Eliminate shutdown data race on task counters

- - - - -
04a19bfc by Ben Gamari at 2020-11-24T12:03:03-05:00
rts/Threads: Avoid data races (TODO)

Replace barriers with appropriate ordering. Drop redundant barrier in
tryWakeupThread (the RELEASE barrier will be provided by sendMessage's
mutex release).

We use relaxed operations on why_blocked and the stack although it's not
clear to me why this is necessary.

- - - - -
1f5dded6 by Ben Gamari at 2020-11-24T12:03:03-05:00
rts/Messages: Annotate benign race

- - - - -
852eb2cc by Ben Gamari at 2020-11-24T12:03:03-05:00
rts/RaiseAsync: Synchronize what_next read

- - - - -
d9b6eb31 by Ben Gamari at 2020-11-24T12:03:03-05:00
rts/Task: Move debugTrace to avoid data race

Specifically, we need to hold all_tasks_mutex to read taskCount.

- - - - -
1bcc9cd0 by Ben Gamari at 2020-11-24T12:03:03-05:00
Disable flawed assertion

- - - - -
2e76a631 by Ben Gamari at 2020-11-24T12:03:03-05:00
Document schedulePushWork race

- - - - -
718a46db by Ben Gamari at 2020-11-24T12:03:03-05:00
Capabiliity: Properly fix data race on n_returning_tasks

There is a real data race but can be made safe by using proper atomic
(but relaxed) accesses.

- - - - -
588a950b by Ben Gamari at 2020-11-24T12:03:03-05:00
rts: Make write of to_cap->inbox atomic

This is necessary since emptyInbox may read from to_cap->inbox without
taking cap->lock.

- - - - -
853ef5e1 by Ben Gamari at 2020-11-24T12:03:03-05:00
gitlab-ci: Add nightly-x86_64-linux-deb9-tsan job

- - - - -
5bcda8ba by GHC GitLab CI at 2020-11-24T12:03:03-05:00
testsuite: Mark setnumcapabilities001 as broken with TSAN

Due to #18808.

- - - - -
e78d90e3 by GHC GitLab CI at 2020-11-24T12:03:03-05:00
testsuite: Skip divbyzero and derefnull under TSAN

ThreadSanitizer changes the output of these tests.

- - - - -
a99f05ef by Ben Gamari at 2020-11-24T12:03:03-05:00
testsuite: Skip high memory usage tests with TSAN

ThreadSanitizer significantly increases the memory footprint of tests,
so much so that it can send machines into OOM.

- - - - -
02d2e42b by Ben Gamari at 2020-11-24T12:03:04-05:00
testsuite: Mark hie002 as high_memory_usage

This test has a peak residency of 1GByte; this is large enough to
classify as "high" in my book.

- - - - -
fba38edf by Ben Gamari at 2020-11-24T12:03:04-05:00
testsuite: Mark T9872[abc] as high_memory_usage

These all have a maximum residency of over 2 GB.

- - - - -
0215ff52 by Ben Gamari at 2020-11-24T12:03:04-05:00
gitlab-ci: Disable documentation in TSAN build

Haddock chews through enough memory to cause the CI builders to OOM and
there's frankly no reason to build documentation in this job anyways.

- - - - -
e191eb78 by Ben Gamari at 2020-11-24T12:03:04-05:00
TSANUtils: Ensure that C11 atomics are supported

- - - - -
a31bccca by Ben Gamari at 2020-11-24T12:03:04-05:00
testsuite: Mark T3807 as broken with TSAN

Due to #18883.

- - - - -
7aba9e54 by Ben Gamari at 2020-11-24T12:03:04-05:00
testsuite: Mark T13702 as broken with TSAN due to #18884

- - - - -
23a30a3b by Ben Gamari at 2020-11-24T12:03:04-05:00
rts/BlockAlloc: Use relaxed operations

- - - - -
4139b672 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts: Rework handling of mutlist scavenging statistics

- - - - -
33b7b375 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts: Avoid data races in StablePtr implementation

This fixes two potentially problematic data races in the StablePtr
implementation:

 * We would fail to RELEASE the stable pointer table when enlarging it,
   causing other cores to potentially see uninitialized memory.

 * We would fail to ACQUIRE when dereferencing a stable pointer.

- - - - -
725dfd75 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts/Storage: Use atomics

- - - - -
240bb1b4 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts/Updates: Use proper atomic operations

- - - - -
b7b0f3ae by Ben Gamari at 2020-11-24T12:03:04-05:00
rts/Weak: Eliminate data races

By taking all_tasks_mutex in stat_exit. Also better-document the fact
that the task statistics are protected by all_tasks_mutex.

- - - - -
20787589 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts/GC: Use atomics

- - - - -
b15db127 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts: Use RELEASE ordering in unlockClosure

- - - - -
49c8049e by Ben Gamari at 2020-11-24T12:03:04-05:00
rts/Storage: Accept races on heap size counters

- - - - -
89864d46 by Ben Gamari at 2020-11-24T12:03:04-05:00
rts: Join to concurrent mark thread during shutdown

Previously we would take all capabilities but fail to join on the thread
itself, potentially resulting in a leaked thread.

- - - - -
31669bd3 by GHC GitLab CI at 2020-11-24T12:03:04-05:00
rts: Fix race in GC CPU time accounting

Ensure that the GC leader synchronizes with workers before calling
stat_endGC.

- - - - -
7e968942 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts/SpinLock: Separate out slow path

Not only is this in general a good idea, but it turns out that GCC
unrolls the retry loop, resulting is massive code bloat in critical
parts of the RTS (e.g. `evacuate`).

- - - - -
acef7fd3 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Use relaxed ordering on spinlock counters

- - - - -
53920304 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Annotate hopefully "benign" races in freeGroup

- - - - -
0ca2beeb by Ben Gamari at 2020-11-24T12:03:05-05:00
Strengthen ordering in releaseGCThreads

- - - - -
7d3d0f13 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts/WSDeque: Rewrite with proper atomics

After a few attempts at shoring up the previous implementation, I ended
up turning to the literature and now use the proven implementation,

> N.M. Lê, A. Pop, A.Cohen, and F.Z. Nardelli. "Correct and Efficient
> Work-Stealing for Weak Memory Models". PPoPP'13, February 2013,
> ACM 978-1-4503-1922/13/02.

Note only is this approach formally proven correct under C11 semantics
but it is also proved to be a bit faster in practice.

- - - - -
c29b1a83 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Use relaxed atomics for whitehole spin stats

- - - - -
55b252f2 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Avoid lock order inversion during fork

Fixes #17275.

- - - - -
d9e82a56 by GHC GitLab CI at 2020-11-24T12:03:05-05:00
rts: Use proper relaxe operations in getCurrentThreadCPUTime

Here we are doing lazy initialization; it's okay if we do the check more
than once, hence relaxed operation is fine.

- - - - -
d9ed5a62 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts/STM: Use atomics

This fixes a potentially harmful race where we failed to synchronize
before looking at a TVar's current_value.

Also did a bit of refactoring to avoid abstract over management of
max_commits.

- - - - -
219f6496 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts/stm: Strengthen orderings to SEQ_CST instead of volatile

Previously the `current_value`, `first_watch_queue_entry`, and
`num_updates` fields of `StgTVar` were marked as `volatile` in an
attempt to provide strong ordering. Of course, this isn't sufficient.

We now use proper atomic operations. In most of these cases I strengthen
the ordering all the way to SEQ_CST although it's possible that some
could be weakened with some thought.

- - - - -
cf99c5e5 by Ben Gamari at 2020-11-24T12:03:05-05:00
Mitigate data races in event manager startup/shutdown

- - - - -
d7655654 by Ben Gamari at 2020-11-24T12:03:05-05:00
Suppress data race due to close

This suppresses the other side of a race during shutdown.

- - - - -
389c92df by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Accept benign races in Proftimer

- - - - -
b4ced846 by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Pause timer while changing capability count

This avoids #17289.

- - - - -
9116b39a by Ben Gamari at 2020-11-24T12:03:05-05:00
Fix #17289

- - - - -
75b8c066 by Ben Gamari at 2020-11-24T12:03:05-05:00
suppress #17289 (ticker) race

- - - - -
dcea5aef by Ben Gamari at 2020-11-24T12:03:05-05:00
rts: Fix timer initialization

Previously `initScheduler` would attempt to pause the ticker and in so
doing acquire the ticker mutex. However, initTicker, which is
responsible for initializing said mutex, hadn't been called
yet.

- - - - -
16d3ea21 by Ben Gamari at 2020-11-24T12:03:06-05:00
rts: Fix races in Pthread timer backend shudown

We can generally be pretty relaxed in the barriers here since the timer
thread is a loop.

- - - - -
da69341b by Ben Gamari at 2020-11-24T12:03:06-05:00
rts/Stats: Hide a few unused unnecessarily global functions

- - - - -
f65a5c9e by Ben Gamari at 2020-11-24T12:03:06-05:00
rts/Stats: Protect with mutex

While on face value this seems a bit heavy, I think it's far better than
enforcing ordering on every access.

- - - - -
543ad4f3 by Ben Gamari at 2020-11-24T12:03:06-05:00
rts: Tear down stats_mutex after exitHeapProfiling

Since the latter wants to call getRTSStats.

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/test-metrics.sh
- CODEOWNERS
- aclocal.m4
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Lint.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Node.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Sink.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Cond.hs
- compiler/GHC/Core/Class.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Multiplicity.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Driver.hs → compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2288ddd4f953c1c692f523b5418ac0ce59cf43d0...543ad4f3f8320c17be0029078a1cbe832f5b6f56

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2288ddd4f953c1c692f523b5418ac0ce59cf43d0...543ad4f3f8320c17be0029078a1cbe832f5b6f56
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/20201124/ad46bd52/attachment-0001.html>


More information about the ghc-commits mailing list