[Git][ghc/ghc][ghc-9.6] 14 commits: Refine the test for naughty record selectors

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Fri Mar 3 14:46:45 UTC 2023



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


Commits:
c00a8a78 by Simon Peyton Jones at 2023-03-02T10:15:53-05:00
Refine the test for naughty record selectors

The test for naughtiness in record selectors is surprisingly subtle.
See the revised Note [Naughty record selectors] in GHC.Tc.TyCl.Utils.

Fixes #23038.

(cherry picked from commit cf118e2fac04b79cc7fa63cff0552190c3885bb9)

- - - - -
3b9bf327 by Simon Peyton Jones at 2023-03-02T10:16:05-05:00
Account for TYPE vs CONSTRAINT in mkSelCo

As #23018 showed, in mkRuntimeRepCo we need to account for coercions
between TYPE and COERCION.

See Note [mkRuntimeRepCo] in GHC.Core.Coercion.

(cherry picked from commit bb500e2a2d039dc75c8bb80d47ea2349b97fbf1b)

- - - - -
0105758b by Sebastian Graf at 2023-03-02T10:16:14-05:00
Revert the main payload of "Make `drop` and `dropWhile` fuse (#18964)"

This reverts the bits affecting fusion of `drop` and `dropWhile` of commit
0f7588b5df1fc7a58d8202761bf1501447e48914 and keeps just the small refactoring
unifying `flipSeqTake` and `flipSeqScanl'` into `flipSeq`.

It also adds a new test for #23021 (which was the reason for reverting) as
well as adds a clarifying comment to T18964.

Fixes #23021, unfixes #18964.

Metric Increase:
    T18964
Metric Decrease:
    T18964

(cherry picked from commit a2a1a1c08bb520b74b00194a83add82b287b38d5)

- - - - -
8f1ba948 by Cheng Shao at 2023-03-02T10:16:21-05:00
ghc-prim: fix hs_cmpxchg64 function prototype

hs_cmpxchg64 must return a StgWord64, otherwise incorrect runtime
results of 64-bit MO_Cmpxchg will appear in 32-bit unregisterised
builds, which go unnoticed at compile-time due to C implicit casting
in .hc files.

(cherry picked from commit 9fa545722f9151781344446dd5501db38cb90dd1)

- - - - -
b821cdbd by Sylvain Henry at 2023-03-02T10:16:55-05:00
JS: fix for overlap with copyMutableByteArray# (#23033)

The code wasn't taking into account some kind of overlap.

cgrun070 has been extended to test the missing case.

(cherry picked from commit 8b77f9bfceb456115f63349ad0ff66a5cea7ab59)

- - - - -
20dfcbed by Simon Peyton Jones at 2023-03-02T10:18:26-05:00
Account for local rules in specImports

As #23024 showed, in GHC.Core.Opt.Specialise.specImports, we were
generating specialisations (a locally-define function) for imported
functions; and then generating specialisations for those
locally-defined functions.  The RULE for the latter should be
attached to the local Id, not put in the rules-for-imported-ids
set.

Fix is easy; similar to what happens in GHC.HsToCore.addExportFlagsAndRules

(cherry picked from commit 0c200ab78c814cb5d1efaf426f0d3d91ceab9f4d)

- - - - -
5451b48c by Simon Peyton Jones at 2023-03-02T10:21:25-05:00
Fix shadowing bug in prepareAlts

As #23012 showed, GHC.Core.Opt.Simplify.Utils.prepareAlts was
using an OutType to construct an InAlt.  When shadowing is in play,
this is outright wrong.

See Note [Shadowing in prepareAlts].

(cherry picked from commit ece092d07f343dcfb4563e4f42d53a2a1e449f1a)

- - - - -
b73b70bf by Simon Peyton Jones at 2023-03-02T10:31:49-05:00
Take more care with unlifted bindings in the specialiser

As #22998 showed, we were floating an unlifted binding to top
level, which breaks a Core invariant.

The fix is easy, albeit a little bit conservative.  See
Note [Care with unlifted bindings] in GHC.Core.Opt.Specialise

(cherry picked from commit 7192ef91c855e1fae6997f75cfde76aafd0b4bcf)

- - - - -
0a0e22f5 by Ben Gamari at 2023-03-02T10:33:54-05:00
rts: Statically assert alignment of Capability

In #22965 we noticed that changes in the size of `Capability` can result
in unsound behavior due to the `align` pragma claiming an alignment
which we don't in practice observe. Avoid this by statically asserting
that the size is a multiple of the alignment.

(cherry picked from commit 485ccddacff5ed8892348905754c02452ac8f523)

- - - - -
72087b1d by Ben Gamari at 2023-03-02T12:31:12-05:00
rts: Introduce stgMallocAlignedBytes

(cherry picked from commit eeb5bd560942a4968980fb341d9ebca33ad3302b)

- - - - -
ac7bbf64 by Ben Gamari at 2023-03-02T12:31:12-05:00
rts: Correctly align Capability allocations

Previously we failed to tell the C allocator that `Capability`s needed
to be aligned, resulting in #22965.

Fixes #22965.
Fixes #22975.

(cherry picked from commit 2cca72cd3e4de25fa81dc6fcc9979e613697a838)

- - - - -
4bda8c6c by Ben Gamari at 2023-03-02T12:31:12-05:00
rts: Drop no-alignment special case for Windows

For reasons that aren't clear, we were previously not giving Capability
the same favorable alignment on Windows that we provided on other
platforms. Fix this.

(cherry picked from commit 05c5b14c5e28c279de0d84472526eccb7f05d00a)

- - - - -
cbdc5d51 by Ben Gamari at 2023-03-02T12:31:12-05:00
nativeGen: Disable asm-shortcutting on Darwin

Asm-shortcutting may produce relative references to symbols defined in
other compilation units. This is not something that MachO relocations
support (see #21972). For this reason we disable the optimisation on
Darwin. We do so without a warning since this flag is enabled by `-O2`.

Another way to address this issue would be to rather implement a
PLT-relocatable jump-table strategy. However, this would only benefit
Darwin and does not seem worth the effort.

Closes #21972.

(cherry picked from commit 8bed166bb79445f90015757fd5baac69a7b835df)

- - - - -
fbc98e66 by Ben Gamari at 2023-03-02T12:31:12-05:00
docs/relnotes: Mention -fprefer-byte-code

Closes #23027.

- - - - -


30 changed files:

- compiler/GHC/CmmToAsm.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- docs/users_guide/9.6.1-notes.rst
- docs/users_guide/using-optimisation.rst
- libraries/base/GHC/List.hs
- libraries/ghc-prim/cbits/atomic.c
- rts/Capability.c
- rts/Capability.h
- rts/RtsUtils.c
- rts/RtsUtils.h
- rts/include/stg/Prim.h
- rts/js/mem.js
- testsuite/tests/codeGen/should_run/CopySmallArray.hs
- testsuite/tests/codeGen/should_run/CopySmallArray.stdout
- testsuite/tests/codeGen/should_run/cgrun070.hs
- testsuite/tests/codeGen/should_run/cgrun070.stdout
- + testsuite/tests/patsyn/should_compile/T23038.hs
- + testsuite/tests/patsyn/should_compile/T23038.stderr
- testsuite/tests/patsyn/should_compile/all.T
- testsuite/tests/perf/should_run/T18964.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/feccc865db4645d02c6326cb9363df8441525950...fbc98e66077b933b634bf86a8d4a739ef10ea232

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/feccc865db4645d02c6326cb9363df8441525950...fbc98e66077b933b634bf86a8d4a739ef10ea232
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/20230303/593ae2b7/attachment-0001.html>


More information about the ghc-commits mailing list