Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-7182

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: None
    • Component/s: Compiler Backend
    • Labels:
      None

      Description

      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 SI-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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jamesiry James Iry
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: