[cfe-commits] [PATCH] atomic operation builtins, part 1

Andrew MacLeod amacleod at redhat.com
Wed Oct 12 09:21:12 PDT 2011


On 10/12/2011 12:03 PM, Jeffrey Yasskin wrote:
> On Wed, Oct 12, 2011 at 6:31 AM, Andrew MacLeod<amacleod at redhat.com>  wrote:
>> - language atomic types up to 16 bytes should be padded to an appropriate
>> size, and aligned properly.
>> - if memory matching one of the 5 'optimized' sizes isn't aligned properly,
>> results are undefined.
>> - if the size does not match one of the 5 specific routines, then the
>> library generic ABI can handle it.  There's no alignment guarantees, so I
>> presume it would end up being a locked implementation using hash tables and
>> addresses or something.
> The ABI library needs to demand alignment guarantees, or have them
> passed in, or it won't be able to support larger lock-free sizes on
> new architectures.

Do you propose alignment must be on the size boundry?   ie, 16 byte 
values must align to 16 byte boundries, and 32 byte value must align to 
32 byte boundries, etc?
If thats the case, I'd also say we don't accept sizes other than rounded 
up to the nearest power of 2.  ie, no 3 byte objects, or 12 byte 
objects, or 24 bytes objects..

whats precedent?  I have to admit I'm not crazy about passing in 
alignment information to the routine and would rather just enforce 
something...

Andrew



More information about the cfe-commits mailing list