Skip to content

Commit 8310c8a

Browse files
authored
Merge pull request #80761 from al45tair/eng/PR-149067144
[Concurrency] Fix size of AsyncTask::PrivateStorage.
2 parents 72144c5 + ef3ea9b commit 8310c8a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/swift/ABI/Task.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ class AsyncTask : public Job {
316316
#endif
317317

318318
// Private storage is currently 6 pointers, 16 bytes of non-pointer data,
319-
// the ActiveTaskStatus, and a RecursiveMutex.
319+
// 8 bytes of padding, the ActiveTaskStatus, and a RecursiveMutex.
320320
static constexpr size_t PrivateStorageSize =
321-
6 * sizeof(void *) + 16 + ActiveTaskStatusSize + sizeof(RecursiveMutex);
321+
6 * sizeof(void *) + 16 + 8 + ActiveTaskStatusSize
322+
+ sizeof(RecursiveMutex);
322323

323324
char Storage[PrivateStorageSize];
324325

stdlib/public/Concurrency/TaskPrivate.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,16 +766,20 @@ struct AsyncTask::PrivateStorage {
766766
alignas(ActiveTaskStatus) char StatusStorage[sizeof(ActiveTaskStatus)];
767767

768768
/// The allocator for the task stack.
769-
/// Currently 2 words + 8 bytes.
769+
/// Currently 2 words + 4 bytes.
770770
TaskAllocator Allocator;
771771

772+
// Four bytes of padding here (on 64-bit)
773+
772774
/// Storage for task-local values.
773775
/// Currently one word.
774776
TaskLocal::Storage Local;
775777

776778
/// The top 32 bits of the task ID. The bottom 32 bits are in Job::Id.
777779
uint32_t Id;
778780

781+
// Another four bytes of padding here too (on 64-bit)
782+
779783
/// Base priority of Task - set only at creation time of task.
780784
/// Current max priority of task is ActiveTaskStatus.
781785
///

0 commit comments

Comments
 (0)