[Git][ghc/ghc][wip/T18587] 202 commits: Fix dead link to haskell prime discussion

Ben Gamari gitlab at gitlab.haskell.org
Sat Sep 5 13:26:47 UTC 2020



Ben Gamari pushed to branch wip/T18587 at Glasgow Haskell Compiler / GHC


Commits:
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")...

- - - - -
99513c79 by Ben Gamari at 2020-09-05T09:26:44-04:00
rts/nonmoving: Add missing STM write barrier

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

- - - - -


29 changed files:

- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/linters/check-cpp.py
- .gitlab/test-metrics.sh
- CODEOWNERS
- aclocal.m4
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.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
- compiler/GHC/Cmm/Graph.hs
- compiler/GHC/Cmm/Info.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/facfb76a0f0c3175b44a0c49f0b7573897b16f7f...99513c796700603da8524723ceca0f52937a9efa

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/facfb76a0f0c3175b44a0c49f0b7573897b16f7f...99513c796700603da8524723ceca0f52937a9efa
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/20200905/2fba5024/attachment-0001.html>


More information about the ghc-commits mailing list