[Git][ghc/ghc][ghc-9.6] 44 commits: nonmoving: Fix style

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Sun May 21 18:10:34 UTC 2023



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


Commits:
14414247 by Ben Gamari at 2023-05-18T16:00:10-04:00
nonmoving: Fix style

(cherry picked from commit abb6070f488120aef113b686e91b439fe6c3d272)

- - - - -
4200590a by Ben Gamari at 2023-05-18T16:00:10-04:00
nonmoving: Deduplicate assertion

(cherry picked from commit be2789014b208db5c471ab187e7dba2ebc59f8c8)

- - - - -
80208941 by Ben Gamari at 2023-05-18T16:00:10-04:00
rts: Fix type issues in Sparks.h

Adds explicit casts to satisfy a C++ compiler.

(cherry picked from commit b90346392f5455bc4a6f6d86700296babc429a98)

- - - - -
0a25b9df by Ben Gamari at 2023-05-18T16:00:10-04:00
rts: Use release ordering when storing thread labels

Since this makes the ByteArray# visible from other cores.

(cherry picked from commit da7b2b941d235a284d5685829c235a9e671a0336)

- - - - -
a70c277a by Ben Gamari at 2023-05-18T16:00:10-04:00
rts/BlockAlloc: Allow disabling of internal assertions

These can be quite expensive and it is sometimes useful to compile a
DEBUG RTS without them.

(cherry picked from commit 5b7f65767fbc2967e01a13ee580598e976f5d225)

- - - - -
b4e5489f by Ben Gamari at 2023-05-18T16:00:10-04:00
rts/Sanity: Mark pinned_object_blocks

(cherry picked from commit 6283144fb2e98f4c774950567e55575c1747d136)

- - - - -
2ab18a83 by Ben Gamari at 2023-05-18T16:00:11-04:00
rts/Sanity: Look at nonmoving saved_filled lists

(cherry picked from commit 9b52840412c920a1a1eed26df37262bc6c82c171)

- - - - -
556c2544 by Ben Gamari at 2023-05-18T16:00:11-04:00
Evac: Squash data race in eval_selector_chain

(cherry picked from commit 0edc543834d8172e54020c5272af1cf2d0b3437c)

- - - - -
4023f814 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Clarify implementation

This makes the intent of this implementation a bit clearer.

(cherry picked from commit 7eab831a7d17eda3108da4702a447656cd62334c)

- - - - -
88cc3f94 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Clarify comment

(cherry picked from commit 532262b95b2eaa685a22279a8e54cc2e379e21ef)

- - - - -
f5a48ce6 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Add missing no-op in busy-wait loop

(cherry picked from commit bd9cd84bbbb51f21c7b2b478e1f5971e2659b9fd)

- - - - -
5c4aa7e2 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Don't push empty arrays to update remembered set

Previously the write barrier of resizeSmallArray# incorrectly handled
resizing of zero-sized arrays, pushing an invalid pointer to the update
remembered set.

Fixes #22931.

(cherry picked from commit c4e6bfc801a79b73e94d363db1d3e65076e17981)

- - - - -
661da5ee by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Fix handling of weak pointers

This fixes an interaction between aging and weak pointer handling which
prevented the finalization of some weak pointers. In particular, weak
pointers could have their keys incorrectly marked by the preparatory
collector, preventing their finalization by the subsequent concurrent
collection.

While in the area, we also significantly improve the assertions
regarding weak pointers.

Fixes #22327.

(cherry picked from commit 92227b6022b35d87f6366c75e09ed495b7c3603e)

- - - - -
568b2523 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Sanity check nonmoving large objects and compacts

(cherry picked from commit ba7e7972ae14848a9ac41d5c6200d0aa5727ed72)

- - - - -
ce560ce4 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Sanity check mutable list

Assert that entries in the nonmoving generation's generational
remembered set (a.k.a. mutable list) live in nonmoving generation.

(cherry picked from commit 71b038a1261754c38cf984f7c578621c3217c3bf)

- - - - -
a01dc8ab by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Don't show occupancy if we didn't collect live words

(cherry picked from commit 99d144d56598965daba30aa73e6c598b3245bb0f)

- - - - -
762f6ae1 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Fix tracking of FILLED_SWEEPING segments

Previously we only updated the state of the segment at the head of each
allocator's filled list.

(cherry picked from commit 81d6cc551c7a843002495d3ffd2373ad00a52766)

- - - - -
395b8572 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Assert state of swept segments

(cherry picked from commit 58e53bc4d33dad76b3250997f1a8300d0041f387)

- - - - -
6208cbae by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Handle new closures in nonmovingIsNowAlive

We must conservatively assume that new closures are reachable since we
are not guaranteed to mark such blocks.

(cherry picked from commit 2db92e015655e7fc22e559020572bf23233ffaae)

- - - - -
471b5fdc by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Don't clobber update rem sets of old capabilities

Previously `storageAddCapabilities` (called by `setNumCapabilities`) would
clobber the update remembered sets of existing capabilities when
increasing the capability count. Fix this by only initializing the
update remembered sets of the newly-created capabilities.

Fixes #22927.

(cherry picked from commit e4c3249f00a406a406b6f1190ca8be628b643042)

- - - - -
229ae7e4 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Add missing write barriers in selector optimisation

This fixes the selector optimisation, adding a few write barriers which
are necessary for soundness. See the inline comments for details.

Fixes #22930.

(cherry picked from commit 1b06967176559d6b2b530dd16e127fa4479ae47f)

- - - - -
8f39f2b3 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Post-sweep sanity checking

(cherry picked from commit d4032690a8bf638f6d134cc6592d138eb018f102)

- - - - -
6a25c84f by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Avoid n_caps race

(cherry picked from commit 0baa8752aaefe80ca428fbfa0cbd4e620d67e1a7)

- - - - -
7213e435 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Don't push if nonmoving collector isn't enabled

(cherry picked from commit 5d3232baa78dd6f00fc040f75d8e9a8075bfbc07)

- - - - -
251e2b4a by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Be more paranoid in segment tracking

Previously we left various segment link pointers dangling. None of this
wrong per se, but it did make it harder than necessary to debug.

(cherry picked from commit 0a7eb0aa0bf7e7464e68ab9b6f4176771dcc3590)

- - - - -
81fb5149 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Sync-phase mark budgeting

Here we significantly improve the bound on sync phase pause times by
imposing a limit on the amount of work that we can perform during the
sync. If we find that we have exceeded our marking budget then we allow
the mutators to resume, return to concurrent marking, and try
synchronizing again later.

Fixes #22929.

(cherry picked from commit 7c817c0a4ab857e03d09526a481f63e313598c5b)

- - - - -
d8ad8043 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Allow pinned gen0 objects to be WEAK keys

(cherry picked from commit ce22a3e2f2e8168f80d77807d79214e1cfbccb44)

- - - - -
d6deed34 by Ben Gamari at 2023-05-18T16:00:11-04:00
rts: Reenable assertion

(cherry picked from commit 78746906d133765a9a4219eb34ed01e78f31344c)

- - - - -
d6826083 by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Move current segment array into Capability

The current segments are conceptually owned by the mutator, not the
collector. Consequently, it was quite tricky to prove that the mutator
would not race with the collect due to this shared state. It turns out
that such races are possible: when resizing the current segment array
we may concurrently try to take a heap census. This will attempt to walk
the current segment array, causing a data race.

Fix this by moving the current segment array into `Capability`, where it
belongs.

Fixes #22926.

(cherry picked from commit b500867a9eae6381e5c686aaa71ae069398eacb9)

- - - - -
02289f9a by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Fix Note references

Some references to Note [Deadlock detection under the non-moving
collector] were missing an article.

(cherry picked from commit 56e669c11208bba136c44ee7154b59e0d4d39c87)

- - - - -
4b75a239 by Ben Gamari at 2023-05-18T16:00:11-04:00
rts/Sanity: Fix block count assertion with non-moving collector

The nonmoving collector does not use `oldest_gen->blocks` to track its
block list. However, it nevertheless updates `oldest_gen->n_blocks` to
ensure that its size is accounted for by the storage manager.
Consequently, we must not attempt to assert consistency between the two.

(cherry picked from commit 4a7650d75752fcde2fc5bc23913e4116ae2ec582)

- - - - -
4275ccfb by Ben Gamari at 2023-05-18T16:00:11-04:00
nonmoving: Don't call prepareUnloadCheck

When the nonmoving GC is in use we do not call `checkUnload` (since we
don't unload code) and therefore should not call `prepareUnloadCheck`,
lest we run into assertions.

(cherry picked from commit 96a5aaede899f95fb06dcdb9d0439bbea0f93e14)

- - - - -
873df322 by Ben Gamari at 2023-05-18T16:00:11-04:00
rts: Encapsulate block allocator spinlock

This makes it a bit easier to add instrumentation on this spinlock
while debugging.

(cherry picked from commit 6c6674cafefbb72f1b9c5b8a005fc62f905c50ea)

- - - - -
8805864d by Ben Gamari at 2023-05-18T16:00:11-04:00
testsuite: Skip some tests when sanity checking is enabled

(cherry picked from commit e84f716798e0d3431aa7ec42b243dc0998cb6444)

- - - - -
f01df851 by Ben Gamari at 2023-05-18T16:00:12-04:00
nonmoving: Fix unregisterised build

(cherry picked from commit 3ae0f368542b24b2ee2cd102cf65db8db705c83c)

- - - - -
3bc83d81 by Ben Gamari at 2023-05-18T16:00:12-04:00
nonmoving: Ensure that sanity checker accounts for saved_filled segments

(cherry picked from commit 4eb9d06b00043e52be3cf828ccb92f0bb4c9e438)

- - - - -
7c5657fc by Ben Gamari at 2023-05-18T16:00:12-04:00
hadrian: Add +boot_nonmoving_gc flavour transformer

For using GHC bootstrapping to validate the non-moving GC.

(cherry picked from commit f0cf384db038ff3b83770dbf11a89ecd20178899)

- - - - -
04e8de8a by Ben Gamari at 2023-05-18T16:00:12-04:00
nonmoving: Move allocator into new source file

(cherry picked from commit 487a8b580581e8f9b40974cf0e0a4e93f95e8665)

- - - - -
a7716f0b by Ben Gamari at 2023-05-18T16:00:12-04:00
nonmoving: Split out nonmovingAllocateGC

(cherry picked from commit 8f374139f0b5f0a39861a7f9432070f78f9fbba0)

- - - - -
01f2fef1 by Ben Gamari at 2023-05-18T16:00:12-04:00
testsuite: Mark ffi023 as broken due to #23089

(cherry picked from commit f1fd3ffbdccf471c43f3c36d6ecb4bd5da33c097)

- - - - -
db8e4d61 by Ben Gamari at 2023-05-18T16:00:12-04:00
testsuite: Skip T7160 in the nonmoving way

Finalization order is different under the nonmoving collector.

(cherry picked from commit a57f12b3f06afe29cbbc6eb0a887bcbe319f17f6)

- - - - -
75fd54fe by Ben Gamari at 2023-05-18T16:00:12-04:00
rts: Capture GC configuration in a struct

The number of distinct arguments passed to GarbageCollect was getting a
bit out of hand.

(cherry picked from commit f6f12a36346e19de7eed330537350d0b7420764a)

- - - - -
19ad1ae5 by Ben Gamari at 2023-05-18T16:00:12-04:00
nonmoving: Non-concurrent collection

(cherry picked from commit ba73a807edbb444c49e0cf21ab2ce89226a77f2e)

- - - - -
15da0925 by Ben Gamari at 2023-05-18T16:00:12-04:00
gitlab-ci: Add job bootstrapping with nonmoving GC

(cherry picked from commit 581e58ac80f98a9f5292ad13a9a984c2f5a1de21)

- - - - -


30 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- hadrian/src/Flavour.hs
- libraries/ghc-heap/tests/all.T
- rts/Capability.c
- rts/Capability.h
- rts/PrimOps.cmm
- rts/RtsStartup.c
- rts/Schedule.c
- rts/Sparks.h
- rts/ThreadLabels.c
- rts/include/rts/storage/GC.h
- rts/include/rts/storage/MBlock.h
- rts/rts.cabal.in
- rts/sm/BlockAlloc.c
- rts/sm/Evac.c
- rts/sm/GC.c
- rts/sm/GC.h
- rts/sm/GCUtils.c
- rts/sm/GCUtils.h
- rts/sm/HeapAlloc.h
- rts/sm/MarkWeak.c
- rts/sm/NonMoving.c
- rts/sm/NonMoving.h
- + rts/sm/NonMovingAllocate.c
- + rts/sm/NonMovingAllocate.h
- rts/sm/NonMovingCensus.c
- rts/sm/NonMovingCensus.h
- rts/sm/NonMovingMark.c
- rts/sm/NonMovingMark.h


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eaadcaa7ca2b7bb1d4d214339092dd9e6df12a96...15da0925a866aac4c8773daf03d4322c0e21a923

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eaadcaa7ca2b7bb1d4d214339092dd9e6df12a96...15da0925a866aac4c8773daf03d4322c0e21a923
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/20230521/20ef56d5/attachment-0001.html>


More information about the ghc-commits mailing list