[Git][ghc/ghc][wip/tuple-width] 82 commits: Make 'undefined x' linear in 'x' (#18731)

Ben Gamari gitlab at gitlab.haskell.org
Tue Oct 13 14:27:15 UTC 2020



Ben Gamari pushed to branch wip/tuple-width at Glasgow Haskell Compiler / GHC


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

- - - - -
386c2d7f by Sylvain Henry at 2020-10-09T08:40:33-04:00
Use UnitId in the backend instead of Unit

In Cmm we can only have real units identified with an UnitId.  Other
units (on-the-fly instantiated units and holes) are only used in
type-checking backpack sessions that don't produce Cmm.

- - - - -
a566c83d by Simon Jakobi at 2020-10-09T08:41:09-04:00
Update containers to v0.6.4.1

Updates containers submodule.

- - - - -
fd984d68 by Tamar Christina at 2020-10-09T08:41:50-04:00
rts: fix race condition in StgCRun

On windows the stack has to be allocated 4k at a time, otherwise we get
a segfault. This is done by using a helper ___chkstk_ms that is provided
by libgcc. The Haskell side already knows how to handle this but we need
to do the same from STG. Previously we would drop the stack in StgRun
but would only make it valid whenever the scheduler loop ran.

This approach was fundamentally broken in that it falls apart when you
take a signal from the OS. We see it less often because you initially
get allocated a 1MB stack block which you have to blow past first.

Concretely this means we must always keep the stack valid.

Fixes #18601.

- - - - -
accdb24a by Sylvain Henry at 2020-10-09T08:42:31-04:00
Expose RTS-only ways (#18651)

Some RTS ways are exposed via settings (ghcThreaded, ghcDebugged) but
not all. It's simpler if the RTS exposes them all itself.

- - - - -
d360f343 by MaxGabriel at 2020-10-09T08:43:11-04:00
Document -Wderiving-typeable

Tracking: #18641

- - - - -
e48cab2a by Krzysztof Gogolewski at 2020-10-09T08:43:49-04:00
Add a flag to indicate that gcc supports -no-pie

Fixes #17919.

- - - - -
f7e2fff9 by Hécate at 2020-10-09T08:44:26-04:00
Add linting of `base` to the CI

- - - - -
45a1d493 by Andreas Klebinger at 2020-10-09T08:45:05-04:00
Use proper RTS flags when collecting residency in perf tests.

Replace options like collect_stats(['peak_megabytes_allocated'],4) with
collect_runtime_residency(4) and so forth. Reason being that the later
also supplies some default RTS arguments which make sure residency does
not fluctuate too much.

The new flags mean we get new (hopefully more accurate) baselines so
accept the stat changes.

-------------------------
Metric Decrease:
     T4029
     T4334
     T7850
Metric Increase:
     T13218
     T7436
-------------------------

- - - - -
ef65b154 by Andreas Klebinger at 2020-10-09T08:45:42-04:00
testsuite/timeout: Fix windows specific errors.

We now seem to use -Werror there. Which caused some long standing
warnings to become errors.

I applied changes to remove the warnings allowing the testsuite to
run on windows as well.

- - - - -
e691a5a0 by Sylvain Henry at 2020-10-09T08:46:22-04:00
Hadrian: add quick-debug flavour

- - - - -
12191a99 by Sylvain Henry at 2020-10-09T08:47:00-04:00
Bignum: match on small Integer/Natural

Previously we only matched on *variables* whose unfoldings were a ConApp
of the form `IS lit#` or `NS lit##`. But we forgot to match on the
ConApp directly... As a consequence, constant folding only worked after
the FloatOut pass which creates bindings for most sub-expressions. With
this patch, matching on bignums works even with -O0 (see bignumMatch
test).

- - - - -
36787bba by Alan Zimmerman at 2020-10-09T08:47:36-04:00
ApiAnnotations : preserve parens in GADTs

A cleanup in 7f418acf61e accidentally discarded some parens in
ConDeclGADT.

Make sure these stay in the AST in a usable format.

Also ensure the AnnLolly does not get lost in a GADT.

- - - - -
32dc7698 by Krzysztof Gogolewski at 2020-10-09T08:48:15-04:00
Linear types: fix roles in GADTs (#18799)

- - - - -
9657f6f3 by Ben Gamari at 2020-10-09T08:48:52-04:00
sdist: Include hadrian sources in source distribution

Previously the make build system's source distribution rules neglected
to include Hadrian's sources.

Fixes #18794.

- - - - -
c832f7e2 by Tamar Christina at 2020-10-09T08:49:33-04:00
winio: fixed timeouts non-threaded.

- - - - -
6f0243ae by Tamar Christina at 2020-10-09T08:50:13-04:00
winio: fix array splat

- - - - -
0fd3d360 by Tamar Christina at 2020-10-09T08:50:51-04:00
winio: fixed bytestring reading interface.

- - - - -
dfaef1ca by Tamar Christina at 2020-10-09T08:51:30-04:00
winio: fixed more data error.

- - - - -
bfdccac6 by Simon Peyton Jones at 2020-10-09T08:52:07-04:00
Fix desugaring of record updates on data families

This fixes a long-standing bug in the desugaring of record
updates for data families, when the latter involves a GADT. It's
all explained in Note [Update for GADTs] in GHC.HsToCore.Expr.

Building the correct cast is surprisingly tricky, as that Note
explains.

Fixes #18809.  The test case (in indexed-types/should_compile/T18809)
contains several examples that exercise the dark corners.

- - - - -
e5c7c9c8 by Ben Gamari at 2020-10-09T08:52:43-04:00
Bump win32-tarballs version to 0.3

This should fix #18774.

- - - - -
ef950b19 by Andreas Klebinger at 2020-10-09T08:53:21-04:00
Add TyCon Set/Env and use them in a few places.

Firstly this improves code clarity.

But it also has performance benefits as we no longer
go through the name of the TyCon to get at it's unique.

In order to make this work the recursion check for TyCon
has been moved into it's own module in order to avoid import
cycles.

- - - - -
fd302e93 by Krzysztof Gogolewski at 2020-10-09T08:54:02-04:00
Add -pgmlm and -optlm flags

!3798 added documentation and semantics for the flags,
but not parsing.

- - - - -
db236ffc by Sylvain Henry at 2020-10-09T08:54:41-04:00
Testsuite: increase timeout for T18223 (#18795)

- - - - -
6a243e9d by Sylvain Henry at 2020-10-09T08:55:21-04:00
Cache HomeUnit in HscEnv (#17957)

Instead of recreating the HomeUnit from the DynFlags every time we need
it, we store it in the HscEnv.

- - - - -
6e5a83bb by GHC GitLab CI at 2020-10-13T10:27:04-04:00
Extend mAX_TUPLE_SIZE to 64

As well a ctuples and sums.

- - - - -


30 changed files:

- .gitlab-ci.yml
- 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/Prim.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Monad.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Multiplicity.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/67539b61bc002386ec314fd313d75c3a71864799...6e5a83bb6052f9e251a54026294c87a5bd650c93

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/67539b61bc002386ec314fd313d75c3a71864799...6e5a83bb6052f9e251a54026294c87a5bd650c93
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/20201013/f80f6f55/attachment-0001.html>


More information about the ghc-commits mailing list