Skip to content

Commit d1cb5d9

Browse files
committed
[Concurrency] Fix task status and private storage sizes.
ActiveTaskStatusSize is 2 words, not 4, on most targets. PrivateStorageSize is measured in bytes, not words, so the Storage field needs to be a char[].
1 parent 4bddb3a commit d1cb5d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/swift/ABI/Task.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,15 @@ class AsyncTask : public Job {
301301
#if SWIFT_CONCURRENCY_ENABLE_PRIORITY_ESCALATION && SWIFT_POINTER_IS_4_BYTES
302302
static constexpr size_t ActiveTaskStatusSize = 4 * sizeof(void *);
303303
#else
304-
static constexpr size_t ActiveTaskStatusSize = 4 * sizeof(void *);
304+
static constexpr size_t ActiveTaskStatusSize = 2 * sizeof(void *);
305305
#endif
306306

307307
// Private storage is currently 6 pointers, 16 bytes of non-pointer data,
308308
// the ActiveTaskStatus, and a RecursiveMutex.
309309
static constexpr size_t PrivateStorageSize =
310310
6 * sizeof(void *) + 16 + ActiveTaskStatusSize + sizeof(RecursiveMutex);
311311

312-
void *Storage[PrivateStorageSize];
312+
char Storage[PrivateStorageSize];
313313

314314
/// Initialize this storage during the creation of a task.
315315
void initialize(JobPriority basePri);

0 commit comments

Comments
 (0)