[Git][ghc/ghc][wip/nonmoving-fixes] 40 commits: doc: Clarify the default for -fomit-yields

Ben Gamari gitlab at gitlab.haskell.org
Tue Dec 15 15:56:03 UTC 2020



Ben Gamari pushed to branch wip/nonmoving-fixes at Glasgow Haskell Compiler / GHC


Commits:
35e7b0c6 by Kirill Elagin at 2020-12-10T01:45:54-05:00
doc: Clarify the default for -fomit-yields

“Yield points enabled” is confusing (and probably wrong?
I am not 100% sure what it means). Change it to a simple “on”.

Undo this change from 2c23fff2e03e77187dc4d01f325f5f43a0e7cad2.
- - - - -
3551c554 by Kirill Elagin at 2020-12-10T01:45:54-05:00
doc: Extra-clarify -fomit-yields

Be more clear on what this optimisation being on by default means
in terms of yields.
- - - - -
6484f0d7 by Sergei Trofimovich at 2020-12-10T01:46:33-05:00
rts/linker/Elf.c: add missing <dlfcn.h> include (musl support)

The change fixes build failure on musl:

```
rts/linker/Elf.c:2031:3: error:
     warning: implicit declaration of function 'dlclose'; did you mean 'close'? [-Wimplicit-function-declaration]
     2031 |   dlclose(nc->dlopen_handle);
          |   ^~~~~~~
          |   close
```

Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>

- - - - -
ab24ed9b by Ben Gamari at 2020-12-11T03:55:51-05:00
users guide: Fix syntax errors

Fixes errors introduced by 3a55b3a2574f913d046f3a6f82db48d7f6df32e3.

- - - - -
d3a24d31 by Ben Gamari at 2020-12-11T03:55:51-05:00
users guide: Describe GC lifecycle events

Every time I am asked about how to interpret these events I need to
figure it out from scratch. It's well past time that the users guide
properly documents these.

- - - - -
741309b9 by Ben Gamari at 2020-12-11T03:56:27-05:00
gitlab-ci: Fix incorrect Docker image for nightly cross job

Also refactor the job definition to eliminate the bug by construction.

- - - - -
19703bc8 by Ben Gamari at 2020-12-11T03:56:27-05:00
gitlab-ci: Fix name of flavour in ThreadSanitizer job

It looks like I neglected to update this after introduce flavour
transformers.

- - - - -
381eb660 by Sylvain Henry at 2020-12-11T12:57:35-05:00
Display FFI labels (fix #18539)

- - - - -
4548d1f8 by Aaron Allen at 2020-12-11T12:58:14-05:00
Elide extraneous messages for :doc command (#15784)

Do not print `<has no documentation>` alongside a valid doc.
Additionally, if two matching symbols lack documentation then the
message will only be printed once. Hence, `<has no documentation>` will
be printed at most once and only if all matching symbols are lacking
docs.

- - - - -
5eba91b6 by Aaron Allen at 2020-12-11T12:58:14-05:00
Add :doc test case for duplicate record fields

Tests that the output of the `:doc` command is correct for duplicate
record fields defined using -XDuplicateRecordFields.

- - - - -
5feb9b2d by Ryan Scott at 2020-12-11T22:39:29-05:00
Delete outdated Note [Kind-checking tyvar binders for associated types]

This Note has severely bitrotted, as it has no references anywhere in the
codebase, and none of the functions that it mentions exist anymore. Let's just
delete this. While I was in town, I deleted some outdated comments from
`checkFamPatBinders` of a similar caliber.

Fixes #19008.

[ci skip]

- - - - -
f9f9f030 by Sylvain Henry at 2020-12-11T22:40:08-05:00
Arrows: correctly query arrow methods (#17423)

Consider the following code:

    proc (C x y) -> ...

Before this patch, the evidence binding for the Arrow dictionary was
attached to the C pattern:

    proc (C x y) { $dArrow = ... } -> ...

But then when we desugar this, we use arrow operations ("arr", ">>>"...)
specialised for this arrow:

    let
        arr_xy = arr $dArrow -- <-- Not in scope!
        ...
    in
        arr_xy (\(C x y) { $dArrow = ... } -> ...)

This patch allows arrow operations to be type-checked before the proc
itself, avoiding this issue.

Fix #17423

- - - - -
aaa8f00f by Sylvain Henry at 2020-12-11T22:40:48-05:00
Validate script: fix configure command when using stack

- - - - -
b4a929a1 by Sylvain Henry at 2020-12-11T22:41:30-05:00
Hadrian: fix libffi tarball parsing

Fix parsing of "libffi-3.3.tar.gz".

NB: switch to a newer libffi isn't done in this patch

- - - - -
690c8946 by Sylvain Henry at 2020-12-11T22:42:09-05:00
Parser: move parser utils into their own module

Move code unrelated to runtime evaluation out of GHC.Runtime.Eval

- - - - -
76be0e32 by Sylvain Henry at 2020-12-11T22:42:48-05:00
Move SizedSeq into ghc-boot

- - - - -
3a16d764 by Sylvain Henry at 2020-12-11T22:42:48-05:00
ghci: don't compile unneeded modules

- - - - -
2895fa60 by Sylvain Henry at 2020-12-11T22:42:48-05:00
ghci: reuse Arch from ghc-boot

- - - - -
480a38d4 by Sylvain Henry at 2020-12-11T22:43:30-05:00
rts: don't use siginterrupt (#19019)

- - - - -
4af6126d by Sylvain Henry at 2020-12-11T22:44:11-05:00
Use static array in zeroCount

- - - - -
5bd71bfd by Sebastian Graf at 2020-12-12T04:45:09-05:00
DmdAnal: Annotate top-level function bindings with demands (#18894)

It's useful to annotate a non-exported top-level function like `g` in

```hs
module Lib (h) where

g :: Int -> Int -> (Int,Int)
g m 1 = (m, 0)
g m n = (2 * m, 2 `div` n)
{-# NOINLINE g #-}

h :: Int -> Int
h 1 = 0
h m
  | odd m     = snd (g m 2)
  | otherwise = uncurry (+) (g 2 m)
```

with its demand `UCU(CS(P(1P(U),SP(U))`, which tells us that whenever `g` was
called, the second component of the returned pair was evaluated strictly.

Since #18903 we do so for local functions, where we can see all calls.
For top-level functions, we can assume that all *exported* functions are
demanded according to `topDmd` and thus get sound demands for
non-exported top-level functions.

The demand on `g` is crucial information for Nested CPR, which may the
go on and unbox `g` for the second pair component. That is true even if
that pair component may diverge, as is the case for the call site `g 13
0`, which throws a div-by-zero exception.

In `T18894b`, you can even see the new demand annotation enabling us to
eta-expand a function that we wouldn't be able to eta-expand without
Call Arity.

We only track bindings of function type in order not to risk huge compile-time
regressions, see `isInterestingTopLevelFn`.

There was a CoreLint check that rejected strict demand annotations on
recursive or top-level bindings, which seems completely unjustified.
All the cases I investigated were fine, so I removed it.

Fixes #18894.

- - - - -
3aae036e by Sebastian Graf at 2020-12-12T04:45:09-05:00
Demand: Simplify `CU(U)` to `U` (#19005)

Both sub-demands encode the same information.
This is a trivial change and already affects a few regression tests
(e.g. `T5075`), so no separate regression test is necessary.

- - - - -
c6477639 by Adam Sandberg Ericsson at 2020-12-12T04:45:48-05:00
hadrian: correctly copy the docs dir into the bindist #18669

- - - - -
e033dd05 by Adam Sandberg Ericsson at 2020-12-12T10:52:19+00:00
mkDocs: support hadrian bindists #18973

- - - - -
78580ba3 by John Ericson at 2020-12-13T07:14:50-05:00
Remove old .travis.yml

- - - - -
c696bb2f by Cale Gibbard at 2020-12-14T13:37:09-05:00
Implement type applications in patterns

The haddock submodule is also updated so that it understands the changes
to patterns.

- - - - -
7e9debd4 by Ben Gamari at 2020-12-14T13:37:09-05:00
Optimise nullary type constructor usage

During the compilation of programs GHC very frequently deals with
the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
teaches GHC to avoid expanding the `Type` synonym (and other nullary
type synonyms) during type comparisons, saving a good amount of work.
This optimisation is described in `Note [Comparing nullary type
synonyms]`.

To maximize the impact of this optimisation, we introduce a few
special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
`Note [Prefer Type over TYPE 'LiftedPtrRep]`.

Closes #17958.

Metric Decrease:
   T18698b
   T1969
   T12227
   T12545
   T12707
   T14683
   T3064
   T5631
   T5642
   T9020
   T9630
   T9872a
   T13035
   haddock.Cabal
   haddock.base

- - - - -
92377c27 by Ben Gamari at 2020-12-14T13:41:58-05:00
Revert "Optimise nullary type constructor usage"

This was inadvertently merged.

This reverts commit 7e9debd4ceb068effe8ac81892d2cabcb8f55850.

- - - - -
d0e8c10d by Sylvain Henry at 2020-12-14T19:45:13+01:00
Move Unit related fields from DynFlags to HscEnv

The unit database cache, the home unit and the unit state were stored in
DynFlags while they ought to be stored in the compiler session state
(HscEnv). This patch fixes this.

It introduces a new UnitEnv type that should be used in the future to
handle separate unit environments (especially host vs target units).

Related to #17957

Bump haddock submodule

- - - - -
af855ac1 by Andreas Klebinger at 2020-12-14T15:22:13-05:00
Optimize dumping of consecutive whitespace.

The naive way of putting out n characters of indent would be something
like `hPutStr hdl (replicate n ' ')`. However this is quite inefficient
as we allocate an absurd number of strings consisting of simply spaces
as we don't cache them.

To improve on this we now track if we can simply write ascii spaces via
hPutBuf instead. This is the case when running with -ddump-to-file where
we force the encoding to be UTF8.

This avoids both the cost of going through encoding as well as avoiding
allocation churn from all the white space. Instead we simply use hPutBuf
on a preallocated unlifted string.

When dumping stg like this:

> nofib/spectral/simple/Main.hs -fforce-recomp -ddump-stg-final -ddump-to-file -c +RTS -s

Allocations went from 1,778 MB to 1,702MB. About a 4% reduction of
allocation! I did not measure the difference in runtime but expect it
to be similar.

Bumps the haddock submodule since the interface of GHC's Pretty
slightly changed.

-------------------------
Metric Decrease:
    T12227
-------------------------

- - - - -
dad87210 by Ben Gamari at 2020-12-14T15:22:29-05:00
Optimise nullary type constructor usage

During the compilation of programs GHC very frequently deals with
the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
teaches GHC to avoid expanding the `Type` synonym (and other nullary
type synonyms) during type comparisons, saving a good amount of work.
This optimisation is described in `Note [Comparing nullary type
synonyms]`.

To maximize the impact of this optimisation, we introduce a few
special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
`Note [Prefer Type over TYPE 'LiftedPtrRep]`.

Closes #17958.

Metric Decrease:
   T18698b
   T1969
   T12227
   T12545
   T12707
   T14683
   T3064
   T5631
   T5642
   T9020
   T9630
   T9872a
   T13035
   haddock.Cabal
   haddock.base

- - - - -
6c2eb223 by Andrew Martin at 2020-12-14T18:48:51-05:00
Implement BoxedRep proposal

This implements the BoxedRep proposal, refacoring the `RuntimeRep`
hierarchy from:

```haskell
data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ...
```

to

```haskell
data RuntimeRep = BoxedRep Levity | ...
data Levity = Lifted | Unlifted
```

Closes #17526.

- - - - -
3ee696cc by Sebastian Graf at 2020-12-15T10:53:31-05:00
Add regression test for #19053

- - - - -
535dae66 by Ben Gamari at 2020-12-15T10:53:58-05:00
testsuite: Mark divbyzero, derefnull as fragile

Due to #18548.
- - - - -
5b9f7d8b by Ben Gamari at 2020-12-15T10:56:01-05:00
nonmoving: Fix small CPP bug

Previously an incorrect semicolon meant that we would fail to call
busy_wait_nop when spinning.

- - - - -
5c8e2ba4 by GHC GitLab CI at 2020-12-15T10:56:01-05:00
nonmoving: Assert deadlock-gc promotion invariant

When performing a deadlock-detection GC we must ensure that all objects
end up in the non-moving generation. Assert this in scavenge.

- - - - -
af102371 by GHC GitLab CI at 2020-12-15T10:56:01-05:00
nonmoving: Ensure deadlock detection promotion works

Previously the deadlock-detection promotion logic in alloc_for_copy was
just plain wrong: it failed to fire when gct->evac_gen_no !=
oldest_gen->gen_no. The fix is simple: move the

- - - - -
28738aea by GHC GitLab CI at 2020-12-15T10:56:01-05:00
nonmoving: Refactor alloc_for_copy

Pull the cold non-moving allocation path out of alloc_for_copy.

- - - - -
c843f309 by Ben Gamari at 2020-12-15T10:56:01-05:00
nonmoving: Don't push objects during deadlock detect GC

Previously we would push large objects and compact regions to the mark
queue during the deadlock detect GC, resulting in failure to detect
deadlocks.

- - - - -
2f89479b by GHC GitLab CI at 2020-12-15T10:56:01-05:00
nonmoving: Add comments to nonmovingResurrectThreads

- - - - -


30 changed files:

- .gitlab-ci.yml
- − .travis.yml
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types.hs-boot
- compiler/GHC/Builtin/Types/Prim.hs
- + compiler/GHC/Builtin/Types/Prim.hs-boot
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Parser/Monad.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Env.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5cc213666d20437cdbbead665a0fd725d8dfb533...2f89479b4220490044807517a2d8c1ed222feb79

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5cc213666d20437cdbbead665a0fd725d8dfb533...2f89479b4220490044807517a2d8c1ed222feb79
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/20201215/d1175b29/attachment-0001.html>


More information about the ghc-commits mailing list