[cpp-threads] modes, interlude

Hans Boehm Hans.Boehm at hp.com
Tue May 10 06:43:49 BST 2005


On Mon, 9 May 2005, Doug Lea wrote:

> Boehm, Hans wrote:
> > -
> >
> > If I understand this correctly, there are two issues:
> >
> > 1) Load(x, acquire) is weaker and much cheaper than load(x);
> > full_barrier
> > on many architectures, and load(x); acquire_barrier is nonsensical.
> > (The load(x) can move after the barrier, which is not what you want.)
> >
>
> But If I were a compiler implementor, the way I would process
> these, regardless of superficial syntax, is to represent
> loads/stores and reordering constraints separately, and then use a
> matcher to possibly combine and issue instructions in the best way for a
> given platform. (At least one JVM agrees with me that this is the best
> strategy :-). So I think the only benefit of combined versions
> for compilers is short-term, until they do things like this.
But I don't think there's a very clean way to separate out the
"acquire" barrier from a load_acquire.  I doubt you would separate it.
The barrier is only meaningful because it's attached to the load.
If you're allowed to move it, it's no constraint at all.  Or it
becomes full barrier, which is much more expensive.

Hans




More information about the cpp-threads mailing list