[Git][ghc/ghc][wip/mp-backports-9.6] 30 commits: EPA: Add SourceText to HsOverLabel

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Feb 1 13:31:43 UTC 2023



Matthew Pickering pushed to branch wip/mp-backports-9.6 at Glasgow Haskell Compiler / GHC


Commits:
686350e9 by Alan Zimmerman at 2023-02-01T13:18:46+00:00
EPA: Add SourceText to HsOverLabel

To be able to capture string literals with possible escape codes as labels.

Close #22771

(cherry picked from commit fec7c2ea8242773b53b253d9536426f743443944)

- - - - -
9cdab037 by Ben Gamari at 2023-02-01T13:18:46+00:00
rts: Use C11-compliant static assertion syntax

Previously we used `static_assert` which is only available in C23. By
contrast, C11 only provides `_Static_assert`.

Fixes #22777

(cherry picked from commit e480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd)

- - - - -
be39064e by Ben Gamari at 2023-02-01T13:18:46+00:00
Revert "CApiFFI: add ConstPtr for encoding const-qualified pointer return types (#22043)"

This reverts commit 99aca26b652603bc62953157a48e419f737d352d.

(cherry picked from commit 56c1bd986ac13e3a1fe1149f011480e44f857f5a)

- - - - -
80a6bb73 by nineonine at 2023-02-01T13:18:46+00:00
CApiFFI: add ConstPtr for encoding const-qualified pointer return types

Previously, when using `capi` calling convention in foreign declarations,
code generator failed to handle const-cualified pointer return types.
This resulted in CC toolchain throwing `-Wincompatible-pointer-types-discards-qualifiers`
warning.

`Foreign.C.Types.ConstPtr` newtype was introduced to handle these cases -
special treatment was put in place to generate appropritetly qualified C
wrapper that no longer triggers the above mentioned warning.

Fixes #22043.

(cherry picked from commit b3a3534b6f75b34dc4db76e904e071485da6d5cc)

- - - - -
3c21d69d by Ben Gamari at 2023-02-01T13:18:46+00:00
nativeGen/AArch64: Fix debugging output

Previously various panics would rely on a half-written Show
instance, leading to very unhelpful errors. Fix this.

See #22798.

(cherry picked from commit be417a47c7695998dea0adc05489a7b8838a78b6)

- - - - -
ac6c24f7 by Ben Gamari at 2023-02-01T13:18:46+00:00
nativeGen: Teach graph-colouring allocator that x18 is unusable

Previously trivColourable for AArch64 claimed that at 18 registers were
trivially-colourable. This is incorrect as x18 is reserved by the platform on
AArch64/Darwin.

See #22798.

(cherry picked from commit 30989d137b8f3a8fddbfd116e04b48f23c24f86c)

- - - - -
6c212ccc by Ben Gamari at 2023-02-01T13:18:46+00:00
nativeGen/AArch64: Fix graph-colouring allocator

Previously various `Instr` queries used by the graph-colouring allocator
failed to handle a few pseudo-instructions. This manifested in compiler
panicks while compiling `SHA`, which uses `-fregs-graph`.

Fixes #22798.

(cherry picked from commit 7566fd9de38c67360c090f828923d41587af519c)

- - - - -
79241b6d by Ben Gamari at 2023-02-01T13:18:46+00:00
testsuite: Add regression test for #22798

(cherry picked from commit 2cb500a5ee1a31dfe1a2cdd71f175442026eb082)

- - - - -
d9e8c39d by Simon Peyton Jones at 2023-02-01T13:18:46+00:00
Detect family instance orphans correctly

We were treating a type-family instance as a non-orphan if there
was a type constructor on its /right-hand side/ that was local. Boo!
Utterly wrong. With this patch, we correctly check the /left-hand side/
instead!

Fixes #22717

(cherry picked from commit 638277ba7bd2683f539afb0bf469fe75376994e2)

- - - - -
86dc9a79 by Zubin Duggal at 2023-02-01T13:18:46+00:00
bindist configure: Fail if find not found (#22691)

(cherry picked from commit c9967d137cff83c7688e26f87a8b5e196a75ec93)

- - - - -
86d88743 by Oleg Grenrus at 2023-02-01T13:18:47+00:00
Add Foldable1 Solo instance

(cherry picked from commit 082b7d43ee4b8203dc9bca53e5e1f7a45c42eeb8)

- - - - -
2eb49ea6 by Krzysztof Gogolewski at 2023-02-01T13:18:47+00:00
Support "unusable UNPACK pragma" warning with -O0

Fixes #11270

(cherry picked from commit f83374f8649e5d8413e7ed585b0e058690c38563)

- - - - -
632937bb by Ryan Scott at 2023-02-01T13:18:47+00:00
Handle `type data` properly in tyThingParent_maybe

Unlike most other data constructors, data constructors declared with `type data`
are represented in `TyThing`s as `ATyCon` rather than `ADataCon`. The `ATyCon`
case in `tyThingParent_maybe` previously did not consider the possibility of
the underlying `TyCon` being a promoted data constructor, which led to the
oddities observed in #22817. This patch adds a dedicated special case in
`tyThingParent_maybe`'s `ATyCon` case for `type data` data constructors to fix
these oddities.

Fixes #22817.

(cherry picked from commit 20598ef6d9e26e2e0af9ac42a42e7be00d7cc4f3)

- - - - -
2efb886c by Ryan Scott at 2023-02-01T13:18:47+00:00
Fix two bugs in TypeData TH reification

This patch fixes two issues in the way that `type data` declarations were
reified with Template Haskell:

* `type data` data constructors are now properly reified using `DataConI`.
  This is accomplished with a special case in `reifyTyCon`. Fixes #22818.

* `type data` type constructors are now reified in `reifyTyCon` using
  `TypeDataD` instead of `DataD`. Fixes #22819.

(cherry picked from commit 2f1450521b816a7d287b72deba14d59b6ccfbdbf)

- - - - -
fc117e3d by Ben Gamari at 2023-02-01T13:18:47+00:00
configure: Always create the VERSION file

Teach the `configure` script to create the `VERSION` file.
This will serve as the stable interface to allow the user to determine
the version number of a working tree.

Fixes #22322.

(cherry picked from commit a2d814dc84dbdcdb6c1e274b8bd7c212cc98c39e)

- - - - -
6e1498fa by Ben Gamari at 2023-02-01T13:18:47+00:00
hadrian: Sphinx docs require templated cabal files

The package-version discovery logic in
`doc/users_guide/package_versions.py` uses packages' cabal files to
determine package versions. Teach Sphinx about these dependencies in
cases where the cabal files are generated by templates.

(cherry picked from commit f838815c365773a8107bf035a8ec27b8ff6ecc8b)

- - - - -
1f42664c by Ben Gamari at 2023-02-01T13:18:47+00:00
hadrian: Refactor templating logic

This refactors Hadrian's autoconf-style templating logic to be explicit
about which interpolation variables should be substituted in which
files. This clears the way to fix #22714 without incurring rule cycles.

(cherry picked from commit 2e48c19a7faf975318e954faea26f37deb763ac0)

- - - - -
653c7513 by Ben Gamari at 2023-02-01T13:18:47+00:00
hadrian: Substitute LIBRARY_*_VERSION variables

This teaches Hadrian to substitute the `LIBRARY_*_VERSION` variables
in `libraries/prologue.txt`, fixing #22714.

Fixes #22714.

(cherry picked from commit 93f0e3c49cea484bd6e838892ff8702ec51f34c3)

- - - - -
3ac79844 by Simon Peyton Jones at 2023-02-01T13:18:47+00:00
Take account of loop breakers in specLookupRule

The key change is that in GHC.Core.Opt.Specialise.specLookupRule
we were using realIdUnfolding, which ignores the loop-breaker
flag.  When given a loop breaker, rule matching therefore
looped infinitely -- #22802.

In fixing this I refactored a bit.

* Define GHC.Core.InScopeEnv as a data type, and use it.
  (Previously it was a pair: hard to grep for.)

* Put several functions returning an IdUnfoldingFun into
  GHC.Types.Id, namely
     idUnfolding
     alwaysActiveUnfoldingFun,
     whenActiveUnfoldingFun,
     noUnfoldingFun
  and use them.  (The are all loop-breaker aware.)

(cherry picked from commit d0f34f25ceaae9ef0a21f15f811469d0bed9da69)

- - - - -
fb186399 by Bodigrim at 2023-02-01T13:18:47+00:00
Document differences between Data.{Monoid,Semigroup}.{First,Last}

(cherry picked from commit c9ad8852bdd083f8692361134bc247a1eb2bbd77)

- - - - -
fdfd8911 by Cheng Shao at 2023-02-01T13:18:47+00:00
compiler: fix subword literal narrowing logic in the wasm NCG

This patch fixes the W8/W16 literal narrowing logic in the wasm NCG,
which used to lower it to something like i32.const -1, without
properly zeroing-out the unused higher bits. Fixes #22608.

(cherry picked from commit 7e11c6dc25cb9dd14ae33ee9715ddbc8ebf9836e)

- - - - -
adf17604 by Cheng Shao at 2023-02-01T13:18:47+00:00
compiler: fix lowering of CmmBlock in the wasm NCG

The CmmBlock datacon was not handled in lower_CmmLit, since I thought
it would have been eliminated after proc-point splitting. Turns out it
still occurs in very rare occasions, and this patch is needed to fix
T9329 for wasm.

(cherry picked from commit 6ea2aa0293aedea2f873b7b5d9cff5e7b9e2f188)

- - - - -
329097fc by Matthew Pickering at 2023-02-01T13:18:47+00:00
Fixes for cabal-reinstall CI job

* Allow filepath to be reinstalled
* Bump some version bounds to allow newer versions of libraries
* Rework testing logic to avoid "install --lib" and package env files

Fixes #22344

(cherry picked from commit 7cbdaad0396cee561f125c95f3352cebabd8ed99)

- - - - -
5695611e by Cheng Shao at 2023-02-01T13:18:47+00:00
compiler: properly handle ForeignHints in the wasm NCG

Properly handle ForeignHints of ccall arguments/return value, insert
sign extends and truncations when handling signed subwords. Fixes #22852.

(cherry picked from commit 78c07219d5dad9730bbe3ec26ad22912ff22f058)

- - - - -
c4cc32d9 by Cheng Shao at 2023-02-01T13:18:47+00:00
compiler: fix data section alignment in the wasm NCG

Previously we tried to lower the alignment requirement as far as
possible, based on the section kind inferred from the CLabel. For info
tables, .p2align 1 was applied given the GC should only need the
lowest bit to tag forwarding pointers. But this would lead to
unaligned loads/stores, which has a performance penalty even if the
wasm spec permits it. Furthermore, the test suite has shown memory
corruption in a few cases when compacting gc is used.

This patch takes a more conservative approach: all data sections
except C strings align to word size.

(cherry picked from commit da468391872f6be286db37a0f016a37f9f362509)

- - - - -
8f29bdae by Cheng Shao at 2023-02-01T13:18:47+00:00
rts: prevent potential divide-by-zero when tickInterval=0

This patch fixes a few places in RtsFlags.c that may result in
divide-by-zero error when tickInterval=0, which is the default on
wasm. Fixes #22603.

(cherry picked from commit fd8f32bf551c34b95275ebb4fe648680013156f3)

- - - - -
343c856f by Cheng Shao at 2023-02-01T13:18:47+00:00
testsuite: use tgamma for cg007

gamma is a glibc-only deprecated function, use tgamma instead. It's
required for fixing cg007 when testing the wasm unregisterised
codegen.

(cherry picked from commit 7716cbe64862932fd69348b2594a14f2092e1c02)

- - - - -
e377aa49 by Ben Gamari at 2023-02-01T13:18:47+00:00
Bump transformers submodule to 0.6.0.6

Fixes #22862.

(cherry picked from commit 22089f693cf6e662a58a7011adb94d7f768ad2d7)

- - - - -
d91e6233 by Cheng Shao at 2023-02-01T13:18:47+00:00
compiler: properly handle non-word-sized CmmSwitch scrutinees in the wasm NCG

Currently, the wasm NCG has an implicit assumption: all CmmSwitch
scrutinees are 32-bit integers. This is not always true; #22864 is one
counter-example with a 64-bit scrutinee. This patch fixes the logic by
explicitly converting the scrutinee to a word that can be used as a
br_table operand. Fixes #22871. Also includes a regression test.

(cherry picked from commit f0eefa3cf058879246991747dcd18c811402f9e5)

- - - - -
30d3c827 by Ben Gamari at 2023-02-01T13:18:47+00:00
nativeGen/X86: MFENCE is unnecessary for release semantics

In #22764 a user noticed that a program implementing a simple atomic
counter via an STRef regressed significantly due to the introduction of
necessary atomic operations in the MutVar# primops (#22468). This
regression was caused by a bug in the NCG, which emitted an unnecessary
MFENCE instruction for a release-ordered atomic write. MFENCE is rather
only needed to achieve sequentially consistent ordering.

Fixes #22764.

(cherry picked from commit f058e3672b969f301b6b1637f8ab081654ec947a)

- - - - -


30 changed files:

- .gitlab-ci.yml
- cabal.project-reinstall
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToAsm/Wasm/Utils.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Parser.y


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ee995a19bd689064aa401d44a738046b0ef7974f...30d3c8271b867ff9d6c2514632632b9483a09056

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ee995a19bd689064aa401d44a738046b0ef7974f...30d3c8271b867ff9d6c2514632632b9483a09056
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/20230201/4eba8d32/attachment-0001.html>


More information about the ghc-commits mailing list