[dmd-concurrency] draft 7
Sean Kelly
sean at invisibleduck.org
Tue Feb 2 09:51:24 PST 2010
On Feb 2, 2010, at 7:07 AM, Sean Kelly wrote:
> On Feb 1, 2010, at 10:50 PM, Andrei Alexandrescu wrote:
>
>> Sean Kelly wrote:
>>> I think there's definite value in just being able to constrain compiler optimization, since it's necessary for anyone who wants to implement a concurrency library. As long as the compiler is required to treat inline asm as effectively volatile then we're in decent shape on platforms the compiler supports inline asm for though. For others I guess we'll have to trust that no optimization would occur across opaque function calls? I recall this sort of thing coming up in the C++ 0x memory model talks, and I wish I had a clearer recollection of what came out of it... or that Hans Boehm were a part of this conversation.
>>
>> Isn't it enough that shared data is always handled as volatile?
>
> Hm... yeah probably. If a shared variable is passed into a function call as a mutable ref then the compiler would have to assume it could be modified, so it couldn't optimize across that call. I guess that works then :-)
Actually, even a const ref, since there may be a barrier on the load as well.
More information about the dmd-concurrency
mailing list