Skip to content

merge 2.12.0 onto 2.12.x [ci: last-only]#5416

Merged
SethTisue merged 52 commits intoscala:2.12.xfrom
SethTisue:merge-2.12.0-to-2.12.x-sep-24
Oct 5, 2016
Merged

merge 2.12.0 onto 2.12.x [ci: last-only]#5416
SethTisue merged 52 commits intoscala:2.12.xfrom
SethTisue:merge-2.12.0-to-2.12.x-sep-24

Conversation

@SethTisue
Copy link
Member

@SethTisue SethTisue commented Sep 24, 2016

main motivation here is to get the STARR bump

no manual merging needed

SethTisue and others added 15 commits September 7, 2016 09:30
link to an external ENSIME page instead
Fix for regression in 2.12.0-RC1 compiling shapeless tests.

They were given the same treatment as vals that are
members of classes on the definition side without the
requisite transformation of references to the val to
fold the constant into references.

This commit limits the transform to members of classes.

Co-Authored-By: Miles Sabin <miles@milessabin.com>
The monitors and module instantation were inliuned into the module accessor
method in b2e0911. However, this seems to have had a detrimental impact on
performance. This might be because the module accessors are now above the
"always inline" HotSpot threshold of 35 bytes, or perhaps because they
contain monitor-entry/exit and exception handlers.

This commit returns to the the 2.11.8 appraoch of factoring
the the second check of the doublecheck locking into a method.
I've done this by declaring a nested method within the accessor;
this will be lifted out to the class level by lambdalift.

This represents a slight deviation from the implementation strategy used
for lazy accessors, which create a symbol for the slowpath method in
the info transform and generate the corresponding DefDef as a class
member. I don't believe this deviation is particular worrisome, though.

I have bootstrapped the compiler through this commit and found that
the drastic regression in compiling the shapeless test suite is solved.
SI-9918 object in trait mixed into package object
SD-225 Use a "lzycompute" method for module initialization
Avoid omitting constant typed vals in constructors
This allows building from the scala sources tarball or similar
situations where there is no local git repository:
 - the git commit date becomes the local date
 - the short git sha1 becomes "unknown"

```
Welcome to Scala 2.12.0-20160920-155429-unknown (OpenJDK 64-Bit Server VM, Java 1.8.0_102).
```
Restarr on PR 5398, lzycompute performance fix
Only mixin fields + accessors into class infos of classes that are
either in the current run, or appear in a superclass chain of a class
in the current run.

This is analagous to what happens in the mixin phase.
Building them as part of `dist/mkQuick` (and thus, by extension,
`dist/mkPack`) was not necessary in the first place. Partest does not
rely on these tasks for its dependencies.

And when we do build the jars, they now go into their standard location
under `target` instead of `build/pack/lib` so they don’t confuse
sbt (see sbt/sbt#2748).
@scala-jenkins scala-jenkins added this to the 2.12.1 milestone Sep 24, 2016
@SethTisue SethTisue changed the title main motivation here is to get the STARR bump merge 2.12.0 onto 2.12.x Sep 24, 2016
retronym and others added 13 commits September 26, 2016 21:13
... by calling javaBinaryNameString, instead.

They all are happy with a throw away String, there is no advantage
to interning this into the name table.
GenBCode, the new backend in Scala 2.12, subtly changed
the way that synchronized blocks are emitted.

It used `java/lang/Throwable` as an explicitly named exception
type, rather than implying the same by omitting this in bytecode.

This appears to confuse HotSpot JIT, which reports a error
parsing the bytecode into its IR which leaves the enclosing method
stuck in interpreted mode.

This commit passes a `null` descriptor to restore the old pattern
(the same one used by javac.) I've checked that the JIT warnings
are gone and that the method can be compiled again.
The info of the var that stores a trait's lazy val's computed value
is expressed in terms of symbols that exist before the fields phase.
When we're implementing the lazy val in a subclass of that trait,
we now see symbols created by the fields phase, which results
in mismatches between the types of the lhs and rhs in the assignment
of `lazyVar = super.lazyImpl`.

So, type check the super-call to the trait's lazy accessor before our
own phase. If the lazy var's info depends on a val that is now
implemented by an accessor synthesize by our info transformer,
we'll get a mismatch when assigning `rhs` to `lazyVarOf(getter)`,
unless we also run before our own phase (like when we were
creating the info for the lazy var).

This was revealed by Hanns Holger Rutz's efforts in compiling
scala-refactoring's test suite (reported on scala-internals).

Fixes scala/scala-dev#219
Also narrow scope of afterOwnPhase.
Fix reference to script engine factory in META-INF/services

Follow up for scala#4819
…thout-git

Build without being in a git repository

Fix scala-dev#220
Do not build partest-javaagent and partest-extras for `pack`

See scala-dev#223
We don't hit this code path during bootstrapping, but we could
conceivably hit it with macros or compiler plugins peering into
the future through atPhase before refchecks as run.

Also rename a method to reflect the generality of the info
transform (it does more than mixin, now.)
An outer parameter of a nested class is typed with the self type
of the enclosing class:

```
class C; trait T { _: C => def x = 42; class D { x } }
```

leads to:

```
    class D extends Object {
      def <init>($outer: C): T.this.D = {
        D.super.<init>();
        ()
      };
      D.this.$outer().$asInstanceOf[T]().x();
```

Note that a cast is inserted before the call to `x`.

If we modify that a little, to instead capture a local module:

```
class C; trait T { _: C => def y { object O; class D { O } } }
```

Scala 2.11 used to generate (after lambdalift):

```
    class D$1 extends Object {
      def <init>($outer: C, O$module$1: runtime.VolatileObjectRef): C#D$1 = {
        D$1.super.<init>();
        ()
      };
      D$1.this.$outer().O$1(O$module$1);
```

That isn't type correct, `D$1.this.$outer() : C` does not
have a member `O$1`.

However, the old trait encoding would rewrite this in mixin to:

```
T$class.O$1($outer, O$module$1);
```

Trait implementation methods also used to accept the self type:

```
trait T$class {
   final <stable> def O$1($this: C, O$module$1: runtime.VolatileObjectRef): T$O$2.type
}
```

So the problem was hidden.

This commit changes replaces manual typecheckin of the selection in LambdaLift with
a use of the local (erasure) typer, which will add casts as needed.

For `run/t9220.scala`, this changes the post LambdaLift AST as follows:

```
     class C1$1 extends Object {
       def <init>($outer: C0, Local$module$1: runtime.VolatileObjectRef): T#C1$1 = {
         C1$1.super.<init>();
         ()
       };
-      C1$1.this.$outer.Local$1(Local$module$1);
+      C1$1.this.$outer.$asInstanceOf[T]().Local$1(Local$module$1);
       <synthetic> <paramaccessor> <artifact> private[this] val $outer: C0 = _;
       <synthetic> <stable> <artifact> def $outer(): C0 = C1$1.this.$outer
     }
```
SD-233 synchronized blocks are JIT-friendly again
Restarr to JITtablity of generated synchronized blocks
adriaanm and others added 6 commits September 28, 2016 09:37
Avoid mismatched symbols in fields phase
Be lazier in Fields info transform for better performance

Fix scala-dev#226
There's still a lot of duplication,
as well as plenty of opportunities
for constant folding / simplification.
SI-9920 Avoid linkage errors with captured local objects + self types
Fixes for DelayedInit classes capturing values

Fix scala/scala-dev#229
@SethTisue
Copy link
Member Author

updated with latest batch of merged 2.12.0 PRs

@SethTisue SethTisue changed the title merge 2.12.0 onto 2.12.x merge 2.12.0 onto 2.12.x [ci:last-only] Sep 28, 2016
@SethTisue SethTisue changed the title merge 2.12.0 onto 2.12.x [ci:last-only] merge 2.12.0 onto 2.12.x [ci: last-only] Sep 28, 2016
SethTisue and others added 6 commits September 28, 2016 21:07
for two reasons:
* to facilitate warning-free cross-compilation between Scala 2.11
  and 2.12
* because it's not clear that .swap is a good replacement for .left

Either.right seems almost certain to be deprecated in 2.13.
Either.left's future is uncertain; see discussion (and links to
additional discussions) at scala#5135
The motivation is to use the new fine-grained lock scoping that
local lazies have since scala#5294.

Fixes scala/scala-dev#235

Co-Authored-By: Jason Zaugg <jzaugg@gmail.com>
A local lazy val and a local object are expanded in the same way.
…right

don't deprecate Either.left and Either.right yet
@SethTisue
Copy link
Member Author

Jenkins failed because scala/scala-jenkins-infra#181

SethTisue and others added 7 commits September 29, 2016 15:20
Emit local module like lazy val
make the 2.12 spec available on scala-lang.org
bump version number in spec from 2.11 to 2.12
So that we can rsync to the 2.12 spec directory.

(also updated the forced command in scalatest@chara.epfl.ch:~/.ssh/authorized_keys2)
@lrytz
Copy link
Member

lrytz commented Sep 30, 2016

/rebuild

1 similar comment
@SethTisue
Copy link
Member Author

/rebuild

@SethTisue
Copy link
Member Author

@adriaanm shall we merge? this is now several weeks' worth of commits

@adriaanm
Copy link
Contributor

adriaanm commented Oct 5, 2016

Thanks, please do! (And no need to wait for me in the future for clear wins like this.)

@SethTisue SethTisue merged commit 9d3f077 into scala:2.12.x Oct 5, 2016
@SethTisue SethTisue deleted the merge-2.12.0-to-2.12.x-sep-24 branch October 5, 2016 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants