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

gh-128760: Merge subsequent escaping calls to avoid redundant stack spills when escaping calls are separated by comments #128761

Closed
wants to merge 11 commits into from

Conversation

WolframAlph
Copy link
Contributor

@WolframAlph WolframAlph commented Jan 12, 2025

@WolframAlph
Copy link
Contributor Author

@picnixz can you take a look?

@picnixz
Copy link
Member

picnixz commented Jan 23, 2025

Can you first resolve the conflicts and make the CI green for this one since it affects generated code? It seems we're indeed doing unnecessary operations, so it's good to fix this. I'd recommend also asking @Eclips4 or @iritkatriel to have a look once it's ready as Mark may not have the bandwidth.

@picnixz
Copy link
Member

picnixz commented Jan 23, 2025

Now, not sure if it's worth a NEWS entry or not. We could gain a bit of performance but only if we have such comments in the code which I don't know whether we do.

@WolframAlph
Copy link
Contributor Author

I will resolve conflicts and regenerate cases so we will see if there are such cases

@WolframAlph
Copy link
Contributor Author

WolframAlph commented Jan 24, 2025

Okay so after resolving conflicts and regenerating cases I noticed that there are changes to those files. No performance related but there is weird reordering of reloading stack & subsequent comment. (You can see this in 8afca3fd). So after some debugging I realized that my initial fix probably should be revisited since it introduces this awkward side effect. In the end I used different approach to fix this. Basically old way of finding escaping calls boundaries but with 1 step in between of merging subsequent calls to avoid redundant spills. More robust solution that fixes initial issue with no side effects.

@WolframAlph WolframAlph changed the title gh-128760: Skip comments when looking for statement end for escaping calls gh-128760: Merge subsequent escaping calls to avoid redundant stack spills when escaping calls are separated by comments Jan 24, 2025
@WolframAlph
Copy link
Contributor Author

@Eclips4 , @picnixz is off now for 2 weeks, can you take a look?

@Eclips4
Copy link
Member

Eclips4 commented Jan 27, 2025

I'll take a look at it later today, sorry for the delay!

Copy link
Member

@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

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

LGTM. This looks quite good. Also, it would be good to hear Ken's opinion on that.

@Fidget-Spinner
Copy link
Member

This introduces some amount of complexity for a use case that we dont currently have. So I'm wondering if it's worth it.

@Eclips4
Copy link
Member

Eclips4 commented Jan 27, 2025

This introduces some amount of complexity for a use case that we dont currently have. So I'm wondering if it's worth it.

This is the reason why I asked for your opinion 🙂. We might encounter something like this in the future, so the question in my mind is: "Is it worth introducing complexity into the analyzer?" In my very personal opinion, yes, it is worth it. I guess you and @markshannon should decide whether it's worthwhile or not, since both of you have a lot of experience with Tools/cases_generator.

@WolframAlph
Copy link
Contributor Author

I don't think this adds a lot of complexity, but we may run into this at some point so it's worth the fix IMO.

@WolframAlph
Copy link
Contributor Author

WolframAlph commented Feb 17, 2025

Just checking in, @Fidget-Spinner do you want to merge or close this PR then?

@Fidget-Spinner
Copy link
Member

I think we should only introduce this PR when we bump into it as an actual problem. So could you close the PR please but keep the branch?

@WolframAlph
Copy link
Contributor Author

Closing per request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants