On 2013-10-15 02:20:49 +0000, "deadalnix" <deadal...@gmail.com> said:
It will indeed cause trouble for code that mutate a large amount of
shared pointers. I'd say that such code is probably asking for trouble
in the first place, but as always, no silver bullet. I still think
solution is the one that fit D the best.
I think there's a small mistake in your phrasing, but it makes a difference.
When the collector is running, it needs to know about any mutation for
pointers to its shared memory pool, including pointers that are
themselves thread-local but point to shared memory. So COW will be
trouble for code that mutate a large amount of **pages containing
pointers to shared memory**. And this which includes **pointers to
immutable data** because immutable is implicitly shared. And this
includes **pointers to const data** since those pointers might point to
immutable (thus shared) memory.
So any memory page susceptible of containing pointers to shared memory
would need to use COW during collection. Which means all the thread's
stacks, and also all objects with a pointer to shared, immutable, and
const data. At this point I think it is fair to approximate this to
almost all memory that could contain pointers.
--
Michel Fortin
michel.for...@michelf.ca
http://michelf.ca