[libcxx-commits] [PATCH] D123511: [libc++abi] Fix fallback allocator alignment issue

Mikhail Maltsev via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 13 06:16:49 PDT 2022


miyuki added inline comments.


================
Comment at: libcxxabi/src/fallback_malloc.cpp:76-77
+
+typedef half_size_uint<sizeof(void*)>::type heap_offset;
+typedef half_size_uint<sizeof(void*)>::type heap_size;
 
----------------
ldionne wrote:
> This is perhaps silly, but I'm not sure I understand why changing the representation of the offset and size is what we want to do here. Shouldn't we instead be adjusting the pointer we are returning when we allocate memory to have the proper alignment?
> 
> In other words, this patch has the side effect that we'll return properly aligned memory, however we could technically keep the same representation as before and also return aligned memory, right?
Right. I found an existing patch that seems to do the right thing: https://reviews.llvm.org/D12669. Should we revive it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123511/new/

https://reviews.llvm.org/D123511



More information about the libcxx-commits mailing list