Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] Factor out common logic for calling aligned allocation
There were a couple of places where we needed to call the underlying platform's aligned allocation/deallocation function. Instead of having the same logic all over the place, extract the logic into a pair of helper functions __libcpp_aligned_alloc and __libcpp_aligned_free. The code in libcxxabi/src/fallback_malloc.cpp looks like it could be simplified after this change -- I purposefully did not simplify it further to keep this change as straightforward as possible, since it is touching very important parts of the library. Also, the changes in libcxx/src/new.cpp and libcxxabi/src/stdlib_new_delete.cpp are basically the same -- I just kept both source files in sync. The underlying reason for this refactoring is to make it easier to support platforms that provide aligned allocation through C11's aligned_alloc function instead of posix_memalign. After this change, we'll only have to add support for that in a single place. Differential Revision: https://reviews.llvm.org/D91379
- Loading branch information
Showing
4 changed files
with
58 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters