[PATCH] D12247: [libc++] remove possible trailing padding from aligned_storage

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 14:47:19 PDT 2015


EricWF added a comment.

In http://reviews.llvm.org/D12247#233595, @yiranwang wrote:

> In http://reviews.llvm.org/D12247#233349, @EricWF wrote:
>
> > In http://reviews.llvm.org/D12247#233323, @davidxl wrote:
> >
> > > We certainly need a fix without breaking ABI. Is there a ABI conformance test for libcxx?
> >
> >
> > Well this patch definitely breaks the ABI. This was my attempt at fixing the problem in `std::function` that might not be ABI breaking..
> >  https://gist.github.com/EricWF/3a35b140a66d4826a9
>
>
> I think following your thought, we should abandon the usage of "aligned_storage" in "function" totally. Instead, just say "void *__buf_[3];", and check alignment_of _Fp (can be arbitrarily big, but usually small), and sizeof the two to guard use of __buf_. The alignment bump to 16 by aligned_storage on AARCH64 is not what we want, performance wise.


Sort of. I wouldn't abandon the use of `aligned_storage` in function but I would change it from `aligned_storage<3*sizeof(void*)>::type` to `aligned_storage<3*sizeof(void*), alignof(void*)>::type`. That would have eventually the same behavior your describing.

The reason that I haven't made that change is that it is ABI breaking.

> Also, such kind of change need to applied for some more places, at least in libc++, such like <libcxx/include/future>


Yes it would.


http://reviews.llvm.org/D12247





More information about the cfe-commits mailing list