summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* SI-9750 scala.util.Properties.isJavaAtLeast works with JDK9Pavel Petlinsky2016-07-132-28/+54
| | | | | | | | | | The utility method compares javaSpecVersion, which has the form "1.8" previously and "9" going forward. The method accepts "1.n" for n < 9. More correctly, the string argument should be a single number. Supports JEP-223.
* Merge pull request #5255 from adriaanm/2.12.xAdriaan Moors2016-06-291-2/+2
|\ | | | | Bump STARR to 2.12.0-M5.
| * Bump STARR to 2.12.0-M5.Adriaan Moors2016-06-291-2/+2
|/
* Merge pull request #5251 from adriaanm/rebase-5177Lukas Rytz2016-06-2939-222/+418
|\ | | | | Emit trait method bodies in statics [rebase of #5177]
| * Use 2.12.0-M4-9901daf as STARR (see #5152)Adriaan Moors2016-06-283-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit switches to using 2.12.0-M3-dc9effe as STARR, so that we can switch to the new trait encoding where each concrete trait member gets a a static member, which has the actual implementation (as well as serving as a target for for super calls using invokestatic), and a default member (forwards to the static member). Also bump partest to 1.0.17 -- the release that goes with the in-sourcing of scalacheck. Replace a few more -Yopt with -opt (for our new STARR)
| * Bootstrap skips scalacheck build step / partest depAdriaan Moors2016-06-281-5/+5
| | | | | | | | | | Keeping diff minimal since this will need to be reverted once 2.12.0 is final.
| * Emit trait method bodies in staticsJason Zaugg2016-06-2833-206/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And use this as the target of the default methods or statically resolved super or $init calls. The call-site change is predicated on `-Yuse-trait-statics` as a stepping stone for experimentation / bootstrapping. I have performed this transformation in the backend, rather than trying to reflect this in the view from Scala symbols + ASTs. We also need to add an restriction related to invokespecial to Java parents: to support a super call to one of these to implement a super accessor, the interface must be listed as a direct parent of the class. The static method names has a trailing $ added to avoid duplicate name and signature errors in classfiles.
| * Revert pruning of redundant Java parentsJason Zaugg2016-06-281-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts the fix for SI-5278 made in 7a99c03da. The original motivation for this case to avoid bytecode that stretched platform limitations in Android. For super calls to Scala defined trait methods, we won't use `invokespecial`, but rather use `invokestatic` to a static trait implementation method. As such, we can continue to prune redundant Scala interfaces. It might be worth considering removing the pruning of redundant parents altoghether, though: - We no longer include `ScalaObject` as a parent of every class, which was mentioned as a problem in SI-5728. - Scala 2.12 has left Android behind for the time being due to use of Java 8 facilities. - javac doesn't do this, so why should we?
| * Don't minimize parents of java defined syms.Jason Zaugg2016-06-281-1/+2
| |
| * Remove stray .class file from version controlJason Zaugg2016-06-281-0/+0
| |
| * Better diagnostic for optimizer crashesJason Zaugg2016-06-281-3/+9
| |
| * Remove nonsensical body for trait getterJason Zaugg2016-06-281-1/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corrects an error in the change to the trait encoding in #5003: getters in traits should have empty bodies and be emitted as abstract. ``` % ~/scala/2.12.0-M4/bin/scalac sandbox/test.scala && javap -c T Compiled from "test.scala" public interface T { public abstract void T$_setter_$x_$eq(int); public int x(); Code: 0: aload_0 1: invokeinterface #15, 1 // InterfaceMethod x:()I 6: ireturn public int y(); Code: 0: aload_0 1: invokeinterface #20, 1 // InterfaceMethod y:()I 6: ireturn public void y_$eq(int); Code: 0: aload_0 1: iload_1 2: invokeinterface #24, 2 // InterfaceMethod y_$eq:(I)V 7: return public void $init$(); Code: 0: aload_0 1: bipush 42 3: invokeinterface #29, 2 // InterfaceMethod T$_setter_$x_$eq:(I)V 8: aload_0 9: bipush 24 11: invokeinterface #24, 2 // InterfaceMethod y_$eq:(I)V 16: return } % qscalac sandbox/test.scala && javap -c T Compiled from "test.scala" public interface T { public abstract void T$_setter_$x_$eq(int); public abstract int x(); public abstract int y(); public abstract void y_$eq(int); public static void $init$(T); Code: 0: aload_0 1: bipush 42 3: invokeinterface #21, 2 // InterfaceMethod T$_setter_$x_$eq:(I)V 8: aload_0 9: bipush 24 11: invokeinterface #23, 2 // InterfaceMethod y_$eq:(I)V 16: return public void $init$(); Code: 0: aload_0 1: invokestatic #27 // Method $init$:(LT;)V 4: return } ```
* Merge pull request #5244 from retronym/topic/insource-scalacheckAdriaan Moors2016-06-2826-66/+3702
|\ | | | | Temporarily insource Scalacheck
| * Fix ParVector#padToJason Zaugg2016-06-287-43/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was throwing a UnsupportedOperationError for small operations. The parallel collections test suite sets `-minSuccessfulTests 5` in test/files/scalacheck/parallel-collections/pc.scala, which is far lower thatn the default of 100, and means that we are less likely to falsify properties. This parameter seems to have been added in #2476, assuming I'm reading it correctly. Not sure of the motiviation, perhaps just to make the slowest part of the scalacheck test suite run faster? I haven't changed the paramater now, but instead have included a one element collection in generator. I also found that when the test failed, Scalacheck would try to minimize the example, but did so assuming that the elements of the tuple of test data could be independentally shrunk. This breaks the invariant that the two collections contain equal elements, and led to spurious error reports. I have disabled shrinking in all tests tests affected by this.
| * Temporarily insource Scalacheck 1.11.6Jason Zaugg2016-06-2719-23/+3653
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a temporary measure until we release Scala 2.12.0. It means we are able to release milestones, and RCs of Scala without needing a public release of Scalacheck. While we've never had to wait very long for these in the past (Thanks, Rickard!) we'd like to spare the maintainer some work betwen now and 2.12.0. After we release Scala 2.12.0, we'll revert to a binary dependency on the standard Scalacheck. I have replaced the scala-parser-combinator based command line option parsing with a quick and dirty version. I've had to remove scalacheck as a SBT test framework in our build. We don't use it directly as such (instead, it is used indirectly through `partest --scalacheck`), and it's test discovery (which we expect to return nothing) fails after re-STARR-ing due to an unsolved problem with SBT's testLoader including either STARR or sbt-launch.jar on the classpath used to discover and spawn tests. For the record, I tried the following to no avail: ``` // Two modifications are needed from the stock SBT configuration in order to exclude STARR // from the classloader that performs test discovery. // - We make `isManagedVersion` hold by providing an explicit Scala version, in order to go into the desired // branch in `createTestLoader` // - We remove STARR from the classloader of the scala instance def fixTestLoader = testLoader := { val s = scalaInstance.value val scalaInstance1 = new ScalaInstance(s.version, appConfiguration.value.provider.scalaProvider.loader(), s.libraryJar, s.compilerJar, s.extraJars, Some(s.actualVersion)) assert(scalaInstance1.isManagedVersion) TestFramework.createTestLoader(Attributed.data(fullClasspath.value), scalaInstance1, IO.createUniqueDirectory(taskTemporaryDirectory.value)) } ``` f
* Merge pull request #5242 from szeiger/wip/merge-2.11-to-2.12-june-19Adriaan Moors2016-06-2319-91/+408
|\ | | | | Merge 2.11 to 2.12 [ci: last-only]
| * Fix test failures of the sbt build in 2.12.xLukas Rytz2016-06-232-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - More memory for compiling partest tests - Enable more detailed logging for partest failures: Partest’s `AntRunner` has extra code for logging details of all failed tests at the end of a run which is not present in `SbtRunner` but we can set the `--show-log` and `--show-diff` options to get similar output interspersed with the main test log. - Update OSGi test dependencies for sbt build to same versions as in ant (see 8247b8f077c96ba9a017b53de4d8062fe428c4a7 for the motivation for this change). - Disable MiMa checks (to be reactivated after M5).
| * Merge commit 'aaf7bc0' into merge-2.11-to-2.12-june-19Lukas Rytz2016-06-2117-88/+378
| |\
| | * Merge pull request #5190 from szeiger/wip/validate-test-use-sbtLukas Rytz2016-06-1921-92/+382
| | |\ | | | | | | | | Use sbt for PR validation [ci: last-only]
| | | * Remove bnd warnings from log outputStefan Zeiger2016-06-141-1/+1
| | | |
| | | * Use sbt for PR validationStefan Zeiger2016-06-1421-92/+382
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Support directories in `-doc-external-doc`: It is documented as accepting a “classpath_entry_path” for the keys but this only worked for JARs and not for individual class files. When checking for external-doc mappings for a Symbol, we now find the root directory relative to a class file instead of using the full class file path. The corresponding tests for SI-191 and SI8557 are also fixed to support individual class files instead of JARs in partest. This is required for the sbt build which runs partest on “quick” instead of “pack”. - Fix version and repository handling for bootstrapping. The bootstrap `scalaInstance` can now be resolved from any repository added to the project (not just the bootstrap repositories) by using a different workaround for https://github.com/sbt/sbt/issues/1872. - Workaround for https://github.com/sbt/sbt/issues/2640 (putting the wrong `scalaInstance` on partest’s classpath). The required `ScalaInstance` constructor is deprecated, so we have to disable deprecation warnings and fatal warnings until there is a better fix. - Add MiMa to the sbt build (port of the old `test.bc` ant task). The sbt-mima plugin doesn’t have all the features we need, so we do it manually in a similar way to what the plugin does. Checks are done in both directions for the `library` and `compiler` projects. The base version has to be set in `build.sbt`. When set to `None`, MiMa checks are skipped. MiMa checks are run sequentially to avoid spurious errors (see https://github.com/typesafehub/migration-manager/issues/115). - Port the OSGi tests to the sbt build. The set of JARs that gets copied into build/osgi as bundles is a bit different from the ant build. We omit the source JARs but add additional modules that are part of the Scala distribution, which seems more correct. - Get rid up `pull-binary-libs.sh` for the sbt build. Add artifacts are resolved from the special bootstrap repository through Ivy. The special `code.jar` and `instrumented.jar` artifacts are copied to the location where partest expects them (because these paths are hardcoded in partest). Other extra JARs for partest in `test/files/lib` are referenced directly from the Ivy cache. - Move common settings that should be available with unqualified names in local `.sbt` files and on the command line into an auto-plugin. - Add an `antStyle` setting to sbt to allow users to easily enable ant-style incremental compilation instead of sbt’s standard name hashing with `set antStyle := true`. - Disable verbose `info`-level logging during sbt startup for both, `validate/test` and `validate/publish-core` jobs. Update logging is no longer disabled when running locally (where it is useful and doesn’t generate excessive output). - Pass optimization flags for scalac down to partest, using the new partest version 1.0.15\6. - Call the new sbt-based PR validation from `scripts/jobs/validate/test`. - Disable the tests `run/t7843-jsr223-service` and `run/t7933` from https://github.com/scala/scala/pull/4959 for now. We need to set up a new test project (either partest or junit) that can run them on a packaged version of Scala, or possibly move them into a separate project that would naturally run from a packaged Scala as part of the community build.
| * | Merge commit '91b6944' into merge-2.11-to-2.12-june-19Lukas Rytz2016-06-192-1/+28
| |\|
| | * Merge pull request #5219 from som-snytt/issue/9245Jason Zaugg2016-06-142-1/+28
| | |\ | | | | | | | | SI-9245 Fresher name in Try and test
| | | * SI-9245 Fresher name in Try and testSom Snytt2016-06-072-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fresh name for catcher gets a dollar. "Here, have a dollar." Test due to retronym demonstrates possible conflict. Over the lifetime of the universe, surely at least one code monkey would type in that identifier to catch a banana.
| * | | Merge commit 'ab06ce8' into merge-2.11-to-2.12-june-19Lukas Rytz2016-06-190-0/+0
| |\| |
| | * | Merge pull request #5213 from som-snytt/issue/stringof-pariterableJason Zaugg2016-06-142-2/+59
| | |\ \ | | | | | | | | | | SI-9737 [no-merge] Backport stringOf ParIterable
| | | * | SI-9737 [no-merge] Backport stringOf ParIterableNicolas Stucki2016-06-032-2/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cherry-picked c5f3d3f286ee5c26c8ddcf10f6878058e8f7e040 Edited comment: in stringOf, let GenIterable subsume both Iterable and ParIterable. This change is required for Scala.js compatibility as it does not support parallel collections. Conflicts: src/library/scala/runtime/ScalaRunTime.scala
| * | | | Merge commit 'f775e1f' into merge-2.11-to-2.12-june-19Lukas Rytz2016-06-191-2/+2
|/| | | | | |/ / /
| * | | Merge pull request #5223 from FelAl/typo_fixJason Zaugg2016-06-141-2/+2
| |\ \ \ | | |_|/ | |/| | Typo fix build.sbt
| | * | Typo fixaf2016-06-101-2/+2
| | | |
* | | | Merge pull request #5202 from lrytz/lineNumbersAdriaan Moors2016-06-0616-109/+175
|\ \ \ \ | | | | | | | | | | Keep line numbers when inlining from the same compilation unit
| * | | | Remove TopLevelCreationFlagsLukas Rytz2016-06-062-8/+3
| | | | |
| * | | | Keep line numbers when inlining from the same compilation unitLukas Rytz2016-06-063-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, line numbers were kept only when inlining from the same class. We can also keep them when inlining from a different class defined in the same compilation unit. Longer-term we should support JSR-45, see SI-7518 and scala-dev#3.
| * | | | SI-9256 check companions in same compilation unit only if same runLukas Rytz2016-06-064-17/+30
| | | | |
| * | | | clear all flags when resetting a symbolLukas Rytz2016-06-063-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this change is a bit scary because it changes code that's not been changed in 11 years https://github.com/scala/scala/commit/7fa7c93#diff-d5789e5ae5061197d782d08324b260dbL214
| * | | | Store source file paths of classes being compiled in the bytecode repoLukas Rytz2016-06-067-72/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For classes being compiled (vs. being loaded from classfiles), keep the source file path in the bytecode repo. This will allow to keep line numbers when inlining from one class into another in case the two are defined in the same compilation unit.
| * | | | Avoid separate traversal in inliner to remove line number nodesLukas Rytz2016-06-062-9/+7
| | | | |
* | | | | Merge pull request #5216 from adriaanm/2.12.xAdriaan Moors2016-06-061-1/+4
|\ \ \ \ \ | | | | | | | | | | | | Merge 2.11.x into 2.12.x for the fix for SI-7898
| * \ \ \ \ Merge branch '2.11.x' into 2.12.xAdriaan Moors2016-06-051-1/+4
| |\ \ \ \ \ | | | |/ / / | | |/| | |
| | * | | | Merge pull request #5214 from som-snytt/issue/7898-sbtAdriaan Moors2016-06-051-1/+4
| | |\ \ \ \ | | | |_|_|/ | | |/| | | SI-7898 Preserve reader against subversion
| | | * | | SI-7898 Preserve reader against subversionSom Snytt2016-06-041-1/+4
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SBT tries to install its own SimpleReader (for some reason) if it needs to create its own IMain. Because Rube Goldberg needs to execute some postinit hooks, don't let SBT do that.
* | | | | Merge pull request #5211 from ↵Jason Zaugg2016-06-061-3/+1
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | | | | | | janekdb/topic/2.12.x-remove-experimental-notice-from-sbt-build Remove experimental status from sbt build in load message
| * | | | Remove experimental status from sbt build in load messageJanek Bogucki2016-06-041-3/+1
| | | | | | | | | | | | | | | | | | | | sbt is now the preferred build tool.
* | | | | Merge pull request #5099 from retronym/ticket/9390Jason Zaugg2016-06-0617-33/+192
|\ \ \ \ \ | | | | | | | | | | | | SI-9390 Emit local defs that don't capture this as static
| * | | | | SI-9390 Avoid needless outer capture with local classesJason Zaugg2016-06-0310-15/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An existing optimization in `Constructors` elides the outer field in member and local classes, if the class doesn't use the outer reference. (Member classes also need to be final, which is a secret handshake to say we're also happy to weaken prefix matching in the pattern matcher.) That optimization leaves the constructor signature as is: the constructor still accepts the outer instance, but does not store it. For member classes, this means that we can separately compile code that calls the constructor. Local classes need not be hampered by this constraint, we could remove the outer instance from the constructor call too. Why would we want to do this? Let's look at the case before and after this commit. Before: ``` class C extends Object { def foo(): Function1 = $anonfun(); final <static> <artifact> def $anonfun$foo$1($this: C, x: Object): Object = new <$anon: Object>($this); def <init>(): C = { C.super.<init>(); () } }; final class anon$1 extends Object { def <init>($outer: C): <$anon: Object> = { anon$1.super.<init>(); () } } ``` After: ``` class C extends Object { def foo(): Function1 = $anonfun(); final <static> <artifact> def $anonfun$foo$1(x: Object): Object = new <$anon: Object>(null); def <init>(): C = { C.super.<init>(); () } }; final class anon$1 extends Object { def <init>($outer: C): <$anon: Object> = { anon$1.super.<init>(); () } } ``` However, the status quo means that a lambda that This in turn makes lambdas that refer to such classes serializable even when the outer class is not itself serialiable. I have not attempted to extend this to calls to secondary constructors.
| * | | | | SI-9390 Emit local defs that don't capture this as staticJason Zaugg2016-06-018-18/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids unnecessary memory retention, and allows lambdas that call the local methods to be serializable, regardless of whether or not the enclosing class is serializable. The second point is especially pressing, given that the enclosing class for local methods defined in a used to be the (serializable) anonymous function class, but as of Scala 2.12 will be the enclosing class of the lambda. This change is similar in spirit to SI-9408 / 93bee55e.
* | | | | | Merge pull request #5157 from retronym/topic/lambda-staticsJason Zaugg2016-06-0627-81/+172
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | Lambda impl methods static and more stably named
| * | | | | Drop local suffix in lambda impl method nameJason Zaugg2016-06-021-1/+1
| |/ / / /
| * | | | Treat self parameter as non-null in the optimizerLukas Rytz2016-06-016-10/+16
| | | | |
| * | | | Lambda impl methods static and more stably namedJason Zaugg2016-06-0120-68/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The body of lambdas is compiled into a synthetic method in the enclosing class. Previously, this method was a public virtual method named `fully$qualified$Class$$anonfun$n`. For lambdas that didn't capture a `this` reference, a static method was used. This commit changes two aspects. Firstly, all lambda impl methods are now emitted static. An extra parameter is added to those that require a this reference. This is an improvement as it: - allows, shorter, more readable names for the lambda impl method - avoids pollution of the vtable of the class. Note that javac uses private instance methods, rather than public static methods. If we followed its lead, we would be unable to support important use cases in our inliner Secondly, the name of the enclosing method has been included in the name of the lambda impl method to improve debuggability and to improve serialization compatibility. The serialization improvement comes from the way that fresh names for the impl methods are allocated: adding or removing lambdas in methods not named "foo" won't change the numbering of the `anonfun$foo$n` impl methods from methods named "foo". This is in line with user expectations about anonymous class and lambda serialization stability. Brian Goetz has described this tricky area well in: http://cr.openjdk.java.net/~briangoetz/eg-attachments/lambda-serialization.html This commit doesn't go as far a Javac, we don't use the hash of the lambda type info, param names, etc to map to a lambda impl method name. As such, we are more prone to the type-1 and -2 failures described there. However, our Scala 2.11.8 has similar characteristics, so we aren't going backwards. Special case in the naming: Use "new" rather than "<init>" for constructor enclosed lambdas, as javac does. I have also changed the way that "delambdafy target" methods are identifed. Rather than relying on the naming convention, I have switched to using a symbol attachment. The assumption is that we only need to identify them from within the same compilation unit. This means we can distinguish impl metbods for expanded functions (ones called from an `apply` method of an ahead-of-time expanded anonfun class), from those that truly end up as targets for lambda metafactory. Only the latter are translated to static methods in this patch.