[libcxx-commits] [libcxx] Lower std::string's alignment requirement from 16 to 8. (PR #68749)

Martijn Vels via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 10 16:21:17 PDT 2023


================
@@ -167,6 +167,11 @@
 // The implementation moved to the header, but we still export the symbols from
 // the dylib for backwards compatibility.
 #    define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
+// Same memory by providing the allocator more freedom to allocate the most
+// efficient size class by dropping the alignment requirements for std::string's
+// pointer from 16 to 8. This changes the output of std::string::max_size,
+// which makes it ABI breaking
+#   define _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT
----------------
martijnvels wrote:

Should we make the define instead be the direct value?

I.e.:
#   define _LIBCPP_ABI_STRING_BYTE_ALIGNMENT 8
#   define _LIBCPP_ABI_STRING_BYTE_ALIGNMENT 16

?

https://github.com/llvm/llvm-project/pull/68749


More information about the libcxx-commits mailing list