-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[compiler-v2] Add loop labels to the language #14868
base: main
Are you sure you want to change the base?
Conversation
⏱️ 2h 50m total CI duration on this PR
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14868 +/- ##
========================================
Coverage 60.0% 60.0%
========================================
Files 856 856
Lines 210624 210737 +113
========================================
+ Hits 126573 126644 +71
- Misses 84051 84093 +42 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good! I have a few comments, but should be ready to go once they are addressed.
@@ -505,6 +507,10 @@ fn find_token( | |||
(get_name_token(&text[..len]), len) | |||
} | |||
}, | |||
'\'' => { | |||
let len = get_name_len(&text[1..]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need some checks on the name, because the following code is currently allowed:
': loop {
break ';
};
'1: loop {
break '1;
};
'00x: loop {
break '00x;
};
We should ideally limit it to whatever our identifier rules are, which I think is what Rust does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wrwg Just checking if this comment was missed.
4352c47
to
ae2049a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
Besides the user being able to describe more complex algorithms more efficiently, loop labels are required to express any reducible control flow in the AST language, and create parity of the AST with the bytecode level for this kind of code (which is also what can be generated from Move).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, have one comment to be addressed.
@@ -505,6 +507,10 @@ fn find_token( | |||
(get_name_token(&text[..len]), len) | |||
} | |||
}, | |||
'\'' => { | |||
let len = get_name_len(&text[1..]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wrwg Just checking if this comment was missed.
Description
Besides the user being able to describe complex algorithms more efficiently, loop labels are required to express aribtrary reducible control flow graphs in the AST language, and create parity of the AST with the bytecode level for this kind of code (which is also what can be generated from Move).
How Has This Been Tested?
New baseline tests in checking, v1-checking, bytecode generation, and a transactional test.
Type of Change
Which Components or Systems Does This Change Impact?