[v3] libstdc++/51798

Benjamin Kosnik bkoz@redhat.com
Tue Feb 14 03:22:00 GMT 2012


 
> The patch uses the weak version of compare_exchange universally, which
> is incorrect in a number of cases.  You wouldn't see this on x86_64;
> you'd have to use a ll/sc target such as powerpc.
> 
> In addition to changing several uses to strong compare_exchange, I
> also optimize the idiom
> 
> 	do
> 	  {
>             var = *m;
> 	    newval = ...;
> 	  }
> 	while (!atomic_compare_exchange(m, &var, newval, ...));
> 
> With the new builtins, VAR is updated with the current value of the 
> memory (regardless of the weak setting), so the initial read from *M
> can be hoisted outside the loop.

nice!

> 
> Ok?
 
cool, thanks for reviewing this. 

I fixed up the line numbers for the header file edits.

-benjamin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20120213-1.patch
Type: text/x-patch
Size: 1927 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20120214/d8b370c2/attachment.bin>


More information about the Libstdc++ mailing list