[cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Andrew MacLeod
Lock free routines are not guaranteed to work if they are not aligned properly. Until now, the __atmoic_is_lock_free property has simply relied on the size of an object to determine lockfreeness. This works when you assume a certain alignment. The library takes generic pointers and with

Re: [cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Richard Henderson
On 11/02/2011 07:59 AM, Andrew MacLeod wrote: Simply adds an optional parameter to __atomic_{is_always}_lock_free which is used to check alignment against the size parameter. NULL as the object pointer produces the same behaviour as today, lockfreeness based on proper alignment for an integral

Re: [cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Andrew MacLeod
On 11/02/2011 11:22 AM, Richard Henderson wrote: On 11/02/2011 07:59 AM, Andrew MacLeod wrote: Simply adds an optional parameter to __atomic_{is_always}_lock_free which is used to check alignment against the size parameter. NULL as the object pointer produces the same behaviour as today,

Re: [cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Richard Henderson
On 11/02/2011 07:59 AM, Andrew MacLeod wrote: gcc * builtins.c (fold_builtin_atomic_always_lock_free): Add object param and check alignment if present. (expand_builtin_atomic_always_lock_free): Expect 2nd argument. (fold_builtin_atomic_is_lock_free): Expect 2nd

Re: [cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Andrew MacLeod
On 11/02/2011 12:28 PM, Richard Henderson wrote: On 11/02/2011 07:59 AM, Andrew MacLeod wrote: + /* Parameters at this point are usually cast to void *, so check for that +and look past the cast. */ + if (TREE_CODE (arg1) == NOP_EXPR POINTER_TYPE_P (ttype) +

Re: [cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Richard Henderson
On 11/02/2011 09:30 AM, Andrew MacLeod wrote: it did in my simply trials as I figured this out in the debugger :-) i only did basic tests. OK, Is there a simple way to get to the def? You should know. You wrote most of that stuff. what happens to the alignment of something if its say 'char

Re: [cxx-mem-model] use alignment when available to determine lock-free ness

2011-11-02 Thread Andrew MacLeod
On 11/02/2011 12:37 PM, Richard Henderson wrote: On 11/02/2011 09:30 AM, Andrew MacLeod wrote: it did in my simply trials as I figured this out in the debugger :-) i only did basic tests. OK, Is there a simple way to get to the def? You should know. You wrote most of that stuff. HA. years