[Git][ghc/ghc][ghc-9.8] 10 commits: rts: only collect live words in nonmoving census when non-concurrent

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue Oct 8 17:07:39 UTC 2024



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


Commits:
fede0d99 by Teo Camarasu at 2024-10-04T16:05:22-04:00
rts: only collect live words in nonmoving census when non-concurrent

This avoids segfaults when the mutator modifies closures as we examine
them.

Resolves #24393

(cherry picked from commit 84357d1143fe4f9076253160f78fac6c2acc8e5b)

- - - - -
47182b77 by Andreas Klebinger at 2024-10-04T16:05:22-04:00
Fix ffi callbacks with >6 args and non-64bit args.

Check for ptr/int arguments rather than 64-bit width arguments when counting
integer register arguments.
The old approach broke when we stopped using exclusively W64-sized types to represent
sub-word sized integers.

Fixes #24314

(cherry picked from commit de589554386fc173a9019922851c05bb727e3450)

- - - - -
72c537ce by Teo Camarasu at 2024-10-04T16:05:22-04:00
nonmoving: Add support for heap profiling

Add support for heap profiling while using the nonmoving collector.

We greatly simply the implementation by disabling concurrent collection for
GCs when heap profiling is enabled. This entails that the marked objects on
the nonmoving heap are exactly the live objects.

Note that we match the behaviour for live bytes accounting by taking the size
of objects on the nonmoving heap to be that of the segment's block
rather than the object itself.

Resolves #22221

(cherry picked from commit bedb4f0de102936099bda4e995cc83f1c344366c)

- - - - -
b2712f69 by Teo Camarasu at 2024-10-04T16:05:22-04:00
docs: move -xn flag beside --nonmoving-gc

It makes sense to have these beside each other as they are aliases.

(cherry picked from commit 98166389e166d4ab7cc2ddbc044261e508859de1)

- - - - -
60f97ccb by Teo Camarasu at 2024-10-04T16:05:22-04:00
nonmoving: introduce a family of dense allocators

Supplement the existing power 2 sized nonmoving allocators with a family
of dense allocators up to a configurable threshold.

This should reduce waste from rounding up block sizes while keeping the
amount of allocator sizes manageable.

This patch:
  - Adds a new configuration option `--nonmoving-dense-allocator-count`
    to control the amount of these new dense allocators.
  - Adds some constants to `NonmovingAllocator` in order to keep
    marking fast with the new allocators.

Resolves #23340

(cherry picked from commit f830d5a34c4c972cced73b6dc25954cedf336747)
(cherry picked from commit 47e02c2ae0ea4713a2f22edf21b9a4eb5fe635be)

- - - - -
8031ebaa by Teo Camarasu at 2024-10-04T16:05:22-04:00
rts: use live words to estimate heap size

We use live words rather than live blocks to determine the size of the
heap for determining memory retention.

Most of the time these two metrics align, but they can come apart in
normal usage when using the nonmoving collector.

The nonmoving collector leads to a lot of partially occupied blocks. So,
using live words is more accurate.

They can also come apart when the heap is suffering from high levels
fragmentation caused by small pinned objects, but in this case, the
block size is the more accurate metric. Since this case is best avoided
anyway. It is ok to accept the trade-off that we might try (and
probably) fail to return more memory in this case.

See also the Note [Statistics for retaining memory]

Resolves #23397

(cherry picked from commit 35ef8dc83428f5405e092b12eb8cfc440b6504d8)
(cherry picked from commit 7991656954a2ba7d66fd75a8202af7d86327f279)

- - - - -
c71191f7 by Ben Gamari at 2024-10-04T16:05:22-04:00
Add changelog entry for #23340

(cherry picked from commit 2b07bf2e8bcb24520fe78b469c3550b9f4099526)

- - - - -
3ff6bbbe by Simon Peyton Jones at 2024-10-04T16:05:22-04:00
Update the unification count in wrapUnifierX

Omitting this caused type inference to fail in #24146.
This was an accidental omision in my refactoring of the
equality solver.

- - - - -
7e5f2ac0 by Fendor at 2024-10-04T16:05:22-04:00
Escape multiple arguments in the settings file

Uses responseFile syntax.

The issue arises when GHC is installed on windows into a location that
has a space, for example the user name is 'Fake User'.
The $topdir will also contain a space, consequentially.
When we resolve the top dir in the string `-I$topdir/mingw/include`,
then `words` will turn this single argument into `-I/C/Users/Fake` and
`User/.../mingw/include` which trips up the flag argument parser of
various tools such as gcc or clang.
We avoid this by escaping the $topdir before replacing it in
`initSettngs`.
Additionally, we allow to escape spaces and quotation marks for
arguments in `settings` file.

Add regression test case to count the number of options after variable
expansion and argument escaping took place.
Additionally, we check that escaped spaces and double quotation marks are
correctly parsed.

(cherry picked from commit 31bf85ee49fe2ca0b17eaee0774e395f017a9373)
(cherry picked from commit d74ffbbb93cb377e64c557f777089b81710ef873)

- - - - -
3d90849d by Ben Gamari at 2024-10-04T16:05:44-04:00
Accept performance shifts

The metrics of MultiLayerModulesTH_Make are remarkably unstable but
bizarrely only on Darwin.

Metric Decrease:
    MultiLayerModulesTH_Make

- - - - -


30 changed files:

- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/Tc/Solver/Monad.hs
- docs/users_guide/9.8.3-notes.rst
- docs/users_guide/eventlog-formats.rst
- docs/users_guide/runtime_control.rst
- hadrian/src/Rules/Generate.hs
- rts/Capability.h
- rts/ProfHeap.c
- rts/RtsFlags.c
- rts/Trace.c
- rts/Trace.h
- rts/eventlog/EventLog.c
- rts/eventlog/EventLog.h
- rts/gen_event_types.py
- rts/include/rts/Flags.h
- rts/include/rts/storage/Block.h
- rts/sm/GC.c
- rts/sm/NonMoving.c
- rts/sm/NonMoving.h
- rts/sm/NonMovingAllocate.c
- rts/sm/NonMovingCensus.c
- rts/sm/Sanity.c
- rts/sm/Storage.c
- rts/sm/Storage.h
- + testsuite/tests/ffi/should_run/T24314.hs
- + testsuite/tests/ffi/should_run/T24314.stdout
- + testsuite/tests/ffi/should_run/T24314_c.c
- testsuite/tests/ffi/should_run/all.T
- + testsuite/tests/ghc-api/settings-escape/T11938.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6bd62051db8abee470e4b5481a6a110c319d21cc...3d90849d00871853c68dbb7b9b4e97349a999459

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6bd62051db8abee470e4b5481a6a110c319d21cc...3d90849d00871853c68dbb7b9b4e97349a999459
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/20241008/771f008e/attachment-0001.html>


More information about the ghc-commits mailing list