Skip to content

Split the chunk header into F14ChunkHeader; the empty chunk is a real header object (#2741) - #2741

Closed
DenisYaroshevskiy wants to merge 1 commit into
meta:mainfrom
DenisYaroshevskiy:export-D130938727
Closed

DenisYaroshevskiy wants to merge 1 commit into
meta:mainfrom
DenisYaroshevskiy:export-D130938727

Conversation

@DenisYaroshevskiy

@DenisYaroshevskiy DenisYaroshevskiy commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

The 16-byte chunk header (tags_, control_, outboundOverflowCount_ and the overflow constants) moves into a non-template base F14ChunkHeader; F14Chunk<Item> derives from it. The empty instance becomes a single inline constexpr F14ChunkHeader kF14EmptyChunkHeader, and F14Table::chunks_ points to the header.

  • F14Table::chunks() (fancy ChunkPtr) and chunksToAddress() (raw Chunk*) static_cast down to F14Chunk<Item>; the former std::to_address(chunks_) uses become chunksToAddress().
  • F14EmptyTagVector / getF14EmptyTagVector() go away; isEmptyInstance / capacityScale read the chunk's own fields instead of reinterpret_casting the chunk to the tag vector.
  • PackedChunkItemPtr gets a defaulted default constructor and default member initializers (null); packedBegin_ is initialized with {} instead of ItemIter{}.pack().
  • The gdb pretty printer casts chunks_ to the table's Chunk type.

No reinterpret_cast of the empty instance remains. This prepares for constexpr default construction (next diff), which needs the empty-chunk address to be a constant expression.

Reviewed By: yfeldblum

Differential Revision: D130938727

@meta-cla meta-cla Bot added the CLA Signed label Nov 10, 2026
@meta-codesync

meta-codesync Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

@DenisYaroshevskiy has exported this pull request. If you are a Meta employee, you can view the originating Diff in D130938727.

… header object (meta#2741)

Summary:

The 16-byte chunk header (`tags_`, `control_`, `outboundOverflowCount_` and the overflow constants) moves into a non-template base `F14ChunkHeader`; `F14Chunk<Item>` derives from it. The empty instance becomes a single `inline constexpr F14ChunkHeader kF14EmptyChunkHeader`, and `F14Table::chunks_` points to the header.

- `F14Table::chunks()` (fancy `ChunkPtr`) and `chunksToAddress()` (raw `Chunk*`) `static_cast` down to `F14Chunk<Item>`; the former `std::to_address(chunks_)` uses become `chunksToAddress()`.
- `F14EmptyTagVector` / `getF14EmptyTagVector()` go away; `isEmptyInstance` / `capacityScale` read the chunk's own fields instead of `reinterpret_cast`ing the chunk to the tag vector.
- `PackedChunkItemPtr` gets a defaulted default constructor and default member initializers (null); `packedBegin_` is initialized with `{}` instead of `ItemIter{}.pack()`.
- The gdb pretty printer casts `chunks_` to the table's `Chunk` type.

No `reinterpret_cast` of the empty instance remains. This prepares for `constexpr` default construction (next diff), which needs the empty-chunk address to be a constant expression.

Reviewed By: yfeldblum

Differential Revision: D130938727
@meta-codesync meta-codesync Bot changed the title Split the chunk header into F14ChunkHeader; the empty chunk is a real header object Split the chunk header into F14ChunkHeader; the empty chunk is a real header object (#2741) Nov 10, 2026
@meta-codesync meta-codesync Bot closed this in e582654 Nov 11, 2026
@meta-codesync meta-codesync Bot added the Merged label Nov 11, 2026
@meta-codesync

meta-codesync Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in e582654.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant