1. 13 Mar, 2000 3 commits
  2. 07 Mar, 2000 1 commit
  3. 29 Feb, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-02-29 14:38:19 by simonmar] · 2edb4793
      simonmar authored
      Ctrl-C now interrupts the RTS safely.  Previously it called
      shutdownHaskellAndExit() from the signal handler directly, which isn't
      safe because we may have been interrupted during GC or whatever.  Now
      we set the interrupted flag and wait for the RTS to shut down by
      itself.
      2edb4793
  4. 30 Jan, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-01-30 10:25:27 by simonmar] · ca2ab438
      simonmar authored
      Change the type of catch# to
      
      	catch# :: (W# -> (# W#, a #))
      	       -> (b -> W# -> (# W#, a #))
      	       -> W# -> (# W# , a #)
      
      where W# == State# RealWorld.  In other words, make it explicit that
      catch# is an IO operation and takes IO operations as arguments.  The
      previous type was too general, and resulted in catch# having the wrong
      arity which could cause mis-optimisations.
      
      The down side is that we now have to pass the state token around
      inside the primop instead of doing it in the Haskell wrapper, and
      raiseAsync() also has to build a PAP(handler,exception,realworld)
      instead of just a PAP(handler,exception) when it invokes a handler as
      a result of an async exception.
      
      I also added some optimisations to (un)?blockAsyncException to not
      grow the stack if it can be avoided, such as when we're about to block
      async exceptions and there's a blockAsyncExceptions_ret stack frame on
      the top of the stack.
      ca2ab438
  5. 22 Jan, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-01-22 18:00:03 by simonmar] · a1750cd6
      simonmar authored
      Fix bug in async exception handling: the target TSO may have been
      relocated as a result of a stack overflow.
      
      Introduce a new StgTSOWhatNext value "ThreadRelocated", which
      indicates that this TSO has moved, and the new location is in the link
      field.  The garbage collector shorts these out just like indirections.
      
      We have to check for relocated TSOs in killThread# (and any other
      primops which take a ThreadId# as an argument - there aren't any at
      present).
      a1750cd6
  6. 14 Jan, 2000 3 commits
  7. 13 Jan, 2000 2 commits
  8. 12 Jan, 2000 1 commit
  9. 01 Dec, 1999 3 commits
    • simonmar's avatar
      [project @ 1999-12-01 16:13:25 by simonmar] · 58d28d4e
      simonmar authored
      initialize the blocked_exceptions field of a TSO properly.
      58d28d4e
    • simonmar's avatar
      [project @ 1999-12-01 14:58:09 by simonmar] · 52457dfe
      simonmar authored
      Fix the case where we're killing a thread that is blocked on
      delivering an exception.
      52457dfe
    • simonmar's avatar
      [project @ 1999-12-01 14:34:38 by simonmar] · e1dc924b
      simonmar authored
      Support for blocking & unblocking asynchronous exceptions.
      
        - new primops:
      
      	blockAsyncExceptions#, unblockAsyncExceptions# :: IO a -> IO a
      
        - raiseInThread will block if the target thread is currently
          blocking async exceptions.
      
        - async exceptions are currently implicitly blocked inside
          an exception handler.  This decision might be reversed when
          we have more experience with this stuff.
      
        - Move exception-related stuff in the RTS into its own file,
          Exception.{h,hc}.
      e1dc924b
  10. 19 Nov, 1999 1 commit
  11. 18 Nov, 1999 1 commit
  12. 15 Nov, 1999 1 commit
  13. 11 Nov, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-11-11 17:19:15 by simonmar] · bc9cfb59
      simonmar authored
      Re-instate interrupted stuff.  If the scheduler finds the interrupted
      flag to be set, it calls deleteThread() on all the runnable and
      blocked threads, wakes up any main thread clients that were waiting,
      and then either
      
      	(a) returns, in the UP case
      	(b) waits for more work, in the SMP case.
      bc9cfb59
  14. 09 Nov, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-11-09 15:46:49 by simonmar] · 30681e79
      simonmar authored
      A slew of SMP-related changes.
      
       - New locking scheme for thunks: we now check whether the thunk
         being entered is in our private allocation area, and if so
         we don't lock it.  Well, that's the upshot.  In practice it's
         a lot more fiddly than that.
      
       - I/O blocking is handled a bit more sanely now (but still not
         properly, methinks)
      
       - deadlock detection is back
      
       - remove old pre-SMP scheduler code
      
       - revamp the timing code.  We actually get reasonable-looking
         timing info for SMP programs now.
      
       - fix a bug in the garbage collector to do with IND_OLDGENs appearing
         on the mutable list of the old generation.
      
       - move BDescr() function from rts/BlockAlloc.h to includes/Block.h.
      
       - move struct generation and struct step into includes/StgStorage.h (sigh)
      
       - add UPD_IND_NOLOCK for updating with an indirection where locking
         the black hole is not required.
      30681e79
  15. 08 Nov, 1999 1 commit
  16. 02 Nov, 1999 2 commits
    • simonmar's avatar
      [project @ 1999-11-02 17:19:15 by simonmar] · c6ff5639
      simonmar authored
      Time the shutdown code as well as the initialisation code.  This
      figure is sometimes significant for SMP, because the tasks are all
      killed by a signal (at the moment) and it might take a while for the
      signal to be delivered.
      c6ff5639
    • simonmar's avatar
      [project @ 1999-11-02 15:05:38 by simonmar] · f6692611
      simonmar authored
      This commit adds in the current state of our SMP support.  Notably,
      this allows the new way 's' to be built, providing support for running
      multiple Haskell threads simultaneously on top of any pthreads
      implementation, the idea being to take advantage of commodity SMP
      boxes.
      
      Don't expect to get much of a speedup yet; due to the excessive
      locking required to synchronise access to mutable heap objects, you'll
      see a slowdown in most cases, even on a UP machine.  The best I've
      seen is a 1.6-1.7 speedup on an example that did no locking (two
      optimised nfibs in parallel).
      
      	- new RTS -N flag specifies how many pthreads to start.
      
      	- new driver -smp flag, tells the driver to use way 's'.
      
      	- new compiler -fsmp option (not for user comsumption)
      	  tells the compiler not to generate direct jumps to
      	  thunk entry code.
      
      	- largely rewritten scheduler
      
      	- _ccall_GC is now done by handing back a "token" to the
      	  RTS before executing the ccall; it should now be possible
      	  to execute blocking ccalls in the current thread while
      	  allowing the RTS to continue running Haskell threads as
      	  normal.
      
      	- you can only call thread-safe C libraries from a way 's'
      	  build, of course.
      
      Pthread support is still incomplete, and weird things (including
      deadlocks) are likely to happen.
      f6692611
  17. 19 Oct, 1999 1 commit
  18. 04 Oct, 1999 1 commit
  19. 10 Sep, 1999 1 commit
  20. 25 Aug, 1999 2 commits
    • simonmar's avatar
      [project @ 1999-08-25 16:11:43 by simonmar] · c6ab4bfa
      simonmar authored
      Support for thread{WaitRead,WaitWrite,Delay}.  These should behave
      identically to the 3.02 implementations.
      
      We now have the virtual timer on during all program runs, which ticks
      at 50Hz by default.  This is used to implement threadDelay, so you
      won't get any better granularity than the tick frequency
      unfortunately.  It remains to be seen whether using the virtual timer
      will have a measurable impact on performance for non-threadDelaying
      programs.
      
      All operations in the I/O subsystem should now be non-blocking with
      respect to other running Haskell threads.  It remains to be seen
      whether this will have a measurable performance impact on
      non-concurrent programs (probably not).
      c6ab4bfa
    • simonmar's avatar
      [project @ 1999-08-25 10:23:51 by simonmar] · 68146c5b
      simonmar authored
      Eq and Ord instances for ThreadId.
      68146c5b
  21. 25 Jun, 1999 1 commit
  22. 11 May, 1999 1 commit
    • keithw's avatar
      [project @ 1999-05-11 16:47:39 by keithw] · eb407ca1
      keithw authored
      (this is number 9 of 9 commits to be applied together)
      
        Usage verification changes / ticky-ticky changes:
      
        We want to verify that SingleEntry thunks are indeed entered at most
        once.  In order to do this, -ticky / -DTICKY_TICKY turns on eager
        blackholing.  We blackhole with new blackholes: SE_BLACKHOLE and
        SE_CAF_BLACKHOLE.  We will enter one of these if we attempt to enter
        a SingleEntry thunk twice.  Note that CAFs are dealt with in by
        codeGen, and ordinary thunks by the RTS.
      
        We also want to see how many times we enter each Updatable thunk.
        To this end, we have modified -ticky.  When -ticky is on, we update
        with a permanent indirection, and arrange that when we enter a
        permanent indirection we count the entry and then convert the
        indirection to a normal indirection.  This gives us a means of
        counting the number of thunks entered again after the first entry.
        Obviously this screws up profiling, and so you can't build a ticky
        and profiling compiler any more.
      
        Also a few other changes that didn't make it into the previous 8
        commits, but form a part of this set.
      eb407ca1
  23. 27 Apr, 1999 1 commit
  24. 20 Mar, 1999 1 commit
  25. 17 Mar, 1999 2 commits
    • simonm's avatar
      [project @ 1999-03-17 13:19:19 by simonm] · d9eb68cf
      simonm authored
      - Stack overflow now generates an (AsyncException StackOverflow)
        exception, which can be caught as normal.
      
      - Add a stack overflow handler to the top-level mainIO handler, with
        the standard behaviour (i.e. call the stack overflow hook and then
        exit).
      
      - Add a test for stack overflow catching.
      
      - Fix a couple of bugs in async exception support.
      d9eb68cf
    • simonm's avatar
      [project @ 1999-03-17 09:50:08 by simonm] · 32e46064
      simonm authored
      When resizing a stack, set the Sp and Su of the old, dead, TSO to be just
      beyond the end of its stack so we don't attempt to scavenge any part of
      the stack in case we come across this TSO during GC.
      32e46064
  26. 16 Mar, 1999 1 commit
    • simonm's avatar
      [project @ 1999-03-16 13:20:07 by simonm] · 456eca73
      simonm authored
      Improvements to the threading model.
      
         - asynchronous exceptions supported.
      
      	- killThread# can now raise an exception in the specified
      	  thread.  It's new type is
      
      		killThread# :: ThreadId# -> Exception -> IO ()
      
      	  High-level versions:
      
      		killThread :: ThreadId -> IO ()
      		raiseInThread :: ThreadId -> Exception -> IO ()
      
      	  (killThread raises a 'ThreadKilled' exception in the
      	   specified thread).
      
      	  If the thread has no exception handler, it is killed
      	  as before.  Otherwise, the exception is passed to
      	  the innermost CATCH_FRAME and the thread is woken up
      	  if it was blocked.  The current computation is
      	  suspended, instead of being replaced by the exception
      	  (as is the case with throw).
      
      	  Sending an exception to the current thread works too.
      
         - new primitive: myThreadId# :: IO ThreadId# and corresponding
           high-level version myThreadId :: IO ThreadId.
      
         - new primitive: yield# :: IO (), and yield :: IO ().
      
         - the TSO now contains a pointer to the resource currently blocked
           on (MVAR or BLACKHOLE_BQ).
      
        - Add a giant comment to TSO.h about what the various link fields
          are supposed to do, and invariants etc.
      456eca73
  27. 08 Mar, 1999 1 commit
  28. 03 Mar, 1999 1 commit
  29. 02 Mar, 1999 1 commit
  30. 26 Feb, 1999 1 commit