[Git][ghc/ghc][wip/nested-cpr-2019] 53 commits: Add flags for annotating Generic{,1} methods INLINE[1] (#11068)

Sebastian Graf gitlab at gitlab.haskell.org
Mon Oct 19 09:00:37 UTC 2020



Sebastian Graf pushed to branch wip/nested-cpr-2019 at Glasgow Haskell Compiler / GHC


Commits:
998803dc by Andrzej Rybczak at 2020-10-15T11:40:32+02:00
Add flags for annotating Generic{,1} methods INLINE[1] (#11068)

Makes it possible for GHC to optimize away intermediate Generic representation
for more types.

Metric Increase:
    T12227

- - - - -
6b14c418 by GHC GitLab CI at 2020-10-15T21:57:50-04:00
Extend mAX_TUPLE_SIZE to 64

As well a ctuples and sums.

- - - - -
d495f36a by Ben Gamari at 2020-10-15T21:58:27-04:00
rts: Clean-up whitespace in Interpreter

- - - - -
cf10becd by Ben Gamari at 2020-10-15T21:58:27-04:00
compiler/ByteCode: Use strict Maps in bytecode assembler

- - - - -
ae146b53 by Ben Gamari at 2020-10-15T21:58:27-04:00
compiler/ByteCode: Make LocalLabel a newtype

- - - - -
cc536288 by Ben Gamari at 2020-10-15T21:58:27-04:00
compiler/ByteCode: Allow 2^32 local labels

This widens LocalLabel to 2^16, avoiding the crash observed in #14334.

Closes #14334.

- - - - -
1bb0512f by Ben Gamari at 2020-10-16T00:15:31-04:00
mingw: Extract zst toolchain archives

This should have been done when the toolchain was bumped.

- - - - -
bf7c5b6d by Ben Gamari at 2020-10-16T00:15:31-04:00
base: Reintroduce necessary LANGUAGE pragmas

These were incorrectly removed in a recent cleanup commit.

- - - - -
c6b4be4b by Ben Gamari at 2020-10-16T00:15:31-04:00
testsuite: Sort metrics by metric type

Closes #18838.

- - - - -
c7989c93 by Ben Gamari at 2020-10-16T00:15:31-04:00
testsuite: Account for -Wnoncanonical-monoid-instances changes on Windows

- - - - -
330a5433 by Ben Gamari at 2020-10-16T00:15:31-04:00
rts: Add __mingw_vfprintf to RtsSymbols.c

Following the model of the other printf symbols. See Note [Symbols for
MinGW's printf].

- - - - -
c4a69f37 by Ben Gamari at 2020-10-16T00:15:31-04:00
gitlab-ci: Remove allow_failure from Windows jobs

- - - - -
9a9679db by Ben Gamari at 2020-10-16T00:15:31-04:00
gitlab-ci: Fix Hadrian bindist names

- - - - -
07b0db86 by f-a at 2020-10-16T10:14:39-04:00
Clarify Eq documentation #18713
- - - - -
aca0e63b by Ben Gamari at 2020-10-17T10:20:31-04:00
gitlab-ci: Allow doc-tarball job to fail

Currently the Hadrian build appears not to package documentation correctly,
causing doc-tarball to fail due to the Windows build.
- - - - -
b02a9ea7 by Ben Gamari at 2020-10-17T13:26:24-04:00
gitlab-ci: s/allow_newer/allow_failure

Silly mistake on my part.
- - - - -
59d7c9f4 by John Ericson at 2020-10-17T22:01:38-04:00
Skip type family defaults with hs-boot and hsig files

Works around #17190, possible resolution for #17224. New design is is
according to accepted [GHC Propoal 320].

Instances in signatures currently unconditionally opt into associated
family defaults if no explicit instance is given. This is bad for two
reasons:

  1. It constrains possible instantiations to use the default, rather
  than possibly define the associated family differently.

  2. It breaks compilation as type families are unsupported in
  signatures.

This PR simply turns off the filling in of defaults in those cases.
Additionally, it squelches a missing definition warning for hs-boot too
that was only squelched for hsig before.

The downsides are:

  1. There is no way to opt into the default, other than copying its
  definition.

  2. If we fixed type classes in signatures, and wanted instances to
  have to explicitly *out of* rather than into the default, that would
  now be a breaking change.

The change that is most unambiguously goood is harmonizing the warning
squelching between hs-boot or hsig. Maybe they should have the warning
(opt out of default) maybe they shouldn't (opt in to default), but
surely it should be the same for both.

Add hs-boot version of a backpack test regarding class-specified
defaults in instances that appear in an hs-boot file.

The metrics increase is very slight and makes no sense --- at least no
one has figured anything out after this languishing for a while, so I'm
just going to accept it.

Metric Increase:
  T10421a

[GHC proposal 320]: https://github.com/ghc-proposals/ghc-proposals/pull/320

- - - - -
7eb46a09 by Sebastian Graf at 2020-10-17T22:02:13-04:00
Arity: Refactor fixed-point iteration in GHC.Core.Opt.Arity

Arity analysis used to propagate optimistic arity types during
fixed-point interation through the `ArityEnv`'s `ae_cheap_fun` field,
which is like `GHC.Core.Utils.exprIsCheap`, but also considers the
current iteration's optimistic arity, for the binder in question only.

In #18793, we have seen that this is a problematic design, because it
doesn't allow us to look through PAP bindings of that binder.

Hence this patch refactors to a more traditional form with an explicit
signature environment, in which we record the optimistic `ArityType` of
the binder in question (and at the moment is the *only* binder that is
recorded in the arity environment).

- - - - -
6b3eb06a by Sebastian Graf at 2020-10-17T22:02:13-04:00
Arity: Record arity types for non-recursive lets

In #18793, we saw a compelling example which requires us to look at
non-recursive let-bindings during arity analysis and unleash their arity
types at use sites.

After the refactoring in the previous patch, the needed change is quite
simple and very local to `arityType`'s defn for non-recurisve `Let`.

Apart from that, we had to get rid of the second item of
`Note [Dealing with bottoms]`, which was entirely a safety measure and
hindered optimistic fixed-point iteration.

Fixes #18793.

The following metric increases are all caused by this commit and a
result of the fact that we just do more work now:

Metric Increase:
    T3294
    T12545
    T12707

- - - - -
451455fd by Sebastian Graf at 2020-10-17T22:02:13-04:00
Testsuite: Add dead arity analysis tests

We didn't seem to test these old tests at all, judging from their
expected output.

- - - - -
50e9df49 by Dylan Yudaken at 2020-10-17T22:02:50-04:00
When using rts_setInCallCapability, lock incall threads

This diff makes sure that incall threads, when using `rts_setInCallCapability`, will be created as locked.
If the thread is not locked, the thread might end up being scheduled to a different capability.
While this is mentioned in the docs for `rts_setInCallCapability,`, it makes the method significantly less useful as there is no guarantees on the capability being used.

This commit also adds a test to make sure things stay on the correct capability.

- - - - -
0b995759 by DylanZA at 2020-10-17T22:02:50-04:00
Apply suggestion to testsuite/tests/ffi/should_run/all.T
- - - - -
a91dcb66 by Sylvain Henry at 2020-10-17T22:04:02-04:00
Don't get host RTS ways via settings (#18651)

To correctly perform a linking hack for Windows we need to link with the
RTS GHC is currently using. We used to query the RTS ways via the
"settings" file but it is fragile (#18651). The hack hasn't been fixed
to take into account all the ways (Tracing) and it makes linking of GHC
with another RTS more difficult (we need to link with another RTS and to
regenerate the settings file).

So this patch uses the ways reported by the RTS itself
(GHC.Platform.Ways.hostWays) instead of the "settings" file.

- - - - -
d858a3ae by Hécate at 2020-10-17T22:04:38-04:00
Linting corrections

* Bring back LANGUAGE pragmas in GHC.IO.Handle.Lock.Windows
* Exclude some modules that are wrongfully reported

- - - - -
578d1ede by Sebastian Graf at 2020-10-19T11:00:29+02:00
Nested CPR

- - - - -
a59c927a by Sebastian Graf at 2020-10-19T11:00:29+02:00
Move tests from stranal to cpranal

- - - - -
6659cc6a by Sebastian Graf at 2020-10-19T11:00:29+02:00
Accept FacState

- - - - -
a419bdd6 by Sebastian Graf at 2020-10-19T11:00:29+02:00
Factor Cpr and Termination into a joint lattice

As a result, we don't even have to export Termination from Cpr. Neat!

Also I realised there is a simpler and more sound way to generate and
unleash CPR signatures.

- - - - -
968e6b22 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Consider unboxing effects of WW better and get rid of hack

- - - - -
b516d73d by Sebastian Graf at 2020-10-19T11:00:30+02:00
stuff

- - - - -
045dca07 by Sebastian Graf at 2020-10-19T11:00:30+02:00
A slew of testsuite changes

- - - - -
6a9777c1 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix T1600

- - - - -
0a0014a0 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix primop termination

- - - - -
defe6b0b by Sebastian Graf at 2020-10-19T11:00:30+02:00
Test for DataCon wrapper CPR

- - - - -
ddd7673f by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix CPR of bottoming functions/primops

- - - - -
ac7287f3 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix DataConWrapperCpr and accept other test outputs

- - - - -
5502211a by Sebastian Graf at 2020-10-19T11:00:30+02:00
Accept two more changed test outputs

- - - - -
730fbdf3 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Update CaseBinderCPR with a new function

- - - - -
0bd1d50c by Sebastian Graf at 2020-10-19T11:00:30+02:00
Don't give the case binder the CPR property

- - - - -
eced6ada by Sebastian Graf at 2020-10-19T11:00:30+02:00
Prune CPR sigs to constant depth on all bindings

- - - - -
e0f0a8b2 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Use variable length coding for ConTags

- - - - -
79d21e1f by Sebastian Graf at 2020-10-19T11:00:30+02:00
Accept testuite output

- - - - -
93cd0067 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Don't attach CPR sigs to expandable bindings; transform their unfoldings instead

- - - - -
ca438c7f by Sebastian Graf at 2020-10-19T11:00:30+02:00
Revert "Don't give the case binder the CPR property"

This reverts commit 910edd76d5fe68b58c74f3805112f9faef4f2788.

It seems we broke too much with this change. We lost our big win in
`fish`.

- - - - -
91c284db by Sebastian Graf at 2020-10-19T11:00:30+02:00
A more modular and configurable approach to optimistic case binder CPR

- - - - -
2a22de5b by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix T9291

- - - - -
7f2bd0a1 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Document -fcase-binder-cpr-depth in the user's guide

- - - - -
0bb5e521 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Testsuite changes

- - - - -
bd38fb0b by Sebastian Graf at 2020-10-19T11:00:30+02:00
Refactoring around cprAnalBind

- - - - -
418be2d3 by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix case binder CPR by not looking into unfoldings of case binders

- - - - -
2508ec0d by Sebastian Graf at 2020-10-19T11:00:30+02:00
Fix T16893

- - - - -
71553c53 by Sebastian Graf at 2020-10-19T11:00:31+02:00
Accept new test output for T17673

- - - - -
6f7b4017 by Sebastian Graf at 2020-10-19T11:00:31+02:00
Accepting metric changes to advance CI

There are two ghc/alloc increases, which we might want to investigate
later on.

Metric Decrease:
    T1969
    T9233
    T9872a
    T9872b
    T9872c
    T9872d
    T12425
Metric Increase:
    T13253
    T13701
    T15164
Metric Increase ['max_bytes_used'] (test_env='x86_64-darwin'):
    T9675
Metric Increase ['max_bytes_used', 'peak_megabytes_allocated']:
    T10370

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/CoreToByteCode.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Platform.hs
- compiler/GHC/Settings.hs
- compiler/GHC/Settings/Constants.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/SysTools.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Generics.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/TyCl/Class.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/546788b5119e34f3f7313f01b56eaa7f437422b4...6f7b40177f693d748080a2c5e17dc2c4da3138a8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/546788b5119e34f3f7313f01b56eaa7f437422b4...6f7b40177f693d748080a2c5e17dc2c4da3138a8
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/20201019/fbdcfc96/attachment-0001.html>


More information about the ghc-commits mailing list