[Git][ghc/ghc][wip/caf-cleanups] 145 commits: Do not panic on linker errors

Ben Gamari gitlab at gitlab.haskell.org
Sat Apr 25 13:59:10 UTC 2020



Ben Gamari pushed to branch wip/caf-cleanups at Glasgow Haskell Compiler / GHC


Commits:
262e42aa by Peter Trommler at 2020-03-25T22:41:39-04:00
Do not panic on linker errors

- - - - -
0de03cd7 by Sylvain Henry at 2020-03-25T22:42:02-04:00
DynFlags refactoring III

Use Platform instead of DynFlags when possible:
* `tARGET_MIN_INT` et al. replaced with `platformMinInt` et al.
* no more DynFlags in PreRules: added a new `RuleOpts` datatype
* don't use `wORD_SIZE` in the compiler
* make `wordAlignment` use `Platform`
* make `dOUBLE_SIZE` a constant

Metric Decrease:
    T13035
    T1969

- - - - -
7a04920b by Tristan Cacqueray at 2020-03-25T22:42:06-04:00
Base: fix a typo in liftA doc

This change removes an extra '|' that should not be rendered in
the liftA documentation.

Tracking: #17929

- - - - -
1c5a15f7 by Tristan Cacqueray at 2020-03-25T22:42:06-04:00
Base: add Control.Applicative optional example

This change adds an optional example.

Tracking: #17929

- - - - -
6d172e63 by Tristan Cacqueray at 2020-03-25T22:42:06-04:00
Base: add markup around Except

- - - - -
eb2162c8 by John Ericson at 2020-03-26T12:37:08-04:00
Remove unused `ghciTablesNextToCode` from compiler proper

- - - - -
f51efc4b by Joachim Breitner at 2020-03-26T12:37:09-04:00
Prepare to use run-time tablesNextToCode in compiler exclusively

Factor out CPP as much as possible to prepare for runtime
determinattion.

Progress towards #15548

- - - - -
1c446220 by Joachim Breitner at 2020-03-26T12:37:09-04:00
Use run-time tablesNextToCode in compiler exclusively (#15548)

Summary:

 - There is no more use of the TABLES_NEXT_TO_CODE CPP macro in
   `compiler/`. GHCI_TABLES_NEXT_TO_CODE is also removed entirely.
   The field within `PlatformMisc` within `DynFlags` is used instead.

 - The field is still not exposed as a CLI flag. We might consider some
   way to ensure the right RTS / libraries are used before doing that.

Original reviewers:

Original subscribers: TerrorJack, rwbarton, carter

Original Differential Revision: https://phabricator.haskell.org/D5082

- - - - -
1941ef4f by Sylvain Henry at 2020-03-29T17:28:51-04:00
Modules: Types (#13009)

Update Haddock submodule

Metric Increase:
   haddock.compiler

- - - - -
1c7c6f1a by Sylvain Henry at 2020-03-29T17:28:51-04:00
Remove GHC.Types.Unique.Map module

This module isn't used anywhere in GHC.

- - - - -
f1a6c73d by Sylvain Henry at 2020-03-29T17:28:51-04:00
Merge GHC.Types.CostCentre.Init into GHC.Driver.CodeOutput

- - - - -
54250f2d by Simon Peyton Jones at 2020-03-29T17:29:30-04:00
Demand analysis: simplify the demand for a RHS

Ticket #17932 showed that we were using a stupid demand for the RHS
of a let-binding, when the result is a product.  This was the result
of a "fix" in 2013, which (happily) turns out to no longer be
necessary.

So I just deleted the code, which simplifies the demand analyser,
and fixes #17932. That in turn uncovered that the anticipation
of worker/wrapper in CPR analysis was inaccurate, hence the logic
that decides whether to unbox an argument in WW was extracted into
a function `wantToUnbox`, now consulted by CPR analysis.

I tried nofib, and got 0.0% perf changes.

All this came up when messing about with !2873 (ticket #17917),
but is idependent of it.

Unfortunately, this patch regresses #4267 and realised that it is now
blocked on #16335.

- - - - -
03060b2f by Ben Gamari at 2020-03-29T17:30:05-04:00
testsuite: Fix T17786 on Windows

Fixes line ending normalization issue.

- - - - -
1f7995ba by Ben Gamari at 2020-03-29T17:30:05-04:00
testsuite: Fix T17786

Fix missing quoting and expected exit code.

- - - - -
ef9c608e by Ben Gamari at 2020-03-29T17:30:05-04:00
testsuite: Mark T12971 as broken on Windows

Due to #17945.

- - - - -
e54500c1 by Sylvain Henry at 2020-03-29T17:30:47-04:00
Store ComponentId details

As far as GHC is concerned, installed package components ("units") are
identified by an opaque ComponentId string provided by Cabal. But we
don't want to display it to users (as it contains a hash) so GHC queries
the database to retrieve some infos about the original source package
(name, version, component name).

This patch caches these infos in the ComponentId itself so that we don't
need to provide DynFlags (which contains installed package informations)
to print a ComponentId.

In the future we want GHC to support several independent package states
(e.g. for plugins and for target code), hence we need to avoid
implicitly querying a single global package state.

- - - - -
7e7cb714 by Marius Bakke at 2020-03-29T17:31:27-04:00
testsuite: Remove test that dlopens a PIE object.

glibc 2.30 disallowed dlopening PIE objects, so just remove the test.
Fixes #17952.

- - - - -
6c8f80d8 by Andreas Klebinger at 2020-03-29T17:32:04-04:00
Correct haddocks for testBit in Data.Bits

It conflated the nth bit with the bit at offset n.

Now we instead give the definition in terms of `bit and `.&.`
on top of clearer phrasing.

- - - - -
c916f190 by Andreas Klebinger at 2020-03-29T17:32:04-04:00
Apply suggestion to libraries/base/Data/Bits.hs
- - - - -
64bf7f51 by Ben Gamari at 2020-03-29T17:32:41-04:00
gitlab-ci: Add FreeBSD release job

- - - - -
a0d8e92e by Ryan Scott at 2020-03-29T17:33:20-04:00
Run checkNewDataCon before constraint-solving newtype constructors

Within `checkValidDataCon`, we used to run `checkValidType` on the
argument types of a newtype constructor before running
`checkNewDataCon`, which ensures that the user does not attempt
non-sensical things such as newtypes with multiple arguments or
constraints. This works out in most situations, but this falls over
on a corner case revealed in #17955:

```hs
newtype T = Coercible () T => T ()
```

`checkValidType`, among other things, peforms an ambiguity check on
the context of a data constructor, and that it turn invokes the
constraint solver. It turns out that there is a special case in the
constraint solver for representational equalities (read: `Coercible`
constraints) that causes newtypes to be unwrapped (see
`Note [Unwrap newtypes first]` in `TcCanonical`). This special case
does not know how to cope with an ill formed newtype like `T`, so
it ends up panicking.

The solution is surprisingly simple: just invoke `checkNewDataCon`
before `checkValidType` to ensure that the illicit newtype
constructor context is detected before the constraint solver can
run amok with it.

Fixes #17955.

- - - - -
45eb9d8c by Krzysztof Gogolewski at 2020-03-29T17:33:59-04:00
Minor cleanup

- Simplify mkBuildExpr, the function newTyVars was called
  only on a one-element list.
- TTG: use noExtCon in more places. This is more future-proof.
- In zonkExpr, panic instead of printing a warning.

- - - - -
f024b6e3 by Sylvain Henry at 2020-03-30T12:48:39+02:00
Expect T4267 to pass

Since 54250f2d8de910b094070c1b48f086030df634b1 we expected T4267 to
fail, but it passes on CI.

- - - - -
57b888c0 by Ryan Scott at 2020-03-31T10:54:20-04:00
Require GHC 8.8 as the minimum compiler for bootstrapping

This allows us to remove several bits of CPP that are either always
true or no longer reachable. As an added bonus, we no longer need to
worry about importing `Control.Monad.Fail.fail` qualified to avoid
clashing with `Control.Monad.fail`, since the latter is now the same
as the former.

- - - - -
33f09551 by Ryan Scott at 2020-03-31T10:54:57-04:00
Add regression test for #17963

The panic in #17963 happened to be fixed by commit
e3c374cc5bd7eb49649b9f507f9f7740697e3f70. This patch adds a
regression test to ensure that it remains fixed.

Fixes #17963.

- - - - -
09a36e80 by Ömer Sinan Ağacan at 2020-03-31T10:55:37-04:00
Simplify stderrSupportsAnsiColors

The combinator andM is used only once, and the code is shorter and
simpler if you inline it.

- - - - -
95bccdd0 by Ben Gamari at 2020-03-31T10:56:19-04:00
base: Ensure that encoding global variables aren't inlined

As noted in #17970, these (e.g. `getFileSystemEncoding` and
`setFileSystemEncoding`) previously had unfoldings, which would
break their global-ness.

While not strictly necessary, I also add a NOINLINE on
`initLocaleEncoding` since it is used in `System.IO`, ensuring that we
only system's query the locale encoding once.

Fixes #17970.

- - - - -
982aaa83 by Andreas Klebinger at 2020-03-31T10:56:55-04:00
Update hadrian index revision.

Required in order to build hadrian using ghc-8.10

- - - - -
4b9c5864 by Ben Gamari at 2020-03-31T10:57:32-04:00
integer-gmp: Bump version and add changelog entry

- - - - -
9b39f2e6 by Ryan Scott at 2020-04-01T01:20:00-04:00
Clean up "Eta reduction for data families" Notes

Before, there were two distinct Notes named
"Eta reduction for data families". This renames one of them to
"Implementing eta reduction for data families" to disambiguate the
two and fixes references in other parts of the codebase to ensure
that they are pointing to the right place.

Fixes #17313.

[ci skip]

- - - - -
7627eab5 by Ryan Scott at 2020-04-01T01:20:38-04:00
Fix the changelog/@since information for hGetContents'/getContents'/readFile'

Fixes #17979.

[ci skip]

- - - - -
0002db1b by Sylvain Henry at 2020-04-01T01:21:27-04:00
Kill wORDS_BIGENDIAN and replace it with platformByteOrder (#17957)

Metric Decrease:
    T13035
    T1969

- - - - -
7b217179 by Sebastian Graf at 2020-04-01T15:03:24-04:00
PmCheck: Adjust recursion depth for inhabitation test

In #17977, we ran into the reduction depth limit of the typechecker.
That was only a symptom of a much broader issue: The recursion depth
of the coverage checker for trying to instantiate strict fields in the
`nonVoid` test was far too high (100, the `defaultMaxTcBound`).

As a result, we were performing quite poorly on `T17977`.
Short of a proper termination analysis to prove emptyness of a type,
we just arbitrarily default to a much lower recursion limit of 3.

Fixes #17977.

- - - - -
3c09f636 by Andreas Klebinger at 2020-04-01T15:03:59-04:00
Make hadrian pass on the no-colour setting to GHC.

Fixes #17983.

- - - - -
b943b25d by Simon Peyton Jones at 2020-04-02T01:45:58-04:00
Re-engineer the binder-swap transformation

The binder-swap transformation is implemented by the occurrence
analyser -- see Note [Binder swap] in OccurAnal. However it had
a very nasty corner in it, for the case where the case scrutinee
was a GlobalId.  This led to trouble and hacks, and ultimately
to #16296.

This patch re-engineers how the occurrence analyser implements
the binder-swap, by actually carrying out a substitution rather
than by adding a let-binding.  It's all described in
Note [The binder-swap substitution].

I did a few other things along the way

* Fix a bug in StgCse, which could allow a loop breaker to be CSE'd
  away.  See Note [Care with loop breakers] in StgCse.  I think it can
  only show up if occurrence analyser sets up bad loop breakers, but
  still.

* Better commenting in SimplUtils.prepareAlts

* A little refactoring in CoreUnfold; nothing significant
  e.g. rename CoreUnfold.mkTopUnfolding to mkFinalUnfolding

* Renamed CoreSyn.isFragileUnfolding to hasCoreUnfolding

* Move mkRuleInfo to CoreFVs

We observed respectively 4.6% and 5.9% allocation decreases for the following
tests:

Metric Decrease:
    T9961
    haddock.base

- - - - -
42d68364 by Sebastian Graf at 2020-04-02T01:46:34-04:00
Preserve precise exceptions in strictness analysis

Fix #13380 and #17676 by

1. Changing `raiseIO#` to have `topDiv` instead of `botDiv`
2. Give it special treatment in `Simplifier.Util.mkArgInfo`, treating it
   as if it still had `botDiv`, to recover dead code elimination.

This is the first commit of the plan outlined in
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2525#note_260886.

- - - - -
0a88dd11 by Ömer Sinan Ağacan at 2020-04-02T01:47:25-04:00
Fix a pointer format string in RTS

- - - - -
5beac042 by Ömer Sinan Ağacan at 2020-04-02T01:48:05-04:00
Remove unused closure stg_IND_direct

- - - - -
88f38b03 by Ben Gamari at 2020-04-02T01:48:42-04:00
Session: Memoize stderrSupportsAnsiColors

Not only is this a reasonable efficiency measure but it avoids making
reentrant calls into ncurses, which is not thread-safe. See #17922.

- - - - -
27740f24 by Ryan Scott at 2020-04-02T01:49:21-04:00
Make Hadrian build with Cabal-3.2

GHC 8.10 ships with `Cabal-3.2.0.0`, so it would be convenient to
make Hadrian supporting building against 3.2.* instead of having to
rebuild the entirety of `Cabal-3.0.0.0`. There is one API change in
`Cabal-3.2.*` that affects Hadrian: the `synopsis` and `description`
functions now return `ShortText` instead of `String`. Since Hadrian
manipulates these `String`s in various places, I found that the
simplest fix was to use CPP to convert `ShortText` to `String`s
where appropriate.

- - - - -
49802002 by Sylvain Henry at 2020-04-02T01:50:00-04:00
Update Stack resolver for hadrian/build-stack

Broken by 57b888c0e90be7189285a6b078c30b26d0923809

- - - - -
30a63e79 by Ryan Scott at 2020-04-02T01:50:36-04:00
Fix two ASSERT buglets in reifyDataCon

Two `ASSERT`s in `reifyDataCon` were always using `arg_tys`, but
`arg_tys` is not meaningful for GADT constructors. In fact, it's
worse than non-meaningful, since using `arg_tys` when reifying a
GADT constructor can lead to failed `ASSERT`ions, as #17305
demonstrates.

This patch applies the simplest possible fix to the immediate
problem. The `ASSERT`s now use `r_arg_tys` instead of `arg_tys`, as
the former makes sure to give something meaningful for GADT
constructors. This makes the panic go away at the very least. There
is still an underlying issue with the way the internals of
`reifyDataCon` work, as described in
https://gitlab.haskell.org/ghc/ghc/issues/17305#note_227023, but we
leave that as future work, since fixing the underlying issue is
much trickier (see
https://gitlab.haskell.org/ghc/ghc/issues/17305#note_227087).

- - - - -
ef7576c4 by Zubin Duggal at 2020-04-03T06:24:56-04:00
Add outputable instances for the types in GHC.Iface.Ext.Types, add -ddump-hie
flag to dump pretty printed contents of the .hie file

Metric Increase:
   hie002

Because of the regression on i386:

compile_time/bytes allocated increased from i386-linux-deb9 baseline @ HEAD~10:
    Expected    hie002 (normal) compile_time/bytes allocated: 583014888.0 +/-10%
    Lower bound hie002 (normal) compile_time/bytes allocated:   524713399
    Upper bound hie002 (normal) compile_time/bytes allocated:   641316377
    Actual      hie002 (normal) compile_time/bytes allocated:   877986292
    Deviation   hie002 (normal) compile_time/bytes allocated:        50.6 %
*** unexpected stat test failure for hie002(normal)

- - - - -
9462452a by Andreas Klebinger at 2020-04-03T06:25:33-04:00
Improve and refactor StgToCmm codegen for DataCons.

We now differentiate three cases of constructor bindings:

1)Bindings which we can "replace" with a reference to
  an existing closure. Reference the replacement closure
  when accessing the binding.
2)Bindings which we can "replace" as above. But we still
  generate a closure which will be referenced by modules
  importing this binding.
3)For any other binding generate a closure. Then reference
  it.

Before this patch 1) did only apply to local bindings and we
didn't do 2) at all.

- - - - -
a214d214 by Moritz Bruder at 2020-04-03T06:26:11-04:00
Add singleton to NonEmpty in libraries/base

This adds a definition to construct a singleton non-empty list
(Data.List.NonEmpty) according to issue #17851.

- - - - -
f7597aa0 by Sylvain Henry at 2020-04-03T06:26:54-04:00
Testsuite: measure compiler stats for T16190

We were mistakenly measuring program stats

- - - - -
a485c3c4 by Sylvain Henry at 2020-04-03T06:26:54-04:00
Move blob handling into StgToCmm

Move handling of big literal strings from CmmToAsm to StgToCmm. It
avoids the use of `sdocWithDynFlags` (cf #10143). We might need to move
this handling even higher in the pipeline in the future (cf #17960):
this patch will make it easier.

- - - - -
cc2918a0 by Sylvain Henry at 2020-04-03T06:26:54-04:00
Refactor CmmStatics

In !2959 we noticed that there was some redundant code (in GHC.Cmm.Utils
and GHC.Cmm.StgToCmm.Utils) used to deal with `CmmStatics` datatype
(before SRT generation) and `RawCmmStatics` datatype (after SRT
generation).

This patch removes this redundant code by using a single GADT for
(Raw)CmmStatics.

- - - - -
9e60273d by Maxim Koltsov at 2020-04-03T06:27:32-04:00
Fix haddock formatting in Control.Monad.ST.Lazy.Imp.hs

- - - - -
1b7e8a94 by Andreas Klebinger at 2020-04-03T06:28:08-04:00
Turn newlines into spaces for hadrian/ghci.

The newlines break the command on windows.

- - - - -
4291bdda by Simon Peyton Jones at 2020-04-03T06:28:44-04:00
Major improvements to the specialiser

This patch is joint work of Alexis King and Simon PJ.  It does some
significant refactoring of the type-class specialiser.  Main highlights:

* We can specialise functions with types like
     f :: Eq a => a -> Ord b => b => blah
  where the classes aren't all at the front (#16473).  Here we can
  correctly specialise 'f' based on a call like
     f @Int @Bool dEqInt x dOrdBool
  This change really happened in an earlier patch
     commit 2d0cf6252957b8980d89481ecd0b79891da4b14b
     Author: Sandy Maguire <sandy at sandymaguire.me>
     Date:   Thu May 16 12:12:10 2019 -0400
  work that this new patch builds directly on that work, and refactors
  it a bit.

* We can specialise functions with implicit parameters (#17930)
     g :: (?foo :: Bool, Show a) => a -> String
  Previously we could not, but now they behave just like a non-class
  argument as in 'f' above.

* We can specialise under-saturated calls, where some (but not all of
  the dictionary arguments are provided (#17966).  For example, we can
  specialise the above 'f' based on a call
     map (f @Int dEqInt) xs
  even though we don't (and can't) give Ord dictionary.

  This may sound exotic, but #17966 is a program from the wild, and
  showed significant perf loss for functions like f, if you need
  saturation of all dictionaries.

* We fix a buglet in which a floated dictionary had a bogus demand
  (#17810), by using zapIdDemandInfo in the NonRec case of specBind.

* A tiny side benefit: we can drop dead arguments to specialised
  functions; see Note [Drop dead args from specialisations]

* Fixed a bug in deciding what dictionaries are "interesting"; see
  Note [Keep the old dictionaries interesting]

This is all achieved by by building on Sandy Macguire's work in
defining SpecArg, which mkCallUDs uses to describe the arguments of
the call. Main changes:

* Main work is in specHeader, which marched down the [InBndr] from the
  function definition and the [SpecArg] from the call site, together.

* specCalls no longer has an arity check; the entire mechanism now
  handles unders-saturated calls fine.

* mkCallUDs decides on an argument-by-argument basis whether to
  specialise a particular dictionary argument; this is new.
  See mk_spec_arg in mkCallUDs.

It looks as if there are many more lines of code, but I think that
all the extra lines are comments!

- - - - -
40a85563 by Ömer Sinan Ağacan at 2020-04-03T18:26:19+03:00
Revert accidental change in 9462452

[ci skip]

- - - - -
bd75e5da by Ryan Scott at 2020-04-04T07:07:58-04:00
Enable ImpredicativeTypes internally when typechecking selector bindings

This is necessary for certain record selectors with higher-rank
types, such as the examples in #18005. See
`Note [Impredicative record selectors]` in `TcTyDecls`.

Fixes #18005.

- - - - -
dcfe29c8 by Ömer Sinan Ağacan at 2020-04-06T13:16:08-04:00
Don't override proc CafInfos in ticky builds

Fixes #17947

When we have a ticky label for a proc, IdLabels for the ticky counter
and proc entry share the same Name. This caused overriding proc CafInfos
with the ticky CafInfos (i.e. NoCafRefs) during SRT analysis.

We now ignore the ticky labels when building SRTMaps. This makes sense
because:

- When building the current module they don't need to be in SRTMaps as
  they're initialized as non-CAFFY (see mkRednCountsLabel), so they
  don't take part in the dependency analysis and they're never added to
  SRTs.

  (Reminder: a "dependency" in the SRT analysis is a CAFFY dependency,
  non-CAFFY uses are not considered as dependencies for the algorithm)

- They don't appear in the interfaces as they're not exported, so it
  doesn't matter for cross-module concerns whether they're in the SRTMap
  or not.

See also the new Note [Ticky labels in SRT analysis].

- - - - -
cec2c71f by Simon Peyton Jones at 2020-04-06T13:16:44-04:00
Fix an tricky specialiser loop

Issue #17151 was a very tricky example of a bug in which the
specialiser accidentally constructs a recurive dictionary,
so that everything turns into bottom.

I have fixed variants of this bug at least twice before:
see Note [Avoiding loops].  It was a bit of a struggle
to isolate the problem, greatly aided by the work that
Alexey Kuleshevich did in distilling a test case.

Once I'd understood the problem, it was not difficult to fix,
though it did lead me a bit of refactoring in specImports.

- - - - -
e850d14f by Simon Peyton Jones at 2020-04-06T13:16:44-04:00
Refactoring only

This refactors DictBinds into a data type rather than a pair.
No change in behaviour, just better code

- - - - -
f38e8d61 by Daniel Gröber at 2020-04-07T02:00:05-04:00
rts: ProfHeap: Fix memory leak when not compiled with profiling

If we're doing heap profiling on an unprofiled executable we keep
allocating new space in initEra via nextEra on each profiler run but we
don't have a corresponding freeEra call.

We do free the last era in endHeapProfiling but previous eras will have
been overwritten by initEra and will never get free()ed.

Metric Decrease:
    space_leak_001

- - - - -
bcd66859 by Sebastian Graf at 2020-04-07T02:00:41-04:00
Re-export GHC.Magic.noinline from base

- - - - -
3d2991f8 by Ben Gamari at 2020-04-07T18:36:09-04:00
simplifier: Kill off ufKeenessFactor

We used to have another factor, ufKeenessFactor, which would scale the
discounts before they were subtracted from the size. This was justified
with the following comment:

  -- We multiple the raw discounts (args_discount and result_discount)
  -- ty opt_UnfoldingKeenessFactor because the former have to do with
  --  *size* whereas the discounts imply that there's some extra
  --  *efficiency* to be gained (e.g. beta reductions, case reductions)
  -- by inlining.

However, this is highly suspect since it means that we subtract a
*scaled* size from an absolute size, resulting in crazy (e.g. negative)
scores in some cases (#15304). We consequently killed off
ufKeenessFactor and bumped up the ufUseThreshold to compensate.

Adjustment of unfolding use threshold
=====================================

Since this removes a discount from our inlining heuristic, I revisited our
default choice of -funfolding-use-threshold to minimize the change in
overall inlining behavior. Specifically, I measured runtime allocations
and executable size of nofib and the testsuite performance tests built
using compilers (and core libraries) built with several values of
-funfolding-use-threshold.

This comes as a result of a quantitative comparison of testsuite
performance and code size as a function of ufUseThreshold, comparing
GHC trees using values of 50, 60, 70, 80, 90, and 100. The test set
consisted of nofib and the testsuite performance tests.
A full summary of these measurements are found in the description of
!2608

Comparing executable sizes (relative to the base commit) across all
nofib tests, we see that sizes are similar to the baseline:

            gmean      min      max   median
thresh
50         -6.36%   -7.04%   -4.82%   -6.46%
60         -5.04%   -5.97%   -3.83%   -5.11%
70         -2.90%   -3.84%   -2.31%   -2.92%
80         -0.75%   -2.16%   -0.42%   -0.73%
90         +0.24%   -0.41%   +0.55%   +0.26%
100        +1.36%   +0.80%   +1.64%   +1.37%
baseline   +0.00%   +0.00%   +0.00%   +0.00%

Likewise, looking at runtime allocations we see that 80 gives slightly
better optimisation than the baseline:

            gmean      min      max   median
thresh
50         +0.16%   -0.16%   +4.43%   +0.00%
60         +0.09%   -0.00%   +3.10%   +0.00%
70         +0.04%   -0.09%   +2.29%   +0.00%
80         +0.02%   -1.17%   +2.29%   +0.00%
90         -0.02%   -2.59%   +1.86%   +0.00%
100        +0.00%   -2.59%   +7.51%   -0.00%
baseline   +0.00%   +0.00%   +0.00%   +0.00%

Finally, I had to add a NOINLINE in T4306 to ensure that `upd` is
worker-wrappered as the test expects. This makes me wonder whether the
inlining heuristic is now too liberal as `upd` is quite a large
function. The same measure was taken in T12600.

             Wall clock time compiling Cabal with -O0
thresh       50     60     70     80     90      100    baseline
build-Cabal  93.88  89.58  92.59  90.09  100.26  94.81  89.13

Also, this change happens to avoid the spurious test output in
`plugin-recomp-change` and `plugin-recomp-change-prof` (see #17308).

Metric Decrease:
    hie002
    T12234
    T13035
    T13719
    T14683
    T4801
    T5631
    T5642
    T9020
    T9872d
    T9961
Metric Increase:
    T12150
    T12425
    T13701
    T14697
    T15426
    T1969
    T3064
    T5837
    T6048
    T9203
    T9872a
    T9872b
    T9872c
    T9872d
    haddock.Cabal
    haddock.base
    haddock.compiler

- - - - -
255418da by Sylvain Henry at 2020-04-07T18:36:49-04:00
Modules: type-checker (#13009)

Update Haddock submodule

- - - - -
04b6cf94 by Ryan Scott at 2020-04-07T19:43:20-04:00
Make NoExtCon fields strict

This changes every unused TTG extension constructor to be strict in
its field so that the pattern-match coverage checker is smart enough
any such constructors are unreachable in pattern matches. This lets
us remove nearly every use of `noExtCon` in the GHC API. The only
ones we cannot remove are ones underneath uses of `ghcPass`, but that
is only because GHC 8.8's and 8.10's coverage checkers weren't smart
enough to perform this kind of reasoning. GHC HEAD's coverage
checker, on the other hand, _is_ smart enough, so we guard these uses
of `noExtCon` with CPP for now.

Bumps the `haddock` submodule.

Fixes #17992.

- - - - -
7802fa17 by Ryan Scott at 2020-04-08T16:43:44-04:00
Handle promoted data constructors in typeToLHsType correctly

Instead of using `nlHsTyVar`, which hardcodes `NotPromoted`, have
`typeToLHsType` pick between `Promoted` and `NotPromoted` by checking
if a type constructor is promoted using `isPromotedDataCon`.

Fixes #18020.

- - - - -
ce481361 by Ben Gamari at 2020-04-09T16:17:21-04:00
hadrian: Use --export-dynamic when linking iserv

As noticed in #17962, the make build system currently does this (see
3ce0e0ba) but the change was never ported to Hadrian.

- - - - -
fa66f143 by Ben Gamari at 2020-04-09T16:17:21-04:00
iserv: Don't pass --export-dynamic on FreeBSD

This is definitely a hack but it's probably the best we can do for now.
Hadrian does the right thing here by passing --export-dynamic only to
the linker.

- - - - -
39075176 by Ömer Sinan Ağacan at 2020-04-09T16:18:00-04:00
Fix CNF handling in compacting GC

Fixes #17937

Previously compacting GC simply ignored CNFs. This is mostly fine as
most (see "What about small compacts?" below) CNF objects don't have
outgoing pointers, and are "large" (allocated in large blocks) and large
objects are not moved or compacted.

However if we do GC *during* sharing-preserving compaction then the CNF
will have a hash table mapping objects that have been moved to the CNF
to their location in the CNF, to be able to preserve sharing.

This case is handled in the copying collector, in `scavenge_compact`,
where we evacuate hash table entries and then rehash the table.

Compacting GC ignored this case.

We now visit CNFs in all generations when threading pointers to the
compacted heap and thread hash table keys. A visited CNF is added to the
list `nfdata_chain`. After compaction is done, we re-visit the CNFs in
that list and rehash the tables.

The overhead is minimal: the list is static in `Compact.c`, and link
field is added to `StgCompactNFData` closure. Programs that don't use
CNFs should not be affected.

To test this CNF tests are now also run in a new way 'compacting_gc',
which just passes `-c` to the RTS, enabling compacting GC for the oldest
generation. Before this patch the result would be:

    Unexpected failures:
       compact_gc.run          compact_gc [bad exit code (139)] (compacting_gc)
       compact_huge_array.run  compact_huge_array [bad exit code (1)] (compacting_gc)

With this patch all tests pass. I can also pass `-c -DS` without any
failures.

What about small compacts? Small CNFs are still not handled by the
compacting GC. However so far I'm unable to write a test that triggers a
runtime panic ("update_fwd: unknown/strange object") by allocating a
small CNF in a compated heap. It's possible that I'm missing something
and it's not possible to have a small CNF.

NoFib Results:

--------------------------------------------------------------------------------
        Program           Size    Allocs    Instrs     Reads    Writes
--------------------------------------------------------------------------------
             CS          +0.1%      0.0%      0.0%     +0.0%     +0.0%
            CSD          +0.1%      0.0%      0.0%      0.0%      0.0%
             FS          +0.1%      0.0%      0.0%      0.0%      0.0%
              S          +0.1%      0.0%      0.0%      0.0%      0.0%
             VS          +0.1%      0.0%      0.0%      0.0%      0.0%
            VSD          +0.1%      0.0%     +0.0%     +0.0%     -0.0%
            VSM          +0.1%      0.0%     +0.0%     -0.0%      0.0%
           anna          +0.0%      0.0%     -0.0%     -0.0%     -0.0%
           ansi          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           atom          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         awards          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         banner          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
     bernouilli          +0.1%      0.0%      0.0%     -0.0%     +0.0%
   binary-trees          +0.1%      0.0%     -0.0%     -0.0%      0.0%
          boyer          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         boyer2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           bspt          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
      cacheprof          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
       calendar          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       cichelli          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        circsim          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       clausify          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
  comp_lab_zift          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       compress          +0.1%      0.0%     +0.0%     +0.0%      0.0%
      compress2          +0.1%      0.0%     -0.0%      0.0%      0.0%
    constraints          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
   cryptarithm1          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
   cryptarithm2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            cse          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
   digits-of-e1          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
   digits-of-e2          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
         dom-lt          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
          eliza          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
          event          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
    exact-reals          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         exp3_8          +0.1%      0.0%     +0.0%     -0.0%      0.0%
         expert          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
 fannkuch-redux          +0.1%      0.0%     -0.0%      0.0%      0.0%
          fasta          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
            fem          +0.1%      0.0%     -0.0%     +0.0%      0.0%
            fft          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
           fft2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       fibheaps          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           fish          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
          fluid          +0.0%      0.0%     +0.0%     +0.0%     +0.0%
         fulsom          +0.1%      0.0%     -0.0%     +0.0%      0.0%
         gamteb          +0.1%      0.0%     +0.0%     +0.0%      0.0%
            gcd          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
    gen_regexps          +0.1%      0.0%     -0.0%     +0.0%      0.0%
         genfft          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             gg          +0.1%      0.0%      0.0%     +0.0%     +0.0%
           grep          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
         hidden          +0.1%      0.0%     +0.0%     -0.0%      0.0%
            hpg          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
            ida          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
          infer          +0.1%      0.0%     +0.0%      0.0%     -0.0%
        integer          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
      integrate          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
   k-nucleotide          +0.1%      0.0%     +0.0%     +0.0%      0.0%
          kahan          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        knights          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
         lambda          +0.1%      0.0%     +0.0%     +0.0%     -0.0%
     last-piece          +0.1%      0.0%     +0.0%      0.0%      0.0%
           lcss          +0.1%      0.0%     +0.0%     +0.0%      0.0%
           life          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
           lift          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         linear          +0.1%      0.0%     -0.0%     +0.0%      0.0%
      listcompr          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       listcopy          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       maillist          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
         mandel          +0.1%      0.0%     +0.0%     +0.0%      0.0%
        mandel2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           mate          +0.1%      0.0%     +0.0%      0.0%     +0.0%
        minimax          +0.1%      0.0%     -0.0%      0.0%     -0.0%
        mkhprog          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
     multiplier          +0.1%      0.0%     +0.0%      0.0%      0.0%
         n-body          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       nucleic2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           para          +0.1%      0.0%      0.0%     +0.0%     +0.0%
      paraffins          +0.1%      0.0%     +0.0%     -0.0%      0.0%
         parser          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
        parstof          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            pic          +0.1%      0.0%     -0.0%     -0.0%      0.0%
       pidigits          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
          power          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         pretty          +0.1%      0.0%     -0.0%     -0.0%     -0.1%
         primes          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
      primetest          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
         prolog          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
         puzzle          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
         queens          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        reptile          +0.1%      0.0%     -0.0%     -0.0%     +0.0%
reverse-complem          +0.1%      0.0%     +0.0%      0.0%     -0.0%
        rewrite          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
           rfib          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            rsa          +0.1%      0.0%     -0.0%     +0.0%     -0.0%
            scc          +0.1%      0.0%     -0.0%     -0.0%     -0.1%
          sched          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            scs          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         simple          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
          solid          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        sorting          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
  spectral-norm          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         sphere          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
         symalg          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
            tak          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
      transform          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       treejoin          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
      typecheck          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        veritas          +0.0%      0.0%     +0.0%     +0.0%     +0.0%
           wang          +0.1%      0.0%      0.0%     +0.0%     +0.0%
      wave4main          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
   wheel-sieve1          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
   wheel-sieve2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           x2n1          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
--------------------------------------------------------------------------------
            Min          +0.0%      0.0%     -0.0%     -0.0%     -0.1%
            Max          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
 Geometric Mean          +0.1%     -0.0%     -0.0%     -0.0%     -0.0%

Bumping numbers of nonsensical perf tests:

Metric Increase:
    T12150
    T12234
    T12425
    T13035
    T5837
    T6048

It's simply not possible for this patch to increase allocations, and
I've wasted enough time on these test in the past (see #17686). I think
these tests should not be perf tests, but for now I'll bump the numbers.

- - - - -
dce50062 by Sylvain Henry at 2020-04-09T16:18:44-04:00
Rts: show errno on failure (#18033)

- - - - -
045139f4 by Hécate at 2020-04-09T23:10:44-04:00
Add an example to liftIO and explain its purpose

- - - - -
101fab6e by Sebastian Graf at 2020-04-09T23:11:21-04:00
Special case `isConstraintKindCon` on `AlgTyCon`

Previously, the `tyConUnique` record selector would unfold into a huge
case expression that would be inlined in all call sites, such as the
`INLINE`-annotated `coreView`, see #18026. `constraintKindTyConKey` only
occurs as the `Unique` of an `AlgTyCon` anyway, so we can make the code
a lot more compact, but have to move it to GHC.Core.TyCon.

Metric Decrease:
    T12150
    T12234

- - - - -
f5212dfc by Sebastian Graf at 2020-04-09T23:11:57-04:00
DmdAnal: No need to attach a StrictSig to DataCon workers

In GHC.Types.Id.Make we were giving a strictness signature to every data
constructor wrapper Id that we weren't looking at in demand analysis
anyway. We used to use its CPR info, but that has its own CPR signature
now.

`Note [Data-con worker strictness]` then felt very out of place, so I
moved it to GHC.Core.DataCon.

- - - - -
75a185dc by Sylvain Henry at 2020-04-09T23:12:37-04:00
Hadrian: fix --summary

- - - - -
723062ed by Ömer Sinan Ağacan at 2020-04-10T09:18:14+03:00
testsuite: Move no_lint to the top level, tweak hie002

- We don't want to benchmark linting so disable lints in hie002 perf
  test

- Move no_lint to the top-level to be able to use it in tests other than
  those in `testsuite/tests/perf/compiler`.

- Filter out -dstg-lint in no_lint.

- hie002 allocation numbers on 32-bit are unstable, so skip it on 32-bit

Metric Decrease:
    hie002
    ManyConstructors
    T12150
    T12234
    T13035
    T1969
    T4801
    T9233
    T9961

- - - - -
bcafaa82 by Peter Trommler at 2020-04-10T19:29:33-04:00
Testsuite: mark T11531 fragile

The test depends on a link editor allowing undefined symbols in an ELF
shared object. This is the standard but it seems some distributions
patch their link editor. See the report by @hsyl20 in #11531.

Fixes #11531

- - - - -
0889f5ee by Takenobu Tani at 2020-04-12T11:44:52+09:00
testsuite: Fix comment for a language extension

[skip ci]

- - - - -
cd4f92b5 by Simon Peyton Jones at 2020-04-12T11:20:58-04:00
Significant refactor of Lint

This refactoring of Lint was triggered by #17923, which is
fixed by this patch.

The main change is this.  Instead of
   lintType :: Type -> LintM LintedKind
we now have
   lintType :: Type -> LintM LintedType

Previously, all of typeKind was effectively duplicate in lintType.
Moreover, since we have an ambient substitution, we still had to
apply the substition here and there, sometimes more than once. It
was all very tricky, in the end, and made my head hurt.

Now, lintType returns a fully linted type, with all substitutions
performed on it.  This is much simpler.

The same thing is needed for Coercions.  Instead of
  lintCoercion :: OutCoercion
               -> LintM (LintedKind, LintedKind,
                         LintedType, LintedType, Role)
we now have
  lintCoercion :: Coercion -> LintM LintedCoercion

Much simpler!  The code is shorter and less bug-prone.

There are a lot of knock on effects.  But life is now better.

Metric Decrease:
    T1969

- - - - -
0efaf301 by Josh Meredith at 2020-04-12T11:21:34-04:00
Implement extensible interface files

- - - - -
54ca66a7 by Ryan Scott at 2020-04-12T11:22:10-04:00
Use conLikeUserTyVarBinders to quantify field selector types

This patch:

1. Writes up a specification for how the types of top-level field
   selectors should be determined in a new section of the GHC User's
   Guide, and
2. Makes GHC actually implement that specification by using
   `conLikeUserTyVarBinders` in `mkOneRecordSelector` to preserve the
   order and specificity of type variables written by the user.

Fixes #18023.

- - - - -
35799dda by Ben Gamari at 2020-04-12T11:22:50-04:00
hadrian: Don't --export-dynamic on Darwin

When fixing #17962 I neglected to consider that --export-dynamic is only
supported on ELF platforms.

- - - - -
e8029816 by Alexis King at 2020-04-12T11:23:27-04:00
Add an INLINE pragma to Control.Category.>>>

This fixes #18013 by adding INLINE pragmas to both Control.Category.>>>
and GHC.Desugar.>>>. The functional change in this patch is tiny (just
two lines of pragmas!), but an accompanying Note explains in gory
detail what’s going on.

- - - - -
0da186c1 by Krzysztof Gogolewski at 2020-04-14T07:55:20-04:00
Change zipWith to zipWithEqual in a few places

- - - - -
074c1ccd by Andreas Klebinger at 2020-04-14T07:55:55-04:00
Small change to the windows ticker.

We already have a function to go from time to ms so use it.
Also expand on the state of timer resolution.

- - - - -
b69cc884 by Alp Mestanogullari at 2020-04-14T07:56:38-04:00
hadrian: get rid of unnecessary levels of nesting in source-dist

- - - - -
d0c3b069 by Julien Debon at 2020-04-14T07:57:16-04:00
doc (Foldable): Add examples to Data.Foldable

See #17929

- - - - -
5b08e0c0 by Ben Gamari at 2020-04-14T23:28:20-04:00
StgCRun: Enable unwinding only on Linux

It's broken on macOS due and SmartOS due to assembler differences
(#15207) so let's be conservative in enabling it. Also, refactor things
to make the intent clearer.

- - - - -
27cc2e7b by Ben Gamari at 2020-04-14T23:28:57-04:00
rts: Don't mark evacuate_large as inline

This function has two callsites and is quite large. GCC consequently
decides not to inline and warns instead. Given the situation, I can't
blame it. Let's just remove the inline specifier.

- - - - -
9853fc5e by Ben Gamari at 2020-04-14T23:29:48-04:00
base: Enable large file support for OFD locking impl.

Not only is this a good idea in general but this should also avoid
issue #17950 by ensuring that off_t is 64-bits.

- - - - -
7b41f21b by Matthew Pickering at 2020-04-14T23:30:24-04:00
Hadrian: Make -i paths absolute

The primary reason for this change is that ghcide does not work with
relative paths. It also matches what cabal and stack do, they always
pass absolute paths.

- - - - -
41230e26 by Daniel Gröber at 2020-04-14T23:31:01-04:00
Zero out pinned block alignment slop when profiling

The heap profiler currently cannot traverse pinned blocks because of
alignment slop. This used to just be a minor annoyance as the whole block
is accounted into a special cost center rather than the respective object's
CCS, cf. #7275. However for the new root profiler we would like to be able
to visit _every_ closure on the heap. We need to do this so we can get rid
of the current 'flip' bit hack in the heap traversal code.

Since info pointers are always non-zero we can in principle skip all the
slop in the profiler if we can rely on it being zeroed. This assumption
caused problems in the past though, commit a586b33f8e ("rts: Correct
handling of LARGE ARR_WORDS in LDV profiler"), part of !1118, tried to use
the same trick for BF_LARGE objects but neglected to take into account that
shrink*Array# functions don't ensure that slop is zeroed when not
compiling with profiling.

Later, commit 0c114c6599 ("Handle large ARR_WORDS in heap census (fix
as we will only be assuming slop is zeroed when profiling is on.

This commit also reduces the ammount of slop we introduce in the first
place by calculating the needed alignment before doing the allocation for
small objects where we know the next available address. For large objects
we don't know how much alignment we'll have to do yet since those details
are hidden behind the allocateMightFail function so there we continue to
allocate the maximum additional words we'll need to do the alignment.

So we don't have to duplicate all this logic in the cmm code we pull it
into the RTS allocatePinned function instead.

Metric Decrease:
    T7257
    haddock.Cabal
    haddock.base

- - - - -
15fa9bd6 by Daniel Gröber at 2020-04-14T23:31:01-04:00
rts: Expand and add more notes regarding slop

- - - - -
caf3f444 by Daniel Gröber at 2020-04-14T23:31:01-04:00
rts: allocatePinned: Fix confusion about word/byte units

- - - - -
c3c0f662 by Daniel Gröber at 2020-04-14T23:31:01-04:00
rts: Underline some Notes as is conventional

- - - - -
e149dea9 by Daniel Gröber at 2020-04-14T23:31:38-04:00
rts: Fix nomenclature in OVERWRITING_CLOSURE macros

The additional commentary introduced by commit 8916e64e5437 ("Implement
shrinkSmallMutableArray# and resizeSmallMutableArray#.") unfortunately got
this wrong. We set 'prim' to true in overwritingClosureOfs because we
_don't_ want to call LDV_recordDead().

The reason is because of this "inherently used" distinction made in the LDV
profiler so I rename the variable to be more appropriate.

- - - - -
1dd3d18c by Daniel Gröber at 2020-04-14T23:31:38-04:00
Remove call to LDV_RECORD_CREATE for array resizing

- - - - -
19de2fb0 by Daniel Gröber at 2020-04-14T23:31:38-04:00
rts: Assert LDV_recordDead is not called for inherently used closures

The comments make it clear LDV_recordDead should not be called for
inhererently used closures, so add an assertion to codify this fact.

- - - - -
0b934e30 by Ryan Scott at 2020-04-14T23:32:14-04:00
Bump template-haskell version to 2.17.0.0

This requires bumping the `exceptions` and `text` submodules to bring
in commits that bump their respective upper version bounds on
`template-haskell`.

Fixes #17645. Fixes #17696.

Note that the new `text` commit includes a fair number of additions
to the Haddocks in that library. As a result, Haddock has to do more
work during the `haddock.Cabal` test case, increasing the number of
allocations it requires. Therefore,

-------------------------
Metric Increase:
    haddock.Cabal
-------------------------

- - - - -
22cc8e51 by Ryan Scott at 2020-04-15T17:48:47-04:00
Fix #18052 by using pprPrefixOcc in more places

This fixes several small oversights in the choice of pretty-printing
function to use. Fixes #18052.

- - - - -
ec77b2f1 by Daniel Gröber at 2020-04-15T17:49:24-04:00
rts: ProfHeap: Fix wrong time in last heap profile sample

We've had this longstanding issue in the heap profiler, where the time of
the last sample in the profile is sometimes way off causing the rendered
graph to be quite useless for long runs.

It seems to me the problem is that we use mut_user_time() for the last
sample as opposed to getRTSStats(), which we use when calling heapProfile()
in GC.c.

The former is equivalent to getProcessCPUTime() but the latter does
some additional stuff:

    getProcessCPUTime() - end_init_cpu - stats.gc_cpu_ns -
    stats.nonmoving_gc_cpu_ns

So to fix this just use getRTSStats() in both places.

- - - - -
85fc32f0 by Sylvain Henry at 2020-04-17T12:45:25-04:00
Hadrian: fix dyn_o/dyn_hi rule (#17534)

- - - - -
bfde3b76 by Ryan Scott at 2020-04-17T12:46:02-04:00
Fix #18065 by fixing an InstCo oversight in Core Lint

There was a small thinko in Core Lint's treatment of `InstCo`
coercions that ultimately led to #18065. The fix: add an apostrophe.
That's it!

Fixes #18065.

Co-authored-by: Simon Peyton Jones <simonpj at microsoft.com>

- - - - -
a05348eb by Cale Gibbard at 2020-04-17T13:08:47-04:00
Change the fail operator argument of BindStmt to be a Maybe

Don't use noSyntaxExpr for it. There is no good way to defensively case
on that, nor is it clear one ought to do so.

- - - - -
79e27144 by John Ericson at 2020-04-17T13:08:47-04:00
Use trees that grow for rebindable operators for `<-` binds

Also add more documentation.

- - - - -
18bc16ed by Cale Gibbard at 2020-04-17T13:08:47-04:00
Use FailOperator in more places, define a couple datatypes (XBindStmtRn and XBindStmtTc) to help clarify the meaning of XBindStmt in the renamer and typechecker

- - - - -
84cc8394 by Simon Peyton Jones at 2020-04-18T13:20:29-04:00
Add a missing zonk in tcHsPartialType

I omitted a vital zonk when refactoring tcHsPartialType in
   commit 48fb3482f8cbc8a4b37161021e846105f980eed4
   Author: Simon Peyton Jones <simonpj at microsoft.com>
   Date:   Wed Jun 5 08:55:17 2019 +0100

   Fix typechecking of partial type signatures

This patch fixes it and adds commentary to explain why.

Fixes #18008

- - - - -
2ee96ac1 by Ben Gamari at 2020-04-18T13:21:05-04:00
gitlab-ci: Bump FreeBSD bootstrap compiler to 8.10.1

- - - - -
434312e5 by Ben Gamari at 2020-04-18T13:21:05-04:00
gitlab-ci: Enable FreeBSD job for so-labelled MRs

- - - - -
ddffb227 by Ben Gamari at 2020-04-18T13:21:05-04:00
gitlab-ci: Use rules syntax for conditional jobs

- - - - -
e2586828 by Ben Gamari at 2020-04-18T13:21:05-04:00
Bump hsc2hs submodule

- - - - -
15ab6cd5 by Ömer Sinan Ağacan at 2020-04-18T13:21:44-04:00
Improve prepForeignCall error reporting

Show parameters and description of the error code when ffi_prep_cif
fails.

This may be helpful for debugging #17018.

- - - - -
3ca52151 by Sylvain Henry at 2020-04-18T20:04:14+02:00
GHC.Core.Opt renaming

* GHC.Core.Op                  => GHC.Core.Opt
* GHC.Core.Opt.Simplify.Driver => GHC.Core.Opt.Driver
* GHC.Core.Opt.Tidy            => GHC.Core.Tidy
* GHC.Core.Opt.WorkWrap.Lib    => GHC.Core.Opt.WorkWrap.Utils

As discussed in:
 * https://mail.haskell.org/pipermail/ghc-devs/2020-April/018758.html
 * https://gitlab.haskell.org/ghc/ghc/issues/13009#note_264650

- - - - -
15312bbb by Sylvain Henry at 2020-04-18T20:04:46+02:00
Modules (#13009)

* SysTools
* Parser
* GHC.Builtin
* GHC.Iface.Recomp
* Settings

Update Haddock submodule

Metric Decrease:
    Naperian
    parsing001

- - - - -
eaed0a32 by Alexis King at 2020-04-19T03:16:44-04:00
Add missing addInScope call for letrec binders in OccurAnal

This fixes #18044, where a shadowed variable was incorrectly substituted
by the binder swap on the RHS of a floated-in letrec. This can only
happen when the uniques line up *just* right, so writing a regression
test would be very difficult, but at least the fix is small and
straightforward.

- - - - -
36882493 by Shayne Fletcher at 2020-04-20T04:36:43-04:00
Derive Ord instance for Extension

Metric Increase:
   T12150
   T12234

- - - - -
b43365ad by Simon Peyton Jones at 2020-04-20T04:37:20-04:00
Fix a buglet in redundant-constraint warnings

Ticket #18036 pointed out that we were reporting a redundant
constraint when it really really wasn't.

Turned out to be a buglet in the SkolemInfo for the
relevant implication constraint.  Easily fixed!

- - - - -
d5fae7da by Ömer Sinan Ağacan at 2020-04-20T14:39:28-04:00
Mark T12010 fragile on 32-bit

- - - - -
bca02fca by Adam Sandberg Ericsson at 2020-04-21T06:38:45-04:00
docs: drop note about not supporting shared libraries on unix systems

[skip ci]

- - - - -
6655f933 by Sylvain Henry at 2020-04-21T06:39:32-04:00
Use ParserFlags in GHC.Runtime.Eval (#17957)

Instead of passing `DynFlags` to functions such as `isStmt` and
`hasImport` in `GHC.Runtime.Eval` we pass `ParserFlags`. It's a much
simpler structure that can be created purely with `mkParserFlags'`.

- - - - -
70be0fbc by Sylvain Henry at 2020-04-21T06:39:32-04:00
GHC.Runtime: avoid DynFlags (#17957)

* add `getPlatform :: TcM Platform` helper
* remove unused `DynFlags` parameter from `emptyPLS`

- - - - -
35e43d48 by Sylvain Henry at 2020-04-21T06:39:32-04:00
Avoid DynFlags in Ppr code (#17957)

* replace `DynFlags` parameters with `SDocContext` parameters for a few
  Ppr related functions: `bufLeftRenderSDoc`, `printSDoc`,
  `printSDocLn`, `showSDocOneLine`.

* remove the use of `pprCols :: DynFlags -> Int` in Outputable. We
  already have the information via `sdocLineLength :: SDocContext ->
  Int`

- - - - -
ce5c2999 by Sylvain Henry at 2020-04-21T06:39:32-04:00
Avoid using sdocWithDynFlags (#17957)

Remove one use of `sdocWithDynFlags` from `GHC.CmmToLlvm.llvmCodeGen'`
and from `GHC.Driver.CodeOutput.profilingInitCode`

- - - - -
f2a98996 by Sylvain Henry at 2020-04-21T06:39:32-04:00
Avoid `sdocWithDynFlags` in `pprCLbl` (#17957)

* add a `DynFlags` parameter to `pprCLbl`
* put `maybe_underscore` and `pprAsmCLbl` in a `where` clause to avoid
  `DynFlags` parameters

- - - - -
747093b7 by Sylvain Henry at 2020-04-21T06:39:32-04:00
CmmToAsm DynFlags refactoring (#17957)

* Remove `DynFlags` parameter from `isDynLinkName`: `isDynLinkName` used
  to test the global `ExternalDynamicRefs` flag. Now we test it outside of
  `isDynLinkName`

* Add new fields into `NCGConfig`: current unit id, sse/bmi versions,
  externalDynamicRefs, etc.

* Replace many uses of `DynFlags` by `NCGConfig`

* Moved `BMI/SSE` datatypes into `GHC.Platform`

- - - - -
ffd7eef2 by Takenobu Tani at 2020-04-22T23:09:50-04:00
stg-spec: Modify file paths according to new module hierarchy

This patch updates file paths according to new module hierarchy [1]:

  * GHC/Stg/Syntax.hs       <= stgSyn/StgSyn.hs
  * GHC/Types/Literal.hs    <= basicTypes/Literal.hs
  * GHC/Types/CostCentre.hs <= profiling/CostCentre.hs

This patch also updates old file path [2]:

  * utils/genapply/Main.hs  <= utils/genapply/GenApply.hs

[1]: https://gitlab.haskell.org/ghc/ghc/-/wikis/Make-GHC-codebase-more-modular
[2]: commit 0cc4aad36f

[skip ci]

- - - - -
e8a5d81b by Jonathan DK Gibbons at 2020-04-22T23:10:28-04:00
Refactor the `MatchResult` type in the desugarer

This way, it does a better job of proving whether or not the fail operator is used.

- - - - -
dcb7fe5a by John Ericson at 2020-04-22T23:10:28-04:00
Remove panic in dsHandleMonadicFailure

Rework dsHandleMonadicFailure to be correct by construction instead of
using an unreachable panic.

- - - - -
cde23cd4 by John Ericson at 2020-04-22T23:10:28-04:00
Inline `adjustMatchResult`

It is just `fmap`

- - - - -
72cb6bcc by John Ericson at 2020-04-22T23:10:28-04:00
Generalize type of `matchCanFail`

- - - - -
401f7bb3 by John Ericson at 2020-04-22T23:10:28-04:00
`MatchResult'` -> `MatchResult`

Inline `MatchResult` alias accordingly.

- - - - -
6c9fae23 by Alexis King at 2020-04-22T23:11:12-04:00
Mark DataCon wrappers CONLIKE

Now that DataCon wrappers don’t inline until phase 0 (see commit
b78cc64e923716ac0512c299f42d4d0012306c05), it’s important that
case-of-known-constructor and RULE matching be able to see saturated
applications of DataCon wrappers in unfoldings. Making them conlike is a
natural way to do it, since they are, in fact, precisely the sort of
thing the CONLIKE pragma exists to solve.

Fixes #18012.

This also bumps the version of the parsec submodule to incorporate a
patch that avoids a metric increase on the haddock perf tests. The
increase was not really a flaw in this patch, as parsec was implicitly
relying on inlining heuristics. The patch to parsec just adds some
INLINABLE pragmas, and we get a nice performance bump out of it (well
beyond the performance we lost from this patch).

Metric Decrease:
    T12234
    WWRec
    haddock.Cabal
    haddock.base
    haddock.compiler

- - - - -
48b8951e by Roland Senn at 2020-04-22T23:11:51-04:00
Fix tab-completion for :break (#17989)

In tab-completion for the `:break` command, only those
identifiers should be shown, that are accepted in the
`:break` command. Hence these identifiers must be

- defined in an interpreted module
- top-level
- currently in scope
- listed in a `ModBreaks` value as a possible breakpoint.

The identifiers my be qualified or unqualified.

To get all possible top-level breakpoints for tab-completeion
with the correct qualification do:

1. Build the  list called `pifsBreaks` of all pairs of
(Identifier, module-filename) from the `ModBreaks` values.
Here all identifiers are unqualified.

2. Build the list called `pifInscope` of all pairs of
(Identifiers, module-filename) with identifiers from
the `GlobalRdrEnv`. Take only those identifiers that are
in scope and have the  correct prefix.
Here the identifiers may be qualified.

3. From the `pifInscope` list seclect all pairs that can be
found in the `pifsBreaks` list, by comparing only the
unqualified part of the identifier.
The remaining identifiers can be used for tab-completion.

This ensures, that we show only identifiers, that can be used
in a `:break` command.

- - - - -
34a45ee6 by Peter Trommler at 2020-04-22T23:12:27-04:00
PPC NCG: Add DWARF constants and debug labels

Fixes #11261

- - - - -
ffde2348 by Simon Peyton Jones at 2020-04-22T23:13:06-04:00
Do eager instantation in terms

This patch implements eager instantiation, a small but critical change
to the type inference engine, #17173.  The main change is this:

  When inferring types, always return an instantiated type
  (for now, deeply instantiated; in future shallowly instantiated)

There is more discussion in
https://www.tweag.io/posts/2020-04-02-lazy-eager-instantiation.html

There is quite a bit of refactoring in this patch:

* The ir_inst field of GHC.Tc.Utils.TcType.InferResultk
  has entirely gone.  So tcInferInst and tcInferNoInst have collapsed
  into tcInfer.

* Type inference of applications, via tcInferApp and
  tcInferAppHead, are substantially refactored, preparing
  the way for Quick Look impredicativity.

* New pure function GHC.Tc.Gen.Expr.collectHsArgs and applyHsArgs
  are beatifully dual.  We can see the zipper!

* GHC.Tc.Gen.Expr.tcArgs is now much nicer; no longer needs to return
  a wrapper

* In HsExpr, HsTypeApp now contains the the actual type argument,
  and is used in desugaring, rather than putting it in a mysterious
  wrapper.

* I struggled a bit with good error reporting in
  Unify.matchActualFunTysPart. It's a little bit simpler than before,
  but still not great.

Some smaller things

* Rename tcPolyExpr --> tcCheckExpr
         tcMonoExpr --> tcLExpr
* tcPatSig moves from GHC.Tc.Gen.HsType to GHC.Tc.Gen.Pat

Metric Decrease:
    T9961

Reduction of 1.6% in comiler allocation on T9961, I think.

- - - - -
6f84aca3 by Ben Gamari at 2020-04-22T23:13:43-04:00
rts: Ensure that sigaction structs are initialized

I noticed these may have uninitialized fields when looking into #18037.
The reporter says that zeroing them doesn't fix the MSAN failures they
observe but zeroing them is the right thing to do regardless.

- - - - -
c29f0fa6 by Andreas Klebinger at 2020-04-22T23:14:21-04:00
Add "ddump-cmm-opt" as alias for "ddump-opt-cmm".

- - - - -
4b4a8b60 by Ben Gamari at 2020-04-22T23:14:57-04:00
llvmGen: Remove -fast-llvm flag

Issue #18076 drew my attention to the undocumented `-fast-llvm` flag for
the LLVM code generator introduced in
22733532171330136d87533d523f565f2a4f102f. Speaking to Moritz about this,
the motivation for this flag was to avoid potential incompatibilities
between LLVM and the assembler/linker toolchain by making LLVM
responsible for machine-code generation.

Unfortunately, this cannot possibly work: the LLVM backend's mangler
performs a number of transforms on the assembler generated by LLVM that
are necessary for correctness. These are currently:

 * mangling Haskell functions' symbol types to be `object` instead of
   `function` on ELF platforms (necessary for tables-next-to-code)
 * mangling AVX instructions to ensure that we don't assume alignment
   (which LLVM otherwise does)
 * mangling Darwin's  subsections-via-symbols directives

Given that these are all necessary I don't believe that we can support
`-fast-llvm`. Let's rather remove it.

- - - - -
831b6642 by Moritz Angermann at 2020-04-22T23:15:33-04:00
Fix build warning; add more informative information to the linker; fix linker for empty sections

- - - - -
c409961a by Ryan Scott at 2020-04-22T23:16:12-04:00
Update commentary and slightly refactor GHC.Tc.Deriv.Infer

There was some out-of-date commentary in `GHC.Tc.Deriv.Infer` that
has been modernized. Along the way, I removed the `bad` constraints
in `simplifyDeriv`, which did not serve any useful purpose (besides
being printed in debugging output).

Fixes #18073.

- - - - -
125aa2b8 by Ömer Sinan Ağacan at 2020-04-22T23:16:51-04:00
Remove leftover comment in tcRnModule', redundant bind

The code for the comment was moved in dc8c03b2a5c but the comment was
forgotten.

- - - - -
8ea37b01 by Sylvain Henry at 2020-04-22T23:17:34-04:00
RTS: workaround a Linux kernel bug in timerfd

Reading a timerfd may return 0: https://lkml.org/lkml/2019/8/16/335.

This is currently undocumented behavior and documentation "won't happen
anytime soon" (https://lkml.org/lkml/2020/2/13/295).

With this patch, we just ignore the result instead of crashing. It may
fix #18033 but we can't be sure because we don't have enough
information.

See also this discussion about the kernel bug:
https://github.com/Azure/sonic-swss-common/pull/302/files/1f070e7920c2e5d63316c0105bf4481e73d72dc9

- - - - -
cd8409c2 by Ryan Scott at 2020-04-23T11:39:24-04:00
Create di_scoped_tvs for associated data family instances properly

See `Note [Associated data family instances and di_scoped_tvs]` in
`GHC.Tc.TyCl.Instance`, which explains all of the moving parts.

Fixes #18055.

- - - - -
339e8ece by Ben Gamari at 2020-04-23T11:40:02-04:00
hadrian/ghci: Allow arguments to be passed to GHCi

Previously the arguments passed to hadrian/ghci were passed both to
`hadrian` and GHCi. This is rather odd given that there are essentially
not arguments in the intersection of the two. Let's just pass them to
GHCi; this allows `hadrian/ghci -Werror`.

- - - - -
5946c85a by Ben Gamari at 2020-04-23T11:40:38-04:00
testsuite: Don't attempt to read .std{err,out} files if they don't exist

Simon reports that he was previously seeing framework failures due to
an attempt to read the non-existing T13456.stderr. While I don't know
exactly what this is due to, it does seem like a non-existing
.std{out,err} file should be equivalent to an empty file. Teach the
testsuite driver to treat it as such.

- - - - -
c42754d5 by John Ericson at 2020-04-23T18:32:43-04:00
Trees That Grow refactor for `ConPat` and `CoPat`

- `ConPat{In,Out}` -> `ConPat`

- `CoPat` -> `XPat (CoPat ..)`

Note that `GHC.HS.*` still uses `HsWrap`, but only when `p ~ GhcTc`.
After this change, moving the type family instances out of `GHC.HS.*` is
sufficient to break the cycle.

Add XCollectPat class to decide how binders are collected from XXPat based on the pass.

Previously we did this with IsPass, but that doesn't work for Haddock's
DocNameI, and the constraint doesn't express what actual distinction is being
made. Perhaps a class for collecting binders more generally is in order, but we
haven't attempted this yet.

Pure refactor of code around ConPat

 - InPat/OutPat synonyms removed

 - rename several identifiers

 - redundant constraints removed

 - move extension field in ConPat to be first

 - make ConPat use record syntax more consistently

Fix T6145 (ConPatIn became ConPat)

Add comments from SPJ.

Add comment about haddock's use of CollectPass.

Updates haddock submodule.

- - - - -
72da0c29 by mniip at 2020-04-23T18:33:21-04:00
Add :doc to GHC.Prim

- - - - -
2c23e2e3 by mniip at 2020-04-23T18:33:21-04:00
Include docs for non-primop entries in primops.txt as well

- - - - -
0ac29c88 by mniip at 2020-04-23T18:33:21-04:00
GHC.Prim docs: note and test

- - - - -
7eb451f9 by Ben Gamari at 2020-04-25T09:58:52-04:00
Add few cleanups of the CAF logic

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- CODEOWNERS
- compiler/GHC.hs
- compiler/prelude/PrelNames.hs → compiler/GHC/Builtin/Names.hs
- compiler/prelude/PrelNames.hs-boot → compiler/GHC/Builtin/Names.hs-boot
- compiler/prelude/THNames.hs → compiler/GHC/Builtin/Names/TH.hs
- compiler/prelude/PrimOp.hs → compiler/GHC/Builtin/PrimOps.hs
- compiler/prelude/PrimOp.hs-boot → compiler/GHC/Builtin/PrimOps.hs-boot
- compiler/prelude/TysWiredIn.hs → compiler/GHC/Builtin/Types.hs
- compiler/prelude/TysWiredIn.hs-boot → compiler/GHC/Builtin/Types.hs-boot
- compiler/typecheck/TcTypeNats.hs → compiler/GHC/Builtin/Types/Literals.hs
- compiler/prelude/TysPrim.hs → compiler/GHC/Builtin/Types/Prim.hs
- compiler/prelude/KnownUniques.hs → compiler/GHC/Builtin/Uniques.hs
- compiler/prelude/KnownUniques.hs-boot → compiler/GHC/Builtin/Uniques.hs-boot
- compiler/prelude/PrelInfo.hs → compiler/GHC/Builtin/Utils.hs
- compiler/prelude/primops.txt.pp → compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/InfoTable.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/BlockId.hs
- compiler/GHC/Cmm/BlockId.hs-boot
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/CommonBlockElim.hs
- compiler/GHC/Cmm/Dataflow.hs
- compiler/GHC/Cmm/Dataflow/Label.hs
- compiler/GHC/Cmm/DebugBlock.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4a147e7eb82883c70683da2682d5596287e196a6...7eb451f9cb25f316a94f470943ca3e9747d9e2a7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4a147e7eb82883c70683da2682d5596287e196a6...7eb451f9cb25f316a94f470943ca3e9747d9e2a7
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/20200425/2bb5c3ad/attachment-0001.html>


More information about the ghc-commits mailing list