[Git][ghc/ghc][wip/haskell-nix-patches/musl64/ghc-9.6-0006-Adds-support-for-Hidden-symbols] 117 commits: compiler: Turn `FinderCache` into a record of operations so that GHC API clients can

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Tue Aug 20 14:02:20 UTC 2024



Sylvain Henry pushed to branch wip/haskell-nix-patches/musl64/ghc-9.6-0006-Adds-support-for-Hidden-symbols at Glasgow Haskell Compiler / GHC


Commits:
0d170eaf by Zubin Duggal at 2024-07-04T11:08:41-04:00
compiler: Turn `FinderCache` into a record of operations so that GHC API clients can
have full control over how its state is managed by overriding `hsc_FC`.

Also removes the `uncacheModule` function as this wasn't being used by anything
since 1893ba12fe1fa2ade35a62c336594afcd569736e

Fixes #23604

- - - - -
4664997d by Teo Camarasu at 2024-07-04T11:09:18-04:00
Add HasCallStack to T23221

This makes the test a bit easier to debug

- - - - -
66919dcc by Teo Camarasu at 2024-07-04T11:09:18-04:00
rts: use live words to estimate heap size

We use live words rather than live blocks to determine the size of the
heap for determining memory retention.

Most of the time these two metrics align, but they can come apart in
normal usage when using the nonmoving collector.

The nonmoving collector leads to a lot of partially occupied blocks. So,
using live words is more accurate.

They can also come apart when the heap is suffering from high levels
fragmentation caused by small pinned objects, but in this case, the
block size is the more accurate metric. Since this case is best avoided
anyway. It is ok to accept the trade-off that we might try (and
probably) fail to return more memory in this case.

See also the Note [Statistics for retaining memory]

Resolves #23397

- - - - -
8dfca66a by Oleg Grenrus at 2024-07-04T11:09:55-04:00
Add reflections of GHC.TypeLits/Nats type families

-------------------------
Metric Increase:
    ghc_experimental_dir
    ghc_experimental_so
-------------------------

- - - - -
6c469bd2 by Adam Gundry at 2024-07-04T11:10:33-04:00
Correct -Wpartial-fields warning to say "Definition" rather than "Use"

Fixes #24710.  The message and documentation for `-Wpartial-fields` were
misleading as (a) the warning occurs at definition sites rather than use
sites, and (b) the warning relates to the definition of a field independently
of the selector function (e.g. because record updates are also partial).

- - - - -
977b6b64 by Max Ulidtko at 2024-07-04T11:11:11-04:00
GHCi: Support local Prelude

Fixes #10920, an issue where GHCi bails out when started alongside a
file named Prelude.hs or Prelude.lhs (even empty file suffices).

The in-source Note [GHCi and local Preludes] documents core reasoning.

Supplementary changes:

 * add debug traces for module lookups under -ddump-if-trace;
 * drop stale comment in GHC.Iface.Load;
 * reduce noise in -v3 traces from GHC.Utils.TmpFs;
 * new test, which also exercizes HomeModError.

- - - - -
87cf4111 by Ryan Scott at 2024-07-04T11:11:47-04:00
Add missing gParPat in cvtp's ViewP case

When converting a `ViewP` using `cvtp`, we need to ensure that the view pattern
is parenthesized so that the resulting code will parse correctly when
roundtripped back through GHC's parser.

Fixes #24894.

- - - - -
b05613c5 by Adam Gundry at 2024-07-04T11:12:23-04:00
Use structured error representation for module cycle errors (see #18516)

This removes the re-export of cyclicModuleErr from the top-level GHC module.

- - - - -
70389749 by Adam Gundry at 2024-07-04T11:12:23-04:00
Use structured error representation when reloading a nonexistent module

- - - - -
680ade3d by sheaf at 2024-07-04T11:12:23-04:00
Use structured errors for a Backpack instantiation error

- - - - -
97c6d6de by sheaf at 2024-07-04T11:12:23-04:00
Move mkFileSrcSpan to GHC.Unit.Module.Location

- - - - -
f9e7bd9b by Adriaan Leijnse at 2024-07-04T11:12:59-04:00
ttg: Remove SourceText from OverloadedLabel

Progress towards #21592

- - - - -
00d63245 by Alexander Foremny at 2024-07-04T11:12:59-04:00
AST: GHC.Prelude -> Prelude

Refactor occurrences to GHC.Prelude with Prelude within
Language/Haskell.

Progress towards #21592

- - - - -
cc846ea5 by Alexander Foremny at 2024-07-04T11:12:59-04:00
AST: remove occurrences of GHC.Unit.Module.ModuleName

`GHC.Unit.Module` re-exports `ModuleName` from
`Language.Haskell.Syntax.Module.Name`.

Progress towards #21592

- - - - -
24c7d287 by Fabian Kirchner at 2024-07-04T11:12:59-04:00
AST: move Data instance definition for ModuleName to GHC.Unit.Types

To remove the dependency on GHC.Utils.Misc inside
Language.Haskell.Syntax.Module.Name, the instance definition is moved
from there into GHC.Unit.Types.

Progress towards #21592

- - - - -
6cbba381 by Fabian Kirchner at 2024-07-04T11:12:59-04:00
AST: move negateOverLitVal into GHC.Hs.Lit

The function negateOverLitVal is not used within Language.Haskell and
therefore can be moved to the respective module inside GHC.Hs.

Progress towards #21592

- - - - -
611aa7c6 by Fabian Kirchner at 2024-07-04T11:12:59-04:00
AST: move conDetailsArity into GHC.Rename.Module

The function conDetailsArity is only used inside GHC.Rename.Module.  We
therefore move it there from Language.Haskell.Syntax.Lit.

Progress towards #21592

- - - - -
1b968d16 by Mauricio at 2024-07-04T11:12:59-04:00
AST: Remove GHC.Utils.Assert from GHC

Simple cleanup.

Progress towards #21592

- - - - -
3d192e5d by Fabian Kirchner at 2024-07-04T11:12:59-04:00
ttg: extract Specificity, ForAllTyFlag and helper functions from GHC.Types.Var

Progress towards #21592

Specificity, ForAllTyFlag and its' helper functions are extracted from
GHC.Types.Var and moved into a new module Language.Haskell.Syntax.Specificity.

Note: Eventually (i.e. after Language.Haskell.Syntax.Decls does not depend on
GHC.* anymore) these should be moved into Language.Haskell.Syntax.Decls.
At this point, this would cause cyclic dependencies.

- - - - -
257d1adc by Adowrath at 2024-07-04T11:12:59-04:00
ttg: Split HsSrcBang, remove ref to DataCon from Syntax.Type

Progress towards #21592

This splits HsSrcBang up, creating the new HsBang within
`Language.Haskell.Syntax.Basic`. `HsBang` holds the unpackedness
and strictness information, while `HsSrcBang` only adds the SourceText
for usage within the compiler directly.

Inside the AST, to preserve the SourceText, it is hidden behind the
pre-existing extension point `XBindTy`. All other occurrences of
`HsSrcBang` were adapted to deconstruct the inner `HsBang`, and when
interacting with the `BindTy` constructor, the hidden `SourceText` is
extracted/inserted into the `XBindTy` extension point.

`GHC.Core.DataCon` exports both `HsSrcBang` and `HsBang` for
convenience. A constructor function `mkHsSrcBang` that takes all
individual components has been added.

Two exceptions has been made though:
- The `Outputable HsSrcBang` instance is replaced by
  `Outputable HsBang`. While being only GHC-internal, the only place
  it's used is in outputting `HsBangTy` constructors -- which already
  have `HsBang`. It wouldn't make sense to reconstruct a `HsSrcBang` just
  to ignore the `SourceText` anyway.
- The error `TcRnUnexpectedAnnotation` did not use the `SourceText`,
  so it too now only holds a `HsBang`.

- - - - -
24757fec by Mauricio at 2024-07-04T11:12:59-04:00
AST: Moved definitions that use GHC.Utils.Panic to GHC namespace

Progress towards #21592

- - - - -
9be49379 by Mike Pilgrem at 2024-07-04T11:13:41-04:00
Fix #25032 Refer to Cabal's `includes` field, not `include-files`

- - - - -
9e2ecf14 by Andrew Lelechenko at 2024-07-04T11:14:17-04:00
base: fix more missing changelog entries

- - - - -
a82121b3 by Peter Trommler at 2024-07-04T11:14:53-04:00
X86 NCG: Fix argument promotion in foreign C calls

Promote 8 bit and 16 bit signed arguments by sign extension.

Fixes #25018

- - - - -
fab13100 by Bryan Richter at 2024-07-04T11:15:29-04:00
Add .gitlab/README.md with creds instructions

- - - - -
564981bd by Matthew Pickering at 2024-07-05T07:35:29-04:00
configure: Set LD_STAGE0 appropiately when 9.10.1 is used as a boot compiler

In 9.10.1 the "ld command" has been removed, so we fall back to using
the more precise "merge objects command" when it's available as
LD_STAGE0 is only used to set the object merging command in hadrian.

Fixes #24949

- - - - -
a949c792 by Matthew Pickering at 2024-07-05T07:35:29-04:00
hadrian: Don't build ghci object files for ./hadrian/ghci target

There is some convoluted logic which determines whether we build ghci
object files are not. In any case, if you set `ghcDynPrograms = pure
False` then it forces them to be built.

Given we aren't ever building executables with this flavour it's fine
to leave `ghcDynPrograms` as the default and it should be a bit faster
to build less.

Also fixes #24949

- - - - -
48bd8f8e by Matthew Pickering at 2024-07-05T07:36:06-04:00
hadrian: Remove STG dump from ticky_ghc flavour transformer

This adds 10-15 minutes to build time, it is a better strategy to
precisely enable dumps for the modules which show up prominently in a
ticky profile.

Given I am one of the only people regularly building ticky compilers I
think it's worthwhile to remove these.

Fixes #23635

- - - - -
5b1aefb7 by Matthew Pickering at 2024-07-05T07:36:06-04:00
hadrian: Add dump_stg flavour transformer

This allows you to write `--flavour=default+ticky_ghc+dump_stg` if you
really want STG for all modules.

- - - - -
ab2b60b6 by Sven Tennie at 2024-07-08T15:03:41-04:00
AArch64: Simplify stmtToInstrs type

There's no need to hand `Nothing`s around... (there was no case with a
`BlockId`.)

- - - - -
71a7fa8c by Sven Tennie at 2024-07-08T15:03:41-04:00
AArch64: Simplify stmtsToInstrs type

The `BlockId` parameter (`bid`) is never used, only handed around.
Deleting it simplifies the surrounding code.

- - - - -
8bf6fd68 by Simon Peyton Jones at 2024-07-08T15:04:17-04:00
Fix eta-expansion in Prep

As #25033 showed, we were eta-expanding in a way that broke a join point,
which messed up Note [CorePrep invariants].

The fix is rather easy.  See Wrinkle (EA1) of
Note [Eta expansion of arguments in CorePrep]

- - - - -
96acf823 by Sjoerd Visscher at 2024-07-09T06:16:14-04:00
One-shot Haddock

- - - - -
74ec4c06 by Sjoerd Visscher at 2024-07-09T06:16:14-04:00
Remove haddock-stdout test option

Superseded by output handling of Hadrian

- - - - -
ed8a8f0b by Rodrigo Mesquita at 2024-07-09T06:16:51-04:00
ghc-boot: Relax Cabal bound

Fixes #25013

- - - - -
3f9548fe by Matthew Pickering at 2024-07-09T06:17:36-04:00
ci: Unset ALEX/HAPPY variables when testing bootstrap jobs

Ticket #24826 reports a regression in 9.10.1 when building from a source
distribution. This patch is an attempt to reproduce the issue on CI by
more aggressively removing `alex` and `happy` from the environment.

- - - - -
aba2c9d4 by Andrea Bedini at 2024-07-09T06:17:36-04:00
hadrian: Ignore build-tool-depends fields in cabal files

hadrian does not utilise the build-tool-depends fields in cabal files
and their presence can cause issues when building source distribution
(see #24826)

Ideally Cabal would support building "full" source distributions which
would remove the need for workarounds in hadrian but for now we can
patch the build-tool-depends out of the cabal files.

Fixes #24826

- - - - -
12bb9e7b by Matthew Pickering at 2024-07-09T06:18:12-04:00
testsuite: Don't attempt to link when checking whether a way is supported

It is sufficient to check that the simple test file compiles as it will
fail if there are not the relevant library files for the requested way.

If you break a way so badly that even a simple executable fails to link
(as I did for profiled dynamic way), it will just mean the tests for
that way are skipped on CI rather than displayed.

- - - - -
46ec0a8e by Torsten Schmits at 2024-07-09T13:37:02+02:00
Improve docs for NondecreasingIndentation

The text stated that this affects indentation of layouts nested in do
expressions, while it actually affects that of do layouts nested in any
other.

- - - - -
dddc9dff by Zubin Duggal at 2024-07-12T11:41:24-04:00
compiler: Fingerprint -fwrite-if-simplified-core

We need to recompile if this flag is changed because later modules might depend on the
simplified core for this module if -fprefer-bytecode is enabled.

Fixes #24656

- - - - -
145a6477 by Matthew Pickering at 2024-07-12T11:42:00-04:00
Add support for building profiled dynamic way

The main payload of this change is to hadrian.

* Default settings will produced dynamic profiled objects
* `-fexternal-interpreter` is turned on in some situations when there is
  an incompatibility between host GHC and the way attempting to be
  built.
* Very few changes actually needed to GHC

There are also necessary changes to the bootstrap plans to work with the
vendored Cabal dependency. These changes should ideally be reverted by
the next GHC release.

In hadrian support is added for building profiled dynamic libraries
(nothing too exciting to see there)

Updates hadrian to use a vendored Cabal submodule, it is important that
we replace this usage with a released version of Cabal library before
the 9.12 release.

Fixes #21594

-------------------------
Metric Increase:
    libdir
-------------------------

- - - - -
414a6950 by Matthew Pickering at 2024-07-12T11:42:00-04:00
testsuite: Make find_so regex more precise

The hash contains lowercase [a-z0-9] and crucially not _p which meant we
sometimes matched on `libHS.._p` profiled shared libraries rather than
the normal shared library.

- - - - -
dee035bf by Alex Mason at 2024-07-12T11:42:41-04:00
ncg(aarch64): Add fsqrt instruction, byteSwap primitives [#24956]

Implements the FSQRT machop using native assembly rather than a C call.

Implements MO_BSwap by producing assembly to do the byte swapping
instead of producing a foreign call a C function.

In `tar`, the hot loop for `deserialise` got almost 4x faster by
avoiding the foreign call which caused spilling live variables to the
stack -- this means the loop did 4x more memory read/writing than
necessary in that particular case!

- - - - -
5104ee61 by Sylvain Henry at 2024-07-12T11:43:23-04:00
Linker: use m32 allocator for sections when NEED_PLT (#24432)

Use M32 allocator to avoid fragmentation when allocating ELF sections.
We already did this when NEED_PLT was undefined. Failing to do this led
to relocations impossible to fulfil (#24432).

- - - - -
52d66984 by Sylvain Henry at 2024-07-12T11:43:23-04:00
RTS: allow M32 allocation outside of 4GB range when assuming -fPIC

- - - - -
c34fef56 by Sylvain Henry at 2024-07-12T11:43:23-04:00
Linker: fix stub offset

Remove unjustified +8 offset that leads to memory corruption (cf
discussion in #24432).

- - - - -
280e4bf5 by Simon Peyton Jones at 2024-07-12T11:43:59-04:00
Make type-equality on synonyms a bit faster

This MR make equality fast for (S tys1 `eqType` S tys2),
where S is a non-forgetful type synonym.

It doesn't affect compile-time allocation much, but then comparison doesn't
allocate anyway.  But it seems like a Good Thing anyway.

See Note [Comparing type synonyms] in GHC.Core.TyCo.Compare
and Note [Forgetful type synonyms] in GHC.Core.TyCon

Addresses #25009.

- - - - -
cb83c347 by Alan Zimmerman at 2024-07-12T11:44:35-04:00
EPA: Bring back SrcSpan in EpaDelta

When processing files in ghc-exactprint, the usual workflow is to
first normalise it with makeDeltaAst, and then operate on it.

But we need the original locations to operate on it, in terms of
finding things.

So restore the original SrcSpan for reference in EpaDelta

- - - - -
7bcda869 by Matthew Pickering at 2024-07-12T11:45:11-04:00
Update alpine release job to 3.20

alpine 3.20 was recently released and uses a new python and sphinx
toolchain which could be useful to test.

- - - - -
43aa99b8 by Matthew Pickering at 2024-07-12T11:45:11-04:00
testsuite: workaround bug in python-3.12

There is some unexplained change to binding behaviour in python-3.12
which requires moving this import from the top-level into the scope of
the function.

I didn't feel any particular desire to do a deep investigation as to why
this changed as the code works when modified like this. No one in the
python IRC channel seemed to know what the problem was.

- - - - -
e3914028 by Adam Sandberg Ericsson at 2024-07-12T11:45:47-04:00
initialise mmap_32bit_base during RTS startup #24847
- - - - -
86b8ecee by Hécate Kleidukos at 2024-07-12T11:46:27-04:00
haddock: Only fetch supported languages and extensions once per Interface list

This reduces the number of operations done on each Interface, because
supported languages and extensions are determined from architecture and
operating system of the build host. This information remains stable
across Interfaces, and as such doesn not need to be recovered for each
Interface.

- - - - -
4f85366f by sheaf at 2024-07-13T05:58:14-04:00
Testsuite: use py-cpuinfo to compute CPU features

This replaces the rather hacky logic we had in place for checking
CPU features. In particular, this means that feature availability now
works properly on Windows.

- - - - -
41f1354d by Matthew Pickering at 2024-07-13T05:58:51-04:00
testsuite: Replace $CC with $TEST_CC

The TEST_CC variable should be set based on the test compiler, which may
be different to the compiler which is set to CC on your system (for
example when cross compiling).

Fixes #24946

- - - - -
572fbc44 by sheaf at 2024-07-15T08:30:32-04:00
isIrrefutableHsPat: consider COMPLETE pragmas

This patch ensures we taken into account COMPLETE pragmas when we
compute whether a pattern is irrefutable. In particular, if a pattern
synonym is the sole member of a COMPLETE pragma (without a result TyCon),
then we consider a pattern match on that pattern synonym to be irrefutable.

This affects the desugaring of do blocks, as it ensures we don't use
a "fail" operation.

Fixes #15681 #16618 #22004

- - - - -
84dadea9 by Zubin Duggal at 2024-07-15T08:31:09-04:00
haddock: Handle non-hs files, so that haddock can generate documentation for modules with
foreign imports and template haskell.

Fixes #24964

- - - - -
0b4ff9fa by Zubin Duggal at 2024-07-15T12:12:30-04:00
haddock: Keep track of warnings/deprecations from dependent packages in `InstalledInterface`
and use this to propagate these on items re-exported from dependent packages.

Fixes #25037

- - - - -
b8b4b212 by Zubin Duggal at 2024-07-15T12:12:30-04:00
haddock: Keep track of instance source locations in `InstalledInterface` and use this to add
source locations on out of package instances

Fixes #24929

- - - - -
559a7a7c by Matthew Pickering at 2024-07-15T12:13:05-04:00
ci: Refactor job_groups definition, split up by platform

The groups are now split up so it's easier to see which jobs are
generated for each platform

No change in behaviour, just refactoring.

- - - - -
20383006 by Matthew Pickering at 2024-07-16T11:48:25+01:00
ci: Replace debian 10 with debian 12 on validation jobs

Since debian 10 is now EOL we migrate onwards to debian 12 as the basis
for most platform independent validation jobs.

- - - - -
12d3b66c by Matthew Pickering at 2024-07-17T13:22:37-04:00
ghcup-metadata: Fix use of arch argument

The arch argument was ignored when making the jobname, which lead to
failures when generating metadata for the alpine_3_18-aarch64 bindist.

Fixes #25089

- - - - -
bace981e by Matthew Pickering at 2024-07-19T10:14:02-04:00
testsuite: Delay querying ghc-pkg to find .so dirs until test is run

The tests which relied on find_so would fail when `test` was run
before the tree was built. This was because `find_so` was evaluated too
eagerly.

We can fix this by waiting to query the location of the libraries until
after the compiler has built them.

- - - - -
478de1ab by Torsten Schmits at 2024-07-19T10:14:37-04:00
Add `complete` pragmas for backwards compat patsyns `ModLocation` and `ModIface`

!12347 and !12582 introduced breaking changes to these two constructors
and mitigated that with pattern synonyms.

- - - - -
b57792a8 by Matthew Pickering at 2024-07-19T10:15:13-04:00
ci: Fix ghcup-metadata generation (again)

I made some mistakes in 203830065b81fe29003c1640a354f11661ffc604

* Syntax error
* The aarch-deb11 bindist doesn't exist

I tested against the latest nightly pipeline locally:

```
nix run .gitlab/generate-ci#generate-job-metadata
nix shell -f .gitlab/rel_eng/ -c ghcup-metadata --pipeline-id 98286 --version 9.11.20240715 --fragment --date 2024-07-17 --metadata=/tmp/meta
```

- - - - -
1fa35b64 by Andreas Klebinger at 2024-07-19T17:35:20+02:00
Revert "Allow non-absolute values for bootstrap GHC variable"

This broke configure in subtle ways resulting in #25076 where hadrian
didn't end up the boot compiler it was configured to use.

This reverts commit 209d09f52363b261b900cf042934ae1e81e2caa7.

- - - - -
55117e13 by Simon Peyton Jones at 2024-07-24T02:41:12-04:00
Fix bad bug in mkSynonymTyCon, re forgetfulness

As #25094 showed, the previous tests for forgetfulness was
plain wrong, when there was a forgetful synonym in the RHS
of a synonym.

- - - - -
a8362630 by Sergey Vinokurov at 2024-07-24T12:22:45-04:00
Define Eq1, Ord1, Show1 and Read1 instances for basic Generic representation types

This way the Generically1 newtype could be used to derive Eq1 and Ord1
for user types with DerivingVia.

The CLC proposal is https://github.com/haskell/core-libraries-committee/issues/273.

The GHC issue is https://gitlab.haskell.org/ghc/ghc/-/issues/24312.

- - - - -
de5d9852 by Simon Peyton Jones at 2024-07-24T12:23:22-04:00
Address #25055, by disabling case-of-runRW# in Gentle phase

See Note [Case-of-case and full laziness]
in GHC.Driver.Config.Core.Opt.Simplify

- - - - -
3f89ab92 by Andreas Klebinger at 2024-07-25T14:12:54+02:00
Fix -freg-graphs for FP and AARch64 NCG (#24941).

It seems we reserve 8 registers instead of four for global regs
based on the layout in Note [AArch64 Register assignments].

I'm not sure it's neccesary, but for now we just accept this state of
affairs and simple update -fregs-graph to account for this.

- - - - -
f6b4c1c9 by Simon Peyton Jones at 2024-07-27T09:45:44-04:00
Fix nasty bug in occurrence analyser

As #25096 showed, the occurrence analyser was getting one-shot info
flat out wrong.

This commit does two things:

* It fixes the bug and actually makes the code a bit tidier too.
  The work is done in the new function
     GHC.Core.Opt.OccurAnal.mkRhsOccEnv,
  especially the bit that prepares the `occ_one_shots` for the RHS.

  See Note [The OccEnv for a right hand side]

* When floating out a binding we must be conservative about one-shot
  info.  But we were zapping the entire demand info, whereas we only
  really need zap the /top level/ cardinality.

  See Note [Floatifying demand info when floating]
  in GHC.Core.Opt.SetLevels

For some reason there is a 2.2% improvement in compile-time allocation
for CoOpt_Read.  Otherwise nickels and dimes.

Metric Decrease:
    CoOpt_Read

- - - - -
646ee207 by Torsten Schmits at 2024-07-27T09:46:20-04:00
add missing cell in flavours table

- - - - -
ec2eafdb by Ben Gamari at 2024-07-28T20:51:12+02:00
users-guide: Drop mention of dead __PARALLEL_HASKELL__ macro

This has not existed for over a decade.

- - - - -
e2f2a56e by Arnaud Spiwack at 2024-07-28T22:21:07-04:00
Add tests for 25081

- - - - -
23f50640 by Arnaud Spiwack at 2024-07-28T22:21:07-04:00
Scale multiplicity in list comprehension

Fixes #25081

- - - - -
d2648289 by romes at 2024-07-30T01:38:12-04:00
TTG HsCmdArrForm: use Fixity via extension point

Also migrate Fixity from GHC.Hs to Language.Haskell.Syntax
since it no longer uses any GHC-specific data types.

Fixed arrow desugaring bug. (This was dead code before.)
Remove mkOpFormRn, it is also dead code, only used in the arrow
desugaring now removed.

Co-authored-by: Fabian Kirchner <kirchner at posteo.de>
Co-authored-by: Alan Zimmerman <alan.zimm at gmail.com>

- - - - -
e258ad54 by Matthew Pickering at 2024-07-30T01:38:48-04:00
ghcup-metadata: More metadata fixes

* Incorrect version range on the alpine bindists
* Missing underscore in "unknown_versioning"

Fixes #25119

- - - - -
72b54c07 by Rodrigo Mesquita at 2024-08-01T00:47:29-04:00
Deriving-via one-shot strict state Monad instances

A small refactor to use deriving via GHC.Utils.Monad.State.Strict
Monad instances for state Monads with unboxed/strict results which all
re-implemented the one-shot trick in the instance and used unboxed
tuples:

* CmmOptM in GHC.Cmm.GenericOpt
* RegM in GHC.CmmToAsm.Reg.Linear.State
* UniqSM in GHC.Types.Unique.Supply

- - - - -
bfe4b3d3 by doyougnu at 2024-08-01T00:48:06-04:00
Rts linker: add case for pc-rel 64 relocation

part of the upstream haskell.nix patches

- - - - -
5843c7e3 by doyougnu at 2024-08-01T00:48:42-04:00
RTS linker: aarch64: better debug information

Dump better debugging information when a symbol address is null.

Part of the haskell.nix patches upstream project

Co-authored-by: Sylvain Henry <sylvain at haskus.fr>

- - - - -
c2e9c581 by Rodrigo Mesquita at 2024-08-01T00:49:18-04:00
base: Add haddocks to HasExceptionContext

Fixes #25091

- - - - -
f954f428 by Sylvain Henry at 2024-08-01T00:49:59-04:00
Only lookup ghcversion.h file in the RTS include-dirs by default.

The code was introduced in 3549c952b535803270872adaf87262f2df0295a4.
It used `getPackageIncludePath` which name doesn't convey that it looks
into all include paths of the preload units too. So this behavior is
probably unintentional and it should be ok to change it.

Fix #25106

- - - - -
951ce3d5 by Matthew Pickering at 2024-08-01T00:50:35-04:00
driver: Fix -Wmissing-home-modules when multiple units have the same module name

It was assumed that module names were unique but that isn't true with
multiple units.

The fix is quite simple, maintain a set of `(ModuleName, UnitId)` and
query that to see whether the module has been specified.

Fixes #25122

- - - - -
bae1fea4 by sheaf at 2024-08-01T00:51:15-04:00
PMC: suggest in-scope COMPLETE sets when possible

This commit modifies GHC.HsToCore.Pmc.Solver.generateInhabitingPatterns
to prioritise reporting COMPLETE sets in which all of the ConLikes
are in scope. This avoids suggesting out of scope constructors
when displaying an incomplete pattern match warning, e.g. in

  baz :: Ordering -> Int
  baz = \case
    EQ -> 5

we prefer:

  Patterns of type 'Ordering' not matched:
      LT
      GT

over:

  Patterns of type 'Ordering' not matched:
      OutOfScope

Fixes #25115

- - - - -
ff158fcd by Tommy Bidne at 2024-08-02T01:14:32+12:00
Print exception metadata in default handler

CLC proposals 231 and 261:

- Add exception type metadata to SomeException's displayException.
- Add "Exception" header to default exception handler.

See:

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

Update stm submodule for test fixes.

- - - - -
8b2f70a2 by Andrei Borzenkov at 2024-08-01T23:00:46-04:00
Type syntax in expressions (#24159, #24572, #24226)

This patch extends the grammar of expressions with syntax that is
typically found only in types:
  * function types (a -> b), (a ->. b), (a %m -> b)
  * constrained types (ctx => t)
  * forall-quantification (forall tvs. t)

The new forms are guarded behind the RequiredTypeArguments extension,
as specified in GHC Proposal #281. Examples:

  {-# LANGUAGE RequiredTypeArguments #-}
  e1 = f (Int    -> String)          -- function type
  e2 = f (Int %1 -> String)          -- linear function type
  e3 = f (forall a. Bounded a => a)  -- forall type, constraint

The GHC AST and the TH AST have been extended as follows:

   syntax        | HsExpr   | TH.Exp
  ---------------+----------+--------------
   a -> b        | HsFunArr | ConE (->)
   a %m -> b     | HsFunArr | ConE FUN
   ctx => t      | HsQual   | ConstrainedE
   forall a. t   | HsForAll | ForallE
   forall a -> t | HsForAll | ForallVisE

Additionally, a new warning flag -Wview-pattern-signatures has been
introduced to aid with migration to the new precedence of (e -> p :: t).

Co-authored-by: Vladislav Zavialov <vlad.z.4096 at gmail.com>

- - - - -
66e7f57d by Brandon Chinn at 2024-08-01T21:50:58-07:00
Implement MultilineStrings (#24390)

This commit adds support for multiline strings, proposed at
https://github.com/ghc-proposals/ghc-proposals/pull/569.
Multiline strings can now be written as:

    myString =
      """
      this is a
      multiline string
      """

The multiline string will have leading indentation stripped away.
Full details of this post-processing may be found at the new
GHC.Parser.String module.

In order to cleanly implement this and maximize reusability, I
broke out the lexing logic for strings out of Lexer.x into a
new GHC.Parser.String module, which lexes strings with any
provided "get next character" function. This also gave us the
opportunity to clean up this logic, and even optimize it a bit.
With this change, parsing string literals now takes 25% less
time and 25% less space.

- - - - -
cf47b96f by Rodrigo Mesquita at 2024-08-03T05:59:40-04:00
hi: Stable sort avails

Sorting the Avails in DocStructures is required to produce fully
deterministic interface files in presence of re-exported modules.

Fixes #25104

- - - - -
af2ae742 by M. Taimoor Zaeem at 2024-08-03T18:52:50+05:00
haddock: decrease margin on top of small headings

- - - - -
a1e42e7a by Rodrigo Mesquita at 2024-08-05T21:03:04-04:00
hi: Deterministic ImportedMods in Usages

The `mi_usages` field of the interface files must use a deterministic
list of `Usage`s to guarantee a deterministic interface. However, this
list was, in its origins, constructed from a `ModuleEnv` which uses a
non-deterministic ordering that was leaking into the interface.

Specifically, ImportedMods = ModuleEnv ... would get converted to a list and
then passed to `mkUsageInfo` to construct the Usages.

The solution is simple. Back `ImportedMods` with a deterministic map.
`Map Module ...` is enough, since the Ord instance for `Module` already
uses a stable, deterministic, comparison.

Fixes #25131

- - - - -
eb1cb536 by Serge S. Gulin at 2024-08-06T08:54:55+00:00
testsuite: extend size performance tests with gzip (fixes #25046)

The main purpose is to create tests for minimal app (hello world and its variations, i.e. unicode used) distribution size metric.

Many platforms support distribution in compressed form via gzip. It would be nice to collect information on how much size is taken by the executional bundle for each platform at minimal edge case.

2 groups of tests are added:
1. We extend javascript backend size tests with gzip-enabled versions for all cases where an optimizing compiler is used (for now it is google closure compiler).
2. We add trivial hello world tests with gzip-enabled versions for all other platforms at CI pipeline where no external optimizing compiler is used.

- - - - -
d94410f8 by Rodrigo Mesquita at 2024-08-07T11:49:19-04:00
ghc-internal: @since for backtraceDesired

Fixes point 1 in #25052

- - - - -
bfe600f5 by Rodrigo Mesquita at 2024-08-07T11:49:19-04:00
ghc-internal: No trailing whitespace in exceptions

Fixes #25052

- - - - -
62650d9f by Andreas Klebinger at 2024-08-07T11:49:54-04:00
Add since annotation for -fkeep-auto-rules.

This partially addresses #25082.

- - - - -
5f0e23fd by Andreas Klebinger at 2024-08-07T11:49:54-04:00
Mention `-fkeep-auto-rules` in release notes.

It was added earlier but hadn't appeared in any release notes yet.
Partially addresses #25082.

- - - - -
7446a09a by Sylvain Henry at 2024-08-07T11:50:35-04:00
Cmm: don't perform unsound optimizations on 32-bit compiler hosts

- beef61351b240967b49169d27a9a19565cf3c4af enabled the use of
  MO_Add/MO_Sub for 64-bit operations in the C and LLVM backends
- 6755d833af8c21bbad6585144b10e20ac4a0a1ab did the same for the x86 NCG
  backend

However we store some literal values as `Int` in the compiler. As a
result, some Cmm optimizations transformed target 64-bit literals into
compiler `Int`. If the compiler is 32-bit, this leads to computing with
wrong literals (see #24893 and #24700).

This patch disables these Cmm optimizations for 32-bit compilers. This
is unsatisfying (optimizations shouldn't be compiler-word-size
dependent) but it fixes the bug and it makes the patch easy to backport.
A proper fix would be much more invasive but it shall be implemented in
the future.

Co-authored-by: amesgen <amesgen at amesgen.de>

- - - - -
d59faaf2 by Vladislav Zavialov at 2024-08-07T11:51:11-04:00
docs: Update info on RequiredTypeArguments

Add a section on "types in terms" that were implemented in 8b2f70a202
and remove the now outdated suggestion of using `type` for them.

- - - - -
39fd6714 by Sylvain Henry at 2024-08-07T11:51:52-04:00
JS: fix minor typo in base's jsbits

- - - - -
e7764575 by Sylvain Henry at 2024-08-07T11:51:52-04:00
RTS: remove hack to force old cabal to build a library with only JS sources

Need to extend JSC externs with Emscripten RTS definitions to avoid
JSC_UNDEFINED_VARIABLE errors when linking without the emcc rts.

Fix #25138

Some recompilation avoidance tests now fail. This is tracked with the
other instances of this failure in #23013. My hunch is that they were
working by chance when we used the emcc linker.

Metric Decrease:
    T24602_perf_size

- - - - -
d1a40233 by Brandon Chinn at 2024-08-07T11:53:08-04:00
Support multiline strings in type literals (#25132)

- - - - -
610840eb by Sylvain Henry at 2024-08-07T11:53:50-04:00
JS: fix callback documentation (#24377)

Fix #24377

- - - - -
6ae4b76a by Zubin Duggal at 2024-08-13T13:36:57-04:00
haddock: Build haddock-api and haddock-library using hadrian

We build these two packages as regular boot library dependencies rather
than using the `in-ghc-tree` flag to include the source files into the haddock
executable.

The `in-ghc-tree` flag is moved into haddock-api to ensure that haddock built
from hackage can still find the location of the GHC bindist using `ghc-paths`.

Addresses #24834

This causes a metric decrease under non-release flavours because under these
flavours libraries are compiled with optimisation but executables are not.

Since we move the bulk of the code from the haddock executable to the
haddock-api library, we see a metric decrease on the validate flavours.

Metric Decrease:
    haddock.Cabal
    haddock.base
    haddock.compiler

- - - - -
51ffba5d by Arnaud Spiwack at 2024-08-13T13:37:50-04:00
Add an extension field to HsRecFields

This is the Right Thing to Do™. And it prepares for storing a
multiplicity coercion there.

First step of the plan outlined here and below
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12947#note_573091

- - - - -
4d2faeeb by Arnaud Spiwack at 2024-08-13T13:37:50-04:00
Add test for #24961

- - - - -
623b4337 by Arnaud Spiwack at 2024-08-13T13:37:50-04:00
Ensures that omitted record fields in pattern have multiplicity Many

Omitted fields were simply ignored in the type checker and produced
incorrect Core code.

Fixes #24961

Metric Increase:
    RecordUpdPerf

- - - - -
c749bdfd by Sylvain Henry at 2024-08-13T13:38:41-04:00
AARCH64 linker: skip NONE relocations

This patch is part of the patches upstreamed from haskell.nix.
See https://github.com/input-output-hk/haskell.nix/pull/1960 for the
original report/patch.

- - - - -
682a6a41 by Brandon Chinn at 2024-08-13T13:39:17-04:00
Support multiline strings in TH

- - - - -
ee0a9c18 by Matthew Pickering at 2024-08-14T14:27:39-04:00
Extend -reexported-module flag to support module renaming

The -reexported-module flag now supports renaming -rexported-modules.

```
-rexported-module "A as B"
```

This feature is only relevant to multi-component sessions.

Fixes #25139

- - - - -
e9496000 by Arnaud Spiwack at 2024-08-14T14:28:20-04:00
Don't restrict eta-reduction of linear functions

This commit simply removes code. All the supporting implementation has
been done as part of !12883.

Closes #25129

- - - - -
2bb4156e by sheaf at 2024-08-14T14:28:56-04:00
Allow @ character in C labels

Generated symbol names can include the '@' character, for example when using
`__attribute__((vectorcall))`.
- - - - -
7602ca23 by Sylvain Henry at 2024-08-14T14:29:36-04:00
Linker: replace blind tuple with a datatype + docs

- - - - -
bdd77b9e by sheaf at 2024-08-16T12:47:11-04:00
isIrrefutableHsPat: look up ConLikes in the HscEnv

At GhcRn stage, in isIrrefutableHsPat we only looked up data constructors
in the RdrEnv, which meant that we lacked fallibility information for
out-of-scope constructors (which can arise from Template Haskell splices).

Instead, we use 'lookupGREInfo', which looks up the information in
the type environment. This was the correct function to call all along,
but was not used in 572fbc44 due to import cycle reasons. The appropriate
functions, 'irrefutableConLike{Rn,Tc}' have been moved to 'GHC.Rename.Env',
which avoids import cycles.

Fixes #25164

- - - - -
4bee377c by Sylvain Henry at 2024-08-16T12:47:53-04:00
Linker: some refactoring to prepare for #24886

- Rename LoadedBCOs into LazyBCOs
- Bundle SptEntries with CompiledByteCode and removed [SptEntry] field
  from the BCOs constructor
- Rename Linkable's LM constructor into Linkable: in the past we had LM
  and LP for Module and Package, now we only have the former.
- Rename Unlinked into LinkablePart (and linkableUnlinked into
  linkableParts)
- Use NonEmpty to encode invariant in Linkable's linkableParts type
- Add helpers: linkableLibs, linkableBCOs, etc.
- Add documentation
- Remove partial nameOfObject
- Rename nameOfObject_maybe into linkablePartPath
- Rename byteCodeOfObject into linkablePartAllBCOs.
- Refactor linkablePartAllBCOs to avoid a panic if a LazyBCO has a C
  stub. Document the fact that LazyBCOs are returned in this case
  (contrary to linkableBCOs which only returns non-lazy ones)

Refactoring done while trying to understand how to adapt the linker code
to support the JS backend too (cf #24886).

- - - - -
fa0dbaca by Mario Blažević at 2024-08-17T03:31:32+00:00
Implements the Exportable Named Default proposal (#24305)

This squashed commit adds support for exportable named defaults, the accepted
GHC proposal at https://github.com/ghc-proposals/ghc-proposals/pull/409

The proposal extends the Haskell '98 declarations

    default (Int, Double)

which were implicitly always applying to Num class alone, to allow specifying
an arbitrary single-parameter class:

    default IsString (Text, String)

The effect of this declaration would be to eliminate the ambiguous type errors
around string literals when OverloadedStrings extension is active. The
declaration by itself has effect only in its module, so the proposal also adds
the ability to export class defaults:

    module MyModule (default IsIstring)

Once the language extension is published and established, we can consider using
it in base and other libraries.

See Note [Named default declarations] in GHC.Tc.Gen.Default
for implementation details.

- - - - -
1deba6b2 by Simon Peyton Jones at 2024-08-17T13:58:13-04:00
Make kick-out more selective

This MR revised the crucial kick-out criteria in the constraint solver.

Ticket #24984 showed an example in which
 * We were kicking out unnecessarily
 * That gave rise to extra work, of course
 * But it /also/ led to exponentially-sized coercions due to lack
   of sharing in coercions (something we want to fix separately #20264)

This MR sharpens up the kick-out criteria; specifially in (KK2) we look
only under type family applications if (fs>=fw).

This forced me to understand the existing kick-out story, and I ended
up rewriting many of the careful Notes in GHC.Tc.Solver.InertSet.
Especially look at the new `Note [The KickOut Criteria]`

The proof of termination is not air-tight, but it is better than before,
and both Richard and I think it's correct :-).

- - - - -
88488847 by Cheng Shao at 2024-08-18T04:44:01+02:00
testsuite: remove undesired -fasm flag from test ways

This patch removes the -fasm flag from test ways, except ways like
optasm that explicitly state they are meant to be compiled with NCG
backend. Most test ways should use the default codegen backend, and
the precense of -fasm can cause stderr mismatches like this when GHC
is configured with the unregisterised backend:

```
--- /dev/null
+++ /tmp/ghctest-3hydwldj/test   spaces/testsuite/tests/profiling/should_compile/prof-late-cc.run/prof-late-cc.comp.stderr.normalised
@@ -0,0 +1,2 @@
+when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags (in -Wdefault)]
+    Target platform uses unregisterised ABI, so compiling via C
*** unexpected failure for prof-late-cc(prof_no_auto)
```

This has been breaking the wasm unreg nightly job since !12595 landed.

- - - - -
3a145315 by Cheng Shao at 2024-08-18T13:05:45-04:00
ghci: fix isMinTTY.h casing for Windows targets

This commit fixes isMinTTY.h casing in isMinTTY.c that's compiled for
Windows targets. While this looks harmless given Windows filesystems
are case-insensitive by default, it does cause a compilation warning
with recent versions of clang, so we might as well fix the casing:

```
driver\ghci\isMinTTY.c:10:10: error:
     warning: non-portable path to file '"isMinTTY.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
   |
10 | #include "isMINTTY.h"
   |          ^

 #include "isMINTTY.h"
         ^~~~~~~~~~~~
         "isMinTTY.h"
1 warning generated.
```

- - - - -
3644db63 by doyougnu at 2024-08-20T15:58:06+02:00
RTS linker: add support for hidden symbols

Co-authored-by: Sylvain Henry <sylvain at haskus.fr>

- - - - -


29 changed files:

- .gitlab-ci.yml
- + .gitlab/README.md
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitmodules
- compiler/GHC.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/GenericOpt.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/AArch64/Regs.hs
- compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
- compiler/GHC/CmmToAsm/Reg/Linear/State.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Core/ConLike.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/OccurAnal.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0486db850edbebdeeb7718bd28fa10def5bc4a6b...3644db6392bc4e8e4d92830505fe1a4e8604effd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0486db850edbebdeeb7718bd28fa10def5bc4a6b...3644db6392bc4e8e4d92830505fe1a4e8604effd
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/20240820/ba5370b4/attachment-0001.html>


More information about the ghc-commits mailing list