[Git][ghc/ghc][wip/req_smp] 212 commits: Make Functor a quantified superclass of Bifunctor.

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Mon Jan 9 15:36:45 UTC 2023



doyougnu pushed to branch wip/req_smp at Glasgow Haskell Compiler / GHC


Commits:
d87f28d8 by Baldur Blöndal at 2022-11-30T21:16:36+01:00
Make Functor a quantified superclass of Bifunctor.

See https://github.com/haskell/core-libraries-committee/issues/91 for
discussion.

This change relates Bifunctor with Functor by requiring second = fmap.
Moreover this change is a step towards unblocking the major version bump
of bifunctors and profunctors to major version 6. This paves the way to
move the Profunctor class into base. For that Functor first similarly
becomes a superclass of Profunctor in the new major version 6.

- - - - -
72cf4c5d by doyougnu at 2022-12-01T12:36:44-05:00
FastString: SAT bucket_match

Metric Decrease:
    MultiLayerModulesTH_OneShot

- - - - -
afc2540d by Simon Peyton Jones at 2022-12-01T12:37:20-05:00
Add a missing varToCoreExpr in etaBodyForJoinPoint

This subtle bug showed up when compiling a library with 9.4.
See #22491.  The bug is present in master, but it is hard to
trigger; the new regression test T22491 fails in 9.4.

The fix was easy: just add a missing varToCoreExpr in
etaBodyForJoinPoint.

The fix is definitely right though!

I also did some other minor refatoring:
* Moved the preInlineUnconditionally test in simplExprF1 to
  before the call to joinPointBinding_maybe, to avoid fruitless
  eta-expansion.
* Added a boolean from_lam flag to simplNonRecE, to avoid two
  fruitless tests, and commented it a bit better.

These refactorings seem to save 0.1% on compile-time allocation in
perf/compiler; with a max saving of 1.4% in T9961

Metric Decrease:
    T9961

- - - - -
81eeec7f by M Farkas-Dyck at 2022-12-01T12:37:56-05:00
CI: Forbid the fully static build on Alpine to fail.

To do so, we mark some tests broken in this configuration.

- - - - -
c5d1bf29 by Bryan Richter at 2022-12-01T12:37:56-05:00
CI: Remove ARMv7 jobs

These jobs fail (and are allowed to fail) nearly every time.

Soon they won't even be able to run at all, as we won't currently have
runners that can run them.

Fixing the latter problem is tracked in #22409.

I went ahead and removed all settings and configurations.

- - - - -
d82992fd by Bryan Richter at 2022-12-01T12:37:56-05:00
CI: Fix CI lint

Failure was introduced by conflicting changes to gen_ci.hs that did
*not* trigger git conflicts.

- - - - -
ce126993 by Simon Peyton Jones at 2022-12-02T01:22:12-05:00
Refactor TyCon to have a top-level product

This patch changes the representation of TyCon so that it has
a top-level product type, with a field that gives the details
(newtype, type family etc), #22458.

Not much change in allocation, but execution seems to be a bit
faster.

Includes a change to the haddock submodule to adjust for API changes.

- - - - -
74c767df by Matthew Pickering at 2022-12-02T01:22:48-05:00
ApplicativeDo: Set pattern location before running exhaustiveness checker

This improves the error messages of the exhaustiveness checker when
checking statements which have been moved around with ApplicativeDo.

Before:

Test.hs:2:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘Maybe ()’ not matched: Nothing
  |
2 |   let x = ()
  |   ^^^^^^^^^^

After:

Test.hs:4:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘Maybe ()’ not matched: Nothing
  |
4 |   ~(Just res1) <- seq x (pure $ Nothing @())
  |

Fixes #22483

- - - - -
85ecc1a0 by Matthew Pickering at 2022-12-02T19:46:43-05:00
Add special case for :Main module in `GHC.IfaceToCore.mk_top_id`

See Note [Root-main Id]

The `:Main` special binding is actually defined in the current module
(hence don't go looking for it externally) but the module name is rOOT_MAIN
rather than the current module so we need this special case.

There was already some similar logic in `GHC.Rename.Env` for
External Core, but now the "External Core" is in interface files it
needs to be moved here instead.

Fixes #22405

- - - - -
108c319f by Krzysztof Gogolewski at 2022-12-02T19:47:18-05:00
Fix linearity checking in Lint

Lint was not able to see that x*y <= x*y, because this inequality
was decomposed to x <= x*y && y <= x*y, but there was no rule
to see that x <= x*y.

Fixes #22546.

- - - - -
bb674262 by Bryan Richter at 2022-12-03T04:38:46-05:00
Mark T16916 fragile

See https://gitlab.haskell.org/ghc/ghc/-/issues/16966

- - - - -
5d267d46 by Vladislav Zavialov at 2022-12-03T04:39:22-05:00
Refactor: FreshOrReuse instead of addTyClTyVarBinds

This is a refactoring that should have no effect on observable behavior.

Prior to this change, GHC.HsToCore.Quote contained a few closely related
functions to process type variable bindings: addSimpleTyVarBinds,
addHsTyVarBinds, addQTyVarBinds, and addTyClTyVarBinds.

We can classify them by their input type and name generation strategy:

                              Fresh names only    Reuse bound names
                          +---------------------+-------------------+
                   [Name] | addSimpleTyVarBinds |                   |
[LHsTyVarBndr flag GhcRn] |     addHsTyVarBinds |                   |
        LHsQTyVars GhcRn  |      addQTyVarBinds | addTyClTyVarBinds |
                          +---------------------+-------------------+

Note how two functions are missing. Because of this omission, there were
two places where a LHsQTyVars value was constructed just to be able to pass it
to addTyClTyVarBinds:

1. mk_qtvs in addHsOuterFamEqnTyVarBinds    -- bad
2. mkHsQTvs in repFamilyDecl                -- bad

This prevented me from making other changes to LHsQTyVars, so the main
goal of this refactoring is to get rid of those workarounds.

The most direct solution would be to define the missing functions.
But that would lead to a certain amount of code duplication. To avoid
code duplication, I factored out the name generation strategy into a
function parameter:

	data FreshOrReuse
	  = FreshNamesOnly
	  | ReuseBoundNames

	addSimpleTyVarBinds :: FreshOrReuse -> ...
	addHsTyVarBinds     :: FreshOrReuse -> ...
	addQTyVarBinds      :: FreshOrReuse -> ...

- - - - -
c189b831 by Vladislav Zavialov at 2022-12-03T04:39:22-05:00
addHsOuterFamEqnTyVarBinds: use FreshNamesOnly for explicit binders

Consider this example:

	[d| instance forall a. C [a] where
	      type forall b. G [a] b = Proxy b |]

When we process "forall b." in the associated type instance, it is
unambiguously the binding site for "b" and we want a fresh name for it.
Therefore, FreshNamesOnly is more fitting than ReuseBoundNames.
This should not have any observable effect but it avoids pointless
lookups in the MetaEnv.

- - - - -
42512264 by Ross Paterson at 2022-12-03T10:32:45+00:00
Handle type data declarations in Template Haskell quotations and splices (fixes #22500)

This adds a TypeDataD constructor to the Template Haskell Dec type,
and ensures that the constructors it contains go in the TyCls namespace.

- - - - -
1a767fa3 by Vladislav Zavialov at 2022-12-05T05:18:50-05:00
Add BufSpan to EpaLocation (#22319, #22558)

The key part of this patch is the change to mkTokenLocation:

	- mkTokenLocation (RealSrcSpan r _)  = TokenLoc (EpaSpan r)
	+ mkTokenLocation (RealSrcSpan r mb) = TokenLoc (EpaSpan r mb)

mkTokenLocation used to discard the BufSpan, but now it is saved and can
be retrieved from LHsToken or LHsUniToken.

This is made possible by the following change to EpaLocation:

	- data EpaLocation = EpaSpan !RealSrcSpan
	+ data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan)
	                   | ...

The end goal is to make use of the BufSpan in Parser/PostProcess/Haddock.

- - - - -
cd31acad by sheaf at 2022-12-06T15:45:58-05:00
Hadrian: fix ghcDebugAssertions off-by-one error

Commit 6b2f7ffe changed the logic that decided whether to enable debug
assertions. However, it had an off-by-one error, as the stage parameter
to the function inconsistently referred to the stage of the compiler
being used to build or the stage of the compiler we are building.

This patch makes it consistent. Now the parameter always refers to the
the compiler which is being built.

In particular, this patch re-enables
assertions in the stage 2 compiler when building with devel2 flavour,
and disables assertions in the stage 2 compiler when building with
validate flavour.

Some extra performance tests are now run in the "validate" jobs because
the stage2 compiler no longer contains assertions.

-------------------------
Metric Decrease:
    CoOpt_Singletons
    MultiComponentModules
    MultiComponentModulesRecomp
    MultiLayerModulesTH_OneShot
    T11374
    T12227
    T12234
    T13253-spj
    T13701
    T14683
    T14697
    T15703
    T17096
    T17516
    T18304
    T18478
    T18923
    T5030
    T9872b
    TcPlugin_RewritePerf
Metric Increase:
    MultiComponentModules
    MultiComponentModulesRecomp
    MultiLayerModules
    MultiLayerModulesRecomp
    MultiLayerModulesTH_Make
    T13386
    T13719
    T3294
    T9233
    T9675
    parsing001
-------------------------

- - - - -
21d66db1 by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of runInstallNameTool

- - - - -
aaaaa79b by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of askOtool

- - - - -
4e28f49e by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of runInjectRPaths

- - - - -
a7422580 by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of Linker.MacOS

- - - - -
e902d771 by Matthew Craven at 2022-12-08T08:30:23-05:00
Fix bounds-checking buglet in Data.Array.Byte

...another manifestation of #20851 which
I unfortunately missed in my first pass.

- - - - -
8d36c0c6 by Gergő Érdi at 2022-12-08T08:31:03-05:00
Remove copy-pasted definitions of `graphFromEdgedVertices*`

- - - - -
c5d8ed3a by Gergő Érdi at 2022-12-08T08:31:03-05:00
Add version of `reachableGraph` that avoids loop for cyclic inputs
by building its result connected component by component

Fixes #22512

- - - - -
90cd5396 by Krzysztof Gogolewski at 2022-12-08T08:31:39-05:00
Mark Type.Reflection.Unsafe as Unsafe

This module can be used to construct ill-formed TypeReps, so it should
be Unsafe.

- - - - -
2057c77d by Ian-Woo Kim at 2022-12-08T08:32:19-05:00
Truncate eventlog event for large payload (#20221)

RTS eventlog events for postCapsetVecEvent are truncated if payload
is larger than EVENT_PAYLOAD_SIZE_MAX
Previously, postCapsetVecEvent records eventlog event with payload
of variable size larger than EVENT_PAYLOAD_SIZE_MAX (2^16) without
any validation, resulting in corrupted data.
For example, this happens when a Haskell binary is invoked with very
long command line arguments exceeding 2^16 bytes (see #20221).
Now we check the size of accumulated payload messages incrementally,
and truncate the message just before the payload size exceeds
EVENT_PAYLOAD_SIZE_MAX. RTS will warn the user with a message showing
how many arguments are truncated.

- - - - -
9ec76f61 by Cheng Shao at 2022-12-08T08:32:59-05:00
hadrian: don't add debug info to non-debug ways of rts

Hadrian used to pass -g when building all ways of rts. It makes output
binaries larger (especially so for wasm backend), and isn't needed by
most users out there, so this patch removes that flag. In case the
debug info is desired, we still pass -g3 when building the debug way,
and there's also the debug_info flavour transformer which ensures -g3
is passed for all rts ways.

- - - - -
7658cdd4 by Krzysztof Gogolewski at 2022-12-08T08:33:36-05:00
Restore show (typeRep @[]) == "[]"

The Show instance for TypeRep [] has changed in 9.5 to output "List"
because the name of the type constructor changed.
This seems to be accidental and is inconsistent with TypeReps of saturated
lists, which are printed as e.g. "[Int]".
For now, I'm restoring the old behavior; in the future,
maybe we should show TypeReps without puns (List, Tuple, Type).

- - - - -
216deefd by Matthew Pickering at 2022-12-08T22:45:27-05:00
Add test for #22162

- - - - -
5d0a311f by Matthew Pickering at 2022-12-08T22:45:27-05:00
ci: Add job to test interface file determinism guarantees

In this job we can run on every commit we add a test which builds the
Cabal library twice and checks that the ABI hash and interface hash is
stable across the two builds.

* We run the test 20 times to try to weed out any race conditions due to
  `-j`
* We run the builds in different temporary directories to try to weed
  out anything related to build directory affecting ABI or interface
  file hash.

Fixes #22180

- - - - -
0a76d7d4 by Matthew Pickering at 2022-12-08T22:45:27-05:00
ci: Add job for testing interface stability across builds

The idea is that both the bindists should product libraries with the
same ABI and interface hash.
So the job checks with ghc-pkg to make sure the computed ABI
is the same.

In future this job can be extended to check for the other facets of
interface determinism.

Fixes #22180

- - - - -
74c9bf91 by Matthew Pickering at 2022-12-08T22:45:27-05:00
backpack: Be more careful when adding together ImportAvails

There was some code in the signature merging logic which added together
the ImportAvails of the signature and the signature which was merged
into it. This had the side-effect of making the merged signature depend
on the signature (via a normal module dependency). The intention was to
propagate orphan instances through the merge but this also messed up
recompilation logic because we shouldn't be attempting to load B.hi when
mergeing it.

The fix is to just combine the part of ImportAvails that we intended to
(transitive info, orphan instances and type family instances) rather
than the whole thing.

- - - - -
d122e022 by Matthew Pickering at 2022-12-08T22:45:27-05:00
Fix mk_mod_usage_info if the interface file is not already loaded

In #22217 it was observed that the order modules are compiled in affects
the contents of an interface file. This was because a module dependended
on another module indirectly, via a re-export but the interface file for
this module was never loaded because the symbol was never used in the
file.

If we decide that we depend on a module then we jolly well ought to
record this fact in the interface file! Otherwise it could lead to very
subtle recompilation bugs if the dependency is not tracked and the
module is updated.

Therefore the best thing to do is just to make sure the file is loaded
by calling the `loadSysInterface` function.  This first checks the
caches (like we did before) but then actually goes to find the interface
on disk if it wasn't loaded.

Fixes #22217

- - - - -
ea25088d by lrzlin at 2022-12-08T22:46:06-05:00
Add initial support for LoongArch Architecture.

- - - - -
9eb9d2f4 by Bodigrim at 2022-12-08T22:46:47-05:00
Update submodule mtl to 2.3.1, parsec to 3.1.15.1, haddock and Cabal to HEAD

- - - - -
08d8fe2a by Bodigrim at 2022-12-08T22:46:47-05:00
Allow mtl-2.3 in hadrian

- - - - -
3807a46c by Bodigrim at 2022-12-08T22:46:47-05:00
Support mtl-2.3 in check-exact

- - - - -
ef702a18 by Bodigrim at 2022-12-08T22:46:47-05:00
Fix tests

- - - - -
3144e8ff by Sebastian Graf at 2022-12-08T22:47:22-05:00
Make (^) INLINE (#22324)

So that we get to cancel away the allocation for the lazily used base.

We can move `powImpl` (which *is* strict in the base) to the top-level
so that we don't duplicate too much code and move the SPECIALISATION
pragmas onto `powImpl`.

The net effect of this change is that `(^)` plays along much better with
inlining thresholds and loopification (#22227), for example in `x2n1`.

Fixes #22324.

- - - - -
1d3a8b8e by Matthew Pickering at 2022-12-08T22:47:59-05:00
Typeable: Fix module locations of some definitions in GHC.Types

There was some confusion in Data.Typeable about which module certain
wired-in things were defined in. Just because something is wired-in
doesn't mean it comes from GHC.Prim, in particular things like LiftedRep
and RuntimeRep are defined in GHC.Types and that's the end of the story.

Things like Int#, Float# etc are defined in GHC.Prim as they have no
Haskell definition site at all so we need to generate type
representations for them (which live in GHC.Types).

Fixes #22510

- - - - -
0f7588b5 by Sebastian Graf at 2022-12-08T22:48:34-05:00
Make `drop` and `dropWhile` fuse (#18964)

I copied the fusion framework we have in place for `take`.
T18964 asserts that we regress neither when fusion fires nor when it doesn't.

Fixes #18964.

- - - - -
26e71562 by Sebastian Graf at 2022-12-08T22:49:10-05:00
Do not strictify a DFun's parameter dictionaries (#22549)

... thus fixing #22549.

The details are in the refurbished and no longer dead
`Note [Do not strictify a DFun's parameter dictionaries]`.

There's a regression test in T22549.

- - - - -
36093407 by John Ericson at 2022-12-08T22:49:45-05:00
Delete `rts/package.conf.in`

It is a relic of the Make build system. The RTS now uses a
`package.conf` file generated the usual way by Cabal.

- - - - -
b0cc2fcf by Krzysztof Gogolewski at 2022-12-08T22:50:21-05:00
Fixes around primitive literals

* The SourceText of primitive characters 'a'# did not include
  the #, unlike for other primitive literals 1#, 1##, 1.0#, 1.0##, "a"#.
  We can now remove the function pp_st_suffix, which was a hack
  to add the # back.
* Negative primitive literals shouldn't use parentheses, as described in
  Note [Printing of literals in Core]. Added a testcase to T14681.

- - - - -
aacf616d by Bryan Richter at 2022-12-08T22:50:56-05:00
testsuite: Mark conc024 fragile on Windows

- - - - -
ed239a24 by Ryan Scott at 2022-12-09T09:42:16-05:00
Document TH splices' interaction with INCOHERENT instances

Top-level declaration splices can having surprising interactions with
`INCOHERENT` instances, as observed in #22492. This patch
resolves #22492 by documenting this strange interaction in the GHC User's
Guide.

[ci skip]

- - - - -
1023b432 by Mike Pilgrem at 2022-12-09T09:42:56-05:00
Fix #22300 Document GHC's extensions to valid whitespace

- - - - -
79b0cec0 by Luite Stegeman at 2022-12-09T09:43:38-05:00
Add support for environments that don't have setImmediate

- - - - -
5b007ec5 by Luite Stegeman at 2022-12-09T09:43:38-05:00
Fix bound thread status

- - - - -
65335d10 by Matthew Pickering at 2022-12-09T20:15:45-05:00
Update containers submodule

This contains a fix necessary for the multi-repl to work on GHC's code
base where we try to load containers and template-haskell into the same
session.

- - - - -
4937c0bb by Matthew Pickering at 2022-12-09T20:15:45-05:00
hadrian-multi: Put interface files in separate directories

Before we were putting all the interface files in the same directory
which was leading to collisions if the files were called the same thing.

- - - - -
8acb5b7b by Matthew Pickering at 2022-12-09T20:15:45-05:00
hadrian-toolargs: Add filepath to allowed repl targets

- - - - -
5949d927 by Matthew Pickering at 2022-12-09T20:15:45-05:00
driver: Set correct UnitId when rehydrating modules

We were not setting the UnitId before rehydrating modules which just led
to us attempting to find things in the wrong HPT. The test for this is
the hadrian-multi command (which is now added as a CI job).

Fixes #22222

- - - - -
ab06c0f0 by Matthew Pickering at 2022-12-09T20:15:45-05:00
ci: Add job to test hadrian-multi command

I am not sure this job is good because it requires booting HEAD with
HEAD, but it should be fine.

- - - - -
fac3e568 by Matthew Pickering at 2022-12-09T20:16:20-05:00
hadrian: Update bootstrap plans to 9.2.* series and 9.4.* series.

This updates the build plans for the most recent compiler versions, as
well as fixing the hadrian-bootstrap-gen script to a specific GHC
version.

- - - - -
195b08b4 by Matthew Pickering at 2022-12-09T20:16:20-05:00
ci: Bump boot images to use ghc-9.4.3

Also updates the bootstrap jobs to test booting 9.2 and 9.4.

- - - - -
c658c580 by Matthew Pickering at 2022-12-09T20:16:20-05:00
hlint: Removed redundant UnboxedSums pragmas

UnboxedSums is quite confusingly implied by UnboxedTuples, alas, just
the way it is.

See #22485

- - - - -
b3e98a92 by Oleg Grenrus at 2022-12-11T12:26:17-05:00
Add heqT, a kind-heterogeneous variant of heq

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

- - - - -
bfd7c1e6 by Bodigrim at 2022-12-11T12:26:55-05:00
Document that Bifunctor instances for tuples are lawful only up to laziness

- - - - -
5d1a1881 by Bryan Richter at 2022-12-12T16:22:36-05:00
Mark T21336a fragile

- - - - -
c30accc2 by Matthew Pickering at 2022-12-12T16:23:11-05:00
Add test for #21476

This issues seems to have been fixed since the ticket was made, so let's
add a test and move on.

Fixes #21476

- - - - -
e9d74a3e by Sebastian Graf at 2022-12-13T22:18:39-05:00
Respect -XStrict in the pattern-match checker (#21761)

We were missing a call to `decideBangHood` in the pattern-match checker.
There is another call in `matchWrapper.mk_eqn_info` which seems redundant
but really is not; see `Note [Desugaring -XStrict matches in Pmc]`.

Fixes #21761.

- - - - -
884790e2 by Gergő Érdi at 2022-12-13T22:19:14-05:00
Fix loop in the interface representation of some `Unfolding` fields

As discovered in #22272, dehydration of the unfolding info of a
recursive definition used to involve a traversal of the definition
itself, which in turn involves traversing the unfolding info. Hence,
a loop.

Instead, we now store enough data in the interface that we can produce
the unfolding info without this traversal. See Note [Tying the 'CoreUnfolding' knot]
for details.

Fixes #22272

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

- - - - -
9f301189 by Alan Zimmerman at 2022-12-13T22:19:50-05:00
EPA: When splitting out header comments, keep ones for first decl

Any comments immediately preceding the first declaration are no longer
kept as header comments, but attach to the first declaration instead.

- - - - -
8b1f1b45 by Sylvain Henry at 2022-12-13T22:20:28-05:00
JS: fix object file name comparison (#22578)

- - - - -
e9e161bb by Bryan Richter at 2022-12-13T22:21:03-05:00
configure: Bump min bootstrap GHC version to 9.2

- - - - -
75855643 by Ben Gamari at 2022-12-15T03:54:02-05:00
hadrian: Don't enable TSAN in stage0 build

- - - - -
da7b51d8 by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm: Introduce blockConcat

- - - - -
34f6b09c by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm: Introduce MemoryOrderings

- - - - -
43beaa7b by Ben Gamari at 2022-12-15T03:54:02-05:00
llvm: Respect memory specified orderings

- - - - -
8faf74fc by Ben Gamari at 2022-12-15T03:54:02-05:00
Codegen/x86: Eliminate barrier for relaxed accesses

- - - - -
6cc3944a by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm/Parser: Reduce some repetition

- - - - -
6c9862c4 by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm/Parser: Add syntax for ordered loads and stores

- - - - -
748490d2 by Ben Gamari at 2022-12-15T03:54:02-05:00
cmm/Parser: Atomic load syntax

Originally I had thought I would just use the `prim` call syntax instead
of introducing new syntax for atomic loads. However, it turns out that
`prim` call syntax tends to make things quite unreadable. This new
syntax seems quite natural.

- - - - -
28c6781a by Ben Gamari at 2022-12-15T03:54:02-05:00
codeGen: Introduce ThreadSanitizer instrumentation

This introduces a new Cmm pass which instruments the program with
ThreadSanitizer annotations, allowing full tracking of mutator memory
accesses via TSAN.

- - - - -
d97aa311 by Ben Gamari at 2022-12-15T03:54:02-05:00
Hadrian: Drop TSAN_ENABLED define from flavour

This is redundant since the TSANUtils.h already defines it.

- - - - -
86974ef1 by Ben Gamari at 2022-12-15T03:54:02-05:00
hadrian: Enable Cmm instrumentation in TSAN flavour

- - - - -
93723290 by Ben Gamari at 2022-12-15T03:54:02-05:00
rts: Ensure that global regs are never passed as fun call args

This is in general unsafe as they may be clobbered if they are mapped to
caller-saved machine registers. See Note [Register parameter passing].

- - - - -
2eb0fb87 by Matthew Pickering at 2022-12-15T03:54:39-05:00
Package Imports: Get candidate packages also from re-exported modules

Previously we were just looking at the direct imports to try and work
out what a package qualifier could apply to but #22333 pointed out we
also needed to look for reexported modules.

Fixes #22333

- - - - -
552b7908 by Ben Gamari at 2022-12-15T03:55:15-05:00
compiler: Ensure that MutVar operations have necessary barriers

Here we add acquire and release barriers in readMutVar# and
writeMutVar#, which are necessary for soundness.

Fixes #22468.

- - - - -
933d61a4 by Simon Peyton Jones at 2022-12-15T03:55:51-05:00
Fix bogus test in Lint

The Lint check for branch compatiblity within an axiom, in
GHC.Core.Lint.compatible_branches was subtly different to the
check made when contructing an axiom, in
GHC.Core.FamInstEnv.compatibleBranches.

The latter is correct, so I killed the former and am now using the
latter.

On the way I did some improvements to pretty-printing and documentation.

- - - - -
03ed0b95 by Ryan Scott at 2022-12-15T03:56:26-05:00
checkValidInst: Don't expand synonyms when splitting sigma types

Previously, the `checkValidInst` function (used when checking that an instance
declaration is headed by an actual type class, not a type synonym) was using
`tcSplitSigmaTy` to split apart the `forall`s and instance context. This is
incorrect, however, as `tcSplitSigmaTy` expands type synonyms, which can cause
instances headed by quantified constraint type synonyms to be accepted
erroneously.

This patch introduces `splitInstTyForValidity`, a variant of `tcSplitSigmaTy`
specialized for validity checking that does _not_ expand type synonyms, and
uses it in `checkValidInst`.

Fixes #22570.

- - - - -
ed056bc3 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts/Messages: Refactor

This doesn't change behavior but makes the code a bit easier to follow.

- - - - -
7356f8e0 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts/ThreadPaused: Ordering fixes

- - - - -
914f0025 by Ben Gamari at 2022-12-16T16:12:44-05:00
eventlog: Silence spurious data race

- - - - -
fbc84244 by Ben Gamari at 2022-12-16T16:12:44-05:00
Introduce SET_INFO_RELEASE for Cmm

- - - - -
821b5472 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts: Use fences instead of explicit barriers

- - - - -
2228c999 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts/stm: Fix memory ordering in readTVarIO#

See #22421.

- - - - -
99269b9f by Ben Gamari at 2022-12-16T16:12:44-05:00
Improve heap memory barrier Note

Also introduce MUT_FIELD marker in Closures.h to document mutable
fields.

- - - - -
70999283 by Ben Gamari at 2022-12-16T16:12:44-05:00
rts: Introduce getNumCapabilities

And ensure accesses to n_capabilities are atomic (although with relaxed
ordering). This is necessary as RTS API callers may concurrently call
into the RTS without holding a capability.

- - - - -
98689f77 by Ben Gamari at 2022-12-16T16:12:44-05:00
ghc: Fix data race in dump file handling

Previously the dump filename cache would use a non-atomic update which
could potentially result in lost dump contents. Note that this is still
a bit racy since the first writer may lag behind a later appending
writer.

- - - - -
605d9547 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Always use atomics for context_switch and interrupt

Since these are modified by the timer handler.

- - - - -
86f20258 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts/Timer: Always use atomic operations

As noted in #22447, the existence of the pthread-based ITimer
implementation means that we cannot assume that the program is
single-threaded.

- - - - -
f8e901dc by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Encapsulate recent_activity access

This makes it easier to ensure that it is accessed using the necessary
atomic operations.

- - - - -
e0affaa9 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Encapsulate access to capabilities array

- - - - -
7ca683e4 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Encapsulate sched_state

- - - - -
1cf13bd0 by Ben Gamari at 2022-12-16T16:12:45-05:00
PrimOps: Fix benign MutVar race

Relaxed ordering is fine here since the later CAS implies a release.

- - - - -
3d2a7e08 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Style fix

- - - - -
82c62074 by Ben Gamari at 2022-12-16T16:12:45-05:00
compiler: Use release store in eager blackholing

- - - - -
eb1a0136 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Fix ordering of makeStableName

- - - - -
ad0e260a by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Use ordered accesses instead of explicit barriers

- - - - -
a3eccf06 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Statically allocate capabilities

This is a rather simplistic way of solving #17289.

- - - - -
287fa3fb by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Ensure that all accesses to pending_sync are atomic

- - - - -
351eae58 by Ben Gamari at 2022-12-16T16:12:45-05:00
rts: Note race with wakeBlockingQueue

- - - - -
5acf33dd by Bodigrim at 2022-12-16T16:13:22-05:00
Bump submodule directory to 1.3.8.0 and hpc to HEAD

- - - - -
0dd95421 by Bodigrim at 2022-12-16T16:13:22-05:00
Accept allocations increase on Windows

This is because of `filepath-1.4.100.0` and AFPP, causing increasing round-trips
between lists and ByteArray. See #22625 for discussion.

Metric Increase:
    MultiComponentModules
    MultiComponentModulesRecomp
    MultiLayerModules
    MultiLayerModulesRecomp
    T10421
    T10547
    T12150
    T12227
    T12234
    T12425
    T13035
    T13253
    T13253-spj
    T13701
    T13719
    T15703
    T16875
    T18140
    T18282
    T18304
    T18698a
    T18698b
    T18923
    T20049
    T21839c
    T21839r
    T5837
    T6048
    T9198
    T9961
    TcPlugin_RewritePerf
    hard_hole_fits

- - - - -
ef9ac9d2 by Cheng Shao at 2022-12-16T16:13:59-05:00
testsuite: Mark T9405 as fragile instead of broken on Windows

It's starting to pass again, and the unexpected pass blocks CI.

- - - - -
1f3abd85 by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: remove obsolete commented code in wasm NCG

It was just a temporary hack to workaround a bug in the relooper, that
bug has been fixed long before the wasm backend is merged.

- - - - -
e3104eab by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: add missing export list of GHC.CmmToAsm.Wasm.FromCmm

Also removes some unreachable code here.

- - - - -
1c6930bf by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: change fallback function signature to Cmm function signature in wasm NCG

In the wasm NCG, when handling a `CLabel` of undefined function
without knowing its function signature, we used to fallback to `() ->
()` which is accepted by `wasm-ld`. This patch changes it to the
signature of Cmm functions, which equally works, but would be required
when we emit tail call instructions.

- - - - -
8a81d9d9 by Cheng Shao at 2022-12-16T21:16:28+00:00
compiler: add optional tail-call support in wasm NCG

When the `-mtail-call` clang flag is passed at configure time, wasm
tail-call extension is enabled, and the wasm NCG will emit
`return_call`/`return_call_indirect` instructions to take advantage of
it and avoid the `StgRun` trampoline overhead.

Closes #22461.

- - - - -
d1431cc0 by Cheng Shao at 2022-12-17T08:07:15-05:00
base: add missing autoconf checks for waitpid/umask

These are not present in wasi-libc. Required for fixing #22589

- - - - -
da3f1e91 by Cheng Shao at 2022-12-17T08:07:51-05:00
compiler: make .wasm the default executable extension on wasm32

Following convention as in other wasm toolchains. Fixes #22594.

- - - - -
ad21f4ef by Cheng Shao at 2022-12-17T08:07:51-05:00
ci: support hello.wasm in ci.sh cross testing logic

- - - - -
6fe2d778 by amesgen at 2022-12-18T19:33:49-05:00
Correct `exitWith` Haddocks

The `IOError`-specific `catch` in the Prelude is long gone.

- - - - -
b3eacd64 by Ben Gamari at 2022-12-18T19:34:24-05:00
rts: Drop racy assertion

0e274c39bf836d5bb846f5fa08649c75f85326ac added an assertion in
`dirty_MUT_VAR` checking that the MUT_VAR being dirtied was clean.
However, this isn't necessarily the case since another thread may have
raced us to dirty the object.

- - - - -
761c1f49 by Ben Gamari at 2022-12-18T19:35:00-05:00
rts/libdw: Silence uninitialized usage warnings

As noted in #22538, previously some GCC versions warned that various
locals in Libdw.c may be used uninitialized. Although this wasn't
strictly true (since they were initialized in an inline assembler block)
we fix this by providing explicit empty initializers.

Fixes #22538
- - - - -
5e047eff by Matthew Pickering at 2022-12-20T15:12:04+00:00
testsuite: Mark T16392 as fragile on windows

See #22649

- - - - -
703a4665 by M Farkas-Dyck at 2022-12-20T21:14:46-05:00
Scrub some partiality in `GHC.Cmm.Info.Build`: `doSRTs` takes a `[(CAFSet, CmmDecl)]` but truly wants a `[(CAFSet, CmmStatics)]`.

- - - - -
9736ab74 by Matthew Pickering at 2022-12-20T21:15:22-05:00
packaging: Fix upload_ghc_libs.py script

This change reflects the changes where .cabal files are now generated by
hadrian rather than ./configure.

Fixes #22518

- - - - -
7c6de18d by Ben Gamari at 2022-12-20T21:15:57-05:00
configure: Drop uses of AC_PROG_CC_C99

As noted in #22566, this macro is deprecated as of autoconf-2.70
`AC_PROG_CC` now sets `ac_cv_prog_cc_c99` itself.

Closes #22566.

- - - - -
36c5d98e by Ben Gamari at 2022-12-20T21:15:57-05:00
configure: Use AS_HELP_STRING instead of AC_HELP_STRING

The latter has been deprecated.

See #22566.

- - - - -
befe6ff8 by Bodigrim at 2022-12-20T21:16:37-05:00
GHCi.UI: fix various usages of head and tail

- - - - -
666d0ba7 by Bodigrim at 2022-12-20T21:16:37-05:00
GHCi.UI: avoid head and tail in parseCallEscape and around

- - - - -
5d96fd50 by Bodigrim at 2022-12-20T21:16:37-05:00
Make GHC.Driver.Main.hscTcRnLookupRdrName to return NonEmpty

- - - - -
3ce2ab94 by Bodigrim at 2022-12-21T06:17:56-05:00
Allow transformers-0.6 in ghc, ghci, ghc-bin and hadrian

- - - - -
954de93a by Bodigrim at 2022-12-21T06:17:56-05:00
Update submodule haskeline to HEAD (to allow transformers-0.6)

- - - - -
cefbeec3 by Bodigrim at 2022-12-21T06:17:56-05:00
Update submodule transformers to 0.6.0.4

- - - - -
b4730b62 by Bodigrim at 2022-12-21T06:17:56-05:00
Fix tests

T13253 imports MonadTrans, which acquired a quantified constraint in transformers-0.6, thus increase in allocations

Metric Increase:
    T13253

- - - - -
0be75261 by Simon Peyton Jones at 2022-12-21T06:18:32-05:00
Abstract over the right free vars

Fix #22459, in two ways:

(1) Make the Specialiser not create a bogus specialisation if
    it is presented by strangely polymorphic dictionary.
    See Note [Weird special case in SpecDict] in
    GHC.Core.Opt.Specialise

(2) Be more careful in abstractFloats
    See Note [Which type variables to abstract over]
    in GHC.Core.Opt.Simplify.Utils.

So (2) stops creating the excessively polymorphic dictionary in
abstractFloats, while (1) stops crashing if some other pass should
nevertheless create a weirdly polymorphic dictionary.

- - - - -
df7bc6b3 by Ying-Ruei Liang (TheKK) at 2022-12-21T14:31:54-05:00
rts: explicitly store return value of ccall checkClosure to prevent type error (#22617)

- - - - -
e193e537 by Simon Peyton Jones at 2022-12-21T14:32:30-05:00
Fix shadowing lacuna in OccurAnal

Issue #22623 demonstrated another lacuna in the implementation
of wrinkle (BS3) in Note [The binder-swap substitution] in
the occurrence analyser.

I was failing to add TyVar lambda binders using
addInScope/addOneInScope and that led to a totally bogus binder-swap
transformation.

Very easy to fix.

- - - - -
3d55d8ab by Simon Peyton Jones at 2022-12-21T14:32:30-05:00
Fix an assertion check in addToEqualCtList

The old assertion saw that a constraint ct could rewrite itself
(of course it can) and complained (stupid).

Fixes #22645

- - - - -
ceb2e9b9 by Ben Gamari at 2022-12-21T15:26:08-05:00
configure: Bump version to 9.6

- - - - -
fb4d36c4 by Ben Gamari at 2022-12-21T15:27:49-05:00
base: Bump version to 4.18

Requires various submodule bumps.

- - - - -
93ee7e90 by Ben Gamari at 2022-12-21T15:27:49-05:00
ghc-boot: Fix bootstrapping

- - - - -
fc3a2232 by Ben Gamari at 2022-12-22T13:45:06-05:00
Bump GHC version to 9.7

- - - - -
914f7fe3 by Andreas Klebinger at 2022-12-22T23:36:10-05:00
Don't consider large byte arrays/compact regions pinned.

Workaround for #22255 which showed how treating large/compact regions
as pinned could cause segfaults.

- - - - -
32b32d7f by Matthew Pickering at 2022-12-22T23:36:46-05:00
hadrian bindist: Install manpages to share/man/man1/ghc.1

When the installation makefile was copied over the manpages were no
longer installed in the correct place. Now we install it into share/man/man1/ghc.1
as the make build system did.

Fixes #22371

- - - - -
b3ddf803 by Ben Gamari at 2022-12-22T23:37:23-05:00
rts: Drop paths from configure from cabal file

A long time ago we would rely on substitutions from the configure script
to inject paths of the include and library directories of libffi and
libdw. However, now these are instead handled inside Hadrian when
calling Cabal's `configure` (see the uses of `cabalExtraDirs` in
Hadrian's `Settings.Packages.packageArgs`).

While the occurrences in the cabal file were redundant, they did no
harm. However, since b5c714545abc5f75a1ffdcc39b4bfdc7cd5e64b4 they have
no longer been interpolated. @mpickering noticed the suspicious
uninterpolated occurrence of `@FFIIncludeDir@` in #22595,
prompting this commit to finally remove them.

- - - - -
b2c7523d by Ben Gamari at 2022-12-22T23:37:59-05:00
Bump libffi-tarballs submodule

We will now use libffi-3.4.4.

- - - - -
3699a554 by Alan Zimmerman at 2022-12-22T23:38:35-05:00
EPA: Make EOF position part of AnnsModule

Closes #20951
Closes #19697

- - - - -
99757ce8 by Sylvain Henry at 2022-12-22T23:39:13-05:00
JS: fix support for -outputdir (#22641)

The `-outputdir` option wasn't correctly handled with the JS backend
because the same code path was used to handle both objects produced by
the JS backend and foreign .js files. Now we clearly distinguish the
two in the pipeline, fixing the bug.

- - - - -
02ed7d78 by Simon Peyton Jones at 2022-12-22T23:39:49-05:00
Refactor mkRuntimeError

This patch fixes #22634.  Because we don't have TYPE/CONSTRAINT
polymorphism, we need two error functions rather than one.

I took the opportunity to rname runtimeError to impossibleError,
to line up with mkImpossibleExpr, and avoid confusion with the
genuine runtime-error-constructing functions.

- - - - -
35267f07 by Ben Gamari at 2022-12-22T23:40:32-05:00
base: Fix event manager shutdown race on non-Linux platforms

During shutdown it's possible that we will attempt to use a closed fd
to wakeup another capability's event manager. On the Linux eventfd path
we were careful to handle this. However on the non-Linux path we failed
to do so. Fix this.

- - - - -
317f45c1 by Simon Peyton Jones at 2022-12-22T23:41:07-05:00
Fix unifier bug: failing to decompose over-saturated type family

This simple patch fixes #22647

- - - - -
14b2e3d3 by Ben Gamari at 2022-12-22T23:41:42-05:00
rts/m32: Fix sanity checking

Previously we would attempt to clear pages which were marked as
read-only. Fix this.

- - - - -
16a1bcd1 by Matthew Pickering at 2022-12-23T09:15:24+00:00
ci: Move wasm pipelines into nightly rather than master

See #22664 for the changes which need to be made to bring one of these
back to the validate pipeline.

- - - - -
18d2acd2 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Fix race in marking of blackholes

We must use an acquire-fence when marking to ensure that the indirectee
is visible.

- - - - -
11241efa by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Fix segment list races

- - - - -
602455c9 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Use atomic when looking at bd->gen

Since it may have been mutated by a moving GC.

- - - - -
9d63b160 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Eliminate race in bump_static_flag

To ensure that we don't race with a mutator entering a new CAF we take
the SM mutex before touching static_flag. The other option here would be
to instead modify newCAF to use a CAS but the present approach is a bit
safer.

- - - - -
26837523 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Ensure that mutable fields have acquire barrier

- - - - -
8093264a by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Fix races in collector status tracking

Mark a number of accesses to do with tracking of the status of the
concurrent collection thread as atomic. No interesting races here,
merely necessary to satisfy TSAN.

- - - - -
387d4fcc by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Make segment state updates atomic

- - - - -
543cae00 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Refactor update remembered set initialization

This avoids a lock inversion between the storage manager mutex and
the stable pointer table mutex by not dropping the SM_MUTEX in
nonmovingCollect. This requires quite a bit of rejiggering but it
does seem like a better strategy.

- - - - -
c9936718 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Ensure that we aren't holding locks when closing them

TSAN complains about this sort of thing.

- - - - -
0cd31f7d by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Make bitmap accesses atomic

This is a benign race on any sensible hard since these are byte
accesses. Nevertheless, atomic accesses are necessary to satisfy
TSAN.

- - - - -
d3fe110a by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Fix benign race in update remembered set check

Relaxed load is fine here since we will take the lock before looking at
the list.

- - - - -
ab6cf893 by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Fix race in shortcutting

We must use an acquire load to read the info table pointer since if we
find an indirection we must be certain that we see the indirectee.

- - - - -
36c9f23c by Ben Gamari at 2022-12-23T19:09:30-05:00
nonmoving: Make free list counter accesses atomic

Since these may race with the allocator(s).

- - - - -
aebef31c by doyougnu at 2022-12-23T19:10:09-05:00
add GHC.Utils.Binary.foldGet' and use for Iface

A minor optimization to remove lazy IO and a lazy accumulator

strictify foldGet'

IFace.Binary: use strict foldGet'

remove superfluous bang

- - - - -
5eb357d9 by Ben Gamari at 2022-12-24T00:41:05-05:00
compiler: Ensure that GHC toolchain is first in search path

As noted in #22561, it is important that GHC's toolchain look
first for its own headers and libraries to ensure that the
system's are not found instead. If this happens things can
break in surprising ways (e.g. see #22561).

- - - - -
cbaebfb9 by Matthew Pickering at 2022-12-24T00:41:40-05:00
head.hackage: Use slow-validate bindist for linting jobs

This enables the SLOW_VALIDATE env var for the linting head.hackage
jobs, namely the jobs enabled manually, by the label or on the nightly
build now use the deb10-numa-slow-validate bindist which has assertions
enabled.

See #22623 for a ticket which was found by using this configuration
already!

The head.hackage jobs triggered by upstream CI are now thusly:

hackage-lint: Can be triggered on any MR, normal validate pipeline or nightly build.
              Runs head.hackage with -dlint and a slow-validate bindist

hackage-label-lint: Trigged on MRs with "user-facing" label, runs the slow-validate
                    head.hackage build with -dlint.

nightly-hackage-lint: Runs automatically on nightly pipelines with slow-validate + dlint config.

nightly-hackage-perf: Runs automaticaly on nightly pipelines with release build and eventlogging enabled.

release-hackage-lint: Runs automatically on release pipelines with -dlint on a release bindist.

- - - - -
f4850f36 by Matthew Pickering at 2022-12-24T00:41:40-05:00
ci: Don't run abi-test-nightly on release jobs

The test is not configured to get the correct dependencies for the
release pipelines (and indeed stops the release pipeline being run at
all)

- - - - -
c264b06b by Matthew Pickering at 2022-12-24T00:41:40-05:00
ci: Run head.hackage jobs on upstream-testing branch rather than master

This change allows less priviledged users to trigger head.hackage jobs
because less permissions are needed to trigger jobs on the
upstream-testing branch, which is not protected.

There is a CI job which updates upstream-testing each hour to the state
of the master branch so it should always be relatively up-to-date.

- - - - -
63b97430 by Ben Gamari at 2022-12-24T00:42:16-05:00
llvmGen: Fix relaxed ordering

Previously I used LLVM's `unordered` ordering for the C11 `relaxed`
ordering. However, this is wrong and should rather use the LLVM
`monotonic` ordering.

Fixes #22640
- - - - -
f42ba88f by Ben Gamari at 2022-12-24T00:42:16-05:00
gitlab-ci: Introduce aarch64-linux-llvm job

This nightly job will ensure that we don't break the LLVM backend on
AArch64/Linux by bootstrapping GHC.

This would have caught #22640.

- - - - -
6d62f6bf by Matthew Pickering at 2022-12-24T00:42:51-05:00
Store RdrName rather than OccName in Holes

In #20472 it was pointed out that you couldn't defer out of scope but
the implementation collapsed a RdrName into an OccName to stuff it into
a Hole. This leads to the error message for a deferred qualified name
dropping the qualification which affects the quality of the error
message.

This commit adds a bit more structure to a hole, so a hole can replace a
RdrName without losing information about what that RdrName was. This is
important when printing error messages.

I also added a test which checks the Template Haskell deferral of out of
scope qualified names works properly.

Fixes #22130

- - - - -
3c3060e4 by Richard Eisenberg at 2022-12-24T17:34:19+00:00
Drop support for kind constraints.

This implements proposal 547 and closes ticket #22298.
See the proposal and ticket for motivation.

Compiler perf improves a bit

Metrics: compile_time/bytes allocated
-------------------------------------
  CoOpt_Singletons(normal)   -2.4% GOOD
            T12545(normal)   +1.0%
            T13035(normal)  -13.5% GOOD
            T18478(normal)   +0.9%
            T9872d(normal)   -2.2% GOOD

                 geo. mean   -0.2%
                 minimum    -13.5%
                 maximum     +1.0%

Metric Decrease:
    CoOpt_Singletons
    T13035
    T9872d

- - - - -
6d7d4393 by Ben Gamari at 2022-12-24T21:09:56-05:00
hadrian: Ensure that linker scripts are used when merging objects

In #22527 @rui314 inadvertantly pointed out a glaring bug in Hadrian's
implementation of the object merging rules: unlike the old `make` build
system we utterly failed to pass the needed linker scripts. Fix this.

- - - - -
a5bd0eb8 by Bodigrim at 2022-12-24T21:10:34-05:00
Document infelicities of instance Ord Double and workarounds

- - - - -
62b9a7b2 by Zubin Duggal at 2023-01-03T12:22:11+00:00
Force the Docs structure to prevent leaks in GHCi with -haddock without -fwrite-interface

Involves adding many new NFData instances.

Without forcing Docs, references to the TcGblEnv for each module are retained
by the Docs structure. Usually these are forced when the ModIface is serialised
but not when we aren't writing the interface.

- - - - -
21bedd84 by Facundo Domínguez at 2023-01-03T23:27:30-05:00
Explain the auxiliary functions of permutations

- - - - -
32255d05 by Matthew Pickering at 2023-01-04T11:58:42+00:00
compiler: Add -f[no-]split-sections flags

Here we add a `-fsplit-sections` flag which may some day replace
`-split-sections`. This has the advantage of automatically providing a
`-fno-split-sections` flag, which is useful for our packaging because we
enable `-split-sections` by default but want to disable it in certain
configurations.

- - - - -
e640940c by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Fix computation of tables_next_to_code for outOfTreeCompiler

This copy-pasto was introduced in de5fb3489f2a9bd6dc75d0cb8925a27fe9b9084b

- - - - -
15bee123 by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Add test:all_deps to build just testsuite dependencies

Fixes #22534

- - - - -
fec6638e by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Add no_split_sections tranformer

This transformer reverts the effect of `split_sections`, which we intend
to use for platforms which don't support split sections.

In order to achieve this we have to modify the implemntation of the
split_sections transformer to store whether we are enabling
split_sections directly in the `Flavour` definition. This is because
otherwise there's no convenient way to turn off split_sections due to
having to pass additional linker scripts when merging objects.

- - - - -
3dc05726 by Matthew Pickering at 2023-01-04T11:58:42+00:00
check-exact: Fix build with -Werror

- - - - -
53a6ae7a by Matthew Pickering at 2023-01-04T11:58:42+00:00
ci: Build all test dependencies with in-tree compiler

This means that these executables will honour flavour transformers such
as "werror".

Fixes #22555

- - - - -
32e264c1 by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Document using GHC environment variable to select boot compiler

Fixes #22340

- - - - -
be9dd9b0 by Matthew Pickering at 2023-01-04T11:58:42+00:00
packaging: Build perf builds with -split-sections

In 8f71d958 the make build system was made to use split-sections on
linux systems but it appears this logic never made it to hadrian.
There is the split_sections flavour transformer but this doesn't appear
to be used for perf builds on linux.

This is disbled on deb9 and windows due to #21670

Closes #21135

- - - - -
00dc5106 by Matthew Pickering at 2023-01-04T14:32:45-05:00
sphinx: Use modern syntax for extlinks

This fixes the following build error:

```
  Command line: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build -b man -d /private/tmp/extra-dir-55768274273/.doctrees-man -n -w /private/tmp/extra-dir-55768274273/.log docs/users_guide /private/tmp/extra-dir-55768274273
  ===> Command failed with error code: 2

  Exception occurred:
    File "/opt/homebrew/Cellar/sphinx-doc/6.0.0/libexec/lib/python3.11/site-packages/sphinx/ext/extlinks.py", line 101, in role
      title = caption % part
              ~~~~~~~~^~~~~~
  TypeError: not all arguments converted during string formatting
```

I tested on Sphinx-5.1.1 and Sphinx-6.0.0

Thanks for sterni for providing instructions about how to test using
sphinx-6.0.0.

Fixes #22690

- - - - -
541aedcd by Krzysztof Gogolewski at 2023-01-05T10:48:34-05:00
Misc cleanup

- Remove unused uniques and hs-boot declarations
- Fix types of seq and unsafeCoerce#
- Remove FastString/String roundtrip in JS
- Use TTG to enforce totality
- Remove enumeration in Heap/Inspect; the 'otherwise' clause
  serves the primitive types well.

- - - - -
22bb8998 by Alan Zimmerman at 2023-01-05T10:49:09-05:00
EPA: Do not collect comments from end of file

In Parser.y semis1 production triggers for the virtual semi at the end
of the file. This is detected by it being zero length.

In this case, do not extend the span being used to gather comments, so
any final comments are allocated at the module level instead.

- - - - -
9e077999 by Vladislav Zavialov at 2023-01-05T23:01:55-05:00
HsToken in TypeArg (#19623)

Updates the haddock submodule.

- - - - -
b2a2db04 by Matthew Pickering at 2023-01-05T23:02:30-05:00
Revert "configure: Drop uses of AC_PROG_CC_C99"

This reverts commit 7c6de18dd3151ead954c210336728e8686c91de6.

Centos7 using a very old version of the toolchain (autotools-2.69) where
the behaviour of these macros has not yet changed. I am reverting this
without haste as it is blocking the 9.6 branch.

Fixes #22704

- - - - -
28f8c0eb by Luite Stegeman at 2023-01-06T18:16:24+09:00
Add support for sized literals in the bytecode interpreter.

The bytecode interpreter only has branching instructions for
word-sized values. These are used for pattern matching.
Branching instructions for other types (e.g. Int16# or Word8#)
weren't needed, since unoptimized Core or STG never requires
branching on types like this.

It's now possible for optimized STG to reach the bytecode
generator (e.g. fat interface files or certain compiler flag
combinations), which requires dealing with various sized
literals in branches.

This patch improves support for generating bytecode from
optimized STG by adding the following new bytecode
instructions:

    TESTLT_I64
    TESTEQ_I64
    TESTLT_I32
    TESTEQ_I32
    TESTLT_I16
    TESTEQ_I16
    TESTLT_I8
    TESTEQ_I8
    TESTLT_W64
    TESTEQ_W64
    TESTLT_W32
    TESTEQ_W32
    TESTLT_W16
    TESTEQ_W16
    TESTLT_W8
    TESTEQ_W8

Fixes #21945

- - - - -
ac39e8e9 by Matthew Pickering at 2023-01-06T13:47:00-05:00
Only store Name in FunRhs rather than Id with knot-tied fields

All the issues here have been caused by #18758.
The goal of the ticket is to be able to talk about things like
`LTyClDecl GhcTc`. In the case of HsMatchContext,
the correct "context" is whatever we want, and in fact storing just a
`Name` is sufficient and correct context, even if the rest of the AST is
storing typechecker Ids.

So this reverts (#20415, !5579) which intended to get closed to #18758 but
didn't really and introduced a few subtle bugs.

Printing of an error message in #22695 would just hang, because we would
attempt to print the `Id` in debug mode to assertain whether it was
empty or not. Printing the Name is fine for the error message.

Another consequence is that when `-dppr-debug` was enabled the compiler would
hang because the debug printing of the Id would try and print fields
which were not populated yet.

This also led to 32070e6c2e1b4b7c32530a9566fe14543791f9a6 having to add
a workaround for the `checkArgs` function which was probably a very
similar bug to #22695.

Fixes #22695

- - - - -
c306d939 by Matthew Pickering at 2023-01-06T22:08:53-05:00
ci: Upgrade darwin, windows and freebsd CI to use GHC-9.4.3

Fixes #22599

- - - - -
0db496ff by Matthew Pickering at 2023-01-06T22:08:53-05:00
darwin ci: Explicitly pass desired build triple to configure

On the zw3rk machines for some reason the build machine was inferred to
be arm64. Setting the build triple appropiately resolve this confusion
and we produce x86 binaries.

- - - - -
2459c358 by Ben Gamari at 2023-01-06T22:09:29-05:00
rts: MUT_VAR is not a StgMutArrPtrs

There was previously a comment claiming that the MUT_VAR closure type
had the layout of StgMutArrPtrs.
- - - - -
6206cb92 by Simon Peyton Jones at 2023-01-07T12:14:40-05:00
Make FloatIn robust to shadowing

This MR fixes #22622. See the new
  Note [Shadowing and name capture]

I did a bit of refactoring in sepBindsByDropPoint too.

The bug doesn't manifest in HEAD, but it did show up in 9.4,
so we should backport this patch to 9.4

- - - - -
a960ca81 by Matthew Pickering at 2023-01-07T12:15:15-05:00
T10955: Set DYLD_LIBRARY_PATH for darwin

The correct path to direct the dynamic linker on darwin is
DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH. On recent versions of OSX
using LD_LIBRARY_PATH seems to have stopped working.

For more reading see:

https://stackoverflow.com/questions/3146274/is-it-ok-to-use-dyld-library-path-on-mac-os-x-and-whats-the-dynamic-library-s

- - - - -
73484710 by Matthew Pickering at 2023-01-07T12:15:15-05:00
Skip T18623 on darwin (to add to the long list of OSs)

On recent versions of OSX, running `ulimit -v` results in

```
ulimit: setrlimit failed: invalid argument
```

Time is too short to work out what random stuff Apple has been doing
with ulimit, so just skip the test like we do for other platforms.

- - - - -
8c0ea25f by Matthew Pickering at 2023-01-07T12:15:15-05:00
Pass -Wl,-no_fixup_chains to ld64 when appropiate

Recent versions of MacOS use a version of ld where `-fixup_chains` is on by default.
This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we
explicitly disable `fixup-chains` by passing `-no_fixup_chains` to the linker on
darwin. This results in a warning of the form:

ld: warning: -undefined dynamic_lookup may not work with chained fixups

The manual explains the incompatible nature of these two flags:

     -undefined treatment
             Specifies how undefined symbols are to be treated. Options are: error, warning,
             suppress, or dynamic_lookup.  The default is error. Note: dynamic_lookup that
             depends on lazy binding will not work with chained fixups.

A relevant ticket is #22429

Here are also a few other links which are relevant to the issue:

Official comment: https://developer.apple.com/forums/thread/719961

More relevant links:

https://openradar.appspot.com/radar?id=5536824084660224

https://github.com/python/cpython/issues/97524

Note in release notes: https://developer.apple.com/documentation/xcode-release-notes/xcode-13-releas    e-notes

- - - - -
365b3045 by Matthew Pickering at 2023-01-09T02:36:20-05:00
Disable split sections on aarch64-deb10 build

See #22722

Failure on this job:

https://gitlab.haskell.org/ghc/ghc/-/jobs/1287852

```
Unexpected failures:
   /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test   spaces/testsuite/tests/th/T10828.run  T10828 [exit code non-0] (ext-interp)
   /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test   spaces/testsuite/tests/th/T13123.run  T13123 [exit code non-0] (ext-interp)
   /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test   spaces/testsuite/tests/th/T20590.run  T20590 [exit code non-0] (ext-interp)
Appending 232 stats to file: /builds/ghc/ghc/performance-metrics.tsv
```

```
Compile failed (exit code 1) errors were:
data family D_0 a_1 :: * -> *
data instance D_0 GHC.Types.Int GHC.Types.Bool :: * where
    DInt_2 :: D_0 GHC.Types.Int GHC.Types.Bool
data E_3 where MkE_4 :: a_5 -> E_3
data Foo_6 a_7 b_8 where
    MkFoo_9, MkFoo'_10 :: a_11 -> Foo_6 a_11 b_12
newtype Bar_13 :: * -> GHC.Types.Bool -> * where
    MkBar_14 :: a_15 -> Bar_13 a_15 b_16
data T10828.T (a_0 :: *) where
    T10828.MkT :: forall (a_1 :: *) . a_1 -> a_1 -> T10828.T a_1
    T10828.MkC :: forall (a_2 :: *) (b_3 :: *) . (GHC.Types.~) a_2
                                                               GHC.Types.Int => {T10828.foo :: a_2,
                                                                                 T10828.bar :: b_3} -> T10828.T GHC.Types.Int
T10828.hs:1:1: error: [GHC-87897]
    Exception when trying to run compile-time code:
      ghc-iserv terminated (-4)
    Code: (do TyConI dec <- runQ $ reify (mkName "T")
              runIO $ putStrLn (pprint dec) >> hFlush stdout
              d <- runQ
                     $ [d| data T' a :: Type
                             where
                               MkT' :: a -> a -> T' a
                               MkC' :: forall a b. (a ~ Int) => {foo :: a, bar :: b} -> T' Int |]
              runIO $ putStrLn (pprint d) >> hFlush stdout
              ....)
*** unexpected failure for T10828(ext-interp)
=====> 7000 of 9215 [0, 1, 0]
=====> 7000 of 9215 [0, 1, 0]
=====> 7000 of 9215 [0, 1, 0]
=====> 7000 of 9215 [0, 1, 0]
Compile failed (exit code 1) errors were:
T13123.hs:1:1: error: [GHC-87897]
    Exception when trying to run compile-time code:
      ghc-iserv terminated (-4)
    Code: ([d| data GADT
                 where MkGADT :: forall k proxy (a :: k). proxy a -> GADT |])
*** unexpected failure for T13123(ext-interp)
=====> 7100 of 9215 [0, 2, 0]
=====> 7100 of 9215 [0, 2, 0]
=====> 7200 of 9215 [0, 2, 0]
Compile failed (exit code 1) errors were:
T20590.hs:1:1: error: [GHC-87897]
    Exception when trying to run compile-time code:
      ghc-iserv terminated (-4)
    Code: ([d| data T where MkT :: forall a. a -> T |])
*** unexpected failure for T20590(ext-interp)
```

Looks fairly worrying to me.

- - - - -
965a2735 by Alan Zimmerman at 2023-01-09T02:36:20-05:00
EPA: exact print HsDocTy

To match ghc-exactprint
https://github.com/alanz/ghc-exactprint/pull/121

- - - - -
63f968e9 by Sylvain Henry at 2023-01-09T10:01:46-05:00
WIP: fix req_smp (target vs ghc)

- - - - -
56c188de by doyougnu at 2023-01-09T10:02:24-05:00
add flag to separate bootstrapper

- - - - -
30447f90 by doyougnu at 2023-01-09T10:02:25-05:00
split req_smp -> req_target_smp and req_ghc_smp

- - - - -
f282d210 by doyougnu at 2023-01-09T10:02:26-05:00
update tests smp flags

- - - - -
f9c96d10 by doyougnu at 2023-01-09T10:02:26-05:00
cleanup and add some docstrings

- - - - -
815146c5 by doyougnu at 2023-01-09T10:03:00-05:00
only set ghc_with_smp to bootstrapper on S1 or CC

Only set ghc_with_smp to bootstrapperWithSMP of when testing stage 1
and cross compiling

- - - - -
778b79e9 by doyougnu at 2023-01-09T10:03:56-05:00
test the RTS in config/ghc not hadrian

- - - - -
2939a350 by doyougnu at 2023-01-09T10:03:57-05:00
re-add ghc_with_smp

- - - - -
e1156bf1 by doyougnu at 2023-01-09T10:03:57-05:00
fix and align req names

- - - - -
5c5dc559 by doyougnu at 2023-01-09T10:03:57-05:00
fix T11760 to use req_host_smp

- - - - -
680ca4eb by doyougnu at 2023-01-09T10:03:57-05:00
test the rts directly, avoid python 3.5 limitation

- - - - -
83fbb47a by doyougnu at 2023-01-09T10:36:25-05:00
test the compiler in a try block

- - - - -
7a5db3ff by doyougnu at 2023-01-09T10:36:26-05:00
align out of tree and in tree withSMP flags

- - - - -
5dd0c547 by doyougnu at 2023-01-09T10:36:26-05:00
mark failing tests as host req smp

- - - - -
67a66dbc by doyougnu at 2023-01-09T10:36:26-05:00
testsuite: req_host_smp --> req_ghc_smp

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/toolchain.nix
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/upload_ghc_libs.py
- compiler/CodeGen.Platform.h
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Literals.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/Config.hs
- compiler/GHC/Cmm/ContFlowOpt.hs
- compiler/GHC/Cmm/Dataflow/Block.hs
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Pipeline.hs
- + compiler/GHC/Cmm/ThreadSanitizer.hs
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/84c4bd6c36b7e5a4599c9e371ce06fa96f29d744...67a66dbcbad78abe59fe212f67eb6f8aecc738b5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/84c4bd6c36b7e5a4599c9e371ce06fa96f29d744...67a66dbcbad78abe59fe212f67eb6f8aecc738b5
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/20230109/ae727a1f/attachment-0001.html>


More information about the ghc-commits mailing list