Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Oct 7, 2011
  1. Enable pthread_getspecific() tls for LLVM compiler

    LLVM does not support the __thread attribute for thread
    local storage and may generate incorrect code for global
    register variables. We want to allow building the runtime with
    LLVM-based compilers such as llvm-gcc and clang,
    particularly for MacOS.
    This patch changes the gct variable used by the garbage
    collector to use pthread_getspecific() for thread local
    storage when an llvm based compiler is used to build the
Commits on Jun 25, 2011
  1. @igfoo

    Fix gcc 4.6 warnings; fixes #5176

    igfoo authored
    Based on a patch from David Terei.
    Some parts are a little ugly (e.g. defining things that only ASSERTs
    use only when DEBUG is defined), so we might want to tweak things a
    I've also turned off -Werror for didn't-inline warnings, as we now
    get a few such warnings.
Commits on Apr 11, 2011
  1. @simonmar

    Refactoring and tidy up

    simonmar authored
    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
Commits on Dec 21, 2010
  1. @simonmar

    boundTaskExiting: don't set task->stopped unless this is the last cal…

    simonmar authored
    …l (#4850)
    The bug in this case was that we had a worker thread making a foreign
    call which invoked a callback (in this case it was performGC, I
    think).  When the callback ended, boundTaskExiting() was setting
    task->stopped, but the Task is now per-OS-thread, so it is shared by
    the worker that made the original foreign call.  When the foreign call
    returned, because task->stopped was set, the worker was not placed on
    the queue of spare workers.  Somehow the worker woke up again, and
    found the spare_workers queue empty, which lead to a crash.
    Two bugs here: task->stopped should not have been set by
    boundTaskExiting (this broke when I split the Task and InCall structs,
    in 6.12.2), and releaseCapabilityAndQueueWorker() should not be
    testing task->stopped anyway, because it should only ever be called
    when task->stopped is false (this is now an assertion).
Commits on Nov 13, 2010
  1. @igfoo

    Fix up the ifdefs in Task.c

    igfoo authored
Commits on Nov 11, 2010
  1. @ezyang
Commits on Sep 19, 2010
  1. @ezyang

    Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4

    ezyang authored
    This is patch that adds support for interruptible FFI calls in the form
    of a new foreign import keyword 'interruptible', which can be used
    instead of 'safe' or 'unsafe'.  Interruptible FFI calls act like safe
    FFI calls, except that the worker thread they run on may be interrupted.
    Internally, it replaces BlockedOnCCall_NoUnblockEx with
    BlockedOnCCall_Interruptible, and changes the behavior of the RTS
    to not modify the TSO_ flags on the event of an FFI call from
    a thread that was interruptible.  It also modifies the bytecode
    format for foreign call, adding an extra Word16 to indicate
    The semantics of interruption vary from platform to platform, but the
    intent is that any blocking system calls are aborted with an error code.
    This is most useful for making function calls to system library
    functions that support interrupting.  There is no support for pre-Vista
    There is a partner testsuite patch which adds several tests for this
Commits on Sep 15, 2010
  1. @simonmar

    Windows: use a thread-local variable for myTask()

    simonmar authored
    Which entailed fixing an incorrect #ifdef in Task.c
Commits on Jul 16, 2010
  1. @simonmar

    Use a separate mutex to protect all_tasks, avoiding a lock-order-reve…

    simonmar authored
    In GHC 6.12.x I found a rare deadlock caused by this
    AQ cap->lock
          AQ sched_mutex
      AQ sched_mutex
          AQ cap->lock
    so sched_mutex and cap->lock are taken in a different order in two
    This doesn't happen in the HEAD because we don't have
    scheduleCheckBlackHoles, but I thought it would be prudent to make
    this less likely to happen in the future by using a different mutex in
    newTask.  We can clearly see that the all_tasks mutex cannot be
    involved in a deadlock, becasue we never call anything else while
    holding it.
Commits on May 7, 2010
  1. @simonmar

    Fix crash in nested callbacks (#4038)

    simonmar authored
    Broken by "Split part of the Task struct into a separate struct
Commits on May 5, 2010
  1. @simonmar

    Make the running_finalizers flag task-local

    simonmar authored
    Fixes a bug reported by Lennart Augustsson, whereby we could get an
    incorrect error from the RTS about re-entry from a finalizer,
Commits on Mar 29, 2010
  1. @simonmar
Commits on Mar 11, 2010
  1. @simonmar
Commits on Mar 9, 2010
  1. @simonmar

    Split part of the Task struct into a separate struct InCall

    simonmar authored
    The idea is that this leaves Tasks and OSThread in one-to-one
    correspondence.  The part of a Task that represents a call into
    Haskell from C is split into a separate struct InCall, pointed to by
    the Task and the TSO bound to it.  A given OSThread/Task thus always
    uses the same mutex and condition variable, rather than getting a new
    one for each callback.  Conceptually it is simpler, although there are
    more types and indirections in a few places now.
    This improves callback performance by removing some of the locks that
    we had to take when making in-calls.  Now we also keep the current Task
    in a thread-local variable if supported by the OS and gcc (currently
    only Linux).
Commits on Aug 2, 2009
  1. @simonmar

    RTS tidyup sweep, first phase

    simonmar authored
    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
     - 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.
Commits on May 18, 2009
  1. @simonmar
Commits on Nov 19, 2008
  1. @simonmar

    Fix some more shutdown races

    simonmar authored
    There were races between workerTaskStop() and freeTaskManager(): we
    need to be sure that all Tasks have exited properly before we start
    tearing things down.  This isn't completely straighforward, see
    comments for details.
Commits on Oct 23, 2008
  1. @simonmar

    Pad Capabilities and Tasks to 64 bytes

    simonmar authored
    This is just good practice to avoid placing two structures heavily
    accessed by different CPUs on the same cache line
Commits on Mar 6, 2007
  1. workerTaskStop(): set task->cap = NULL

    Simon Marlow authored
    avoids an assertion failure in newBoundTask()
Commits on Feb 22, 2007
  1. @igfoo
Commits on Feb 20, 2007
  1. freeTaskManager: don't free Tasks that are still in use

    Simon Marlow authored
    See conc059.
Commits on Dec 15, 2006
  1. @igfoo
  2. @igfoo
Commits on Dec 12, 2006
  1. Don't free sched_mutex until freeTaskManager has finished with it

    Simon Marlow authored
    Also move closeMutex() etc. into freeTaskManager, this is a free-ish thing
Commits on Dec 11, 2006
  1. @igfoo

    Add freeScheduler/freeTaskManager and call it later than exitScheduler

    igfoo authored
    We were freeing the tasks in exitScheduler (stopTaskManager) before
    exitStorage (stat_exit), but the latter needs to walk down the list
    printing stats. Resulted in segfaults with commands like
        ghc -v0 -e main q.hs -H32m -H32m +RTS -Sstderr
    (where q.hs is trivial), but very sensitive to exact commandline and
    libc version or something.
Commits on Oct 24, 2006
  1. Split GC.c, and move storage manager into sm/ directory

    Simon Marlow authored
    In preparation for parallel GC, split up the monolithic GC.c file into
    smaller parts.  Also in this patch (and difficult to separate,
      - Don't include Stable.h in Rts.h, instead just include it where
      - 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.
Commits on Aug 31, 2006
  1. free the task *after* calling closeCond and closeMutex

    Simon Marlow authored
Commits on Aug 30, 2006
  1. add sysErrorBelch() for reporting system call errors

    Simon Marlow authored
Commits on Aug 23, 2006
  1. Add closeMutex and use it on clean up

    Esa Ilari Vuokko authored
Commits on Aug 10, 2006
  1. Match format strings and arguments for printf-like functions authored
Commits on Aug 9, 2006
  1. fix bug in task freeing

    Simon Marlow authored
  2. Remove the artifical cap on the number of workers

    Simon Marlow authored
    See #805.  This was here to catch bugs that resulted in an infinite
    number of worker threads being created.  However, we can't put a
    reasonable bound on the number of worker threads, because legitimate
    programs may need to create large numbers of (probably blocked) worker
    threads.  Furthermore, the OS probably has a bound on the number of
    threads that a process can create in any case.
Commits on Aug 8, 2006
  1. Remember to free() memory on exit

    Simon Marlow authored
    Patch mostly from Lennart Augustsson in #803, with additions to
    Task.c by me.
Commits on Jun 16, 2006
  1. make compilation a little less noisy

    Simon Marlow authored
  2. allow the max number of workers to scale with +RTS -N

    Simon Marlow authored
Something went wrong with that request. Please try again.