[Git][ghc/ghc][wip/andreask/elem_rule_fix] 273 commits: Document GMP build [skip ci]

Andreas Klebinger gitlab at gitlab.haskell.org
Wed Apr 1 15:54:19 UTC 2020



Andreas Klebinger pushed to branch wip/andreask/elem_rule_fix at Glasgow Haskell Compiler / GHC


Commits:
f82a2f90 by Sylvain Henry at 2020-02-12T01:56:46-05:00
Document GMP build [skip ci]

- - - - -
da7f7479 by Sylvain Henry at 2020-02-12T01:57:27-05:00
Module hierarchy: ByteCode and Runtime (cf #13009)

Update haddock submodule

- - - - -
04f51297 by Ömer Sinan Ağacan at 2020-02-12T01:58:11-05:00
Fix naming of tests for #12923

- - - - -
31fc3321 by Ömer Sinan Ağacan at 2020-02-12T01:58:11-05:00
Add regression test for #12926

Closes #12926

- - - - -
f0c0ee7d by Krzysztof Gogolewski at 2020-02-12T01:58:51-05:00
Fix order of arguments in specializer (#17801)

See https://gitlab.haskell.org/ghc/ghc/issues/17801#note_253330

No regression test, as it's hard to trigger.

- - - - -
059c3c9d by Sebastian Graf at 2020-02-12T11:00:58+01:00
Separate CPR analysis from the Demand analyser

The reasons for that can be found in the wiki:
https://gitlab.haskell.org/ghc/ghc/wikis/nested-cpr/split-off-cpr

We now run CPR after demand analysis (except for after the final demand
analysis run just before code gen). CPR got its own dump flags
(`-ddump-cpr-anal`, `-ddump-cpr-signatures`), but not its own flag to
activate/deactivate. It will run with `-fstrictness`/`-fworker-wrapper`.

As explained on the wiki page, this step is necessary for a sane Nested
CPR analysis. And it has quite positive impact on compiler performance:

Metric Decrease:
    T9233
    T9675
    T9961
    T15263

- - - - -
f5ffd8d9 by Ben Gamari at 2020-02-12T17:22:37-05:00
base: Expose GHC.Unicode.unicodeVersion

This exposes a Data.Version.Version representing the version of the
Unicode database used by `base`. This should clear up some confusion I
have seen in tickets regarding with which Unicode versions a given GHC
can be expected to work.

While in town I also regenerated (but did not update) the Unicode
database with database 12.0.0. Strangely, the file cited in the README
no longer existed. Consequently, I used
https://www.unicode.org/Public/12.0.0/ucd/UnicodeData.txt and was
slightly surprised to find that there were a few changes.

- - - - -
6c2585e0 by Ben Gamari at 2020-02-12T17:22:37-05:00
base: Update Unicode database to 12.1.0

Using `curl https://www.unicode.org/Public/12.1.0/ucd/UnicodeData.txt |
libraries/base/cbits/ubconfc 12.1.0`.

- - - - -
df084681 by Krzysztof Gogolewski at 2020-02-12T23:58:52+01:00
Always display inferred variables using braces

We now always show "forall {a}. T" for inferred variables,
previously this was controlled by -fprint-explicit-foralls.

This implements part 1 of https://github.com/ghc-proposals/ghc-proposals/pull/179.

Part of GHC ticket #16320.

Furthermore, when printing a levity restriction error, we now display
the HsWrap of the expression. This lets users see the full elaboration with
-fprint-typechecker-elaboration (see also #17670)

- - - - -
16d643cf by Sylvain Henry at 2020-02-13T09:16:04-05:00
Remove -ddump-srts flag

This flag is deemed not useful.

- - - - -
fa28ae95 by Sylvain Henry at 2020-02-13T09:16:04-05:00
Fix flag documentation (#17826)

- - - - -
1bfd8259 by Sylvain Henry at 2020-02-13T09:16:43-05:00
Ensure that Hadrian is built correctly before using it

When Hadrian failed to build, the script would pick a previously built
Hadrian (if available) instead of failing.

- - - - -
cd6e786a by Ömer Sinan Ağacan at 2020-02-14T05:29:56-05:00
Add test for #17648

- - - - -
9f2c3677 by Sylvain Henry at 2020-02-14T05:30:39-05:00
GMP expects the Target platform as --host parameter

- - - - -
aa6086fd by Oleg Grenrus at 2020-02-14T05:31:16-05:00
Add explicit LANGUAGE Safe to template-haskell


(cherry picked from commit a5e0f376821ca882880b03b07b451aa574e289ec)
- - - - -
af6a0c36 by Ben Gamari at 2020-02-14T05:31:53-05:00
hadrian: Add execution and target architecture to stage-compilation figure

- - - - -
cf739945 by Sylvain Henry at 2020-02-14T05:32:37-05:00
Module hierarchy: HsToCore (cf #13009)

- - - - -
719db318 by Simon Peyton Jones at 2020-02-14T05:33:16-05:00
De-duplicate overlapping Notes

Documentation only.  Fixes #17827

- - - - -
7550417a by Sylvain Henry at 2020-02-14T05:33:56-05:00
Hadrian: drop Sphinx flag checking for PDF documentation (#17825)

It seems that Sphinx produces the ghc-flags.txt in
doc/users_guide/_build rather than pdfRoot. We could copy ghc-flags.txt
into pdfRoot (like happens naturally in the HTML case) but the benefit
is pretty small. Let's just only check the HTML case.

- - - - -
813842f4 by Ben Gamari at 2020-02-14T10:16:36-05:00
make: Be more selective in building windows-extra-src tarball

- - - - -
0725f4bb by Ben Gamari at 2020-02-14T10:16:36-05:00
Rework handling of win32 toolchain tarballs

- - - - -
565ce7ae by Ben Gamari at 2020-02-14T10:16:36-05:00
gitlab-ci: Consolidate CI logic

This moves nearly all of the CI logic to .gitlab/ci.sh. This improves
things in a number of ways:

 * it's harder for inconsistencies to arise between architectures
 * it's easier to share logic between architectures
 * on Windows, it's easier to ensure that all CI steps are executed from
   within a properly initialized mingw session.

While in town I also add a FreeBSD build job and update the Windows job
to use the gitlab-runner PowerShell executor, since cmd.exe will be
deprecated soon (fixing #17699).

- - - - -
9cbace74 by Ben Gamari at 2020-02-14T10:16:36-05:00
gitlab-ci: Deduplicate nightly job configuration

- - - - -
6e837144 by Ben Gamari at 2020-02-14T10:16:36-05:00
integer-gmp: Fix unused command-line argument

-L is only needed during linking.

- - - - -
e5ee07ab by Ben Gamari at 2020-02-14T10:16:36-05:00
testsuite: Don't ask sed to operate in-place on symlinks

Some sed implementations (e.g. FreeBSD) refuse to operate in-place on
symlinks.

- - - - -
71e5e68f by Ben Gamari at 2020-02-14T10:16:36-05:00
testsuite: Disable tests that assume name of libstdc++ on FreeBSD

- - - - -
7b2da0f4 by Ben Gamari at 2020-02-14T10:16:36-05:00
testsuite: Mark T6132 as broken on FreeBSD

- - - - -
8ef7a15a by Ben Gamari at 2020-02-14T10:16:36-05:00
testsuite/T16930: Don't rely on gnu grep specific --include

In BSD grep this flag only affects directory recursion.

- - - - -
6060003e by Ben Gamari at 2020-02-14T10:16:36-05:00
Pass -Wno-unused-command-line-arguments during link on FreeBSD

FreeBSD cc throws a warning if we pass -pthread without actually using
any pthread symbols.

- - - - -
97497bae by Ben Gamari at 2020-02-14T10:16:36-05:00
base: Always clamp reads/writes to 2GB in length

Previously we did this only on Darwin due to #17414. However, even on
other platforms >2GB writes are on shaky ground. POSIX explicitly says
that the result is implementation-specified and Linux will write at most
0x7ffff000, even on 64-bit platforms. Moreover, getting the sign
of the syscall result correct is tricky, as demonstrated by the fact
that T17414 currently fails on FreeBSD.

For simplicity we now just uniformly clamp to 0x7ffff000 on all
platforms.

- - - - -
49be2a3f by Ben Gamari at 2020-02-14T10:16:36-05:00
configure: Fix sphinx version test

The check for the "v" prefix is redundant.

- - - - -
f7f7a556 by Ben Gamari at 2020-02-14T10:16:37-05:00
users-guide: Fix unknown link targets

- - - - -
a204102c by Ben Gamari at 2020-02-14T10:16:37-05:00
docs/compare-flags: Don't use python f-strings

- - - - -
92e15a37 by Ben Gamari at 2020-02-14T10:16:37-05:00
gitlab-ci: Fix various shellcheck warnings

- - - - -
459f7c6e by Ben Gamari at 2020-02-14T10:16:37-05:00
hadrian: Drop empty arguments from target list

Fixes #17748.

- - - - -
c06df28d by Ben Gamari at 2020-02-14T10:16:37-05:00
users-guide: Fix "invalid file" failure

I have no idea how this worked previously. Different Python version?

- - - - -
3fe8444f by Ben Gamari at 2020-02-14T10:16:59-05:00
testsuite: Mark T7702 as fragile on Windows

Due to #16799. There was previously an attempt to mark it as broken but
the `opsys` name was incorrect.

- - - - -
fe02f781 by Ben Gamari at 2020-02-14T10:16:59-05:00
testsuite: Assert the opsys names are known

Previously opsys would take any string. This meant it was very easy for
a typo to silently render the predicate ineffective. Fix this by
checking the given operating system name against a list of known values.

- - - - -
149e2a3a by Ben Gamari at 2020-02-14T10:16:59-05:00
compare-flags: Don't rely on encoding flag of subprocess.check_output

Apparently it isn't supported by some slightly older Python versions.

- - - - -
798d59f6 by Ben Gamari at 2020-02-14T10:16:59-05:00
rts: Add more debug output to failed path in onIOComplete

This will help track down #17035.

- - - - -
e35f3f98 by Ben Gamari at 2020-02-14T10:16:59-05:00
gitlab-ci: Allow i386 Windows builds to fail again

Due to the resistance of #17736 to resolution.

- - - - -
261a3cf8 by Ben Gamari at 2020-02-14T10:17:00-05:00
gitlab-ci: Build integer-simple job in the validate flavour

- - - - -
b613a961 by Ben Gamari at 2020-02-14T10:17:00-05:00
gitlab-ci: Always use mingw64 python on Windows

- - - - -
1bc8c8cd by Ben Gamari at 2020-02-14T10:17:00-05:00
gitlab-ci: Allow Windows build to fail due to #17777

The fact that `exec` isn't POSIX compliant means that things can break
in arbitrarily bad ways. Sometimes things happen to work correctly but
sadly this isn't always the case.

- - - - -
ac63020d by Ben Gamari at 2020-02-14T10:17:00-05:00
gitlab-ci: Drop unnecessary GHC_VERSION check

- - - - -
6926f369 by Ben Gamari at 2020-02-14T10:17:00-05:00
Bump process submodule

Folds in the second part of Phyx's Windows process exit fixes [1],
hopefully finally resolving issue #17480.

[1] https://github.com/haskell/process/pull/160

- - - - -
584eee71 by Tamar Christina at 2020-02-14T10:17:00-05:00
SysTools: Use "process job" when spawning processes on Windows

GHC should make calls using process jobs when calling out to GCC and LD.
The reason is these use the exec () family of posix functions.  Window's
process model doesn't allow replacement of processes so this is emulated
by creating a new process and immediately exiting the old one.  Because
of this when using normal Windows wait functions you would return even
without the child process having finished.  In this case if you are
depending on data from the child you will enter a race condition.

The usual fix for this is to use process jobs and wait for the
termination of all children that have ever been spawn by the process you
called. But also waiting for the freeing of all resources.

- - - - -
ecabfa28 by Tamar Christina at 2020-02-14T10:17:00-05:00
Revert "compiler: Disable atomic renaming on Windows"

The original reason this was disabled should be fixed by the previous
commit.

This reverts commit 1c1b63d63efe8b0f789aa7d5b87cfac3edd213eb.

- - - - -
06d60c66 by Ben Gamari at 2020-02-14T10:17:00-05:00
Bump Cabal submodule

- - - - -
8cabb384 by Ben Gamari at 2020-02-14T10:17:00-05:00
compare-flags: Fix output

- - - - -
8cf646d3 by Ben Gamari at 2020-02-14T10:17:00-05:00
users-guide: Document -ddump-srts

- - - - -
932307a5 by Ben Gamari at 2020-02-14T10:17:00-05:00
users-guide: Fix broken reference

- - - - -
e77818de by Ben Gamari at 2020-02-15T09:26:55-05:00
Accept performance changes

These manifested in the integer-simple job.

Metric Decrease:
    T12227
    T5549
    T14936
    T4830
    Conversions
    T5237
    T8766
    T4801
    T10359

Metric Increase:
    T12234
    T6048
    T3294
    T14683
    T3064
    T9872b
    T9872c
    T783
    T5837
    T10678
    T14697
    T5631
    T9203
    T13719
    T12707
    T13056
    T9630
    T10547
    T9872d
    T1969
    WWRec
    T10370
    T5321FD
    haddock.Cabal
    T5642
    T9872a
    T15263
    T12425
    MultiLayerModules
    T5205
    T9233
    T13379
    haddock.base
    T9020
    T13035
    T12150
    T9961

- - - - -
785008c1 by Ben Gamari at 2020-02-15T09:30:13-05:00
testsuite: Sort test names in expected change output

- - - - -
9e851472 by Ömer Sinan Ağacan at 2020-02-16T10:38:41+03:00
Revert "users-guide: Document -ddump-srts"

This reverts commit 8cf646d36b02b8ea1c289cb52781c9171853b514.

The flag was removed by 16d643cf.

[ci skip]

- - - - -
9792c816 by Ben Gamari at 2020-02-16T09:47:08-05:00
testsuite: Probe whether symlinks are usable on Windows

Closes #17706.

- - - - -
ee1e5342 by Vladislav Zavialov at 2020-02-16T09:47:44-05:00
Fix the "unused terminals: 2" warning in Parser.y

- - - - -
b4a8ce52 by Roland Senn at 2020-02-18T20:14:42-05:00
If a :reload finds syntax errors in the module graph, remove the loaded modules. (Fixes #17549)

The processing in `compiler/main/GhcMake.hs` computes the ModuleGraph. If it finds errors
in the module header or in the import specifications, then the new module graph is
incomplete and should not be used.
The code before #17549 just reported the errors and left the old ModuleGraph in place.
The new code of this MR replaces the old ModuleGraph with an empty one.

- - - - -
d7029cc0 by Sylvain Henry at 2020-02-18T20:15:30-05:00
Hadrian: refactor GMP in-tree build support (#17756)

* Hadrian doesn't use integer-gmp/config.mk file anymore to determine if
  building GMP in-tree is required.

  "config.mk" is created by Cabal when the integer-gmp package is
  configured and this file is still untracked by Hadrian. This led to a
  tricky configure "race" because "config.mk" is built by the
  "setup-config" rule, but this rule is also used to find dependencies,
  in particular the "ghc-gmp.h" header, but the creation of this file
  was depending (without being tracked) on "config.mk".

  Now Hadrian only builds in-tree GMP if `--with-intree-gmp` is passed
  to the top-level configure script.

* in-tree GMP isn't built once for all in a fixed stage (Stage1)
  anymore. It is built per stage which is required if we build a
  cross-compiler

* switching between in-tree and external GMP is now supported without
  having to clean the build directory first.

* "wrappers.c" now includes "ghc-gmp.h" instead of "ghc.h". It
  helps ensuring that the build system generates "ghc-gmp.h".

* build in-tree GMP in "<root>/stageN/gmp/gmpbuild" and produce useful
  artefacts (libgmp.a, gmp.h, objs/*.o) in "<root>/stageN/gmp"

- - - - -
40d917fb by Vladislav Zavialov at 2020-02-18T20:16:07-05:00
Remove the MonadFail P instance

There were two issues with this instance:

* its existence meant that a pattern match failure in the P monad would
  produce a user-visible parse error, but the error message would not be
  helpful to the user

* due to the MFP migration strategy, we had to use CPP in Lexer.x,
  and that created issues for #17750

Updates haddock submodule.

- - - - -
5a1ce45d by Joshua Price at 2020-02-18T20:16:47-05:00
Fix unboxed tuple size limit (#17837)

- - - - -
192caf58 by Vladislav Zavialov at 2020-02-18T20:17:24-05:00
Fix testsuite driver output (#17847)

- - - - -
1500f089 by Sylvain Henry at 2020-02-18T20:18:12-05:00
Modules: Llvm (#13009)

- - - - -
d53e81c0 by Niklas Hambüchen at 2020-02-20T10:36:22-05:00
8.10 Release notes for atomic .o writes [skip ci]

- - - - -
19680ee5 by Niklas Hambüchen at 2020-02-20T10:37:53-05:00
8.10 Release notes for --disable-delayed-os-memory-return [skip ci]

- - - - -
74ad75e8 by Simon Peyton Jones at 2020-02-20T21:17:57-05:00
Re-implement unsafe coercions in terms of unsafe equality proofs

(Commit message written by Omer, most of the code is written by Simon
and Richard)

See Note [Implementing unsafeCoerce] for how unsafe equality proofs and
the new unsafeCoerce# are implemented.

New notes added:

- [Checking for levity polymorphism] in CoreLint.hs
- [Implementing unsafeCoerce] in base/Unsafe/Coerce.hs
- [Patching magic definitions] in Desugar.hs
- [Wiring in unsafeCoerce#] in Desugar.hs

Only breaking change in this patch is unsafeCoerce# is not exported from
GHC.Exts, instead of GHC.Prim.

Fixes #17443
Fixes #16893

NoFib
-----

--------------------------------------------------------------------------------
        Program           Size    Allocs    Instrs     Reads    Writes
--------------------------------------------------------------------------------
             CS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            CSD          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             FS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              S          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             VS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            VSD          -0.1%      0.0%     -0.0%     -0.0%     -0.1%
            VSM          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           anna          -0.0%      0.0%     -0.0%     -0.0%     -0.0%
           ansi          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           atom          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         awards          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         banner          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
     bernouilli          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   binary-trees          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          boyer          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         boyer2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           bspt          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      cacheprof          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       calendar          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       cichelli          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        circsim          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       clausify          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
  comp_lab_zift          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       compress          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      compress2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
    constraints          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   cryptarithm1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   cryptarithm2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            cse          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   digits-of-e1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   digits-of-e2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         dom-lt          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          eliza          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          event          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
    exact-reals          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         exp3_8          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         expert          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
 fannkuch-redux          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          fasta          -0.1%      0.0%     -0.5%     -0.3%     -0.4%
            fem          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            fft          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           fft2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       fibheaps          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           fish          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          fluid          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         fulsom          -0.1%      0.0%     +0.0%     +0.0%     +0.0%
         gamteb          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            gcd          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
    gen_regexps          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         genfft          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             gg          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           grep          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         hidden          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            hpg          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            ida          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          infer          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        integer          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      integrate          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   k-nucleotide          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          kahan          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        knights          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         lambda          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
     last-piece          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           lcss          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           life          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           lift          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         linear          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      listcompr          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       listcopy          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       maillist          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         mandel          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        mandel2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           mate          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        minimax          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        mkhprog          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
     multiplier          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         n-body          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       nucleic2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           para          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      paraffins          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         parser          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        parstof          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            pic          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       pidigits          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          power          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         pretty          -0.1%      0.0%     -0.1%     -0.1%     -0.1%
         primes          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      primetest          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         prolog          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         puzzle          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         queens          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        reptile          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
reverse-complem          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        rewrite          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           rfib          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            rsa          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            scc          -0.1%      0.0%     -0.1%     -0.1%     -0.1%
          sched          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            scs          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         simple          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          solid          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        sorting          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
  spectral-norm          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         sphere          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         symalg          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            tak          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      transform          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       treejoin          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      typecheck          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        veritas          -0.0%      0.0%     -0.0%     -0.0%     -0.0%
           wang          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      wave4main          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   wheel-sieve1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
   wheel-sieve2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           x2n1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
--------------------------------------------------------------------------------
            Min          -0.1%      0.0%     -0.5%     -0.3%     -0.4%
            Max          -0.0%      0.0%     +0.0%     +0.0%     +0.0%
 Geometric Mean          -0.1%     -0.0%     -0.0%     -0.0%     -0.0%

Test changes
------------

- break006 is marked as broken, see #17833
- The compiler allocates less when building T14683 (an unsafeCoerce#-
  heavy happy-generated code) on 64-platforms. Allocates more on 32-bit
  platforms.
- Rest of the increases are tiny amounts (still enough to pass the
  threshold) in micro-benchmarks. I briefly looked at each one in a
  profiling build: most of the increased allocations seem to be because
  of random changes in the generated code.

Metric Decrease:
    T14683

Metric Increase:
    T12150
    T12234
    T12425
    T13035
    T14683
    T5837
    T6048

Co-Authored-By: Richard Eisenberg <rae at cs.brynmawr.edu>
Co-Authored-By: Ömer Sinan Ağacan <omeragacan at gmail.com>

- - - - -
6880d6aa by Sylvain Henry at 2020-02-20T21:18:48-05:00
Disentangle DynFlags and SDoc

Remove several uses of `sdocWithDynFlags`. The remaining ones are mostly
CodeGen related (e.g. depend on target platform constants) and will be
fixed separately.

Metric Decrease:
   T12425
   T9961
   WWRec
   T1969
   T14683

- - - - -
70a90110 by Julien Debon at 2020-02-20T21:19:27-05:00
doc(List): Add examples to GHC.List

* Add examples
* Cleanup documentation
* Clarify merge process and Marge bot

- - - - -
c8439fc7 by Peter Trommler at 2020-02-20T21:20:05-05:00
Fix testsuite on powerpc64le

Remove expect broken on recomp tests, #11260 was closed
by !2264 and #11323 most likely by !2264 as well.

GHCi scripts tests work on GHCi but not the external interpreter,
adjust test configuration accordingly. Fixes unexpected passes.

Mark test requiring DWARF expect fail on powerpc64[le] for #11261.

- - - - -
65b7256a by Ömer Sinan Ağacan at 2020-02-20T21:20:45-05:00
Use concatMap(M) instead of `concat . map` and the monadic variant

- - - - -
8b76d457 by Roland Senn at 2020-02-20T21:21:28-05:00
Fix #17832: Weird handling of exports named main in 8.10-rc1

Switching from `lookupGlobalOccRn_maybe` to `lookupInfoOccRn`
to check whether a `main` function is in scope. Unfortunately
`lookupGlobalOccRn_maybe` complains if there are multiple `main`
functions in scope.

- - - - -
466e1ad5 by Krzysztof Gogolewski at 2020-02-20T21:22:11-05:00
Use TTG for HsSplicedT constructor

The constructor HsSplicedT occurs only in the GhcTc pass.
This enforces this fact statically via TTG.

- - - - -
4e622fca by Alexis King at 2020-02-20T21:22:49-05:00
Normalize types when dropping absent arguments from workers

fixes #17852

- - - - -
a533e547 by Adam Sandberg Eriksson at 2020-02-20T21:23:31-05:00
Mention users guide and release notes in merge request template
- - - - -
05251b17 by Ben Gamari at 2020-02-20T21:24:08-05:00
gitlab-ci: Fix typo in BIN_DIST_PREP_TAR_COMP variable name
- - - - -
f44c7e67 by Ben Gamari at 2020-02-20T21:24:46-05:00
gitlab-ci: Avoid duplicating ~/.cabal contents with every build

Previously our attempt to cache the cabal store would
`cp cabal-cache ~/.cabal`. However, if the latter already
 existed this meant that we would end up with
~/.cabal/cabal-cache. Not only would this not help caching
but it would exponentially grow the size of ~/.cabal. Not
good!
- - - - -
c5ec9965 by Ben Gamari at 2020-02-20T21:56:13-05:00
GHC.Hs.Extension: Use Type instead of *

- - - - -
89cb4cc4 by Ben Gamari at 2020-02-20T21:56:13-05:00
Use Type instead of * in GHC

- - - - -
04eb0d6c by Ben Gamari at 2020-02-20T21:56:13-05:00
Enable -Wstar-is-type in -Wall

As noted in [proposal 0143][proposal] this is supposed to happen in
8.12.

Also fix an incorrect claim in the users guide that -Wstar-is-type is
enabled by default.

[proposal]: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0143-remove-star-kind.rst

- - - - -
6de966f1 by Andreas Klebinger at 2020-02-20T21:56:15-05:00
Fix #17724 by having occAnal preserve used bindings.

It sometimes happened that occAnal would remove bindings
as dead code by relying on bindings to be in dependency
order. The fix was contributed by SPJ.

- - - - -
abd7f962 by Ben Gamari at 2020-02-20T21:56:15-05:00
users-guide: Mention dependency on `exceptions` in release notes

Fixes #17845.

- - - - -
58175379 by Sylvain Henry at 2020-02-20T21:56:20-05:00
Hadrian: minor GMP refactoring

Somehow I forgot to totally remove `gmpContext` in
d7029cc09edc052c2f97effe33233c53340fcce0. This patch fixes it and adds
some additional comments.

- - - - -
33fa8d94 by Ryan Scott at 2020-02-20T21:56:21-05:00
Generalize liftData to work over any Quote (#17857)

The Overloaded Quotations proposal generalized the type of `lift`
to work over any `Quote`, but not the type of `liftData`, leading
to #17857. Thankfully, generalizing `liftData` is extremely
straightforward.

Fixes #17857.

- - - - -
3cea6795 by Sylvain Henry at 2020-02-20T21:56:23-05:00
Make: fix sdist target (#17848)

- - - - -
e2cce997 by Sylvain Henry at 2020-02-20T21:56:23-05:00
Hadrian: fix source-dist target (#17849)

- - - - -
0a4c89b2 by Matthew Pickering at 2020-02-21T20:44:45-05:00
Special case `mkTyConApp liftedTypeKind []`

We really need to make sure that these are shared because otherwise GHC
will allocate thousands of identical `TyConApp` nodes.

See #17292

-------------------------
Metric Decrease:
    haddock.Cabal
    T14683
-------------------------

- - - - -
0482f58a by Matthew Pickering at 2020-02-21T20:45:21-05:00
TH: wrapGenSyns, don't split the element type too much

The invariant which allowed the pervious method of splitting the type of
the body to find the type of the elements didn't work in the new
overloaded quotation world as the type can be something like
`WriterT () m a` rather than `Q a` like before.

Fixes #17839

- - - - -
be7068a6 by Vladislav Zavialov at 2020-02-21T20:45:59-05:00
Parser API annotations: RealSrcLoc

During parsing, GHC collects lexical information about AST nodes and
stores it in a map. It is needed to faithfully restore original source
code, e.g. compare these expressions:

	a =  b
	a  = b

The position of the equality sign is not recorded in the AST, so it must
be stored elsewhere.

This system is described in Note [Api annotations].

Before this patch, the mapping was represented by:

	Map (SrcSpan, AnnKeywordId) SrcSpan

After this patch, the mapping is represented by:

	Map (RealSrcSpan, AnnKeywordId) RealSrcSpan

The motivation behind this change is to avoid using the Ord SrcSpan
instance (required by Map here), as it interferes with #17632 (see the
discussion there).

SrcSpan is isomorphic to  Either String RealSrcSpan,  but we shouldn't
use those strings as Map keys. Those strings are intended as hints to
the user, e.g. "<interactive>" or "<compiler-generated code>", so they
are not a valid way to identify nodes in the source code.

- - - - -
240f5bf6 by Sylvain Henry at 2020-02-21T20:46:40-05:00
Modules: Driver (#13009)

submodule updates: nofib, haddock

- - - - -
9d094111 by Sylvain Henry at 2020-02-21T20:47:19-05:00
Hadrian: `docs` rule needs `configure` (#17840)

- - - - -
1674353a by Ben Gamari at 2020-02-23T17:31:19-05:00
fs: Port fixes from ghc-jailbreak repository

* Override rename, unlink, and remove
* Factor out wchar conversion

- - - - -
853210f2 by Adam Sandberg Ericsson at 2020-02-23T17:32:03-05:00
show gcc linker options in configure summary

- - - - -
2831544a by Adam Sandberg Ericsson at 2020-02-23T17:32:44-05:00
hadrian: docs depend on stage1 ghc

- - - - -
1d9df9e0 by Adam Sandberg Ericsson at 2020-02-23T17:33:23-05:00
ci: after 5ce63d52fed the linux bindist for doc-tarball has changed name

- - - - -
26e8fff3 by Vladislav Zavialov at 2020-02-24T02:05:30-05:00
Remove Ord SrcLoc, Ord SrcSpan

Before this patch, GHC relied on Ord SrcSpan to identify source elements, by
using SrcSpan as Map keys:

	blackList :: Map SrcSpan ()      -- compiler/GHC/HsToCore/Coverage.hs
	instanceMap :: Map SrcSpan Name  -- compiler/GHC/HsToCore/Docs.hs

Firstly, this design is not valid in presence of UnhelpfulSpan, as it
distinguishes between  UnhelpfulSpan "X"  and  UnhelpfulSpan "Y", but those
strings are messages for the user, unfit to serve as identifiers for source
elements.

Secondly, this design made it hard to extend SrcSpan with additional data.
Recall that the definition of SrcSpan is:

	data SrcSpan =
	    RealSrcSpan !RealSrcSpan
	  | UnhelpfulSpan !FastString

Say we want to extend the RealSrcSpan constructor with additional information:

	data SrcSpan =
	    RealSrcSpan !RealSrcSpan !AdditionalInformation
	  | UnhelpfulSpan !FastString

	getAdditionalInformation :: SrcSpan -> AdditionalInformation
	getAdditionalInformation (RealSrcSpan _ a) = a

Now, in order for  Map SrcSpan  to keep working correctly, we must *ignore* additional
information when comparing SrcSpan values:

	instance Ord SrcSpan where
	  compare (RealSrcSpan r1 _) (RealSrcSpan r2 _) = compare r1 r2
	  ...

However, this would violate an important law:

	a == b  therefore  f a == f b

Ignoring  AdditionalInformation  in comparisons would mean that with
f=getAdditionalInformation, the law above does not hold.

A more robust design is to avoid  Ord SrcSpan  altogether, which is what this patch implements.
The mappings are changed to use RealSrcSpan instead:

	blackList :: Set RealSrcSpan         -- compiler/GHC/HsToCore/Coverage.hs
	instanceMap :: Map RealSrcSpan Name  -- compiler/GHC/HsToCore/Docs.hs

All SrcSpan comparisons are now done with explicit comparison strategies:

	SrcLoc.leftmost_smallest
	SrcLoc.leftmost_largest
	SrcLoc.rightmost_smallest

These strategies are not subject to the law mentioned above and can easily
discard both the string stored in  UnhelpfulSpan  and  AdditionalInformation.

Updates haddock submodule.

- - - - -
5aa6c188 by Ben Gamari at 2020-02-24T02:06:09-05:00
users-guide: Shuffle text

- - - - -
e3f17413 by Ben Gamari at 2020-02-24T02:06:09-05:00
users-guide: Drop old release notes

- - - - -
84dd9610 by Ben Gamari at 2020-02-24T02:06:09-05:00
Bump directory submodule to 1.3.6.0

- - - - -
e295a024 by Stefan Pavikevik at 2020-02-24T20:53:44-05:00
check for safe arguments, raising error when invalid (fix #17720)

- - - - -
354e2787 by Krzysztof Gogolewski at 2020-02-24T20:54:35-05:00
Comments, small refactor

* Remove outdated Note [HsForAllTy tyvar binders] and [Context quantification].
  Since the wildcard refactor 1e041b7382, HsForAllTy no longer has an flag
  controlling explicity. The field `hsq_implicit` is gone too.
  The current situation is covered by Note [HsType binders] which is already
  linked from LHsQTyVars.
* Small refactor in CoreLint, extracting common code to a function
* Remove "not so sure about WpFun" in TcEvidence, per Richard's comment
  https://gitlab.haskell.org/ghc/ghc/merge_requests/852#note_223226
* Use mkIfThenElse in Foreign/Call, as it does exactly what we need.

- - - - -
1b1067d1 by Sylvain Henry at 2020-02-24T20:55:25-05:00
Modules: CmmToAsm (#13009)

- - - - -
621468f6 by Alexis King at 2020-02-26T15:08:09-05:00
Treat coercions as arguments for floating and inlining

This reverts commit 8924224ecfa065ebc67b96a90d01cf9d2edd0e77
and fixes #17787.

- - - - -
def486c9 by Ben Gamari at 2020-02-26T15:08:47-05:00
hadrian: Allow libnuma library path to be specified

- - - - -
ed03d4e7 by Ben Gamari at 2020-02-26T15:08:47-05:00
hadrian: Refactor gmp arguments

Move the gmp configuration to its own binding.

- - - - -
09b88384 by Ben Gamari at 2020-02-26T15:08:47-05:00
hadrian: Tell Cabal about integer-gmp library location

- - - - -
161e08c5 by Krzysztof Gogolewski at 2020-02-26T15:09:30-05:00
Remove dead code

* FailablePattern can no longer be created since ab51bee40c82
  Therefore, Opt_WarnMissingMonadFailInstances has no effect anymore.
* XWrap is no longer used, it was moved to an extension field

- - - - -
e0d09db3 by Ben Gamari at 2020-02-26T15:10:09-05:00
gitlab-ci: Use 8.8.3 to bootstrap on Windows

This should fix #17861.

- - - - -
972bcf3a by Ben Gamari at 2020-02-26T15:10:09-05:00
testsuite: Fix symlink test

Needs to `write` bytes, not str.

- - - - -
273e60de by Ben Gamari at 2020-02-26T15:10:09-05:00
gitlab-ci: Add shell subcommand for debugging within CI environment

- - - - -
43b13ed3 by Ben Gamari at 2020-02-26T15:10:09-05:00
gitlab-ci: Fix colors on Darwin

Darwin sh doesn't support \e.

- - - - -
217546a7 by Ben Gamari at 2020-02-26T15:10:09-05:00
testsuite: Flush stdout buffers in InitEventLogging

Otherwise we are sensitive to libc's buffering strategy.
Similar to the issue fixed in 543dfaab166c81f46ac4af76918ce32190aaab22.

- - - - -
c7d4fa55 by Ben Gamari at 2020-02-26T15:10:09-05:00
gitlab-ci: Add run_hadrian subcommand

I've ruined two trees already by failing to pass --flavour to hadrian.
Let's factor this out so it can be reused during troubleshooting.

- - - - -
7dc54873 by Ben Gamari at 2020-02-26T15:10:09-05:00
testsuite: Allow tests to be marked as broken on the command line

This allows us to work-around distribution-specific breakage easily.

- - - - -
25e2458e by Ben Gamari at 2020-02-26T15:10:09-05:00
hadrian: Add --broken-test flag

This exposes the flag of the same name supported by the testsuite
driver.

- - - - -
55769996 by Ben Gamari at 2020-02-26T15:10:09-05:00
gitlab-ci: Mark some tests as broken on Alpine

- - - - -
9ee7f87d by Ben Gamari at 2020-02-26T15:10:09-05:00
SysTools: Don't use process jobs if they are broken

- - - - -
bfaa3961 by Ben Gamari at 2020-02-26T15:10:09-05:00
Bump hsc2hs submodule

Fixes name of C compiler.

- - - - -
b2b49a0a by Ben Gamari at 2020-02-26T15:10:09-05:00
testsuite: Make hasMetricsFile RHS more descriptive

- - - - -
817f93ea by Sylvain Henry at 2020-02-26T15:10:58-05:00
Modules: Core (#13009)

Update haddock submodule

- - - - -
74311e10 by Sebastian Graf at 2020-02-27T16:22:45-05:00
PmCheck: Implement Long-distance information with Covered sets

Consider

```hs
data T = A | B | C

f :: T -> Int
f A = 1
f x = case x of
  A -> 2
  B -> 3
  C -> 4
```

Clearly, the RHS returning 2 is redundant. But we don't currently see
that, because our approximation to the covered set of the inner case
expression just picks up the positive information from surrounding
pattern matches. It lacks the context sensivity that `x` can't be `A`
anymore!

Therefore, we adopt the conceptually and practically superior approach
of reusing the covered set of a particular GRHS from an outer pattern
match. In this case, we begin checking the `case` expression with the
covered set of `f`s second clause, which encodes the information that
`x` can't be `A` anymore. After this MR, we will successfully warn about
the RHS returning 2 being redundant.

Perhaps surprisingly, this was a great simplification to the code of
both the coverage checker and the desugarer.

Found a redundant case alternative in `unix` submodule, so we have to
bump it with a fix.

Metric Decrease:
    T12227

- - - - -
59c023ba by Adam Sandberg Ericsson at 2020-02-27T16:23:25-05:00
configure: correctly generate LIBRARY_template_haskell_VERSION

- - - - -
9be82389 by Krzysztof Gogolewski at 2020-02-28T02:35:35-05:00
boot: Remove remote origin check

Previously, we used relative paths in submodules. When cloning from
GitHub, they had to be manually tweaked.
Since a76b233d we use absolute paths, so this workaround can be removed.

- - - - -
f4b6b594 by Ben Gamari at 2020-02-28T02:36:12-05:00
nonmoving: Fix marking in compact regions

Previously we were tracing the object we were asked to mark, even if it
lives in a compact region. However, there is no need to do this; we need
only to mark the region itself as live.

I have seen a segfault due to this due to the concurrent mark seeing a
an object in the process of being compacted by the mutator.

- - - - -
f97d1fb6 by Alp Mestanogullari at 2020-02-28T02:36:59-05:00
base: use an explicit import list in System.Environment.ExecutablePath

This was making -Werror builds fail on Windows (at least with Hadrian).

- - - - -
66f5d6d6 by Simon Peyton Jones at 2020-02-28T22:03:23-05:00
Improve error handling for VTA + deferred type errors

This fixes #17792

See Note [VTA for out-of-scope functions] in TcExpr

- - - - -
37f12603 by Ilias Tsitsimpis at 2020-02-28T22:04:04-05:00
llvm-targets: Add arm-unknown-linux-gnueabi

Add arm-unknown-linux-gnueabi, which is used by Debian's ARM EABI port
(armel), as an LLVM target.

- - - - -
327b29e1 by Vladislav Zavialov at 2020-02-29T05:06:31-05:00
Monotonic locations (#17632)

When GHC is parsing a file generated by a tool, e.g. by the C preprocessor, the
tool may insert #line pragmas to adjust the locations reported to the user.

As the result, the locations recorded in RealSrcLoc are not monotonic. Elements
that appear later in the StringBuffer are not guaranteed to have a higher
line/column number.

In fact, there are no guarantees whatsoever, as #line pragmas can arbitrarily
modify locations. This lack of guarantees makes ideas such as #17544
infeasible.

This patch adds an additional bit of information to every SrcLoc:

	newtype BufPos = BufPos { bufPos :: Int }

A BufPos represents the location in the StringBuffer, unaffected by any
pragmas.

Updates haddock submodule.

Metric Increase:
    haddock.Cabal
    haddock.base
    haddock.compiler
    MultiLayerModules
    Naperian
    parsing001
    T12150

- - - - -
99d2de86 by Ben Gamari at 2020-02-29T05:07:10-05:00
plugins: Ensure that loadInterface plugins can see annotations

loadInterface replaces the `mi_decls`, `mi_insts`, `mi_fam_insts`,
`mi_rules`, `mi_anns` fields of ModIface with `undefined` before
inserting the interface into the EPS. However, we still want to give
loadInterface plugins access to these fields. Consequently, we want to
pass the unmodified `ModIface` the plugin.

- - - - -
a999ee96 by Xavier Denis at 2020-02-29T05:07:50-05:00
Rename ghci.sh and build.sh to ghci and build respectively

Convert hadrian buildscripts to unsuffixed, dashed form

final cleanups

- - - - -
b5fb58fd by Ömer Sinan Ağacan at 2020-02-29T05:08:36-05:00
Document and refactor a few things around bitmap scavenging

- Added a few comments in StgPAP
- Added a few comments and assertions in scavenge_small_bitmap and
  walk_large_bitmap
- Did tiny refactor in GHC.Data.Bitmap: added some comments, deleted
  dead code, used PlatformWordSize type.

- - - - -
18757cab by Sylvain Henry at 2020-02-29T05:09:25-05:00
Refactor runtime interpreter code

In #14335 we want to be able to use both the internal interpreter (for
the plugins) and the external interpreter (for TH and GHCi) at the same
time.

This patch performs some preliminary refactoring: the `hsc_interp` field
of HscEnv replaces `hsc_iserv` and is now used to indicate which
interpreter (internal, external) to use to execute TH and GHCi.

Opt_ExternalInterpreter flag and iserv options in DynFlags are now
queried only when we set the session DynFlags. It should help making GHC
multi-target in the future by selecting an interpreter according to the
selected target.

- - - - -
b86a6395 by Adam Sandberg Ericsson at 2020-02-29T05:10:06-05:00
docs: correct relative links to haddocks from users guide (fixes #17866)

- - - - -
0f55df7f by Adam Sandberg Ericsson at 2020-02-29T05:10:06-05:00
docs: correct link to th haddocks from users guide

- - - - -
252e5117 by Jean-Baptiste Mazon at 2020-02-29T05:10:46-05:00
rts: enforce POSIX numeric locale for heap profiles

- - - - -
34c7d230 by Sylvain Henry at 2020-02-29T05:11:27-05:00
Fix Hadrian's ``--configure`` (fix #17883)

- - - - -
04d30137 by Ömer Sinan Ağacan at 2020-02-29T05:12:06-05:00
Simplify IfaceIdInfo type

IfaceIdInfo type is confusing: there's practically no difference between
`NoInfo` and `HasInfo []`. The comments say NoInfo is used when
-fomit-interface-pragmas is enabled, but we don't need to distinguish
`NoInfo` from `HasInfo []` in when reading the interface so the
distinction is not important.

This patch simplifies the type by removing NoInfo. When we have no info
we use an empty list.

With this change we no longer read the info list lazily when reading an
IfaceInfoItem, but when reading an IfaceId the ifIdInfo field is
read lazily, so I doubt this is going to be a problem.

- - - - -
3979485b by Roland Senn at 2020-02-29T17:36:59+01:00
Show breakpoint locations of breakpoints which were ignored during :force (#2950)

GHCi is split up into 2 major parts: The user-interface (UI)
and the byte-code interpreter. With `-fexternal-interpreter`
they even run in different processes. Communication between
the UI and the Interpreter (called `iserv`) is done using
messages over a pipe. This is called `Remote GHCI` and
explained in the Note [Remote GHCi] in `compiler/ghci/GHCi.hs`.

To process a `:force` command the UI sends a `Seq` message
to the `iserv` process. Then `iserv` does the effective
evaluation of the value. When during this process a breakpoint
is hit, the `iserv` process has no additional information to
enhance the `Ignoring breakpoint` output with the breakpoint
location.

To be able to print additional breakpoint information,
there are 2 possible implementation choices:
1. Store the needed information in the `iserv` process.
2. Print the `Ignoring breakpoint` from the UI process.

For option 1 we need to store the breakpoint info redundantely
in 2 places and this is bad. Therfore option 2 was implemented
in this MR:
- The user enters a `force` command
- The UI sends  a `Seq` message to the `iserv` process.
- If processing of the `Seq` message hits a breakpoint,
  the `iserv` process returns control to the UI process.
- The UI looks up the source location of the breakpoint,
  and prints the enhanced `Ignoring breakpoint` output.
- The UI sends a `ResumeSeq` message to the `iserv` process,
  to continue forcing.

- - - - -
3cf7303b by Krzysztof Gogolewski at 2020-03-02T01:18:33-05:00
Remove dead code

* The names in PrelName and THNames are no longer used
  since TH merged types and kinds, Typeable is kind-polymorphic,
  .net support was removed
* unqualQuasiQuote no longer used since 6f8ff0bbad3b9fa3

- - - - -
dbea7e9d by Ilias Tsitsimpis at 2020-03-02T01:19:12-05:00
Do not define hs_atomic{read,write}64() on non-64bit

Do not define hs_atomicread64() and hs_atomicwrite64() on machines where
WORD_SIZE_IN_BITS is less than 64, just like we do with the rest of the atomic
functions which work on 64-bit values.

Without this, compilation fails on MIPSel and PowerPC with the following error:

/usr/bin/ld: /<<PKGBUILDDIR>>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicread64':
atomic.c:(.text.hs_atomicread64+0x8): undefined reference to `__sync_add_and_fetch_8'
/usr/bin/ld: /<<PKGBUILDDIR>>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicwrite64':
atomic.c:(.text.hs_atomicwrite64+0x38): undefined reference to `__sync_bool_compare_and_swap_8'

Fixes #17886.

- - - - -
7c0c76fb by Roland Senn at 2020-03-02T17:13:55-05:00
Set `ImpredicativeTypes` during :print command. (#14828)

If ImpredicativeTypes is not enabled, then `:print <term>` will fail if the
type of <term> has nested `forall`s or `=>`s.
This is because the GHCi debugger's internals will attempt to unify a
metavariable with the type of <term> and then display the result, but if the
type has nested `forall`s or `=>`s, then unification will fail.
As a result, `:print` will bail out and the unhelpful result will be
`<term> = (_t1::t1)` (where `t1` is a metavariable).

Beware: <term> can have nested `forall`s even if its definition doesn't use
RankNTypes! Here is an example from #14828:

  class Functor f where
    fmap :: (a -> b) -> f a -> f b

Somewhat surprisingly, `:print fmap` considers the type of fmap to have
nested foralls. This is because the GHCi debugger sees the type
`fmap :: forall f. Functor f => forall a b. (a -> b) -> f a -> f b`.
We could envision deeply instantiating this type to get the type
`forall f a b. Functor f => (a -> b) -> f a -> f b`,
but this trick wouldn't work for higher-rank types.

Instead, we adopt a simpler fix: enable `ImpredicativeTypes` when using
`:print` and friends in the GHCi debugger. This is allows metavariables
to unify with types that have nested (or higher-rank) `forall`s/`=>`s,
which makes `:print fmap` display as
`fmap = (_t1::forall a b. Functor f => (a -> b) -> f a -> f b)`, as expected.

Although ImpredicativeTypes is a somewhat unpredictable from a type inference
perspective, there is no danger in using it in the GHCi debugger, since all
of the terms that the GHCi debugger deals with have already been typechecked.

- - - - -
2a2f51d7 by Sylvain Henry at 2020-03-02T17:14:38-05:00
Use configure script to detect that we should use in-tree GMP on Windows

- - - - -
8c663c2c by Andreas Klebinger at 2020-03-04T16:12:14+01:00
Be explicit about how stack usage of mvar primops are covered.

This fixes #17893

[skip-ci]

- - - - -
cedd6f30 by Ben Gamari at 2020-03-05T14:53:12-05:00
rts: Add getCurrentThreadCPUTime helper

- - - - -
ace618cd by Ben Gamari at 2020-03-05T14:53:12-05:00
nonmoving-gc: Track time usage of nonmoving marking

- - - - -
022b5ad5 by Ben Gamari at 2020-03-05T14:53:12-05:00
Stats: Add sync pauses to +RTS -S output

- - - - -
06763234 by Ben Gamari at 2020-03-05T14:53:12-05:00
rts: Report nonmoving collector statistics in machine-readable output

- - - - -
70d2b995 by Ben Gamari at 2020-03-09T06:10:52-04:00
nonmoving: Fix collection of sparks

Previously sparks living in the non-moving heap would be promptly GC'd
by the minor collector since pruneSparkQueue uses the BF_EVACUATED flag,
which non-moving heap blocks do not have set.

Fix this by implementing proper support in pruneSparkQueue for
determining reachability in the non-moving heap. The story is told in
Note [Spark management in the nonmoving heap].

- - - - -
9668781a by Ben Gamari at 2020-03-09T06:11:30-04:00
gitlab-ci: Disable Sphinx documentation in Alpine build
- - - - -
8eb2c263 by Jean-Baptiste Mazon at 2020-03-09T16:33:37-04:00
Fix Windows breakage by not touching locales on Windows

- - - - -
b8dab057 by Jean-Baptiste Mazon at 2020-03-09T16:33:37-04:00
rts: ensure C numerics in heap profiles using Windows locales if needed

- - - - -
7d95260f by Jean-Baptiste Mazon at 2020-03-09T16:33:37-04:00
rts: refactor and comment profile locales

- - - - -
5b627813 by Ryan Scott at 2020-03-09T16:34:14-04:00
Use InstanceSigs in GND/DerivingVia-generated code (#17899)

Aside from making the generated code easier to read when
`-ddump-deriv` is enabled, this makes the error message in `T15073`
substantially simpler (see the updated `T15073` expected stderr).

Fixes #17899.

- - - - -
70b50778 by Ben Gamari at 2020-03-10T02:05:42-04:00
SysTools: Ensure that error parser can handle absolute paths on Windows

This fixes #17786, where the error parser fails to correctly handle the
drive name in absolute Windows paths.

Unfortunately I couldn't find a satisfactory way to test this.

- - - - -
85b861d8 by Ben Gamari at 2020-03-10T02:05:42-04:00
testsuite: Add test for #17786

This isn't pretty but it's perhaps better than nothing.

- - - - -
ee2c50cb by Sylvain Henry at 2020-03-10T02:06:33-04:00
Hadrian: track missing configure results

- - - - -
ca8f51d4 by Ömer Sinan Ağacan at 2020-03-10T02:07:22-04:00
Add regression test for T17904

Closes #17904

- - - - -
5fa9cb82 by Richard Eisenberg at 2020-03-10T12:29:46-04:00
anyRewritableTyVar now looks in RuntimeReps

Previously, anyRewritableTyVar looked only at the arg and res
of `arg -> res`, but their RuntimeReps are also subject to
rewriting. Easy to fix.

Test case: typecheck/should_compile/T17024

Fixes #17024.

- - - - -
5ba01d83 by Ben Price at 2020-03-10T12:30:27-04:00
Clarify a Lint message

When developing a plugin I had a shadowing problem, where I generated
code
  app = \f{v r7B} x{v r7B} -> f{v r7B} x{v r7B}
This is obviously wrong, since the occurrence of `f` to the right of the
arrow refers to the `x` binder (they share a Unique). However, it is
rather confusing when Lint reports
  Mismatch in type between binder and occurrence
  Var: x{v rB7}
since it is printing the binder, rather than the occurrence.
It is rather easy to read this as claiming there is something wrong with
the `x` occurrence!

We change the report to explicitly print both the binder and the
occurrence variables.

- - - - -
7b2c827b by Simon Peyton Jones at 2020-03-10T12:31:15-04:00
Comments only

Clarify code added in #17852 and MR !2724

- - - - -
3300eeac by Krzysztof Gogolewski at 2020-03-10T12:31:54-04:00
Misc cleanup

- Remove Note [Existentials in shift_con_pat].
  The function shift_con_pat has been removed 15 years ago in 23f40f0e9be6d4.
- Remove kcLookupTcTyCon - it's the same as tcLookupTcTyCon
- Remove ASSERT in tyConAppArgN. It's already done by getNth,
  and it's the only reason getNth exists.
- Remove unused function nextRole

- - - - -
abf5736b by Krzysztof Gogolewski at 2020-03-10T18:05:01+01:00
Typos in comments [skip ci]

- - - - -
bb586f89 by Ben Gamari at 2020-03-11T00:14:59-04:00
rts: Prefer darwin-specific getCurrentThreadCPUTime

macOS Catalina now supports a non-POSIX-compliant version of clock_gettime
which cannot use the clock_gettime codepath.

Fixes #17906.

- - - - -
20800b9a by Sylvain Henry at 2020-03-11T08:17:19-04:00
Split GHC.Iface.Utils module

* GHC.Iface.Recomp: recompilation avoidance stuff
* GHC.Iface.Make: mkIface*

Moved `writeIfaceFile` into GHC.Iface.Load alongside `readIface` and
renamed it `writeIface` for consistency.

- - - - -
1daa2029 by Greg Steuck at 2020-03-11T08:17:56-04:00
Fixed a minor typo in codegen.rst
- - - - -
0bc23338 by Ryan Scott at 2020-03-11T08:18:32-04:00
Re-quantify when generalising over rewrite rule types

Previously, `tcRules` would check for naughty quantification
candidates (see `Note [Naughty quantification candidates]` in
`TcMType`) when generalising over the type of a rewrite rule. This
caused sensible-looking rewrite rules (like those in #17710) to be
rejected. A more permissing (and easier-to-implement) approach is to
do what is described in `Note [Generalising in tcTyFamInstEqnGuts]`
in `TcTyClsDecls`: just re-quantify all the type variable binders,
regardless of the order in which the user specified them. After all,
the notion of type variable specificity has no real meaning in
rewrite rules, since one cannot "visibly apply" a rewrite rule.
I have written up this wisdom in
`Note [Re-quantify type variables in rules]` in `TcRules`.

As a result of this patch, compiling the `ExplicitForAllRules1` test
case now generates one fewer warning than it used to. As far as I can
tell, this is benign, since the thing that the disappearing warning
talked about was also mentioned in an entirely separate warning.

Fixes #17710.

- - - - -
336eac7e by Ben Gamari at 2020-03-11T08:19:08-04:00
testsuite: Mark ghci056 and ghcilink004 as fragile in unreg

As noted in #17018.

Also fix fragile declaration of T13786, which only runs in the normal
way.

- - - - -
c61b9b02 by Simon Peyton Jones at 2020-03-11T08:19:44-04:00
Deepen call stack for isIn

I see quite a few warnings like:

  WARNING: file compiler/utils/Util.hs, line 593
    Over-long elem in unionLists

But the call stack is uninformative.   Better to add HasDebugCallStack
to isIn.  Ditto isn'tIn.

- - - - -
3aa9b35f by Ömer Sinan Ağacan at 2020-03-11T08:20:27-04:00
Zero any slop after compaction in compacting GC

In copying GC, with the relevant debug flags enabled, we release the old
blocks after a GC, and the block allocator zeroes the space before
releasing a block. This effectively zeros the old heap.

In compacting GC we reuse the blocks and previously we didn't zero the
unused space in a compacting generation after compaction. With this
patch we zero the slop between the free pointer and the end of the block
when we're done with compaction and when switching to a new block
(because the current block doesn't have enough space for the next object
we're shifting).

- - - - -
8e6febce by Sylvain Henry at 2020-03-11T20:33:37-04:00
Refactor GHC.Driver.Session (Ways and Flags)

* extract flags and ways into their own modules (with some renaming)

* remove one SOURCE import of GHC.Driver.Session from GHC.Driver.Phases

* when GHC uses dynamic linking (WayDyn), `interpWays` was only
  reporting WayDyn even if the host was profiled (WayProf).  Now it
  returns both as expected (might fix #16803).

* `mkBuildTag :: [Way] -> String` wasn't reporting a canonical tag for
  differently ordered lists. Now we sort and nub the list to fix this.

- - - - -
bc41e471 by Sylvain Henry at 2020-03-11T20:33:37-04:00
Refactor interpreterDynamic and interpreterProfiled

* `interpreterDynamic` and `interpreterProfiled` now take `Interp`
  parameters instead of DynFlags

* slight refactoring of `ExternalInterp` so that we can read the iserv
  configuration (which is pure) without reading an MVar.

- - - - -
a6989971 by Sylvain Henry at 2020-03-11T20:33:37-04:00
Use a Set to represent Ways

Should make `member` queries faster and avoid messing up with missing
`nubSort`.

Metric Increase:
    hie002

- - - - -
cb93a1a4 by Ryan Scott at 2020-03-11T20:34:14-04:00
Make DeriveFunctor-generated code require fewer beta reductions

Issue #17880 demonstrates that `DeriveFunctor`-generated code is
surprisingly fragile when rank-_n_ types are involved. The culprit is
that `$fmap` (the algorithm used to generate `fmap` implementations)
was too keen on applying arguments with rank-_n_ types to lambdas,
which fail to typecheck more often than not.

In this patch, I change `$fmap` (both the specification and the
implementation) to produce code that avoids creating as many lambdas,
avoiding problems when rank-_n_ field types arise.
See the comments titled "Functor instances" in `TcGenFunctor` for a
more detailed description. Not only does this fix #17880, but it also
ensures that the code that `DeriveFunctor` generates will continue
to work after simplified subsumption is implemented (see #17775).

What is truly amazing is that #17880 is actually a regression
(introduced in GHC 7.6.3) caused by commit
49ca2a37bef18aa57235ff1dbbf1cc0434979b1e, the fix #7436. Prior to
that commit, the version of `$fmap` that was used was almost
identical to the one used in this patch! Why did that commit change
`$fmap` then? It was to avoid severe performance issues that would
arise for recursive `fmap` implementations, such as in the example
below:

```hs
data List a = Nil | Cons a (List a) deriving Functor

-- ===>

instance Functor List where
  fmap f Nil = Nil
  fmap f (Cons x xs) = Cons (f x) (fmap (\y -> f y) xs)
```

The fact that `\y -> f y` was eta expanded caused significant
performance overheads. Commit
49ca2a37bef18aa57235ff1dbbf1cc0434979b1e fixed this performance
issue, but it went too far. As a result, this patch partially
reverts 49ca2a37bef18aa57235ff1dbbf1cc0434979b1e.

To ensure that the performance issues pre-#7436 do not resurface,
I have taken some precautionary measures:

* I have added a special case to `$fmap` for situations where the
  last type variable in an application of some type occurs directly.
  If this special case fires, we avoid creating a lambda expression.
  This ensures that we generate
  `fmap f (Cons x xs) = Cons (f x) (fmap f xs)` in the derived
  `Functor List` instance above. For more details, see
  `Note [Avoid unnecessary eta expansion in derived fmap implementations]`
  in `TcGenFunctor`.
* I have added a `T7436b` test case to ensure that the performance
  of this derived `Functor List`-style code does not regress.

When implementing this, I discovered that `$replace`, the algorithm
which generates implementations of `(<$)`, has a special case that is
very similar to the `$fmap` special case described above. `$replace`
marked this special case with a custom `Replacer` data type, which
was a bit overkill. In order to use the same machinery for both
`Functor` methods, I ripped out `Replacer` and instead implemented
a simple way to detect the special case. See the updated commentary
in `Note [Deriving <$]` for more details.

- - - - -
1f9db3e7 by Kirill Elagin at 2020-03-12T09:45:51-04:00
pretty-printer: Properly parenthesise LastStmt

After ApplicatveDo strips the last `return` during renaming, the pretty
printer has to restore it. However, if the return was followed by `$`,
the dollar was stripped too and not restored.

For example, the last stamement in:

```
  foo = do
    x <- ...
    ...
    return $ f x
```

would be printed as:

```
    return f x
```

This commit preserved the dolar, so it becomes:

```
    return $ f x
```

- - - - -
5cb93af7 by Kirill Elagin at 2020-03-12T09:45:51-04:00
pretty-printer: Do not print ApplicativeDo join

* Do not print `join` in ApplictiveStmt, unless ppr-debug
* Print parens around multiple parallel binds

When ApplicativeDo is enabled, the renamer analyses the statements of a
`do` block and in certain cases marks them as needing to be rewritten
using `join`.

For example, if you have:

```
foo = do
  a <- e1
  b <- e2
  doSomething a b
```

it will be desugared into:

```
foo = join (doSomething <$> e1 <*> e2)
```

After renaming but before desugaring the expression is stored
essentially as:

```
foo = do
  [will need join] (a <- e1 | b <- e2)
  [no return] doSomething a b
```

Before this change, the pretty printer would print a call to `join`,
even though it is not needed at this stage at all. The expression will be
actually rewritten into one using join only at desugaring, at which
point a literal call to join will be inserted.

- - - - -
3a259092 by Simon Peyton Jones at 2020-03-12T09:46:29-04:00
Expose compulsory unfoldings always

The unsafeCoerce# patch requires that unsafeCoerce# has
a compulsory unfolding that is always available.  So we have
to be careful to expose compulsory unfoldings unconditionally
and consistently.

We didn't get this quite right: #17871.  This patch fixes
it.  No real surprises here.

See Note [Always expose compulsory unfoldings] in GHC.Iface.Tidy

- - - - -
6a65b8c2 by Alp Mestanogullari at 2020-03-13T02:29:20-04:00
hadrian: improve dependency tracking for the check-* programs

The code in Rules.Register responsible for finding all the build artifacts
that Cabal installs when registering a library (static/shared libs, .hi files,
...) was looking in the wrong place. This patch fixes that logic and makes sure
we gather all those artifacts in a list to declare that the rule for a given
`.conf` file, our proxy for "Hadrian, please install this package in the package
db for this stage", also produces those artifacts under the said package
database.

We also were completely missing some logic to declare that the check-* programs
have dependencies besides their source code, at least when testing an in-tree
compiler.

Finally, this patch also removes redundant packages from 'testsuitePackages',
since they should already be covered by the stage<N>Packages lists from
Settings.Default.

With this patch, after a complete build and freezing stage 1, a change to
`compiler/parser/Parser.y` results in rebuilding the ghc lib, reinstalling it,
and rebuilding the few programs that depend on it, _including_ `check-ppr` and
`check-api-annotations` (therefore fixing #17273).

- - - - -
44fad4a9 by Sylvain Henry at 2020-03-13T02:30:22-04:00
Rename isDllName

I wanted to fix the dangling comment in `isDllName` ("This is the cause
of #", #8696 is already mentioned earlier). I took the opportunity to
change the function name to better reflect what it does.

- - - - -
2f292db8 by Paavo at 2020-03-13T02:31:03-04:00
Update documentation for closureSize

- - - - -
f124ff0d by Ben Gamari at 2020-03-13T02:31:40-04:00
gitlab-ci: Rework triggering of release builds

Use a push option instead of tagging.

- - - - -
7f25557a by Ben Gamari at 2020-03-13T10:38:09-04:00
gitlab-ci: Distinguish integer-simple test envs

Previously two integer-simple jobs declared the same test environment. One (the nightly job) was built in the perf way, the other in the validate way. Consequently they had appreciably different performance characteristics, causing in the nightly job to spuriously fail with performance changes.
- - - - -
c12a2ec5 by Simon Peyton Jones at 2020-03-14T05:25:30-04:00
Fix Lint

Ticket #17590 pointed out a bug in the way the linter dealt with
type lets, exposed by the new uniqAway story.

The fix is described in Note [Linting type lets]. I ended up
putting the in-scope Ids in a different env field, le_ids,
rather than (as before) sneaking them into the TCvSubst.

Surprisingly tiresome, but done.

Metric Decrease:
    hie002

- - - - -
b989845e by Sylvain Henry at 2020-03-14T05:26:11-04:00
Hadrian: fix absolute buildroot support (#17822)

Shake's "**" wildcard doesn't match absolute root. We must use "//" instead.

- - - - -
4f117135 by Sylvain Henry at 2020-03-14T05:26:49-04:00
Make: refactor GMP rules

Document and use simpler rules for the ghc-gmp.h header.

- - - - -
7432b327 by Sylvain Henry at 2020-03-14T05:27:28-04:00
Use correct option name (-opti) (fix #17314)

s/pgmo/opti

- - - - -
8f7dd571 by Judah Jacobson at 2020-03-14T05:28:07-04:00
Allow overriding LD_STAGE0 and AR_STAGE0 in the configure script.

Previously it was possible to override the stage0 C compiler via `CC_STAGE0`,
but you couldn't override `ld` or `ar` in stage0.  This change allows overriding them
by setting `LD_STAGE0` or `AR_STAGE0`, respectively.

Our team uses this feature internally to take more control of our GHC build
and make it run more hermetically.

- - - - -
7c3e39a9 by Judah Jacobson at 2020-03-14T05:28:07-04:00
Use AC_ARG_VAR for LD_STAGE0 and AR_STAGE0.

- - - - -
20d4d676 by Ben Gamari at 2020-03-14T05:28:43-04:00
nonmoving: Don't traverse filled segment list in pause

The non-moving collector would previously walk the entire filled segment
list during the preparatory pause. However, this is far more work than
is strictly necessary. We can rather get away with merely collecting the
allocators' filled segment list heads and process the lists themselves
during the concurrent phase. This can significantly reduce the maximum
gen1 GC pause time in programs with high rates of long-lived allocations.

- - - - -
fdfa2d01 by Ben Gamari at 2020-03-14T05:29:18-04:00
nonmoving: Remove redundant bitmap clearing

nonmovingSweep already clears the bitmap in the sweep loop. There is no
reason to do so a second time.

- - - - -
2f8c7767 by Simon Peyton Jones at 2020-03-14T05:29:55-04:00
Simple refactor of cheapEqExpr

No change in functionality.  Just seems tidier (and signficantly more
efficient) to deal with ticks directly than to call stripTicksTopE.

- - - - -
88f7a762 by Simon Peyton Jones at 2020-03-14T05:29:55-04:00
Improve CSE.combineAlts

This patch improves the way that CSE combines identical
alternatives.  See #17901.

I'm still not happy about the duplication between CSE.combineAlts
and GHC.Core.Utils.combineIdenticalAlts; see the Notes with those
functions.  But this patch is a step forward.

Metric Decrease:
    T12425
    T5642

- - - - -
8b95ddd3 by Ben Gamari at 2020-03-14T05:30:31-04:00
gitlab-ci: Add integer-simple release build for Windows

Closes #16144.

- - - - -
e3c374cc by Simon Peyton Jones at 2020-03-14T05:31:07-04:00
Wrap an implication around class-sig kind errors

Ticket #17841 showed that we can get a kind error
in a class signature, but lack an enclosing implication
that binds its skolems.

This patch

* Adds the wrapping implication: the new call to
  checkTvConstraints in tcClassDecl1

* Simplifies the API to checkTvConstraints, which
  was not otherwise called at all.

* Simplifies TcErrors.report_unsolved by *not*
  initialising the TidyEnv from the typechecker lexical
  envt.  It's enough to do so from the free vars of the
  unsolved constraints; and we get silly renamings if
  we add variables twice: once from the lexical scope
  and once from the implication constraint.

- - - - -
73133a3b by Simon Peyton Jones at 2020-03-14T05:31:07-04:00
Refactoring in TcSMonad

This patch is just refactoring: no change in
behaviour.

I removed the rather complicated
    checkConstraintsTcS
    checkTvConstraintsTcS

in favour of simpler functions
    emitImplicationTcS
    emitTvImplicationTcS
    pushLevelNoWorkList

The last of these is a little strange, but overall
it's much better I think.

- - - - -
93c88c26 by Ben Gamari at 2020-03-14T05:31:42-04:00
base: Make `open` calls interruptible

As noted in #17912, `open` system calls were `safe` rather than
`interruptible`. Consequently, the program could not be interrupted with
SIGINT if stuck in a slow open operation. Fix this by marking
`c_safe_open` as interruptible.

- - - - -
bee4cdad by Vladislav Zavialov at 2020-03-14T05:32:18-04:00
Remove second tcLookupTcTyCon in tcDataDefn

Before this patch, tcDataDefn used to call tcLookupTcTyCon twice in a row:
	1. in bindTyClTyVars itself
	2. in the continuation passed to it

Now bindTyClTyVars passes the TcTyCon to the continuation, making
the second lookup unnecessary.

- - - - -
3f116d35 by Cale Gibbard at 2020-03-14T19:34:42-04:00
Enable stage1 build of haddock

The submodule has already been bumped to contain the fix.

- - - - -
49e9d739 by Ömer Sinan Ağacan at 2020-03-14T19:35:24-04:00
rts: Fix printClosure when printing fwd ptrs

- - - - -
1de3ab4a by Krzysztof Gogolewski at 2020-03-14T19:36:04-04:00
Remove unused field var_inline (#17915)

- - - - -
d30aeb4b by Krzysztof Gogolewski at 2020-03-15T03:57:41-04:00
Document restriction on SCC pragma syntax

Currently, the names of cost centres must be quoted or
be lowercase identifiers.

Fixes #17916.

- - - - -
b4774598 by Brian Foley at 2020-03-15T03:58:18-04:00
Remove some dead code

>From the notes.ghc.drop list found using weeder in #17713

- - - - -
dd6ffe6b by Viktor Dukhovni at 2020-03-15T03:58:55-04:00
Note platform-specific Foreign.C.Types in context

Also fix the markup in the general note at the top of the module.  Haddock
(usability trade-off), does not support multi-line emphasised text.

- - - - -
2e82465f by Sylvain Henry at 2020-03-15T10:57:10-04:00
Refactor CmmToAsm (disentangle DynFlags)

This patch disentangles a bit more DynFlags from the native code
generator (CmmToAsm).

In more details:

- add a new NCGConfig datatype in GHC.CmmToAsm.Config which contains the
  configuration of a native code generation session
- explicitly pass NCGConfig/Platform arguments when necessary
- as a consequence `sdocWithPlatform` is gone and there are only a few
  `sdocWithDynFlags` left
- remove the use of `unsafeGlobalDynFlags` from GHC.CmmToAsm.CFG
- remove `sdocDebugLevel` (now we pass the debug level via NCGConfig)

There are still some places where DynFlags is used, especially because
of pretty-printing (CLabel), because of Cmm helpers (such as
`cmmExprType`) and because of `Outputable` instance for the
instructions. These are left for future refactoring as this patch is
already big.

- - - - -
c35c545d by Judah Jacobson at 2020-03-15T10:57:48-04:00
Add a -no-haddock flag.

This flag undoes the effect of a previous "-haddock" flag.  Having both flags makes it easier
for build systems to enable Haddock parsing in a set of global flags, but then disable it locally for
specific targets (e.g., third-party packages whose comments don't pass the validation in the latest GHC).

I added the flag to expected-undocumented-flags.txt since `-haddock` was alreadyin that list.

- - - - -
cfcc3c9a by Ömer Sinan Ağacan at 2020-03-15T10:58:27-04:00
Fix global_link of TSOs for threads reachable via dead weaks

Fixes #17785

Here's how the problem occurs:

- In generation 0 we have a TSO that is finished (i.e. it has no more
  work to do or it is killed).

- The TSO only becomes reachable after collectDeadWeakPtrs().

- After collectDeadWeakPtrs() we switch to WeakDone phase where we don't
  move TSOs to different lists anymore (like the next gen's thread list
  or the resurrected_threads list).

- So the TSO will never be moved to a generation's thread list, but it
  will be promoted to generation 1.

- Generation 1 collected via mark-compact, and because the TSO is
  reachable it is marked, and its `global_link` field, which is bogus at
  this point (because the TSO is not in a list), will be threaded.

- Chaos ensues.

In other words, when these conditions hold:

- A TSO is reachable only after collectDeadWeakPtrs()
- It's finished (what_next is ThreadComplete or ThreadKilled)
- It's retained by mark-compact collector (moving collector doesn't
  evacuate the global_list field)

We end up doing random mutations on the heap because the TSO's
global_list field is not valid, but it still looks like a heap pointer
so we thread it during compacting GC.

The fix is simple: when we traverse old_threads lists to resurrect
unreachable threads the threads that won't be resurrected currently
stays on the old_threads lists. Those threads will never be visited
again by MarkWeak so we now reset the global_list fields. This way
compacting GC does not thread pointers to nowhere.

Testing
-------

The reproducer in #17785 is quite large and hard to build, because of
the dependencies, so I'm not adding a regression test.

In my testing the reproducer would take a less than 5 seconds to run,
and once in every ~5 runs would fail with a segfault or an assertion
error. In other cases it also fails with a test failure. Because the
tests never fail with the bug fix, assuming the code is correct, this
also means that this bug can sometimes lead to incorrect runtime
results.

After the fix I was able to run the reproducer repeatedly for about an
hour, with no runtime crashes or test failures.

To run the reproducer clone the git repo:

    $ git clone https://github.com/osa1/streamly --branch ghc-segfault

Then clone primitive and atomic-primops from their git repos and point
to the clones in cabal.project.local. The project should then be
buildable using GHC HEAD. Run the executable `properties` with `+RTS -c
-DZ`.

In addition to the reproducer above I run the test suite using:

    $ make slowtest EXTRA_HC_OPTS="-debug -with-rtsopts=-DS \
        -with-rtsopts=-c +RTS -c -RTS" SKIPWAY='nonmoving nonmoving_thr'

This enables compacting GC always in both GHC when building the test
programs and when running the test programs, and also enables sanity
checking when running the test programs. These set of flags are not
compatible for all tests so there are some failures, but I got the same
set of failures with this patch compared to GHC HEAD.

- - - - -
818b3c38 by Lysxia at 2020-03-16T23:52:42-04:00
base: add strict IO functions: readFile', getContents', hGetContents'

- - - - -
18a346a4 by Sylvain Henry at 2020-03-16T23:53:24-04:00
Modules: Core (#13009)

Update submodule: haddock

- - - - -
92327e3a by Ömer Sinan Ağacan at 2020-03-16T23:54:04-04:00
Update sanity checking for TSOs:

- Remove an invalid assumption about GC checking what_next field. The GC
  doesn't care about what_next at all, if a TSO is reachable then all
  its pointers are followed (other than global_tso, which is only
  followed by compacting GC).

- Remove checkSTACK in checkTSO: TSO stacks will be visited in
  checkHeapChain, or checkLargeObjects etc.

- Add an assertion in checkTSO to check that the global_link field is
  sane.

- Did some refactor to remove forward decls in checkGlobalTSOList and
  added braces around single-statement if statements.

- - - - -
e1aa4052 by PHO at 2020-03-17T07:36:09-04:00
Don't use non-portable operator "==" in configure.ac

The test operator "==" is a Bash extension and produces a wrong result
if /bin/sh is not Bash.

- - - - -
89f034dd by Maximilian Tagher at 2020-03-17T07:36:48-04:00
Document the units of -ddump-timings

Right now, in the output of -ddump-timings to a file, you can't tell what the units are:

```
CodeGen [TemplateTestImports]: alloc=22454880 time=14.597
```

I believe bytes/milliseconds are the correct units, but confirmation would be appreciated. I'm basing it off of this snippet from `withTiming'`:

```
when (verbosity dflags >= 2 && prtimings == PrintTimings)
  $ liftIO $ logInfo dflags (defaultUserStyle dflags)
      (text "!!!" <+> what <> colon <+> text "finished in"
       <+> doublePrec 2 time
       <+> text "milliseconds"
       <> comma
       <+> text "allocated"
       <+> doublePrec 3 (realToFrac alloc / 1024 / 1024)
       <+> text "megabytes")
```

which implies time is in milliseconds, and allocations in bytes (which divided by 1024 would be KB, and again would be MB)

- - - - -
beffa147 by Simon Peyton Jones at 2020-03-17T07:37:25-04:00
Implement mapTyCo like foldTyCo

This patch makes mapType use the successful idiom described
in TyCoRep
   Note [Specialising foldType]

I have not yet changed any functions to use mapType, though there
may be some suitable candidates.

This patch should be a no-op in terms of functionality but,
because it inlines the mapper itself, I'm hoping that there may
be some modest perf improvements.

Metric Decrease:
    T5631
    T5642
    T3064
    T9020
    T14683
    hie002
    haddock.Cabal
    haddock.base
    haddock.compiler

- - - - -
5800ebfe by Ömer Sinan Ağacan at 2020-03-17T07:38:08-04:00
Don't update ModDetails with CafInfos when opts are disabled

This is consistent with the interface file behavior where we omit
HsNoCafRefs annotations with -fomit-interface-pragmas (implied by -O0).

ModDetails and ModIface are just different representations of the same
thing, so they really need to be in sync. This patch does the right
thing and does not need too much explanation, but here's an example of a
problem not doing this causes in !2842:

    -- MyInteger.hs
    module MyInteger
      ( MyInteger (MyInteger)
      , ToMyInteger (toMyInteger)
      ) where

    newtype MyInteger = MyInteger Integer

    class ToMyInteger a where
      toMyInteger :: a -> MyInteger

    instance ToMyInteger Integer where
      toMyInteger = MyInteger {- . succ -}

    -- Main.hs
    module Main
      ( main
      ) where

    import MyInteger (MyInteger (MyInteger), toMyInteger)

    main :: IO ()
    main = do
      let (MyInteger i) = (id . toMyInteger) (41 :: Integer)
      print i

If I build this with -O0, without this fix, we generate a ModDetails with
accurate LFInfo for toMyInteger (MyInteger.$fToMyIntegerInteger) which says that
it's a LFReEntrant with arity 1. This means in the use site (Main) we tag the
value:

    R3 = MyInteger.$fToMyIntegerInteger_closure + 1;
    R2 = GHC.Base.id_closure;
    R1 = GHC.Base.._closure;
    Sp = Sp - 16;
    call stg_ap_ppp_fast(R4, R3, R2, R1) args: 24, res: 0, upd: 24;

Now we change the definition by uncommenting the `succ` part and it becomes a thunk:

    MyInteger.$fToMyIntegerInteger [InlPrag=INLINE (sat-args=0)]
      :: MyInteger.ToMyInteger GHC.Integer.Type.Integer
    [GblId[DFunId(nt)]] =
        {} \u [] $ctoMyInteger_rEA;

and its LFInfo is now LFThunk. This change in LFInfo makes a difference in the
use site: we can no longer tag it.

But becuase the interface fingerprint does not change (because ModIface does not
change) we don't rebuild Main and tag the thunk.

(1.2% increase in allocations when building T12545 on armv7 because we
generate more code without CafInfos)

Metric Increase:
    T12545

- - - - -
5b632dad by Paavo at 2020-03-17T07:38:48-04:00
Add example for Data.Semigroup.diff

- - - - -
4d85d68b by Paavo at 2020-03-17T07:38:48-04:00
Clean up

- - - - -
75168d07 by Paavo at 2020-03-17T07:38:48-04:00
Make example collapsible

- - - - -
53ff2cd0 by Richard Eisenberg at 2020-03-17T13:46:57+00:00
Fix #17021 by checking more return kinds

All the details are in new Note [Datatype return kinds] in
TcTyClsDecls.

Test case: typecheck/should_fail/T17021{,b}
           typecheck/should_compile/T17021a

Updates haddock submodule

- - - - -
528df8ec by Sylvain Henry at 2020-03-18T10:06:43-04:00
Modules: Core operations (#13009)

- - - - -
4e8a71c1 by Richard Eisenberg at 2020-03-18T10:07:19-04:00
Add release note about fix to #16502.

We thought we needed to update the manual, but the fix for #16502
actually brings the implementation in line with the manual. So we
just alert users of how to update their code.

- - - - -
5cbf9934 by Andreas Klebinger at 2020-03-19T00:39:27-04:00
Update "GHC differences to the FFI Chapter" in user guide.

The old entry had a heavy focus on how things had been. Which is
not what I generally look for in a user guide.

I also added a small section on behaviour of nested safe ffi calls.

[skip-ci]

- - - - -
b03fd3bc by Sebastian Graf at 2020-03-19T00:40:06-04:00
PmCheck: Use ConLikeSet to model negative info

In #17911, Simon recognised many warnings stemming from over-long list
unions while coverage checking Cabal's `LicenseId` module.

This patch introduces a new `PmAltConSet` type which uses a `UniqDSet`
instead of an association list for `ConLike`s. For `PmLit`s, it will
still use an assocation list, though, because a similar map data
structure would entail a lot of busy work.

Fixes #17911.

- - - - -
64f20756 by Sylvain Henry at 2020-03-19T12:16:49-04:00
Refactoring: use Platform instead of DynFlags when possible

Metric Decrease:
    ManyConstructors
    T12707
    T13035
    T1969

- - - - -
cb1785d9 by Ömer Sinan Ağacan at 2020-03-19T12:16:54-04:00
FastString: fix eager reading of string ptr in hashStr

This read causes NULL dereferencing when len is 0.

Fixes #17909

In the reproducer in #17909 this bug is triggered as follows:

- SimplOpt.dealWithStringLiteral is called with a single-char string
  ("=" in #17909)

- tailFS gets called on the FastString of the single-char string.

- tailFS checks the length of the string, which is 1, and calls
  mkFastStringByteString on the tail of the ByteString, which is an
  empty ByteString as the original ByteString has only one char.

- ByteString's unsafeUseAsCStringLen returns (NULL, 0) for the empty
  ByteString, which is passed to mkFastStringWith.

- mkFastStringWith gets hash of the NULL pointer via hashStr, which
  fails on empty strings because of this bug.

- - - - -
73a7383e by Richard Eisenberg at 2020-03-20T20:42:56-04:00
Simplify treatment of heterogeneous equality

Previously, if we had a [W] (a :: k1) ~ (rhs :: k2), we would
spit out a [D] k1 ~ k2 and part the W as irreducible, hoping for
a unification. But we needn't do this. Instead, we now spit out
a [W] co :: k2 ~ k1 and then use co to cast the rhs of the original
Wanted. This means that we retain the connection between the
spat-out constraint and the original.

The problem with this new approach is that we cannot use the
casted equality for substitution; it's too like wanteds-rewriting-
wanteds. So, we forbid CTyEqCans that mention coercion holes.

All the details are in Note [Equalities with incompatible kinds]
in TcCanonical.

There are a few knock-on effects, documented where they occur.

While debugging an error in this patch, Simon and I ran into
infelicities in how patterns and matches are printed; we made
small improvements.

This patch includes mitigations for #17828, which causes spurious
pattern-match warnings. When #17828 is fixed, these lines should
be removed.

- - - - -
faa36e5b by Sylvain Henry at 2020-03-20T20:43:41-04:00
Hadrian: ignore in-tree GMP objects with ``--lint``

- - - - -
9a96ff6b by Richard Eisenberg at 2020-03-20T20:44:17-04:00
Update core spec to reflect changes to Core.

Key changes:
 * Adds a new rule for forall-coercions over coercion variables, which
was implemented but conspicuously missing from the spec.
 * Adds treatment for FunCo.
 * Adds treatment for ForAllTy over coercion variables.
 * Improves commentary (including restoring a Note lost in
03d4852658e1b7407abb4da84b1b03bfa6f6db3b) in the source.

No changes to running code.

- - - - -
7e0451c6 by Sergej Jaskiewicz at 2020-03-20T20:44:55-04:00
Fix event message in withTiming'

This typo caused generating 'end' events without the corresponding 'begin' events.

- - - - -
1542a626 by Ben Gamari at 2020-03-22T22:37:47-04:00
fs.h: Add missing declarations on Windows

- - - - -
3bcf2ccd by Ben Gamari at 2020-03-22T22:37:47-04:00
Bump process submodule

Avoids redundant case alternative warning.

- - - - -
3b363ef9 by Ben Gamari at 2020-03-22T22:37:47-04:00
testsuite: Normalize slashes in ghc-api annotations output

Enable `normalise_slashes` on `annotations`, `listcomps`, and
`parseTree` to fix Windows failures.

- - - - -
25fc9429 by Ben Gamari at 2020-03-22T22:37:47-04:00
testsuite: Update expected output on Windows

- - - - -
7f58ec6d by Ben Gamari at 2020-03-22T22:37:47-04:00
testsuite: Fix TOP of T17786

- - - - -
aadcd909 by GHC GitLab CI at 2020-03-22T22:37:47-04:00
testsuite: Update expected output on Windows

- - - - -
dc1eb10d by GHC GitLab CI at 2020-03-22T22:37:47-04:00
hadrian: Fix executable extension passed to testsuite driver

- - - - -
58f62e2c by GHC GitLab CI at 2020-03-22T22:37:47-04:00
gitlab-ci: Require that Windows-hadrian job passes

- - - - -
8dd2415d by Ben Gamari at 2020-03-22T22:37:47-04:00
hadrian: Eliminate redundant .exe from GHC path

Previously we were invoking:

    bash -c
    "c:/GitLabRunner/builds/eEQrxK4p/0/ghc/ghc/toolchain/bin/ghc.exe.exe
    testsuite/mk/ghc-config.hs -o _build/test/bin/ghc-config.exe"

- - - - -
373621f6 by Ben Gamari at 2020-03-22T22:37:47-04:00
Bump hsc2hs submodule

- - - - -
abc02b40 by Hécate at 2020-03-22T22:38:33-04:00
Annotate the non-total function in Data.Foldable as such

- - - - -
19f12557 by Josef Svenningsson at 2020-03-23T14:05:33-04:00
Fix ApplicativeDo regression #17835

A previous fix for #15344 made sure that monadic 'fail' is used properly
when translating ApplicativeDo. However, it didn't properly account
for when a 'fail' will be inserted which resulted in some programs
failing with a type error.

- - - - -
2643ba46 by Paavo at 2020-03-24T08:31:32-04:00
Add example and doc for Arg (Fixes #17153)

- - - - -
703221f4 by Roland Senn at 2020-03-25T14:45:04-04:00
Use export list of Main module in function TcRnDriver.hs:check_main (Fix #16453)

- Provide the export list of the `Main` module as parameter to the
  `compiler/typecheck/TcRnDriver.hs:check_main` function.
- Instead of `lookupOccRn_maybe` call the function `lookupInfoOccRn`.
  It returns the list `mains_all` of all the main functions in scope.
- Select from this list `mains_all` all `main` functions that are in
  the export list of the `Main` module.
- If this new list contains exactly one single `main` function, then
  typechecking continues.
- Otherwise issue an appropriate error message.

- - - - -
3e27205a by Sebastian Graf at 2020-03-25T14:45:40-04:00
Remove -fkill-absence and -fkill-one-shot flags

They seem to be a benchmarking vestige of the Cardinality paper and
probably shouldn't have been merged to HEAD in the first place.

- - - - -
262e42aa by Peter Trommler at 2020-03-25T22:41:39-04:00
Do not panic on linker errors

- - - - -
0de03cd7 by Sylvain Henry at 2020-03-25T22:42:02-04:00
DynFlags refactoring III

Use Platform instead of DynFlags when possible:
* `tARGET_MIN_INT` et al. replaced with `platformMinInt` et al.
* no more DynFlags in PreRules: added a new `RuleOpts` datatype
* don't use `wORD_SIZE` in the compiler
* make `wordAlignment` use `Platform`
* make `dOUBLE_SIZE` a constant

Metric Decrease:
    T13035
    T1969

- - - - -
7a04920b by Tristan Cacqueray at 2020-03-25T22:42:06-04:00
Base: fix a typo in liftA doc

This change removes an extra '|' that should not be rendered in
the liftA documentation.

Tracking: #17929

- - - - -
1c5a15f7 by Tristan Cacqueray at 2020-03-25T22:42:06-04:00
Base: add Control.Applicative optional example

This change adds an optional example.

Tracking: #17929

- - - - -
6d172e63 by Tristan Cacqueray at 2020-03-25T22:42:06-04:00
Base: add markup around Except

- - - - -
eb2162c8 by John Ericson at 2020-03-26T12:37:08-04:00
Remove unused `ghciTablesNextToCode` from compiler proper

- - - - -
f51efc4b by Joachim Breitner at 2020-03-26T12:37:09-04:00
Prepare to use run-time tablesNextToCode in compiler exclusively

Factor out CPP as much as possible to prepare for runtime
determinattion.

Progress towards #15548

- - - - -
1c446220 by Joachim Breitner at 2020-03-26T12:37:09-04:00
Use run-time tablesNextToCode in compiler exclusively (#15548)

Summary:

 - There is no more use of the TABLES_NEXT_TO_CODE CPP macro in
   `compiler/`. GHCI_TABLES_NEXT_TO_CODE is also removed entirely.
   The field within `PlatformMisc` within `DynFlags` is used instead.

 - The field is still not exposed as a CLI flag. We might consider some
   way to ensure the right RTS / libraries are used before doing that.

Original reviewers:

Original subscribers: TerrorJack, rwbarton, carter

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

- - - - -
1941ef4f by Sylvain Henry at 2020-03-29T17:28:51-04:00
Modules: Types (#13009)

Update Haddock submodule

Metric Increase:
   haddock.compiler

- - - - -
1c7c6f1a by Sylvain Henry at 2020-03-29T17:28:51-04:00
Remove GHC.Types.Unique.Map module

This module isn't used anywhere in GHC.

- - - - -
f1a6c73d by Sylvain Henry at 2020-03-29T17:28:51-04:00
Merge GHC.Types.CostCentre.Init into GHC.Driver.CodeOutput

- - - - -
54250f2d by Simon Peyton Jones at 2020-03-29T17:29:30-04:00
Demand analysis: simplify the demand for a RHS

Ticket #17932 showed that we were using a stupid demand for the RHS
of a let-binding, when the result is a product.  This was the result
of a "fix" in 2013, which (happily) turns out to no longer be
necessary.

So I just deleted the code, which simplifies the demand analyser,
and fixes #17932. That in turn uncovered that the anticipation
of worker/wrapper in CPR analysis was inaccurate, hence the logic
that decides whether to unbox an argument in WW was extracted into
a function `wantToUnbox`, now consulted by CPR analysis.

I tried nofib, and got 0.0% perf changes.

All this came up when messing about with !2873 (ticket #17917),
but is idependent of it.

Unfortunately, this patch regresses #4267 and realised that it is now
blocked on #16335.

- - - - -
03060b2f by Ben Gamari at 2020-03-29T17:30:05-04:00
testsuite: Fix T17786 on Windows

Fixes line ending normalization issue.

- - - - -
1f7995ba by Ben Gamari at 2020-03-29T17:30:05-04:00
testsuite: Fix T17786

Fix missing quoting and expected exit code.

- - - - -
ef9c608e by Ben Gamari at 2020-03-29T17:30:05-04:00
testsuite: Mark T12971 as broken on Windows

Due to #17945.

- - - - -
e54500c1 by Sylvain Henry at 2020-03-29T17:30:47-04:00
Store ComponentId details

As far as GHC is concerned, installed package components ("units") are
identified by an opaque ComponentId string provided by Cabal. But we
don't want to display it to users (as it contains a hash) so GHC queries
the database to retrieve some infos about the original source package
(name, version, component name).

This patch caches these infos in the ComponentId itself so that we don't
need to provide DynFlags (which contains installed package informations)
to print a ComponentId.

In the future we want GHC to support several independent package states
(e.g. for plugins and for target code), hence we need to avoid
implicitly querying a single global package state.

- - - - -
7e7cb714 by Marius Bakke at 2020-03-29T17:31:27-04:00
testsuite: Remove test that dlopens a PIE object.

glibc 2.30 disallowed dlopening PIE objects, so just remove the test.
Fixes #17952.

- - - - -
6c8f80d8 by Andreas Klebinger at 2020-03-29T17:32:04-04:00
Correct haddocks for testBit in Data.Bits

It conflated the nth bit with the bit at offset n.

Now we instead give the definition in terms of `bit and `.&.`
on top of clearer phrasing.

- - - - -
c916f190 by Andreas Klebinger at 2020-03-29T17:32:04-04:00
Apply suggestion to libraries/base/Data/Bits.hs
- - - - -
64bf7f51 by Ben Gamari at 2020-03-29T17:32:41-04:00
gitlab-ci: Add FreeBSD release job

- - - - -
a0d8e92e by Ryan Scott at 2020-03-29T17:33:20-04:00
Run checkNewDataCon before constraint-solving newtype constructors

Within `checkValidDataCon`, we used to run `checkValidType` on the
argument types of a newtype constructor before running
`checkNewDataCon`, which ensures that the user does not attempt
non-sensical things such as newtypes with multiple arguments or
constraints. This works out in most situations, but this falls over
on a corner case revealed in #17955:

```hs
newtype T = Coercible () T => T ()
```

`checkValidType`, among other things, peforms an ambiguity check on
the context of a data constructor, and that it turn invokes the
constraint solver. It turns out that there is a special case in the
constraint solver for representational equalities (read: `Coercible`
constraints) that causes newtypes to be unwrapped (see
`Note [Unwrap newtypes first]` in `TcCanonical`). This special case
does not know how to cope with an ill formed newtype like `T`, so
it ends up panicking.

The solution is surprisingly simple: just invoke `checkNewDataCon`
before `checkValidType` to ensure that the illicit newtype
constructor context is detected before the constraint solver can
run amok with it.

Fixes #17955.

- - - - -
45eb9d8c by Krzysztof Gogolewski at 2020-03-29T17:33:59-04:00
Minor cleanup

- Simplify mkBuildExpr, the function newTyVars was called
  only on a one-element list.
- TTG: use noExtCon in more places. This is more future-proof.
- In zonkExpr, panic instead of printing a warning.

- - - - -
f024b6e3 by Sylvain Henry at 2020-03-30T12:48:39+02:00
Expect T4267 to pass

Since 54250f2d8de910b094070c1b48f086030df634b1 we expected T4267 to
fail, but it passes on CI.

- - - - -
57b888c0 by Ryan Scott at 2020-03-31T10:54:20-04:00
Require GHC 8.8 as the minimum compiler for bootstrapping

This allows us to remove several bits of CPP that are either always
true or no longer reachable. As an added bonus, we no longer need to
worry about importing `Control.Monad.Fail.fail` qualified to avoid
clashing with `Control.Monad.fail`, since the latter is now the same
as the former.

- - - - -
33f09551 by Ryan Scott at 2020-03-31T10:54:57-04:00
Add regression test for #17963

The panic in #17963 happened to be fixed by commit
e3c374cc5bd7eb49649b9f507f9f7740697e3f70. This patch adds a
regression test to ensure that it remains fixed.

Fixes #17963.

- - - - -
09a36e80 by Ömer Sinan Ağacan at 2020-03-31T10:55:37-04:00
Simplify stderrSupportsAnsiColors

The combinator andM is used only once, and the code is shorter and
simpler if you inline it.

- - - - -
95bccdd0 by Ben Gamari at 2020-03-31T10:56:19-04:00
base: Ensure that encoding global variables aren't inlined

As noted in #17970, these (e.g. `getFileSystemEncoding` and
`setFileSystemEncoding`) previously had unfoldings, which would
break their global-ness.

While not strictly necessary, I also add a NOINLINE on
`initLocaleEncoding` since it is used in `System.IO`, ensuring that we
only system's query the locale encoding once.

Fixes #17970.

- - - - -
982aaa83 by Andreas Klebinger at 2020-03-31T10:56:55-04:00
Update hadrian index revision.

Required in order to build hadrian using ghc-8.10

- - - - -
4b9c5864 by Ben Gamari at 2020-03-31T10:57:32-04:00
integer-gmp: Bump version and add changelog entry

- - - - -
9b39f2e6 by Ryan Scott at 2020-04-01T01:20:00-04:00
Clean up "Eta reduction for data families" Notes

Before, there were two distinct Notes named
"Eta reduction for data families". This renames one of them to
"Implementing eta reduction for data families" to disambiguate the
two and fixes references in other parts of the codebase to ensure
that they are pointing to the right place.

Fixes #17313.

[ci skip]

- - - - -
7627eab5 by Ryan Scott at 2020-04-01T01:20:38-04:00
Fix the changelog/@since information for hGetContents'/getContents'/readFile'

Fixes #17979.

[ci skip]

- - - - -
0002db1b by Sylvain Henry at 2020-04-01T01:21:27-04:00
Kill wORDS_BIGENDIAN and replace it with platformByteOrder (#17957)

Metric Decrease:
    T13035
    T1969

- - - - -
774d1f47 by Andreas Klebinger at 2020-04-01T17:53:52+02:00
Rework treatment of `elem`. Add UTF8 GHC.CString functions.

We optimize `elem` now in more ways than before.

A fusion RULE for elem was broken preventing it from firing.
Fixing this allows a call to elem on a known list to be translated
into a series of equality checks. These ultimately simply to a
single case expression.

It will also turn into a fold for dynamic lists when list fusion
applies.

This logic however does not work on string literals. For this reason
I added a rule to do the transformation into a case explicitly via a
built in rule. It will fire for any short string literals. (<=32 Bytes).

Longer calls to elem on string literals are rewritten to calls
to elem variants specialized to string literals.

This means we will rewrite:
    * c `elem` (unpackCString "Foo"#) => elemCString# c' "Foo"#
    * c `elem` (unpackCStringUtf8 "Bär"#) => elemCStringUtf8# c' "Bär"#

This means all calls to elem on string literals, as well as many
on other statically known lists should now be allocation free.

As a byproduct GHC.CString functionality is now available for Ascii
and UTF8 strings. The following missing UTF8 variants were
added: unpackAppendCStringUtf8#, unpackFoldrCStringUtf8#

They work just like their ascii counterparts. Which hopefully
makes proper UTF8 support easier for library authors.

A version of `elem` operating on known string literals was added:
* elemCString#     :: Char# -> Addr# -> Bool
* elemCStringUtf8# :: Char# -> Addr# -> Bool

- - - - -


30 changed files:

- .ghcid
- .gitlab-ci.yml
- + .gitlab/ci.sh
- − .gitlab/darwin-init.sh
- .gitlab/linters/check-cpp.py
- .gitlab/merge_request_templates/merge-request.md
- − .gitlab/prepare-system.sh
- − .gitlab/win32-init.sh
- HACKING.md
- aclocal.m4
- boot
- compiler/main/GHC.hs → compiler/GHC.hs
- compiler/ghci/ByteCodeAsm.hs → compiler/GHC/ByteCode/Asm.hs
- compiler/ghci/ByteCodeItbls.hs → compiler/GHC/ByteCode/InfoTable.hs
- compiler/ghci/ByteCodeInstr.hs → compiler/GHC/ByteCode/Instr.hs
- compiler/ghci/ByteCodeLink.hs → compiler/GHC/ByteCode/Linker.hs
- compiler/ghci/ByteCodeTypes.hs → compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/BlockId.hs
- compiler/GHC/Cmm/BlockId.hs-boot
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/CallConv.hs
- compiler/GHC/Cmm/CommonBlockElim.hs
- compiler/GHC/Cmm/Dataflow.hs
- compiler/GHC/Cmm/Dataflow/Block.hs
- compiler/GHC/Cmm/Dataflow/Graph.hs
- compiler/GHC/Cmm/Dataflow/Label.hs
- compiler/GHC/Cmm/DebugBlock.hs
- compiler/GHC/Cmm/Expr.hs
- compiler/GHC/Cmm/Graph.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cf3313927aa8801d9aab740b10bf26778626dcd7...774d1f47016e662eaf0c7ac4189f73439f3beab3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cf3313927aa8801d9aab740b10bf26778626dcd7...774d1f47016e662eaf0c7ac4189f73439f3beab3
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/20200401/75fbe2ff/attachment-0001.html>


More information about the ghc-commits mailing list