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

inlining creates duplicates when anon-closure-class can't be eliminated after all

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Optimizer
    • Labels:
      None

      Description

      Sometimes it happens that"

      1. an anon-closure's apply() gets inlined (let's call that method A), but
      2. a sibling method invoked by A (ie also owned by A's owner) doesn't get inlined (that sibling method is usually an specialized apply).
        In general, whenever the instance of the anon-closure-class is used somehow.

      As a result, the anon-closure-class can't be eliminated, and we end up emitting code duplicates (for the method/s that did get inlined). When compiling the compiling under -optimize about 600 anon-closure-classes are prone to this. In these cases it would be best not to inline at all.

      Somewhat related,

      • private members of anon-closure-classes that aren't used in their owning classes could be removed by DeadCodeElimination.
      • more aggressively, any synthetic private member that can't be accessed from a non-private member could be removed (no statistics gathered yet on the eventual bytecode reduction).
      • doing that for non-synthetic private members would go too far.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                magarcia Miguel Garcia
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: