summaryrefslogtreecommitdiff
path: root/rts
Commit message (Collapse)AuthorAgeFilesLines
...
* rts: Break up census logicBen Gamari2021-01-071-176/+187
| | | | | Move the logic for taking censuses of "normal" and pinned blocks to their own functions.
* Maintain invariant: MVars on mut_list are dirtyViktor Dukhovni2021-01-032-0/+3
| | | | | | | | | | | | The fix for 18919 was somewhat incomplete: while the MVars were correctly added to the mut_list via dirty_MVAR(), their info table remained "clean". While this is mostly harmless in non-debug builds, but trips an assertion in the debug build, and may result in the MVar being needlessly being added to the mut_list multiple times. Resolves: #19145
* rts: update usage text for new -A defaultDouglas Wilson2021-01-021-1/+1
|
* rts/Messages: Relax locked-closure assertionBen Gamari2021-01-021-2/+3
| | | | | | | In general we are less careful about locking closures when running with only a single capability. Fixes #19075.
* spelling: thead -> threadDouglas Wilson2020-12-232-3/+3
|
* Increase -A default to 4MB.Andreas Klebinger2020-12-221-2/+3
| | | | | | | | | | | This gives a small increase in performance under most circumstances. For single threaded GC the improvement is on the order of 1-2%. For multi threaded GC the results are quite noisy but seem to fall into the same ballpark. Fixes #16499
* nonmoving: Add comments to nonmovingResurrectThreadsGHC GitLab CI2020-12-201-0/+5
|
* nonmoving: Don't push objects during deadlock detect GCBen Gamari2020-12-201-2/+6
| | | | | | Previously we would push large objects and compact regions to the mark queue during the deadlock detect GC, resulting in failure to detect deadlocks.
* nonmoving: Refactor alloc_for_copyGHC GitLab CI2020-12-201-48/+79
| | | | Pull the cold non-moving allocation path out of alloc_for_copy.
* nonmoving: Ensure deadlock detection promotion worksGHC GitLab CI2020-12-201-18/+22
| | | | | | Previously the deadlock-detection promotion logic in alloc_for_copy was just plain wrong: it failed to fire when gct->evac_gen_no != oldest_gen->gen_no. The fix is simple: move the
* nonmoving: Assert deadlock-gc promotion invariantGHC GitLab CI2020-12-201-0/+8
| | | | | When performing a deadlock-detection GC we must ensure that all objects end up in the non-moving generation. Assert this in scavenge.
* nonmoving: Fix small CPP bugBen Gamari2020-12-201-1/+3
| | | | | Previously an incorrect semicolon meant that we would fail to call busy_wait_nop when spinning.
* rts: enable thread label table in all RTS flavours #17972Adam Sandberg Ericsson2020-12-205-17/+4
|
* rts: Use weaker cas in WSDequeDouglas Wilson2020-12-191-1/+2
| | | | | | | | The algorithm described in the referenced paper uses this slightly weaker atomic op. This is the first "exotic" cas we're using. I've added a macro in the <ORDERING>_OP style to match existing ones.
* rts: Fix typo in macro nameBen Gamari2020-12-181-1/+1
| | | | | THREADED_RTS was previously misspelled as THREADEDED_RTS. Fixes #19057.
* Rts/elf-linker: Upcast to 64bit to satisfy format string.Andreas Klebinger2020-12-181-2/+2
| | | | | The elf size is 32bit on 32bit builds and 64 otherwise. We just upcast to 64bits before printing now.
* rts: EventLog.c: Properly cast (potential) 32bit pointers to uint64_tAndreas Klebinger2020-12-181-2/+3
|
* OSMem.c: Use proper type for mbinds mask argument.Andreas Klebinger2020-12-181-1/+1
| | | | | StgWord has different widths on 32/64bit. So use the proper type instead.
* rts: don't use siginterrupt (#19019)Sylvain Henry2020-12-111-5/+1
|
* users guide: Describe GC lifecycle eventsBen Gamari2020-12-111-1/+1
| | | | | | Every time I am asked about how to interpret these events I need to figure it out from scratch. It's well past time that the users guide properly documents these.
* rts/linker/Elf.c: add missing <dlfcn.h> include (musl support)Sergei Trofimovich2020-12-101-0/+3
| | | | | | | | | | | | | | The change fixes build failure on musl: ``` rts/linker/Elf.c:2031:3: error: warning: implicit declaration of function 'dlclose'; did you mean 'close'? [-Wimplicit-function-declaration] 2031 | dlclose(nc->dlopen_handle); | ^~~~~~~ | close ``` Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* rts/linker: Use m32 to allocate symbol extras in PEi386Ben Gamari2020-12-014-33/+20
|
* rts/m32: Introduce NEEDS_M32 macroBen Gamari2020-12-015-27/+32
| | | | Instead of relying on RTS_LINKER_USE_MMAP
* rts/Linker: Introduce Windows implementations for mmapForLinker, et al.Ben Gamari2020-12-011-1/+32
|
* rts/linker: Introduce munmapForLinkerBen Gamari2020-12-017-30/+22
| | | | Consolidates munmap calls to ensure consistent error handling.
* rts: Introduce mmapAnonForLinkerBen Gamari2020-12-018-26/+41
| | | | | | | | Previously most of the uses of mmapForLinker were mapping anonymous memory, resulting in a great deal of unnecessary repetition. Factor this out into a new helper. Also fixes a few places where error checking was missing or suboptimal.
* rts/linker: Don't declare dynamic objects with image_mappedGHC GitLab CI2020-11-301-1/+1
| | | | This previously resulted in warnings due to spurious unmap failures.
* rts/linker: Move shared library loading logic into Elf.cBen Gamari2020-11-305-184/+197
|
* rts/linker: Initialise CCSs from native shared objectsBen Gamari2020-11-302-1/+7
|
* rts/linker: Don't allow shared libraries to be loaded multiple timesBen Gamari2020-11-301-0/+9
|
* dirty MVAR after mutating TSO queue headViktor Dukhovni2020-11-302-15/+28
| | | | | | | | | While the original head and tail of the TSO queue may be in the same generation as the MVAR, interior elements of the queue could be younger after a GC run and may then be exposed by putMVar operation that updates the queue head. Resolves #18919
* rts/linker: Replace some ASSERTs with CHECKBen Gamari2020-11-305-38/+35
| | | | | | | | In the past some people have confused ASSERT, which is for checking internal invariants, which CHECK, which should be used when checking things that might fail due to bad input (and therefore should be enabled even in the release compiler). Change some of these cases in the linker to use CHECK.
* rts: Use CHECK instead of assertBen Gamari2020-11-302-30/+28
| | | | Use the GHC wrappers instead of <assert.h>.
* rts/m32: Refactor handling of allocator seedingBen Gamari2020-11-301-25/+36
| | | | | | | | | | | | | | | | | | | | | | | | Previously, in an attempt to reduce fragmentation, each new allocator would map a region of M32_MAX_PAGES fresh pages to seed itself. However, this ends up being extremely wasteful since it turns out that we often use fewer than this. Consequently, these pages end up getting freed which, ends up fragmenting our address space more than than we would have if we had naively allocated pages on-demand. Here we refactor m32 to avoid this waste while achieving the fragmentation mitigation previously desired. In particular, we move all page allocation into the global m32_alloc_page, which will pull a page from the free page pool. If the free page pool is empty we then refill it by allocating a region of M32_MAP_PAGES and adding them to the pool. Furthermore, we do away with the initial seeding entirely. That is, the allocator starts with no active pages: pages are rather allocated on an as-needed basis. On the whole this ends up being a pleasingly simple change, simultaneously making m32 more efficient, more robust, and simpler. Fixes #18980.
* nonmoving: Ensure that evacuated large objects are markedGHC GitLab CI2020-11-292-7/+60
| | | | See Note [Non-moving GC: Marking evacuated objects].
* nonmoving: Add reference to Ueno 2016Ben Gamari2020-11-291-2/+7
|
* nonmoving: Don't join to mark_thread on shutdownGHC GitLab CI2020-11-291-1/+0
| | | | The mark thread is not joinable as we detach from it on creation.
* OSThreads: Fix error code checkingGHC GitLab CI2020-11-291-2/+3
| | | | pthread_join returns its error code and apparently doesn't set errno.
* Updates: Don't zero slop until closure has been pushedGHC GitLab CI2020-11-291-1/+1
| | | | | Ensure that the the free variables have been pushed to the update remembered set before we zero the slop.
* nonmoving: Add missing write barrier in shrinkSmallByteArrayGHC GitLab CI2020-11-291-0/+15
|
* rts/Messages: Add missing write barrier in THROWTO message updateGHC GitLab CI2020-11-293-6/+14
| | | | | | After a THROWTO message has been handle the message closure is overwritten by a NULL message. We must ensure that the original closure's pointers continue to be visible to the nonmoving GC.
* nonmoving: Fix regression from TSAN workGHC GitLab CI2020-11-291-7/+2
| | | | | | | The TSAN rework (specifically aad1f803) introduced a subtle regression in GC.c, swapping `g0` in place of `gen`. Whoops! Fixes #18997.
* ThreadPaused: Don't zero slop until free vars are pushedGHC GitLab CI2020-11-291-6/+7
| | | | | | | | When threadPaused blackholes a thunk it calls `OVERWRITING_CLOSURE` to zero the slop for the benefit of the sanity checker. Previously this was done *before* pushing the thunk's free variables to the update remembered set. Consequently we would pull zero'd pointers to the update remembered set.
* ghc-heap: partial TSO/STACK decodingDavid Eichmann2020-11-282-3/+22
| | | | | | Co-authored-by: Sven Tennie <sven.tennie@gmail.com> Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com> Co-authored-by: Ben Gamari <bgamari.foss@gmail.com>
* rts: Allocate MBlocks with MAP_TOP_DOWN on WindowsBen Gamari2020-11-271-1/+4
| | | | | | | As noted in #18991, we would previously allocate heap in low memory. Due to this the linker, which typically *needs* low memory, would end up competing with the heap. In longer builds we end up running out of low memory entirely, leading to linking failures.
* RTS: Fix failed inlining of copy_tag.Andreas Klebinger2020-11-261-7/+12
| | | | | | | | | | | | | | | On windows using gcc-10 gcc failed to inline copy_tag into evacuate. To fix this we now set the always_inline attribute for the various copy* functions in Evac.c. The main motivation here is not the overhead of the function call, but rather that this allows the code to "specialize" for the size of the closure we copy which is often known at compile time. An earlier commit also tried to avoid evacuate_large inlining. But didn't quite succeed. So I also marked evacuate_large as noinline. Fixes #12416
* [Sized Cmm] properly retain sizes.Moritz Angermann2020-11-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int# with Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us with properly sized primitives in the codegenerator instead of pretending they are all full machine words. This came up when implementing darwinpcs for arm64. The darwinpcs reqires us to pack function argugments in excess of registers on the stack. While most procedure call standards (pcs) assume arguments are just passed in 8 byte slots; and thus the caller does not know the exact signature to make the call, darwinpcs requires us to adhere to the prototype, and thus have the correct sizes. If we specify CInt in the FFI call, it should correspond to the C int, and not just be Word sized, when it's only half the size. This does change the expected output of T16402 but the new result is no less correct as it eliminates the narrowing (instead of the `and` as was previously done). Bumps the array, bytestring, text, and binary submodules. Co-Authored-By: Ben Gamari <ben@well-typed.com> Metric Increase: T13701 T14697
* CmmToLlvm: Declare signature for memcmpwip/angerman/arm64Ben Gamari2020-11-243-4/+12
| | | | | | Otherwise `opt` fails with: error: use of undefined value '@memcmp$def'
* rts: Flush eventlog buffers from flushEventLogBen Gamari2020-11-248-9/+58
| | | | | | | | | | | | As noted in #18043, flushTrace failed flush anything beyond the writer. This means that a significant amount of data sitting in capability-local event buffers may never get flushed, despite the users' pleads for us to flush. Fix this by making flushEventLog flush all of the event buffers before flushing the writer. Fixes #18043.
* rts: Post ticky entry counts to the eventlogBen Gamari2020-11-219-2/+150
| | | | | | | | We currently only post the entry counters, not the other global counters as in my experience the former are more useful. We use the heap profiler's census period to decide when to dump. Also spruces up the documentation surrounding ticky-ticky a bit.