Go, D, and the GC
Marc Schütz via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 5 03:40:59 PDT 2015
On Sunday, 4 October 2015 at 21:01:45 UTC, Jonathan M Davis wrote:
> That would be ideal but gets really nasty for a number of
> reasons - primarily having to do with casting. It's perfectly
> possible to cast to and from shared and much easier to create
> something as thread-local and then cast it to shared than to
> create it as shared, so you very quickly run into problems with
> objects being created on heap but really needing to be used on
> another. Another major issue is message passing, because in
> order to avoid copying, you basically need a way to move an
> object from one thread-local heap to another. Right now the way
> you'd do it is to cast to immutable to pass the object and cast
> it back to mutable on the other side (which is _far_ from
> ideal). Using shared would be better, but the last time I
> checked, Variant has issues with it so that that didn't work
> with std.concurrency. Regardless, the fact that you're casting
> to pass across threads again runs into issues with objects
> being created on a particular heap but then needing to be moved
> to another. _Maybe_ that could be resolved by making casting to
> and from shared do a lot more work underneath the hood, but
> that get's _really_ complicated when you start having objects
> that refer to other objects and the like.
It should at least be considered. I wouldn't want write-barriers,
but OTOH cast-barriers might be acceptable.
More information about the Digitalmars-d
mailing list