RFC: omit write barrier instructions unless '-threaded'

Simon Marlow marlowsd at gmail.com
Fri Mar 1 10:00:42 CET 2013

On 27/02/13 16:17, Joey Adams wrote:
> On Sun, Feb 24, 2013 at 3:40 PM, Gabor Greif <ggreif at gmail.com
> <mailto:ggreif at gmail.com>> wrote:
>     Hi all,
>     from what I gathered so far no emission of write barriers is needed when
>       - running on a uniprocessor (-threaded or not)
>       - running on a multiprocessor sans having linked with -threaded.
> On Windows, the non-threaded RTS does I/O with forked threads; see
> rts/win32/IOManager.c and the async* functions in GHC.Conc.Windows.  I
> think this means that for Windows, we need those write barriers even for
> non-threaded.

Windows does use multiple OS threads to do non-blocking I/O in the 
non-threaded RTS.  However, it doesn't run multiple Haskell threads in 
parallel (the threaded RTS is needed for that), so Gabor's patch which 
just affects the update code is fine.

If we did actually rely on the C write_barrier() macro for the Windows 
I/O manager, then there could be a problem, but we don't.  On the other 
hand, it might be prudent to enable write_barrier() on Windows just in 
case someone tries to use it in the non-threaded RTS in the future.


More information about the ghc-devs mailing list