Skip to content

Commit f3493bf

Browse files
committed
[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
1 parent 4b217bc commit f3493bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,8 @@ class ReflectionContext
13721372
Chunk.Length = Slab->CurrentOffset;
13731373
Chunk.Kind = AsyncTaskAllocationChunk::ChunkKind::Unknown;
13741374

1375-
// Total slab size is the slab's capacity plus the slab struct itself.
1376-
StoredPointer SlabSize = Slab->Capacity + sizeof(*Slab);
1375+
// Total slab size is the slab's capacity plus the header.
1376+
StoredPointer SlabSize = Slab->Capacity + HeaderSize;
13771377

13781378
return {llvm::None, {Slab->Next, SlabSize, {Chunk}}};
13791379
}

0 commit comments

Comments
 (0)