-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Inline statement parsing #41585
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
Inline statement parsing #41585
Conversation
|
Tagging @RikkiGibson |
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.
this removes the need for one layer of statement indirection. instead of having the no-local-decl statement parsing helper, we just have the single ParseStatemnetCore that the caller can direct the behavior of.
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.
Note: only the script-parsin code ever gets into this path. It is the only one that doesn't have top level decls, but instead parses out fields. I don't actually love that thsi is how it works. I think it would actually be cleaner to parse out local-decls and then just resynthesize field decls from them. but i think that could be done in another PR.
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.
we still have the main dispatch switch from before.
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 just inlined this as it was the only usage of this helper.
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.
'const' handling is already handled by IsPossibleLocalDeclaration below.
|
@RikkiGibson do you want to test out hte stack-frame stuff here to see if this improves things enough? |
|
@RikkiGibson EndToEndTests.NestedIfStatements passes on my machine. Can you send me instructions on capturing stack frame size? |
752f852 to
b3cdbc4
Compare
ghost
left a comment
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.
Auto-approval
|
Oops, applied the tag to the wrong PR. |
|
Surprised to see NestedIfStatements failing in release mode here. x86 is down 1650 -> 1576 and x64 is down 780 -> 700. |
|
@CyrusNajmabadi this PR still has a stack depth regression in it. |
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.
want want [](start = 89, length = 9)
Typo
|
Will take a look once #41639 is merged. |
|
The test |
I think that's because we can now parse this properly (because we've won so much back in the stack) :) I'll have to up this value to something that will definitely start failing. |
|
Might be easier to review with whitespace changes off. |
|
@cston for visibility as well. Note: i can try to break this up into smaller PRs if that would be helpful. But i've gotten feedback that it would be nice to get this all finished (and this is hte last PR i was intending on making). |
|
Tagging @jcouv let me know if anything in the PR needs more explanation. I'll try to go through to document what change is going on here since hte diff doesn't look great (either in normal or split view), but the change is conceptually really simple. |
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.
the allowAnyExpression param name is not very helpful or intuitive as to what it is trying to convey. really, it's only purpose is to say "we're at the global level, parse accordingly".
|
I'm going to try to rework this PR into very easy to follow individual commits. |
d6947fc to
07a15a8
Compare
|
@jcouv I have rewritten this PR into a series of commits to make this much easier to understand. If you go commit by commit it shuld be much easier. |
07a15a8 to
3955fff
Compare
|
@jaredpar @dotnet/roslyn-compiler this change is required for local-function-attributes. It would be very helpful to get a second reviewer. |
This reduces teh amount of stack frames we need when parsing. It should actually routinely halve the number as there's no need for all the indirections.
This should be reviewed one commit at a time to make the changes clear. Individual commits are lkely clearer with whitespace diffs off.