[dmd-concurrency] tail-shared by default?

Michel Fortin michel.fortin at michelf.com
Sat Jan 9 10:56:20 PST 2010


Le 2010-01-09 à 13:26, Sean Kelly a écrit :

> I think we should, though one issue needs to be discussed related to this.  If we allow the compiler to optimize away use of atomic() when it can determine that atomic behavior is unnecessary then the exact same code may compile with one compiler and not another (if the second doesn't optimize in exactly the same manner). This is a big enough issue that I'm almost inclined to say that atomic() isn't necessary, though I would hate to do so.  Are there any other options?

I'm not sure I follow. If we implement atomic() as a function returning a temporary struct, we just need to overload atomic() so that it doesn't insert barriers when the passed variable isn't shared (because all operations on non-shared variables are atomic anyway).

Or were you thinking of more subtle optimizations like using flow control to detect that a variable isn't shared *yet*? I don't think those optimizations can get very far.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-concurrency mailing list