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

Finally blocks are duplicated for each 'return' in a try/catch/finally #7182

Closed
scabug opened this issue Feb 25, 2013 · 3 comments
Closed

Finally blocks are duplicated for each 'return' in a try/catch/finally #7182

scabug opened this issue Feb 25, 2013 · 3 comments
Labels

Comments

@scabug
Copy link

scabug commented Feb 25, 2013

Finally blocks are duplicated for every 'return' in the body of a try or catch block. It should be possible to avoid that duplication, but to do so would require an analysis of the stack state and then draining the stack or otherwise creating a situation where the stack was identical on all flows into the 'return' copy of the finally block.

This is related to #7181, except that deals with the much easier duplication on normal exit from a try or exception handler. In that case we always know the stack state must be the same because ultimately they need to flow to the same point.

Because 'return' is relatively rare in Scala and because the fix requires some care and work I'm not prioritizing this issue, just recording it for when somebody is bored.

@scabug
Copy link
Author

scabug commented Feb 25, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7182?orig=1
Reporter: @JamesIry
Affected Versions: 2.10.0

@scabug scabug added the backend label Apr 7, 2017
@SethTisue
Copy link
Member

closing stale backend tickets; comment/reopen if you have evidence this is still applicable

@lrytz
Copy link
Member

lrytz commented Mar 2, 2018

No longer the case in 2.12, but there's a problem with the new solution #10183

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

No branches or pull requests

3 participants