| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Adriaan and Jason agree that the test is failing because the test
itself needs reworking, not because it's showing a real problem.
so, disabling it for now in the interest of getting 2.12.0-M2 out
the door.
|
|\
| |
| | |
SI-9387 Fix VerifyError introduced by indylambda
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As with regular `Apply`-s, we should compute the generated type
based on the function's type, rather than the expected type.
In the test case, the expected type was void. Now, we correctly
use the generated type of `scala/Function1`, which is enough
to generate a subsequent POP instruction.
The tree shape involved was:
```
arg0 = {
{
$anonfun()
};
scala.runtime.BoxedUnit.UNIT
}
```
|
|\ \
| | |
| | | |
[indylambda] Improve test coverage
|
| | |
| | |
| | |
| | |
| | |
| | | |
- Add requisite boilerplate for test cleanup to IndyLambdaTest
- ... and to the spot where I copy/pasted the wrong code from
- Fix comment.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Adding tests for the selective use of boxing bridge methods
and to show that specialization is not subverted by indylambda.
Other aspects of indylambda are tested by tests like:
- run/lambda-serialization.scala
- run/indylambda-boxing
When those tests were written, they only tested the old backend.
However, now that we have Java 8 and the new backend avaialble
by default to partest, they provide the intended coverage.
|
|\ \
| | |
| | | |
Accessibility checks for methods with an InvokeDynamic instruction
|
| | |
| | |
| | |
| | |
| | |
| | | |
There are two cases tested here
- An indyLMF where the lambda body method is private
- An indy where the bootstrap method is not LMF
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Implements the necessary tests to check if a method with an
InvokeDynamic instruction can be inlined into a destination class.
Only InvokeDynamic instructions with LambdaMetaFactory as bootstrap
methods can be inlined. The accessibility checks cannot be implemented
generically, because it depends on what the bootstrap method is doing.
In particular, the bootstrap method receives a Lookup object as
argument which can be used to access private methods of the class
where the InvokeDynamic method is located.
A comment in the inliner explains the details.
|
|\| |
| |/
|/| |
Fix optimizer bugs and enable -Yopt:l:classpath when building scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Remove some unnecessary flags files
- neg/t4425.flags
- run/blame_eye_triple_eee-double.flags
- run/blame_eye_triple_eee-float.flags
Force tests that use -optimize to GenASM
- neg/sealed-final-neg.flags
- pos/inline-access-levels.flags
- pos/inliner2.flags
- pos/sealed-final.flags
- pos/t3420.flags
- pos/t8410.flags
- run/constant-optimization.flags
- run/dead-code-elimination.flags
- run/elidable-opt.flags
- run/finalvar.flags
- run/icode-reader-dead-code.scala
- run/optimizer-array-load.flags
- run/synchronized.flags
- run/t3509.flags
- run/t3569.flags
- run/t4285.flags
- run/t4935.flags
- run/t5789.scala
- run/t6188.flags
- run/t7459b-optimize.flags
- run/t7582.flags
- run/t7582b.flags
- run/t8601.flags
- run/t8601b.flags
- run/t8601c.flags
- run/t8601d.flags
- run/t8601e.flags
- run/t9003.flags
Move some tests to the new optimizer
- run/classfile-format-51.scala
- run/classfile-format-52.scala
- run/run-bug4840.flags
- run/t2106.flags
- run/t6102.flags
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
No change in build.sbt, there's no optimizer settings there yet.
Ignore the inliner warning in presentation/t7678 and run/t8029.scala,
noted in https://issues.scala-lang.org/browse/SI-9378
|
| |
| |
| |
| |
| |
| | |
When an instruction is its own producer or consumer, the
`initialProducer` / `ultimateConsumer` methods would loop.
While loops or @tailrec annotated methods can generate such bytecode.
|
| |
| |
| |
| |
| |
| |
| |
| | |
If the closure body method has return type Nothing$, add an `ATHROW`
instruction after the callsite. This is required for computing stack
map frames, as explained in a comment in BCodeBodyBuilder.adapt.
Similar for closure bodies with return type Null$.
|
|\ \
| | |
| | | |
SI-7514 Introduce Source.fromResource(...) method
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Creates Source from named classpath resource.
Simplifies
val src = io.Source.fromInputStream(classOf[ClassInst].getResourceAsStream("/name"))
to
val src = io.Source.fromClassPath("/name")
|
|\ \ \
| | | |
| | | | |
SI-9373 Restore the test for t8960 with IndyLamba enabled
|
| | |/
| |/| |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
Add support in scalap to parse new constant pool entries
- MethodHandle
- MethodType
- InvokeDynamic
Spec: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html
|
| |
| |
| |
| | |
Simplify and sweeten the message.
|
|/
|
|
|
|
| |
If the version string was empty, ScalaVersion would
indignantly refuse to initialize. Now it takes a missing
property as "none".
|
|
|
|
|
|
|
|
|
|
| |
According to the spec [1] the superclass of an interface is always
Object.
Restores the tests that were moved to pending in bf951ec1,
fixex part of SI-9374.
[1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move run/t8960 to pending
It tests the serialVersionUID field on closure classes. The field
doesn't exist for indyLambda closures.
See https://issues.scala-lang.org/browse/SI-9373
Move some reify tests to pending
They fail at runtime in GenBCode since scala is built with indyLambda
enabled:
java.lang.AssertionError: assertion failed: Bad superClass for trait JFunction1: class Any
at scala.tools.nsc.Global.assert(Global.scala:261)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:228)
Noted in https://issues.scala-lang.org/browse/SI-9374
force t6546 to GenASM - no closure elimination in GenBCode yet
Noted in https://issues.scala-lang.org/browse/SI-9364.
Fix or disable some tests that fail because of the old optimizer
The old inliner fails more often when the library is built with
indylambda.
Noted in https://issues.scala-lang.org/browse/SI-9374.
Example: List.foreach
➜ sandbox git:(jfun) ✗ qs -Ybackend:GenASM -optimize -Yinline-warnings
Welcome to Scala version 2.12.0-20150630-220939-1cb032d806 (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> List(1,2,3).foreach(x => x + 1)
<console>:11: warning: Could not inline required method foreach because bytecode unavailable.
List(1,2,3).foreach(x => x + 1)
^
<console>:11: warning: At the end of the day, could not inline @inline-marked method foreach
List(1,2,3).foreach(x => x + 1)
^
Upate a number of tests for having indyLambda enabled
The delambdafyLambdaClassNames tests was removed, there's nothing to
tests with indyLambda.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit e1895d64f87dc3c699a3ccbc8a3143b18d3b5bb1,
titled "Add scala-java8-compat to scala-library.jar".
Move SAM functions and `LambdaDeserializer` (from scala/scala-java8-compat@9253ed9)
into `scala.runtime.java8` package under `src/library`.
(The package name is the only diff -- they were in `scala.compat.java8` before).
The original LambdaDeserializer:
https://github.com/scala/scala-java8-compat/blob/c0732e6/src/main/java/scala/compat/java8/runtime/LambdaDeserializer.scala
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Java parser should not set the `DEFERRED` flag for
default methods or static methods in interfaces.
Their bytecode doesn't have it either.
Also tightens parsing of Java abstract methods to
disallow a method body.
Here's the log of how Lukas diagnosed this:
```
quick.bin:
...
BUILD FAILED
/Users/luc/scala/scala/build.xml:69: The following error occurred while executing this line:
...
/Users/luc/scala/scala/build-ant-macros.xml:350: Could not create type mk-bin due to
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at scala.sys.BooleanProp$.keyExists(BooleanProp.scala:72)
at scala.sys.SystemProperties$.bool(SystemProperties.scala:78)
at scala.sys.SystemProperties$.noTraceSupression$lzycompute(SystemProperties.scala:89)
at scala.sys.SystemProperties$.noTraceSupression(SystemProperties.scala:89)
at scala.util.control.NoStackTrace$.<init>(NoStackTrace.scala:31)
at scala.util.control.NoStackTrace$.<clinit>(NoStackTrace.scala)
at scala.util.control.NoStackTrace$class.fillInStackTrace(NoStackTrace.scala:22)
at scala.util.control.BreakControl.fillInStackTrace(Breaks.scala:94)
at java.lang.Throwable.<init>(Throwable.java:250)
at scala.util.control.BreakControl.<init>(Breaks.scala:94)
at scala.util.control.Breaks.<init>(Breaks.scala:29)
at scala.collection.Traversable$.<init>(Traversable.scala:95)
at scala.collection.Traversable$.<clinit>(Traversable.scala)
at scala.package$.<init>(package.scala:40)
at scala.package$.<clinit>(package.scala)
at scala.Predef$.<init>(Predef.scala:89)
at scala.Predef$.<clinit>(Predef.scala)
at scala.tools.ant.ScalaTool.<init>(ScalaTool.scala:58)
[...]
Caused by: java.lang.invoke.LambdaConversionException:
Incorrect number of parameters for static method invokeStatic
scala.sys.BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted:(String)Object;
0 captured parameters, 0 functional interface method parameters, 1 implementation parameters
at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
at java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:473)
at java.lang.invoke.CallSite.makeSite(CallSite.java:325)
```
[source code](https://github.com/scala/scala/blob/2.11.x/src/library/scala/sys/BooleanProp.scala#L72):
```
s => s == "" || s.equalsIgnoreCase("true")
```
bytecode:
```
INVOKEDYNAMIC $init$()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:
()V,
// handle kind 0x6 : INVOKESTATIC
scala/sys/BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted(Ljava/lang/String;)Ljava/lang/Object;,
(Ljava/lang/String;)Ljava/lang/Object;,
3,
1,
Lscala/Serializable;.class,
0
]
CHECKCAST scala/Function1
```
The mistake seems to be that the Scala compiler incorrectly selects `$init$`
([which is a default method](https://github.com/scala/scala/blob/640ffe7fceb5d573b2c12a7c7da09bfd751036a0/src/library/scala/compat/java8/JFunction1.java#L10))
as the abstract method of `JFunction1`, whereas it should be `apply` (inherited from `Function1`).
Since we're doing mixed compilation, this is almost certainly a problem of the Java parser.
|
|\
| |
| | |
Fix size update on `mutable.TreeMap#clear()`
|
| |
| |
| |
| |
| |
| | |
The previous implementation has a major bug - although `clear()` sets the root node to `null`, the `size` attribute of the `Tree` was not updated. This effectively meant that even after a `map.clear()`, a call to `map.size` would still yield the old size of the map.
The scalacheck test suite was updated to contemplate this issue.
|
|\ \
| |/
|/| |
|
| |\
| | |
| | | |
Fix 8 typos (j-l)
|
| | | |
|
| |\ \
| | |/
| |/| |
Closure elimination for new backend
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | | |
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
|
|\ \ \ \
| |/ / /
|/| / /
| |/ / |
|
| |\ \
| | | |
| | | | |
Fix 25 typos (g-i)
|
| | |/ |
|
| |\ \
| | | |
| | | | |
SI-9206 Fix REPL code indentation
|
| | | |
| | | |
| | | |
| | | | |
But sans test.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| |\ \ \
| | |_|/
| |/| | |
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).
|