[all-commits] [llvm/llvm-project] 04ce0b: Unconditionally lower std::string's alignment requ...

Eric via All-commits all-commits at lists.llvm.org
Wed Jan 24 11:52:58 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04ce0baf015ced39e994b8839e30bd5cef6c995e
      https://github.com/llvm/llvm-project/commit/04ce0baf015ced39e994b8839e30bd5cef6c995e
  Author: Eric <eric at efcs.ca>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    M libcxx/docs/ReleaseNotes/18.rst
    M libcxx/include/__config
    M libcxx/include/string
    M libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
    M libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp

  Log Message:
  -----------
  Unconditionally lower std::string's alignment requirement from 16 to 8. (#68925)

Unconditionally change std::string's alignment to 8.

This change saves 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.

That said, the discussion concluded that we don't care about this ABI
break. and would like this change enabled universally.

The ABI break isn't one of layout or "class size", but rather the value
of "max_size()" changes, which in turn changes whether `std::bad_alloc`
or `std::length_error` is thrown for large allocations.

This change is the child of PR #68807, which enabled the change behind
an ABI flag.




More information about the All-commits mailing list