[Git][ghc/ghc][wip/backports-9.6] 27 commits: Bump ghc-tarballs to fix #22497

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Jan 26 03:58:15 UTC 2023



Ben Gamari pushed to branch wip/backports-9.6 at Glasgow Haskell Compiler / GHC


Commits:
408199af by Ben Gamari at 2023-01-25T12:58:18-05:00
Bump ghc-tarballs to fix #22497

It turns out that gmp 6.2.1 uses the platform-reserved `x18` register on
AArch64/Darwin. This was fixed in upstream changeset 18164:5f32dbc41afc,
which was merged in 2020. Here I backport this patch although I do hope
that a new release is forthcoming soon.

Bumps gmp-tarballs submodule.

Fixes #22497.

(cherry picked from commit b1089ee68b53ba737a301a2e8e21e27b79143f03)

- - - - -
36e000d0 by Ben Gamari at 2023-01-25T12:58:20-05:00
Bump gmp-tarballs submodule

This backports the upstream fix for CVE-2021-43618, fixing #22789.

(cherry picked from commit b13c6ea5d4b64841164f8cc58d6c6f3de390f2ed)

- - - - -
ef2f39d2 by Cheng Shao at 2023-01-25T12:58:20-05:00
compiler: fix handling of MO_F_Neg in wasm NCG

In the wasm NCG, we used to compile MO_F_Neg to 0.0-x. It was an
oversight, there actually exists f32.neg/f64.neg opcodes in the wasm
spec and those should be used instead! The old behavior almost works,
expect when GHC compiles the -0.0 literal, which will incorrectly
become 0.0.

(cherry picked from commit bc038c3bd45ee99db9fba23a823a906735740200)

- - - - -
79407120 by Matthew Pickering at 2023-01-25T12:58:20-05:00
docs: Update INSTALL.md

Removes references to make.

Fixes #22480

(cherry picked from commit 3097282777a28770f0d597355e33b45d2f11e1d4)

- - - - -
a5f3657c by Ryan Scott at 2023-01-25T12:58:20-05:00
Restore Compose's Read/Show behavior to match Read1/Show1 instances

Fixes #22816.

(cherry picked from commit 1957eda1b25735b143899add93a4cd4f0af3b2ea)

- - - - -
7782d6d6 by Cheng Shao at 2023-01-25T12:58:20-05:00
CmmToC: fix CmmRegOff for 64-bit register on a 32-bit target

We used to print the offset value to a platform word sized integer.
This is incorrect when the offset is negative (e.g. output of cmm
constant folding) and the register is 64-bit but on a 32-bit target,
and may lead to incorrect runtime result (e.g. #22607).

The fix is simple: just treat it as a proper MO_Add, with the correct
width info inferred from the register itself.

Metric Increase:
    T12707
    T13379
    T4801
    T5321FD
    T5321Fun

(cherry picked from commit d151546e59a50158f25c3df6728b00d3c27bb4b9)

- - - - -
f8664027 by Cheng Shao at 2023-01-25T12:58:20-05:00
hadrian: disable alloca for in-tree GMP on wasm32

When building in-tree GMP for wasm32, disable its alloca usage, since
it may potentially cause stack overflow (e.g. #22602).

(cherry picked from commit 0900b58432c0e42263c62b0e151b0268129a290a)

- - - - -
c9d95529 by Matthew Pickering at 2023-01-25T12:58:20-05:00
Fix recompilation checking for multiple home units

The key part of this change is to store a UnitId in the
`UsageHomeModule` and `UsageHomeModuleInterface`.

* Fine-grained dependency tracking is used if the dependency comes from
  any home unit.
* We actually look up the right module when checking whether we need to
  recompile in the `UsageHomeModuleInterface` case.

These scenarios are both checked by the new tests (
multipleHomeUnits_recomp and multipleHomeUnits_recomp_th )

Fixes #22675

(cherry picked from commit c316a99e110c0ecea2d371e6cfe38ea1e51ccb49)

- - - - -
020d0c53 by Matthew Pickering at 2023-01-25T12:58:20-05:00
Augment target filepath by working directory when checking if module satisfies target

This fixes a spurious warning in -Wmissing-home-modules.

This is a simple oversight where when looking for the target in the
first place we augment the search by the -working-directory flag but
then fail to do so when checking this warning.

Fixes #22676

(cherry picked from commit 8a47f4e0c1b8e91edef635e6ba05f65df62a416f)

- - - - -
0d319e67 by Matthew Pickering at 2023-01-25T12:58:20-05:00
Use NodeKey rather than ModuleName in pruneCache

The `pruneCache` function assumes that the list of `CachedInfo` all have unique `ModuleName`, this is not true:

* In normal compilation, the same module name can appear for a file and it's boot file.
* In multiple home unit compilation the same ModuleName can appear in different units

The fix is to use a `NodeKey` as the actual key for the interfaces which includes `ModuleName`, `IsBoot` and `UnitId`.

Fixes #22677

(cherry picked from commit 982e8bbec3e892f6379662017cd97fcd70d98b37)

- - - - -
58c49a29 by Matthew Pickering at 2023-01-25T12:58:20-05:00
Recompilation checking: Don't try to find artefacts for Interactive & hs-boot combo

In interactive mode we don't produce any linkables for hs-boot files. So
we also need to not going looking for them when we check to see if we
have all the right objects needed for recompilation.

Ticket #22669

(cherry picked from commit 95cc0bed637e3cd136d9fe135514037cd0638481)

- - - - -
975036ec by Matthew Pickering at 2023-01-25T12:58:20-05:00
Don't write o-boot files in Interactive mode

We should not be producing object files when in interactive mode but we
still produced the dummy o-boot files. These never made it into a
`Linkable` but then confused the recompilation checker.

Fixes #22669

(cherry picked from commit 5609fd913a110b8316125be707e2c30e9dda47cc)

- - - - -
20ad61da by Matthew Pickering at 2023-01-25T12:58:20-05:00
Improve driver diagnostic messages by including UnitId in message

Currently the driver diagnostics don't give any indication about which unit they correspond to.

For example `-Wmissing-home-modules` can fire multiple times for each different home unit and gives no indication about which unit it's actually reporting about.

Perhaps a longer term fix is to generalise the providence information away from a SrcSpan so that these kind of whole project errors can be reported with an accurate provenance. For now we can just include the `UnitId` in the error message.

Fixes #22678

(cherry picked from commit dccfd125251651681ac03eb42362b0ee5d3da4ce)

- - - - -
03499656 by Matthew Pickering at 2023-01-25T12:58:20-05:00
Key ModSummary cache by UnitId as well as FilePath

Multiple units can refer to the same files without any problem. Just
another assumption which needs to be updated when we may have multiple
home units.

However, there is the invariant that within each unit each file only
maps to one module, so as long as we also key the cache by UnitId then
we are all good.

This led to some confusing behaviour in GHCi when reloading,
multipleHomeUnits_shared distils the essence of what can go wrong.

Fixes #22679

(cherry picked from commit 24cc4ea93215942de1adf83307f7cde9c4856af4)

- - - - -
b2fed4da by Matthew Pickering at 2023-01-25T12:58:20-05:00
Finder: Look in current unit before looking in any home package dependencies

In order to preserve existing behaviour it's important to look within the current component before consideirng a module might come from an external component.

This already happened by accident in `downsweep`, (because roots are used to repopulated the cache) but in the `Finder` the logic was the wrong way around.

Fixes #22680

-------------------------
Metric Decrease:
    MultiComponentModules
    MultiComponentModulesRecomp
-------------------------p

(cherry picked from commit e46e68fee52b46beaf9172f8397a35bad63a417a)

- - - - -
f3eaae93 by Matthew Pickering at 2023-01-25T12:58:20-05:00
Debug: Print full NodeKey when pretty printing ModuleGraphNode

This is helpful when debugging multiple component issues.

(cherry picked from commit a86ff179462b7fc07c3903255856ed05ef149806)

- - - - -
f74793e9 by Ben Gamari at 2023-01-25T12:58:20-05:00
template-haskell: Bump version to 2.20.0.0

Updates `text` and `exceptions` submodules for bounds bumps.

Addresses #22767.

(cherry picked from commit 3efd1e9934d9896e6c816e6cafb41b6872e3015b)

- - - - -
82092091 by Ben Gamari at 2023-01-25T12:58:20-05:00
gitlab-ci: Add Rocky8 jobs

Addresses #22268.

(cherry picked from commit 658f4446964c01e804ed5cff59fa3ceac3f9619d)

- - - - -
786cdc4c by Bodigrim at 2023-01-25T12:58:20-05:00
ghc package does not have to depend on terminfo

(cherry picked from commit 32ab07bf3d6ce45e8ea5b55e8095174a6b42a7f0)

- - - - -
5190aaf4 by Bodigrim at 2023-01-25T12:58:20-05:00
ghc-pkg does not have to depend on terminfo

(cherry picked from commit 981ff7c4d0e0dd1f4cf721ceb3e99128e442f9fc)

- - - - -
71afb8a8 by Luite Stegeman at 2023-01-25T12:58:21-05: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

(cherry picked from commit 28f8c0ebbfe623784988745af75dcf3fdbdd3ca5)

- - - - -
43ed0d72 by Luite Stegeman at 2023-01-25T12:58:21-05:00
Add PrimCallConv support to GHCi

This adds support for calling Cmm code from bytecode using the native
calling convention, allowing modules that use `foreign import prim`
to be loaded and debugged in GHCi.

This patch introduces a new `PRIMCALL` bytecode instruction and
a helper stack frame `stg_primcall`. The code is based on the
existing functionality for dealing with unboxed tuples in bytecode,
which has been generalised to handle arbitrary calls.

Fixes #22051

(cherry picked from commit b4c14c4ba17b3abf3e7b88e1201ac7ba89fd56c9)

- - - - -
6ce27384 by Cheng Shao at 2023-01-25T12:58:21-05:00
Fix typo in recent darwin tests fix

Corrects a typo in !9647. Otherwise T18623 will still fail on darwin
and stall other people's work.

(cherry picked from commit c45a5fffef2c76efbf5d3a009c3f6d0244a63f0d)

- - - - -
501f2e29 by Ryan Scott at 2023-01-25T12:58:21-05:00
Add missing parenthesizeHsType in cvtSigTypeKind

We need to ensure that the output of `cvtSigTypeKind` is parenthesized (at
precedence `sigPrec`) so that any type signatures with an outermost, explicit
kind signature can parse correctly.

Fixes #22784.

(cherry picked from commit 4efee43db5090aac4dde1293357bdb548ae71c24)

- - - - -
a145efb1 by Oleg Grenrus at 2023-01-25T12:58:21-05:00
Fix #22728: Not all diagnostics in safe check are fatal

Also add tests for the issue and -Winferred-safe-imports in general

(cherry picked from commit 1b812b6973a25cb1962e2fc543d2c4ed3cf31f3c)

- - - - -
adeef3a3 by Matthew Pickering at 2023-01-25T12:58:21-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

(cherry picked from commit ac39e8e97fbb69e4a786c1c29d6e477e7944f998)

- - - - -
cd8dd55a by Richard Eisenberg at 2023-01-25T12:58:21-05:00
Refactor the treatment of loopy superclass dicts

This patch completely re-engineers how we deal with loopy superclass
dictionaries in instance declarations. It fixes #20666 and #19690

The highlights are

* Recognise that the loopy-superclass business should use precisely
  the Paterson conditions.  This is much much nicer.  See
  Note [Recursive superclasses] in GHC.Tc.TyCl.Instance

* With that in mind, define "Paterson-smaller" in
  Note [Paterson conditions] in GHC.Tc.Validity, and the new
  data type `PatersonSize` in GHC.Tc.Utils.TcType, along with
  functions to compute and compare PatsonSizes

* Use the new PatersonSize stuff when solving superclass constraints
  See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance

* In GHC.Tc.Solver.Monad.lookupInInerts, add a missing call to
  prohibitedSuperClassSolve.  This was the original cause of #20666.

* Treat (TypeError "stuff") as having PatersonSize zero. See
  Note [Paterson size for type family applications] in GHC.Tc.Utils.TcType.

* Treat the head of a Wanted quantified constraint in the same way
  as the superclass of an instance decl; this is what fixes #19690.
  See GHC.Tc.Solver.Canonical Note [Solving a Wanted forall-constraint]
  (Thanks to Matthew Craven for this insight.)

  This entailed refactoring the GivenSc constructor of CtOrigin a bit,
  to say whether it comes from an instance decl or quantified constraint.

* Some refactoring way in which redundant constraints are reported; we
  don't want to complain about the extra, apparently-redundant
  constraints that we must add to an instance decl because of the
  loopy-superclass thing.  I moved some work from GHC.Tc.Errors to
  GHC.Tc.Solver.

* Add a new section to the user manual to describe the loopy
  superclass issue and what rules it follows.

(cherry picked from commit aed1974e92366ab8e117734f308505684f70cddf)

- - - - -


30 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- INSTALL.md
- cabal.project-reinstall
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/CallConv.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Reg.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Errors/Types.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Foreign.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b9b834d688c24e3c0529ccbc2d07e6a10ab0db80...cd8dd55a03d24539300f1300c8c8ceecb1b5404a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b9b834d688c24e3c0529ccbc2d07e6a10ab0db80...cd8dd55a03d24539300f1300c8c8ceecb1b5404a
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/20230125/9c4fd6dc/attachment-0001.html>


More information about the ghc-commits mailing list