summaryrefslogtreecommitdiff
path: root/rts/Sparks.c
Commit message (Collapse)AuthorAgeFilesLines
* Windows DLLs: use DLL aware runSparks_closure instead of ↵Ben.Lippmeier@anu.edu.au2009-11-231-1/+1
| | | | base_GHCziConc_runSparks_closure directly
* Expose all EventLog events as DTrace probesManuel M T Chakravarty2009-12-121-1/+1
| | | | | | | | | | | | | | - Defines a DTrace provider, called 'HaskellEvent', that provides a probe for every event of the eventlog framework. - In contrast to the original eventlog, the DTrace probes are available in all flavours of the runtime system (DTrace probes have virtually no overhead if not enabled); when -DTRACING is defined both the regular event log as well as DTrace probes can be used. - Currently, Mac OS X only. User-space DTrace probes are implemented differently on Mac OS X than in the original DTrace implementation. Nevertheless, it shouldn't be too hard to enable these probes on other platforms, too. - Documentation is at http://hackage.haskell.org/trac/ghc/wiki/DTrace
* Unify event logging and debug tracing.Simon Marlow2009-08-291-7/+5
| | | | | | | | | | | | | | | | | | | - tracing facilities are now enabled with -DTRACING, and -DDEBUG additionally enables debug-tracing. -DEVENTLOG has been removed. - -debug now implies -eventlog - events can be printed to stderr instead of being sent to the binary .eventlog file by adding +RTS -v (which is implied by the +RTS -Dx options). - -Dx debug messages can be sent to the binary .eventlog file by adding +RTS -l. This should help debugging by reducing the impact of debug tracing on execution time. - Various debug messages that duplicated the information in events have been removed.
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-12/+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.
* Remove old GUM/GranSim codeSimon Marlow2009-06-021-660/+2
|
* Add EVENT_CREATE_SPARK_THREAD to replace EVENT_SPARK_TO_THREADSimon Marlow2009-04-231-6/+1
| | | | Also some tidyups and renaming
* For consistency, changed access of thread id to be through capability ↵donnie@darthik.com2009-04-131-1/+1
| | | | instead of directly from StgRegTable.
* Added new EventLog event: Spark to Thread.donnie@darthik.com2009-04-131-0/+7
|
* Eventlog support for new event type: create spark.donnie@darthik.com2009-04-031-0/+3
|
* Refactor the spark queue implementation into a generic work-stealing dequeSimon Marlow2009-02-051-299/+37
| | | | So we can use this abstraction elsewhere in the RTS
* Fix some unsigned comparisions that should be signedSimon Marlow2008-11-191-3/+8
| | | | | Fixes crashes when using reclaimSpark() (not used currently, but may be in the future).
* Remove incorrect assertions in steal()Simon Marlow2008-11-191-2/+6
|
* pruneSparkQueue(): fix bug when top>bottomSimon Marlow2008-11-061-0/+6
|
* Run sparks in batches, instead of creating a new thread for each oneSimon Marlow2008-11-061-4/+6
| | | | | Signficantly reduces the overhead for par, which means that we can make use of paralellism at a much finer granularity.
* retreat the top/bottom fields of the spark pool in pruneSparkPool()Simon Marlow2008-11-051-0/+7
|
* traverse the spark pools only once during GC rather than twiceSimon Marlow2008-10-221-20/+29
|
* Refactoring and reorganisation of the schedulerSimon Marlow2008-10-221-67/+58
| | | | | | | | | | | | | | | | | Change the way we look for work in the scheduler. Previously, checking to see whether there was anything to do was a non-side-effecting operation, but this has changed now that we do work-stealing. This lead to a refactoring of the inner loop of the scheduler. Also, lots of cleanup in the new work-stealing code, but no functional changes. One new statistic is added to the +RTS -s output: SPARKS: 1430 (2 converted, 1427 pruned) lets you know something about the use of `par` in the program.
* Work stealing for sparksberthold@mathematik.uni-marburg.de2008-09-151-108/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | Spark stealing support for PARALLEL_HASKELL and THREADED_RTS versions of the RTS. Spark pools are per capability, separately allocated and held in the Capability structure. The implementation uses Double-Ended Queues (deque) and cas-protected access. The write end of the queue (position bottom) can only be used with mutual exclusion, i.e. by exactly one caller at a time. Multiple readers can steal()/findSpark() from the read end (position top), and are synchronised without a lock, based on a cas of the top position. One reader wins, the others return NULL for a failure. Work stealing is called when Capabilities find no other work (inside yieldCapability), and tries all capabilities 0..n-1 twice, unless a theft succeeds. Inside schedulePushWork, all considered cap.s (those which were idle and could be grabbed) are woken up. Future versions should wake up capabilities immediately when putting a new spark in the local pool, from newSpark(). Patch has been re-recorded due to conflicting bugfixes in the sparks.c, also fixing a (strange) conflict in the scheduler.
* Separate pruning from marking of spark poolsSimon Marlow2008-09-091-7/+13
| | | | Fixes crash when using compacting GC in parallel programs
* Undo fix for #2185: sparks really should be treated as rootsSimon Marlow2008-07-231-6/+7
| | | | | Unless sparks are roots, strategies don't work at all: all the sparks get GC'd. We need to think about this some more.
* debug message tweaksSimon Marlow2008-07-231-1/+1
|
* FIX #2185: sparks should not be treated as roots by the GCSimon Marlow2008-04-241-18/+23
|
* Reorganisation to fix problems related to the gct register variableSimon Marlow2008-04-161-0/+69
| | | | | | | | | - 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
* move markSparkQueue into GC.c, as it needs the register variable definedSimon Marlow2008-01-091-68/+0
|
* have each GC thread call GetRoots()simonmar@microsoft.com2007-12-131-46/+43
|
* Pointer TaggingSimon Marlow2007-07-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | This patch implements pointer tagging as per our ICFP'07 paper "Faster laziness using dynamic pointer tagging". It improves performance by 10-15% for most workloads, including GHC itself. The original patches were by Alexey Rodriguez Yakushev <mrchebas@gmail.com>, with additions and improvements by me. I've re-recorded the development as a single patch. The basic idea is this: we use the low 2 bits of a pointer to a heap object (3 bits on a 64-bit architecture) to encode some information about the object pointed to. For a constructor, we encode the "tag" of the constructor (e.g. True vs. False), for a function closure its arity. This enables some decisions to be made without dereferencing the pointer, which speeds up some common operations. In particular it enables us to avoid costly indirect jumps in many cases. More information in the commentary: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging
* Free various things we allocateIan Lynagh2006-12-151-0/+5
|
* Split GC.c, and move storage manager into sm/ directorySimon Marlow2006-10-241-1/+1
| | | | | | | | | | | | | | | | | In preparation for parallel GC, split up the monolithic GC.c file into smaller parts. Also in this patch (and difficult to separate, unfortunatley): - Don't include Stable.h in Rts.h, instead just include it where necessary. - consistently use STATIC_INLINE in source files, and INLINE_HEADER in header files. STATIC_INLINE is now turned off when DEBUG is on, to make debugging easier. - The GC no longer takes the get_roots function as an argument. We weren't making use of this generalisation.
* fix a couple of bugs in markSparkQueue (#799)Simon Marlow2006-06-231-1/+3
|
* New tracing interfaceSimon Marlow2006-06-081-11/+12
| | | | | | | | A simple interface for generating trace messages with timestamps and thread IDs attached to them. Most debugging output goes through this interface now, so it is straightforward to get timestamped debugging traces with +RTS -vt. Also, we plan to use this to generate parallelism profiles from the trace output.
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+881
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.