summaryrefslogtreecommitdiff
path: root/rts/sm
Commit message (Collapse)AuthorAgeFilesLines
* nonmoving: Don't push if nonmoving collector isn't enabledBen Gamari2023-03-081-1/+1
|
* nonmoving: Avoid n_caps raceBen Gamari2023-03-081-4/+4
|
* nonmoving: Post-sweep sanity checkingBen Gamari2023-03-081-1/+13
|
* nonmoving: Add missing write barriers in selector optimisationBen Gamari2023-03-082-6/+62
| | | | | | | This fixes the selector optimisation, adding a few write barriers which are necessary for soundness. See the inline comments for details. Fixes #22930.
* nonmoving: Don't clobber update rem sets of old capabilitiesBen Gamari2023-03-081-1/+1
| | | | | | | | | 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.
* nonmoving: Handle new closures in nonmovingIsNowAliveBen Gamari2023-03-082-8/+18
| | | | | We must conservatively assume that new closures are reachable since we are not guaranteed to mark such blocks.
* nonmoving: Assert state of swept segmentsBen Gamari2023-03-082-0/+3
|
* nonmoving: Fix tracking of FILLED_SWEEPING segmentsBen Gamari2023-03-081-1/+1
| | | | | Previously we only updated the state of the segment at the head of each allocator's filled list.
* nonmoving: Don't show occupancy if we didn't collect live wordsBen Gamari2023-03-083-17/+41
|
* nonmoving: Sanity check mutable listBen Gamari2023-03-081-0/+1
| | | | | Assert that entries in the nonmoving generation's generational remembered set (a.k.a. mutable list) live in nonmoving generation.
* nonmoving: Sanity check nonmoving large objects and compactsBen Gamari2023-03-081-0/+5
|
* nonmoving: Fix handling of weak pointersBen Gamari2023-03-085-79/+161
| | | | | | | | | | | | | 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.
* nonmoving: Add missing no-op in busy-wait loopBen Gamari2023-03-081-2/+5
|
* nonmoving: Clarify commentBen Gamari2023-03-081-1/+1
|
* nonmoving: Clarify implementationBen Gamari2023-03-081-10/+11
| | | | This makes the intent of this implementation a bit clearer.
* Evac: Squash data race in eval_selector_chainBen Gamari2023-03-081-2/+3
|
* rts/Sanity: Look at nonmoving saved_filled listsBen Gamari2023-03-081-0/+2
|
* rts/Sanity: Mark pinned_object_blocksBen Gamari2023-03-081-0/+1
|
* rts/BlockAlloc: Allow disabling of internal assertionsBen Gamari2023-03-081-6/+16
| | | | | These can be quite expensive and it is sometimes useful to compile a DEBUG RTS without them.
* nonmoving: Deduplicate assertionBen Gamari2023-03-081-2/+9
|
* nonmoving: Fix styleBen Gamari2023-03-081-2/+3
|
* rts: add the rts_clearMemory functionCheng Shao2023-02-156-4/+71
| | | | | | | This patch adds the rts_clearMemory function that does its best to zero out unused RTS memory for a wasm backend use case. See the comment above rts_clearMemory() prototype declaration for more detailed explanation. Closes #22920.
* rts: make it possible to change mblock size on 32-bit targetsCheng Shao2023-02-143-3/+9
| | | | | | | | The MBLOCK_SHIFT macro must be the single source of truth for defining the mblock size, and changing it should only affect performance, not correctness. This patch makes it truly possible to reconfigure mblock size, at least on 32-bit targets, by fixing places which implicitly relied on the previous MBLOCK_SHIFT constant. Fixes #22901.
* rts: Fix C++ compilation issuesBen Gamari2023-01-271-2/+2
| | | | | Make the RTS compilable with a C++ compiler by inserting necessary casts.
* Only gc sparks locally when we can ensure marking is done.Andreas Klebinger2023-01-121-10/+11
| | | | | | | | When performing GC without work stealing there was no guarantee that spark pruning was happening after marking of the sparks. This could cause us to GC live sparks under certain circumstances. Fixes #22528.
* rts: Drop racy assertionBen Gamari2023-01-121-0/+3
| | | | | | | 0e274c39bf836d5bb846f5fa08649c75f85326ac added an assertion in `dirty_MUT_VAR` checking that the MUT_VAR being dirtied was clean. However, this isn't necessarily the case since another thread may have raced us to dirty the object.
* Revert "rts: Drop racy assertion"Ben Gamari2023-01-121-3/+0
| | | | | | | The logic here was inverted. Reverting the commit to avoid confusion when examining the commit history. This reverts commit b3eacd64fb36724ed6c5d2d24a81211a161abef1.
* rts, tests: limit thread name length to 15 bytesNicolas Trangez2023-01-091-1/+1
| | | | | | | | | | | | | On Linux, `pthread_setname_np` (or rather, the kernel) only allows for thread names up to 16 bytes, including the terminating null byte. This commit adds a note pointing this out in `createOSThread`, and fixes up two instances where a thread name of more than 15 characters long was used (in the RTS, and in a test-case). Fixes: #22366 Fixes: https://gitlab.haskell.org/ghc/ghc/-/issues/22366 See: https://gitlab.haskell.org/ghc/ghc/-/issues/22366#note_460796
* nonmoving: Make free list counter accesses atomicBen Gamari2022-12-231-1/+1
| | | | Since these may race with the allocator(s).
* nonmoving: Fix race in shortcuttingBen Gamari2022-12-231-1/+2
| | | | | We must use an acquire load to read the info table pointer since if we find an indirection we must be certain that we see the indirectee.
* nonmoving: Fix benign race in update remembered set checkBen Gamari2022-12-231-1/+3
| | | | | Relaxed load is fine here since we will take the lock before looking at the list.
* nonmoving: Make bitmap accesses atomicBen Gamari2022-12-231-2/+2
| | | | | | This is a benign race on any sensible hard since these are byte accesses. Nevertheless, atomic accesses are necessary to satisfy TSAN.
* nonmoving: Ensure that we aren't holding locks when closing themBen Gamari2022-12-231-1/+4
| | | | TSAN complains about this sort of thing.
* nonmoving: Refactor update remembered set initializationBen Gamari2022-12-235-34/+66
| | | | | | | This avoids a lock inversion between the storage manager mutex and the stable pointer table mutex by not dropping the SM_MUTEX in nonmovingCollect. This requires quite a bit of rejiggering but it does seem like a better strategy.
* nonmoving: Make segment state updates atomicBen Gamari2022-12-231-1/+1
|
* nonmoving: Fix races in collector status trackingBen Gamari2022-12-232-7/+10
| | | | | | Mark a number of accesses to do with tracking of the status of the concurrent collection thread as atomic. No interesting races here, merely necessary to satisfy TSAN.
* nonmoving: Ensure that mutable fields have acquire barrierBen Gamari2022-12-231-8/+16
|
* nonmoving: Eliminate race in bump_static_flagBen Gamari2022-12-231-8/+10
| | | | | | | To ensure that we don't race with a mutator entering a new CAF we take the SM mutex before touching static_flag. The other option here would be to instead modify newCAF to use a CAS but the present approach is a bit safer.
* nonmoving: Use atomic when looking at bd->genBen Gamari2022-12-231-1/+4
| | | | Since it may have been mutated by a moving GC.
* nonmoving: Fix segment list racesBen Gamari2022-12-232-6/+12
|
* nonmoving: Fix race in marking of blackholesBen Gamari2022-12-231-2/+6
| | | | | We must use an acquire-fence when marking to ensure that the indirectee is visible.
* rts: Drop racy assertionBen Gamari2022-12-181-0/+3
| | | | | | | 0e274c39bf836d5bb846f5fa08649c75f85326ac added an assertion in `dirty_MUT_VAR` checking that the MUT_VAR being dirtied was clean. However, this isn't necessarily the case since another thread may have raced us to dirty the object.
* rts: Style fixBen Gamari2022-12-161-6/+3
|
* rts: Encapsulate sched_stateBen Gamari2022-12-161-3/+3
|
* rts: Encapsulate access to capabilities arrayBen Gamari2022-12-168-64/+64
|
* rts: Introduce getNumCapabilitiesBen Gamari2022-12-169-68/+68
| | | | | | And ensure accesses to n_capabilities are atomic (although with relaxed ordering). This is necessary as RTS API callers may concurrently call into the RTS without holding a capability.
* Improve heap memory barrier NoteBen Gamari2022-12-161-2/+2
| | | | | Also introduce MUT_FIELD marker in Closures.h to document mutable fields.
* Remove the now-unused markSchedulerDuncan Coutts2022-11-223-7/+0
| | | | | The global vars {blocked,sleeping}_queue are now in the Capability and so get marked there via markCapabilityIOManager.
* rts: make flushExec a no-op on wasm32Cheng Shao2022-11-111-0/+1
| | | | | This patch makes flushExec a no-op on wasm32, since there's no such thing as executable memory on wasm32 in the first place.
* rts: don't return memory to OS on wasm32Cheng Shao2022-11-112-0/+8
| | | | | | This patch makes the storage manager not return any memory on wasm32. The detailed reason is described in Note [Megablock allocator on wasm].