1. 25 Jun, 2011 1 commit
    • Ian Lynagh's avatar
      Fix gcc 4.6 warnings; fixes #5176 · 0a6f26f6
      Ian Lynagh 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
      little.
      
      I've also turned off -Werror for didn't-inline warnings, as we now
      get a few such warnings.
      0a6f26f6
  2. 11 Apr, 2011 1 commit
    • Simon Marlow's avatar
      Refactoring and tidy up · 1fb38442
      Simon Marlow 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
      1fb38442
  3. 21 Dec, 2010 1 commit
    • Simon Marlow's avatar
      boundTaskExiting: don't set task->stopped unless this is the last call (#4850) · 9201a2d1
      Simon Marlow authored
      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).
      9201a2d1
  4. 13 Nov, 2010 1 commit
  5. 11 Nov, 2010 1 commit
  6. 19 Sep, 2010 1 commit
    • Edward Z. Yang's avatar
      Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4 · 83d563cb
      Edward Z. Yang 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
      interruptibility.
      
      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
      Windows.
      
      There is a partner testsuite patch which adds several tests for this
      functionality.
      83d563cb
  7. 15 Sep, 2010 1 commit
  8. 16 Jul, 2010 1 commit
    • Simon Marlow's avatar
      Use a separate mutex to protect all_tasks, avoiding a lock-order-reversal · ed301949
      Simon Marlow authored
      In GHC 6.12.x I found a rare deadlock caused by this
      lock-order-reversal:
      
      AQ cap->lock
        startWorkerTask
          newTask
            AQ sched_mutex
      
      scheduleCheckBlackHoles
        AQ sched_mutex
         unblockOne_
          wakeupThreadOnCapabilty
            AQ cap->lock
      
      so sched_mutex and cap->lock are taken in a different order in two
      places.
      
      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.
      ed301949
  9. 07 May, 2010 1 commit
  10. 05 May, 2010 1 commit
  11. 29 Mar, 2010 1 commit
  12. 11 Mar, 2010 1 commit
  13. 09 Mar, 2010 1 commit
    • Simon Marlow's avatar
      Split part of the Task struct into a separate struct InCall · 7effbbbb
      Simon Marlow 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).
      7effbbbb
  14. 02 Aug, 2009 1 commit
    • Simon Marlow's avatar
      RTS tidyup sweep, first phase · a2a67cd5
      Simon Marlow 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
         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.
      a2a67cd5
  15. 18 May, 2009 1 commit
  16. 19 Nov, 2008 1 commit
    • Simon Marlow's avatar
      Fix some more shutdown races · 5cbe7adb
      Simon Marlow 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.
      5cbe7adb
  17. 23 Oct, 2008 1 commit
  18. 06 Mar, 2007 1 commit
  19. 22 Feb, 2007 1 commit
  20. 20 Feb, 2007 1 commit
  21. 15 Dec, 2006 2 commits
  22. 12 Dec, 2006 1 commit
  23. 11 Dec, 2006 1 commit
    • Ian Lynagh's avatar
      Add freeScheduler/freeTaskManager and call it later than exitScheduler · cf6b495d
      Ian Lynagh 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.
      cf6b495d
  24. 24 Oct, 2006 1 commit
    • Simon Marlow's avatar
      Split GC.c, and move storage manager into sm/ directory · ab0e778c
      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,
      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.
      ab0e778c
  25. 31 Aug, 2006 1 commit
  26. 30 Aug, 2006 1 commit
  27. 23 Aug, 2006 1 commit
  28. 10 Aug, 2006 1 commit
  29. 09 Aug, 2006 2 commits
    • Simon Marlow's avatar
      fix bug in task freeing · d54ca9c5
      Simon Marlow authored
      d54ca9c5
    • Simon Marlow's avatar
      Remove the artifical cap on the number of workers · 7b8b9040
      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.
      
      
      7b8b9040
  30. 08 Aug, 2006 1 commit
  31. 16 Jun, 2006 2 commits
  32. 08 Jun, 2006 1 commit
    • Simon Marlow's avatar
      New tracing interface · 5a2769f0
      Simon Marlow authored
      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.
      5a2769f0
  33. 07 Jun, 2006 1 commit
  34. 07 Apr, 2006 1 commit
    • Simon Marlow's avatar
      Reorganisation of the source tree · 0065d5ab
      Simon Marlow authored
      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.
      0065d5ab
  35. 17 Mar, 2006 1 commit
  36. 16 Mar, 2006 2 commits