-
Notifications
You must be signed in to change notification settings - Fork 55
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
Improve state machine codegen #258
Comments
This issue is intended for status updates only. For general questions or comments, please contact the owner(s) directly. |
This is, I believe, mostly waiting on us on the lang team to have a look, probably in a design meeting, to feel out what's in the realm of possibility for us to accept. |
@traviscross how would we make progress on that? So far we've mostly been talking to @joshtriplett, under the assumption that a Our current implementation handles the following #![feature(loop_match)]
enum State {
A,
B,
}
fn main() {
let mut state = State::A;
#[loop_match]
'outer: loop {
state = 'blk: {
match state {
State::A =>
{
#[const_continue]
break 'blk State::B
}
State::B => break 'outer,
}
}
}
} Crucially, this does not add syntax, only the attributes and internal logic in MIR lowering for statically performing the pattern match to pick the right branch to jump to. The main challenge is then to implement this in the compiler itself, which we've been working on (I'll post our tl;dr update shortly) |
Some benchmarks (as of march 18th) A benchmark of https://github.com/bjorn3/comrak/blob/loop_match_attr/autolink_email.rs, basically a big state machine that is a perfect fit for loop match
A benchmark of zlib decompression with chunks of 16 bytes (this makes the impact of
The important points: |
TL;DR: We've started work on implementing Our next steps can be found in the todo file, and focus mostly on improving the code quality and robustness. |
Thanks for that update. Have reached out separately. |
Summary
We want to improve rustc codegen, based on this initialive by the Trifecta Tech Foundation. The work focusses on improving state machine code generation, and finding (and hopefully fixing) cases where clang produces better code than rustc for roughly equivalent input.
Tasks and status
The text was updated successfully, but these errors were encountered: