copy_tag_nolock(): fix write ordering and add a write_barrier()
authorSimon Marlow <marlowsd@gmail.com>
Tue, 16 Mar 2010 14:31:03 +0000 (14:31 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 16 Mar 2010 14:31:03 +0000 (14:31 +0000)
commit1a050f3cff3a93f634d2d929aba779585f39609c
tree5df677ea6d010ad4c2a32e56fd733ca4ba0856fe
parent3a90968fac18bbf931420afff6ef866614ecdd7f
copy_tag_nolock(): fix write ordering and add a write_barrier()

Fixes a rare crash in the parallel GC.

If we copy a closure non-atomically during GC, as we do for all
immutable values, then before writing the forwarding pointer we better
make sure that the closure itself is visible to other threads that
might follow the forwarding pointer.  I imagine this doesn't happen
very often, but I just found one case of it: in scavenge_stack, the
RET_FUN case, after evacuating ret_fun->fun we then follow it and look
up the info pointer.
rts/sm/Evac.c