[Git][ghc/ghc][wip/T25576] 47 commits: Update GHCi :info type declaration printing (#24459)

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Jan 9 18:13:13 UTC 2025



Ben Gamari pushed to branch wip/T25576 at Glasgow Haskell Compiler / GHC


Commits:
9c53489d by Andrei Borzenkov at 2024-12-12T15:06:42-05:00
Update GHCi :info type declaration printing (#24459)

- Do not print result's kind in type families
  because we have full kind in SAKS and we display
  invisible arity using @-binders

- Do not suppress significant invisible binders

An invisible binder is considered significant when it meets at least
one of the following two criteria:
  - It visibly occurs in the declaration's body
  - It is followed by a significant binder,
    so it affects positioning
For non-generative type declarations (type synonyms and type families)
there is one additional criterion:
  - It is not followed by a visible binder, so it
    affects the arity of a type synonym

See Note [Print invisible binders in interface declarations]
for more information about what is "visibly occurs"

- - - - -
13fe48d4 by Matthew Pickering at 2024-12-12T15:07:19-05:00
typechecker: Perform type family consistency checks in topological order

Consider a module M importing modules A, B and C.

We can waste a lot of work depending on the order that the modules are
checked for family consistency.

Consider that C imports A and B. When compiling C we must have already
checked A and B for consistency, therefore if C is processed first then
A and B will not need to be checked for consistency again.

If A and B are compared first, then the consistency checks will be
performed against (wasted as we already performed them for C).

At the moment the order which modules are checked is non-deterministic.

Clearly we should engineer that C is checked before B and A, but by what
scheme?

A simple one is to observe that if a module M is in the transitive
closure of X then the size of the consistent family set of M is less
than or equal to size of the consistent family set of X.

Therefore by sorting the imports by the size of the consistent family
set and processing the largest first, you make sure to process modules
in topological order.

In practice we have observed that this strategy has reduced the amount
of consistency checks performed.

One solution to #25554

- - - - -
62a2b25f by Sylvain Henry at 2024-12-14T04:31:09-05:00
TNTC: set CmmProc entry_label properly (#25565)

Before this patch we were renaming the entry label of a CmmProc late in
the CmmToAsm pass. It led to inconsistencies and to some labels being
used in info tables but not being emitted (#25565).
Now we set the CmmProc entry label earlier in the StgToCmm monad and we
don't renamed it afterwards.

- - - - -
b339e7c3 by Simon Hengel at 2024-12-14T04:31:47-05:00
Make filter functionality for system tools line-based

This is more efficient as:

- All existing filter functions were line-based anyway.  They broke up
  the input into lines and then joined it back together.
- We already break up the output from system tools into lines when
  processing it.

Splitting up the output of system tools once and then filtering and
processing it reduces both code and runtime complexity.

- - - - -
39669077 by Simon Hengel at 2024-12-14T04:31:47-05:00
Refactoring: Don't use a `Chan` when parsing SysTools output

- - - - -
64756530 by Simon Peyton Jones at 2024-12-14T22:28:04-05:00
Tidy up the handling of `assert`

Fixes #25493

- - - - -
8658fbc1 by Rodrigo Mesquita at 2024-12-14T22:28:41-05:00
base: displayException for SomeAsyncException

Provide a better implementation of `SomeException` for
`SomeAsyncException`.
The previous, implicit, implementation, would not use the
`displayException` of the exception wrapped by `SomeAsyncException`.

Implements CLC-Proposal#309

Closes #25513

- - - - -
2d3a0a70 by ARATA Mizuki at 2024-12-15T18:35:30-05:00
LLVM: When emitting a vector literal with ppTypeLit, include the type information

Fixes #25561

- - - - -
bfacc086 by Simon Peyton Jones at 2024-12-15T18:36:05-05:00
Fix signature lookup in instance declarations

This fixes a bug introduced by the fix to #16610

- - - - -
80f0e02d by Simon Peyton Jones at 2024-12-16T17:13:52+00:00
Improve GHC build times

Two small changes

* In GHC.Data.Unboxed, never omit interface pragmas.  In "fast builds"
  one might omit them generally, but doing so gives very bad
  performance for code that imports this module.

* In GHC.Hs.Dump don't do type-class specialisation.  For some reason
  it goes mad and generates vast amounts of useless code.  See #25463.

- - - - -
175a1355 by Simon Peyton Jones at 2024-12-16T17:13:52+00:00
Refactor Lint

Refactor Lint for two reasons:

* To improve performance
* To prepare for type-lets

The big changes are all in GHC.Core.Lint:

* Change the main APIs:
  * `lintType` returns nothing rather than returning a `LintedType`;
  * `lintCoercion` return nothing rather than returning a `LintedCoercion`
  Reason: these functions did a lot of allocation to return a substituted
  type/coercion that was often discarded, or used only to extract its kind.

  Instead we now return nothing, and, when needed, extract the kind and
  substitute.

* Applications are treated as a whole, by `lintApp`.  By treating
  multiple arguments all at once we avoid performing multiple
  substitutions, each substituting a single type variable. This can
  make an absolutely huge difference.

Overall this led to a pretty massive rewrite of Lint, with many smaller
changes.

Smaller chnages elsewhere

* Rename `GHC.Core.TyCo.Subst.getSubstInScope` to `substInScopeSet` for consistency

* Define and use `GHC.Core.Type.liftedTypeOrConstraintKind`

Performance. This MR someimtes gives gives a very large improvement in
compile time, when Lint is on.  here is a selection of changes over 5%
in perf/compiler (with -dcore-lint)

      T25196                       -97.0%
      T14766                       -89.7%
      T14683                       -74.4%
      T5631                        -60.9%
      T20261                       -56.7%
      T18923                       -17.6%
      T13035                       -15.8%
      T6048                        -15.8%
      CoOpt_Read                   -14.4%
      T9630                        -10.9%
      T5642                         -7.3%

Eliminating the egregious offenders is a big win.

However, in some cases the compiler allocation /increases/. Here ae the
changes over 1%:

      T9961                          1.5%
      T8095                          2.8%
      T14052                         3.9%
      T12545                         4.5%
      T14052Type                     5.5%
      T5030                          8.0%
      T5321Fun                       8.3%
      T3064                         12.7%
      CoOpt_Singletons              15.6%
      T9198                         16.0%
      LargeRecord                   18.1%

I looked at the two biggest increases in compile-time bytes allocated.  Interestingly,
they both show substantial *decreases* in actual compile time, due to much smaller GC times.
I'm honestly not sure either why the allocation increases, or why the GC time decreases;
but I'm going to take the win!

    T9198
                 Baseline            With patch
    No Lint
      Alloc       44.6M              44.6M
      Mut time    0.23s              0.22s
      GC time     0.21s              0.21s

    With Lint
      Alloc       309M               360M
      Mut time    1.51s              0.85s
      GC time     2.97s              0.25s

    -------------------
    LargeRecord
                 Baseline            With patch
    No Lint
      Alloc       1.37G              1.37G
      Mut time    2.33s              2.33s
      GC time     2.40s              2.42s

    With Lint
      Alloc       3.4G               4.0G
      Mut time    6.02s              5.68s
      GC time     3.67s              3.03s

IMPORTANT NOTE: These changes don't show up in CI because in CI the
tests in perf/compiler are all run with -dcore-lint switched off.  I
gathered this data with some manual runs.

- - - - -
8ef2dad6 by Simon Peyton Jones at 2024-12-17T02:48:09-05:00
Add Note [Typechecking overloaded literals]

See #25494.

- - - - -
e86b1b20 by Ben Gamari at 2024-12-17T13:51:39-05:00
testsuite: Use math.inf instead of division-by-zero

This both more directly captures the intent and also fixes #25580.

- - - - -
430d965a by Ben Gamari at 2024-12-17T13:52:15-05:00
rts: Fix incorrect format specifiers in era profiling

Fixes #25581.

- - - - -
267098ad by Andreas Klebinger at 2024-12-18T23:43:13-05:00
Document `-prof` and non `-prof` code being incompatible.

Fixes #25518.

- - - - -
04433916 by Zubin Duggal at 2024-12-18T23:43:50-05:00
ghcup metadata: output metadata fragment in CI

(cherry picked from commit 52b58a660e735b20961d792d8fa9267f01247a50)

- - - - -
7c78804e by Zubin Duggal at 2024-12-18T23:43:50-05:00
ghcup metatdata: use fedora33 for redhat

Redhat 9 doesn't have libtinfo.so.5 anymore

(cherry picked from commit dc86785eb43afd1bd292287c064fb5ad94fe8c7f)

- - - - -
1d72cfb2 by Zubin Duggal at 2024-12-18T23:43:50-05:00
ghcup metadata: still use centos for redhat <9

- - - - -
3f7ebc58 by Sylvain Henry at 2024-12-19T20:40:14-05:00
Merge ghc-bignum into ghc-internal (#24453)

First step towards merging ghc-bignum and ghc-prim into ghc-internal.

After this patch, ghc-bignum is deprecated and is just a shallow package
reexporting modules from ghc-internal and base. Use those directly
instead.

Move `gmp` submodule into ghc-internal directory.

- - - - -
ee0150c2 by Rodrigo Mesquita at 2024-12-19T20:40:51-05:00
Improve performance of deriving Show

Significantly improves performance of deriving Show instances by
avoiding using the very polymorphic `.` operator in favour of inlining
its definition. We were generating tons of applications of it, each
which had 3 type arguments!

Improves on #9557

-------------------------
Metric Decrease:
    InstanceMatching
    T12707
    T3294
------------------------

- - - - -
8b266671 by Rodrigo Mesquita at 2024-12-19T20:40:51-05:00
Don't eta expand cons when deriving Data

This eta expansion was introduced with the initial commit for Linear
types.

I believe this isn't needed any longer. My guess is it is an artifact
from the initial linear types implementation: data constructors are
linear, but they shouldn't need to be eta expanded to be used as higher
order functions. I suppose in the early days this wasn't true.

For instance, this works now:

    data T x = T x
    f = \(x :: forall y. y -> T y) -> x True
    f T -- ok!

T is linear, but can be passed where an unrestricted higher order
function is expected. I recall there being some magic around to make
this work for data constructors...

Since this works, there's no need to eta_expand the data constructors in
the derived Data instances.

- - - - -
1f67ad21 by Andrei Borzenkov at 2024-12-25T01:42:31-05:00
Flip the order of arguments of setField (#24668)

GHC Proposal 583 "HasField redesign" specifies the
following order of a setField function arguments as this:

  setField :: forall fld a b. SetField fld a b. b -> a -> a

This patch flips the application order to match the spec.

- - - - -
3e0c948d by Ben Gamari at 2024-12-25T01:43:08-05:00
rel-eng/upload: Add set_symlink mode

This slightly eases updating of the `latest` symlinks.

- - - - -
63d63f9d by Simon Peyton Jones at 2024-12-25T01:43:45-05:00
Preserve orientation when unifying kinds

This MR fixes yet another manifestation of the trickiness caused
by Note [Fundeps with instances, and equality orientation].

I wish there was a more robust way to do this, but this fix is
a definite improvement.

Fixes #25597

- - - - -
94ba9a6a by ARATA Mizuki at 2024-12-26T10:47:57-05:00
x86 NCG SIMD: Support pack/insert/broadcast/unpack of 128-bit integer vectors

- - - - -
6bf0d587 by Andrew Lelechenko at 2024-12-26T10:48:33-05:00
docs: fix haddock formatting in Control.Monad.Fix

- - - - -
feb14af1 by Sergey Vinokurov at 2024-12-27T15:06:28+00:00
Remove unnecessary irrefutable patterns from NonEmpty functions

Implementation of https://github.com/haskell/core-libraries-committee/issues/107

- - - - -
6a0d91b4 by Sergey Vinokurov at 2024-12-27T15:06:28+00:00
Make cons, Semigroup, IsList, and Monad instances stricter

- - - - -
1249e597 by Sergey Vinokurov at 2024-12-27T15:06:28+00:00
Restore some laziness in <| and Semigroup instance, improve Monad instance

The Monad instance shouldn't produce the outer :| unless f a reduces
to WHNF. (Notice that the b :| bs match is implicitly lazy.)

- - - - -
8699d826 by Sergey Vinokurov at 2024-12-27T15:12:30+00:00
Add comment outlining Data.List.NonEmpty implementation guiding principles

- - - - -
7febe00e by Sergey Vinokurov at 2024-12-27T22:24:43+00:00
Fix tests since location of ‘>>=’ changed

- - - - -
a928c326 by ARATA Mizuki at 2024-12-28T03:06:14-05:00
Fix LLVM version detection

With a recent LLVM, `llc -version` emits the version on the first line
if the vendor is set.  It emits the version on the second line
otherwise.

Therefore, we need to check the both lines to detect the version.

GHC now emits a warning if it fails to detect the LLVM version,
so we can notice if the output of `llc -version` changes in the future.

Also, the warning for using LLVM < 10 on s390x is removed, because
we assume LLVM >= 13 now.

This fixes the definition of __GLASGOW_HASKELL_LLVM__ macro.

Fixes #25606

- - - - -
7f79257a by Zubin Duggal at 2024-12-29T13:04:35+00:00
Bump base, ghc-prim and template-haskell versions for 9.12

Also bump various submodules.

(cherry picked from commit 6fc1fa3bdc8f53acdb19e47145789274060e498f)

Bump base bound to 4.21 for GHC 9.12

(cherry picked from commit 473a201c6b55aea5bf9c9db0836a66ea1b657e04)

Bump binary submodule to 0.8.9.2

(cherry picked from commit 7199869a52ab45e8856658248bf807954d58cc20)
(cherry picked from commit ec2f40b45c1a3d82d17a2fc07e9ddb9218bc3940)

Bump exceptions submodule to 0.10.9

(cherry picked from commit f5b5d1dc2d326368e5b173d622630d77f019b629)

Bump file-io submodule to 0.1.4

(cherry picked from commit ba786681de6ac5fa49938e2cd71a5988f0f40d1f)

bump os-string submodule to 2.0.6

(cherry picked from commit 3a7ffdbb832c045a55fd1ef24f546abdd9d9e30f)

bump transformers submodule to 0.6.1.2

(cherry picked from commit 53b46fd437421b9e5a001edc6d1c427439d7714f)

Bump directory submodule to v1.3.9.0

(cherry picked from commit 27dc2664c5404bb462092bb216c2c37b418fd1f8)

Bump Win32 submodule to v2.14.1.0

(cherry picked from commit 80df88086180f5e39212b2feacf70a9d2b263c6c)

Bump filepath submodule to 1.5.3.0

(cherry picked from commit 29bfae2c58a7303a081a6e7956b9f55e5faf3eeb)

Bump file-io submodule to avoid usage of QuasiQuotes

(cherry picked from commit 97b0dff223a6c4cc003adec448104c277f214645)

Bump unix submodule to 2.8.6.0

(cherry picked from commit a1f56d6d6a99c100f88ef0a8b4d51298cf24a42d)

Bump os-string submodule to 2.0.8

(cherry picked from commit 0121b76fd52ea0c0ce5d07085bc195666b63c625)

Bump file-io submodule to avoid usage of QuasiQuotes

(cherry picked from commit 962ceb50c8a6fc370e1c0a267f5cd5562a8cf759)

Bump filepath submodule to 1.5.4.0

(cherry picked from commit 7bc6877fd5d41c6d5900678ad5e73ed30f366569)

Bump file-io submodule to 0.1.5

(cherry picked from commit 9478b5aefe2877d58baf527edcf936dddbb955b7)

Bump Cabal submodule to 3.14.1.0

(cherry picked from commit 5c9c3e3f79a79bb6d9a77a17c716dc3a0bcbd2aa)

Bump directory submodule to 0.12.2.0

(cherry picked from commit 897906265db37af34ae2aaa016cec417f263407b)

Bump array submodule for base bump

Bump stm submodule for base bump

Bump process submodule for base bump

- - - - -
f6079408 by Zubin Duggal at 2024-12-29T13:04:35+00:00
Fix ghc-e005 after HasCallstack changes

(cherry picked from commit 77f340a24561cea8a6f2ada296b3ea356ab1823c)

- - - - -
3e10fa75 by Zubin Duggal at 2024-12-29T13:04:35+00:00
Add haskeline to stage0Packages

Otherwise we link against boot inplace and boot unix as boot haskeline
depends on boot unix.

(cherry picked from commit 90b493769ebdf3cd7be404d18462dc20ac1044df)

- - - - -
4ad6aec4 by Zubin Duggal at 2024-12-29T13:04:35+00:00
Fix TH changelog

- - - - -
ea3f7fd5 by Zubin Duggal at 2024-12-29T13:04:35+00:00
release: copy index.html from correct directory

(cherry picked from commit cbfd0829cd61928976c9eb17ba4af18272466063)

- - - - -
fafb70db by Zubin Duggal at 2024-12-29T13:04:35+00:00
hadrian-multi: warn on unused imports

os-string has redundant imports

(cherry picked from commit dde3796be689ea57543936e22aa5ea4ef7ed995e)

- - - - -
c02b1e46 by Simon Peyton Jones at 2024-12-29T17:04:30-05:00
Fix in-scope set for CSE

Ticket #25468 showed an assertion failure in CSE because a top-level
Id was being used before it was defined.  Reason: Note [Glomming] in
GHC.Core.Opt.OccurAnal.

Solution (used in many places): just put all the top-level bindings in
scope at the beginning of CSE.

Compile-time allocation wobbles up and down a tiny bit; geo mean is
zero. But MultiLayerModulesTH_OneShot and hard_hole_fits increase (on
some architectures only) by a bit oever 2% .  I think these are just a
random fluctuations.

Metric Increase:
    MultiLayerModulesTH_OneShot
    hard_hole_fits

- - - - -
559d4f84 by Krzysztof Gogolewski at 2024-12-30T11:53:19-05:00
Add tests for #23883

The issue has been fixed by commit f5d3e03c56ffc63.
Only T23883a is the actual regression test, the remaining ones are
tricky cases found during development of an independent fix !11313.

- - - - -
278a53ee by Sergey Vinokurov at 2024-12-30T11:53:59-05:00
Update changelog for CLC proposal #107 (NonEmpty laziness)

- - - - -
f56558be by Matthew Pickering at 2025-01-07T13:53:03-05:00
warnings: Find out if a qualified name is in the interactive scope directly

There were two ad-hoc mechanisms used to determine which modules were in
the interactive scope.

1. Look at everything in the GRE, to see what is imported qualified.
2. Look at the last loaded module in the HPT.

(1) Is very inefficient, GlobalRdrEnvs can be very big.
(2) is incorrect, there is no reason to assume the "last" thing added to
the HPT has any relevance to module loading order.

Happily, the same checks can be implemented directly by looking at the
interactive imports from the interactive context. This mirrors what
happens for normal imports.

Arguably, the error reporting code shouldn't be doing this kind of
processing and it should be an option is set when rendering the error
message. However, this just improves the situation and doesn't block
progress on that front in future.

See #14225 and #15611

Fixes #25600

- - - - -
84155cdb by Simon Peyton Jones at 2025-01-07T13:53:40-05:00
Tidy up kcConDecls

Addresses #25630

In particular,

* Introduce ConArgKind and use it.

* Make kcConDecls and tcConDecls work the same way
  concerning the kind of argument types

- - - - -
6c12b6cf by Bryan Richter at 2025-01-07T18:15:02-05:00
Remove tmp files after toolchain check

Fixes #25620

- - - - -
42826a89 by Cheng Shao at 2025-01-07T18:15:39-05:00
xxhash: bump to v0.8.3

- - - - -
185f17e4 by sheaf at 2025-01-07T18:16:15-05:00
Fix typo in GHC.Tc.Solver.Solve.runTcPluginsWanted
- - - - -
63d74f4d by Ben Gamari at 2025-01-09T13:13:01-05:00
compiler: Fix CPP guards around ghc_unique_counter64

The `ghc_unique_counter64` symbol was introduced in the RTS in the
64-bit unique refactor (!10568) which has been backported to %9.6.7 and
%9.8.4. Update the CPP to reflect this.

Fixes #25576.

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitlab/rel_eng/upload.sh
- .gitmodules
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToLlvm.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.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/CoreToStg/Prep.hs
- compiler/GHC/Data/Unboxed.hs
- compiler/GHC/Driver/Config/Core/Rules.hs
- compiler/GHC/Driver/Config/Linker.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Utils.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e421ec3c8fc9688b3f7ee08c0d1baaf1cb7aa750...63d74f4d15ecaa8d711bd12fa64f77fce72b5f79

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e421ec3c8fc9688b3f7ee08c0d1baaf1cb7aa750...63d74f4d15ecaa8d711bd12fa64f77fce72b5f79
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/20250109/45d77df2/attachment-0001.html>


More information about the ghc-commits mailing list