summaryrefslogtreecommitdiff
path: root/rts
Commit message (Collapse)AuthorAgeFilesLines
* Gracefully handle error condition in Mach-O relocateSectionArtem Pyanykh2019-03-201-1/+6
|
* Directly test section alignment, fix internal reloc probing lengthArtem Pyanykh2019-03-201-2/+6
|
* Add missing levels to SegmentProt enumArtem Pyanykh2019-03-202-4/+19
|
* Address some todos and fixmesArtem Pyanykh2019-03-203-21/+22
|
* Use segments for section layoutArtem Pyanykh2019-03-206-94/+296
|
* Adjust section placement and relocation logic for Mach-OArtem Pyanykh2019-03-204-123/+234
| | | | | | | | | | | | | | 1. Place each section on a separate page to ensure required alignment (wastes lots ot space, needs to be improved). 2. Unwire relocation logic from macho sections (the most fiddly part is adjusting internal relocations). Other todos: 0. Add a test for section alignment. 1. Investigate 32bit relocations! 2. Fix memory leak in ZEROPAGE section allocation. 3. Fix creating redundant jump islands for GOT. 4. Investigate more compact section placement.
* rts/RtsSymbols: Drop __mingw_vsnwprintfBen Gamari2019-03-201-1/+0
| | | | | | As described in #16387, this is already defined by mingw and consequently defining it in the RTS as well leads to multiple definition errors from the RTS linker at runtime.
* err: clean up error handlerTamar Christina2019-03-191-19/+30
|
* ghc-heap: Introduce closureSizeBen Gamari2019-03-172-0/+8
| | | | | | This function allows the user to compute the (non-transitive) size of a heap object in words. The "closure" in the name is admittedly confusing but we are stuck with this nomenclature at this point.
* Update Trac ticket URLs to point to GitLabRyan Scott2019-03-1514-18/+18
| | | | | This moves all URL references to Trac tickets to their corresponding GitLab counterparts.
* rts: Factor out large bitmap walkingBen Gamari2019-03-092-16/+40
| | | | | This will be needed by the mark phase of the non-moving collector so let's factor it out.
* Fix itBen Gamari2019-03-063-6/+10
|
* rts: Unglobalize dead_weak_ptr_list and resurrected_threadsÖmer Sinan Ağacan2019-03-065-24/+23
| | | | | | | | In the concurrent nonmoving collector we will need the ability to call `traverseWeakPtrList` concurrently with minor generation collections. This global state stands in the way of this. However, refactoring it away is straightforward since this list only persists the length of a single GC.
* rts/Printer: Print forwarding pointersÖmer Sinan Ağacan2019-03-051-3/+8
|
* rts/Printer: Introduce a few more printing utilitiesÖmer Sinan Ağacan2019-03-052-0/+74
| | | | | These include printLargeAndPinnedObjects, printWeakLists, and printStaticObjects. These are generally useful things to have.
* RTS: Add missing memory barrierPeter Trommler2019-02-271-3/+6
| | | | | | | | | | | | | In the work stealing queue a load-load-barrier is required to ensure that a read of queue data cannot be reordered before a read of the bottom pointer into the queue. The added load-load-barrier ensures that the ordering of writes enforced at the end of `pushWSDeque` is also respected in the order of reads in `stealWSDeque_`. In other words, when reading `q->bottom` we want to make sure that we see the updates to `q->elements`. Fixes #13633
* Drop support for i386 and PowerPC in MachO linkerArtem Pyanykh2019-02-224-231/+8
| | | | | | Some code is broken, there are no CI targets (so not obvious how to test), and no one seems to have built GHC for any of the above platforms in years.
* Fix two bugs in stg_ap_0_fast in profiling runtimeÖmer Sinan Ağacan2019-02-201-7/+11
| | | | | | | | | | | | | | | | | | This includes two bug fixes in profiling version of stg_ap_0_fast: - PAPs allocated by stg_ap_0_fast are now correctly tagged. This invariant is checked in Sanity.c:checkPAP. (This was originally implemented in 2693eb11f5, later reverted with ab55b4ddb7 because it revealed the bug below, but it wasn't clear at the time whether the bug was the one below or something in the commit) - The local variable `untaggedfun` is now marked as a pointer so it survives GC. With this we finally fix all known bugs caught in #15508. `concprog001` now works reliably with prof+threaded and prof runtimes (with and without -debug).
* Fix checkStackChunk() call in Interepter.c, enable an assertionÖmer Sinan Ağacan2019-02-132-2/+2
| | | | Fixes #16303
* rts/ProfilerReportJson: Fix format stringBen Gamari2019-02-081-1/+1
| | | | This was warning on i386.
* Don't use X86_64_ELF_NONPIC_HACK for +RTS -xpZejun Wu2019-01-301-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When `+RTS -xp` is passed, when don't need the X86_64_ELF_NONPIC_HACK, becasue the relocation offset should only be out of range if * the object file was not compiled with `-fPIC -fexternal-dynamic-refs`; * ghc generates non-pic code while it should (e.g. #15723) In either case, we should print an error message rather that silently attempt to use a hacky workaround that may not work. This could have made debugging #15723 and #15729 much easier. Test Plan: Run this in a case where ghci used to crash becasue of T15723. Now we see helpful message like: ``` ghc-iserv-prof: R_X86_64_PC32 relocation out of range: stmzm2zi4zi4zi1zmJQn4hNPyYjP5m9AcbI88Ve_ControlziConcurrentziSTMziTMVar_readTMVar_C61n_cc = 9b95ffac ``` Reviewers: simonmar, bgamari, erikd Reviewed By: simonmar, bgamari Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5233
* Allocate bss section within proper range of other sectionsZejun Wu2019-01-3011-72/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This re-applies {D5195} and {D5235}, they were reverted as part of diff stack to unbreak i386. The proper fix is done in {D5289}. Allocate bss section within proper range of other sections: * when `+RTS -xp` is passed, allocate it contiguously as we did for jump islands * when we mmap the code to lower 2Gb, we should allocate bss section there too Test Plan: 1. `./validate` 2. with ``` DYNAMIC_GHC_PROGRAMS = NO DYNAMIC_BY_DEFAULT = NO ``` `TEST="T15729" make test` passed in both linux (both i386 and x86_64) and macos. 3. Also test in a use case where we used to encouter error like: ``` ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) = b90282ba ``` and now, everything works fine. Reviewers: simonmar, bgamari, angerman, erikd Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15729 Differential Revision: https://phabricator.haskell.org/D5290
* Add a RTS option -xp to load PIC object anywhere in address spaceZejun Wu2019-01-305-92/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This re-applies {D5195} with fixes for i386: * Fix unused label warnings, see {D5230} or {D5273} * Fix a silly bug introduced by moving `#if` {P190} Add a RTS option -xp to load PIC object anywhere in address space. We do this by relaxing the requirement of <0x80000000 result of `mmapForLinker` and implying USE_CONTIGUOUS_MMAP. We also need to change calls to `ocInit` and `ocGetNames` to avoid dangling pointers when the address of `oc->image` is changed by `ocAllocateSymbolExtra`. Test Plan: See {D5195}, also test under i386: ``` $ uname -a Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28 20:45:30 CEST 2018 i686 GNU/Linux $ cd testsuite/tests/th/ && make test ... ``` will run `./validate` on stacked diff. Reviewers: simonmar, bgamari, alpmestan, trommler, hvr, erikd Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5289
* Revert "Batch merge"Ben Gamari2019-01-3012-203/+158
| | | | This reverts commit 76c8fd674435a652c75a96c85abbf26f1f221876.
* Batch mergeBen Gamari2019-01-3012-158/+203
|
* A few typofixesGabor Greif2019-01-231-1/+1
|
* Extend linker-script workaround to work with musl libcSamuel Holland2019-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GHC has code to handle unsuffixed .so files that are linker scripts pointing to the real shared library. The detection is done by parsing the result of `dlerror()` after calling `dlopen()` and looking for certain error strings. On musl libc, the error message is "Exec format error", which happens to be `strerror(ENOEXEC)`: ``` $ cat tmp.c #include <dlfcn.h> #include <stdio.h> int main(void) { dlopen("libz.so", RTLD_NOW | RTLD_GLOBAL); puts(dlerror()); return 0; } $ gcc -o tmp tmp.c $ ./tmp Error loading shared library libz.so: Exec format error $ ``` This change fixes the workaround to also work on musl libc. Link: https://phabricator.haskell.org/D5474
* RTS: Use ELF v1 convention on all powerpc64 systemsPeter Trommler2019-01-171-5/+0
|
* doc: reorder heap profiling information in +RTS -?Ben Price2019-01-161-6/+5
|
* rts: Allow heap prof by closure type in prof wayBen Price2019-01-161-0/+1
| | | | | | Complete b7b6617a90824303daf555c817f538cd9c792671 (see ticket #15086) to actually enable profiling by closure type in the profiling rts. I.e. +RTS -p -hT is now accepted.
* rts: Use always-available locking operations in pthread Itimer implementationBen Gamari2019-01-141-6/+6
| | | | | | Previously we ACQUIRE_LOCK and RELEASE_LOCK but these compile to a noop in the non-threaded RTS, as noted in #16150. Use OS_ACQUIRE_LOCK and OS_RELEASE_LOCK instead.
* itimer: Don't free condvar until we know ticker is stoppedBen Gamari2019-01-141-2/+2
| | | | | | | | | | | When we are shutting down the pthread ticker we signal the start_cond condition variable to ensure that the ticker thread wakes up and exits in a reasonable amount of time. Previously, when the ticker thread would shut down it was responsible for freeing the start_cond condition variable. However, this would lead to a race wherein the ticker would free start_cond, then the main thread would try to signal it in an effort to wake the ticker (#16150). Avoid this by moving the mutex destruction to the main thread.
* Fix checkPtrInArenaÖmer Sinan Ağacan2019-01-131-2/+11
| | | | (See comments)
* Fix negative mutator time in GC stats in prof buildsÖmer Sinan Ağacan2019-01-123-49/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because garbage collector calls `retainerProfile()` and `heapCensus()`, GC times normally include some of PROF times too. To fix this we have these lines: // heapCensus() is called by the GC, so RP and HC time are // included in the GC stats. We therefore subtract them to // obtain the actual GC cpu time. stats.gc_cpu_ns -= prof_cpu; stats.gc_elapsed_ns -= prof_elapsed; These variables are later used for calculating GC time excluding the final GC (which should be attributed to EXIT). exit_gc_elapsed = stats.gc_elapsed_ns - start_exit_gc_elapsed; The problem is if we subtract PROF times from `gc_elapsed_ns` and then subtract `start_exit_gc_elapsed` from the result, we end up subtracting PROF times twice, because `start_exit_gc_elapsed` also includes PROF times. We now subtract PROF times from GC after the calculations for EXIT and MUT times. The existing assertion that checks INIT + MUT + GC + EXIT = TOTAL now holds. When we subtract PROF numbers from GC, and a new assertion INIT + MUT + GC + PROF + EXIT = TOTAL also holds. Fixes #15897. New assertions added in this commit also revealed #16102, which is also fixed by this commit.
* Fix raiseAsync() UNDERFLOW_FRAME handling in profiling runtimeÖmer Sinan Ağacan2019-01-121-7/+6
| | | | | | | UNDERFLOW_FRAMEs don't have profiling headers so we have to use the AP_STACK's function's CCS as the new frame's CCS. Fixes one of the many bugs caught by concprog001 (#15508).
* Documentation and refactoring in CCS related codeÖmer Sinan Ağacan2019-01-122-33/+56
| | | | | | | | | - Remove REGISTER_CC and REGISTER_CCS macros, add functions registerCC and registerCCS to Profiling.c. - Reduce scope of symbols: CC_LIST, CCS_LIST, CC_ID, CCS_ID - Document CC_LIST and CCS_LIST
* Implement a sanity check for CCS fields in profiling buildsÖmer Sinan Ağacan2019-01-105-0/+44
| | | | | This helped me debug one of the bugs in #15508. I'm not sure if this is a good idea, but it worked for me, so wanted to submit this as a MR.
* Minor refactoring and documentation in profiling RTS codeÖmer Sinan Ağacan2019-01-031-41/+20
|
* PPC NCG: Remove Darwin supportPeter Trommler2019-01-017-416/+47
| | | | | | | Support for Mac OS X on PowerPC has been dropped by Apple years ago. We follow suit and remove PowerPC support for Darwin. Fixes #16106.
* rts: fix build failure on OpenBSD (_DYNAMIC symbol collision)Sergei Trofimovich2018-12-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Build failure on OpenBSD-6.4 the the following: ``` rts/RtsSymbols.c:994:1: error: error: redefinition of '_DYNAMIC' as different kind of symbol | 994 | RTS_OPENBSD_ONLY_SYMBOLS | ^ RTS_OPENBSD_ONLY_SYMBOLS ^ ``` On OpenBSD `_DYNAMIC` was always defined in `<elf.h>` headers but used not to be included. The change explicitly includes `<elf.h>` as a source of symbol definition. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build-tested on OpenBSD-6.4 Reviewers: bgamari, erikd, simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15945 Differential Revision: https://phabricator.haskell.org/D5461
* rts: Turn ASSERT in LDV_recordDead into a normal ifBen Gamari2018-12-251-1/+3
| | | | | | | | As reported in #15382 the `ASSERT(ctr != NULL)` is currently getting routinely hit during testsuite runs. While this is certainly a bug I would far prefer getting a proper error message than a segmentation fault. Consequently I'm turning the `ASSERT` into a proper `if` so we get a proper error in non-debug builds.
* Fix warning that 'hugs-options' isn't supported any moreGabor Greif2018-12-191-1/+0
|
* StgCRun: Disable unwinding on DarwinBen Gamari2018-12-171-2/+12
| | | | See #15207.
* Use https links in user-facing startup and error messagesBen Gamari2018-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I consider myself lucky that in my circle of friends, `http` urls (as opposed to `https` urls) are frowned upon in that we generally apologize in the rase cases that we share an `http` url. This pull request changes `http` links into their `https` analogues in the following places: * In the GHCI startup message (and parts of the User's Guide, where there are verbatim transcripts of GHCi sessions). * In a couple of error messages, asking the user to report a bug. (I also took the liberty to change a single space before the reportabug url into two spaces, harmonizing this occurence with the others.) I'm not trying to start a war. I just had a moment to spare and felt like preparing this diff. Merge or don't merge as you wish! Reviewers: bgamari, erikd, simonmar Subscribers: goldfire, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5450
* rts: Annotate fallthroughs in AArch64 linkerBen Gamari2018-12-141-1/+6
|
* Update -F RTS help:Ömer Sinan Ağacan2018-12-141-3/+4
| | | | | | | | | | | | | | - Add default value - Update the help line as multiple short lines instead of one long line, for consistency with other lines. Reviewers: simonmar, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5445
* RetainerProfiler: Update retainer profiler debuggingAlexander Vershilov2018-12-121-125/+85
| | | | | | | | | | | | | Debug code have not been updated for a long time, now it's changed to it compiles with recent RTS. Reviewers: bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5369
* Typo fix, replace a foldl with foldl'Ömer Sinan Ağacan2018-12-121-1/+1
|
* Fix uninformative hp2ps error when the cmdline contains double quotesZejun Wu2018-12-111-8/+22
| | | | | | | | | | | | | | | | | | | | | | | Reapply D5346 with fix incompatible shell quoting in tests. It seems like `$'string'` is not recognized under all test environments, so let's avoid it in tests. Test Plan: ``` hp2ps: "T15904".hp, line 2: integer must follow identifier ``` use new ghc and hp2ps to profile a simple program. Reviewers: simonmar, bgamari, erikd, tdammers Reviewed By: bgamari Subscribers: tdammers, carter, rwbarton GHC Trac Issues: #15904 Differential Revision: https://phabricator.haskell.org/D5388
* Add +RTS -F to the --help outputSimon Marlow2018-12-111-0/+2
| | | | | | | | | | | | Test Plan: `./inplace/bin/ghc-stage2 +RTS --help" Reviewers: bgamari, sgraf, erikd Reviewed By: sgraf Subscribers: adamse, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5428