summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* SI-8502 Rework handling of stub symbols in unpicklerJason Zaugg2016-11-292-6/+4
| | | | | | | | | - Rework previous fixes for SI-8502 to move the creation of a term or type stub symbol during unpickling to the initial point of stub creation, based on the tag. - Just set the PACKAGE flag on class stub symbols created during unpickling `ThisType`, rather than bothering with a different subclass of `StubSymbol` for (assumed) packages.
* Merge pull request #5544 from retronym/ticket/8779Jason Zaugg2016-11-2911-25/+133
|\ | | | | SI-8779 Enable inlining of code within a REPL session
| * Support inlining under -Yrepl-class-based REPLJason Zaugg2016-11-284-10/+21
| | | | | | | | | | | | | | By marking the wrapper classes as sealed, the inliner will be able to assume finality of defs introduces in the REPL without requiring the user to mark them as `final`, which is an odd thing to do in single line of REPL input.
| * SI-8779 Enable inlining of code within a REPL sessionJason Zaugg2016-11-289-21/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The REPL has a long running instance of Global which outputs classfiles by default to a VirtualDirectory. The inliner did not find any of these class files when compiling calls to methods defined in previous runs (ie, previous lines of input.) This commit: - Adds a hook to augment the classpath that the optimizer searches, and uses this in the REPL to add the output directory - Fixes the implementation of `findClassFile` in VirtualDirectory, which doesn't seem to have been used in anger before. I've factored out some common code into a new method on `AbstractFile`. - Fixes a similar problem getSubDir reported by Li Haoyi - Adds missing unit test coverage. This also fixes a bug in REPL autocompletion for types defined in packages >= 2 level deep (with the `:paste -raw` command). I've added a test for this case.
* | Merge pull request #5529 from lrytz/sd259Jason Zaugg2016-11-2914-270/+578
|\ \ | |/ |/| Better inliner support for 2.12 trait encoding
| * Clean up the implementation and output of Yopt-log-inlineLukas Rytz2016-11-281-42/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One line per inline request, nested inlines are indented. Log when a rollback happens. Examples: ``` Inline into scala/collection/SeqLike$$anon$2.andThen: inlined scala/collection/SeqLike$$anon$2.andThen. Before: 8 ins, inlined: 8 ins. inlined scala/PartialFunction.andThen$. Before: 20 ins, inlined: 8 ins. inlined scala/PartialFunction.andThen. Before: 31 ins, inlined: 10 ins. ``` and ``` Inline into scala/collection/IterableLike$$anon$1.takeWhile: inlined scala/collection/IterableLike$$anon$1.takeWhile. Before: 8 ins, inlined: 8 ins. inlined scala/collection/TraversableViewLike.takeWhile$. Before: 20 ins, inlined: 8 ins. failed scala/collection/TraversableViewLike.takeWhile. [...] would cause IllegalAccessError [...] rolling back, nested inline failed. ```
| * Address review feedbackLukas Rytz2016-11-281-15/+14
| | | | | | | | | | Rename `undoLog.run` to `rollback`, use java ArrayList instead of helper methods to copy to an array.
| * Better inliner support for 2.12 trait encodingLukas Rytz2016-11-2514-242/+484
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some changes to the trait encoding came late in the 2.12 cycle, and the inliner was not adapted to support it in the best possible way. In 2.12.0 concrete trait methods are encoded as interface T { default int m() { return 1 } static int m$(T $this) { <invokespecial $this.m()> } } class C implements T { public int m() { return T.m$(this) } } If a trait method is selected for inlining, the 2.12.0 inliner would copy its body into the static super accessor `T.m$`, and from there into the mixin forwarder `C.m`. This commit special-cases the inliner: - We don't inline into static super accessors and mixin forwarders. - Insted, when inlining an invocation of a mixin forwarder, the inliner also follows through the two forwarders and inlines the trait method body. There was a difficulty implementing this: inlining the static static super accessor would copy an `invokespecial` instruction into a different classfile, which is not legal / may change semantics. That `invokespecial` is supposed to disappear when inlining the actual default method body. However, this last step may fail, for example because the trait method body itself contains instructions that are not legal in a different classfile. It is very difficult to perform all necessary checks ahead of time. So instead, this commit implements the ability to speculatively inline a callsite and roll back if necessary. The commit also cleans up the implementation of inliner warnings a little. The previous code would always emit a warning when a method annotated `@inline` was not picked by the heuristics - this was a problem when the callsite in the static super accessor was no longer chosen.
* | Merge pull request #5556 from dragos/ticket/10071Iulian Dragos2016-11-2511-65/+147
|\ \ | |/ |/| SI-10071 Separate compilation for varargs methods
| * Simplify creation of varargs forwarder symbolJason Zaugg2016-11-251-42/+26
| | | | | | | | | | | | Cloning the original symbol in its entirety, rather than cloning its type/value parameters individually. `cloneSymbol` takes care of all the tricky substitutions for us!
| * Don’t run the uncurry info transformer on Java symbols.Iulian Dragos2016-11-251-3/+4
| |
| * SI-10071 Separate compilation for varargs methodsIulian Dragos2016-11-2511-64/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that methods annotated with varargs are properly mixed-in. This commit splits the transformation into an info transformer (that works on all symbols, whether they come from source or binary) and a tree transformer. The gist of this is that the symbol-creation part of the code was moved to the UnCurry info transformer, while tree operations remained in the tree transformer. The newly created symbol is attached to the original method so that the tree transformer can still retrieve the symbol. A few fall outs: - I removed a local map that was identical to TypeParamsVarargsAttachment - moved the said attachment to StdAttachments so it’s visible between reflect.internal and nsc.transform - a couple more comments in UnCurry to honour the boy-scout rule
* | Merge pull request #5540 from retronym/ticket/9814Lukas Rytz2016-11-252-1/+30
|\ \ | |/ |/| SI-9814 Fix synchronized in specialized overrides
| * SI-9814 Fix synchronized in specialized overridesJason Zaugg2016-11-252-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specialization creates a subclasses of a specializd class for each type parameter combination. These contains copies of the methods from the superclass. However, before this transform, the pattern of self-synchronization in a method body had been replace by flag Flag.SYNCHRONIZED on the method symbol. This was not being propagated to the override, and hence no locking occured. This commit modifies the creation of the specialized overload symbol to copy the SYNCHRONIZED flag, as was already done for ASBOVERRIDE. I have also done the same for the `@strictfp` annotation.
* | Merge pull request #5480 from SethTisue/remove-reflection-mem-typecheck-testSeth Tisue2016-11-231-28/+0
|\ \ | | | | | | SI-6412 remove flaky test
| * | SI-6412 remove flaky testSeth Tisue2016-10-261-28/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | I have repeatedly seen this fail CI runs, including recently as the comment in the test itself says: "I'm not sure this is a great way to test for memory leaks, since we're also testing how good the JVM's GC is, and this is not easily reproduced between machines/over time"
* | | Merge pull request #5535 from som-snytt/issue/9945Seth Tisue2016-11-231-1/+1
|\ \ \ | | | | | | | | SI-9945 Don't warn imports in java units
| * | | SI-9945 Don't warn imports in java unitsSom Snytt2016-11-161-1/+1
| | | | | | | | | | | | | | | | Scaladoc was prone to warning about java imports.
* | | | Merge pull request #5528 from paplorinc/getOrElseUpdateJason Zaugg2016-11-226-8/+138
|\ \ \ \ | | | | | | | | | | Changed HashMap.getOrElseUpdate to only calculate the index once
| * | | | Changed HashMap.getOrElseUpdate to only calculate the index oncePap Lőrinc2016-11-181-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes https://issues.scala-lang.org/browse/SI-10049 Since `groupBy` uses this method extensively and suffered a measurable slowdown in `2.12.0`, this modification restores (and exceeds) its original speed. --- included benchmarks: (`ns/op` → smaller is better) `before (2.12.0):` ```java Benchmark (size) Mode Cnt Score Error Units s.c.immutable.VectorMapBenchmark.groupBy 10 avgt 20 865.693 ± 7.869 ns/op s.c.immutable.VectorMapBenchmark.groupBy 100 avgt 20 3095.657 ± 56.438 ns/op s.c.immutable.VectorMapBenchmark.groupBy 1000 avgt 20 28247.005 ± 470.513 ns/op s.c.mutable.HashMapBenchmark.get 10 avgt 20 679.448 ± 11.809 ns/op s.c.mutable.HashMapBenchmark.get 100 avgt 20 7240.178 ± 61.734 ns/op s.c.mutable.HashMapBenchmark.get 1000 avgt 20 95725.127 ± 2373.458 ns/op s.c.mutable.HashMapBenchmark.getOrElseUpdate 10 avgt 20 836.561 ± 20.085 ns/op s.c.mutable.HashMapBenchmark.getOrElseUpdate 100 avgt 20 7891.368 ± 56.808 ns/op s.c.mutable.HashMapBenchmark.getOrElseUpdate 1000 avgt 20 97478.629 ± 1782.497 ns/op s.c.mutable.HashMapBenchmark.put 10 avgt 20 243.422 ± 2.915 ns/op s.c.mutable.HashMapBenchmark.put 100 avgt 20 5810.927 ± 60.054 ns/op s.c.mutable.HashMapBenchmark.put 1000 avgt 20 82175.539 ± 1690.296 ns/op ``` `after:` ```java Benchmark (size) Mode Cnt Score Error Units s.c.immutable.VectorMapBenchmark.groupBy 10 avgt 20 627.007 ± 9.718 ns/op s.c.immutable.VectorMapBenchmark.groupBy 100 avgt 20 2086.955 ± 19.042 ns/op s.c.immutable.VectorMapBenchmark.groupBy 1000 avgt 20 19515.234 ± 173.647 ns/op s.c.mutable.HashMapBenchmark.get 10 avgt 20 683.977 ± 11.843 ns/op s.c.mutable.HashMapBenchmark.get 100 avgt 20 7345.675 ± 41.092 ns/op s.c.mutable.HashMapBenchmark.get 1000 avgt 20 95085.926 ± 1702.997 ns/op s.c.mutable.HashMapBenchmark.getOrElseUpdate 10 avgt 20 503.208 ± 2.643 ns/op s.c.mutable.HashMapBenchmark.getOrElseUpdate 100 avgt 20 5526.483 ± 28.262 ns/op s.c.mutable.HashMapBenchmark.getOrElseUpdate 1000 avgt 20 69265.900 ± 674.958 ns/op s.c.mutable.HashMapBenchmark.put 10 avgt 20 252.481 ± 7.597 ns/op s.c.mutable.HashMapBenchmark.put 100 avgt 20 5708.034 ± 110.360 ns/op s.c.mutable.HashMapBenchmark.put 1000 avgt 20 82051.378 ± 1432.009 ns/op ``` i.e. for the given benchmark conditions `~40%` faster `groupBy` and `getOrElseUpdate`
| * | | | Added benchmarks for Vector and HashMapPap Lőrinc2016-11-182-0/+102
| | | | |
| * | | | Updated benchmark dependenciesPap Lőrinc2016-11-183-8/+5
| | | | |
* | | | | Merge pull request #5549 from szeiger/wip/whitelist-mimaStefan Zeiger2016-11-212-1/+12
|\ \ \ \ \ | |/ / / / |/| | | | Whitelist the remaining changes since 2.12.0 that break all builds
| * | | | Whitelist the remaining changes since 2.12.0 that break all buildsStefan Zeiger2016-11-212-1/+12
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | The changes were made in https://github.com/scala/scala/pull/5481, subsequently breaking binary compatibility checks after https://github.com/scala/scala/pull/5532 was merged, too. The affected methods are part of an internal implementation class. Whitelisting should be safe.
* | | | Merge pull request #5481 from som-snytt/issue/10007-processLukas Rytz2016-11-185-24/+54
|\ \ \ \ | | | | | | | | | | SI-10007 sys.process thread sync
| * | | | SI-10007 sys.process thread syncSom Snytt2016-11-175-24/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous change to replace `SyncVar.set` with `SyncVar.put` breaks things. This commit tweaks the thread synchronizing in `sys.process` to actually use `SyncVar` to sync and pass a var. Joining the thread about to exit is superfluous. A result is put exactly once, and consumers use non-destructive `get`. Note that as usual, avoid kicking off threads in a static context, since class loading cycles are somewhat dicier with 2.12 lambdas. In particular, REPL is a static context by default. SI-10007 Clarify deprecation message The message on `set` was self-fulfilling, as it didn't hint that `put` has different semantics. So explain why `put` helps avoid errors instead of creating them. SI-10007 Always set exit value Always put a value to exit code, defaulting to None. Also clean up around tuple change to unfortunately named Future.apply. Very hard to follow those types. Date command pollutes output, so tweak test.
* | | | | Merge pull request #5330 from som-snytt/issue/9885Jason Zaugg2016-11-182-9/+33
|\ \ \ \ \ | |_|_|_|/ |/| | | | SI-9885 Don't return offset past EOF
| * | | | SI-9885 Don't return offset past EOFSom Snytt2016-08-122-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | On bad line number, `lineToOffset` should not return an offset past EOF (which was sentinel, internally).
* | | | | Add language to code blocks in spec (#5502)Daniel Barclay2016-11-166-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add "scala" language code to pure-Scala code blocks. * Add "java" language code to Java code block. * Add "scala" language code to almost-pure-Scala code blocks. Add "scala" language code to two code blocks whose content was Scala except for containing ellipses (\ldots). * Add "scala" language code to non-literal-Scala code blocks. Add "scala" language code to code blocks that contain Scala but also special elements, such as identifiers that are italicized or have prime marks (e.g., e′, e′′), ellipses (\ldots), etc.
* | | | | Merge pull request #5532 from retronym/ticket/SD-264Adriaan Moors2016-11-167-703/+22
|\ \ \ \ \ | |_|_|/ / |/| | | | Reinstate MiMa and address problems
| * | | | Workaround a bug that rendered MiMa inoperativeJason Zaugg2016-11-162-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MiMa has been off-duty because of a bug in handling the default value of the new paramter `--direction`. This commit explicitly provides this parameter to get things working again post haste. Fixes scala/scala-dev#264
| * | | | Revert "SI-9750 isJavaAtLeast(Int)"Jason Zaugg2016-11-162-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 656162bb48fbbd703790a2c94d4563e40ddfdfc2. Adding new APIs is not possible until a major release.
| * | | | Restore binary compatiblity with 2.12.0Jason Zaugg2016-11-163-686/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Revert a typo fix to a non-private method - Whitelist changes to internals of runtime reflection that are not part of the API and should only be referenced from within scala-reflect.jar itself.
* | | | | Merge pull request #5449 from som-snytt/issue/9953Lukas Rytz2016-11-164-1/+21
|\ \ \ \ \ | | | | | | | | | | | | SI-9953 Any Any aborts warn on equals
| * | | | | SI-9953 Any Any aborts warn on equalsSom Snytt2016-10-074-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't warn about equals if any `Any` is involved. cf SI-8965 The condition for warning is that both types lub to a supertype of Object.
* | | | | | Merge pull request #5440 from som-snytt/issue/9944Lukas Rytz2016-11-163-2/+30
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-9944 Scan after interp expr keeps CR
| * | | | | | SI-9944 Scan after interp expr keeps CRSom Snytt2016-10-013-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In an interpolated expression `s"""${ e }"""`, the scanner advances input past the RBRACE. If a multiline string as shown, get the next raw char, because CR is significant.
* | | | | | | Merge pull request #5533 from som-snytt/issue/broken-9915Seth Tisue2016-11-161-1/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9915 Fix test on windows
| * | | | | | | SI-9915 Fix test on windowsSom Snytt2016-11-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `javac: -encoding UTF-8` tool args comment so javac uses correct source encoding.
* | | | | | | | Merge pull request #5530 from dwijnand/j-single-unitStefan Zeiger2016-11-161-0/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Avoid double-compiling junit sources
| * | | | | | | | Avoid double-compiling junit sourcesDale Wijnand2016-11-161-0/+1
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Fixes scala/scala-dev#266
* | | | | | | | Merge pull request #5513 from SethTisue/compiler-rootdocLukas Rytz2016-11-161-6/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | improve top-level compiler/reflect doc text
| * | | | | | | | improve top-level compiler/reflect doc textSeth Tisue2016-11-081-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this shows up at http://www.scala-lang.org/api/2.12.0/scala-compiler/ ideally there'd be something better here, but we should at least not link to egregiously outdated stuff
* | | | | | | | | Merge pull request #5534 from lrytz/t10059Lukas Rytz2016-11-163-1/+13
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|/ / / / |/| | | | | | | | SI-10059 reset the `DEFERRED` flag for Java varargs forwarders
| * | | | | | | | SI-10059 reset the `DEFERRED` flag for Java varargs forwardersLukas Rytz2016-11-163-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an abstract method is annotated `@varargs`, make sure that the generated synthetic Java varargs method does not have the `DEFERRED` flag (`ACC_ABSTRACT` in bytecode). The flag lead to an NPE in the code generator, because the ASM framework leaves certain fields `null` for abstract methods (`localVariables` in this case). Interestingly this did not crash in 2.11.x: the reason is that the test whether to emit a method body or not has changed in the 2.12 backend (in c8e6050). val isAbstractMethod = [..] methSymbol.isDeferred [..] // 2.11 val isAbstractMethod = rhs == EmptyTree // 2.12 So in 2.11, the varargs forwarder method was actually left abstract in bytecode, leading to an `AbstractMethodError: T.m([I)I` at run-time.
* | | | | | | | | Merge pull request #5512 from szeiger/wip/more-compiler-scaladocSeth Tisue2016-11-151-0/+10
|\ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / |/| | | | | | | | Add “test”, “scaladoc” and “repl” projects to scala-compiler docs
| * | | | | | | | Add “test”, “scaladoc” and “repl” projects to scala-compiler docsStefan Zeiger2016-11-081-0/+10
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | This makes the scaladoc bundle for scala-compiler consistent with the binary and source bundles.
* | | | | | | | Merge pull request #5384 from som-snytt/issue/9915Seth Tisue2016-11-143-2/+36
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-9915 Utf8_info are modified UTF8
| * | | | | | | | SI-9915 Utf8_info are modified UTF8Som Snytt2016-10-203-2/+36
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use DataInputStream.readUTF to read CONSTANT_Utf8_info. This fixes reading embedded null char and supplementary chars.
* | | | | | | | Merge pull request #5526 from 0xmohit/typo-man-pagesLukas Rytz2016-11-142-2/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix typo in scalac, scalap man pages