[libc-commits] [libc] [libc][malloc] Reduce block overhead by 4 bytes plus alignment effects (PR #99945)

Daniel Thornburgh via libc-commits libc-commits at lists.llvm.org
Tue Jul 23 11:55:45 PDT 2024


================
@@ -338,32 +323,26 @@ class Block {
   /// ensure the split will succeed.
   static Block *split_impl(Block *&block, size_t new_inner_size);
 
-  /// Offset (in increments of the minimum alignment) from this block to the
-  /// previous block. 0 if this is the first block.
+  /// Offset from this block to the previous block. 0 if this is the first
+  /// block.
   offset_type prev_ = 0;
 
-  /// Offset (in increments of the minimum alignment) from this block to the
-  /// next block. Valid even if this is the last block, since it equals the
-  /// size of the block.
+  /// Offset from this block to the next block. Valid even if this is the last
+  /// block, since it equals the size of the block.
   offset_type next_ = 0;
----------------
mysterymath wrote:

I thought about doing this, but I couldn't find any standard that guarantees the order of bitfields on all the targets libc supports or will eventually support. It wouldn't be the end of the world if the flags were in the high order bits, but then extracting the size would be a mask and a shift, rather than just a mask.

Leaving open to see if anyone knows of a better way to express this.

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


More information about the libc-commits mailing list