[Git][ghc/ghc][wip/boot-lib-testing] 89 commits: ghc-experimental: expose GHC.RTS.Flags, GHC.Stats

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Fri Dec 20 16:29:12 UTC 2024



Ben Gamari pushed to branch wip/boot-lib-testing at Glasgow Haskell Compiler / GHC


Commits:
53f978c0 by doyougnu at 2024-11-26T16:07:26-05:00
ghc-experimental: expose GHC.RTS.Flags, GHC.Stats

See this CLC proposal:

- https://github.com/haskell/core-libraries-committee/issues/289

and this CLC proposal for background:

- https://github.com/haskell/core-libraries-committee/issues/288

Metric Decrease:
    MultiLayerModulesTH_OneShot

- - - - -
e70d4140 by Wang Xin at 2024-11-26T16:08:10-05:00
Add -mcmodel=medium moduleflag to generated LLVM IR on LoongArch platform

With the Medium code model, the jump range of the generated jump
instruction is larger than that of the Small code model. It's a
temporary fix of the problem descriped in https://gitlab.haskell
.org/ghc/ghc/-/issues/25495. This commit requires that the LLVM
used contains the code of commit 9dd1d451d9719aa91b3bdd59c0c6679
83e1baf05, i.e., version 8.0 and later. Actually we should not
rely on LLVM, so the only way to solve this problem is to implement
the LoongArch backend.

Add new type for codemodel

- - - - -
df42ba16 by Andreas Klebinger at 2024-11-27T11:40:49-05:00
Cmm constant folding: Narrow results to operations bitwidth.

When constant folding ensure the result is still within bounds
for the given type by explicitly narrowing the results.

Not doing so results in a lot of spurious assembler warnings
especially when testing primops.

- - - - -
bf3db97e by Ben Gamari at 2024-11-27T11:41:26-05:00
ghc-toolchain: Introduce basic flag validation

We verify that required flags (currently `--output` and `--triple`) are
provided. The implementation is truly awful, but so is getopt.

Begins to address #25500.

- - - - -
a104508d by Ben Gamari at 2024-11-27T11:42:03-05:00
rts: Allow ExecPage to allocate anywhere in address space

Currently the ExecPage facility has two users:

 * GHCi, for constructing info tables, and
 * the adjustor allocation path

Despite neither of these have any spatial locality constraints ExecPage
was using the linker's `mmapAnonForLinker`, which tries hard to ensure
that mappings end up nearby the executable image. This makes adjustor
allocation needlessly subject to fragmentation concerns.

We now instead return less constrained mappings, improving the
robustness of the mechanism.

Addresses #25503.

- - - - -
c3fc9b86 by Ben Gamari at 2024-11-27T11:42:39-05:00
base: Fix incorrect mentions of GHC.Internal.Numeric

These were incorrectly changed by the automated refactoring of the
`ghc-internal` migration.

Fixes #25521.

- - - - -
a362b943 by sheaf at 2024-11-27T23:44:28-05:00
Add checkExact to toolTargets

This change means that the Hadrian multi target will include exactprint.
In particular, this means that HLS will work on exactprint inside the GHC tree.
- - - - -
e6c957e4 by Arnaud Spiwack at 2024-11-27T23:45:09-05:00
Add test for #25428

- - - - -
52d97f4e by Arnaud Spiwack at 2024-11-27T23:45:09-05:00
Don't bypass MonoLocalBind in empty patterns

Fixes #25428

- - - - -
7890f2d8 by Ben Gamari at 2024-11-28T10:26:46-05:00
hadrian: Bump directory bound to >=1.3.9

Earlier versions of `directory` are racy on Windows due to #24382.

Also includes necessary Hadrian bootstrap plan bump.

Fixes #24382.

- - - - -
0fd43ea6 by Adam Sandberg Ericsson at 2024-11-28T10:27:22-05:00
mention -Iw in +RTS -?
- - - - -
6cf579b9 by Ben Gamari at 2024-11-28T10:27:59-05:00
gitlab-ci: Set GIT_SUBMODULE_FORCE_HTTPS

GitLab recommends using `https://` to clone submodules and provides the
`GIT_SUBMODULE_FORCE_HTTPS` variable to force this.

Fixes #25528.

- - - - -
5b4774f9 by sheaf at 2024-12-03T15:22:07+01:00
Remove TcRnDeprecatedInvisTyArgInConPat mechanism

The combination of ScopedTypeVariables + TypeApplications now no longer
enables the use of type applications in constructor patterns, as per
GHC proposal #448.

This completes the deprecation that begun with GHC 9.8.

We also remove the -Wdeprecated-type-abstractions flag, which was
introduced in GHC 9.10.

- - - - -
f813c8d7 by sheaf at 2024-12-03T17:10:15-05:00
Hadrian: use / when making filepaths absolute

In Hadrian, we are careful to use -/- rather than </>, in order to use
/ instead of \ in filepaths. However, this gets ruined by the use of
makeAbsolute from System.Directory, which, on Windows, changes back
forward slashes to backslashes.

- - - - -
292ed74e by Ben Gamari at 2024-12-03T17:10:52-05:00
rts/linker: Fix out-of-bounds mapping logic

Previously the structure of `mmapInRegion` concealed a subtle bug
concerning handling of `mmap` returning mappings below the beginning of
the desired region. Specifically, we would reset `p = result + bytes`
and then again reset `p = region->start` before looping around for
another iteration. This resulted in an infinite loop on FreeBSD.

Fixes #25492.

- - - - -
20912f5b by Ben Gamari at 2024-12-03T17:10:52-05:00
rts/linker: Clarify debug output

- - - - -
f98b3ac0 by Simon Hengel at 2024-12-03T17:11:30-05:00
SysTools: Avoid race conditions when processing output (fixes #16450)

- - - - -
03851b64 by Rodrigo Mesquita at 2024-12-03T17:12:06-05:00
mg: Drop unnecessary HasCallStack

This HasCallStack was a debugging artifact from a previous commit.

- - - - -
01d213b5 by Rodrigo Mesquita at 2024-12-03T17:12:06-05:00
Improve haddock of graphReachabilityCyclic

- - - - -
f7cbffe2 by Rodrigo Mesquita at 2024-12-03T17:12:06-05:00
Refactor ModuleGraph interface

The 'ModuleGraph' abstraction represents the relationship and strucutre
of the modules being compiled. This structure is meant to be constructed
once at the start of compilation, and never changed again.

However, it's exposed interface was confusing and exposed too many
footguns which led to inneficient usages of the ModuleGraph. This commit
improves significantly the exported interface of ModuleGraph, taking
into consideration the recent improvements around reachability queries.

Since the ModuleGraph graphs and related structures (HPT, EPS) are
performance critical in the sense that somewhat simple mistakes can
cause bad leaks and non-linear memory usage, we want to have proper APIs
that guide efficient usage. This is a good step in that direction.

- - - - -
b69a7f3c by David Binder at 2024-12-04T18:37:42-05:00
Use consistent capitalization for "GHC Proposal" in user guide

- - - - -
18d9500d by David Binder at 2024-12-04T18:37:42-05:00
Fix reference to GHC proposal 193 in user guide

- - - - -
dd959406 by Ben Gamari at 2024-12-04T18:38:18-05:00
Revert "rts/Interpreter: Assert that TEST*_P discriminators are valid"

This assertion was based on the misconception that `GET_TAG` was
returning the pointer tag whereas it is actually returning the
constructor tag.

This reverts commit 9bf3663b9970851e7b5701d68147450272823197.

Fixes #25527.

- - - - -
cad6fede by Ben Gamari at 2024-12-04T18:38:54-05:00
rts/IOManager: Drop dead code

This assignment is dead code as it occurs after all branches have
returned. Moreover, it can't possibly be relevant since the "available"
branch already sets `flag`.

Potentially fixes #25542.

- - - - -
55d8304e by Ben Gamari at 2024-12-06T16:56:00-05:00
ghc-internal: Drop GHC.Internal.Data.Enum

This module consists only of reexports and consequently there is no
reason for it to exist.

- - - - -
56b9f484 by Ben Gamari at 2024-12-06T16:56:00-05:00
base: Introduce Data.Bounded

As proposed in [CLC#208] but unfortunately `Data.Enum` was already
incorrectly introduced in the `ghc-internal` refactor.

[CLC#208]: https://github.com/haskell/core-libraries-committee/issues/208

- - - - -
336d392e by Ben Gamari at 2024-12-06T16:56:00-05:00
base: Deprecate export of Bounded from Data.Enum

This begins the process of bringing us into compliance with
[CLC#208].

[CLC#208]: https://github.com/haskell/core-libraries-committee/issues/208

- - - - -
dd7ca939 by Ben Gamari at 2024-12-06T16:56:00-05:00
base: Mention incorrect Data.Enum addition in changelog

- - - - -
dfd1db48 by Ben Gamari at 2024-12-06T16:56:36-05:00
base: Reintroduce {Show,Enum} IoSubSystem

These instances were dropped in !9676 but not approved by the CLC.

Addresses #25549.

- - - - -
090fc7c1 by Peter Trommler at 2024-12-07T03:41:21-05:00
Fix requirements on T25240

T25240 doesn't need RTS linker, GHCi is sufficient and GHCi can also be
dynamically linked.

- - - - -
3fb5d399 by Peter Trommler at 2024-12-07T03:41:21-05:00
Fix requirements for T25155

Loading C objects requires RTS linker.

- - - - -
4c58bdf6 by Leary at 2024-12-07T03:42:07-05:00
TH: Add typed variants of dataToExpQ and liftData

This commit introduces to template-haskell (via ghc-internal) two
functions `dataToCodeQ` and `liftDataTyped`, typed variants of
`dataToExpQ` and `liftData` respectively.

Tested in: `dataToCodeQUnit`.

- - - - -
63027593 by Serge S. Gulin at 2024-12-08T13:52:05+03:00
JS: Basic cleanup for unused stuff to simplify things.

1. Make `staticInitStat`, `staticDeclStat`, `allocUnboxedConStatic`, `allocateStaticList`, `jsStaticArg` local to modules.
2. Remove unused `hdRawStr`, `hdStrStr` from Haskell and JavaScript (`h$pstr`, `h$rstr`, `h$str`).
3. Introduce a special type `StaticAppKind` enumeration and `StaticApp` to represent boxed scalar static applications. Originally, StaticThunk supported to pass Maybe when it became Nothing for initializied thunks in an alternatie way but it is not used anymore.

- - - - -
a9f8f1fb by Serge S. Gulin at 2024-12-08T14:10:45+03:00
JS: Add trivial optimizations for `unpackCString` and `unpackCStringUtf8`.

It became possible due of introduction strings unfloating at Sinker pass (#13185). Earns few more bytes at optimizations.

- - - - -
b519c06b by Serge S. Gulin at 2024-12-08T15:50:26+03:00
JS: Specialize unpackCString# CAFs (fixes #24744)

Code analysis shown that such optimization would be possible out of the box if `cachedIdentForId` allowed to do that for Haskell `Id`s which are represented by few JavaScript `Ident`s. It is a usual for strings which are represented at JavaScript as a pair of 2 values: the string content and the offset where to start reading actual string from the full content. Usually offset is 0 but technically we need to allow such complex structures to be treated as "global".

Enabling it there shown that `genToplevelRhs` and `globalOccs` had inaccuracies in their implementations:
1. `globalOccs` operated over JavaScript's `Ident`s but for complex structures it didn't pay attention to the fact that different Idents actually could be pointed to same Id. Now the algo is changed to calculate occurencies for Ids.
2. `genToplevelRhs` didn't assume that different Idents pointed to same Id can have mixed order of occurence. But actually the order is important. Strings are encoded into 2 variables where first is content and second is offset and their order are not interchangeable. It is fixed by regeneration Idents from collected Ids which is fine because all Idents generation is passed through the Cache and they are quasi-stable.

- - - - -
a8ceccf3 by Brandon Chinn at 2024-12-09T16:25:43-05:00
Fix panic in multiline string with unterminated gap (#25530)

- - - - -
9e464ad0 by Brandon Chinn at 2024-12-09T16:25:43-05:00
Add test case for unterminated multiline string

- - - - -
ed1ed5c6 by Rodrigo Mesquita at 2024-12-09T16:26:19-05:00
Revert mapMG renaming

We had previously renamed this function for consistency, but that caused unnecessary breakage

- - - - -
158261f7 by Sylvain Henry at 2024-12-09T16:27:01-05:00
RTS: make Cabal flags manual

Cabal shouldn't automatically try to set them. We set them explicitly.

- - - - -
a83b7ed6 by Matthew Stephenson at 2024-12-10T14:01:22-05:00
Add missing @since documentation for (!?) function
- - - - -
e745e3a3 by Ben Gamari at 2024-12-10T14:01:59-05:00
compiler: Don't attempt to TSAN-instrument SIMD operations

TSAN only provides instrumentation for 8, 16, 32, and 64-bit memory
loads/stores. Don't attempt to instrument wider operations.

Fixes #25563.

- - - - -
684c0018 by Ben Gamari at 2024-12-10T14:02:35-05:00
gitlab/ci: Don't clobber RUNTEST_ARGS

Previously the logic handling `IGNORE_PERF_FAILURES` clobbered the
user's `RUNTEST_ARGS`. Fix this.

- - - - -
41dae5b8 by Ben Gamari at 2024-12-10T14:03:11-05:00
hadrian: Mitigate mktexfmt race

At least some versions of Texlive's `mktexfmt` utility cannot be invoked
concurrently in their initial run since they fail to handle failure of
`mkdir` due to racing. Specifically, we see

```
| Run Xelatex: users_guide.tex => /tmp/extra-dir-9616886274866
| Run Xelatex: Haddock.tex => /tmp/extra-dir-9616886274869
This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020) (preloaded format=xelatex)
 restricted \write18 enabled.
kpathsea: Running mktexfmt xelatex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /usr/share/texlive/texmf-dist/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /builds/ghc/ghc/tmp-home/.texlive2020/texmf-config/web2c/fmtutil.cnf
/usr/bin/mktexfmt: mkdir(/builds/ghc/ghc/tmp-home/.texlive2020/texmf-var/web2c/) failed for tree /builds/ghc/ghc/tmp-home/.texlive2020/texmf-var/web2c: File exists at /usr/share/texlive/tlpkg/TeXLive/TLUtils.pm line 937.
I can't find the format file `xelatex.fmt'!
```

That is two `mktexfmt` invocations (for the user's guide and haddock
builds) attempted to create `$HOME/texlive2020/texmf-var/web2c` and
raced. One of the two `mkdir`'s consequently failed, bringing down the
entire build.

We avoid this by ensuring that the first `xelatex` invocation is always
performed serially.

Fixes #25564.

- - - - -
9efbc51f by Ben Gamari at 2024-12-10T14:03:48-05:00
rts/CheckUnload: Reset old_objects if unload is skipped

Previously `checkUnload` failed to reset `old_objects` when it decided
not to unload (e.g. due to heap profiling being enabled).

Fixes #24935.

- - - - -
5192a75f by Ben Gamari at 2024-12-11T04:28:11-05:00
rts: Annotate BCOs with their Name

This introduces a new bytecode instruction, `BCO_NAME`, to aid in debugging
bytecode execution. This instruction is injected by `mkProtoBCO` and
captures the Haskell name of the BCO. It is then printed by the
disassembler, allowing ready correlation with STG dumps.

- - - - -
99225996 by Ben Gamari at 2024-12-11T04:28:48-05:00
configure: Implement ld override whitelist

Bring `configure` into alignment with `ghc-toolchain`, ensuring that the
ld-override logic will only take effect on Linux and Windows.

Fixes #25501.

- - - - -
4a8fc928 by Ben Gamari at 2024-12-11T12:33:42+00:00
testsuite: Unmark T14028 as broken on FreeBSD

This now appears to pass on FreeBSD 14.

Closes #19723.

- - - - -
d7c0eb5a by Ben Gamari at 2024-12-11T12:33:42+00:00
gitlab-ci: Migrate FreeBSD runner tag to FreeBSD 14

- - - - -
7246dacc by Ben Gamari at 2024-12-11T12:33:42+00:00
gitlab-ci: Reintroduce FreeBSD 14 job

- - - - -
4af936da by Ben Gamari at 2024-12-11T12:33:42+00:00
gitlab-ci: Allow use of newer cabal-install bindists

Newer cabal-install bindists have internal directory structure.
Here we detect and account for the presence of such structure.

- - - - -
cbf38c1b by Ben Gamari at 2024-12-11T12:33:42+00:00
gitlab-ci: Enable documentation build on FreeBSD 14

- - - - -
d68107fb by Ben Gamari at 2024-12-11T12:33:42+00:00
gitlab-ci: Use system libffi on FreeBSD

- - - - -
fea3b590 by Ben Gamari at 2024-12-11T12:33:42+00:00
testsuite: Mark linker_unload as broken on FreeeBSD

Due to #25491.

- - - - -
ccf171ee by Ben Gamari at 2024-12-11T12:33:42+00:00
gitlab-ci: Prefer system toolchain on FreeBSD

It's not uncommon to find machines with gcc installed via ports. We
should be using the system's default clang-based toolchain instead.

- - - - -
cfb34738 by Ben Gamari at 2024-12-11T12:33:42+00:00
testsuite: Mark T21969 as broken on FreeBSD

Due to #25512.

- - - - -
0b64e37c by Ben Gamari at 2024-12-11T12:33:42+00:00
testsuite: Mark RestartEventLogging as broken on FreeBSD

I am seeing this fail quite reproducibly.

Due to #19724.

- - - - -
3b412019 by Ben Gamari at 2024-12-11T12:33:42+00:00
testsuite: Mark T16180 as "broken" on FreeBSD

Sadly we in fact need to skip it as it merely times out during
compilation.

See #14012.

- - - - -
57e3cab5 by Ben Gamari at 2024-12-11T12:33:42+00:00
testsuite: Skip T16992 unless in slow speed

This test has extraordinary memory requirements and tests a rather
niche aspect of the compact region mechanism. It has been suggested
multiple times that we shouldn't run it in the default testsuite
configuration. Finally implement this.

See #21890.
See #21892.

- - - - -
f08a72eb by Ben Gamari at 2024-12-11T19:30:54-05:00
rts(setNumCapabilities): Assert that n_caps < MAX_N_CAPS

It was noticed in #25560 that this would previously be allowed,
resulting in a segfault.

I will add a proper exception in `base` in a future commit.

- - - - -
e10d31ad by Ben Gamari at 2024-12-11T19:30:55-05:00
ghc-internal: Fix inconsistent FFI import types

The foreign imports of `enabled_capabilities` and
`getNumberOfProcessors` were declared as `CInt` whereas they are defined
as `uint32_t`.

- - - - -
06265655 by Ben Gamari at 2024-12-11T19:30:55-05:00
rts: Mention maximum capability count in users guide

Addresses #25560.

- - - - -
d488470b by Ben Gamari at 2024-12-11T19:30:55-05:00
rts/Capability: Move induction variable declaration into `for`s

Just a stylistic change.

- - - - -
71f050b7 by Ben Gamari at 2024-12-11T19:30:55-05:00
rts: Determine max_n_capabilities at RTS startup

Previously the maximum number of capabilities supported by the RTS was
statically capped at 256. However, this bound is uncomfortably low given
the size of today's machine.

While supporting unbounded, fully-dynamic adjustment would be nice, it
is complex and so instead we do something simpler: Probe the logical
core count at RTS startup and use this as the static bound for the rest
of our execution.

This should avoid users running into the capability limit on large
machines while avoiding wasting memory on a large capabilities array for
most users and keeping complexity at bay.

Addresses #25560.

- - - - -
1e84b411 by Ben Gamari at 2024-12-11T19:30:55-05:00
testsuite: Introduce req_c_rts

As suggested by @hsyl20, this is intended to mark tests that rely on the
behavior of the C RTS.

- - - - -
683115a4 by Ben Gamari at 2024-12-11T19:30:55-05:00
testsuite: Add test for #25560

- - - - -
ef2052a8 by Ben Gamari at 2024-12-12T04:42:32-05:00
testsuite: Only run T14497_compact in normal way

This test targets the compacting GC so it makes little sense to run it
across all ways. Moreover, it outright conflicts with the `nonmoving`
way.

- - - - -
34d3e8e6 by Ben Gamari at 2024-12-12T04:43:08-05:00
rts/CheckUnload: Don't prepare to unload if we can't unload

Previously `prepareUnloadCheck` would move the `objects` list to
`old_objects` even when profiling (where we cannot unload). This caused
us to vacate the `objects` list during major GCs, losing track of loaded
objects. Fix this by ensuring that `prepareUnloadCheck` and
`checkUnload` both use the same short-cutting logic.

- - - - -
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.

- - - - -
79fd071c by Ben Gamari at 2024-12-20T11:28:52-05:00
check-submodules: initial commit

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitmodules
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/ThreadSanitizer.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/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/Graph/Directed/Reachability.hs
- compiler/GHC/Data/Unboxed.hs
- compiler/GHC/Driver/Config/Core/Rules.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/441d18668a411b33b446ff2fcc2772c891891ede...79fd071c4dd2c38190d164f524339602da920d5b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/441d18668a411b33b446ff2fcc2772c891891ede...79fd071c4dd2c38190d164f524339602da920d5b
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/20241220/57765be1/attachment-0001.html>


More information about the ghc-commits mailing list