patch applied (ghc): New implementation of BLACKHOLEs

Simon Marlow marlowsd at gmail.com
Tue Apr 6 10:34:38 EDT 2010


Mon Mar 29 07:44:56 PDT 2010  Simon Marlow <marlowsd at gmail.com>
  * New implementation of BLACKHOLEs
  
  This replaces the global blackhole_queue with a clever scheme that
  enables us to queue up blocked threads on the closure that they are
  blocked on, while still avoiding atomic instructions in the common
  case.
  
  Advantages:
  
   - gets rid of a locked global data structure and some tricky GC code
     (replacing it with some per-thread data structures and different
     tricky GC code :)
  
   - wakeups are more prompt: parallel/concurrent performance should
     benefit.  I haven't seen anything dramatic in the parallel
     benchmarks so far, but a couple of threading benchmarks do improve
     a bit.
  
   - waking up a thread blocked on a blackhole is now O(1) (e.g. if
     it is the target of throwTo).
  
   - less sharing and better separation of Capabilities: communication
     is done with messages, the data structures are strictly owned by a
     Capability and cannot be modified except by sending messages.
  
   - this change will utlimately enable us to do more intelligent
     scheduling when threads block on each other.  This is what started
     off the whole thing, but it isn't done yet (#3838).
  
  I'll be documenting all this on the wiki in due course.
  

    M ./compiler/cmm/CLabel.hs +2
    M ./compiler/codeGen/CgCallConv.hs -1
    M ./compiler/codeGen/CgClosure.lhs -7 +19
    M ./compiler/codeGen/CgMonad.lhs -1
    M ./compiler/codeGen/CgStackery.lhs -5 +23
    M ./includes/Rts.h +8
    M ./includes/mkDerivedConstants.c +12
    M ./includes/rts/storage/ClosureMacros.h -1 +7
    M ./includes/rts/storage/ClosureTypes.h -1 +1
    M ./includes/rts/storage/Closures.h -1 +16
    M ./includes/rts/storage/TSO.h -1 +25
    M ./includes/stg/MiscClosures.h -7 +13
    M ./rts/Capability.c -61 +2
    M ./rts/Capability.h -8 +11
    M ./rts/ClosureFlags.c -1 +1
    M ./rts/FrontPanel.c -2
    M ./rts/HeapStackCheck.cmm -17 +19
    M ./rts/Interpreter.c -1 +3
    M ./rts/LdvProfile.c -1 +1
    M ./rts/Linker.c +4
    A ./rts/Messages.c
    A ./rts/Messages.h
    M ./rts/PrimOps.cmm -32
    M ./rts/Printer.c -9 +7
    M ./rts/ProfHeap.c -1 +1
    M ./rts/RaiseAsync.c -106 +69
    M ./rts/RetainerProfile.c -7 +2
    M ./rts/STM.c -1 +1
    M ./rts/Schedule.c -213 +30
    M ./rts/Schedule.h -9
    M ./rts/StgMiscClosures.cmm -70 +85
    M ./rts/ThreadPaused.c -28 +38
    M ./rts/Threads.c -9 +205
    M ./rts/Threads.h -3 +18
    M ./rts/Timer.c -2
    M ./rts/Updates.cmm -34 +66
    M ./rts/Updates.h -17 +6
    M ./rts/posix/OSMem.c -2 +3
    M ./rts/sm/Compact.c -4 +1
    M ./rts/sm/Evac.c -26 +68
    M ./rts/sm/GC.c -7
    M ./rts/sm/MarkWeak.c -58
    M ./rts/sm/MarkWeak.h -1
    M ./rts/sm/Sanity.c -4 +23
    M ./rts/sm/Scav.c -43 +90
    M ./rts/sm/Storage.c -18 +9
    M ./utils/genapply/GenApply.hs -1 +1

View patch online:
http://darcs.haskell.org/cgi-bin/darcsweb.cgi?r=ghc;a=darcs_commitdiff;h=20100329144456-12142-dcf882c602194ca5a9da4732533bdf5442c31cf0.gz



More information about the Cvs-ghc mailing list