Boost logo

Boost :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2007-10-19 09:29:17


Markus Schoepflin wrote:
> Boris Gubenko wrote:
>> I'm a bit surprised you did not use __ATOMIC_EXCH_LONG in atomic_write32().
>
> Two reasons. 1) I didn't think of it. 2) The guarantees given by volatile
> seemed OK.
>
> Do you think I should change it to use __ATOMIC_EXCH_LONG?

I do. To see the difference, you can compare the code generated for foo()
and bar() in x.cxx below. Note ldl_l/stl_c in bar().

x.cxx
-----
#include <machine/builtins.h>
void foo (volatile int *mem, int val) { *mem = val; }
void bar (volatile int *mem, int val) { __ATOMIC_EXCH_LONG(mem, val); }

>> I'm also not sure why you decided to implement atomic_cas32() in asm
>> language instead of using __CMP_STORE_LONG:
>
> [...]
>
> Because cas32 returns the old value, but __CMP_STORE_LONG does not.

I see.

Thanks,
  Boris

----- Original Message -----
From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, October 19, 2007 4:48 AM
Subject: Re: [boost] [interprocess] Atomic ops supports for Alpha processors.

> Boris Gubenko wrote:
>> Hi Markus,
>>
>> Thank you for continuing to support Boost on Tru64.
>>
>> I've asked Rich Peterson to review your implementation. I don't know
>> yet when (and if) Rich will be able to do it.
>
> That would be really great if someone knowledgeable could review the
> implementation.
>
>> I think
>>
>> #elif defined(__osf__)
>>
>> should be:
>>
>> #elif defined(__osf__) && defined(__DECCXX)
>>
>> to not break compilation with gcc.
>
> You are right. I will add it.
>
>> I'm a bit surprised you did not use __ATOMIC_EXCH_LONG in atomic_write32().
>
> Two reasons. 1) I didn't think of it. 2) The guarantees given by volatile
> seemed OK.
>
> Do you think I should change it to use __ATOMIC_EXCH_LONG?
>
>> I'm also not sure why you decided to implement atomic_cas32() in asm
>> language instead of using __CMP_STORE_LONG:
>
> [...]
>
> Because cas32 returns the old value, but __CMP_STORE_LONG does not.
>
>> Anyway, Rich is an expert in this stuff and, hopefully, he will be able
>> to review your implementation.
>
> Looking forward to it.
>
> Markus
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk