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

Remove a stack frame from .await calls #70831

Merged
merged 2 commits into from
Apr 16, 2020

Conversation

sfackler
Copy link
Member

@sfackler sfackler commented Apr 6, 2020

The stack frames when .awaiting one async fn from another currently look like this:

  12: foo::b::{{closure}}
             at src/main.rs:2
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:66
  14: core::future::poll_with_context
             at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:84
  15: foo::a::{{closure}}
             at src/main.rs:6

Since the move away from using TLS to pass the Context around, it's now easy to remove frame 14 by removing poll_with_context in favor of calling Future::poll directly. This still leaves the GenFuture frame, but that seems significantly harder to deal with.

It also improves diagnostics a bit since they no longer talk about the private poll_with_context function.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 6, 2020
@Centril
Copy link
Contributor

Centril commented Apr 6, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Apr 6, 2020

⌛ Trying commit 5dc8ec8 with merge c625e40f85b5b2f48f832564bf9dcdaeecc9a4fd...

@bors
Copy link
Contributor

bors commented Apr 6, 2020

☀️ Try build successful - checks-azure
Build commit: c625e40f85b5b2f48f832564bf9dcdaeecc9a4fd (c625e40f85b5b2f48f832564bf9dcdaeecc9a4fd)

@rust-timer
Copy link
Collaborator

Queued c625e40f85b5b2f48f832564bf9dcdaeecc9a4fd with parent b543afc, future comparison URL.

@sfackler
Copy link
Member Author

sfackler commented Apr 9, 2020

It looks like the perf run finished but the bot didn't comment for some reason.

@Centril
Copy link
Contributor

Centril commented Apr 9, 2020

Yeah, that happens sometimes sadly.

Copy link
Contributor

@matthewjasper matthewjasper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with nit addressed if we think that the perf is good enough.

Poll,
poll_with_context,
get_context,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved up to be in order.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@Centril Centril added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 13, 2020
@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 16, 2020

📌 Commit 3ba3bd5 has been approved by matthewjasper

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 16, 2020
@bors
Copy link
Contributor

bors commented Apr 16, 2020

⌛ Testing commit 3ba3bd5 with merge 4e4d49d...

@bors
Copy link
Contributor

bors commented Apr 16, 2020

☀️ Test successful - checks-azure
Approved by: matthewjasper
Pushing 4e4d49d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 16, 2020
@bors bors merged commit 4e4d49d into rust-lang:master Apr 16, 2020
@eddyb

This comment has been minimized.

@sfackler sfackler deleted the shrink-future-stack branch April 16, 2020 22:23
bors bot added a commit to taiki-e/futures-async-stream that referenced this pull request Apr 17, 2020
37: Remove poll*with_context functions r=taiki-e a=taiki-e

Based on rust-lang/rust#70831

Co-authored-by: Taiki Endo <[email protected]>
bors bot added a commit to taiki-e/futures-async-stream that referenced this pull request May 2, 2020
37: Remove poll*with_context functions r=taiki-e a=taiki-e

Based on rust-lang/rust#70831


Co-authored-by: Taiki Endo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants