1. 11 Mar, 2010 2 commits
    • Simon Marlow's avatar
      Use message-passing to implement throwTo in the RTS · 7408b392
      Simon Marlow authored
      This replaces some complicated locking schemes with message-passing
      in the implementation of throwTo. The benefits are
      
       - previously it was impossible to guarantee that a throwTo from
         a thread running on one CPU to a thread running on another CPU
         would be noticed, and we had to rely on the GC to pick up these
         forgotten exceptions. This no longer happens.
      
       - the locking regime is simpler (though the code is about the same
         size)
      
       - threads can be unblocked from a blocked_exceptions queue without
         having to traverse the whole queue now.  It's a rare case, but
         replaces an O(n) operation with an O(1).
      
       - generally we move in the direction of sharing less between
         Capabilities (aka HECs), which will become important with other
         changes we have planned.
      
      Also in this patch I replaced several STM-specific closure types with
      a generic MUT_PRIM closure type, which allowed a lot of code in the GC
      and other places to go away, hence the line-count reduction.  The
      message-passing changes resulted in about a net zero line-count
      difference.
      7408b392
    • Simon Marlow's avatar
      12cfec94
  2. 23 Nov, 2009 1 commit
  3. 09 Mar, 2010 2 commits
    • 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
    • Simon Marlow's avatar
      Fix a rare deadlock when the IO manager thread is slow to start up · f8a01fb3
      Simon Marlow authored
      This fixes occasional failures of ffi002(threaded1) on a loaded
      machine.
      f8a01fb3
  4. 26 Feb, 2010 2 commits
    • Simon Marlow's avatar
      Tweak the tracing flags slightly, and clean up error handling and diagnostics · cd6bd66f
      Simon Marlow authored
      Tracing flags are now:
      
         -l[flags]  Log events in binary format to the file <program>.eventlog
         -v[flags]  Log events to stderr
                    where [flags] can contain:
                       s    scheduler events
                       t    add time stamps (only useful with -v)
      
      and there are more helpful error messages when using flags that are
      only available in particular variants of the RTS:
      
       the flag -v requires the program to be built with -debug
       the flag -Ds requires the program to be built with -debug
       the flag -p requires the program to be built with -prof
       the flag -N requires the program to be built with -threaded
       the flag -v requires the program to be built with -debug
      
      Also, I fixed the crash reported in #3874, with +RTS -ls -v.
      cd6bd66f
    • Simon Marlow's avatar
  5. 22 Feb, 2010 1 commit
  6. 16 Feb, 2010 2 commits
    • Simon Marlow's avatar
      32578fc5
    • Simon Marlow's avatar
      Fix a bug that can lead to noDuplicate# not working sometimes. · c44aaa10
      Simon Marlow authored
      The symptom is that under some rare conditions when running in
      parallel, an unsafePerformIO or unsafeInterleaveIO computation might
      be duplicated, so e.g. lazy I/O might give the wrong answer (the
      stream might appear to have duplicate parts or parts missing).
      
      I have a program that demonstrates it -N3 or more, some lazy I/O, and
      a lot of shared mutable state.  See the comment with stg_noDuplicatezh
      in PrimOps.cmm that explains the problem and the fix.  This took me
      about a day to find :-(
      c44aaa10
  7. 15 Feb, 2010 1 commit
  8. 03 Feb, 2010 3 commits
  9. 02 Feb, 2010 1 commit
  10. 30 Jan, 2010 1 commit
  11. 28 Jan, 2010 1 commit
    • Simon Marlow's avatar
      tweak the totally-bogus arbitrary stack-squeezing heuristic to fix #2797 · 990171bf
      Simon Marlow authored
      In #2797, a program that ran in constant stack space when compiled
      needed linear stack space when interpreted.  It turned out to be
      nothing more than stack-squeezing not happening.  We have a heuristic
      to avoid stack-squeezing when it would be too expensive (shuffling a
      large amount of memory to save a few words), but in some cases even
      expensive stack-squeezing is necessary to avoid linear stack usage.
      One day we should implement stack chunks, which would make this less
      expensive.
      990171bf
  12. 27 Jan, 2010 5 commits
  13. 26 Jan, 2010 3 commits
    • Simon Marlow's avatar
      Fix signal segfaults on Solaris (#3790) · aa2e8180
      Simon Marlow authored
      aa2e8180
    • Simon Marlow's avatar
      comment-out an incorrect assertion · cd2773d8
      Simon Marlow authored
      cd2773d8
    • Simon Marlow's avatar
      Fix a deadlock, and possibly other problems · 3b97d0d0
      Simon Marlow authored
      After a bound thread had completed, its TSO remains in the heap until
      it has been GC'd, although the associated Task is returned to the
      caller where it is freed and possibly re-used.  
      
      The bug was that GC was following the pointer to the Task and updating
      the TSO field, meanwhile the Task had already been recycled (it was
      being used by exitScheduler()). Confusion ensued, leading to a very
      occasional deadlock at shutdown, but in principle it could result in
      other crashes too.
      
      The fix is to remove the link between the TSO and the Task when the
      TSO has completed and the call to schedule() has returned; see
      comments in Schedule.c.
      3b97d0d0
  14. 22 Jan, 2010 5 commits
  15. 20 Jan, 2010 3 commits
  16. 16 Dec, 2009 1 commit
    • howard_b_golden@yahoo.com's avatar
      FIX #2615 (linker scripts in .so files) · e020e387
      howard_b_golden@yahoo.com authored
      This patch does not apply to Windows. It only applies to systems with
      ELF binaries.
      
      This is a patch to rts/Linker.c to recognize linker scripts in .so
      files and find the real target .so shared library for loading.
      e020e387
  17. 19 Jan, 2010 2 commits
  18. 31 Dec, 2009 1 commit
  19. 30 Dec, 2009 2 commits
  20. 23 Nov, 2009 1 commit