1. 27 May, 2005 1 commit
  2. 25 May, 2005 3 commits
  3. 23 May, 2005 2 commits
    • simonmar's avatar
      [project @ 2005-05-23 15:44:10 by simonmar] · 6d16c476
      simonmar authored
      Simplify and improve the Capability-passing machinery for bound
      threads.
      
      The old story was quite complicated: if you find a thread on the run
      queue which the current task can't run, you had to call
      passCapability(), which set a flag saying where the next Capability
      was to go, and then release the Capability.  When multiple
      Capabilities are flying around, it's not clear how this story should
      extend.
      
      The new story is much simpler: each time around the scheduler loop,
      the task looks to see whether it can make any progress, and if not, it
      releases its Capability and wakes up a task which *can* make some
      progress.  The predicate for whether we can make any progress is
      encapsulated in the (inline) function ANY_WORK_FOR_ME(Condition).
      Waking up an appropriate task is encapsulated in the function
      threadRunnable() (previously it was in two places).
      
      The logic in Capability.c is simpler, but unfortunately it is now more
      closely connected with the Scheduler, because it inspects the run
      queue.  However, performance when communicating between bound and
      unbound threads might be better.
      
      The concurrency tests still work, so hopefully this hasn't broken
      anything.
      6d16c476
    • simonmar's avatar
      [project @ 2005-05-23 13:39:55 by simonmar] · 58150db0
      simonmar authored
      - scheduleDetectDeadlock() should invoke GarbageCollect() via
        scheduleDoGC(), which collects the Capabilities first.
      
      - scheduleDoGC() doesn't need the Capability.  Also, it appears that
        there was an out-of-bounds array access in here.
      
      - add printThreadQueue(), useful from gdb.
      
      - fix a couple of warnings.
      58150db0
  4. 21 May, 2005 1 commit
  5. 20 May, 2005 1 commit
    • krasimir's avatar
      [project @ 2005-05-20 14:40:50 by krasimir] · 65ebd31a
      krasimir authored
      Bugfix: in rtsFatalInternalErrorFn vsnprintf function was used instead of
      snprintf. The code is changed so that the error message will be displayed
      even if it is longer that BUFSIZE.
      65ebd31a
  6. 19 May, 2005 4 commits
    • simonmar's avatar
      [project @ 2005-05-19 13:46:24 by simonmar] · 88825a2e
      simonmar authored
      Fix locking when unblocking a thread in take/putMVar.  Due to CPP
      nonsense the previous locking wasn't actually working, which lead to
      deadlock problems.  It now turns out that I can call unblockOne
      directly rather than needing unblockOneLocked (the lock on the MVar
      means I have exclusive access to the threads on its queue).
      88825a2e
    • simonmar's avatar
      [project @ 2005-05-19 13:21:55 by simonmar] · 3595da95
      simonmar authored
      - Move the call to threadPaused() from the scheduler into STG land,
        and put it in a new code fragment (stg_returnToSched) that we pass
        through every time we return from STG to the scheduler.  Also, the
        SAVE_THREAD_STATE() is now in stg_returnToSched which might save a
        little code space (at the expense of an extra jump for every return
        to the scheduler).
      
      - SMP: when blocking on an MVar, we now wait until the thread has been
        made fully safe and placed on the blocked queue of the MVar before
        we unlock the MVar.  This closes a race whereby another OS thread could
        begin waking us up before the current TSO had been properly tidied up.
      
      Fixes one cause of crashes when using MVars with SMP.  I still have a
      deadlock problem to track down.
      3595da95
    • simonmar's avatar
      [project @ 2005-05-19 11:13:23 by simonmar] · f01b31dd
      simonmar authored
      Add required include: #include "RtsFlags.h"
      f01b31dd
    • simonmar's avatar
      [project @ 2005-05-19 11:09:27 by simonmar] · e615ba8a
      simonmar authored
      Fix SMP build on Windows
      e615ba8a
  7. 18 May, 2005 3 commits
  8. 16 May, 2005 2 commits
    • simonmar's avatar
      [project @ 2005-05-16 14:27:07 by simonmar] · 33a84b8c
      simonmar authored
      Allow the amount of idle time which must pass before we force a major
      GC to be configured at runtime with the +RTS -I<secs> option.
      
      The idle GC only happens in the threaded RTS, and it is useful because
      it can make finalizers run more promptly, and also detect cases of
      deadlock.  Without the idle GC, Haskell computation must be taking
      place in order for finalizers to run or deadlock to be detected, and
      the only way some Haskell computation can take place is usually by
      in-calls.
      
      +RTS -I0 turns off the idle GC, the default is +RTS -I0.3.
      
      We might need to add more tuning if it turns out that the idle GC is
      problematic, for example we don't check how long the GC actually took,
      and we should probably back off if major GCs are taking too long and
      adversely affecting interactive responsiveness.
      33a84b8c
    • simonmar's avatar
      [project @ 2005-05-16 09:24:53 by simonmar] · 313797f8
      simonmar authored
      - re-initalise cap on returning from STG land, because we might now
        have a different capability.  ToDo: we should pass it back somehow,
        rather than looking it up in the hash table
      
      - export unblockOneLocked (we'll need this later)
      313797f8
  9. 15 May, 2005 1 commit
  10. 13 May, 2005 2 commits
  11. 12 May, 2005 2 commits
  12. 11 May, 2005 6 commits
  13. 10 May, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-05-10 13:25:41 by simonmar] · bf821981
      simonmar authored
      Two SMP-related changes:
      
        - New storage manager interface:
      
          bdescr *allocateLocal(StgRegTable *reg, nat words)
      
          which allocates from the current thread's nursery (being careful
          not to clash with the heap pointer).  It can do this without
          taking any locks; the lock only has to be taken if a block needs
          to be allocated.  allocateLocal() is now used instead of allocate()
          in a few PrimOps.
      
          This removes locks from most Integer operations, cutting down
          the overhead for SMP a bit more.
      
          To make this work, we have to be able to grab the current thread's
          Capability out of thin air (i.e. when called from GMP), so the
          Capability subsystem needs to keep a hash from thread IDs to
          Capabilities.
      
        - Small MVar optimisation: instead of taking the global
          storage-manager lock, do our own locking of MVars with a bit of
          inline assembly (x86 only for now).
      bf821981
  14. 09 May, 2005 2 commits
  15. 05 May, 2005 5 commits
    • sof's avatar
      [project @ 2005-05-05 18:14:27 by sof] · e96f56a1
      sof authored
      ocResolve_PEi386():
          when fixing up REL32 relocations, _add_ displacement to value at the
          given offset. The existing value has so far been assumed to be zero
          (which we've asserted for), but curiously wxhaskell-0.9.4's wx.o
          contains lots of interesting non-zero values. Information / specifications
          are awfully thin on the ground as to how to precisely handle these
          relocations, but adding rather than overwriting seems to have a
          generally healthy effect; unable to crash wxhaskell-0.9.4 with a 6.4 build.
      
      Merge to STABLE.
      e96f56a1
    • simonmar's avatar
      [project @ 2005-05-05 13:17:47 by simonmar] · 4ab21614
      simonmar authored
      Some fixes to the blackhole garbage collection strategy. conc049 is a
      great test case.
      4ab21614
    • simonmar's avatar
      [project @ 2005-05-05 11:35:29 by simonmar] · c2d428ba
      simonmar authored
      Treat the blackhole_queue as a weak list: it shouldn't keep its
      elements alive, because otherwise we can't detect deadlock using the
      GC.  Fortunately the fix is quite simple.
      c2d428ba
    • simonmar's avatar
      [project @ 2005-05-05 11:33:10 by simonmar] · 8ffe6eb9
      simonmar authored
      AP_STACK fix for SMP
      8ffe6eb9
    • simonmar's avatar
      [project @ 2005-05-05 11:19:42 by simonmar] · 96a1ac66
      simonmar authored
      Sanity fix for SMP
      96a1ac66
  16. 29 Apr, 2005 2 commits
  17. 28 Apr, 2005 1 commit
  18. 27 Apr, 2005 1 commit