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

Sharing GenBcode backend between scalac and dotty #4136

Closed
wants to merge 46 commits into from

Commits on Nov 14, 2014

  1. 1 Configuration menu
    Copy the full SHA
    3d66b0d View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    7537cb6 View commit details
    Browse the repository at this point in the history
  3. 1 Configuration menu
    Copy the full SHA
    f15d62a View commit details
    Browse the repository at this point in the history
  4. 1 Configuration menu
    Copy the full SHA
    e081724 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2014

  1. 1 Configuration menu
    Copy the full SHA
    61fac46 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2014

  1. 1 Configuration menu
    Copy the full SHA
    31e1c55 View commit details
    Browse the repository at this point in the history
  2. Make sure genIcode and genASM compile.

    They are using primitives and opcodes that were extracted to objects.
    DarkDimius committed Nov 18, 2014
    1 Configuration menu
    Copy the full SHA
    78acb5a View commit details
    Browse the repository at this point in the history
  3. Use name-based pattern matching for deconstructors, using same instan…

    …ces.
    
    Saves allocations but breaks thread-safety of  BackendInterface.
    DarkDimius committed Nov 18, 2014
    1 Configuration menu
    Copy the full SHA
    c93b3b4 View commit details
    Browse the repository at this point in the history
  4. 1 Configuration menu
    Copy the full SHA
    7131476 View commit details
    Browse the repository at this point in the history
  5. 1 Configuration menu
    Copy the full SHA
    284915c View commit details
    Browse the repository at this point in the history
  6. 1 Configuration menu
    Copy the full SHA
    3c89b52 View commit details
    Browse the repository at this point in the history
  7. 1 Configuration menu
    Copy the full SHA
    4c66397 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2014

  1. Avoid initialization order problem

    retronym authored and DarkDimius committed Nov 19, 2014
    1 Configuration menu
    Copy the full SHA
    6783bec View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2014

  1. Fixing bugs introduced while porting.

    ArrayClass is magical. Several methods had recursive implementation. PatternMatching was shadowing parameter.
    DarkDimius committed Nov 20, 2014
    1 Configuration menu
    Copy the full SHA
    de1efa9 View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    b1d096f View commit details
    Browse the repository at this point in the history
  3. 1 Configuration menu
    Copy the full SHA
    9986e7d View commit details
    Browse the repository at this point in the history
  4. 5 Configuration menu
    Copy the full SHA
    d37adac View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2014

  1. Move in shared implementation between dotty and scalac.

    Those methods ended having same implementation in dotty and scalac.
    And even more they are implemented in terms of what is already part of exposed abstractions.
    Providing default implementations, that can be overridden in backends if ever needed.
    DarkDimius committed Nov 24, 2014
    1 Configuration menu
    Copy the full SHA
    82d137f View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    9300268 View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2014

  1. Fix error in BCodeBodyBuilder.

    Found by just looking at the code. Interestingly enough none of the tests broke.
    DarkDimius committed Nov 25, 2014
    1 Configuration menu
    Copy the full SHA
    2d0104d View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2014

  1. Get rid of most of allocations in ScalacBackendInterface

    By reusing same decorator instances.
    DarkDimius committed Nov 26, 2014
    1 Configuration menu
    Copy the full SHA
    20b3c04 View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    0b2e0c5 View commit details
    Browse the repository at this point in the history
  3. Make reading of source easier by giving a bit more structure.

    Also gather in one place Product1s
    DarkDimius committed Nov 26, 2014
    1 Configuration menu
    Copy the full SHA
    fa98eea View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2014

  1. 1 Configuration menu
    Copy the full SHA
    fa67f6c View commit details
    Browse the repository at this point in the history
  2. Handle Dotty Idents

    In Scalac any function call has Select as it function. In dotty it could be an Ident.
    Eg in Scalac you get Select(Preded$, println);
    while in dotty you get Ident(println)
    In order to get actual receiver need to either look at the type(which is TermRef) or at owner chain.
    First one is more systematic but is isn't exposed in the abstraction API, so using the second one.
    DarkDimius committed Nov 27, 2014
    1 Configuration menu
    Copy the full SHA
    f9b3cf1 View commit details
    Browse the repository at this point in the history
  3. Handle dotty typeApply.

    TypeApply's are free to not have a Apply node around them in dotty.
    DarkDimius committed Nov 27, 2014
    1 Configuration menu
    Copy the full SHA
    0e1fec4 View commit details
    Browse the repository at this point in the history
  4. 1 Configuration menu
    Copy the full SHA
    084cc06 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2014

  1. Minimal set of modifications to allow to support both dotty <label> D…

    …efDefs and scalac LabelDefs
    
    DefDefs are assumed to be grouped in blocks that share same return address used to jump back.
    DarkDimius committed Dec 2, 2014
    1 Configuration menu
    Copy the full SHA
    5b1ef8c View commit details
    Browse the repository at this point in the history
  2. A bit more abstraction on what are primitives and operations on them.

    Required to support arrays in dotty. Operations on those couldn't be decided based on symbol.
    DarkDimius committed Dec 2, 2014
    1 Configuration menu
    Copy the full SHA
    b8d14a1 View commit details
    Browse the repository at this point in the history
  3. 1 Configuration menu
    Copy the full SHA
    2d22839 View commit details
    Browse the repository at this point in the history
  4. Handle Dotty Closures. Generate InvokeDynamic for them. Give a basis …

    …to generate them for Scalac
    
    Based on https://github.com/retronym/scala/compare/topic/invoke-dynamic-lambda adapted to abstract from global.
    DarkDimius committed Dec 2, 2014
    1 Configuration menu
    Copy the full SHA
    e6c183a View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2014

  1. 1 Configuration menu
    Copy the full SHA
    77f2fad View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    d62f7bf View commit details
    Browse the repository at this point in the history
  3. 1 Configuration menu
    Copy the full SHA
    0581a7c View commit details
    Browse the repository at this point in the history
  4. 1 Configuration menu
    Copy the full SHA
    61fb9a5 View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2014

  1. 1 Configuration menu
    Copy the full SHA
    57274f8 View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    1439f45 View commit details
    Browse the repository at this point in the history
  3. 1 Configuration menu
    Copy the full SHA
    5215341 View commit details
    Browse the repository at this point in the history
  4. 1 Configuration menu
    Copy the full SHA
    0bbab5c View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2014

  1. snapshot scala

    lrytz committed Dec 5, 2014
    1 Configuration menu
    Copy the full SHA
    8628f92 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1 from lrytz/sharedBackend

    snapshot scala
    DarkDimius committed Dec 5, 2014
    1 Configuration menu
    Copy the full SHA
    2712a22 View commit details
    Browse the repository at this point in the history
  3. 1 Configuration menu
    Copy the full SHA
    658e2f6 View commit details
    Browse the repository at this point in the history
  4. Handle dotty Idents by desugaring them into selects.

    Handling Ident's in dotty requires analysing its type,
    Instead of exporting a lot of abstractions around types
    I'd better go with a single method that hides this.
    DarkDimius committed Dec 5, 2014
    Configuration menu
    Copy the full SHA
    9392c81 View commit details
    Browse the repository at this point in the history
  5. SI-9003 Eagerly capture more potentially mutable binders

    This is a re-run of SI-5158 in two different contexts.
    
    As reported, the result of `unapply[Seq]` under name based pattern
    matching might not guarantee stability of results of calls to
    `_1`, `apply(i)`, etc, so we call these eagerly, and call them
    once only.
    
    I also found a case in regular pattern matching that we hadn't
    accounted for: extracting elements of sequences (either from
    a case class or from an `unapplySeq`) may also be unstable.
    
    This commit changes `ExtractorTreeMaker` to force storage
    of such binders, even under `-optimize`. This parallels the change
    to `ProductExtractorTreeMaker` in 8ebe8e3.
    
    I have added a special case for traditional `unapply` methods
    returning `Option`. This avoids a change for:
    
    ```
    % cat test/files/run/t9003b.scala
    object Single {
      def unapply(a: Any) = Some("")
    }
    
    object Test {
      def main(args: Array[String]): Unit = {
        "" match {
          case Single(x) =>
            (x, x)
        }
      }
    }
    % qscalac -optimize -Xprint:patmat test/files/run/t9003b.scala 2>&1 | grep --context=5 get
          case <synthetic> val x1: Any = "";
          case5(){
            <synthetic> val o7: Some[String] = Single.unapply(x1);
            if (o7.isEmpty.unary_!)
              matchEnd4({
                scala.Tuple2.apply[String, String](o7.get, o7.get);
                ()
              })
            else
              case6()
          };
    % scalac-hash v2.11.4 -optimize -Xprint:patmat test/files/run/t9003b.scala 2>&1 | grep --context=5 get
          case <synthetic> val x1: Any = "";
          case5(){
            <synthetic> val o7: Some[String] = Single.unapply(x1);
            if (o7.isEmpty.unary_!)
              matchEnd4({
                scala.Tuple2.apply[String, String](o7.get, o7.get);
                ()
              })
            else
              case6()
          };
    ```
    retronym authored and lrytz committed Dec 5, 2014
    Configuration menu
    Copy the full SHA
    3ec6c6f View commit details
    Browse the repository at this point in the history
  6. Even more handling of primitives by trees.

    needed to handle array_clone in dotty. Which doesn't have a symbol but isn't byte code primitive operation
    DarkDimius committed Dec 5, 2014
    1 Configuration menu
    Copy the full SHA
    cdaf6dc View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2014

  1. 1 Configuration menu
    Copy the full SHA
    beaa78b View commit details
    Browse the repository at this point in the history