Skip to content

SILGen: Emit async let entry points at correct abstraction level. #42101

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 1 commit into from
Mar 31, 2022

Conversation

jckarter
Copy link
Contributor

Avoid a reabstraction thunk every time an async let entry point is emitted,
by setting the context abstraction level while we emit the implicit closure.
Adjust some surrounding logic that breaks when we do this:

  • When lowering a non-throwing function type against a throwing abstraction
    pattern, include the error type in the lowered substituted type. Async
    throwing and nonthrowing functions would require another thunk to convert
    away the throwingness of the async context, which would defeat the purpose.
  • Adjust the code in IRGen that pads the initial context size for async let
    entry points so that it works when the entry point has not yet emitted, by
    marking the async function pointer to be padded later if it isn't defined
    yet.

@jckarter
Copy link
Contributor Author

@swift-ci Please test

@jckarter jckarter force-pushed the async-let-reabstraction branch from 08adbfb to cf128ee Compare March 30, 2022 20:37
@jckarter
Copy link
Contributor Author

@swift-ci Please test

Avoid a reabstraction thunk every time an async let entry point is emitted,
by setting the context abstraction level while we emit the implicit closure.
Adjust some surrounding logic that breaks when we do this:

- When lowering a non-throwing function type against a throwing abstraction
  pattern, include the error type in the lowered substituted type. Async
  throwing and nonthrowing functions would require another thunk to convert
  away the throwingness of the async context, which would defeat the purpose.
- Adjust the code in IRGen that pads the initial context size for `async let`
  entry points so that it works when the entry point has not yet emitted, by
  marking the async function pointer to be padded later if it isn't defined
  yet.
@jckarter jckarter force-pushed the async-let-reabstraction branch from cf128ee to d451203 Compare March 30, 2022 21:52
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@jckarter jckarter merged commit 15c2192 into swiftlang:main Mar 31, 2022
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