[Git][ghc/ghc][ghc-9.8] 87 commits: CgUtils.fixStgRegStmt respect register width

Zubin (@wz1000) gitlab at gitlab.haskell.org
Sat Feb 10 01:25:44 UTC 2024



Zubin pushed to branch ghc-9.8 at Glasgow Haskell Compiler / GHC


Commits:
0cbb9e10 by Moritz Angermann at 2024-01-21T17:46:58-05:00
CgUtils.fixStgRegStmt respect register width

This change ensure that the reg + offset computation is always of the
same size.  Before this we could end up with a 64bit register, and then
add a 32bit offset (on 32bit platforms).  This not only would fail type
sanity checking, but also incorrectly truncate 64bit values into 32bit
values silently on 32bit architectures.

(cherry picked from commit dafc47091c9107dcf81e1e80a105f59211927c89)

- - - - -
da8d2a29 by Matthew Pickering at 2024-01-21T22:06:34-05:00
Add aarch64 alpine bindist

This is dynamically linked and makes creating statically linked
executables more straightforward.

Fixes #23482

(cherry picked from commit 51b57d6587b75020045c1a1edf9eb02990ca63cc)

- - - - -
53b308e9 by sheaf at 2024-01-21T22:06:34-05:00
Combine GREs when combining in mkImportOccEnv

In `GHC.Rename.Names.mkImportOccEnv`, we sometimes discard one import
item in favour of another, as explained in Note [Dealing with imports]
in `GHC.Rename.Names`. However, this can cause us to lose track of
important parent information.

Consider for example #24084:

  module M1 where { class C a where { type T a } }
  module M2 ( module M1 ) where { import M1 }
  module M3 where { import M2 ( C, T ); instance C () where T () = () }

When processing the import list of `M3`, we start off (for reasons that
are not relevant right now) with two `Avail`s attached to `T`, namely
`C(C, T)` and `T(T)`. We combine them in the `combine` function of
`mkImportOccEnv`; as described in Note [Dealing with imports] we discard
`C(C, T)` in favour of `T(T)`. However, in doing so, we **must not**
discard the information want that `C` is the parent of `T`. Indeed,
losing track of this information can cause errors when importing,
as we could get an error of the form

  ‘T’ is not a (visible) associated type of class ‘C’

We fix this by combining the two GREs for `T` using `plusGRE`.

Fixes #24084

(cherry picked from commit ec3c4488f456f6f9bdd28a09f0b1e87fd3782db9)

- - - - -
c4d1edb1 by Cheng Shao at 2024-01-21T22:06:34-05:00
testsuite: increase timeout of ghc-api tests for wasm32

ghc-api tests for wasm32 are more likely to timeout due to the large
wasm module sizes, especially when testing with wasm native tail
calls, given wasmtime's handling of tail call opcodes are suboptimal
at the moment. It makes sense to increase timeout specifically for
these tests on wasm32. This doesn't affect other targets, and for
wasm32 we don't increase timeout for all tests, so not to risk letting
major performance regressions slip through the testsuite.

(cherry picked from commit 07ab5cc10d4ce8db0c3b099d8bd34da66db51b9e)

- - - - -
a2d7130e by Simon Peyton Jones at 2024-01-21T22:06:34-05:00
Fix non-termination bug in equality solver

constraint left-to-right then right to left, forever.

Easily fixed.

(cherry picked from commit 21b76843e9b51cd27be32b8c595f29a784276229)

- - - - -
d9a34b85 by Cheng Shao at 2024-01-21T22:06:34-05:00
compiler: fix eager blackhole symbol in wasm32 NCG

(cherry picked from commit fe50eb3510ca730c4d2fc57778d380fdc493abd8)

- - - - -
a0631c4a by Cheng Shao at 2024-01-21T22:06:34-05:00
testsuite: fix optasm tests for wasm32

(cherry picked from commit af77114815ad9052261898c830171e49fbed5160)

- - - - -
186956a6 by Matthew Pickering at 2024-01-21T22:06:34-05:00
testsuite: Add wasm32 to testsuite arches with NCG

The compiler --info reports that wasm32 compilers have a NCG, so we
should agree with that here.

(cherry picked from commit 1b90735c99f1179328f6dd67dbcc81f964901a19)

- - - - -
2bb6c062 by Josh Meredith at 2024-01-21T22:06:34-05:00
JavaScript: support unicode code points > 2^16 in toJSString using String.fromCodePoint (#23628)

(cherry picked from commit 09a5c6cccf8f1b517bc01e8cc924e151d9cbae49)

- - - - -
7c419b07 by Josh Meredith at 2024-01-21T22:06:34-05:00
JavaScript: update MK_TUP macros to use current tuple constructors (#23659)

(cherry picked from commit b9d5bfe9e76e18c78dbcb67e1c5c33a15a54dcd0)

- - - - -
60f3a468 by Sylvain Henry at 2024-01-21T22:06:34-05:00
JS: testsuite: use req_c predicate instead of js_broken

(cherry picked from commit 41968fd699a285e1a1b43535fda28a61bd1202f1)

- - - - -
e110b68f by Sylvain Henry at 2024-01-21T22:06:34-05:00
JS: implement some file primitives (lstat,rmdir) (#22374)

- Implement lstat and rmdir.
- Implement base_c_s_is* functions (testing a file type)
- Enable passing tests

(cherry picked from commit 74a4dd2ec6e200b11a56b6f82907feb66e94c90b)

- - - - -
6c31021e by Andreas Klebinger at 2024-01-21T22:06:34-05:00
Fix FMA primops generating broken assembly on x86.

`genFMA3Code` assumed that we had to take extra precations to avoid overwriting
the result of `getNonClobberedReg`. One of these special cases caused a bug resulting
in broken assembly.

I believe we don't need to hadle these cases specially at all, which means this MR simply
deletes the special cases to fix the bug.

Fixes #24160

(cherry picked from commit fa576eb8a55db8e216eed3e7ea8807121b3496f5)

- - - - -
c52d657c by Zubin Duggal at 2024-01-21T22:06:34-05:00
driver: Don't lose track of nodes when we fail to resolve cycles

The nodes that take part in a cycle should include both hs-boot and hs files,
but when we fail to resolve a cycle, we were only counting the nodes from the
graph without boot files.

Fixes #24196

(cherry picked from commit 717c9b59ecfb919cba1b8cec6597d0c2fb3ef1a1)

- - - - -
6a78bcc1 by Sebastian Graf at 2024-01-30T17:14:16+05:30
Cpr: Turn an assertion into a check to deal with some dead code (#23862)

See the new `Note [Dead code may contain type confusions]`.

Fixes #23862.

(cherry picked from commit 57c391c463f26b7025df9b340ad98416cff1d2b2)

- - - - -
724102f6 by Zubin Duggal at 2024-01-30T17:14:16+05:30
hadrian: set -Wno-deprecations for directory and Win32

The filepath bump to 1.4.200.1 introduces a deprecation warning.

See https://gitlab.haskell.org/ghc/ghc/-/issues/24240
    https://github.com/haskell/filepath/pull/206

(cherry picked from commit 86f652dc9a649e59e643609c287a510a565f5408)

- - - - -
38cb7fb4 by Moritz Angermann at 2024-01-30T17:14:16+05:30
Drop hard Xcode dependency

XCODE_VERSION calls out to `xcodebuild`, which is only available
when having `Xcode` installed. The CommandLineTools are not
sufficient. To install Xcode, you must have an apple id to download
the Xcode.xip from apple.

We do not use xcodebuild anywhere in our build explicilty. At best
it appears to be a proxy for checking the linker or the compiler.
These should rather be done with
```
xcrun ld -version
```
or similar, and not by proxy through Xcode. The CLR should be
sufficient for building software on macOS.

(cherry picked from commit a3ee3b99e6889fd68da75c6ea7a14d101f71da56)

- - - - -
3ac10c2c by Sylvain Henry at 2024-01-30T17:14:16+05:30
Fix unusable units and module reexport interaction (#21097)

This commit fixes an issue with ModUnusable introduced in df0f148feae.

In mkUnusableModuleNameProvidersMap we traverse the list of unusable
units and generate ModUnusable origin for all the modules they contain:
exposed modules, hidden modules, and also re-exported modules. To do
this we have a two-level map:

  ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin

So for each module name "M" in broken unit "u" we have:
  "M" -> u:M -> ModUnusable reason

However in the case of module reexports we were using the *target*
module as a key. E.g. if "u:M" is a reexport for "X" from unit "o":
   "M" -> o:X -> ModUnusable reason

Case 1: suppose a reexport without module renaming (u:M -> o:M) from
unusable unit u:
   "M" -> o:M -> ModUnusable reason

Here it's claiming that the import of M is unusable because a reexport
from u is unusable. But if unit o isn't unusable we could also have in
the map:
   "M" -> o:M -> ModOrigin ...

Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
(ModUnusable <> ModOrigin)

Case 2: similarly we could have 2 unusable units reexporting the same module
without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v
unusable. It gives:

  "M" -> o:M -> ModUnusable ... (for u)
  "M" -> o:M -> ModUnusable ... (for v)

Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
(ModUnusable <> ModUnusable).

This led to #21097, #16996, #11050.

To fix this, in this commit we make ModUnusable track whether the module
used as key is a reexport or not (for better error messages) and we use
the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u
is unusable, we now record:

    "M" -> u:M -> ModUnusable reason reexported=True

So now, we have two cases for a reexport u:M -> o:X:
   - u unusable: "M" -> u:M -> ModUnusable ... reexported=True
   - u usable:   "M" -> o:X -> ModOrigin   ... reexportedFrom=u:M

The second case is indexed with o:X because in this case the Semigroup
instance of ModOrigin is used to combine valid expositions of a module
(directly or via reexports).

Note that module lookup functions select usable modules first (those who
have a ModOrigin value), so it doesn't matter if we add new ModUnusable
entries in the map like this:

  "M" -> {
    u:M -> ModUnusable ... reexported=True
    o:M -> ModOrigin ...
  }

The ModOrigin one will be used. Only if there is no ModOrigin or
ModHidden entry will the ModUnusable error be printed. See T21097 for an
example printing several reasons why an import is unusable.

(cherry picked from commit cee81370cd6ef256f66035e3116878d4cb82e28b)

- - - - -
2af5c8d1 by Moritz Angermann at 2024-01-30T17:14:16+05:30
[PEi386] Mask SYM_TYPE_DUP_DISCARD in makeSymbolExtra

48e391952c17ff7eab10b0b1456e3f2a2af28a9b
introduced `SYM_TYPE_DUP_DISCARD` to the bitfield.

The linker however, failed to mask the `SYM_TYPE_DUP_DISCARD` value.
Thus `== SYM_TYPE_CODE` comparisons easily failed. This lead to us
relocating DATA lookups (GOT) into E8 (call) and E9 (jump) instructions.

(cherry picked from commit 34f06334025521c2440ebedb0237697fbcc3c6de)

- - - - -
97679725 by Ilias Tsitsimpis at 2024-01-30T17:14:16+05:30
hadrian: Pass -DNOSMP to C compiler when needed

Hadrian passes the -DNOSMP flag to GHC when the target doesn't support
SMP, but doesn't pass it to CC as well, leading to the following
compilation error on mips64el:

| Run Cc (FindCDependencies CDep) Stage1: rts/sm/NonMovingScav.c => _build/stage1/rts/build/c/sm/NonMovingScav.o.d
Command line: /usr/bin/mips64el-linux-gnuabi64-gcc -E -MM -MG -MF _build/stage1/rts/build/c/hooks/FlagDefaults.thr_debug_p_o.d -MT _build/stage1/rts/build/c/hooks/FlagDefaults.o -Irts/include -I_build/stage1/rts/build -I_build/stage1/rts/build/include -Irts/include -x c rts/hooks/FlagDefaults.c -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline -Wpointer-arith -Wmissing-noreturn -Wnested-externs -Wredundant-decls -Wundef -fno-strict-aliasing -DTHREADED_RTS -DDEBUG -fomit-frame-pointer -O2 -g -Irts -I_build/stage1/rts/build -DDEBUG -fno-omit-frame-pointer -g3 -O0
===> Command failed with error code: 1
In file included from rts/include/Stg.h:348,
                 from rts/include/Rts.h:38,
                 from rts/hooks/FlagDefaults.c:8:
rts/include/stg/SMP.h:416:2: error: #error memory barriers unimplemented on this architecture
  416 | #error memory barriers unimplemented on this architecture
      |  ^~~~~
rts/include/stg/SMP.h:440:2: error: #error memory barriers unimplemented on this architecture
  440 | #error memory barriers unimplemented on this architecture
      |  ^~~~~
rts/include/stg/SMP.h:464:2: error: #error memory barriers unimplemented on this architecture
  464 | #error memory barriers unimplemented on this architecture
      |  ^~~~~

The old make system correctly passed this flag to both GHC and CC [1].

Fix this error by passing -DNOSMP to CC as well.

[1] https://gitlab.haskell.org/ghc/ghc/-/blob/00920f176b0235d5bb52a8e054d89a664f8938fe/rts/ghc.mk#L407

Closes #24082

(cherry picked from commit 257c2807587624592813a42e06a05c5fc34cb38c)

- - - - -
0ae27729 by Moritz Angermann at 2024-01-30T17:14:16+05:30
nativeGen: section flags for .text$foo only

Commit 3ece9856d157c85511d59f9f862ab351bbd9b38b, was supposed to fix
#22834 in !9810.

It does however add "xr" indiscriminatly to .text sections
even if splitSections is disabled. This leads to the assembler saying:

ghc_1.s:7849:0: error:
     Warning: Ignoring changed section attributes for .text
     |
7849 | .section .text,"xr"
     | ^

(cherry picked from commit e99cf237f84db34be0468a893b10394d6b364bce)

- - - - -
336c0c39 by Moritz Angermann at 2024-01-30T17:14:16+05:30
[PEi386 linker] Bounds check and null-deref guard

We should resonably be able to expect that we won't exceed the number of
sections if we assume to be dealing with legal object files. We can however
not guarantee that we get some negative values, and while we try to
special case most, we should exclude negative indexing into the sections
array.

We also need to ensure that we do not try to derefences targetSection,
if it is NULL, due to the switch statement.

(cherry picked from commit df81536f2e53abf521a05eb1e482a076f5849c21)

- - - - -
c036cf16 by Sylvain Henry at 2024-01-30T17:14:16+05:30
Avoid out-of-bound array access in bigNatIsPowerOf2 (fix #24066)

bigNatIndex# in the `where` clause wasn't guarded by "bigNatIsZero a".

(cherry picked from commit fe0675770b66a9ed393884d96e276b8d116fa2a2)

- - - - -
14d23c31 by Sylvain Henry at 2024-01-30T17:14:16+05:30
Bignum: fix right shift of negative BigNat with native backend

(cherry picked from commit cc1625b1ffbdf086b8380bacd35abc8d85861637)

- - - - -
cead9699 by Sylvain Henry at 2024-01-30T17:14:17+05:30
Rts: expose rtsOutOfBoundsAccess symbol

(cherry picked from commit cbe4400d2690104053ec544cf7d0a9a13ee914ee)

- - - - -
0ffbcb24 by Sylvain Henry at 2024-01-30T17:14:17+05:30
Hadrian: enable `-fcheck-prim-bounds` in validate flavour

This allows T24066 to fail when the bug is present.

Otherwise the out-of-bound access isn't detected as it happens in
ghc-bignum which wasn't compiled with the bounds check.

(cherry picked from commit 72c7380cb780933825bc84924908e01ce0495dc4)

- - - - -
ef2f3e02 by Profpatsch at 2024-01-30T17:14:17+05:30
base: Improve String & IsString documentation

(cherry picked from commit d751c583d29460f033fefb45e685fa40fb3487ad)

- - - - -
b8af87e8 by Ben Gamari at 2024-01-30T17:14:17+05:30
rts/eventlog: Fix off-by-one in assertion

Previously we failed to account for the NULL terminator `postString`
asserted that there is enough room in the buffer for the string.

(cherry picked from commit d0b17576148d336b67c7d65bcf742f83001413cb)

- - - - -
86ac4f65 by Ben Gamari at 2024-01-30T17:14:17+05:30
rts/eventlog: Honor result of ensureRoomForVariableEvent is

Previously we would keep plugging along, even if isn't enough room for
the event.

(cherry picked from commit a10f9b9bc510051a5b47d31238aad1174f7a1966)

- - - - -
64de5b77 by Ben Gamari at 2024-01-30T17:14:17+05:30
rts/eventlog: Avoid truncating event sizes

Previously ensureRoomForVariableEvent would truncate the desired size to
16-bits, resulting in #24197.

Fixes #24197.

(cherry picked from commit 0e0f41c0e3d9c67fc669e975060e88bccdc7d823)

- - - - -
efc34462 by Zubin Duggal at 2024-01-30T17:14:17+05:30
driver: Ensure we actually clear the interactive context before reloading

Previously we called discardIC, but immediately after set the session
back to an old HscEnv that still contained the IC

Partially addresses #24107
Fixes #23405

(cherry picked from commit 58d56644c54b221f265b739829e53f9f5e1216d3)

- - - - -
459dc2db by Zubin Duggal at 2024-01-30T17:14:17+05:30
driver: Ensure we force the lookup of old build artifacts before returning the build plan

This prevents us from retaining all previous build artifacts in memory until a
recompile finishes, instead only retaining the exact artifacts we need.

Fixes #24118

(cherry picked from commit 8e5745a0cddf36afb680e1e99675279f0065ad7b)

- - - - -
87d262af by Zubin Duggal at 2024-01-30T17:14:17+05:30
testsuite: add test for #24118 and #24107

MultiLayerModulesDefsGhci was not able to catch the leak because it uses
:l which discards the previous environment.

Using :r catches both of these leaks
(cherry picked from commit 105c370ce8d2efe0295c3a50a5866f169b59b5e2)

- - - - -
a8e0c9ab by Zubin Duggal at 2024-01-30T17:14:17+05:30
compiler: Add some strictness annotations to ImportSpec and related constructors
This prevents us from retaining entire HscEnvs.

Force these ImportSpecs when forcing the GlobalRdrEltX

Adds an NFData instance for Bag

Fixes #24107

(cherry picked from commit e822ff88f7b139191163d0b2dafe43b318b779f9)

- - - - -
67536e12 by Zubin Duggal at 2024-01-30T17:14:17+05:30
compiler: Force IfGlobalRdrEnv in NFData instance.

(cherry picked from commit 522c12a43b34ad4ca7f3f916fa630d33a4fe6efb)

- - - - -
057f4e24 by Claudio Bley at 2024-01-30T17:14:17+05:30
Only exit ghci in -e mode when :add command fails

Previously, when running `ghci -e ':add Sample.hs'` the process would
exit with exit code 1 if the file exists and could be loaded.

Fixes #24115

(cherry picked from commit d561073727186c7b456c9ef113ccb7fc0df4560e)

- - - - -
28fff112 by mmzk1526 at 2024-01-30T17:14:17+05:30
Use "-V" for alex version check for better backward compatibility
Fixes #24302.
In recent versions of alex, "-v" is used for "--verbose" instead of "-version".

(cherry picked from commit c7be0c680d96ba6209c86e509ab2682e5041a53d)

- - - - -
1b7b1345 by Ben Gamari at 2024-01-30T17:14:17+05:30
distrib: Rediscover otool and install_name_tool on Darwin

In the bindist configure script we must rediscover the `otool` and
`install_name_tool`s since they may be different from the build
environment.

Fixes #24211.

(cherry picked from commit 292983c841b4facd5c48fcec9689448d66bcb90e)

- - - - -
f8a889b3 by Zubin Duggal at 2024-01-30T17:14:17+05:30
ci: Ensure we use the correct bindist name for the test artifact when generating
release ghcup metadata

Fixes #24268

(cherry picked from commit 989bf8e53c08eb22de716901b914b3607bc8dd08)

- - - - -
9f8fd045 by Stefan Schulze Frielinghaus at 2024-01-30T17:14:17+05:30
llvmGen: Align objects in the data section

Objects in the data section may be referenced via tagged pointers.
Thus, align those objects to a 4- or 8-byte boundary for 32- or 64-bit
platforms, respectively.  Note, this may need to be reconsidered if
objects with a greater natural alignment requirement are emitted as e.g.
128-bit atomics.

Fixes #24163.

(cherry picked from commit dfe1c3540e4b519b62b862b5966dfec5cae9ece1)

- - - - -
ff1c1cfb by Zubin Duggal at 2024-01-30T17:14:17+05:30
docs: document permissibility of -XOverloadedLabels (#24249)

Document the permissibility introduced by
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst

(cherry picked from commit c247b6befe6a599688bad0a3383424f7ea12d5f2)

- - - - -
57a663f1 by Simon Peyton Jones at 2024-01-30T17:14:17+05:30
Take care when simplifying unfoldings

This MR fixes a very subtle bug exposed by #24242.

See Note [Environment for simplLetUnfolding].

I also updated a bunch of Notes on shadowing

(cherry picked from commit d8baa1bdeea1753afc939a20119d3ce555301167)

- - - - -
e3f862f7 by Simon Peyton Jones at 2024-01-30T17:14:17+05:30
Make TYPE and CONSTRAINT not-apart

Issue #24279 showed up a bug in the logic in GHC.Core.Unify.unify_ty
which is supposed to make TYPE and CONSTRAINT be not-apart.

Easily fixed.

(cherry picked from commit af6932d6c068361c6ae300d52e72fbe13f8e1f18)

- - - - -
a9681fe1 by Zubin Duggal at 2024-01-30T17:14:17+05:30
ci: Fix typo in mk_ghcup_metadata.py

There was a missing colon in the fix to #24268 in 989bf8e53c08eb22de716901b914b3607bc8dd08

(cherry picked from commit 4a39b5ffb85246d0dc491e36a80449afdbcc74cc)

- - - - -
ba4edca6 by sheaf at 2024-01-30T17:14:17+05:30
Use lookupOccRn_maybe in TH.lookupName

When looking up a value, we want to be able to find both variables
and record fields. So we should not use the lookupSameOccRn_maybe
function, as we can't know ahead of time which record field namespace
a record field with the given textual name will belong to.

Fixes #24293

(cherry picked from commit c5fc7304d56c7a1e0a7bc6e53e23b976772fc10e)

- - - - -
5ac5d8d2 by Zubin Duggal at 2024-02-07T15:22:43+05:30
#22362 and 22349 are fixed on the js backend

- - - - -
661e2a46 by Greg Steuck at 2024-02-08T15:28:41+05:30
Remove undefined FP_PROG_LD_BUILD_ID from configure.ac's

(cherry picked from commit 6f904808c925991bbaf4068c9a12b584675c6209)

- - - - -
d1a6ad12 by Sylvain Henry at 2024-02-08T15:37:59+05:30
JS: implement some file primitives (lstat,rmdir) (#22374)

- Implement lstat and rmdir.
- Implement base_c_s_is* functions (testing a file type)
- Enable passing tests

(cherry picked from commit 74a4dd2ec6e200b11a56b6f82907feb66e94c90b)

- - - - -
8986d86d by jade at 2024-02-08T15:40:03+05:30
Expand documentation of List & Data.List

This commit aims to improve the documentation and examples
of symbols exported from Data.List

(cherry picked from commit ff81d53f6404867c7cdd9dde5bb6bf3776912048)

- - - - -
2fde790f by Jade at 2024-02-08T15:41:33+05:30
Improve documentation of Semigroup & Monoid

This commit aims to improve the documentation of various symbols
exported from Data.Semigroup and Data.Monoid

(cherry picked from commit fa4e5913251786f2b535b31abd3fad39da8b3602)

- - - - -
f36b8ba7 by Finley McIlwaine at 2024-02-08T15:44:05+05:30
Add -dipe-stats flag

This is useful for seeing which info tables have information.

(cherry picked from commit cc52c358316ac8210f80da80db6b0c620dd5bdc3)

- - - - -
c237fe04 by Finley McIlwaine at 2024-02-08T19:53:20+05:30
Add -finfo-table-map-with-fallback -finfo-table-map-with-stack

The -fno-info-table-map-with-stack flag omits STACK info tables from the info
table map, and the -fno-info-table-map-with-fallback flag omits info tables
with defaulted source locations from the map. In a test on the Agda codebase
the build results were about 7% smaller when both of those types of tables
were omitted.

Adds a test that verifies that passing each combination of these flags
results in the correct output for -dipe-stats, which is disabled for the js
backend since profiling is not implemented.

This commit also refactors a lot of the logic around extracting info tables
from the Cmm results and building the info table map.

This commit also fixes some issues in the users guide rst source to fix
warnings that were noticed while debugging the documentation for these flags.

Fixes #23702

(cherry picked from commit 261c4acbfdaf5babfc57ab0cef211edb66153fb1)

- - - - -
c5e5e6da by Finley McIlwaine at 2024-02-08T19:53:20+05:30
Refactor estimation of stack info table provenance

This commit greatly refactors the way we compute estimated provenance for stack
info tables. Previously, this process was done using an entirely separate traversal
of the whole Cmm code stream to build the map from info tables to source locations.
The separate traversal is now fused with the Cmm code generation pipeline in
GHC.Driver.Main.

This results in very significant code generation speed ups when -finfo-table-map is
enabled. In testing, this patch reduces code generation times by almost 30% with
-finfo-table-map and -O0, and 60% with -finfo-table-map and -O1 or -O2 .

Fixes #23103

(cherry picked from commit d99c816f7b5727a3f344960e02a1932187ea093f)

- - - - -
882f3b32 by Finley McIlwaine at 2024-02-08T19:53:20+05:30
Add a test checking overhead of -finfo-table-map

We want to make sure we don't end up with poor codegen performance resulting from
-finfo-table-map again as in #23103. This test adds a performance test tracking
total allocations while compiling ExactPrint with -finfo-table-map.

(cherry picked from commit d3e0124c1157a4a423d86a1dc1d7e82c6d32ef06)

- - - - -
a36e4c46 by Matthew Pickering at 2024-02-08T19:53:20+05:30
Add aarch64-deb11 bindist

This adds a debian 11 release job for aarch64.

Fixes #22005

(cherry picked from commit 02c87213e1215520d5496130a3082143f27035ae)

- - - - -
eda05046 by sheaf at 2024-02-08T19:53:20+05:30
Pass quantified tyvars in tcDefaultAssocDecl

This commit passes the correct set of quantified type variables written
by the user in associated type default declarations for validity
checking. This ensures that validity checking of associated type defaults
mirrors that of standalone type family instances.

Fixes #23768 (see testcase T23734 in subsequent commit)

(cherry picked from commit 5f826c180aa9b42ccb0af5763d87a48bee5e4083)

- - - - -
f8484716 by sheaf at 2024-02-08T19:53:20+05:30
Avoid panic in mkGADTVars

This commit avoids panicking in mkGADTVars when we encounter
a type variable as in #23784 that is bound by a user-written
forall but not actually used.

Fixes #23784

(cherry picked from commit aba184241a80e5abc804c4f22db91a16be215c11)

- - - - -
5181eda8 by sheaf at 2024-02-08T19:53:20+05:30
Adjust reporting of unused tyvars in data FamInsts

This commit adjusts the validity checking of data family
instances to improve the reporting of unused type variables.

See Note [Out of scope tvs in data family instances] in GHC.Tc.Validity.

The problem was that, in a situation such as

  data family D :: Type
  data instance forall (d :: Type). D = MkD

the RHS passed to 'checkFamPatBinders' would be the TyCon app

  R:D d

which mentions the type variable 'd' quantified in the user-written
forall. Thus, when computing the set of unused type variables in
the RHS of the data family instance, we would find that 'd' is used,
and report a strange error message that would say that 'd' is not
bound on the LHS.

To fix this, we special-case the data-family instance case,
manually extracting all the type variables that appear in the
arguments of all the data constructores of the data family instance.

Fixes #23778

(cherry picked from commit a525a92a37cc202b6db09a827ba9df9eb8c9fa79)

- - - - -
931a0c34 by Antoine Leblanc at 2024-02-08T23:01:53+05:30
Be more eager in TyCon boot validity checking

This commit performs boot-file consistency checking for TyCons into
checkValidTyCl. This ensures that we eagerly catch any mismatches,
which prevents the compiler from seeing these inconsistencies and
panicking as a result.

See Note [TyCon boot consistency checking] in GHC.Tc.TyCl.

Fixes #16127

(cherry picked from commit 1420b8cb8a7d6196eec80dc5293864c780379560)

- - - - -
e7cf6437 by sheaf at 2024-02-08T23:01:53+05:30
Unused tyvars in FamInst: only report user tyvars

This commit changes how we perform some validity checking for
coercion axioms to mirror how we handle default declarations for
associated type families. This allows us to keep track of whether
type variables in type and data family instances were user-written
or not, in order to only report the user-written ones in
"unused type variable" error messages.

Consider for example:

  {-# LANGUAGE PolyKinds #-}
  type family F
  type instance forall a. F = ()

In this case, we get two quantified type variables,
(k :: Type) and (a :: k); the second being user-written, but the first
is introduced by the typechecker. We should only report 'a' as being
unused, as the user has no idea what 'k' is.

Fixes #23734

(cherry picked from commit 28dd52eec98e50c711cd00df22f6ab9e054c8b75)

- - - - -
ebc725b2 by sheaf at 2024-02-08T23:01:53+05:30
Validity: refactor treatment of data families

This commit refactors the reporting of unused type variables in type
and data family instances to be more principled. This avoids ad-hoc
logic in the treatment of data family instances.

(cherry picked from commit 1eed645c8b03b19a14cf58d9be5317cb81cbd30a)

- - - - -
dcd8ca74 by Krzysztof Gogolewski at 2024-02-08T23:01:53+05:30
docs: fix ScopedTypeVariables example (#24101)

The previous example didn't compile.

Furthermore, it wasn't demonstrating the point properly.
I have changed it to an example which shows that 'a' in the signature
must be the same 'a' as in the instance head.

(cherry picked from commit 7a90020f167ab016cbfa95decafaa1a54a974bc6)

- - - - -
f47a95f2 by PHO at 2024-02-08T23:01:53+05:30
Don't assume the current locale is *.UTF-8, set the encoding explicitly

primops.txt contains Unicode characters:
> LC_ALL=C ./genprimopcode --data-decl < ./primops.txt
> genprimopcode: <stdin>: hGetContents: invalid argument (cannot decode byte sequence starting from 226)

Hadrian must also avoid using readFile' to read primops.txt because it
tries to decode the file with a locale-specific encoding.

(cherry picked from commit 52c0fc691e6501e99a96693ec1fc02e3c93a4fbc)

- - - - -
73600e14 by Simon Peyton Jones at 2024-02-08T23:01:53+05:30
Add an extra check in kcCheckDeclHeader_sig

Fix #24083 by checking for a implicitly-scoped type variable that is not
actually bound.  See Note [Disconnected type variables] in GHC.Tc.Gen.HsType

For some reason, on aarch64-darwin we saw a 2.8% decrease in compiler
allocations for MultiLayerModulesTH_Make; but 0.0% on other architectures.

Metric Decrease:
    MultiLayerModulesTH_Make

(cherry picked from commit 6dbab1808bfbe484b3fb396aab1d105314f918d8)

- - - - -
39179586 by Simon Peyton Jones at 2024-02-08T23:01:53+05:30
Second fix to #24083

My earlier fix turns out to be too aggressive for data/type families

See wrinkle (DTV1) in Note [Disconnected type variables]

(cherry picked from commit 2776920e642544477a38d0ed9205d4f0b48a782e)
(cherry picked from commit 110efc9813ba5f68668ab7fc3f95b9febca52880)

- - - - -
aa339700 by Matthew Pickering at 2024-02-08T23:01:53+05:30
libraries: Bump filepath to 1.4.200.1 and unix to 2.8.4.0

Updates filepath submodule
Updates unix submodule

Fixes #24240

(cherry picked from commit 36b9a38cc45a26865c4e45f4949e519a5dede76d)

- - - - -
4058ecba by Matthew Pickering at 2024-02-08T23:01:54+05:30
Submodule linter: Allow references to tags

We modify the submodule linter so that if the bumped commit is a
specific tag then the commit is accepted.

Fixes #24241

(cherry picked from commit 91ff0971df64b04938d011fe1562320c5d90849a)

- - - - -
ab835c3f by Matthew Craven at 2024-02-08T23:01:54+05:30
Fix loopification in the presence of void arguments

This also removes Note [Void arguments in self-recursive tail calls],
which was just misleading.  It's important to count void args both
in the function's arity and at the call site.

Fixes #24295.

(cherry picked from commit ae9cc1a84c9f470b77d98423400e6dfa95b2449b)

- - - - -
275997f7 by Andreas Klebinger at 2024-02-08T23:01:54+05:30
Aarch64: Enable -mfma by default.

Fixes #24311

(cherry picked from commit 7e95f738620dc805868d198f980e1bdd53e27a2d)

- - - - -
bb4f3878 by Matthew Pickering at 2024-02-08T23:01:54+05:30
eventlog: Fix off-by-one error in postIPE

We were missing the extra_comma from the calculation of the size of the
payload of postIPE. This was causing assertion failures when the event
would overflow the buffer by one byte, as ensureRoomForVariable event
would report there was enough space for `n` bytes but then we would
write `n + 1` bytes into the buffer.

Fixes #24287

(cherry picked from commit 5776008c7a5581193c3e72e59451ad49abac9d81)

- - - - -
8fac10a2 by Jade at 2024-02-08T23:01:54+05:30
Enhance Documentation of functions exported by Data.Function

This patch aims to improve the documentation of functions exported
in Data.Function

Tracking: #17929
Fixes: #10065
(cherry picked from commit 1fa1c00c95325761a5aa914af53d71ba5e7072b3)

- - - - -
758ff906 by Jade at 2024-02-08T23:01:54+05:30
Improve documentation of hGetLine.

- Add explanation for whether a newline is returned
- Add examples

Fixes #14804

(cherry picked from commit ab47a43d64f6b7d4fc181645171c31ba2db1eebe)

- - - - -
5205b93d by sheaf at 2024-02-08T23:01:54+05:30
Fix FMA instruction on LLVM

We were emitting the wrong instructions for fused multiply-add
operations on LLVM:

  - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd"
  - LLVM does not support other instructions such as "fmsub"; instead
    we implement these by flipping signs of some arguments
  - the instruction is an LLVM intrinsic, which requires handling it
    like a normal function call instead of a machine instruction

Fixes #24223

(cherry picked from commit a40f4ab21bcc088e63892cd5e85edbec20d3fc69)

- - - - -
7ddb1418 by Hécate Moonlight at 2024-02-08T23:01:54+05:30
Clarification for newtype constructors when using `coerce`

(cherry picked from commit 699da01bbbf3e42c7d38b9cfe443dd0e8e256342)

- - - - -
4593f490 by Andreas Klebinger at 2024-02-08T23:01:54+05:30
Fix fma warning when using llvm on aarch64.

On aarch64 fma is always on so the +fma flag doesn't exist for that
target. Hence no need to try and pass +fma to llvm.

Fixes #24379

(cherry picked from commit 9294a08643b89509a0e0957cb73c186a39d4f3db)

- - - - -
10de6db4 by Patrick at 2024-02-08T23:01:54+05:30
Fix bug wrong span of nested_doc_comment #24378

close #24378
1. Update the start position of span in `nested_doc_comment` correctly.
and hence the spans of identifiers of haddoc can be computed correctly.
2. add test `HaddockSpanIssueT24378`.

(cherry picked from commit 8eeadfad3a0035f8c5b339782676ff23572e0e5e)

- - - - -
85ef42ce by sheaf at 2024-02-08T23:01:54+05:30
No shadowing warnings for NoFieldSelector fields

This commit ensures we don't emit shadowing warnings when a user
shadows a field defined with NoFieldSelectors.

Fixes #24381

(cherry picked from commit ced2e7312b692e3f5402e4db6cfec390653a6a06)

- - - - -
e59bae2a by Teo Camarasu at 2024-02-08T23:01:54+05:30
doc: Add -Dn flag to user guide

Resolves #24394

(cherry picked from commit 94ce031ddc84ee702c12a11793028ef21e65fa00)

- - - - -
81cb68aa by Rodrigo Mesquita at 2024-02-08T23:01:54+05:30
Work around autotools setting C11 standard in CC/CXX

In autoconf >=2.70, C11 is set by default for $CC and $CXX via the
-std=...11 flag. In this patch, we split the "-std" flag out of the $CC
and $CXX variables, which we traditionally assume to be just the
executable name/path, and move it to $CFLAGS/$CXXFLAGS instead.

Fixes #24324

(cherry picked from commit cdddeb0f1280b40cc194028bbaef36e127175c4c)

- - - - -
a7421910 by Zubin Duggal at 2024-02-08T23:01:54+05:30
driver: Really don't lose track of nodes when we fail to resolve cycles

This fixes a bug in 8db8d2fd1c881032b1b360c032b6d9d072c11723, where we could lose
track of acyclic components at the start of an unresolved cycle. We now ensure we
never loose track of any of these components.

As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC:

When viewed without boot files, we have a single SCC

```
[REC main:T24275B [main:T24275B {-# SOURCE #-},
                   main:T24275A {-# SOURCE #-}]
     main:T24275A [main:T24275A {-# SOURCE #-}]]
```

But with boot files this turns into

```
[NONREC main:T24275B {-# SOURCE #-} [],
 REC main:T24275B [main:T24275B {-# SOURCE #-},
                   main:T24275A {-# SOURCE #-}]
    main:T24275A {-# SOURCE #-} [main:T24275B],
 NONREC main:T24275A [main:T24275A {-# SOURCE #-}]]
```

Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot.
However, we treat this entire group as a single "SCC" because it seems so when we
analyse the graph without taking boot files into account.

Indeed, we must return a single ResolvedCycle element in the BuildPlan for this
as described in Note [Upsweep].

However, since after resolving this is not a true SCC anymore, `findCycle` fails
to find a cycle and we have a sub-optimal error message as a result.

To handle this, I extended `findCycle` to not assume its input is an SCC, and to
try harder to find cycles in its input.

Fixes #24275

(cherry picked from commit 532993c8160d960f848e7abd401774b6879e3ee8)

- - - - -
ba0a5d95 by Matthew Pickering at 2024-02-08T23:01:54+05:30
distrib/configure: Fix typo in CONF_GCC_LINKER_OPTS_STAGE2 variable

Instead we were setting CONF_GCC_LINK_OPTS_STAGE2 which meant that we
were missing passing `--target` when invoking the linker.

Fixes #24414

(cherry picked from commit d309f4e7e37f3795c6d6b150c407d5a9b332854e)

- - - - -
b3300cb5 by Zubin Duggal at 2024-02-09T01:34:17+05:30
ci: Regenerate jobs.yaml

- - - - -
042d45dd by Zubin Duggal at 2024-02-09T13:28:50+05:30
ci: Mark PartialDownsweep and OldModLocation tests as fragile on js backend

- - - - -
55bbea03 by Rodrigo Mesquita at 2024-02-09T16:01:30+05:30
Suppress duplicate librares linker warning of new macOS linker

Fixes #24167

XCode 15 introduced a new linker which warns on duplicate libraries being
linked. To disable this warning, we pass -Wl,-no_warn_duplicate_libraries as
suggested by Brad King in CMake issue #25297.

This flag isn't necessarily available to other linkers on darwin, so we must
only configure it into the CC linker arguments if valid.

(cherry picked from commit e98051a5e7251390799f9fdead988c61d72e82e3)

- - - - -
74d6260a by Rodrigo Mesquita at 2024-02-09T16:02:03+05:30
testsuite: Encoding test witnesses recent iconv bug is fragile

A regression in the new iconv() distributed with XCode 15 and MacOS
Sonoma causes the test 'encoding004' to fail in the CP936 roundrip.

We mark this test as fragile until this is fixed upstream (rather than
broken, since previous versions of iconv pass the test)

See #24161

(cherry picked from commit c411c431e7ae1f0effbe9f9a624c7f9171d50f0a)

- - - - -
0f6116ca by Rodrigo Mesquita at 2024-02-09T16:02:12+05:30
testsuite: Update to LC_ALL=C no longer being ignored in darwin

MacOS seems to have fixed an issue where it used to ignore the variable
`LC_ALL` in program invocations and default to using Unicode.

Since the behaviour seems to be fixed to account for the locale
variable, we mark tests that were previously broken in spite of it as
fragile (since they now pass in recent macOS distributions)

See #24161

(cherry picked from commit ce7fe5a916d50f471812f4714615e13f557fe57a)

- - - - -
b746f8a8 by Rodrigo Mesquita at 2024-02-09T16:05:28+05:30
darwin: Fix single_module is obsolete warning

In XCode 15's linker, -single_module is the default and otherwise
passing it as a flag results in a warning being raised:

    ld: warning: -single_module is obsolete

This patch fixes this warning by, at configure time, determining whether
the linker supports -single_module (which is likely false for all
non-darwin linkers, and true for darwin linkers in previous versions of
macOS), and using that information at runtime to decide to pass or not
the flag in the invocation.

Fixes #24168

(cherry picked from commit e6c803f702e8b09dfd0073b973b8afcd7071db50)
(cherry picked from commit 273f5a3fd392d528664d5661508cc0094e37ec0d)

- - - - -


30 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm.hs
- compiler/GHC/CmmToAsm/Ppr.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/CmmToLlvm/Data.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Class.hs
- compiler/GHC/Core/Coercion/Axiom.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Data/Bag.hs
- compiler/GHC/Data/Graph/Directed.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/GenerateCgIPEStub.hs
- compiler/GHC/Driver/Main.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/443e870d977b1ab6fc05f47a9a17bc49296adbd6...b746f8a86d48f1c379228039a87e220dfb81fba6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/443e870d977b1ab6fc05f47a9a17bc49296adbd6...b746f8a86d48f1c379228039a87e220dfb81fba6
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/20240209/e0b3e1c7/attachment-0001.html>


More information about the ghc-commits mailing list