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

Optimizer leaves references to classes that have been eliminated by inlining

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.2, Scala 2.10.0-RC1
    • Fix Version/s: Scala 2.10.4-RC1
    • Component/s: Compiler Backend
    • Labels:
      None

      Description

      I am running into a problem where the optimizer is not completely removing references to inner classes it has decided it doesn't need to output. This is a serious problem in JavaEE 6 environments that rely heavily on class detection. I don't know of any workaround if you want to use Scala + JavaEE 6 except to turn off inlining, which is a pretty severe performance penalty in some cases.

      The problem is all due to the inliner. All the little inner classes that get generated to represent anonymous functions, inner objects, etc. are smartly subject to removal if they can be inlined. I like this feature, as it does a good job speeding up startup and reducing the PermGen cost of Scala.

      However, the problem is that the inliner does not remove these elided classes from the inner-classes declaration that is part of the class file format for outer classes. This inner-classes declaration is a key part of how class scanners look for all annotated classes, which is a major part of JavaEE 6 containers. The container ends up complaining that some of your declared classes are not present because there's no physical .class file. In JBoss, one such error prevents your entire module from deploying as it fails verification.

      Even though these inner classes are never required by any actual method bytecode, the compiler is wrong to declare that they exist. I've also seen it cause warnings in other tools, though this is the worst symptom I've seen. I'm hoping that we can get for this as part of 2.10 if not sooner. (I haven't looked to see if this issue is still present in the 2.10 line. Last time I tried using the 2.10 milestones it didn't work for me.)

      Besides the poor Eclipse performance, the implications of no optimization is one of the issues that is raising concerns about further adoption of Scala.

        Attachments

          Issue Links

            Activity

            Hide
            magarcia Miguel Garcia added a comment -

            Pull requrest closed by Grzegorz Kossakowski so the fix won't show up in 2.10.

            Show
            magarcia Miguel Garcia added a comment - Pull requrest closed by Grzegorz Kossakowski so the fix won't show up in 2.10.
            Hide
            gerweck Sarah Gerweck added a comment -

            Thanks for trying anyway.

            Show
            gerweck Sarah Gerweck added a comment - Thanks for trying anyway.
            Hide
            gerweck Sarah Gerweck added a comment -

            Any chance this will be part of 2.10.1? Is it a question of just needing someone to figure out the solution? This continues to be a really painful issue for me, as it means we cannot use optimization.

            Show
            gerweck Sarah Gerweck added a comment - Any chance this will be part of 2.10.1? Is it a question of just needing someone to figure out the solution? This continues to be a really painful issue for me, as it means we cannot use optimization.
            Show
            extempore Paul Phillips added a comment - https://github.com/scala/scala/pull/3093
            Hide
            extempore Paul Phillips added a comment -

            I submitted it for 2.10.4 as https://github.com/scala/scala/pull/3097 .

            Show
            extempore Paul Phillips added a comment - I submitted it for 2.10.4 as https://github.com/scala/scala/pull/3097 .

              People

              • Assignee:
                extempore Paul Phillips
                Reporter:
                gerweck Sarah Gerweck
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: