summaryrefslogtreecommitdiff
path: root/rts
Commit message (Collapse)AuthorAgeFilesLines
...
* Move win32/IOManager to win32/MIOManagerDuncan Coutts2021-01-257-7/+7
| | | | | It is only for MIO, and we want to use the generic name IOManager for the name of the common parts of the interface and dispatch.
* Optimize some rts_mk/rts_get functions in RtsAPI.cCheng Shao2021-01-221-26/+43
| | | | | | | | | - All rts_mk functions return the tagged closure address - rts_mkChar/rts_mkInt avoid allocation when the argument is within the CHARLIKE/INTLIKE range - rts_getBool avoids a memory load by checking the closure tag - In rts_mkInt64/rts_mkWord64, allocated closure payload size is either 1 or 2 words depending on target architecture word size
* rts: Initialize card table in newArray#Ben Gamari2021-01-171-0/+3
| | | | | | | | | | Previously we would leave the card table of new arrays uninitialized. This wasn't a soundness issue: at worst we would end up doing unnecessary scavenging during GC, after which the card table would be reset. That being said, it seems worth initializing this properly to avoid both unnecessary work and non-determinism. Fixes #19143.
* rts/linker: Don't assume existence of dlinfoBen Gamari2021-01-173-12/+20
| | | | | | | | | The native-code codepath uses dlinfo to identify memory regions owned by a loaded dynamic object, facilitating safe unload. Unfortunately, this interface is not always available. Add an autoconf check for it and introduce a safe fallback behavior. Fixes #19159.
* rts: gc: use mutex+condvar instead of spinlooks in gc entry/exitDouglas Wilson2021-01-174-110/+113
| | | | | | used timed wait on condition variable in waitForGcThreads fix dodgy timespec calculation
* rts: add timedWaitConditionDouglas Wilson2021-01-172-0/+26
|
* rts: add max_n_todo_overflow internal counterDouglas Wilson2021-01-175-11/+37
| | | | | | | | I've never observed this counter taking a non-zero value, however I do think it's existence is justified by the comment in grab_local_todo_block. I've not added it to RTSStats in GHC.Stats, as it doesn't seem worth the api churn.
* rts: remove no_work counterDouglas Wilson2021-01-175-28/+6
| | | | We are no longer busyish waiting, so this is no longer meaningful
* rts: gc: use mutex+condvar instead of sched_yield in gc main loopDouglas Wilson2021-01-173-134/+237
| | | | | | | | | | | | | | | | | | | Here we remove the schedYield loop in scavenge_until_all_done+any_work, replacing it with a single mutex + condition variable. Previously any_work would check todo_large_objects, todo_q, todo_overflow of each gen for work. Comments explained that this was checking global work in any gen. However, these must have been out of date, because all of these locations are local to a gc thread. We've eliminated any_work entirely, instead simply looping back into scavenge_loop, which will quickly return if there is no work. shutdown_gc_threads is called slightly earlier than before. This ensures that n_gc_threads can never be observed to increase from 0 by a worker thread. startup_gc_threads is removed. It consisted of a single variable assignment, which is moved inline to it's single callsite.
* rts/eventlog: Reset ticky counters after dumping sampleBen Gamari2021-01-171-0/+4
|
* rts/eventlog: Introduce event to demarcate new ticky sampleBen Gamari2021-01-171-0/+7
|
* rts/PEi386: Fix reentrant lock usageBen Gamari2021-01-091-1/+1
| | | | | | | | | | | | Previously lookupSymbol_PEi386 would call lookupSymbol while holding linker_mutex. Fix this by rather calling `lookupDependentSymbol`. This is safe because lookupSymbol_PEi386 unconditionally holds linker_mutex. Happily, this un-breaks `T12771`, `T13082_good`, and `T14611`, which were previously marked as broken due to #18718. Closes #19155.
* rts/Capability: Use relaxed load in findSparkBen Gamari2021-01-091-1/+2
| | | | When checking n_returning_tasks.
* rts: Use SEQ_CST accesses when touching `wakeup`Ben Gamari2021-01-093-4/+4
| | | | | These are the two remaining non-atomic accesses to `wakeup` which were missed by the original TSAN patch.
* rts: Use relaxed load when checking for cap ownershipBen Gamari2021-01-091-1/+4
| | | | This check is merely a service to the user; no reason to synchronize.
* rts: stats: Fix calculation for fragmentationDouglas Wilson2021-01-091-1/+1
|
* rts: stats: Some fixes to stats for sequential gcsDouglas Wilson2021-01-092-14/+37
| | | | | | | | Solves #19147. When n_capabilities > 1 we were not correctly accounting for gc time for sequential collections. In this case par_n_gcthreads == 1, however it is not guaranteed that the single gc thread is capability 0. A similar issue for copied is addressed as well.
* rts/Sanity: Allow DEAD_WEAKs in weak pointer listBen Gamari2021-01-071-1/+1
| | | | | | | The weak pointer check in `checkGenWeakPtrList` previously failed to account for dead weak pointers. This caused `fptr01` to fail in the `sanity` way. Fixes #19162.
* rts/Linker: Add noreturn to loadNativeObj on non-ELF platformsBen Gamari2021-01-071-2/+6
|
* rts: Enforce that mark-region isn't used with -hBen Gamari2021-01-071-0/+10
| | | | | | | As noted in #9666, the mark-region GC is not compatible with heap profiling. Also add documentation for this flag. Closes #9666.
* rts: Zero shrunk array slop in vanilla RTSBen Gamari2021-01-071-4/+9
| | | | | | But only when profiling or DEBUG are enabled. Fixes #17572.
* Storage: Unconditionally enable zeroing of alignment slopBen Gamari2021-01-071-11/+11
| | | | This is necessary since the user may enable `+RTS -hT` at any time.
* rts: Implement heap census support for pinned objectsBen Gamari2021-01-071-29/+21
| | | | | It turns out that this was fairly straightforward to implement since we are now pretty careful about zeroing slop.
* 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.