summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5430 from adriaanm/dev235Adriaan Moors2016-09-298-66/+117
|\ | | | | Emit local module like lazy val
| * Clarify docs, variable nameAdriaan Moors2016-09-291-11/+12
| | | | | | | | A local lazy val and a local object are expanded in the same way.
| * Emit local module like lazy valAdriaan Moors2016-09-296-40/+88
| | | | | | | | | | | | | | | | | | The motivation is to use the new fine-grained lock scoping that local lazies have since #5294. Fixes scala/scala-dev#235 Co-Authored-By: Jason Zaugg <jzaugg@gmail.com>
| * Make some name suffixes constantsAdriaan Moors2016-09-282-18/+20
| | | | | | | | | | | | There's still a lot of duplication, as well as plenty of opportunities for constant folding / simplification.
* | Merge pull request #5433 from SethTisue/undeprecate-either-left-rightAdriaan Moors2016-09-291-15/+13
|\ \ | | | | | | don't deprecate Either.left and Either.right yet
| * | don't deprecate Either.left and Either.right yetSeth Tisue2016-09-281-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 https://github.com/scala/scala/pull/5135
* | | Merge pull request #5408 from szeiger/wip/mima-2.12.0Adriaan Moors2016-09-292-2/+2
|\ \ \ | |/ / |/| | Enable MiMa for 2.12.0
| * | Enable MiMa for 2.12.0Stefan Zeiger2016-09-292-2/+2
|/ /
* | Merge pull request #5423 from lrytz/sd229Adriaan Moors2016-09-285-12/+240
|\ \ | | | | | | | | | | | | Fixes for DelayedInit classes capturing values Fix scala/scala-dev#229
| * | SI-4683 fix $outer accesses in class bodies extending DelayedInitLukas Rytz2016-09-283-2/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | Constructors rewrites references to parameter accessor methods in the constructor to references to parameters. It avoids doing so for subclasses of DelayedInit. This commit makes sure the rewrite does not happen for the $outer paramter, a case that was simply forgotten.
| * | SI-9697 / SD-229 Fix DelayedInit subclass capturing local valueLukas Rytz2016-09-284-11/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a class captures an outer value, a field for that value is created in the class. The class also gets a constructor parameter for the captured value, the constructor will assign the field. LambdaLift re-writes accesses to the local value (Ident trees) to the field. However, if the statement accessing the local value will end up inside the constructor, the access is re-written to the constructor parameter instead. This is the case for constructor statements: class C { { println(capturedLocal) } } If C extends DelayedInit, the statement does not end up in C's constructor, but into a new synthetic method. The access to `capturedLocal` needs to be re-written to the field instead of the constructor parameter. LambdaLift takes the decision (field or constructor parameter) based on the owner chain of `currentOwner`. For the constructor statement block, the owner is a local dummy, for which `logicallyEnclosingMember` returns the constructor symbol. This commit introduces a special case in LambdaLift for local dummies of DelayedInit subclasses: instead of the constructor, we use a temporary symbol representing the synthetic method holding the initializer statements.
* | | Merge pull request #5397 from retronym/ticket/9920Adriaan Moors2016-09-287-2/+84
|\ \ \ | |_|/ |/| | SI-9920 Avoid linkage errors with captured local objects + self types
| * | SI-9920 Avoid linkage errors with captured local objects + self typesJason Zaugg2016-09-277-2/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 } ```
* | | Merge pull request #5412 from retronym/ticket/SD-226Adriaan Moors2016-09-282-1/+19
|\ \ \ | | | | | | | | | | | | | | | | Be lazier in Fields info transform for better performance Fix scala-dev#226
| * | | Make isSeparateCompiled... robust against rogue phase time travelJason Zaugg2016-09-272-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
| * | | SD-226 Be lazier in Fields info transform for better performanceJason Zaugg2016-09-212-1/+13
| | |/ | |/| | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5388 from adriaanm/issue-219Adriaan Moors2016-09-284-44/+79
|\ \ \ | | | | | | | | Avoid mismatched symbols in fields phase
| * | | Cast more pro-actively in synthetic accessor trees.Adriaan Moors2016-09-263-53/+64
| | | | | | | | | | | | | | | | Also narrow scope of afterOwnPhase.
| * | | Avoid mismatched symbols in fields phaseAdriaan Moors2016-09-262-2/+26
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge pull request #5426 from adriaanm/version-mention-lightbendAdriaan Moors2016-09-283-3/+3
|\ \ \ | | | | | | | | Including Lightbend in `-version` message.
| * | | Including Lightbend in `-version` message.Adriaan Moors2016-09-273-3/+3
|/ / / | | | | | | | | | Also consistently use "LAMP/EPFL" and not "EPFL LAMP".
* | | Merge pull request #5422 from retronym/topic/restarr-synchronizedAdriaan Moors2016-09-271-1/+1
|\ \ \ | | | | | | | | Restarr to JITtablity of generated synchronized blocks
| * | | Restarr to JITtablity of generated synchronized blocksJason Zaugg2016-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Depends on this build completing and being promoted to Maven Central. https://scala-ci.typesafe.com/view/scala-2.12.0/job/scala-2.12.0-release-main/86/console
* | | | Merge pull request #5417 from retronym/ticket/SD-233Jason Zaugg2016-09-272-1/+11
|\ \ \ \ | |/ / / |/| | | SD-233 synchronized blocks are JIT-friendly again
| * | | SD-233 synchronized blocks are JIT-friendly againJason Zaugg2016-09-272-1/+11
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5414 from szeiger/wip/no-partest-in-packAdriaan Moors2016-09-261-4/+4
|\ \ \ | | | | | | | | | | | | | | | | Do not build partest-javaagent and partest-extras for `pack` See scala-dev#223
| * | | Do not build partest-javaagent and partest-extras for `pack`Stefan Zeiger2016-09-221-4/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | 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 https://github.com/sbt/sbt/issues/2748).
* | | Merge pull request #5411 from gourlaysama/ticket/sd-220-build-without-gitAdriaan Moors2016-09-262-7/+16
|\ \ \ | | | | | | | | | | | | | | | | Build without being in a git repository Fix scala-dev#220
| * | | SD-220 building without being in a git repositoryAntoine Gourlay2016-09-202-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). ```
* | | | Merge pull request #5404 from rjolly/2.12.0Adriaan Moors2016-09-261-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Fix reference to script engine factory in META-INF/services Follow up for #4819
| * | | | Fixed reference to script engine factory in META-INF/servicesRaphael Jolly2016-09-161-1/+1
| | |/ / | |/| |
* | | | Merge pull request #5418 from retronym/opt/java-binary-nameJason Zaugg2016-09-273-5/+5
|\ \ \ \ | |_|_|/ |/| | | Optimize javaBinaryName callers
| * | | Optimize javaBinaryName callersJason Zaugg2016-09-263-5/+5
|/ / / | | | | | | | | | | | | | | | | | | ... by calling javaBinaryNameString, instead. They all are happy with a throw away String, there is no advantage to interning this into the name table.
* | | Merge pull request #5403 from retronym/bootstrap/lzycomputeSeth Tisue2016-09-201-1/+1
|\ \ \ | | | | | | | | Restarr on PR 5398, lzycompute performance fix
| * | | Restarr on PR 5398, lzycompute performance fixJason Zaugg2016-09-181-1/+1
| |/ /
* | | Merge pull request #5380 from SethTisue/remove-outdated-ensime-stuffLukas Rytz2016-09-203-30/+3
|\ \ \ | |/ / |/| | remove outdated ENSIME info
| * | remove outdated ENSIME infoSeth Tisue2016-09-073-30/+3
| | | | | | | | | | | | link to an external ENSIME page instead
* | | Merge pull request #5395 from retronym/pr/5394Jason Zaugg2016-09-152-1/+17
|\ \ \ | | | | | | | | Avoid omitting constant typed vals in constructors
| * | | Avoid omitting constant typed vals in constructorsJason Zaugg2016-09-122-1/+17
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge pull request #5398 from retronym/ticket/SD-225Jason Zaugg2016-09-155-9/+20
|\ \ \ | | | | | | | | SD-225 Use a "lzycompute" method for module initialization
| * | | SD-225 Use a "lzycompute" method for module initializationJason Zaugg2016-09-145-9/+20
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5392 from adriaanm/t9918Lukas Rytz2016-09-143-1/+5
|\ \ \ | |/ / |/| | SI-9918 object in trait mixed into package object
| * | SI-9918 object in trait mixed into package objectAdriaan Moors2016-09-103-1/+5
|/ /
* | Merge pull request #5381 from SethTisue/use-rc1-as-starrAdriaan Moors2016-09-071-2/+2
|\ \ | |/ |/| bump STARR to 2.12.0-RC1
| * bump STARR to 2.12.0-RC1Seth Tisue2016-09-061-2/+2
|/
* Merge pull request #5375 from scala/spec-typoSeth Tisue2016-09-061-1/+3
|\ | | | | Spec typo: hide source comment in rendered version
| * Spec typo: hide source comment in rendered versionLukas Rytz2016-09-051-1/+3
| |
* | Merge pull request #5368 from retronym/ticket/SD-208Adriaan Moors2016-09-064-36/+23
|\ \ | | | | | | | | | | | | SD-208 Restore 2.11 names for arrayOps implicits Fix scala/scala-dev#208
| * | SD-208 Restore 2.11 names for arrayOps implicitsJason Zaugg2016-08-313-33/+11
| | |
| * | Disable stack hungry test of deprecated PagedSeqJason Zaugg2016-08-311-1/+2
| | |