Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Why does membar_consumer() do anything on x86_64?



On Sat, Nov 12, 2011 at 12:03:12AM +0000, Christos Zoulas wrote:
> In article <20111111085910.865F214A28B%mail.netbsd.org@localhost>,
> YAMAMOTO Takashi <yamt%mwd.biglobe.ne.jp@localhost> wrote:
> >hi,
> >
> >what's the status of this topic?
> 
> I believe Dennis is right (from my experience). One has to be careful
> though with certain compilers (not gcc) that re-order memory
> accesses of volatile variables, when using aggressive optimizations.

Is that allowed? I thought that was one of the restrictions that
'volatile' implied.

In which case you might need the gcc membar (if I've got the syntax right):
        asm volatile("" ::: "memory" );
that tells gcc that the (empty) asm instruction might look at, and
modify, any part of memory - so the compiler cannot keep any
non-local values in registers across the statement.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index