[Git][ghc/ghc][wip/int64-everywhere] 194 commits: rts: Add stg_copyArray_barrier to RtsSymbols list

Sylvain Henry gitlab at gitlab.haskell.org
Fri Oct 9 07:11:40 UTC 2020



Sylvain Henry pushed to branch wip/int64-everywhere at Glasgow Haskell Compiler / GHC


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

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

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

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

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

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

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

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

- - - - -
0c61cbff by Ben Gamari at 2020-09-08T15:43:54-04:00
gitlab-ci: Handle distributions without locales

Previously we would assume that the `locale` utility exists. However,
this is not so on Alpine as musl's locale support is essentially
non-existent.

(cherry picked from commit 17cdb7ac3b557a245fee1686e066f9f770ddc21e)

- - - - -
d989c842 by Ben Gamari at 2020-09-08T15:43:55-04:00
gitlab-ci: Accept Centos 7 C.utf8 locale

Centos apparently has C.utf8 rather than C.UTF-8.

(cherry picked from commit d9f85dd25a26a04d3485470afb3395ee2dec6464)

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

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

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

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

- - - - -
822f1057 by Ryan Scott at 2020-09-09T00:46:41-04:00
Postpone associated tyfam default checks until after typechecking

Previously, associated type family defaults were validity-checked
during typechecking. Unfortunately, the error messages that these
checks produce run the risk of printing knot-tied type constructors,
which will cause GHC to diverge. In order to preserve the current
error message's descriptiveness, this patch postpones these validity
checks until after typechecking, which are now located in the new
function `GHC.Tc.Validity.checkValidAssocTyFamDeflt`.

Fixes #18648.

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

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

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

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

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

It avoids passing and querying DynFlags down in the simplifier.

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

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

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

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

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

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

Updates haddock submodule

Closes #18639

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #18672.

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

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

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

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

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

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

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

Metric Decrease:
    T12227

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

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

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

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

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

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

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

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

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

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

Metric Decrease:
    T18478

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

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

- - - - -
853d121a by Ryan Scott at 2020-09-12T00:33:25-04:00
Don't quote argument to Hadrian's test-env flag (#18656)

Doing so causes the name of the test environment to gain an extra
set of double quotes, which changes the name entirely.

Fixes #18656.

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

See #18656.

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

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

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

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

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

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

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

Fixes #18645 and #17836.

Metric Decrease:
    T17977
    T18478

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

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

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

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

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

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

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

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

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

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

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

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

- - - - -
c7182a5c by Simon Peyton Jones at 2020-09-15T15:19:44-04:00
Care with implicit-parameter superclasses

Two bugs, #18627 and #18649, had the same cause: we were not
account for the fact that a constaint tuple might hide an implicit
parameter.

The solution is not hard: look for implicit parameters in
superclasses.  See Note [Local implicit parameters] in
GHC.Core.Predicate.

Then we use this new function in two places

* The "short-cut solver" in GHC.Tc.Solver.Interact.shortCutSolver
  which simply didn't handle implicit parameters properly at all.
  This fixes #18627

* The specialiser, which should not specialise on implicit parameters
  This fixes #18649

There are some lingering worries (see Note [Local implicit
parameters]) but things are much better.

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

This is useful for `ghcide`

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

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

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

Fixes #18662.

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

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

Fixes #18426.

- - - - -
ce42e187 by Ben Gamari at 2020-09-16T04:53:59-04:00
rts: Fix erroneous usage of vsnprintf

As pointed out in #18685, this should be snprintf not vsnprintf. This
appears to be due to a cut-and-paste error.

Fixes #18658.

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

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

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

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

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

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

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

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

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

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

- - - - -
3c94c816 by HaskellMouse at 2020-09-17T08:49:51-04:00
Added explicit fixity to (~).

Solves #18252

- - - - -
b612e396 by Cary Robbins at 2020-09-17T08:50:30-04:00
Make the 'IsString (Const a b)' instance polykinded on 'b'

- - - - -
8d0c26c4 by Ben Gamari at 2020-09-17T08:51:08-04:00
rts/win32: Fix missing #include's

These slipped through CI.

- - - - -
76009ec8 by Ben Gamari at 2020-09-17T08:51:08-04:00
Bump Win32 submodule to 2.9.0.0

Also bumps Cabal, directory

- - - - -
147bb598 by Ben Gamari at 2020-09-17T08:51:08-04:00
Bump version to 9.0

Bumps haskeline and haddock submodules.

(cherry picked from commit f218cfc92f7b1a1e01190851972bb9a0e0f3c682)

- - - - -
5c7387f6 by Leif Metcalf at 2020-09-17T08:51:43-04:00
Make Z-encoding comment into a note

- - - - -
c12b3041 by Leif Metcalf at 2020-09-17T08:51:43-04:00
Cosmetic

- - - - -
4f461e1a by Vladislav Zavialov at 2020-09-17T08:52:19-04:00
Parser.y: clarify treatment of @{-# UNPACK #-}

Before this patch, we had this parser production:

	ftype : ...
	      | ftype PREFIX_AT tyarg  { ... }

And 'tyarg' is defined as follows:

	tyarg : atype              { ... }
	      | unpackedness atype { ... }

So one might get the (false) impression that that parser production is
intended to parse things like:

	F @{-# UNPACK #-} X

However, the lexer wouldn't produce PREFIX_AT followed by 'unpackedness',
as the '@' operator followed by '{-' is not considered prefix.

Thus there's no point using 'tyarg' after PREFIX_AT,
and a simple 'atype' will suffice:

	ftype : ...
	      | ftype PREFIX_AT atype  { ... }

This change has no user-facing consequences. It just makes the grammar a
bit more clear.

- - - - -
9dec8600 by Benjamin Maurer at 2020-09-17T08:52:56-04:00
Documented '-m' flags for machine specific instruction extensions.
See #18641 'Documenting the Expected Undocumented Flags'

- - - - -
ca48076a by Sylvain Henry at 2020-09-17T20:04:08-04:00
Introduce OutputableP

Some types need a Platform value to be pretty-printed: CLabel, Cmm
types, instructions, etc.

Before this patch they had an Outputable instance and the Platform value
was obtained via sdocWithDynFlags. It meant that the *renderer* of the
SDoc was responsible of passing the appropriate Platform value (e.g. via
the DynFlags given to showSDoc).  It put the burden of passing the
Platform value on the renderer while the generator of the SDoc knows the
Platform it is generating the SDoc for and there is no point passing a
different Platform at rendering time.

With this patch, we introduce a new OutputableP class:

   class OutputableP a where
      pdoc :: Platform -> a -> SDoc

With this class we still have some polymorphism as we have with `ppr`
(i.e. we can use `pdoc` on a variety of types instead of having a
dedicated `pprXXX` function for each XXX type).

One step closer removing `sdocWithDynFlags` (#10143) and supporting
several platforms (#14335).

- - - - -
e45c8544 by Sylvain Henry at 2020-09-17T20:04:08-04:00
Generalize OutputableP

Add a type parameter for the environment required by OutputableP. It
avoids tying Platform with OutputableP.

- - - - -
37aa224a by Sylvain Henry at 2020-09-17T20:04:08-04:00
Add note about OutputableP

- - - - -
7f2785f2 by Sylvain Henry at 2020-09-17T20:04:08-04:00
Remove pprPrec from Outputable (unused)

- - - - -
b689f3db by Sylvain Henry at 2020-09-17T20:04:46-04:00
Bignum: add clamping naturalToWord (fix #18697)

- - - - -
0799b3de by Ben Gamari at 2020-09-18T15:55:50-04:00
rts/nonmoving: Add missing STM write barrier

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

- - - - -
c4921349 by Ben Gamari at 2020-09-18T15:56:25-04:00
rts: Refactor foreign export tracking

This avoids calling `libc` in the initializers which are responsible for
registering foreign exports. We believe this should avoid the corruption
observed in #18548.

See Note [Tracking foreign exports] in rts/ForeignExports.c for an
overview of the new scheme.

- - - - -
40dc9106 by Ben Gamari at 2020-09-18T15:56:25-04:00
rts: Refactor unloading of foreign export StablePtrs

Previously we would allocate a linked list cell for each foreign export.
Now we can avoid this by taking advantage of the fact that they are
already broken into groups.

- - - - -
45fa8218 by Simon Jakobi at 2020-09-19T06:57:36-04:00
Deprecate Data.Semigroup.Option

Libraries email: https://mail.haskell.org/pipermail/libraries/2018-April/028724.html

GHC issue: https://gitlab.haskell.org/ghc/ghc/issues/15028

Corresponding PRs for deepseq:
* https://github.com/haskell/deepseq/pull/55
* https://github.com/haskell/deepseq/pull/57

Bumps the deepseq submodule.

- - - - -
2229d570 by Vladislav Zavialov at 2020-09-19T15:47:24-04:00
Require happy >=1.20

- - - - -
a89c2fba by Ben Gamari at 2020-09-19T15:47:24-04:00
ci.sh: Enforce minimum happy/alex versions

Also, always invoke cabal-install to ensure that happy/alex symlinks are
up-to-date.

- - - - -
2f7ef2fb by Ben Gamari at 2020-09-19T15:47:24-04:00
gitlab-ci: Ensure that cabal-install overwrites existing executables

Previously cabal-install wouldn't overwrite toolchain executables if
they already existed (as they likely would due to caching).

- - - - -
ac213d26 by Ryan Scott at 2020-09-19T15:48:01-04:00
Wire in constraint tuples

This wires in the definitions of the constraint tuple classes. The
key changes are in:

* `GHC.Builtin.Types`, where the `mk_ctuple` function is used to
  define constraint tuple type constructors, data constructors, and
  superclass selector functions, and
* `GHC.Builtin.Uniques`. In addition to wiring in the `Unique`s for
  constraint tuple type and data constructors, we now must wire in
  the superclass selector functions. Luckily, this proves to be not
  that challenging. See the newly added comments.

Historical note: constraint tuples used to be wired-in until about
five years ago, when commit 130e93aab220bdf14d08028771f83df210da340b
turned them into known-key names. This was done as part of a larger
refactor to reduce the number of special cases for constraint tuples,
but the commit message notes that the main reason that constraint
tuples were made known-key (as opposed to boxed/unboxed tuples, which
are wired in) is because it was awkward to wire in the superclass
selectors. This commit solves the problem of wiring in superclass
selectors.

Fixes #18635.

-------------------------
Metric Decrease:
    T10421
    T12150
    T12227
    T12234
    T12425
    T13056
    T13253-spj
    T18282
    T18304
    T5321FD
    T5321Fun
    T5837
    T9961
Metric Decrease (test_env='x86_64-linux-deb9-unreg-hadrian'):
    T12707
Metric Decrease (test_env='x86_64-darwin'):
    T4029
-------------------------

- - - - -
e195dae6 by Wander Hillen at 2020-09-19T15:48:41-04:00
Export singleton function from Data.List

Data.OldList exports a monomorphized singleton function but
it is not re-exported by Data.List. Adding the export to
Data.List causes a conflict with a 14-year old function of the
same name and type by SPJ in GHC.Utils.Misc. We can't just remove
this function because that leads to a problems when building
GHC with a stage0 compiler that does not have singleton in
Data.List yet. We also can't hide the function in GHC.Utils.Misc
since it is not possible to hide a function from a module if the
module does not export the function. To work around this, all
places where the Utils.Misc singleton was used now use a qualified
version like Utils.singleton and in GHC.Utils.Misc we are very
specific about which version we export.

- - - - -
9c1b8ad9 by Sylvain Henry at 2020-09-19T15:49:19-04:00
Bump Stack resolver

- - - - -
d05d13ce by John Ericson at 2020-09-19T15:49:57-04:00
Cinch -fno-warn-name-shadowing down to specific GHCi module

- - - - -
f1accd00 by Sylvain Henry at 2020-09-19T15:49:57-04:00
Add quick-validate Hadrian flavour (quick + -Werror)

- - - - -
8f8d51f1 by Andreas Klebinger at 2020-09-19T15:50:33-04:00
Fix docs who misstated how the RTS treats size suffixes.

They are parsed as multiples of 1024. Not 1000. The docs
used to imply otherwise.

See decodeSize in rts/RtsFlags.c for the logic for this.

- - - - -
2ae0edbd by Andreas Klebinger at 2020-09-19T15:50:33-04:00
Fix a codeblock in ghci.rst

- - - - -
4df3aa95 by Ben Gamari at 2020-09-19T15:51:07-04:00
users guide: Fix various documentation issues

- - - - -
885ecd18 by Ben Gamari at 2020-09-19T15:51:07-04:00
hadrian: Fail on Sphinx syntax errors

Specifically the "Inline literal start-string without end-string"
warning, which typically means that the user neglected to separate
an inline code block from suffix text with a backslash.

- - - - -
b26cd867 by David Feuer at 2020-09-19T15:51:44-04:00
Unpack the MVar in Compact

The `MVar` lock in `Compact` was unnecessarily lazy, creating an extra indirection and wasting two words. Make it strict.
- - - - -
760307cf by Artyom Kuznetsov at 2020-09-19T15:52:21-04:00
Remove GADT self-reference check (#11554, #12081, #12174, fixes #15942)

Reverts 430f5c84dac1eab550110d543831a70516b5cac8

- - - - -
057db94c by Ben Gamari at 2020-09-19T15:52:56-04:00
rts: Drop field initializer on thread_basic_info_data_t

This struct has a number of fields and we only care that the value is
initialized with zeros. This eliminates the warnings noted in #17905.

- - - - -
87e2e2b1 by Vladislav Zavialov at 2020-09-19T23:55:30+03:00
Resolve shift/reduce conflicts with %shift (#17232)

- - - - -
66cba46e by Ben Gamari at 2020-09-20T20:30:57-04:00
testsuite: Unmark T12971 as broken on Windows

It's unclear why, but this no longer seems to fail.

Closes #17945.

- - - - -
816811d4 by Ben Gamari at 2020-09-20T20:30:57-04:00
testsuite: Unmark T5975[ab] as broken on Windows

Sadly it's unclear *why* they have suddenly started working.

Closes #7305.

- - - - -
43a43d39 by Ben Gamari at 2020-09-20T20:30:57-04:00
base/testsuite: Add missing LANGUAGE pragma in ThreadDelay001

Only affected the Windows codepath.

- - - - -
ced8f113 by Ben Gamari at 2020-09-20T20:30:57-04:00
testsuite: Update expected output for outofmem on Windows

The error originates from osCommitMemory rather than getMBlocks.

- - - - -
ea08aead by Ben Gamari at 2020-09-20T20:30:57-04:00
testsuite: Mark some GHCi/Makefile tests as broken on Windows

See #18718.

- - - - -
caf6a5a3 by GHC GitLab CI at 2020-09-20T20:30:57-04:00
testsuite: Fix WinIO error message normalization

This wasn't being applied to stderr.

- - - - -
93ab3e8d by GHC GitLab CI at 2020-09-20T20:30:57-04:00
testsuite: Mark tempfiles as broken on Win32 without WinIO

The old POSIX emulation appears to ignore the user-requested prefix.

- - - - -
9df77fed by GHC GitLab CI at 2020-09-20T20:30:57-04:00
testsuite: Mark TH_spliceE5_prof as broken on Windows

Due to #18721.

- - - - -
1a0f8243 by Ryan Scott at 2020-09-21T16:45:47-04:00
Remove unused ThBrackCtxt and ResSigCtxt

Fixes #18715.

- - - - -
2f222b12 by Ryan Scott at 2020-09-21T16:45:47-04:00
Disallow constraints in KindSigCtxt

This patch cleans up how `GHC.Tc.Validity` classifies `UserTypeCtxt`s
that can only refer to kind-level positions, which is important for
rejecting certain classes of programs. In particular, this patch:

* Introduces a new `TypeOrKindCtxt` data type and
  `typeOrKindCtxt :: UserTypeCtxt -> TypeOrKindCtxt` function, which
  determines whether a `UserTypeCtxt` can refer to type-level
  contexts, kind-level contexts, or both.
* Defines the existing `allConstraintsAllowed` and `vdqAllowed`
  functions in terms of `typeOrKindCtxt`, which avoids code
  duplication and ensures that they stay in sync in the future.

The net effect of this patch is that it fixes #18714, in which it was
discovered that `allConstraintsAllowed` incorrectly returned `True`
for `KindSigCtxt`. Because `typeOrKindCtxt` now correctly classifies
`KindSigCtxt` as a kind-level context, this bug no longer occurs.

- - - - -
aaa51dcf by Ben Gamari at 2020-09-21T16:46:22-04:00
hadrian: Add extra-deps: happy-1.20 to stack.yaml

GHC now requires happy-1.20, which isn't available in LTS-16.14.

Fixes #18726.
- - - - -
6de40f83 by Simon Peyton Jones at 2020-09-22T05:37:24-04:00
Better eta-expansion (again) and don't specilise DFuns

This patch fixes #18223, which made GHC generate an exponential
amount of code.  There are three quite separate changes in here

1.  Re-engineer eta-expansion (again).  The eta-expander was
    generating lots of intermediate stuff, which could be optimised
    away, but which choked the simplifier meanwhile.  Relatively
    easy to kill it off at source.

    See Note [The EtaInfo mechanism] in GHC.Core.Opt.Arity.
    The main new thing is the use of pushCoArg in getArg_maybe.

2.  Stop Specialise specalising DFuns.  This is the cause of a huge
    (and utterly unnecessary) blowup in program size in #18223.
    See Note [Do not specialise DFuns] in GHC.Core.Opt.Specialise.

    I also refactored the Specialise monad a bit... it was silly,
    because it passed on unchanging values as if they were mutable
    state.

3.  Do an extra Simplifer run, after SpecConstra and before
    late-Specialise.  I found (investigating perf/compiler/T16473)
    that failing to do this was crippling *both* SpecConstr *and*
    Specialise.  See Note [Simplify after SpecConstr] in
    GHC.Core.Opt.Pipeline.

    This change does mean an extra run of the Simplifier, but only
    with -O2, and I think that's acceptable.

    T16473 allocates *three* times less with this change.  (I changed
    it to check runtime rather than compile time.)

Some smaller consequences

* I moved pushCoercion, pushCoArg and friends from SimpleOpt
  to Arity, because it was needed by the new etaInfoApp.

  And pushCoValArg now returns a MCoercion rather than Coercion for
  the argument Coercion.

* A minor, incidental improvement to Core pretty-printing

This does fix #18223, (which was otherwise uncompilable. Hooray.  But
there is still a big intermediate because there are some very deeply
nested types in that program.

Modest reductions in compile-time allocation on a couple of benchmarks
    T12425     -2.0%
    T13253    -10.3%

Metric increase with -O2, due to extra simplifier run
    T9233     +5.8%
    T12227    +1.8%
    T15630    +5.0%

There is a spurious apparent increase on heap residency on T9630,
on some architectures at least.  I tried it with -G1 and the residency
is essentially unchanged.

Metric Increase
    T9233
    T12227
    T9630

Metric Decrease
    T12425
    T13253

- - - - -
416bd50e by Simon Peyton Jones at 2020-09-22T05:37:59-04:00
Fix the occurrence analyser

Ticket #18603 demonstrated that the occurrence analyser's
handling of

  local RULES for imported Ids

(which I now call IMP-RULES) was inadequate.  It led the simplifier
into an infnite loop by failing to label a binder as a loop breaker.

The main change in this commit is to treat IMP-RULES in a simple and
uniform way: as extra rules for the local binder.  See
  Note [IMP-RULES: local rules for imported functions]

This led to quite a bit of refactoring.  The result is still tricky,
but it's much better than before, and better documented I think.

Oh, and it fixes the bug.

- - - - -
6fe8a0c7 by Sebastian Graf at 2020-09-22T05:38:35-04:00
PmCheck - Comments only: Replace /~ by ≁

- - - - -
e9501547 by Sebastian Graf at 2020-09-22T05:38:35-04:00
PmCheck: Rewrite inhabitation test

We used to produce inhabitants of a pattern-match refinement type Nabla
in the checker in at least two different and mostly redundant ways:

  1. There was `provideEvidence` (now called
     `generateInhabitingPatterns`) which is used by
     `GHC.HsToCore.PmCheck` to produce non-exhaustive patterns, which
     produces inhabitants of a Nabla as a sub-refinement type where all
     match variables are instantiated.
  2. There also was `ensure{,All}Inhabited` (now called
     `inhabitationTest`) which worked slightly different, but was
     whenever new type constraints or negative term constraints were
     added. See below why `provideEvidence` and `ensureAllInhabited`
     can't be the same function, the main reason being performance.
  3. And last but not least there was the `nonVoid` test, which tested
     that a given type was inhabited. We did use this for strict fields
     and -XEmptyCase in the past.

The overlap of (3) with (2) was always a major pet peeve of mine. The
latter was quite efficient and proven to work for recursive data types,
etc, but could not handle negative constraints well (e.g. we often want
to know if a *refined* type is empty, such as `{ x:[a] | x /= [] }`).

Lower Your Guards suggested that we could get by with just one, by
replacing both functions with `inhabitationTest` in this patch.
That was only possible by implementing the structure of φ constraints
as in the paper, namely the semantics of φ constructor constraints.

This has a number of benefits:

  a. Proper handling of unlifted types and strict fields, fixing #18249,
     without any code duplication between
     `GHC.HsToCore.PmCheck.Oracle.instCon` (was `mkOneConFull`) and
     `GHC.HsToCore.PmCheck.checkGrd`.
  b. `instCon` can perform the `nonVoid` test (3) simply by emitting
     unliftedness constraints for strict fields.
  c. `nonVoid` (3) is thus simply expressed by a call to
     `inhabitationTest`.
  d. Similarly, `ensureAllInhabited` (2), which we called after adding
     type info, now can similarly be expressed as the fuel-based
     `inhabitationTest`.

See the new `Note [Why inhabitationTest doesn't call generateInhabitingPatterns]`
why we still have tests (1) and (2).

Fixes #18249 and brings nice metric decreases for `T17836` (-76%) and
`T17836b` (-46%), as well as `T18478` (-8%) at the cost of a few very
minor regressions (< +2%), potentially due to the fact that
`generateInhabitingPatterns` does more work to suggest the minimal
COMPLETE set.

Metric Decrease:
    T17836
    T17836b

- - - - -
086ef018 by Hécate at 2020-09-23T06:52:08-04:00
Remove the list of loaded modules from the ghci prompt

- - - - -
d7385f70 by Ben Gamari at 2020-09-23T06:52:44-04:00
Bump submodules

* Bump bytestring to 0.10.12.0
* Bump Cabal to 3.4.0.0-rc3
* Bump Win32 to 2.10.0.0

- - - - -
667d6355 by Sylvain Henry at 2020-09-23T20:43:48-04:00
Refactor CLabel pretty-printing

* Don't depend on the selected backend to know if we print Asm or C
  labels: we already have PprStyle to determine this. Moreover even when
  a native backend is used (NCG, LLVM) we may want to C headers
  containing pretty-printed labels, so it wasn't a good predicate
  anyway.

* Make pretty-printing code clearer and avoid partiality

- - - - -
a584366b by Sylvain Henry at 2020-09-23T20:43:48-04:00
Remove sdocWithDynFlags (fix #10143)

- - - - -
a997fa01 by Sylvain Henry at 2020-09-23T20:43:48-04:00
Preliminary work towards removing DynFlags -> Driver.Ppr dependency

- - - - -
31fea307 by Hécate at 2020-09-23T20:44:24-04:00
Remove redundant "do", "return" and language extensions from base

- - - - -
04d64331 by syd at cs-syd.eu at 2020-09-24T13:15:54-04:00
Update Lock.hs with more documentation to make sure that the Boolean return value is clear.

[skip ci]

- - - - -
97cff919 by Simon Peyton Jones at 2020-09-24T13:16:32-04:00
Implement Quick Look impredicativity

This patch implements Quick Look impredicativity (#18126), sticking
very closely to the design in
    A quick look at impredicativity, Serrano et al, ICFP 2020

The main change is that a big chunk of GHC.Tc.Gen.Expr has been
extracted to two new modules
    GHC.Tc.Gen.App
    GHC.Tc.Gen.Head
which deal with typechecking n-ary applications, and the head of
such applications, respectively.  Both contain a good deal of
documentation.

Three other loosely-related changes are in this patch:

* I implemented (partly by accident) points (2,3)) of the accepted GHC
  proposal "Clean up printing of foralls", namely
  https://github.com/ghc-proposals/ghc-proposals/blob/
        master/proposals/0179-printing-foralls.rst
  (see #16320).

  In particular, see Note [TcRnExprMode] in GHC.Tc.Module
  - :type instantiates /inferred/, but not /specified/, quantifiers
  - :type +d instantiates /all/ quantifiers
  - :type +v is killed off

  That completes the implementation of the proposal,
  since point (1) was done in
    commit df08468113ab46832b7ac0a7311b608d1b418c4d
    Author: Krzysztof Gogolewski <krzysztof.gogolewski at tweag.io>
    Date:   Mon Feb 3 21:17:11 2020 +0100
    Always display inferred variables using braces

* HsRecFld (which the renamer introduces for record field selectors),
  is now preserved by the typechecker, rather than being rewritten
  back to HsVar.  This is more uniform, and turned out to be more
  convenient in the new scheme of things.

* The GHCi debugger uses a non-standard unification that allows the
  unification variables to unify with polytypes.  We used to hack
  this by using ImpredicativeTypes, but that doesn't work anymore
  so I introduces RuntimeUnkTv.  See Note [RuntimeUnkTv] in
  GHC.Runtime.Heap.Inspect

Updates haddock submodule.

WARNING: this patch won't validate on its own.  It was too
hard to fully disentangle it from the following patch, on
type errors and kind generalisation.

Changes to tests

* Fixes #9730 (test added)

* Fixes #7026 (test added)

* Fixes most of #8808, except function `g2'` which uses a
  section (which doesn't play with QL yet -- see #18126)
  Test added

* Fixes #1330. NB Church1.hs subsumes Church2.hs, which is now deleted

* Fixes #17332 (test added)

* Fixes #4295

* This patch makes typecheck/should_run/T7861 fail.
  But that turns out to be a pre-existing bug: #18467.
  So I have just made T7861 into expect_broken(18467)

- - - - -
9fa26aa1 by Simon Peyton Jones at 2020-09-24T13:16:32-04:00
Improve kind generalisation, error messages

This patch does two things:

* It refactors GHC.Tc.Errors a bit.  In debugging Quick Look I was
  forced to look in detail at error messages, and ended up doing a bit
  of refactoring, esp in mkTyVarEqErr'.  It's still quite a mess, but
  a bit better, I think.

* It makes a significant improvement to the kind checking of type and
  class declarations. Specifically, we now ensure that if kind
  checking fails with an unsolved constraint, all the skolems are in
  scope.  That wasn't the case before, which led to some obscure error
  messages; and occasional failures with "no skolem info" (eg #16245).

Both of these, and the main Quick Look patch itself, affect a /lot/ of
error messages, as you can see from the number of files changed.  I've
checked them all; I think they are as good or better than before.

Smaller things

* I documented the various instances of VarBndr better.
  See Note [The VarBndr tyep and its uses] in GHC.Types.Var

* Renamed GHC.Tc.Solver.simpl_top to simplifyTopWanteds

* A bit of refactoring in bindExplicitTKTele, to avoid the
  footwork with Either.  Simpler now.

* Move promoteTyVar from GHC.Tc.Solver to GHC.Tc.Utils.TcMType

Fixes #16245 (comment 211369), memorialised as
  typecheck/polykinds/T16245a
Also fixes the three bugs in #18640

- - - - -
6d0ce0eb by Sebastian Graf at 2020-09-24T13:17:07-04:00
PmCheck: Desugar string literal patterns with -XRebindableSyntax correctly (#18708)

Fixes #18708.

- - - - -
007940d2 by Hécate at 2020-09-24T13:17:44-04:00
Namespace the Hadrian linting rule for base

- - - - -
5b727189 by Andreas Klebinger at 2020-09-25T21:10:20-04:00
Make sizeExpr strict in the size threshold to facilitate WW.

- - - - -
dd664031 by Ben Gamari at 2020-09-25T21:10:56-04:00
ci.sh: Factor out common utilities

- - - - -
5b78e865 by Ben Gamari at 2020-09-25T21:10:56-04:00
ci: Add ad-hoc performance testing rule

- - - - -
29885f07 by Zubin Duggal at 2020-09-25T21:11:32-04:00
Stop removing definitions of record fields in GHC.Iface.Ext.Ast

- - - - -
0d6519d9 by Ben Gamari at 2020-09-25T21:12:08-04:00
gitlab-ci: Drop Darwin cleanup job

We now have a proper periodic clean-up script installed on the runners.

- - - - -
277d20af by Sebastian Graf at 2020-09-25T21:12:44-04:00
Add regression tests for #18371

They have been fixed by !3959, I believe.
Fixes #18371.

- - - - -
8edf6056 by Sebastian Graf at 2020-09-25T21:12:44-04:00
Add a regression test for #18609

The egregious performance hits are gone since !4050.
So we fix #18609.

- - - - -
4a1b89a4 by Sebastian Graf at 2020-09-25T21:12:44-04:00
Accept new test output for #17218

The expected test output was plain wrong.
It has been fixed for a long time.
Thus we can close #17218.

- - - - -
51606236 by Sven Tennie at 2020-09-25T21:13:19-04:00
Print RET_BIG stack closures

A RET_BIG closure has a large bitmap that describes it's payload and can
be printed with printLargeBitmap().

Additionally, the output for payload closures of small and big bitmaps is
changed: printObj() is used to print a bit more information about what's
on the stack.

- - - - -
2707c4ea by Arnaud Spiwack at 2020-09-25T21:13:58-04:00
Pattern guards BindStmt always use multiplicity Many

Fixes #18439 .

The rhs of the pattern guard was consumed with multiplicity one, while
the pattern assumed it was Many. We use Many everywhere instead.

This is behaviour consistent with that of `case` expression. See #18738.

- - - - -
92daad24 by Sylvain Henry at 2020-09-25T21:14:36-04:00
Bignum: refactor backend modules

* move backends into GHC.Num.Backend.*
* split backend selection into GHC.Num.Backend and
  GHC.Num.Backend.Selected to avoid duplication with the Check backend

- - - - -
04bc50b3 by Sylvain Henry at 2020-09-25T21:14:36-04:00
Bignum: implement extended GCD (#18427)

- - - - -
6a7dae4b by Krzysztof Gogolewski at 2020-09-25T21:15:14-04:00
Fix typed holes causing linearity errors (#18491)

- - - - -
83407ffc by Krzysztof Gogolewski at 2020-09-25T21:15:53-04:00
Various documentation fixes

* Remove UnliftedFFITypes from conf. Some time ago, this extension
  was undocumented and we had to silence a warning.
  This is no longer needed.
* Use r'' in conf.py. This fixes a Sphinx warning:
  WARNING: Support for evaluating Python 2 syntax is deprecated and will be removed in Sphinx 4.0. Convert docs/users_guide/conf.py to Python 3 syntax.
* Mark GHCForeignImportPrim as documented
* Fix formatting in template_haskell.rst
* Remove 'recursive do' from the list of unsupported items in TH

- - - - -
af1e84e7 by Sebastian Graf at 2020-09-26T05:36:46-04:00
PmCheck: Big refactor of module structure

  * Move everything from `GHC.HsToCore.PmCheck.*` to
    `GHC.HsToCore.Pmc.*` in analogy to `GHC.Tc`, rename exported
    `covCheck*` functions to `pmc*`
  * Rename `Pmc.Oracle` to `Pmc.Solver`
  * Split off the LYG desugaring and checking steps into their own
    modules (`Pmc.Desugar` and `Pmc.Check` respectively)
  * Split off a `Pmc.Utils` module with stuff shared by
    `Pmc.{,Desugar,Check,Solver}`
  * Move `Pmc.Types` to `Pmc.Solver.Types`, add a new `Pmc.Types` module
    with all the LYG types, which form the interfaces between
    `Pmc.{Desugar,Check,Solver,}`.

- - - - -
f08f98e8 by Sebastian Graf at 2020-09-26T05:36:46-04:00
Extract SharedIdEnv into its own module

It's now named `GHC.Types.Unique.SDFM.UniqSDFM`.
The implementation is more clear about its stated goals and supported
operations.

- - - - -
1cde295c by Sylvain Henry at 2020-09-26T05:37:23-04:00
Bignum: add bigNatFromWordArray

Reimplementation of integer-gmp's byteArrayToBigNat#

- - - - -
bda55fa0 by Krzysztof Gogolewski at 2020-09-26T13:18:22-04:00
Make 'undefined x' linear in 'x' (#18731)

- - - - -
160fba4a by Krzysztof Gogolewski at 2020-09-26T13:19:00-04:00
Disallow linear types in FFI (#18472)

- - - - -
e124f2a7 by Krzysztof Gogolewski at 2020-09-26T13:19:36-04:00
Fix handling of function coercions (#18747)

This was broken when we added multiplicity to the function type.

- - - - -
7ff43382 by Vladislav Zavialov at 2020-09-27T03:01:31+03:00
Comments: change outdated reference to mergeOps

As of 686e06c59c3aa6b66895e8a501c7afb019b09e36,
GHC.Parser.PostProcess.mergeOps no longer exists.

[ci skip]

- - - - -
4edf5527 by Vladislav Zavialov at 2020-09-27T10:04:12-04:00
Don't rearrange (->) in the renamer

The parser produces an AST where the (->)
is already associated correctly:

  1. (->) has the least possible precedence
  2. (->) is right-associative

Thus we don't need to handle it in mkHsOpTyRn.

- - - - -
a9ce159b by Vladislav Zavialov at 2020-09-27T10:04:12-04:00
Remove outdated comment in rnHsTyKi

This comment dates back to 3df40b7b78044206bbcffe3e2c0a57d901baf5e8
and does not seem relevant anymore.

- - - - -
583a2070 by Richard Eisenberg at 2020-09-29T00:31:27-04:00
Optimize NthCo (FunCo ...) in coercion opt

We were missing this case previously.

Close #18528.

Metric Decrease:
    T18223
    T5321Fun

- - - - -
b31a3360 by Krzysztof Gogolewski at 2020-09-29T00:32:05-04:00
Linear types: fix kind inference when checking datacons

- - - - -
5830a12c by Vladislav Zavialov at 2020-09-29T00:32:05-04:00
New linear types syntax: a %p -> b (#18459)

Implements GHC Proposal #356

Updates the haddock submodule.

- - - - -
bca4d36d by Vladislav Zavialov at 2020-09-29T00:32:05-04:00
Improve error messages for (a %m) without LinearTypes

Detect when the user forgets to enable the LinearTypes
extension and produce a better error message.

Steals the (a %m) syntax from TypeOperators, the workaround
is to write (a % m) instead.

- - - - -
b9635d0a by Benjamin Maurer at 2020-09-29T00:32:43-04:00
Description of flag `-H` was in 'verbosity options', moved to 'misc'.
Fixes #18699

- - - - -
74c797f6 by Benjamin Maurer at 2020-09-29T00:33:20-04:00
Workaround for #18623: GHC crashes bc. under rlimit for vmem it will reserve
_all_ of it, leaving nothing for, e.g., thread stacks.
Fix will only allocate 2/3rds and check whether remainder is at least large
enough for minimum amount of thread stacks.

- - - - -
4365d77a by Ryan Scott at 2020-09-29T00:33:57-04:00
Add regression test #18501

ghc/ghc!3220 ended up fixing #18501. This patch adds a regression
test for #18501 to ensure that it stays fixed.

- - - - -
8e3f00dd by Sylvain Henry at 2020-09-29T17:24:03+02:00
Make the parser module less dependent on DynFlags

Bump haddock submodule

- - - - -
3ab0d8f7 by Sebastian Graf at 2020-09-30T02:48:27-04:00
PmCheck: Long-distance information for LocalBinds (#18626)

Now `desugarLocalBind` (formerly `desugarLet`) reasons about

  * `FunBind`s that
    * Have no pattern matches (so which aren't functions)
    * Have a singleton match group with a single GRHS
    * (which may have guards)
  * and looks through trivial post-typechecking `AbsBinds` in doing so
    to pick up the introduced renamings.

And desugars to `PmLet` LYG-style guards. Since GRHSs are no longer
denoted simply by `NonEmpty PmGRHS`, but also need to carry a `[PmGrd]`
for the `PmLet`s from `LocalBind`s, I added `PmGRHSs` to capture that.

Since we call out to the desugarer more often, I found that there were
superfluous warnings emitted when desugaring e.g. case expressions.
Thus, I made sure that we deactivate any warnings in the LYG desugaring
steps by the new wrapper function `noCheckDs`.

There's a regression test in `T18626`. Fixes #18626.

- - - - -
f8f60efc by Ben Gamari at 2020-09-30T02:49:03-04:00
testsuite: Mark T12971 as broken on Windows

Due to #17945.

- - - - -
6527fc57 by Ben Gamari at 2020-09-30T02:49:03-04:00
Bump Cabal, hsc2hs, directory, process submodules

Necessary for recent Win32 bump.

- - - - -
df3f5880 by Sylvain Henry at 2020-09-30T02:49:41-04:00
Remove unsafeGlobalDynFlags (#17957, #14597)

There are still global variables but only 3 booleans instead of a single
DynFlags.

- - - - -
9befd94d by Sylvain Henry at 2020-09-30T02:49:41-04:00
Remove unused global variables

Some removed globals variables were still declared in the RTS.

They were removed in the following commits:

* 4fc6524a2a4a0003495a96c8b84783286f65c198
* 0dc7985663efa1739aafb480759e2e2e7fca2a36
* bbd3c399939311ec3e308721ab87ca6b9443f358

- - - - -
7c98699f by Richard Eisenberg at 2020-09-30T02:50:17-04:00
Omit redundant kind equality check in solver

See updated Note [Use loose types in inert set] in
GHC.Tc.Solver.Monad.

Close #18753.

- - - - -
39549826 by Sebastian Graf at 2020-09-30T02:50:54-04:00
Pmc: Don't call exprType on type arguments (#18767)

Fixes #18767.

- - - - -
235e410f by Richard Eisenberg at 2020-09-30T02:51:29-04:00
Regression test for #10709.

Close #10709

- - - - -
5c32655f by Ben Gamari at 2020-09-30T22:31:55-04:00
hadrian/doc: Clarify documentation of key-value configuration
- - - - -
0bb02873 by Sylvain Henry at 2020-10-01T18:34:53-04:00
Add test for T18574

- - - - -
e393f213 by Sylvain Henry at 2020-10-01T18:34:53-04:00
Allow fusion with catMaybes (#18574)

Metric Decrease:
   T18574

- - - - -
d2cfad96 by Fendor at 2020-10-01T18:35:33-04:00
Add mainModuleNameIs and demote mainModIs

Add `mainModuleNameIs` to DynFlags and demote
`mainModIs` to function which uses the homeUnit from DynFlags
it is created from.

- - - - -
fc351ab8 by Fendor at 2020-10-01T18:35:33-04:00
Use HomeUnit for main module without module declaration

- - - - -
dca1cb22 by Fendor at 2020-10-01T18:35:33-04:00
Remove mAIN completely

- - - - -
a5aaceec by Sylvain Henry at 2020-10-01T18:36:11-04:00
Use ADTs for parser errors/warnings

Haskell and Cmm parsers/lexers now report errors and warnings using ADTs
defined in GHC.Parser.Errors. They can be printed using functions in
GHC.Parser.Errors.Ppr.

Some of the errors provide hints with a separate ADT (e.g. to suggest to
turn on some extension). For now, however, hints are not consistent
across all messages. For example some errors contain the hints in the
main message. I didn't want to change any message with this patch. I
expect these changes to be discussed and implemented later.

Surprisingly, this patch enhances performance. On CI
(x86_64/deb9/hadrian, ghc/alloc):

   parsing001         -11.5%
   T13719             -2.7%
   MultiLayerModules  -3.5%
   Naperian           -3.1%

Bump haddock submodule

Metric Decrease:
    MultiLayerModules
    Naperian
    T13719
    parsing001

- - - - -
a946c7ef by Sylvain Henry at 2020-10-01T18:36:11-04:00
Less DynFlags in Header parsing

- - - - -
dafe7943 by Sylvain Henry at 2020-10-01T18:36:11-04:00
Parser: remove some unused imports

These are not reported by GHC because Happy adds {-# OPTIONS_GHC -w #-}

- - - - -
93d5de16 by Sylvain Henry at 2020-10-01T18:36:11-04:00
Don't import GHC.Unit to reduce the number of dependencies

- - - - -
e3655f81 by Sebastian Graf at 2020-10-01T18:36:47-04:00
Don't attach CPR signatures to NOINLINE data structures (#18154)

Because the generated `KindRep`s don't have an unfolding, !3230 did not
actually stop to compute, attach and serialise unnecessary CPR
signatures for them. As already said in
`Note [CPR for data structures]`, that leads to bloated interface
files which is ultimately quadratic for Nested CPR.

So we don't attach any CPR signature to bindings that

  * Are not thunks (because thunks are not in WHNF)
  * Have arity 0 (which means the top-level constructor is not a lambda)

If the data structure has an unfolding, we continue to look through it.
If not (as is the case for `KindRep`s), we look at the unchanged CPR
signature and see `topCprType`, as expected.

- - - - -
ba5965eb by Richard Eisenberg at 2020-10-01T18:37:23-04:00
Add regression test for #18755.

Close #18755

- - - - -
a8018c17 by Vladislav Zavialov at 2020-10-01T18:37:58-04:00
Fix pretty-printing of the mult-polymorphic arrow

A follow-up to !4020 (5830a12c46e7227c276a8a71213057595ee4fc04)

- - - - -
e5523324 by Sylvain Henry at 2020-10-01T18:38:35-04:00
Bignum: add integerNegate RULE

- - - - -
1edd6d21 by Vladislav Zavialov at 2020-10-01T18:39:10-04:00
Refactor: remove rnHsDoc

It did not do any useful work.

- - - - -
a9ae83af by Krzysztof Gogolewski at 2020-10-02T08:00:25-04:00
Fix typos in comments

[skip ci]

- - - - -
b81350bb by Icelandjack at 2020-10-02T08:01:01-04:00
Replaced MkT1 with T1 in type signatures.
- - - - -
3c9beab7 by Vladislav Zavialov at 2020-10-02T13:51:58-04:00
Minor TTG clean-up: comments, unused families, bottom

1. Fix and update section headers in GHC/Hs/Extension.hs
2. Delete the unused 'XCoreAnn' and 'XTickPragma' families
3. Avoid calls to 'panic' in 'pprStmt'

- - - - -
12c06927 by Sylvain Henry at 2020-10-02T13:52:38-04:00
Bignum: implement integerRecipMod (#18427)

- - - - -
8dd4f405 by Sylvain Henry at 2020-10-02T13:52:38-04:00
Bignum: implement integerPowMod (#18427)

Incidentally fix powModInteger which was crashing in integer-gmp for
negative exponents when the modular multiplicative inverse for the base
didn't exist. Now we compute it explicitly with integerRecipMod so that
every backend returns the same result without crashing.

- - - - -
1033a720 by Krzysztof Gogolewski at 2020-10-02T13:53:23-04:00
Reject linearity in kinds in checkValidType (#18780)

Patch taken from https://gitlab.haskell.org/ghc/ghc/-/issues/18624#note_300673

- - - - -
b0ccba66 by Krzysztof Gogolewski at 2020-10-03T19:33:02-04:00
Small documentation fixes

- Fix formatting of code blocks and a few sphinx warnings
- Move the Void# change to 9.2, it was done right after the branch was cut
- Fix typo in linear types documentation
- Note that -Wincomplete-uni-patterns affects lazy patterns

[skip ci]

- - - - -
70dc2f09 by Karel Gardas at 2020-10-03T19:33:06-04:00
fix rts.cabal to use real arch names and not aliasses (fixes #18654)

- - - - -
bc5de347 by Sebastian Graf at 2020-10-05T13:59:24-04:00
Inline `integerDecodeDouble#` and constant-fold `decodeDouble_Int64#` instead

Currently, `integerDecodeDouble#` is known-key so that it can be
recognised in constant folding. But that is very brittle and doesn't
survive worker/wrapper, which we even do for
`NOINLINE` things since #13143.
Also it is a trade-off: The implementation of `integerDecodeDouble#`
allocates an `Integer` box that never cancels aways if we don't inline
it.

Hence we recognise the `decodeDouble_Int64#` primop instead in constant
folding, so that we can inline `integerDecodeDouble#`. As a result,
`integerDecodeDouble#` no longer needs to be known-key.

While doing so, I realised that we don't constant-fold
`decodeFloat_Int#` either, so I also added a RULE for it.

`integerDecodeDouble` is dead, so I deleted it.

Part of #18092. This improves the 32-bit `realToFrac`/`toRational`:

Metric Decrease:
    T10359

- - - - -
802b5e6f by Krzysztof Gogolewski at 2020-10-05T13:59:33-04:00
Fix linear types in TH splices (#18465)

- - - - -
18a3ddf7 by Ben Gamari at 2020-10-05T13:59:33-04:00
rts: Fix integer width in TICK_BUMP_BY

Previously `TICK_BUMP_BY` was defined as

```c
 #define TICK_BUMP_BY(ctr,n) CLong[ctr] = CLong[ctr] + n
```

Yet the tickers themselves were defined as `StgInt`s. This happened to
work out correctly on Linux, where `CLong` is 64-bits. However, it
failed on Windows, where `CLong` is 32-bits, resulting in #18782.

Fixes #18783.

- - - - -
5fc4243b by Rachel at 2020-10-07T14:59:45-04:00
Document profiling flags, warning flags, and no-pie

- - - - -
b41f7c38 by Andreas Klebinger at 2020-10-07T15:00:20-04:00
WinIO: Small changes related to atomic request swaps.

Move the atomix exchange over the Ptr type to an internal module.

Fix a bug caused by us passing ptr-to-ptr instead of ptr to
atomic exchange.

Renamed interlockedExchange to exchangePtr.

I've also added an cas primitive. It turned out we don't need it
for WinIO but I'm leaving it in as it's useful for other things.

- - - - -
948a14e1 by Ben Gamari at 2020-10-07T15:00:55-04:00
gitlab-ci: Fix name of Ubuntu 20.04 image
- - - - -
74d4017b by Sylvain Henry at 2020-10-07T15:01:35-04:00
Fix -flink-rts (#18651)

Before this patch -flink-rts could link with GHC's rts instead of the
selected one.

- - - - -
0e8b923d by Sylvain Henry at 2020-10-07T15:01:35-04:00
Apply suggestion to compiler/GHC/SysTools.hs
- - - - -
d6dff830 by Alan Zimmerman at 2020-10-07T15:02:10-04:00
Preserve as-parsed arrow type for HsUnrestrictedArrow

When linear types are disabled, HsUnrestrictedArrow is treated as
HslinearArrow.

Move this adjustment into the type checking phase, so that the parsed
source accurately represents the source as parsed.

Closes #18791

- - - - -
030c5ce0 by Karel Gardas at 2020-10-07T15:02:48-04:00
hadrian: use stage0 linker to merge objects when done during the stage0

Fixes #18800.

- - - - -
a94db588 by Ben Gamari at 2020-10-07T15:03:23-04:00
testsuite: Allow whitespace before "Metric (in|de)crease"

Several people have struggled with metric change annotations
in their commit messages not being recognized due to the fact that
GitLab's job log inserts a space at the beginning of each line. Teach
the regular expression to accept this whitespace.

- - - - -
e91ddddd by Krzysztof Gogolewski at 2020-10-07T15:04:07-04:00
Misc cleanup

* Include funTyCon in exposedPrimTyCons.
  Every single place using exposedPrimTyCons was adding funTyCon
  manually.
* Remove unused synTyConResKind and ieLWrappedName
* Add recordSelectorTyCon_maybe
* In exprType, panic instead of giving a trace message and dummy output.
  This prevents #18767 reoccurring.
* Fix compilation error in fragile concprog001 test (part of #18732)

- - - - -
f52abbd7 by John Ericson at 2020-10-09T09:04:11+02:00
Make fixed-size `Int32#` and `Int64#`

The boxed Int64 uses Int64#, but Int32# still uses Int#. The 32-bit case
is less pressing to change because it is not a source of brittle
CPP---it is the same thing on all platforms.

We need Int64/Word64 constant folding to avoid the let/app restriction on Core, so
that is implemented now. 32-bit constant unfolding and 32-bit literals
are left as follow-up.

This is the bulk of #11953

ghc-bignum: add support for Word64#/Int64# on 64-bit arch

Fix fingerprint Core generation

Fix some tests

Co-authored-by: Sylvain Henry <hsyl20 at gmail.com>

- - - - -
af35c212 by John Ericson at 2020-10-09T09:04:11+02:00
Inline INT64 and WORD64 macros in primops.txt.pp

The definition is now unconditional so there is no reason for that CPP.

- - - - -
9c49c0de by Sylvain Henry at 2020-10-09T09:04:11+02:00
Fix toArgRep

- - - - -
1803690b by Sylvain Henry at 2020-10-09T09:04:11+02:00
Adapt rules from #16402 to Word64#/Int64#

- - - - -
8a80a59a by John Ericson at 2020-10-09T09:04:11+02:00
Copy enumFrom* implementations from Int/Word for Int64/Word64

Without this, we don't get proper list fusion.

I think this sort of copying is OK for now, but we absolutely need
something better if we are going to make `IntN` use `IntN#` for all `N`.
The degree to which proper metaprogramming has been punted upon by
factoring everything through the native-sized types is disconcerting.

- - - - -
1d0be873 by John Ericson at 2020-10-09T09:04:11+02:00
`integerFromInt64#` can be inlined when the word size is >= 64 bits

Maybe this will help with the renaming test failure?

- - - - -
f3421863 by John Ericson at 2020-10-09T09:04:11+02:00
Add builtin rule for `divInt64#` and `modInt64#`

- - - - -
3e2ba78a by John Ericson at 2020-10-09T09:04:11+02:00
WIP: Add missing floats <-> int/word 64 rule and primops

- - - - -


30 changed files:

- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- + .gitlab/common.sh
- README.md
- aclocal.m4
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types.hs-boot
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Builtin/Uniques.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Dataflow/Label.hs
- compiler/GHC/Cmm/DebugBlock.hs
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/LayoutStack.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Lint.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Monad.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Pipeline.hs
- compiler/GHC/Cmm/Ppr.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d8e97fddf37c900dce00bc6fe83fd588372d33c9...3e2ba78a1198e693eef8148e339dea5acc9c5e8e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d8e97fddf37c900dce00bc6fe83fd588372d33c9...3e2ba78a1198e693eef8148e339dea5acc9c5e8e
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/20201009/c12b71f1/attachment-0001.html>


More information about the ghc-commits mailing list