Skip to content

[Coro] RetconOnceDynamic: Popless return on null allocator. #10132

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
Feb 28, 2025

Conversation

nate-chandler
Copy link

When the coroutine is using the swiftcorocc convention, newly added here, branch on the nullness of the allocator argument. If it's null, use a popless return. Otherwise, use a regular return.

ahmedbougacha and others added 2 commits February 27, 2025 09:14
The 'swiftcorocc' calling convention is a variant of 'swiftcc',
but additionally allows the 'swiftcorocc' function to have
partial-pop/restore-less returns.

These restore-less returns don't fully restore the stack in their
epilog, thereby allowing the caller to access some stack allocations
made in the 'swiftcorocc' callee.

As part of that, these returns don't restore SP (but do restore FP).

So the most important characteristic of a 'swiftcorocc' call is that it
forces the caller function to access its stack through FP, like it does
with e.g., variable-size allocas.

This patch only implements the 'swiftcorocc' keyword and CallingConv,
but doesn't implement its support on any target yet.
When the coroutine is using the swiftcorocc convention, branch on the
nullness of the allocator argument.  If it's null, use a popless return.
Otherwise, use a regular return.
@nate-chandler
Copy link
Author

@swift-ci please test

@nate-chandler
Copy link
Author

@swift-ci please test llvm

@nate-chandler
Copy link
Author

@swift-ci please test windows platform

@nate-chandler nate-chandler marked this pull request as ready for review February 28, 2025 19:50
@nate-chandler nate-chandler requested a review from a team as a code owner February 28, 2025 19:50
@nate-chandler nate-chandler merged commit aec968d into swiftlang:stable/20240723 Feb 28, 2025
3 of 5 checks passed
@nate-chandler nate-chandler deleted the coro-popless branch February 28, 2025 19:50
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.

3 participants