Skip to content
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

[Concurrency] Enable TaskGroup/DiscardingTaskGroup in Embedded Swift #76767

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubamracek
Copy link
Contributor

@kubamracek kubamracek commented Sep 29, 2024

This is enabling TaskGroup and DiscardingTaskGroup to be used in Embedded Swift by:

  • Using the same metadata-free approach we have for Builtin.createAsyncTask and applying it to Builtin.createTaskGroup and Builtin.createTaskGroupWithFlags. We discard the metatype argument in SILGen (we do that already for Builtin.createAsyncTask), and instead deduce it from the substitution map in IRGen.
  • The runtime entry point (swift_taskGroup_initializeWithFlags) doesn't offer a convenient way to pass extra data (unlike swift_task_create). I'm avoiding adding a new entry for simplicity and instead using a bit in groupFlags that means that instead of Metadata * we receive the same format of arbitrary options that swift_task_create uses (TaskOptionRecord linked list).
  • IRGen under Embedded Swift mode emits TaskOptionRecord instead of the metadata pointer, and sets the bit in groupFlags.
  • Like task creation, task group creation does not support throwing in Embedded Swift yet.

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.

1 participant