summaryrefslogtreecommitdiff
path: root/rts
Commit message (Collapse)AuthorAgeFilesLines
* Make BlockAlloc.c comment slightly more accurate (fixes #8491)Edward Z. Yang2014-04-131-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Fix linked list manipulation code (buggy on consecutive deletion)Edward Z. Yang2014-04-122-3/+6
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Include LD_OPTS when building the RTS shared libsSimon Marlow2014-04-071-1/+4
|
* Ignore repeated loads of the same archive (#8942)Simon Marlow2014-04-071-18/+32
|
* Disable thin archive support on WindowsSimon Marlow2014-04-041-1/+14
|
* Test return value of clock_gettime() for errors.Simon Marlow2014-04-041-3/+13
| | | | | I don't want to fall back to gettimeofday(), because that might have a different absolute value.
* Fix copy/paste error (#8937)Simon Marlow2014-04-041-1/+1
|
* Support thin archive formatSimon Marlow2014-04-011-49/+90
| | | | | | | | | | | | This is a patch from FB's internal build of GHC that I'm pushing upstream. Author: Andrew Gallagher <agallagher@fb.com> This diff adds simple thin archive support to ghc's linker code, which basically just entails finding the member data from disk rather than from inside the archive (except for the case of the symbol index and gnu filename index, where the member data is still inline).
* Add more missing linker symbolsJohan Tibell2014-03-291-0/+3
|
* PrimOps.cmm: whitespace onlyJohan Tibell2014-03-291-438/+439
| | | | | Harmonize the indentation amount. The file mixed 4, 2, and in some cases 3 spaces for indentation.
* Add missing symbols to linkerJohan Tibell2014-03-291-1/+5
| | | | The copy array family of primops were moved out-of-line.
* Add SmallArray# and SmallMutableArray# typesJohan Tibell2014-03-2912-2/+379
| | | | | | | | | | | | | | | These array types are smaller than Array# and MutableArray# and are faster when the array size is small, as they don't have the overhead of a card table. Having no card table reduces the closure size with 2 words in the typical small array case and leads to less work when updating or GC:ing the array. Reduces both the runtime and memory allocation by 8.8% on my insert benchmark for the HashMap type in the unordered-containers package, which makes use of lots of small arrays. With tuned GC settings (i.e. `+RTS -A6M`) the runtime reduction is 15%. Fixes #8923.
* Make copy array ops out-of-line by defaultJohan Tibell2014-03-281-0/+20
| | | | | | This should reduce code size when there's little to gain from inlining these primops, while still retaining the inlining benefit when the size of the copy is known statically.
* rts: remove unused functions, fix validate on OS XAustin Seipp2014-03-271-7/+1
| | | | | | | After a toolchain update, Clang is no longer appreciative of the fact these are unused, thanks to -Werror during validate. Signed-off-by: Austin Seipp <austin@well-typed.com>
* codeGen: inline allocation optimization for clone array primopsJohan Tibell2014-03-222-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | The inline allocation version is 69% faster than the out-of-line version, when cloning an array of 16 unit elements on a 64-bit machine. Comparing the new and the old primop implementations isn't straightforward. The old version had a missing heap check that I discovered during the development of the new version. Comparing the old and the new version would requiring fixing the old version, which in turn means reimplementing the equivalent of MAYBE_CG in StgCmmPrim. The inline allocation threshold is configurable via -fmax-inline-alloc-size which gives the maximum array size, in bytes, to allocate inline. The size does not include the closure header size. Allowing the same primop to be either inline or out-of-line has some implication for how we lay out heap checks. We always place a heap check around out-of-line primops, as they may allocate outside of our knowledge. However, for the inline primops we only allow allocation via the standard means (i.e. virtHp). Since the clone primops might be either inline or out-of-line the heap check layout code now consults shouldInlinePrimOp to know whether a primop will be inlined.
* linker: Fix indirect calls for x86_64 windows (#2283)Kyrill Briantsev2014-03-211-2/+28
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Don't use gcptr for interior pointersJohan Tibell2014-03-201-10/+8
| | | | | | gcptr should only be used for pointers that the GC should follow. While this didn't cause any bugs right now, since these variables aren't live over a GC, it's clearer to use the right type.
* Fix incorrect maxStkSize calculation (#8858)Kyrill Briantsev2014-03-131-2/+2
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix two issues in stg_newArrayzhJohan Tibell2014-03-131-18/+4
| | | | | | | | | | | | | | | | | | | | | | The implementations of newArray# and newArrayArray#, stg_newArrayzh and stg_newArrayArrayzh, had three issues: * The condition for the loop that fills the array with the initial element was incorrect. It would write into the card table as well. The condition for the loop that filled the card table was never executed, as its condition was also wrong. In the end this didn't lead to any disasters as the value of the card table doesn't matter for newly allocated arrays. * The card table was unnecessarily initialized. The card table is only used when the array isn't copied, which new arrays always are. By not writing the card table at all we save some cycles. * The ticky allocation accounting was wrong. The second argument to TICK_ALLOC_PRIM is the size of the closure excluding the header size, but the header size was incorrectly included. Fixes #8867.
* Add hs_thread_done() (#8124)Simon Marlow2014-02-274-11/+78
| | | | See documentation for details.
* fix comment on allocate() (#8254)Simon Marlow2014-02-271-12/+14
|
* RetainerProfile.c: include missing header (#8810)Sergei Trofimovich2014-02-201-0/+1
| | | | | | | | | | | | | Found by clang: rts_dist_HC rts/dist/build/RetainerProfile.p_o rts/RetainerProfile.c:1779:5: error: implicit declaration of function 'markStableTables' is invalid in C99 [-Werror,-Wimplicit-function-declaration] markStableTables(retainRoot, NULL); Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix check for TLS support in Storage.cAustin Seipp2014-02-171-2/+2
| | | | | | | This should have manifested earlier, but for some reason it only seemed to trigger on Mavericks. Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts/package.conf.in: fix UNREG on --with-system-libffi when include-dir is ↵Sergei Trofimovich2014-02-171-2/+2
| | | | | | | | | passed explicitely Issue #8748 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts/Capability.c: fix crash in -threaded mode on UNREG buildSergei Trofimovich2014-02-171-9/+13
| | | | | | | | | | | | | UNREG mode has quite nasty invariant to maintain: capabilities[0] == &MainCapability and it's a non-heap memory, while other capabilities are dynamically allocated. Issue #8748 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Remove ios_HOST check for GCTDecl.hAustin Seipp2014-02-061-1/+1
| | | | | | | Following 298a25bdf and #8722 as Peter mentioned, this probably isn't needed anymore. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix #8698 by properly handling long section names and reenabling .ctors handlingEdward Z. Yang2014-02-041-23/+36
| | | | | | | | Our old function for searching for sections could only deal with section names that were eight bytes or shorter; this patch adds support for long section names. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Final fix to #7134 (and #8717 as well.)Kyrill Briantsev2014-02-041-12/+4
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix some edge cases in 8f8bd88c (#7134)Kyrill Briantsev2014-01-301-7/+12
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix iOS build (fallout from 28b031c506)Austin Seipp2014-01-301-2/+5
| | | | | | | | As Luke Iannini reported, the Clang iOS cross compiler apparently doesn't support __thread for some bizarre reason, so unfortunately they too must fall back to pthread_{get,set}specific. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Win64 linker: fix loading foreign imports (#2283)Kyrill Briantsev2014-01-281-0/+17
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix inplace dynamic linking on OS X (#8266)Christiaan Baaj2014-01-281-2/+4
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Refactor GCTDecl.h, and mitigate #7602 a bitAustin Seipp2014-01-281-59/+93
| | | | | | | | | | | | | | | | | | | | | | | | | This basically cleans a lot of GCTDecl up - I found it quite hard to read and a bit confusing. The changes are mostly cosmetic: better delineation between the alternative cases and light touchups, and tries to make every branch as consistent as possible. However, this patch does have one significant effect: it will ensure that any LLVM-based compilers will use __thread if they support it. Before, they would simply always use pthread_getspecific and pthread_setspecific, which are almost surely even *more* inefficient. The details are a bit too long and boring to go into here; see #7602. After talking with Simon, we decided to play it safe - __thread can at least be optimized by future clang releases even further on OS X if they choose, and it's safer until we can investigate the pthread implementation further on Mavericks. For Linux, the story isn't so bleak if you use Clang (for whatever reason) - Linux directly writes to `%fs` for __thread slots (while OS X will perform a load followed by an indirect call.) So it should still be fairly competitive, speed-wise. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix the Win64 RTS linker & disable .ctorsKyrill Briantsev2014-01-271-40/+145
| | | | | | This fixes #7134 Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add a way to reserve temporary stack space in high-level CmmSimon Marlow2014-01-161-22/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We occasionally need to reserve some temporary memory in a primop for passing to a foreign function. We've been using the stack for this, but when we moved to high-level Cmm it became quite fragile because primops are in high-level Cmm and the stack is supposed to be under the control of the Cmm pipeline. So this change puts things on a firmer footing by adding a new Cmm construct 'reserve'. e.g. in decodeFloat_Int#: reserve 2 = tmp { mp_tmp1 = tmp + WDS(1); mp_tmp_w = tmp; /* Perform the operation */ ccall __decodeFloat_Int(mp_tmp1 "ptr", mp_tmp_w "ptr", arg); r1 = W_[mp_tmp1]; r2 = W_[mp_tmp_w]; } reserve is described in CmmParse.y. Unfortunately the argument to reserve must be a compile-time constant. We might have to extend the parser to allow expressions with arithmetic operators if this is too restrictive. Note also that the return instruction for the procedure must be outside the scope of the reserved stack area, so we have to extract the values from the reserved area before we close the scope. This means some more local variables (r1, r2 in the example above). The generated code is more or less identical to what we had before though.
* In rts/Printer.c, print exact UPDATE_FRAME typeArash Rouhani2014-01-152-1/+20
| | | | | | | | When printing an update frame in printClosure(), it will not print the unspecific UPDATE_FRAME, instead it prints BH_UPDATE_FRAME, NORMAL_UPDATE_FRAME or MARKED_UPDATE_FRAME. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix typo in error messageHerbert Valerio Riedel2014-01-111-1/+1
| | | | Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Fix specification of -z origin for gold.Austin Seipp2014-01-071-1/+1
| | | | | | | Gold apparently doesn't recognize `-z origin`, only `-zorigin` it seems. Authored-by: Ben Gamari <bgamari.foss@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Clean up block allocator, fixes #8609Edward Z. Yang2013-12-311-4/+30
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Fix windows x86_64 build.Austin Seipp2013-12-091-1/+1
| | | | | | | On win64 sizeof(long) != sizeof(void*), so debugTrace was casting a value of incorrect size causing a validate failure. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix compiler warnings due to integer size mismatchChristopher Rodrigues2013-12-041-2/+2
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Use new flushExec implementation on all operating systems (#8562)Christopher Rodrigues2013-12-041-37/+19
| | | | | | | An earlier patch fixes a bug in flushExec on linux only. This patch uses the fixed code on all operating systems. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Update and deduplicate the comments on CAF management (#8590)Patrick Palka2013-12-041-6/+10
|
* Move the allocation of CAF blackholes into 'newCAF' (#8590)Patrick Palka2013-12-041-13/+27
| | | | | | | | | | We now do the allocation of the blackhole indirection closure inside the RTS procedure 'newCAF' instead of generating the allocation code inline in the closure body of each CAF. This slightly decreases code size in modules with a lot of CAFs. As a result of this change, for example, the size of DynFlags.o drops by ~60KB and HsExpr.o by ~100KB.
* Untab ClosureTypes.h and ClosureFlags.cPatrick Palka2013-12-041-41/+41
|
* Call busy_wait_nop() in the spin-wait loop in shutdown_gc_threads()Patrick Palka2013-11-291-1/+4
|
* Rejigger flushExec implementation (#8562, #8561)Austin Seipp2013-11-261-3/+19
| | | | | | | | Instead, just don't do anything on x86/amd64, and on !x86, use either A) __clear_cache from libgcc, or B) sys_icache_invalidate for OS X (and iOS.) Signed-off-by: Austin Seipp <austin@well-typed.com>
* Extend getPhysicalMemorySize to iOS (#8533)Austin Seipp2013-11-221-1/+1
| | | | | Authored-by: Authored-by: Luke Iannini <lukexi@me.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix formatting (fixes #8551)Arash Rouhani2013-11-221-1/+1
| | | | | Signed-off-by: Arash Rouhani <rarash@student.chalmers.se> Reviewed-by: Austin Seipp <austin@well-typed.com>
* GHCi: Properly generate jump code for ARM (#8380)Austin Seipp2013-11-222-3/+31
| | | | | | | | | | | | | | | | | | | | This adds code for jumping to given addresses for ARM, written by Ben Gamari. However, when allocating new infotables for bytecode (which is where this jump code occurs), we need to be sure to flush the cache on the execute pointer returned from allocateExec() - on systems like ARM, the processor won't reliably read back code or automatically cache flush, where x86 will. So we add a new flushExec primitive to call out to GCC's __builtin___clear_cache primitive, which will properly generate the correct code (nothing on x86, and a call to libgcc's __clear_cache on ARM) and make sure we use it after writing the code out. Authored-by: Ben Gamari <bgamari.foss@gmail.com> Authored-by: Austin Seipp <austin@well-typed.com> Signed-off-by: Austin Seipp <austin@well-typed.com>