Skip to content

[Concurrency] Fix task status and private storage sizes. #80447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Apr 1, 2025

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[].

rdar://148836760

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[].
@mikeash mikeash requested a review from ktoso April 1, 2025 20:09
@mikeash
Copy link
Contributor Author

mikeash commented Apr 1, 2025

@swift-ci please test

@mikeash mikeash requested a review from slavapestov as a code owner April 2, 2025 19:25
@mikeash
Copy link
Contributor Author

mikeash commented Apr 2, 2025

This fix exposed an issue with task child iteration in ReflectionContext. Adding a fix for that here, plus a better test.

@mikeash
Copy link
Contributor Author

mikeash commented Apr 2, 2025

@swift-ci please test

@mikeash mikeash requested a review from al45tair April 2, 2025 19:26
@mikeash mikeash requested a review from a team as a code owner April 3, 2025 18:25
@mikeash
Copy link
Contributor Author

mikeash commented Apr 3, 2025

And this needs a new entry in abi/macOS/x86_64/concurrency-asserts.swift.

@mikeash
Copy link
Contributor Author

mikeash commented Apr 3, 2025

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Apr 7, 2025

@swift-ci please test macos platform

Iterating child tasks depends on knowing the size of AsyncTask, and changing the size of the task broke it. Instead of relying on mirroring the full structure in our out-of-process definitions, add a debug variable to libswift_Concurrency that contains the size of AsyncTask.

While we're there, add some more validation to child task enumeration. Check each child task's metadata pointer to make sure that it actually points to the AsyncTask metadata, and have the inner loop also increment and check ChildTaskLoopCount to stop runaway iteration in that loop.
@mikeash
Copy link
Contributor Author

mikeash commented Apr 8, 2025

@swift-ci please test

@mikeash mikeash merged commit 4290f0a into swiftlang:main Apr 9, 2025
5 checks passed
jrflat added a commit to jrflat/swift that referenced this pull request Apr 11, 2025
static void
indented_printf(unsigned indentLevel, const char *fmt, ...) {
for (unsigned i = 0; i < indentLevel; i++)
fputs(" ", stdout);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot your flock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants