On Wednesday, 16 October 2013 at 10:02:28 UTC, Denis Shelomovskij
wrote:
16.10.2013 3:20, Sean Kelly пишет:
Looking at the code... I think you'll get this to work, but
manipulating such user-mode weak references seems really
expensive. Why not work on a DIP to get them built in? For
example, one option might be to have the GC perform certain
types of finalization while the world is stopped. This would
have to be limited to very rudimentary stuff, and the easiest
way to guarantee that would be to have everything live in
Druntime.
But someone have to do it. And I can only see it will save one
of two GC lock/unlock pairs.
If the GC calls "block was disposed" callbacks when the world is
stopped, it's possible that a WeakRef implementation wouldn't
need any synchronization at all beyond whatever is necessary to
prevent the compiler from optimizing anything away. I haven't
thought too hard about this though, so perhaps there's something
I've missed.