More on memory barriers

Jason Merrill jason@redhat.com
Wed Sep 15 21:42:00 GMT 2004


On Wed, 15 Sep 2004 13:11:41 -0700, Richard Henderson <rth@redhat.com> wrote:

> On Wed, Sep 15, 2004 at 12:20:53PM -0700, Geoffrey Keating wrote:
>> So you have to do something to prevent a processor from 
>> speculatively executing that code path while the code protected by the 
>> mutex is running in a different processor.
>
> Has nothing to do with speculation.

On the Alpha the problem has to do with its wacky cache-coherence rules,
but on other architectures the problem has everything to do with
speculation.  If the memory model allows the processor to execute loads out
of order, you can run into the same problem by loading the contents of the
guarded object before the flag.

Jason



More information about the Gcc mailing list