atomic operations for shared_ptr ?
Florian Weimer
fweimer@redhat.com
Mon Aug 26 11:26:00 GMT 2013
On 08/26/2013 01:04 PM, Marc Glisse wrote:
> On Mon, 26 Aug 2013, Florian Weimer wrote:
>
>> On 08/25/2013 01:52 PM, Oleg Endo wrote:
>>
>>> Just for my understanding, on targets that use 32 bit pointers and have
>>> a 64 bit atomic (compare and) exchange, that would be a no-brainer,
>>> wouldn't it?
>>
>> Unfortunately, no. At least i686 requires 8-byte alignment for the
>> pair, while we currently only provide 4-byte alignment. Similarly for
>> x86_64, where it's 16-byte alignment vs 8-byte.
>
> If changing the alignment in the library would help, please make sure
> there is a PR open with the ABI keyword. There may be some form of ABI
> change in 4.10, though I don't know if it will be large enough to allow
> this...
I'm not sure if we can actually reliably allocate objects with 16 byte
alignment on the heap (for x86_64, that is). If not, achieving this
alignment would be rather invasive.
> (I hate binary compatibility taken too far)
This seems to require pretty far-reaching layout changes, and shared_ptr
has been around as std::tr1::shared_ptr for a long time.
--
Florian Weimer / Red Hat Product Security Team
More information about the Libstdc++
mailing list