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

nested extractors generate exponential-space bytecode

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0-M4
    • Component/s: Pattern Matcher
    • Labels:
      None
    • Environment:

      extractors, bytecode

      Description

      Pattern matching multiple cases against extractors triggers a combination explosion that quickly overwhelms the maximum method size. This has bitten me quite hard on my in-progress java to scala translator, as I use extractors against the JDT for parsing java source. I have attached a demonstration. You can make a minor tweak to the attached source and see the size of the bytecode drop in half (or double again, if FJBG wouldn't choke.)

      leaf:dfascala paulp$$ scalac *.scala
      Exception in thread "main" java.lang.Error: ch.epfl.lamp.fjbg.JCode$$OffsetTooBigException: offset too big to fit in 16 bits: 36580
      at ch.epfl.lamp.fjbg.JFieldOrMethod.writeTo(JFieldOrMethod.java:114)
      [...]

      The disassembled bytecode reveals enormous nested if-else statements with massive duplicated code.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                extempore Paul Phillips
                Reporter:
                extempore Paul Phillips
                TracCC:
                Alex Cruise, Daniel Sobral, Dustin Whitney, fmpwizard, Igor Rumiha, Ismael Juma, Johannes Rudolph, Juha Heljoranta, Kieron Wilkinson, Mirko Stocker, Nathan, Paul Phillips, Seth Tisue, tomer.doron, Willis Blackburn
              • Votes:
                8 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: