Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

no_std compatible async/await #42

Closed
Nemo157 opened this issue Aug 6, 2018 · 4 comments
Closed

no_std compatible async/await #42

Nemo157 opened this issue Aug 6, 2018 · 4 comments
Labels
WG embedded Issues relevant to the embedded subgroup

Comments

@Nemo157
Copy link
Member

Nemo157 commented Aug 6, 2018

This is mostly a local tracking issue for wg-net-embedded of blocking work that needs to happen in rustc.

The initial implementation of async/await! used TLS for ease of implementation. Before we can start developing using async/await! on embedded we will need to move this onto something that is no_std compatible.

@Nemo157 Nemo157 added the WG embedded Issues relevant to the embedded subgroup label Aug 6, 2018
@cramertj
Copy link
Collaborator

cramertj commented Aug 29, 2018

I think this is blocked on having (limited, 'static-only) arguments to generators. At least, that's the only way I'd know to implement this. (modulo creating a struct with a field located at a known offset from the first field of a generator or something similarly hacky).

@Nemo157
Copy link
Member Author

Nemo157 commented Aug 30, 2018

'static-only

I assume with this you’re thinking to do the same lifetime erasure of the context that is used with TLS and rely on the async transformation not allowing the context variable to leak into the rest of the code?

I really don’t understand the generator transform enough to know if this is easy, but it seems like it should be possible to have the argument variable special-cased to not be borrow-able across yield points even in immovable generators. That plus a memory barrier at the yield point to disallow the optimiser moving reads across it should allow passing temporaries as arguments to generators.

@riaqn
Copy link

riaqn commented Apr 30, 2019

Hi, I just want to know the status of this issue - can we use async/await on no_std now?

@Nemo157
Copy link
Member Author

Nemo157 commented Apr 30, 2019

@riaqn no, not yet. It's still blocked on someone doing the design and implementation for generator resume-arguments or coming up with an alternative plan. (I have implemented a PoC of an alternative implementation in https://github.com/Nemo157/embrio-rs/tree/master/embrio-async to make sure there's some possibility other than generator resume-arguments, although I've recently found out that it optimizes really badly with LTO).

Relevant Rust issues to track: rust-lang/rust#56974 and rust-lang/rust#56767

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
WG embedded Issues relevant to the embedded subgroup
Projects
None yet
Development

No branches or pull requests

4 participants