summaryrefslogtreecommitdiff
path: root/rts/sm/GCAux.c
Commit message (Collapse)AuthorAgeFilesLines
* isAlive needs to look through BLACKHOLE indirectionsSimon Marlow2013-02-141-0/+8
| | | | | This has been breaking StableNames and possibly weak pointers in some cases.
* Convert more RTS macros to functionsIan Lynagh2012-09-211-1/+1
| | | | No size changes in the non-debug object files
* isAlive: re-apply the tag if we find a forwarding pointer. This is aSimon Marlow2011-04-121-1/+1
| | | | | real bug, spotted by Marcin Orczyk (thanks!). I'm not sure if it lead to any actual crashes.
* Refactoring and tidy upSimon Marlow2011-04-111-1/+1
| | | | | | | | | | | | This is a port of some of the changes from my private local-GC branch (which is still in darcs, I haven't converted it to git yet). There are a couple of small functional differences in the GC stats: first, per-thread GC timings should now be more accurate, and secondly we now report average and maximum pause times. e.g. from minimax +RTS -N8 -s: Tot time (elapsed) Avg pause Max pause Gen 0 2755 colls, 2754 par 13.16s 0.93s 0.0003s 0.0150s Gen 1 769 colls, 769 par 3.71s 0.26s 0.0003s 0.0059s
* Implement stack chunks and separate TSO/STACK objectsSimon Marlow2010-12-151-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes two changes to the way stacks are managed: 1. The stack is now stored in a separate object from the TSO. This means that it is easier to replace the stack object for a thread when the stack overflows or underflows; we don't have to leave behind the old TSO as an indirection any more. Consequently, we can remove ThreadRelocated and deRefTSO(), which were a pain. This is obviously the right thing, but the last time I tried to do it it made performance worse. This time I seem to have cracked it. 2. Stacks are now represented as a chain of chunks, rather than a single monolithic object. The big advantage here is that individual chunks are marked clean or dirty according to whether they contain pointers to the young generation, and the GC can avoid traversing clean stack chunks during a young-generation collection. This means that programs with deep stacks will see a big saving in GC overhead when using the default GC settings. A secondary advantage is that there is much less copying involved as the stack grows. Programs that quickly grow a deep stack will see big improvements. In some ways the implementation is simpler, as nothing special needs to be done to reclaim stack as the stack shrinks (the GC just recovers the dead stack chunks). On the other hand, we have to manage stack underflow between chunks, so there's a new stack frame (UNDERFLOW_FRAME), and we now have separate TSO and STACK objects. The total amount of code is probably about the same as before. There are new RTS flags: -ki<size> Sets the initial thread stack size (default 1k) Egs: -ki4k -ki2m -kc<size> Sets the stack chunk size (default 32k) -kb<size> Sets the stack chunk buffer size (default 1k) -ki was previously called just -k, and the old name is still accepted for backwards compatibility. These new options are documented.
* Handle IND_STATIC in isRetainerIan Lynagh2010-04-091-0/+4
| | | | | | IND_STATIC used to be an error, but at the moment it can happen as isAlive doesn't look through IND_STATIC as it ignores static closures. See trac #3956 for a program that hit this error.
* Remove the IND_OLDGEN and IND_OLDGEN_PERM closure typesSimon Marlow2010-04-011-2/+0
| | | | | | | These are no longer used: once upon a time they used to have different layout from IND and IND_PERM respectively, but that is no longer the case since we changed the remembered set to be an array of addresses instead of a linked list of closures.
* Move a thread to the front of the run queue when another thread blocks on itSimon Marlow2010-03-291-1/+2
| | | | | | | This fixes #3838, and was made possible by the new BLACKHOLE infrastructure. To allow reording of the run queue I had to make it doubly-linked, which entails some extra trickiness with regard to GC write barriers and suchlike.
* tiny GC optimisationSimon Marlow2010-03-291-3/+5
|
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* Redesign 64-bit HEAP_ALLOCED (FIX #2934 at the same time)Simon Marlow2009-03-091-1/+1
| | | | | | | | After much experimentation, I've found a formulation for HEAP_ALLOCED that (a) improves performance, and (b) doesn't have any race conditions when used concurrently. GC performance on x86_64 should be improved slightly. See extensive comments in MBlock.h for the details.
* Experimental "mark-region" strategy for the old generationSimon Marlow2008-06-091-1/+1
| | | | Sometimes better than the default copying, enabled by +RTS -w
* FIX #2164: check for ThreadRelocated in isAlive()Simon Marlow2008-05-281-0/+5
|
* remove EVACUATED: store the forwarding pointer in the info pointerSimon Marlow2008-04-171-5/+9
|
* optimisation for isAlive()Simon Marlow2008-04-161-1/+1
|
* Add a write barrier to the TSO link field (#1589)Simon Marlow2008-04-161-1/+1
|
* Use the BF_EVACUATED flag to indicate to-space consistentlySimon Marlow2008-04-161-3/+0
| | | | | | | | | BF_EVACUATED is now set on all blocks except those that we are copying. This means we don't need a separate test for gen>N in evacuate(), because in generations older than N, BF_EVACUATED will be set anyway. The disadvantage is that we have to reset the BF_EVACUATED flag on the blocks of any generation we're collecting before starting GC. Results in a small speed improvement.
* Reorganisation to fix problems related to the gct register variableSimon Marlow2008-04-161-0/+140
- GCAux.c contains code not compiled with the gct register enabled, it is callable from outside the GC - marking functions are moved to their relevant subsystems, outside the GC - mark_root needs to save the gct register, as it is called from outside the GC