[Git][ghc/ghc][wip/andreask/simd_test] 170 commits: base: Add `HasCallStack` constraint to `ioError`

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Fri Nov 1 13:33:16 UTC 2024



Andreas Klebinger pushed to branch wip/andreask/simd_test at Glasgow Haskell Compiler / GHC


Commits:
876d6e0e by Ben Gamari at 2024-10-04T15:07:53+01:00
base: Add `HasCallStack` constraint to `ioError`

As proposed in core-libraries-committee#275.

- - - - -
9bfd9fd0 by Matthew Pickering at 2024-10-04T15:08:03+01:00
Fix toException method for ExceptionWithContext

Fixes #25235

- - - - -
ac004028 by Matthew Pickering at 2024-10-04T15:09:07+01:00
Exception rethrowing

Basic changes:

* Change `catch` function to propagate exceptions using the
  WhileHandling mechanism.
* Introduce `catchNoPropagate`, which does the same as before, but
  passes an exception which can be rethrown.
* Introduce `rethrowIO` combinator, which rethrows an exception with a
  context and doesn't add a new backtrace.
* Introduce `tryWithContext` for a variant of `try` which can rethrow
  the exception with it's original context.
* onException is modified to rethrow the original error rather than
  creating a new callstack.
* Functions which rethrow in GHC.Internal.IO.Handle.FD,
  GHC.Internal.IO.Handle.Internals, GHC.Internal.IO.Handle.Text, and
  GHC.Internal.System.IO.Error are modified to not add a new callstack.

Implements CLC proposal#202 <https://github.com/haskell/core-libraries-committee/issues/202>

- - - - -
bcb293f2 by Cheng Shao at 2024-10-04T17:59:28-04:00
testsuite: remove accidentally checked in debug print logic

- - - - -
68e2da5a by Rodrigo Mesquita at 2024-10-05T10:36:15-04:00
Deprecation for WarnCompatUnqualifiedImports

Fixes #25330

- - - - -
4327f0e8 by Andrew Lelechenko at 2024-10-05T10:36:52-04:00
Restrict Data.List.NonEmpty.unzip to NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)

Implementing the final phase of CLC proposal https://github.com/haskell/core-libraries-committee/issues/86

- - - - -
ceca9efb by Cheng Shao at 2024-10-06T02:18:31+00:00
driver: fix runWorkerLimit on wasm

This commit fixes link-time unresolved symbol errors for sem_open etc
on wasm, by making runWorkerLimit always behave single-threaded. This
avoids introducing the jobserver logic into the final wasm module and
thus avoids referencing the posix semaphore symbols.

- - - - -
135fd1ac by Torsten Schmits at 2024-10-06T02:18:31+00:00
Parallelize getRootSummary computations in dep analysis downsweep

This reuses the upsweep step's infrastructure to process batches of
modules in parallel.

I benchmarked this by running `ghc -M` on two sets of 10,000 modules;
one with a linear dependency chain and the other with a binary tree.
Comparing different values for the number of modules per thread
suggested an optimum at `length targets `div` (n_cap * 2)`, with results
similar to this one (6 cores, 12 threads):

```
Benchmark 1: linear 1 jobs
  Time (mean ± σ):      1.775 s ±  0.026 s    [User: 1.377 s, System: 0.399 s]
  Range (min … max):    1.757 s …  1.793 s    2 runs

Benchmark 2: linear 6 jobs
  Time (mean ± σ):     876.2 ms ±  20.9 ms    [User: 1833.2 ms, System: 518.6 ms]
  Range (min … max):   856.2 ms … 898.0 ms    3 runs

Benchmark 3: linear 12 jobs
  Time (mean ± σ):     793.5 ms ±  23.2 ms    [User: 2318.9 ms, System: 718.6 ms]
  Range (min … max):   771.9 ms … 818.0 ms    3 runs
```

Results don't differ much when the batch size is reduced to a quarter
of that, but there's significant thread scheduling overhead for a size
of 1:

```
Benchmark 1: linear 1 jobs
  Time (mean ± σ):      2.611 s ±  0.029 s    [User: 2.851 s, System: 0.783 s]
  Range (min … max):    2.591 s …  2.632 s    2 runs

Benchmark 2: linear 6 jobs
  Time (mean ± σ):      1.189 s ±  0.007 s    [User: 2.707 s, System: 1.103 s]
  Range (min … max):    1.184 s …  1.194 s    2 runs

Benchmark 3: linear 12 jobs
  Time (mean ± σ):      1.097 s ±  0.006 s    [User: 2.938 s, System: 1.300 s]
  Range (min … max):    1.093 s …  1.101 s    2 runs
```

Larger batches also slightly worsen performance.

- - - - -
535a2117 by Daniel Díaz at 2024-10-06T09:51:46-04:00
Clarify the meaning of "exactly once" in LinearTypes

Solves documentaion issue #25084.

- - - - -
92f8939a by Krzysztof Gogolewski at 2024-10-06T09:52:22-04:00
Only allow (a => b) :: Constraint rather than CONSTRAINT rep

Fixes #25243

- - - - -
4a2f0f13 by Alan Zimmerman at 2024-10-07T05:16:54-04:00
EPA: Remove unused hsCaseAnnsRest

We never populate it, so remove it.

- - - - -
5099057b by John Paul Adrian Glaubitz at 2024-10-07T05:17:40-04:00
rts: Fix invocation of __ieee_set_fp_control() on alpha-linux

Fixes the following error when building GHC on alpha-linux:

rts/posix/Signals.c: In function ‘initDefaultHandlers’:

rts/posix/Signals.c:709:5: error:
     error: implicit declaration of function ‘ieee_set_fp_control’ [-Wimplicit-function-declaration]
      709 |     ieee_set_fp_control(0);
          |     ^~~~~~~~~~~~~~~~~~~
    |
709 |     ieee_set_fp_control(0);
    |

- - - - -
c9590ba0 by Teo Camarasu at 2024-10-07T05:18:17-04:00
Add changelog entries for !12479

- - - - -
bf9c9566 by Matthew Pickering at 2024-10-07T13:19:30-04:00
javascript: Read fields of ObjectBlock lazily

When linking a module with a large dependency footprint too much of the
object files were forced during linking. This lead to a large amount of
memory taken up by thunks which would never be forced

On the PartialDownsweep test this halves the memory required (from 25G
to 13G).

Towards #25324

-------------------------
Metric Increase:
    size_hello_obj
-------------------------

- - - - -
571329df by Matthew Pickering at 2024-10-07T13:20:06-04:00
ci: Run the i386 validation job when i386 label is set

This is helpful when making changes to base and must update the
javascript and i386 base exports files.

- - - - -
e68f9aaf by Matthew Pickering at 2024-10-07T13:20:42-04:00
Rewrite partitionByWorkerSize to avoid pattern match checker bug

With `-g3` the pattern match checker would warn about these incomplete
patterns. This affects the debug_info builds on CI.

```
    Pattern match(es) are non-exhaustive
    In an equation for ‘go’:
        Patterns of type ‘[a]’, ‘[a]’, ‘[SpecFailWarning]’ not matched:
            (_:_) _ _
     |
2514 |         go [] small warnings = (small, warnings)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```

Workaround for #25338

- - - - -
d915dc8b by Arnaud Spiwack at 2024-10-07T19:23:00-04:00
Remove the wrapper/coercion-passing logic for submultiplicity checks

Instead, we use a dedicated DelayedError, which is emitted
systematically on submultiplicity checks, but is suppressed if we can
indeed solve the submultiplicity constraint with a reflexivity
coercion.

This way, we don't have to return anything from `tcSubMult`, which now
looks like a regular constraint check, the rest is implementation
detail. This removes all of the strange boilerplate that I'd been
struggling with under the previous implementation. Even if
submultiplicity checks are not properly constraints, this way it's
contained entirely within a `WantedConstraint`. Much more pleasant.

Closes #25128.

- - - - -
1d226116 by Sven Tennie at 2024-10-07T19:23:37-04:00
AArch64: Implement switch/jump tables (#19912)

This improves the performance of Cmm switch statements (compared to a
chain of if statements.)

- - - - -
3fe621dd by Mario Blažević at 2024-10-07T19:24:18-04:00
Fixes #25256, missing parens inside TH-printed pattern type signature

- - - - -
ea4b4391 by ARATA Mizuki at 2024-10-07T19:24:59-04:00
Better documentation for floatRange function

Closes #16479

- - - - -
ff09205c by Andreas Klebinger at 2024-10-07T19:25:35-04:00
Adjust progress message for hadrian to include cwd.

Fixes #25335

- - - - -
5fd320da by Sven Tennie at 2024-10-07T19:26:12-04:00
CCallConv test: Align argument types

The C calling convention / standard requires that arguments and their
values are of the same type.

- - - - -
c6e5fd3d by Cheng Shao at 2024-10-07T19:26:47-04:00
hadrian: remove unused ghciWithDebugger field from flavour config

This patch removes the ghciWithDebugger field from flavour config
since it's actually not used anywhere.

- - - - -
9c9c790d by sheaf at 2024-10-07T19:27:23-04:00
user's guide: update docs for X86 CPU flags

This commit updates the section of the user's guide pertaining to
X86 feature flags with the following changes:

  - the NCG backend now supports SIMD, so remove all text
    that says the contrary,
  - the LLVM backend does not "automatically detect" features,
    so remove any text that makes that claim.

- - - - -
a1ecc826 by Sven Tennie at 2024-10-08T13:36:03-04:00
ci: RISCV64 cross-compile testing

This adds a validation job which tests that we can build a riscv64 cross
compiler and build a simple program using it. We do not currently run
the whole testsuite.

Towards #25254

Co-authored-by: Matthew Pickering <matthewtpickering at gmail.com>

- - - - -
d5c2577f by Arnaud Spiwack at 2024-10-08T13:36:44-04:00
Remove unused accumulators in partition_errors

- - - - -
55609880 by Andrzej Rybczak at 2024-10-09T16:41:46-04:00
Fix typo in the @since annotation of annotateIO

- - - - -
ef481813 by Alan Zimmerman at 2024-10-09T16:42:23-04:00
EPA: Remove [AddEpAnn] from (most of) HsExpr

EPA: introduce EpAnnLam for lambda annotationsi, and remove `glAA`
from `Parser.y`, it is the same as `glR`

EPA: Remove unused annotation from XOpApp

EPA: Use EpToken for XNPat and XNegApp

EPA: specific anns for XExplicitTuple / XTuplePat / sumPatParens.

EPA: Use specific annotation for MultiIf

EPA: Move annotations into FunRhs

EPA: Remove [AddEpAnn] from SigPat and ExprWithTySig

EPA: Remove [AddEpAnn] from ArithSeq

EPA: Remove [AddEpAnn] from HsProc

EPA: Remove [AddEpAnn] from HsStatic

EPA: Remove [AddEpAnn] from BindStmt

EPA: Remove [AddEpAnn] from TransStmt

EPA: Remove [AddEpAnn] from HsTypedSplice

EPA: Remove [AddEpAnn] from HsUntypedSpliceExpr

- - - - -
69960230 by Fabian Thorand at 2024-10-10T19:03:59+00:00
Handle exceptions from IO manager backend

If an IO manager backend throws, it will not actually have registered
the file descriptor. However, at that point, the IO manager state was
already updated to assume the file descriptor is being tracked, leading
to errors and an eventual deadlock down the line as documented in the
issue #21969.

The fix for this is to undo the IO manager state change in case the
backend throws (just as we already do when the backend signals that the
file type is not supported). The exception then bubbles up to user code.

That way we make sure that
1. the bookkeeping state of the IO manager is consistent with the
   actions taken by the backend, even in the presence of unexpected
   failures, and
2. the error is not silent and visible to user code, making failures
   easier to debug.

- - - - -
1587cccf by Hassan Al-Awwadi at 2024-10-11T03:52:36-04:00
Put RdrName in the foExt field of FieldOcc

The main purpose of this commit is to rip RdrName out of FieldOcc, in
accordance with #21592, and as a side note it has simplified the method
we use to deal with ambiguity somewhat.

To do the first, we make FieldOccs store (LIdP p) instead of always
storing Located RdrName, and moved the readername to the extension
points where necessary.

For the second, well, we just turn an ambiguous RdrName into a unbound
Name through mkUnboundName. Later during disambiguateRecordBinds of the
type checking phase, we will try and do type-directed disambiguation based
on the rdrName field (for now), so this hack works out fine.

See Note [Ambiguous FieldOcc in record updates] for more details.

There are two additional minor changes in this commit:
*  The HsRecSel constructor of HsExpr has been moved to the extension
constuctors, since its really GHC specific.
*  HsProjection no longer has a Located DotFieldOcc as a field, but just a
regular DotFieldOcc, since DotFieldOcc already wraps a located
FieldLabelString

co-authored by: @Jade       <Jade512 at proton.me>
                @alt-romes  <rodrigo.m.mesquita at gmail.com>

- - - - -
2338a971 by Cheng Shao at 2024-10-11T03:53:13-04:00
driver: bail out when -fllvm is passed to GHC not configured with LLVM

This patch makes GHC bail out with an proper error message when it's
not configured with LLVM but users attempt to pass -fllvm, see #25011
and added comment for details.

Fixes #25011

Co-authored-by: Rodrigo Mesquita <rodrigo.m.mesquita at gmail.com>

- - - - -
78ad81ec by Cristiano Moraes at 2024-10-11T03:53:55-04:00
configure: Find C++ probing when GCC version is the latest but G++ is old #23118
- - - - -
083703a1 by Simon Peyton Jones at 2024-10-11T03:54:32-04:00
Consider Wanteds with rewriters as insoluble

This MR fixes #25325

See GHC.Tc.Types.Constraint, Note [Insoluble Wanteds], especially (IW2)

There is a small change in the error message for T14172, but it looks
entirely acceptable to me.

- - - - -
0dfaeb66 by Simon Peyton Jones at 2024-10-11T03:54:32-04:00
Wibbles

- - - - -
09d24d82 by Simon Peyton Jones at 2024-10-11T03:54:32-04:00
Spelling errors

- - - - -
694489ed by sheaf at 2024-10-11T03:55:14-04:00
LLVM: use sse4.2 instead of sse42

LLVM expects the former instead of the latter since version 3.4.

Fixes #25019

- - - - -
06ae8507 by sheaf at 2024-10-11T03:55:14-04:00
LLVM: make SSE4.2 imply +popcnt

For consistency with the NCG as well as with Clang and GCC, we make
the SSE4.2 feature flag imply +popcnt when using the LLVM backend.

Fixes #25353

- - - - -
3fe843c7 by Cheng Shao at 2024-10-11T03:55:50-04:00
Drop obsolete libffi Makefile

This patch drops obsolete libffi Makefile from the tree, given it's
completely unused since removal of make build system in !7094.

- - - - -
df70405c by Ben Gamari at 2024-10-11T03:56:26-04:00
ghc-internal: Fix incomplete matches on IOError

As noted in #25362, these incomplete matches were previously not being
warned about. They were easily addressed by use of
`GHC.Internal.Event.Windows.withException`.

Closes #25362.

- - - - -
8584504b by Matthew Pickering at 2024-10-11T03:57:02-04:00
compiler: Fix orientation of GHC.Hs.Doc boot file

We should be free to import things from Language.Haskell.Syntax in GHC
modules. Therefore the the boot file for the loop between ImpExp and
GHC.Hs.Doc was in the wrong place.

Issue #21592

- - - - -
d029f170 by Ben Gamari at 2024-10-11T23:43:17-04:00
testsuite: Normalise trailing digits from hole fits output

The type variables in the holes fit output from
`abstract_refinement_hole_fits` is quite sensitive to compiler
configuration. Specifically, a slight change in the inlining
behavior of `throw` changes type variable naming in `(>>=)` and a few
others.

Ideally we would make hole fits output more deterministic but in the
meantime we simply normalise this difference away as it not relevant
to the test's goal.

- - - - -
da5d7d0d by Ben Gamari at 2024-10-11T23:43:17-04:00
base: Add test for #25066

- - - - -
eb7ddae1 by Ben Gamari at 2024-10-11T23:43:17-04:00
base: Fix #25066

As noted in #25066, the exception backtrace proposal introduced a rather
subtle performance regression due to simplification producing Core which
the demand analyser concludes may diverge with a precise exception. The
nature of the problem is more completely described in the new Note
[Hiding precise exception signature in throw].

The (rather hacky) solution we use here hides the problematic
optimisation through judicious use of `noinline`. Ultimately however we
will want a more principled solution (e.g. #23847).

Fixes #255066

CLC proposal: https://github.com/haskell/core-libraries-committee/issues/290

Metric Decrease:
    T9872d

- - - - -
0060ece7 by Ben Gamari at 2024-10-11T23:43:17-04:00
base: Improve documentation of Control.Exception.Backtrace

- - - - -
18f532f3 by Ben Gamari at 2024-10-11T23:43:53-04:00
Bump process submodule to v1.6.25.0

- - - - -
a9a3badf by Hassan Al-Awwadi at 2024-10-11T23:44:29-04:00
Move HsInteger and HsRat to an extension constructor

These constructors were only used during the TC stage,
or during template haskell. It seemed clear that it was
independent of the source syntax represented in L.H.S,
and thus we removed it according to #21592.

- - - - -
4dd30cba by Artem Pelenitsyn at 2024-10-11T23:45:09-04:00
Docs: Linear types: link Strict Patterns subsection

Also, fix a bug in RST with missing newline before a listing.

Co-authored-by: Arnaud Spiwack <arnaud at spiwack.net>

- - - - -
adca5f2b by Ben Gamari at 2024-10-11T23:45:45-04:00
users guide: Address remaining TODOs in eventlog format docs

Closes #25296.

- - - - -
9291c125 by Sylvain Henry at 2024-10-11T23:46:26-04:00
Fix z-encoding of tuples (#25364)

Tuples with prefix/suffix strings weren't always properly encoded with
their shortcut notations. Fix this.

- - - - -
c08b68bc by Sven Tennie at 2024-10-11T23:47:01-04:00
Delete constants that can be deduced

There are macros in MachRegs.h to figure those out.

- - - - -
8b402da2 by Zubin Duggal at 2024-10-12T20:36:57+00:00
hadrian: Handle broken symlinks properly when creating source dist directories

If we have a broken symlink in the repository, don't try to `need` the symlink
or the target of the symlink. Attempting to do so has `shake` attempt to read the
target to compute its hash, which fails because the target doesn't exist.

- - - - -
16f97667 by Zubin Duggal at 2024-10-12T20:36:57+00:00
hadrian: exclude cabal.project.symlink.broken from source archives

Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also https://github.com/haskell/cabal/issues/10442

- - - - -
f1a2c9fc by Zubin Duggal at 2024-10-12T20:36:57+00:00
Bump Cabal submodule to 3.14

Metric Decrease:
    MultiLayerModulesTH_OneShot
Metric Increase:
    haddock.Cabal

- - - - -
745dd590 by Ben Gamari at 2024-10-14T09:13:12-04:00
users-guide: Document GHCi :where command

Resolve #24509.

- - - - -
e9cc4699 by Alan Zimmerman at 2024-10-14T09:13:48-04:00
EPA: Remove [AddEpAnn] from IE, Pat and some Tys

EPA: Remove [AddEpAnn] from LazyPat

EPA: Remove [AddEpAnn] from RecordCon/RecordUpd/ConPat

EPA: Remove [AddEpAnn] from HsFieldBind

EPA: Remove [AddEpAnn] from PatSynBind

EPA: Remove [AddEpAnn] from IPBind

EPA: Remove [AddEpAnn] from FixSig

EPA: Remove [AddEpAnn] from activation rules

EPA: Remove [AddEpann] from SpecInstSig

EPA: Remove [AddEpAnn] from MinimalSig

EPA: Remove [AddEpAnn] from SCCFunSig

EPA: Remove [AddEpAnn] from CompleteMatchSig

EPA: Remove [AddEpAnn] from AnnSig, as used in PatSynSig, ClassOpSig, TypeSig

EPA: Remove [AddEpAnn] from IEThingAbs

EPA: Remove [AddEpAnn] from IEThingAll / IEThingWith

EPA: Remove [AddEpAnn] from IEModuleContents

EPA: Remove [AddEpAnn] from HsOpTy

EPA: Remove [AddEpAnn] for various binders

EPA: Remove [AddEpAnn] for HsIParamTy

- - - - -
81a570bf by Sebastian Graf at 2024-10-14T22:15:31-04:00
Desugaring, plus -Wincomplete-record-selectors

This commit does several related things:

* Major refactor of the handling of applications in the desugarer.
  Now all applications are handled in `dsApp`, `ds_app` and related
  functions.  This dramatically simplifies the code and removes
  complicated cruft that had accumulated.  Hooray.

  Fixes #25281.

* Improve the handling of -Wincomplete-record-selectors.

  We now incorporate the result type of unsaturated record selector
  applications as well as consider long-distance information in
  getField applications.

  Plus, the implmentation now builds the improved `dsApp` stuff
  above, so it is much easier to understand.

  Plus, incorporates improved error message wording suggested
  by Adam Gundry in !12685.

  Fixes #24824, #24891

  See the long Note [Detecting incomplete record selectors]

* Add -Wincomplete-record-selectors to -Wall, as specified in
  GHC Proposal 516.

  To do this, I also had to add -Wno-incomplete-record-selectors
  to the build flags for Cabal in GHC's CI.  See
  hadrian/src/Settings/Warnings.hs.  We can remove this when
  Cabal is updated so that it doesn't trigger the warning:
  https://github.com/haskell/cabal/issues/10402

2.6% decrease in compile time allocation in RecordUpPerf

Metric Decrease:
    RecordUpdPerf

- - - - -
ae7bc08e by Simon Peyton Jones at 2024-10-14T22:15:31-04:00
Elmininate incomplete record selectors

This patch is a pure refactor of GHC's source code, to avoid the use
of partial record selectors.  It was provoked by adding
-Wincomplete-record-selectors to -Wall (as the GHC Proposal specified),
which in turn showed up lots of places where GHC was using incomplete
record selectors.

This patch does mostly-simple refactoring to make it clear to the pattern
match checker that there is in fact no partiality.

There is one externally-visible change: I changed the data type HoleFit
to split out the two cases

  data HoleFit = TcHoleFit  TcHoleFit | RawHoleFit SDoc
  data TcHoleFit = HoleFit { ...lots of fields }

There are large swathes of code that just deal with `TcHoleFit`, and
having it as a separate data types makes it apparent that `RawHoleFit`
can't occur.

This makes it much better -- but the change is visible in the
HolePlugin interface.  I decided that there are so few clients of this
API that it's worth the change.

I moved several functions from Language.Haskell.Syntax to GHC.Hs.
Reason, when instantiated at (GhcPass _), the extension data construtcor
is guaranteed unused, and that justifies omitted patterns in these
functions.  By putting them in GHC.Hs.X I can specialise the type for
(GhcPass _) and thereby make the function total.

An interesting side-light is that there were a few local function
definitions without a type signature, like this one in GHC.Parser.Header
     convImport (L _ i) = (ideclPkgQual i, reLoc $ ideclName i)
This is fully closed, and so is generalised; but that generalises
it to any old pass, not (GhcPass _), so GHC rightly complains about the
use of the selector `ideclPkgQual`.  I added a type signature to `i`, thus
     convImport (L _ (i::ImportDecl GhcPs))
         = (ideclPkgQual i, reLoc $ ideclName i)
which specialised the function enough to make the record selector complete.
Quite a surprising consequence of local let-generalisation!

- - - - -
6a067226 by Simon Peyton Jones at 2024-10-14T22:15:31-04:00
Add -Werror=-Wno-error=incomplete-record-selectors to hadrian-multi

In the main MR, -Wall now includes -Wincomplete-record-selectors.
However `hadrian-multi` has many, many warnings about incomplete
record selectors, so this patch stops those warnings being treated
as errors.  (See discussion on !13308.)

A better fix would be to remove the use of incomplete record
selectors, since each of them represents a potential crash.

- - - - -
edeafc14 by Ben Gamari at 2024-10-14T22:16:08-04:00
users-guide: Document field coalescence

- - - - -
55b83587 by ARATA Mizuki at 2024-10-14T22:16:49-04:00
LLVM backend: Use correct rounding for Float literals

Fixes #22033

- - - - -
e59fe5c6 by Hassan Al-Awwadi at 2024-10-15T08:25:33+00:00
Changed import from Ghc.  module to L.H.S module

Progresses #21592

For some reason we still imported GHC.Types.Fixity when the definitino of Fixity and LexicalFixity have already been moved to Language.Haskell.Syntax.Basic. This fixes that for

- - - - -
ab1767d5 by Simon Peyton Jones at 2024-10-15T23:45:04-04:00
Add a release-notes entry for -Wincomplete-record-selectors

- - - - -
6f0a62db by ur4t at 2024-10-16T15:33:43+00:00
GHCi: fix improper location of ghci_history file

Fixes #24266

- - - - -
5f67db48 by Alan Zimmerman at 2024-10-17T05:18:43-04:00
EPA: Remove [AddEpAnn] commit 3

EPA: Remove [AddEpAnn] from HsDocTy

EPA: Remove [AddEpAnn] from HsBangTy

EPA: Remove [AddEpAnn] from HsExplicitListTy

EPA: Remove [AddEpAnn] from HsExplicitTupleTy

EPA: Remove [AddEpAnn] from HsTypedBracket

EPA: Remove [AddEpAnn] from HsUntypedBracket

EPA: Remove [AddEpAnn] from PatBuilderOpApp

EPA: break out 'EpToken "|"' from ClassDecl anns

EPA: Remove [AddEpAnn] from ClassDecl

EPA: Remove [AddEpAnn] from SynDecl

- - - - -
fbbbd010 by Daan Rijks at 2024-10-17T05:19:19-04:00
Expand the haddocks for Control.Category

- - - - -
076c1a10 by Andrew Lelechenko at 2024-10-17T05:19:19-04:00
documentation: more examples for Control.Category

- - - - -
90891962 by Cheng Shao at 2024-10-17T16:41:18+00:00
ghci: mitigate host/target word size mismatch in BCOByteArray serialization

This patch mitigates a severe host/target word size mismatch issue in
BCOByteArray serialization logic introduced since !12142, see added
note for detailed explanation.

- - - - -
839ac52e by Cheng Shao at 2024-10-17T16:41:18+00:00
ghci: use plain malloc for mkConInfoTable on non-TNTC platforms

This patch avoids using mmap() to allocate executable memory for
mkConInfoTable on platforms without tables-next-to-code, see added
comment for explanation.

- - - - -
a998f69d by Cheng Shao at 2024-10-17T16:41:18+00:00
ghc-internal: add missing CPPs for wasm

This patch adds some missing CPP guards to ghc-internal, given those
functions are non existent on wasm and would cause linking issues.

- - - - -
71a471e7 by Cheng Shao at 2024-10-17T16:41:18+00:00
rts: rename prelude.js to prelude.mjs

This commit renames prelude.js to prelude.mjs for wasm backend rts
jsbits, and slightly adjusts the jsbits contents. This is for
preparing the implementation of dyld.mjs that contains wasm dynamic
linker logic, which needs to import prelude.mjs as a proper ESM
module.

- - - - -
33d9db17 by Cheng Shao at 2024-10-17T16:41:18+00:00
rts: add __wrapped_freeJSVal

This commit wraps imported freeJSVal in a __wrapped_freeJSVal C
function for wasm backend RTS. In general, wasm imports are only
supposed to be directly called by C; they shouldn't be used as
function pointers, which confuses wasm-ld at link-time when generating
shared libraries.

- - - - -
0d0a16a8 by Cheng Shao at 2024-10-17T16:41:18+00:00
rts: correct stale link in comment

- - - - -
90a35c41 by Cheng Shao at 2024-10-17T16:41:18+00:00
rts: drop interpretBCO support from non-dyn ways on wasm

This commit drops interpretBCO support from non dynamic rts ways on
wasm. The bytecode interpreter is only useful when the RTS linker also
works, and on wasm it only works for dynamic ways anyway. An
additional benefit of dropping interpretBCO is reduction in code size
of linked wasm modules, especially since interpretBCO references
ffi_call which is an auto-generated large function in libffi-wasm and
unused by most user applications.

- - - - -
98a32ec5 by Cheng Shao at 2024-10-17T16:41:18+00:00
rts: don't build predefined GloblRegs for wasm PIC mode

This commit wraps the predefined GlobalRegs in Wasm.S under a CPP
guard to prevent building for PIC mode. When building dynamic ways of
RTS, the wasm globals that represent STG GlobalRegs will be created
and supplied by dyld.mjs. The current wasm dylink convention doesn't
properly support exporting relocatable wasm globals at all, any wasm
global exported by a .so is assumed to be a GOT.mem entry.

- - - - -
bef94bde by Cheng Shao at 2024-10-17T16:41:18+00:00
rts: fix conflicting StgRun definitions on wasm

This commit fixes conflicting StgRun definition when building dynamic
ways of RTS for wasm in unregisterised mode.

- - - - -
a6a82cdb by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian: use targetSupportsRPaths predicate

This commit changes the hostSupportsRPaths predicate to
targetSupportsRPaths and use that to decide whether to pass
RPATH-related link-time options. It's not applied to stage0, we should
just use the default link-time options of stageBoot ghc.

- - - - -
f232c872 by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian: disable internal-interpreter of ghc library when cross compiling

This commit disable the internal-interpreter flag of ghc library when
cross compiling, only external interpreter works in such cases.

- - - - -
577c1819 by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian: enable internal-interpreter for ghc-bin stage0

This commit enables internal-interpreter flag for ghc-bin even when
compiling stage0, as long as target supports ghci. It enables ghci
functionality for cross targets that support ghci, since cross ghc-bin
is really stage0.

- - - - -
c247f2ee by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian: fix CFLAGS for gmp shared objs on wasm

This commit adds -fvisibility=default to CFLAGS of gmp when building
for wasm. This is required to generate the ghc-bignum shared library
without linking errors. Clang defaults to -fvisibility=hidden for wasm
targets, which will cause issues when a symbol is expected to be
exported in a shared library but without explicit visibility attribute
annotation.

- - - - -
775410fd by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian: re-enable PIC for gmp on wasm

This commit re-enables --with-pic=yes configuration option of gmp when
building for wasm, given we're about to include support for shared
libraries, TH and ghci.

- - - - -
b45080a3 by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian: add the host_fully_static flavour transformer

This commit adds the host_fully_static flavour transformer to hadrian,
which ensures stage0 is fully statically linked while still permitting
stage1 libdir to contain shared libraries. This is intended to be used
by the wasm backend to build portable linux bindists that contain wasm
shared libraries.

- - - - -
5043507c by Cheng Shao at 2024-10-17T16:41:18+00:00
ci: update wasm jobs configuration

This commit bumps ci-image revision to use updated wasm toolchain, and
use host_fully_static instead of fully_static for wasm jobs so to
ensure wasm shared libraries can be properly built.

- - - - -
2956a3f7 by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian/testsuite: implement config.cross logic

This commit implements the config.cross field in the testsuite driver.
It comes from the "cross compiling" ghc info field for both
in-tree/out-of-tree GHC, and is an accurate predicate of whether we're
cross-compiling or not (compared to the precense of target emulator),
and is useful to implement predicates to assert the precense of
internal interpreter (only available on non-cross GHC) for tests that
do require it (e.g. plugins).

- - - - -
8c74a0ed by Cheng Shao at 2024-10-17T16:41:18+00:00
hadrian/compiler: implement targetRTSLinkerOnlySupportsSharedLibs

This patch implements the targetRTSLinkerOnlySupportsSharedLibs
predicate in hadrian. Its definition in hadrian is the single source
of truth, and the information propagates to ghc settings file, ghc
driver and testsuite driver. It is used in various places to ensure
dynamic dependency is selected when the target RTS linker only
supports loading dynamic code.

- - - - -
b4c3c340 by Cheng Shao at 2024-10-17T16:41:18+00:00
testsuite: don't use host cpu features when testing cross ghc

This patch disables CPU feature detection logic when testing cross
GHC, since those features don't make sense for the target anyway.

- - - - -
3c21b696 by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: implement & use req_plugins predicate

This commit implements req_plugins predicate to indicate that the test
requires plugin functionality. Currently this means cross GHC is
disabled since internal-interpreter doesn't work in cross GHC yet.

- - - - -
93b8af80 by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: make use of config.interp_force_dyn

This commit takes config.interp_force_dyn into consideration when
setting up TH/ghci way flags.

- - - - -
94673d41 by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: bump T17572 timeout

- - - - -
2b5efc2d by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: bump T22744 pre_cmd timeout

- - - - -
45102e2a by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: skip terminfo_so for cross ghc

- - - - -
05e40406 by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: fix shared library size tests for cross ghc

This commit fixes shared library size tests (e.g. array_so in
testsuite/tests/perf/size/all.T) when testing cross ghc. Previously,
if shared library file extension of host and target differs, those
tests will fail with framework errors due to not finding the right
files.

- - - - -
fa68f833 by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: skip ghc api tests that attempt to spawn processes inside wasm

This commit skips a few ghc api tests on wasm, since they would
attempt to spawn processes inside wasm, which is not supported at all.

- - - - -
1241c04e by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: skip T22840 due to broken -dtag-inference-checks on wasm

- - - - -
78c8b900 by Cheng Shao at 2024-10-17T16:41:19+00:00
testsuite: ensure $(ghciWayFlags) can be overridden

This commit revises boilerplate.mk in testsuite as well as a few other
places, to ensure the tests that do make use of $(ghciWayFlags) can
receive the right $(ghciWayFlags) from testsuite driver config.

- - - - -
47989ecc by Cheng Shao at 2024-10-17T16:41:24+00:00
testsuite: skip rdynamic on wasm

- - - - -
fefb4ea1 by Cheng Shao at 2024-10-17T16:41:24+00:00
testsuite: skip T2615 on wasm

This commit marks T2615 as skip on wasm, given LD_* environment
variables aren't supported on wasm anyway.

- - - - -
77c79762 by Cheng Shao at 2024-10-17T16:41:24+00:00
testsuite: mark MultiLayerModulesTH_Make/MultiLayerModulesTH_OneShot as fragile on wasm

- - - - -
69bb4745 by Cheng Shao at 2024-10-17T16:41:24+00:00
testsuite: fix T16180 on wasm

This commit fixes T16180 on wasm once TH support is flipped on. The
fix is simply adding right asm code for wasm.

- - - - -
621c753d by Cheng Shao at 2024-10-17T16:41:24+00:00
driver: fix -fexternal-interpreter flag for JS backend

Previously, -fexternal-interpreter is broken for JS backend, since GHC
would attempt to launch a non-existent ghc-iserv* executable. This
commit fixes it by adjusting pattern matching order in
setTopSessionDynFlags.

- - - - -
80aa8983 by Cheng Shao at 2024-10-17T16:41:24+00:00
driver: use interpreterDynamic predicate in preloadLib

This commit use the interpreterDynamic predicate in preloadLib to
decide if we should do dynLoadObjs instead of loadObj. Previously we
used hostIsDynamic which was only written with non-cross internal
interpreter in mind.

The testsuite is also adjusted to remove hard-wired -fPIC flag for
cbits (doesn't work in i386 RTS linker in vanilla way, #25260) and
properly pass ghc_th_way_flags to ghc.

- - - - -
74411461 by Cheng Shao at 2024-10-17T16:41:24+00:00
compiler: fix Cmm dynamic CLabels for wasm

This commit fixes the handling of dynamic CLabels for the wasm
backend. Just do the simplest handling: preserve the original CLabel,
both unreg/NCG backends can handle them properly without issue.

- - - - -
f6abaf13 by Cheng Shao at 2024-10-17T16:41:24+00:00
driver: add necessary compile-time flags for wasm PIC mode

This commit adds necessary compile-time flags when compiling for wasm
PIC mode, see added comment for detailed explanation.

- - - - -
9745fcfb by Cheng Shao at 2024-10-17T16:41:24+00:00
driver: add necessary link-time flags for wasm shared libs

This commit adds necessary link-time flags for wasm shared libs, see
added comments for detailed explanation.

- - - - -
649aae00 by Cheng Shao at 2024-10-17T16:41:24+00:00
driver: enforce -fno-use-rpaths for wasm

This commit ensures the GHC driver never passes any RPATH-related
link-time flags on wasm, which is not supported at all.

- - - - -
47baa904 by Cheng Shao at 2024-10-17T16:41:24+00:00
driver: ensure static archives are picked when linking static .wasm modules

This commit ensures static archives are picked when linking .wasm
modules which are supposed to be fully static, even when ghc may be
invoked with -dynamic, see added comment for explanation.

- - - - -
fc3a5591 by Cheng Shao at 2024-10-17T16:41:24+00:00
compiler: fix dynamic_too_enable for targets that require dynamic libraries

This commit fixes dynamic_too_enable for targets whose RTS linker can
only load dynamic code.

- - - - -
94ef949e by Cheng Shao at 2024-10-17T16:41:24+00:00
compiler: fix checkNonStdWay for targets that require dynamic libraries

This commit fixes checkNonStdWay to ensure that for targets whose RTS
linker can only load dynamic code, the dynamic way of object is
selected.

- - - - -
88e99248 by Cheng Shao at 2024-10-17T16:41:24+00:00
ghc-bin: enforce dynamic way when the target requires so

This commit makes ghc-bin use dynamic way when it is doing interactive
stuff on certain targets whose RTS linker can only handle dynamic
code.

- - - - -
549582ef by Cheng Shao at 2024-10-17T16:41:24+00:00
hadrian/ghci: add wasm dyld

This commit adds the wasm dynamic linker implementation, as well as
ghci logic to call it and hadrian logic to install it to the correct
location. See the top-level note in utils/jsffi/dyld.mjs for more
details.

- - - - -
b562e3a6 by Cheng Shao at 2024-10-17T16:41:29+00:00
driver: fix getGccSearchDirectory for wasm target

This commit fixes getGccSearchDirectory logic for wasm target, ensures
the correct search directory containing libc.so etc can be found by
GHC. getGccSearchDirectory is also exported so it can be used
elsewhere to obtain the wasi-sdk libdir and pass to the dyld script.

- - - - -
2d6107dc by Cheng Shao at 2024-10-17T16:41:29+00:00
driver: add wasm backend iserv logic

This commit adds wasm backend iserv logic to the driver, see added
comments for explanation.

- - - - -
61f5baa5 by Cheng Shao at 2024-10-17T16:41:29+00:00
compiler: add PIC support to wasm backend NCG

This commit adds support for generating PIC to the wasm backend NCG.

- - - - -
652e7239 by Cheng Shao at 2024-10-17T16:41:29+00:00
hadrian/compiler: flip on support for shared libs & ghci for wasm

This commit flips on the support for shared libs and ghci for the wasm
target, given all required support logic has been added in previous
commits.

- - - - -
74a1f681 by Cheng Shao at 2024-10-17T16:41:29+00:00
testsuite: flip on support for shared libs, TH & ghci for wasm

This commit flips on support for shared libs, TH & ghci for wasm in
the testsuite, given support has been landed in previous commits.

- - - - -
525d451e by Cheng Shao at 2024-10-17T23:03:34-04:00
Revert "compiler: start deprecating cmmToRawCmmHook"

This reverts commit 1c064ef1f3e1aa2afc996e962ad53effa99ec5f4. Turns
out the GHC-WPC project does use it to observe Cmm in the pipeline,
see #25363.

- - - - -
5bcfefd5 by Cheng Shao at 2024-10-17T23:04:09-04:00
rts: fix pointer overflow undefined behavior in bytecode interpreter

This patch fixes an unnoticed undefined behavior in the bytecode
interpreter. It can be caught by building `rts/Interpreter.c` with
`-fsanitize=pointer-overflow`, the warning message is something like:

```
rts/Interpreter.c:1369:13: runtime error: addition of unsigned offset to 0x004200197660 overflowed to 0x004200197658
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Interpreter.c:1369:13
rts/Interpreter.c:1265:13: runtime error: addition of unsigned offset to 0x004200197660 overflowed to 0x004200197658
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Interpreter.c:1265:13
rts/Interpreter.c:1645:13: runtime error: addition of unsigned offset to 0x0042000b22f8 overflowed to 0x0042000b22f0
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Interpreter.c:1645:13
```

Whenever we do something like `SpW(-1)`, the negative argument is
implicitly converted to an unsigned integer type and causes pointer
arithmetic overflow. It happens to be harmless for most targets since
overflowing would wrap the result to desired value, but it's still
coincidental and undefined behavior. Furthermore, it causes real
damage to the wasm backend, given clang-20 will emit invalid wasm code
that crashes at run-time for this kind of C code! (see
https://github.com/llvm/llvm-project/issues/108770)

The fix here is adding some explicit casts to ensure we always use the
signed `ptrdiff_t` type as right hand operand of pointer arithmetic.

- - - - -
eb67875f by Matthew Craven at 2024-10-18T12:18:35+00:00
Bump transformers submodule

The svg image files mentioned in transformers.cabal were
previously not checked in, which broke sdist generation.

- - - - -
366a1109 by Matthew Craven at 2024-10-18T12:18:35+00:00
Remove reference to non-existent file in haddock.cabal

- - - - -
826852e9 by Matthew Craven at 2024-10-18T12:18:35+00:00
Move tests T11462 and T11525 into tests/tcplugins

- - - - -
dbe27152 by Matthew Craven at 2024-10-18T12:18:35+00:00
Repair the 'build-cabal' hadrian target

Fixes #23117. Fixes #23281. Fixes #23490.

This required:
 * Updating the bit-rotted compiler/Setup.hs and its setup-depends
 * Listing a few recently-added libraries and utilities
   in cabal.project-reinstall
 * Setting allow-boot-library-installs to 'True' since Cabal
   now considers the 'ghc' package itself a boot library for
   the purposes of this flag

Additionally, the allow-newer block in cabal.project-reinstall
was removed.  This block was probably added because when the
libraries/Cabal submodule is too new relative to the cabal-install
executable, solving the setup-depends for any package with a custom
setup requires building an old Cabal (from Hackage) against the
in-tree version of base, and this can fail un-necessarily due to
tight version bounds on base.  However, the blind allow-newer can
also cause the solver to go berserk and choose a stupid build plan
that has no business succeeding, and the failures when this happens
are dreadfully confusing. (See #23281 and #24363.)

Why does setup-depends solving insist on an old version of Cabal? See:
  https://github.com/haskell/cabal/blob/0a0b33983b0f022b9697f7df3a69358ee9061a89/cabal-install/src/Distribution/Client/ProjectPlanning.hs#L1393-L1410

The right solution here is probably to use the in-tree cabal-install
from libraries/Cabal/cabal-install with the build-cabal target rather
than whatever the environment happens to provide.  But this is left
for future work.

- - - - -
b3c00c62 by Matthew Craven at 2024-10-18T12:18:35+00:00
Revert "CI: Disable the test-cabal-reinstall job"

This reverts commit 38c3afb64d3ffc42f12163c6f0f0d5c414aa8255.

- - - - -
a04959b8 by Daneel Yaitskov at 2024-10-19T09:34:15-04:00
base: speed up traceEventIO and friends when eventlogging is turned off #17949

Check the RTS flag before doing any work with the given lazy string.

Fix #17949

Co-authored-by: Michael Peyton Jones <me at michaelpj.com>
Co-authored-by: Sylvain Henry <sylvain at haskus.fr>
Co-authored-by: Matthew Pickering <matthewtpickering at gmail.com>

- - - - -
eff16c22 by Matthew Pickering at 2024-10-19T21:55:55-04:00
ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

By setting the ONLY_JOBS variable to the name of the job (or multiple
jobs), the resulting
pipeline will include a validation job for that pipeline.

For example - if you set ONLY_JOBS="x86_64-linux-ubuntu22_04-validate"
then a ubuntu22_04 job will be included in the validation pipeline. This
is useful for testing specific jobs.

Fixes #25332

- - - - -
280b6278 by Zubin Duggal at 2024-10-19T21:56:31-04:00
rel-eng: ghcup metadata generation: generated yaml anchors with meaningful names

(cherry picked from commit d83f5bd730a8aef37d8a38b3560590d9798f8e45)

- - - - -
25edf849 by Alan Zimmerman at 2024-10-19T21:57:08-04:00
EPA: Remove [AddEpAnn] Commit 4

EPA: Remove [AddEpAnn] from DataDecl

This is quite a big change.
The most important part is moving the annotations into HsDataDefn,
using a specific annotation data type.

It has a knock-on to everything that uses HsDataDefn

EPA: Remove [AddEpAnn] for FunDep

EPA: Remove [AddEpann] from FamilyDecl

EPA: Remove [AddEpAnn] From InjectivityAnn

EPA: Remove [AddEpAnn] from DefaultDecl

EPA: Remove [AddEpAnn] from RuleDecls

EPA: Remove [AddEpAnn] from Warnings

- - - - -
d5f42045 by Luite Stegeman at 2024-10-20T16:34:47-04:00
Interpreter: Add locking for communication with external interpreter

This adds locking to communication with the external interpreter
to prevent concurrent tasks interfering with each other. This
fixes Template Haskell with the external interpreter in parallel (-j)
builds.

Fixes #25083

- - - - -
d6bfea76 by Matthew James Kraai at 2024-10-20T16:35:29-04:00
Use monospace font for "Either a b" in fmap docs

The documentation for fmap shows "`Either a b`" in the default font
instead of showing "Either a b" in a monospace font.

- - - - -
4bc7f9c8 by Luite Stegeman at 2024-10-20T16:36:15-04:00
Parser: remove non-ASCII characters from Parser.y

Non-ASCII characters in the source causes a problem with the default
Haskell Language Server setup in VSCode. Two characters seems to have
been left in by accident.

Workaround for #25396

- - - - -
7f61ed4e by Alan Zimmerman at 2024-10-21T06:39:45-04:00
EPA: Remove [AddEpAnn] Commit 5

EPA: Remove [AddEpAnn] from AnnPragma

EPA: Remove [AddEpAnn] From ForeignDecl

EPA: Remove [AddEpAnn] from RoleAnnotDecl

EPA: Remove [AddEpAnn] from StandaloneKindSig

EPA: Remove [AddEpAnn] From HsDeriving

EPA: Remove [AddEpAnn] from ConDeclField

EPA: Remove [AddEpAnn] from ConDeclGADT

EPA: Remove [AddEpAnn] from ConDeclH98

EPA: Remove [AddEpAnn] from ClsInstDecl

- - - - -
f8694fe7 by Cheng Shao at 2024-10-21T06:40:21-04:00
wasm: bump dyld v8 heap size limit

This patch adds `--max-old-space-size=8192` to wasm dyld shebang
arguments to bump V8 heap size limit. The default limit
(`heap_size_limit` returned by `v8.getHeapStatistics()`) is
dynamically determined and a bit too low under certain workloads, and
V8 would waste too much CPU time to garbage collect old generation
heap more aggressively. Bumping the limit to 8G doesn't imply dyld
would really take that much memory at run-time, but it lessens V8 heap
stress significantly.

- - - - -
d328d173 by Luite Stegeman at 2024-10-21T12:39:18+00:00
Add requestTickyCounterSamples to GHC.Internal.Profiling

This allows the user to request ticky counters to be written to
the eventlog at specific times.

See #24645

- - - - -
71765b1d by Simon Peyton Jones at 2024-10-21T20:55:00-04:00
Move defaulting code into a new module

GHC.Tc.Solver had reached 4,000 lines -- although quite a lot of them
are comments.

This MR

* Adds the new module GHC.Tc.Solver.Default, which has all the
  complex, but well modularised, defaulting code

* Moves a bit of code from GHC.Tc.Solver into the existing
  GHC.Tc.Solver.Solve. Notably solveWanteds and simplifyWantedsTcM,
  which are called from GHC.Tc.Solver.Default

It's a pure refactor.  No code changes.

- - - - -
a398227b by Simon Peyton Jones at 2024-10-21T20:55:00-04:00
Improve the generalisation code in Solver.simplifyInfer

The code in `decideQuantification` has become quite complicated.
This MR straightens it out, adds a new Note, and on the way
fixes #25266.

See especially Note [decideAndPromoteTyVars] which is is where
all the action happens in this MR.

- - - - -
148059fe by Andrzej Rybczak at 2024-10-21T20:55:40-04:00
Adjust catches to properly rethrow exceptions

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13302 implemented exception
rethrowing proposal, but it didn't adjust `catches`. This fixes it.

- - - - -
25121dbc by doyougnu at 2024-10-22T09:38:18-04:00
linker: add --optimistic-linking flag

This patch adds:

- the --optimistic-linking flag which binds unknown symbols in the
runtime linker to 0xDEADBEEF instead of exiting with failure

- The test T25240 which tests these flags using dead code in the FFI system.

- closes #25240

This patch is part of the upstreaming haskell.nix patches project.

- - - - -
f19e076d by doyougnu at 2024-10-22T09:38:18-04:00
ghc-internal: hide linkerOptimistic in MiscFlags

- - - - -
edc02197 by Cheng Shao at 2024-10-22T09:38:54-04:00
hadrian: fix bindist executable wrapper logic for cross targets

This commit fixes an oversight of hadrian wrapper generation logic:
when doing cross compilation, `wrapper` is called on executable names
with cross prefix, therefore we must use `isSuffixOf` when matching to
take the cross prefix into account. Also add missing cross prefix to
ghci wrapper content and fix hsc2hs wrapper logic.

- - - - -
edf3bdf5 by Andreas Klebinger at 2024-10-22T16:30:42-04:00
mkTick: Push ticks through unsafeCoerce#.

unsafeCoerce# doesn't exist at runtime so we should treat it like a Cast
for the purpose of mkTick.

This means if we have `{-# SCC foo #-} (unsafeCoerce# trivial_expr))` we
now push the scope part of the cost centre up to `trivial_expr` at which
point we can discard it completely if the expression is trivial enough.

This fixes #25212.

- - - - -
1bdb1317 by Cheng Shao at 2024-10-22T16:31:17-04:00
hadrian: enable late-CCS for perf flavour as well

This patch enables late-CCS for perf flavour so that the testsuite can
pass for perf as well. Fixes #25308.

- - - - -
fde12aba by Cheng Shao at 2024-10-22T16:31:54-04:00
hadrian: make sure ghc-bin internal-interpreter is disabled for stage0 when not cross compiling

This patch disables internal-interpreter flag for stage0 ghc-bin when
not cross compiling, see added comment for explanation. Fixes #25406.

- - - - -
6ab8d751 by ignatiusm at 2024-10-24T01:23:35-04:00
Improve heap overflow exception message (#25198)

Catch heap overflow exceptions and suggest using `+RTS -M<size>`.

Fix #25198

- - - - -
b3f7fb80 by Rodrigo Mesquita at 2024-10-24T01:24:12-04:00
determinism: Interface re-export list det

In 'DocStructureItem' we want to make sure the 'Avails' are sorted, for
interface file determinism. This commit introduces 'DetOrdAvails', a
newtype that should only be constructed by sorting Avails with
'sortAvails' unless the avails are known to be deterministically
ordered. This newtype is used by 'DocStructureItem' where 'Avails' was
previously used to ensure the list of avails is deterministically sorted
by construction.

Note: Even though we order the constructors and avails in the interface
file, the order of constructors in the haddock output is still
determined from the order of declaration in the source. This was also
true before, when the list of constructors in the interface file <docs>
section was non-deterministic. Some haddock tests such as
"ConstructorArgs" observe this (check the order of constructors in
out/ConstructorArgs.html vs src/ConstructorArgs.hs vs its interface file)

The updated tests are caused by haddock corners where the order in the
source is not preserved (and was non-deterministic before this PR):
    * Module header in the latex backend
    * Re-export of pattern synonyms associated to a datatype (#25342)

Fixes #25304

- - - - -
e39c8c99 by Rodrigo Mesquita at 2024-10-24T01:24:12-04:00
Revert "ci: Allow abi-test to fail."

After #25304, the abi-test with interface and object determinism
succeeds.

This reverts commit 7b37afc9f3e79559055488998ee73187886a0e00.

- - - - -
7b1b0c6d by Alan Zimmerman at 2024-10-24T13:07:02-04:00
EPA: reduce [AddEpann] in AnnList

Remove it from the `al_rest` field, and make `AnnList` parameterized
on a type to be used in `al_rest`, for the various use cases.

- - - - -
4a00731e by Rodrigo Mesquita at 2024-10-24T13:07:38-04:00
Fix -fobject-determinism flag definition

The flag should be defined as an fflag to make sure the
-fno-object-determinism flag is also an available option.

Fixes #25397

- - - - -
55e4b9f2 by Sebastian Graf at 2024-10-25T07:01:54-04:00
CorePrep: Attach evaldUnfolding to floats to detect more values

See `Note [Pin evaluatedness on floats]`.

- - - - -
9f57c96d by Sebastian Graf at 2024-10-25T07:01:54-04:00
Make DataCon workers strict in strict fields (#20749)

This patch tweaks `exprIsConApp_maybe`, `exprIsHNF` and friends, and Demand
Analysis so that they exploit and maintain strictness of DataCon workers. See
`Note [Strict fields in Core]` for details.

Very little needed to change, and it puts field seq insertion done by Tag
Inference into a new perspective: That of *implementing* strict field semantics.
Before Tag Inference, DataCon workers are strict. Afterwards they are
effectively lazy and field seqs happen around use sites. History has shown
that there is no other way to guarantee taggedness and thus the STG Strict Field
Invariant.

Knock-on changes:

  * I reworked the whole narrative around "Tag inference".
    It's now called "EPT enforcement" and I recycyled the different overview
    Notes into `Note [EPT enforcement]`.

  * `exprIsHNF` previously used `exprOkForSpeculation` on unlifted arguments
    instead of recursing into `exprIsHNF`. That regressed the termination
    analysis in CPR analysis (which simply calls out to `exprIsHNF`), so I made
    it call `exprOkForSpeculation`, too.

  * There's a small regression in Demand Analysis, visible in the changed test
    output of T16859: Previously, a field seq on a variable would give that
    variable a "used exactly once" demand, now it's "used at least once",
    because `dmdTransformDataConSig` accounts for future uses of the field
    that actually all go through the case binder (and hence won't re-enter the
    potential thunk). The difference should hardly be observable.

  * The Simplifier's fast path for data constructors only applies to lazy
    data constructors now. I observed regressions involving Data.Binary.Put's
    `Pair` data type.

  * Unfortunately, T21392 does no longer reproduce after this patch, so I marked
    it as "not broken" in order to track whether we regress again in the future.

Fixes #20749, the satisfying conclusion of an annoying saga (cf. the ideas
in #21497 and #22475).

Compiler perf generally improves, sometimes drastically:

                                                     Baseline
                                 Test    Metric          value      New value Change
--------------------------------------------------------------------------------
             ManyConstructors(normal) ghc/alloc  3,629,760,116  3,711,852,800  +2.3%  BAD
  MultiLayerModulesTH_OneShot(normal) ghc/alloc  2,502,735,440  2,565,282,888  +2.5%  BAD
                       T12707(normal) ghc/alloc    804,399,798    791,807,320  -1.6% GOOD
                       T17516(normal) ghc/alloc    964,987,744  1,008,383,520  +4.5%
                       T18140(normal) ghc/alloc     75,381,152     49,860,560 -33.9% GOOD
                      T18698b(normal) ghc/alloc    232,614,457    184,262,736 -20.8% GOOD
                       T18923(normal) ghc/alloc     62,002,368     58,301,408  -6.0% GOOD
                       T20049(normal) ghc/alloc     75,719,168     70,494,368  -6.9% GOOD
                        T3294(normal) ghc/alloc  1,237,925,833  1,157,638,992  -6.5% GOOD
                        T9233(normal) ghc/alloc    686,490,105    635,166,688  -7.5% GOOD

                            geo. mean                                          -0.7%
                            minimum                                           -33.9%
                            maximum                                            +4.5%

I looked at T17516. It seems we do a few more simplifier iterations and end up
with a larger program. It seems that some things inline more, while other things
inline less. I don't see low-hanging fruit.

I also looked at MultiLayerModulesTH_OneShot. It appears we generate a strange
join point in the `getUnique` method of `Uniquable GHC.Unit.Types.Module` that
should better call-site inline, but does not. Perhaps with !11492.

NoFib does not seem affected much either:

+-------------------------------++--+------------+-----------+---------------+-----------+
|                               ||  |      base/ | std. err. | T20749/ (rel) | std. err. |
+===============================++==+============+===========+===============+===========+
|           spectral/last-piece ||  |    7.263e8 |      0.0% |        +0.62% |      0.0% |
+===============================++==+============+===========+===============+===========+
|                     geom mean ||  |     +0.00% |           |               |           |
+-------------------------------++--+------------+-----------+---------------+-----------+

I had a look at last-piece. Nothing changes in stg-final, but there is a bit
of ... movement around Data.Map.insert's use of GHC.Exts.lazy that is gone in
stg-final.

Co-Authored-By: Jaro Reinders <jaro.reinders at gmail.com>

Metric Decrease:
    T12707
    T18140
    T18698b
    T18923
    T19695
    T20049
    T3294
    T9233
    T21839c
Metric Increase:
    ManyConstructors
    MultiLayerModulesTH_OneShot

- - - - -
0225249a by Simon Peyton Jones at 2024-10-25T07:02:32-04:00
Some renaming

This is a pure refactor, tidying up some inconsistent naming:

   isEqPred          -->  isEqClassPred
   isEqPrimPred      -->  isEqPred
   isReprEqPrimPred  -->  isReprEqPred
   mkPrimEqPred      -->  mkNomEqPred
   mkReprPrimEqPred  -->  mkReprEqPred
   mkPrimEqPredRold  -->  mkEqPredRole

Plus I moved mkNomEqPred, mkReprEqPred, mkEqPredRolek
  from GHC.Core.Coercion to GHC.Core.Predicate
where they belong.  That means that Coercion imports Predicate
rather than vice versa -- better.

- - - - -
15a3456b by Ryan Hendrickson at 2024-10-25T07:02:32-04:00
compiler: Fix deriving with method constraints

See Note [Inferred contexts from method constraints]

Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>

- - - - -
dbc77ce8 by Alan Zimmerman at 2024-10-25T18:20:13+01:00
EPA: Remove AddEpann commit 7

EPA: Remove [AddEpAnn] from HYPHEN in Parser.y

The return value is never used, as it is part of the backpack
configuration parsing.

EPA: Remove last [AddEpAnn] usages

Remove residual usage in GHC. It is still used
- In haddock TTG extension point definitions (to be removed)
- Some check-exact residual, to be removed
- Comments around DisambECP in PostProcess

EPA: Clean up [AddEpAnn] from check-exact

There is one left, to be cleaned up when we remove AddEpann itself

EPA: Remove [AddEpAnn] from haddock

The TTG extension points need a value, it is not critical what that
value is, in most cases.

EPA: Remove AddEpAnn from HsRuleAnn

EPA: Remove AddEpAnn from HsCmdArrApp

- - - - -
23ddcc01 by Simon Peyton Jones at 2024-10-26T12:44:34-04:00
Fix optimisation of InstCo

It turned out (#25387) that the fix to #15725 was not quite right:

  commit 48efbc04bd45d806c52376641e1a7ed7278d1ec7
  Date:   Mon Oct 15 10:25:02 2018 +0200

    Fix #15725 with an extra Sym

Optimising InstCo is quite subtle, and the invariants surrounding
the LiftingContext in the coercion optimiser were not stated explicitly.

This patch refactors the InstCo optimisation, and documents these
invariants.  See
  * Note [Optimising InstCo]
  * Note [The LiftingContext in optCoercion]

I also did some refactoring of course:

* Instead of a Bool swap-flag, I am not using GHC.Types.Basic.SwapFlag

* I added some invariant-checking the coercion-construction functions
  in GHC.Core.Coercion.Opt.  (Sadly these invariants don't hold during
  typechecking, becuase the types are un-zonked, so I can't put these
  checks in GHC.Core.Coercion.)

- - - - -
589fea7f by Cheng Shao at 2024-10-27T05:36:38-04:00
ghcid: use multi repl for ghcid

- - - - -
d52a0475 by Andrew Lelechenko at 2024-10-27T05:37:13-04:00
documentation: add motivating section to Control.Monad.Fix

- - - - -
301c3b54 by Cheng Shao at 2024-10-27T05:37:49-04:00
wasm: fix safari console error message related to import("node:timers")

This patch fixes the wasm backend JSFFI prelude script to avoid
calling `import("node:timers")` on non-deno hosts. Safari doesn't like
it and would print an error message to the console. Fixes
https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/issues/13.

- - - - -
9f02dfb5 by Simon Peyton Jones at 2024-10-27T15:10:08-04:00
Add a missing tidy in UnivCo

We were failing to tidy the argument coercions of a UnivCo, which
led directly to #25391.

The fix is, happily, trivial.

I don't have a small repro case (it came up when building horde-ad,
which uses typechecker plugins).  It should be possible to make a
repro case, by using a plugin (which builds a UnivCo) but I decided
it was not worth the bother. The bug is egregious and easily fixed.

- - - - -
853050c3 by Andrew Lelechenko at 2024-10-27T15:10:44-04:00
Bump text submodule to 2.1.2

- - - - -
90746a59 by Andrew Lelechenko at 2024-10-27T15:10:44-04:00
hadrian: allow -Wunused-imports for text package

- - - - -
8a6691c3 by Alan Zimmerman at 2024-10-27T19:44:48+00:00
EPA: Remove AddEpAnn Commit 8/final

EPA: Remove AddEpAnn from AnnList

EPA: Remove AddEpAnn from GrhsAnn

This is the last actual use

EPA: Remove NameAdornment from NameAnn

Also rework AnnContext to use EpToken, and AnnParen

EPA: Remove AddEpAnn.  Final removal

There are now none left, except for in a large note/comment in
PostProcess, describing the historical transition to the
disambiguation infrastructure

- - - - -
d5e7990c by Alan Zimmerman at 2024-10-28T21:41:05+00:00
EPA: Remove AnnKeywordId.

This was used as part of AddEpAnn, and is no longer needed.

Also remove all the haddock comments about which of are attached to
the various parts of the AST.  This is now clearly captured in the
appropriate TTG extension points, and the `ExactPrint.hs` file.

- - - - -
e08b8370 by Serge S. Gulin at 2024-10-29T23:17:01-04:00
JS: Re-add optimization for literal strings in genApp (fixes #23479)

Based on https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10588/

Co-authored-by: Sylvain Henry <sylvain at haskus.fr>
Co-authored-by: Andrei Borzenkov <root at sandwitch.dev>
Co-authored-by: Danil Berestov <goosedb at yandex.ru>

-------------------------
Metric Decrease:
    T25046_perf_size_gzip
    size_hello_artifact
    size_hello_artifact_gzip
    size_hello_unicode
    size_hello_unicode_gzip
-------------------------

- - - - -
e3496ef6 by Cheng Shao at 2024-10-29T23:17:37-04:00
compiler: remove unused hscDecls/hscDeclsWithLocation

This patch removes unused `hscDecls`/`hscDeclsWithLocation` functions
from the compiler, to reduce maintenance burden when doing
refactorings related to ghci.

- - - - -
b1eed26f by Cheng Shao at 2024-10-29T23:18:13-04:00
testsuite: add T25414 test case marked as broken

This commit adds T25414 test case to demonstrate #25414. It is marked
as broken and will be fixed by the next commit.

- - - - -
e70009bc by Cheng Shao at 2024-10-29T23:18:13-04:00
driver: fix foreign stub handling logic in hscParsedDecls

This patch fixes foreign stub handling logic in `hscParsedDecls`.
Previously foreign stubs were simply ignored here, so any feature that
involve foreign stubs would not work in ghci (e.g. CApiFFI). The patch
reuses `generateByteCode` logic and eliminates a large chunk of
duplicate logic that implements Core to bytecode generation pipeline
here. Fixes #25414.

- - - - -
1d7cd7fe by Andreas Klebinger at 2024-10-30T19:14:28-04:00
Add since tag for -fwrite-if-compression in user guide.

Partial fix for #25395

- - - - -
b349fd1b by Alan Zimmerman at 2024-10-30T19:15:04-04:00
EPA: Remove some unused functions

- - - - -
f859d61c by Alan Zimmerman at 2024-10-30T19:15:04-04:00
EPA: use explicit vertical bar token for ExplicitSum / SumPat

- - - - -
721ac00d by Ben Gamari at 2024-10-31T08:37:38-04:00
rts/Disassembler: Fix encoding of BRK_FUN instruction

The offset of the CC field was not updated after the encoding change in
b85b11994e0130ff2401dd4bbdf52330e0bcf776. Fix this.

Fixes #25374.

- - - - -
0bc94360 by Alan Zimmerman at 2024-10-31T08:38:15-04:00
EPA: Bring in last EpToken usages

For import declarations, NameAnnCommas and NPlusKPat.

And remove anchor, it is the same as epaLocationRealSrcSpan.

- - - - -
0b11cdc0 by sheaf at 2024-10-31T08:38:55-04:00
Assert that ctEvCoercion is called on an equality

Calling 'ctEvCoercion' on non-equality constraints is always incorrect.
We add an assertion to this function to detect such cases; for example
a type-checking plugin might erroneously do this.

- - - - -
352cc3ac by Andreas Klebinger at 2024-11-01T14:12:55+01:00
Compile T25062 simd tests even if we can't run them.

Helps avoid them being utterly broken.

Fixes #25341

- - - - -


23 changed files:

- .ghcid
- .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
- CODEOWNERS
- cabal.project-reinstall
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/Dwarf/Types.hs
- compiler/GHC/CmmToAsm/PIC.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Stats.hs
- compiler/GHC/CmmToAsm/Wasm.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/CmmToLlvm/Data.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b16b01f1f91821ff6920ecbfb8e702f27107b017...352cc3ac121681998fc13c9458644304010dbcf2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b16b01f1f91821ff6920ecbfb8e702f27107b017...352cc3ac121681998fc13c9458644304010dbcf2
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/20241101/b19a0d6b/attachment-0001.html>


More information about the ghc-commits mailing list