swift
716f4b9e - Hop to the generic executor in non-actor-isolated async functions.

Commit
3 years ago
Hop to the generic executor in non-actor-isolated async functions. Async functions are now expected to set ExpectedExecutor in their prologue (and, generally, immediately hop to it). I updated the prologue code for a bunch of function emission, most of which was uninteresting. Top-level code was not returning to the main executor, which is now fixed; fortunately, we weren't assuming that we were on the main executor yet. We had some code that only kicked in when an ExpectedExecutor wasn't set which made us capture the current executor before a hop and then return to it later. This code has been removed; there's no situation in which save-and-return is the semantically correct thing to do given the possibility of hop optimization. I suspect it could also have led to crashes if the current executor is being kept alive only because it's currently running code. If we ever add async functions that are supposed to inherit their caller's executor, we should have the caller pass the right executor down to it. This is the first half of SE-0338; the second, sendability enforcement, is much more complicated, and Doug has volunteered to do it. Fixes rdar://79284465, as well as some tests that were XFAILed on Windows.
Author
Committer
Parents
Loading