ghc.git
3 months agoCODEOWNERS: Use correct username for Richard Eisenberg
Ben Gamari [Tue, 28 May 2019 01:02:16 +0000 (21:02 -0400)] 
CODEOWNERS: Use correct username for Richard Eisenberg

In !980 Richard noted that he could not approve the MR.
This mis-spelling was the reason.

[skip ci]

3 months agoHadrian: always generate the libffi dynlibs manifest with globbing
Alp Mestanogullari [Fri, 24 May 2019 16:19:22 +0000 (18:19 +0200)] 
Hadrian: always generate the libffi dynlibs manifest with globbing

Instead of trying to deduce which dynlibs are expected to be found (and then
copied to the RTS's build dir) in libffi's build directory, with some OS
specific logic, we now always just use `getDirectoryFilesIO` to look for
those dynlibs and record their names in the manifest. The previous logic
ended up causing problems on Windows, where we don't build dynlibs at all
for now but the manifest file's logic didn't take that into account because
it was only partially reproducing the criterions that determine whether or not
we will be building shared libraries.

This patch also re-enables the Hadrian/Windows CI job, which was failing to
build GHC precisely because of libffi shared libraries and the aforementionned
duplicated logic.

3 months agoHadrian: Add note about Libffi's Indicating Inputs #16653
David Eichmann [Fri, 24 May 2019 17:16:28 +0000 (18:16 +0100)] 
Hadrian: Add note about Libffi's Indicating Inputs #16653

[skip ci]

3 months agoInline `Settings` into `DynFlags`
John Ericson [Wed, 22 May 2019 03:00:27 +0000 (23:00 -0400)] 
Inline `Settings` into `DynFlags`

After the previous commit, `Settings` is just a thin wrapper around
other groups of settings. While `Settings` is used by GHC-the-executable
to initalize `DynFlags`, in principle another consumer of
GHC-the-library could initialize `DynFlags` a different way. It
therefore doesn't make sense for `DynFlags` itself (library code) to
separate the settings that typically come from `Settings` from the
settings that typically don't.

3 months agoBreak up `Settings` into smaller structs
John Ericson [Wed, 22 May 2019 03:00:27 +0000 (23:00 -0400)] 
Break up `Settings` into smaller structs

As far as I can tell, the fields within `Settings` aren't *intrinsicly*
related. They just happen to be initialized the same way (in particular
prior to the rest of `DynFlags`), and that is why they are grouped
together.

Within `Settings`, however, there are groups of settings that clearly do
share something in common, regardless of how they anything is
initialized.

In the spirit of GHC being a library, where the end cosumer may choose
to initialize this configuration in arbitrary ways, I made some new data
types for thoses groups internal to `Settings`, and used them to define
`Settings` instead. Hopefully this is a baby step towards a general
decoupling of the stateful and stateless parts of GHC.

3 months agoProvide details in `plusSimplCount` errors
Josh Meredith [Tue, 28 May 2019 11:15:56 +0000 (21:15 +1000)] 
Provide details in `plusSimplCount` errors

3 months agotcMatchesFun s/rho/sigma #16692
Vladislav Zavialov [Sun, 26 May 2019 11:21:19 +0000 (14:21 +0300)] 
tcMatchesFun s/rho/sigma #16692

3 months agoCNF.c: Move debug functions behind ifdef
Ömer Sinan Ağacan [Tue, 28 May 2019 07:46:41 +0000 (10:46 +0300)] 
CNF.c: Move debug functions behind ifdef

3 months agodownsweep: Allow TargetFile not to exist when a buffer is given
Daniel Gröber [Mon, 20 May 2019 10:17:36 +0000 (12:17 +0200)] 
downsweep: Allow TargetFile not to exist when a buffer is given

Currently 'getRootSummary' will fail with an exception if a 'TargetFile' is
given but it does not exist even if an input buffer is passed along for
this target.

In this case it is not necessary for the file to exist since the buffer
will be used as input for the compilation pipeline instead of the file
anyways.

3 months agoAllow using tagetContents for modules needing preprocessing
Daniel Gröber [Mon, 20 May 2019 09:58:55 +0000 (11:58 +0200)] 
Allow using tagetContents for modules needing preprocessing

This allows GHC API clients, most notably tooling such as
Haskell-IDE-Engine, to pass unsaved files to GHC more easily.

Currently when targetContents is used but the module requires preprocessing
'preprocessFile' simply throws an error because the pipeline does not
support passing a buffer.

This change extends `runPipeline` to allow passing the input buffer into
the pipeline. Before proceeding with the actual pipeline loop the input
buffer is immediately written out to a new tempfile.

I briefly considered refactoring the pipeline at large to pass around
in-memory buffers instead of files, but this seems needlessly complicated
since no pipeline stages other than Hsc could really support this at the
moment.

3 months agoAdd hPutStringBuffer utility
Daniel Gröber [Mon, 20 May 2019 04:03:49 +0000 (06:03 +0200)] 
Add hPutStringBuffer utility

3 months agoDon't lose parentheses in show SomeAsyncException
Nathan Collins [Tue, 21 May 2019 17:35:58 +0000 (13:35 -0400)] 
Don't lose parentheses in show SomeAsyncException

3 months agoFix missing unboxed tuple RuntimeReps (#16565)
Krzysztof Gogolewski [Sun, 5 May 2019 18:37:31 +0000 (20:37 +0200)] 
Fix missing unboxed tuple RuntimeReps (#16565)

Unboxed tuples and sums take extra RuntimeRep arguments,
which must be manually passed in a few places.
This was not done in deSugar/Check.

This error was hidden because zipping functions in TyCoRep
ignored lists with mismatching length. This is now fixed;
the lengths are now checked by calling zipEqual.

As suggested in #16565, I moved checking for isTyVar and
isCoVar to zipTyEnv and zipCoEnv.

3 months agoIn hole fits, don't show VTA for inferred variables (#16456)
Krzysztof Gogolewski [Thu, 16 May 2019 17:41:46 +0000 (19:41 +0200)] 
In hole fits, don't show VTA for inferred variables (#16456)

We fetch the ArgFlag for every argument by using splitForAllVarBndrs
instead of splitForAllTys in unwrapTypeVars.

3 months agoAdd test for old issue displaying unboxed tuples in error messages (#502)
Kevin Buhr [Fri, 10 May 2019 02:46:48 +0000 (21:46 -0500)] 
Add test for old issue displaying unboxed tuples in error messages (#502)

3 months agoFix some warnings in users_guide (incl #16640)
Oleg Grenrus [Wed, 8 May 2019 18:39:58 +0000 (21:39 +0300)] 
Fix some warnings in users_guide (incl #16640)

- short underline
- :ghc-flag:, not :ghc-flags:
- :since: have to be separate
- newline before code block
- workaround anchor generation so

    - pragma:SPECIALISE
    - pragma:SPECIALIZE-INLINE
    - pragma:SPECIALIZE-inline

  are different anchors, not all the same `pragma:SPECIALIZE`

3 months agoRemove stale 8.2.1-notes
Oleg Grenrus [Wed, 8 May 2019 18:22:19 +0000 (21:22 +0300)] 
Remove stale 8.2.1-notes

3 months agoMinor spelling fixes to users guide.
P.C. Shyamshankar [Sat, 27 Apr 2019 16:54:03 +0000 (12:54 -0400)] 
Minor spelling fixes to users guide.

3 months agotestsuite: introduce 'static_stats' tests
Alp Mestanogullari [Fri, 26 Apr 2019 12:25:46 +0000 (14:25 +0200)] 
testsuite: introduce 'static_stats' tests

They are a particular type of perf tests. This patch introduces a
'stats_files_dir' configuration field in the testsuite driver where all
haddock timing files (and possibly others in the future) are assumed to live.
We also change both the Make and Hadrian build systems to pass respectively
$(TOP)/testsuite/tests/perf/haddock/ and
<build root>/stage1/haddock-timing-files/ as the value of that new
configuration field, and to generate the timing files in those directories
in the first place while generating documentation with haddock.

This new test type can be seen as one dedicated to examining stats files that
are generated while building a GHC distribution. This also lets us get rid of
the 'extra_files' directives in the all.T entries for haddock.base,
haddock.Cabal and haddock.compiler.

3 months agoHandle hs-boot files in -Wmissing-home-modules (#16551)
Krzysztof Gogolewski [Tue, 9 Apr 2019 11:51:29 +0000 (13:51 +0200)] 
Handle hs-boot files in -Wmissing-home-modules (#16551)

3 months agoImprove comments around injectivity checks
Richard Eisenberg [Thu, 14 Mar 2019 17:29:17 +0000 (13:29 -0400)] 
Improve comments around injectivity checks

3 months agoAdd missing opening braces in Cmm dumps
Ömer Sinan Ağacan [Fri, 24 May 2019 18:28:45 +0000 (21:28 +0300)] 
Add missing opening braces in Cmm dumps

Previously -ddump-cmm was generating code with unbalanced curly braces:

     stg_atomically_entry() //  [R1]
             { info_tbls: [(cfl,
                            label: stg_atomically_info
                            rep: tag:16 HeapRep 1 ptrs { Thunk }
                            srt: Nothing)]
               stack_info: arg_space: 8 updfr_space: Just 8
             }
         {offset
           cfl: // cfk
               unwind Sp = Just Sp + 0;
               _cfk::P64 = R1;
               //tick src<rts/PrimOps.cmm:(1243,1)-(1245,1)>
               R1 = I64[_cfk::P64 + 8 + 8 + 0 * 8];
               call stg_atomicallyzh(R1) args: 8, res: 0, upd: 8;
         }
     }, <---- OPENING BRACE MISSING

After this patch:

     stg_atomically_entry() { //  [R1] <---- MISSING OPENING BRACE HERE
             { info_tbls: [(cfl,
                            label: stg_atomically_info
                            rep: tag:16 HeapRep 1 ptrs { Thunk }
                            srt: Nothing)]
               stack_info: arg_space: 8 updfr_space: Just 8
             }
         {offset
           cfl: // cfk
               unwind Sp = Just Sp + 0;
               _cfk::P64 = R1;
               //tick src<rts/PrimOps.cmm:(1243,1)-(1245,1)>
               R1 = I64[_cfk::P64 + 8 + 8 + 0 * 8];
               call stg_atomicallyzh(R1) args: 8, res: 0, upd: 8;
         }
     },

3 months agohadrian: Fix generation of settings
John Ericson [Fri, 24 May 2019 15:32:20 +0000 (11:32 -0400)] 
hadrian: Fix generation of settings

I jumbled some lines in e529c65eacf595006dd5358491d28c202d673732,
messing up the leading underscores and rts ways settings. This broke at
least stage1 linking on macOS, but probably loads of other things too.

Should fix #16685 and #16658.

3 months agoFix padding of entries in .prof files
Jasper Van der Jeugt [Wed, 22 May 2019 09:49:15 +0000 (11:49 +0200)] 
Fix padding of entries in .prof files

When the number of entries of a cost centre reaches 11 digits, it takes
up the whole space reserved for it and the prof file ends up looking
like:

    ... no.        entries  %time %alloc   %time %alloc

        ...
    ... 120918     978250    0.0    0.0     0.0    0.0
    ... 118891          0    0.0    0.0    73.3   80.8
    ... 11890229702412351    8.9   13.5    73.3   80.8
    ... 118903  153799689    0.0    0.1     0.0    0.1
        ...

This results in tooling not being able to parse the .prof file.  I
realise we have the JSON output as well now, but still it'd be good to
fix this little weirdness.

Original bug report and full prof file can be seen here:
<https://github.com/jaspervdj/profiteur/issues/28>.

3 months agobase: Include (<$) in all exports of Functor
Simon Jakobi [Wed, 22 May 2019 05:31:49 +0000 (07:31 +0200)] 
base: Include (<$) in all exports of Functor

Previously the haddocks for Control.Monad and Data.Functor gave
the impression that `fmap` was the only Functor method.

Fixes #16681.

3 months agoAdd a pprTraceWith function
Sebastian Graf [Mon, 20 May 2019 15:36:18 +0000 (17:36 +0200)] 
Add a pprTraceWith function

3 months agoFix tcfail158 (#15899)
Krzysztof Gogolewski [Sun, 19 May 2019 19:44:11 +0000 (21:44 +0200)] 
Fix tcfail158 (#15899)

As described in #15899, this test was broken, but now it's back
to normal.

3 months agoCorrect the large tuples section in user's guide
Joshua Price [Sun, 19 May 2019 18:40:47 +0000 (14:40 -0400)] 
Correct the large tuples section in user's guide

Fixes #16644.

3 months agoFix typo of primop format
mizunashi_mana [Fri, 17 May 2019 06:49:50 +0000 (02:49 -0400)] 
Fix typo of primop format

3 months agoHadrian: Fix problem with unlit path in settings file
Alp Mestanogullari [Wed, 15 May 2019 13:26:45 +0000 (15:26 +0200)] 
Hadrian: Fix problem with unlit path in settings file

e529c65e introduced a problem in the logic for generating the
path to the unlit command in the settings file, and this patches
fixes it.

This fixes many tests, the simplest of which is:

> _build/stage1/bin/ghc testsuite/tests/parser/should_fail/T8430.lhs

which failed because of a wrong path for unlit, and now fails for the right
reason, with the error message expected for this test.

This addresses #16659.

3 months agoLowercase windows imports
Moritz Angermann [Wed, 15 May 2019 02:54:42 +0000 (10:54 +0800)] 
Lowercase windows imports

While windows and macOS are currently on case-insensitive file
systems, this poses no issue on those.  When cross compiling from
linux with a case sensitive file system and mingw providing only
lowercase headers, this in fact produces an issue.  As such we just
lowercase the import headers, which should still work fine on a
case insensitive file system and also enable mingw's headers to
be usable porperly.

3 months agoLet the specialiser work on dicts under lambdas
Sandy Maguire [Thu, 16 May 2019 16:12:10 +0000 (12:12 -0400)] 
Let the specialiser work on dicts under lambdas

Following the discussion under #16473, this change allows the
specializer to work on any dicts in a lambda, not just those that occur
at the beginning.

For example, if you use data types which contain dictionaries and
higher-rank functions then once these are erased by the optimiser you
end up with functions such as:

```
  go_s4K9
  Int#
  -> forall (m :: * -> *).
     Monad m =>
     (forall x. Union '[State (Sum Int)] x -> m x) -> m ()
```

The dictionary argument is after the Int# value argument, this patch
allows `go` to be specialised.

3 months agoHadrian: Add Mising Libffi Dependencies #16653
David Eichmann [Tue, 14 May 2019 10:44:00 +0000 (11:44 +0100)] 
Hadrian: Add Mising Libffi Dependencies #16653

Libffi is ultimately built from a single archive file (e.g.
libffi-tarballs/libffi-3.99999+git20171002+77e130c.tar.gz).
The file can be seen as the shallow dependency for the whole
libffi build. Hence, in all libffi rules, the archive is
`need`ed and the build directory is `trackAllow`ed.

3 months agoAdd `keepCAFs` to RtsSymbols
Moritz Angermann [Wed, 15 May 2019 03:13:42 +0000 (11:13 +0800)] 
Add `keepCAFs` to RtsSymbols

3 months agoAdd PlainPanic for throwing exceptions without depending on pprint
Michael Sloan [Thu, 14 Mar 2019 22:47:44 +0000 (15:47 -0700)] 
Add PlainPanic for throwing exceptions without depending on pprint

This commit splits out a subset of GhcException which do not depend on
pretty printing (SDoc), as a new datatype called
PlainGhcException. These exceptions can be caught as GhcException,
because 'fromException' will convert them.

The motivation for this change is that that the Panic module
transitively depends on many modules, primarily due to pretty printing
code.  It's on the order of about 130 modules.  This large set of
dependencies has a few implications:

1. To avoid cycles / use of boot files, these dependencies cannot
throw GhcException.

2. There are some utility modules that use UnboxedTuples and also use
`panic`. This means that when loading GHC into GHCi, about 130
additional modules would need to be compiled instead of
interpreted. Splitting the non-pprint exception throwing into a new
module resolves this issue. See #13101

3 months agoAllow metric change after reverting "Add Generic tuple instances up to 15-tuple"...
David Eichmann [Fri, 24 May 2019 10:22:29 +0000 (11:22 +0100)] 
Allow metric change after reverting "Add Generic tuple instances up to 15-tuple" #16688

Metrics increased on commit 5eb9445444c4099fc9ee0803ba45db390900a80f and
decreased on revert commit 535a26c90f458801aeb1e941a3f541200d171e8f.

Metric Decrease:
    T9630
    haddock.base

3 months agoSome forall-related cleanup in deriving code
Ryan Scott [Tue, 14 May 2019 19:04:02 +0000 (15:04 -0400)] 
Some forall-related cleanup in deriving code

* Tweak the parser to allow `deriving` clauses to mention explicit
  `forall`s or kind signatures without gratuitous parentheses.
  (This fixes #14332 as a consequence.)
* Allow Haddock comments on `deriving` clauses with explicit
  `forall`s. This requires corresponding changes in Haddock.

3 months agoAdd a `NOINLINE` pragma on `someNatVal` (#16586)
Iavor Diatchki [Tue, 7 May 2019 20:02:27 +0000 (13:02 -0700)] 
Add a `NOINLINE` pragma on `someNatVal` (#16586)

This fixes #16586, see `Note [NOINLINE someNatVal]` for details.

3 months agoAdd a test for #16597
Ömer Sinan Ağacan [Tue, 23 Apr 2019 11:17:40 +0000 (14:17 +0300)] 
Add a test for #16597

3 months agoadd an --hadrian mode to ./validate
Alp Mestanogullari [Tue, 9 Apr 2019 10:08:04 +0000 (12:08 +0200)] 
add an --hadrian mode to ./validate

When the '--hadrian' flag is passed to the validate script, we use hadrian
to build GHC, package it up in a binary distribution and later on run GHC's
testsuite against the said bindist, which gets installed locally in the process.

Along the way, this commit fixes a typo, an omission (build iserv binaries
before producing the bindist archive) and moves the Makefile that enables
'make install' on those bindists from being a list of strings in the code to
an actual file (it was becoming increasingly annoying to work with).

Finally, the Settings.Builders.Ghc part of this patch is necessary for being
able to use the installed binary distribution, in 'validate'.

3 months agoRevert "Add Generic tuple instances up to 15-tuple" #16688
David Eichmann [Thu, 23 May 2019 17:26:37 +0000 (18:26 +0100)] 
Revert "Add Generic tuple instances up to 15-tuple" #16688

This reverts commit 5eb9445444c4099fc9ee0803ba45db390900a80f.
It has caused an increase in variance of performance test T9630,
causing CI to fail.

3 months agofix Template Haskell cross compilation on 64 bit compiler with 32 bit target
Luite Stegeman [Mon, 8 Jan 2018 08:42:30 +0000 (08:42 +0000)] 
fix Template Haskell cross compilation on 64 bit compiler with 32 bit target

3 months agoUse HsTyPats in associated type family defaults
Ryan Scott [Sun, 12 May 2019 23:16:37 +0000 (19:16 -0400)] 
Use HsTyPats in associated type family defaults

Associated type family default declarations behave strangely in a
couple of ways:

1. If one tries to bind the type variables with an explicit `forall`,
   the `forall`'d part will simply be ignored. (#16110)
2. One cannot use visible kind application syntax on the left-hand
   sides of associated default equations, unlike every other form
   of type family equation. (#16356)

Both of these issues have a common solution. Instead of using
`LHsQTyVars` to represent the left-hand side arguments of an
associated default equation, we instead use `HsTyPats`, which is what
other forms of type family equations use. In particular, here are
some highlights of this patch:

* `FamEqn` is no longer parameterized by a `pats` type variable, as
  the `feqn_pats` field is now always `HsTyPats`.
* The new design for `FamEqn` in chronicled in
  `Note [Type family instance declarations in HsSyn]`.
* `TyFamDefltEqn` now becomes the same thing as `TyFamInstEqn`. This
  means that many of `TyFamDefltEqn`'s code paths can now reuse the
  code paths for `TyFamInstEqn`, resulting in substantial
  simplifications to various parts of the code dealing with
  associated type family defaults.

Fixes #16110 and #16356.

3 months agoHadrian: add --test-root-dirs, to only run specific directories of tests
Alp Mestanogullari [Tue, 14 May 2019 16:16:52 +0000 (18:16 +0200)] 
Hadrian: add --test-root-dirs, to only run specific directories of tests

We can specify several of those, by using the flag multiple times or
just once but combining the directories with ':'.

Along the way, this patch also fixes the testsuite-related --only flag,
so that we can use it many times instead of being force to specify a
space-separated list of test in a single --only flag.

3 months agoRTS: Fix restrictive cast
Alec Theriault [Mon, 13 May 2019 22:31:56 +0000 (15:31 -0700)] 
RTS: Fix restrictive cast

Commit e75a9afd2989e0460f9b49fa07c1667299d93ee9 added an `unsigned` cast
to account for OSes that have signed `rlim_t` signed. Unfortunately,
the `unsigned` cast has the unintended effect of narrowing `rlim_t` to
only 4 bytes. This leads to some spurious out of memory crashes
(in particular: Haddock crashes with OOM whenn building docs of
`ghc`-the-library).

In this case, `W_` is a better type to cast to: we know it will be
unsigned too and it has the same type as `*len` (so we don't suffer from
accidental narrowing).

3 months agoAdd regression test for old Word32 arithmetic issue (#497)
Kevin Buhr [Fri, 10 May 2019 00:56:53 +0000 (19:56 -0500)] 
Add regression test for old Word32 arithmetic issue (#497)

3 months agoUse datatype for unboxed returns when loading ghc into ghci
Michael Sloan [Fri, 15 Mar 2019 00:26:51 +0000 (17:26 -0700)] 
Use datatype for unboxed returns when loading ghc into ghci

See #13101 and #15454

3 months agoHave GHCi use object code for UnboxedTuples modules #15454
Michael Sloan [Thu, 14 Mar 2019 06:04:41 +0000 (23:04 -0700)] 
Have GHCi use object code for UnboxedTuples modules #15454

The idea is to automatically enable -fobject-code for modules that use
UnboxedTuples, along with all the modules they depend on. When looking
into how to solve this, I was pleased to find that there was already
highly similar logic for enabling code generation when -fno-code is
specified but TemplateHaskell is used.

The state before this patch was that if you used unboxed tuples then you
had to enable `-fobject-code` globally rather than on a per module
basis.

3 months agoAllow for multiple linker instances. Fixes Haskell portion of #3372.
Julian Leviston [Sat, 2 Feb 2019 09:10:51 +0000 (20:10 +1100)] 
Allow for multiple linker instances. Fixes Haskell portion of #3372.

3 months agoUpdate .gitlab-ci.yml
Ben Gamari [Sat, 18 May 2019 21:35:54 +0000 (17:35 -0400)] 
Update .gitlab-ci.yml

3 months agogitlab-ci: Allow Windows Hadrian build to fail
Ben Gamari [Sat, 18 May 2019 21:34:06 +0000 (17:34 -0400)] 
gitlab-ci: Allow Windows Hadrian build to fail

Due to #16574.

3 months agoFix #16666 by parenthesizing contexts in Convert
Ryan Scott [Thu, 16 May 2019 21:50:33 +0000 (17:50 -0400)] 
Fix #16666 by parenthesizing contexts in Convert

Most places where we convert contexts in `Convert` are actually in
positions that are to the left of some `=>`, such as in superclasses
and instance contexts. Accordingly, these contexts need to be
parenthesized at `funPrec`. To accomplish this, this patch changes
`cvtContext` to require a precedence argument for the purposes of
calling `parenthesizeHsContext` and adjusts all `cvtContext` call
sites accordingly.

3 months agodistrib/configure.ac.in: remove mention to 'settings', since settings.in is gone
Alp Mestanogullari [Thu, 16 May 2019 09:12:30 +0000 (11:12 +0200)] 
distrib/configure.ac.in: remove mention to 'settings', since settings.in is gone

Otherwise, when `./configure`ing a GHC bindist, produced by either Make or
Hadrian, we would try to generate the `settings` file from the `settings.in`
template that we used to have around but which has been gone since d37d91e9.
That commit generates the settings file using the build systems instead, but
forgot to remove this mention to the `settings` file.

3 months agoUpdate resolver for for happy 1.19.10
Shayne Fletcher [Wed, 15 May 2019 10:30:36 +0000 (06:30 -0400)] 
Update resolver for for happy 1.19.10

3 months agoFix doc for Data.Function.fix.
Javran Cheng [Mon, 13 May 2019 21:58:56 +0000 (14:58 -0700)] 
Fix doc for Data.Function.fix.

Doc-only change.

3 months agousers-guide: Fix -rtsopts default
Kirill Elagin [Mon, 13 May 2019 13:20:50 +0000 (09:20 -0400)] 
users-guide: Fix -rtsopts default

3 months agoRefactor Libffi and RTS rules
David Eichmann [Fri, 3 May 2019 17:53:26 +0000 (18:53 +0100)] 
Refactor Libffi and RTS rules

This removes a hack that copies libffi files to the rts
build directory. This was done in a libffi rule, but now
an rts rule correctly needs and copies the relevant
files from the libffi build dir to the rts build dir.

Issues: #16272 #16304

3 months agoInclude CPP preprocessor dependencies in -M output
David Eichmann [Tue, 9 Apr 2019 12:17:34 +0000 (13:17 +0100)] 
Include CPP preprocessor dependencies in -M output

Issue #16521

3 months agousers-guide: Fix directive errors on 8.10
Takenobu Tani [Sat, 27 Apr 2019 11:54:21 +0000 (20:54 +0900)] 
users-guide: Fix directive errors on 8.10

The following sections are not displayed due to a directive error:

  * -Wunused-record-wildcards
  * -Wredundant-record-wildcards

I changed the location of the `since` directive.

[skip ci]

3 months agoRecalculate Performance Test Baseline T9630 #16680
David Eichmann [Mon, 20 May 2019 18:45:56 +0000 (19:45 +0100)] 
Recalculate Performance Test Baseline T9630 #16680

Metric Decrease:
    T9630

3 months agoImprove test runner logging when calculating performance metric baseline #16662
David Eichmann [Thu, 16 May 2019 12:19:38 +0000 (13:19 +0100)] 
Improve test runner logging when calculating performance metric baseline #16662

We attempt to get 75 commit hashes via `git log`, but this only gave 10
hashes in a CI run (see #16662). Better logging may help solve this
error if it occurs again in the future.

4 months agorts: Explicit state that CONSTR tag field is zero-based
Ben Gamari [Thu, 16 May 2019 16:47:59 +0000 (12:47 -0400)] 
rts: Explicit state that CONSTR tag field is zero-based

This was a bit unclear as we use both one-based and zero-based
tags in GHC.

[skip ci]

4 months agoHadrian: 'need' source files for various docs in Rules.Documentation
Alp Mestanogullari [Thu, 9 May 2019 13:09:45 +0000 (15:09 +0200)] 
Hadrian: 'need' source files for various docs in Rules.Documentation

Previously, changing one of the .rst files from the user guide would not cause
the user guide to be rebuilt. This patch take a first stab at declaring the
documentation source files that our documentation rules depend on, focusing
on the .rst files only for now.

We eventually might want to rebuild docs when we, say, change the haddock style
file, but this level of tracking isn't really necessary for now.

This fixes #16645.

4 months agoRestore the --coerce option in 'happy' configuration
Vladislav Zavialov [Thu, 9 May 2019 08:01:17 +0000 (11:01 +0300)] 
Restore the --coerce option in 'happy' configuration

happy-1.19.10 has been released with a fix for --coerce in the presence
of higher rank types. This should result in about 10% performance
improvement in the parser.

4 months agoGuard CUSKs behind a language pragma
Vladislav Zavialov [Wed, 8 May 2019 22:53:26 +0000 (01:53 +0300)] 
Guard CUSKs behind a language pragma

GHC Proposal #36 describes a transition plan away from CUSKs and to
top-level kind signatures:

1. Introduce a new extension, -XCUSKs, on by default, that detects CUSKs
   as they currently exist.
2. We turn off the -XCUSKs extension in a few releases and remove it
   sometime thereafter.

This patch implements phase 1 of this plan, introducing a new language
extension to control whether CUSKs are enabled. When top-level kind
signatures are implemented, we can transition to phase 2.

4 months agoAdd a minimized regression test for #12928
Vladislav Zavialov [Wed, 8 May 2019 18:47:38 +0000 (21:47 +0300)] 
Add a minimized regression test for #12928

4 months agoUpdate terminal title while running test-suite
Oleg Grenrus [Wed, 8 May 2019 06:35:15 +0000 (09:35 +0300)] 
Update terminal title while running test-suite

Useful progress indicator even when `make test VERBOSE=1`,
and when you do something else, but have terminal title visible.

4 months agoRemove all target-specific portions of Config.hs
John Ericson [Wed, 27 Mar 2019 04:27:01 +0000 (00:27 -0400)] 
Remove all target-specific portions of Config.hs

1. If GHC is to be multi-target, these cannot be baked in at compile
   time.

2. Compile-time flags have a higher maintenance than run-time flags.

3. The old way makes build system implementation (various bootstrapping
   details) with the thing being built. E.g. GHC doesn't need to care
   about which integer library *will* be used---this is purely a crutch
   so the build system doesn't need to pass flags later when using that
   library.

4. Experience with cross compilation in Nixpkgs has shown things work
   nicer when compiler's can *optionally* delegate the bootstrapping the
   package manager. The package manager knows the entire end-goal build
   plan, and thus can make top-down decisions on bootstrapping. GHC can
   just worry about GHC, not even core library like base and ghc-prim!

4 months agoDont refer to `cLeadingUnderscore` in test
John Ericson [Tue, 7 May 2019 23:09:25 +0000 (19:09 -0400)] 
Dont refer to `cLeadingUnderscore` in test

Can't use this config entry because it's about to go away

4 months agohadrian: Make settings stage specific
John Ericson [Sun, 7 Apr 2019 14:24:03 +0000 (10:24 -0400)] 
hadrian: Make settings stage specific

4 months agoAdd regression test for old parser issue #504
Kevin Buhr [Tue, 7 May 2019 02:40:37 +0000 (21:40 -0500)] 
Add regression test for old parser issue #504

4 months agoChange GHC.hs to Packages.hs in Hadrian user-settings.md
Giles Anderson [Mon, 8 Apr 2019 19:52:51 +0000 (21:52 +0200)] 
Change GHC.hs to Packages.hs in Hadrian user-settings.md

... "all packages that are currently built as part of the GHC are
defined in src/Packages.hs"

4 months agoAdd regression test case for old issue #493
Kevin Buhr [Tue, 7 May 2019 00:24:31 +0000 (19:24 -0500)] 
Add regression test case for old issue #493

4 months agogitlab-ci: Disable cleanup job on Windows
Ben Gamari [Mon, 6 May 2019 13:34:19 +0000 (09:34 -0400)] 
gitlab-ci: Disable cleanup job on Windows

As discussed in the Note, we now have a cron job to handle this and the
cleanup job itself is quite fragile.

[skip ci]

4 months agoHadrian: programs need registered ghc-pkg libraries
David Eichmann [Tue, 30 Apr 2019 11:02:41 +0000 (12:02 +0100)] 
Hadrian: programs need registered ghc-pkg libraries

In Hadrian, building programs (e.g. `ghc` or `haddock`) requires libraries located in the ghc-pkg package database i.e.

    _build/stage1/lib/x86_64-linux-ghc-8.9.0.20190430/libHSdeepseq-1.4.4.0-ghc8.9.0.20190430.so

Add the corresponding `need`s for these library files and the subsequent rules.

4 months agoFix bugs and documentation for #13456
Roland Senn [Sun, 14 Apr 2019 12:21:40 +0000 (14:21 +0200)] 
Fix bugs and documentation for #13456

4 months agoAdd Generic tuple instances up to 15-tuple
Oleg Grenrus [Thu, 11 Apr 2019 13:46:06 +0000 (16:46 +0300)] 
Add Generic tuple instances up to 15-tuple

Why 15? Because we have Eq instances up to 15.

Metric Increase:
    T9630
    haddock.base

4 months agoAdd a regression test for #14548
Vladislav Zavialov [Tue, 7 May 2019 15:17:44 +0000 (18:17 +0300)] 
Add a regression test for #14548

4 months agoAdd regression test for old issue #507
Kevin Buhr [Tue, 7 May 2019 04:32:42 +0000 (23:32 -0500)] 
Add regression test for old issue #507

4 months agoPurge TargetPlatform_NAME and cTargetPlatformString
John Ericson [Wed, 27 Mar 2019 03:48:47 +0000 (23:48 -0400)] 
Purge TargetPlatform_NAME and cTargetPlatformString

4 months agoRegression test for #16627.
Richard Eisenberg [Sat, 4 May 2019 02:04:19 +0000 (22:04 -0400)] 
Regression test for #16627.

test: typecheck/should_fail/T16627

4 months agoPrint PAP object address in stg_PAP_info entry code
Ömer Sinan Ağacan [Thu, 2 May 2019 10:48:09 +0000 (13:48 +0300)] 
Print PAP object address in stg_PAP_info entry code

Continuation to ce23451c

4 months agostg_floatToWord32zh: zero-extend the Word32 (#16617)
Kevin Buhr [Wed, 1 May 2019 22:13:33 +0000 (17:13 -0500)] 
stg_floatToWord32zh: zero-extend the Word32 (#16617)

The primop stgFloatToWord32 was sign-extending the 32-bit word, resulting
in weird negative Word32s.  Zero-extend them instead.

Closes #16617.

4 months agoImplement ImportQualifiedPost
Shayne Fletcher [Tue, 7 May 2019 21:35:50 +0000 (17:35 -0400)] 
Implement ImportQualifiedPost

4 months agoFix #16632 by using the correct SrcSpan in checkTyClHdr
Ryan Scott [Tue, 7 May 2019 12:56:30 +0000 (08:56 -0400)] 
Fix #16632 by using the correct SrcSpan in checkTyClHdr

`checkTyClHdr`'s case for `HsTyVar` was grabbing the wrong `SrcSpan`,
which lead to error messages pointing to the wrong location. Easily
fixed.

4 months agoFix #16603 by documenting some important changes in changelogs
Ryan Scott [Sat, 4 May 2019 15:05:20 +0000 (11:05 -0400)] 
Fix #16603 by documenting some important changes in changelogs

This addresses some glaring omissions from
`libraries/base/changelog.md` and
`docs/users_guide/8.8.1-notes.rst`, fixing #16603 in the process.

4 months agoAdd regression test for old typechecking issue #505
Kevin Buhr [Tue, 7 May 2019 02:42:33 +0000 (21:42 -0500)] 
Add regression test for old typechecking issue #505

4 months agoCheck for duplicate variables in associated default equations
Ryan Scott [Mon, 6 May 2019 18:49:44 +0000 (14:49 -0400)] 
Check for duplicate variables in associated default equations

A follow-up to !696's, which attempted to clean up the error messages
for ill formed associated type family default equations. The previous
attempt, !696, forgot to account for the possibility of duplicate
kind variable arguments, as in the following example:

```hs
class C (a :: j) where
  type T (a :: j) (b :: k)
  type T (a :: k) (b :: k) = k
```

This patch addresses this shortcoming by adding an additional check
for this. Fixes #13971 (hopefully for good this time).

4 months agoAdd /includes/dist to .gitignore
Ryan Scott [Sat, 4 May 2019 14:30:47 +0000 (10:30 -0400)] 
Add /includes/dist to .gitignore

As of commit d37d91e9a444a7822eef1558198d21511558515e, the GHC build
now autogenerates a `includes/dist/build/settings` file. To avoid
dirtying the current `git` status, this adds `includes/dist` to
`.gitignore`.

[ci skip]

4 months agoHadrian: override $(ghc-config-mk), to prevent redundant config generation
Alp Mestanogullari [Tue, 23 Apr 2019 12:46:42 +0000 (14:46 +0200)] 
Hadrian: override $(ghc-config-mk), to prevent redundant config generation

This required making the 'ghc-config-mk' variable overridable in
testsuite/mk/boilerplate.mk, and then making use of this in hadrian
to point to '<build root>/test/ghcconfig' instead, which is where we
always put the test config.

Previously, we would build ghc-config and run it against the
GHC to be tested, a second time, while we're running the tests, because some
include testsuite/mk/boilerplate.mk. This was causing unexpected output
failures.

4 months agoEnable external interpreter when TH is requested but no internal interpreter is available
Alp Mestanogullari [Fri, 3 May 2019 10:21:44 +0000 (12:21 +0200)] 
Enable external interpreter when TH is requested but no internal interpreter is available

4 months agoRemove `$(TOP)/ANNOUNCE` file
Takenobu Tani [Mon, 29 Apr 2019 09:12:31 +0000 (18:12 +0900)] 
Remove `$(TOP)/ANNOUNCE` file

Remove `$(TOP)/ANNOUNCE` because maintaining this file is expensive
for each release.

Currently, release announcements of ghc are made on ghc blogs and wikis.

[skip ci]

4 months agoRemove cGhcEnableTablesNextToCode
John Ericson [Wed, 27 Mar 2019 04:27:01 +0000 (00:27 -0400)] 
Remove cGhcEnableTablesNextToCode

Get "Tables next to code" from the settings file instead.

4 months ago'warnSpaceAfterBang' only in patterns (#16619)
Vladislav Zavialov [Thu, 2 May 2019 04:42:16 +0000 (07:42 +0300)] 
'warnSpaceAfterBang' only in patterns (#16619)

4 months agoFix #16593 by having only one definition of -fprint-explicit-runtime-reps
Chaitanya Koparkar [Fri, 19 Apr 2019 13:50:54 +0000 (09:50 -0400)] 
Fix #16593 by having only one definition of -fprint-explicit-runtime-reps

[skip ci]

4 months ago[ typo ] 'castFloatToWord32' -> 'castFloatToWord64'
gallais [Fri, 3 May 2019 08:24:21 +0000 (04:24 -0400)] 
[ typo ] 'castFloatToWord32' -> 'castFloatToWord64'

Probably due to a copy/paste gone wrong.

4 months agoFix typo in 8.8.1 notes related to traceBinaryEvent
iustin [Fri, 26 Apr 2019 13:07:33 +0000 (09:07 -0400)] 
Fix typo in 8.8.1 notes related to traceBinaryEvent

- fixes double mention of `traceBinaryEvent#` (the second one should be `traceEvent#`, I think)
- fixes note about `traceEvent#` taking a `String` - the docs say it takes a zero-terminated ByteString.

4 months agoPrimOps.cmm: remove unused stuff
Ömer Sinan Ağacan [Fri, 3 May 2019 05:13:57 +0000 (08:13 +0300)] 
PrimOps.cmm: remove unused stuff

4 months agoStgCmmMonad: remove emitProc_, don't export emitProc
Ömer Sinan Ağacan [Fri, 3 May 2019 05:12:48 +0000 (08:12 +0300)] 
StgCmmMonad: remove emitProc_, don't export emitProc

4 months agorts: Properly free the RTSSummaryStats structure
Ömer Sinan Ağacan [Wed, 1 May 2019 15:40:33 +0000 (18:40 +0300)] 
rts: Properly free the RTSSummaryStats structure

`stat_exit` always allocates a `RTSSummaryStats` but only sometimes
frees it, which casues leaks. With this patch we unconditionally free
the structure, fixing the leak.

Fixes #16584