[Git][ghc/ghc][wip/andreask/allocationArea] 422 commits: Use dumpStyle when printing inlinings

Andreas Klebinger gitlab at gitlab.haskell.org
Thu Sep 17 12:11:59 UTC 2020



Andreas Klebinger pushed to branch wip/andreask/allocationArea at Glasgow Haskell Compiler / GHC


Commits:
9ad072b4 by Simon Peyton Jones at 2020-07-13T14:52:49-04:00
Use dumpStyle when printing inlinings

This just makes debug-printing consistent,
and more informative.

- - - - -
e78c4efb by Simon Peyton Jones at 2020-07-13T14:52:49-04:00
Comments only

- - - - -
7ccb760b by Simon Peyton Jones at 2020-07-13T14:52:49-04:00
Reduce result discount in conSize

Ticket #18282 showed that the result discount given by conSize
was massively too large.  This patch reduces that discount to
a constant 10, which just balances the cost of the constructor
application itself.

Note [Constructor size and result discount] elaborates, as
does the ticket #18282.

Reducing result discount reduces inlining, which affects perf.  I
found that I could increase the unfoldingUseThrehold from 80 to 90 in
compensation; in combination with the result discount change I get
these overall nofib numbers:

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
          boyer          -0.2%     +5.4%     -3.2%     -3.4%      0.0%
       cichelli          -0.1%     +5.9%    -11.2%    -11.7%      0.0%
      compress2          -0.2%     +9.6%     -6.0%     -6.8%      0.0%
   cryptarithm2          -0.1%     -3.9%     -6.0%     -5.7%      0.0%
         gamteb          -0.2%     +2.6%    -13.8%    -14.4%      0.0%
         genfft          -0.1%     -1.6%    -29.5%    -29.9%      0.0%
             gg          -0.0%     -2.2%    -17.2%    -17.8%    -20.0%
           life          -0.1%     -2.2%    -62.3%    -63.4%      0.0%
           mate          +0.0%     +1.4%     -5.1%     -5.1%    -14.3%
         parser          -0.2%     -2.1%     +7.4%     +6.7%      0.0%
      primetest          -0.2%    -12.8%    -14.3%    -14.2%      0.0%
         puzzle          -0.2%     +2.1%    -10.0%    -10.4%      0.0%
            rsa          -0.2%    -11.7%     -3.7%     -3.8%      0.0%
         simple          -0.2%     +2.8%    -36.7%    -38.3%     -2.2%
   wheel-sieve2          -0.1%    -19.2%    -48.8%    -49.2%    -42.9%
--------------------------------------------------------------------------------
            Min          -0.4%    -19.2%    -62.3%    -63.4%    -42.9%
            Max          +0.3%     +9.6%     +7.4%    +11.0%    +16.7%
 Geometric Mean          -0.1%     -0.3%    -17.6%    -18.0%     -0.7%

I'm ok with these numbers, remembering that this change removes
an *exponential* increase in code size in some in-the-wild cases.

I investigated compress2.  The difference is entirely caused by this
function no longer inlining

WriteRoutines.$woutputCodes
  = \ (w :: [CodeEvent]) ->
      let result_s1Sr
            = case WriteRoutines.outputCodes_$s$woutput w 0# 0# 8# 9# of
                (# ww1, ww2 #) -> (ww1, ww2)
      in (# case result_s1Sr of (x, _) ->
              map @Int @Char WriteRoutines.outputCodes1 x
         , case result_s1Sr of { (_, y) -> y } #)

It was right on the cusp before, driven by the excessive result
discount.  Too bad!

Happily, the compiler/perf tests show a number of improvements:
    T12227     compiler bytes-alloc  -6.6%
    T12545     compiler bytes-alloc  -4.7%
    T13056     compiler bytes-alloc  -3.3%
    T15263     runtime  bytes-alloc -13.1%
    T17499     runtime  bytes-alloc -14.3%
    T3294      compiler bytes-alloc  -1.1%
    T5030      compiler bytes-alloc -11.7%
    T9872a     compiler bytes-alloc  -2.0%
    T9872b     compiler bytes-alloc  -1.2%
    T9872c     compiler bytes-alloc  -1.5%

Metric Decrease:
    T12227
    T12545
    T13056
    T15263
    T17499
    T3294
    T5030
    T9872a
    T9872b
    T9872c

- - - - -
7f0b671e by Ben Gamari at 2020-07-13T14:52:49-04:00
testsuite: Widen acceptance threshold on T5837

This test is positively tiny and consequently the bytes allocated
measurement will be relatively noisy. Consequently I have seen this
fail spuriously quite often.

- - - - -
118e1c3d by Alp Mestanogullari at 2020-07-14T21:30:52-04:00
compiler: re-engineer the treatment of rebindable if

Executing on the plan described in #17582, this patch changes the way if expressions
are handled in the compiler in the presence of rebindable syntax. We get rid of the
SyntaxExpr field of HsIf and instead, when rebindable syntax is on, we rewrite the HsIf
node to the appropriate sequence of applications of the local `ifThenElse` function.

In order to be able to report good error messages, with expressions as they were
written by the user (and not as desugared by the renamer), we make use of TTG
extensions to extend GhcRn expression ASTs with an `HsExpansion` construct, which
keeps track of a source (GhcPs) expression and the desugared (GhcRn) expression that
it gives rise to. This way, we can typecheck the latter while reporting the former in
error messages.

In order to discard the error context lines that arise from typechecking the desugared
expressions (because they talk about expressions that the user has not written), we
carefully give a special treatment to the nodes fabricated by this new renaming-time
transformation when typechecking them. See Note [Rebindable syntax and HsExpansion]
for more details. The note also includes a recipe to apply the same treatment to
other rebindable constructs.

Tests 'rebindable11' and 'rebindable12' have been added to make sure we report
identical error messages as before this patch under various circumstances.

We also now disable rebindable syntax when processing untyped TH quotes, as per
the discussion in #18102 and document the interaction of rebindable syntax and
Template Haskell, both in Note [Template Haskell quotes and Rebindable Syntax]
and in the user guide, adding a test to make sure that we do not regress in
that regard.

- - - - -
64c774b0 by Andreas Klebinger at 2020-07-14T21:31:27-04:00
Explain why keeping DynFlags in AnalEnv saves allocation.

- - - - -
254245d0 by Ben Gamari at 2020-07-14T21:32:03-04:00
docs/users-guide: Update default -funfolding-use-threshold value

This was changed in 3d2991f8 but I neglected to update the
documentation. Fixes #18419.

- - - - -
4c259f86 by Andreas Klebinger at 2020-07-14T21:32:41-04:00
Escape backslashes in json profiling reports properly.

I also took the liberty to do away the fixed buffer size for escaping.
Using a fixed size here can only lead to issues down the line.

Fixes #18438.

- - - - -
23797224 by Sergei Trofimovich at 2020-07-14T21:33:19-04:00
.gitlab: re-enable integer-simple substitute (BIGNUM_BACKEND)

Recently build system migrated from INTEGER_LIBRARY to BIGNUM_BACKEND.
But gitlab CI was never updated. Let's enable BIGNUM_BACKEND=native.

Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437
Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>

- - - - -
e0db878a by Sergei Trofimovich at 2020-07-14T21:33:19-04:00
ghc-bignum: bring in sync .hs-boot files with module declarations

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

```
libraries/ghc-bignum/src/GHC/Num/BigNat/Native.hs:708:16: error:
    * Variable not in scope: naturalFromBigNat# :: WordArray# -> t
    * Perhaps you meant one of these:
        `naturalFromBigNat' (imported from GHC.Num.Natural),
        `naturalToBigNat' (imported from GHC.Num.Natural)
    |
708 |           m' = naturalFromBigNat# m
    |
```

This happens because `.hs-boot` files are slightly out of date.
This change brings in data and function types in sync.

Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437
Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>

- - - - -
c9f65c36 by Stefan Schulze Frielinghaus at 2020-07-14T21:33:57-04:00
rts/Disassembler.c: Use FMT_HexWord for printing values in hex format

- - - - -
58ae62eb by Matthias Andreas Benkard at 2020-07-14T21:34:35-04:00
macOS: Load frameworks without stating them first.

macOS Big Sur makes the following change to how frameworks are shipped
with the OS:

> New in macOS Big Sur 11 beta, the system ships with a built-in
> dynamic linker cache of all system-provided libraries. As part of
> this change, copies of dynamic libraries are no longer present on
> the filesystem. Code that attempts to check for dynamic library
> presence by looking for a file at a path or enumerating a directory
> will fail. Instead, check for library presence by attempting to
> dlopen() the path, which will correctly check for the library in the
> cache. (62986286)

https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11-beta-release-notes/

Therefore, the previous method of checking whether a library exists
before attempting to load it makes GHC.Runtime.Linker.loadFramework
fail to find frameworks installed at /System/Library/Frameworks.

GHC.Runtime.Linker.loadFramework now opportunistically loads the
framework libraries without checking for their existence first,
failing only if all attempts to load a given framework from any of the
various possible locations fail.

- - - - -
cdc4a6b0 by Matthias Andreas Benkard at 2020-07-14T21:34:35-04:00
loadFramework: Output the errors collected in all loading attempts.

With the recent change away from first finding and then loading a
framework, loadFramework had no way of communicating the real reason
why loadDLL failed if it was any reason other than the framework
missing from the file system.  It now collects all loading attempt
errors into a list and concatenates them into a string to return to
the caller.

- - - - -
51dbfa52 by Ben Gamari at 2020-07-15T04:05:34-04:00
StgToCmm: Use CmmRegOff smart constructor

Previously we would generate expressions of the form
`CmmRegOff BaseReg 0`. This should do no harm (and really should be
handled by the NCG anyways) but it's better to just generate a plain
`CmmReg`.

- - - - -
ae11bdfd by Ben Gamari at 2020-07-15T04:06:08-04:00
testsuite: Add regression test for #17744

Test due to @monoidal.

- - - - -
0e3c277a by Ben Gamari at 2020-07-15T16:41:01-04:00
Bump Cabal submodule

Updates a variety of tests as Cabal is now more strict about Cabal file
form.

- - - - -
ceed994a by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Drop Windows Vista support, require Windows 7

- - - - -
00a23bfd by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Update Windows FileSystem wrapper utilities.

- - - - -
459e1c5f by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Use SlimReaderLocks and ConditonalVariables provided by the OS instead of emulated ones

- - - - -
763088fc by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Small linker comment and ifdef cleanups

- - - - -
1a228ff9 by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Flush event logs eagerly.

- - - - -
e9e04dda by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Refactor Buffer structures to be able to track async operations

- - - - -
356dc3fe by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Implement new Console API

- - - - -
90e69f77 by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Add IOPort synchronization primitive

- - - - -
71245fcc by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Add new io-manager cmdline options

- - - - -
d548a3b3 by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Init Windows console Codepage to UTF-8.

- - - - -
58ef6366 by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Add unsafeSplat to GHC.Event.Array

- - - - -
d660725e by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Add size and iterate to GHC.Event.IntTable.

- - - - -
050da6dd by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Switch Testsuite to test winio by default

- - - - -
4bf542bf by Tamar Christina at 2020-07-15T16:41:01-04:00
winio: Multiple refactorings and support changes.

- - - - -
4489af6b by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: core threaded I/O manager

- - - - -
64d8f2fe by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: core non-threaded I/O manager

- - - - -
8da15a09 by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: Fix a scheduler bug with the threaded-runtime.

- - - - -
84ea3d14 by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: Relaxing some constraints in io-manager.

- - - - -
ccf0d107 by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: Fix issues with non-threaded I/O manager after split.

- - - - -
b492fe6e by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: Remove some barf statements that are a bit strict.

- - - - -
01423fd2 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Expand comments describing non-threaded loop

- - - - -
4b69004f by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: fix FileSize unstat-able handles

- - - - -
9b384270 by Tamar Christina at 2020-07-15T16:41:02-04:00
winio: Implement new tempfile routines for winio

- - - - -
f1e0be82 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix input truncation when reading from handle.

This was caused by not upholding the read buffer invariant
that bufR == bufL == 0 for empty read buffers.

- - - - -
e176b625 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix output truncation for writes larger than buffer size

- - - - -
a831ce0e by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Rewrite bufWrite.

I think it's far easier to follow the code now.
It's also correct now as I had still missed a spot
where we didn't update the offset.

- - - - -
6aefdf62 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix offset set by bufReadEmpty.

bufReadEmpty returns the bytes read *including* content that
was already buffered,
But for calculating the offset we only care about the number
of bytes read into the new buffer.

- - - - -
750ebaee by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Clean up code surrounding IOPort primitives.

According to phyx these should only be read and written once per
object. Not neccesarily in that order.

To strengthen that guarantee the primitives will now throw an
exception if we violate this invariant.

As a consequence we can eliminate some code from their primops.
In particular code dealing with multiple queued readers/writers
now simply checks the invariant and throws an exception if it
was violated. That is in contrast to mvars which will do things
like wake up all readers, queue multi writers etc.

- - - - -
ffd31db9 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix multi threaded threadDelay and a few other small changes.

Multithreaded threadDelay suffered from a race condition
based on the ioManagerStatus. Since the status isn't needed
for WIO I removed it completely.

This resulted in a light refactoring, as consequence we will always
wake up the IO manager using interruptSystemManager, which uses
`postQueuedCompletionStatus` internally.

I also added a few comments which hopefully makes the code easier to
dive into for the next person diving in.

- - - - -
6ec26df2 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
wionio: Make IO subsystem check a no-op on non-windows platforms.

- - - - -
29bcd936 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Set handle offset when opening files in Append mode.

Otherwise we would truncate the file.

- - - - -
55c29700 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Remove debug event log trace

- - - - -
9acb9f40 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix sqrt and openFile009 test cases

- - - - -
57017cb7 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Allow hp2ps to build with -DDEBUG

- - - - -
b8cd9995 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Update output of T9681 since we now actually run it.

- - - - -
10af5b14 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: A few more improvements to the IOPort primitives.

- - - - -
39afc4a7 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix expected tempfiles output.

Tempfiles now works properly on windows, as such we can
delete the win32 specific output.

- - - - -
99db46e0 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Assign thread labels to IOManager threads.

- - - - -
be6af732 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Properly check for the tso of an incall to be zero.

- - - - -
e2c6dac7 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Mark FD instances as unsupported under WINIO.

- - - - -
fd02ceed by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Fix threadDelay maxBound invocations.

Instead of letting the ns timer overflow now clamp it at
(maxBound :: Word64) ns. That still gives a few hundred
years.

- - - - -
bc79f9f1 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Add comments/cleanup an import in base

- - - - -
1d197f4b by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Mark outstanding_service_requests volatile.

As far as I know C(99) gives no guarantees for code like

    bool condition;

    ...

    while(condition)
        sleep();

that condition will be updated if it's changed by another thread.
So we are explicit here and mark it as volatile, this will force
a reload from memory on each iteration.

- - - - -
dc438186 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Make last_event a local variable

- - - - -
2fc957c5 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Add comment about thread safety of processCompletion.

- - - - -
4c026b6c by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: nonthreaded: Create io processing threads in main thread.

We now set a flag in the IO thread. The scheduler when looking for work
will check the flag and create/queue threads accordingly.

We used to create these in the IO thread. This improved performance
but caused frequent segfaults. Thread creation/allocation is only safe to
do if nothing currently accesses the storeagemanager. However without
locks in the non-threaded runtime this can't be guaranteed.

This shouldn't change performance all too much.

In the past we had:
* IO: Create/Queue thread.
* Scheduler: Runs a few times. Eventually picks up IO processing thread.

Now it's:
* IO: Set flag to queue thread.
* Scheduler: Pick up flag, if set create/queue thread. Eventually picks up IO processing thread.

- - - - -
f47c7208 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Add an exported isHeapAlloced function to the RTS

- - - - -
cc5d7bb1 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Queue IO processing threads at the front of the queue.

This will unblock the IO thread sooner hopefully leading to higher
throughput in some situations.

- - - - -
e7630115 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: ThreadDelay001: Use higher resolution timer.

- - - - -
451b5f96 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Update T9681 output, disable T4808 on windows.

T4808 tests functionality of the FD interface which won't be supported
under WINIO.

T9681 just has it's expected output tweaked.

- - - - -
dd06f930 by Andreas Klebinger at 2020-07-15T16:41:02-04:00
winio: Wake io manager once per registerTimeout.

Which is implicitly done in editTimeouts, so need to wake it
up twice.

- - - - -
e87d0bf9 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Update placeholder comment with actual function name.

- - - - -
fc9025db by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Always lock win32 event queue

- - - - -
c24c9a1f by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Display thread labels when tracing scheduler events.

- - - - -
06542b03 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Refactor non-threaded runner thread and scheduler interface.

Only use a single communication point (registerAlertableWait) to inform
the C side aobut both timeouts to use as well as outstanding requests.

Also queue a haskell processing thread after each return from alertable
waits. This way there is no risk of us missing a timer event.

- - - - -
256299b1 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Remove outstanding_requests from runner.

We used a variable to keep track of situations where we got
entries from the IO port, but all of them had already been
canceled. While we can avoid some work that way this case
seems quite rare.

So we give up on tracking this and instead always assume at
least one of the returned entries is valid.

If that's not the case no harm is done, we just perform some
additional work. But it makes the runner easier to reason about.

In particular we don't need to care if another thread modifies
oustanding_requests after we return from waiting on the IO Port.

- - - - -
3ebd8ad9 by Tamar Christina at 2020-07-15T16:41:03-04:00
winio: Various fixes related to rebase and testdriver

- - - - -
6be6bcba by Tamar Christina at 2020-07-15T16:41:03-04:00
winio: Fix rebase artifacts

- - - - -
2c649dc3 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Rename unsafeSplat to unsafeCopyFromBuffer

- - - - -
a18b73f3 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Remove unused size/iterate operations from IntTable

- - - - -
16bab48e by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Detect running IO Backend via peeking at RtsConfig

- - - - -
8b8405a0 by Tamar Christina at 2020-07-15T16:41:03-04:00
winio: update temp path so GCC etc can handle it.

Also fix PIPE support, clean up error casting, fix memory leaks

- - - - -
2092bc54 by Ben Gamari at 2020-07-15T16:41:03-04:00
winio: Minor comments/renamings

- - - - -
a5b5b6c0 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Checking if an error code indicates completion is now a function.

- - - - -
362176fd by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Small refactor in withOverlappedEx

- - - - -
32e20597 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: A few comments and commented out dbxIO

- - - - -
a4bfc1d9 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Don't drop buffer offset in byteView/cwcharView

- - - - -
b3ad2a54 by Tamar Christina at 2020-07-15T16:41:03-04:00
winio: revert BHandle changes.

- - - - -
3dcd87e2 by Ben Gamari at 2020-07-15T16:41:03-04:00
winio: Fix imports

- - - - -
5a371890 by Tamar Christina at 2020-07-15T16:41:03-04:00
winio: update ghc-cabal to handle new Cabal submodule bump

- - - - -
d07ebe0d by Ben Gamari at 2020-07-15T16:41:03-04:00
winio: Only compile sources on Windows

- - - - -
dcb42393 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Actually return Nothing on EOF for non-blocking read

- - - - -
895a3beb by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Deduplicate logic in encodeMultiByte[Raw]IO.

- - - - -
e06e6734 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Deduplicate openFile logic

- - - - -
b59430c0 by Tamar Christina at 2020-07-15T16:41:03-04:00
winio: fix -werror issue in encoding file

- - - - -
f8d39a51 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Don't mention windows specific functions when building on Linux.

- - - - -
6a533d2a by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: add a note about file locking in the RTS.

- - - - -
cf37ce34 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Add version to @since annotation

- - - - -
0fafa2eb by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Rename GHC.Conc.IOCP -> GHC.Conc.WinIO

- - - - -
1854fc23 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Expand GHC.Conc.POSIX description

It now explains users may not use these functions when
using the old IO manager.

- - - - -
fcc7ba41 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Fix potential spaceleak in __createUUIDTempFileErrNo

- - - - -
6b3fd9fa by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Remove redundant -Wno-missing-signatures pragmas

- - - - -
916fc861 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Make it explicit that we only create one IO manager

- - - - -
f260a721 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Note why we don't use blocking waits.

- - - - -
aa0a4bbf by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Remove commented out pragma

- - - - -
d679b544 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Remove redundant buffer write in Handle/Text.hs:bufReadEmpty

- - - - -
d3f94368 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Rename SmartHandles to StdHandles

- - - - -
bd6b8ec1 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: add comment stating failure behaviour for getUniqueFileInfo.

- - - - -
12846b85 by Andreas Klebinger at 2020-07-15T16:41:03-04:00
winio: Update IOPort haddocks.

- - - - -
9f39fb14 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Add a note cross reference

- - - - -
62dd5a73 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Name Haskell/OS I/O Manager explicitly in Note

- - - - -
fa807828 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Expand BlockedOnIOCompletion description.

- - - - -
f0880a1d by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Remove historical todos

- - - - -
8e58e714 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Update note, remove debugging pragma.

- - - - -
aa4d84d5 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: flushCharReadBuffer shouldn't need to adjust offsets.

- - - - -
e580893a by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Remove obsolete comment about cond. variables

- - - - -
d54e9d79 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: fix initial linux validate build

- - - - -
3cd4de46 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Fix ThreadDelay001 CPP

- - - - -
c88b1b9f by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Fix openFile009 merge conflict leftover

- - - - -
849e8889 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Accept T9681 output.

GHC now reports String instead of [Char].

- - - - -
e7701818 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Fix cabal006 after upgrading cabal submodule

Demand cabal 2.0 syntax instead of >= 1.20 as required by newer cabal versions.

- - - - -
a44f0373 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Fix stderr output for ghci/linking/dyn tests.

We used to filter rtsopts, i opted to instead just accept the warning of it having no effect.
This works both for -rtsopts, as well as -with-rtsopts which winio adds.

- - - - -
515d9896 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Adjust T15261b stdout for --io-manager flag.

- - - - -
949aaacc by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Adjust T5435_dyn_asm stderr

The warning about rtsopts having no consequences is expected.
So accept new stderr.

- - - - -
7d424e1e by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Also accept T7037 stderr

- - - - -
1f009768 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: fix cabal04 by filtering rts args

- - - - -
981a9f2e by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: fix cabal01 by accepting expected stderr

- - - - -
b7b0464e by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: fix safePkg01 by accepting expected stderr

- - - - -
32734b29 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: fix T5435_dyn_gcc by accepting expected stderr

- - - - -
acc5cebf by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: fix tempfiles test on linux

- - - - -
c577b789 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Accept accepted stderr for T3807

- - - - -
c108c527 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Accept accepted stderr for linker_unload

- - - - -
2b0b9a08 by Andreas Klebinger at 2020-07-15T16:41:04-04:00
winio: Accept accepted stderr for linker_unload_multiple_objs

- - - - -
67afb03c by Tamar Christina at 2020-07-15T16:41:04-04:00
winio: clarify wording on conditional variables.

- - - - -
3bd41572 by Tamar Christina at 2020-07-15T16:41:04-04:00
winio: clarify comment on cooked mode.

- - - - -
ded58a03 by Tamar Christina at 2020-07-15T16:41:04-04:00
winio: update lockfile signature and remove mistaken symbol in rts.

- - - - -
2143c492 by Ben Gamari at 2020-07-15T16:41:04-04:00
testsuite: Add winio and winio_threaded ways

Reverts many of the testsuite changes

- - - - -
c0979cc5 by Ben Gamari at 2020-07-16T10:56:54-04:00
Merge remote-tracking branch 'origin/wip/winio'

- - - - -
750a1595 by Ben Gamari at 2020-07-18T07:26:41-04:00
rts: Add --copying-gc flag to reverse effect of --nonmoving-gc

Fixes #18281.

- - - - -
6ba6a881 by Hécate at 2020-07-18T07:26:42-04:00
Implement `fullCompilerVersion`

Follow-up of https://gitlab.haskell.org/ghc/ghc/-/issues/18403

This MR adds `fullCompilerVersion`, a function that shares the same
backend as the `--numeric-version` GHC flag, exposing a full,
three-digit version datatype.

- - - - -
e6cf27df by Hécate at 2020-07-18T07:26:43-04:00
Add a Lint hadrian rule and an .hlint.yaml file in base/

- - - - -
bcb177dd by Simon Peyton Jones at 2020-07-18T07:26:43-04:00
Allow multiple case branches to have a higher rank type

As #18412 points out, it should be OK for multiple case alternatives
to have a higher rank type, provided they are all the same.

This patch implements that change.  It sweeps away
GHC.Tc.Gen.Match.tauifyMultipleBranches, and friends, replacing it
with an enhanced version of fillInferResult.

The basic change to fillInferResult is to permit the case in which
another case alternative has already filled in the result; and in
that case simply unify.  It's very simple actually.

See the new Note [fillInferResult] in TcMType

Other refactoring:

- Move all the InferResult code to one place, in GHC.Tc.Utils.TcMType
  (previously some of it was in Unify)

- Move tcInstType and friends from TcMType to Instantiate, where it
  more properly belongs.  (TCMType was getting very long.)

- - - - -
e5525a51 by Simon Peyton Jones at 2020-07-18T07:26:43-04:00
Improve typechecking of NPlusK patterns

This patch (due to Richard Eisenberg) improves
documentation of the wrapper returned by tcSubMult
(see Note [Wrapper returned from tcSubMult] in
 GHC.Tc.Utils.Unify).

And, more substantially, it cleans up the multiplicity
handling in the typechecking of NPlusKPat

- - - - -
12f90352 by Krzysztof Gogolewski at 2020-07-18T07:26:45-04:00
Remove {-# CORE #-} pragma (part of #18048)

This pragma has no effect since 2011.
It was introduced for External Core, which no longer exists.

Updates haddock submodule.

- - - - -
e504c913 by Simon Peyton Jones at 2020-07-18T07:26:45-04:00
Refactor the simplification of join binders

This MR (for #18449) refactors the Simplifier's treatment
of join-point binders.

Specifically, it puts together, into
     GHC.Core.Opt.Simplify.Env.adjustJoinPointType
two currently-separate ways in which we adjust the type of
a join point. As the comment says:

-- (adjustJoinPointType mult new_res_ty join_id) does two things:
--
--   1. Set the return type of the join_id to new_res_ty
--      See Note [Return type for join points]
--
--   2. Adjust the multiplicity of arrows in join_id's type, as
--      directed by 'mult'. See Note [Scaling join point arguments]

I think this actually fixes a latent bug, by ensuring that the
seIdSubst and seInScope have the right multiplicity on the type
of join points.

I did some tidying up while I was at it.  No more
setJoinResTy, or modifyJoinResTy: instead it's done locally in
Simplify.Env.adjustJoinPointType

- - - - -
49b265f0 by Chaitanya Koparkar at 2020-07-18T07:26:46-04:00
Fix minor typos in a Core.hs note

- - - - -
8d59aed6 by Stefan Schulze Frielinghaus at 2020-07-18T07:26:47-04:00
GHCi: Fix isLittleEndian

- - - - -
c26e81d1 by Ben Gamari at 2020-07-18T07:26:47-04:00
testsuite: Mark ghci tests as fragile under unreg compiler

In particular I have seen T16012 fail repeatedly under the
unregisterised compiler.

- - - - -
868e4523 by Moritz Angermann at 2020-07-20T04:30:38-04:00
Revert "AArch32 symbols only on aarch32."

This reverts commit cdfeb3f24f76e8fd30452016676e56fbc827789a.

Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
c915ba84 by Moritz Angermann at 2020-07-20T04:30:38-04:00
Revert "Fix (1)"

This reverts commit 7abffced01f5680efafe44f6be2733eab321b039.

Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
777c452a by Moritz Angermann at 2020-07-20T04:30:38-04:00
Revert "better if guards."

This reverts commit 3f60b94de1f460ca3f689152860b108a19ce193e.

Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
0dd40552 by Moritz Angermann at 2020-07-20T04:30:38-04:00
Revert "[linker/rtsSymbols] More linker symbols"

This reverts commit 686e72253aed3880268dd6858eadd8c320f09e97.

Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
30caeee7 by Sylvain Henry at 2020-07-21T06:39:33-04:00
DynFlags: remove use of sdocWithDynFlags from GHC.Stg.* (#17957)

* add StgPprOpts datatype
* remove Outputable instances for types that need `StgPprOpts` to be
  pretty-printed and explicitly call type specific ppr functions
* add default `panicStgPprOpts` for panic messages (when it's not
  convenient to thread StgPprOpts or DynFlags down to the ppr function
  call)

- - - - -
863c544c by Mark at 2020-07-21T06:39:34-04:00
Fix a typo in existential_quantification.rst
- - - - -
05910be1 by Krzysztof Gogolewski at 2020-07-21T14:47:07-04:00
Add release notes entry for #17816

[skip ci]

- - - - -
a6257192 by Matthew Pickering at 2020-07-21T14:47:19-04:00
Use a newtype `Code` for the return type of typed quotations (Proposal #195)

There are three problems with the current API:

1. It is hard to properly write instances for ``Quote m => m (TExp a)`` as the type is the composition
   of two type constructors. Doing so in your program involves making your own newtype and
   doing a lot of wrapping/unwrapping.

   For example, if I want to create a language which I can either run immediately or
   generate code from I could write the following with the new API. ::

      class Lang r where
        _int :: Int -> r Int
        _if  :: r Bool -> r a -> r a -> r a

      instance Lang Identity where
        _int = Identity
        _if (Identity b) (Identity t) (Identity f) = Identity (if b then t else f)

      instance Quote m => Lang (Code m) where
        _int = liftTyped
        _if cb ct cf = [|| if $$cb then $$ct else $$cf ||]

2. When doing code generation it is common to want to store code fragments in
   a map. When doing typed code generation, these code fragments contain a
   type index so it is desirable to store them in one of the parameterised
   map data types such as ``DMap`` from ``dependent-map`` or ``MapF`` from
   ``parameterized-utils``.

   ::

      compiler :: Env -> AST a -> Code Q a

      data AST a where ...
      data Ident a = ...

      type Env = MapF Ident (Code Q)

      newtype Code m a = Code (m (TExp a))

   In this example, the ``MapF`` maps an ``Ident String`` directly to a ``Code Q String``.
   Using one of these map types currently requires creating your own newtype and constantly
   wrapping every quotation and unwrapping it when using a splice. Achievable, but
   it creates even more syntactic noise than normal metaprogramming.

3. ``m (TExp a)`` is ugly to read and write, understanding ``Code m a`` is
   easier. This is a weak reason but one everyone
   can surely agree with.

Updates text submodule.

- - - - -
58235d46 by Ben Gamari at 2020-07-21T14:47:28-04:00
users-guide: Fix :rts-flag:`--copying-gc` documentation

It was missing a newline.

- - - - -
19e80b9a by Vladislav Zavialov at 2020-07-21T14:50:01-04:00
Accumulate Haddock comments in P (#17544, #17561, #8944)

Haddock comments are, first and foremost, comments. It's very annoying
to incorporate them into the grammar. We can take advantage of an
important property: adding a Haddock comment does not change the parse
tree in any way other than wrapping some nodes in HsDocTy and the like
(and if it does, that's a bug).

This patch implements the following:

* Accumulate Haddock comments with their locations in the P monad.
  This is handled in the lexer.

* After parsing, do a pass over the AST to associate Haddock comments
  with AST nodes using location info.

* Report the leftover comments to the user as a warning (-Winvalid-haddock).

- - - - -
4c719460 by David Binder at 2020-07-22T20:17:35-04:00
Fix dead link to haskell prime discussion

- - - - -
f2f817e4 by BinderDavid at 2020-07-22T20:17:35-04:00
Replace broken links to old haskell-prime site by working links to gitlab instance.
[skip ci]

- - - - -
0bf8980e by Daniel Gröber at 2020-07-22T20:18:11-04:00
Remove length field from FastString

- - - - -
1010c33b by Daniel Gröber at 2020-07-22T20:18:11-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

- - - - -
8336ba78 by Daniel Gröber at 2020-07-22T20:18:11-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.

- - - - -
7484a9a4 by Daniel Gröber at 2020-07-22T20:18:11-04:00
Encoding: Add comment about tricky ForeignPtr lifetime

- - - - -
5536ed28 by Daniel Gröber at 2020-07-22T20:18:11-04:00
Use IO constructor instead of `stToIO . ST`

- - - - -
5b8902e3 by Daniel Gröber at 2020-07-22T20:18:11-04:00
Encoding: Remove redundant use of withForeignPtr

- - - - -
5976a161 by Daniel Gröber at 2020-07-22T20:18:11-04:00
Encoding: Reformat utf8EncodeShortByteString to be more consistent

- - - - -
9ddf1614 by Daniel Gröber at 2020-07-22T20:18:11-04:00
FastString: Reintroduce character count cache

Metric Increase:
    ManyConstructors

Metric Decrease:
    T4029

- - - - -
e9491668 by Ben Gamari at 2020-07-22T20:18:46-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.

- - - - -
9f3ff8fd by Andreas Klebinger at 2020-07-22T20:19:22-04:00
Enable BangPatterns, ScopedTypeVariables for ghc and hadrian by default.

This is only for their respective codebases.

- - - - -
0f17b930 by Sylvain Henry at 2020-07-22T20:19:59-04:00
Remove unused "ncg" flag

This flag has been removed in 066b369de2c6f7da03c88206288dca29ab061b31
in 2011.

- - - - -
bab4ec8f by Sylvain Henry at 2020-07-22T20:19:59-04:00
Don't panic if the NCG isn't built (it is always built)

- - - - -
8ea33edb by Sylvain Henry at 2020-07-22T20:19:59-04:00
Remove unused sGhcWithNativeCodeGen

- - - - -
e079bb72 by Sylvain Henry at 2020-07-22T20:19:59-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.

- - - - -
735f9d6b by Sylvain Henry at 2020-07-22T20:19:59-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)

- - - - -
f7cc4313 by Sylvain Henry at 2020-07-22T20:19:59-04:00
Replace HscTarget with Backend

They both have the same role and Backend name is more explicit.

Metric Decrease:
    T3064

Update Haddock submodule

- - - - -
15ce1804 by Andreas Klebinger at 2020-07-22T20:20:34-04:00
Deprecate -fdmd-tx-dict-sel.

It's behaviour is now unconditionally enabled as
it's slightly beneficial.

There are almost no benchmarks which benefit from
disabling it, so it's not worth the keep this
configurable.

This fixes #18429.

- - - - -
ff1b7710 by Sylvain Henry at 2020-07-22T20:21:11-04:00
Add test for #18064

It has been fixed by 0effc57d48ace6b719a9f4cbeac67c95ad55010b

- - - - -
cfa89149 by Krzysztof Gogolewski at 2020-07-22T20:21:48-04:00
Define type Void# = (# #) (#18441)

There's one backwards compatibility issue: GHC.Prim no longer exports
Void#, we now manually re-export it from GHC.Exts.

- - - - -
02f40b0d by Sebastian Graf at 2020-07-22T20:22:23-04:00
Add regression test for #18478

!3392 backported !2993 to GHC 8.10.2 which most probably is responsible
for fixing #18478, which triggered a pattern match checker performance
regression in GHC 8.10.1 as first observed in #17977.

- - - - -
7f44df1e by Sylvain Henry at 2020-07-22T20:23:00-04:00
Minor refactoring of Unit display

* for consistency, try to always use UnitPprInfo to display units to
  users

* remove some uses of `unitPackageIdString` as it doesn't show the
  component name and it uses String

- - - - -
dff1cb3d by Moritz Angermann at 2020-07-23T07:55:29-04:00
[linker] Fix out of range relocations.

mmap may return address all over the place. mmap_next will ensure we get
the next free page after the requested address.

This is especially important for linking on aarch64, where the memory model with PIC
admits relocations in the +-4GB range, and as such we can't work with
arbitrary object locations in memory.

Of note: we map the rts into process space, so any mapped objects must
not be ouside of the 4GB from the processes address space.

- - - - -
cdd0ff16 by Tamar Christina at 2020-07-24T18:12:23-04:00
winio: restore console cp on exit

- - - - -
c1f4f81d by Tamar Christina at 2020-07-24T18:13:00-04:00
winio: change memory allocation strategy and fix double free errors.

- - - - -
ba205046 by Simon Peyton Jones at 2020-07-24T18:13:35-04:00
Care with occCheckExpand in kind of occurrences

Issue #18451 showed that we could get an infinite type, through
over-use of occCheckExpand in the kind of an /occurrence/ of a
type variable.

See Note [Occurrence checking: look inside kinds] in GHC.Core.Type

This patch fixes the problem by making occCheckExpand less eager
to expand synonyms in kinds.

It also improves pretty printing of kinds, by *not* suppressing
the kind on a tyvar-binder like
    (a :: Const Type b)
where type Const p q = p.  Even though the kind of 'a' is Type,
we don't want to suppress the kind ascription.  Example: the
error message for polykinds/T18451{a,b}. See GHC.Core.TyCo.Ppr
Note [Suppressing * kinds].

- - - - -
02133353 by Zubin Duggal at 2020-07-25T00:44:30-04:00
Simplify XRec definition
Change `Located X` usage to `XRec pass X`
This increases the scope of the LPat experiment to almost all of GHC.
Introduce UnXRec and MapXRec classes

Fixes #17587 and #18408

Updates haddock submodule

Co-authored-by: Philipp Krüger <philipp.krueger1 at gmail.com>

- - - - -
e443846b by Sylvain Henry at 2020-07-25T00:45:07-04:00
DynFlags: store printer in TraceBinIfaceReading

We don't need to pass the whole DynFlags, just pass the logging
function, if any.

- - - - -
15b2b44f by Sylvain Henry at 2020-07-25T00:45:08-04:00
Rename GHC.Driver.Ways into GHC.Platform.Ways

- - - - -
342a01af by Sylvain Henry at 2020-07-25T00:45:08-04:00
Add GHC.Platform.Profile

- - - - -
6333d739 by Sylvain Henry at 2020-07-25T00:45:08-04:00
Put PlatformConstants into Platform

- - - - -
9dfeca6c by Sylvain Henry at 2020-07-25T00:45:08-04:00
Remove platform constant wrappers

Platform constant wrappers took a DynFlags parameter, hence implicitly
used the target platform constants. We removed them to allow support
for several platforms at once (#14335) and to avoid having to pass
the full DynFlags to every function (#17957).

Metric Decrease:
   T4801

- - - - -
73145d57 by Sylvain Henry at 2020-07-25T00:45:08-04:00
Remove dead code in utils/derivConstants

- - - - -
7721b923 by Sylvain Henry at 2020-07-25T00:45:08-04:00
Move GHC.Platform into the compiler

Previously it was in ghc-boot so that ghc-pkg could use it. However it
wasn't necessary because ghc-pkg only uses a subset of it: reading
target arch and OS from the settings file. This is now done via
GHC.Platform.ArchOS (was called PlatformMini before).

- - - - -
459afeb5 by Sylvain Henry at 2020-07-25T00:45:08-04:00
Fix build systems

- - - - -
9e2930c3 by Sylvain Henry at 2020-07-25T00:45:08-04:00
Bump CountParserDeps

- - - - -
6e2db34b by Sylvain Henry at 2020-07-25T00:45:08-04:00
Add accessors to ArchOS

- - - - -
fc0f6fbc by Stefan Schulze Frielinghaus at 2020-07-25T00:45:45-04:00
Require SMP support in order to build a threaded stage1

Fixes 18266

- - - - -
a7c4439a by Matthias Andreas Benkard at 2020-07-26T13:23:24-04:00
Document loadFramework changes. (#18446)

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

- - - - -
da7269a4 by Ben Gamari at 2020-07-26T13:23:59-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.

- - - - -
f153a1d0 by Ben Gamari at 2020-07-26T13:23:59-04:00
testsuite: Update win32 output for parseTree

- - - - -
e91672f0 by Ben Gamari at 2020-07-26T13:23:59-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.

- - - - -
9cbfe086 by Ben Gamari at 2020-07-26T13:23:59-04:00
gitlab-ci: Kill ssh-agent after pushing test metrics

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

- - - - -
8236925f by Tamar Christina at 2020-07-26T13:24:35-04:00
winio: remove dead argument to stg_newIOPortzh

- - - - -
ce0a1d67 by Tamar Christina at 2020-07-26T13:25:11-04:00
winio: fix detection of tty terminals

- - - - -
52685cf7 by Tamar Christina at 2020-07-26T13:25:48-04:00
winio: update codeowners

- - - - -
aee45d9e by Vladislav Zavialov at 2020-07-27T07:06:56-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.

- - - - -
667ab69e by leiftw at 2020-07-27T07:07:32-04:00
fix typo referring to non-existent `-ohidir` flag, should be `-hidir` I think
- - - - -
6ff89c17 by Vladislav Zavialov at 2020-07-27T07:08:07-04:00
Refactor the parser a little

* Create a dedicated production for type operators
* Create a dedicated type for the UNPACK pragma
* Remove an outdated part of Note [Parsing data constructors is hard]

- - - - -
aa054d32 by Ben Gamari at 2020-07-27T20:09:07-04:00
Drop 32-bit Windows support

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

- - - - -
6da73bbf by Michalis Pardalos at 2020-07-27T20:09:44-04:00
Add minimal test for #12492

- - - - -
47680cb7 by Michalis Pardalos at 2020-07-27T20:09:44-04:00
Use allocate, not ALLOC_PRIM_P for unpackClosure#

ALLOC_PRIM_P fails for large closures, by directly using allocate
we can handle closures which are larger than the block size.

Fixes #12492

- - - - -
3d345c96 by Simon Peyton Jones at 2020-07-27T20:10:19-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

- - - - -
57aca6bb by Ben Gamari at 2020-07-27T20:10:54-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.

- - - - -
0a815cea by Ben Gamari at 2020-07-27T20:10:54-04:00
gitlab-ci: Bump bootstrap compiler to 8.8.4

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

- - - - -
0bd60059 by Simon Peyton Jones at 2020-07-28T02:01:49-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

- - - - -
6ee07b49 by Sylvain Henry at 2020-07-28T02:02:27-04: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.

- - - - -
f305bbfd by Peter Trommler at 2020-07-28T02:03:02-04:00
config: Fix Haskell platform constructor w/ params

Fixes #18505

- - - - -
318bb17c by Oleg Grenrus at 2020-07-28T20:54:13-04:00
Fix typo in haddock

Spotted by `vilpan` on `#haskell`

- - - - -
39c89862 by Sergei Trofimovich at 2020-07-28T20:54:50-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>

- - - - -
b9a880fc by Felix Wiemuth at 2020-07-29T15:06:35-04:00
Fix typo
- - - - -
c59064b0 by Brandon Chinn at 2020-07-29T15:07:11-04:00
Add regression test for #16341

- - - - -
a61411ca by Brandon Chinn at 2020-07-29T15:07:11-04:00
Pass dit_rep_tc_args to dsm_stock_gen_fn

- - - - -
a26498da by Brandon Chinn at 2020-07-29T15:07:11-04:00
Pass tc_args to gen_fn

- - - - -
44b11bad by Brandon Chinn at 2020-07-29T15:07:11-04:00
Filter out unreachable constructors when deriving stock instances (#16431)

- - - - -
bbc51916 by Simon Peyton Jones at 2020-07-29T15:07:47-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

- - - - -
e3db4b4c by Peter Trommler at 2020-07-29T15:08:22-04:00
configure: Fix build system on ARM

- - - - -
96c31ea1 by Sylvain Henry at 2020-07-29T15:09:02-04: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).

- - - - -
e1dc3d7b by Krzysztof Gogolewski at 2020-07-29T15:09:39-04:00
Fix validation errors (#18510)

Test T2632 is a stage1 test that failed because of the Q => Quote change.

The remaining tests did not use quotation and failed when the path
contained a space.

- - - - -
6c68a842 by John Ericson at 2020-07-30T07:11:02-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.

- - - - -
502de556 by cgibbard at 2020-07-30T07:11:02-04:00
Add haddock comment for unfilteredEdges
and move the note about drop_hs_boot_nodes into it.
- - - - -
01c948eb by Ryan Scott at 2020-07-30T07:11:37-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.

- - - - -
d47324ce by Ryan Scott at 2020-07-30T07:12:16-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.

- - - - -
ebe2cf45 by Simon Peyton Jones at 2020-07-30T07:12:52-04:00
Remove an incorrect WARN in extendLocalRdrEnv

I noticed this warning going off, and discovered that it's
really fine.  This small patch removes the warning, and docments
what is going on.

- - - - -
9f71f697 by Simon Peyton Jones at 2020-07-30T07:13:27-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

- - - - -
7c274cd5 by Sylvain Henry at 2020-07-30T22:54:48-04:00
Fix minimal imports dump for boot files (fix #18497)

- - - - -
175cb5b4 by Sylvain Henry at 2020-07-30T22:55:25-04:00
DynFlags: don't use sdocWithDynFlags in datacon ppr

We don't need to use `sdocWithDynFlags` to know whether we should
display linear types for datacon types, we already have
`sdocLinearTypes` field in `SDocContext`.  Moreover we want to remove
`sdocWithDynFlags` (#10143, #17957)).

- - - - -
380638a3 by Sylvain Henry at 2020-07-30T22:56:03-04:00
Bignum: fix powMod for gmp backend (#18515)

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

- - - - -
56a7c193 by Sylvain Henry at 2020-07-31T19:32:09+02:00
Refactor CLabel pretty-printing

Pretty-printing CLabel relies on sdocWithDynFlags that we want to remove
(#10143, #17957). It uses it to query the backend and the platform.

This patch exposes Clabel ppr functions specialised for each backend so
that backend code can directly use them.

- - - - -
3b15dc3c by Sylvain Henry at 2020-07-31T19:32:09+02:00
DynFlags: don't use sdocWithDynFlags in GHC.CmmToAsm.Dwarf.Types

- - - - -
e30fed6c by Vladislav Zavialov at 2020-08-01T04:23:04-04:00
Test case for #17652

The issue was fixed by 19e80b9af252eee760dc047765a9930ef00067ec

- - - - -
22641742 by Ryan Scott at 2020-08-02T16:44:11-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.

- - - - -
f2d1accf by Leon Schoorl at 2020-08-02T16:44:47-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

- - - - -
947206f4 by Niklas Hambüchen at 2020-08-03T07:52:33+02: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.

- - - - -
ef2ae81a by Alex Biehl at 2020-08-03T07:52:33+02:00
Hardcode RTS includes to cope with unregistered builds

- - - - -
d613ed76 by Sylvain Henry at 2020-08-05T03:59:27-04:00
Bignum: add backward compat integer-gmp functions

Also enhance bigNatCheck# and isValidNatural test

- - - - -
3f2f7718 by Sylvain Henry at 2020-08-05T03:59:27-04:00
Bignum: add more BigNat compat functions in integer-gmp

- - - - -
5e12cd17 by Krzysztof Gogolewski at 2020-08-05T04:00:04-04:00
Rename Core.Opt.Driver -> Core.Opt.Pipeline

Closes #18504.

- - - - -
2bff2f87 by Ben Gamari at 2020-08-05T04:00:39-04:00
Revert "iserv: Don't pass --export-dynamic on FreeBSD"

This reverts commit 2290eb02cf95e9cfffcb15fc9c593d5ef79c75d9.

- - - - -
53ce0db5 by Ben Gamari at 2020-08-05T04:00:39-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.

- - - - -
eb7013c3 by Hécate at 2020-08-05T04:01:15-04:00
Remove all the unnecessary LANGUAGE pragmas

- - - - -
fbcb886d by Ryan Scott at 2020-08-05T04:01:51-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.

- - - - -
686e06c5 by Vladislav Zavialov at 2020-08-06T13:34:05-04:00
Grammar for types and data/newtype constructors

Before this patch, we parsed types into a reversed sequence
of operators and operands. For example, (F x y + G a b * X)
would be parsed as [X, *, b, a, G, +, y, x, F],
using a simple grammar:

	tyapps
	  : tyapp
	  | tyapps tyapp

	tyapp
	  : atype
	  | PREFIX_AT atype
	  | tyop
	  | unpackedness

Then we used a hand-written state machine to assemble this
 either into a type,        using 'mergeOps',
     or into a constructor, using 'mergeDataCon'.

This is due to a syntactic ambiguity:

	data T1 a =          MkT1 a
	data T2 a = Ord a => MkT2 a

In T1, what follows after the = sign is a data/newtype constructor
declaration. However, in T2, what follows is a type (of kind
Constraint). We don't know which of the two we are parsing until we
encounter =>, and we cannot check for => without unlimited lookahead.

This poses a few issues when it comes to e.g. infix operators:

	data I1 = Int :+ Bool :+ Char          -- bad
	data I2 = Int :+ Bool :+ Char => MkI2  -- fine

By this issue alone we are forced into parsing into an intermediate
representation and doing a separate validation pass.

However, should that intermediate representation be as low-level as a
flat sequence of operators and operands?

Before GHC Proposal #229, the answer was Yes, due to some particularly
nasty corner cases:

	data T = ! A :+ ! B          -- used to be fine, hard to parse
	data T = ! A :+ ! B => MkT   -- bad

However, now the answer is No, as this corner case is gone:

	data T = ! A :+ ! B          -- bad
	data T = ! A :+ ! B => MkT   -- bad

This means we can write a proper grammar for types, overloading it in
the DisambECP style, see Note [Ambiguous syntactic categories].

With this patch, we introduce a new class, DisambTD. Just like
DisambECP is used to disambiguate between expressions, commands, and patterns,
DisambTD  is used to disambiguate between types and data/newtype constructors.

This way, we get a proper, declarative grammar for constructors and
types:

	infixtype
	  : ftype
	  | ftype tyop infixtype
	  | unpackedness infixtype

	ftype
	  : atype
	  | tyop
	  | ftype tyarg
	  | ftype PREFIX_AT tyarg

	tyarg
	  : atype
	  | unpackedness atype

And having a grammar for types means we are a step closer to using a
single grammar for types and expressions.

- - - - -
6770e199 by Vladislav Zavialov at 2020-08-06T13:34:05-04:00
Clean up the story around runPV/runECP_P/runECP_PV

This patch started as a small documentation change, an attempt to make
Note [Parser-Validator] and Note [Ambiguous syntactic categories]
more clear and up-to-date.

But it turned out that runECP_P/runECP_PV are weakly motivated,
and it's easier to remove them than to find a good rationale/explanation
for their existence.

As the result, there's a bit of refactoring in addition to
a documentation update.

- - - - -
826d07db by Vladislav Zavialov at 2020-08-06T13:34:06-04:00
Fix debug_ppr_ty ForAllTy (#18522)

Before this change, GHC would
pretty-print   forall k. forall a -> ()
          as   forall @k a. ()
which isn't even valid Haskell.

- - - - -
0ddb4384 by Vladislav Zavialov at 2020-08-06T13:34:06-04:00
Fix visible forall in ppr_ty (#18522)

Before this patch, this type:
  T :: forall k -> (k ~ k) => forall j -> k -> j -> Type
was printed incorrectly as:
  T :: forall k j -> (k ~ k) => k -> j -> Type

- - - - -
d2a43225 by Richard Eisenberg at 2020-08-06T13:34:06-04:00
Fail eagerly on a lev-poly datacon arg

Close #18534.

See commentary in the patch.

- - - - -
63348155 by Sylvain Henry at 2020-08-06T13:34:08-04:00
Use a type alias for Ways

- - - - -
9570c212 by Takenobu Tani at 2020-08-06T19:46:46-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]

- - - - -
3907ee01 by Cale Gibbard at 2020-08-07T08:34:46-04:00
A fix to an error message in monad comprehensions, and a move of dsHandleMonadicFailure
as suggested by comments on !2330.

- - - - -
fa9bb70a by Cale Gibbard at 2020-08-07T08:34:46-04:00
Add some tests for fail messages in do-expressions and monad-comprehensions.

- - - - -
5f036063 by Ben Gamari at 2020-08-07T08:35:21-04:00
cmm: Clean up Notes a bit

- - - - -
6402c124 by Ben Gamari at 2020-08-07T08:35:21-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.

- - - - -
15b36de0 by Ben Gamari at 2020-08-07T08:35:21-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].

- - - - -
3847ae0c by Ben Gamari at 2020-08-07T08:35:21-04:00
testsuite: Add test for #18527

- - - - -
dd51d53b by Ben Gamari at 2020-08-07T08:35:21-04:00
testsuite: Fix prog001

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

- - - - -
e4f1b73a by Alan Zimmerman at 2020-08-07T23:58:10-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.

- - - - -
8a665db6 by Ben Gamari at 2020-08-07T23:58:45-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.
- - - - -
a11c9678 by Adam Sandberg Ericsson at 2020-08-09T11:32:25+02:00
hadrian: depend on boot compiler version #18001

- - - - -
c8873b52 by Alan Zimmerman at 2020-08-09T21:17:54-04:00
Api Annotations : Adjust SrcSpans for prefix bang (!).

And prefix ~

(cherry picked from commit 8dbee2c578b1f642d45561be3f416119863e01eb)

- - - - -
77398b67 by Sylvain Henry at 2020-08-09T21:18:34-04:00
Avoid allocations in `splitAtList` (#18535)

As suspected by @simonpj in #18535, avoiding allocations in
`GHC.Utils.Misc.splitAtList` when there are no leftover arguments is
beneficial for performance:

   On CI validate-x86_64-linux-deb9-hadrian:
    T12227 -7%
    T12545 -12.3%
    T5030  -10%
    T9872a -2%
    T9872b -2.1%
    T9872c -2.5%

Metric Decrease:
    T12227
    T12545
    T5030
    T9872a
    T9872b
    T9872c

- - - - -
8ba41a0f by Felix Yan at 2020-08-10T20:23:29-04:00
Correct a typo in ghc.mk
- - - - -
1c469264 by Felix Yan at 2020-08-10T20:23:29-04:00
Add a closing parenthesis too

- - - - -
acf537f9 by Sylvain Henry at 2020-08-10T20:24:09-04:00
Make splitAtList strict in its arguments

Also fix its slightly wrong comment

Metric Decrease:
    T5030
    T12227
    T12545

- - - - -
ab4d1589 by Ben Gamari at 2020-08-11T22:18:03-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.

- - - - -
0ac8c0a5 by Ben Gamari at 2020-08-11T22:18:03-04:00
testsuite: Add test for #18118

- - - - -
c43078d7 by Sven Tennie at 2020-08-11T22:18:38-04:00
Add hie.yaml to ghc-heap

This enables IDE support by haskell-language-server for ghc-heap.

- - - - -
f1088b3f by Ben Gamari at 2020-08-11T22:19:15-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".

- - - - -
accbc242 by Sylvain Henry at 2020-08-12T03:50:12-04:00
DynFlags: disentangle Outputable

- put panic related functions into GHC.Utils.Panic
- put trace related functions using DynFlags in GHC.Driver.Ppr

One step closer making Outputable fully independent of DynFlags.

Bump haddock submodule

- - - - -
db6dd810 by Ben Gamari at 2020-08-12T03:50:48-04:00
testsuite: Increase tolerance of T16916

T16916 (testing #16916) has been slightly fragile in CI due to its
reliance on CPU times. While it's hard to see how to eliminate
the time-dependence entirely, we can nevertheless make it more tolerant.

Fixes #16966.

- - - - -
bee43aca by Sylvain Henry at 2020-08-12T20:52:50-04:00
Rewrite and move the monad-state hack note

The note has been rewritten by @simonpj in !3851

[skip ci]

- - - - -
25fdf25e by Alan Zimmerman at 2020-08-12T20:53:26-04:00
ApiAnnotations: Fix parser for new GHC 9.0 features

- - - - -
7831fe05 by Ben Gamari at 2020-08-13T03:44:17-04:00
parser: Suggest ImportQualifiedPost in prepositive import warning

As suggested in #18545.

- - - - -
55dec4dc by Sebastian Graf at 2020-08-13T03:44:52-04:00
PmCheck: Better long-distance info for where bindings (#18533)

Where bindings can see evidence from the pattern match of the `GRHSs`
they belong to, but not from anything in any of the guards (which belong
to one of possibly many RHSs).

Before this patch, we did *not* consider said evidence, causing #18533,
where the lack of considering type information from a case pattern match
leads to failure to resolve the vanilla COMPLETE set of a data type.

Making available that information required a medium amount of
refactoring so that `checkMatches` can return a
`[(Deltas, NonEmpty Deltas)]`; one `(Deltas, NonEmpty Deltas)` for each
`GRHSs` of the match group. The first component of the pair is the
covered set of the pattern, the second component is one covered set per
RHS.

Fixes #18533.
Regression test case: T18533

- - - - -
cf97889a by Hécate at 2020-08-13T03:45:29-04:00
Re-add BangPatterns to CodePage.hs

- - - - -
ffc0d578 by Sylvain Henry at 2020-08-13T09:49:56-04:00
Add HomeUnit type

Since Backpack the "home unit" is much more involved than what it was
before (just an identifier obtained with `-this-unit-id`). Now it is
used in conjunction with `-component-id` and `-instantiated-with` to
configure module instantiations and to detect if we are type-checking an
indefinite unit or compiling a definite one.

This patch introduces a new HomeUnit datatype which is much easier to
understand. Moreover to make GHC support several packages in the same
instances, we will need to handle several HomeUnits so having a
dedicated (documented) type is helpful.

Finally in #14335 we will also need to handle the case where we have no
HomeUnit at all because we are only loading existing interfaces for
plugins which live in a different space compared to units used to
produce target code. Several functions will have to be refactored to
accept "Maybe HomeUnit" parameters instead of implicitly querying the
HomeUnit fields in DynFlags. Having a dedicated type will make this
easier.

Bump haddock submodule

- - - - -
8a51b2ab by Sylvain Henry at 2020-08-13T21:09:15-04:00
Make IOEnv monad one-shot (#18202)

On CI (x86_64-linux-deb9-hadrian, compile_time/bytes_allocated):

    T10421     -1.8%    (threshold: +/- 1%)
    T10421a    -1.7%    (threshold: +/- 1%)
    T12150     -4.9%    (threshold: +/- 2%)
    T12227     -1.6     (threshold: +/- 1%)
    T12425     -1.5%    (threshold: +/- 1%)
    T12545     -3.8%    (threshold: +/- 1%)
    T12707     -3.0%    (threshold: +/- 1%)
    T13035     -3.0%    (threshold: +/- 1%)
    T14683     -10.3%   (threshold: +/- 2%)
    T3064      -6.9%    (threshold: +/- 2%)
    T4801      -4.3%    (threshold: +/- 2%)
    T5030      -2.6%    (threshold: +/- 2%)
    T5321FD    -3.6%    (threshold: +/- 2%)
    T5321Fun   -4.6%    (threshold: +/- 2%)
    T5631      -19.7%   (threshold: +/- 2%)
    T5642      -13.0%   (threshold: +/- 2%)
    T783       -2.7     (threshold: +/- 2%)
    T9020      -11.1    (threshold: +/- 2%)
    T9961      -3.4%    (threshold: +/- 2%)

    T1969 (compile_time/bytes_allocated)  -2.2%  (threshold: +/-1%)
    T1969 (compile_time/max_bytes_used)   +24.4% (threshold: +/-20%)

Additionally on other CIs:

    haddock.Cabal                  -10.0%   (threshold: +/- 5%)
    haddock.compiler               -9.5%    (threshold: +/- 5%)
    haddock.base (max bytes used)  +24.6%   (threshold: +/- 15%)
    T10370 (max bytes used, i386)  +18.4%   (threshold: +/- 15%)

Metric Decrease:
    T10421
    T10421a
    T12150
    T12227
    T12425
    T12545
    T12707
    T13035
    T14683
    T3064
    T4801
    T5030
    T5321FD
    T5321Fun
    T5631
    T5642
    T783
    T9020
    T9961
    haddock.Cabal
    haddock.compiler
Metric Decrease 'compile_time/bytes allocated':
    T1969
Metric Increase 'compile_time/max_bytes_used':
    T1969
    T10370
    haddock.base

- - - - -
9f66fdf6 by Ben Gamari at 2020-08-14T15:50:34-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.

- - - - -
55fd1dc5 by Ben Gamari at 2020-08-14T15:51:10-04:00
llvm-targets: Add i686 targets

Addresses #18422.

- - - - -
f4cc57fa by Ben Gamari at 2020-08-18T15:38:55-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.

- - - - -
3ac6ae7c by Ben Gamari at 2020-08-18T15:38:55-04:00
testsuite: Add test for #18291

- - - - -
a87a0b49 by Eli Schwartz at 2020-08-18T15:39:30-04:00
install: do not install sphinx doctrees

These files are 100% not needed at install time, and they contain
unreproducible info. See https://reproducible-builds.org/ for why this
matters.

- - - - -
194b25ee by Ben Gamari at 2020-08-18T15:40:05-04:00
testsuite: Allow baseline commit to be set explicitly

- - - - -
fdcf7645 by Ben Gamari at 2020-08-18T15:40:05-04:00
gitlab-ci: Use MR base commit as performance baseline

- - - - -
9ad5cab3 by Fendor at 2020-08-18T15:40:42-04:00
Expose UnitInfoMap as it is part of the public API

- - - - -
aa4b744d by Ben Gamari at 2020-08-18T22:11:36-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.

- - - - -
0c5ed5c7 by Sylvain Henry at 2020-08-18T22:12:13-04:00
DynFlags: refactor GHC.CmmToAsm (#17957, #10143)

This patch removes the use of `sdocWithDynFlags` from GHC.CmmToAsm.*.Ppr

To do that I've had to make some refactoring:

* X86' and PPC's `Instr` are no longer `Outputable` as they require a
  `Platform` argument

* `Instruction` class now exposes `pprInstr :: Platform -> instr -> SDoc`

* as a consequence, I've refactored some modules to avoid .hs-boot files

* added (derived) functor instances for some datatypes parametric in the
  instruction type. It's useful for pretty-printing as we just have to
  map `pprInstr` before pretty-printing the container datatype.

- - - - -
731c8d3b by nineonine at 2020-08-19T18:47:39-04:00
Implement -Wredundant-bang-patterns (#17340)

Add new flag '-Wredundant-bang-patterns' that enables checks for "dead" bangs.
Dead bangs are the ones that under no circumstances can force a thunk that
wasn't already forced. Dead bangs are a form of redundant bangs. The new check
is performed in Pattern-Match Coverage Checker along with other checks (namely,
redundant and inaccessible RHSs). Given

    f :: Bool -> Int
    f True = 1
    f !x   = 2

we can detect dead bang patterns by checking whether @x ~ ⊥@ is satisfiable
where the PmBang appears in 'checkGrdTree'. If not, then clearly the bang is
dead. Such a dead bang is then indicated in the annotated pattern-match tree by
a 'RedundantSrcBang' wrapping. In 'redundantAndInaccessibles', we collect
all dead bangs to warn about.

Note that we don't want to warn for a dead bang that appears on a redundant
clause. That is because in that case, we recommend to delete the clause wholly,
including its leading pattern match.

Dead bang patterns are redundant. But there are bang patterns which are
redundant that aren't dead, for example

    f !() = 0

the bang still forces the match variable, before we attempt to match on (). But
it is redundant with the forcing done by the () match. We currently don't
detect redundant bangs that aren't dead.

- - - - -
eb9bdaef by Simon Peyton Jones at 2020-08-19T18:48:14-04:00
Add right-to-left rule for pattern bindings

Fix #18323 by adding a few lines of code to handle non-recursive
pattern bindings.  see GHC.Tc.Gen.Bind
Note [Special case for non-recursive pattern bindings]

Alas, this confused the pattern-match overlap checker; see #18323.

Note that this patch only affects pattern bindings like that
for (x,y) in this program

  combine :: (forall a . [a] -> a) -> [forall a. a -> a]
          -> ((forall a . [a] -> a), [forall a. a -> a])

  breaks = let (x,y) = combine head ids
           in x y True

We need ImpredicativeTypes for those [forall a. a->a] types to be
valid. And with ImpredicativeTypes the old, unprincipled "allow
unification variables to unify with a polytype" story actually
works quite well. So this test compiles fine (if delicatedly) with
old GHCs; but not with QuickLook unless we add this patch

- - - - -
293c7fba by Sylvain Henry at 2020-08-21T09:36:38-04:00
Put CFG weights into their own module (#17957)

It avoids having to query DynFlags to get them

- - - - -
50eb4460 by Sylvain Henry at 2020-08-21T09:36:38-04:00
Don't use DynFlags in CmmToAsm.BlockLayout (#17957)

- - - - -
659eb31b by Sylvain Henry at 2020-08-21T09:36:38-04:00
NCG: Dwarf configuration

* remove references to DynFlags in GHC.CmmToAsm.Dwarf
* add specific Dwarf options in NCGConfig instead of directly querying
  the debug level

- - - - -
2d8ca917 by Sylvain Henry at 2020-08-21T09:37:15-04:00
Fix -ddump-stg flag

-ddump-stg was dumping the initial STG (just after Core-to-STG pass)
which was misleading because we want the final STG to know if a function
allocates or not. Now we have a new flag -ddump-stg-from-core for this and
-ddump-stg is deprecated.

- - - - -
fddddbf4 by Vladislav Zavialov at 2020-08-21T09:37:49-04: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.

- - - - -
989c1c27 by Ben Gamari at 2020-08-21T11:27:53-04:00
gitlab-ci: Test master branch as well

While these builds are strictly speaking redundant (since every commit
is tested by @marge-bot before making it into `master`), they are nevertheless
useful as they are displayed in the branch's commit list in GitLab's web interface.

Fixes #18595.
- - - - -
e67ae884 by Aditya Gupta at 2020-08-22T03:29:00-04:00
mkUnique refactoring (#18362)

Move uniqFromMask from Unique.Supply to Unique.
Move the the functions that call mkUnique from Unique to Builtin.Uniques

- - - - -
03cfcfd4 by Wander Hillen at 2020-08-22T03:29:36-04:00
Add ubuntu 20.04 jobs for nightly and release

- - - - -
3f501545 by Craig Ferguson at 2020-08-22T03:30:13-04:00
Utils: clarify docs slightly

The previous comment implies `nTimes n f` is either `f^{n+1}` or
`f^{2^n}` (when in fact it's `f^n`).

- - - - -
8b865092 by Krzysztof Gogolewski at 2020-08-23T14:12:53+02: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'.

- - - - -
d8f61182 by Krzysztof Gogolewski at 2020-08-23T14:12:56+02:00
Move pprTyTcApp' inside pprTyTcApp

No semantic change

- - - - -
364258e0 by Krzysztof Gogolewski at 2020-08-24T00:32:31-04:00
Fix types in silly shifts (#18589)

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

- - - - -
b1eb38a0 by Sylvain Henry at 2020-08-24T00:33:13-04:00
Perf: make SDoc monad one-shot (#18202)

With validate-x86_64-linux-deb9-hadrian:
   T1969  -3.4% (threshold: +/-1%)
   T3294  -3.3% (threshold: +/-1%)
   T12707 -1.4% (threshold: +/-1%)

Additionally with validate-x86_64-linux-deb9-unreg-hadrian:
   T4801  -2.4% (threshold: +/-2%)
   T13035 -1.4% (threshold: +/-1%)
   T13379 -2.4% (threshold: +/-2%)
   ManyAlternatives -2.5% (threshold: +/-2%)
   ManyConstructors -3.0% (threshold: +/-2%)

Metric Decrease:
    T12707
    T1969
    T3294
    ManyAlternatives
    ManyConstructors
    T13035
    T13379
    T4801

- - - - -
a77b9ec2 by Krzysztof Gogolewski at 2020-08-24T10:04:20-04:00
Add a test for #18397

The bug was fixed by !3421.

- - - - -
05550a5a by Sylvain Henry at 2020-08-24T10:04:59-04:00
Avoid roundtrip through SDoc

As found by @monoidal on https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3885#note_295126

- - - - -
0a1ecc5f by Ben Gamari at 2020-08-25T07:37:05-04:00
SysTools.Process: Handle exceptions in readCreateProcessWithExitCode'

In #18069 we are observing MVar deadlocks from somewhere in ghc.exe.
This use of MVar stood out as being one of the more likely culprits.
Here we make sure that it is exception-safe.

- - - - -
db8793ad by Richard Eisenberg at 2020-08-25T07:37:40-04:00
Use tcView, not coreView, in the pure unifier.

Addresses a lingering point within #11715.

- - - - -
fb77207a by Simon Peyton Jones at 2020-08-25T07:38:16-04:00
Use LIdP rather than (XRec p (IdP p))

This patch mainly just replaces use of
    XRec p (IdP p)
with
    LIdP p

One slightly more significant change is to parameterise
HsPatSynDetails over the pass rather than the argument type,
so that it's uniform with HsConDeclDetails and HsConPatDetails.

I also got rid of the dead code GHC.Hs.type.conDetailsArgs

But this is all just minor refactoring. No change in functionality.

- - - - -
8426a136 by Krzysztof Gogolewski at 2020-08-25T07:38:54-04:00
Add a test for #18585

- - - - -
2d635a50 by Takenobu Tani at 2020-08-26T04:50:21-04:00
linters: Make CPP linter skip image files

This patch adds an exclusion rule for `docs/users_guide/images`,
to avoid lint errors of PDF files.

- - - - -
b7d98cb2 by Takenobu Tani at 2020-08-26T04:50:21-04:00
users-guide: Color the logo on the front page of the PDF

This patch updates the logo with a recent color scheme.
This affects only the PDF version of the user's guide.

See also:
* https://mail.haskell.org/pipermail/ghc-devs/2020-August/019139.html
* https://gitlab.haskell.org/ghc/ghc/-/wikis/logo

- - - - -
0b17fa18 by Sylvain Henry at 2020-08-26T04:50:58-04:00
Refactor UnitId pretty-printing

When we pretty-print a UnitId for the user, we try to map it back to its
origin package name, version and component to print
"package-version:component" instead of some hash.

The UnitId type doesn't carry these information, so we have to look into
a UnitState to find them. This is why the Outputable instance of
UnitId used `sdocWithDynFlags` in order to access the `unitState` field
of DynFlags.

This is wrong for several reasons:

1. The DynFlags are accessed when the message is printed, not when it is
   generated. So we could imagine that the unitState may have changed
   in-between. Especially if we want to allow unit unloading.

2. We want GHC to support several independent sessions at once, hence
   several UnitState. The current approach supposes there is a unique
   UnitState as a UnitId doesn't indicate which UnitState to use.

See the Note [Pretty-printing UnitId] in GHC.Unit for the new approach
implemented by this patch.

One step closer to remove `sdocDynFlags` field from `SDocContext`
(#10143).

Fix #18124.

Also fix some Backpack code to use SDoc instead of String.

- - - - -
dc476a50 by Sylvain Henry at 2020-08-26T04:51:35-04:00
Bignum: fix BigNat subtraction (#18604)

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

- - - - -
fcb10b6c by Peter Trommler at 2020-08-26T10:42:30-04:00
PPC and X86: Portable printing of IEEE floats

GNU as and the AIX assembler support floating point literals.
SPARC seems to have support too but I cannot test on SPARC.
Curiously, `doubleToBytes` is also used in the LLVM backend.

To avoid endianness issues when cross-compiling float and double literals
are printed as C-style floating point values. The assembler then takes
care of memory layout and endianness.

This was brought up in #18431 by @hsyl20.

- - - - -
770100e0 by Krzysztof Gogolewski at 2020-08-26T10:43:13-04:00
primops: Remove Monadic and Dyadic categories

There were four categories of primops: Monadic, Dyadic, Compare, GenPrimOp.

The compiler does not treat Monadic and Dyadic in any special way,
we can just replace them with GenPrimOp.

Compare is still used in isComparisonPrimOp.

- - - - -
01ff8c89 by Aditya Gupta at 2020-08-27T14:19:26-04:00
Consolidate imports in getMinimalImports (#18264)

- - - - -
bacccb73 by Ryan Scott at 2020-08-27T14:20:01-04:00
Make {hsExpr,hsType,pat}NeedsParens aware of boxed 1-tuples

`hsExprNeedsParens`, `hsTypeNeedsParens`, and `patNeedsParens`
previously assumed that all uses of explicit tuples in the source
syntax never need to be parenthesized. This is true save for one
exception: boxed one-tuples, which use the `Solo` data type from
`GHC.Tuple` instead of special tuple syntax. This patch adds the
necessary logic to the three `*NeedsParens` functions to handle
`Solo` correctly.

Fixes #18612.

- - - - -
c6f50cea by Krzysztof Gogolewski at 2020-08-28T02:22:36-04:00
Add missing primop documentation (#18454)

- Add three pseudoops to primops.txt.pp, so that Haddock renders
  the documentation
- Update comments
- Remove special case for "->" - it's no longer exported from GHC.Prim
- Remove reference to Note [Compiling GHC.Prim] - the ad-hoc fix is no
  longer there after updates to levity polymorphism.
- Document GHC.Prim
- Remove the comment that lazy is levity-polymorphic.
  As far as I can tell, it never was: in 80e399639,
  only the unfolding was given an open type variable.
- Remove haddock hack in GHC.Magic - no longer neccessary after
  adding realWorld# to primops.txt.pp.

- - - - -
f065b6b0 by Tamar Christina at 2020-08-28T02:23:13-04:00
Fix use distro toolchian

- - - - -
4517a382 by Tamar Christina at 2020-08-28T02:23:13-04:00
document how build system find toolchains on Windows

- - - - -
329f7cb9 by Ben Gamari at 2020-08-31T22:59:14-04:00
base: Better error message on invalid getSystemTimerManager call

Previously we would produce a rather unhelpful pattern match failure
error in the case where the user called `getSystemTimerManager` in a
program which isn't built with `-threaded`. This understandably confused
the user in #15616.

Fixes #15616.

- - - - -
f6d70a8f by Roland Senn at 2020-08-31T22:59:50-04:00
Add tests for #15617.

Avoid a similar regression in the future.

- - - - -
e5969fd0 by Roland Senn at 2020-08-31T23:00:27-04:00
Add additional tests for #18172 (Followup MR 3543)

There was still one active discussion [thread](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3543#note_284325) when MR !3543 got merged.

This MR adds the requested tests exercising the changes in
`compiler/GHC/HsToCore/Match/Literal.hs:warnAboutEmptyEnumerations` and its sub-functions.

- - - - -
fe18b482 by Ben Gamari at 2020-08-31T23:01:02-04:00
Bump Win32 and process submodules

- - - - -
2da93308 by Sylvain Henry at 2020-08-31T23:01:39-04:00
Hadrian: fix slow-validate flavour (#18586)

- - - - -
85e13008 by Andreas Klebinger at 2020-08-31T23:02:15-04:00
Update dominator code with fixes from the dom-lt package.

Two bugs turned out in the package that have been fixed since.
This MR includes this fixes in the GHC port of the code.

- - - - -
dffb38fa by Andreas Klebinger at 2020-08-31T23:02:15-04:00
Dominators.hs: Use unix line endings

- - - - -
6189cc04 by Moritz Angermann at 2020-08-31T23:02:50-04:00
[fixup 3433] move debugBelch into IF_DEBUG(linker)

The commit in dff1cb3d9c111808fec60190747272b973547c52 incorrectly left
the `debugBelch` function without a comment or IF_DEBUG(linker,)
decoration. This rectifies it.

Needs at least a 8.10 backport, as it was backported in 6471cc6aff80d5deebbdb1bf7b677b31ed2af3d5

- - - - -
bcb68a3f by Sylvain Henry at 2020-08-31T23:03:27-04:00
Don't store HomeUnit in UnitConfig

Allow the creation of a UnitConfig (hence of a UnitState) without having
a HomeUnit. It's required for #14335.

- - - - -
0a372387 by Sylvain Henry at 2020-08-31T23:04:04-04:00
Fix documentation and fix "check" bignum backend (#18604)

- - - - -
eb85f125 by Moritz Angermann at 2020-08-31T23:04:39-04:00
Set the dynamic-system-linker flag to Manual

This flag should be user controllable, hence Manual: True.

- - - - -
380ef845 by Sven Tennie at 2020-08-31T23:05:14-04:00
Ignore more files

Ignore files from "new style" cabal builds (dist-newstyle folders) and
from clangd (C language server).

- - - - -
74a7fbff by Takenobu Tani at 2020-08-31T23:05:51-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.

- - - - -
a4473f02 by Takenobu Tani at 2020-08-31T23:05:51-04:00
Limit upper version of Happy for ghc-9.2 (#18620)

This patch adds the upper bound of a happy version for ghc-9.2.

Currently, We can use happy-1.19 or happy-1.20 for ghc-9.2.

See #18620.

- - - - -
a8a2568b by Sylvain Henry at 2020-08-31T23:06:28-04:00
Bignum: add BigNat compat functions (#18613)

- - - - -
884245dd by Sylvain Henry at 2020-09-01T12:39:36-04:00
Fix FastString lexicographic ordering (fix #18562)

- - - - -
4b4fbc58 by Sylvain Henry at 2020-09-01T12:39:36-04:00
Remove "Ord FastString" instance

FastStrings can be compared in 2 ways: by Unique or lexically. We don't
want to bless one particular way with an "Ord" instance because it leads
to bugs (#18562) or to suboptimal code (e.g. using lexical comparison
while a Unique comparison would suffice).

UTF-8 encoding has the advantage that sorting strings by their encoded
bytes also sorts them by their Unicode code points, without having to
decode the actual code points. BUT GHC uses Modified UTF-8 which
diverges from UTF-8 by encoding \0 as 0xC080 instead of 0x00 (to avoid
null bytes in the middle of a String so that the string can still be
null-terminated). This patch adds a new `utf8CompareShortByteString`
function that performs sorting by bytes but that also takes Modified
UTF-8 into account. It is much more performant than decoding the strings
into [Char] to perform comparisons (which we did in the previous patch).

Bump haddock submodule

- - - - -
b4edcde7 by Ben Gamari at 2020-09-01T14:53:42-04:00
testsuite: Add broken test for #18302

- - - - -
bfab2a30 by Sebastian Graf at 2020-09-02T15:54:55-04:00
Turn on -XMonoLocalBinds by default (#18430)

And fix the resulting type errors.

Co-authored-by: Krzysztof Gogolewski <krz.gogolewski at gmail.com>

Metric Decrease:
    parsing001

- - - - -
c30cc0e9 by David Feuer at 2020-09-02T15:55:31-04:00
Remove potential space leak from Data.List.transpose

Previously, `transpose` produced a list of heads
and a list of tails independently. This meant that
a function using only some heads, and only some tails,
could potentially leak space. Use `unzip` to work
around the problem by producing pairs and selector
thunks instead. Time and allocation behavior will
be worse, but there should be no more leak potential.
- - - - -
ffc3da47 by Sylvain Henry at 2020-09-02T15:56:11-04:00
Remove outdated note

- - - - -
85e62123 by Sylvain Henry at 2020-09-02T15:56:48-04:00
Bignum: add missing compat import/export functions

- - - - -
397c2b03 by Ben Gamari at 2020-09-03T17:31:47-04:00
configure: Work around Raspbian's silly packaging decisions

See #17856.

- - - - -
4891c18a by Kathryn Spiers at 2020-09-03T17:32:24-04:00
expected-undocumented-flags remove kill flags

It looks like the flags were removed in https://gitlab.haskell.org/ghc/ghc/-/commit/3e27205a66b06a4501d87eb31e285eadbc693eb7
and can safely be removed here
- - - - -
1d6d6488 by Sylvain Henry at 2020-09-04T16:24:20-04:00
Don't rely on CLabel's Outputable instance in CmmToC

This is in preparation of the removal of sdocWithDynFlags (#10143),
hence of the refactoring of CLabel's Outputable instance.

- - - - -
89ce7cdf by Sylvain Henry at 2020-09-04T16:24:59-04:00
DynFlags: use Platform in foldRegs*

- - - - -
220ad8d6 by Sylvain Henry at 2020-09-04T16:24:59-04:00
DynFlags: don't pass DynFlags to cmmImplementSwitchPlans

- - - - -
c1e54439 by Ryan Scott at 2020-09-04T16:25:35-04:00
Introduce isBoxedTupleDataCon and use it to fix #18644

The code that converts promoted tuple data constructors to
`IfaceType`s in `GHC.CoreToIface` was using `isTupleDataCon`, which
conflates boxed and unboxed tuple data constructors. To avoid this,
this patch introduces `isBoxedTupleDataCon`, which is like
`isTupleDataCon` but only works for _boxed_ tuple data constructors.

While I was in town, I was horribly confused by the fact that there
were separate functions named `isUnboxedTupleCon` and
`isUnboxedTupleTyCon` (similarly, `isUnboxedSumCon` and
`isUnboxedSumTyCon`). It turns out that the former only works for
data constructors, despite its very general name! I opted to rename
`isUnboxedTupleCon` to `isUnboxedTupleDataCon` (similarly, I renamed
`isUnboxedSumCon` to `isUnboxedSumDataCon`) to avoid this potential
confusion, as well as to be more consistent with
the naming convention I used for `isBoxedTupleDataCon`.

Fixes #18644.

- - - - -
07bdcac3 by GHC GitLab CI at 2020-09-04T22:26:25-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).

- - - - -
0be8e746 by Benjamin Maurer at 2020-09-04T22:27:01-04:00
Documented the as of yet undocumented '--print-*'  GHC flags,
as well as `-split-objs`, since that is related to
`--print-object-splitting-supported`.
See #18641

- - - - -
4813486f by Sylvain Henry at 2020-09-04T22:27:44-04:00
Move Hadrian's wiki pages in tree (fix #16165)

Only the debugging page contains interesting stuff. Some of this stuff
looks old (e.g. recommending "cabal install")...

- - - - -
7980ae23 by GHC GitLab CI at 2020-09-05T14:50:52-04:00
rts: Consistently use stgMallocBytes instead of malloc

This can help in debugging RTS memory leaks since all allocations go
through the same interface.

- - - - -
67059893 by Ben Gamari at 2020-09-05T14:51:27-04:00
configure: Fix whitespace

- - - - -
be2cc0ad by Ben Gamari at 2020-09-05T14:51:27-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.

- - - - -
15dca847 by Ben Gamari at 2020-09-05T14:51:27-04:00
gitlab-ci: Rename RELEASE variable to RELEASE_JOB

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

- - - - -
bec0d170 by Ben Gamari at 2020-09-05T14:51:27-04:00
gitlab-ci: Bump Windows toolchain version

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

- - - - -
9fbaee21 by Ben Gamari at 2020-09-05T14:51:27-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.

- - - - -
869f6e19 by Ben Gamari at 2020-09-05T14:51:27-04:00
testsuite: Drop Windows-specific output for parseTree

The normalise_slashes normaliser should handle this.

- - - - -
2c9f743c by Ben Gamari at 2020-09-05T14:51:28-04:00
testsuite: Mark T5975[ab] as broken on Windows

Due to #7305.

- - - - -
643785e3 by Ben Gamari at 2020-09-05T14:51:28-04:00
gitlab-ci: Fix typo

A small typo in a rule regular expression.

- - - - -
c5413fc6 by Wander Hillen at 2020-09-07T09:33:54-04:00
Add clarification regarding poll/kqueue flags

- - - - -
10434d60 by Ben Gamari at 2020-09-07T09:34:32-04:00
gitlab-ci: Configure bignum backend in Hadrian builds

- - - - -
d4bc9f0d by Ben Gamari at 2020-09-07T09:34:32-04:00
gitlab-ci: Use hadrian builds for Windows release artifacts

- - - - -
4ff93292 by Moritz Angermann at 2020-09-07T21:18:39-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)

- - - - -
df04b81e by Sylvain Henry at 2020-09-07T21:19:20-04:00
Move DynFlags test into updateModDetailsIdInfos's caller (#17957)

- - - - -
ea1cbb8f by Ben Gamari at 2020-09-08T15:42:02-04:00
rts: Add stg_copyArray_barrier to RtsSymbols list

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

- - - - -
d7b2f799 by Daishi Nakajima at 2020-09-08T15:42:41-04:00
testsuite: Output performance test results in tabular format
this was suggested in #18417.

Change the print format of the values.
* Shorten commit hash
* Reduce precision of the "Value" field
* Shorten metrics name
  * e.g. runtime/bytes allocated -> run/alloc
* Shorten "MetricsChange"
  * e.g. unchanged -> unch, increased -> incr

And, print the baseline environment if there are baselines that were
measured in a different environment than the current environment.

If all "Baseline commit" are the same, print it once.

- - - - -
44472daf by Ryan Scott at 2020-09-08T15:43:16-04:00
Make the forall-or-nothing rule only apply to invisible foralls (#18660)

This fixes #18660 by changing `isLHsForAllTy` to
`isLHsInvisForAllTy`, which is sufficient to make the
`forall`-or-nothing rule only apply to invisible `forall`s. I also
updated some related documentation and Notes while I was in the
neighborhood.

- - - - -
0c61cbff by Ben Gamari at 2020-09-08T15:43:54-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)

- - - - -
d989c842 by Ben Gamari at 2020-09-08T15:43:55-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)

- - - - -
e5a2899c by John Ericson at 2020-09-09T00:46:05-04:00
Use "to" instead of "2" in internal names of conversion ops

Change the constructors for the primop union, and also names of the
literal conversion functions.

"2" runs into trouble when we need to do conversions from fixed-width
types, and end up with thing like "Int642Word".

Only the names internal to GHC are changed, as I don't want to worry
about breaking changes ATM.

- - - - -
822f1057 by Ryan Scott at 2020-09-09T00:46:41-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.

- - - - -
8c892689 by Sylvain Henry at 2020-09-09T11:19:24-04:00
DynFlags: add OptCoercionOpts

Use OptCoercionOpts to avoid threading DynFlags all the way down to
GHC.Core.Coercion.Opt

- - - - -
3f32a9c0 by Sylvain Henry at 2020-09-09T11:19:24-04:00
DynFlags: add UnfoldingOpts and SimpleOpts

Milestone: after this patch, we only use 'unsafeGlobalDynFlags' for the
state hack and for debug in Outputable.

- - - - -
b3df72a6 by Sylvain Henry at 2020-09-09T11:19:24-04:00
DynFlags: add sm_pre_inline field into SimplMode (#17957)

It avoids passing and querying DynFlags down in the simplifier.

- - - - -
ffae5792 by Sylvain Henry at 2020-09-09T11:19:24-04:00
Add comments about sm_dflags and simpleOptExpr

- - - - -
7911d0d9 by Alan Zimmerman at 2020-09-09T11:20:03-04:00
Remove GENERATED pragma, as it is not being used

@alanz pointed out on ghc-devs that the payload of this pragma does
not appear to be used anywhere.

I (@bgamari) did some digging and traced the pragma's addition back to
d386e0d2 (way back in 2006!).

It appears that it was intended to be used by code generators for use
in informing the code coveraging checker about generated code
provenance. When it was added it used the pragma's "payload" fields as
source location information to build an "ExternalBox". However, it
looks like this was dropped a year later in 55a5d8d9.  At this point
it seems like the pragma serves no useful purpose.

Given that it also is not documented, I think we should remove it.

Updates haddock submodule

Closes #18639

- - - - -
5aae5b32 by Ben Gamari at 2020-09-09T18:31:40-04:00
gitlab-ci: Bump Docker images

We now generate our Docker images via Dhall definitions, as described in
ghc/ci-images!52. Additionally, we are far more careful about where tools
come from, using the ALEX, HAPPY, HSCOLOR, and GHC environment variables
(set in the Dockerfiles) to find bootstrapping tools.

- - - - -
4ce9fe88 by Ben Gamari at 2020-09-09T18:31:40-04:00
hadrian: Fix leakage of GHC in PATH into build

Previously hadrian would use GHC on PATH when configuring packages (or
fail if there is no such GHC). Fix this. Unfortunately this runs into
another bug in Cabal which we workaround.

- - - - -
291a15dd by Ben Gamari at 2020-09-09T18:31:40-04:00
utils: Bump cabal-version of hp2ps and unlit

- - - - -
4798caa0 by David Himmelstrup at 2020-09-09T18:32:16-04:00
rts comment: RTS_TICKY_SYMBOLS moved from rts/Linker.c to rts/RtsSymbols.c

- - - - -
67ce72da by Sebastian Graf at 2020-09-10T10:35:33-04:00
Add long-distance info for pattern bindings (#18572)

We didn't consider the RHS of a pattern-binding before, which led to
surprising warnings listed in #18572.

As can be seen from the regression test T18572, we get the expected
output now.

- - - - -
1207576a by Sebastian Graf at 2020-09-10T10:35:33-04:00
PmCheck: Big refactor using guard tree variants more closely following source syntax (#18565)

Previously, we desugared and coverage checked plain guard trees as
described in Lower Your Guards. That caused (in !3849) quite a bit of
pain when we need to partially recover tree structure of the input
syntax to return covered sets for long-distance information, for
example.

In this refactor, I introduced a guard tree variant for each relevant
source syntax component of a pattern-match (mainly match groups, match,
GRHS, empty case, pattern binding). I made sure to share as much
coverage checking code as possible, so that the syntax-specific checking
functions are just wrappers around the more substantial checking
functions for the LYG primitives (`checkSequence`, `checkGrds`).

The refactoring payed off in clearer code and elimination of all panics
related to assumed guard tree structure and thus fixes #18565.

I also took the liberty to rename and re-arrange the order of functions
and comments in the module, deleted some dead and irrelevant Notes,
wrote some new ones and gave an overview module haddock.

- - - - -
95455982 by GHC GitLab CI at 2020-09-10T10:36:09-04:00
hadrian: Don't include -fdiagnostics-color in argument hash

Otherwise the input hash will vary with whether colors are requested,
which changed with `isatty`.

Fixes #18672.

- - - - -
6abe4a1c by Sebastian Graf at 2020-09-10T17:02:00+02:00
.gitignore *.hiedb files

- - - - -
3777be14 by Sebastian Graf at 2020-09-10T17:03:12+02:00
PmCheck: Handle ⊥ and strict fields correctly (#18341)

In #18341, we discovered an incorrect digression from Lower Your Guards.
This MR changes what's necessary to support properly fixing #18341.

In particular, bottomness constraints are now properly tracked in the
oracle/inhabitation testing, as an additional field
`vi_bot :: Maybe Bool` in `VarInfo`. That in turn allows us to
model newtypes as advertised in the Appendix of LYG and fix #17725.
Proper handling of ⊥ also fixes #17977 (once again) and fixes #18670.

For some reason I couldn't follow, this also fixes #18273.

I also added a couple of regression tests that were missing. Most of
them were already fixed before.

In summary, this patch fixes #18341, #17725, #18273, #17977 and #18670.

Metric Decrease:
    T12227

- - - - -
1bd28931 by David Himmelstrup at 2020-09-11T09:59:43-04:00
Define TICKY_TICKY when compiling cmm RTS files.

- - - - -
15e67801 by David Himmelstrup at 2020-09-11T09:59:43-04:00
Fix typos in TICKY_TICKY symbol names.

- - - - -
8a5a91cb by David Himmelstrup at 2020-09-11T09:59:43-04:00
Enable TICKY_TICKY for debug builds when building with makefiles.

- - - - -
fc965c09 by Sandy Maguire at 2020-09-12T00:31:36-04:00
Add clamp function to Data.Ord

- - - - -
fb6e29e8 by Sandy Maguire at 2020-09-12T00:31:37-04:00
Add tests

- - - - -
2a942285 by Sebastian Graf at 2020-09-12T00:32:13-04:00
PmCheck: Disattach COMPLETE pragma lookup from TyCons

By not attaching COMPLETE pragmas with a particular TyCon and instead
assume that every COMPLETE pragma is applicable everywhere, we can
drastically simplify the logic that tries to initialise available
COMPLETE sets of a variable during the pattern-match checking process,
as well as fixing a few bugs.

Of course, we have to make sure not to report any of the
ill-typed/unrelated COMPLETE sets, which came up in a few regression
tests.

In doing so, we fix #17207, #18277 and #14422.

There was a metric decrease in #18478 by ~20%.

Metric Decrease:
    T18478

- - - - -
389a6683 by Ben Gamari at 2020-09-12T00:32:49-04:00
hadrian: Pass input file to makeindex

Strangely I find that on Alpine (and apparently only on Alpine) the
latex makeindex command expects to be given a filename, lest it reads
from stdin.

- - - - -
853d121a by Ryan Scott at 2020-09-12T00:33:25-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.

- - - - -
8440b5fa by Krzysztof Gogolewski at 2020-09-12T00:33:25-04:00
Make sure we can read past perf notes

See #18656.

- - - - -
2157be52 by theobat at 2020-09-12T21:27:04-04:00
Avoid iterating twice in `zipTyEnv` (#18535)

zipToUFM is a new function to replace `listToUFM (zipEqual ks vs)`.
An explicit recursion is preferred due to the sensible nature of fusion.

    T12227 -6.0%
    T12545 -12.3%
    T5030  -9.0%
    T9872a -1.6%
    T9872b -1.6%
    T9872c -2.0%

 -------------------------
Metric Decrease:
    T12227
    T12545
    T5030
    T9872a
    T9872b
    T9872c
-------------------------

- - - - -
69ea2fee by Sebastian Graf at 2020-09-12T21:27:40-04:00
Make `tcCheckSatisfiability` incremental (#18645)

By taking and returning an `InertSet`.
Every new `TcS` session can then pick up where a prior session left with
`setTcSInerts`.

Since we don't want to unflatten the Givens (and because it leads to
infinite loops, see !3971), we introduced a new variant of `runTcS`,
`runTcSInerts`, that takes and returns the `InertSet` and makes
sure not to unflatten the Givens after running the `TcS` action.

Fixes #18645 and #17836.

Metric Decrease:
    T17977
    T18478

- - - - -
a77e48d2 by Sebastian Graf at 2020-09-12T21:27:40-04:00
Extract definition of DsM into GHC.HsToCore.Types

`DsM` was previously defined in `GHC.Tc.Types`, along with `TcM`. But
`GHC.Tc.Types` is in the set of transitive dependencies of `GHC.Parser`,
a set which we aim to minimise. Test case `CountParserDeps` checks for
that.

Having `DsM` in that set means the parser also depends on the innards of
the pattern-match checker in `GHC.HsToCore.PmCheck.Types`, which is the
reason we have that module in the first place.

In the previous commit, we represented the `TyState` by an `InertSet`,
but that pulls the constraint solver as well as 250 more modules into
the set of dependencies, triggering failure of `CountParserDeps`.
Clearly, we want to evolve the pattern-match checker (and the desugarer)
without being concerned by this test, so this patch includes a small
refactor that puts `DsM` into its own module.

- - - - -
fd5d622a by Sebastian Graf at 2020-09-12T21:27:40-04:00
Hackily decouple the parser from the desugarer

In a hopefully temporary hack, I re-used the idea from !1957 of using a
nullary type family to break the dependency from GHC.Driver.Hooks on the
definition of DsM ("Abstract Data").
This in turn broke the last dependency from the parser to the desugarer.
More details in `Note [The Decoupling Abstract Data Hack]`.

In the future, we hope to undo this hack again in favour of breaking the
dependency from the parser to DynFlags altogether.

- - - - -
35a7b7ec by Adam Sandberg Eriksson at 2020-09-14T17:46:16-04:00
docs: -B rts option sounds the bell on every GC (#18351)
- - - - -
5ae8212c by Wander Hillen at 2020-09-14T17:46:54-04:00
Populate gitlab cache after building

- - - - -
a5ffb39a by Wander Hillen at 2020-09-14T17:46:54-04:00
Move ahead cabal cache restoration to before use of cabal

- - - - -
e8b37c21 by Wander Hillen at 2020-09-14T17:46:54-04:00
Do the hadrian rebuild multicore

- - - - -
07762eb5 by Wander Hillen at 2020-09-14T17:46:54-04:00
Also cache other hadrian builds

- - - - -
8610bcbe by DenisFrezzato at 2020-09-15T15:19:08-04:00
Fix rtsopts documentation

- - - - -
c7182a5c by Simon Peyton Jones at 2020-09-15T15:19:44-04: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.

- - - - -
0f3884b0 by Zubin Duggal at 2020-09-15T15:20:23-04:00
Export enrichHie from GHC.Iface.Ext.Ast

This is useful for `ghcide`

- - - - -
b3143f5a by Sylvain Henry at 2020-09-15T15:21:06-04:00
Enhance metrics output

- - - - -
4283feaa by Ryan Scott at 2020-09-15T15:21:43-04:00
Introduce and use DerivClauseTys (#18662)

This switches `deriv_clause_tys` so that instead of using a list of
`LHsSigType`s to represent the types in a `deriving` clause, it now
uses a sum type. `DctSingle` represents a `deriving` clause with no
enclosing parentheses, while `DctMulti` represents a clause with
enclosing parentheses. This makes pretty-printing easier and avoids
confusion between `HsParTy` and the enclosing parentheses in
`deriving` clauses, which are different semantically.

Fixes #18662.

- - - - -
90229c4b by Ryan Scott at 2020-09-16T04:53:22-04:00
Include -f{write,validate}-ide-info in the User's Guide flag reference

Previously, these were omitted from the flag reference due to a
layout oversight in `docs/users_guide/flags.{rst,py}`.

Fixes #18426.

- - - - -
ce42e187 by Ben Gamari at 2020-09-16T04:53:59-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.

- - - - -
b695e7d7 by Sylvain Henry at 2020-09-16T04:54:38-04:00
Rename ghci flag into internal-interpreter

"ghci" as a flag name was confusing because it really enables the
internal-interpreter. Even the ghci library had a "ghci" flag...

- - - - -
8af954d2 by Sylvain Henry at 2020-09-16T04:55:17-04:00
Make ghc-boot reexport modules from ghc-boot-th

Packages don't have to import both ghc-boot and ghc-boot-th. It makes
the dependency graph easier to understand and to refactor.

- - - - -
6baa67f5 by Adam Sandberg Eriksson at 2020-09-16T07:45:47-04:00
docs: correct haddock reference

[skip ci]
- - - - -
7cf09ab0 by Simon Peyton Jones at 2020-09-17T01:27:25-04:00
Do absence analysis on stable unfoldings

Ticket #18638 showed that Very Bad Things happen if we fail
to do absence analysis on stable unfoldings.  It's all described
in Note [Absence analysis for stable unfoldings and RULES].

I'm a bit surprised this hasn't bitten us before. Fortunately
the fix is pretty simple.

- - - - -
76d3bcbc by Leif Metcalf at 2020-09-17T01:28:01-04:00
Replace deprecated git --recursive

The --recursive flag of git-clone has been replaced by the
--recurse-submodules flag since git 1.7.4, released in 2011.
- - - - -
da8f4ddd by Richard Eisenberg at 2020-09-17T01:28:38-04:00
Document IfaceTupleTy

- - - - -
289c151f by Andreas Klebinger at 2020-09-17T14:09:12+02:00
Increase -A default to 4MB.

This gives a small increase in performance under most circumstances.

For single threaded GC the improvement is on the order of 1-2%.

For multi threaded GC the results are quite noisy but seem to
fall into the same ballpark.

Fixes #16499

- - - - -


30 changed files:

- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/linters/check-cpp.py
- .gitlab/test-metrics.sh
- CODEOWNERS
- Makefile
- README.md
- aclocal.m4
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs
- + compiler/GHC/Builtin/RebindableNames.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types.hs-boot
- compiler/GHC/Builtin/Types/Literals.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Builtin/Uniques.hs
- compiler/GHC/Builtin/Uniques.hs-boot
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/InfoTable.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/CallConv.hs
- compiler/GHC/Cmm/CommonBlockElim.hs
- compiler/GHC/Cmm/DebugBlock.hs
- compiler/GHC/Cmm/Expr.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d5275f44a45317d9806fb28ff94bc0b7d9aa99d1...289c151f405f39358030e1f4b1f757fb157c059f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d5275f44a45317d9806fb28ff94bc0b7d9aa99d1...289c151f405f39358030e1f4b1f757fb157c059f
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/20200917/f738f7ac/attachment-0001.html>


More information about the ghc-commits mailing list