[sgen] Add missing memory barrier
authorVlad Brezae <brezaevlad@gmail.com>
Thu, 21 Jul 2016 21:43:40 +0000 (00:43 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Thu, 21 Jul 2016 22:14:53 +0000 (01:14 +0300)
commit1979f8b295044260b8b9d3558c4bf58d53f8cded
treeb7327cd71e9f8142a503f3df2916f8af8ec5be6d
parent725892b35c29fe919d6e58305ac241f6cbd01018
[sgen] Add missing memory barrier

When doing the first phase of sweeping we tag the block pointer within the block list with a CAS, after which we own the block and we are free to update the state and do sweep computations on the block. When we finish this phase we directly write the untagged block pointer back in the list, making the block available to inspect by other threads. We need a write barrier before writting the untagged pointer back because, when another thread might acquire the block, it might encounter an invalid block state.
mono/sgen/sgen-marksweep.c