[Reflection] Fix async task slab size calculation.

The calculation failed to account for padding after the slab struct itself. We already account for this padding in HeaderSize, so use that instead of the raw struct size.

rdar://87607280
This commit is contained in:
Mike Ash
2022-01-19 12:36:10 -05:00
parent 4b217bc1b0
commit f3493bf149

View File

@@ -1372,8 +1372,8 @@ public:
Chunk.Length = Slab->CurrentOffset;
Chunk.Kind = AsyncTaskAllocationChunk::ChunkKind::Unknown;
// Total slab size is the slab's capacity plus the slab struct itself.
StoredPointer SlabSize = Slab->Capacity + sizeof(*Slab);
// Total slab size is the slab's capacity plus the header.
StoredPointer SlabSize = Slab->Capacity + HeaderSize;
return {llvm::None, {Slab->Next, SlabSize, {Chunk}}};
}