17.10.2013 12:09, Martin Nowak пишет:
On 10/13/2013 09:47 AM, Denis Shelomovskij wrote:
* Alex's one from MCI:
https://github.com/lycus/mci/blob/f9165c287f92e4ef70674828fbadb33ee3967547/src/mci/core/weak.d
I remember talking about this with Alex.
He wanted to add some functions to the GC and this is what I came up
with based on the current implementation.
It uses the synchronized GC.addrOf to check whether the loaded pointer
is still valid. Still looks correctly synchronized to me.
https://gist.github.com/dawgfoto/2852438
In fact the load!(msync.acq) could be made load!(msync.raw) too.
The only thing we need from `GC.addrOf` here is a "GC barrier" i.e.
`lock`/`unlock` pair so runtime changes are necessary for performance.
--
Денис В. Шеломовский
Denis V. Shelomovskij