Skip to content

Two more small improvements to the codegen of tailrec methods #14878

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

Merged

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Apr 7, 2022

Follow up to #14865.

sjrd added 2 commits April 7, 2022 16:07
As a peep-hole-like optimization, we recognize the shape
`WhileDo(<empty>, Labeled(...))` of tailrec methods, and register
the target of the label to be the beginning of the loop, rather
than the end of its body. This avoids a useless jump.
@sjrd sjrd requested a review from lrytz April 7, 2022 14:09
@lrytz lrytz merged commit f3cca47 into scala:main Apr 8, 2022
@lrytz lrytz deleted the tailrec-avoid-useless-reassignment-to-this branch April 8, 2022 13:38
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants