| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
fix README. 2.12.x branch require Java 8
|
|/ |
|
|\
| |
| | |
Merge 2.11 to 2.12 june 26
|
| |\ |
|
| | |\
| | | |
| | | | |
Contributors guide tweaks
|
| | | | |
|
| | |/ |
|
| |\| |
|
| | |\
| | | |
| | | | |
Bump versions after 2.11.7 release
|
| | | | |
|
|/| | |
| |/ / |
|
| |\ \
| | |/
| |/| |
Traits mistakenly set as 'Case Classes' subsection
|
| | |
| | |
| | |
| | |
| | | |
Instead of being its own section, a minor formatting issue causes 'Traits' to be rendered and numbered as a subsection of the section 'Case Classes'.
This patch changes the numbering on both 'Traits' and 'Object Definitions' sections.
|
| |\ \
| | | |
| | | | |
Fix 8 typos (j-l)
|
| | | | |
|
| |\ \ \
| | |/ /
| |/| | |
Closure elimination for new backend
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The parameter types of a closure invocation can be supertypes of the
parameter types in the implementation method. The closure automatically
casts arguments to the right type. We need to do the same when
rewriting closure invocations. Example:
val fun: String => String = l => l
val l = List("")
fun(l.head)
The closure object calls `apply(Object)Object`. The body method takes
an argument of type `String`.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When an indylambda closure is allocated and invoked within the same
method, rewrite the invocation to the implementation method.
This works for any indylambda / SAM type, not only Scala functions.
However, the Scala compiler (under -Xexperimental) currently desugars
function literals for non-FunctionN types to an anonymous class during
typer.
No testing yet, waiting for FunctionN to become SAMs first.
The feature requires scala-java8-compat to be on the classpath and a
number of compiler flags:
-Ydelambdafy:method -Ybackend:GenBCode -Yopt:closure-elimination -target:jvm-1.8
➜ scala git:(opt/closureInlining) ant -Dscala-java8-compat.package=1 -Dlocker.skip=1
➜ scala git:(opt/closureInlining) cd sandbox
➜ sandbox git:(opt/closureInlining) cat Fun.java
public interface Fun<T> {
T apply(T x);
}
➜ sandbox git:(opt/closureInlining) javac Fun.java
➜ sandbox git:(opt/closureInlining) cat Test.scala
class C {
val z = "too"
def f = {
val kap = "me! me!"
val f: Tuple2[String, String] => String = (o => z + kap + o.toString)
f(("a", "b"))
}
def g = {
val f: Int => String = x => x.toString
f(10)
}
def h = {
val f: Fun[Int] = x => x + 100 // Java SAM, requires -Xexperimental, will create an anonymous class in typer
f(10)
}
def i = {
val l = 10l
val f: (Long, String) => String = (x, s) => s + l + z + x
f(20l, "n")
}
def j = {
val f: Int => Int = x => x + 101 // specialized
f(33)
}
}
➜ sandbox git:(opt/closureInlining) ../build/quick/bin/scalac -target:jvm-1.8 -Yopt:closure-elimination -Ydelambdafy:method -Ybackend:GenBCode -Xexperimental -cp ../build/quick/scala-java8-compat:. Test.scala
➜ sandbox git:(opt/closureInlining) asm -a C.class
➜ sandbox git:(opt/closureInlining) cat C.asm
[...]
public g()Ljava/lang/String;
L0
INVOKEDYNAMIC apply()Lscala/compat/java8/JFunction1; [
// handle kind 0x6 : INVOKESTATIC
java/lang/invoke/LambdaMetafactory.altMetafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
// arguments:
(Ljava/lang/Object;)Ljava/lang/Object;,
// handle kind 0x6 : INVOKESTATIC
C.C$$$anonfun$2$adapted(Ljava/lang/Object;)Ljava/lang/String;,
(Ljava/lang/Object;)Ljava/lang/String;,
3,
1,
Lscala/Serializable;.class,
0
]
CHECKCAST scala/Function1
L1
ASTORE 1
L2
ALOAD 1
BIPUSH 10
INVOKESTATIC scala/runtime/BoxesRunTime.boxToInteger (I)Ljava/lang/Integer;
ASTORE 2
POP
ALOAD 2
INVOKESTATIC C.C$$$anonfun$2$adapted (Ljava/lang/Object;)Ljava/lang/String;
CHECKCAST java/lang/String
L3
ARETURN
[...]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
ASM has a built-in `SourceValue` analysis which computes for each
value a set of instructions that may possibly have constructed it.
The ProdConsAnalyzer class provides additional queries over the
result of the SourceValue analysis:
- consumers of values
- tracking producers / consumers through copying operations (load,
store, etc)
A fix to (and therefore a new version of) ASM was required. See here:
https://github.com/scala/scala-asm/commit/94106a5472
|
|\ \ \ \
| | | | |
| | | | | |
Default to delambdafy:method and backend:GenBCode
|
| | | | |
| | | | |
| | | | |
| | | | | |
It was fixed in GenASM in 44807a7852.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Switch the defaults of `-Ydelambdafy` and `-Ybackend`.
Rewrite t6288b-jump-position test - no more icode
Don't crash GenBCode beyond JVM code size limits
A similar patch is in GenASM, see 3fa2c97
Fix check files for GenBCode / delambdafy:method defaults
Force copy propagation test to ASM, see SI-9364
Force inline-ex-handlers test to GenASM, see SI-9364
Move t6613 test to pending - still broken in GenBCode
Adding a `flags` file with `-Ybackend:GenASM` doesn't seem to have
the desired effect.
SI-6613 is re-opened.
Force a few tests to GenASM, see SI-9364
|
|\ \ \ \
| | | | |
| | | | | |
SI-9277 Downgrade marginal javap features
|
| | | | |
| | | | |
| | | | |
| | | | | |
Drop Java 6 support, -fun, -app, and -raw options.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-4147 Add an implementation of `mutable.TreeMap`
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This commit contains an implementation of a mutable red-black tree with focus on performance. It also contains a new `mutable.TreeMap` Scala collection that is backed by the aforementioned tree. The common generic factories and traits related to mutable sorted maps didn't exist yet, so this commit also adds them.
Regarding performance, `TreeMap` overrides (from `MapLike` and `SortedMapLike`) all of the most common methods for maps and also those whose default implementations are asymptotically worse than direct red-black tree algorithms (e.g. `last`, `clear`).
The `rangeImpl` method of `TreeMap` returns an instance of `TreeMapView`, an inner class of `TreeMap`. This view is backed by the same `RedBlackTree.Tree` instance, and therefore changes to the original map are reflected in the view and vice-versa. The semantics of mutating a view by adding and removing keys outside the view's range are the same of the current `mutable.TreeSet`. A bit less focus was given on the performance of views - in particular, getting the `size` of a `TreeMapView` is O(n) on the number of elements inside the view bounds. That can be improved in the future.
In a future commit, `mutable.TreeSet` can be changed to be backed by this red-black tree implementation.
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
Documentation for split [ci: last-only]
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Reverts to calling String.split(re: String), but change escape to
always put us on the JDK7 fast-path if possible, which is for everything
but Chars representing surrogate codeunits
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Merge 2.11.x to 2.12.x
|
| |\ \ \ \ \
| | |/ / / /
| |/| / / /
| | |/ / / |
|
| | |\ \ \
| | | | | |
| | | | | | |
Fix 25 typos (g-i)
|
| | | |/ / |
|
| | |\ \ \
| | | | | |
| | | | | | |
SI-9206 Fix REPL code indentation
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We talk about bit rot but not about how dust accumulates on
code that hasn't been swept since the last time the furniture
was moved around.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
But sans test.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Only for exactly `-Dscala.repl.info`, include the complete version
number string in the REPL prompt. One could imagine this is the mode
for posting snippets to stackoverflow.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
To make code in error messages line up with the original line of
code, templated code is indented by the width of the prompt.
Use the raw prompt (without ANSI escapes or newlines) to determine
the indentation.
Also, indent only once per line.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The scala shell prompt can be provided as either a system
property or in compiler.properties.
The prompt string is taken as a format string with one
argument that is the version string.
```
$ scala -Dscala.repl.prompt="%nScala %s> "
Welcome to Scala version 2.11.7-20150616-093756-43a56fb5a1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
Scala 2.11.7-20150616-093756-43a56fb5a1> 42
res0: Int = 42
Scala 2.11.7-20150616-093756-43a56fb5a1> :quit
```
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Previously, handy `sys.BooleanProp.keyExists` ignored the
property value. While trying not to make any real estate puns,
this commit will let it go false if a value is supplied that
is not true in the usual Java sense. But what is truth?
Allows `scala -Dscala.color=off`, for example.
|
| | |\ \ \ \
| | | | | | |
| | | | | | | |
Spec: Add lost references, cleanup
|
| | | | |_|/
| | | |/| | |
|
| | |\ \ \ \
| | | | | | |
| | | | | | | |
SI-9359 Fix InnerClass entry flags for nested Java enums
|
| | | | | | | |
|
| | | | |/ /
| | | |/| |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The access flags in InnerClass entries for nested Java enums were
basically completely off.
A first step is to use the recently introduced backend method
`javaClassfileFlags`, which is now moved to BCodeAsmCommon.
See its doc for an explanation.
Then the flags of the enum class symbol were off. An enum is
- final if none of its values has a class body
- abstract if it has an abstract method
(https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9)
When using the ClassfileParser:
- ENUM was never added. I guess that's just an oversight.
- ABSTRACT (together with SEALED) was always added. This is to
enable exhaustiveness checking, see 3f7b8b5. This is a hack and we
have to go through the class members in the backend to find out if
the enum actually has the `ACC_ABSTRACT` flag or not.
When using the JavaParser:
- FINAL was never added.
- ABSTRACT was never added.
This commit fixes all of the above and tests cases (Java enum read
from the classfile and from source).
|
| | |\ \ \ \
| | | |_|_|/
| | |/| | | |
SI-9253 avoid IndexOutOfBoundsException in TypeMaps.correspondingTypeArgument
|
| | |/ / / |
|
| | |\ \ \
| | | |_|/
| | |/| | |
Fix 36 typos (d-f)
|
| | |/ / |
|
| | |\ \
| | | | |
| | | | | |
Pin to non-crashy redcarpet
|