Optimise atomicModifyIORef' implementation (#8345)

This forces the new value before installing it in the IORef.

This optimisation was originally suggested by Patrick Palka
and "exhibits a speedup of 1.7x (vanilla RTS) / 1.4x (threaded RTS)"
according to #8345

Reviewed By: austin, simonmar

Differential Revision: https://phabricator.haskell.org/D315
Un-wire `Integer` type (re #9714)

Integer is currently a wired-in type for integer-gmp. This requires
replicating its inner structure in `TysWiredIn`, which makes it much
harder to change Integer to a more complex representation (as
e.g. needed for implementing #9281)

This commit stops `Integer` being a wired-in type, and makes it
known-key type instead, thereby simplifying code notably.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D351
Deactivate T3064 `max_bytes_used`-check

Summary:
T3064 is deactivated for now because it's currently too volatile
and causes too much noise in Phabricator's CI

C.f. 4805abf413c02a2ed1af4fbeca2476590e984e37

Reviewers: austin

Subscribers: thomie, carter, ezyang, simonmar

Differential Revision: https://phabricator.haskell.org/D381
Improve performance of isSuffixOf (#9676)

The new implementation avoids reversing the "haystack" list, which can be
very expensive.

Reviewed By: ekmett

Differential Revision: https://phabricator.haskell.org/D330
Typo in comment
Normalise package key hash to make tests less fragile.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Add n-ary version of `two_normalisers` to testsuite lib

This is more readable than nesting `two_normalisers()`-invocations
testlib: Get rid of two_normalisers

And make normalise_fun polyvariadic. After all, this is untyped code, so
lets make use of it :-)
Make iterateFB inlineable

When investigating a case of unexpected Call Arity failure I noticed
that iterateFB would not inline as far as desired, as it is recursive.

This patch makes it non-recursive (with a local go), which seem so do
great good.
base: Refactor/clean-up *List modules

This gets rid of all hand-unboxing in `GHC.List` and moves `Foldable`
requirements from `Data.OldList` into `GHC.List` (preparatory work for
addressing #9716).  Specifically, this moves the definition of
`maximum`, `minimum`, `foldl'`, `foldl1`, `foldl1'`, `sum`, and
`product` into `GHC.List` (which now needs to import `GHC.Num`)

Make `take`, `drop`, `length`, and `!!` generally saner (see also #9510)

Performance overall seems minimally affected. Some things go up; some
things go down; nothing moves horribly much. The code is much easier to
read.

Differential Revision: https://phabricator.haskell.org/D380
Reorder GHC.List; fix performance regressions

Rearrange some oddly placed code.

Modify `take` to make the fold unconditionally strict in the passed
`Int`. This clears up the `fft2` regression.
This fixes #9740. Differential Revision: https://phabricator.haskell.org/D390
Update Haddock submodule for collapsible section support

This also updates a few occurences of recently added "Example"
headings to make use of this new feature for testing
Really fix fft2 regression. #9740

Rewrite `take` more aggressively for fusion. Add some more explicit
strictness to `unsafeTake` and `unsafeDrop` that seems to help code size and
allocation just a drop in some nofib tests. They were not previously
strict in their numerical arguments, but always called in contexts where
those had been forced; it didn't make a difference in simple test cases,
but made a small difference for nofib. See #9740.

Differential Revision: https://phabricator.haskell.org/D394
Fixed unused variable warning on mingw32/i686 in rts/Linker.c

The warning was breaking validate.sh runs due to -Wall.

Reviewers: austin

Reviewed By: austin

Subscribers: #ghc_windows_task_force, thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D400
hsc2hs: Update submodule

This makes sure the --cross-compile mode can handle negative enum
values.

Differential Revision: https://phabricator.haskell.org/D301

Signed-off-by: Austin Seipp <austin@well-typed.com>
Convert GHCi sources from .lhs to .hs

Summary: Signed-off-by: Rodlogic <admin@rodlogic.net>

Test Plan: Does it compile?

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D319
Fix #9236 Error on read from closed handle

Summary:
Fixes #9236. My testing indicates that this does *not* lead to problems with
broken pipes and such, but further testing is required. It found
a bug in haddock; I've submitted a pull request upstream.

Reviewers: ekmett, austin

Reviewed By: ekmett, austin

Subscribers: rwbarton, thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D327

GHC Trac Issues: #9236
Use snwprintf instead of swprintf in rts/Linker.c.

Summary:
swprintf has different signatures in mingw32, where it does not include the
buffer size, and in mingw-w64, where it does. That of course breaks the code
as mingw-w64 treats the pointer to the format string as a size_t.

snwprintf is available in both environments and is consistent, so use that
instead.

Reviewers: simonmar, austin

Reviewed By: austin

Subscribers: #ghc_windows_task_force, thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D372

GHC Trac Issues: #9726
Avoid setting -Werror=unused-but-set-variable on Windows.

Summary:
The option is not needed (it was only intended to override Debian's default)
and causes an error if the host ghc's mingw is too old (which the script
does not detect).

Fixes T9727

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D373

GHC Trac Issues: #9727
Extra CRs are now filtered out from the source file for :list.

Fixes #9367.

Reviewers: austin

Reviewed By: austin

Subscribers: #ghc_windows_task_force, thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D382

GHC Trac Issues: #9367