[Git][ghc/ghc][wip/T18126] 83 commits: Remove further dead code found by a simple Python script.

Simon Peyton Jones gitlab at gitlab.haskell.org
Tue May 26 10:02:42 UTC 2020



Simon Peyton Jones pushed to branch wip/T18126 at Glasgow Haskell Compiler / GHC


Commits:
6f6d72b2 by Brian Foley at 2020-05-08T15:29:25-04:00
Remove further dead code found by a simple Python script.

Avoid removing some functions that are part of an API even
though they're not used in-tree at the moment.

- - - - -
78bf8bf9 by Julien Debon at 2020-05-08T15:29:28-04:00
Add doc examples for Bifoldable

See #17929

- - - - -
66f0a847 by Julien Debon at 2020-05-08T15:29:29-04:00
doc (Bitraversable): Add examples to Bitraversable

* Add examples to Data.Bitraversable
* Fix formatting for (,) in Bitraversable and Bifoldable
* Fix mistake on bimapAccumR documentation

See #17929

- - - - -
9749fe12 by Baldur Blöndal at 2020-05-08T15:29:32-04:00
Specify kind variables for inferred kinds in base.

- - - - -
4e9aef9e by John Ericson at 2020-05-08T15:29:36-04:00
HsSigWcTypeScoping: Pull in documentation from stray location

- - - - -
f4d5c6df by John Ericson at 2020-05-08T15:29:36-04:00
Rename local `real_fvs` to `implicit_vs`

It doesn't make sense to call the "free" variables we are about to
implicitly bind the real ones.

- - - - -
20570b4b by John Ericson at 2020-05-08T15:29:36-04:00
A few tiny style nits with renaming

 - Use case rather than guards that repeatedly scrutenize same thing.

 - No need for view pattern when `L` is fine.

 - Use type synnonym to convey the intent like elsewhere.

- - - - -
09ac8de5 by John Ericson at 2020-05-08T15:29:36-04:00
Add `forAllOrNothing` function with note

- - - - -
bb35c0e5 by Joseph C. Sible at 2020-05-08T15:29:40-04:00
Document lawlessness of Ap's Num instance
- - - - -
cdd229ff by Joseph C. Sible at 2020-05-08T15:29:40-04:00
Apply suggestion to libraries/base/Data/Monoid.hs
- - - - -
926d2aab by Joseph C. Sible at 2020-05-08T15:29:40-04:00
Apply more suggestions from Simon Jakobi
- - - - -
7a763cff by Adam Gundry at 2020-05-08T15:29:41-04:00
Reject all duplicate declarations involving DuplicateRecordFields (fixes #17965)

This fixes a bug that resulted in some programs being accepted that used the same
identifier as a field label and another declaration, depending on the order they
appeared in the source code.

- - - - -
88e3c815 by Simon Peyton Jones at 2020-05-08T15:29:41-04:00
Fix specialisation for DFuns

When specialising a DFun we must take care to saturate the
unfolding.  See Note [Specialising DFuns] in Specialise.

Fixes #18120

- - - - -
86c77b36 by Greg Steuck at 2020-05-08T15:29:45-04:00
Remove unused SEGMENT_PROT_RWX

It's been unused for a year and is problematic on any OS which
requires W^X for security.

- - - - -
9d97f4b5 by nineonine at 2020-05-08T15:30:03-04:00
Add test for #16167

- - - - -
aa318338 by Ryan Scott at 2020-05-08T15:30:04-04:00
Bump exceptions submodule so that dist-boot is .gitignore'd

`exceptions` is a stage-0 boot library as of commit
30272412fa437ab8e7a8035db94a278e10513413, which means that building
`exceptions` in a GHC tree will generate a `dist-boot` directory.
However, this directory was not specified in `exceptions`'
`.gitignore` file, which causes it to dirty up the current `git`
working directory.

Accordingly, this bumps the `exceptions` submodule to commit
ghc/packages/exceptions at 23c0b8a50d7592af37ca09beeec16b93080df98f,
which adds `dist-boot` to the `.gitignore` file.

- - - - -
ea86360f by Ömer Sinan Ağacan at 2020-05-08T15:30:30-04:00
Linker.c: initialize n_symbols of ObjectCode with other fields

- - - - -
951c1fb0 by Sylvain Henry at 2020-05-09T21:46:38-04:00
Fix unboxed-sums GC ptr-slot rubbish value (#17791)

This patch allows boot libraries to use unboxed sums without implicitly
depending on `base` package because of `absentSumFieldError`.

See updated Note [aBSENT_SUM_FIELD_ERROR_ID] in GHC.Core.Make

- - - - -
b352d63c by Ben Gamari at 2020-05-09T21:47:14-04:00
rts: Make non-existent linker search path merely a warning

As noted in #18105, previously this resulted in a rather intrusive error
message. This is in contrast to the general expectation that search
paths are merely places to look, not places that must exist.

Fixes #18105.

- - - - -
cf4f1e2f by Ben Gamari at 2020-05-13T02:02:33-04:00
rts/CNF: Fix fixup comparison function

Previously we would implicitly convert the difference between two words
to an int, resulting in an integer overflow on 64-bit machines.

Fixes #16992

- - - - -
a03da9bf by Ömer Sinan Ağacan at 2020-05-13T02:03:16-04:00
Pack some of IdInfo fields into a bit field

This reduces residency of compiler quite a bit on some programs.
Example stats when building T10370:

Before:

   2,871,242,832 bytes allocated in the heap
   4,693,328,008 bytes copied during GC
      33,941,448 bytes maximum residency (276 sample(s))
         375,976 bytes maximum slop
              83 MiB total memory in use (0 MB lost due to fragmentation)

After:

   2,858,897,344 bytes allocated in the heap
   4,629,255,440 bytes copied during GC
      32,616,624 bytes maximum residency (278 sample(s))
         314,400 bytes maximum slop
              80 MiB total memory in use (0 MB lost due to fragmentation)

So -3.9% residency, -1.3% bytes copied and -0.4% allocations.

Fixes #17497

Metric Decrease:
    T9233
    T9675

- - - - -
670c3e5c by Ben Gamari at 2020-05-13T02:03:54-04:00
get-win32-tarballs: Fix base URL

Revert a change previously made for testing purposes.

- - - - -
8ad8dc41 by Ben Gamari at 2020-05-13T02:03:54-04:00
get-win32-tarballs: Improve diagnostics output

- - - - -
8c0740b7 by Simon Jakobi at 2020-05-13T02:04:33-04:00
docs: Add examples for Data.Semigroup.Arg{Min,Max}

Context: #17153

- - - - -
cb22348f by Ben Gamari at 2020-05-13T02:05:11-04:00
Add few cleanups of the CAF logic

Give the NameSet of non-CAFfy names a proper newtype to distinguish it
from all of the other NameSets floating about.

- - - - -
90e38b81 by Emeka Nkurumeh at 2020-05-13T02:05:51-04:00
fix printf warning when using with ghc with clang on mingw
- - - - -
86d8ac22 by Sebastian Graf at 2020-05-13T02:06:29-04:00
CprAnal: Don't attach CPR sigs to expandable bindings (#18154)

Instead, look through expandable unfoldings in `cprTransform`.
See the new Note [CPR for expandable unfoldings]:

```
Long static data structures (whether top-level or not) like

  xs = x1 : xs1
  xs1 = x2 : xs2
  xs2 = x3 : xs3

should not get CPR signatures, because they

  * Never get WW'd, so their CPR signature should be irrelevant after analysis
    (in fact the signature might even be harmful for that reason)
  * Would need to be inlined/expanded to see their constructed product
  * Recording CPR on them blows up interface file sizes and is redundant with
    their unfolding. In case of Nested CPR, this blow-up can be quadratic!

But we can't just stop giving DataCon application bindings the CPR property,
for example

  fac 0 = 1
  fac n = n * fac (n-1)

fac certainly has the CPR property and should be WW'd! But FloatOut will
transform the first clause to

  lvl = 1
  fac 0 = lvl

If lvl doesn't have the CPR property, fac won't either. But lvl doesn't have a
CPR signature to extrapolate into a CPR transformer ('cprTransform'). So
instead we keep on cprAnal'ing through *expandable* unfoldings for these arity
0 bindings via 'cprExpandUnfolding_maybe'.

In practice, GHC generates a lot of (nested) TyCon and KindRep bindings, one
for each data declaration. It's wasteful to attach CPR signatures to each of
them (and intractable in case of Nested CPR).
```

Fixes #18154.

- - - - -
e34bf656 by Ben Gamari at 2020-05-13T02:07:08-04:00
users-guide: Add discussion of shared object naming

Fixes #18074.

- - - - -
5d0f2445 by Ben Gamari at 2020-05-13T02:07:47-04:00
testsuite: Print sign of performance changes

Executes the minor formatting change in the tabulated performance
changes suggested in #18135.

- - - - -
9e4b981f by Ben Gamari at 2020-05-13T02:08:24-04:00
testsuite: Add testcase for #18129

- - - - -
266310c3 by Ivan-Yudin at 2020-05-13T02:09:03-04:00
doc: Reformulate the opening paragraph of Ch. 4 in User's guide

Removes mentioning of Hugs
(it is not helpful for new users anymore).

Changes the wording for the rest of the paragraph.

Fixes #18132.

- - - - -
55e35c0b by Baldur Blöndal at 2020-05-13T20:02:48-04:00
Predicate, Equivalence derive via `.. -> a -> All'

- - - - -
d7e0b57f by Alp Mestanogullari at 2020-05-13T20:03:30-04:00
hadrian: add a --freeze2 option to freeze stage 1 and 2

- - - - -
d880d6b2 by Artem Pelenitsyn at 2020-05-13T20:04:11-04:00
Don't reload environment files on every setSessionDynFlags

Makes `interpretPackageEnv` (which loads envirinment files) a part of
`parseDynamicFlags` (parsing command-line arguments, which is typically
done once) instead of `setSessionDynFlags` (which is typically called
several times). Making several (transitive) calls to `interpretPackageEnv`,
as before, caused #18125 #16318, which should be fixed now.

- - - - -
102cfd67 by Ryan Scott at 2020-05-13T20:04:46-04:00
Factor out HsPatSigType for pat sigs/RULE term sigs (#16762)

This implements chunks (2) and (3) of
https://gitlab.haskell.org/ghc/ghc/issues/16762#note_270170. Namely,
it introduces a dedicated `HsPatSigType` AST type, which represents
the types that can appear in pattern signatures and term-level `RULE`
binders. Previously, these were represented with `LHsSigWcType`.
Although `LHsSigWcType` is isomorphic to `HsPatSigType`, the intended
semantics of the two types are slightly different, as evidenced by
the fact that they have different code paths in the renamer and
typechecker.

See also the new `Note [Pattern signature binders and scoping]` in
`GHC.Hs.Types`.

- - - - -
b17574f7 by Hécate at 2020-05-13T20:05:28-04:00
fix(documentation): Fix the RST links to GHC.Prim

- - - - -
df021fb1 by Baldur Blöndal at 2020-05-13T20:06:06-04:00
Document (->) using inferred quantification for its runtime representations.

Fixes #18142.

- - - - -
1a93ea57 by Takenobu Tani at 2020-05-13T20:06:54-04:00
Tweak man page for ghc command

This commit updates the ghc command's man page as followings:

* Enable `man_show_urls` to show URL addresses in the `DESCRIPTION`
section of ghc.rst, because sphinx currently removes hyperlinks
for man pages.

* Add a `SEE ALSO` section to point to the GHC homepage

- - - - -
a951e1ba by Takenobu Tani at 2020-05-13T20:07:37-04:00
GHCi: Add link to the user's guide in help message

This commit adds a link to the user's guide in ghci's
`:help` message.

Newcomers could easily reach to details of ghci.

- - - - -
404581ea by Jeff Happily at 2020-05-13T20:08:15-04:00
Handle single unused import

- - - - -
1c999e5d by Ben Gamari at 2020-05-13T20:09:07-04:00
Ensure that printMinimalImports closes handle

Fixes #18166.

- - - - -
c9f5a8f4 by Ben Gamari at 2020-05-13T20:09:51-04:00
hadrian: Tell testsuite driver about LLVM availability

This reflects the logic present in the Make build system into Hadrian.

Fixes #18167.

- - - - -
c05c0659 by Simon Jakobi at 2020-05-14T03:31:21-04:00
Improve some folds over Uniq[D]FM

* Replace some non-deterministic lazy folds with
  strict folds.
* Replace some O(n log n) folds in deterministic order
  with O(n) non-deterministic folds.
* Replace some folds with set-operations on the underlying
  IntMaps.

This reduces max residency when compiling
`nofib/spectral/simple/Main.hs` with -O0 by about 1%.

Maximum residency when compiling Cabal also seems reduced on the
order of 3-9%.

- - - - -
477f13bb by Simon Jakobi at 2020-05-14T03:31:58-04:00
Use Data.IntMap.disjoint

Data.IntMap gained a dedicated `disjoint` function in containers-0.6.2.1.

This patch applies this function where appropriate in hopes of modest
compiler performance improvements.

Closes #16806.

- - - - -
e9c0110c by Ben Gamari at 2020-05-14T12:25:53-04:00
IdInfo: Add reference to bitfield-packing ticket

- - - - -
9bd20e83 by Sebastian Graf at 2020-05-15T10:42:09-04:00
DmdAnal: Improve handling of precise exceptions

This patch does two things: Fix possible unsoundness in what was called
the "IO hack" and implement part 2.1 of the "fixing precise exceptions"
plan in
https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions,
which, in combination with !2956, supersedes !3014 and !2525.

**IO hack**

The "IO hack" (which is a fallback to preserve precise exceptions
semantics and thus soundness, rather than some smart thing that
increases precision) is called `exprMayThrowPreciseException` now.
I came up with two testcases exemplifying possible unsoundness (if
twisted enough) in the old approach:

- `T13380d`: Demonstrating unsoundness of the "IO hack" when resorting
             to manual state token threading and direct use of primops.
             More details below.
- `T13380e`: Demonstrating unsoundness of the "IO hack" when we have
             Nested CPR. Not currently relevant, as we don't have Nested
             CPR yet.
- `T13380f`: Demonstrating unsoundness of the "IO hack" for safe FFI
             calls.

Basically, the IO hack assumed that precise exceptions can only be
thrown from a case scrutinee of type `(# State# RealWorld, _ #)`. I
couldn't come up with a program using the `IO` abstraction that violates
this assumption. But it's easy to do so via manual state token threading
and direct use of primops, see `T13380d`. Also similar code might be
generated by Nested CPR in the (hopefully not too) distant future, see
`T13380e`. Hence, we now have a more careful test in `forcesRealWorld`
that passes `T13380{d,e}` (and will hopefully be robust to Nested CPR).

**Precise exceptions**

In #13380 and #17676 we saw that we didn't preserve precise exception
semantics in demand analysis. We fixed that with minimal changes in
!2956, but that was terribly unprincipled.

That unprincipledness resulted in a loss of precision, which is tracked
by these new test cases:

- `T13380b`: Regression in dead code elimination, because !2956 was too
             syntactic about `raiseIO#`
- `T13380c`: No need to apply the "IO hack" when the IO action may not
             throw a precise exception (and the existing IO hack doesn't
             detect that)

Fixing both issues in !3014 turned out to be too complicated and had
the potential to regress in the future. Hence we decided to only fix
`T13380b` and augment the `Divergence` lattice with a new middle-layer
element, `ExnOrDiv`, which means either `Diverges` (, throws an
imprecise exception) or throws a *precise* exception.

See the wiki page on Step 2.1 for more implementational details:
https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions#dead-code-elimination-for-raiseio-with-isdeadenddiv-introducing-exnordiv-step-21

- - - - -
568d7279 by Ben Gamari at 2020-05-15T10:42:46-04:00
GHC.Cmm.Opt: Handle MO_XX_Conv

This MachOp was introduced by 2c959a1894311e59cd2fd469c1967491c1e488f3
but a wildcard match in cmmMachOpFoldM hid the fact that it wasn't
handled. Ideally we would eliminate the match but this appears to be a
larger task.

Fixes #18141.

- - - - -
5bcf8606 by Ryan Scott at 2020-05-17T08:46:38-04:00
Remove duplicate Note [When to print foralls] in GHC.Core.TyCo.Ppr

There are two different Notes named `[When to print foralls]`. The
most up-to-date one is in `GHC.Iface.Type`, but there is a second
one in `GHC.Core.TyCo.Ppr`. The latter is less up-to-date, as it was
written before GHC switched over to using ifaces to pretty-print
types. I decided to just remove the latter and replace it with a
reference to the former.

[ci skip]

- - - - -
55f0e783 by Fumiaki Kinoshita at 2020-05-21T12:10:44-04:00
base: Add Generic instances to various datatypes under GHC.*

* GHC.Fingerprint.Types: Fingerprint
* GHC.RTS.Flags: GiveGCStats, GCFlags, ConcFlags, DebugFlags, CCFlags, DoHeapProfile, ProfFlags, DoTrace, TraceFlags, TickyFlags, ParFlags and RTSFlags
* GHC.Stats: RTSStats and GCStats
* GHC.ByteOrder: ByteOrder
* GHC.Unicode: GeneralCategory
* GHC.Stack.Types: SrcLoc

Metric Increase:
    haddock.base

- - - - -
a9311cd5 by Gert-Jan Bottu at 2020-05-21T12:11:31-04:00
Explicit Specificity

Implementation for Ticket #16393.
Explicit specificity allows users to manually create inferred type variables,
by marking them with braces.
This way, the user determines which variables can be instantiated through
visible type application.

The additional syntax is included in the parser, allowing users to write
braces in type variable binders (type signatures, data constructors etc).
This information is passed along through the renamer and verified in the
type checker.
The AST for type variable binders, data constructors, pattern synonyms,
partial signatures and Template Haskell has been updated to include the
specificity of type variables.

Minor notes:
- Bumps haddock submodule
- Disables pattern match checking in GHC.Iface.Type with GHC 8.8

- - - - -
24e61aad by Ben Price at 2020-05-21T12:12:17-04:00
Lint should say when it is checking a rule

It is rather confusing that when lint finds an error in a rule attached
to a binder, it reports the error as in the RHS, not the rule:
  ...
  In the RHS of foo

We add a clarifying line:
  ...
  In the RHS of foo
  In a rule attached to foo

The implication that the rule lives inside the RHS is a bit odd, but
this niggle is already present for unfoldings, whose pattern we are
following.

- - - - -
78c6523c by Ben Gamari at 2020-05-21T12:13:01-04:00
nonmoving: Optimise the write barrier

- - - - -
13f6c9d0 by Andreas Klebinger at 2020-05-21T12:13:45-04:00
Refactor linear reg alloc to remember past assignments.

When assigning registers we now first try registers we
assigned to in the past, instead of picking the "first"
one.

This is in extremely helpful when dealing with loops for
which variables are dead for part of the loop.

This is important for patterns like this:

        foo = arg1
    loop:
        use(foo)
        ...
        foo = getVal()
        goto loop;

There we:
* assign foo to the register of arg1.
* use foo, it's dead after this use as it's overwritten after.
* do other things.
* look for a register to put foo in.

If we pick an arbitrary one it might differ from the register the
start of the loop expect's foo to be in.
To fix this we simply look for past register assignments for
the given variable. If we find one and the register is free we
use that register.

This reduces the need for fixup blocks which match the register
assignment between blocks. In the example above between the end
and the head of the loop.

This patch also moves branch weight estimation ahead of register
allocation and adds a flag to control it (cmm-static-pred).
* It means the linear allocator is more likely to assign the hotter
  code paths first.
* If it assign these first we are:
  + Less likely to spill on the hot path.
  + Less likely to introduce fixup blocks on the hot path.

These two measure combined are surprisingly effective. Based on nofib
we get in the mean:

* -0.9% instructions executed
* -0.1% reads/writes
* -0.2% code size.
* -0.1% compiler allocations.
* -0.9% compile time.
* -0.8% runtime.

Most of the benefits are simply a result of removing redundant moves
and spills.

Reduced compiler allocations likely are the result of less code being
generated. (The added lookup is mostly non-allocating).

- - - - -
edc2cc58 by Andreas Klebinger at 2020-05-21T12:14:25-04:00
NCG: Codelayout: Distinguish conditional and other branches.

In #18053 we ended up with a suboptimal code layout because
the code layout algorithm didn't distinguish between conditional
and unconditional control flow.

We can completely eliminate unconditional control flow instructions
by placing blocks next to each other, not so much for conditionals.

In terms of implementation we simply give conditional branches less
weight before computing the layout.

Fixes #18053

- - - - -
b7a6b2f4 by Gleb Popov at 2020-05-21T12:15:26-04:00
gitlab-ci: Set locale to C.UTF-8.

- - - - -
a8c27cf6 by Stefan Holdermans at 2020-05-21T12:16:08-04:00
Allow spaces in GHCi :script file names

This patch updates the user interface of GHCi so that file names passed
to the ':script' command may contain spaces escaped with a backslash.

For example:

  :script foo\ bar.script

The implementation uses a modified version of 'words' that does not
break on escaped spaces.

Fixes #18027.

- - - - -
82663959 by Stefan Holdermans at 2020-05-21T12:16:08-04:00
Add extra tests for GHCi :script syntax checks

The syntax for GHCi's ":script" command allows for only a single file
name to be passed as an argument. This patch adds a test for the cases
in which a file name is missing or multiple file names are passed.

Related to #T18027.

- - - - -
a0b79e1b by Stefan Holdermans at 2020-05-21T12:16:08-04:00
Allow GHCi :script file names in double quotes

This patch updates the user interface of GHCi so that file names passed
to the ':script' command can be wrapped in double quotes.

For example:

  :script "foo bar.script"

The implementation uses a modified version of 'words' that treats
character sequences enclosed in double quotes as single words.

Fixes #18027.

- - - - -
cf566330 by Stefan Holdermans at 2020-05-21T12:16:08-04:00
Update documentation for GHCi :script

This patch adds the fixes that allow for file names containing spaces to
be passed to GHCi's ':script' command to the release notes for 8.12 and
expands the user-guide documentation for ':script' by mentioning how
such file names can be passed.

Related to #18027.

- - - - -
0004ccb8 by Tuan Le at 2020-05-21T12:16:46-04:00
llvmGen: Consider Relocatable read-only data as not constantReferences: #18137

- - - - -
964d3ea2 by John Ericson at 2020-05-21T12:17:30-04:00
Use `Checker` for `tc_pat`

- - - - -
b797aa42 by John Ericson at 2020-05-21T12:17:30-04:00
Use `Checker` for `tc_lpat` and `tc_lpats`

- - - - -
5108e84a by John Ericson at 2020-05-21T12:17:30-04:00
More judiciously panic in `ts_pat`

- - - - -
510e0451 by John Ericson at 2020-05-21T12:17:30-04:00
Put `PatEnv` first in `GHC.Tc.Gen.Pat.Checker`

- - - - -
cb4231db by John Ericson at 2020-05-21T12:17:30-04:00
Tiny cleaup eta-reduce away a function argument

In GHC, not in the code being compiled!

- - - - -
6890c38d by John Ericson at 2020-05-21T12:17:30-04:00
Use braces with do in `SplicePat` case for consistency

- - - - -
3451584f by buggymcbugfix at 2020-05-21T12:18:06-04:00
Fix spelling mistakes and typos

- - - - -
b552e531 by buggymcbugfix at 2020-05-21T12:18:06-04:00
Add INLINABLE pragmas to Enum list producers

The INLINABLE pragmas ensure that we export stable (unoptimised) unfoldings in
the interface file so we can do list fusion at usage sites.

Related tickets: #15185, #8763, #18178.

- - - - -
e7480063 by buggymcbugfix at 2020-05-21T12:18:06-04:00
Piggyback on Enum Word methods for Word64

If we are on a 64 bit platform, we can use the efficient Enum Word
methods for the Enum Word64 instance.

- - - - -
892b0c41 by buggymcbugfix at 2020-05-21T12:18:06-04:00
Document INLINE(ABLE) pragmas that enable fusion

- - - - -
2b363ebb by Richard Eisenberg at 2020-05-21T12:18:45-04:00
MR template should ask for key part
- - - - -
a95bbd0b by Sebastian Graf at 2020-05-21T12:19:37-04:00
Make `Int`'s `mod` and `rem` strict in their first arguments

They used to be strict until 4d2ac2d (9 years ago).

It's obviously better to be strict for performance reasons.
It also blocks #18067.

NoFib results:

```
--------------------------------------------------------------------------------
        Program         Allocs    Instrs
--------------------------------------------------------------------------------
        integer          -1.1%     +0.4%
   wheel-sieve2         +21.2%    +20.7%
--------------------------------------------------------------------------------
            Min          -1.1%     -0.0%
            Max         +21.2%    +20.7%
 Geometric Mean          +0.2%     +0.2%
```

The regression in `wheel-sieve2` is due to reboxing that likely will go
away with the resolution of #18067. See !3282 for details.

Fixes #18187.

- - - - -
d3d055b8 by Galen Huntington at 2020-05-21T12:20:18-04:00
Clarify pitfalls of NegativeLiterals; see #18022.
- - - - -
1b508a9e by Alexey Kuleshevich at 2020-05-21T12:21:02-04:00
Fix wording in primops documentation to reflect the correct reasoning:

* Besides resizing functions, shrinking ones also mutate the
  size of a mutable array and because of those two `sizeofMutabeByteArray`
  and `sizeofSmallMutableArray` are now deprecated
* Change reference in documentation to the newer functions `getSizeof*`
  instead of `sizeof*` for shrinking functions
* Fix incorrect mention of "byte" instead of "small"

- - - - -
4ca0c8a1 by Andreas Klebinger at 2020-05-21T12:21:53-04:00
Don't variable-length encode magic iface constant.

We changed to use variable length encodings for many types by default,
including Word32. This makes sense for numbers but not when Word32 is
meant to represent four bytes.

I added a FixedLengthEncoding newtype to Binary who's instances
interpret their argument as a collection of bytes instead of a number.

We then use this when writing/reading magic numbers to the iface file.

I also took the libery to remove the dummy iface field.

This fixes #18180.

- - - - -
a1275081 by Krzysztof Gogolewski at 2020-05-21T12:22:35-04:00
Add a regression test for #11506

The testcase works now.
See explanation in https://gitlab.haskell.org/ghc/ghc/issues/11506#note_273202

- - - - -
8a816e5f by Krzysztof Gogolewski at 2020-05-21T12:23:55-04:00
Sort deterministically metric output

Previously, we sorted according to the test name and way,
but the metrics (max_bytes_used/peak_megabytes_allocated etc.)
were appearing in nondeterministic order.

- - - - -
566cc73f by Sylvain Henry at 2020-05-21T12:24:45-04:00
Move isDynLinkName into GHC.Types.Name

It doesn't belong into GHC.Unit.State

- - - - -
1d118923 by Simon Peyton Jones at 2020-05-22T19:54:47-04:00
Simple subsumption

This patch simplifies GHC to use simple subsumption.
  Ticket #17775

Implements GHC proposal #287
   https://github.com/ghc-proposals/ghc-proposals/blob/master/
   proposals/0287-simplify-subsumption.rst

All the motivation is described there; I will not repeat it here.
The implementation payload:
 * tcSubType and friends become noticably simpler, because it no
   longer uses eta-expansion when checking subsumption.
 * No deeplyInstantiate or deeplySkolemise

That in turn means that some tests fail, by design; they can all
be fixed by eta expansion.  There is a list of such changes below.

Implementing the patch led me into a variety of sticky corners, so
the patch includes several othe changes, some quite significant:

* I made String wired-in, so that
    "foo" :: String   rather than
    "foo" :: [Char]
  This improves error messages, and fixes #15679

* The pattern match checker relies on knowing about in-scope equality
  constraints, andd adds them to the desugarer's environment using
  addTyCsDs.  But the co_fn in a FunBind was missed, and for some reason
  simple-subsumption ends up with dictionaries there. So I added a
  call to addTyCsDs.  This is really part of #18049.

* I moved the ic_telescope field out of Implication and into
  ForAllSkol instead.  This is a nice win; just expresses the code
  much better.

* There was a bug in GHC.Tc.TyCl.Instance.tcDataFamInstHeader.
  We called checkDataKindSig inside tc_kind_sig, /before/
  solveEqualities and zonking.  Obviously wrong, easily fixed.

* solveLocalEqualitiesX: there was a whole mess in here, around
  failing fast enough.  I discovered a bad latent bug where we
  could successfully kind-check a type signature, and use it,
  but have unsolved constraints that could fill in coercion
  holes in that signature --  aargh.

  It's all explained in Note [Failure in local type signatures]
  in GHC.Tc.Solver. Much better now.

* I fixed a serious bug in anonymous type holes. IN
    f :: Int -> (forall a. a -> _) -> Int
  that "_" should be a unification variable at the /outer/
  level; it cannot be instantiated to 'a'.  This was plain
  wrong.  New fields mode_lvl and mode_holes in TcTyMode,
  and auxiliary data type GHC.Tc.Gen.HsType.HoleMode.

  This fixes #16292, but makes no progress towards the more
  ambitious #16082

* I got sucked into an enormous refactoring of the reporting of
  equality errors in GHC.Tc.Errors, especially in
      mkEqErr1
      mkTyVarEqErr
      misMatchMsg
      misMatchMsgOrCND
  In particular, the very tricky mkExpectedActualMsg function
  is gone.

  It took me a full day.  But the result is far easier to understand.
  (Still not easy!)  This led to various minor improvements in error
  output, and an enormous number of test-case error wibbles.

  One particular point: for occurs-check errors I now just say
     Can't match 'a' against '[a]'
  rather than using the intimidating language of "occurs check".

* Pretty-printing AbsBinds

Tests review

* Eta expansions
   T11305: one eta expansion
   T12082: one eta expansion (undefined)
   T13585a: one eta expansion
   T3102:  one eta expansion
   T3692:  two eta expansions (tricky)
   T2239:  two eta expansions
   T16473: one eta
   determ004: two eta expansions (undefined)
   annfail06: two eta (undefined)
   T17923: four eta expansions (a strange program indeed!)
   tcrun035: one eta expansion

* Ambiguity check at higher rank.  Now that we have simple
  subsumption, a type like
     f :: (forall a. Eq a => Int) -> Int
  is no longer ambiguous, because we could write
     g :: (forall a. Eq a => Int) -> Int
     g = f
  and it'd typecheck just fine.  But f's type is a bit
  suspicious, and we might want to consider making the
  ambiguity check do a check on each sub-term.  Meanwhile,
  these tests are accepted, whereas they were previously
  rejected as ambiguous:
     T7220a
     T15438
     T10503
     T9222

* Some more interesting error message wibbles
   T13381: Fine: one error (Int ~ Exp Int)
           rather than two (Int ~ Exp Int, Exp Int ~ Int)
   T9834:  Small change in error (improvement)
   T10619: Improved
   T2414:  Small change, due to order of unification, fine
   T2534:  A very simple case in which a change of unification order
           means we get tow unsolved constraints instead of one
   tc211: bizarre impredicative tests; just accept this for now

Updates Cabal submodule.

- - - - -
fcb157d7 by Simon Peyton Jones at 2020-05-23T22:33:20+01:00
Simple subsumption

This patch simplifies GHC to use simple subsumption.
  Ticket #17775

Implements GHC proposal #287
   https://github.com/ghc-proposals/ghc-proposals/blob/master/
   proposals/0287-simplify-subsumption.rst

All the motivation is described there; I will not repeat it here.
The implementation payload:
 * tcSubType and friends become noticably simpler, because it no
   longer uses eta-expansion when checking subsumption.
 * No deeplyInstantiate or deeplySkolemise

That in turn means that some tests fail, by design; they can all
be fixed by eta expansion.  There is a list of such changes below.

Implementing the patch led me into a variety of sticky corners, so
the patch includes several othe changes, some quite significant:

* I made String wired-in, so that
    "foo" :: String   rather than
    "foo" :: [Char]
  This improves error messages, and fixes #15679

* The pattern match checker relies on knowing about in-scope equality
  constraints, andd adds them to the desugarer's environment using
  addTyCsDs.  But the co_fn in a FunBind was missed, and for some reason
  simple-subsumption ends up with dictionaries there. So I added a
  call to addTyCsDs.  This is really part of #18049.

* I moved the ic_telescope field out of Implication and into
  ForAllSkol instead.  This is a nice win; just expresses the code
  much better.

* There was a bug in GHC.Tc.TyCl.Instance.tcDataFamInstHeader.
  We called checkDataKindSig inside tc_kind_sig, /before/
  solveEqualities and zonking.  Obviously wrong, easily fixed.

* solveLocalEqualitiesX: there was a whole mess in here, around
  failing fast enough.  I discovered a bad latent bug where we
  could successfully kind-check a type signature, and use it,
  but have unsolved constraints that could fill in coercion
  holes in that signature --  aargh.

  It's all explained in Note [Failure in local type signatures]
  in GHC.Tc.Solver. Much better now.

* I fixed a serious bug in anonymous type holes. IN
    f :: Int -> (forall a. a -> _) -> Int
  that "_" should be a unification variable at the /outer/
  level; it cannot be instantiated to 'a'.  This was plain
  wrong.  New fields mode_lvl and mode_holes in TcTyMode,
  and auxiliary data type GHC.Tc.Gen.HsType.HoleMode.

  This fixes #16292, but makes no progress towards the more
  ambitious #16082

* I got sucked into an enormous refactoring of the reporting of
  equality errors in GHC.Tc.Errors, especially in
      mkEqErr1
      mkTyVarEqErr
      misMatchMsg
      misMatchMsgOrCND
  In particular, the very tricky mkExpectedActualMsg function
  is gone.

  It took me a full day.  But the result is far easier to understand.
  (Still not easy!)  This led to various minor improvements in error
  output, and an enormous number of test-case error wibbles.

  One particular point: for occurs-check errors I now just say
     Can't match 'a' against '[a]'
  rather than using the intimidating language of "occurs check".

* Pretty-printing AbsBinds

Tests review

* Eta expansions
   T11305: one eta expansion
   T12082: one eta expansion (undefined)
   T13585a: one eta expansion
   T3102:  one eta expansion
   T3692:  two eta expansions (tricky)
   T2239:  two eta expansions
   T16473: one eta
   determ004: two eta expansions (undefined)
   annfail06: two eta (undefined)
   T17923: four eta expansions (a strange program indeed!)
   tcrun035: one eta expansion

* Ambiguity check at higher rank.  Now that we have simple
  subsumption, a type like
     f :: (forall a. Eq a => Int) -> Int
  is no longer ambiguous, because we could write
     g :: (forall a. Eq a => Int) -> Int
     g = f
  and it'd typecheck just fine.  But f's type is a bit
  suspicious, and we might want to consider making the
  ambiguity check do a check on each sub-term.  Meanwhile,
  these tests are accepted, whereas they were previously
  rejected as ambiguous:
     T7220a
     T15438
     T10503
     T9222

* Some more interesting error message wibbles
   T13381: Fine: one error (Int ~ Exp Int)
           rather than two (Int ~ Exp Int, Exp Int ~ Int)
   T9834:  Small change in error (improvement)
   T10619: Improved
   T2414:  Small change, due to order of unification, fine
   T2534:  A very simple case in which a change of unification order
           means we get tow unsolved constraints instead of one
   tc211: bizarre impredicative tests; just accept this for now

- - - - -
343bff5c by Simon Peyton Jones at 2020-05-23T22:39:20+01:00
First draft of Quick Look impredicativity

This patch implements Quick Look impredicativity
(see #18126).

The main action in is in the new module GHC.Tc.Gen.App, which
deals with typechecking function applications.  Much code has
moved from Tc.Gen.Expr into Tc.Gen.App, but Tc.Gen.App also
includes the new Quick Look code: see the function quickLook.

Not properly tested yet -- this is just so you can see what
I'm up to.

- - - - -
7683714b by Simon Peyton Jones at 2020-05-23T22:39:21+01:00
Wibbles

- - - - -
61a30705 by Simon Peyton Jones at 2020-05-26T10:58:07+01:00
More wibbles

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/merge_request_templates/merge-request.md
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/Utils.hs
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/CFG.hs
- compiler/GHC/CmmToAsm/Instr.hs
- compiler/GHC/CmmToAsm/PPC/Cond.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/Base.hs
- compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs
- compiler/GHC/CmmToAsm/Reg/Linear/SPARC.hs
- compiler/GHC/CmmToAsm/Reg/Linear/State.hs
- compiler/GHC/CmmToAsm/Reg/Linear/X86.hs
- compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs
- compiler/GHC/CmmToAsm/SPARC/Cond.hs
- compiler/GHC/CmmToAsm/X86/Cond.hs
- compiler/GHC/CmmToC.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/81ef202e7467b9ebdd52adde7af7c3dd390b77c5...61a30705fab7f1c013f1b3b28aa1a94b36c9366b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/81ef202e7467b9ebdd52adde7af7c3dd390b77c5...61a30705fab7f1c013f1b3b28aa1a94b36c9366b
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/20200526/658a0d22/attachment-0001.html>


More information about the ghc-commits mailing list