Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-24 Thread Andrew MacLeod
On 08/17/2011 11:39 AM, Andrew MacLeod wrote: Next step, change the C++ header files to use the new __sync builtins. pretty straightforward. mostly. A previous patch changed and documents the behaviour at runtime which is transparent to these template changes. Another patch fixed the cons

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-23 Thread Richard Henderson
On 08/23/2011 03:24 PM, Andrew MacLeod wrote: > On 08/23/2011 06:20 PM, Richard Henderson wrote: >> On 08/23/2011 03:13 PM, Andrew MacLeod wrote: >>> ! DEF_FUNCTION_TYPE_2 (BT_FN_I1_CONST_VPTR_INT, BT_I1, >>> BT_CONST_VOLATILE_PTR, >>> ! BT_INT) >> Given that VPTR means "volatile PTR"

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-23 Thread Andrew MacLeod
On 08/23/2011 06:20 PM, Richard Henderson wrote: On 08/23/2011 03:13 PM, Andrew MacLeod wrote: ! DEF_FUNCTION_TYPE_2 (BT_FN_I1_CONST_VPTR_INT, BT_I1, BT_CONST_VOLATILE_PTR, !BT_INT) Given that VPTR means "volatile PTR", I suggest you use CVPTR instead of CONST_VPTR. Hmm, w

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-23 Thread Richard Henderson
On 08/23/2011 03:13 PM, Andrew MacLeod wrote: > ! DEF_FUNCTION_TYPE_2 (BT_FN_I1_CONST_VPTR_INT, BT_I1, BT_CONST_VOLATILE_PTR, > ! BT_INT) Given that VPTR means "volatile PTR", I suggest you use CVPTR instead of CONST_VPTR. Otherwise ok. r~

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-23 Thread Andrew MacLeod
On 08/18/2011 06:33 PM, Richard Henderson wrote: On 08/17/2011 08:39 AM, Andrew MacLeod wrote: ! return __sync_mem_load (const_cast<__int_type *>(&_M_i), __m); This suggests the builtin is incorrectly defined. It ought to be const itself. Err, right. This patch declares the function pr

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-19 Thread Andrew MacLeod
On 08/19/2011 12:48 PM, Torvald Riegel wrote: The problem with issuing a warning is that anytime the compiler creates a C++ atomic class and you use a method with a memory order, it usually leaves an externally call-able method which has to take a runtime value... so you'd see the warning on ba

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-19 Thread Torvald Riegel
On Fri, 2011-08-19 at 08:44 -0400, Andrew MacLeod wrote: > On 08/19/2011 04:57 AM, Torvald Riegel wrote: > > On Wed, 2011-08-17 at 11:39 -0400, Andrew MacLeod wrote: > >> That would be quite ugly, and you get what you deserve if you do that. > >> I changed the builtins so that if you dont specify a

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-19 Thread Andrew MacLeod
On 08/19/2011 04:57 AM, Torvald Riegel wrote: On Wed, 2011-08-17 at 11:39 -0400, Andrew MacLeod wrote: That would be quite ugly, and you get what you deserve if you do that. I changed the builtins so that if you dont specify a compile time constant in the memory model parameter, it will simply d

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-19 Thread Torvald Riegel
On Wed, 2011-08-17 at 11:39 -0400, Andrew MacLeod wrote: > Turns out, C++ will allow you to specify the memory model as a variable > of type enum memory_order... WTF? I would expect that to be pretty > uncommon, and in order to get that right, we'd need a switch statement > and call the appropr

Re: [cxx-mem-model] Atomic C++ header file changes

2011-08-18 Thread Richard Henderson
On 08/17/2011 08:39 AM, Andrew MacLeod wrote: > ! return __sync_mem_load (const_cast <__int_type *>(&_M_i), __m); This suggests the builtin is incorrectly defined. It ought to be const itself. r~