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

Proper tail calls in Rust FFI #757

Closed
raviqqe opened this issue Feb 17, 2022 · 1 comment · Fixed by #795
Closed

Proper tail calls in Rust FFI #757

raviqqe opened this issue Feb 17, 2022 · 1 comment · Fixed by #795
Labels
bug Something isn't working

Comments

@raviqqe
Copy link
Contributor

raviqqe commented Feb 17, 2022

Problem

  • Tail calls are not eliminated in Rust FFI.
    • At least, not guaranteed...

Solution

  • Options
    • Trampoline?
      • We do not return stacks because they are visible from callers.
      • e.g. return (continue_function, value);
    • Return values
      • This requires Rust functions to be idempotent.
      • e.g. return value;

Reference

@raviqqe raviqqe added the bug Something isn't working label Feb 17, 2022
@raviqqe
Copy link
Contributor Author

raviqqe commented Feb 28, 2022

It turned out that we sometimes use trampoline functions even in the current implementation on suspension of futures in Rust by calling AsyncStack::suspend() although it would be better if we do this always without relying on nondeterministic suspension.

@raviqqe raviqqe changed the title Proper tail call in Rust FFI Proper tail calls in Rust FFI Feb 28, 2022
@mergify mergify bot closed this as completed in #795 Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant