ghc.git
8 weeks agoconfigure.ac: fix '--disable-dwarf-debug'
Sergei Trofimovich [Sat, 17 Aug 2019 23:50:35 +0000 (00:50 +0100)] 
configure.ac: fix '--disable-dwarf-debug'

Before the change
    ./configure --disable-dwarf-debug
enabled DWARF debugging unconditionally.

This happened due to use of 5-argument form of `AC_ARG_ENABLE`
without actually checking the passed  `$enableval` parameter:

```
AC_ARG_ENABLE(dwarf-unwind,
    [AC_HELP_STRING([--enable-dwarf-unwind],
        [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])],
    [AC_CHECK_LIB(dw, dwfl_attach_state,
      [UseLibdw=YES],
      [AC_MSG_ERROR([Cannot find system libdw (required by --enable-dwarf-unwind)])])]
    [UseLibdw=NO]
)
```

Note:

- `[UseLibdw=NO]` is called when `--{enable,disable}-dwarf-unwind`
  is not passed at all as a parameter (ok).
- `[AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES],` is called
  for both:

  * `--enable-dwarf-unwind` being passed: `$enableval = "yes"` (ok).
  *  --disable-dwarf-unwind` being passed: `$enableval = "no"` (bad).

The change is to use 3-argument `AC_ARG_ENABLE` and check for passed
value as `"$enable_dwarf_unwind" = "yes"`.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
8 weeks agoUse variable length encoding for Binary instances.
Andreas Klebinger [Thu, 15 Aug 2019 15:23:48 +0000 (17:23 +0200)] 
Use variable length encoding for Binary instances.

Use LEB128 encoding for Int/Word variants. This reduces
the size of interface files significantly. (~19%).

Also includes a few small optimizations to make unboxing
work better that I have noticed while looking at the core.

8 weeks agoMake non-streaming LLVM and C backends streaming
Ömer Sinan Ağacan [Thu, 22 Aug 2019 09:09:24 +0000 (12:09 +0300)] 
Make non-streaming LLVM and C backends streaming

This adds a Stream.consume function, uses it in LLVM and C code
generators, and removes the use of Stream.collect function which was
used to collect streaming Cmm generation results into a list.

LLVM and C backends now properly use streamed Cmm generation, instead of
collecting Cmm groups into a list before generating LLVM/C code.

8 weeks agoRemove special case in SRT generation with -split-sections
Ömer Sinan Ağacan [Mon, 19 Aug 2019 13:33:31 +0000 (16:33 +0300)] 
Remove special case in SRT generation with -split-sections

Previously we were using an empty ModuleSRTInfo for each Cmm group with
-split-section. As far as I can see this has no benefits, and
simplifying this makes another patch simpler (!1304).

We also remove some outdated comments: we no longer generate one
module-level SRT.

8 weeks agobase: Reintroduce fusion for scanr
TDecki [Sat, 10 Aug 2019 13:12:05 +0000 (09:12 -0400)] 
base: Reintroduce fusion for scanr

While avoiding #16943.

8 weeks agoAdd documentation for Hadrian expressions
James Foster [Sun, 18 Aug 2019 00:24:15 +0000 (20:24 -0400)] 
Add documentation for Hadrian expressions

This commit adds documentation on Hadrian's 'Expr' type and
references the documentation in hadrian/README.md

8 weeks agoDoc: add Haddocks for quotRemWord2 primop
Sylvain Henry [Wed, 21 Aug 2019 13:59:53 +0000 (15:59 +0200)] 
Doc: add Haddocks for quotRemWord2 primop

8 weeks agogitlab-ci: Add Windows full build during the nightly pipeline
Ben Gamari [Sun, 18 Aug 2019 20:39:30 +0000 (16:39 -0400)] 
gitlab-ci: Add Windows full build during the nightly pipeline

2 months agogitlab-ci: Update bootstrap compiled used for Darwin builds
Ben Gamari [Sun, 18 Aug 2019 07:18:16 +0000 (03:18 -0400)] 
gitlab-ci: Update bootstrap compiled used for Darwin builds

2 months agoRemove Bag fold specialisations (#16969)
Richard Lupton [Sat, 17 Aug 2019 12:34:51 +0000 (13:34 +0100)] 
Remove Bag fold specialisations (#16969)

2 months agoUse Foldable instance of Bag for specialised Bag folds (#16969)
Richard Lupton [Sun, 11 Aug 2019 19:08:53 +0000 (20:08 +0100)] 
Use Foldable instance of Bag for specialised Bag folds (#16969)

2 months agoRe-export foldlM and foldrM from Data.Foldable in MonadUtils (#16969)
Richard Lupton [Sun, 11 Aug 2019 19:05:58 +0000 (20:05 +0100)] 
Re-export foldlM and foldrM from Data.Foldable in MonadUtils (#16969)

2 months agoGeneralized MonadUtils folds to Foldable (#16969)
Richard Lupton [Sun, 11 Aug 2019 11:06:00 +0000 (12:06 +0100)] 
Generalized MonadUtils folds to Foldable (#16969)

2 months agoFix COMPACT_NFDATA closure size, more CNF sanity checking
Ömer Sinan Ağacan [Wed, 14 Aug 2019 09:12:36 +0000 (12:12 +0300)] 
Fix COMPACT_NFDATA closure size, more CNF sanity checking

We now do a shallow closure check on objects in compact regions.

See the new comment on why we can't do a "normal" closure check.

2 months agoexpose ModuleInfo.minf_rdr_env for tooling authors
Sam Halliday [Tue, 6 Aug 2019 21:02:53 +0000 (22:02 +0100)] 
expose ModuleInfo.minf_rdr_env for tooling authors

2 months agoFix #17067 by making data family type constructors actually injective
Ryan Scott [Sat, 17 Aug 2019 12:27:35 +0000 (08:27 -0400)] 
Fix #17067 by making data family type constructors actually injective

`TcTyClsDecls.tcFamDecl1` was using `NotInjective` when creating data
family type constructors, which is just plain wrong. This tweaks it
to use `Injective` instead.

Fixes #17067.

2 months agoTypo fix in CoreToStg
Ömer Sinan Ağacan [Fri, 16 Aug 2019 07:23:59 +0000 (10:23 +0300)] 
Typo fix in CoreToStg

2 months agoFaster exactLog2
Sylvain Henry [Tue, 6 Aug 2019 17:35:16 +0000 (19:35 +0200)] 
Faster exactLog2

Make `exactLog2` faster (use `countLeadingZeros` and Int32 bit-ops).

On my Core i7-9700k Criterion reports ~50% speedup (from 16 to 8ns).

2 months agoDocument types of LitNumbers, minor refactoring in Literal.hs
Ömer Sinan Ağacan [Wed, 7 Aug 2019 12:07:07 +0000 (15:07 +0300)] 
Document types of LitNumbers, minor refactoring in Literal.hs

2 months agoCmm: constant folding `quotRem x 2^N`
Sylvain Henry [Tue, 6 Aug 2019 23:57:21 +0000 (01:57 +0200)] 
Cmm: constant folding `quotRem x 2^N`

`quot` and `rem` are implemented efficiently when the second argument
is a constant power of 2. This patch uses the same implementations for
`quotRem` primop.

2 months agoMake add_info attach unfoldings (#16615)
Tobias Dammers [Wed, 12 Jun 2019 08:14:59 +0000 (10:14 +0200)] 
Make add_info attach unfoldings (#16615)

2 months agoAdd test cases for #16615
Tobias Dammers [Wed, 10 Jul 2019 08:34:40 +0000 (10:34 +0200)] 
Add test cases for #16615

2 months agoRemove unused imports of the form 'import foo ()' (Fixes #17065)
James Foster [Thu, 15 Aug 2019 01:00:17 +0000 (01:00 +0000)] 
Remove unused imports of the form 'import foo ()' (Fixes #17065)

These kinds of imports are necessary in some cases such as
importing instances of typeclasses or intentionally creating
dependencies in the build system, but '-Wunused-imports' can't
detect when they are no longer needed. This commit removes the
unused ones currently in the code base (not including test files
or submodules), with the hope that doing so may increase
parallelism in the build system by removing unnecessary
dependencies.

2 months agoGHCi supports not-necessarily-lifted join points
Richard Eisenberg [Tue, 4 Jun 2019 18:31:08 +0000 (14:31 -0400)] 
GHCi supports not-necessarily-lifted join points

Fixes #16509.

See Note [Not-necessarily-lifted join points] in ByteCodeGen,
which tells the full story.

This commit also adds some comments and cleans some code
in the byte-code generator, as I was exploring around trying
to understand it.

(This commit removes an old test -- this is really a GHCi problem,
not a pattern-synonym problem.)

test case: ghci/scripts/T16509

2 months agoUse os.devnull instead of '/dev/null' in the testsuite driver.
Andreas Klebinger [Fri, 9 Aug 2019 10:38:40 +0000 (12:38 +0200)] 
Use os.devnull instead of '/dev/null' in the testsuite driver.

The later caused issues on windows by being translated into
"\\dev\\null" and python then trying to open this non-existant file.

So we now use os.devnull inside python and convert it to "/dev/null"
when calling out to the shell, which is bound to run in a unix like
environment.

This fixes an issue a test producing unexpected stderr output failed
with a framework failure instead of showing a diff of the output.

2 months agoRework the Binary Integer instance.
Andreas Klebinger [Mon, 5 Aug 2019 16:42:10 +0000 (18:42 +0200)] 
Rework the Binary Integer instance.

We used to serialise large integers as strings. Now they are serialized
as a list of Bytes.

This changes the size for a Integer in the higher 64bit range from 77 to
9 bytes when written to disk.

The impact on the general case is small (<1% for interface files) as we
don't use many Integers. But for code that uses many this should be a
nice benefit.

2 months agoFix binary distribution
Tamar Christina [Sat, 10 Aug 2019 19:17:09 +0000 (15:17 -0400)] 
Fix binary distribution

2 months agoAdd Foldable, Traversable instances for Uniq(D)FM
Sebastian Graf [Tue, 30 Jul 2019 17:55:31 +0000 (17:55 +0000)] 
Add Foldable, Traversable instances for Uniq(D)FM

The `UniqDFM` is deterministic, of course, while we provide an unsafe
`NonDetUniqFM` wrapper for `UniqFM` to opt into nondeterministic instances.

2 months agoReformat comments in StgSyn
Ömer Sinan Ağacan [Fri, 9 Aug 2019 09:15:49 +0000 (12:15 +0300)] 
Reformat comments in StgSyn

This does not make any changes in the contents -- formatting only.

Previously the comments were too noisy and I've always found it very
hard to read. Hopefully it's easier to read now.

2 months agoAdd test for #16893
Ömer Sinan Ağacan [Thu, 8 Aug 2019 06:13:02 +0000 (09:13 +0300)] 
Add test for #16893

2 months agoAdd timing on loadInterface
Ben Gamari [Sun, 4 Aug 2019 22:44:59 +0000 (18:44 -0400)] 
Add timing on loadInterface

AndreasK recently mentioned that he thought that interface file loading
may be a non-trivial cost. Let's measure.

2 months agoConsolidate `TablesNextToCode` and `GhcUnreigsterised` in configure (#15548)
Joachim Breitner [Mon, 21 Jan 2019 00:25:26 +0000 (19:25 -0500)] 
Consolidate `TablesNextToCode` and `GhcUnreigsterised` in configure (#15548)

`TablesNextToCode` is now a substituted by configure, where it has the
correct defaults and error handling. Nowhere else needs to duplicate
that, though we may want the compiler to to guard against bogus settings
files.

I renamed it from `GhcEnableTablesNextToCode` to `TablesNextToCode` to:

 - Help me guard against any unfixed usages

 - Remove any lingering connotation that this flag needs to be combined
   with `GhcUnreigsterised`.

Original reviewers:

Original subscribers: TerrorJack, rwbarton, carter

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

2 months agoRevert "Make scanr a good producer and consumer"
Ben Gamari [Tue, 16 Jul 2019 01:02:48 +0000 (21:02 -0400)] 
Revert "Make scanr a good producer and consumer"

This reverts commit 4e1dfc3767167dddd0e151a2df8305b12aa0f49c.

Due to #16943.

2 months agotestsuite: Add tests for #16943
Ben Gamari [Tue, 16 Jul 2019 00:58:01 +0000 (20:58 -0400)] 
testsuite: Add tests for #16943

2 months agoFix bug preventing information about patterns from being serialized in .hie files
Zubin Duggal [Sat, 29 Jun 2019 13:50:54 +0000 (19:20 +0530)] 
Fix bug preventing information about patterns from being serialized in .hie files

2 months agoFix test
mniip [Mon, 29 Jul 2019 15:59:40 +0000 (18:59 +0300)] 
Fix test

2 months agoFix documentation
mniip [Fri, 28 Jun 2019 10:50:03 +0000 (13:50 +0300)] 
Fix documentation

2 months agoExplicitly number equations when printing axiom incompatibilities
mniip [Fri, 28 Jun 2019 10:19:45 +0000 (13:19 +0300)] 
Explicitly number equations when printing axiom incompatibilities

2 months agoFix test
mniip [Mon, 17 Jun 2019 10:13:30 +0000 (13:13 +0300)] 
Fix test

2 months agoAdd a -fprint-axiom-incomps option (#15546)
mniip [Mon, 21 Jan 2019 01:48:13 +0000 (20:48 -0500)] 
Add a -fprint-axiom-incomps option (#15546)

Supply branch incomps when building an IfaceClosedSynFamilyTyCon

`pprTyThing` now has access to incomps. This also causes them to be
written out to .hi files, but that doesn't pose an issue other than a
more faithful bijection between `tyThingToIfaceDecl` and `tcIfaceDecl`.

The machinery for displaying axiom incomps was already present but not
in use. Since this is now a thing that pops up in ghci's :info the
format was modified to look like a haskell comment.

Documentation and a test for the new feature included.

Test Plan: T15546

Reviewers: simonpj, bgamari, goldfire

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15546

Differential Revision: https://phabricator.haskell.org/D5097

2 months agoIntroduce a type for "platform word size", use it instead of Int
Ömer Sinan Ağacan [Mon, 5 Aug 2019 17:44:33 +0000 (20:44 +0300)] 
Introduce a type for "platform word size", use it instead of Int

We introduce a PlatformWordSize type and use it in platformWordSize
field.

This removes to panic/error calls called when platform word size is not
32 or 64. We now check for this when reading the platform config.

2 months agoRemove old/broken(?) .ghci script
Matthew Pickering [Mon, 5 Aug 2019 09:58:34 +0000 (10:58 +0100)] 
Remove old/broken(?) .ghci script

I was attempting to load hadrian into ghci by using
`cabal new-repl exe:hadrian` but it failed because it tried
to use this `.ghci` configuration.

I'm not sure who used this script but you should really use the new-repl
method.

2 months agohadrian: Refactor file patterns for future Shake changes (fixes #17005)
James Foster [Tue, 30 Jul 2019 17:01:29 +0000 (18:01 +0100)] 
hadrian: Refactor file patterns for future Shake changes (fixes #17005)

Shake will be moving from its current implementation of ?== to one from
System.FilePattern. Support for `//` is being dropped, leaving only `*`
and `**` as special forms. This commit converts the existing file
patterns in Hadrian to the new format. It also removes all occurances
of <//> and changes the user-settings docs to remove references to //
and add **.

The conversion is as follows:

- //a ==> **/a

- a// ==> a/**

- a//b ==> a/**/b

2 months agoRemove dead parameter from coreToStgApp
Simon Peyton Jones [Fri, 26 Jul 2019 16:08:37 +0000 (16:08 +0000)] 
Remove dead parameter from coreToStgApp

2 months agotestsuite: Rework tracking of fragile tests
Ben Gamari [Fri, 2 Aug 2019 19:36:06 +0000 (15:36 -0400)] 
testsuite: Rework tracking of fragile tests

Breaks fragile tests into two groups, allowing us to easily preserve
stdout/stderr of failing fragile tests.

2 months agoconfigure: Search for LLVM executables with two-number versions
Ben Gamari [Thu, 1 Aug 2019 13:23:24 +0000 (09:23 -0400)] 
configure: Search for LLVM executables with two-number versions

Fedora uses the naming llc-7.0 while Debian uses llc-7. Ensure that both
are found.

Fixes #16990.

2 months agotestsuite: Add testsuite for #16978
Ben Gamari [Wed, 31 Jul 2019 18:07:43 +0000 (14:07 -0400)] 
testsuite: Add testsuite for #16978

2 months agoDon't float unlifted join points to top level
Simon Peyton Jones [Tue, 30 Jul 2019 14:56:08 +0000 (15:56 +0100)] 
Don't float unlifted join points to top level

Ticket #16978 showed that we were floating a recursive,
unlifted join point to top level.  It's very much a corner
case:

    joinrec j :: Int#
            j = jump j
    in ...

But somehow it showed up in a real program.

For non-recursive bindings in SetLevels.lvlBind we were already
(correctly) checking for unlifted bindings, but when I wrote
that code I didn't think that a /recursive/ binding could be
unlifted but /join-points/ can be!

Actually I don't think that SetLevels should be floating
join points at all.  SetLevels really floats things to move
stuff out of loops and save allocation; but none of that applies
to join points.  The only reason to float join points is in
cases like
   join j1 x = join j2 y = ...
               in ...
which we might want to swizzle to
   join j2 x y = ... in
   join j1 x = ...
   in ...
because now j1 looks small and might be inlined away altogether.
But this is a very local float perhaps better done in the simplifier.

Still: this patch fixes the crash, and does so in a way that is
harmless if/when we change our strategy for floating join points.

2 months agoUpdate .gitignore
Matthew Pickering [Thu, 25 Jul 2019 17:31:58 +0000 (18:31 +0100)] 
Update .gitignore

Add some files generated by hadrian and some tooling files

2 months agogitlab-ci: Manually set SPHINXBUILD on Windows
Ben Gamari [Tue, 23 Jul 2019 13:27:29 +0000 (09:27 -0400)] 
gitlab-ci: Manually set SPHINXBUILD on Windows

For some reason configure seems unable to find it on its own. Let's try
giving it a hint.

Addresses #16398.

2 months agoHadrian: make settings, platformConstants, etc dependencies of lib:ghc
Alp Mestanogullari [Thu, 1 Aug 2019 10:30:41 +0000 (12:30 +0200)] 
Hadrian: make settings, platformConstants, etc dependencies of lib:ghc

This fixes #17003, where a user directly asked for the 'docs-haddock' target
without building a complete stage 2 GHC first. Since haddock only depends on
lib:ghc, the stage 2 GHC executable wasn't built, and neither were the
settings, platformConstants, llvm-passes and llvm-targets files, since they
are declared to be dependencies of exe:ghc.

This makes sense in general since all GHC API users (haddock is one) will likely
want those files to be there.

2 months agoPackages: Add timing for package database initialization
Ben Gamari [Tue, 30 Jul 2019 15:43:14 +0000 (11:43 -0400)] 
Packages: Add timing for package database initialization

2 months agorts: Always truncate output files
Ben Gamari [Fri, 26 Jul 2019 14:32:25 +0000 (10:32 -0400)] 
rts: Always truncate output files

Previously there were numerous places in the RTS where we would fopen
with the "w" flag string. This is wrong as it will not truncate the
file. Consequently if we write less data than the previous length of the
file we will leave garbage at its end.

Fixes #16993.

2 months agoAdd Note [withTiming] in compiler/main/ErrUtils.hs
Alp Mestanogullari [Fri, 26 Jul 2019 16:22:06 +0000 (18:22 +0200)] 
Add Note [withTiming] in compiler/main/ErrUtils.hs

2 months agocompiler: emit finer grained codegen events to eventlog
Alp Mestanogullari [Wed, 24 Jul 2019 19:46:49 +0000 (21:46 +0200)] 
compiler: emit finer grained codegen events to eventlog

2 months agodocs: fixs -prof links in rts-flags section
Adam Sandberg Eriksson [Thu, 1 Aug 2019 14:18:16 +0000 (16:18 +0200)] 
docs: fixs -prof links in rts-flags section

2 months agoRemove build.nix.sh
Krzysztof Gogolewski [Wed, 31 Jul 2019 22:52:09 +0000 (00:52 +0200)] 
Remove build.nix.sh

This file refers to shell.nix, which was removed in
430e6fedfda and c00d2f59d.

2 months agoUse injectiveVarsOfType to catch dodgy type family instance binders (#17008)
Ryan Scott [Wed, 31 Jul 2019 14:32:32 +0000 (10:32 -0400)] 
Use injectiveVarsOfType to catch dodgy type family instance binders (#17008)

Previously, we detected dodgy type family instances binders by
expanding type synonyms (via `exactTyCoVarsOfType`) and looking for
type variables on the RHS that weren't mentioned on the (expanded)
LHS. But this doesn't account for type families (like the example
in #17008), so we instead use `injectiveVarsOfType` to only count
LHS type variables that are in injective positions. That way, the `a`
in `type instance F (x :: T a) = a` will not count if `T` is a type
synonym _or_ a type family.

Along the way, I moved `exactTyCoVarsOfType` to `TyCoFVs` to live
alongside its sibling functions that also compute free variables.

Fixes #17008.

2 months agoRip out 9-year-old pattern variable hack (#17007)
Ryan Scott [Tue, 30 Jul 2019 14:44:33 +0000 (10:44 -0400)] 
Rip out 9-year-old pattern variable hack (#17007)

GHC had an ad hoc validity check in place to rule out pattern
variables bound by type synonyms, such as in the following example:

```hs
type ItemColID a b = Int  -- Discards a,b

get :: ItemColID a b -> ItemColID a b
get (x :: ItemColID a b) = x :: ItemColID a b
```

This hack is wholly unnecessary nowadays, since OutsideIn(X) is more
than capable of instantiating `a` and `b` to `Any`. In light of this,
let's rip out this validity check.

Fixes #17007.

2 months agoAdd StandaloneDeriving example for DerivingVia.
Andreas Klebinger [Tue, 30 Jul 2019 15:46:41 +0000 (17:46 +0200)] 
Add StandaloneDeriving example for DerivingVia.

[skip-ci]

2 months agoFix T16916 CI failures (#16966)
Ivan Kasatenko [Wed, 31 Jul 2019 16:17:53 +0000 (19:17 +0300)] 
Fix T16916 CI failures (#16966)

1. Slightly increased the waiting time for the tested effect to be more
   profound.

2. Introduced measuring of the actual time spent waiting and adjusing
   CPU time by it to compensate for threadDelay waiting time
   inconsistencies.

2 months agogitlab-ci: Fix it after upgrade
Ben Gamari [Wed, 31 Jul 2019 17:42:51 +0000 (13:42 -0400)] 
gitlab-ci: Fix it after upgrade

It seems that the regular expression parser changed in GitLab 12.1 and
now does now support forward slashes in the RE, even when escaped.

2 months agoWork around redundant import issue
Ben Gamari [Fri, 26 Jul 2019 22:44:03 +0000 (18:44 -0400)] 
Work around redundant import issue

As mentioned in #16997, GHC currently complains about this import.
In general I'm reluctant to paper over things like this but in the case
of an hs-boot file I think adding an import list is the right thing to
do regardless of the bug.

2 months agoMove tyConAppNeedsKindSig to Type
Ben Gamari [Fri, 26 Jul 2019 17:44:21 +0000 (13:44 -0400)] 
Move tyConAppNeedsKindSig to Type

Previously it was awkwardly in TyCoFVs (and before that in TyCoRep).
Type seems like a sensible place for it to live.

2 months agogitignore: Add .mypy_cache
Ben Gamari [Fri, 26 Jul 2019 17:37:39 +0000 (13:37 -0400)] 
gitignore: Add .mypy_cache

2 months agoBreak up TyCoRep
Ben Gamari [Thu, 25 Jul 2019 23:41:12 +0000 (19:41 -0400)] 
Break up TyCoRep

This breaks up the monstrous TyCoReps module into several new modules by
topic:

 * TyCoRep: Contains the `Coercion`, `Type`, and related type
   definitions and a few simple predicates but nothing further

 * TyCoPpr: Contains the the pretty-printer logic

 * TyCoFVs: Contains the free variable computations (and
   `tyConAppNeedsKindSig`, although I suspect this should change)

 * TyCoSubst: Contains the substitution logic for types and coercions

 * TyCoTidy: Contains the tidying logic for types

While we are able to eliminate a good number of `SOURCE` imports (and
make a few others smaller) with this change, we must introduce one new
`hs-boot` file for `TyCoPpr` so that `TyCoRep` can define `Outputable`
instances for the types it defines.

Metric Increase:
    haddock.Cabal
    haddock.compiler

2 months agoApply a missing substitution in mkEtaWW (#16979)
Simon Peyton Jones [Fri, 26 Jul 2019 23:19:50 +0000 (19:19 -0400)] 
Apply a missing substitution in mkEtaWW (#16979)

The `mkEtaWW` case for newtypes forgot to apply the substitution to
the newtype coercion, resulting in the Core Lint errors observed
in #16979. Easily fixed.

Fixes #16979.

Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
2 months agoExpand the preallocated Int range to [-16,255]
Andreas Klebinger [Sun, 21 Jul 2019 10:26:25 +0000 (12:26 +0200)] 
Expand the preallocated Int range to [-16,255]

Effects as I measured them:

RTS Size: +0.1%
Compile times: -0.5%
Runtine nofib: -1.1%

Nofib runtime result seems to mostly come from the `CS` benchmark
which is very sensible to alignment changes so this is likely over
represented.

However the compile time changes are realistic.

This is related to #16961.

2 months agohadrian: Drop a stale limitation tracking issue
Dale Wijnand [Sun, 28 Jul 2019 06:27:22 +0000 (02:27 -0400)] 
hadrian: Drop a stale limitation tracking issue

https://github.com/snowleopard/hadrian/issues/187 was superseded by
https://github.com/snowleopard/hadrian/issues/669, which has also
been closed.

So, optimistically, dropping this as a limitation issue.

2 months agoAdd Note [RuntimeRep and PrimRep] in RepType
Richard Eisenberg [Tue, 23 Jul 2019 14:13:51 +0000 (10:13 -0400)] 
Add Note [RuntimeRep and PrimRep] in RepType

Also adds Note [Getting from RuntimeRep to PrimRep], which
deocuments a related thorny process.

This Note addresses #16964, which correctly observes that
documentation for this thorny design is lacking.

Documentation only.

2 months agohadrian: relink to the flavours doc in the ghc repo
Dale Wijnand [Sun, 28 Jul 2019 06:33:22 +0000 (02:33 -0400)] 
hadrian: relink to the flavours doc in the ghc repo

2 months agobase: add Functor, Applicative, Monad, Alternative, MonadPlus, Generic and Generic1...
Fumiaki Kinoshita [Thu, 4 Apr 2019 06:56:40 +0000 (15:56 +0900)] 
base: add Functor, Applicative, Monad, Alternative, MonadPlus, Generic and Generic1 instances to Kleisli

2 months agoAdd regression test for #16946
nineonine [Thu, 25 Jul 2019 18:13:20 +0000 (11:13 -0700)] 
Add regression test for #16946

2 months agoghc-heap: implement WEAK closure type #16974
Adam Sandberg Eriksson [Wed, 24 Jul 2019 10:56:16 +0000 (12:56 +0200)] 
ghc-heap: implement WEAK closure type #16974

2 months agoreifyTypeOfThing: panic on impossible cases
Vladislav Zavialov [Wed, 24 Jul 2019 23:57:37 +0000 (02:57 +0300)] 
reifyTypeOfThing: panic on impossible cases

2 months agoTemplateHaskell: reifyType (#16976)
Vladislav Zavialov [Wed, 24 Jul 2019 14:17:47 +0000 (17:17 +0300)] 
TemplateHaskell: reifyType (#16976)

2 months agoChange behaviour of -ddump-cmm-verbose to dump each Cmm pass output to a separate...
nineonine [Sat, 13 Jul 2019 07:11:46 +0000 (00:11 -0700)] 
Change behaviour of -ddump-cmm-verbose to dump each Cmm pass output to a separate file and add -ddump-cmm-verbose-by-proc to keep old behaviour (#16930)

2 months agoBanish reportFloatingViaTvs to the shadow realm (#15831, #16181)
Ryan Scott [Fri, 12 Jul 2019 14:47:05 +0000 (10:47 -0400)] 
Banish reportFloatingViaTvs to the shadow realm (#15831, #16181)

GHC used to reject programs of this form:

```
newtype Age = MkAge Int
  deriving Eq via Const Int a
```

That's because an earlier implementation of `DerivingVia` would
generate the following instance:

```
instance Eq Age where
  (==) = coerce @(Const Int a -> Const Int a -> Bool)
                @(Age         -> Age         -> Bool)
                (==)
```

Note that the `a` in `Const Int a` is not bound anywhere, which
causes all sorts of issues. I figured that no one would ever want to
write code like this anyway, so I simply banned "floating" `via` type
variables like `a`, checking for their presence in the aptly named
`reportFloatingViaTvs` function.

`reportFloatingViaTvs` ended up being implemented in a subtly
incorrect way, as #15831 demonstrates. Following counsel with the
sage of gold fire, I decided to abandon `reportFloatingViaTvs`
entirely and opt for a different approach that would _accept_
the instance above. This is because GHC now generates this instance
instead:

```
instance forall a. Eq Age where
  (==) = coerce @(Const Int a -> Const Int a -> Bool)
                @(Age         -> Age         -> Bool)
                (==)
```

Notice that we now explicitly quantify the `a` in
`instance forall a. Eq Age`, so everything is peachy scoping-wise.
See `Note [Floating `via` type variables]` in `TcDeriv` for the full
scoop.

A pleasant benefit of this refactoring is that it made it much easier
to catch the problem observed in #16181, so this patch fixes that
issue too.

Fixes #15831. Fixes #16181.

2 months agoPrinter: add an empty line between bindings in Rec STG binding groups
Ömer Sinan Ağacan [Thu, 25 Jul 2019 07:44:38 +0000 (10:44 +0300)] 
Printer: add an empty line between bindings in Rec STG binding groups

Before:

    Rec {
    x2_r10T :: Lib.Bar
    [GblId, Unf=OtherCon []] =
        CCS_DONT_CARE Lib.Bar! [x3_r10U];
    x3_r10U :: Lib.Foo
    [GblId, Unf=OtherCon []] =
        CCS_DONT_CARE Lib.Foo! [x1_r10p x2_r10T];
    end Rec }

After:

    Rec {
    x2_r10T :: Lib.Bar
    [GblId, Unf=OtherCon []] =
        CCS_DONT_CARE Lib.Bar! [x3_r10U];

    x3_r10U :: Lib.Foo
    [GblId, Unf=OtherCon []] =
        CCS_DONT_CARE Lib.Foo! [x1_r10p x2_r10T];
    end Rec }

2 months agoMake DefUses = OrdList DefUse
Ryan Scott [Tue, 23 Jul 2019 18:30:46 +0000 (14:30 -0400)] 
Make DefUses = OrdList DefUse

Before, `type DefUses = [DefUse]`. But lists are a terrible choice of
data structure here, as we frequently append to the right of a
`DefUses`, which yields some displeasing asymptotics. Let's instead
use `OrdList`, which has constant-time appending to the right.

This is one step on the way to #10347.

2 months agoDrop unused helpers 'mkTyClGroup' and 'emptyTyClGroup'
Vladislav Zavialov [Sat, 20 Jul 2019 17:23:54 +0000 (20:23 +0300)] 
Drop unused helpers 'mkTyClGroup' and 'emptyTyClGroup'

2 months agoASSERT(vis_flag==ForallInvis) in hsScopedTvs
Vladislav Zavialov [Sat, 20 Jul 2019 11:14:41 +0000 (14:14 +0300)] 
ASSERT(vis_flag==ForallInvis) in hsScopedTvs

2 months agogitlab-ci: Fix source tarball job
Ben Gamari [Sat, 20 Jul 2019 00:05:37 +0000 (20:05 -0400)] 
gitlab-ci: Fix source tarball job

* Use show! in source tarball job. Since we aren't actually building
  anything in this job `show` won't
  work.

* Fix Docker image name

* Make `version` file contain only version string

2 months agoMake stage 1 GHC target independent
John Ericson [Mon, 8 Apr 2019 02:33:21 +0000 (22:33 -0400)] 
Make stage 1 GHC target independent

Now that the target macros are not being used, we remove them. This
prevents target hardcoding regressions.

2 months agoSimon and I like to work in hsSyn, too.
Richard Eisenberg [Tue, 23 Jul 2019 14:46:46 +0000 (10:46 -0400)] 
Simon and I like to work in hsSyn, too.

2 months agoHadrian: run the testsuite in Windows CI job
Alp Mestanogullari [Mon, 27 May 2019 11:05:32 +0000 (13:05 +0200)] 
Hadrian: run the testsuite in Windows CI job

Since MR !1025 fixed the Windows build, allowing us to build a binary
distribution, we can now run the testsuite in that CI job.

This required fixing 'createFileLink': it should not try to create
symlinks on Windows (that requires admin priviledges, which Hadrian can't
assume). We now instead fall back to copying.

This patch also removes some duplicated logic for iserv in the test rules,
where we handle our dependency on the iserv binaries in a special way.

2 months agoRemove fix-submodules.py
Ömer Sinan Ağacan [Tue, 23 Jul 2019 03:36:03 +0000 (06:36 +0300)] 
Remove fix-submodules.py

Now that we have absolute paths for submodules (since a76b233d) we no
longer need this script.

2 months agoMake sure to load interfaces when running :instances
Xavier Denis [Mon, 8 Jul 2019 12:58:46 +0000 (14:58 +0200)] 
Make sure to load interfaces when running :instances

2 months agoghc-cabal: Use fromFlagOrDefault instead of fromFlag
Ben Gamari [Sat, 20 Jul 2019 01:33:55 +0000 (21:33 -0400)] 
ghc-cabal: Use fromFlagOrDefault instead of fromFlag

As fromFlag is partial. The only case where we used fromFlag is when
determining whether to strip libraries; we now assume that we shouldn't.

2 months agoFix #8487: Debugger confuses variables
Roland Senn [Thu, 18 Jul 2019 08:41:44 +0000 (10:41 +0200)] 
Fix #8487: Debugger confuses variables

To display the free variables for a single breakpoint, GHCi pulls out the
information from the fields `modBreaks_breakInfo` and `modBreaks_vars`
of the `ModBreaks` data structure. For a specific breakpoint this gives 2
lists of types 'Id` (`Var`) and `OccName`. They are used to create the Id's
for the free variables and must be kept in sync:
If we remove an element from the Names list, then we also must remove the
corresponding element from the OccNames list.

2 months agoDo not ignore events deletion when events to be added are provided (#16916)
Ivan Kasatenko [Sat, 20 Jul 2019 12:09:00 +0000 (15:09 +0300)] 
Do not ignore events deletion when events to be added are provided (#16916)

Kqueue/kevent implementation used to ignore events to be unsubscribed
from when events to be subscribed to were provided. This resulted in a
lost notification subscription, when GHC runtime didn't listen for any
events, yet the kernel considered otherwise and kept waking up the IO
manager thread.

This commit fixes this issue by always adding and removing all of the
provided subscriptions.

2 months agoExpose the GhcPrelude module.
Andreas Klebinger [Wed, 10 Jul 2019 08:55:49 +0000 (10:55 +0200)] 
Expose the GhcPrelude module.

This makes it simpler to load Modules importing it
when using ghc-the-package.

-------------------------
Metric Decrease:
    haddock.compiler
-------------------------

3 months agohadrian: Remove RTS -Waggregate-return warning
Matthew Pickering [Fri, 19 Jul 2019 16:12:56 +0000 (12:12 -0400)] 
hadrian: Remove RTS -Waggregate-return warning

This was removed from make in 077b92fa39839a8e83cd87398435424403cf6486

3 months agoBump nofib submodule.
Andreas Klebinger [Mon, 15 Jul 2019 14:28:28 +0000 (16:28 +0200)] 
Bump nofib submodule.

3 months agoLine wrap when pp long expressions (fixes #16874)
Alfredo Di Napoli [Sat, 13 Jul 2019 16:07:17 +0000 (18:07 +0200)] 
Line wrap when pp long expressions (fixes #16874)

This commit fixes #16874 by using `fsep` rather than `sep` when pretty
printing long patterns and expressions.

3 months agoAdded do-notation examples for Functor, Applicative and Monad combinators.
Baldur Blöndal [Sat, 13 Jul 2019 15:46:39 +0000 (16:46 +0100)] 
Added do-notation examples for Functor, Applicative and Monad combinators.

3 months agoAdd module doc for Plugins.
Richard Eisenberg [Thu, 18 Jul 2019 17:51:57 +0000 (13:51 -0400)] 
Add module doc for Plugins.

This was requested in #15650.

3 months agoDon't maintainer-clean libraries/ghc-boot/ghc.mk (#16953)
Ryan Scott [Thu, 18 Jul 2019 13:54:11 +0000 (09:54 -0400)] 
Don't maintainer-clean libraries/ghc-boot/ghc.mk (#16953)

This makes the `maintainer-clean` rule in `ghc.mk` slightly more
sophisticated so that it does not remove the version-controlled
file `libraries/ghc-boot/ghc.mk`, which was checked into version
control in commit 24782b89907ab36fb5aef3a17584f4c10f1e2690.

Fixes #16953.

3 months agousers-guide: corrected -fmax-relevant-binds reverse to be -fno-max-relevant-binds
James Foster [Wed, 17 Jul 2019 15:16:32 +0000 (11:16 -0400)] 
users-guide: corrected -fmax-relevant-binds reverse to be -fno-max-relevant-binds

3 months agoMake generated ghc-stage<n> scripts executable
Sebastian Graf [Wed, 17 Jul 2019 10:08:15 +0000 (10:08 +0000)] 
Make generated ghc-stage<n> scripts executable