| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Introduce a cache to remember which methods have maxLocals and
maxStack already computed. Before we were computing these values
on every run of eliminateUnreachableCode.
Also update the implementation of eliminateUnreachableCode to keep
correct max values.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The call graph holds an argInfos field for every callsite, which
contains additional information about the argument passed to the
callee. For example, an argInfo specifies if the argument is a
function literal or a parameter of the callsite method.
Computing the argInfo requires running an ASM analyzer, which is not
cheap. This change assembles the argInfos for callsites that are
created or changed by the inliner / closure optimizer from the
available information instead of just running the analyzer again.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Because that's what the field holds: the parameter types that are SAM
types.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Make InlinerHeuristics a backend component like the others, instead
of nested within the Inliner component.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Remember in the call graph if a function literal is passed as an
argument to a higher-order function.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
For higher order methods, the call graph contains a map from
parameter positions to SAM types.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Inline requests have a list of post-inline requests: callsites within
the inlined method that should be inlined into the initial callee.
This commit changes the inliner to actually perform post-inline
requests.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The computed value was too large previously: inlining stores receiver
and argument values of the inlined method into locals.
A too large value doesn't cause any bugs, but data flow analyses would
allocate too large frames.
The test (InlinerTest.maxLocalsMaxStackAfterInline) didn't catch the
bug because it tested the methods of the wrong ClassNode. The
CodeGenTools.compileClasses method returns a ClassNode that is created
from the classfile byte array emitted by the compiler. This ClassNode
is a new object and unrelated to the ClassNode used in the compiler
backend. The test now takes the correct ClassNode from the hash map in
the backend's byteCodeRepository.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
If a class (trait) is a SAM type, store the name and descriptor of the
SAM in the ClassBType's InlineInfo.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Store classes being compiled in a separate hash map. This allows
efficiently traversing all classes being compiled. It also simplifies
limiting the size of the cache of class nodes parsed from classfiles.
Also change the cache of class nodes parsed from classfiles to LRU
instead of FIFO.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Change the hash maps in the call graph to index callsites and
closure instantiations by the containing method. This is beneficial
for implementing inliner heuristics and the closure optimizer.
|
|\ \ \ \
| | | | |
| | | | | |
SI-9473 Cleaner references to statically owned symbols
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Ever wonder why `identity("")` typechecks to
`scala.this.Predef.identity("")`?
It turns out that `mkAttributedRef` was importing
`q"$scalaPackageClass.this.Predef._"` for all these years,
rather than `q"$scalaModule.Predef._"`.
This commit makes `mkAttributedRef` special case static owners
by referring the the corresponding module, instead.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8647 Used immutable scheme for mutable.BitSet to resolve canBuildFrom
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
mutable.BitSet had a conflict between its own implicit canBuildFrom and the one inherited from SortedSetFactory in mutable.SortedSet.
The immutable hierarchy already had a workaround; this just copies it on the mutable side.
Test written to verify compilation.
|
|\ \ \ \
| |_|/ /
|/| | | |
Preparation for using default methods in traits
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A DefDef owned by a trait may now have have a method body.
Such a method must be emitted without ACC_ABSTRACT, and
with the code attribute.
Tested by intercepting the compile pipeline and adding the
DEFAULTMETHOD flag and a method body before running
the backend.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
only trivial merge conflicts here.
not dealing with PR #4333 in this merge because there is a substantial
conflict there -- so that's why I stopped at
63daba33ae99471175e9d7b20792324615f5999b for now
|
|\ \ \
| | | |
| | | | |
SI-9379 Added toString to .zipped to allow Stream etc to short-circuit
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
Tuple2Zipped and Tuple3Zipped would try to compute a hash code when .toString was called on them. This overrides toString to print (collection1, collection2).zipped instead, using the collection's own toString method. This allows collections that have a toString but not a hashCode (such as Iterator.from(0) and s = 1 #:: s) to print out as they usually do.
JUnit test to verify the deferral to collections' .toString.
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
nicolasstucki/2.12.x-ScalaRunntime-fix-for-Scala.js
Remove unnecessary dependency on parallel collections in ScalaRunTime.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In method `ScalaRuntime.stringOf(arg: Any, maxElements: Int)` there are
`case x: Iterable[_]` and `case x: ParIterable[_]` which have the excat
same code that only uses the `GenIterable[_]` API on `x`. Therfore they
can be replaced by a single `case x: GenIterable[_]`.
The `case x: ParIterable[_]` was added because prevoiusly parallel
colections would only match `case x = x.toSting()` which ignores the
`maxElements` parameter. This was still the case for other `GenIterable[_]`.
Using `case x: GenIterable[_]` will cover those cases as well.
This change is required for Scala.js compatibility as it does not
support parallel collections.
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
The previous implementation of `mutable.TreeSet` uses a mutable reference to an immutable red-black tree as its underlying data structure. That leads to unnecessary objects being created, which can be a problem in systems with limited resources. It also has reduced performance when compared with common mutable implementations.
In this commit `mutable.TreeSet` is changed so that it uses the recently created `mutable.RedBlackTree` as its underlying data structure. Specialized red-black tree methods were created for working with keys for efficiency reasons. The new implementation is source-compatible with the previous one, although its serialized representation obviously changes.
Closes [SI-6938](https://issues.scala-lang.org/browse/SI-6938).
|
|\ \
| | |
| | | |
SI-9393 fix modifiers of ClassBTypes for Java annotations
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Adds query methods to the public reflection API for querying the
JAVA_ENUM and JAVA_ANNOTATION flags.
Didn't include JAVA_DEFAULTMETHOD because it does not correspond
to a real java classfile flag (just a non-abstract method in an
interface), and we want to clean the usage of this flag before adding
it to a public API.
The flags themselfs are not added to the reflection API. A comment in
api/FlagSets.scala says:
Q: I have a pretty flag. Can I put it here?
A: Only if there's a tree that cannot be built without it.
If you want to put a flag here so that it can be tested
against, introduce an `isXXX` method in one of the api.Symbols
classes instead.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The Scala classfile and java source parsers make Java annotation
classes (which are actually interfaces at the classfile level) look
like Scala annotation classes:
- the INTERFACE / ABSTRACT flags are not added
- scala.annotation.Annotation is added as superclass
- scala.annotation.ClassfileAnnotation is added as interface
This makes type-checking @Annot uniform, whether it is defined in Java
or Scala.
This is a hack that leads to various bugs (SI-9393, SI-9400). Instead
the type-checking should be special-cased for Java annotations.
This commit fixes SI-9393 and a part of SI-9400, but it's still easy
to generate invalid classfiles. Restores the assertions that were
disabled in #4621. I'd like to leave these assertions in: they
are valuable and helped uncovering the issue being fixed here.
A new flag JAVA_ANNOTATION is introduced for Java annotation
ClassSymbols, similar to the existing ENUM flag. When building
ClassBTypes for Java annotations, the flags, superclass and interfaces
are recovered to represent the situation in the classfile.
Cleans up and documents the flags space in the area of "late" and
"anti" flags.
The test for SI-9393 is extended to test both the classfile and the
java source parser.
|
|\ \ \
| | | |
| | | | |
SI-8911 allow serializing Scala Maps wrapped as Java ones
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Added `with Serializable` to `MapWrapper` and `SetWrapper`.
Test verifies that serialization works in the simplest case.
Also updated tests in t8549 to check that serialization works and doesn't change.
|
|\ \ \
| |/ /
|/| /
| |/ |
merge/2.11.x-to-2.12.x-20152307
|
| | |
|
|\ \
| | |
| | | |
add test coverage for SI-8627 (Stream.filterNot)
|
| | | |
|
|\ \ \
| | | |
| | | | |
Merge 2.11.x to 2.12.x [ci: last-only]
|
| |\ \ \
| | |/ /
| |/| /
| | |/
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
merge/2.11.x-to-2.12.x-20150713
Conflicts:
src/eclipse/partest/.classpath
src/eclipse/repl/.classpath
test/files/run/nothingTypeNoFramesNoDce.scala
test/files/run/repl-javap-app.check
Also fixup two .classpath files with updated partest, xml and
parser combinators JARs.
|
| | | |
|
|\ \ \
| | | |
| | | | |
[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
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
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")
|
| | |
| | |
| | |
| | | |
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".
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|