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

editorial: mismatch between Await transfer-of-control and AsyncBlockStart #3435

Open
bakkot opened this issue Oct 2, 2024 · 0 comments
Open

Comments

@bakkot
Copy link
Contributor

bakkot commented Oct 2, 2024

AsyncBlockStart step 5 transfers control into an async function, which (unless it completes without awaiting) transfers it back by hitting Await step 10.

But Await step 10 resumes the outer context with ~empty~, and AsyncBlockStart step 7 asserts that it has been resumed with NormalCompletion(~unused~). They should match. And specifically it needs to be a normal completion because the abstract closure crated by NewPromiseReactionJob generally returns completion records.

I believe we introduced this mismatch in #2665: prior to that PR Await would Return NormalCompletion(~unused~), and subsequently it would Resume _callerContext_ passing ~empty~.

Also, we could maybe stand to give more details about where control transfers of this kind can go. It's nice that AsyncBlockStart mentions the two possible places it can be resumed from, though it could stand to mention the relevant step of Await, not merely name the AO. Also, Await could mention that it returns either to AsyncBlockStart or, in the case of awaits after the first, is returning to the host steps which triggered it to run after the previous await (e.g. in HTML). The generator machinery is slightly simpler but could also benefit from such notes.

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

No branches or pull requests

1 participant