summaryrefslogtreecommitdiff
path: root/includes
Commit message (Collapse)AuthorAgeFilesLines
...
* Add loadNativeObj and unloadNativeObjRay Shih2020-11-111-0/+13
| | | | | | | | | | | | | | | | | | | (This change is originally written by niteria) This adds two functions: * `loadNativeObj` * `unloadNativeObj` and implements them for Linux. They are useful if you want to load a shared object with Haskell code using the system linker and have GHC call dlclose() after the code is no longer referenced from the heap. Using the system linker allows you to load the shared object above outside the low-mem region. It also loads the DWARF sections in a way that `perf` understands. `dl_iterate_phdr` is what makes this implementation Linux specific.
* Add code comments for StgInfoTable and StgStack structsDavid Eichmann2020-11-102-2/+19
|
* ghc-heap: expose decoding from heap representationDavid Eichmann2020-11-101-0/+9
| | | | | | 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>
* Merge remote-tracking branch 'origin/wip/tsan/all'Ben Gamari2020-11-089-35/+186
|\
| * Merge branch 'wip/tsan/stm' into wip/tsan/allBen Gamari2020-11-011-3/+3
| |\
| | * rts/stm: Strengthen orderings to SEQ_CST instead of volatilewip/tsan/stmBen Gamari2020-10-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the `current_value`, `first_watch_queue_entry`, and `num_updates` fields of `StgTVar` were marked as `volatile` in an attempt to provide strong ordering. Of course, this isn't sufficient. We now use proper atomic operations. In most of these cases I strengthen the ordering all the way to SEQ_CST although it's possible that some could be weakened with some thought.
| * | Merge branch 'wip/tsan/wsdeque' into wip/tsan/allBen Gamari2020-11-011-0/+15
| |\ \
| | * | rts/WSDeque: Rewrite with proper atomicswip/tsan/wsdequeBen Gamari2020-10-241-0/+15
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a few attempts at shoring up the previous implementation, I ended up turning to the literature and now use the proven implementation, > N.M. Lê, A. Pop, A.Cohen, and F.Z. Nardelli. "Correct and Efficient > Work-Stealing for Weak Memory Models". PPoPP'13, February 2013, > ACM 978-1-4503-1922/13/02. Note only is this approach formally proven correct under C11 semantics but it is also proved to be a bit faster in practice.
| * | Merge branch 'wip/tsan/storage' into wip/tsan/allBen Gamari2020-11-015-15/+16
| |\ \
| | * | rts: Use relaxed ordering on spinlock counterswip/tsan/storageBen Gamari2020-10-301-0/+2
| | | |
| | * | rts/SpinLock: Separate out slow pathBen Gamari2020-10-301-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | Not only is this in general a good idea, but it turns out that GCC unrolls the retry loop, resulting is massive code bloat in critical parts of the RTS (e.g. `evacuate`).
| | * | rts: Join to concurrent mark thread during shutdownBen Gamari2020-10-301-1/+2
| | | | | | | | | | | | | | | | | | | | Previously we would take all capabilities but fail to join on the thread itself, potentially resulting in a leaked thread.
| | * | rts/GC: Use atomicsBen Gamari2020-10-301-3/+3
| | | |
| | * | rts: Avoid data races in StablePtr implementationBen Gamari2020-10-241-1/+5
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two potentially problematic data races in the StablePtr implementation: * We would fail to RELEASE the stable pointer table when enlarging it, causing other cores to potentially see uninitialized memory. * We would fail to ACQUIRE when dereferencing a stable pointer.
| * | Merge branch 'wip/tsan/ci' into wip/tsan/allBen Gamari2020-11-011-0/+4
| |\ \
| | * | TSANUtils: Ensure that C11 atomics are supportedBen Gamari2020-10-241-0/+4
| | |/
| * | Capabiliity: Properly fix data race on n_returning_tasksBen Gamari2020-10-241-0/+1
| |/ | | | | | | | | There is a real data race but can be made safe by using proper atomic (but relaxed) accesses.
| * rts: Introduce SET_HDR_RELEASEwip/tsan/prepBen Gamari2020-10-241-2/+8
| | | | | | | | | | Also ensure that we also store the info table pointer last to ensure that the synchronization covers all stores.
| * rts/ClosureMaros: Use relaxed atomicsBen Gamari2020-10-241-10/+13
| |
| * rts/SpinLock: Move to proper atomicsBen Gamari2020-10-241-6/+4
| | | | | | | | | | | | This is fairly straightforward; we just needed to use relaxed operations for the PROF_SPIN counters and a release store instead of a write barrier.
| * rts: Infrastructure for testing with ThreadSanitizerBen Gamari2020-10-242-0/+64
| |
| * SMP.h: Add C11-style atomic operationsBen Gamari2020-10-241-1/+60
| |
* | [AArch64] Aarch64 Always PICMoritz Angermann2020-11-061-1/+1
| |
* | RtsAPI: pause and resume the RTSDavid Eichmann2020-11-022-8/+95
|/ | | | | | | | | The `rts_pause` and `rts_resume` functions have been added to `RtsAPI.h` and allow an external process to completely pause and resume the RTS. 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>
* Don't get host RTS ways via settings (#18651)Sylvain Henry2020-10-171-6/+0
| | | | | | | | | | | | To correctly perform a linking hack for Windows we need to link with the RTS GHC is currently using. We used to query the RTS ways via the "settings" file but it is fragile (#18651). The hack hasn't been fixed to take into account all the ways (Tracing) and it makes linking of GHC with another RTS more difficult (we need to link with another RTS and to regenerate the settings file). So this patch uses the ways reported by the RTS itself (GHC.Platform.Ways.hostWays) instead of the "settings" file.
* When using rts_setInCallCapability, lock incall threadsDylan Yudaken2020-10-171-4/+4
| | | | | | | | This diff makes sure that incall threads, when using `rts_setInCallCapability`, will be created as locked. If the thread is not locked, the thread might end up being scheduled to a different capability. While this is mentioned in the docs for `rts_setInCallCapability,`, it makes the method significantly less useful as there is no guarantees on the capability being used. This commit also adds a test to make sure things stay on the correct capability.
* Expose RTS-only ways (#18651)Sylvain Henry2020-10-091-0/+9
| | | | | Some RTS ways are exposed via settings (ghcThreaded, ghcDebugged) but not all. It's simpler if the RTS exposes them all itself.
* rts: Fix integer width in TICK_BUMP_BYBen Gamari2020-10-051-1/+1
| | | | | | | | | | | | | | Previously `TICK_BUMP_BY` was defined as ```c #define TICK_BUMP_BY(ctr,n) CLong[ctr] = CLong[ctr] + n ``` Yet the tickers themselves were defined as `StgInt`s. This happened to work out correctly on Linux, where `CLong` is 64-bits. However, it failed on Windows, where `CLong` is 32-bits, resulting in #18782. Fixes #18783.
* Remove unused global variablesSylvain Henry2020-09-301-4/+0
| | | | | | | | | | Some removed globals variables were still declared in the RTS. They were removed in the following commits: * 4fc6524a2a4a0003495a96c8b84783286f65c198 * 0dc7985663efa1739aafb480759e2e2e7fca2a36 * bbd3c399939311ec3e308721ab87ca6b9443f358
* Remove unsafeGlobalDynFlags (#17957, #14597)Sylvain Henry2020-09-301-1/+3
| | | | | There are still global variables but only 3 booleans instead of a single DynFlags.
* rts: Refactor unloading of foreign export StablePtrsBen Gamari2020-09-181-0/+2
| | | | | | Previously we would allocate a linked list cell for each foreign export. Now we can avoid this by taking advantage of the fact that they are already broken into groups.
* rts: Refactor foreign export trackingBen Gamari2020-09-182-0/+39
| | | | | | | | | This avoids calling `libc` in the initializers which are responsible for registering foreign exports. We believe this should avoid the corruption observed in #18548. See Note [Tracking foreign exports] in rts/ForeignExports.c for an overview of the new scheme.
* Define TICKY_TICKY when compiling cmm RTS files.David Himmelstrup2020-09-112-11/+20
|
* rts comment: RTS_TICKY_SYMBOLS moved from rts/Linker.c to rts/RtsSymbols.cDavid Himmelstrup2020-09-091-1/+1
|
* [macOS] improved runpath handlingMoritz Angermann2020-09-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In b592bd98ff25730bbe3c13d6f62a427df8c78e28 we started using -dead_strip_dylib on macOS when lining dynamic libraries and binaries. The underlying reason being the Load Command Size Limit in macOS Sierra (10.14) and later. GHC will produce @rpath/libHS... dependency entries together with a corresponding RPATH entry pointing to the location of the libHS... library. Thus for every library we produce two Load Commands. One to specify the dependent library, and one with the path where to find it. This makes relocating libraries and binaries easier, as we just need to update the RPATH entry with the install_name_tool. The dynamic linker will then subsitute each @rpath with the RPATH entries it finds in the libraries load commands or the environement, when looking up @rpath relative libraries. -dead_strip_dylibs intructs the linker to drop unused libraries. This in turn help us reduce the number of referenced libraries, and subsequently the size of the load commands. This however does not remove the RPATH entries. Subsequently we can end up (in extreme cases) with only a single @rpath/libHS... entry, but 100s or more RPATH entries in the Load Commands. This patch rectifies this (slighly unorthodox) by passing *no* -rpath arguments to the linker at link time, but -headerpad 8000. The headerpad argument is in hexadecimal and the maxium 32k of the load command size. This tells the linker to pad the load command section enough for us to inject the RPATHs later. We then proceed to link the library or binary with -dead_strip_dylibs, and *after* the linking inspect the library to find the left over (non-dead-stripped) dependencies (using otool). We find the corresponding RPATHs for each @rpath relative dependency, and inject them into the library or binary using the install_name_tool. Thus achieving a deadstripped dylib (and rpaths) build product. We can not do this in GHC, without starting to reimplement a dynamic linker as we do not know which symbols and subsequently libraries are necessary. Commissioned-by: Mercury Technologies, Inc. (mercury.com)
* document how build system find toolchains on WindowsTamar Christina2020-08-281-0/+1
|
* Fix use distro toolchianTamar Christina2020-08-281-0/+3
|
* cmm: Clean up Notes a bitBen Gamari2020-08-071-0/+2
|
* Refactor handling of object mergingBen Gamari2020-08-051-0/+2
| | | | | | | | | Previously to merge a set of object files we would invoke the linker as usual, adding -r to the command-line. However, this can result in non-sensical command-lines which causes lld to balk (#17962). To avoid this we introduce a new tool setting into GHC, -pgmlm, which is the linker which we use to merge object files.
* Fix GHC_STAGE definition generated by makeLeon Schoorl2020-08-021-1/+1
| | | | | | | | | | Fixes #18070 GHC_STAGE is the stage of the compiler we're building, it should be 1,2(,3?). But make was generating 0 and 1. Hadrian does this correctly using a similar `+ 1`: https://gitlab.haskell.org/ghc/ghc/-/blob/eb8115a8c4cbc842b66798480fefc7ab64d31931/hadrian/src/Rules/Generate.hs#L245
* Fix build systemsSylvain Henry2020-07-251-10/+0
|
* winio: restore console cp on exitTamar Christina2020-07-241-0/+1
|
* Replace ghcWithNativeCodeGen with a proper Backend datatypeSylvain Henry2020-07-221-1/+0
| | | | | | | | | | | | | | | | * Represent backends with a `Backend` datatype in GHC.Driver.Backend * Don't detect the default backend to use for the target platform at compile time in Hadrian/make but at runtime. It makes "Settings" simpler and it is a step toward making GHC multi-target. * The latter change also fixes hadrian which has not been updated to take into account that the NCG now supports AIX and PPC64 (cf df26b95559fd467abc0a3a4151127c95cb5011b9 and d3c1dda60d0ec07fc7f593bfd83ec9457dfa7984) * Also we don't treat iOS specifically anymore (cf cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f)
* Implement `fullCompilerVersion`Hécate2020-07-181-1/+1
| | | | | | | | Follow-up of https://gitlab.haskell.org/ghc/ghc/-/issues/18403 This MR adds `fullCompilerVersion`, a function that shares the same backend as the `--numeric-version` GHC flag, exposing a full, three-digit version datatype.
* winio: update lockfile signature and remove mistaken symbol in rts.Tamar Christina2020-07-151-2/+2
|
* winio: Expand BlockedOnIOCompletion description.Andreas Klebinger2020-07-151-1/+3
|
* winio: add a note about file locking in the RTS.Andreas Klebinger2020-07-151-0/+16
|
* winio: Multiple refactorings and support changes.Tamar Christina2020-07-152-8/+17
|
* winio: Add new io-manager cmdline optionsTamar Christina2020-07-151-0/+5
|
* winio: Add IOPort synchronization primitiveTamar Christina2020-07-153-1/+10
|